@netlify/agent-runner-cli 1.168.1-claude-compaction.0 → 1.168.2-claude-compaction.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/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __cr } from 'node:module'; import { fileURLToPath as __ftu } from 'node:url'; import { dirname as __dnn } from 'node:path'; const require = __cr(import.meta.url); const __filename = __ftu(import.meta.url); const __dirname = __dnn(__filename);
2
- var Iye=Object.create;var iE=Object.defineProperty;var Pye=Object.getOwnPropertyDescriptor;var Oye=Object.getOwnPropertyNames;var Nye=Object.getPrototypeOf,kye=Object.prototype.hasOwnProperty;var Z=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var A=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ar=(t,e)=>{for(var r in e)iE(t,r,{get:e[r],enumerable:!0})},GV=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oye(e))!kye.call(t,i)&&i!==r&&iE(t,i,{get:()=>e[i],enumerable:!(n=Pye(e,i))||n.enumerable});return t};var fn=(t,e,r)=>(r=t!=null?Iye(Nye(t)):{},GV(e||!t||!t.__esModule?iE(r,"default",{value:t,enumerable:!0}):r,t)),Nr=t=>GV(iE({},"__esModule",{value:!0}),t);var zo,_P=A(()=>{"use strict";zo="1.9.1"});function Mye(t){let e=new Set([t]),r=new Set,n=t.match(qV);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(c){return c===t};function o(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(r.has(c))return!1;let l=c.match(qV);if(!l)return o(c);let u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||i.major!==u.major?o(c):i.major===0?i.minor===u.minor&&i.patch<=u.patch?s(c):o(c):i.minor<=u.minor?s(c):o(c)}}var qV,VV,HV=A(()=>{"use strict";_P();qV=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;VV=Mye(zo)});function ji(t,e,r,n=!1){var i;let o=Sm[ym]=(i=Sm[ym])!==null&&i!==void 0?i:{version:zo};if(!n&&o[t]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return r.error(s.stack||s.message),!1}if(o.version!==zo){let s=new Error(`@opentelemetry/api: Registration of version v${o.version} for ${t} does not match previously registered API v${zo}`);return r.error(s.stack||s.message),!1}return o[t]=e,r.debug(`@opentelemetry/api: Registered a global for ${t} v${zo}.`),!0}function pn(t){var e,r;let n=(e=Sm[ym])===null||e===void 0?void 0:e.version;if(!(!n||!VV(n)))return(r=Sm[ym])===null||r===void 0?void 0:r[t]}function zi(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${zo}.`);let r=Sm[ym];r&&delete r[t]}var Dye,ym,Sm,Vc=A(()=>{"use strict";_P();HV();Dye=zo.split(".")[0],ym=Symbol.for(`opentelemetry.js.api.${Dye}`),Sm=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Em(t,e,r){let n=pn("diag");if(n)return n[t](e,...r)}var oE,WV=A(()=>{"use strict";Vc();oE=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Em("debug",this._namespace,e)}error(...e){return Em("error",this._namespace,e)}info(...e){return Em("info",this._namespace,e)}warn(...e){return Em("warn",this._namespace,e)}verbose(...e){return Em("verbose",this._namespace,e)}}});var Ke,sE=A(()=>{"use strict";(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"})(Ke||(Ke={}))});function YV(t,e){t<Ke.NONE?t=Ke.NONE:t>Ke.ALL&&(t=Ke.ALL),e=e||{};function r(n,i){let o=e[n];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:r("error",Ke.ERROR),warn:r("warn",Ke.WARN),info:r("info",Ke.INFO),debug:r("debug",Ke.DEBUG),verbose:r("verbose",Ke.VERBOSE)}}var KV=A(()=>{"use strict";sE()});var Lye,Wt,Hc=A(()=>{"use strict";WV();KV();sE();Vc();Lye="diag",Wt=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(i){return function(...o){let s=pn("diag");if(s)return s[i](...o)}}let r=this,n=(i,o={logLevel:Ke.INFO})=>{var s,a,c;if(i===r){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=d.stack)!==null&&s!==void 0?s:d.message),!1}typeof o=="number"&&(o={logLevel:o});let l=pn("diag"),u=YV((a=o.logLevel)!==null&&a!==void 0?a:Ke.INFO,i);if(l&&!o.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),u.warn(`Current logger will overwrite one already registered from ${d}`)}return ji("diag",u,r,!0)};r.setLogger=n,r.disable=()=>{zi(Lye,r)},r.createComponentLogger=i=>new oE(i),r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}}});var aE,ZV=A(()=>{"use strict";aE=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let r=this._entries.get(e);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,r){let n=new t(this._entries);return n._entries.set(e,r),n}removeEntry(e){let r=new t(this._entries);return r._entries.delete(e),r}removeEntries(...e){let r=new t(this._entries);for(let n of e)r._entries.delete(n);return r}clear(){return new t}}});var JV,XV=A(()=>{"use strict";JV=Symbol("BaggageEntryMetadata")});function QV(t={}){return new aE(new Map(Object.entries(t)))}function Hu(t){return typeof t!="string"&&($ye.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:JV,toString(){return t}}}var $ye,yP=A(()=>{"use strict";Hc();ZV();XV();$ye=Wt.instance()});function Yt(t){return Symbol.for(t)}var SP,cE,vm=A(()=>{"use strict";SP=class t{constructor(e){let r=this;r._currentContext=e?new Map(e):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{let o=new t(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=n=>{let i=new t(r._currentContext);return i._currentContext.delete(n),i}}},cE=new SP});var EP,vP,lE,eH=A(()=>{"use strict";EP=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],vP={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(vP[e]=console[e])}lE=class{constructor(){function e(r){return function(...n){let i=vP[r];if(typeof i!="function"&&(i=vP.log),typeof i!="function"&&console&&(i=console[r],typeof i!="function"&&(i=console.log)),typeof i=="function")return i.apply(console,n)}}for(let r=0;r<EP.length;r++)this[EP[r].n]=e(EP[r].c)}}});function ta(){return PP}var TP,Wu,bP,AP,wP,xP,Tm,RP,CP,IP,PP,Uye,Fye,Bye,jye,zye,Gye,qye,OP=A(()=>{"use strict";TP=class{constructor(){}createGauge(e,r){return Fye}createHistogram(e,r){return Bye}createCounter(e,r){return Uye}createUpDownCounter(e,r){return jye}createObservableGauge(e,r){return Gye}createObservableCounter(e,r){return zye}createObservableUpDownCounter(e,r){return qye}addBatchObservableCallback(e,r){}removeBatchObservableCallback(e){}},Wu=class{},bP=class extends Wu{add(e,r){}},AP=class extends Wu{add(e,r){}},wP=class extends Wu{record(e,r){}},xP=class extends Wu{record(e,r){}},Tm=class{addCallback(e){}removeCallback(e){}},RP=class extends Tm{},CP=class extends Tm{},IP=class extends Tm{},PP=new TP,Uye=new bP,Fye=new wP,Bye=new xP,jye=new AP,zye=new RP,Gye=new CP,qye=new IP});var Go,tH=A(()=>{"use strict";(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(Go||(Go={}))});var uE,dE,NP=A(()=>{"use strict";uE={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},dE={set(t,e,r){t!=null&&(t[e]=r)}}});var fE,rH=A(()=>{"use strict";vm();fE=class{active(){return cE}with(e,r,n,...i){return r.call(n,...i)}bind(e,r){return r}enable(){return this}disable(){return this}}});var kP,Vye,Gi,bm=A(()=>{"use strict";rH();Vc();Hc();kP="context",Vye=new fE,Gi=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return ji(kP,e,Wt.instance())}active(){return this._getContextManager().active()}with(e,r,n,...i){return this._getContextManager().with(e,r,n,...i)}bind(e,r){return this._getContextManager().bind(e,r)}_getContextManager(){return pn(kP)||Vye}disable(){this._getContextManager().disable(),zi(kP,Wt.instance())}}});var Ct,MP=A(()=>{"use strict";(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Ct||(Ct={}))});var Am,wm,Yu,pE=A(()=>{"use strict";MP();Am="0000000000000000",wm="00000000000000000000000000000000",Yu={traceId:wm,spanId:Am,traceFlags:Ct.NONE}});var qi,hE=A(()=>{"use strict";pE();qi=class{constructor(e=Yu){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,r){return this}setAttributes(e){return this}addEvent(e,r){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,r){}}});function mE(t){return t.getValue(DP)||void 0}function nH(){return mE(Gi.getInstance().active())}function xm(t,e){return t.setValue(DP,e)}function iH(t){return t.deleteValue(DP)}function oH(t,e){return xm(t,new qi(e))}function gE(t){var e;return(e=mE(t))===null||e===void 0?void 0:e.spanContext()}var DP,LP=A(()=>{"use strict";vm();hE();bm();DP=Yt("OpenTelemetry Context Key SPAN")});function sH(t,e){if(typeof t!="string"||t.length!==e)return!1;let r=0;for(let n=0;n<t.length;n+=4)r+=(_E[t.charCodeAt(n)]|0)+(_E[t.charCodeAt(n+1)]|0)+(_E[t.charCodeAt(n+2)]|0)+(_E[t.charCodeAt(n+3)]|0);return r===e}function Rm(t){return sH(t,32)&&t!==wm}function $P(t){return sH(t,16)&&t!==Am}function Wr(t){return Rm(t.traceId)&&$P(t.spanId)}function aH(t){return new qi(t)}var _E,yE=A(()=>{"use strict";pE();hE();_E=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 Hye(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 UP,Ku,FP=A(()=>{"use strict";bm();LP();hE();yE();UP=Gi.getInstance(),Ku=class{startSpan(e,r,n=UP.active()){if(!!r?.root)return new qi;let o=n&&gE(n);return Hye(o)&&Wr(o)?new qi(o):new qi}startActiveSpan(e,r,n,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);let c=s??UP.active(),l=this.startSpan(e,o,c),u=xm(c,l);return UP.with(u,a,void 0,l)}}});var Wye,Zu,BP=A(()=>{"use strict";FP();Wye=new Ku,Zu=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}startSpan(e,r,n){return this._getTracer().startSpan(e,r,n)}startActiveSpan(e,r,n,i){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,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):Wye}}});var SE,cH=A(()=>{"use strict";FP();SE=class{getTracer(e,r,n){return new Ku}}});var Yye,Wc,jP=A(()=>{"use strict";BP();cH();Yye=new SE,Wc=class{getTracer(e,r,n){var i;return(i=this.getDelegateTracer(e,r,n))!==null&&i!==void 0?i:new Zu(this,e,r,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Yye}setDelegate(e){this._delegate=e}getDelegateTracer(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,r,n)}}});var Yc,lH=A(()=>{"use strict";(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Yc||(Yc={}))});var oi,uH=A(()=>{"use strict";(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"})(oi||(oi={}))});var Er,dH=A(()=>{"use strict";(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Er||(Er={}))});function fH(t){return Jye.test(t)}function pH(t){return Xye.test(t)&&!Qye.test(t)}var zP,Kye,Zye,Jye,Xye,Qye,hH=A(()=>{"use strict";zP="[_0-9a-z-*/]",Kye=`[a-z]${zP}{0,255}`,Zye=`[a-z0-9]${zP}{0,240}@[a-z]${zP}{0,13}`,Jye=new RegExp(`^(?:${Kye}|${Zye})$`),Xye=/^[ -~]{0,255}[!-~]$/,Qye=/,|=/});var mH,eSe,gH,_H,EE,yH=A(()=>{"use strict";hH();mH=32,eSe=512,gH=",",_H="=",EE=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,r)=>(e.push(r+_H+this.get(r)),e),[]).join(gH)}_parse(e){e.length>eSe||(this._internalState=e.split(gH).reduceRight((r,n)=>{let i=n.trim(),o=i.indexOf(_H);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);fH(s)&&pH(a)&&r.set(s,a)}return r},new Map),this._internalState.size>mH&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,mH))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function SH(t){return new EE(t)}var EH=A(()=>{"use strict";yH()});var pt,vH=A(()=>{"use strict";bm();pt=Gi.getInstance()});var J,TH=A(()=>{"use strict";Hc();J=Wt.instance()});var GP,bH,AH=A(()=>{"use strict";OP();GP=class{getMeter(e,r,n){return PP}},bH=new GP});var qP,vE,wH=A(()=>{"use strict";AH();Vc();Hc();qP="metrics",vE=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return ji(qP,e,Wt.instance())}getMeterProvider(){return pn(qP)||bH}getMeter(e,r,n){return this.getMeterProvider().getMeter(e,r,n)}disable(){zi(qP,Wt.instance())}}});var Cm,xH=A(()=>{"use strict";wH();Cm=vE.getInstance()});var TE,RH=A(()=>{"use strict";TE=class{inject(e,r){}extract(e,r){return e}fields(){return[]}}});function HP(t){return t.getValue(VP)||void 0}function CH(){return HP(Gi.getInstance().active())}function IH(t,e){return t.setValue(VP,e)}function PH(t){return t.deleteValue(VP)}var VP,OH=A(()=>{"use strict";bm();vm();VP=Yt("OpenTelemetry Baggage Key")});var WP,tSe,bE,NH=A(()=>{"use strict";Vc();RH();NP();OH();yP();Hc();WP="propagation",tSe=new TE,bE=class t{constructor(){this.createBaggage=QV,this.getBaggage=HP,this.getActiveBaggage=CH,this.setBaggage=IH,this.deleteBaggage=PH}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return ji(WP,e,Wt.instance())}inject(e,r,n=dE){return this._getGlobalPropagator().inject(e,r,n)}extract(e,r,n=uE){return this._getGlobalPropagator().extract(e,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){zi(WP,Wt.instance())}_getGlobalPropagator(){return pn(WP)||tSe}}});var kr,kH=A(()=>{"use strict";NH();kr=bE.getInstance()});var YP,AE,MH=A(()=>{"use strict";Vc();jP();yE();LP();Hc();YP="trace",AE=class t{constructor(){this._proxyTracerProvider=new Wc,this.wrapSpanContext=aH,this.isSpanContextValid=Wr,this.deleteSpan=iH,this.getSpan=mE,this.getActiveSpan=nH,this.getSpanContext=gE,this.setSpan=xm,this.setSpanContext=oH}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let r=ji(YP,this._proxyTracerProvider,Wt.instance());return r&&this._proxyTracerProvider.setDelegate(e),r}getTracerProvider(){return pn(YP)||this._proxyTracerProvider}getTracer(e,r){return this.getTracerProvider().getTracer(e,r)}disable(){zi(YP,Wt.instance()),this._proxyTracerProvider=new Wc}}});var ot,DH=A(()=>{"use strict";MH();ot=AE.getInstance()});var ra={};ar(ra,{DiagConsoleLogger:()=>lE,DiagLogLevel:()=>Ke,INVALID_SPANID:()=>Am,INVALID_SPAN_CONTEXT:()=>Yu,INVALID_TRACEID:()=>wm,ProxyTracer:()=>Zu,ProxyTracerProvider:()=>Wc,ROOT_CONTEXT:()=>cE,SamplingDecision:()=>Yc,SpanKind:()=>oi,SpanStatusCode:()=>Er,TraceFlags:()=>Ct,ValueType:()=>Go,baggageEntryMetadataFromString:()=>Hu,context:()=>pt,createContextKey:()=>Yt,createNoopMeter:()=>ta,createTraceState:()=>SH,default:()=>rSe,defaultTextMapGetter:()=>uE,defaultTextMapSetter:()=>dE,diag:()=>J,isSpanContextValid:()=>Wr,isValidSpanId:()=>$P,isValidTraceId:()=>Rm,metrics:()=>Cm,propagation:()=>kr,trace:()=>ot});var rSe,Se=A(()=>{"use strict";yP();vm();eH();sE();OP();tH();NP();BP();jP();lH();uH();dH();MP();EH();yE();pE();vH();TH();xH();kH();DH();rSe={context:pt,diag:J,metrics:Cm,propagation:kr,trace:ot}});var UH=A(()=>{"use strict"});var FH=A(()=>{"use strict";UH()});var BH=A(()=>{"use strict"});var jH=A(()=>{"use strict";BH()});var KP,wE,zH,xE,GH,Vo,Ju,Ho,Wo,qH=A(()=>{"use strict";KP="error.type",wE="exception.message",zH="exception.stacktrace",xE="exception.type",GH="service.name",Vo="telemetry.sdk.language",Ju="nodejs",Ho="telemetry.sdk.name",Wo="telemetry.sdk.version"});var VH=A(()=>{"use strict"});var HH=A(()=>{"use strict"});var Kc=A(()=>{"use strict";FH();jH();qH();VH();HH()});var o0=v(ME=>{"use strict";Object.defineProperty(ME,"__esModule",{value:!0});ME.AbstractAsyncHooksContextManager=void 0;var SSe=Z("events"),ESe=["addListener","on","once","prependListener","prependOnceListener"],i0=class{bind(e,r){return r instanceof SSe.EventEmitter?this._bindEventEmitter(e,r):typeof r=="function"?this._bindFunction(e,r):r}_bindFunction(e,r){let n=this,i=function(...o){return n.with(e,()=>r.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),i}_bindEventEmitter(e,r){return this._getPatchMap(r)!==void 0||(this._createPatchMap(r),ESe.forEach(i=>{r[i]!==void 0&&(r[i]=this._patchAddListener(r,r[i],e))}),typeof r.removeListener=="function"&&(r.removeListener=this._patchRemoveListener(r,r.removeListener)),typeof r.off=="function"&&(r.off=this._patchRemoveListener(r,r.off)),typeof r.removeAllListeners=="function"&&(r.removeAllListeners=this._patchRemoveAllListeners(r,r.removeAllListeners))),r}_patchRemoveListener(e,r){let n=this;return function(i,o){let s=n._getPatchMap(e)?.[i];if(s===void 0)return r.call(this,i,o);let a=s.get(o);return r.call(this,i,a||o)}}_patchRemoveAllListeners(e,r){let n=this;return function(i){let o=n._getPatchMap(e);return o!==void 0&&(arguments.length===0?n._createPatchMap(e):o[i]!==void 0&&delete o[i]),r.apply(this,arguments)}}_patchAddListener(e,r,n){let i=this;return function(o,s){if(i._wrapped)return r.call(this,o,s);let a=i._getPatchMap(e);a===void 0&&(a=i._createPatchMap(e));let c=a[o];c===void 0&&(c=new WeakMap,a[o]=c);let l=i.bind(n,s);c.set(s,l),i._wrapped=!0;try{return r.call(this,o,l)}finally{i._wrapped=!1}}}_createPatchMap(e){let r=Object.create(null);return e[this._kOtListeners]=r,r}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};ME.AbstractAsyncHooksContextManager=i0});var i6=v(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.AsyncHooksContextManager=void 0;var vSe=(Se(),Nr(ra)),TSe=Z("async_hooks"),bSe=o0(),s0=class extends bSe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=TSe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??vSe.ROOT_CONTEXT}with(e,r,n,...i){this._enterContext(e);try{return r.call(n,...i)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,r){if(r==="TIMERWRAP")return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let r=this._contexts.get(e);r!==void 0&&this._enterContext(r)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};DE.AsyncHooksContextManager=s0});var o6=v(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE.AsyncLocalStorageContextManager=void 0;var ASe=(Se(),Nr(ra)),wSe=Z("async_hooks"),xSe=o0(),a0=class extends xSe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new wSe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??ASe.ROOT_CONTEXT}with(e,r,n,...i){let o=n==null?r:r.bind(n);return this._asyncLocalStorage.run(e,o,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};LE.AsyncLocalStorageContextManager=a0});var s6=v(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.AsyncLocalStorageContextManager=td.AsyncHooksContextManager=void 0;var RSe=i6();Object.defineProperty(td,"AsyncHooksContextManager",{enumerable:!0,get:function(){return RSe.AsyncHooksContextManager}});var CSe=o6();Object.defineProperty(td,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return CSe.AsyncLocalStorageContextManager}})});function $E(t){return t.setValue(c0,!0)}function a6(t){return t.deleteValue(c0)}function rd(t){return t.getValue(c0)===!0}var c0,km=A(()=>{"use strict";Se();c0=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});var UE,c6=A(()=>{"use strict";UE="baggage"});function f6(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?",":""}${r}`;return n.length>8192?e:n},"")}function p6(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function h6(t){if(!t)return;let e=t.indexOf(";"),r=e===-1?t:t.substring(0,e),n=r.indexOf("=");if(n<=0)return;let i=r.substring(0,n).trim(),o=r.substring(n+1).trim();if(!i||!o)return;let s,a;try{s=decodeURIComponent(i),a=decodeURIComponent(o)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=Hu(l)}return{key:s,value:a,metadata:c}}function l0(t,e,r,n){let i=0;for(;i<t.length&&r<180;){let o=t.indexOf(",",i),s=o===-1?t.length:o,a=s-i;if(a<=4096){let c=h6(t.substring(i,s));if(c){let l=(r===0?0:1)+a;if(n+l>8192)break;e[c.key]=c.metadata?{value:c.value,metadata:c.metadata}:{value:c.value},r++,n+=l}}if(o===-1)break;i=o+1}return[r,n]}function m6(t){let e={};return typeof t=="string"&&t.length>0&&t.split(",").forEach(r=>{let n=h6(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}var u0=A(()=>{"use strict";Se()});var FE,g6=A(()=>{"use strict";Se();km();c6();u0();FE=class{inject(e,r,n){let i=kr.getBaggage(e);if(!i||rd(e))return;let o=p6(i).filter(a=>a.length<=4096).slice(0,180),s=f6(o);s.length>0&&n.set(r,UE,s)}extract(e,r,n){let i=n.get(r,UE);if(!i)return e;let o={},s=0,a=0;if(Array.isArray(i))for(let c=0;c<i.length;c++)[s,a]=l0(i[c],o,s,a);else[s]=l0(i,o,s,a);return s===0?e:kr.setBaggage(e,kr.createBaggage(o))}fields(){return[UE]}}});var BE,_6=A(()=>{"use strict";BE=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}});function y6(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!OSe(r)){J.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!d0(n)){J.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function OSe(t){return typeof t=="string"&&t!==""}function d0(t){return t==null?!0:Array.isArray(t)?NSe(t):S6(typeof t)}function NSe(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(S6(n)){e=n;continue}return!1}return!1}}return!0}function S6(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}var E6=A(()=>{"use strict";Se()});function jE(){return t=>{J.error(kSe(t))}}function kSe(t){return typeof t=="string"?t:JSON.stringify(MSe(t))}function MSe(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}var f0=A(()=>{"use strict";Se()});function T6(t){v6=t}function b6(t){try{v6(t)}catch{}}var v6,A6=A(()=>{"use strict";f0();v6=jE()});import{inspect as w6}from"util";function Ot(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){J.warn(`Unknown value ${w6(e)} for ${t}, expected a number, using defaults`);return}return r}function Zc(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}function zE(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||J.warn(`Unknown value ${w6(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function GE(t){return Zc(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}var x6=A(()=>{"use strict";Se()});var qE,R6=A(()=>{"use strict";qE=globalThis});var C6,I6=A(()=>{"use strict";C6="2.9.0"});var P6,O6=A(()=>{"use strict";P6="process.runtime.name"});var VE,N6=A(()=>{"use strict";I6();Kc();O6();VE={[Ho]:"opentelemetry",[P6]:"node",[Vo]:Ju,[Wo]:C6}});var ia,k6=A(()=>{"use strict";x6();R6();N6();ia=performance});var p0=A(()=>{"use strict";k6()});function nd(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*LSe);return[r,n]}function D6(){return ia.timeOrigin}function h0(t){let e=nd(ia.timeOrigin),r=nd(typeof t=="number"?t:ia.now());return m0(e,r)}function L6(t){if(HE(t))return t;if(typeof t=="number")return t<ia.timeOrigin/2?h0(t):nd(t);if(t instanceof Date)return nd(t.getTime());throw TypeError("Invalid input type")}function $6(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=Mm),[r,n]}function U6(t){let e=M6,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}function F6(t){return t[0]*Mm+t[1]}function B6(t){return t[0]*1e6+t[1]/1e3}function j6(t){return t[0]*1e3+t[1]/1e6}function z6(t){return t[0]+t[1]/Mm}function HE(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function G6(t){return HE(t)||typeof t=="number"||t instanceof Date}function m0(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=Mm&&(r[1]-=Mm,r[0]+=1),r}var M6,DSe,LSe,Mm,q6=A(()=>{"use strict";p0();M6=9,DSe=6,LSe=Math.pow(10,DSe),Mm=Math.pow(10,M6)});function V6(t){typeof t!="number"&&t.unref()}var H6=A(()=>{"use strict"});var WE,W6=A(()=>{"use strict";(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(WE||(WE={}))});var YE,Y6=A(()=>{"use strict";Se();YE=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let r=new Set;for(let n of this._propagators){let i=typeof n.fields=="function"?n.fields():[];for(let o of i)r.add(o)}this._fields=Array.from(r)}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){J.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){J.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}});function _0(t){return FSe.test(t)}function y0(t){return BSe.test(t)&&!jSe.test(t)}var g0,$Se,USe,FSe,BSe,jSe,K6=A(()=>{"use strict";g0="[_0-9a-z-*/]",$Se=`[a-z]${g0}{0,255}`,USe=`[a-z0-9]${g0}{0,240}@[a-z]${g0}{0,13}`,FSe=new RegExp(`^(?:${$Se}|${USe})$`),BSe=/^[ -~]{0,255}[!-~]$/,jSe=/,|=/});var zSe,Z6,J6,X6,id,S0=A(()=>{"use strict";K6();zSe=32,Z6=512,J6=",",X6="=",id=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!_0(e)||!y0(r))return this;let n=this._getState(),i=n.get(e),o=this._length;if(typeof i=="string"?o+=r.length-i.length:o+=e.length+r.length+(n.size>0?2:1),o>Z6)return this;let s=new Map(n);return s.delete(e),s.set(e,r),this._fromState(s,o)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let o=new Map(r);return o.delete(e),this._fromState(o,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=J6+e),e=`${n[0]}${X6}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(J6),r=new Map,n=0;for(let i of e){let o=i.trim(),s=o.indexOf(X6);if(s===-1)continue;let a=o.slice(0,s),c=o.slice(s+1);if(!_0(a)||!y0(c))continue;let l=n+o.length+(r.size>0?1:0);if(!(l>Z6)&&(r.set(a,c),n=l,r.size>=zSe))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}}});function E0(t){let e=YSe.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Dm,Lm,GSe,qSe,VSe,HSe,WSe,YSe,KE,Q6=A(()=>{"use strict";Se();km();S0();Dm="traceparent",Lm="tracestate",GSe="00",qSe="(?!ff)[\\da-f]{2}",VSe="(?![0]{32})[\\da-f]{32}",HSe="(?![0]{16})[\\da-f]{16}",WSe="[\\da-f]{2}",YSe=new RegExp(`^\\s?(${qSe})-(${VSe})-(${HSe})-(${WSe})(-.*)?\\s?$`);KE=class{inject(e,r,n){let i=ot.getSpanContext(e);if(!i||rd(e)||!Wr(i))return;let o=`${GSe}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Ct.NONE).toString(16)}`;n.set(r,Dm,o),i.traceState&&n.set(r,Lm,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,Dm);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=E0(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,Lm);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new id(typeof c=="string"?c:void 0)}return ot.setSpanContext(e,s)}fields(){return[Dm,Lm]}}});function eW(t,e){return t.setValue(v0,e)}function tW(t){return t.deleteValue(v0)}function rW(t){return t.getValue(v0)}var v0,ZE,nW=A(()=>{"use strict";Se();v0=Yt("OpenTelemetry SDK Context Key RPC_METADATA");(function(t){t.HTTP="http"})(ZE||(ZE={}))});function T0(t){if(!tEe(t)||rEe(t)!==KSe)return!1;let e=eEe(t);if(e===null)return!0;let r=sW.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&iW.call(r)===QSe}function tEe(t){return t!=null&&typeof t=="object"}function rEe(t){return t==null?t===void 0?JSe:ZSe:Jc&&Jc in Object(t)?nEe(t):iEe(t)}function nEe(t){let e=sW.call(t,Jc),r=t[Jc],n=!1;try{t[Jc]=void 0,n=!0}catch{}let i=aW.call(t);return n&&(e?t[Jc]=r:delete t[Jc]),i}function iEe(t){return aW.call(t)}var KSe,ZSe,JSe,XSe,iW,QSe,eEe,oW,sW,Jc,aW,cW=A(()=>{"use strict";KSe="[object Object]",ZSe="[object Null]",JSe="[object Undefined]",XSe=Function.prototype,iW=XSe.toString,QSe=iW.call(Object),eEe=Object.getPrototypeOf,oW=Object.prototype,sW=oW.hasOwnProperty,Jc=Symbol?Symbol.toStringTag:void 0,aW=oW.toString});function QE(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=uW(e,t.shift(),0,r);return e}function b0(t){return XE(t)?t.slice():t}function uW(t,e,r=0,n){let i;if(!(r>oEe)){if(r++,JE(t)||JE(e)||dW(e))i=b0(e);else if(XE(t)){if(i=t.slice(),XE(e))for(let o=0,s=e.length;o<s;o++)i.push(b0(e[o]));else if($m(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];c==="__proto__"||c==="constructor"||c==="prototype"||(i[c]=b0(e[c]))}}}else if($m(t))if($m(e)){if(!sEe(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let l=e[c];if(JE(l))typeof l>"u"?delete i[c]:i[c]=l;else{let u=i[c],d=l;if(lW(t,c,n)||lW(e,c,n))delete i[c];else{if($m(u)&&$m(d)){let f=n.get(u)||[],p=n.get(d)||[];f.push({obj:t,key:c}),p.push({obj:e,key:c}),n.set(u,f),n.set(d,p)}i[c]=uW(i[c],l,r,n)}}}}else i=e;return i}}function lW(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function XE(t){return Array.isArray(t)}function dW(t){return typeof t=="function"}function $m(t){return!JE(t)&&!XE(t)&&!dW(t)&&typeof t=="object"}function JE(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function sEe(t,e){return!(!T0(t)||!T0(e))}var oEe,fW=A(()=>{"use strict";cW();oEe=20});function pW(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new Um("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}var Um,hW=A(()=>{"use strict";Um=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});function A0(t,e){return typeof e=="string"?t===e:!!t.match(e)}function mW(t,e){if(!e)return!1;for(let r of e)if(A0(t,r))return!0;return!1}var gW=A(()=>{"use strict"});var ev,_W=A(()=>{"use strict";ev=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}});var tv,yW=A(()=>{"use strict";_W();tv=class{_isCalled=!1;_deferred=new ev;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}});function EW(t){if(t==null)return;let e=SW[t.toUpperCase()];return e??(J.warn(`Unknown log level "${t}", expected one of ${Object.keys(SW)}, using default`),Ke.INFO)}var SW,vW=A(()=>{"use strict";Se();SW={ALL:Ke.ALL,VERBOSE:Ke.VERBOSE,DEBUG:Ke.DEBUG,INFO:Ke.INFO,WARN:Ke.WARN,ERROR:Ke.ERROR,NONE:Ke.NONE}});function TW(t,e){return new Promise(r=>{pt.with($E(pt.active()),()=>{t.export(e,r)})})}var bW=A(()=>{"use strict";Se();km()});var AW={};ar(AW,{AnchoredClock:()=>BE,BindOnceFuture:()=>tv,CompositePropagator:()=>YE,ExportResultCode:()=>WE,RPCType:()=>ZE,SDK_INFO:()=>VE,TRACE_PARENT_HEADER:()=>Dm,TRACE_STATE_HEADER:()=>Lm,TimeoutError:()=>Um,TraceState:()=>id,W3CBaggagePropagator:()=>FE,W3CTraceContextPropagator:()=>KE,_globalThis:()=>qE,addHrTimes:()=>m0,callWithTimeout:()=>pW,deleteRPCMetadata:()=>tW,diagLogLevelFromString:()=>EW,getBooleanFromEnv:()=>zE,getNumberFromEnv:()=>Ot,getRPCMetadata:()=>rW,getStringFromEnv:()=>Zc,getStringListFromEnv:()=>GE,getTimeOrigin:()=>D6,globalErrorHandler:()=>b6,hrTime:()=>h0,hrTimeDuration:()=>$6,hrTimeToMicroseconds:()=>B6,hrTimeToMilliseconds:()=>j6,hrTimeToNanoseconds:()=>F6,hrTimeToSeconds:()=>z6,hrTimeToTimeStamp:()=>U6,internal:()=>aEe,isAttributeValue:()=>d0,isTimeInput:()=>G6,isTimeInputHrTime:()=>HE,isTracingSuppressed:()=>rd,isUrlIgnored:()=>mW,loggingErrorHandler:()=>jE,merge:()=>QE,millisToHrTime:()=>nd,otperformance:()=>ia,parseKeyPairsIntoRecord:()=>m6,parseTraceParent:()=>E0,sanitizeAttributes:()=>y6,setGlobalErrorHandler:()=>T6,setRPCMetadata:()=>eW,suppressTracing:()=>$E,timeInputToHrTime:()=>L6,unrefTimer:()=>V6,unsuppressTracing:()=>a6,urlMatches:()=>A0});var aEe,od=A(()=>{"use strict";g6();_6();E6();A6();f0();q6();H6();W6();u0();p0();Y6();Q6();nW();km();S0();fW();hW();gW();yW();vW();bW();aEe={_export:TW}});function Fm(t){return t.setValue(wW,!0)}function w0(t){return t.getValue(wW)===!0}var wW,x0=A(()=>{"use strict";Se();wW=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});function oa(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!cEe(r)){J.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!rv(n)){J.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function cEe(t){return typeof t=="string"&&t!==""}function rv(t){return t==null?!0:Array.isArray(t)?lEe(t):xW(typeof t)}function lEe(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(xW(n)){e=n;continue}return!1}return!1}}return!0}function xW(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}var RW=A(()=>{"use strict";Se()});function CW(){return t=>{J.error(uEe(t))}}function uEe(t){return typeof t=="string"?t:JSON.stringify(dEe(t))}function dEe(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}var IW=A(()=>{"use strict";Se()});function Vi(t){try{fEe(t)}catch{}}var fEe,PW=A(()=>{"use strict";IW();fEe=CW()});var OW,NW=A(()=>{"use strict";OW="2.9.0"});var kW,MW=A(()=>{"use strict";kW="process.runtime.name"});var Xc,DW=A(()=>{"use strict";NW();Kc();MW();Xc={[Ho]:"opentelemetry",[kW]:"node",[Vo]:Ju,[Wo]:OW}});var Hi,LW=A(()=>{"use strict";DW();Hi=performance});var R0=A(()=>{"use strict";LW()});function sa(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*EEe);return[r,n]}function I0(t){let e=sa(Hi.timeOrigin),r=sa(typeof t=="number"?t:Hi.now());return sv(e,r)}function P0(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=C0),[r,n]}function nv(t){return t[0]*1e6+t[1]/1e3}function iv(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function ov(t){return iv(t)||typeof t=="number"||t instanceof Date}function sv(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=C0&&(r[1]-=C0,r[0]+=1),r}var yEe,SEe,EEe,C0,$W=A(()=>{"use strict";R0();yEe=9,SEe=6,EEe=Math.pow(10,SEe),C0=Math.pow(10,yEe)});var Ln,UW=A(()=>{"use strict";(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Ln||(Ln={}))});var av,FW=A(()=>{"use strict";av=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}});var Qc,BW=A(()=>{"use strict";FW();Qc=class{_isCalled=!1;_deferred=new av;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}});function jW(t,e){return new Promise(r=>{pt.with(Fm(pt.active()),()=>{t.export(e,r)})})}var zW=A(()=>{"use strict";Se();x0()});var GW,Wi=A(()=>{"use strict";RW();PW();$W();UW();R0();x0();BW();zW();GW={_export:jW}});function qW(){if(cv===void 0)try{let t=globalThis.process.argv0;cv=t?`unknown_service:${t}`:"unknown_service"}catch{cv="unknown_service"}return cv}var cv,VW=A(()=>{"use strict"});var sd,HW=A(()=>{"use strict";sd=t=>t!==null&&typeof t=="object"&&typeof t.then=="function"});function YW(t,e){return O0.FromAttributeList(Object.entries(t),e)}function N0(){return YW({[GH]:qW(),[Vo]:Xc[Vo],[Ho]:Xc[Ho],[Wo]:Xc[Wo]})}function WW(t){return t.map(([e,r])=>sd(r)?[e,r.catch(n=>{J.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function vEe(t){if(typeof t=="string"||t===void 0)return t;J.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function TEe(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;J.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var O0,KW=A(()=>{"use strict";Se();Wi();Kc();VW();HW();O0=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=WW(e),n._asyncAttributesPending=e.filter(([i,o])=>sd(o)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>(sd(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=WW(this._rawAttributes),this._schemaUrl=vEe(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,sd(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&J.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(sd(n)){J.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=TEe(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}}});var ZW=A(()=>{"use strict";KW()});var JW,XW=A(()=>{"use strict";JW="exception"});function cd(t){let e={};for(let[r,n]of t.getRawAttributes())typeof n?.then!="function"&&n!=null&&(e[r]??=n);return e}function ld(t,e,r,n,i){if(typeof r=="number"&&r<0){let s=`[${t}]`;return n?.stylize?n.stylize(s,"special"):s}if(typeof i!="function"||!n)return e;let o={...n,depth:n.depth==null?n.depth:n.depth-1};return`${t} ${i(e,o)}`}var ad,lv=A(()=>{"use strict";ad=Symbol.for("nodejs.util.inspect.custom")});var uv,QW=A(()=>{"use strict";Se();Wi();Kc();XW();lv();uv=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Er.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Hi.now(),this._performanceOffset=r-(this._performanceStartTime+Hi.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let n of e.links)this.addLink(n);this.startTime=this._getTime(e.startTime??r),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,r){if(r==null||this._isSpanEnded())return this;if(e.length===0)return J.warn(`Invalid attribute key: ${e}`),this;if(!rv(r))return J.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&i?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(r),i&&this._attributesCount++,this)}setAttributes(e){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setAttribute(r,e[r]);return this}addEvent(e,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:i}=this._spanLimits;if(i===0)return J.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&J.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),ov(r)&&(ov(n)||(n=r),r=void 0);let o=oa(r),{attributePerEventCountLimit:s}=this._spanLimits,a={},c=0,l=0;for(let u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;let d=o[u];if(s!==void 0&&l>=s){c++;continue}a[u]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(n),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&J.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,i=oa(e.attributes),o={},s=0,a=0;for(let l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;let u=i[l];if(n!==void 0&&a>=n){s++;continue}o[l]=this._truncateToSize(u),a++}let c={context:e.context};return a>0&&(c.attributes=o),s>0&&(c.droppedAttributesCount=s),this.links.push(c),this}addLinks(e){for(let r of e)this.addLink(r);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===Er.UNSET)return this;if(this.status.code===Er.OK)return this;let r={code:e.code};return e.code===Er.ERROR&&(typeof e.message=="string"?r.message=e.message:e.message!=null&&J.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=r,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){J.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=P0(this.startTime,this.endTime),this._duration[0]<0&&(J.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&&J.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&J.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=Hi.now())return I0(e+this._performanceOffset);if(typeof e=="number")return sa(e);if(e instanceof Date)return sa(e.getTime());if(iv(e))return e;if(this._startTimeProvided)return sa(Date.now());let r=Hi.now()-this._performanceStartTime;return sv(this.startTime,sa(r))}isRecording(){return this._ended===!1}recordException(e,r){let n={};typeof e=="string"?n[wE]=e:e&&(e.code?n[xE]=e.code.toString():e.name&&(n[xE]=e.name),e.message&&(n[wE]=e.message),e.stack&&(n[zH]=e.stack)),n[xE]||n[wE]?this.addEvent(JW,n,r):J.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);J.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_truncateToSize(e){let r=this._attributeValueLengthLimit;return r<=0?(J.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}[ad](e,r,n){let i={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:cd(this.resource)}};return ld("SpanImpl",i,e,r,n)}}});var cr,ud=A(()=>{"use strict";(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(cr||(cr={}))});var e3,t3,r3,k0,n3,i3,o3,s3,a3,c3,l3,Bm=A(()=>{"use strict";e3="otel.component.name",t3="otel.component.type",r3="otel.span.parent.origin",k0="otel.span.sampling_result",n3="otel.sdk.processor.span.processed",i3="otel.sdk.processor.span.queue.capacity",o3="otel.sdk.processor.span.queue.size",s3="otel.sdk.span.live",a3="otel.sdk.span.started",c3="batching_span_processor",l3="simple_span_processor"});function bEe(t){return t?t.isRemote?"remote":"local":"none"}function AEe(t){switch(t){case cr.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case cr.RECORD:return"RECORD_ONLY";case cr.NOT_RECORD:return"DROP"}}var dv,u3=A(()=>{"use strict";ud();Bm();dv=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(a3,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(s3,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,r){let n=AEe(r);if(this.startedSpans.add(1,{[r3]:bEe(e),[k0]:n}),r===cr.NOT_RECORD)return()=>{};let i={[k0]:n};return this.liveSpans.add(1,i),()=>{this.liveSpans.add(-1,i)}}}});var d3,f3=A(()=>{"use strict";d3="2.9.0"});var fv,p3=A(()=>{"use strict";Se();Wi();QW();u3();f3();lv();fv=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,r){this.instrumentationScope=e,this._sampler=r.sampler,this._spanLimits=r.spanLimits,this._resource=r.resource,this._idGenerator=r.idGenerator,this._spanProcessor=r.spanProcessor;let n=r.meterProvider.getMeter("@opentelemetry/sdk-trace",d3);this._tracerMetrics=new dv(n)}startSpan(e,r={},n=pt.active()){r.root&&(n=ot.deleteSpan(n));let i=ot.getSpan(n);if(w0(n))return J.debug("Instrumentation suppressed, returning Noop Span"),ot.wrapSpanContext(Yu);let o=i?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,l;!o||!ot.isSpanContextValid(o)?c=this._idGenerator.generateTraceId():(c=o.traceId,l=o.traceState,a=o);let u=r.kind??oi.INTERNAL,d=(r.links??[]).map(w=>({context:w.context,attributes:oa(w.attributes)})),f=oa(r.attributes),p=this._sampler.shouldSample(n,c,e,u,f,d),h=this._tracerMetrics.startSpan(o,p.decision);l=p.traceState??l;let m=p.decision===Yc.RECORD_AND_SAMPLED?Ct.SAMPLED:Ct.NONE,y={traceId:c,spanId:s,traceFlags:m,traceState:l};if(p.decision===Yc.NOT_RECORD)return J.debug("Recording is off, propagating context in a non-recording span"),ot.wrapSpanContext(y);let S=oa(Object.assign(f,p.attributes));return new uv({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:u,links:d,parentSpanContext:a,attributes:S,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(e,r,n,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);let c=s??pt.active(),l=this.startSpan(e,o,c),u=ot.setSpan(c,l);return pt.with(u,a,void 0,l)}[ad](e,r,n){let i={instrumentationScope:this.instrumentationScope,resource:{attributes:cd(this._resource)},spanLimits:this._spanLimits};return ld("Tracer",i,e,r,n)}}});var pv,h3=A(()=>{"use strict";Wi();pv=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let r of this._spanProcessors)e.push(r.forceFlush());return new Promise(r=>{Promise.all(e).then(()=>{r()}).catch(n=>{Vi(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(e,r){for(let n of this._spanProcessors)n.onStart(e,r)}onEnding(e){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(e)}onEnd(e){for(let r of this._spanProcessors)r.onEnd(e)}shutdown(){let e=[];for(let r of this._spanProcessors)e.push(r.shutdown());return new Promise((r,n)=>{Promise.all(e).then(()=>{r()},n)})}}});var si,M0=A(()=>{"use strict";ud();si=class{shouldSample(){return{decision:cr.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}});var Mr,hv=A(()=>{"use strict";ud();Mr=class{shouldSample(){return{decision:cr.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}});var $n,D0=A(()=>{"use strict";Se();Wi();M0();hv();$n=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Vi(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Mr),this._remoteParentSampled=e.remoteParentSampled??new Mr,this._remoteParentNotSampled=e.remoteParentNotSampled??new si,this._localParentSampled=e.localParentSampled??new Mr,this._localParentNotSampled=e.localParentNotSampled??new si}shouldSample(e,r,n,i,o,s){let a=ot.getSpanContext(e);return!a||!Wr(a)?this._root.shouldSample(e,r,n,i,o,s):a.isRemote?a.traceFlags&Ct.SAMPLED?this._remoteParentSampled.shouldSample(e,r,n,i,o,s):this._remoteParentNotSampled.shouldSample(e,r,n,i,o,s):a.traceFlags&Ct.SAMPLED?this._localParentSampled.shouldSample(e,r,n,i,o,s):this._localParentNotSampled.shouldSample(e,r,n,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}});var m3,dd,L0=A(()=>{"use strict";Kc();Bm();m3=new Map,dd=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,r,n){let i=m3.get(e)??0;if(m3.set(e,i+1),this.standardAttrs={[t3]:e,[e3]:`${e}/${i}`},this.droppedAttrs={...this.standardAttrs,[KP]:"queue_full"},this.processedSpans=r.createCounter(n3,{unit:"{span}",description:"The number of spans for which the processing has finished, either successful or failed."}),n){let{capacity:o,getQueueSize:s}=n;r.createUpDownCounter(i3,{unit:"{span}",description:"The maximum number of spans the queue of a given instance of an SDK span processor can hold."}).add(o,this.standardAttrs),this.queueSize=r.createObservableUpDownCounter(o3,{unit:"{span}",description:"The number of spans in the queue of a given instance of an SDK span processor."}),this.queueSizeCallback=c=>c.observe(s(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,r){if(!r){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[KP]:r.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}});var mv,g3=A(()=>{"use strict";Se();Wi();L0();Bm();mv=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new Qc(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(J.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);let r=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):ta();this._metrics=new dd(c3,r,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,r){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&Ct.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&J.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(J.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,r)=>{let n=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let o=0,s=i;o<s;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);pt.with(Fm(pt.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);let o=()=>this._exporter.export(i,a=>{clearTimeout(n),this._metrics.finishSpans(i.length,a.error),a.code===Ln.SUCCESS?e():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=i.length;a<c;a++){let l=i[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(s??=[],s.push(l.resource.waitForAsyncAttributes()))}s===null?o():Promise.all(s).then(o,a=>{Vi(a),r(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(r=>{this._isExporting=!1,Vi(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}});var el,_3=A(()=>{"use strict";g3();el=class extends mv{onShutdown(){}}});function y3(t){return function(){for(let r=0;r<t/4;r++)gv.writeUInt32BE(Math.random()*2**32>>>0,r*4);for(let r=0;r<t&&!(gv[r]>0);r++)r===t-1&&(gv[t-1]=1);return gv.toString("hex",0,t)}}var Yo,gv,S3=A(()=>{"use strict";Yo=class{generateTraceId=y3(16);generateSpanId=y3(8)},gv=Buffer.allocUnsafe(16)});var E3=A(()=>{"use strict";_3();S3()});var $0=A(()=>{"use strict";E3()});var tl,jm,v3=A(()=>{"use strict";Se();ZW();p3();h3();D0();hv();$0();lv();(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(tl||(tl={}));jm=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??N0();let r=e.spanProcessors??[];this._activeSpanProcessor=new pv(r),this._tracerOptions={resource:this._resource,sampler:e.sampler??new $n({root:new Mr}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Yo,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return ta()}}}}getTracer(e,r,n){let i=`${e}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new fv({name:e,version:r,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(i)}forceFlush(){let e=this._forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(i=>{let o,s=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${e} ms`)),o=tl.timeout},e);n.forceFlush().then(()=>{clearTimeout(s),o!==tl.timeout&&(o=tl.resolved,i(o))}).catch(a=>{clearTimeout(s),o=tl.error,i(a)})}));return new Promise((n,i)=>{Promise.all(r).then(o=>{let s=o.filter(a=>a!==tl.resolved);s.length>0?i(s):n()}).catch(o=>i([o]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[ad](e,r,n){let i=this._activeSpanProcessor._spanProcessors,o={resource:{attributes:cd(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:i.map(s=>s.constructor?.name??"SpanProcessor")};return ld("TracerProvider",o,e,r,n)}}});var zm,T3=A(()=>{"use strict";Wi();zm=class{export(e,r){return this._sendSpans(e,r)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:nv(e.startTime),duration:nv(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});if(r)return r({code:Ln.SUCCESS})}}});var Gm,b3=A(()=>{"use strict";Wi();Gm=class{_finishedSpans=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:Ln.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>r({code:Ln.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}});var qm,A3=A(()=>{"use strict";Se();Wi();L0();Bm();qm=class{_exporter;_metrics;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e.exporter,this._shutdownOnce=new Qc(this._shutdown,this),this._pendingExports=new Set;let r=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):ta();this._metrics=new dd(l3,r)}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,r){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&Ct.SAMPLED)===0)return;let r=this._doExport(e).catch(n=>Vi(n));this._pendingExports.add(r),r.finally(()=>this._pendingExports.delete(r))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let r=await GW._export(this._exporter,[e]);if(this._metrics.finishSpans(1,r.error),r.code!==Ln.SUCCESS)throw r.error??new Error(`SimpleSpanProcessor: span export failed (status ${r})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._metrics.shutdown(),this._exporter.shutdown()}}});var Vm,w3=A(()=>{"use strict";Vm=class{onStart(e,r){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}});var aa,x3=A(()=>{"use strict";Se();ud();aa=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,r){return{decision:Rm(r)&&this._accumulate(r)<this._upperBound?cr.RECORD_AND_SAMPLED:cr.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 r=0;for(let n=0;n<32;n+=8){let i=0;for(let o=0;o<8;o++){let s=e.charCodeAt(n+o),a=s<58?s-48:s<71?s-55:s-87;i=i<<4|a}r=(r^i)>>>0}return r}}});var fd=A(()=>{"use strict";v3();$0();T3();b3();A3();w3();M0();hv();D0();x3();ud()});function C3(){return{sampler:wEe(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:Ot("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:Ot("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:Ot("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:Ot("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:Ot("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:Ot("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:Ot("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:Ot("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}function wEe(){let t=Zc("OTEL_TRACES_SAMPLER")??Yi.ParentBasedAlwaysOn;switch(t){case Yi.AlwaysOn:return new Mr;case Yi.AlwaysOff:return new si;case Yi.ParentBasedAlwaysOn:return new $n({root:new Mr});case Yi.ParentBasedAlwaysOff:return new $n({root:new si});case Yi.TraceIdRatio:return new aa(R3());case Yi.ParentBasedTraceIdRatio:return new $n({root:new aa(R3())});default:return J.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${Yi.ParentBasedAlwaysOn}".`),new $n({root:new Mr})}}function R3(){let t=Ot("OTEL_TRACES_SAMPLER_ARG");return t==null?(J.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${_v}.`),_v):t<0||t>1?(J.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${_v}.`),_v):t}var Yi,_v,I3=A(()=>{"use strict";Se();od();fd();(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"})(Yi||(Yi={}));_v=1});function P3(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??Ot("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??Ot("OTEL_ATTRIBUTE_COUNT_LIMIT")??xEe,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??Ot("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??Ot("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??REe,Object.assign({},t,{spanLimits:e})}var xEe,REe,O3=A(()=>{"use strict";od();xEe=128,REe=1/0});var yv,N3=A(()=>{"use strict";od();I3();O3();fd();yv=class extends jm{constructor(e={}){let r=QE({},C3(),P3(e));delete r.generalLimits,super(r)}}});var Sv,k3=A(()=>{"use strict";od();fd();Sv=class extends el{constructor(e,r){r||(r={});let n=[["maxExportBatchSize","OTEL_BSP_MAX_EXPORT_BATCH_SIZE"],["maxQueueSize","OTEL_BSP_MAX_QUEUE_SIZE"],["scheduledDelayMillis","OTEL_BSP_SCHEDULE_DELAY"],["exportTimeoutMillis","OTEL_BSP_EXPORT_TIMEOUT"]];for(let[i,o]of n)if(r[i]===void 0){let s=Ot(o);s!==void 0&&(r[i]=s)}super({exporter:e,...r})}}});var Ev,M3=A(()=>{"use strict";fd();Ev=class extends qm{constructor(e){super({exporter:e})}}});var U0={};ar(U0,{AlwaysOffSampler:()=>si,AlwaysOnSampler:()=>Mr,BasicTracerProvider:()=>yv,BatchSpanProcessor:()=>Sv,ConsoleSpanExporter:()=>zm,InMemorySpanExporter:()=>Gm,NoopSpanProcessor:()=>Vm,ParentBasedSampler:()=>$n,RandomIdGenerator:()=>Yo,SamplingDecision:()=>cr,SimpleSpanProcessor:()=>Ev,TraceIdRatioBasedSampler:()=>aa});var F0=A(()=>{"use strict";N3();k3();M3();fd()});var D3=v(vv=>{"use strict";Object.defineProperty(vv,"__esModule",{value:!0});vv.NodeTracerProvider=void 0;var CEe=s6(),IEe=(F0(),Nr(U0)),Hm=(Se(),Nr(ra)),B0=(od(),Nr(AW));function PEe(t){if(t!==null){if(t===void 0){let e=new CEe.AsyncLocalStorageContextManager;e.enable(),Hm.context.setGlobalContextManager(e);return}t.enable(),Hm.context.setGlobalContextManager(t)}}function OEe(t){if(t!==null){if(t===void 0){Hm.propagation.setGlobalPropagator(new B0.CompositePropagator({propagators:[new B0.W3CTraceContextPropagator,new B0.W3CBaggagePropagator]}));return}Hm.propagation.setGlobalPropagator(t)}}var j0=class extends IEe.BasicTracerProvider{constructor(e={}){super(e)}register(e={}){Hm.trace.setGlobalTracerProvider(this),PEe(e.contextManager),OEe(e.propagator)}};vv.NodeTracerProvider=j0});var z0=v(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.TraceIdRatioBasedSampler=ct.SimpleSpanProcessor=ct.SamplingDecision=ct.RandomIdGenerator=ct.ParentBasedSampler=ct.NoopSpanProcessor=ct.InMemorySpanExporter=ct.ConsoleSpanExporter=ct.BatchSpanProcessor=ct.BasicTracerProvider=ct.AlwaysOnSampler=ct.AlwaysOffSampler=ct.NodeTracerProvider=void 0;var NEe=D3();Object.defineProperty(ct,"NodeTracerProvider",{enumerable:!0,get:function(){return NEe.NodeTracerProvider}});var Un=(F0(),Nr(U0));Object.defineProperty(ct,"AlwaysOffSampler",{enumerable:!0,get:function(){return Un.AlwaysOffSampler}});Object.defineProperty(ct,"AlwaysOnSampler",{enumerable:!0,get:function(){return Un.AlwaysOnSampler}});Object.defineProperty(ct,"BasicTracerProvider",{enumerable:!0,get:function(){return Un.BasicTracerProvider}});Object.defineProperty(ct,"BatchSpanProcessor",{enumerable:!0,get:function(){return Un.BatchSpanProcessor}});Object.defineProperty(ct,"ConsoleSpanExporter",{enumerable:!0,get:function(){return Un.ConsoleSpanExporter}});Object.defineProperty(ct,"InMemorySpanExporter",{enumerable:!0,get:function(){return Un.InMemorySpanExporter}});Object.defineProperty(ct,"NoopSpanProcessor",{enumerable:!0,get:function(){return Un.NoopSpanProcessor}});Object.defineProperty(ct,"ParentBasedSampler",{enumerable:!0,get:function(){return Un.ParentBasedSampler}});Object.defineProperty(ct,"RandomIdGenerator",{enumerable:!0,get:function(){return Un.RandomIdGenerator}});Object.defineProperty(ct,"SamplingDecision",{enumerable:!0,get:function(){return Un.SamplingDecision}});Object.defineProperty(ct,"SimpleSpanProcessor",{enumerable:!0,get:function(){return Un.SimpleSpanProcessor}});Object.defineProperty(ct,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return Un.TraceIdRatioBasedSampler}})});var xv,H3=A(()=>{"use strict";xv=class{_delegate;constructor(e){this._delegate=e}export(e,r){this._delegate.export(e,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}});var Ko,Rv=A(()=>{"use strict";Ko=class extends Error{code;name="OTLPExporterError";data;constructor(e,r,n){super(e),this.data=n,this.code=r}}});function zEe(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function Cv(t){if(t!=null)return async()=>t}function Iv(t,e,r){return{timeoutMillis:zEe(t.timeoutMillis??e.timeoutMillis??r.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??r.concurrencyLimit,compression:t.compression??e.compression??r.compression}}function Pv(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Jm=A(()=>{"use strict"});var Ov,W3=A(()=>{"use strict";(function(t){t.NONE="none",t.GZIP="gzip"})(Ov||(Ov={}))});function Nv(t){return new W0(t.concurrencyLimit)}var W0,Y0=A(()=>{"use strict";W0=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);let r=()=>{let n=this._sendingPromises.indexOf(e);this._sendingPromises.splice(n,1)};e.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}});function kv(t){return t.setValue(K0,!0)}function Y3(t){return t.deleteValue(K0)}function pd(t){return t.getValue(K0)===!0}var K0,Xm=A(()=>{"use strict";Se();K0=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});var Mv,K3=A(()=>{"use strict";Mv="baggage"});function Z3(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?",":""}${r}`;return n.length>8192?e:n},"")}function J3(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function Z0(t){if(!t)return;let e=t.indexOf(";"),r=e===-1?t:t.substring(0,e),n=r.indexOf("=");if(n<=0)return;let i=r.substring(0,n).trim(),o=r.substring(n+1).trim();if(!i||!o)return;let s,a;try{s=decodeURIComponent(i),a=decodeURIComponent(o)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=Hu(l)}return{key:s,value:a,metadata:c}}function rl(t){let e={};return typeof t=="string"&&t.length>0&&t.split(",").forEach(r=>{let n=Z0(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}var J0=A(()=>{"use strict";Se()});var Lv,X3=A(()=>{"use strict";Se();Xm();K3();J0();Lv=class{inject(e,r,n){let i=kr.getBaggage(e);if(!i||pd(e))return;let o=J3(i).filter(a=>a.length<=4096).slice(0,180),s=Z3(o);s.length>0&&n.set(r,Mv,s)}extract(e,r,n){let i=n.get(r,Mv),o=Array.isArray(i)?i.join(","):i;if(!o)return e;let s={};return o.length===0||(o.split(",").forEach(c=>{let l=Z0(c);if(l){let u={value:l.value};l.metadata&&(u.metadata=l.metadata),s[l.key]=u}}),Object.entries(s).length===0)?e:kr.setBaggage(e,kr.createBaggage(s))}fields(){return[Mv]}}});var $v,Q3=A(()=>{"use strict";$v=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}});function eY(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!HEe(r)){J.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!X0(n)){J.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function HEe(t){return typeof t=="string"&&t!==""}function X0(t){return t==null?!0:Array.isArray(t)?WEe(t):tY(typeof t)}function WEe(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(tY(n)){e=n;continue}return!1}return!1}}return!0}function tY(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}var rY=A(()=>{"use strict";Se()});function Uv(){return t=>{J.error(YEe(t))}}function YEe(t){return typeof t=="string"?t:JSON.stringify(KEe(t))}function KEe(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}var Q0=A(()=>{"use strict";Se()});function iY(t){nY=t}function oY(t){try{nY(t)}catch{}}var nY,sY=A(()=>{"use strict";Q0();nY=Uv()});import{inspect as aY}from"util";function hd(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){J.warn(`Unknown value ${aY(e)} for ${t}, expected a number, using defaults`);return}return r}function Yr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}function Fv(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||J.warn(`Unknown value ${aY(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function Bv(t){return Yr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}var cY=A(()=>{"use strict";Se()});var jv,lY=A(()=>{"use strict";jv=globalThis});var uY,dY=A(()=>{"use strict";uY="2.7.1"});var fY,pY=A(()=>{"use strict";fY="process.runtime.name"});var zv,hY=A(()=>{"use strict";dY();Kc();pY();zv={[Ho]:"opentelemetry",[fY]:"node",[Vo]:Ju,[Wo]:uY}});var ca,mY=A(()=>{"use strict";cY();lY();hY();ca=performance});var eO=A(()=>{"use strict";mY()});function md(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*JEe);return[r,n]}function _Y(){return ca.timeOrigin}function tO(t){let e=md(ca.timeOrigin),r=md(typeof t=="number"?t:ca.now());return rO(e,r)}function yY(t){if(Vv(t))return t;if(typeof t=="number")return t<ca.timeOrigin?tO(t):md(t);if(t instanceof Date)return md(t.getTime());throw TypeError("Invalid input type")}function SY(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=Gv),[r,n]}function EY(t){let e=gY,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}function qv(t){return t[0]*Gv+t[1]}function vY(t){return t[0]*1e3+t[1]/1e6}function TY(t){return t[0]*1e6+t[1]/1e3}function Vv(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function bY(t){return Vv(t)||typeof t=="number"||t instanceof Date}function rO(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=Gv&&(r[1]-=Gv,r[0]+=1),r}var gY,ZEe,JEe,Gv,AY=A(()=>{"use strict";eO();gY=9,ZEe=6,JEe=Math.pow(10,ZEe),Gv=Math.pow(10,gY)});function wY(t){typeof t!="number"&&t.unref()}var xY=A(()=>{"use strict"});var Fn,RY=A(()=>{"use strict";(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Fn||(Fn={}))});var Hv,CY=A(()=>{"use strict";Se();Hv=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let r=new Set;for(let n of this._propagators){let i=typeof n.fields=="function"?n.fields():[];for(let o of i)r.add(o)}this._fields=Array.from(r)}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){J.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){J.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}});function iO(t){return eve.test(t)}function oO(t){return tve.test(t)&&!rve.test(t)}var nO,XEe,QEe,eve,tve,rve,IY=A(()=>{"use strict";nO="[_0-9a-z-*/]",XEe=`[a-z]${nO}{0,255}`,QEe=`[a-z0-9]${nO}{0,240}@[a-z]${nO}{0,13}`,eve=new RegExp(`^(?:${XEe}|${QEe})$`),tve=/^[ -~]{0,255}[!-~]$/,rve=/,|=/});var nve,PY,OY,NY,gd,sO=A(()=>{"use strict";IY();nve=32,PY=512,OY=",",NY="=",gd=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!iO(e)||!oO(r))return this;let n=this._getState(),i=n.get(e),o=this._length;if(typeof i=="string"?o+=r.length-i.length:o+=e.length+r.length+(n.size>0?2:1),o>PY)return this;let s=new Map(n);return s.delete(e),s.set(e,r),this._fromState(s,o)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let o=new Map(r);return o.delete(e),this._fromState(o,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=OY+e),e=`${n[0]}${NY}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(OY),r=new Map,n=0;for(let i of e){let o=i.trim(),s=o.indexOf(NY);if(s===-1)continue;let a=o.slice(0,s),c=o.slice(s+1);if(!iO(a)||!oO(c))continue;let l=n+o.length+(r.size>0?1:0);if(!(l>PY)&&(r.set(a,c),n=l,r.size>=nve))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}}});function aO(t){let e=lve.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Qm,eg,ive,ove,sve,ave,cve,lve,Wv,kY=A(()=>{"use strict";Se();Xm();sO();Qm="traceparent",eg="tracestate",ive="00",ove="(?!ff)[\\da-f]{2}",sve="(?![0]{32})[\\da-f]{32}",ave="(?![0]{16})[\\da-f]{16}",cve="[\\da-f]{2}",lve=new RegExp(`^\\s?(${ove})-(${sve})-(${ave})-(${cve})(-.*)?\\s?$`);Wv=class{inject(e,r,n){let i=ot.getSpanContext(e);if(!i||pd(e)||!Wr(i))return;let o=`${ive}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Ct.NONE).toString(16)}`;n.set(r,Qm,o),i.traceState&&n.set(r,eg,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,Qm);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=aO(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,eg);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new gd(typeof c=="string"?c:void 0)}return ot.setSpanContext(e,s)}fields(){return[Qm,eg]}}});function MY(t,e){return t.setValue(cO,e)}function DY(t){return t.deleteValue(cO)}function LY(t){return t.getValue(cO)}var cO,Yv,$Y=A(()=>{"use strict";Se();cO=Yt("OpenTelemetry SDK Context Key RPC_METADATA");(function(t){t.HTTP="http"})(Yv||(Yv={}))});function lO(t){if(!gve(t)||_ve(t)!==uve)return!1;let e=mve(t);if(e===null)return!0;let r=BY.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&UY.call(r)===hve}function gve(t){return t!=null&&typeof t=="object"}function _ve(t){return t==null?t===void 0?fve:dve:nl&&nl in Object(t)?yve(t):Sve(t)}function yve(t){let e=BY.call(t,nl),r=t[nl],n=!1;try{t[nl]=void 0,n=!0}catch{}let i=jY.call(t);return n&&(e?t[nl]=r:delete t[nl]),i}function Sve(t){return jY.call(t)}var uve,dve,fve,pve,UY,hve,mve,FY,BY,nl,jY,zY=A(()=>{"use strict";uve="[object Object]",dve="[object Null]",fve="[object Undefined]",pve=Function.prototype,UY=pve.toString,hve=UY.call(Object),mve=Object.getPrototypeOf,FY=Object.prototype,BY=FY.hasOwnProperty,nl=Symbol?Symbol.toStringTag:void 0,jY=FY.toString});function qY(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=VY(e,t.shift(),0,r);return e}function uO(t){return Zv(t)?t.slice():t}function VY(t,e,r=0,n){let i;if(!(r>Eve)){if(r++,Kv(t)||Kv(e)||HY(e))i=uO(e);else if(Zv(t)){if(i=t.slice(),Zv(e))for(let o=0,s=e.length;o<s;o++)i.push(uO(e[o]));else if(tg(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];c==="__proto__"||c==="constructor"||c==="prototype"||(i[c]=uO(e[c]))}}}else if(tg(t))if(tg(e)){if(!vve(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let l=e[c];if(Kv(l))typeof l>"u"?delete i[c]:i[c]=l;else{let u=i[c],d=l;if(GY(t,c,n)||GY(e,c,n))delete i[c];else{if(tg(u)&&tg(d)){let f=n.get(u)||[],p=n.get(d)||[];f.push({obj:t,key:c}),p.push({obj:e,key:c}),n.set(u,f),n.set(d,p)}i[c]=VY(i[c],l,r,n)}}}}else i=e;return i}}function GY(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function Zv(t){return Array.isArray(t)}function HY(t){return typeof t=="function"}function tg(t){return!Kv(t)&&!Zv(t)&&!HY(t)&&typeof t=="object"}function Kv(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function vve(t,e){return!(!lO(t)||!lO(e))}var Eve,WY=A(()=>{"use strict";zY();Eve=20});function YY(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new rg("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}var rg,KY=A(()=>{"use strict";rg=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});function dO(t,e){return typeof e=="string"?t===e:!!t.match(e)}function ZY(t,e){if(!e)return!1;for(let r of e)if(dO(t,r))return!0;return!1}var JY=A(()=>{"use strict"});var Jv,XY=A(()=>{"use strict";Jv=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}});var Xv,QY=A(()=>{"use strict";XY();Xv=class{_isCalled=!1;_deferred=new Jv;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}});function tK(t){if(t==null)return;let e=eK[t.toUpperCase()];return e??(J.warn(`Unknown log level "${t}", expected one of ${Object.keys(eK)}, using default`),Ke.INFO)}var eK,rK=A(()=>{"use strict";Se();eK={ALL:Ke.ALL,VERBOSE:Ke.VERBOSE,DEBUG:Ke.DEBUG,INFO:Ke.INFO,WARN:Ke.WARN,ERROR:Ke.ERROR,NONE:Ke.NONE}});function nK(t,e){return new Promise(r=>{pt.with(kv(pt.active()),()=>{t.export(e,r)})})}var iK=A(()=>{"use strict";Se();Xm()});var oK={};ar(oK,{AnchoredClock:()=>$v,BindOnceFuture:()=>Xv,CompositePropagator:()=>Hv,ExportResultCode:()=>Fn,RPCType:()=>Yv,SDK_INFO:()=>zv,TRACE_PARENT_HEADER:()=>Qm,TRACE_STATE_HEADER:()=>eg,TimeoutError:()=>rg,TraceState:()=>gd,W3CBaggagePropagator:()=>Lv,W3CTraceContextPropagator:()=>Wv,_globalThis:()=>jv,addHrTimes:()=>rO,callWithTimeout:()=>YY,deleteRPCMetadata:()=>DY,diagLogLevelFromString:()=>tK,getBooleanFromEnv:()=>Fv,getNumberFromEnv:()=>hd,getRPCMetadata:()=>LY,getStringFromEnv:()=>Yr,getStringListFromEnv:()=>Bv,getTimeOrigin:()=>_Y,globalErrorHandler:()=>oY,hrTime:()=>tO,hrTimeDuration:()=>SY,hrTimeToMicroseconds:()=>TY,hrTimeToMilliseconds:()=>vY,hrTimeToNanoseconds:()=>qv,hrTimeToTimeStamp:()=>EY,internal:()=>Tve,isAttributeValue:()=>X0,isTimeInput:()=>bY,isTimeInputHrTime:()=>Vv,isTracingSuppressed:()=>pd,isUrlIgnored:()=>ZY,loggingErrorHandler:()=>Uv,merge:()=>qY,millisToHrTime:()=>md,otperformance:()=>ca,parseKeyPairsIntoRecord:()=>rl,parseTraceParent:()=>aO,sanitizeAttributes:()=>eY,setGlobalErrorHandler:()=>iY,setRPCMetadata:()=>MY,suppressTracing:()=>kv,timeInputToHrTime:()=>yY,unrefTimer:()=>wY,unsuppressTracing:()=>Y3,urlMatches:()=>dO});var Tve,_d=A(()=>{"use strict";X3();Q3();rY();sY();Q0();AY();xY();RY();J0();eO();CY();kY();$Y();Xm();sO();WY();KY();JY();QY();rK();iK();Tve={_export:nK}});function bve(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function sK(){return{handleResponse(t){t==null||!bve(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||J.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}var aK=A(()=>{"use strict";Se()});function Qv(t,e){return new fO(t.transport,t.serializer,sK(),t.promiseHandler,e.timeout)}var fO,pO=A(()=>{"use strict";_d();Rv();aK();Se();fO=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,r,n,i,o){this._transport=e,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=J.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){r({code:Fn.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(e);if(n==null){r({code:Fn.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(i=>{if(i.status==="success"){if(i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(o){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",o,i.data)}r({code:Fn.SUCCESS});return}else if(i.status==="failure"&&i.error){r({code:Fn.FAILED,error:i.error});return}else i.status==="retryable"?r({code:Fn.FAILED,error:i.error??new Ko("Export failed with retryable status")}):r({code:Fn.FAILED,error:new Ko("Export failed with unknown error")})},i=>r({code:Fn.FAILED,error:i})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}});function cK(t,e,r){return Qv({transport:r,serializer:e,promiseHandler:Nv(t)},{timeout:t.timeoutMillis})}var lK=A(()=>{"use strict";Y0();pO()});var eT={};ar(eT,{CompressionAlgorithm:()=>Ov,OTLPExporterBase:()=>xv,OTLPExporterError:()=>Ko,createOtlpNetworkExportDelegate:()=>cK,getSharedConfigurationDefaults:()=>Pv,mergeOtlpSharedConfigurationWithDefaults:()=>Iv});var tT=A(()=>{"use strict";H3();Rv();Jm();W3();lK()});var uK=v(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});rT.VERSION=void 0;rT.VERSION="0.218.0"});var Ve=v(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=Bn.DEFAULT_MAX_SEND_MESSAGE_LENGTH=Bn.Propagate=Bn.LogVerbosity=Bn.Status=void 0;var dK;(function(t){t[t.OK=0]="OK",t[t.CANCELLED=1]="CANCELLED",t[t.UNKNOWN=2]="UNKNOWN",t[t.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",t[t.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",t[t.NOT_FOUND=5]="NOT_FOUND",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.PERMISSION_DENIED=7]="PERMISSION_DENIED",t[t.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",t[t.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",t[t.ABORTED=10]="ABORTED",t[t.OUT_OF_RANGE=11]="OUT_OF_RANGE",t[t.UNIMPLEMENTED=12]="UNIMPLEMENTED",t[t.INTERNAL=13]="INTERNAL",t[t.UNAVAILABLE=14]="UNAVAILABLE",t[t.DATA_LOSS=15]="DATA_LOSS",t[t.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(dK||(Bn.Status=dK={}));var fK;(function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.ERROR=2]="ERROR",t[t.NONE=3]="NONE"})(fK||(Bn.LogVerbosity=fK={}));var pK;(function(t){t[t.DEADLINE=1]="DEADLINE",t[t.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",t[t.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",t[t.CANCELLATION=8]="CANCELLATION",t[t.DEFAULTS=65535]="DEFAULTS"})(pK||(Bn.Propagate=pK={}));Bn.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;Bn.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024});var hO=v((Pat,Ave)=>{Ave.exports={name:"@grpc/grpc-js",version:"1.14.4",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var ht=v(hn=>{"use strict";var mO,gO,_O,yO;Object.defineProperty(hn,"__esModule",{value:!0});hn.log=hn.setLoggerVerbosity=hn.setLogger=hn.getLogger=void 0;hn.trace=Dve;hn.isTracerEnabled=mK;var la=Ve(),wve=Z("process"),xve=hO().version,Rve={error:(t,...e)=>{console.error("E "+t,...e)},info:(t,...e)=>{console.error("I "+t,...e)},debug:(t,...e)=>{console.error("D "+t,...e)}},il=Rve,yd=la.LogVerbosity.ERROR,Cve=(gO=(mO=process.env.GRPC_NODE_VERBOSITY)!==null&&mO!==void 0?mO:process.env.GRPC_VERBOSITY)!==null&&gO!==void 0?gO:"";switch(Cve.toUpperCase()){case"DEBUG":yd=la.LogVerbosity.DEBUG;break;case"INFO":yd=la.LogVerbosity.INFO;break;case"ERROR":yd=la.LogVerbosity.ERROR;break;case"NONE":yd=la.LogVerbosity.NONE;break;default:}var Ive=()=>il;hn.getLogger=Ive;var Pve=t=>{il=t};hn.setLogger=Pve;var Ove=t=>{yd=t};hn.setLoggerVerbosity=Ove;var Nve=(t,...e)=>{let r;if(t>=yd){switch(t){case la.LogVerbosity.DEBUG:r=il.debug;break;case la.LogVerbosity.INFO:r=il.info;break;case la.LogVerbosity.ERROR:r=il.error;break}r||(r=il.error),r&&r.bind(il)(...e)}};hn.log=Nve;var kve=(yO=(_O=process.env.GRPC_NODE_TRACE)!==null&&_O!==void 0?_O:process.env.GRPC_TRACE)!==null&&yO!==void 0?yO:"",SO=new Set,hK=new Set;for(let t of kve.split(","))t.startsWith("-")?hK.add(t.substring(1)):SO.add(t);var Mve=SO.has("all");function Dve(t,e,r){mK(e)&&(0,hn.log)(t,new Date().toISOString()+" | v"+xve+" "+wve.pid+" | "+e+" | "+r)}function mK(t){return!hK.has(t)&&(Mve||SO.has(t))}});var iT=v(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0});nT.getErrorMessage=Lve;nT.getErrorCode=$ve;function Lve(t){return t instanceof Error?t.message:String(t)}function $ve(t){return typeof t=="object"&&t!==null&&"code"in t&&typeof t.code=="number"?t.code:null}});var Kt=v(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});sT.Metadata=void 0;var Uve=ht(),Fve=Ve(),Bve=iT(),jve=/^[:0-9a-z_.-]+$/,zve=/^[ -~]*$/;function Gve(t){return jve.test(t)}function qve(t){return zve.test(t)}function _K(t){return t.endsWith("-bin")}function Vve(t){return!t.startsWith("grpc-")}function oT(t){return t.toLowerCase()}function gK(t,e){if(!Gve(t))throw new Error('Metadata key "'+t+'" contains illegal characters');if(e!=null)if(_K(t)){if(!Buffer.isBuffer(e))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(e))throw new Error("keys that don't end with '-bin' must have String values");if(!qve(e))throw new Error('Metadata string value "'+e+'" contains illegal characters')}}var EO=class t{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,r){e=oT(e),gK(e,r),this.internalRepr.set(e,[r])}add(e,r){e=oT(e),gK(e,r);let n=this.internalRepr.get(e);n===void 0?this.internalRepr.set(e,[r]):n.push(r)}remove(e){e=oT(e),this.internalRepr.delete(e)}get(e){return e=oT(e),this.internalRepr.get(e)||[]}getMap(){let e={};for(let[r,n]of this.internalRepr)if(n.length>0){let i=n[0];e[r]=Buffer.isBuffer(i)?Buffer.from(i):i}return e}clone(){let e=new t(this.options),r=e.internalRepr;for(let[n,i]of this.internalRepr){let o=i.map(s=>Buffer.isBuffer(s)?Buffer.from(s):s);r.set(n,o)}return e}merge(e){for(let[r,n]of e.internalRepr){let i=(this.internalRepr.get(r)||[]).concat(n);this.internalRepr.set(r,i)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){let e={};for(let[r,n]of this.internalRepr)r.startsWith(":")||(e[r]=n.map(Hve));return e}toJSON(){let e={};for(let[r,n]of this.internalRepr)e[r]=n;return e}setOpaque(e,r){this.opaqueData.set(e,r)}getOpaque(e){return this.opaqueData.get(e)}static fromHttp2Headers(e){let r=new t;for(let n of Object.keys(e)){if(n.charAt(0)===":")continue;let i=e[n];try{_K(n)?Array.isArray(i)?i.forEach(o=>{r.add(n,Buffer.from(o,"base64"))}):i!==void 0&&(Vve(n)?i.split(",").forEach(o=>{r.add(n,Buffer.from(o.trim(),"base64"))}):r.add(n,Buffer.from(i,"base64"))):Array.isArray(i)?i.forEach(o=>{r.add(n,o)}):i!==void 0&&r.add(n,i)}catch(o){let s=`Failed to add metadata entry ${n}: ${i}. ${(0,Bve.getErrorMessage)(o)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,Uve.log)(Fve.LogVerbosity.ERROR,s)}}return r}};sT.Metadata=EO;var Hve=t=>Buffer.isBuffer(t)?t.toString("base64"):t});var cT=v(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.CallCredentials=void 0;var AO=Kt();function Wve(t){return"getRequestHeaders"in t&&typeof t.getRequestHeaders=="function"}var Sd=class t{static createFromMetadataGenerator(e){return new TO(e)}static createFromGoogleCredential(e){return t.createFromMetadataGenerator((r,n)=>{let i;Wve(e)?i=e.getRequestHeaders(r.service_url):i=new Promise((o,s)=>{e.getRequestMetadata(r.service_url,(a,c)=>{if(a){s(a);return}if(!c){s(new Error("Headers not set by metadata plugin"));return}o(c)})}),i.then(o=>{let s=new AO.Metadata;for(let a of Object.keys(o))s.add(a,o[a]);n(null,s)},o=>{n(o)})})}static createEmpty(){return new bO}};aT.CallCredentials=Sd;var vO=class t extends Sd{constructor(e){super(),this.creds=e}async generateMetadata(e){let r=new AO.Metadata,n=await Promise.all(this.creds.map(i=>i.generateMetadata(e)));for(let i of n)r.merge(i);return r}compose(e){return new t(this.creds.concat([e]))}_equals(e){return this===e?!0:e instanceof t?this.creds.every((r,n)=>r._equals(e.creds[n])):!1}},TO=class t extends Sd{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((r,n)=>{this.metadataGenerator(e,(i,o)=>{o!==void 0?r(o):n(i)})})}compose(e){return new vO([this,e])}_equals(e){return this===e?!0:e instanceof t?this.metadataGenerator===e.metadataGenerator:!1}},bO=class t extends Sd{generateMetadata(e){return Promise.resolve(new AO.Metadata)}compose(e){return e}_equals(e){return e instanceof t}}});var xO=v(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});ng.CIPHER_SUITES=void 0;ng.getDefaultRootsData=Kve;var Yve=Z("fs");ng.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var yK=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,wO=null;function Kve(){return yK?(wO===null&&(wO=Yve.readFileSync(yK)),wO):null}});var Dr=v(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.parseUri=Jve;Ed.splitHostPort=Xve;Ed.combineHostPort=Qve;Ed.uriToString=eTe;var Zve=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Jve(t){let e=Zve.exec(t);return e===null?null:{scheme:e[1],authority:e[2],path:e[3]}}var SK=/^\d+$/;function Xve(t){if(t.startsWith("[")){let e=t.indexOf("]");if(e===-1)return null;let r=t.substring(1,e);if(r.indexOf(":")===-1)return null;if(t.length>e+1)if(t[e+1]===":"){let n=t.substring(e+2);return SK.test(n)?{host:r,port:+n}:null}else return null;else return{host:r}}else{let e=t.split(":");return e.length===2?SK.test(e[1])?{host:e[0],port:+e[1]}:null:{host:t}}}function Qve(t){return t.port===void 0?t.host:t.host.includes(":")?`[${t.host}]:${t.port}`:`${t.host}:${t.port}`}function eTe(t){let e="";return t.scheme!==void 0&&(e+=t.scheme+":"),t.authority!==void 0&&(e+="//"+t.authority+"/"),e+=t.path,e}});var ai=v(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;Zo.registerResolver=tTe;Zo.registerDefaultScheme=rTe;Zo.createResolver=nTe;Zo.getDefaultAuthority=iTe;Zo.mapUriDefaultScheme=oTe;var CO=Dr();Zo.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var vd={},RO=null;function tTe(t,e){vd[t]=e}function rTe(t){RO=t}function nTe(t,e,r){if(t.scheme!==void 0&&t.scheme in vd)return new vd[t.scheme](t,e,r);throw new Error(`No resolver could be created for target ${(0,CO.uriToString)(t)}`)}function iTe(t){if(t.scheme!==void 0&&t.scheme in vd)return vd[t.scheme].getDefaultAuthority(t);throw new Error(`Invalid target ${(0,CO.uriToString)(t)}`)}function oTe(t){return t.scheme===void 0||!(t.scheme in vd)?RO!==null?{scheme:RO,authority:void 0,path:(0,CO.uriToString)(t)}:null:t}});var Td=v(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.ChannelCredentials=void 0;og.createCertificateProviderChannelCredentials=lTe;var ig=Z("tls"),dT=cT(),PO=xO(),EK=Dr(),sTe=ai(),aTe=ht(),cTe=Ve();function IO(t,e){if(t&&!(t instanceof Buffer))throw new TypeError(`${e}, if provided, must be a Buffer.`)}var ol=class{compose(e){return new kO(this,e)}static createSsl(e,r,n,i){var o;if(IO(e,"Root certificate"),IO(r,"Private key"),IO(n,"Certificate chain"),r&&!n)throw new Error("Private key must be given with accompanying certificate chain");if(!r&&n)throw new Error("Certificate chain must be given with accompanying private key");let s=(0,ig.createSecureContext)({ca:(o=e??(0,PO.getDefaultRootsData)())!==null&&o!==void 0?o:void 0,key:r??void 0,cert:n??void 0,ciphers:PO.CIPHER_SUITES});return new lT(s,i??{})}static createFromSecureContext(e,r){return new lT(e,r??{})}static createInsecure(){return new OO}};og.ChannelCredentials=ol;var OO=class t extends ol{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof t}_createSecureConnector(e,r,n){return{connect(i){return Promise.resolve({socket:i,secure:!1})},waitForReady:()=>Promise.resolve(),getCallCredentials:()=>n??dT.CallCredentials.createEmpty(),destroy(){}}}};function vK(t,e,r,n){var i,o;let s={secureContext:t},a=r;if("grpc.http_connect_target"in n){let d=(0,EK.parseUri)(n["grpc.http_connect_target"]);d&&(a=d)}let c=(0,sTe.getDefaultAuthority)(a),l=(0,EK.splitHostPort)(c),u=(i=l?.host)!==null&&i!==void 0?i:c;if(s.host=u,e.checkServerIdentity&&(s.checkServerIdentity=e.checkServerIdentity),e.rejectUnauthorized!==void 0&&(s.rejectUnauthorized=e.rejectUnauthorized),s.ALPNProtocols=["h2"],n["grpc.ssl_target_name_override"]){let d=n["grpc.ssl_target_name_override"],f=(o=s.checkServerIdentity)!==null&&o!==void 0?o:ig.checkServerIdentity;s.checkServerIdentity=(p,h)=>f(d,h),s.servername=d}else s.servername=u;return n["grpc-node.tls_enable_trace"]&&(s.enableTrace=!0),s}var NO=class{constructor(e,r){this.connectionOptions=e,this.callCredentials=r}connect(e){let r=Object.assign({socket:e},this.connectionOptions);return new Promise((n,i)=>{let o=(0,ig.connect)(r,()=>{var s;if((!((s=this.connectionOptions.rejectUnauthorized)!==null&&s!==void 0)||s)&&!o.authorized){i(o.authorizationError);return}n({socket:o,secure:!0})});o.on("error",s=>{i(s)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}},lT=class t extends ol{constructor(e,r){super(),this.secureContext=e,this.verifyOptions=r}_isSecure(){return!0}_equals(e){return this===e?!0:e instanceof t?this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity:!1}_createSecureConnector(e,r,n){let i=vK(this.secureContext,this.verifyOptions,e,r);return new NO(i,n??dT.CallCredentials.createEmpty())}},uT=class t extends ol{constructor(e,r,n){super(),this.caCertificateProvider=e,this.identityCertificateProvider=r,this.verifyOptions=n,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(e){var r,n;return this===e?!0:e instanceof t?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&((r=this.verifyOptions)===null||r===void 0?void 0:r.checkServerIdentity)===((n=e.verifyOptions)===null||n===void 0?void 0:n.checkServerIdentity):!1}ref(){var e;this.refcount===0&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(e=this.identityCertificateProvider)===null||e===void 0||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,this.refcount===0&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(e=this.identityCertificateProvider)===null||e===void 0||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,r,n){return this.ref(),new t.SecureConnectorImpl(this,e,r,n??dT.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return!(this.latestCaUpdate===void 0||this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,r;if(!this.latestCaUpdate||this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,ig.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(e=this.latestIdentityUpdate)===null||e===void 0?void 0:e.privateKey,cert:(r=this.latestIdentityUpdate)===null||r===void 0?void 0:r.certificate,ciphers:PO.CIPHER_SUITES})}catch(n){return(0,aTe.log)(cTe.LogVerbosity.ERROR,"Failed to createSecureContext with error "+n.message),null}}};uT.SecureConnectorImpl=class{constructor(t,e,r,n){this.parent=t,this.channelTarget=e,this.options=r,this.callCredentials=n}connect(t){return new Promise((e,r)=>{let n=this.parent.getLatestSecureContext();if(!n){r(new Error("Failed to load credentials"));return}t.closed&&r(new Error("Socket closed while loading credentials"));let i=vK(n,this.parent.verifyOptions,this.channelTarget,this.options),o=Object.assign({socket:t},i),s=()=>{r(new Error("Socket closed"))},a=l=>{r(l)},c=(0,ig.connect)(o,()=>{var l;if(c.removeListener("close",s),c.removeListener("error",a),(!((l=this.parent.verifyOptions.rejectUnauthorized)!==null&&l!==void 0)||l)&&!c.authorized){r(c.authorizationError);return}e({socket:c,secure:!0})});c.once("close",s),c.once("error",a)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function lTe(t,e,r){return new uT(t,e,r??{})}var kO=class t extends ol{constructor(e,r){if(super(),this.channelCredentials=e,this.callCredentials=r,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){let r=this.callCredentials.compose(e);return new t(this.channelCredentials,r)}_isSecure(){return!0}_equals(e){return this===e?!0:e instanceof t?this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials):!1}_createSecureConnector(e,r,n){let i=this.callCredentials.compose(n??dT.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,r,i)}}});var da=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.createChildChannelControlHelper=fTe;Ki.registerLoadBalancerType=pTe;Ki.registerDefaultLoadBalancerType=hTe;Ki.createLoadBalancer=mTe;Ki.isLoadBalancerNameRegistered=gTe;Ki.parseLoadBalancingConfig=TK;Ki.getDefaultConfig=_Te;Ki.selectLbConfigFromList=yTe;var uTe=ht(),dTe=Ve();function fTe(t,e){var r,n,i,o,s,a,c,l,u,d;return{createSubchannel:(n=(r=e.createSubchannel)===null||r===void 0?void 0:r.bind(e))!==null&&n!==void 0?n:t.createSubchannel.bind(t),updateState:(o=(i=e.updateState)===null||i===void 0?void 0:i.bind(e))!==null&&o!==void 0?o:t.updateState.bind(t),requestReresolution:(a=(s=e.requestReresolution)===null||s===void 0?void 0:s.bind(e))!==null&&a!==void 0?a:t.requestReresolution.bind(t),addChannelzChild:(l=(c=e.addChannelzChild)===null||c===void 0?void 0:c.bind(e))!==null&&l!==void 0?l:t.addChannelzChild.bind(t),removeChannelzChild:(d=(u=e.removeChannelzChild)===null||u===void 0?void 0:u.bind(e))!==null&&d!==void 0?d:t.removeChannelzChild.bind(t)}}var ua={},sg=null;function pTe(t,e,r){ua[t]={LoadBalancer:e,LoadBalancingConfig:r}}function hTe(t){sg=t}function mTe(t,e){let r=t.getLoadBalancerName();return r in ua?new ua[r].LoadBalancer(e):null}function gTe(t){return t in ua}function TK(t){let e=Object.keys(t);if(e.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let r=e[0];if(r in ua)try{return ua[r].LoadBalancingConfig.createFromJson(t[r])}catch(n){throw new Error(`${r}: ${n.message}`)}else throw new Error(`Unrecognized load balancing config name ${r}`)}function _Te(){if(!sg)throw new Error("No default load balancer type registered");return new ua[sg].LoadBalancingConfig}function yTe(t,e=!1){for(let r of t)try{return TK(r)}catch(n){(0,uTe.log)(dTe.LogVerbosity.DEBUG,"Config parsing failed with error",n.message);continue}return e&&sg?new ua[sg].LoadBalancingConfig:null}});var MO=v(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.validateRetryThrottling=bK;ag.validateServiceConfig=AK;ag.extractAndSelectServiceConfig=CTe;var STe=Z("os"),fT=Ve(),pT=/^\d+(\.\d{1,9})?s$/,ETe="node";function vTe(t){if("service"in t&&t.service!==""){if(typeof t.service!="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof t.service}`);if("method"in t&&t.method!==""){if(typeof t.method!="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof t.service}`);return{service:t.service,method:t.method}}else return{service:t.service}}else{if("method"in t&&t.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}function TTe(t){if(!("maxAttempts"in t)||!Number.isInteger(t.maxAttempts)||t.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in t)||typeof t.initialBackoff!="string"||!pT.test(t.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in t)||typeof t.maxBackoff!="string"||!pT.test(t.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in t)||typeof t.backoffMultiplier!="number"||t.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in t&&Array.isArray(t.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(t.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let e of t.retryableStatusCodes)if(typeof e=="number"){if(!Object.values(fT.Status).includes(e))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof e=="string"){if(!Object.values(fT.Status).includes(e.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:t.maxAttempts,initialBackoff:t.initialBackoff,maxBackoff:t.maxBackoff,backoffMultiplier:t.backoffMultiplier,retryableStatusCodes:t.retryableStatusCodes}}function bTe(t){if(!("maxAttempts"in t)||!Number.isInteger(t.maxAttempts)||t.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in t&&(typeof t.hedgingDelay!="string"||!pT.test(t.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in t&&Array.isArray(t.nonFatalStatusCodes))for(let r of t.nonFatalStatusCodes)if(typeof r=="number"){if(!Object.values(fT.Status).includes(r))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof r=="string"){if(!Object.values(fT.Status).includes(r.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let e={maxAttempts:t.maxAttempts};return t.hedgingDelay&&(e.hedgingDelay=t.hedgingDelay),t.nonFatalStatusCodes&&(e.nonFatalStatusCodes=t.nonFatalStatusCodes),e}function ATe(t){var e;let r={name:[]};if(!("name"in t)||!Array.isArray(t.name))throw new Error("Invalid method config: invalid name array");for(let n of t.name)r.name.push(vTe(n));if("waitForReady"in t){if(typeof t.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");r.waitForReady=t.waitForReady}if("timeout"in t)if(typeof t.timeout=="object"){if(!("seconds"in t.timeout)||typeof t.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in t.timeout)||typeof t.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");r.timeout=t.timeout}else if(typeof t.timeout=="string"&&pT.test(t.timeout)){let n=t.timeout.substring(0,t.timeout.length-1).split(".");r.timeout={seconds:n[0]|0,nanos:((e=n[1])!==null&&e!==void 0?e:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in t){if(typeof t.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxRequestBytes=t.maxRequestBytes}if("maxResponseBytes"in t){if(typeof t.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxResponseBytes=t.maxResponseBytes}if("retryPolicy"in t){if("hedgingPolicy"in t)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");r.retryPolicy=TTe(t.retryPolicy)}else"hedgingPolicy"in t&&(r.hedgingPolicy=bTe(t.hedgingPolicy));return r}function bK(t){if(!("maxTokens"in t)||typeof t.maxTokens!="number"||t.maxTokens<=0||t.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in t)||typeof t.tokenRatio!="number"||t.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+t.maxTokens.toFixed(3),tokenRatio:+t.tokenRatio.toFixed(3)}}function wTe(t){if(!(typeof t=="object"&&t!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof t}`);let e=Object.keys(t);if(e.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${e}`);if(e.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[e[0]]:t[e[0]]}}function AK(t){let e={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in t)if(typeof t.loadBalancingPolicy=="string")e.loadBalancingPolicy=t.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in t)if(Array.isArray(t.loadBalancingConfig))for(let n of t.loadBalancingConfig)e.loadBalancingConfig.push(wTe(n));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in t&&Array.isArray(t.methodConfig))for(let n of t.methodConfig)e.methodConfig.push(ATe(n));"retryThrottling"in t&&(e.retryThrottling=bK(t.retryThrottling));let r=[];for(let n of e.methodConfig)for(let i of n.name){for(let o of r)if(i.service===o.service&&i.method===o.method)throw new Error(`Invalid service config: duplicate name ${i.service}/${i.method}`);r.push(i)}return e}function xTe(t){if(!("serviceConfig"in t))throw new Error("Invalid service config choice: missing service config");let e={serviceConfig:AK(t.serviceConfig)};if("clientLanguage"in t)if(Array.isArray(t.clientLanguage)){e.clientLanguage=[];for(let n of t.clientLanguage)if(typeof n=="string")e.clientLanguage.push(n);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in t)if(Array.isArray(t.clientHostname)){e.clientHostname=[];for(let n of t.clientHostname)if(typeof n=="string")e.clientHostname.push(n);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in t)if(typeof t.percentage=="number"&&0<=t.percentage&&t.percentage<=100)e.percentage=t.percentage;else throw new Error("Invalid service config choice: invalid percentage");let r=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let n in t)if(!r.includes(n))throw new Error(`Invalid service config choice: unexpected field ${n}`);return e}function RTe(t,e){if(!Array.isArray(t))throw new Error("Invalid service config list");for(let r of t){let n=xTe(r);if(!(typeof n.percentage=="number"&&e>n.percentage)){if(Array.isArray(n.clientHostname)){let i=!1;for(let o of n.clientHostname)o===STe.hostname()&&(i=!0);if(!i)continue}if(Array.isArray(n.clientLanguage)){let i=!1;for(let o of n.clientLanguage)o===ETe&&(i=!0);if(!i)continue}return n.serviceConfig}}throw new Error("No matching service config found")}function CTe(t,e){for(let r of t)if(r.length>0&&r[0].startsWith("grpc_config=")){let n=r.join("").substring(12),i=JSON.parse(n);return RTe(i,e)}return null}});var Lr=v(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.ConnectivityState=void 0;var wK;(function(t){t[t.IDLE=0]="IDLE",t[t.CONNECTING=1]="CONNECTING",t[t.READY=2]="READY",t[t.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",t[t.SHUTDOWN=4]="SHUTDOWN"})(wK||(hT.ConnectivityState=wK={}))});var Jo=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.QueuePicker=fa.UnavailablePicker=fa.PickResultType=void 0;var ITe=Kt(),PTe=Ve(),mT;(function(t){t[t.COMPLETE=0]="COMPLETE",t[t.QUEUE=1]="QUEUE",t[t.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",t[t.DROP=3]="DROP"})(mT||(fa.PickResultType=mT={}));var DO=class{constructor(e){this.status=Object.assign({code:PTe.Status.UNAVAILABLE,details:"No connection established",metadata:new ITe.Metadata},e)}pick(e){return{pickResultType:mT.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};fa.UnavailablePicker=DO;var LO=class{constructor(e,r){this.loadBalancer=e,this.childPicker=r,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:mT.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};fa.QueuePicker=LO});var bd=v(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0});_T.BackoffTimeout=void 0;var OTe=Ve(),NTe=ht(),kTe="backoff",MTe=1e3,DTe=1.6,LTe=12e4,$Te=.2;function UTe(t,e){return Math.random()*(e-t)+t}var gT=class t{constructor(e,r){this.callback=e,this.initialDelay=MTe,this.multiplier=DTe,this.maxDelay=LTe,this.jitter=$Te,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=t.getNextId(),r&&(r.initialDelay&&(this.initialDelay=r.initialDelay),r.multiplier&&(this.multiplier=r.multiplier),r.jitter&&(this.jitter=r.jitter),r.maxDelay&&(this.maxDelay=r.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(e){NTe.trace(OTe.LogVerbosity.DEBUG,kTe,"{"+this.id+"} "+e)}runTimer(e){var r,n;this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||(n=(r=this.timerId).unref)===null||n===void 0||n.call(r)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),r=e*this.jitter;this.nextDelay=e+UTe(-r,r)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let e=new Date,r=this.startTime;r.setMilliseconds(r.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<r?this.runTimer(r.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,r;this.hasRef=!0,(r=(e=this.timerId).ref)===null||r===void 0||r.call(e)}unref(){var e,r;this.hasRef=!1,(r=(e=this.timerId).unref)===null||r===void 0||r.call(e)}getEndTime(){return this.endTime}};_T.BackoffTimeout=gT;gT.nextId=0});var ST=v(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.ChildLoadBalancerHandler=void 0;var FTe=da(),BTe=Lr(),jTe="child_load_balancer_helper",$O=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(r){this.parent=r,this.child=null}createSubchannel(r,n){return this.parent.channelControlHelper.createSubchannel(r,n)}updateState(r,n,i){var o;if(this.calledByPendingChild()){if(r===BTe.ConnectivityState.CONNECTING)return;(o=this.parent.currentChild)===null||o===void 0||o.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(r,n,i)}requestReresolution(){var r;let n=(r=this.parent.pendingChild)!==null&&r!==void 0?r:this.parent.currentChild;this.child===n&&this.parent.channelControlHelper.requestReresolution()}setChild(r){this.child=r}addChannelzChild(r){this.parent.channelControlHelper.addChannelzChild(r)}removeChannelzChild(r){this.parent.channelControlHelper.removeChannelzChild(r)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,r){return e.getLoadBalancerName()!==r.getLoadBalancerName()}updateAddressList(e,r,n,i){let o;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,r)){let s=new this.ChildPolicyHelper(this),a=(0,FTe.createLoadBalancer)(r,s);s.setChild(a),this.currentChild===null?(this.currentChild=a,o=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=a,o=this.pendingChild)}else this.pendingChild===null?o=this.currentChild:o=this.pendingChild;return this.latestConfig=r,o.updateAddressList(e,r,n,i)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return jTe}};yT.ChildLoadBalancerHandler=$O});var CK=v(ET=>{"use strict";Object.defineProperty(ET,"__esModule",{value:!0});ET.ResolvingLoadBalancer=void 0;var zTe=da(),GTe=MO(),Kr=Lr(),xK=ai(),cg=Jo(),qTe=bd(),UO=Ve(),VTe=Kt(),HTe=ht(),WTe=Ve(),YTe=Dr(),KTe=ST(),ZTe="resolving_load_balancer";function RK(t){HTe.trace(WTe.LogVerbosity.DEBUG,ZTe,t)}var JTe=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function XTe(t,e,r,n){for(let i of r.name)switch(n){case"EMPTY":if(!i.service&&!i.method)return!0;break;case"SERVICE":if(i.service===t&&!i.method)return!0;break;case"SERVICE_AND_METHOD":if(i.service===t&&i.method===e)return!0}return!1}function QTe(t,e,r,n){for(let i of r)if(XTe(t,e,i,n))return i;return null}function ebe(t){return{invoke(e,r){var n,i;let o=e.split("/").filter(c=>c.length>0),s=(n=o[0])!==null&&n!==void 0?n:"",a=(i=o[1])!==null&&i!==void 0?i:"";if(t&&t.methodConfig)for(let c of JTe){let l=QTe(s,a,t.methodConfig,c);if(l)return{methodConfig:l,pickInformation:{},status:UO.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:UO.Status.OK,dynamicFilterFactories:[]}},unref(){}}}var FO=class{constructor(e,r,n,i,o){this.target=e,this.channelControlHelper=r,this.channelOptions=n,this.onSuccessfulResolution=i,this.onFailedResolution=o,this.latestChildState=Kr.ConnectivityState.IDLE,this.latestChildPicker=new cg.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=Kr.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,n["grpc.service_config"]?this.defaultServiceConfig=(0,GTe.validateServiceConfig)(JSON.parse(n["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(Kr.ConnectivityState.IDLE,new cg.QueuePicker(this),null),this.childLoadBalancer=new KTe.ChildLoadBalancerHandler({createSubchannel:r.createSubchannel.bind(r),requestReresolution:()=>{this.backoffTimeout.isRunning()?(RK("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(a,c,l)=>{this.latestChildState=a,this.latestChildPicker=c,this.latestChildErrorMessage=l,this.updateState(a,c,l)},addChannelzChild:r.addChannelzChild.bind(r),removeChannelzChild:r.removeChannelzChild.bind(r)}),this.innerResolver=(0,xK.createResolver)(e,this.handleResolverResult.bind(this),n);let s={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new qTe.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},s),this.backoffTimeout.unref()}handleResolverResult(e,r,n,i){var o,s;this.backoffTimeout.stop(),this.backoffTimeout.reset();let a=!0,c=null;if(n===null?c=this.defaultServiceConfig:n.ok?c=n.value:this.previousServiceConfig!==null?c=this.previousServiceConfig:(a=!1,this.handleResolutionFailure(n.error)),c!==null){let l=(o=c?.loadBalancingConfig)!==null&&o!==void 0?o:[],u=(0,zTe.selectLbConfigFromList)(l,!0);u===null?(a=!1,this.handleResolutionFailure({code:UO.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new VTe.Metadata})):a=this.childLoadBalancer.updateAddressList(e,u,Object.assign(Object.assign({},this.channelOptions),r),i)}return a&&this.onSuccessfulResolution(c,(s=r[xK.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&s!==void 0?s:ebe(c)),a}updateResolution(){this.innerResolver.updateResolution(),this.currentState===Kr.ConnectivityState.IDLE&&this.updateState(Kr.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,r,n){RK((0,YTe.uriToString)(this.target)+" "+Kr.ConnectivityState[this.currentState]+" -> "+Kr.ConnectivityState[e]),e===Kr.ConnectivityState.IDLE&&(r=new cg.QueuePicker(this,r)),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}handleResolutionFailure(e){this.latestChildState===Kr.ConnectivityState.IDLE&&(this.updateState(Kr.ConnectivityState.TRANSIENT_FAILURE,new cg.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){(this.currentState===Kr.ConnectivityState.IDLE||this.currentState===Kr.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,r){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=Kr.ConnectivityState.IDLE,this.latestChildPicker=new cg.QueuePicker(this),this.currentState=Kr.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};ET.ResolvingLoadBalancer=FO});var IK=v(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});lg.recognizedOptions=void 0;lg.channelOptionsEqual=tbe;lg.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function tbe(t,e){let r=Object.keys(t).sort(),n=Object.keys(e).sort();if(r.length!==n.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==n[i]||t[r[i]]!==e[n[i]])return!1;return!0}});var Zr=v(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.EndpointMap=void 0;ci.isTcpSubchannelAddress=dg;ci.subchannelAddressEqual=vT;ci.subchannelAddressToString=OK;ci.stringToSubchannelAddress=nbe;ci.endpointEqual=ibe;ci.endpointToString=obe;ci.endpointHasAddress=NK;var PK=Z("net");function dg(t){return"port"in t}function vT(t,e){return!t&&!e?!0:!t||!e?!1:dg(t)?dg(e)&&t.host===e.host&&t.port===e.port:!dg(e)&&t.path===e.path}function OK(t){return dg(t)?(0,PK.isIPv6)(t.host)?"["+t.host+"]:"+t.port:t.host+":"+t.port:t.path}var rbe=443;function nbe(t,e){return(0,PK.isIP)(t)?{host:t,port:e??rbe}:{path:t}}function ibe(t,e){if(t.addresses.length!==e.addresses.length)return!1;for(let r=0;r<t.addresses.length;r++)if(!vT(t.addresses[r],e.addresses[r]))return!1;return!0}function obe(t){return"["+t.addresses.map(OK).join(", ")+"]"}function NK(t,e){for(let r of t.addresses)if(vT(r,e))return!0;return!1}function ug(t,e){if(t.addresses.length!==e.addresses.length)return!1;for(let r of t.addresses){let n=!1;for(let i of e.addresses)if(vT(r,i)){n=!0;break}if(!n)return!1}return!0}var BO=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(let r of this.map)if(NK(r.key,e))return r.value}deleteMissing(e){let r=[];for(let n of this.map){let i=!1;for(let o of e)ug(o,n.key)&&(i=!0);i||(r.push(n.value),this.map.delete(n))}return r}get(e){for(let r of this.map)if(ug(e,r.key))return r.value}set(e,r){for(let n of this.map)if(ug(e,n.key)){n.value=r;return}this.map.add({key:e,value:r})}delete(e){for(let r of this.map)if(ug(e,r.key)){this.map.delete(r);return}}has(e){for(let r of this.map)if(ug(e,r.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let e of this.map)yield e.key}*values(){for(let e of this.map)yield e.value}*entries(){for(let e of this.map)yield[e.key,e.value]}};ci.EndpointMap=BO});var MK={};ar(MK,{OrderedMap:()=>pbe});function Ad(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");jO(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function sbe(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(u){return c([l,u])}}function c(l){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(u){l=[6,u],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function sl(){throw new RangeError("Iterator access denied!")}var jO,kK,abe,cbe,lbe,ube,dbe,fbe,Xo,pbe,DK=A(()=>{"use strict";jO=function(t,e){return jO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},jO(t,e)};kK=(function(){function t(e,r,n){n===void 0&&(n=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=r,this.l=n}return t.prototype.v=function(){var e=this,r=e.h.h===e;if(r&&e.l===1)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(r)return e.h;for(var n=e.h;n.t===e;)e=n,n=e.h;e=n}return e},t.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}else{for(var r=e.h;r.i===e;)e=r,r=e.h;return e.i!==r?r:e}},t.prototype.T=function(){var e=this.h,r=this.i,n=r.t;return e.h===this?e.h=r:e.t===this?e.t=r:e.i=r,r.h=e,r.t=this,this.h=r,this.i=n,n&&(n.h=this),r},t.prototype.I=function(){var e=this.h,r=this.t,n=r.i;return e.h===this?e.h=r:e.t===this?e.t=r:e.i=r,r.h=e,r.i=this,this.h=r,this.t=n,n&&(n.h=this),r},t})(),abe=(function(t){Ad(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.O=1,r}return e.prototype.T=function(){var r=t.prototype.T.call(this);return this.M(),r.M(),r},e.prototype.I=function(){var r=t.prototype.I.call(this);return this.M(),r.M(),r},e.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},e})(kK),cbe=(function(){function t(e){e===void 0&&(e=0),this.iteratorType=e}return t.prototype.equals=function(e){return this.C===e.C},t})(),lbe=(function(){function t(){this._=0}return Object.defineProperty(t.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),t.prototype.size=function(){return this._},t.prototype.empty=function(){return this._===0},t})(),ube=(function(t){Ad(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(lbe);dbe=(function(t){Ad(e,t);function e(r,n){r===void 0&&(r=function(o,s){return o<s?-1:o>s?1:0}),n===void 0&&(n=!1);var i=t.call(this)||this;return i.N=void 0,i.g=r,i.enableIndex=n,i.S=n?abe:kK,i.A=new i.S,i}return e.prototype.m=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);if(o<0)r=r.i;else if(o>0)i=r,r=r.t;else return r}return i},e.prototype.B=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);o<=0?r=r.i:(i=r,r=r.t)}return i},e.prototype.j=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);if(o<0)i=r,r=r.i;else if(o>0)r=r.t;else return r}return i},e.prototype.k=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);o<0?(i=r,r=r.i):r=r.t}return i},e.prototype.R=function(r){for(;;){var n=r.h;if(n===this.A)return;if(r.l===1){r.l=0;return}if(r===n.t){var i=n.i;if(i.l===1)i.l=0,n.l=1,n===this.N?this.N=n.T():n.T();else if(i.i&&i.i.l===1){i.l=n.l,n.l=0,i.i.l=0,n===this.N?this.N=n.T():n.T();return}else i.t&&i.t.l===1?(i.l=1,i.t.l=0,i.I()):(i.l=1,r=n)}else{var i=n.t;if(i.l===1)i.l=0,n.l=1,n===this.N?this.N=n.I():n.I();else if(i.t&&i.t.l===1){i.l=n.l,n.l=0,i.t.l=0,n===this.N?this.N=n.I():n.I();return}else i.i&&i.i.l===1?(i.l=1,i.i.l=0,i.T()):(i.l=1,r=n)}}},e.prototype.G=function(r){if(this._===1){this.clear();return}for(var n=r;n.t||n.i;){if(n.i)for(n=n.i;n.t;)n=n.t;else n=n.t;var i=r.u;r.u=n.u,n.u=i;var o=r.o;r.o=n.o,n.o=o,r=n}this.A.t===n?this.A.t=n.h:this.A.i===n&&(this.A.i=n.h),this.R(n);var s=n.h;if(n===s.t?s.t=void 0:s.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;s!==this.A;)s.O-=1,s=s.h},e.prototype.P=function(r){for(var n=typeof r=="number"?r:void 0,i=typeof r=="function"?r:void 0,o=typeof r>"u"?[]:void 0,s=0,a=this.N,c=[];c.length||a;)if(a)c.push(a),a=a.t;else{if(a=c.pop(),s===n)return a;o&&o.push(a),i&&i(a,s,this),s+=1,a=a.i}return o},e.prototype.q=function(r){for(;;){var n=r.h;if(n.l===0)return;var i=n.h;if(n===i.t){var o=i.i;if(o&&o.l===1){if(o.l=n.l=0,i===this.N)return;i.l=1,r=i;continue}else if(r===n.i){if(r.l=0,r.t&&(r.t.h=n),r.i&&(r.i.h=i),n.i=r.t,i.t=r.i,r.t=n,r.i=i,i===this.N)this.N=r,this.A.h=r;else{var s=i.h;s.t===i?s.t=r:s.i=r}r.h=i.h,n.h=r,i.h=r,i.l=1}else{n.l=0,i===this.N?this.N=i.I():i.I(),i.l=1;return}}else{var o=i.t;if(o&&o.l===1){if(o.l=n.l=0,i===this.N)return;i.l=1,r=i;continue}else if(r===n.t){if(r.l=0,r.t&&(r.t.h=i),r.i&&(r.i.h=n),i.i=r.t,n.t=r.i,r.t=i,r.i=n,i===this.N)this.N=r,this.A.h=r;else{var s=i.h;s.t===i?s.t=r:s.i=r}r.h=i.h,n.h=r,i.h=r,i.l=1}else{n.l=0,i===this.N?this.N=i.T():i.T(),i.l=1;return}}this.enableIndex&&(n.M(),i.M(),r.M());return}},e.prototype.D=function(r,n,i){if(this.N===void 0)return this._+=1,this.N=new this.S(r,n,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var o,s=this.A.t,a=this.g(s.u,r);if(a===0)return s.o=n,this._;if(a>0)s.t=new this.S(r,n),s.t.h=s,o=s.t,this.A.t=o;else{var c=this.A.i,l=this.g(c.u,r);if(l===0)return c.o=n,this._;if(l<0)c.i=new this.S(r,n),c.i.h=c,o=c.i,this.A.i=o;else{if(i!==void 0){var u=i.C;if(u!==this.A){var d=this.g(u.u,r);if(d===0)return u.o=n,this._;if(d>0){var f=u.v(),p=this.g(f.u,r);if(p===0)return f.o=n,this._;p<0&&(o=new this.S(r,n),f.i===void 0?(f.i=o,o.h=f):(u.t=o,o.h=u))}}}if(o===void 0)for(o=this.N;;){var h=this.g(o.u,r);if(h>0){if(o.t===void 0){o.t=new this.S(r,n),o.t.h=o,o=o.t;break}o=o.t}else if(h<0){if(o.i===void 0){o.i=new this.S(r,n),o.i.h=o,o=o.i;break}o=o.i}else return o.o=n,this._}}}if(this.enableIndex)for(var m=o.h;m!==this.A;)m.O+=1,m=m.h;return this.q(o),this._+=1,this._},e.prototype.F=function(r,n){for(;r;){var i=this.g(r.u,n);if(i<0)r=r.i;else if(i>0)r=r.t;else return r}return r||this.A},e.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},e.prototype.updateKeyByIterator=function(r,n){var i=r.C;if(i===this.A&&sl(),this._===1)return i.u=n,!0;var o=i.p().u;if(i===this.A.t)return this.g(o,n)>0?(i.u=n,!0):!1;var s=i.v().u;return i===this.A.i?this.g(s,n)<0?(i.u=n,!0):!1:this.g(s,n)>=0||this.g(o,n)<=0?!1:(i.u=n,!0)},e.prototype.eraseElementByPos=function(r){if(r<0||r>this._-1)throw new RangeError;var n=this.P(r);return this.G(n),this._},e.prototype.eraseElementByKey=function(r){if(this._===0)return!1;var n=this.F(this.N,r);return n===this.A?!1:(this.G(n),!0)},e.prototype.eraseElementByIterator=function(r){var n=r.C;n===this.A&&sl();var i=n.i===void 0,o=r.iteratorType===0;return o?i&&r.next():(!i||n.t===void 0)&&r.next(),this.G(n),r},e.prototype.getHeight=function(){if(this._===0)return 0;function r(n){return n?Math.max(r(n.t),r(n.i))+1:0}return r(this.N)},e})(ube),fbe=(function(t){Ad(e,t);function e(r,n,i){var o=t.call(this,i)||this;return o.C=r,o.A=n,o.iteratorType===0?(o.pre=function(){return this.C===this.A.t&&sl(),this.C=this.C.v(),this},o.next=function(){return this.C===this.A&&sl(),this.C=this.C.p(),this}):(o.pre=function(){return this.C===this.A.i&&sl(),this.C=this.C.p(),this},o.next=function(){return this.C===this.A&&sl(),this.C=this.C.v(),this}),o}return Object.defineProperty(e.prototype,"index",{get:function(){var r=this.C,n=this.A.h;if(r===this.A)return n?n.O-1:0;var i=0;for(r.t&&(i+=r.t.O);r!==n;){var o=r.h;r===o.i&&(i+=1,o.t&&(i+=o.t.O)),r=o}return i},enumerable:!1,configurable:!0}),e.prototype.isAccessible=function(){return this.C!==this.A},e})(cbe),Xo=(function(t){Ad(e,t);function e(r,n,i,o){var s=t.call(this,r,n,o)||this;return s.container=i,s}return Object.defineProperty(e.prototype,"pointer",{get:function(){this.C===this.A&&sl();var r=this;return new Proxy([],{get:function(n,i){return i==="0"?r.C.u:i==="1"?r.C.o:(n[0]=r.C.u,n[1]=r.C.o,n[i])},set:function(n,i,o){if(i!=="1")throw new TypeError("prop must be 1");return r.C.o=o,!0}})},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.C,this.A,this.container,this.iteratorType)},e})(fbe),pbe=(function(t){Ad(e,t);function e(r,n,i){r===void 0&&(r=[]);var o=t.call(this,n,i)||this,s=o;return r.forEach((function(a){s.setElement(a[0],a[1])})),o}return e.prototype.begin=function(){return new Xo(this.A.t||this.A,this.A,this)},e.prototype.end=function(){return new Xo(this.A,this.A,this)},e.prototype.rBegin=function(){return new Xo(this.A.i||this.A,this.A,this,1)},e.prototype.rEnd=function(){return new Xo(this.A,this.A,this,1)},e.prototype.front=function(){if(this._!==0){var r=this.A.t;return[r.u,r.o]}},e.prototype.back=function(){if(this._!==0){var r=this.A.i;return[r.u,r.o]}},e.prototype.lowerBound=function(r){var n=this.m(this.N,r);return new Xo(n,this.A,this)},e.prototype.upperBound=function(r){var n=this.B(this.N,r);return new Xo(n,this.A,this)},e.prototype.reverseLowerBound=function(r){var n=this.j(this.N,r);return new Xo(n,this.A,this)},e.prototype.reverseUpperBound=function(r){var n=this.k(this.N,r);return new Xo(n,this.A,this)},e.prototype.forEach=function(r){this.P((function(n,i,o){r([n.u,n.o],i,o)}))},e.prototype.setElement=function(r,n,i){return this.D(r,n,i)},e.prototype.getElementByPos=function(r){if(r<0||r>this._-1)throw new RangeError;var n=this.P(r);return[n.u,n.o]},e.prototype.find=function(r){var n=this.F(this.N,r);return new Xo(n,this.A,this)},e.prototype.getElementByKey=function(r){var n=this.F(this.N,r);return n.o},e.prototype.union=function(r){var n=this;return r.forEach((function(i){n.setElement(i[0],i[1])})),this._},e.prototype[Symbol.iterator]=function(){var r,n,i,o;return sbe(this,(function(s){switch(s.label){case 0:r=this._,n=this.P(),i=0,s.label=1;case 1:return i<r?(o=n[i],[4,[o.u,o.o]]):[3,4];case 2:s.sent(),s.label=3;case 3:return++i,[3,1];case 4:return[2]}}))},e})(dbe)});var bT=v(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.registerAdminService=hbe;TT.addAdminServicesToServer=mbe;var LK=[];function hbe(t,e){LK.push({getServiceDefinition:t,getHandlers:e})}function mbe(t){for(let{getServiceDefinition:e,getHandlers:r}of LK)t.addService(e(),r())}});var $K=v(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.ClientDuplexStreamImpl=li.ClientWritableStreamImpl=li.ClientReadableStreamImpl=li.ClientUnaryCallImpl=void 0;li.callErrorFromStatus=_be;var gbe=Z("events"),HO=Z("stream"),fg=Ve();function _be(t,e){let r=`${t.code} ${fg.Status[t.code]}: ${t.details}`,i=`${new Error(r).stack}
2
+ var Iye=Object.create;var iE=Object.defineProperty;var Pye=Object.getOwnPropertyDescriptor;var Oye=Object.getOwnPropertyNames;var Nye=Object.getPrototypeOf,kye=Object.prototype.hasOwnProperty;var Z=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var A=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ar=(t,e)=>{for(var r in e)iE(t,r,{get:e[r],enumerable:!0})},GV=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oye(e))!kye.call(t,i)&&i!==r&&iE(t,i,{get:()=>e[i],enumerable:!(n=Pye(e,i))||n.enumerable});return t};var fn=(t,e,r)=>(r=t!=null?Iye(Nye(t)):{},GV(e||!t||!t.__esModule?iE(r,"default",{value:t,enumerable:!0}):r,t)),Nr=t=>GV(iE({},"__esModule",{value:!0}),t);var zo,_P=A(()=>{"use strict";zo="1.9.1"});function Mye(t){let e=new Set([t]),r=new Set,n=t.match(qV);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(c){return c===t};function o(a){return r.add(a),!1}function s(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(r.has(c))return!1;let l=c.match(qV);if(!l)return o(c);let u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||i.major!==u.major?o(c):i.major===0?i.minor===u.minor&&i.patch<=u.patch?s(c):o(c):i.minor<=u.minor?s(c):o(c)}}var qV,VV,HV=A(()=>{"use strict";_P();qV=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;VV=Mye(zo)});function ji(t,e,r,n=!1){var i;let o=Sm[ym]=(i=Sm[ym])!==null&&i!==void 0?i:{version:zo};if(!n&&o[t]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${t}`);return r.error(s.stack||s.message),!1}if(o.version!==zo){let s=new Error(`@opentelemetry/api: Registration of version v${o.version} for ${t} does not match previously registered API v${zo}`);return r.error(s.stack||s.message),!1}return o[t]=e,r.debug(`@opentelemetry/api: Registered a global for ${t} v${zo}.`),!0}function pn(t){var e,r;let n=(e=Sm[ym])===null||e===void 0?void 0:e.version;if(!(!n||!VV(n)))return(r=Sm[ym])===null||r===void 0?void 0:r[t]}function zi(t,e){e.debug(`@opentelemetry/api: Unregistering a global for ${t} v${zo}.`);let r=Sm[ym];r&&delete r[t]}var Dye,ym,Sm,Vc=A(()=>{"use strict";_P();HV();Dye=zo.split(".")[0],ym=Symbol.for(`opentelemetry.js.api.${Dye}`),Sm=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function Em(t,e,r){let n=pn("diag");if(n)return n[t](e,...r)}var oE,WV=A(()=>{"use strict";Vc();oE=class{constructor(e){this._namespace=e.namespace||"DiagComponentLogger"}debug(...e){return Em("debug",this._namespace,e)}error(...e){return Em("error",this._namespace,e)}info(...e){return Em("info",this._namespace,e)}warn(...e){return Em("warn",this._namespace,e)}verbose(...e){return Em("verbose",this._namespace,e)}}});var Ke,sE=A(()=>{"use strict";(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"})(Ke||(Ke={}))});function YV(t,e){t<Ke.NONE?t=Ke.NONE:t>Ke.ALL&&(t=Ke.ALL),e=e||{};function r(n,i){let o=e[n];return typeof o=="function"&&t>=i?o.bind(e):function(){}}return{error:r("error",Ke.ERROR),warn:r("warn",Ke.WARN),info:r("info",Ke.INFO),debug:r("debug",Ke.DEBUG),verbose:r("verbose",Ke.VERBOSE)}}var KV=A(()=>{"use strict";sE()});var Lye,Wt,Hc=A(()=>{"use strict";WV();KV();sE();Vc();Lye="diag",Wt=class t{static instance(){return this._instance||(this._instance=new t),this._instance}constructor(){function e(i){return function(...o){let s=pn("diag");if(s)return s[i](...o)}}let r=this,n=(i,o={logLevel:Ke.INFO})=>{var s,a,c;if(i===r){let d=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=d.stack)!==null&&s!==void 0?s:d.message),!1}typeof o=="number"&&(o={logLevel:o});let l=pn("diag"),u=YV((a=o.logLevel)!==null&&a!==void 0?a:Ke.INFO,i);if(l&&!o.suppressOverrideMessage){let d=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";l.warn(`Current logger will be overwritten from ${d}`),u.warn(`Current logger will overwrite one already registered from ${d}`)}return ji("diag",u,r,!0)};r.setLogger=n,r.disable=()=>{zi(Lye,r)},r.createComponentLogger=i=>new oE(i),r.verbose=e("verbose"),r.debug=e("debug"),r.info=e("info"),r.warn=e("warn"),r.error=e("error")}}});var aE,ZV=A(()=>{"use strict";aE=class t{constructor(e){this._entries=e?new Map(e):new Map}getEntry(e){let r=this._entries.get(e);if(r)return Object.assign({},r)}getAllEntries(){return Array.from(this._entries.entries())}setEntry(e,r){let n=new t(this._entries);return n._entries.set(e,r),n}removeEntry(e){let r=new t(this._entries);return r._entries.delete(e),r}removeEntries(...e){let r=new t(this._entries);for(let n of e)r._entries.delete(n);return r}clear(){return new t}}});var JV,XV=A(()=>{"use strict";JV=Symbol("BaggageEntryMetadata")});function QV(t={}){return new aE(new Map(Object.entries(t)))}function Hu(t){return typeof t!="string"&&($ye.error(`Cannot create baggage metadata from unknown type: ${typeof t}`),t=""),{__TYPE__:JV,toString(){return t}}}var $ye,yP=A(()=>{"use strict";Hc();ZV();XV();$ye=Wt.instance()});function Yt(t){return Symbol.for(t)}var SP,cE,vm=A(()=>{"use strict";SP=class t{constructor(e){let r=this;r._currentContext=e?new Map(e):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{let o=new t(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=n=>{let i=new t(r._currentContext);return i._currentContext.delete(n),i}}},cE=new SP});var EP,vP,lE,eH=A(()=>{"use strict";EP=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],vP={};if(typeof console<"u"){let t=["error","warn","info","debug","trace","log"];for(let e of t)typeof console[e]=="function"&&(vP[e]=console[e])}lE=class{constructor(){function e(r){return function(...n){let i=vP[r];if(typeof i!="function"&&(i=vP.log),typeof i!="function"&&console&&(i=console[r],typeof i!="function"&&(i=console.log)),typeof i=="function")return i.apply(console,n)}}for(let r=0;r<EP.length;r++)this[EP[r].n]=e(EP[r].c)}}});function ta(){return PP}var TP,Wu,bP,AP,wP,xP,Tm,RP,CP,IP,PP,Uye,Fye,Bye,jye,zye,Gye,qye,OP=A(()=>{"use strict";TP=class{constructor(){}createGauge(e,r){return Fye}createHistogram(e,r){return Bye}createCounter(e,r){return Uye}createUpDownCounter(e,r){return jye}createObservableGauge(e,r){return Gye}createObservableCounter(e,r){return zye}createObservableUpDownCounter(e,r){return qye}addBatchObservableCallback(e,r){}removeBatchObservableCallback(e){}},Wu=class{},bP=class extends Wu{add(e,r){}},AP=class extends Wu{add(e,r){}},wP=class extends Wu{record(e,r){}},xP=class extends Wu{record(e,r){}},Tm=class{addCallback(e){}removeCallback(e){}},RP=class extends Tm{},CP=class extends Tm{},IP=class extends Tm{},PP=new TP,Uye=new bP,Fye=new wP,Bye=new xP,jye=new AP,zye=new RP,Gye=new CP,qye=new IP});var Go,tH=A(()=>{"use strict";(function(t){t[t.INT=0]="INT",t[t.DOUBLE=1]="DOUBLE"})(Go||(Go={}))});var uE,dE,NP=A(()=>{"use strict";uE={get(t,e){if(t!=null)return t[e]},keys(t){return t==null?[]:Object.keys(t)}},dE={set(t,e,r){t!=null&&(t[e]=r)}}});var fE,rH=A(()=>{"use strict";vm();fE=class{active(){return cE}with(e,r,n,...i){return r.call(n,...i)}bind(e,r){return r}enable(){return this}disable(){return this}}});var kP,Vye,Gi,bm=A(()=>{"use strict";rH();Vc();Hc();kP="context",Vye=new fE,Gi=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalContextManager(e){return ji(kP,e,Wt.instance())}active(){return this._getContextManager().active()}with(e,r,n,...i){return this._getContextManager().with(e,r,n,...i)}bind(e,r){return this._getContextManager().bind(e,r)}_getContextManager(){return pn(kP)||Vye}disable(){this._getContextManager().disable(),zi(kP,Wt.instance())}}});var Ct,MP=A(()=>{"use strict";(function(t){t[t.NONE=0]="NONE",t[t.SAMPLED=1]="SAMPLED"})(Ct||(Ct={}))});var Am,wm,Yu,pE=A(()=>{"use strict";MP();Am="0000000000000000",wm="00000000000000000000000000000000",Yu={traceId:wm,spanId:Am,traceFlags:Ct.NONE}});var qi,hE=A(()=>{"use strict";pE();qi=class{constructor(e=Yu){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,r){return this}setAttributes(e){return this}addEvent(e,r){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,r){}}});function mE(t){return t.getValue(DP)||void 0}function nH(){return mE(Gi.getInstance().active())}function xm(t,e){return t.setValue(DP,e)}function iH(t){return t.deleteValue(DP)}function oH(t,e){return xm(t,new qi(e))}function gE(t){var e;return(e=mE(t))===null||e===void 0?void 0:e.spanContext()}var DP,LP=A(()=>{"use strict";vm();hE();bm();DP=Yt("OpenTelemetry Context Key SPAN")});function sH(t,e){if(typeof t!="string"||t.length!==e)return!1;let r=0;for(let n=0;n<t.length;n+=4)r+=(_E[t.charCodeAt(n)]|0)+(_E[t.charCodeAt(n+1)]|0)+(_E[t.charCodeAt(n+2)]|0)+(_E[t.charCodeAt(n+3)]|0);return r===e}function Rm(t){return sH(t,32)&&t!==wm}function $P(t){return sH(t,16)&&t!==Am}function Wr(t){return Rm(t.traceId)&&$P(t.spanId)}function aH(t){return new qi(t)}var _E,yE=A(()=>{"use strict";pE();hE();_E=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 Hye(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 UP,Ku,FP=A(()=>{"use strict";bm();LP();hE();yE();UP=Gi.getInstance(),Ku=class{startSpan(e,r,n=UP.active()){if(!!r?.root)return new qi;let o=n&&gE(n);return Hye(o)&&Wr(o)?new qi(o):new qi}startActiveSpan(e,r,n,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);let c=s??UP.active(),l=this.startSpan(e,o,c),u=xm(c,l);return UP.with(u,a,void 0,l)}}});var Wye,Zu,BP=A(()=>{"use strict";FP();Wye=new Ku,Zu=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}startSpan(e,r,n){return this._getTracer().startSpan(e,r,n)}startActiveSpan(e,r,n,i){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,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):Wye}}});var SE,cH=A(()=>{"use strict";FP();SE=class{getTracer(e,r,n){return new Ku}}});var Yye,Wc,jP=A(()=>{"use strict";BP();cH();Yye=new SE,Wc=class{getTracer(e,r,n){var i;return(i=this.getDelegateTracer(e,r,n))!==null&&i!==void 0?i:new Zu(this,e,r,n)}getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:Yye}setDelegate(e){this._delegate=e}getDelegateTracer(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(e,r,n)}}});var Yc,lH=A(()=>{"use strict";(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Yc||(Yc={}))});var oi,uH=A(()=>{"use strict";(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"})(oi||(oi={}))});var Er,dH=A(()=>{"use strict";(function(t){t[t.UNSET=0]="UNSET",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR"})(Er||(Er={}))});function fH(t){return Jye.test(t)}function pH(t){return Xye.test(t)&&!Qye.test(t)}var zP,Kye,Zye,Jye,Xye,Qye,hH=A(()=>{"use strict";zP="[_0-9a-z-*/]",Kye=`[a-z]${zP}{0,255}`,Zye=`[a-z0-9]${zP}{0,240}@[a-z]${zP}{0,13}`,Jye=new RegExp(`^(?:${Kye}|${Zye})$`),Xye=/^[ -~]{0,255}[!-~]$/,Qye=/,|=/});var mH,eSe,gH,_H,EE,yH=A(()=>{"use strict";hH();mH=32,eSe=512,gH=",",_H="=",EE=class t{constructor(e){this._internalState=new Map,e&&this._parse(e)}set(e,r){let n=this._clone();return n._internalState.has(e)&&n._internalState.delete(e),n._internalState.set(e,r),n}unset(e){let r=this._clone();return r._internalState.delete(e),r}get(e){return this._internalState.get(e)}serialize(){return Array.from(this._internalState.keys()).reduceRight((e,r)=>(e.push(r+_H+this.get(r)),e),[]).join(gH)}_parse(e){e.length>eSe||(this._internalState=e.split(gH).reduceRight((r,n)=>{let i=n.trim(),o=i.indexOf(_H);if(o!==-1){let s=i.slice(0,o),a=i.slice(o+1,n.length);fH(s)&&pH(a)&&r.set(s,a)}return r},new Map),this._internalState.size>mH&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,mH))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let e=new t;return e._internalState=new Map(this._internalState),e}}});function SH(t){return new EE(t)}var EH=A(()=>{"use strict";yH()});var pt,vH=A(()=>{"use strict";bm();pt=Gi.getInstance()});var J,TH=A(()=>{"use strict";Hc();J=Wt.instance()});var GP,bH,AH=A(()=>{"use strict";OP();GP=class{getMeter(e,r,n){return PP}},bH=new GP});var qP,vE,wH=A(()=>{"use strict";AH();Vc();Hc();qP="metrics",vE=class t{constructor(){}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalMeterProvider(e){return ji(qP,e,Wt.instance())}getMeterProvider(){return pn(qP)||bH}getMeter(e,r,n){return this.getMeterProvider().getMeter(e,r,n)}disable(){zi(qP,Wt.instance())}}});var Cm,xH=A(()=>{"use strict";wH();Cm=vE.getInstance()});var TE,RH=A(()=>{"use strict";TE=class{inject(e,r){}extract(e,r){return e}fields(){return[]}}});function HP(t){return t.getValue(VP)||void 0}function CH(){return HP(Gi.getInstance().active())}function IH(t,e){return t.setValue(VP,e)}function PH(t){return t.deleteValue(VP)}var VP,OH=A(()=>{"use strict";bm();vm();VP=Yt("OpenTelemetry Baggage Key")});var WP,tSe,bE,NH=A(()=>{"use strict";Vc();RH();NP();OH();yP();Hc();WP="propagation",tSe=new TE,bE=class t{constructor(){this.createBaggage=QV,this.getBaggage=HP,this.getActiveBaggage=CH,this.setBaggage=IH,this.deleteBaggage=PH}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalPropagator(e){return ji(WP,e,Wt.instance())}inject(e,r,n=dE){return this._getGlobalPropagator().inject(e,r,n)}extract(e,r,n=uE){return this._getGlobalPropagator().extract(e,r,n)}fields(){return this._getGlobalPropagator().fields()}disable(){zi(WP,Wt.instance())}_getGlobalPropagator(){return pn(WP)||tSe}}});var kr,kH=A(()=>{"use strict";NH();kr=bE.getInstance()});var YP,AE,MH=A(()=>{"use strict";Vc();jP();yE();LP();Hc();YP="trace",AE=class t{constructor(){this._proxyTracerProvider=new Wc,this.wrapSpanContext=aH,this.isSpanContextValid=Wr,this.deleteSpan=iH,this.getSpan=mE,this.getActiveSpan=nH,this.getSpanContext=gE,this.setSpan=xm,this.setSpanContext=oH}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalTracerProvider(e){let r=ji(YP,this._proxyTracerProvider,Wt.instance());return r&&this._proxyTracerProvider.setDelegate(e),r}getTracerProvider(){return pn(YP)||this._proxyTracerProvider}getTracer(e,r){return this.getTracerProvider().getTracer(e,r)}disable(){zi(YP,Wt.instance()),this._proxyTracerProvider=new Wc}}});var ot,DH=A(()=>{"use strict";MH();ot=AE.getInstance()});var ra={};ar(ra,{DiagConsoleLogger:()=>lE,DiagLogLevel:()=>Ke,INVALID_SPANID:()=>Am,INVALID_SPAN_CONTEXT:()=>Yu,INVALID_TRACEID:()=>wm,ProxyTracer:()=>Zu,ProxyTracerProvider:()=>Wc,ROOT_CONTEXT:()=>cE,SamplingDecision:()=>Yc,SpanKind:()=>oi,SpanStatusCode:()=>Er,TraceFlags:()=>Ct,ValueType:()=>Go,baggageEntryMetadataFromString:()=>Hu,context:()=>pt,createContextKey:()=>Yt,createNoopMeter:()=>ta,createTraceState:()=>SH,default:()=>rSe,defaultTextMapGetter:()=>uE,defaultTextMapSetter:()=>dE,diag:()=>J,isSpanContextValid:()=>Wr,isValidSpanId:()=>$P,isValidTraceId:()=>Rm,metrics:()=>Cm,propagation:()=>kr,trace:()=>ot});var rSe,Ee=A(()=>{"use strict";yP();vm();eH();sE();OP();tH();NP();BP();jP();lH();uH();dH();MP();EH();yE();pE();vH();TH();xH();kH();DH();rSe={context:pt,diag:J,metrics:Cm,propagation:kr,trace:ot}});var UH=A(()=>{"use strict"});var FH=A(()=>{"use strict";UH()});var BH=A(()=>{"use strict"});var jH=A(()=>{"use strict";BH()});var KP,wE,zH,xE,GH,Vo,Ju,Ho,Wo,qH=A(()=>{"use strict";KP="error.type",wE="exception.message",zH="exception.stacktrace",xE="exception.type",GH="service.name",Vo="telemetry.sdk.language",Ju="nodejs",Ho="telemetry.sdk.name",Wo="telemetry.sdk.version"});var VH=A(()=>{"use strict"});var HH=A(()=>{"use strict"});var Kc=A(()=>{"use strict";FH();jH();qH();VH();HH()});var o0=v(ME=>{"use strict";Object.defineProperty(ME,"__esModule",{value:!0});ME.AbstractAsyncHooksContextManager=void 0;var SSe=Z("events"),ESe=["addListener","on","once","prependListener","prependOnceListener"],i0=class{bind(e,r){return r instanceof SSe.EventEmitter?this._bindEventEmitter(e,r):typeof r=="function"?this._bindFunction(e,r):r}_bindFunction(e,r){let n=this,i=function(...o){return n.with(e,()=>r.apply(this,o))};return Object.defineProperty(i,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),i}_bindEventEmitter(e,r){return this._getPatchMap(r)!==void 0||(this._createPatchMap(r),ESe.forEach(i=>{r[i]!==void 0&&(r[i]=this._patchAddListener(r,r[i],e))}),typeof r.removeListener=="function"&&(r.removeListener=this._patchRemoveListener(r,r.removeListener)),typeof r.off=="function"&&(r.off=this._patchRemoveListener(r,r.off)),typeof r.removeAllListeners=="function"&&(r.removeAllListeners=this._patchRemoveAllListeners(r,r.removeAllListeners))),r}_patchRemoveListener(e,r){let n=this;return function(i,o){let s=n._getPatchMap(e)?.[i];if(s===void 0)return r.call(this,i,o);let a=s.get(o);return r.call(this,i,a||o)}}_patchRemoveAllListeners(e,r){let n=this;return function(i){let o=n._getPatchMap(e);return o!==void 0&&(arguments.length===0?n._createPatchMap(e):o[i]!==void 0&&delete o[i]),r.apply(this,arguments)}}_patchAddListener(e,r,n){let i=this;return function(o,s){if(i._wrapped)return r.call(this,o,s);let a=i._getPatchMap(e);a===void 0&&(a=i._createPatchMap(e));let c=a[o];c===void 0&&(c=new WeakMap,a[o]=c);let l=i.bind(n,s);c.set(s,l),i._wrapped=!0;try{return r.call(this,o,l)}finally{i._wrapped=!1}}}_createPatchMap(e){let r=Object.create(null);return e[this._kOtListeners]=r,r}_getPatchMap(e){return e[this._kOtListeners]}_kOtListeners=Symbol("OtListeners");_wrapped=!1};ME.AbstractAsyncHooksContextManager=i0});var i6=v(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.AsyncHooksContextManager=void 0;var vSe=(Ee(),Nr(ra)),TSe=Z("async_hooks"),bSe=o0(),s0=class extends bSe.AbstractAsyncHooksContextManager{_asyncHook;_contexts=new Map;_stack=[];constructor(){super(),this._asyncHook=TSe.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){return this._stack[this._stack.length-1]??vSe.ROOT_CONTEXT}with(e,r,n,...i){this._enterContext(e);try{return r.call(n,...i)}finally{this._exitContext()}}enable(){return this._asyncHook.enable(),this}disable(){return this._asyncHook.disable(),this._contexts.clear(),this._stack=[],this}_init(e,r){if(r==="TIMERWRAP")return;let n=this._stack[this._stack.length-1];n!==void 0&&this._contexts.set(e,n)}_destroy(e){this._contexts.delete(e)}_before(e){let r=this._contexts.get(e);r!==void 0&&this._enterContext(r)}_after(){this._exitContext()}_enterContext(e){this._stack.push(e)}_exitContext(){this._stack.pop()}};DE.AsyncHooksContextManager=s0});var o6=v(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE.AsyncLocalStorageContextManager=void 0;var ASe=(Ee(),Nr(ra)),wSe=Z("async_hooks"),xSe=o0(),a0=class extends xSe.AbstractAsyncHooksContextManager{_asyncLocalStorage;constructor(){super(),this._asyncLocalStorage=new wSe.AsyncLocalStorage}active(){return this._asyncLocalStorage.getStore()??ASe.ROOT_CONTEXT}with(e,r,n,...i){let o=n==null?r:r.bind(n);return this._asyncLocalStorage.run(e,o,...i)}enable(){return this}disable(){return this._asyncLocalStorage.disable(),this}};LE.AsyncLocalStorageContextManager=a0});var s6=v(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});td.AsyncLocalStorageContextManager=td.AsyncHooksContextManager=void 0;var RSe=i6();Object.defineProperty(td,"AsyncHooksContextManager",{enumerable:!0,get:function(){return RSe.AsyncHooksContextManager}});var CSe=o6();Object.defineProperty(td,"AsyncLocalStorageContextManager",{enumerable:!0,get:function(){return CSe.AsyncLocalStorageContextManager}})});function $E(t){return t.setValue(c0,!0)}function a6(t){return t.deleteValue(c0)}function rd(t){return t.getValue(c0)===!0}var c0,km=A(()=>{"use strict";Ee();c0=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});var UE,c6=A(()=>{"use strict";UE="baggage"});function f6(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?",":""}${r}`;return n.length>8192?e:n},"")}function p6(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function h6(t){if(!t)return;let e=t.indexOf(";"),r=e===-1?t:t.substring(0,e),n=r.indexOf("=");if(n<=0)return;let i=r.substring(0,n).trim(),o=r.substring(n+1).trim();if(!i||!o)return;let s,a;try{s=decodeURIComponent(i),a=decodeURIComponent(o)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=Hu(l)}return{key:s,value:a,metadata:c}}function l0(t,e,r,n){let i=0;for(;i<t.length&&r<180;){let o=t.indexOf(",",i),s=o===-1?t.length:o,a=s-i;if(a<=4096){let c=h6(t.substring(i,s));if(c){let l=(r===0?0:1)+a;if(n+l>8192)break;e[c.key]=c.metadata?{value:c.value,metadata:c.metadata}:{value:c.value},r++,n+=l}}if(o===-1)break;i=o+1}return[r,n]}function m6(t){let e={};return typeof t=="string"&&t.length>0&&t.split(",").forEach(r=>{let n=h6(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}var u0=A(()=>{"use strict";Ee()});var FE,g6=A(()=>{"use strict";Ee();km();c6();u0();FE=class{inject(e,r,n){let i=kr.getBaggage(e);if(!i||rd(e))return;let o=p6(i).filter(a=>a.length<=4096).slice(0,180),s=f6(o);s.length>0&&n.set(r,UE,s)}extract(e,r,n){let i=n.get(r,UE);if(!i)return e;let o={},s=0,a=0;if(Array.isArray(i))for(let c=0;c<i.length;c++)[s,a]=l0(i[c],o,s,a);else[s]=l0(i,o,s,a);return s===0?e:kr.setBaggage(e,kr.createBaggage(o))}fields(){return[UE]}}});var BE,_6=A(()=>{"use strict";BE=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}});function y6(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!OSe(r)){J.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!d0(n)){J.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function OSe(t){return typeof t=="string"&&t!==""}function d0(t){return t==null?!0:Array.isArray(t)?NSe(t):S6(typeof t)}function NSe(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(S6(n)){e=n;continue}return!1}return!1}}return!0}function S6(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}var E6=A(()=>{"use strict";Ee()});function jE(){return t=>{J.error(kSe(t))}}function kSe(t){return typeof t=="string"?t:JSON.stringify(MSe(t))}function MSe(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}var f0=A(()=>{"use strict";Ee()});function T6(t){v6=t}function b6(t){try{v6(t)}catch{}}var v6,A6=A(()=>{"use strict";f0();v6=jE()});import{inspect as w6}from"util";function Ot(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){J.warn(`Unknown value ${w6(e)} for ${t}, expected a number, using defaults`);return}return r}function Zc(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}function zE(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||J.warn(`Unknown value ${w6(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function GE(t){return Zc(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}var x6=A(()=>{"use strict";Ee()});var qE,R6=A(()=>{"use strict";qE=globalThis});var C6,I6=A(()=>{"use strict";C6="2.9.0"});var P6,O6=A(()=>{"use strict";P6="process.runtime.name"});var VE,N6=A(()=>{"use strict";I6();Kc();O6();VE={[Ho]:"opentelemetry",[P6]:"node",[Vo]:Ju,[Wo]:C6}});var ia,k6=A(()=>{"use strict";x6();R6();N6();ia=performance});var p0=A(()=>{"use strict";k6()});function nd(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*LSe);return[r,n]}function D6(){return ia.timeOrigin}function h0(t){let e=nd(ia.timeOrigin),r=nd(typeof t=="number"?t:ia.now());return m0(e,r)}function L6(t){if(HE(t))return t;if(typeof t=="number")return t<ia.timeOrigin/2?h0(t):nd(t);if(t instanceof Date)return nd(t.getTime());throw TypeError("Invalid input type")}function $6(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=Mm),[r,n]}function U6(t){let e=M6,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}function F6(t){return t[0]*Mm+t[1]}function B6(t){return t[0]*1e6+t[1]/1e3}function j6(t){return t[0]*1e3+t[1]/1e6}function z6(t){return t[0]+t[1]/Mm}function HE(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function G6(t){return HE(t)||typeof t=="number"||t instanceof Date}function m0(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=Mm&&(r[1]-=Mm,r[0]+=1),r}var M6,DSe,LSe,Mm,q6=A(()=>{"use strict";p0();M6=9,DSe=6,LSe=Math.pow(10,DSe),Mm=Math.pow(10,M6)});function V6(t){typeof t!="number"&&t.unref()}var H6=A(()=>{"use strict"});var WE,W6=A(()=>{"use strict";(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(WE||(WE={}))});var YE,Y6=A(()=>{"use strict";Ee();YE=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let r=new Set;for(let n of this._propagators){let i=typeof n.fields=="function"?n.fields():[];for(let o of i)r.add(o)}this._fields=Array.from(r)}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){J.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){J.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}});function _0(t){return FSe.test(t)}function y0(t){return BSe.test(t)&&!jSe.test(t)}var g0,$Se,USe,FSe,BSe,jSe,K6=A(()=>{"use strict";g0="[_0-9a-z-*/]",$Se=`[a-z]${g0}{0,255}`,USe=`[a-z0-9]${g0}{0,240}@[a-z]${g0}{0,13}`,FSe=new RegExp(`^(?:${$Se}|${USe})$`),BSe=/^[ -~]{0,255}[!-~]$/,jSe=/,|=/});var zSe,Z6,J6,X6,id,S0=A(()=>{"use strict";K6();zSe=32,Z6=512,J6=",",X6="=",id=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!_0(e)||!y0(r))return this;let n=this._getState(),i=n.get(e),o=this._length;if(typeof i=="string"?o+=r.length-i.length:o+=e.length+r.length+(n.size>0?2:1),o>Z6)return this;let s=new Map(n);return s.delete(e),s.set(e,r),this._fromState(s,o)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let o=new Map(r);return o.delete(e),this._fromState(o,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=J6+e),e=`${n[0]}${X6}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(J6),r=new Map,n=0;for(let i of e){let o=i.trim(),s=o.indexOf(X6);if(s===-1)continue;let a=o.slice(0,s),c=o.slice(s+1);if(!_0(a)||!y0(c))continue;let l=n+o.length+(r.size>0?1:0);if(!(l>Z6)&&(r.set(a,c),n=l,r.size>=zSe))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}}});function E0(t){let e=YSe.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Dm,Lm,GSe,qSe,VSe,HSe,WSe,YSe,KE,Q6=A(()=>{"use strict";Ee();km();S0();Dm="traceparent",Lm="tracestate",GSe="00",qSe="(?!ff)[\\da-f]{2}",VSe="(?![0]{32})[\\da-f]{32}",HSe="(?![0]{16})[\\da-f]{16}",WSe="[\\da-f]{2}",YSe=new RegExp(`^\\s?(${qSe})-(${VSe})-(${HSe})-(${WSe})(-.*)?\\s?$`);KE=class{inject(e,r,n){let i=ot.getSpanContext(e);if(!i||rd(e)||!Wr(i))return;let o=`${GSe}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Ct.NONE).toString(16)}`;n.set(r,Dm,o),i.traceState&&n.set(r,Lm,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,Dm);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=E0(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,Lm);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new id(typeof c=="string"?c:void 0)}return ot.setSpanContext(e,s)}fields(){return[Dm,Lm]}}});function eW(t,e){return t.setValue(v0,e)}function tW(t){return t.deleteValue(v0)}function rW(t){return t.getValue(v0)}var v0,ZE,nW=A(()=>{"use strict";Ee();v0=Yt("OpenTelemetry SDK Context Key RPC_METADATA");(function(t){t.HTTP="http"})(ZE||(ZE={}))});function T0(t){if(!tEe(t)||rEe(t)!==KSe)return!1;let e=eEe(t);if(e===null)return!0;let r=sW.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&iW.call(r)===QSe}function tEe(t){return t!=null&&typeof t=="object"}function rEe(t){return t==null?t===void 0?JSe:ZSe:Jc&&Jc in Object(t)?nEe(t):iEe(t)}function nEe(t){let e=sW.call(t,Jc),r=t[Jc],n=!1;try{t[Jc]=void 0,n=!0}catch{}let i=aW.call(t);return n&&(e?t[Jc]=r:delete t[Jc]),i}function iEe(t){return aW.call(t)}var KSe,ZSe,JSe,XSe,iW,QSe,eEe,oW,sW,Jc,aW,cW=A(()=>{"use strict";KSe="[object Object]",ZSe="[object Null]",JSe="[object Undefined]",XSe=Function.prototype,iW=XSe.toString,QSe=iW.call(Object),eEe=Object.getPrototypeOf,oW=Object.prototype,sW=oW.hasOwnProperty,Jc=Symbol?Symbol.toStringTag:void 0,aW=oW.toString});function QE(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=uW(e,t.shift(),0,r);return e}function b0(t){return XE(t)?t.slice():t}function uW(t,e,r=0,n){let i;if(!(r>oEe)){if(r++,JE(t)||JE(e)||dW(e))i=b0(e);else if(XE(t)){if(i=t.slice(),XE(e))for(let o=0,s=e.length;o<s;o++)i.push(b0(e[o]));else if($m(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];c==="__proto__"||c==="constructor"||c==="prototype"||(i[c]=b0(e[c]))}}}else if($m(t))if($m(e)){if(!sEe(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let l=e[c];if(JE(l))typeof l>"u"?delete i[c]:i[c]=l;else{let u=i[c],d=l;if(lW(t,c,n)||lW(e,c,n))delete i[c];else{if($m(u)&&$m(d)){let f=n.get(u)||[],p=n.get(d)||[];f.push({obj:t,key:c}),p.push({obj:e,key:c}),n.set(u,f),n.set(d,p)}i[c]=uW(i[c],l,r,n)}}}}else i=e;return i}}function lW(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function XE(t){return Array.isArray(t)}function dW(t){return typeof t=="function"}function $m(t){return!JE(t)&&!XE(t)&&!dW(t)&&typeof t=="object"}function JE(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function sEe(t,e){return!(!T0(t)||!T0(e))}var oEe,fW=A(()=>{"use strict";cW();oEe=20});function pW(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new Um("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}var Um,hW=A(()=>{"use strict";Um=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});function A0(t,e){return typeof e=="string"?t===e:!!t.match(e)}function mW(t,e){if(!e)return!1;for(let r of e)if(A0(t,r))return!0;return!1}var gW=A(()=>{"use strict"});var ev,_W=A(()=>{"use strict";ev=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}});var tv,yW=A(()=>{"use strict";_W();tv=class{_isCalled=!1;_deferred=new ev;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}});function EW(t){if(t==null)return;let e=SW[t.toUpperCase()];return e??(J.warn(`Unknown log level "${t}", expected one of ${Object.keys(SW)}, using default`),Ke.INFO)}var SW,vW=A(()=>{"use strict";Ee();SW={ALL:Ke.ALL,VERBOSE:Ke.VERBOSE,DEBUG:Ke.DEBUG,INFO:Ke.INFO,WARN:Ke.WARN,ERROR:Ke.ERROR,NONE:Ke.NONE}});function TW(t,e){return new Promise(r=>{pt.with($E(pt.active()),()=>{t.export(e,r)})})}var bW=A(()=>{"use strict";Ee();km()});var AW={};ar(AW,{AnchoredClock:()=>BE,BindOnceFuture:()=>tv,CompositePropagator:()=>YE,ExportResultCode:()=>WE,RPCType:()=>ZE,SDK_INFO:()=>VE,TRACE_PARENT_HEADER:()=>Dm,TRACE_STATE_HEADER:()=>Lm,TimeoutError:()=>Um,TraceState:()=>id,W3CBaggagePropagator:()=>FE,W3CTraceContextPropagator:()=>KE,_globalThis:()=>qE,addHrTimes:()=>m0,callWithTimeout:()=>pW,deleteRPCMetadata:()=>tW,diagLogLevelFromString:()=>EW,getBooleanFromEnv:()=>zE,getNumberFromEnv:()=>Ot,getRPCMetadata:()=>rW,getStringFromEnv:()=>Zc,getStringListFromEnv:()=>GE,getTimeOrigin:()=>D6,globalErrorHandler:()=>b6,hrTime:()=>h0,hrTimeDuration:()=>$6,hrTimeToMicroseconds:()=>B6,hrTimeToMilliseconds:()=>j6,hrTimeToNanoseconds:()=>F6,hrTimeToSeconds:()=>z6,hrTimeToTimeStamp:()=>U6,internal:()=>aEe,isAttributeValue:()=>d0,isTimeInput:()=>G6,isTimeInputHrTime:()=>HE,isTracingSuppressed:()=>rd,isUrlIgnored:()=>mW,loggingErrorHandler:()=>jE,merge:()=>QE,millisToHrTime:()=>nd,otperformance:()=>ia,parseKeyPairsIntoRecord:()=>m6,parseTraceParent:()=>E0,sanitizeAttributes:()=>y6,setGlobalErrorHandler:()=>T6,setRPCMetadata:()=>eW,suppressTracing:()=>$E,timeInputToHrTime:()=>L6,unrefTimer:()=>V6,unsuppressTracing:()=>a6,urlMatches:()=>A0});var aEe,od=A(()=>{"use strict";g6();_6();E6();A6();f0();q6();H6();W6();u0();p0();Y6();Q6();nW();km();S0();fW();hW();gW();yW();vW();bW();aEe={_export:TW}});function Fm(t){return t.setValue(wW,!0)}function w0(t){return t.getValue(wW)===!0}var wW,x0=A(()=>{"use strict";Ee();wW=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});function oa(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!cEe(r)){J.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!rv(n)){J.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function cEe(t){return typeof t=="string"&&t!==""}function rv(t){return t==null?!0:Array.isArray(t)?lEe(t):xW(typeof t)}function lEe(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(xW(n)){e=n;continue}return!1}return!1}}return!0}function xW(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}var RW=A(()=>{"use strict";Ee()});function CW(){return t=>{J.error(uEe(t))}}function uEe(t){return typeof t=="string"?t:JSON.stringify(dEe(t))}function dEe(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}var IW=A(()=>{"use strict";Ee()});function Vi(t){try{fEe(t)}catch{}}var fEe,PW=A(()=>{"use strict";IW();fEe=CW()});var OW,NW=A(()=>{"use strict";OW="2.9.0"});var kW,MW=A(()=>{"use strict";kW="process.runtime.name"});var Xc,DW=A(()=>{"use strict";NW();Kc();MW();Xc={[Ho]:"opentelemetry",[kW]:"node",[Vo]:Ju,[Wo]:OW}});var Hi,LW=A(()=>{"use strict";DW();Hi=performance});var R0=A(()=>{"use strict";LW()});function sa(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*EEe);return[r,n]}function I0(t){let e=sa(Hi.timeOrigin),r=sa(typeof t=="number"?t:Hi.now());return sv(e,r)}function P0(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=C0),[r,n]}function nv(t){return t[0]*1e6+t[1]/1e3}function iv(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function ov(t){return iv(t)||typeof t=="number"||t instanceof Date}function sv(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=C0&&(r[1]-=C0,r[0]+=1),r}var yEe,SEe,EEe,C0,$W=A(()=>{"use strict";R0();yEe=9,SEe=6,EEe=Math.pow(10,SEe),C0=Math.pow(10,yEe)});var Ln,UW=A(()=>{"use strict";(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Ln||(Ln={}))});var av,FW=A(()=>{"use strict";av=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}});var Qc,BW=A(()=>{"use strict";FW();Qc=class{_isCalled=!1;_deferred=new av;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}});function jW(t,e){return new Promise(r=>{pt.with(Fm(pt.active()),()=>{t.export(e,r)})})}var zW=A(()=>{"use strict";Ee();x0()});var GW,Wi=A(()=>{"use strict";RW();PW();$W();UW();R0();x0();BW();zW();GW={_export:jW}});function qW(){if(cv===void 0)try{let t=globalThis.process.argv0;cv=t?`unknown_service:${t}`:"unknown_service"}catch{cv="unknown_service"}return cv}var cv,VW=A(()=>{"use strict"});var sd,HW=A(()=>{"use strict";sd=t=>t!==null&&typeof t=="object"&&typeof t.then=="function"});function YW(t,e){return O0.FromAttributeList(Object.entries(t),e)}function N0(){return YW({[GH]:qW(),[Vo]:Xc[Vo],[Ho]:Xc[Ho],[Wo]:Xc[Wo]})}function WW(t){return t.map(([e,r])=>sd(r)?[e,r.catch(n=>{J.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function vEe(t){if(typeof t=="string"||t===void 0)return t;J.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function TEe(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;J.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}var O0,KW=A(()=>{"use strict";Ee();Wi();Kc();VW();HW();O0=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=WW(e),n._asyncAttributesPending=e.filter(([i,o])=>sd(o)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>(sd(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=WW(this._rawAttributes),this._schemaUrl=vEe(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,sd(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&J.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(sd(n)){J.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=TEe(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}}});var ZW=A(()=>{"use strict";KW()});var JW,XW=A(()=>{"use strict";JW="exception"});function cd(t){let e={};for(let[r,n]of t.getRawAttributes())typeof n?.then!="function"&&n!=null&&(e[r]??=n);return e}function ld(t,e,r,n,i){if(typeof r=="number"&&r<0){let s=`[${t}]`;return n?.stylize?n.stylize(s,"special"):s}if(typeof i!="function"||!n)return e;let o={...n,depth:n.depth==null?n.depth:n.depth-1};return`${t} ${i(e,o)}`}var ad,lv=A(()=>{"use strict";ad=Symbol.for("nodejs.util.inspect.custom")});var uv,QW=A(()=>{"use strict";Ee();Wi();Kc();XW();lv();uv=class{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Er.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(e){let r=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=Hi.now(),this._performanceOffset=r-(this._performanceStartTime+Hi.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let n of e.links)this.addLink(n);this.startTime=this._getTime(e.startTime??r),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,r){if(r==null||this._isSpanEnded())return this;if(e.length===0)return J.warn(`Invalid attribute key: ${e}`),this;if(!rv(r))return J.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,i=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&i?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(r),i&&this._attributesCount++,this)}setAttributes(e){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.setAttribute(r,e[r]);return this}addEvent(e,r,n){if(this._isSpanEnded())return this;let{eventCountLimit:i}=this._spanLimits;if(i===0)return J.warn("No events allowed."),this._droppedEventsCount++,this;i!==void 0&&this.events.length>=i&&(this._droppedEventsCount===0&&J.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),ov(r)&&(ov(n)||(n=r),r=void 0);let o=oa(r),{attributePerEventCountLimit:s}=this._spanLimits,a={},c=0,l=0;for(let u in o){if(!Object.prototype.hasOwnProperty.call(o,u))continue;let d=o[u];if(s!==void 0&&l>=s){c++;continue}a[u]=this._truncateToSize(d),l++}return this.events.push({name:e,attributes:a,time:this._getTime(n),droppedAttributesCount:c}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:r}=this._spanLimits;if(r===0)return this._droppedLinksCount++,this;r!==void 0&&this.links.length>=r&&(this._droppedLinksCount===0&&J.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,i=oa(e.attributes),o={},s=0,a=0;for(let l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;let u=i[l];if(n!==void 0&&a>=n){s++;continue}o[l]=this._truncateToSize(u),a++}let c={context:e.context};return a>0&&(c.attributes=o),s>0&&(c.droppedAttributesCount=s),this.links.push(c),this}addLinks(e){for(let r of e)this.addLink(r);return this}setStatus(e){if(this._isSpanEnded())return this;if(e.code===Er.UNSET)return this;if(this.status.code===Er.OK)return this;let r={code:e.code};return e.code===Er.ERROR&&(typeof e.message=="string"?r.message=e.message:e.message!=null&&J.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=r,this}updateName(e){return this._isSpanEnded()?this:(this.name=e,this)}end(e){if(this._isSpanEnded()){J.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=P0(this.startTime,this.endTime),this._duration[0]<0&&(J.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&&J.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&J.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e=="number"&&e<=Hi.now())return I0(e+this._performanceOffset);if(typeof e=="number")return sa(e);if(e instanceof Date)return sa(e.getTime());if(iv(e))return e;if(this._startTimeProvided)return sa(Date.now());let r=Hi.now()-this._performanceStartTime;return sv(this.startTime,sa(r))}isRecording(){return this._ended===!1}recordException(e,r){let n={};typeof e=="string"?n[wE]=e:e&&(e.code?n[xE]=e.code.toString():e.name&&(n[xE]=e.name),e.message&&(n[wE]=e.message),e.stack&&(n[zH]=e.stack)),n[xE]||n[wE]?this.addEvent(JW,n,r):J.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);J.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,r){return e.length<=r?e:e.substring(0,r)}_truncateToSize(e){let r=this._attributeValueLengthLimit;return r<=0?(J.warn(`Attribute value limit must be positive, got ${r}`),e):typeof e=="string"?this._truncateToLimitUtil(e,r):Array.isArray(e)?e.map(n=>typeof n=="string"?this._truncateToLimitUtil(n,r):n):e}[ad](e,r,n){let i={name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:cd(this.resource)}};return ld("SpanImpl",i,e,r,n)}}});var cr,ud=A(()=>{"use strict";(function(t){t[t.NOT_RECORD=0]="NOT_RECORD",t[t.RECORD=1]="RECORD",t[t.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(cr||(cr={}))});var e3,t3,r3,k0,n3,i3,o3,s3,a3,c3,l3,Bm=A(()=>{"use strict";e3="otel.component.name",t3="otel.component.type",r3="otel.span.parent.origin",k0="otel.span.sampling_result",n3="otel.sdk.processor.span.processed",i3="otel.sdk.processor.span.queue.capacity",o3="otel.sdk.processor.span.queue.size",s3="otel.sdk.span.live",a3="otel.sdk.span.started",c3="batching_span_processor",l3="simple_span_processor"});function bEe(t){return t?t.isRemote?"remote":"local":"none"}function AEe(t){switch(t){case cr.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case cr.RECORD:return"RECORD_ONLY";case cr.NOT_RECORD:return"DROP"}}var dv,u3=A(()=>{"use strict";ud();Bm();dv=class{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter(a3,{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter(s3,{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,r){let n=AEe(r);if(this.startedSpans.add(1,{[r3]:bEe(e),[k0]:n}),r===cr.NOT_RECORD)return()=>{};let i={[k0]:n};return this.liveSpans.add(1,i),()=>{this.liveSpans.add(-1,i)}}}});var d3,f3=A(()=>{"use strict";d3="2.9.0"});var fv,p3=A(()=>{"use strict";Ee();Wi();QW();u3();f3();lv();fv=class{_sampler;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,r){this.instrumentationScope=e,this._sampler=r.sampler,this._spanLimits=r.spanLimits,this._resource=r.resource,this._idGenerator=r.idGenerator,this._spanProcessor=r.spanProcessor;let n=r.meterProvider.getMeter("@opentelemetry/sdk-trace",d3);this._tracerMetrics=new dv(n)}startSpan(e,r={},n=pt.active()){r.root&&(n=ot.deleteSpan(n));let i=ot.getSpan(n);if(w0(n))return J.debug("Instrumentation suppressed, returning Noop Span"),ot.wrapSpanContext(Yu);let o=i?.spanContext(),s=this._idGenerator.generateSpanId(),a,c,l;!o||!ot.isSpanContextValid(o)?c=this._idGenerator.generateTraceId():(c=o.traceId,l=o.traceState,a=o);let u=r.kind??oi.INTERNAL,d=(r.links??[]).map(w=>({context:w.context,attributes:oa(w.attributes)})),f=oa(r.attributes),p=this._sampler.shouldSample(n,c,e,u,f,d),h=this._tracerMetrics.startSpan(o,p.decision);l=p.traceState??l;let m=p.decision===Yc.RECORD_AND_SAMPLED?Ct.SAMPLED:Ct.NONE,y={traceId:c,spanId:s,traceFlags:m,traceState:l};if(p.decision===Yc.NOT_RECORD)return J.debug("Recording is off, propagating context in a non-recording span"),ot.wrapSpanContext(y);let S=oa(Object.assign(f,p.attributes));return new uv({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:u,links:d,parentSpanContext:a,attributes:S,startTime:r.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:h})}startActiveSpan(e,r,n,i){let o,s,a;if(arguments.length<2)return;arguments.length===2?a=r:arguments.length===3?(o=r,a=n):(o=r,s=n,a=i);let c=s??pt.active(),l=this.startSpan(e,o,c),u=ot.setSpan(c,l);return pt.with(u,a,void 0,l)}[ad](e,r,n){let i={instrumentationScope:this.instrumentationScope,resource:{attributes:cd(this._resource)},spanLimits:this._spanLimits};return ld("Tracer",i,e,r,n)}}});var pv,h3=A(()=>{"use strict";Wi();pv=class{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(let r of this._spanProcessors)e.push(r.forceFlush());return new Promise(r=>{Promise.all(e).then(()=>{r()}).catch(n=>{Vi(n||new Error("MultiSpanProcessor: forceFlush failed")),r()})})}onStart(e,r){for(let n of this._spanProcessors)n.onStart(e,r)}onEnding(e){for(let r of this._spanProcessors)r.onEnding&&r.onEnding(e)}onEnd(e){for(let r of this._spanProcessors)r.onEnd(e)}shutdown(){let e=[];for(let r of this._spanProcessors)e.push(r.shutdown());return new Promise((r,n)=>{Promise.all(e).then(()=>{r()},n)})}}});var si,M0=A(()=>{"use strict";ud();si=class{shouldSample(){return{decision:cr.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}});var Mr,hv=A(()=>{"use strict";ud();Mr=class{shouldSample(){return{decision:cr.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}});var $n,D0=A(()=>{"use strict";Ee();Wi();M0();hv();$n=class{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Vi(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new Mr),this._remoteParentSampled=e.remoteParentSampled??new Mr,this._remoteParentNotSampled=e.remoteParentNotSampled??new si,this._localParentSampled=e.localParentSampled??new Mr,this._localParentNotSampled=e.localParentNotSampled??new si}shouldSample(e,r,n,i,o,s){let a=ot.getSpanContext(e);return!a||!Wr(a)?this._root.shouldSample(e,r,n,i,o,s):a.isRemote?a.traceFlags&Ct.SAMPLED?this._remoteParentSampled.shouldSample(e,r,n,i,o,s):this._remoteParentNotSampled.shouldSample(e,r,n,i,o,s):a.traceFlags&Ct.SAMPLED?this._localParentSampled.shouldSample(e,r,n,i,o,s):this._localParentNotSampled.shouldSample(e,r,n,i,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}});var m3,dd,L0=A(()=>{"use strict";Kc();Bm();m3=new Map,dd=class{processedSpans;queueSize;queueSizeCallback;standardAttrs;droppedAttrs;constructor(e,r,n){let i=m3.get(e)??0;if(m3.set(e,i+1),this.standardAttrs={[t3]:e,[e3]:`${e}/${i}`},this.droppedAttrs={...this.standardAttrs,[KP]:"queue_full"},this.processedSpans=r.createCounter(n3,{unit:"{span}",description:"The number of spans for which the processing has finished, either successful or failed."}),n){let{capacity:o,getQueueSize:s}=n;r.createUpDownCounter(i3,{unit:"{span}",description:"The maximum number of spans the queue of a given instance of an SDK span processor can hold."}).add(o,this.standardAttrs),this.queueSize=r.createObservableUpDownCounter(o3,{unit:"{span}",description:"The number of spans in the queue of a given instance of an SDK span processor."}),this.queueSizeCallback=c=>c.observe(s(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,r){if(!r){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[KP]:r.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}}});var mv,g3=A(()=>{"use strict";Ee();Wi();L0();Bm();mv=class{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_metrics;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e){this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new Qc(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(J.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize);let r=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):ta();this._metrics=new dd(c3,r,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,r){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&Ct.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&J.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(J.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,r)=>{let n=[],i=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let o=0,s=i;o<s;o++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(r)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,r)=>{let n=setTimeout(()=>{r(new Error("Timeout"))},this._exportTimeoutMillis);pt.with(Fm(pt.active()),()=>{let i;this._finishedSpans.length<=this._maxExportBatchSize?(i=this._finishedSpans,this._finishedSpans=[]):i=this._finishedSpans.splice(0,this._maxExportBatchSize);let o=()=>this._exporter.export(i,a=>{clearTimeout(n),this._metrics.finishSpans(i.length,a.error),a.code===Ln.SUCCESS?e():r(a.error??new Error("BatchSpanProcessor: span export failed"))}),s=null;for(let a=0,c=i.length;a<c;a++){let l=i[a];l.resource.asyncAttributesPending&&l.resource.waitForAsyncAttributes&&(s??=[],s.push(l.resource.waitForAsyncAttributes()))}s===null?o():Promise.all(s).then(o,a=>{Vi(a),r(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(r=>{this._isExporting=!1,Vi(r)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!="number"&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}});var el,_3=A(()=>{"use strict";g3();el=class extends mv{onShutdown(){}}});function y3(t){return function(){for(let r=0;r<t/4;r++)gv.writeUInt32BE(Math.random()*2**32>>>0,r*4);for(let r=0;r<t&&!(gv[r]>0);r++)r===t-1&&(gv[t-1]=1);return gv.toString("hex",0,t)}}var Yo,gv,S3=A(()=>{"use strict";Yo=class{generateTraceId=y3(16);generateSpanId=y3(8)},gv=Buffer.allocUnsafe(16)});var E3=A(()=>{"use strict";_3();S3()});var $0=A(()=>{"use strict";E3()});var tl,jm,v3=A(()=>{"use strict";Ee();ZW();p3();h3();D0();hv();$0();lv();(function(t){t[t.resolved=0]="resolved",t[t.timeout=1]="timeout",t[t.error=2]="error",t[t.unresolved=3]="unresolved"})(tl||(tl={}));jm=class{_resource;_activeSpanProcessor;_forceFlushTimeoutMillis;_tracerOptions;_tracers=new Map;constructor(e={}){this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??N0();let r=e.spanProcessors??[];this._activeSpanProcessor=new pv(r),this._tracerOptions={resource:this._resource,sampler:e.sampler??new $n({root:new Mr}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Yo,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return ta()}}}}getTracer(e,r,n){let i=`${e}@${r||""}:${n?.schemaUrl||""}`;return this._tracers.has(i)||this._tracers.set(i,new fv({name:e,version:r,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(i)}forceFlush(){let e=this._forceFlushTimeoutMillis,r=this._activeSpanProcessor._spanProcessors.map(n=>new Promise(i=>{let o,s=setTimeout(()=>{i(new Error(`Span processor did not completed within timeout period of ${e} ms`)),o=tl.timeout},e);n.forceFlush().then(()=>{clearTimeout(s),o!==tl.timeout&&(o=tl.resolved,i(o))}).catch(a=>{clearTimeout(s),o=tl.error,i(a)})}));return new Promise((n,i)=>{Promise.all(r).then(o=>{let s=o.filter(a=>a!==tl.resolved);s.length>0?i(s):n()}).catch(o=>i([o]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[ad](e,r,n){let i=this._activeSpanProcessor._spanProcessors,o={resource:{attributes:cd(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:i.map(s=>s.constructor?.name??"SpanProcessor")};return ld("TracerProvider",o,e,r,n)}}});var zm,T3=A(()=>{"use strict";Wi();zm=class{export(e,r){return this._sendSpans(e,r)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:nv(e.startTime),duration:nv(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,r){for(let n of e)console.dir(this._exportInfo(n),{depth:3});if(r)return r({code:Ln.SUCCESS})}}});var Gm,b3=A(()=>{"use strict";Wi();Gm=class{_finishedSpans=[];_stopped=!1;export(e,r){if(this._stopped)return r({code:Ln.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>r({code:Ln.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}});var qm,A3=A(()=>{"use strict";Ee();Wi();L0();Bm();qm=class{_exporter;_metrics;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e.exporter,this._shutdownOnce=new Qc(this._shutdown,this),this._pendingExports=new Set;let r=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter("@opentelemetry/sdk-trace"):ta();this._metrics=new dd(l3,r)}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,r){}onEnd(e){if(this._shutdownOnce.isCalled||(e.spanContext().traceFlags&Ct.SAMPLED)===0)return;let r=this._doExport(e).catch(n=>Vi(n));this._pendingExports.add(r),r.finally(()=>this._pendingExports.delete(r))}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();let r=await GW._export(this._exporter,[e]);if(this._metrics.finishSpans(1,r.error),r.code!==Ln.SUCCESS)throw r.error??new Error(`SimpleSpanProcessor: span export failed (status ${r})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._metrics.shutdown(),this._exporter.shutdown()}}});var Vm,w3=A(()=>{"use strict";Vm=class{onStart(e,r){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}});var aa,x3=A(()=>{"use strict";Ee();ud();aa=class{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,r){return{decision:Rm(r)&&this._accumulate(r)<this._upperBound?cr.RECORD_AND_SAMPLED:cr.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 r=0;for(let n=0;n<32;n+=8){let i=0;for(let o=0;o<8;o++){let s=e.charCodeAt(n+o),a=s<58?s-48:s<71?s-55:s-87;i=i<<4|a}r=(r^i)>>>0}return r}}});var fd=A(()=>{"use strict";v3();$0();T3();b3();A3();w3();M0();hv();D0();x3();ud()});function C3(){return{sampler:wEe(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:Ot("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:Ot("OTEL_ATTRIBUTE_COUNT_LIMIT")??128},spanLimits:{attributeValueLengthLimit:Ot("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??1/0,attributeCountLimit:Ot("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??128,linkCountLimit:Ot("OTEL_SPAN_LINK_COUNT_LIMIT")??128,eventCountLimit:Ot("OTEL_SPAN_EVENT_COUNT_LIMIT")??128,attributePerEventCountLimit:Ot("OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT")??128,attributePerLinkCountLimit:Ot("OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT")??128}}}function wEe(){let t=Zc("OTEL_TRACES_SAMPLER")??Yi.ParentBasedAlwaysOn;switch(t){case Yi.AlwaysOn:return new Mr;case Yi.AlwaysOff:return new si;case Yi.ParentBasedAlwaysOn:return new $n({root:new Mr});case Yi.ParentBasedAlwaysOff:return new $n({root:new si});case Yi.TraceIdRatio:return new aa(R3());case Yi.ParentBasedTraceIdRatio:return new $n({root:new aa(R3())});default:return J.error(`OTEL_TRACES_SAMPLER value "${t}" invalid, defaulting to "${Yi.ParentBasedAlwaysOn}".`),new $n({root:new Mr})}}function R3(){let t=Ot("OTEL_TRACES_SAMPLER_ARG");return t==null?(J.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${_v}.`),_v):t<0||t>1?(J.error(`OTEL_TRACES_SAMPLER_ARG=${t} was given, but it is out of range ([0..1]), defaulting to ${_v}.`),_v):t}var Yi,_v,I3=A(()=>{"use strict";Ee();od();fd();(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"})(Yi||(Yi={}));_v=1});function P3(t){let e=Object.assign({},t.spanLimits);return e.attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??Ot("OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT")??Ot("OTEL_ATTRIBUTE_COUNT_LIMIT")??xEe,e.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??Ot("OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT")??Ot("OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT")??REe,Object.assign({},t,{spanLimits:e})}var xEe,REe,O3=A(()=>{"use strict";od();xEe=128,REe=1/0});var yv,N3=A(()=>{"use strict";od();I3();O3();fd();yv=class extends jm{constructor(e={}){let r=QE({},C3(),P3(e));delete r.generalLimits,super(r)}}});var Sv,k3=A(()=>{"use strict";od();fd();Sv=class extends el{constructor(e,r){r||(r={});let n=[["maxExportBatchSize","OTEL_BSP_MAX_EXPORT_BATCH_SIZE"],["maxQueueSize","OTEL_BSP_MAX_QUEUE_SIZE"],["scheduledDelayMillis","OTEL_BSP_SCHEDULE_DELAY"],["exportTimeoutMillis","OTEL_BSP_EXPORT_TIMEOUT"]];for(let[i,o]of n)if(r[i]===void 0){let s=Ot(o);s!==void 0&&(r[i]=s)}super({exporter:e,...r})}}});var Ev,M3=A(()=>{"use strict";fd();Ev=class extends qm{constructor(e){super({exporter:e})}}});var U0={};ar(U0,{AlwaysOffSampler:()=>si,AlwaysOnSampler:()=>Mr,BasicTracerProvider:()=>yv,BatchSpanProcessor:()=>Sv,ConsoleSpanExporter:()=>zm,InMemorySpanExporter:()=>Gm,NoopSpanProcessor:()=>Vm,ParentBasedSampler:()=>$n,RandomIdGenerator:()=>Yo,SamplingDecision:()=>cr,SimpleSpanProcessor:()=>Ev,TraceIdRatioBasedSampler:()=>aa});var F0=A(()=>{"use strict";N3();k3();M3();fd()});var D3=v(vv=>{"use strict";Object.defineProperty(vv,"__esModule",{value:!0});vv.NodeTracerProvider=void 0;var CEe=s6(),IEe=(F0(),Nr(U0)),Hm=(Ee(),Nr(ra)),B0=(od(),Nr(AW));function PEe(t){if(t!==null){if(t===void 0){let e=new CEe.AsyncLocalStorageContextManager;e.enable(),Hm.context.setGlobalContextManager(e);return}t.enable(),Hm.context.setGlobalContextManager(t)}}function OEe(t){if(t!==null){if(t===void 0){Hm.propagation.setGlobalPropagator(new B0.CompositePropagator({propagators:[new B0.W3CTraceContextPropagator,new B0.W3CBaggagePropagator]}));return}Hm.propagation.setGlobalPropagator(t)}}var j0=class extends IEe.BasicTracerProvider{constructor(e={}){super(e)}register(e={}){Hm.trace.setGlobalTracerProvider(this),PEe(e.contextManager),OEe(e.propagator)}};vv.NodeTracerProvider=j0});var z0=v(ct=>{"use strict";Object.defineProperty(ct,"__esModule",{value:!0});ct.TraceIdRatioBasedSampler=ct.SimpleSpanProcessor=ct.SamplingDecision=ct.RandomIdGenerator=ct.ParentBasedSampler=ct.NoopSpanProcessor=ct.InMemorySpanExporter=ct.ConsoleSpanExporter=ct.BatchSpanProcessor=ct.BasicTracerProvider=ct.AlwaysOnSampler=ct.AlwaysOffSampler=ct.NodeTracerProvider=void 0;var NEe=D3();Object.defineProperty(ct,"NodeTracerProvider",{enumerable:!0,get:function(){return NEe.NodeTracerProvider}});var Un=(F0(),Nr(U0));Object.defineProperty(ct,"AlwaysOffSampler",{enumerable:!0,get:function(){return Un.AlwaysOffSampler}});Object.defineProperty(ct,"AlwaysOnSampler",{enumerable:!0,get:function(){return Un.AlwaysOnSampler}});Object.defineProperty(ct,"BasicTracerProvider",{enumerable:!0,get:function(){return Un.BasicTracerProvider}});Object.defineProperty(ct,"BatchSpanProcessor",{enumerable:!0,get:function(){return Un.BatchSpanProcessor}});Object.defineProperty(ct,"ConsoleSpanExporter",{enumerable:!0,get:function(){return Un.ConsoleSpanExporter}});Object.defineProperty(ct,"InMemorySpanExporter",{enumerable:!0,get:function(){return Un.InMemorySpanExporter}});Object.defineProperty(ct,"NoopSpanProcessor",{enumerable:!0,get:function(){return Un.NoopSpanProcessor}});Object.defineProperty(ct,"ParentBasedSampler",{enumerable:!0,get:function(){return Un.ParentBasedSampler}});Object.defineProperty(ct,"RandomIdGenerator",{enumerable:!0,get:function(){return Un.RandomIdGenerator}});Object.defineProperty(ct,"SamplingDecision",{enumerable:!0,get:function(){return Un.SamplingDecision}});Object.defineProperty(ct,"SimpleSpanProcessor",{enumerable:!0,get:function(){return Un.SimpleSpanProcessor}});Object.defineProperty(ct,"TraceIdRatioBasedSampler",{enumerable:!0,get:function(){return Un.TraceIdRatioBasedSampler}})});var xv,H3=A(()=>{"use strict";xv=class{_delegate;constructor(e){this._delegate=e}export(e,r){this._delegate.export(e,r)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}});var Ko,Rv=A(()=>{"use strict";Ko=class extends Error{code;name="OTLPExporterError";data;constructor(e,r,n){super(e),this.data=n,this.code=r}}});function zEe(t){if(Number.isFinite(t)&&t>0)return t;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${t}')`)}function Cv(t){if(t!=null)return async()=>t}function Iv(t,e,r){return{timeoutMillis:zEe(t.timeoutMillis??e.timeoutMillis??r.timeoutMillis),concurrencyLimit:t.concurrencyLimit??e.concurrencyLimit??r.concurrencyLimit,compression:t.compression??e.compression??r.compression}}function Pv(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var Jm=A(()=>{"use strict"});var Ov,W3=A(()=>{"use strict";(function(t){t.NONE="none",t.GZIP="gzip"})(Ov||(Ov={}))});function Nv(t){return new W0(t.concurrencyLimit)}var W0,Y0=A(()=>{"use strict";W0=class{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(e){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(e);let r=()=>{let n=this._sendingPromises.indexOf(e);this._sendingPromises.splice(n,1)};e.then(r,r)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}});function kv(t){return t.setValue(K0,!0)}function Y3(t){return t.deleteValue(K0)}function pd(t){return t.getValue(K0)===!0}var K0,Xm=A(()=>{"use strict";Ee();K0=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING")});var Mv,K3=A(()=>{"use strict";Mv="baggage"});function Z3(t){return t.reduce((e,r)=>{let n=`${e}${e!==""?",":""}${r}`;return n.length>8192?e:n},"")}function J3(t){return t.getAllEntries().map(([e,r])=>{let n=`${encodeURIComponent(e)}=${encodeURIComponent(r.value)}`;return r.metadata!==void 0&&(n+=";"+r.metadata.toString()),n})}function Z0(t){if(!t)return;let e=t.indexOf(";"),r=e===-1?t:t.substring(0,e),n=r.indexOf("=");if(n<=0)return;let i=r.substring(0,n).trim(),o=r.substring(n+1).trim();if(!i||!o)return;let s,a;try{s=decodeURIComponent(i),a=decodeURIComponent(o)}catch{return}let c;if(e!==-1&&e<t.length-1){let l=t.substring(e+1);c=Hu(l)}return{key:s,value:a,metadata:c}}function rl(t){let e={};return typeof t=="string"&&t.length>0&&t.split(",").forEach(r=>{let n=Z0(r);n!==void 0&&n.value.length>0&&(e[n.key]=n.value)}),e}var J0=A(()=>{"use strict";Ee()});var Lv,X3=A(()=>{"use strict";Ee();Xm();K3();J0();Lv=class{inject(e,r,n){let i=kr.getBaggage(e);if(!i||pd(e))return;let o=J3(i).filter(a=>a.length<=4096).slice(0,180),s=Z3(o);s.length>0&&n.set(r,Mv,s)}extract(e,r,n){let i=n.get(r,Mv),o=Array.isArray(i)?i.join(","):i;if(!o)return e;let s={};return o.length===0||(o.split(",").forEach(c=>{let l=Z0(c);if(l){let u={value:l.value};l.metadata&&(u.metadata=l.metadata),s[l.key]=u}}),Object.entries(s).length===0)?e:kr.setBaggage(e,kr.createBaggage(s))}fields(){return[Mv]}}});var $v,Q3=A(()=>{"use strict";$v=class{_monotonicClock;_epochMillis;_performanceMillis;constructor(e,r){this._monotonicClock=r,this._epochMillis=e.now(),this._performanceMillis=r.now()}now(){let e=this._monotonicClock.now()-this._performanceMillis;return this._epochMillis+e}}});function eY(t){let e={};if(typeof t!="object"||t==null)return e;for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(!HEe(r)){J.warn(`Invalid attribute key: ${r}`);continue}let n=t[r];if(!X0(n)){J.warn(`Invalid attribute value set for key: ${r}`);continue}Array.isArray(n)?e[r]=n.slice():e[r]=n}return e}function HEe(t){return typeof t=="string"&&t!==""}function X0(t){return t==null?!0:Array.isArray(t)?WEe(t):tY(typeof t)}function WEe(t){let e;for(let r of t){if(r==null)continue;let n=typeof r;if(n!==e){if(!e){if(tY(n)){e=n;continue}return!1}return!1}}return!0}function tY(t){switch(t){case"number":case"boolean":case"string":return!0}return!1}var rY=A(()=>{"use strict";Ee()});function Uv(){return t=>{J.error(YEe(t))}}function YEe(t){return typeof t=="string"?t:JSON.stringify(KEe(t))}function KEe(t){let e={},r=t;for(;r!==null;)Object.getOwnPropertyNames(r).forEach(n=>{if(e[n])return;let i=r[n];i&&(e[n]=String(i))}),r=Object.getPrototypeOf(r);return e}var Q0=A(()=>{"use strict";Ee()});function iY(t){nY=t}function oY(t){try{nY(t)}catch{}}var nY,sY=A(()=>{"use strict";Q0();nY=Uv()});import{inspect as aY}from"util";function hd(t){let e=process.env[t];if(e==null||e.trim()==="")return;let r=Number(e);if(isNaN(r)){J.warn(`Unknown value ${aY(e)} for ${t}, expected a number, using defaults`);return}return r}function Yr(t){let e=process.env[t];if(!(e==null||e.trim()===""))return e}function Fv(t){let e=process.env[t]?.trim().toLowerCase();return e==null||e===""?!1:e==="true"?!0:(e==="false"||J.warn(`Unknown value ${aY(e)} for ${t}, expected 'true' or 'false', falling back to 'false' (default)`),!1)}function Bv(t){return Yr(t)?.split(",").map(e=>e.trim()).filter(e=>e!=="")}var cY=A(()=>{"use strict";Ee()});var jv,lY=A(()=>{"use strict";jv=globalThis});var uY,dY=A(()=>{"use strict";uY="2.7.1"});var fY,pY=A(()=>{"use strict";fY="process.runtime.name"});var zv,hY=A(()=>{"use strict";dY();Kc();pY();zv={[Ho]:"opentelemetry",[fY]:"node",[Vo]:Ju,[Wo]:uY}});var ca,mY=A(()=>{"use strict";cY();lY();hY();ca=performance});var eO=A(()=>{"use strict";mY()});function md(t){let e=t/1e3,r=Math.trunc(e),n=Math.round(t%1e3*JEe);return[r,n]}function _Y(){return ca.timeOrigin}function tO(t){let e=md(ca.timeOrigin),r=md(typeof t=="number"?t:ca.now());return rO(e,r)}function yY(t){if(Vv(t))return t;if(typeof t=="number")return t<ca.timeOrigin?tO(t):md(t);if(t instanceof Date)return md(t.getTime());throw TypeError("Invalid input type")}function SY(t,e){let r=e[0]-t[0],n=e[1]-t[1];return n<0&&(r-=1,n+=Gv),[r,n]}function EY(t){let e=gY,r=`${"0".repeat(e)}${t[1]}Z`,n=r.substring(r.length-e-1);return new Date(t[0]*1e3).toISOString().replace("000Z",n)}function qv(t){return t[0]*Gv+t[1]}function vY(t){return t[0]*1e3+t[1]/1e6}function TY(t){return t[0]*1e6+t[1]/1e3}function Vv(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&typeof t[1]=="number"}function bY(t){return Vv(t)||typeof t=="number"||t instanceof Date}function rO(t,e){let r=[t[0]+e[0],t[1]+e[1]];return r[1]>=Gv&&(r[1]-=Gv,r[0]+=1),r}var gY,ZEe,JEe,Gv,AY=A(()=>{"use strict";eO();gY=9,ZEe=6,JEe=Math.pow(10,ZEe),Gv=Math.pow(10,gY)});function wY(t){typeof t!="number"&&t.unref()}var xY=A(()=>{"use strict"});var Fn,RY=A(()=>{"use strict";(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(Fn||(Fn={}))});var Hv,CY=A(()=>{"use strict";Ee();Hv=class{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];let r=new Set;for(let n of this._propagators){let i=typeof n.fields=="function"?n.fields():[];for(let o of i)r.add(o)}this._fields=Array.from(r)}inject(e,r,n){for(let i of this._propagators)try{i.inject(e,r,n)}catch(o){J.warn(`Failed to inject with ${i.constructor.name}. Err: ${o.message}`)}}extract(e,r,n){return this._propagators.reduce((i,o)=>{try{return o.extract(i,r,n)}catch(s){J.warn(`Failed to extract with ${o.constructor.name}. Err: ${s.message}`)}return i},e)}fields(){return this._fields.slice()}}});function iO(t){return eve.test(t)}function oO(t){return tve.test(t)&&!rve.test(t)}var nO,XEe,QEe,eve,tve,rve,IY=A(()=>{"use strict";nO="[_0-9a-z-*/]",XEe=`[a-z]${nO}{0,255}`,QEe=`[a-z0-9]${nO}{0,240}@[a-z]${nO}{0,13}`,eve=new RegExp(`^(?:${XEe}|${QEe})$`),tve=/^[ -~]{0,255}[!-~]$/,rve=/,|=/});var nve,PY,OY,NY,gd,sO=A(()=>{"use strict";IY();nve=32,PY=512,OY=",",NY="=",gd=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!iO(e)||!oO(r))return this;let n=this._getState(),i=n.get(e),o=this._length;if(typeof i=="string"?o+=r.length-i.length:o+=e.length+r.length+(n.size>0?2:1),o>PY)return this;let s=new Map(n);return s.delete(e),s.set(e,r),this._fromState(s,o)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let o=new Map(r);return o.delete(e),this._fromState(o,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=OY+e),e=`${n[0]}${NY}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(OY),r=new Map,n=0;for(let i of e){let o=i.trim(),s=o.indexOf(NY);if(s===-1)continue;let a=o.slice(0,s),c=o.slice(s+1);if(!iO(a)||!oO(c))continue;let l=n+o.length+(r.size>0?1:0);if(!(l>PY)&&(r.set(a,c),n=l,r.size>=nve))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}}});function aO(t){let e=lve.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Qm,eg,ive,ove,sve,ave,cve,lve,Wv,kY=A(()=>{"use strict";Ee();Xm();sO();Qm="traceparent",eg="tracestate",ive="00",ove="(?!ff)[\\da-f]{2}",sve="(?![0]{32})[\\da-f]{32}",ave="(?![0]{16})[\\da-f]{16}",cve="[\\da-f]{2}",lve=new RegExp(`^\\s?(${ove})-(${sve})-(${ave})-(${cve})(-.*)?\\s?$`);Wv=class{inject(e,r,n){let i=ot.getSpanContext(e);if(!i||pd(e)||!Wr(i))return;let o=`${ive}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Ct.NONE).toString(16)}`;n.set(r,Qm,o),i.traceState&&n.set(r,eg,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,Qm);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=aO(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,eg);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new gd(typeof c=="string"?c:void 0)}return ot.setSpanContext(e,s)}fields(){return[Qm,eg]}}});function MY(t,e){return t.setValue(cO,e)}function DY(t){return t.deleteValue(cO)}function LY(t){return t.getValue(cO)}var cO,Yv,$Y=A(()=>{"use strict";Ee();cO=Yt("OpenTelemetry SDK Context Key RPC_METADATA");(function(t){t.HTTP="http"})(Yv||(Yv={}))});function lO(t){if(!gve(t)||_ve(t)!==uve)return!1;let e=mve(t);if(e===null)return!0;let r=BY.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&UY.call(r)===hve}function gve(t){return t!=null&&typeof t=="object"}function _ve(t){return t==null?t===void 0?fve:dve:nl&&nl in Object(t)?yve(t):Sve(t)}function yve(t){let e=BY.call(t,nl),r=t[nl],n=!1;try{t[nl]=void 0,n=!0}catch{}let i=jY.call(t);return n&&(e?t[nl]=r:delete t[nl]),i}function Sve(t){return jY.call(t)}var uve,dve,fve,pve,UY,hve,mve,FY,BY,nl,jY,zY=A(()=>{"use strict";uve="[object Object]",dve="[object Null]",fve="[object Undefined]",pve=Function.prototype,UY=pve.toString,hve=UY.call(Object),mve=Object.getPrototypeOf,FY=Object.prototype,BY=FY.hasOwnProperty,nl=Symbol?Symbol.toStringTag:void 0,jY=FY.toString});function qY(...t){let e=t.shift(),r=new WeakMap;for(;t.length>0;)e=VY(e,t.shift(),0,r);return e}function uO(t){return Zv(t)?t.slice():t}function VY(t,e,r=0,n){let i;if(!(r>Eve)){if(r++,Kv(t)||Kv(e)||HY(e))i=uO(e);else if(Zv(t)){if(i=t.slice(),Zv(e))for(let o=0,s=e.length;o<s;o++)i.push(uO(e[o]));else if(tg(e)){let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];c==="__proto__"||c==="constructor"||c==="prototype"||(i[c]=uO(e[c]))}}}else if(tg(t))if(tg(e)){if(!vve(t,e))return e;i=Object.assign({},t);let o=Object.keys(e);for(let s=0,a=o.length;s<a;s++){let c=o[s];if(c==="__proto__"||c==="constructor"||c==="prototype")continue;let l=e[c];if(Kv(l))typeof l>"u"?delete i[c]:i[c]=l;else{let u=i[c],d=l;if(GY(t,c,n)||GY(e,c,n))delete i[c];else{if(tg(u)&&tg(d)){let f=n.get(u)||[],p=n.get(d)||[];f.push({obj:t,key:c}),p.push({obj:e,key:c}),n.set(u,f),n.set(d,p)}i[c]=VY(i[c],l,r,n)}}}}else i=e;return i}}function GY(t,e,r){let n=r.get(t[e])||[];for(let i=0,o=n.length;i<o;i++){let s=n[i];if(s.key===e&&s.obj===t)return!0}return!1}function Zv(t){return Array.isArray(t)}function HY(t){return typeof t=="function"}function tg(t){return!Kv(t)&&!Zv(t)&&!HY(t)&&typeof t=="object"}function Kv(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t>"u"||t instanceof Date||t instanceof RegExp||t===null}function vve(t,e){return!(!lO(t)||!lO(e))}var Eve,WY=A(()=>{"use strict";zY();Eve=20});function YY(t,e){let r,n=new Promise(function(o,s){r=setTimeout(function(){s(new rg("Operation timed out."))},e)});return Promise.race([t,n]).then(i=>(clearTimeout(r),i),i=>{throw clearTimeout(r),i})}var rg,KY=A(()=>{"use strict";rg=class t extends Error{constructor(e){super(e),Object.setPrototypeOf(this,t.prototype)}}});function dO(t,e){return typeof e=="string"?t===e:!!t.match(e)}function ZY(t,e){if(!e)return!1;for(let r of e)if(dO(t,r))return!0;return!1}var JY=A(()=>{"use strict"});var Jv,XY=A(()=>{"use strict";Jv=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}});var Xv,QY=A(()=>{"use strict";XY();Xv=class{_isCalled=!1;_deferred=new Jv;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}}});function tK(t){if(t==null)return;let e=eK[t.toUpperCase()];return e??(J.warn(`Unknown log level "${t}", expected one of ${Object.keys(eK)}, using default`),Ke.INFO)}var eK,rK=A(()=>{"use strict";Ee();eK={ALL:Ke.ALL,VERBOSE:Ke.VERBOSE,DEBUG:Ke.DEBUG,INFO:Ke.INFO,WARN:Ke.WARN,ERROR:Ke.ERROR,NONE:Ke.NONE}});function nK(t,e){return new Promise(r=>{pt.with(kv(pt.active()),()=>{t.export(e,r)})})}var iK=A(()=>{"use strict";Ee();Xm()});var oK={};ar(oK,{AnchoredClock:()=>$v,BindOnceFuture:()=>Xv,CompositePropagator:()=>Hv,ExportResultCode:()=>Fn,RPCType:()=>Yv,SDK_INFO:()=>zv,TRACE_PARENT_HEADER:()=>Qm,TRACE_STATE_HEADER:()=>eg,TimeoutError:()=>rg,TraceState:()=>gd,W3CBaggagePropagator:()=>Lv,W3CTraceContextPropagator:()=>Wv,_globalThis:()=>jv,addHrTimes:()=>rO,callWithTimeout:()=>YY,deleteRPCMetadata:()=>DY,diagLogLevelFromString:()=>tK,getBooleanFromEnv:()=>Fv,getNumberFromEnv:()=>hd,getRPCMetadata:()=>LY,getStringFromEnv:()=>Yr,getStringListFromEnv:()=>Bv,getTimeOrigin:()=>_Y,globalErrorHandler:()=>oY,hrTime:()=>tO,hrTimeDuration:()=>SY,hrTimeToMicroseconds:()=>TY,hrTimeToMilliseconds:()=>vY,hrTimeToNanoseconds:()=>qv,hrTimeToTimeStamp:()=>EY,internal:()=>Tve,isAttributeValue:()=>X0,isTimeInput:()=>bY,isTimeInputHrTime:()=>Vv,isTracingSuppressed:()=>pd,isUrlIgnored:()=>ZY,loggingErrorHandler:()=>Uv,merge:()=>qY,millisToHrTime:()=>md,otperformance:()=>ca,parseKeyPairsIntoRecord:()=>rl,parseTraceParent:()=>aO,sanitizeAttributes:()=>eY,setGlobalErrorHandler:()=>iY,setRPCMetadata:()=>MY,suppressTracing:()=>kv,timeInputToHrTime:()=>yY,unrefTimer:()=>wY,unsuppressTracing:()=>Y3,urlMatches:()=>dO});var Tve,_d=A(()=>{"use strict";X3();Q3();rY();sY();Q0();AY();xY();RY();J0();eO();CY();kY();$Y();Xm();sO();WY();KY();JY();QY();rK();iK();Tve={_export:nK}});function bve(t){return Object.prototype.hasOwnProperty.call(t,"partialSuccess")}function sK(){return{handleResponse(t){t==null||!bve(t)||t.partialSuccess==null||Object.keys(t.partialSuccess).length===0||J.warn("Received Partial Success response:",JSON.stringify(t.partialSuccess))}}}var aK=A(()=>{"use strict";Ee()});function Qv(t,e){return new fO(t.transport,t.serializer,sK(),t.promiseHandler,e.timeout)}var fO,pO=A(()=>{"use strict";_d();Rv();aK();Ee();fO=class{_diagLogger;_transport;_serializer;_responseHandler;_promiseQueue;_timeout;constructor(e,r,n,i,o){this._transport=e,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=J.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){if(this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()){r({code:Fn.FAILED,error:new Error("Concurrent export limit reached")});return}let n=this._serializer.serializeRequest(e);if(n==null){r({code:Fn.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(n,this._timeout).then(i=>{if(i.status==="success"){if(i.data!=null)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(i.data))}catch(o){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",o,i.data)}r({code:Fn.SUCCESS});return}else if(i.status==="failure"&&i.error){r({code:Fn.FAILED,error:i.error});return}else i.status==="retryable"?r({code:Fn.FAILED,error:i.error??new Ko("Export failed with retryable status")}):r({code:Fn.FAILED,error:new Ko("Export failed with unknown error")})},i=>r({code:Fn.FAILED,error:i})))}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}});function cK(t,e,r){return Qv({transport:r,serializer:e,promiseHandler:Nv(t)},{timeout:t.timeoutMillis})}var lK=A(()=>{"use strict";Y0();pO()});var eT={};ar(eT,{CompressionAlgorithm:()=>Ov,OTLPExporterBase:()=>xv,OTLPExporterError:()=>Ko,createOtlpNetworkExportDelegate:()=>cK,getSharedConfigurationDefaults:()=>Pv,mergeOtlpSharedConfigurationWithDefaults:()=>Iv});var tT=A(()=>{"use strict";H3();Rv();Jm();W3();lK()});var uK=v(rT=>{"use strict";Object.defineProperty(rT,"__esModule",{value:!0});rT.VERSION=void 0;rT.VERSION="0.218.0"});var Ve=v(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=Bn.DEFAULT_MAX_SEND_MESSAGE_LENGTH=Bn.Propagate=Bn.LogVerbosity=Bn.Status=void 0;var dK;(function(t){t[t.OK=0]="OK",t[t.CANCELLED=1]="CANCELLED",t[t.UNKNOWN=2]="UNKNOWN",t[t.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",t[t.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",t[t.NOT_FOUND=5]="NOT_FOUND",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.PERMISSION_DENIED=7]="PERMISSION_DENIED",t[t.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",t[t.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",t[t.ABORTED=10]="ABORTED",t[t.OUT_OF_RANGE=11]="OUT_OF_RANGE",t[t.UNIMPLEMENTED=12]="UNIMPLEMENTED",t[t.INTERNAL=13]="INTERNAL",t[t.UNAVAILABLE=14]="UNAVAILABLE",t[t.DATA_LOSS=15]="DATA_LOSS",t[t.UNAUTHENTICATED=16]="UNAUTHENTICATED"})(dK||(Bn.Status=dK={}));var fK;(function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.ERROR=2]="ERROR",t[t.NONE=3]="NONE"})(fK||(Bn.LogVerbosity=fK={}));var pK;(function(t){t[t.DEADLINE=1]="DEADLINE",t[t.CENSUS_STATS_CONTEXT=2]="CENSUS_STATS_CONTEXT",t[t.CENSUS_TRACING_CONTEXT=4]="CENSUS_TRACING_CONTEXT",t[t.CANCELLATION=8]="CANCELLATION",t[t.DEFAULTS=65535]="DEFAULTS"})(pK||(Bn.Propagate=pK={}));Bn.DEFAULT_MAX_SEND_MESSAGE_LENGTH=-1;Bn.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH=4*1024*1024});var hO=v((Pat,Ave)=>{Ave.exports={name:"@grpc/grpc-js",version:"1.14.4",description:"gRPC Library for Node - pure JS implementation",homepage:"https://grpc.io/",repository:"https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",main:"build/src/index.js",engines:{node:">=12.10.0"},keywords:[],author:{name:"Google Inc."},types:"build/src/index.d.ts",license:"Apache-2.0",devDependencies:{"@grpc/proto-loader":"file:../proto-loader","@types/gulp":"^4.0.17","@types/gulp-mocha":"0.0.37","@types/lodash":"^4.14.202","@types/mocha":"^10.0.6","@types/ncp":"^2.0.8","@types/node":">=20.11.20","@types/pify":"^5.0.4","@types/semver":"^7.5.8","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0","@typescript-eslint/typescript-estree":"^7.1.0","clang-format":"^1.8.0",eslint:"^8.42.0","eslint-config-prettier":"^8.8.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^4.2.1",execa:"^2.0.3",gulp:"^4.0.2","gulp-mocha":"^6.0.0",lodash:"^4.17.21",madge:"^5.0.1","mocha-jenkins-reporter":"^0.4.1",ncp:"^2.0.0",pify:"^4.0.1",prettier:"^2.8.8",rimraf:"^3.0.2",semver:"^7.6.0","ts-node":"^10.9.2",typescript:"^5.3.3"},contributors:[{name:"Google Inc."}],scripts:{build:"npm run compile",clean:"rimraf ./build",compile:"tsc -p .",format:'clang-format -i -style="{Language: JavaScript, BasedOnStyle: Google, ColumnLimit: 80}" src/*.ts test/*.ts',lint:"eslint src/*.ts test/*.ts",prepare:"npm run copy-protos && npm run generate-types && npm run generate-test-types && npm run compile",test:"gulp test",check:"npm run lint",fix:"eslint --fix src/*.ts test/*.ts",pretest:"npm run generate-types && npm run generate-test-types && npm run compile",posttest:"npm run check && madge -c ./build/src","generate-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --includeDirs proto/ --include-dirs proto/ proto/xds/ proto/protoc-gen-validate/ -O src/generated/ --grpcLib ../index channelz.proto xds/service/orca/v3/orca.proto","generate-test-types":"proto-loader-gen-types --keepCase --longs String --enums String --defaults --oneofs --includeComments --include-dirs test/fixtures/ -O test/generated/ --grpcLib ../../src/index test_service.proto echo_service.proto","copy-protos":"node ./copy-protos"},dependencies:{"@grpc/proto-loader":"^0.8.0","@js-sdsl/ordered-map":"^4.4.2"},files:["src/**/*.ts","build/src/**/*.{js,d.ts,js.map}","proto/**/*.proto","proto/**/LICENSE","LICENSE","deps/envoy-api/envoy/api/v2/**/*.proto","deps/envoy-api/envoy/config/**/*.proto","deps/envoy-api/envoy/service/**/*.proto","deps/envoy-api/envoy/type/**/*.proto","deps/udpa/udpa/**/*.proto","deps/googleapis/google/api/*.proto","deps/googleapis/google/rpc/*.proto","deps/protoc-gen-validate/validate/**/*.proto"]}});var ht=v(hn=>{"use strict";var mO,gO,_O,yO;Object.defineProperty(hn,"__esModule",{value:!0});hn.log=hn.setLoggerVerbosity=hn.setLogger=hn.getLogger=void 0;hn.trace=Dve;hn.isTracerEnabled=mK;var la=Ve(),wve=Z("process"),xve=hO().version,Rve={error:(t,...e)=>{console.error("E "+t,...e)},info:(t,...e)=>{console.error("I "+t,...e)},debug:(t,...e)=>{console.error("D "+t,...e)}},il=Rve,yd=la.LogVerbosity.ERROR,Cve=(gO=(mO=process.env.GRPC_NODE_VERBOSITY)!==null&&mO!==void 0?mO:process.env.GRPC_VERBOSITY)!==null&&gO!==void 0?gO:"";switch(Cve.toUpperCase()){case"DEBUG":yd=la.LogVerbosity.DEBUG;break;case"INFO":yd=la.LogVerbosity.INFO;break;case"ERROR":yd=la.LogVerbosity.ERROR;break;case"NONE":yd=la.LogVerbosity.NONE;break;default:}var Ive=()=>il;hn.getLogger=Ive;var Pve=t=>{il=t};hn.setLogger=Pve;var Ove=t=>{yd=t};hn.setLoggerVerbosity=Ove;var Nve=(t,...e)=>{let r;if(t>=yd){switch(t){case la.LogVerbosity.DEBUG:r=il.debug;break;case la.LogVerbosity.INFO:r=il.info;break;case la.LogVerbosity.ERROR:r=il.error;break}r||(r=il.error),r&&r.bind(il)(...e)}};hn.log=Nve;var kve=(yO=(_O=process.env.GRPC_NODE_TRACE)!==null&&_O!==void 0?_O:process.env.GRPC_TRACE)!==null&&yO!==void 0?yO:"",SO=new Set,hK=new Set;for(let t of kve.split(","))t.startsWith("-")?hK.add(t.substring(1)):SO.add(t);var Mve=SO.has("all");function Dve(t,e,r){mK(e)&&(0,hn.log)(t,new Date().toISOString()+" | v"+xve+" "+wve.pid+" | "+e+" | "+r)}function mK(t){return!hK.has(t)&&(Mve||SO.has(t))}});var iT=v(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0});nT.getErrorMessage=Lve;nT.getErrorCode=$ve;function Lve(t){return t instanceof Error?t.message:String(t)}function $ve(t){return typeof t=="object"&&t!==null&&"code"in t&&typeof t.code=="number"?t.code:null}});var Kt=v(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});sT.Metadata=void 0;var Uve=ht(),Fve=Ve(),Bve=iT(),jve=/^[:0-9a-z_.-]+$/,zve=/^[ -~]*$/;function Gve(t){return jve.test(t)}function qve(t){return zve.test(t)}function _K(t){return t.endsWith("-bin")}function Vve(t){return!t.startsWith("grpc-")}function oT(t){return t.toLowerCase()}function gK(t,e){if(!Gve(t))throw new Error('Metadata key "'+t+'" contains illegal characters');if(e!=null)if(_K(t)){if(!Buffer.isBuffer(e))throw new Error("keys that end with '-bin' must have Buffer values")}else{if(Buffer.isBuffer(e))throw new Error("keys that don't end with '-bin' must have String values");if(!qve(e))throw new Error('Metadata string value "'+e+'" contains illegal characters')}}var EO=class t{constructor(e={}){this.internalRepr=new Map,this.opaqueData=new Map,this.options=e}set(e,r){e=oT(e),gK(e,r),this.internalRepr.set(e,[r])}add(e,r){e=oT(e),gK(e,r);let n=this.internalRepr.get(e);n===void 0?this.internalRepr.set(e,[r]):n.push(r)}remove(e){e=oT(e),this.internalRepr.delete(e)}get(e){return e=oT(e),this.internalRepr.get(e)||[]}getMap(){let e={};for(let[r,n]of this.internalRepr)if(n.length>0){let i=n[0];e[r]=Buffer.isBuffer(i)?Buffer.from(i):i}return e}clone(){let e=new t(this.options),r=e.internalRepr;for(let[n,i]of this.internalRepr){let o=i.map(s=>Buffer.isBuffer(s)?Buffer.from(s):s);r.set(n,o)}return e}merge(e){for(let[r,n]of e.internalRepr){let i=(this.internalRepr.get(r)||[]).concat(n);this.internalRepr.set(r,i)}}setOptions(e){this.options=e}getOptions(){return this.options}toHttp2Headers(){let e={};for(let[r,n]of this.internalRepr)r.startsWith(":")||(e[r]=n.map(Hve));return e}toJSON(){let e={};for(let[r,n]of this.internalRepr)e[r]=n;return e}setOpaque(e,r){this.opaqueData.set(e,r)}getOpaque(e){return this.opaqueData.get(e)}static fromHttp2Headers(e){let r=new t;for(let n of Object.keys(e)){if(n.charAt(0)===":")continue;let i=e[n];try{_K(n)?Array.isArray(i)?i.forEach(o=>{r.add(n,Buffer.from(o,"base64"))}):i!==void 0&&(Vve(n)?i.split(",").forEach(o=>{r.add(n,Buffer.from(o.trim(),"base64"))}):r.add(n,Buffer.from(i,"base64"))):Array.isArray(i)?i.forEach(o=>{r.add(n,o)}):i!==void 0&&r.add(n,i)}catch(o){let s=`Failed to add metadata entry ${n}: ${i}. ${(0,Bve.getErrorMessage)(o)}. For more information see https://github.com/grpc/grpc-node/issues/1173`;(0,Uve.log)(Fve.LogVerbosity.ERROR,s)}}return r}};sT.Metadata=EO;var Hve=t=>Buffer.isBuffer(t)?t.toString("base64"):t});var cT=v(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});aT.CallCredentials=void 0;var AO=Kt();function Wve(t){return"getRequestHeaders"in t&&typeof t.getRequestHeaders=="function"}var Sd=class t{static createFromMetadataGenerator(e){return new TO(e)}static createFromGoogleCredential(e){return t.createFromMetadataGenerator((r,n)=>{let i;Wve(e)?i=e.getRequestHeaders(r.service_url):i=new Promise((o,s)=>{e.getRequestMetadata(r.service_url,(a,c)=>{if(a){s(a);return}if(!c){s(new Error("Headers not set by metadata plugin"));return}o(c)})}),i.then(o=>{let s=new AO.Metadata;for(let a of Object.keys(o))s.add(a,o[a]);n(null,s)},o=>{n(o)})})}static createEmpty(){return new bO}};aT.CallCredentials=Sd;var vO=class t extends Sd{constructor(e){super(),this.creds=e}async generateMetadata(e){let r=new AO.Metadata,n=await Promise.all(this.creds.map(i=>i.generateMetadata(e)));for(let i of n)r.merge(i);return r}compose(e){return new t(this.creds.concat([e]))}_equals(e){return this===e?!0:e instanceof t?this.creds.every((r,n)=>r._equals(e.creds[n])):!1}},TO=class t extends Sd{constructor(e){super(),this.metadataGenerator=e}generateMetadata(e){return new Promise((r,n)=>{this.metadataGenerator(e,(i,o)=>{o!==void 0?r(o):n(i)})})}compose(e){return new vO([this,e])}_equals(e){return this===e?!0:e instanceof t?this.metadataGenerator===e.metadataGenerator:!1}},bO=class t extends Sd{generateMetadata(e){return Promise.resolve(new AO.Metadata)}compose(e){return e}_equals(e){return e instanceof t}}});var xO=v(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});ng.CIPHER_SUITES=void 0;ng.getDefaultRootsData=Kve;var Yve=Z("fs");ng.CIPHER_SUITES=process.env.GRPC_SSL_CIPHER_SUITES;var yK=process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH,wO=null;function Kve(){return yK?(wO===null&&(wO=Yve.readFileSync(yK)),wO):null}});var Dr=v(Ed=>{"use strict";Object.defineProperty(Ed,"__esModule",{value:!0});Ed.parseUri=Jve;Ed.splitHostPort=Xve;Ed.combineHostPort=Qve;Ed.uriToString=eTe;var Zve=/^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/;function Jve(t){let e=Zve.exec(t);return e===null?null:{scheme:e[1],authority:e[2],path:e[3]}}var SK=/^\d+$/;function Xve(t){if(t.startsWith("[")){let e=t.indexOf("]");if(e===-1)return null;let r=t.substring(1,e);if(r.indexOf(":")===-1)return null;if(t.length>e+1)if(t[e+1]===":"){let n=t.substring(e+2);return SK.test(n)?{host:r,port:+n}:null}else return null;else return{host:r}}else{let e=t.split(":");return e.length===2?SK.test(e[1])?{host:e[0],port:+e[1]}:null:{host:t}}}function Qve(t){return t.port===void 0?t.host:t.host.includes(":")?`[${t.host}]:${t.port}`:`${t.host}:${t.port}`}function eTe(t){let e="";return t.scheme!==void 0&&(e+=t.scheme+":"),t.authority!==void 0&&(e+="//"+t.authority+"/"),e+=t.path,e}});var ai=v(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=void 0;Zo.registerResolver=tTe;Zo.registerDefaultScheme=rTe;Zo.createResolver=nTe;Zo.getDefaultAuthority=iTe;Zo.mapUriDefaultScheme=oTe;var CO=Dr();Zo.CHANNEL_ARGS_CONFIG_SELECTOR_KEY="grpc.internal.config_selector";var vd={},RO=null;function tTe(t,e){vd[t]=e}function rTe(t){RO=t}function nTe(t,e,r){if(t.scheme!==void 0&&t.scheme in vd)return new vd[t.scheme](t,e,r);throw new Error(`No resolver could be created for target ${(0,CO.uriToString)(t)}`)}function iTe(t){if(t.scheme!==void 0&&t.scheme in vd)return vd[t.scheme].getDefaultAuthority(t);throw new Error(`Invalid target ${(0,CO.uriToString)(t)}`)}function oTe(t){return t.scheme===void 0||!(t.scheme in vd)?RO!==null?{scheme:RO,authority:void 0,path:(0,CO.uriToString)(t)}:null:t}});var Td=v(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});og.ChannelCredentials=void 0;og.createCertificateProviderChannelCredentials=lTe;var ig=Z("tls"),dT=cT(),PO=xO(),EK=Dr(),sTe=ai(),aTe=ht(),cTe=Ve();function IO(t,e){if(t&&!(t instanceof Buffer))throw new TypeError(`${e}, if provided, must be a Buffer.`)}var ol=class{compose(e){return new kO(this,e)}static createSsl(e,r,n,i){var o;if(IO(e,"Root certificate"),IO(r,"Private key"),IO(n,"Certificate chain"),r&&!n)throw new Error("Private key must be given with accompanying certificate chain");if(!r&&n)throw new Error("Certificate chain must be given with accompanying private key");let s=(0,ig.createSecureContext)({ca:(o=e??(0,PO.getDefaultRootsData)())!==null&&o!==void 0?o:void 0,key:r??void 0,cert:n??void 0,ciphers:PO.CIPHER_SUITES});return new lT(s,i??{})}static createFromSecureContext(e,r){return new lT(e,r??{})}static createInsecure(){return new OO}};og.ChannelCredentials=ol;var OO=class t extends ol{constructor(){super()}compose(e){throw new Error("Cannot compose insecure credentials")}_isSecure(){return!1}_equals(e){return e instanceof t}_createSecureConnector(e,r,n){return{connect(i){return Promise.resolve({socket:i,secure:!1})},waitForReady:()=>Promise.resolve(),getCallCredentials:()=>n??dT.CallCredentials.createEmpty(),destroy(){}}}};function vK(t,e,r,n){var i,o;let s={secureContext:t},a=r;if("grpc.http_connect_target"in n){let d=(0,EK.parseUri)(n["grpc.http_connect_target"]);d&&(a=d)}let c=(0,sTe.getDefaultAuthority)(a),l=(0,EK.splitHostPort)(c),u=(i=l?.host)!==null&&i!==void 0?i:c;if(s.host=u,e.checkServerIdentity&&(s.checkServerIdentity=e.checkServerIdentity),e.rejectUnauthorized!==void 0&&(s.rejectUnauthorized=e.rejectUnauthorized),s.ALPNProtocols=["h2"],n["grpc.ssl_target_name_override"]){let d=n["grpc.ssl_target_name_override"],f=(o=s.checkServerIdentity)!==null&&o!==void 0?o:ig.checkServerIdentity;s.checkServerIdentity=(p,h)=>f(d,h),s.servername=d}else s.servername=u;return n["grpc-node.tls_enable_trace"]&&(s.enableTrace=!0),s}var NO=class{constructor(e,r){this.connectionOptions=e,this.callCredentials=r}connect(e){let r=Object.assign({socket:e},this.connectionOptions);return new Promise((n,i)=>{let o=(0,ig.connect)(r,()=>{var s;if((!((s=this.connectionOptions.rejectUnauthorized)!==null&&s!==void 0)||s)&&!o.authorized){i(o.authorizationError);return}n({socket:o,secure:!0})});o.on("error",s=>{i(s)})})}waitForReady(){return Promise.resolve()}getCallCredentials(){return this.callCredentials}destroy(){}},lT=class t extends ol{constructor(e,r){super(),this.secureContext=e,this.verifyOptions=r}_isSecure(){return!0}_equals(e){return this===e?!0:e instanceof t?this.secureContext===e.secureContext&&this.verifyOptions.checkServerIdentity===e.verifyOptions.checkServerIdentity:!1}_createSecureConnector(e,r,n){let i=vK(this.secureContext,this.verifyOptions,e,r);return new NO(i,n??dT.CallCredentials.createEmpty())}},uT=class t extends ol{constructor(e,r,n){super(),this.caCertificateProvider=e,this.identityCertificateProvider=r,this.verifyOptions=n,this.refcount=0,this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this),this.secureContextWatchers=[]}_isSecure(){return!0}_equals(e){var r,n;return this===e?!0:e instanceof t?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&((r=this.verifyOptions)===null||r===void 0?void 0:r.checkServerIdentity)===((n=e.verifyOptions)===null||n===void 0?void 0:n.checkServerIdentity):!1}ref(){var e;this.refcount===0&&(this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener),(e=this.identityCertificateProvider)===null||e===void 0||e.addIdentityCertificateListener(this.identityCertificateUpdateListener)),this.refcount+=1}unref(){var e;this.refcount-=1,this.refcount===0&&(this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener),(e=this.identityCertificateProvider)===null||e===void 0||e.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_createSecureConnector(e,r,n){return this.ref(),new t.SecureConnectorImpl(this,e,r,n??dT.CallCredentials.createEmpty())}maybeUpdateWatchers(){if(this.hasReceivedUpdates()){for(let e of this.secureContextWatchers)e(this.getLatestSecureContext());this.secureContextWatchers=[]}}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.maybeUpdateWatchers()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.maybeUpdateWatchers()}hasReceivedUpdates(){return!(this.latestCaUpdate===void 0||this.identityCertificateProvider&&this.latestIdentityUpdate===void 0)}getSecureContext(){return this.hasReceivedUpdates()?Promise.resolve(this.getLatestSecureContext()):new Promise(e=>{this.secureContextWatchers.push(e)})}getLatestSecureContext(){var e,r;if(!this.latestCaUpdate||this.identityCertificateProvider!==null&&!this.latestIdentityUpdate)return null;try{return(0,ig.createSecureContext)({ca:this.latestCaUpdate.caCertificate,key:(e=this.latestIdentityUpdate)===null||e===void 0?void 0:e.privateKey,cert:(r=this.latestIdentityUpdate)===null||r===void 0?void 0:r.certificate,ciphers:PO.CIPHER_SUITES})}catch(n){return(0,aTe.log)(cTe.LogVerbosity.ERROR,"Failed to createSecureContext with error "+n.message),null}}};uT.SecureConnectorImpl=class{constructor(t,e,r,n){this.parent=t,this.channelTarget=e,this.options=r,this.callCredentials=n}connect(t){return new Promise((e,r)=>{let n=this.parent.getLatestSecureContext();if(!n){r(new Error("Failed to load credentials"));return}t.closed&&r(new Error("Socket closed while loading credentials"));let i=vK(n,this.parent.verifyOptions,this.channelTarget,this.options),o=Object.assign({socket:t},i),s=()=>{r(new Error("Socket closed"))},a=l=>{r(l)},c=(0,ig.connect)(o,()=>{var l;if(c.removeListener("close",s),c.removeListener("error",a),(!((l=this.parent.verifyOptions.rejectUnauthorized)!==null&&l!==void 0)||l)&&!c.authorized){r(c.authorizationError);return}e({socket:c,secure:!0})});c.once("close",s),c.once("error",a)})}async waitForReady(){await this.parent.getSecureContext()}getCallCredentials(){return this.callCredentials}destroy(){this.parent.unref()}};function lTe(t,e,r){return new uT(t,e,r??{})}var kO=class t extends ol{constructor(e,r){if(super(),this.channelCredentials=e,this.callCredentials=r,!e._isSecure())throw new Error("Cannot compose insecure credentials")}compose(e){let r=this.callCredentials.compose(e);return new t(this.channelCredentials,r)}_isSecure(){return!0}_equals(e){return this===e?!0:e instanceof t?this.channelCredentials._equals(e.channelCredentials)&&this.callCredentials._equals(e.callCredentials):!1}_createSecureConnector(e,r,n){let i=this.callCredentials.compose(n??dT.CallCredentials.createEmpty());return this.channelCredentials._createSecureConnector(e,r,i)}}});var da=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.createChildChannelControlHelper=fTe;Ki.registerLoadBalancerType=pTe;Ki.registerDefaultLoadBalancerType=hTe;Ki.createLoadBalancer=mTe;Ki.isLoadBalancerNameRegistered=gTe;Ki.parseLoadBalancingConfig=TK;Ki.getDefaultConfig=_Te;Ki.selectLbConfigFromList=yTe;var uTe=ht(),dTe=Ve();function fTe(t,e){var r,n,i,o,s,a,c,l,u,d;return{createSubchannel:(n=(r=e.createSubchannel)===null||r===void 0?void 0:r.bind(e))!==null&&n!==void 0?n:t.createSubchannel.bind(t),updateState:(o=(i=e.updateState)===null||i===void 0?void 0:i.bind(e))!==null&&o!==void 0?o:t.updateState.bind(t),requestReresolution:(a=(s=e.requestReresolution)===null||s===void 0?void 0:s.bind(e))!==null&&a!==void 0?a:t.requestReresolution.bind(t),addChannelzChild:(l=(c=e.addChannelzChild)===null||c===void 0?void 0:c.bind(e))!==null&&l!==void 0?l:t.addChannelzChild.bind(t),removeChannelzChild:(d=(u=e.removeChannelzChild)===null||u===void 0?void 0:u.bind(e))!==null&&d!==void 0?d:t.removeChannelzChild.bind(t)}}var ua={},sg=null;function pTe(t,e,r){ua[t]={LoadBalancer:e,LoadBalancingConfig:r}}function hTe(t){sg=t}function mTe(t,e){let r=t.getLoadBalancerName();return r in ua?new ua[r].LoadBalancer(e):null}function gTe(t){return t in ua}function TK(t){let e=Object.keys(t);if(e.length!==1)throw new Error("Provided load balancing config has multiple conflicting entries");let r=e[0];if(r in ua)try{return ua[r].LoadBalancingConfig.createFromJson(t[r])}catch(n){throw new Error(`${r}: ${n.message}`)}else throw new Error(`Unrecognized load balancing config name ${r}`)}function _Te(){if(!sg)throw new Error("No default load balancer type registered");return new ua[sg].LoadBalancingConfig}function yTe(t,e=!1){for(let r of t)try{return TK(r)}catch(n){(0,uTe.log)(dTe.LogVerbosity.DEBUG,"Config parsing failed with error",n.message);continue}return e&&sg?new ua[sg].LoadBalancingConfig:null}});var MO=v(ag=>{"use strict";Object.defineProperty(ag,"__esModule",{value:!0});ag.validateRetryThrottling=bK;ag.validateServiceConfig=AK;ag.extractAndSelectServiceConfig=CTe;var STe=Z("os"),fT=Ve(),pT=/^\d+(\.\d{1,9})?s$/,ETe="node";function vTe(t){if("service"in t&&t.service!==""){if(typeof t.service!="string")throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof t.service}`);if("method"in t&&t.method!==""){if(typeof t.method!="string")throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof t.service}`);return{service:t.service,method:t.method}}else return{service:t.service}}else{if("method"in t&&t.method!==void 0)throw new Error("Invalid method config name: method set with empty or unset service");return{}}}function TTe(t){if(!("maxAttempts"in t)||!Number.isInteger(t.maxAttempts)||t.maxAttempts<2)throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");if(!("initialBackoff"in t)||typeof t.initialBackoff!="string"||!pT.test(t.initialBackoff))throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("maxBackoff"in t)||typeof t.maxBackoff!="string"||!pT.test(t.maxBackoff))throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");if(!("backoffMultiplier"in t)||typeof t.backoffMultiplier!="number"||t.backoffMultiplier<=0)throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");if(!("retryableStatusCodes"in t&&Array.isArray(t.retryableStatusCodes)))throw new Error("Invalid method config retry policy: retryableStatusCodes is required");if(t.retryableStatusCodes.length===0)throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");for(let e of t.retryableStatusCodes)if(typeof e=="number"){if(!Object.values(fT.Status).includes(e))throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range")}else if(typeof e=="string"){if(!Object.values(fT.Status).includes(e.toUpperCase()))throw new Error("Invalid method config retry policy: retryableStatusCodes value not a status code name")}else throw new Error("Invalid method config retry policy: retryableStatusCodes value must be a string or number");return{maxAttempts:t.maxAttempts,initialBackoff:t.initialBackoff,maxBackoff:t.maxBackoff,backoffMultiplier:t.backoffMultiplier,retryableStatusCodes:t.retryableStatusCodes}}function bTe(t){if(!("maxAttempts"in t)||!Number.isInteger(t.maxAttempts)||t.maxAttempts<2)throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");if("hedgingDelay"in t&&(typeof t.hedgingDelay!="string"||!pT.test(t.hedgingDelay)))throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");if("nonFatalStatusCodes"in t&&Array.isArray(t.nonFatalStatusCodes))for(let r of t.nonFatalStatusCodes)if(typeof r=="number"){if(!Object.values(fT.Status).includes(r))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range")}else if(typeof r=="string"){if(!Object.values(fT.Status).includes(r.toUpperCase()))throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not a status code name")}else throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number");let e={maxAttempts:t.maxAttempts};return t.hedgingDelay&&(e.hedgingDelay=t.hedgingDelay),t.nonFatalStatusCodes&&(e.nonFatalStatusCodes=t.nonFatalStatusCodes),e}function ATe(t){var e;let r={name:[]};if(!("name"in t)||!Array.isArray(t.name))throw new Error("Invalid method config: invalid name array");for(let n of t.name)r.name.push(vTe(n));if("waitForReady"in t){if(typeof t.waitForReady!="boolean")throw new Error("Invalid method config: invalid waitForReady");r.waitForReady=t.waitForReady}if("timeout"in t)if(typeof t.timeout=="object"){if(!("seconds"in t.timeout)||typeof t.timeout.seconds!="number")throw new Error("Invalid method config: invalid timeout.seconds");if(!("nanos"in t.timeout)||typeof t.timeout.nanos!="number")throw new Error("Invalid method config: invalid timeout.nanos");r.timeout=t.timeout}else if(typeof t.timeout=="string"&&pT.test(t.timeout)){let n=t.timeout.substring(0,t.timeout.length-1).split(".");r.timeout={seconds:n[0]|0,nanos:((e=n[1])!==null&&e!==void 0?e:0)|0}}else throw new Error("Invalid method config: invalid timeout");if("maxRequestBytes"in t){if(typeof t.maxRequestBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxRequestBytes=t.maxRequestBytes}if("maxResponseBytes"in t){if(typeof t.maxResponseBytes!="number")throw new Error("Invalid method config: invalid maxRequestBytes");r.maxResponseBytes=t.maxResponseBytes}if("retryPolicy"in t){if("hedgingPolicy"in t)throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");r.retryPolicy=TTe(t.retryPolicy)}else"hedgingPolicy"in t&&(r.hedgingPolicy=bTe(t.hedgingPolicy));return r}function bK(t){if(!("maxTokens"in t)||typeof t.maxTokens!="number"||t.maxTokens<=0||t.maxTokens>1e3)throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");if(!("tokenRatio"in t)||typeof t.tokenRatio!="number"||t.tokenRatio<=0)throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");return{maxTokens:+t.maxTokens.toFixed(3),tokenRatio:+t.tokenRatio.toFixed(3)}}function wTe(t){if(!(typeof t=="object"&&t!==null))throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof t}`);let e=Object.keys(t);if(e.length>1)throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${e}`);if(e.length===0)throw new Error("Invalid loadBalancingConfig: load balancing policy name required");return{[e[0]]:t[e[0]]}}function AK(t){let e={loadBalancingConfig:[],methodConfig:[]};if("loadBalancingPolicy"in t)if(typeof t.loadBalancingPolicy=="string")e.loadBalancingPolicy=t.loadBalancingPolicy;else throw new Error("Invalid service config: invalid loadBalancingPolicy");if("loadBalancingConfig"in t)if(Array.isArray(t.loadBalancingConfig))for(let n of t.loadBalancingConfig)e.loadBalancingConfig.push(wTe(n));else throw new Error("Invalid service config: invalid loadBalancingConfig");if("methodConfig"in t&&Array.isArray(t.methodConfig))for(let n of t.methodConfig)e.methodConfig.push(ATe(n));"retryThrottling"in t&&(e.retryThrottling=bK(t.retryThrottling));let r=[];for(let n of e.methodConfig)for(let i of n.name){for(let o of r)if(i.service===o.service&&i.method===o.method)throw new Error(`Invalid service config: duplicate name ${i.service}/${i.method}`);r.push(i)}return e}function xTe(t){if(!("serviceConfig"in t))throw new Error("Invalid service config choice: missing service config");let e={serviceConfig:AK(t.serviceConfig)};if("clientLanguage"in t)if(Array.isArray(t.clientLanguage)){e.clientLanguage=[];for(let n of t.clientLanguage)if(typeof n=="string")e.clientLanguage.push(n);else throw new Error("Invalid service config choice: invalid clientLanguage")}else throw new Error("Invalid service config choice: invalid clientLanguage");if("clientHostname"in t)if(Array.isArray(t.clientHostname)){e.clientHostname=[];for(let n of t.clientHostname)if(typeof n=="string")e.clientHostname.push(n);else throw new Error("Invalid service config choice: invalid clientHostname")}else throw new Error("Invalid service config choice: invalid clientHostname");if("percentage"in t)if(typeof t.percentage=="number"&&0<=t.percentage&&t.percentage<=100)e.percentage=t.percentage;else throw new Error("Invalid service config choice: invalid percentage");let r=["clientLanguage","percentage","clientHostname","serviceConfig"];for(let n in t)if(!r.includes(n))throw new Error(`Invalid service config choice: unexpected field ${n}`);return e}function RTe(t,e){if(!Array.isArray(t))throw new Error("Invalid service config list");for(let r of t){let n=xTe(r);if(!(typeof n.percentage=="number"&&e>n.percentage)){if(Array.isArray(n.clientHostname)){let i=!1;for(let o of n.clientHostname)o===STe.hostname()&&(i=!0);if(!i)continue}if(Array.isArray(n.clientLanguage)){let i=!1;for(let o of n.clientLanguage)o===ETe&&(i=!0);if(!i)continue}return n.serviceConfig}}throw new Error("No matching service config found")}function CTe(t,e){for(let r of t)if(r.length>0&&r[0].startsWith("grpc_config=")){let n=r.join("").substring(12),i=JSON.parse(n);return RTe(i,e)}return null}});var Lr=v(hT=>{"use strict";Object.defineProperty(hT,"__esModule",{value:!0});hT.ConnectivityState=void 0;var wK;(function(t){t[t.IDLE=0]="IDLE",t[t.CONNECTING=1]="CONNECTING",t[t.READY=2]="READY",t[t.TRANSIENT_FAILURE=3]="TRANSIENT_FAILURE",t[t.SHUTDOWN=4]="SHUTDOWN"})(wK||(hT.ConnectivityState=wK={}))});var Jo=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});fa.QueuePicker=fa.UnavailablePicker=fa.PickResultType=void 0;var ITe=Kt(),PTe=Ve(),mT;(function(t){t[t.COMPLETE=0]="COMPLETE",t[t.QUEUE=1]="QUEUE",t[t.TRANSIENT_FAILURE=2]="TRANSIENT_FAILURE",t[t.DROP=3]="DROP"})(mT||(fa.PickResultType=mT={}));var DO=class{constructor(e){this.status=Object.assign({code:PTe.Status.UNAVAILABLE,details:"No connection established",metadata:new ITe.Metadata},e)}pick(e){return{pickResultType:mT.TRANSIENT_FAILURE,subchannel:null,status:this.status,onCallStarted:null,onCallEnded:null}}};fa.UnavailablePicker=DO;var LO=class{constructor(e,r){this.loadBalancer=e,this.childPicker=r,this.calledExitIdle=!1}pick(e){return this.calledExitIdle||(process.nextTick(()=>{this.loadBalancer.exitIdle()}),this.calledExitIdle=!0),this.childPicker?this.childPicker.pick(e):{pickResultType:mT.QUEUE,subchannel:null,status:null,onCallStarted:null,onCallEnded:null}}};fa.QueuePicker=LO});var bd=v(_T=>{"use strict";Object.defineProperty(_T,"__esModule",{value:!0});_T.BackoffTimeout=void 0;var OTe=Ve(),NTe=ht(),kTe="backoff",MTe=1e3,DTe=1.6,LTe=12e4,$Te=.2;function UTe(t,e){return Math.random()*(e-t)+t}var gT=class t{constructor(e,r){this.callback=e,this.initialDelay=MTe,this.multiplier=DTe,this.maxDelay=LTe,this.jitter=$Te,this.running=!1,this.hasRef=!0,this.startTime=new Date,this.endTime=new Date,this.id=t.getNextId(),r&&(r.initialDelay&&(this.initialDelay=r.initialDelay),r.multiplier&&(this.multiplier=r.multiplier),r.jitter&&(this.jitter=r.jitter),r.maxDelay&&(this.maxDelay=r.maxDelay)),this.trace("constructed initialDelay="+this.initialDelay+" multiplier="+this.multiplier+" jitter="+this.jitter+" maxDelay="+this.maxDelay),this.nextDelay=this.initialDelay,this.timerId=setTimeout(()=>{},0),clearTimeout(this.timerId)}static getNextId(){return this.nextId++}trace(e){NTe.trace(OTe.LogVerbosity.DEBUG,kTe,"{"+this.id+"} "+e)}runTimer(e){var r,n;this.trace("runTimer(delay="+e+")"),this.endTime=this.startTime,this.endTime.setMilliseconds(this.endTime.getMilliseconds()+e),clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.trace("timer fired"),this.running=!1,this.callback()},e),this.hasRef||(n=(r=this.timerId).unref)===null||n===void 0||n.call(r)}runOnce(){this.trace("runOnce()"),this.running=!0,this.startTime=new Date,this.runTimer(this.nextDelay);let e=Math.min(this.nextDelay*this.multiplier,this.maxDelay),r=e*this.jitter;this.nextDelay=e+UTe(-r,r)}stop(){this.trace("stop()"),clearTimeout(this.timerId),this.running=!1}reset(){if(this.trace("reset() running="+this.running),this.nextDelay=this.initialDelay,this.running){let e=new Date,r=this.startTime;r.setMilliseconds(r.getMilliseconds()+this.nextDelay),clearTimeout(this.timerId),e<r?this.runTimer(r.getTime()-e.getTime()):this.running=!1}}isRunning(){return this.running}ref(){var e,r;this.hasRef=!0,(r=(e=this.timerId).ref)===null||r===void 0||r.call(e)}unref(){var e,r;this.hasRef=!1,(r=(e=this.timerId).unref)===null||r===void 0||r.call(e)}getEndTime(){return this.endTime}};_T.BackoffTimeout=gT;gT.nextId=0});var ST=v(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.ChildLoadBalancerHandler=void 0;var FTe=da(),BTe=Lr(),jTe="child_load_balancer_helper",$O=class{constructor(e){this.channelControlHelper=e,this.currentChild=null,this.pendingChild=null,this.latestConfig=null,this.ChildPolicyHelper=class{constructor(r){this.parent=r,this.child=null}createSubchannel(r,n){return this.parent.channelControlHelper.createSubchannel(r,n)}updateState(r,n,i){var o;if(this.calledByPendingChild()){if(r===BTe.ConnectivityState.CONNECTING)return;(o=this.parent.currentChild)===null||o===void 0||o.destroy(),this.parent.currentChild=this.parent.pendingChild,this.parent.pendingChild=null}else if(!this.calledByCurrentChild())return;this.parent.channelControlHelper.updateState(r,n,i)}requestReresolution(){var r;let n=(r=this.parent.pendingChild)!==null&&r!==void 0?r:this.parent.currentChild;this.child===n&&this.parent.channelControlHelper.requestReresolution()}setChild(r){this.child=r}addChannelzChild(r){this.parent.channelControlHelper.addChannelzChild(r)}removeChannelzChild(r){this.parent.channelControlHelper.removeChannelzChild(r)}calledByPendingChild(){return this.child===this.parent.pendingChild}calledByCurrentChild(){return this.child===this.parent.currentChild}}}configUpdateRequiresNewPolicyInstance(e,r){return e.getLoadBalancerName()!==r.getLoadBalancerName()}updateAddressList(e,r,n,i){let o;if(this.currentChild===null||this.latestConfig===null||this.configUpdateRequiresNewPolicyInstance(this.latestConfig,r)){let s=new this.ChildPolicyHelper(this),a=(0,FTe.createLoadBalancer)(r,s);s.setChild(a),this.currentChild===null?(this.currentChild=a,o=this.currentChild):(this.pendingChild&&this.pendingChild.destroy(),this.pendingChild=a,o=this.pendingChild)}else this.pendingChild===null?o=this.currentChild:o=this.pendingChild;return this.latestConfig=r,o.updateAddressList(e,r,n,i)}exitIdle(){this.currentChild&&(this.currentChild.exitIdle(),this.pendingChild&&this.pendingChild.exitIdle())}resetBackoff(){this.currentChild&&(this.currentChild.resetBackoff(),this.pendingChild&&this.pendingChild.resetBackoff())}destroy(){this.currentChild&&(this.currentChild.destroy(),this.currentChild=null),this.pendingChild&&(this.pendingChild.destroy(),this.pendingChild=null)}getTypeName(){return jTe}};yT.ChildLoadBalancerHandler=$O});var CK=v(ET=>{"use strict";Object.defineProperty(ET,"__esModule",{value:!0});ET.ResolvingLoadBalancer=void 0;var zTe=da(),GTe=MO(),Kr=Lr(),xK=ai(),cg=Jo(),qTe=bd(),UO=Ve(),VTe=Kt(),HTe=ht(),WTe=Ve(),YTe=Dr(),KTe=ST(),ZTe="resolving_load_balancer";function RK(t){HTe.trace(WTe.LogVerbosity.DEBUG,ZTe,t)}var JTe=["SERVICE_AND_METHOD","SERVICE","EMPTY"];function XTe(t,e,r,n){for(let i of r.name)switch(n){case"EMPTY":if(!i.service&&!i.method)return!0;break;case"SERVICE":if(i.service===t&&!i.method)return!0;break;case"SERVICE_AND_METHOD":if(i.service===t&&i.method===e)return!0}return!1}function QTe(t,e,r,n){for(let i of r)if(XTe(t,e,i,n))return i;return null}function ebe(t){return{invoke(e,r){var n,i;let o=e.split("/").filter(c=>c.length>0),s=(n=o[0])!==null&&n!==void 0?n:"",a=(i=o[1])!==null&&i!==void 0?i:"";if(t&&t.methodConfig)for(let c of JTe){let l=QTe(s,a,t.methodConfig,c);if(l)return{methodConfig:l,pickInformation:{},status:UO.Status.OK,dynamicFilterFactories:[]}}return{methodConfig:{name:[]},pickInformation:{},status:UO.Status.OK,dynamicFilterFactories:[]}},unref(){}}}var FO=class{constructor(e,r,n,i,o){this.target=e,this.channelControlHelper=r,this.channelOptions=n,this.onSuccessfulResolution=i,this.onFailedResolution=o,this.latestChildState=Kr.ConnectivityState.IDLE,this.latestChildPicker=new cg.QueuePicker(this),this.latestChildErrorMessage=null,this.currentState=Kr.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1,n["grpc.service_config"]?this.defaultServiceConfig=(0,GTe.validateServiceConfig)(JSON.parse(n["grpc.service_config"])):this.defaultServiceConfig={loadBalancingConfig:[],methodConfig:[]},this.updateState(Kr.ConnectivityState.IDLE,new cg.QueuePicker(this),null),this.childLoadBalancer=new KTe.ChildLoadBalancerHandler({createSubchannel:r.createSubchannel.bind(r),requestReresolution:()=>{this.backoffTimeout.isRunning()?(RK("requestReresolution delayed by backoff timer until "+this.backoffTimeout.getEndTime().toISOString()),this.continueResolving=!0):this.updateResolution()},updateState:(a,c,l)=>{this.latestChildState=a,this.latestChildPicker=c,this.latestChildErrorMessage=l,this.updateState(a,c,l)},addChannelzChild:r.addChannelzChild.bind(r),removeChannelzChild:r.removeChannelzChild.bind(r)}),this.innerResolver=(0,xK.createResolver)(e,this.handleResolverResult.bind(this),n);let s={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new qTe.BackoffTimeout(()=>{this.continueResolving?(this.updateResolution(),this.continueResolving=!1):this.updateState(this.latestChildState,this.latestChildPicker,this.latestChildErrorMessage)},s),this.backoffTimeout.unref()}handleResolverResult(e,r,n,i){var o,s;this.backoffTimeout.stop(),this.backoffTimeout.reset();let a=!0,c=null;if(n===null?c=this.defaultServiceConfig:n.ok?c=n.value:this.previousServiceConfig!==null?c=this.previousServiceConfig:(a=!1,this.handleResolutionFailure(n.error)),c!==null){let l=(o=c?.loadBalancingConfig)!==null&&o!==void 0?o:[],u=(0,zTe.selectLbConfigFromList)(l,!0);u===null?(a=!1,this.handleResolutionFailure({code:UO.Status.UNAVAILABLE,details:"All load balancer options in service config are not compatible",metadata:new VTe.Metadata})):a=this.childLoadBalancer.updateAddressList(e,u,Object.assign(Object.assign({},this.channelOptions),r),i)}return a&&this.onSuccessfulResolution(c,(s=r[xK.CHANNEL_ARGS_CONFIG_SELECTOR_KEY])!==null&&s!==void 0?s:ebe(c)),a}updateResolution(){this.innerResolver.updateResolution(),this.currentState===Kr.ConnectivityState.IDLE&&this.updateState(Kr.ConnectivityState.CONNECTING,this.latestChildPicker,this.latestChildErrorMessage),this.backoffTimeout.runOnce()}updateState(e,r,n){RK((0,YTe.uriToString)(this.target)+" "+Kr.ConnectivityState[this.currentState]+" -> "+Kr.ConnectivityState[e]),e===Kr.ConnectivityState.IDLE&&(r=new cg.QueuePicker(this,r)),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}handleResolutionFailure(e){this.latestChildState===Kr.ConnectivityState.IDLE&&(this.updateState(Kr.ConnectivityState.TRANSIENT_FAILURE,new cg.UnavailablePicker(e),e.details),this.onFailedResolution(e))}exitIdle(){(this.currentState===Kr.ConnectivityState.IDLE||this.currentState===Kr.ConnectivityState.TRANSIENT_FAILURE)&&(this.backoffTimeout.isRunning()?this.continueResolving=!0:this.updateResolution()),this.childLoadBalancer.exitIdle()}updateAddressList(e,r){throw new Error("updateAddressList not supported on ResolvingLoadBalancer")}resetBackoff(){this.backoffTimeout.reset(),this.childLoadBalancer.resetBackoff()}destroy(){this.childLoadBalancer.destroy(),this.innerResolver.destroy(),this.backoffTimeout.reset(),this.backoffTimeout.stop(),this.latestChildState=Kr.ConnectivityState.IDLE,this.latestChildPicker=new cg.QueuePicker(this),this.currentState=Kr.ConnectivityState.IDLE,this.previousServiceConfig=null,this.continueResolving=!1}getTypeName(){return"resolving_load_balancer"}};ET.ResolvingLoadBalancer=FO});var IK=v(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});lg.recognizedOptions=void 0;lg.channelOptionsEqual=tbe;lg.recognizedOptions={"grpc.ssl_target_name_override":!0,"grpc.primary_user_agent":!0,"grpc.secondary_user_agent":!0,"grpc.default_authority":!0,"grpc.keepalive_time_ms":!0,"grpc.keepalive_timeout_ms":!0,"grpc.keepalive_permit_without_calls":!0,"grpc.service_config":!0,"grpc.max_concurrent_streams":!0,"grpc.initial_reconnect_backoff_ms":!0,"grpc.max_reconnect_backoff_ms":!0,"grpc.use_local_subchannel_pool":!0,"grpc.max_send_message_length":!0,"grpc.max_receive_message_length":!0,"grpc.enable_http_proxy":!0,"grpc.enable_channelz":!0,"grpc.dns_min_time_between_resolutions_ms":!0,"grpc.enable_retries":!0,"grpc.per_rpc_retry_buffer_size":!0,"grpc.retry_buffer_size":!0,"grpc.max_connection_age_ms":!0,"grpc.max_connection_age_grace_ms":!0,"grpc-node.max_session_memory":!0,"grpc.service_config_disable_resolution":!0,"grpc.client_idle_timeout_ms":!0,"grpc-node.tls_enable_trace":!0,"grpc.lb.ring_hash.ring_size_cap":!0,"grpc-node.retry_max_attempts_limit":!0,"grpc-node.flow_control_window":!0,"grpc.server_call_metric_recording":!0};function tbe(t,e){let r=Object.keys(t).sort(),n=Object.keys(e).sort();if(r.length!==n.length)return!1;for(let i=0;i<r.length;i+=1)if(r[i]!==n[i]||t[r[i]]!==e[n[i]])return!1;return!0}});var Zr=v(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.EndpointMap=void 0;ci.isTcpSubchannelAddress=dg;ci.subchannelAddressEqual=vT;ci.subchannelAddressToString=OK;ci.stringToSubchannelAddress=nbe;ci.endpointEqual=ibe;ci.endpointToString=obe;ci.endpointHasAddress=NK;var PK=Z("net");function dg(t){return"port"in t}function vT(t,e){return!t&&!e?!0:!t||!e?!1:dg(t)?dg(e)&&t.host===e.host&&t.port===e.port:!dg(e)&&t.path===e.path}function OK(t){return dg(t)?(0,PK.isIPv6)(t.host)?"["+t.host+"]:"+t.port:t.host+":"+t.port:t.path}var rbe=443;function nbe(t,e){return(0,PK.isIP)(t)?{host:t,port:e??rbe}:{path:t}}function ibe(t,e){if(t.addresses.length!==e.addresses.length)return!1;for(let r=0;r<t.addresses.length;r++)if(!vT(t.addresses[r],e.addresses[r]))return!1;return!0}function obe(t){return"["+t.addresses.map(OK).join(", ")+"]"}function NK(t,e){for(let r of t.addresses)if(vT(r,e))return!0;return!1}function ug(t,e){if(t.addresses.length!==e.addresses.length)return!1;for(let r of t.addresses){let n=!1;for(let i of e.addresses)if(vT(r,i)){n=!0;break}if(!n)return!1}return!0}var BO=class{constructor(){this.map=new Set}get size(){return this.map.size}getForSubchannelAddress(e){for(let r of this.map)if(NK(r.key,e))return r.value}deleteMissing(e){let r=[];for(let n of this.map){let i=!1;for(let o of e)ug(o,n.key)&&(i=!0);i||(r.push(n.value),this.map.delete(n))}return r}get(e){for(let r of this.map)if(ug(e,r.key))return r.value}set(e,r){for(let n of this.map)if(ug(e,n.key)){n.value=r;return}this.map.add({key:e,value:r})}delete(e){for(let r of this.map)if(ug(e,r.key)){this.map.delete(r);return}}has(e){for(let r of this.map)if(ug(e,r.key))return!0;return!1}clear(){this.map.clear()}*keys(){for(let e of this.map)yield e.key}*values(){for(let e of this.map)yield e.value}*entries(){for(let e of this.map)yield[e.key,e.value]}};ci.EndpointMap=BO});var MK={};ar(MK,{OrderedMap:()=>pbe});function Ad(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");jO(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function sbe(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(u){return c([l,u])}}function c(l){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(r=0)),r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(u){l=[6,u],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function sl(){throw new RangeError("Iterator access denied!")}var jO,kK,abe,cbe,lbe,ube,dbe,fbe,Xo,pbe,DK=A(()=>{"use strict";jO=function(t,e){return jO=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},jO(t,e)};kK=(function(){function t(e,r,n){n===void 0&&(n=1),this.t=void 0,this.i=void 0,this.h=void 0,this.u=e,this.o=r,this.l=n}return t.prototype.v=function(){var e=this,r=e.h.h===e;if(r&&e.l===1)e=e.i;else if(e.t)for(e=e.t;e.i;)e=e.i;else{if(r)return e.h;for(var n=e.h;n.t===e;)e=n,n=e.h;e=n}return e},t.prototype.p=function(){var e=this;if(e.i){for(e=e.i;e.t;)e=e.t;return e}else{for(var r=e.h;r.i===e;)e=r,r=e.h;return e.i!==r?r:e}},t.prototype.T=function(){var e=this.h,r=this.i,n=r.t;return e.h===this?e.h=r:e.t===this?e.t=r:e.i=r,r.h=e,r.t=this,this.h=r,this.i=n,n&&(n.h=this),r},t.prototype.I=function(){var e=this.h,r=this.t,n=r.i;return e.h===this?e.h=r:e.t===this?e.t=r:e.i=r,r.h=e,r.i=this,this.h=r,this.t=n,n&&(n.h=this),r},t})(),abe=(function(t){Ad(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.O=1,r}return e.prototype.T=function(){var r=t.prototype.T.call(this);return this.M(),r.M(),r},e.prototype.I=function(){var r=t.prototype.I.call(this);return this.M(),r.M(),r},e.prototype.M=function(){this.O=1,this.t&&(this.O+=this.t.O),this.i&&(this.O+=this.i.O)},e})(kK),cbe=(function(){function t(e){e===void 0&&(e=0),this.iteratorType=e}return t.prototype.equals=function(e){return this.C===e.C},t})(),lbe=(function(){function t(){this._=0}return Object.defineProperty(t.prototype,"length",{get:function(){return this._},enumerable:!1,configurable:!0}),t.prototype.size=function(){return this._},t.prototype.empty=function(){return this._===0},t})(),ube=(function(t){Ad(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e})(lbe);dbe=(function(t){Ad(e,t);function e(r,n){r===void 0&&(r=function(o,s){return o<s?-1:o>s?1:0}),n===void 0&&(n=!1);var i=t.call(this)||this;return i.N=void 0,i.g=r,i.enableIndex=n,i.S=n?abe:kK,i.A=new i.S,i}return e.prototype.m=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);if(o<0)r=r.i;else if(o>0)i=r,r=r.t;else return r}return i},e.prototype.B=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);o<=0?r=r.i:(i=r,r=r.t)}return i},e.prototype.j=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);if(o<0)i=r,r=r.i;else if(o>0)r=r.t;else return r}return i},e.prototype.k=function(r,n){for(var i=this.A;r;){var o=this.g(r.u,n);o<0?(i=r,r=r.i):r=r.t}return i},e.prototype.R=function(r){for(;;){var n=r.h;if(n===this.A)return;if(r.l===1){r.l=0;return}if(r===n.t){var i=n.i;if(i.l===1)i.l=0,n.l=1,n===this.N?this.N=n.T():n.T();else if(i.i&&i.i.l===1){i.l=n.l,n.l=0,i.i.l=0,n===this.N?this.N=n.T():n.T();return}else i.t&&i.t.l===1?(i.l=1,i.t.l=0,i.I()):(i.l=1,r=n)}else{var i=n.t;if(i.l===1)i.l=0,n.l=1,n===this.N?this.N=n.I():n.I();else if(i.t&&i.t.l===1){i.l=n.l,n.l=0,i.t.l=0,n===this.N?this.N=n.I():n.I();return}else i.i&&i.i.l===1?(i.l=1,i.i.l=0,i.T()):(i.l=1,r=n)}}},e.prototype.G=function(r){if(this._===1){this.clear();return}for(var n=r;n.t||n.i;){if(n.i)for(n=n.i;n.t;)n=n.t;else n=n.t;var i=r.u;r.u=n.u,n.u=i;var o=r.o;r.o=n.o,n.o=o,r=n}this.A.t===n?this.A.t=n.h:this.A.i===n&&(this.A.i=n.h),this.R(n);var s=n.h;if(n===s.t?s.t=void 0:s.i=void 0,this._-=1,this.N.l=0,this.enableIndex)for(;s!==this.A;)s.O-=1,s=s.h},e.prototype.P=function(r){for(var n=typeof r=="number"?r:void 0,i=typeof r=="function"?r:void 0,o=typeof r>"u"?[]:void 0,s=0,a=this.N,c=[];c.length||a;)if(a)c.push(a),a=a.t;else{if(a=c.pop(),s===n)return a;o&&o.push(a),i&&i(a,s,this),s+=1,a=a.i}return o},e.prototype.q=function(r){for(;;){var n=r.h;if(n.l===0)return;var i=n.h;if(n===i.t){var o=i.i;if(o&&o.l===1){if(o.l=n.l=0,i===this.N)return;i.l=1,r=i;continue}else if(r===n.i){if(r.l=0,r.t&&(r.t.h=n),r.i&&(r.i.h=i),n.i=r.t,i.t=r.i,r.t=n,r.i=i,i===this.N)this.N=r,this.A.h=r;else{var s=i.h;s.t===i?s.t=r:s.i=r}r.h=i.h,n.h=r,i.h=r,i.l=1}else{n.l=0,i===this.N?this.N=i.I():i.I(),i.l=1;return}}else{var o=i.t;if(o&&o.l===1){if(o.l=n.l=0,i===this.N)return;i.l=1,r=i;continue}else if(r===n.t){if(r.l=0,r.t&&(r.t.h=i),r.i&&(r.i.h=n),i.i=r.t,n.t=r.i,r.t=i,r.i=n,i===this.N)this.N=r,this.A.h=r;else{var s=i.h;s.t===i?s.t=r:s.i=r}r.h=i.h,n.h=r,i.h=r,i.l=1}else{n.l=0,i===this.N?this.N=i.T():i.T(),i.l=1;return}}this.enableIndex&&(n.M(),i.M(),r.M());return}},e.prototype.D=function(r,n,i){if(this.N===void 0)return this._+=1,this.N=new this.S(r,n,0),this.N.h=this.A,this.A.h=this.A.t=this.A.i=this.N,this._;var o,s=this.A.t,a=this.g(s.u,r);if(a===0)return s.o=n,this._;if(a>0)s.t=new this.S(r,n),s.t.h=s,o=s.t,this.A.t=o;else{var c=this.A.i,l=this.g(c.u,r);if(l===0)return c.o=n,this._;if(l<0)c.i=new this.S(r,n),c.i.h=c,o=c.i,this.A.i=o;else{if(i!==void 0){var u=i.C;if(u!==this.A){var d=this.g(u.u,r);if(d===0)return u.o=n,this._;if(d>0){var f=u.v(),p=this.g(f.u,r);if(p===0)return f.o=n,this._;p<0&&(o=new this.S(r,n),f.i===void 0?(f.i=o,o.h=f):(u.t=o,o.h=u))}}}if(o===void 0)for(o=this.N;;){var h=this.g(o.u,r);if(h>0){if(o.t===void 0){o.t=new this.S(r,n),o.t.h=o,o=o.t;break}o=o.t}else if(h<0){if(o.i===void 0){o.i=new this.S(r,n),o.i.h=o,o=o.i;break}o=o.i}else return o.o=n,this._}}}if(this.enableIndex)for(var m=o.h;m!==this.A;)m.O+=1,m=m.h;return this.q(o),this._+=1,this._},e.prototype.F=function(r,n){for(;r;){var i=this.g(r.u,n);if(i<0)r=r.i;else if(i>0)r=r.t;else return r}return r||this.A},e.prototype.clear=function(){this._=0,this.N=void 0,this.A.h=void 0,this.A.t=this.A.i=void 0},e.prototype.updateKeyByIterator=function(r,n){var i=r.C;if(i===this.A&&sl(),this._===1)return i.u=n,!0;var o=i.p().u;if(i===this.A.t)return this.g(o,n)>0?(i.u=n,!0):!1;var s=i.v().u;return i===this.A.i?this.g(s,n)<0?(i.u=n,!0):!1:this.g(s,n)>=0||this.g(o,n)<=0?!1:(i.u=n,!0)},e.prototype.eraseElementByPos=function(r){if(r<0||r>this._-1)throw new RangeError;var n=this.P(r);return this.G(n),this._},e.prototype.eraseElementByKey=function(r){if(this._===0)return!1;var n=this.F(this.N,r);return n===this.A?!1:(this.G(n),!0)},e.prototype.eraseElementByIterator=function(r){var n=r.C;n===this.A&&sl();var i=n.i===void 0,o=r.iteratorType===0;return o?i&&r.next():(!i||n.t===void 0)&&r.next(),this.G(n),r},e.prototype.getHeight=function(){if(this._===0)return 0;function r(n){return n?Math.max(r(n.t),r(n.i))+1:0}return r(this.N)},e})(ube),fbe=(function(t){Ad(e,t);function e(r,n,i){var o=t.call(this,i)||this;return o.C=r,o.A=n,o.iteratorType===0?(o.pre=function(){return this.C===this.A.t&&sl(),this.C=this.C.v(),this},o.next=function(){return this.C===this.A&&sl(),this.C=this.C.p(),this}):(o.pre=function(){return this.C===this.A.i&&sl(),this.C=this.C.p(),this},o.next=function(){return this.C===this.A&&sl(),this.C=this.C.v(),this}),o}return Object.defineProperty(e.prototype,"index",{get:function(){var r=this.C,n=this.A.h;if(r===this.A)return n?n.O-1:0;var i=0;for(r.t&&(i+=r.t.O);r!==n;){var o=r.h;r===o.i&&(i+=1,o.t&&(i+=o.t.O)),r=o}return i},enumerable:!1,configurable:!0}),e.prototype.isAccessible=function(){return this.C!==this.A},e})(cbe),Xo=(function(t){Ad(e,t);function e(r,n,i,o){var s=t.call(this,r,n,o)||this;return s.container=i,s}return Object.defineProperty(e.prototype,"pointer",{get:function(){this.C===this.A&&sl();var r=this;return new Proxy([],{get:function(n,i){return i==="0"?r.C.u:i==="1"?r.C.o:(n[0]=r.C.u,n[1]=r.C.o,n[i])},set:function(n,i,o){if(i!=="1")throw new TypeError("prop must be 1");return r.C.o=o,!0}})},enumerable:!1,configurable:!0}),e.prototype.copy=function(){return new e(this.C,this.A,this.container,this.iteratorType)},e})(fbe),pbe=(function(t){Ad(e,t);function e(r,n,i){r===void 0&&(r=[]);var o=t.call(this,n,i)||this,s=o;return r.forEach((function(a){s.setElement(a[0],a[1])})),o}return e.prototype.begin=function(){return new Xo(this.A.t||this.A,this.A,this)},e.prototype.end=function(){return new Xo(this.A,this.A,this)},e.prototype.rBegin=function(){return new Xo(this.A.i||this.A,this.A,this,1)},e.prototype.rEnd=function(){return new Xo(this.A,this.A,this,1)},e.prototype.front=function(){if(this._!==0){var r=this.A.t;return[r.u,r.o]}},e.prototype.back=function(){if(this._!==0){var r=this.A.i;return[r.u,r.o]}},e.prototype.lowerBound=function(r){var n=this.m(this.N,r);return new Xo(n,this.A,this)},e.prototype.upperBound=function(r){var n=this.B(this.N,r);return new Xo(n,this.A,this)},e.prototype.reverseLowerBound=function(r){var n=this.j(this.N,r);return new Xo(n,this.A,this)},e.prototype.reverseUpperBound=function(r){var n=this.k(this.N,r);return new Xo(n,this.A,this)},e.prototype.forEach=function(r){this.P((function(n,i,o){r([n.u,n.o],i,o)}))},e.prototype.setElement=function(r,n,i){return this.D(r,n,i)},e.prototype.getElementByPos=function(r){if(r<0||r>this._-1)throw new RangeError;var n=this.P(r);return[n.u,n.o]},e.prototype.find=function(r){var n=this.F(this.N,r);return new Xo(n,this.A,this)},e.prototype.getElementByKey=function(r){var n=this.F(this.N,r);return n.o},e.prototype.union=function(r){var n=this;return r.forEach((function(i){n.setElement(i[0],i[1])})),this._},e.prototype[Symbol.iterator]=function(){var r,n,i,o;return sbe(this,(function(s){switch(s.label){case 0:r=this._,n=this.P(),i=0,s.label=1;case 1:return i<r?(o=n[i],[4,[o.u,o.o]]):[3,4];case 2:s.sent(),s.label=3;case 3:return++i,[3,1];case 4:return[2]}}))},e})(dbe)});var bT=v(TT=>{"use strict";Object.defineProperty(TT,"__esModule",{value:!0});TT.registerAdminService=hbe;TT.addAdminServicesToServer=mbe;var LK=[];function hbe(t,e){LK.push({getServiceDefinition:t,getHandlers:e})}function mbe(t){for(let{getServiceDefinition:e,getHandlers:r}of LK)t.addService(e(),r())}});var $K=v(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.ClientDuplexStreamImpl=li.ClientWritableStreamImpl=li.ClientReadableStreamImpl=li.ClientUnaryCallImpl=void 0;li.callErrorFromStatus=_be;var gbe=Z("events"),HO=Z("stream"),fg=Ve();function _be(t,e){let r=`${t.code} ${fg.Status[t.code]}: ${t.details}`,i=`${new Error(r).stack}
3
3
  for call at
4
4
  ${e}`;return Object.assign(new Error(r),t,{stack:i})}var zO=class extends gbe.EventEmitter{constructor(){super()}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(fg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}};li.ClientUnaryCallImpl=zO;var GO=class extends HO.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(fg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_read(e){var r;(r=this.call)===null||r===void 0||r.startRead()}};li.ClientReadableStreamImpl=GO;var qO=class extends HO.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(fg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_write(e,r,n){var i;let o={callback:n},s=Number(r);Number.isNaN(s)||(o.flags=s),(i=this.call)===null||i===void 0||i.sendMessageWithContext(o,e)}_final(e){var r;(r=this.call)===null||r===void 0||r.halfClose(),e()}};li.ClientWritableStreamImpl=qO;var VO=class extends HO.Duplex{constructor(e,r){super({objectMode:!0}),this.serialize=e,this.deserialize=r}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(fg.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_read(e){var r;(r=this.call)===null||r===void 0||r.startRead()}_write(e,r,n){var i;let o={callback:n},s=Number(r);Number.isNaN(s)||(o.flags=s),(i=this.call)===null||i===void 0||i.sendMessageWithContext(o,e)}_final(e){var r;(r=this.call)===null||r===void 0||r.halfClose(),e()}};li.ClientDuplexStreamImpl=VO});var cl=v(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.InterceptingListenerImpl=void 0;al.statusOrFromValue=Sbe;al.statusOrFromError=Ebe;al.isInterceptingListener=vbe;var ybe=Kt();function Sbe(t){return{ok:!0,value:t}}function Ebe(t){var e;return{ok:!1,error:Object.assign(Object.assign({},t),{metadata:(e=t.metadata)!==null&&e!==void 0?e:new ybe.Metadata})}}function vbe(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var WO=class{constructor(e,r){this.listener=e,this.nextListener=r,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextListener.onReceiveStatus(r)})}};al.InterceptingListenerImpl=WO});var eN=v(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.InterceptingCall=ui.RequesterBuilder=ui.ListenerBuilder=ui.InterceptorConfigurationError=void 0;ui.getInterceptingCall=wbe;var Tbe=Kt(),UK=cl(),FK=Ve(),BK=iT(),hg=class t extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,t)}};ui.InterceptorConfigurationError=hg;var KO=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};ui.ListenerBuilder=KO;var ZO=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};ui.RequesterBuilder=ZO;var YO={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveStatus:(t,e)=>{e(t)}},pg={start:(t,e,r)=>{r(t,e)},sendMessage:(t,e)=>{e(t)},halfClose:t=>{t()},cancel:t=>{t()}},JO=class{constructor(e,r){var n,i,o,s;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,r?this.requester={start:(n=r.start)!==null&&n!==void 0?n:pg.start,sendMessage:(i=r.sendMessage)!==null&&i!==void 0?i:pg.sendMessage,halfClose:(o=r.halfClose)!==null&&o!==void 0?o:pg.halfClose,cancel:(s=r.cancel)!==null&&s!==void 0?s:pg.cancel}:this.requester=pg}cancelWithStatus(e,r){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,r)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,r){var n,i,o,s,a,c;let l={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:(u=>{}),onReceiveMessage:(s=(o=r?.onReceiveMessage)===null||o===void 0?void 0:o.bind(r))!==null&&s!==void 0?s:(u=>{}),onReceiveStatus:(c=(a=r?.onReceiveStatus)===null||a===void 0?void 0:a.bind(r))!==null&&c!==void 0?c:(u=>{})};this.processingMetadata=!0,this.requester.start(e,l,(u,d)=>{var f,p,h;this.processingMetadata=!1;let m;if((0,UK.isInterceptingListener)(d))m=d;else{let y={onReceiveMetadata:(f=d.onReceiveMetadata)!==null&&f!==void 0?f:YO.onReceiveMetadata,onReceiveMessage:(p=d.onReceiveMessage)!==null&&p!==void 0?p:YO.onReceiveMessage,onReceiveStatus:(h=d.onReceiveStatus)!==null&&h!==void 0?h:YO.onReceiveStatus};m=new UK.InterceptingListenerImpl(y,l)}this.nextCall.start(u,m),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,r){this.processingMessage=!0,this.requester.sendMessage(r,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=r):(this.nextCall.sendMessageWithContext(e,n),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};ui.InterceptingCall=JO;function bbe(t,e,r){var n,i;let o=(n=r.deadline)!==null&&n!==void 0?n:1/0,s=r.host,a=(i=r.parent)!==null&&i!==void 0?i:null,c=r.propagate_flags,l=r.credentials,u=t.createCall(e,o,s,a,c);return l&&u.setCredentials(l),u}var AT=class{constructor(e,r){this.call=e,this.methodDefinition=r}cancelWithStatus(e,r){this.call.cancelWithStatus(e,r)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,r){let n;try{n=this.methodDefinition.requestSerialize(r)}catch(i){this.call.cancelWithStatus(FK.Status.INTERNAL,`Request message serialization failure: ${(0,BK.getErrorMessage)(i)}`);return}this.call.sendMessageWithContext(e,n)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,r){let n=null;this.call.start(e,{onReceiveMetadata:i=>{var o;(o=r?.onReceiveMetadata)===null||o===void 0||o.call(r,i)},onReceiveMessage:i=>{var o;let s;try{s=this.methodDefinition.responseDeserialize(i)}catch(a){n={code:FK.Status.INTERNAL,details:`Response message parsing error: ${(0,BK.getErrorMessage)(a)}`,metadata:new Tbe.Metadata},this.call.cancelWithStatus(n.code,n.details);return}(o=r?.onReceiveMessage)===null||o===void 0||o.call(r,s)},onReceiveStatus:i=>{var o,s;n?(o=r?.onReceiveStatus)===null||o===void 0||o.call(r,n):(s=r?.onReceiveStatus)===null||s===void 0||s.call(r,i)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}},XO=class extends AT{constructor(e,r){super(e,r)}start(e,r){var n,i;let o=!1,s={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:(a=>{}),onReceiveMessage:a=>{var c;o=!0,(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,a)},onReceiveStatus:a=>{var c,l;o||(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,null),(l=r?.onReceiveStatus)===null||l===void 0||l.call(r,a)}};super.start(e,s),this.call.startRead()}},QO=class extends AT{};function Abe(t,e,r){let n=bbe(t,r.path,e);return r.responseStream?new QO(n,r):new XO(n,r)}function wbe(t,e,r,n){if(t.clientInterceptors.length>0&&t.clientInterceptorProviders.length>0)throw new hg("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(t.callInterceptors.length>0&&t.callInterceptorProviders.length>0)throw new hg("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let i=[];t.callInterceptors.length>0||t.callInterceptorProviders.length>0?i=[].concat(t.callInterceptors,t.callInterceptorProviders.map(a=>a(e))).filter(a=>a):i=[].concat(t.clientInterceptors,t.clientInterceptorProviders.map(a=>a(e))).filter(a=>a);let o=Object.assign({},r,{method_definition:e});return i.reduceRight((a,c)=>l=>c(l,a),a=>Abe(n,a,e))(o)}});var nN=v(xT=>{"use strict";Object.defineProperty(xT,"__esModule",{value:!0});xT.Client=void 0;var Zi=$K(),xbe=iN(),Rbe=Lr(),pa=Ve(),wd=Kt(),wT=eN(),di=Symbol(),xd=Symbol(),Rd=Symbol(),Qo=Symbol();function tN(t){return typeof t=="function"}function Cd(t){var e;return((e=t.stack)===null||e===void 0?void 0:e.split(`
5
5
  `).slice(1).join(`
6
- `))||"no stack trace available"}var rN=class{constructor(e,r,n={}){var i,o;if(n=Object.assign({},n),this[xd]=(i=n.interceptors)!==null&&i!==void 0?i:[],delete n.interceptors,this[Rd]=(o=n.interceptor_providers)!==null&&o!==void 0?o:[],delete n.interceptor_providers,this[xd].length>0&&this[Rd].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Qo]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[di]=n.channelOverride;else if(n.channelFactoryOverride){let s=n.channelFactoryOverride;delete n.channelFactoryOverride,this[di]=s(e,r,n)}else this[di]=new xbe.ChannelImplementation(e,r,n)}close(){this[di].close()}getChannel(){return this[di]}waitForReady(e,r){let n=i=>{if(i){r(new Error("Failed to connect before the deadline"));return}let o;try{o=this[di].getConnectivityState(!0)}catch{r(new Error("The channel has been closed"));return}if(o===Rbe.ConnectivityState.READY)r();else try{this[di].watchConnectivityState(o,e,n)}catch{r(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,r,n){if(tN(e))return{metadata:new wd.Metadata,options:{},callback:e};if(tN(r))return e instanceof wd.Metadata?{metadata:e,options:{},callback:r}:{metadata:new wd.Metadata,options:e,callback:r};if(!(e instanceof wd.Metadata&&r instanceof Object&&tN(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:r,callback:n}}makeUnaryRequest(e,r,n,i,o,s,a){var c,l;let u=this.checkOptionalUnaryResponseArguments(o,s,a),d={path:e,requestStream:!1,responseStream:!1,requestSerialize:r,responseDeserialize:n},f={argument:i,metadata:u.metadata,call:new Zi.ClientUnaryCallImpl,channel:this[di],methodDefinition:d,callOptions:u.options,callback:u.callback};this[Qo]&&(f=this[Qo](f));let p=f.call,h={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(c=f.callOptions.interceptors)!==null&&c!==void 0?c:[],callInterceptorProviders:(l=f.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},m=(0,wT.getInterceptingCall)(h,f.methodDefinition,f.callOptions,f.channel);p.call=m;let y=null,S=!1,b=new Error;return m.start(f.metadata,{onReceiveMetadata:w=>{p.emit("metadata",w)},onReceiveMessage(w){y!==null&&m.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),y=w},onReceiveStatus(w){if(!S){if(S=!0,w.code===pa.Status.OK)if(y===null){let T=Cd(b);f.callback((0,Zi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:w.metadata},T))}else f.callback(null,y);else{let T=Cd(b);f.callback((0,Zi.callErrorFromStatus)(w,T))}b=null,p.emit("status",w)}}}),m.sendMessage(i),m.halfClose(),p}makeClientStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkOptionalUnaryResponseArguments(i,o,s),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:r,responseDeserialize:n},d={metadata:l.metadata,call:new Zi.ClientWritableStreamImpl(r),channel:this[di],methodDefinition:u,callOptions:l.options,callback:l.callback};this[Qo]&&(d=this[Qo](d));let f=d.call,p={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=null,y=!1,S=new Error;return h.start(d.metadata,{onReceiveMetadata:b=>{f.emit("metadata",b)},onReceiveMessage(b){m!==null&&h.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),m=b,h.startRead()},onReceiveStatus(b){if(!y){if(y=!0,b.code===pa.Status.OK)if(m===null){let w=Cd(S);d.callback((0,Zi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:b.metadata},w))}else d.callback(null,m);else{let w=Cd(S);d.callback((0,Zi.callErrorFromStatus)(b,w))}S=null,f.emit("status",b)}}}),f}checkMetadataAndOptions(e,r){let n,i;return e instanceof wd.Metadata?(n=e,r?i=r:i={}):(e?i=e:i={},n=new wd.Metadata),{metadata:n,options:i}}makeServerStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkMetadataAndOptions(o,s),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:r,responseDeserialize:n},d={argument:i,metadata:l.metadata,call:new Zi.ClientReadableStreamImpl(n),channel:this[di],methodDefinition:u,callOptions:l.options};this[Qo]&&(d=this[Qo](d));let f=d.call,p={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=!1,y=new Error;return h.start(d.metadata,{onReceiveMetadata(S){f.emit("metadata",S)},onReceiveMessage(S){f.push(S)},onReceiveStatus(S){if(!m){if(m=!0,f.push(null),S.code!==pa.Status.OK){let b=Cd(y);f.emit("error",(0,Zi.callErrorFromStatus)(S,b))}y=null,f.emit("status",S)}}}),h.sendMessage(i),h.halfClose(),f}makeBidiStreamRequest(e,r,n,i,o){var s,a;let c=this.checkMetadataAndOptions(i,o),l={path:e,requestStream:!0,responseStream:!0,requestSerialize:r,responseDeserialize:n},u={metadata:c.metadata,call:new Zi.ClientDuplexStreamImpl(r,n),channel:this[di],methodDefinition:l,callOptions:c.options};this[Qo]&&(u=this[Qo](u));let d=u.call,f={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(s=u.callOptions.interceptors)!==null&&s!==void 0?s:[],callInterceptorProviders:(a=u.callOptions.interceptor_providers)!==null&&a!==void 0?a:[]},p=(0,wT.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);d.call=p;let h=!1,m=new Error;return p.start(u.metadata,{onReceiveMetadata(y){d.emit("metadata",y)},onReceiveMessage(y){d.push(y)},onReceiveStatus(y){if(!h){if(h=!0,d.push(null),y.code!==pa.Status.OK){let S=Cd(m);d.emit("error",(0,Zi.callErrorFromStatus)(y,S))}m=null,d.emit("status",y)}}}),d}};xT.Client=rN});var CT=v(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.makeClientConstructor=jK;RT.loadPackageDefinition=Obe;var mg=nN(),Cbe={unary:mg.Client.prototype.makeUnaryRequest,server_stream:mg.Client.prototype.makeServerStreamRequest,client_stream:mg.Client.prototype.makeClientStreamRequest,bidi:mg.Client.prototype.makeBidiStreamRequest};function oN(t){return["__proto__","prototype","constructor"].includes(t)}function jK(t,e,r){r||(r={});class n extends mg.Client{}return Object.keys(t).forEach(i=>{if(oN(i))return;let o=t[i],s;if(typeof i=="string"&&i.charAt(0)==="$")throw new Error("Method names cannot start with $");o.requestStream?o.responseStream?s="bidi":s="client_stream":o.responseStream?s="server_stream":s="unary";let a=o.requestSerialize,c=o.responseDeserialize,l=Ibe(Cbe[s],o.path,a,c);n.prototype[i]=l,Object.assign(n.prototype[i],o),o.originalName&&!oN(o.originalName)&&(n.prototype[o.originalName]=n.prototype[i])}),n.service=t,n.serviceName=e,n}function Ibe(t,e,r,n){return function(...i){return t.call(this,e,r,n,...i)}}function Pbe(t){return"format"in t}function Obe(t){let e={};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r],i=r.split(".");if(i.some(a=>oN(a)))continue;let o=i[i.length-1],s=e;for(let a of i.slice(0,-1))s[a]||(s[a]={}),s=s[a];Pbe(n)?s[o]=n:s[o]=jK(n,o,{})}return e}});var f8=v((rct,d8)=>{"use strict";var Nbe=1/0,kbe="[object Symbol]",Mbe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dbe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,PT="\\ud800-\\udfff",KK="\\u0300-\\u036f\\ufe20-\\ufe23",ZK="\\u20d0-\\u20f0",JK="\\u2700-\\u27bf",XK="a-z\\xdf-\\xf6\\xf8-\\xff",Lbe="\\xac\\xb1\\xd7\\xf7",$be="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ube="\\u2000-\\u206f",Fbe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",QK="A-Z\\xc0-\\xd6\\xd8-\\xde",e8="\\ufe0e\\ufe0f",t8=Lbe+$be+Ube+Fbe,aN="['\u2019]",Bbe="["+PT+"]",zK="["+t8+"]",IT="["+KK+ZK+"]",r8="\\d+",jbe="["+JK+"]",n8="["+XK+"]",i8="[^"+PT+t8+r8+JK+XK+QK+"]",sN="\\ud83c[\\udffb-\\udfff]",zbe="(?:"+IT+"|"+sN+")",o8="[^"+PT+"]",cN="(?:\\ud83c[\\udde6-\\uddff]){2}",lN="[\\ud800-\\udbff][\\udc00-\\udfff]",Id="["+QK+"]",s8="\\u200d",GK="(?:"+n8+"|"+i8+")",Gbe="(?:"+Id+"|"+i8+")",qK="(?:"+aN+"(?:d|ll|m|re|s|t|ve))?",VK="(?:"+aN+"(?:D|LL|M|RE|S|T|VE))?",a8=zbe+"?",c8="["+e8+"]?",qbe="(?:"+s8+"(?:"+[o8,cN,lN].join("|")+")"+c8+a8+")*",l8=c8+a8+qbe,Vbe="(?:"+[jbe,cN,lN].join("|")+")"+l8,Hbe="(?:"+[o8+IT+"?",IT,cN,lN,Bbe].join("|")+")",Wbe=RegExp(aN,"g"),Ybe=RegExp(IT,"g"),Kbe=RegExp(sN+"(?="+sN+")|"+Hbe+l8,"g"),Zbe=RegExp([Id+"?"+n8+"+"+qK+"(?="+[zK,Id,"$"].join("|")+")",Gbe+"+"+VK+"(?="+[zK,Id+GK,"$"].join("|")+")",Id+"?"+GK+"+"+qK,Id+"+"+VK,r8,Vbe].join("|"),"g"),Jbe=RegExp("["+s8+PT+KK+ZK+e8+"]"),Xbe=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qbe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},eAe=typeof global=="object"&&global&&global.Object===Object&&global,tAe=typeof self=="object"&&self&&self.Object===Object&&self,rAe=eAe||tAe||Function("return this")();function nAe(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function iAe(t){return t.split("")}function oAe(t){return t.match(Mbe)||[]}function sAe(t){return function(e){return t?.[e]}}var aAe=sAe(Qbe);function u8(t){return Jbe.test(t)}function cAe(t){return Xbe.test(t)}function lAe(t){return u8(t)?uAe(t):iAe(t)}function uAe(t){return t.match(Kbe)||[]}function dAe(t){return t.match(Zbe)||[]}var fAe=Object.prototype,pAe=fAe.toString,HK=rAe.Symbol,WK=HK?HK.prototype:void 0,YK=WK?WK.toString:void 0;function hAe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function mAe(t){if(typeof t=="string")return t;if(EAe(t))return YK?YK.call(t):"";var e=t+"";return e=="0"&&1/t==-Nbe?"-0":e}function gAe(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:hAe(t,e,r)}function _Ae(t){return function(e){e=OT(e);var r=u8(e)?lAe(e):void 0,n=r?r[0]:e.charAt(0),i=r?gAe(r,1).join(""):e.slice(1);return n[t]()+i}}function yAe(t){return function(e){return nAe(wAe(bAe(e).replace(Wbe,"")),t,"")}}function SAe(t){return!!t&&typeof t=="object"}function EAe(t){return typeof t=="symbol"||SAe(t)&&pAe.call(t)==kbe}function OT(t){return t==null?"":mAe(t)}var vAe=yAe(function(t,e,r){return e=e.toLowerCase(),t+(r?TAe(e):e)});function TAe(t){return AAe(OT(t).toLowerCase())}function bAe(t){return t=OT(t),t&&t.replace(Dbe,aAe).replace(Ybe,"")}var AAe=_Ae("toUpperCase");function wAe(t,e,r){return t=OT(t),e=r?void 0:e,e===void 0?cAe(t)?dAe(t):oAe(t):t.match(e)||[]}d8.exports=vAe});var uN=v((nct,p8)=>{"use strict";p8.exports=xAe;function xAe(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,c){r[n]=function(u){if(o)if(o=!1,u)c(u);else{for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f++]=arguments[f];a.apply(null,d)}};try{t.apply(e||null,r)}catch(l){o&&(o=!1,c(l))}})}});var _8=v(g8=>{"use strict";var NT=g8;NT.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Pd=new Array(64),m8=new Array(123);for(fi=0;fi<64;)m8[Pd[fi]=fi<26?fi+65:fi<52?fi+71:fi<62?fi-4:fi-59|43]=fi++;var fi;NT.encode=function(e,r,n){for(var i=null,o=[],s=0,a=0,c;r<n;){var l=e[r++];switch(a){case 0:o[s++]=Pd[l>>2],c=(l&3)<<4,a=1;break;case 1:o[s++]=Pd[c|l>>4],c=(l&15)<<2,a=2;break;case 2:o[s++]=Pd[c|l>>6],o[s++]=Pd[l&63],a=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=Pd[c],o[s++]=61,a===1&&(o[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var h8="invalid encoding";NT.decode=function(e,r,n){for(var i=n,o=0,s,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&o>1)break;if((c=m8[c])===void 0)throw Error(h8);switch(o){case 0:s=c,o=1;break;case 1:r[n++]=s<<2|(c&48)>>4,s=c,o=2;break;case 2:r[n++]=(s&15)<<4|(c&60)>>2,s=c,o=3;break;case 3:r[n++]=(s&3)<<6|c,o=0;break}}if(o===1)throw Error(h8);return n-i};NT.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var S8=v((oct,y8)=>{"use strict";y8.exports=kT;function kT(){this._listeners=Object.create(null)}kT.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};kT.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var n=this._listeners[e];if(!n)return this;for(var i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i}return this};kT.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var x8=v((sct,w8)=>{"use strict";w8.exports=E8(E8);function E8(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3]}function o(c,l,u){e[0]=c,l[u]=r[3],l[u+1]=r[2],l[u+2]=r[1],l[u+3]=r[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],e[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],e[0]}t.readFloatLE=n?s:a,t.readFloatBE=n?a:s})():(function(){function e(n,i,o,s){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,o,s);else if(isNaN(i))n(2143289344,o,s);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,o,s)}}t.writeFloatLE=e.bind(null,v8),t.writeFloatBE=e.bind(null,T8);function r(n,i,o){var s=n(i,o),a=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=r.bind(null,b8),t.readFloatBE=r.bind(null,A8)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3],l[u+4]=r[4],l[u+5]=r[5],l[u+6]=r[6],l[u+7]=r[7]}function o(c,l,u){e[0]=c,l[u]=r[7],l[u+1]=r[6],l[u+2]=r[5],l[u+3]=r[4],l[u+4]=r[3],l[u+5]=r[2],l[u+6]=r[1],l[u+7]=r[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],e[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],e[0]}t.readDoubleLE=n?s:a,t.readDoubleBE=n?a:s})():(function(){function e(n,i,o,s,a,c){var l=s<0?1:0;if(l&&(s=-s),s===0)n(0,a,c+i),n(1/s>0?0:2147483648,a,c+o);else if(isNaN(s))n(0,a,c+i),n(2146959360,a,c+o);else if(s>17976931348623157e292)n(0,a,c+i),n((l<<31|2146435072)>>>0,a,c+o);else{var u;if(s<22250738585072014e-324)u=s/5e-324,n(u>>>0,a,c+i),n((l<<31|u/4294967296)>>>0,a,c+o);else{var d=Math.floor(Math.log(s)/Math.LN2);d===1024&&(d=1023),u=s*Math.pow(2,-d),n(u*4503599627370496>>>0,a,c+i),n((l<<31|d+1023<<20|u*1048576&1048575)>>>0,a,c+o)}}}t.writeDoubleLE=e.bind(null,v8,0,4),t.writeDoubleBE=e.bind(null,T8,4,0);function r(n,i,o,s,a){var c=n(s,a+i),l=n(s,a+o),u=(l>>31)*2+1,d=l>>>20&2047,f=4294967296*(l&1048575)+c;return d===2047?f?NaN:u*(1/0):d===0?u*5e-324*f:u*Math.pow(2,d-1075)*(f+4503599627370496)}t.readDoubleLE=r.bind(null,b8,0,4),t.readDoubleBE=r.bind(null,A8,4,0)})(),t}function v8(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function T8(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function b8(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function A8(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var C8=v((act,R8)=>{"use strict";R8.exports=RAe;function RAe(t){try{if(typeof Z!="function")return null;var e=Z(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var P8=v(I8=>{"use strict";var fN=I8,dN="\uFFFD";fN.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};fN.read=function(e,r,n){if(n-r<1)return"";for(var i="",o=r;o<n;){var s=e[o++];if(s<=127)i+=String.fromCharCode(s);else if(s>=192&&s<224){var a=(s&31)<<6|e[o++]&63;i+=a>=128?String.fromCharCode(a):dN}else if(s>=224&&s<240){var c=(s&15)<<12|(e[o++]&63)<<6|e[o++]&63;i+=c>=2048?String.fromCharCode(c):dN}else if(s>=240){var l=(s&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;l<65536||l>1114111?i+=dN:(l-=65536,i+=String.fromCharCode(55296+(l>>10)),i+=String.fromCharCode(56320+(l&1023)))}}return i};fN.write=function(e,r,n){for(var i=n,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128);return n-i}});var N8=v((uct,O8)=>{"use strict";O8.exports=CAe;function CAe(t,e,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(c){if(c<1||c>i)return t(c);s+c>n&&(o=t(n),s=0);var l=e.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}});var M8=v((dct,k8)=>{"use strict";k8.exports=Zt;var gg=pi();function Zt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ll=Zt.zero=new Zt(0,0);ll.toNumber=function(){return 0};ll.zzEncode=ll.zzDecode=function(){return this};ll.length=function(){return 1};var IAe=Zt.zeroHash="\0\0\0\0\0\0\0\0";Zt.fromNumber=function(e){if(e===0)return ll;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Zt(n,i)};Zt.from=function(e){if(typeof e=="number")return Zt.fromNumber(e);if(gg.isString(e))if(gg.Long)e=gg.Long.fromString(e);else return Zt.fromNumber(parseInt(e,10));return e.low||e.high?new Zt(e.low>>>0,e.high>>>0):ll};Zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Zt.prototype.toLong=function(e){return gg.Long?new gg.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ha=String.prototype.charCodeAt;Zt.fromHash=function(e){return e===IAe?ll:new Zt((ha.call(e,0)|ha.call(e,1)<<8|ha.call(e,2)<<16|ha.call(e,3)<<24)>>>0,(ha.call(e,4)|ha.call(e,5)<<8|ha.call(e,6)<<16|ha.call(e,7)<<24)>>>0)};Zt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Zt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Zt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Zt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var hN=v((_g,pN)=>{"use strict";(function(t,e){function r(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return e(n),r(n)}):typeof _g=="object"?(e(_g),typeof pN=="object"&&(pN.exports=r(_g))):(function(){var n={};e(n),t.Long=r(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:_g,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(N,g,E){this.low=N|0,this.high=g|0,this.unsigned=!!E}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(N){return(N&&N.__isLong__)===!0}function i(N){var g=Math.clz32(N&-N);return N?31-g:g}r.isLong=n;var o={},s={};function a(N,g){var E,x,Y;return g?(N>>>=0,(Y=0<=N&&N<256)&&(x=s[N],x)?x:(E=l(N,0,!0),Y&&(s[N]=E),E)):(N|=0,(Y=-128<=N&&N<128)&&(x=o[N],x)?x:(E=l(N,N<0?-1:0,!1),Y&&(o[N]=E),E))}r.fromInt=a;function c(N,g){if(isNaN(N))return g?T:w;if(g){if(N<0)return T;if(N>=y)return M}else{if(N<=-S)return F;if(N+1>=S)return P}return N<0?c(-N,g).neg():l(N%m|0,N/m|0,g)}r.fromNumber=c;function l(N,g,E){return new r(N,g,E)}r.fromBits=l;var u=Math.pow;function d(N,g,E){if(N.length===0)throw Error("empty string");if(typeof g=="number"?(E=g,g=!1):g=!!g,N==="NaN"||N==="Infinity"||N==="+Infinity"||N==="-Infinity")return g?T:w;if(E=E||10,E<2||36<E)throw RangeError("radix");var x;if((x=N.indexOf("-"))>0)throw Error("interior hyphen");if(x===0)return d(N.substring(1),g,E).neg();for(var Y=c(u(E,8)),G=w,fe=0;fe<N.length;fe+=8){var $e=Math.min(8,N.length-fe),Ie=parseInt(N.substring(fe,fe+$e),E);if($e<8){var Pe=c(u(E,$e));G=G.mul(Pe).add(c(Ie))}else G=G.mul(Y),G=G.add(c(Ie))}return G.unsigned=g,G}r.fromString=d;function f(N,g){return typeof N=="number"?c(N,g):typeof N=="string"?d(N,g):l(N.low,N.high,typeof g=="boolean"?g:N.unsigned)}r.fromValue=f;var p=65536,h=1<<24,m=p*p,y=m*m,S=y/2,b=a(h),w=a(0);r.ZERO=w;var T=a(0,!0);r.UZERO=T;var C=a(1);r.ONE=C;var O=a(1,!0);r.UONE=O;var k=a(-1);r.NEG_ONE=k;var P=l(-1,2147483647,!1);r.MAX_VALUE=P;var M=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=M;var F=l(0,-2147483648,!1);r.MIN_VALUE=F;var _=r.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},_.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var E=c(g),x=this.div(E),Y=x.mul(E).sub(this);return x.toString(g)+Y.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var G=c(u(g,6),this.unsigned),fe=this,$e="";;){var Ie=fe.div(G),Pe=fe.sub(Ie.mul(G)).toInt()>>>0,xe=Pe.toString(g);if(fe=Ie,fe.isZero())return xe+$e;for(;xe.length<6;)xe="0"+xe;$e=""+xe+$e}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,E=31;E>0&&(g&1<<E)==0;E--);return this.high!=0?E+33:E+1},_.isSafeInteger=function(){var g=this.high>>21;return g?this.unsigned?!1:g===-1&&!(this.low===0&&this.high===-2097152):!0},_.isZero=function(){return this.high===0&&this.low===0},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(g){return n(g)||(g=f(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},_.eq=_.equals,_.notEquals=function(g){return!this.eq(g)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(g){return this.comp(g)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(g){return this.comp(g)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(g){return this.comp(g)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(g){return this.comp(g)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(g){if(n(g)||(g=f(g)),this.eq(g))return 0;var E=this.isNegative(),x=g.isNegative();return E&&!x?-1:!E&&x?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(C)},_.neg=_.negate,_.add=function(g){n(g)||(g=f(g));var E=this.high>>>16,x=this.high&65535,Y=this.low>>>16,G=this.low&65535,fe=g.high>>>16,$e=g.high&65535,Ie=g.low>>>16,Pe=g.low&65535,xe=0,Fe=0,Re=0,ce=0;return ce+=G+Pe,Re+=ce>>>16,ce&=65535,Re+=Y+Ie,Fe+=Re>>>16,Re&=65535,Fe+=x+$e,xe+=Fe>>>16,Fe&=65535,xe+=E+fe,xe&=65535,l(Re<<16|ce,xe<<16|Fe,this.unsigned)},_.subtract=function(g){return n(g)||(g=f(g)),this.add(g.neg())},_.sub=_.subtract,_.multiply=function(g){if(this.isZero())return this;if(n(g)||(g=f(g)),e){var E=e.mul(this.low,this.high,g.low,g.high);return l(E,e.get_high(),this.unsigned)}if(g.isZero())return this.unsigned?T:w;if(this.eq(F))return g.isOdd()?F:w;if(g.eq(F))return this.isOdd()?F:w;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(b)&&g.lt(b))return c(this.toNumber()*g.toNumber(),this.unsigned);var x=this.high>>>16,Y=this.high&65535,G=this.low>>>16,fe=this.low&65535,$e=g.high>>>16,Ie=g.high&65535,Pe=g.low>>>16,xe=g.low&65535,Fe=0,Re=0,ce=0,_e=0;return _e+=fe*xe,ce+=_e>>>16,_e&=65535,ce+=G*xe,Re+=ce>>>16,ce&=65535,ce+=fe*Pe,Re+=ce>>>16,ce&=65535,Re+=Y*xe,Fe+=Re>>>16,Re&=65535,Re+=G*Pe,Fe+=Re>>>16,Re&=65535,Re+=fe*Ie,Fe+=Re>>>16,Re&=65535,Fe+=x*xe+Y*Pe+G*Ie+fe*$e,Fe&=65535,l(ce<<16|_e,Fe<<16|Re,this.unsigned)},_.mul=_.multiply,_.divide=function(g){if(n(g)||(g=f(g)),g.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&g.low===-1&&g.high===-1)return this;var E=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,g.low,g.high);return l(E,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?T:w;var x,Y,G;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return T;if(g.gt(this.shru(1)))return O;G=T}else{if(this.eq(F)){if(g.eq(C)||g.eq(k))return F;if(g.eq(F))return C;var fe=this.shr(1);return x=fe.div(g).shl(1),x.eq(w)?g.isNegative()?C:k:(Y=this.sub(g.mul(x)),G=x.add(Y.div(g)),G)}else if(g.eq(F))return this.unsigned?T:w;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();G=w}for(Y=this;Y.gte(g);){x=Math.max(1,Math.floor(Y.toNumber()/g.toNumber()));for(var $e=Math.ceil(Math.log(x)/Math.LN2),Ie=$e<=48?1:u(2,$e-48),Pe=c(x),xe=Pe.mul(g);xe.isNegative()||xe.gt(Y);)x-=Ie,Pe=c(x,this.unsigned),xe=Pe.mul(g);Pe.isZero()&&(Pe=C),G=G.add(Pe),Y=Y.sub(xe)}return G},_.div=_.divide,_.modulo=function(g){if(n(g)||(g=f(g)),e){var E=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,g.low,g.high);return l(E,e.get_high(),this.unsigned)}return this.sub(this.div(g).mul(g))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return l(~this.low,~this.high,this.unsigned)},_.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},_.clz=_.countLeadingZeros,_.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},_.ctz=_.countTrailingZeros,_.and=function(g){return n(g)||(g=f(g)),l(this.low&g.low,this.high&g.high,this.unsigned)},_.or=function(g){return n(g)||(g=f(g)),l(this.low|g.low,this.high|g.high,this.unsigned)},_.xor=function(g){return n(g)||(g=f(g)),l(this.low^g.low,this.high^g.high,this.unsigned)},_.shiftLeft=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):l(0,this.low<<g-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):l(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>>g,this.unsigned):g===32?l(this.high,0,this.unsigned):l(this.high>>>g-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(g){var E;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(E=32-g,l(this.low<<g|this.high>>>E,this.high<<g|this.low>>>E,this.unsigned)):(g-=32,E=32-g,l(this.high<<g|this.low>>>E,this.low<<g|this.high>>>E,this.unsigned))},_.rotl=_.rotateLeft,_.rotateRight=function(g){var E;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(E=32-g,l(this.high<<E|this.low>>>g,this.low<<E|this.high>>>g,this.unsigned)):(g-=32,E=32-g,l(this.low<<E|this.high>>>g,this.high<<E|this.low>>>g,this.unsigned))},_.rotr=_.rotateRight,_.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},_.toBytes=function(g){return g?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var g=this.high,E=this.low;return[E&255,E>>>8&255,E>>>16&255,E>>>24,g&255,g>>>8&255,g>>>16&255,g>>>24]},_.toBytesBE=function(){var g=this.high,E=this.low;return[g>>>24,g>>>16&255,g>>>8&255,g&255,E>>>24,E>>>16&255,E>>>8&255,E&255]},r.fromBytes=function(g,E,x){return x?r.fromBytesLE(g,E):r.fromBytesBE(g,E)},r.fromBytesLE=function(g,E){return new r(g[0]|g[1]<<8|g[2]<<16|g[3]<<24,g[4]|g[5]<<8|g[6]<<16|g[7]<<24,E)},r.fromBytesBE=function(g,E){return new r(g[4]<<24|g[5]<<16|g[6]<<8|g[7],g[0]<<24|g[1]<<16|g[2]<<8|g[3],E)},typeof BigInt=="function"&&(r.fromBigInt=function(g,E){var x=Number(BigInt.asIntN(32,g)),Y=Number(BigInt.asIntN(32,g>>BigInt(32)));return l(x,Y,E)},r.fromValue=function(g,E){return typeof g=="bigint"?r.fromBigInt(g,E):f(g,E)},_.toBigInt=function(){var g=BigInt(this.low>>>0),E=BigInt(this.unsigned?this.high>>>0:this.high);return E<<BigInt(32)|g});var re=t.default=r})});var pi=v(mN=>{"use strict";var be=mN;be.asPromise=uN();be.base64=_8();be.EventEmitter=S8();be.float=x8();be.inquire=C8();be.utf8=P8();be.pool=N8();be.LongBits=M8();function D8(t){return t==="__proto__"||t==="prototype"||t==="constructor"}be.isUnsafeProperty=D8;be.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);be.global=be.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||mN;be.emptyArray=Object.freeze?Object.freeze([]):[];be.emptyObject=Object.freeze?Object.freeze({}):{};be.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};be.isString=function(e){return typeof e=="string"||e instanceof String};be.isObject=function(e){return e&&typeof e=="object"};be.isset=be.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};be.Buffer=(function(){try{var t=be.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();be._Buffer_from=null;be._Buffer_allocUnsafe=null;be.newBuffer=function(e){return typeof e=="number"?be.Buffer?be._Buffer_allocUnsafe(e):new be.Array(e):be.Buffer?be._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};be.Array=typeof Uint8Array<"u"?Uint8Array:Array;be.Long=be.global.dcodeIO&&be.global.dcodeIO.Long||be.global.Long||(function(){try{var t=hN();return t&&t.isLong?t:null}catch{return null}})();be.key2Re=/^true|false|0|1$/;be.key32Re=/^-?(?:0|[1-9][0-9]*)$/;be.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;be.longToHash=function(e){return e?be.LongBits.from(e).toHash():be.LongBits.zeroHash};be.longFromHash=function(e,r){var n=be.LongBits.fromHash(e);return be.Long?be.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function L8(t){var e=typeof arguments[arguments.length-1]=="boolean",r=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var n=1;n<r;++n){var i=arguments[n];if(i)for(var o=Object.keys(i),s=0;s<o.length;++s)!D8(o[s])&&(t[o[s]]===void 0||!e)&&(t[o[s]]=i[o[s]])}return t}be.merge=L8;be.nestingLimit=32;be.recursionLimit=100;be.makeProp=function(e,r){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0})};be.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function $8(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&L8(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}be.newError=$8;be.ProtocolError=$8("ProtocolError");be.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(r[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};be.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};be.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};be._configure=function(){var t=be.Buffer;if(!t){be._Buffer_from=be._Buffer_allocUnsafe=null;return}be._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},be._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var DT=v((pct,j8)=>{"use strict";j8.exports=et;var jn=pi(),gN,MT=jn.LongBits,U8=jn.base64,F8=jn.utf8;function yg(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function yN(){}function PAe(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function et(){this.len=0,this.head=new yg(yN,0,0),this.tail=this.head,this.states=null}var B8=function(){return jn.Buffer?function(){return(et.create=function(){return new gN})()}:function(){return new et}};et.create=B8();et.alloc=function(e){return new jn.Array(e)};jn.Array!==Array&&(et.alloc=jn.pool(et.alloc,jn.Array.prototype.subarray));et.prototype._push=function(e,r,n){return this.tail=this.tail.next=new yg(e,r,n),this.len+=r,this};function SN(t,e,r){e[r]=t&255}function OAe(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function EN(t,e){this.len=t,this.next=void 0,this.val=e}EN.prototype=Object.create(yg.prototype);EN.prototype.fn=OAe;et.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new EN((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};et.prototype.int32=function(e){return(e|=0)<0?this._push(vN,10,MT.fromNumber(e)):this.uint32(e)};et.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function vN(t,e,r){for(var n=t.lo,i=t.hi;i;)e[r++]=n&127|128,n=(n>>>7|i<<25)>>>0,i>>>=7;for(;n>127;)e[r++]=n&127|128,n=n>>>7;e[r++]=n}et.prototype.uint64=function(e){var r=MT.from(e);return this._push(vN,r.length(),r)};et.prototype.int64=et.prototype.uint64;et.prototype.sint64=function(e){var r=MT.from(e).zzEncode();return this._push(vN,r.length(),r)};et.prototype.bool=function(e){return this._push(SN,1,e?1:0)};function _N(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}et.prototype.fixed32=function(e){return this._push(_N,4,e>>>0)};et.prototype.sfixed32=et.prototype.fixed32;et.prototype.fixed64=function(e){var r=MT.from(e);return this._push(_N,4,r.lo)._push(_N,4,r.hi)};et.prototype.sfixed64=et.prototype.fixed64;et.prototype.float=function(e){return this._push(jn.float.writeFloatLE,4,e)};et.prototype.double=function(e){return this._push(jn.float.writeDoubleLE,8,e)};var NAe=jn.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};et.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(SN,1,0);if(jn.isString(e)){var n=et.alloc(r=U8.length(e));U8.decode(e,n,0),e=n}return this.uint32(r)._push(NAe,r,e)};et.prototype.string=function(e){var r=F8.length(e);return r?this.uint32(r)._push(F8.write,r,e):this._push(SN,1,0)};et.prototype.fork=function(){return this.states=new PAe(this),this.head=this.tail=new yg(yN,0,0),this.len=0,this};et.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new yg(yN,0,0),this.len=0),this};et.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};et.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};et._configure=function(t){gN=t,et.create=B8(),gN._configure()}});var q8=v((hct,G8)=>{"use strict";G8.exports=Ji;var z8=DT();(Ji.prototype=Object.create(z8.prototype)).constructor=Ji;var ma=pi();function Ji(){z8.call(this)}Ji._configure=function(){Ji.alloc=ma._Buffer_allocUnsafe,Ji.writeBytesBuffer=ma.Buffer&&ma.Buffer.prototype instanceof Uint8Array&&ma.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};Ji.prototype.bytes=function(e){ma.isString(e)&&(e=ma._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Ji.writeBytesBuffer,r,e),this};function kAe(t,e,r){t.length<40?ma.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Ji.prototype.string=function(e){var r=ma.Buffer.byteLength(e);return this.uint32(r),r&&this._push(kAe,r,e),this};Ji._configure()});var $T=v((mct,K8)=>{"use strict";K8.exports=Tt;var zn=pi(),bN,W8=zn.LongBits,MAe=zn.utf8;function hi(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Tt(t){this.buf=t,this.pos=0,this.len=t.length}var V8=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Tt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Tt(e);throw Error("illegal buffer")},Y8=function(){return zn.Buffer?function(r){return(Tt.create=function(i){return zn.Buffer.isBuffer(i)?new bN(i):V8(i)})(r)}:V8};Tt.create=Y8();Tt.prototype._slice=zn.Array.prototype.subarray||zn.Array.prototype.slice;Tt.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,hi(this,10);return e}})();Tt.prototype.int32=function(){return this.uint32()|0};Tt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function TN(){var t=new W8(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw hi(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw hi(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Tt.prototype.bool=function(){return this.uint32()!==0};function LT(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Tt.prototype.fixed32=function(){if(this.pos+4>this.len)throw hi(this,4);return LT(this.buf,this.pos+=4)};Tt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw hi(this,4);return LT(this.buf,this.pos+=4)|0};function H8(){if(this.pos+8>this.len)throw hi(this,8);return new W8(LT(this.buf,this.pos+=4),LT(this.buf,this.pos+=4))}Tt.prototype.float=function(){if(this.pos+4>this.len)throw hi(this,4);var e=zn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Tt.prototype.double=function(){if(this.pos+8>this.len)throw hi(this,4);var e=zn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Tt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw hi(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=zn.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};Tt.prototype.string=function(){var e=this.bytes();return MAe.read(e,0,e.length)};Tt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw hi(this,e);this.pos+=e}else do if(this.pos>=this.len)throw hi(this);while(this.buf[this.pos++]&128);return this};Tt.recursionLimit=zn.recursionLimit;Tt.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>Tt.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Tt._configure=function(t){bN=t,Tt.create=Y8(),bN._configure();var e=zn.Long?"toLong":"toNumber";zn.merge(Tt.prototype,{int64:function(){return TN.call(this)[e](!1)},uint64:function(){return TN.call(this)[e](!0)},sint64:function(){return TN.call(this).zzDecode()[e](!1)},fixed64:function(){return H8.call(this)[e](!0)},sfixed64:function(){return H8.call(this)[e](!1)}})}});var Q8=v((gct,X8)=>{"use strict";X8.exports=ul;var J8=$T();(ul.prototype=Object.create(J8.prototype)).constructor=ul;var Z8=pi();function ul(t){J8.call(this,t)}ul._configure=function(){Z8.Buffer&&(ul.prototype._slice=Z8.Buffer.prototype.slice)};ul.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};ul._configure()});var tZ=v((_ct,eZ)=>{"use strict";eZ.exports=Sg;var AN=pi();(Sg.prototype=Object.create(AN.EventEmitter.prototype)).constructor=Sg;function Sg(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");AN.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Sg.prototype.rpcCall=function t(e,r,n,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return AN.asPromise(t,s,e,r,n,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(e,r[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return s.emit("error",c,e),o(c);if(l===null){s.end(!0);return}if(!(l instanceof n))try{l=n[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return s.emit("error",u,e),o(u)}return s.emit("data",l,e),o(null,l)})}catch(a){s.emit("error",a,e),setTimeout(function(){o(a)},0);return}};Sg.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var wN=v(rZ=>{"use strict";var DAe=rZ;DAe.Service=tZ()});var xN=v((Sct,nZ)=>{"use strict";nZ.exports={}});var sZ=v(oZ=>{"use strict";var Jr=oZ;Jr.build="minimal";Jr.Writer=DT();Jr.BufferWriter=q8();Jr.Reader=$T();Jr.BufferReader=Q8();Jr.util=pi();Jr.rpc=wN();Jr.roots=xN();Jr.configure=iZ;function iZ(){Jr.util._configure(),Jr.Writer._configure(Jr.BufferWriter),Jr.Reader._configure(Jr.BufferReader)}iZ()});var cZ=v((vct,aZ)=>{"use strict";aZ.exports=RN;var LAe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function RN(t,e){typeof t=="string"&&(e=t,t=void 0);var r=[];function n(o){if(typeof o!="string"){var s=i();if(RN.verbose&&console.log("codegen: "+s),s="return "+s,o){for(var a=Object.keys(o),c=new Array(a.length+1),l=new Array(a.length),u=0;u<a.length;)c[u]=a[u],l[u]=o[a[u++]];return c[u]=s,Function.apply(null,c).apply(null,l)}return Function(s)()}for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f]=arguments[++f];if(f=0,o=o.replace(/%([%dfijs])/g,function(h,m){var y=d[f++];switch(m){case"d":case"f":return String(Number(y));case"i":return String(Math.floor(y));case"j":return JSON.stringify(y);case"s":return String(y)}return"%"}),f!==d.length)throw Error("parameter count mismatch");return r.push(o),n}function i(o){return"function "+$Ae(o||e)+"("+(t&&t.join(",")||"")+`){
6
+ `))||"no stack trace available"}var rN=class{constructor(e,r,n={}){var i,o;if(n=Object.assign({},n),this[xd]=(i=n.interceptors)!==null&&i!==void 0?i:[],delete n.interceptors,this[Rd]=(o=n.interceptor_providers)!==null&&o!==void 0?o:[],delete n.interceptor_providers,this[xd].length>0&&this[Rd].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Qo]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[di]=n.channelOverride;else if(n.channelFactoryOverride){let s=n.channelFactoryOverride;delete n.channelFactoryOverride,this[di]=s(e,r,n)}else this[di]=new xbe.ChannelImplementation(e,r,n)}close(){this[di].close()}getChannel(){return this[di]}waitForReady(e,r){let n=i=>{if(i){r(new Error("Failed to connect before the deadline"));return}let o;try{o=this[di].getConnectivityState(!0)}catch{r(new Error("The channel has been closed"));return}if(o===Rbe.ConnectivityState.READY)r();else try{this[di].watchConnectivityState(o,e,n)}catch{r(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,r,n){if(tN(e))return{metadata:new wd.Metadata,options:{},callback:e};if(tN(r))return e instanceof wd.Metadata?{metadata:e,options:{},callback:r}:{metadata:new wd.Metadata,options:e,callback:r};if(!(e instanceof wd.Metadata&&r instanceof Object&&tN(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:r,callback:n}}makeUnaryRequest(e,r,n,i,o,s,a){var c,l;let u=this.checkOptionalUnaryResponseArguments(o,s,a),d={path:e,requestStream:!1,responseStream:!1,requestSerialize:r,responseDeserialize:n},f={argument:i,metadata:u.metadata,call:new Zi.ClientUnaryCallImpl,channel:this[di],methodDefinition:d,callOptions:u.options,callback:u.callback};this[Qo]&&(f=this[Qo](f));let p=f.call,h={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(c=f.callOptions.interceptors)!==null&&c!==void 0?c:[],callInterceptorProviders:(l=f.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},m=(0,wT.getInterceptingCall)(h,f.methodDefinition,f.callOptions,f.channel);p.call=m;let y=null,S=!1,b=new Error;return m.start(f.metadata,{onReceiveMetadata:w=>{p.emit("metadata",w)},onReceiveMessage(w){y!==null&&m.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),y=w},onReceiveStatus(w){if(!S){if(S=!0,w.code===pa.Status.OK)if(y===null){let T=Cd(b);f.callback((0,Zi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:w.metadata},T))}else f.callback(null,y);else{let T=Cd(b);f.callback((0,Zi.callErrorFromStatus)(w,T))}b=null,p.emit("status",w)}}}),m.sendMessage(i),m.halfClose(),p}makeClientStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkOptionalUnaryResponseArguments(i,o,s),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:r,responseDeserialize:n},d={metadata:l.metadata,call:new Zi.ClientWritableStreamImpl(r),channel:this[di],methodDefinition:u,callOptions:l.options,callback:l.callback};this[Qo]&&(d=this[Qo](d));let f=d.call,p={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=null,y=!1,S=new Error;return h.start(d.metadata,{onReceiveMetadata:b=>{f.emit("metadata",b)},onReceiveMessage(b){m!==null&&h.cancelWithStatus(pa.Status.UNIMPLEMENTED,"Too many responses received"),m=b,h.startRead()},onReceiveStatus(b){if(!y){if(y=!0,b.code===pa.Status.OK)if(m===null){let w=Cd(S);d.callback((0,Zi.callErrorFromStatus)({code:pa.Status.UNIMPLEMENTED,details:"No message received",metadata:b.metadata},w))}else d.callback(null,m);else{let w=Cd(S);d.callback((0,Zi.callErrorFromStatus)(b,w))}S=null,f.emit("status",b)}}}),f}checkMetadataAndOptions(e,r){let n,i;return e instanceof wd.Metadata?(n=e,r?i=r:i={}):(e?i=e:i={},n=new wd.Metadata),{metadata:n,options:i}}makeServerStreamRequest(e,r,n,i,o,s){var a,c;let l=this.checkMetadataAndOptions(o,s),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:r,responseDeserialize:n},d={argument:i,metadata:l.metadata,call:new Zi.ClientReadableStreamImpl(n),channel:this[di],methodDefinition:u,callOptions:l.options};this[Qo]&&(d=this[Qo](d));let f=d.call,p={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,wT.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=!1,y=new Error;return h.start(d.metadata,{onReceiveMetadata(S){f.emit("metadata",S)},onReceiveMessage(S){f.push(S)},onReceiveStatus(S){if(!m){if(m=!0,f.push(null),S.code!==pa.Status.OK){let b=Cd(y);f.emit("error",(0,Zi.callErrorFromStatus)(S,b))}y=null,f.emit("status",S)}}}),h.sendMessage(i),h.halfClose(),f}makeBidiStreamRequest(e,r,n,i,o){var s,a;let c=this.checkMetadataAndOptions(i,o),l={path:e,requestStream:!0,responseStream:!0,requestSerialize:r,responseDeserialize:n},u={metadata:c.metadata,call:new Zi.ClientDuplexStreamImpl(r,n),channel:this[di],methodDefinition:l,callOptions:c.options};this[Qo]&&(u=this[Qo](u));let d=u.call,f={clientInterceptors:this[xd],clientInterceptorProviders:this[Rd],callInterceptors:(s=u.callOptions.interceptors)!==null&&s!==void 0?s:[],callInterceptorProviders:(a=u.callOptions.interceptor_providers)!==null&&a!==void 0?a:[]},p=(0,wT.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);d.call=p;let h=!1,m=new Error;return p.start(u.metadata,{onReceiveMetadata(y){d.emit("metadata",y)},onReceiveMessage(y){d.push(y)},onReceiveStatus(y){if(!h){if(h=!0,d.push(null),y.code!==pa.Status.OK){let S=Cd(m);d.emit("error",(0,Zi.callErrorFromStatus)(y,S))}m=null,d.emit("status",y)}}}),d}};xT.Client=rN});var CT=v(RT=>{"use strict";Object.defineProperty(RT,"__esModule",{value:!0});RT.makeClientConstructor=jK;RT.loadPackageDefinition=Obe;var mg=nN(),Cbe={unary:mg.Client.prototype.makeUnaryRequest,server_stream:mg.Client.prototype.makeServerStreamRequest,client_stream:mg.Client.prototype.makeClientStreamRequest,bidi:mg.Client.prototype.makeBidiStreamRequest};function oN(t){return["__proto__","prototype","constructor"].includes(t)}function jK(t,e,r){r||(r={});class n extends mg.Client{}return Object.keys(t).forEach(i=>{if(oN(i))return;let o=t[i],s;if(typeof i=="string"&&i.charAt(0)==="$")throw new Error("Method names cannot start with $");o.requestStream?o.responseStream?s="bidi":s="client_stream":o.responseStream?s="server_stream":s="unary";let a=o.requestSerialize,c=o.responseDeserialize,l=Ibe(Cbe[s],o.path,a,c);n.prototype[i]=l,Object.assign(n.prototype[i],o),o.originalName&&!oN(o.originalName)&&(n.prototype[o.originalName]=n.prototype[i])}),n.service=t,n.serviceName=e,n}function Ibe(t,e,r,n){return function(...i){return t.call(this,e,r,n,...i)}}function Pbe(t){return"format"in t}function Obe(t){let e={};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r],i=r.split(".");if(i.some(a=>oN(a)))continue;let o=i[i.length-1],s=e;for(let a of i.slice(0,-1))s[a]||(s[a]={}),s=s[a];Pbe(n)?s[o]=n:s[o]=jK(n,o,{})}return e}});var f8=v((rct,d8)=>{"use strict";var Nbe=1/0,kbe="[object Symbol]",Mbe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dbe=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,PT="\\ud800-\\udfff",KK="\\u0300-\\u036f\\ufe20-\\ufe23",ZK="\\u20d0-\\u20f0",JK="\\u2700-\\u27bf",XK="a-z\\xdf-\\xf6\\xf8-\\xff",Lbe="\\xac\\xb1\\xd7\\xf7",$be="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ube="\\u2000-\\u206f",Fbe=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",QK="A-Z\\xc0-\\xd6\\xd8-\\xde",e8="\\ufe0e\\ufe0f",t8=Lbe+$be+Ube+Fbe,aN="['\u2019]",Bbe="["+PT+"]",zK="["+t8+"]",IT="["+KK+ZK+"]",r8="\\d+",jbe="["+JK+"]",n8="["+XK+"]",i8="[^"+PT+t8+r8+JK+XK+QK+"]",sN="\\ud83c[\\udffb-\\udfff]",zbe="(?:"+IT+"|"+sN+")",o8="[^"+PT+"]",cN="(?:\\ud83c[\\udde6-\\uddff]){2}",lN="[\\ud800-\\udbff][\\udc00-\\udfff]",Id="["+QK+"]",s8="\\u200d",GK="(?:"+n8+"|"+i8+")",Gbe="(?:"+Id+"|"+i8+")",qK="(?:"+aN+"(?:d|ll|m|re|s|t|ve))?",VK="(?:"+aN+"(?:D|LL|M|RE|S|T|VE))?",a8=zbe+"?",c8="["+e8+"]?",qbe="(?:"+s8+"(?:"+[o8,cN,lN].join("|")+")"+c8+a8+")*",l8=c8+a8+qbe,Vbe="(?:"+[jbe,cN,lN].join("|")+")"+l8,Hbe="(?:"+[o8+IT+"?",IT,cN,lN,Bbe].join("|")+")",Wbe=RegExp(aN,"g"),Ybe=RegExp(IT,"g"),Kbe=RegExp(sN+"(?="+sN+")|"+Hbe+l8,"g"),Zbe=RegExp([Id+"?"+n8+"+"+qK+"(?="+[zK,Id,"$"].join("|")+")",Gbe+"+"+VK+"(?="+[zK,Id+GK,"$"].join("|")+")",Id+"?"+GK+"+"+qK,Id+"+"+VK,r8,Vbe].join("|"),"g"),Jbe=RegExp("["+s8+PT+KK+ZK+e8+"]"),Xbe=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Qbe={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},eAe=typeof global=="object"&&global&&global.Object===Object&&global,tAe=typeof self=="object"&&self&&self.Object===Object&&self,rAe=eAe||tAe||Function("return this")();function nAe(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function iAe(t){return t.split("")}function oAe(t){return t.match(Mbe)||[]}function sAe(t){return function(e){return t?.[e]}}var aAe=sAe(Qbe);function u8(t){return Jbe.test(t)}function cAe(t){return Xbe.test(t)}function lAe(t){return u8(t)?uAe(t):iAe(t)}function uAe(t){return t.match(Kbe)||[]}function dAe(t){return t.match(Zbe)||[]}var fAe=Object.prototype,pAe=fAe.toString,HK=rAe.Symbol,WK=HK?HK.prototype:void 0,YK=WK?WK.toString:void 0;function hAe(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function mAe(t){if(typeof t=="string")return t;if(EAe(t))return YK?YK.call(t):"";var e=t+"";return e=="0"&&1/t==-Nbe?"-0":e}function gAe(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:hAe(t,e,r)}function _Ae(t){return function(e){e=OT(e);var r=u8(e)?lAe(e):void 0,n=r?r[0]:e.charAt(0),i=r?gAe(r,1).join(""):e.slice(1);return n[t]()+i}}function yAe(t){return function(e){return nAe(wAe(bAe(e).replace(Wbe,"")),t,"")}}function SAe(t){return!!t&&typeof t=="object"}function EAe(t){return typeof t=="symbol"||SAe(t)&&pAe.call(t)==kbe}function OT(t){return t==null?"":mAe(t)}var vAe=yAe(function(t,e,r){return e=e.toLowerCase(),t+(r?TAe(e):e)});function TAe(t){return AAe(OT(t).toLowerCase())}function bAe(t){return t=OT(t),t&&t.replace(Dbe,aAe).replace(Ybe,"")}var AAe=_Ae("toUpperCase");function wAe(t,e,r){return t=OT(t),e=r?void 0:e,e===void 0?cAe(t)?dAe(t):oAe(t):t.match(e)||[]}d8.exports=vAe});var uN=v((nct,p8)=>{"use strict";p8.exports=xAe;function xAe(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,c){r[n]=function(u){if(o)if(o=!1,u)c(u);else{for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f++]=arguments[f];a.apply(null,d)}};try{t.apply(e||null,r)}catch(l){o&&(o=!1,c(l))}})}});var _8=v(g8=>{"use strict";var NT=g8;NT.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Pd=new Array(64),m8=new Array(123);for(fi=0;fi<64;)m8[Pd[fi]=fi<26?fi+65:fi<52?fi+71:fi<62?fi-4:fi-59|43]=fi++;var fi;NT.encode=function(e,r,n){for(var i=null,o=[],s=0,a=0,c;r<n;){var l=e[r++];switch(a){case 0:o[s++]=Pd[l>>2],c=(l&3)<<4,a=1;break;case 1:o[s++]=Pd[c|l>>4],c=(l&15)<<2,a=2;break;case 2:o[s++]=Pd[c|l>>6],o[s++]=Pd[l&63],a=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=Pd[c],o[s++]=61,a===1&&(o[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var h8="invalid encoding";NT.decode=function(e,r,n){for(var i=n,o=0,s,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&o>1)break;if((c=m8[c])===void 0)throw Error(h8);switch(o){case 0:s=c,o=1;break;case 1:r[n++]=s<<2|(c&48)>>4,s=c,o=2;break;case 2:r[n++]=(s&15)<<4|(c&60)>>2,s=c,o=3;break;case 3:r[n++]=(s&3)<<6|c,o=0;break}}if(o===1)throw Error(h8);return n-i};NT.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var S8=v((oct,y8)=>{"use strict";y8.exports=kT;function kT(){this._listeners=Object.create(null)}kT.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};kT.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var n=this._listeners[e];if(!n)return this;for(var i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i}return this};kT.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var x8=v((sct,w8)=>{"use strict";w8.exports=E8(E8);function E8(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3]}function o(c,l,u){e[0]=c,l[u]=r[3],l[u+1]=r[2],l[u+2]=r[1],l[u+3]=r[0]}t.writeFloatLE=n?i:o,t.writeFloatBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],e[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],e[0]}t.readFloatLE=n?s:a,t.readFloatBE=n?a:s})():(function(){function e(n,i,o,s){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,o,s);else if(isNaN(i))n(2143289344,o,s);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,o,s)}}t.writeFloatLE=e.bind(null,v8),t.writeFloatBE=e.bind(null,T8);function r(n,i,o){var s=n(i,o),a=(s>>31)*2+1,c=s>>>23&255,l=s&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=r.bind(null,b8),t.readFloatBE=r.bind(null,A8)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3],l[u+4]=r[4],l[u+5]=r[5],l[u+6]=r[6],l[u+7]=r[7]}function o(c,l,u){e[0]=c,l[u]=r[7],l[u+1]=r[6],l[u+2]=r[5],l[u+3]=r[4],l[u+4]=r[3],l[u+5]=r[2],l[u+6]=r[1],l[u+7]=r[0]}t.writeDoubleLE=n?i:o,t.writeDoubleBE=n?o:i;function s(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],e[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],e[0]}t.readDoubleLE=n?s:a,t.readDoubleBE=n?a:s})():(function(){function e(n,i,o,s,a,c){var l=s<0?1:0;if(l&&(s=-s),s===0)n(0,a,c+i),n(1/s>0?0:2147483648,a,c+o);else if(isNaN(s))n(0,a,c+i),n(2146959360,a,c+o);else if(s>17976931348623157e292)n(0,a,c+i),n((l<<31|2146435072)>>>0,a,c+o);else{var u;if(s<22250738585072014e-324)u=s/5e-324,n(u>>>0,a,c+i),n((l<<31|u/4294967296)>>>0,a,c+o);else{var d=Math.floor(Math.log(s)/Math.LN2);d===1024&&(d=1023),u=s*Math.pow(2,-d),n(u*4503599627370496>>>0,a,c+i),n((l<<31|d+1023<<20|u*1048576&1048575)>>>0,a,c+o)}}}t.writeDoubleLE=e.bind(null,v8,0,4),t.writeDoubleBE=e.bind(null,T8,4,0);function r(n,i,o,s,a){var c=n(s,a+i),l=n(s,a+o),u=(l>>31)*2+1,d=l>>>20&2047,f=4294967296*(l&1048575)+c;return d===2047?f?NaN:u*(1/0):d===0?u*5e-324*f:u*Math.pow(2,d-1075)*(f+4503599627370496)}t.readDoubleLE=r.bind(null,b8,0,4),t.readDoubleBE=r.bind(null,A8,4,0)})(),t}function v8(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function T8(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function b8(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function A8(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var C8=v((act,R8)=>{"use strict";R8.exports=RAe;function RAe(t){try{if(typeof Z!="function")return null;var e=Z(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var P8=v(I8=>{"use strict";var fN=I8,dN="\uFFFD";fN.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};fN.read=function(e,r,n){if(n-r<1)return"";for(var i="",o=r;o<n;){var s=e[o++];if(s<=127)i+=String.fromCharCode(s);else if(s>=192&&s<224){var a=(s&31)<<6|e[o++]&63;i+=a>=128?String.fromCharCode(a):dN}else if(s>=224&&s<240){var c=(s&15)<<12|(e[o++]&63)<<6|e[o++]&63;i+=c>=2048?String.fromCharCode(c):dN}else if(s>=240){var l=(s&7)<<18|(e[o++]&63)<<12|(e[o++]&63)<<6|e[o++]&63;l<65536||l>1114111?i+=dN:(l-=65536,i+=String.fromCharCode(55296+(l>>10)),i+=String.fromCharCode(56320+(l&1023)))}}return i};fN.write=function(e,r,n){for(var i=n,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?r[n++]=o:o<2048?(r[n++]=o>>6|192,r[n++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128);return n-i}});var N8=v((uct,O8)=>{"use strict";O8.exports=CAe;function CAe(t,e,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(c){if(c<1||c>i)return t(c);s+c>n&&(o=t(n),s=0);var l=e.call(o,s,s+=c);return s&7&&(s=(s|7)+1),l}}});var M8=v((dct,k8)=>{"use strict";k8.exports=Zt;var gg=pi();function Zt(t,e){this.lo=t>>>0,this.hi=e>>>0}var ll=Zt.zero=new Zt(0,0);ll.toNumber=function(){return 0};ll.zzEncode=ll.zzDecode=function(){return this};ll.length=function(){return 1};var IAe=Zt.zeroHash="\0\0\0\0\0\0\0\0";Zt.fromNumber=function(e){if(e===0)return ll;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Zt(n,i)};Zt.from=function(e){if(typeof e=="number")return Zt.fromNumber(e);if(gg.isString(e))if(gg.Long)e=gg.Long.fromString(e);else return Zt.fromNumber(parseInt(e,10));return e.low||e.high?new Zt(e.low>>>0,e.high>>>0):ll};Zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Zt.prototype.toLong=function(e){return gg.Long?new gg.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var ha=String.prototype.charCodeAt;Zt.fromHash=function(e){return e===IAe?ll:new Zt((ha.call(e,0)|ha.call(e,1)<<8|ha.call(e,2)<<16|ha.call(e,3)<<24)>>>0,(ha.call(e,4)|ha.call(e,5)<<8|ha.call(e,6)<<16|ha.call(e,7)<<24)>>>0)};Zt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Zt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Zt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Zt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var hN=v((_g,pN)=>{"use strict";(function(t,e){function r(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return e(n),r(n)}):typeof _g=="object"?(e(_g),typeof pN=="object"&&(pN.exports=r(_g))):(function(){var n={};e(n),t.Long=r(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:_g,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(N,g,E){this.low=N|0,this.high=g|0,this.unsigned=!!E}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(N){return(N&&N.__isLong__)===!0}function i(N){var g=Math.clz32(N&-N);return N?31-g:g}r.isLong=n;var o={},s={};function a(N,g){var E,x,Y;return g?(N>>>=0,(Y=0<=N&&N<256)&&(x=s[N],x)?x:(E=l(N,0,!0),Y&&(s[N]=E),E)):(N|=0,(Y=-128<=N&&N<128)&&(x=o[N],x)?x:(E=l(N,N<0?-1:0,!1),Y&&(o[N]=E),E))}r.fromInt=a;function c(N,g){if(isNaN(N))return g?T:w;if(g){if(N<0)return T;if(N>=y)return M}else{if(N<=-S)return F;if(N+1>=S)return P}return N<0?c(-N,g).neg():l(N%m|0,N/m|0,g)}r.fromNumber=c;function l(N,g,E){return new r(N,g,E)}r.fromBits=l;var u=Math.pow;function d(N,g,E){if(N.length===0)throw Error("empty string");if(typeof g=="number"?(E=g,g=!1):g=!!g,N==="NaN"||N==="Infinity"||N==="+Infinity"||N==="-Infinity")return g?T:w;if(E=E||10,E<2||36<E)throw RangeError("radix");var x;if((x=N.indexOf("-"))>0)throw Error("interior hyphen");if(x===0)return d(N.substring(1),g,E).neg();for(var Y=c(u(E,8)),q=w,fe=0;fe<N.length;fe+=8){var $e=Math.min(8,N.length-fe),Ie=parseInt(N.substring(fe,fe+$e),E);if($e<8){var Pe=c(u(E,$e));q=q.mul(Pe).add(c(Ie))}else q=q.mul(Y),q=q.add(c(Ie))}return q.unsigned=g,q}r.fromString=d;function f(N,g){return typeof N=="number"?c(N,g):typeof N=="string"?d(N,g):l(N.low,N.high,typeof g=="boolean"?g:N.unsigned)}r.fromValue=f;var p=65536,h=1<<24,m=p*p,y=m*m,S=y/2,b=a(h),w=a(0);r.ZERO=w;var T=a(0,!0);r.UZERO=T;var C=a(1);r.ONE=C;var O=a(1,!0);r.UONE=O;var k=a(-1);r.NEG_ONE=k;var P=l(-1,2147483647,!1);r.MAX_VALUE=P;var M=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=M;var F=l(0,-2147483648,!1);r.MIN_VALUE=F;var _=r.prototype;_.toInt=function(){return this.unsigned?this.low>>>0:this.low},_.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},_.toString=function(g){if(g=g||10,g<2||36<g)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(F)){var E=c(g),x=this.div(E),Y=x.mul(E).sub(this);return x.toString(g)+Y.toInt().toString(g)}else return"-"+this.neg().toString(g);for(var q=c(u(g,6),this.unsigned),fe=this,$e="";;){var Ie=fe.div(q),Pe=fe.sub(Ie.mul(q)).toInt()>>>0,xe=Pe.toString(g);if(fe=Ie,fe.isZero())return xe+$e;for(;xe.length<6;)xe="0"+xe;$e=""+xe+$e}},_.getHighBits=function(){return this.high},_.getHighBitsUnsigned=function(){return this.high>>>0},_.getLowBits=function(){return this.low},_.getLowBitsUnsigned=function(){return this.low>>>0},_.getNumBitsAbs=function(){if(this.isNegative())return this.eq(F)?64:this.neg().getNumBitsAbs();for(var g=this.high!=0?this.high:this.low,E=31;E>0&&(g&1<<E)==0;E--);return this.high!=0?E+33:E+1},_.isSafeInteger=function(){var g=this.high>>21;return g?this.unsigned?!1:g===-1&&!(this.low===0&&this.high===-2097152):!0},_.isZero=function(){return this.high===0&&this.low===0},_.eqz=_.isZero,_.isNegative=function(){return!this.unsigned&&this.high<0},_.isPositive=function(){return this.unsigned||this.high>=0},_.isOdd=function(){return(this.low&1)===1},_.isEven=function(){return(this.low&1)===0},_.equals=function(g){return n(g)||(g=f(g)),this.unsigned!==g.unsigned&&this.high>>>31===1&&g.high>>>31===1?!1:this.high===g.high&&this.low===g.low},_.eq=_.equals,_.notEquals=function(g){return!this.eq(g)},_.neq=_.notEquals,_.ne=_.notEquals,_.lessThan=function(g){return this.comp(g)<0},_.lt=_.lessThan,_.lessThanOrEqual=function(g){return this.comp(g)<=0},_.lte=_.lessThanOrEqual,_.le=_.lessThanOrEqual,_.greaterThan=function(g){return this.comp(g)>0},_.gt=_.greaterThan,_.greaterThanOrEqual=function(g){return this.comp(g)>=0},_.gte=_.greaterThanOrEqual,_.ge=_.greaterThanOrEqual,_.compare=function(g){if(n(g)||(g=f(g)),this.eq(g))return 0;var E=this.isNegative(),x=g.isNegative();return E&&!x?-1:!E&&x?1:this.unsigned?g.high>>>0>this.high>>>0||g.high===this.high&&g.low>>>0>this.low>>>0?-1:1:this.sub(g).isNegative()?-1:1},_.comp=_.compare,_.negate=function(){return!this.unsigned&&this.eq(F)?F:this.not().add(C)},_.neg=_.negate,_.add=function(g){n(g)||(g=f(g));var E=this.high>>>16,x=this.high&65535,Y=this.low>>>16,q=this.low&65535,fe=g.high>>>16,$e=g.high&65535,Ie=g.low>>>16,Pe=g.low&65535,xe=0,Fe=0,Re=0,ce=0;return ce+=q+Pe,Re+=ce>>>16,ce&=65535,Re+=Y+Ie,Fe+=Re>>>16,Re&=65535,Fe+=x+$e,xe+=Fe>>>16,Fe&=65535,xe+=E+fe,xe&=65535,l(Re<<16|ce,xe<<16|Fe,this.unsigned)},_.subtract=function(g){return n(g)||(g=f(g)),this.add(g.neg())},_.sub=_.subtract,_.multiply=function(g){if(this.isZero())return this;if(n(g)||(g=f(g)),e){var E=e.mul(this.low,this.high,g.low,g.high);return l(E,e.get_high(),this.unsigned)}if(g.isZero())return this.unsigned?T:w;if(this.eq(F))return g.isOdd()?F:w;if(g.eq(F))return this.isOdd()?F:w;if(this.isNegative())return g.isNegative()?this.neg().mul(g.neg()):this.neg().mul(g).neg();if(g.isNegative())return this.mul(g.neg()).neg();if(this.lt(b)&&g.lt(b))return c(this.toNumber()*g.toNumber(),this.unsigned);var x=this.high>>>16,Y=this.high&65535,q=this.low>>>16,fe=this.low&65535,$e=g.high>>>16,Ie=g.high&65535,Pe=g.low>>>16,xe=g.low&65535,Fe=0,Re=0,ce=0,_e=0;return _e+=fe*xe,ce+=_e>>>16,_e&=65535,ce+=q*xe,Re+=ce>>>16,ce&=65535,ce+=fe*Pe,Re+=ce>>>16,ce&=65535,Re+=Y*xe,Fe+=Re>>>16,Re&=65535,Re+=q*Pe,Fe+=Re>>>16,Re&=65535,Re+=fe*Ie,Fe+=Re>>>16,Re&=65535,Fe+=x*xe+Y*Pe+q*Ie+fe*$e,Fe&=65535,l(ce<<16|_e,Fe<<16|Re,this.unsigned)},_.mul=_.multiply,_.divide=function(g){if(n(g)||(g=f(g)),g.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&g.low===-1&&g.high===-1)return this;var E=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,g.low,g.high);return l(E,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?T:w;var x,Y,q;if(this.unsigned){if(g.unsigned||(g=g.toUnsigned()),g.gt(this))return T;if(g.gt(this.shru(1)))return O;q=T}else{if(this.eq(F)){if(g.eq(C)||g.eq(k))return F;if(g.eq(F))return C;var fe=this.shr(1);return x=fe.div(g).shl(1),x.eq(w)?g.isNegative()?C:k:(Y=this.sub(g.mul(x)),q=x.add(Y.div(g)),q)}else if(g.eq(F))return this.unsigned?T:w;if(this.isNegative())return g.isNegative()?this.neg().div(g.neg()):this.neg().div(g).neg();if(g.isNegative())return this.div(g.neg()).neg();q=w}for(Y=this;Y.gte(g);){x=Math.max(1,Math.floor(Y.toNumber()/g.toNumber()));for(var $e=Math.ceil(Math.log(x)/Math.LN2),Ie=$e<=48?1:u(2,$e-48),Pe=c(x),xe=Pe.mul(g);xe.isNegative()||xe.gt(Y);)x-=Ie,Pe=c(x,this.unsigned),xe=Pe.mul(g);Pe.isZero()&&(Pe=C),q=q.add(Pe),Y=Y.sub(xe)}return q},_.div=_.divide,_.modulo=function(g){if(n(g)||(g=f(g)),e){var E=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,g.low,g.high);return l(E,e.get_high(),this.unsigned)}return this.sub(this.div(g).mul(g))},_.mod=_.modulo,_.rem=_.modulo,_.not=function(){return l(~this.low,~this.high,this.unsigned)},_.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},_.clz=_.countLeadingZeros,_.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},_.ctz=_.countTrailingZeros,_.and=function(g){return n(g)||(g=f(g)),l(this.low&g.low,this.high&g.high,this.unsigned)},_.or=function(g){return n(g)||(g=f(g)),l(this.low|g.low,this.high|g.high,this.unsigned)},_.xor=function(g){return n(g)||(g=f(g)),l(this.low^g.low,this.high^g.high,this.unsigned)},_.shiftLeft=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low<<g,this.high<<g|this.low>>>32-g,this.unsigned):l(0,this.low<<g-32,this.unsigned)},_.shl=_.shiftLeft,_.shiftRight=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>g,this.unsigned):l(this.high>>g-32,this.high>=0?0:-1,this.unsigned)},_.shr=_.shiftRight,_.shiftRightUnsigned=function(g){return n(g)&&(g=g.toInt()),(g&=63)===0?this:g<32?l(this.low>>>g|this.high<<32-g,this.high>>>g,this.unsigned):g===32?l(this.high,0,this.unsigned):l(this.high>>>g-32,0,this.unsigned)},_.shru=_.shiftRightUnsigned,_.shr_u=_.shiftRightUnsigned,_.rotateLeft=function(g){var E;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(E=32-g,l(this.low<<g|this.high>>>E,this.high<<g|this.low>>>E,this.unsigned)):(g-=32,E=32-g,l(this.high<<g|this.low>>>E,this.low<<g|this.high>>>E,this.unsigned))},_.rotl=_.rotateLeft,_.rotateRight=function(g){var E;return n(g)&&(g=g.toInt()),(g&=63)===0?this:g===32?l(this.high,this.low,this.unsigned):g<32?(E=32-g,l(this.high<<E|this.low>>>g,this.low<<E|this.high>>>g,this.unsigned)):(g-=32,E=32-g,l(this.low<<E|this.high>>>g,this.high<<E|this.low>>>g,this.unsigned))},_.rotr=_.rotateRight,_.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},_.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},_.toBytes=function(g){return g?this.toBytesLE():this.toBytesBE()},_.toBytesLE=function(){var g=this.high,E=this.low;return[E&255,E>>>8&255,E>>>16&255,E>>>24,g&255,g>>>8&255,g>>>16&255,g>>>24]},_.toBytesBE=function(){var g=this.high,E=this.low;return[g>>>24,g>>>16&255,g>>>8&255,g&255,E>>>24,E>>>16&255,E>>>8&255,E&255]},r.fromBytes=function(g,E,x){return x?r.fromBytesLE(g,E):r.fromBytesBE(g,E)},r.fromBytesLE=function(g,E){return new r(g[0]|g[1]<<8|g[2]<<16|g[3]<<24,g[4]|g[5]<<8|g[6]<<16|g[7]<<24,E)},r.fromBytesBE=function(g,E){return new r(g[4]<<24|g[5]<<16|g[6]<<8|g[7],g[0]<<24|g[1]<<16|g[2]<<8|g[3],E)},typeof BigInt=="function"&&(r.fromBigInt=function(g,E){var x=Number(BigInt.asIntN(32,g)),Y=Number(BigInt.asIntN(32,g>>BigInt(32)));return l(x,Y,E)},r.fromValue=function(g,E){return typeof g=="bigint"?r.fromBigInt(g,E):f(g,E)},_.toBigInt=function(){var g=BigInt(this.low>>>0),E=BigInt(this.unsigned?this.high>>>0:this.high);return E<<BigInt(32)|g});var re=t.default=r})});var pi=v(mN=>{"use strict";var be=mN;be.asPromise=uN();be.base64=_8();be.EventEmitter=S8();be.float=x8();be.inquire=C8();be.utf8=P8();be.pool=N8();be.LongBits=M8();function D8(t){return t==="__proto__"||t==="prototype"||t==="constructor"}be.isUnsafeProperty=D8;be.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);be.global=be.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||mN;be.emptyArray=Object.freeze?Object.freeze([]):[];be.emptyObject=Object.freeze?Object.freeze({}):{};be.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};be.isString=function(e){return typeof e=="string"||e instanceof String};be.isObject=function(e){return e&&typeof e=="object"};be.isset=be.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};be.Buffer=(function(){try{var t=be.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();be._Buffer_from=null;be._Buffer_allocUnsafe=null;be.newBuffer=function(e){return typeof e=="number"?be.Buffer?be._Buffer_allocUnsafe(e):new be.Array(e):be.Buffer?be._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};be.Array=typeof Uint8Array<"u"?Uint8Array:Array;be.Long=be.global.dcodeIO&&be.global.dcodeIO.Long||be.global.Long||(function(){try{var t=hN();return t&&t.isLong?t:null}catch{return null}})();be.key2Re=/^true|false|0|1$/;be.key32Re=/^-?(?:0|[1-9][0-9]*)$/;be.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;be.longToHash=function(e){return e?be.LongBits.from(e).toHash():be.LongBits.zeroHash};be.longFromHash=function(e,r){var n=be.LongBits.fromHash(e);return be.Long?be.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function L8(t){var e=typeof arguments[arguments.length-1]=="boolean",r=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var n=1;n<r;++n){var i=arguments[n];if(i)for(var o=Object.keys(i),s=0;s<o.length;++s)!D8(o[s])&&(t[o[s]]===void 0||!e)&&(t[o[s]]=i[o[s]])}return t}be.merge=L8;be.nestingLimit=32;be.recursionLimit=100;be.makeProp=function(e,r){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0})};be.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function $8(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&L8(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}be.newError=$8;be.ProtocolError=$8("ProtocolError");be.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(r[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};be.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};be.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};be._configure=function(){var t=be.Buffer;if(!t){be._Buffer_from=be._Buffer_allocUnsafe=null;return}be._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},be._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var DT=v((pct,j8)=>{"use strict";j8.exports=et;var jn=pi(),gN,MT=jn.LongBits,U8=jn.base64,F8=jn.utf8;function yg(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function yN(){}function PAe(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function et(){this.len=0,this.head=new yg(yN,0,0),this.tail=this.head,this.states=null}var B8=function(){return jn.Buffer?function(){return(et.create=function(){return new gN})()}:function(){return new et}};et.create=B8();et.alloc=function(e){return new jn.Array(e)};jn.Array!==Array&&(et.alloc=jn.pool(et.alloc,jn.Array.prototype.subarray));et.prototype._push=function(e,r,n){return this.tail=this.tail.next=new yg(e,r,n),this.len+=r,this};function SN(t,e,r){e[r]=t&255}function OAe(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function EN(t,e){this.len=t,this.next=void 0,this.val=e}EN.prototype=Object.create(yg.prototype);EN.prototype.fn=OAe;et.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new EN((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};et.prototype.int32=function(e){return(e|=0)<0?this._push(vN,10,MT.fromNumber(e)):this.uint32(e)};et.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function vN(t,e,r){for(var n=t.lo,i=t.hi;i;)e[r++]=n&127|128,n=(n>>>7|i<<25)>>>0,i>>>=7;for(;n>127;)e[r++]=n&127|128,n=n>>>7;e[r++]=n}et.prototype.uint64=function(e){var r=MT.from(e);return this._push(vN,r.length(),r)};et.prototype.int64=et.prototype.uint64;et.prototype.sint64=function(e){var r=MT.from(e).zzEncode();return this._push(vN,r.length(),r)};et.prototype.bool=function(e){return this._push(SN,1,e?1:0)};function _N(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}et.prototype.fixed32=function(e){return this._push(_N,4,e>>>0)};et.prototype.sfixed32=et.prototype.fixed32;et.prototype.fixed64=function(e){var r=MT.from(e);return this._push(_N,4,r.lo)._push(_N,4,r.hi)};et.prototype.sfixed64=et.prototype.fixed64;et.prototype.float=function(e){return this._push(jn.float.writeFloatLE,4,e)};et.prototype.double=function(e){return this._push(jn.float.writeDoubleLE,8,e)};var NAe=jn.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};et.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(SN,1,0);if(jn.isString(e)){var n=et.alloc(r=U8.length(e));U8.decode(e,n,0),e=n}return this.uint32(r)._push(NAe,r,e)};et.prototype.string=function(e){var r=F8.length(e);return r?this.uint32(r)._push(F8.write,r,e):this._push(SN,1,0)};et.prototype.fork=function(){return this.states=new PAe(this),this.head=this.tail=new yg(yN,0,0),this.len=0,this};et.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new yg(yN,0,0),this.len=0),this};et.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};et.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};et._configure=function(t){gN=t,et.create=B8(),gN._configure()}});var q8=v((hct,G8)=>{"use strict";G8.exports=Ji;var z8=DT();(Ji.prototype=Object.create(z8.prototype)).constructor=Ji;var ma=pi();function Ji(){z8.call(this)}Ji._configure=function(){Ji.alloc=ma._Buffer_allocUnsafe,Ji.writeBytesBuffer=ma.Buffer&&ma.Buffer.prototype instanceof Uint8Array&&ma.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};Ji.prototype.bytes=function(e){ma.isString(e)&&(e=ma._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Ji.writeBytesBuffer,r,e),this};function kAe(t,e,r){t.length<40?ma.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Ji.prototype.string=function(e){var r=ma.Buffer.byteLength(e);return this.uint32(r),r&&this._push(kAe,r,e),this};Ji._configure()});var $T=v((mct,K8)=>{"use strict";K8.exports=Tt;var zn=pi(),bN,W8=zn.LongBits,MAe=zn.utf8;function hi(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Tt(t){this.buf=t,this.pos=0,this.len=t.length}var V8=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Tt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Tt(e);throw Error("illegal buffer")},Y8=function(){return zn.Buffer?function(r){return(Tt.create=function(i){return zn.Buffer.isBuffer(i)?new bN(i):V8(i)})(r)}:V8};Tt.create=Y8();Tt.prototype._slice=zn.Array.prototype.subarray||zn.Array.prototype.slice;Tt.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,hi(this,10);return e}})();Tt.prototype.int32=function(){return this.uint32()|0};Tt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function TN(){var t=new W8(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw hi(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw hi(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Tt.prototype.bool=function(){return this.uint32()!==0};function LT(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Tt.prototype.fixed32=function(){if(this.pos+4>this.len)throw hi(this,4);return LT(this.buf,this.pos+=4)};Tt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw hi(this,4);return LT(this.buf,this.pos+=4)|0};function H8(){if(this.pos+8>this.len)throw hi(this,8);return new W8(LT(this.buf,this.pos+=4),LT(this.buf,this.pos+=4))}Tt.prototype.float=function(){if(this.pos+4>this.len)throw hi(this,4);var e=zn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Tt.prototype.double=function(){if(this.pos+8>this.len)throw hi(this,4);var e=zn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Tt.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw hi(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=zn.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};Tt.prototype.string=function(){var e=this.bytes();return MAe.read(e,0,e.length)};Tt.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw hi(this,e);this.pos+=e}else do if(this.pos>=this.len)throw hi(this);while(this.buf[this.pos++]&128);return this};Tt.recursionLimit=zn.recursionLimit;Tt.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>Tt.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Tt._configure=function(t){bN=t,Tt.create=Y8(),bN._configure();var e=zn.Long?"toLong":"toNumber";zn.merge(Tt.prototype,{int64:function(){return TN.call(this)[e](!1)},uint64:function(){return TN.call(this)[e](!0)},sint64:function(){return TN.call(this).zzDecode()[e](!1)},fixed64:function(){return H8.call(this)[e](!0)},sfixed64:function(){return H8.call(this)[e](!1)}})}});var Q8=v((gct,X8)=>{"use strict";X8.exports=ul;var J8=$T();(ul.prototype=Object.create(J8.prototype)).constructor=ul;var Z8=pi();function ul(t){J8.call(this,t)}ul._configure=function(){Z8.Buffer&&(ul.prototype._slice=Z8.Buffer.prototype.slice)};ul.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};ul._configure()});var tZ=v((_ct,eZ)=>{"use strict";eZ.exports=Sg;var AN=pi();(Sg.prototype=Object.create(AN.EventEmitter.prototype)).constructor=Sg;function Sg(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");AN.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}Sg.prototype.rpcCall=function t(e,r,n,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return AN.asPromise(t,s,e,r,n,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(e,r[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return s.emit("error",c,e),o(c);if(l===null){s.end(!0);return}if(!(l instanceof n))try{l=n[s.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return s.emit("error",u,e),o(u)}return s.emit("data",l,e),o(null,l)})}catch(a){s.emit("error",a,e),setTimeout(function(){o(a)},0);return}};Sg.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var wN=v(rZ=>{"use strict";var DAe=rZ;DAe.Service=tZ()});var xN=v((Sct,nZ)=>{"use strict";nZ.exports={}});var sZ=v(oZ=>{"use strict";var Jr=oZ;Jr.build="minimal";Jr.Writer=DT();Jr.BufferWriter=q8();Jr.Reader=$T();Jr.BufferReader=Q8();Jr.util=pi();Jr.rpc=wN();Jr.roots=xN();Jr.configure=iZ;function iZ(){Jr.util._configure(),Jr.Writer._configure(Jr.BufferWriter),Jr.Reader._configure(Jr.BufferReader)}iZ()});var cZ=v((vct,aZ)=>{"use strict";aZ.exports=RN;var LAe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function RN(t,e){typeof t=="string"&&(e=t,t=void 0);var r=[];function n(o){if(typeof o!="string"){var s=i();if(RN.verbose&&console.log("codegen: "+s),s="return "+s,o){for(var a=Object.keys(o),c=new Array(a.length+1),l=new Array(a.length),u=0;u<a.length;)c[u]=a[u],l[u]=o[a[u++]];return c[u]=s,Function.apply(null,c).apply(null,l)}return Function(s)()}for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f]=arguments[++f];if(f=0,o=o.replace(/%([%dfijs])/g,function(h,m){var y=d[f++];switch(m){case"d":case"f":return String(Number(y));case"i":return String(Math.floor(y));case"j":return JSON.stringify(y);case"s":return String(y)}return"%"}),f!==d.length)throw Error("parameter count mismatch");return r.push(o),n}function i(o){return"function "+$Ae(o||e)+"("+(t&&t.join(",")||"")+`){
7
7
  `+r.join(`
8
8
  `)+`
9
9
  }`}return n.toString=i,n}RN.verbose=!1;function $Ae(t){return!t||(t=String(t).replace(/[^\w$]/g,""),!t)?"":(/^\d/.test(t)&&(t="_"+t),LAe.test(t)?t+"_":t)}});var uZ=v((Tct,lZ)=>{"use strict";var Od=null;try{Od=Z("fs"),(!Od||!Od.readFile||!Od.readFileSync)&&(Od=null)}catch{}lZ.exports=Od});var fZ=v((bct,dZ)=>{"use strict";dZ.exports=Eg;var UAe=uN(),CN=uZ();function Eg(t,e,r){return typeof e=="function"?(r=e,e={}):e||(e={}),r?!e.xhr&&CN&&CN.readFile?CN.readFile(t,function(i,o){return i&&typeof XMLHttpRequest<"u"?Eg.xhr(t,e,r):i?r(i):r(null,e.binary?o:o.toString("utf8"))}):Eg.xhr(t,e,r):UAe(Eg,this,t,e)}Eg.xhr=function(e,r,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===4){if(i.status!==0&&i.status!==200)return n(Error("status "+i.status));if(r.binary){var s=i.response;if(!s){s=[];for(var a=0;a<i.responseText.length;++a)s.push(i.responseText.charCodeAt(a)&255)}return n(null,typeof Uint8Array<"u"?new Uint8Array(s):s)}return n(null,i.responseText)}},r.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}});var mZ=v(hZ=>{"use strict";var PN=hZ,pZ=PN.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},IN=PN.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var r=e.split("/"),n=pZ(e),i="";n&&(i=r.shift()+"/");for(var o=0;o<r.length;)r[o]===".."?o>0&&r[o-1]!==".."?r.splice(--o,2):n?r.splice(o,1):++o:r[o]==="."?r.splice(o,1):++o;return i+r.join("/")};PN.resolve=function(e,r,n){return n||(r=IN(r)),pZ(r)?r:(n||(e=IN(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?IN(e+"/"+r):r)}});var _Z=v(gZ=>{"use strict";var ON=gZ;ON.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;ON.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;ON.reservedRe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/});var SZ=v((xct,yZ)=>{"use strict";var Nd=null;try{Nd=Z("fs"),(!Nd||!Nd.readFile||!Nd.readFileSync)&&(Nd=null)}catch{}yZ.exports=Nd});var Md=v((Rct,TZ)=>{"use strict";TZ.exports=Ze;var UT=_a();((Ze.prototype=Object.create(UT.prototype)).constructor=Ze).className="Namespace";var NN=ga(),fl=Jt(),FAe=hl(),dl,kd,pl;Ze.fromJSON=function(e,r,n){return n=fl.checkDepth(n),new Ze(e,r.options).addJSON(r.nested,n)};function EZ(t,e){if(t&&t.length){for(var r={},n=0;n<t.length;++n)r[t[n].name]=t[n].toJSON(e);return r}}Ze.arrayToJSON=EZ;Ze.isReservedId=function(e,r){if(e){for(var n=0;n<e.length;++n)if(typeof e[n]!="string"&&e[n][0]<=r&&e[n][1]>r)return!0}return!1};Ze.isReservedName=function(e,r){if(e){for(var n=0;n<e.length;++n)if(e[n]===r)return!0}return!1};function Ze(t,e){UT.call(this,t,e),this.nested=void 0,this._nestedArray=null,this._lookupCache=Object.create(null),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function vZ(t){t._nestedArray=null,t._lookupCache=Object.create(null);for(var e=t;e=e.parent;)e._lookupCache=Object.create(null);return t}Object.defineProperty(Ze.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=fl.toArray(this.nested))}});Ze.prototype.toJSON=function(e){return fl.toObject(["options",this.options,"nested",EZ(this.nestedArray,e)])};Ze.prototype.addJSON=function(e,r){r=fl.checkDepth(r);var n=this;if(e)for(var i=Object.keys(e),o=0,s;o<i.length;++o)s=e[i[o]],n.add((s.fields!==void 0?dl.fromJSON:s.values!==void 0?pl.fromJSON:s.methods!==void 0?kd.fromJSON:s.id!==void 0?NN.fromJSON:Ze.fromJSON)(i[o],s,r+1));return this};Ze.prototype.get=function(e){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};Ze.prototype.getEnum=function(e){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)&&this.nested[e]instanceof pl)return this.nested[e].values;throw Error("no such enum: "+e)};Ze.prototype.add=function(e){if(!(e instanceof NN&&e.extend!==void 0||e instanceof dl||e instanceof FAe||e instanceof pl||e instanceof kd||e instanceof Ze))throw TypeError("object must be a valid nested object");if(e.name==="__proto__")return this;if(!this.nested)this.nested={};else{var r=this.get(e.name);if(r)if(r instanceof Ze&&e instanceof Ze&&!(r instanceof dl||r instanceof kd)){for(var n=r.nestedArray,i=0;i<n.length;++i)e.add(n[i]);this.remove(r),this.nested||(this.nested={}),e.setOptions(r.options,!0)}else throw Error("duplicate name '"+e.name+"' in "+this)}this.nested[e.name]=e,this instanceof dl||this instanceof kd||this instanceof pl||this instanceof NN||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var o=this;o=o.parent;)o._needsRecursiveFeatureResolution=!0,o._needsRecursiveResolve=!0;return e.onAdd(this),vZ(this)};Ze.prototype.remove=function(e){if(!(e instanceof UT))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),vZ(this)};Ze.prototype.define=function(e,r){if(fl.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&e[0]==="")throw Error("path must be relative");if(e.length>fl.recursionLimit)throw Error("max depth exceeded");for(var n=this;e.length>0;){var i=e.shift();if(n.nested&&n.nested[i]){if(n=n.nested[i],!(n instanceof Ze))throw Error("path conflicts with non-namespace objects")}else n.add(n=new Ze(i))}return r&&n.addJSON(r),n};Ze.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,r=0;for(this.resolve();r<e.length;)e[r]instanceof Ze?e[r++].resolveAll():e[r++].resolve();return this._needsRecursiveResolve=!1,this};Ze.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,UT.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(r=>{r._resolveFeaturesRecursive(e)}),this):this};Ze.prototype.lookup=function(e,r,n){if(typeof r=="boolean"?(n=r,r=void 0):r&&!Array.isArray(r)&&(r=[r]),fl.isString(e)&&e.length){if(e===".")return this.root;e=e.split(".")}else if(!e.length)return this;var i=e.join(".");if(e[0]==="")return this.root.lookup(e.slice(1),r);var o=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+i];if(o&&(!r||r.indexOf(o.constructor)>-1)||(o=this._lookupImpl(e,i),o&&(!r||r.indexOf(o.constructor)>-1)))return o;if(n)return null;for(var s=this;s.parent;){if(o=s.parent._lookupImpl(e,i),o&&(!r||r.indexOf(o.constructor)>-1))return o;s=s.parent}return null};Ze.prototype._lookupImpl=function(e,r){if(Object.prototype.hasOwnProperty.call(this._lookupCache,r))return this._lookupCache[r];var n=this.get(e[0]),i=null;if(n)e.length===1?i=n:n instanceof Ze&&(e=e.slice(1),i=n._lookupImpl(e,e.join(".")));else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof Ze&&(n=this._nestedArray[o]._lookupImpl(e,r))){i=n;break}return this._lookupCache[r]=i,i};Ze.prototype.lookupType=function(e){var r=this.lookup(e,[dl]);if(!r)throw Error("no such type: "+e);return r};Ze.prototype.lookupEnum=function(e){var r=this.lookup(e,[pl]);if(!r)throw Error("no such Enum '"+e+"' in "+this);return r};Ze.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[dl,pl]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r};Ze.prototype.lookupService=function(e){var r=this.lookup(e,[kd]);if(!r)throw Error("no such Service '"+e+"' in "+this);return r};Ze._configure=function(t,e,r){dl=t,kd=e,pl=r}});var FT=v((Cct,bZ)=>{"use strict";bZ.exports=es;var kN=ga();((es.prototype=Object.create(kN.prototype)).constructor=es).className="MapField";var BAe=ml(),vg=Jt();function es(t,e,r,n,i,o){if(kN.call(this,t,e,n,void 0,void 0,i,o),!vg.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}es.fromJSON=function(e,r){return new es(e,r.id,r.keyType,r.type,r.options,r.comment)};es.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return vg.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",r?this.comment:void 0])};es.prototype.resolve=function(){if(this.resolved)return this;if(BAe.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return kN.prototype.resolve.call(this)};es.d=function(e,r,n){return typeof n=="function"?n=vg.decorateType(n).name:n&&typeof n=="object"&&(n=vg.decorateEnum(n).name),function(o,s){vg.decorateType(o.constructor).add(new es(s,e,r,n))}}});var BT=v((Ict,AZ)=>{"use strict";AZ.exports=gl;var MN=_a();((gl.prototype=Object.create(MN.prototype)).constructor=gl).className="Method";var Dd=Jt();function gl(t,e,r,n,i,o,s,a,c){if(Dd.isObject(i)?(s=i,i=o=void 0):Dd.isObject(o)&&(s=o,o=void 0),!(e===void 0||Dd.isString(e)))throw TypeError("type must be a string");if(!Dd.isString(r))throw TypeError("requestType must be a string");if(!Dd.isString(n))throw TypeError("responseType must be a string");MN.call(this,t,s),this.type=e||"rpc",this.requestType=r,this.requestStream=i?!0:void 0,this.responseType=n,this.responseStream=o?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=a,this.parsedOptions=c}gl.fromJSON=function(e,r){return new gl(e,r.type,r.requestType,r.responseType,r.requestStream,r.responseStream,r.options,r.comment,r.parsedOptions)};gl.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return Dd.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])};gl.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),MN.prototype.resolve.call(this))}});var jT=v((Pct,xZ)=>{"use strict";xZ.exports=mn;var ts=Md();((mn.prototype=Object.create(ts.prototype)).constructor=mn).className="Service";var DN=BT(),Ld=Jt(),jAe=wN(),zAe=Ld.patterns.reservedRe;function mn(t,e){ts.call(this,t,e),this.methods={},this._methodsArray=null}mn.fromJSON=function(e,r,n){n=Ld.checkDepth(n);var i=new mn(e,r.options);if(r.methods)for(var o=Object.keys(r.methods),s=0;s<o.length;++s)i.add(DN.fromJSON(o[s],r.methods[o[s]]));return r.nested&&i.addJSON(r.nested,n),r.edition&&(i._edition=r.edition),i.comment=r.comment,i._defaultEdition="proto3",i};mn.prototype.toJSON=function(e){var r=ts.prototype.toJSON.call(this,e),n=e?!!e.keepComments:!1;return Ld.toObject(["edition",this._editionToJSON(),"options",r&&r.options||void 0,"methods",ts.arrayToJSON(this.methodsArray,e)||{},"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])};Object.defineProperty(mn.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=Ld.toArray(this.methods))}});function wZ(t){return t._methodsArray=null,t}mn.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.methods,e)?this.methods[e]:ts.prototype.get.call(this,e)};mn.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;ts.prototype.resolve.call(this);for(var e=this.methodsArray,r=0;r<e.length;++r)e[r].resolve();return this};mn.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,ts.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(r=>{r._resolveFeaturesRecursive(e)}),this):this};mn.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof DN?e.name==="__proto__"?this:(this.methods[e.name]=e,e.parent=this,wZ(this)):ts.prototype.add.call(this,e)};mn.prototype.remove=function(e){if(e instanceof DN){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,wZ(this)}return ts.prototype.remove.call(this,e)};mn.prototype.create=function(e,r,n){for(var i=new jAe.Service(e,r,n),o=0,s;o<this.methodsArray.length;++o){var a=Ld.lcFirst((s=this._methodsArray[o]).resolve().name).replace(/[^$\w_]/g,"");i[a]=Ld.codegen(["r","c"],zAe.test(a)?a+"_":a)("return this.rpcCall(m,q,s,r,c)")({m:s,q:s.resolvedRequestType.ctor,s:s.resolvedResponseType.ctor})}return i}});var zT=v((Oct,RZ)=>{"use strict";RZ.exports=Xi;var GAe=pi();function Xi(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r){var n=e[r];n!=="__proto__"&&(this[n]=t[n])}}Xi.create=function(e){return this.$type.create(e)};Xi.encode=function(e,r){return this.$type.encode(e,r)};Xi.encodeDelimited=function(e,r){return this.$type.encodeDelimited(e,r)};Xi.decode=function(e){return this.$type.decode(e)};Xi.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};Xi.verify=function(e){return this.$type.verify(e)};Xi.fromObject=function(e){return this.$type.fromObject(e)};Xi.toObject=function(e,r){return this.$type.toObject(e,r)};Xi.prototype.toJSON=function(){return this.$type.toObject(this,GAe.toJSONOptions)}});var LN=v((Nct,IZ)=>{"use strict";IZ.exports=HAe;var qAe=mi(),rs=ml(),CZ=Jt();function VAe(t){return"missing required '"+t.name+"'"}function HAe(t){for(var e=CZ.codegen(["r","l","e","n"],t.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(t.fieldsArray.filter(function(a){return a.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),r=0;r<t.fieldsArray.length;++r){var n=t._fieldsArray[r].resolve(),i=n.resolvedType instanceof qAe?"int32":n.type,o="m"+CZ.safeProp(n.name);e("case %i: {",n.id),n.map?(e("if(%s===util.emptyObject)",o)("%s={}",o)("var c2 = r.uint32()+r.pos"),rs.defaults[n.keyType]!==void 0?e("k=%j",rs.defaults[n.keyType]):e("k=null"),rs.defaults[i]!==void 0?e("value=%j",rs.defaults[i]):e("value=null"),e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",n.keyType)("case 2:"),rs.basic[i]===void 0?e("value=types[%i].decode(r,r.uint32(),undefined,n+1)",r):e("value=r.%s()",i),e("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),rs.long[n.keyType]!==void 0?e('%s[typeof k==="object"?util.longToHash(k):k]=value',o):(n.keyType==="string"&&e('if(k==="__proto__")')("util.makeProp(%s,k)",o),e("%s[k]=value",o))):n.repeated?(e("if(!(%s&&%s.length))",o,o)("%s=[]",o),rs.packed[i]!==void 0&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",o,i)("}else"),rs.basic[i]===void 0?e(n.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",o,r):e("%s.push(r.%s())",o,i)):rs.basic[i]===void 0?e(n.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",o,r):e("%s=r.%s()",o,i),e("break")("}")}for(e("default:")("r.skipType(t&7,n)")("break")("}")("}"),r=0;r<t._fieldsArray.length;++r){var s=t._fieldsArray[r];s.required&&e("if(!m.hasOwnProperty(%j))",s.name)("throw util.ProtocolError(%j,{instance:m})",VAe(s))}return e("return m")}});var FN=v((kct,PZ)=>{"use strict";PZ.exports=KAe;var WAe=mi(),$N=Jt();function Gn(t,e){return t.name+": "+e+(t.repeated&&e!=="array"?"[]":t.map&&e!=="object"?"{k:"+t.keyType+"}":"")+" expected"}function UN(t,e,r,n){if(e.resolvedType)if(e.resolvedType instanceof WAe){t("switch(%s){",n)("default:")("return%j",Gn(e,"enum value"));for(var i=Object.keys(e.resolvedType.values),o=0;o<i.length;++o)t("case %i:",e.resolvedType.values[i[o]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s,n+1);",r,n)("if(e)")("return%j+e",e.name+".")("}");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",n)("return%j",Gn(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",Gn(e,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',n)("return%j",Gn(e,"number"));break;case"bool":t('if(typeof %s!=="boolean")',n)("return%j",Gn(e,"boolean"));break;case"string":t("if(!util.isString(%s))",n)("return%j",Gn(e,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",Gn(e,"buffer"));break}return t}function YAe(t,e,r){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.key32Re.test(%s))",r)("return%j",Gn(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.key64Re.test(%s))",r)("return%j",Gn(e,"integer|Long key"));break;case"bool":t("if(!util.key2Re.test(%s))",r)("return%j",Gn(e,"boolean key"));break}return t}function KAe(t){var e=$N.codegen(["m","n"],t.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),r=t.oneofsArray,n={};r.length&&e("var p={}");for(var i=0;i<t.fieldsArray.length;++i){var o=t._fieldsArray[i].resolve(),s="m"+$N.safeProp(o.name);if(o.optional&&e("if(%s!=null&&m.hasOwnProperty(%j)){",s,o.name),o.map)e("if(!util.isObject(%s))",s)("return%j",Gn(o,"object"))("var k=Object.keys(%s)",s)("for(var i=0;i<k.length;++i){"),YAe(e,o,"k[i]"),UN(e,o,i,s+"[k[i]]")("}");else if(o.repeated)e("if(!Array.isArray(%s))",s)("return%j",Gn(o,"array"))("for(var i=0;i<%s.length;++i){",s),UN(e,o,i,s+"[i]")("}");else{if(o.partOf){var a=$N.safeProp(o.partOf.name);n[o.partOf.name]===1&&e("if(p%s===1)",a)("return%j",o.partOf.name+": multiple values"),n[o.partOf.name]=1,e("p%s=1",a)}UN(e,o,i,s)}o.optional&&e("}")}return e("return null")}});var zN=v(NZ=>{"use strict";var OZ=NZ,Tg=mi(),Qi=Jt();function BN(t,e,r,n){var i=!1;if(e.resolvedType)if(e.resolvedType instanceof Tg){t("switch(d%s){",n);for(var o=e.resolvedType.values,s=Object.keys(o),a=0;a<s.length;++a)o[s[a]]===e.typeDefault&&!i&&(t("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),e.repeated||t("break"),i=!0),t("case%j:",s[a])("case %i:",o[s[a]])("m%s=%j",n,o[s[a]])("break");t("}")}else t('if(typeof d%s!=="object")',n)("throw TypeError(%j)",e.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",n,r,n);else{var c=!1;switch(e.type){case"double":case"float":t("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":t("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",n,n);break;case"uint64":case"fixed64":c=!0;case"int64":case"sint64":case"sfixed64":t("if(util.Long)")("m%s=util.Long.fromValue(d%s,%j)",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":t('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":t("m%s=String(d%s)",n,n);break;case"bool":t("m%s=Boolean(d%s)",n,n);break}}return t}OZ.fromObject=function(e){var r=e.fieldsArray,n=Qi.codegen(["d","n"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');if(!r.length)return n("return new this.ctor");n("var m=new this.ctor");for(var i=0;i<r.length;++i){var o=r[i].resolve(),s=Qi.safeProp(o.name);o.map?(n("if(d%s){",s)('if(typeof d%s!=="object")',s)("throw TypeError(%j)",o.fullName+": object expected")("m%s={}",s)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",s),n('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",s),BN(n,o,i,s+"[ks[i]]")("}")("}")):o.repeated?(n("if(d%s){",s)("if(!Array.isArray(d%s))",s)("throw TypeError(%j)",o.fullName+": array expected")("m%s=[]",s)("for(var i=0;i<d%s.length;++i){",s),BN(n,o,i,s+"[i]")("}")("}")):(o.resolvedType instanceof Tg||n("if(d%s!=null){",s),BN(n,o,i,s),o.resolvedType instanceof Tg||n("}"))}return n("return m")};function jN(t,e,r,n){if(e.resolvedType)e.resolvedType instanceof Tg?t("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):t("d%s=types[%i].toObject(m%s,o,q+1)",n,r,n);else{var i=!1;switch(e.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":case"fixed64":i=!0;case"int64":case"sint64":case"sfixed64":t('if(typeof BigInt!=="undefined"&&o.longs===BigInt)')('d%s=typeof m%s==="number"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()',n,n,n,n,n,i)('else if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,i?"true":"",n);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:t("d%s=m%s",n,n);break}}return t}OZ.toObject=function(e){var r=e.fieldsArray.slice().sort(Qi.compareFieldsById);if(!r.length)return Qi.codegen()("return {}");for(var n=Qi.codegen(["m","o","q"],e.name+"$toObject")("if(!o)")("o={}")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")')("var d={}"),i=[],o=[],s=[],a=0;a<r.length;++a)r[a].partOf||(r[a].resolve().repeated?i:r[a].map?o:s).push(r[a]);if(i.length){for(n("if(o.arrays||o.defaults){"),a=0;a<i.length;++a)n("d%s=[]",Qi.safeProp(i[a].name));n("}")}if(o.length){for(n("if(o.objects||o.defaults){"),a=0;a<o.length;++a)n("d%s={}",Qi.safeProp(o[a].name));n("}")}if(s.length){for(n("if(o.defaults){"),a=0;a<s.length;++a){var c=s[a],l=Qi.safeProp(c.name);if(c.resolvedType instanceof Tg)n("d%s=o.enums===String?%j:%j",l,c.resolvedType.valuesById[c.typeDefault],c.typeDefault);else if(c.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",c.typeDefault.low,c.typeDefault.high,c.typeDefault.unsigned)('d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!=="undefined"&&o.longs===BigInt?n.toBigInt():n',l)("}else")('d%s=o.longs===String?%j:typeof BigInt!=="undefined"&&o.longs===BigInt?BigInt(%j):%i',l,c.typeDefault.toString(),c.typeDefault.toString(),c.typeDefault.toNumber());else if(c.bytes){var u=Array.prototype.slice.call(c.typeDefault);n("if(o.bytes===String)d%s=%j",l,String.fromCharCode.apply(String,c.typeDefault))("else{")("d%s=%j",l,u)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",l,l)("}")}else n("d%s=%j",l,c.typeDefault)}n("}")}var d=!1;for(a=0;a<r.length;++a){var c=r[a],f=e._fieldsArray.indexOf(c),l=Qi.safeProp(c.name);c.map?(d||(d=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",l,l)("d%s={}",l)("for(var j=0;j<ks2.length;++j){"),n('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",l),jN(n,c,f,l+"[ks2[j]]")("}")):c.repeated?(n("if(m%s&&m%s.length){",l,l)("d%s=[]",l)("for(var j=0;j<m%s.length;++j){",l),jN(n,c,f,l+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",l,c.name),jN(n,c,f,l),c.partOf&&n("if(o.oneofs)")("d%s=%j",Qi.safeProp(c.partOf.name),c.name)),n("}")}return n("return d")}});var GN=v(kZ=>{"use strict";var ZAe=kZ,JAe=zT(),XAe=pi();ZAe[".google.protobuf.Any"]={fromObject:function(t,e){if(t&&t["@type"]){var r=t["@type"].substring(t["@type"].lastIndexOf("/")+1),n=this.lookup(r);if(n){var i=t["@type"].charAt(0)==="."?t["@type"].slice(1):t["@type"];return i.indexOf("/")===-1&&(i="/"+i),this.create({type_url:i,value:n.encode(n.fromObject(t,e===void 0?1:e+1)).finish()})}}return this.fromObject(t,e)},toObject:function(t,e,r){if(r===void 0&&(r=0),r>XAe.recursionLimit)throw Error("max depth exceeded");var n="type.googleapis.com/",i="",o="";if(e&&e.json&&t.type_url&&t.value){o=t.type_url.substring(t.type_url.lastIndexOf("/")+1),i=t.type_url.substring(0,t.type_url.lastIndexOf("/")+1);var s=this.lookup(o);s&&(t=s.decode(t.value,void 0,void 0,r+1))}if(!(t instanceof this.ctor)&&t instanceof JAe){var a=t.$type.toObject(t,e,r+1),c=t.$type.fullName[0]==="."?t.$type.fullName.slice(1):t.$type.fullName;return i===""&&(i=n),o=i+c,a["@type"]=o,a}return this.toObject(t,e,r)}}});var VT=v((Lct,DZ)=>{"use strict";DZ.exports=mt;var qn=Md();((mt.prototype=Object.create(qn.prototype)).constructor=mt).className="Type";var QAe=mi(),HN=hl(),GT=ga(),ewe=FT(),twe=jT(),qN=zT(),VN=$T(),rwe=DT(),lr=Jt(),nwe=WN(),iwe=LN(),owe=FN(),MZ=zN(),swe=GN();function mt(t,e){t=t.replace(/\W/g,""),qn.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(mt.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var r=this.fields[t[e]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=lr.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=lr.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=mt.generateConstructor(this)())},set:function(t){var e=t.prototype;e instanceof qN||((t.prototype=new qN).constructor=t,lr.merge(t.prototype,e)),t.$type=t.prototype.$type=this,lr.merge(t,qN,!0),this._ctor=t;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:lr.oneOfGetter(this._oneofsArray[r].oneof),set:lr.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(t.prototype,n)}}});mt.generateConstructor=function(e){for(var r=lr.codegen(["p"],e.name),n=0,i;n<e.fieldsArray.length;++n)(i=e._fieldsArray[n]).map?r("this%s={}",lr.safeProp(i.name)):i.repeated&&r("this%s=[]",lr.safeProp(i.name));return r('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")};function qT(t){return t._fieldsById=t._fieldsArray=t._oneofsArray=null,delete t.encode,delete t.decode,delete t.verify,t}mt.fromJSON=function(e,r,n){if(n===void 0&&(n=0),n>lr.nestingLimit)throw Error("max depth exceeded");var i=new mt(e,r.options);i.extensions=r.extensions,i.reserved=r.reserved;for(var o=Object.keys(r.fields),s=0;s<o.length;++s)i.add((typeof r.fields[o[s]].keyType<"u"?ewe.fromJSON:GT.fromJSON)(o[s],r.fields[o[s]]));if(r.oneofs)for(o=Object.keys(r.oneofs),s=0;s<o.length;++s)i.add(HN.fromJSON(o[s],r.oneofs[o[s]]));if(r.nested)for(o=Object.keys(r.nested),s=0;s<o.length;++s){var a=r.nested[o[s]];i.add((a.id!==void 0?GT.fromJSON:a.fields!==void 0?mt.fromJSON:a.values!==void 0?QAe.fromJSON:a.methods!==void 0?twe.fromJSON:qn.fromJSON)(o[s],a,n+1))}return r.extensions&&r.extensions.length&&(i.extensions=r.extensions),r.reserved&&r.reserved.length&&(i.reserved=r.reserved),r.group&&(i.group=!0),r.comment&&(i.comment=r.comment),r.edition&&(i._edition=r.edition),i._defaultEdition="proto3",i};mt.prototype.toJSON=function(e){var r=qn.prototype.toJSON.call(this,e),n=e?!!e.keepComments:!1;return lr.toObject(["edition",this._editionToJSON(),"options",r&&r.options||void 0,"oneofs",qn.arrayToJSON(this.oneofsArray,e),"fields",qn.arrayToJSON(this.fieldsArray.filter(function(i){return!i.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])};mt.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;qn.prototype.resolveAll.call(this);var e=this.oneofsArray;for(n=0;n<e.length;)e[n++].resolve();for(var r=this.fieldsArray,n=0;n<r.length;)r[n++].resolve();return this};mt.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,qn.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(r=>{r._resolveFeatures(e)}),this.fieldsArray.forEach(r=>{r._resolveFeatures(e)}),this):this};mt.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.fields,e)?this.fields[e]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,e)?this.oneofs[e]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};mt.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof GT&&e.extend===void 0){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),qT(this))}return e instanceof HN?e.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),qT(this)):qn.prototype.add.call(this,e)};mt.prototype.remove=function(e){if(e instanceof GT&&e.extend===void 0){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),qT(this)}if(e instanceof HN){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),qT(this)}return qn.prototype.remove.call(this,e)};mt.prototype.isReservedId=function(e){return qn.isReservedId(this.reserved,e)};mt.prototype.isReservedName=function(e){return qn.isReservedName(this.reserved,e)};mt.prototype.create=function(e){return new this.ctor(e)};mt.prototype.setup=function(){for(var e=this.fullName,r=[],n=0;n<this.fieldsArray.length;++n)r.push(this._fieldsArray[n].resolve().resolvedType);this.encode=nwe(this)({Writer:rwe,types:r,util:lr}),this.decode=iwe(this)({Reader:VN,types:r,util:lr}),this.verify=owe(this)({types:r,util:lr}),this.fromObject=MZ.fromObject(this)({types:r,util:lr}),this.toObject=MZ.toObject(this)({types:r,util:lr});var i=swe[e];if(i){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=i.fromObject.bind(o),o.toObject=this.toObject,this.toObject=i.toObject.bind(o)}return this};mt.prototype.encode=function(e,r){return this.setup().encode.apply(this,arguments)};mt.prototype.encodeDelimited=function(e,r){return this.encode(e,r&&r.len?r.fork():r).ldelim()};mt.prototype.decode=function(e,r,n,i){return this.setup().decode(e,r,n,i)};mt.prototype.decodeDelimited=function(e){return e instanceof VN||(e=VN.create(e)),this.decode(e,e.uint32())};mt.prototype.verify=function(e,r){return this.setup().verify(e,r)};mt.prototype.fromObject=function(e,r){return this.setup().fromObject(e,r)};mt.prototype.toObject=function(e,r){return this.setup().toObject.apply(this,arguments)};mt.d=function(e){return function(n){lr.decorateType(n,e)}}});var KT=v(($ct,UZ)=>{"use strict";UZ.exports=gn;var YT=Md();((gn.prototype=Object.create(YT.prototype)).constructor=gn).className="Root";var HT=ga(),YN=mi(),awe=hl(),eo=Jt(),KN,ZN,bg;function gn(t){YT.call(this,"",t),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}gn.fromJSON=function(e,r,n){return n=eo.checkDepth(n),r||(r=new gn),e.options&&r.setOptions(e.options),r.addJSON(e.nested,n).resolveAll()};gn.prototype.resolvePath=eo.path.resolve;gn.prototype.fetch=eo.fetch;function $Z(){}gn.prototype.load=function t(e,r,n){typeof r=="function"&&(n=r,r=void 0);var i=this;if(!n)return eo.asPromise(t,i,e,r);var o=n===$Z;function s(p,h){if(n){if(o)throw p;h&&h.resolveAll();var m=n;n=null,m(p,h)}}function a(p){var h=p.lastIndexOf("google/protobuf/");if(h>-1){var m=p.substring(h);if(m in bg)return m}return null}function c(p,h,m){m===void 0&&(m=0);try{if(m>eo.recursionLimit)throw Error("max depth exceeded");if(eo.isString(h)&&h.charAt(0)==="{"&&(h=JSON.parse(h)),!eo.isString(h))i.setOptions(h.options).addJSON(h.nested);else{ZN.filename=p;var y=ZN(h,i,r),S,b=0;if(y.imports)for(;b<y.imports.length;++b)(S=a(y.imports[b])||i.resolvePath(p,y.imports[b]))&&l(S,!1,m+1);if(y.weakImports)for(b=0;b<y.weakImports.length;++b)(S=a(y.weakImports[b])||i.resolvePath(p,y.weakImports[b]))&&l(S,!0,m+1)}}catch(w){s(w)}!o&&!u&&s(null,i)}function l(p,h,m){if(m===void 0&&(m=0),p=a(p)||p,!(i.files.indexOf(p)>-1)){if(i.files.push(p),p in bg){o?c(p,bg[p],m):(++u,setTimeout(function(){--u,c(p,bg[p],m)}));return}if(o){var y;try{y=eo.fs.readFileSync(p).toString("utf8")}catch(S){h||s(S);return}c(p,y,m)}else++u,i.fetch(p,function(S,b){if(--u,!!n){if(S){h?u||s(null,i):s(S);return}c(p,b,m)}})}}var u=0;eo.isString(e)&&(e=[e]);for(var d=0,f;d<e.length;++d)(f=i.resolvePath("",e[d]))&&l(f);return o?(i.resolveAll(),i):(u||s(null,i),i)};gn.prototype.loadSync=function(e,r){if(!eo.isNode)throw Error("not supported");return this.load(e,r,$Z)};gn.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return YT.prototype.resolveAll.call(this)};var WT=/^[A-Z]/;function LZ(t,e){var r=e.parent.lookup(e.extend);if(r){var n=new HT(e.fullName,e.id,e.type,e.rule,void 0,e.options);return r.get(n.name)||(n.declaringField=e,e.extensionField=n,r.add(n)),!0}return!1}gn.prototype._handleAdd=function(e){if(e instanceof HT)e.extend!==void 0&&!e.extensionField&&(LZ(this,e)||this.deferred.push(e));else if(e instanceof YN)WT.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof awe)){if(e instanceof KN)for(var r=0;r<this.deferred.length;)LZ(this,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);WT.test(e.name)&&(e.parent[e.name]=e)}(e instanceof KN||e instanceof YN||e instanceof HT)&&(this._fullyQualifiedObjects[e.fullName]=e)};gn.prototype._handleRemove=function(e){if(e instanceof HT){if(e.extend!==void 0)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var r=this.deferred.indexOf(e);r>-1&&this.deferred.splice(r,1)}}else if(e instanceof YN)WT.test(e.name)&&delete e.parent[e.name];else if(e instanceof YT){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);WT.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]};gn._configure=function(t,e,r){KN=t,ZN=e,bg=r}});var Jt=v((Uct,jZ)=>{"use strict";var St=jZ.exports=pi(),FZ=xN(),JN,XN;St.codegen=cZ();St.fetch=fZ();St.path=mZ();St.patterns=_Z();var BZ=St.patterns.reservedRe;St.fs=SZ();St.checkDepth=function(e){if(e===void 0&&(e=0),e>St.recursionLimit)throw Error("max depth exceeded");return e};St.toArray=function(e){if(e){for(var r=Object.keys(e),n=new Array(r.length),i=0;i<r.length;)n[i]=e[r[i++]];return n}return[]};St.toObject=function(e){for(var r={},n=0;n<e.length;){var i=e[n++],o=e[n++];o!==void 0&&(r[i]=o)}return r};St.isReserved=function(e){return BZ.test(e)};St.safeProp=function(e){return!/^[$\w_]+$/.test(e)||BZ.test(e)?"["+JSON.stringify(e)+"]":"."+e};St.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var cwe=/_([a-z])/g;St.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(cwe,function(r,n){return n.toUpperCase()})};St.compareFieldsById=function(e,r){return e.id-r.id};St.decorateType=function(e,r){if(e.$type)return r&&e.$type.name!==r&&(St.decorateRoot.remove(e.$type),e.$type.name=r,St.decorateRoot.add(e.$type)),e.$type;JN||(JN=VT());var n=new JN(r||e.name);return St.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var lwe=0;St.decorateEnum=function(e){if(e.$type)return e.$type;XN||(XN=mi());var r=new XN("Enum"+lwe++,e);return St.decorateRoot.add(r),Object.defineProperty(e,"$type",{value:r,enumerable:!1}),r};St.setProperty=function(e,r,n,i){function o(s,a,c){var l=a.shift();if(St.isUnsafeProperty(l))return s;if(a.length>0)s[l]=o(s[l]||{},a,c);else{var u=s[l];if(u&&i)return s;u&&(c=[].concat(u).concat(c)),s[l]=c}return s}if(typeof e!="object")throw TypeError("dst must be an object");if(!r)throw TypeError("path must be specified");if(r=r.split("."),r.length>St.recursionLimit)throw Error("max depth exceeded");return o(e,r,n)};Object.defineProperty(St,"decorateRoot",{get:function(){return FZ.decorated||(FZ.decorated=new(KT()))}})});var ml=v(zZ=>{"use strict";var Ag=zZ,uwe=Jt(),dwe=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function wg(t,e){var r=0,n=Object.create(null);for(e|=0;r<t.length;)n[dwe[r+e]]=t[r++];return n}Ag.basic=wg([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);Ag.defaults=wg([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",uwe.emptyArray,null]);Ag.long=wg([0,0,0,1,1],7);Ag.mapKey=wg([0,0,0,5,5,0,0,0,1,1,0,2],2);Ag.packed=wg([1,5,0,0,0,5,5,0,0,0,1,1,0])});var ga=v((Bct,qZ)=>{"use strict";qZ.exports=Xt;var Rg=_a();((Xt.prototype=Object.create(Rg.prototype)).constructor=Xt).className="Field";var GZ=mi(),QN=ml(),$t=Jt(),xg,fwe=/^required|optional|repeated$/;Xt.fromJSON=function(e,r){var n=new Xt(e,r.id,r.type,r.rule,r.extend,r.options,r.comment);return r.edition&&(n._edition=r.edition),n._defaultEdition="proto3",n};function Xt(t,e,r,n,i,o,s){if($t.isObject(n)?(s=i,o=n,n=i=void 0):$t.isObject(i)&&(s=o,o=i,i=void 0),Rg.call(this,t,o),!$t.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!$t.isString(r))throw TypeError("type must be a string");if(n!==void 0&&!fwe.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(i!==void 0&&!$t.isString(i))throw TypeError("extend must be a string");n==="proto3_optional"&&(n="optional"),this.rule=n&&n!=="optional"?n:void 0,this.type=r,this.id=e,this.extend=i||void 0,this.repeated=n==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=$t.Long?QN.long[r]!==void 0:!1,this.bytes=r==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=s}Object.defineProperty(Xt.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(Xt.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(Xt.prototype,"delimited",{get:function(){return this.resolvedType instanceof xg&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(Xt.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(Xt.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});Xt.prototype.setOption=function(e,r,n){return Rg.prototype.setOption.call(this,e,r,n)};Xt.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return $t.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",r?this.comment:void 0])};Xt.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=QN.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof xg?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof GZ&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof GZ)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=$t.Long.fromNumber(this.typeDefault,this.type==="uint64"||this.type==="fixed64"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var e;$t.base64.test(this.typeDefault)?$t.base64.decode(this.typeDefault,e=$t.newBuffer($t.base64.length(this.typeDefault)),0):$t.utf8.write(this.typeDefault,e=$t.newBuffer($t.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=$t.emptyObject:this.repeated?this.defaultValue=$t.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof xg&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Rg.prototype.resolve.call(this)};Xt.prototype._inferLegacyProtoFeatures=function(e){if(e!=="proto2"&&e!=="proto3")return{};var r={};if(this.rule==="required"&&(r.field_presence="LEGACY_REQUIRED"),this.parent&&QN.defaults[this.type]===void 0){var n=this.parent.get(this.type.split(".").pop());n&&n instanceof xg&&n.group&&(r.message_encoding="DELIMITED")}return this.getOption("packed")===!0?r.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(r.repeated_field_encoding="EXPANDED"),r};Xt.prototype._resolveFeatures=function(e){return Rg.prototype._resolveFeatures.call(this,this._edition||e)};Xt.d=function(e,r,n,i){return typeof r=="function"?r=$t.decorateType(r).name:r&&typeof r=="object"&&(r=$t.decorateEnum(r).name),function(s,a){$t.decorateType(s.constructor).add(new Xt(a,e,r,n,{default:i}))}};Xt._configure=function(e){xg=e}});var hl=v((jct,WZ)=>{"use strict";WZ.exports=_n;var JT=_a();((_n.prototype=Object.create(JT.prototype)).constructor=_n).className="OneOf";var VZ=ga(),ZT=Jt();function _n(t,e,r,n){if(Array.isArray(e)||(r=e,e=void 0),JT.call(this,t,r),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=n}_n.fromJSON=function(e,r){return new _n(e,r.oneof,r.options,r.comment)};_n.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return ZT.toObject(["options",this.options,"oneof",this.oneof,"comment",r?this.comment:void 0])};function HZ(t){if(t.parent)for(var e=0;e<t.fieldsArray.length;++e)t.fieldsArray[e].parent||t.parent.add(t.fieldsArray[e])}_n.prototype.add=function(e){if(!(e instanceof VZ))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,HZ(this),this};_n.prototype.remove=function(e){if(!(e instanceof VZ))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),r=this.oneof.indexOf(e.name),r>-1&&this.oneof.splice(r,1),e.partOf=null,this};_n.prototype.onAdd=function(e){JT.prototype.onAdd.call(this,e);for(var r=this,n=0;n<this.oneof.length;++n){var i=e.get(this.oneof[n]);i&&!i.partOf&&(i.partOf=r,r.fieldsArray.push(i))}HZ(this)};_n.prototype.onRemove=function(e){for(var r=0,n;r<this.fieldsArray.length;++r)(n=this.fieldsArray[r]).parent&&n.parent.remove(n);JT.prototype.onRemove.call(this,e)};Object.defineProperty(_n.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var t=this.fieldsArray[0];return t.options!=null&&t.options.proto3_optional===!0}});_n.d=function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;)e[r]=arguments[r++];return function(i,o){ZT.decorateType(i.constructor).add(new _n(o,e)),Object.defineProperty(i,o,{get:ZT.oneOfGetter(e),set:ZT.oneOfSetter(e)})}}});var _a=v((zct,YZ)=>{"use strict";YZ.exports=ur;ur.className="ReflectionObject";var pwe=hl(),gi=Jt(),XT,hwe={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},mwe={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},gwe={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function ur(t,e){if(!gi.isString(t))throw TypeError("name must be a string");if(e&&!gi.isObject(e))throw TypeError("options must be an object");this.options=e,this.parsedOptions=null,this.name=t,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(ur.prototype,{root:{get:function(){for(var t=this;t.parent!==null;)t=t.parent;return t}},fullName:{get:function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}});ur.prototype.toJSON=function(){throw Error()};ur.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var r=e.root;r instanceof XT&&r._handleAdd(this)};ur.prototype.onRemove=function(e){var r=e.root;r instanceof XT&&r._handleRemove(this),this.parent=null,this.resolved=!1};ur.prototype.resolve=function(){return this.resolved?this:(this.root instanceof XT&&(this.resolved=!0),this)};ur.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)};ur.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var r={};if(!e)throw new Error("Unknown edition for "+this.fullName);var n=gi.merge({},this.options&&this.options.features,this._inferLegacyProtoFeatures(e));if(this._edition){if(e==="proto2")r=Object.assign({},mwe);else if(e==="proto3")r=Object.assign({},gwe);else if(e==="2023")r=Object.assign({},hwe);else throw new Error("Unknown edition: "+e);this._features=gi.merge(r,n),this._featuresResolved=!0;return}if(this.partOf instanceof pwe){var i=gi.merge({},this.partOf._features);this._features=gi.merge(i,n)}else if(!this.declaringField)if(this.parent){var o=gi.merge({},this.parent._features);this._features=gi.merge(o,n)}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}};ur.prototype._inferLegacyProtoFeatures=function(){return{}};ur.prototype.getOption=function(e){if(this.options)return this.options[e]};ur.prototype.setOption=function(e,r,n){return e==="__proto__"?this:(this.options||(this.options={}),/^features\./.test(e)?gi.setProperty(this.options,e,r,n):(!n||this.options[e]===void 0)&&(this.getOption(e)!==r&&(this.resolved=!1),this.options[e]=r),this)};ur.prototype.setParsedOption=function(e,r,n){if(e==="__proto__")return this;this.parsedOptions||(this.parsedOptions=[]);var i=this.parsedOptions;if(n){var o=i.find(function(c){return Object.prototype.hasOwnProperty.call(c,e)});if(o){var s=o[e];gi.setProperty(s,n,r)}else o={},o[e]=gi.setProperty({},n,r),i.push(o)}else{var a={};a[e]=r,i.push(a)}return this};ur.prototype.setOptions=function(e,r){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)this.setOption(n[i],e[n[i]],r);return this};ur.prototype.toString=function(){var e=this.constructor.className,r=this.fullName;return r.length?e+" "+r:e};ur.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition};ur._configure=function(t){XT=t}});var mi=v((Gct,ZZ)=>{"use strict";ZZ.exports=_i;var ek=_a();((_i.prototype=Object.create(ek.prototype)).constructor=_i).className="Enum";var KZ=Md(),$d=Jt();function _i(t,e,r,n,i,o){if(ek.call(this,t,r),e&&typeof e!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=i||{},this.valuesOptions=o,this._valuesFeatures={},this.reserved=void 0,e)for(var s=Object.keys(e),a=0;a<s.length;++a)s[a]!=="__proto__"&&typeof e[s[a]]=="number"&&(this.valuesById[this.values[s[a]]=e[s[a]]]=s[a])}_i.prototype._resolveFeatures=function(e){return e=this._edition||e,ek.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(r=>{var n=$d.merge({},this._features);this._valuesFeatures[r]=$d.merge(n,this.valuesOptions&&this.valuesOptions[r]&&this.valuesOptions[r].features||{})}),this};_i.fromJSON=function(e,r){var n=new _i(e,r.values,r.options,r.comment,r.comments);return n.reserved=r.reserved,r.edition&&(n._edition=r.edition),n._defaultEdition="proto3",n};_i.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return $d.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",r?this.comment:void 0,"comments",r?this.comments:void 0])};_i.prototype.add=function(e,r,n,i){if(!$d.isString(e))throw TypeError("name must be a string");if(!$d.isInteger(r))throw TypeError("id must be an integer");if(e==="__proto__")return this;if(this.values[e]!==void 0)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(r))throw Error("id "+r+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[r]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+r+" in "+this);this.values[e]=r}else this.valuesById[this.values[e]=r]=e;return i&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[e]=i||null),this.comments[e]=n||null,this};_i.prototype.remove=function(e){if(!$d.isString(e))throw TypeError("name must be a string");var r=this.values[e];if(r==null)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[r],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this};_i.prototype.isReservedId=function(e){return KZ.isReservedId(this.reserved,e)};_i.prototype.isReservedName=function(e){return KZ.isReservedName(this.reserved,e)}});var WN=v((qct,XZ)=>{"use strict";XZ.exports=ywe;var _we=mi(),tk=ml(),rk=Jt();function JZ(t,e,r,n){return e.delimited?t("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)",r,n,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()",r,n,(e.id<<3|2)>>>0)}function ywe(t){for(var e=rk.codegen(["m","w","q"],t.name+"$encode")("if(!w)")("w=Writer.create()")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")'),r,n,i=t.fieldsArray.slice().sort(rk.compareFieldsById),r=0;r<i.length;++r){var o=i[r].resolve(),s=t._fieldsArray.indexOf(o),a=o.resolvedType instanceof _we?"int32":o.type,c=tk.basic[a];n="m"+rk.safeProp(o.name),o.map?(e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",n,o.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",n)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(o.id<<3|2)>>>0,8|tk.mapKey[o.keyType],o.keyType),c===void 0?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()",s,n):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|c,a,n),e("}")("}")):o.repeated?(e("if(%s!=null&&%s.length){",n,n),o.packed&&tk.packed[a]!==void 0?e("w.uint32(%i).fork()",(o.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",n)("w.%s(%s[i])",a,n)("w.ldelim()"):(e("for(var i=0;i<%s.length;++i)",n),c===void 0?JZ(e,o,s,n+"[i]"):e("w.uint32(%i).%s(%s[i])",(o.id<<3|c)>>>0,a,n)),e("}")):(o.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",n,o.name),c===void 0?JZ(e,o,s,n):e("w.uint32(%i).%s(%s)",(o.id<<3|c)>>>0,a,n))}return e("return w")}});var e5=v((Vct,QZ)=>{"use strict";var Je=QZ.exports=sZ();Je.build="light";function Swe(t,e,r){return typeof e=="function"?(r=e,e=new Je.Root):e||(e=new Je.Root),e.load(t,r)}Je.load=Swe;function Ewe(t,e){return e||(e=new Je.Root),e.loadSync(t)}Je.loadSync=Ewe;Je.encoder=WN();Je.decoder=LN();Je.verifier=FN();Je.converter=zN();Je.ReflectionObject=_a();Je.Namespace=Md();Je.Root=KT();Je.Enum=mi();Je.Type=VT();Je.Field=ga();Je.OneOf=hl();Je.MapField=FT();Je.Service=jT();Je.Method=BT();Je.Message=zT();Je.wrappers=GN();Je.types=ml();Je.util=Jt();Je.ReflectionObject._configure(Je.Root);Je.Namespace._configure(Je.Type,Je.Service,Je.Enum);Je.Root._configure(Je.Type);Je.Field._configure(Je.Type)});var ik=v((Hct,n5)=>{"use strict";n5.exports=r5;var nk=/[\s{}=;:[\],'"()<>]/g,vwe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,Twe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,bwe=/^ *[*/]+ */,Awe=/^\s*\*?\/*/,wwe=/\n/g,xwe=/\s/,Rwe=/\\(.?)/g,Cwe={0:"\0",r:"\r",n:`
@@ -13,15 +13,15 @@ ${e}`;return Object.assign(new Error(r),t,{stack:i})}var zO=class extends gbe.Ev
13
13
  `;)C++;return C}function m(){if(a.length>0)return a.shift();if(c)return u();var T,C,O,k,P,M=r===0;do{if(r===n)return null;for(T=!1;xwe.test(O=d(r));)if(O===`
14
14
  `&&(M=!0,++i),++r===n)return null;if(d(r)==="/"){if(++r===n)throw l("comment");if(d(r)==="/")if(e){if(k=r,P=!1,p(r-1)){P=!0;do if(r=h(r),r===n||(r++,!M))break;while(p(r))}else r=Math.min(n,h(r)+1);P&&(f(k,r,M),M=!0),i++,T=!0}else{for(P=d(k=r+1)==="/";d(++r)!==`
15
15
  `;)if(r===n)return null;++r,P&&(f(k,r-1,M),M=!0),++i,T=!0}else if((O=d(r))==="*"){k=r+1,P=e||d(k)==="*";do{if(O===`
16
- `&&++i,++r===n)throw l("comment");C=O,O=d(r)}while(C!=="*"||O!=="/");++r,P&&(f(k,r-2,M),M=!0),T=!0}else return"/"}}while(T);var F=r;nk.lastIndex=0;var _=nk.test(d(F++));if(!_)for(;F<n&&!nk.test(d(F));)++F;var re=t.substring(r,r=F);return(re==='"'||re==="'")&&(c=re),re}function y(T){a.push(T)}function S(){if(!a.length){var T=m();if(T===null)return null;y(T)}return a[0]}function b(T,C){var O=S(),k=O===T;if(k)return m(),!0;if(!C)throw l("token '"+O+"', '"+T+"' expected");return!1}function w(T){var C=null,O;return T===void 0?(O=s[i-1],delete s[i-1],O&&(e||O.type==="*"||O.lineEmpty)&&(C=O.leading?O.text:null)):(o<T&&S(),O=s[T],delete s[T],O&&!O.lineEmpty&&(e||O.type==="/")&&(C=O.leading?null:O.text)),C}return Object.defineProperty({next:m,peek:S,push:y,skip:b,cmnt:w},"line",{get:function(){return i}})}});var l5=v((Wct,c5)=>{"use strict";c5.exports=is;is.filename=null;is.defaults={keepCase:!1};var Iwe=ik(),i5=KT(),o5=VT(),s5=ga(),Pwe=FT(),a5=hl(),Owe=mi(),Nwe=jT(),kwe=BT(),Mwe=_a(),Dwe=ml(),ns=Jt(),Lwe=/^[1-9][0-9]*$/,$we=/^-?[1-9][0-9]*$/,Uwe=/^0[x][0-9a-fA-F]+$/,Fwe=/^-?0[x][0-9a-fA-F]+$/,Bwe=/^0[0-7]+$/,jwe=/^-?0[0-7]+$/,zwe=ns.patterns.numberRe,to=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ro=ns.patterns.typeRefRe;function is(t,e,r){e instanceof i5||(r=e,e=new i5),r||(r=is.defaults);var n=r.preferTrailingComment||!1,i=Iwe(t,r.alternateCommentMode||!1),o=i.next,s=i.push,a=i.peek,c=i.skip,l=i.cmnt,u=!0,d,f,p,h="proto2",m=e,y=[],S={},b=r.keepCase?function(I){return I}:ns.camelCase;function w(){y.forEach(I=>{I._edition=h,Object.keys(S).forEach(U=>{I.getOption(U)===void 0&&I.setOption(U,S[U],!0)})})}function T(I,U,j){var q=is.filename;return j||(is.filename=null),Error("illegal "+(U||"token")+" '"+I+"' ("+(q?q+", ":"")+"line "+i.line+")")}function C(){var I=[],U;do{if((U=o())!=='"'&&U!=="'")throw T(U);I.push(o()),c(U),U=a()}while(U==='"'||U==="'");return I.join("")}function O(I){var U=o();switch(U){case"'":case'"':return s(U),C();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return P(U,!0)}catch{if(I&&ro.test(U))return U;throw T(U,"value")}}function k(I,U){var j,q;do if(U&&((j=a())==='"'||j==="'")){var ee=C();if(I.push(ee),h>=2023)throw T(ee,"id")}else try{I.push([q=M(o()),c("to",!0)?M(o()):q])}catch(Te){if(U&&ro.test(j)&&h>=2023)I.push(j);else throw Te}while(c(",",!0));var se={options:void 0};se.setOption=function(Te,Ye){this.options===void 0&&(this.options={}),this.options[Te]=Ye},E(se,function(Ye){if(Ye==="option")xe(se,Ye),c(";");else throw T(Ye)},function(){_e(se)})}function P(I,U){var j=1;switch(I.charAt(0)==="-"&&(j=-1,I=I.substring(1)),I){case"inf":case"INF":case"Inf":return j*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(Lwe.test(I))return j*parseInt(I,10);if(Uwe.test(I))return j*parseInt(I,16);if(Bwe.test(I))return j*parseInt(I,8);if(zwe.test(I))return j*parseFloat(I);throw T(I,"number",U)}function M(I,U){switch(I){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!U&&I.charAt(0)==="-")throw T(I,"id");if($we.test(I))return parseInt(I,10);if(Fwe.test(I))return parseInt(I,16);if(jwe.test(I))return parseInt(I,8);throw T(I,"id")}function F(){if(d!==void 0)throw T("package");if(d=o(),!ro.test(d))throw T(d,"name");m=m.define(d),c(";")}function _(){var I=a(),U;switch(I){case"weak":U=p||(p=[]),o();break;case"public":o();default:U=f||(f=[]);break}I=C(),c(";"),U.push(I)}function re(){if(c("="),h=C(),h<2023)throw T(h,"syntax");c(";")}function N(){if(c("="),h=C(),!["2023"].includes(h))throw T(h,"edition");c(";")}function g(I,U,j){switch(j===void 0&&(j=0),U){case"option":return xe(I,U),c(";"),!0;case"message":return x(I,U,j+1),!0;case"enum":return Ie(I,U),!0;case"service":return qe(I,U,j+1),!0;case"extend":return le(I,U,j),!0}return!1}function E(I,U,j){var q=i.line;if(I&&(typeof I.comment!="string"&&(I.comment=l()),I.filename=is.filename),c("{",!0)){for(var ee;(ee=o())!=="}";)U(ee);c(";",!0)}else j&&j(),c(";"),I&&(typeof I.comment!="string"||n)&&(I.comment=l(q)||I.comment)}function x(I,U,j){if(j===void 0&&(j=0),j>ns.nestingLimit)throw Error("max depth exceeded");if(!to.test(U=o()))throw T(U,"type name");var q=new o5(U);E(q,function(se){if(!g(q,se,j))switch(se){case"map":fe(q,se);break;case"required":if(h!=="proto2")throw T(se);case"repeated":Y(q,se,void 0,j+1);break;case"optional":if(h==="proto3")Y(q,"proto3_optional",void 0,j+1);else{if(h!=="proto2")throw T(se);Y(q,"optional",void 0,j+1)}break;case"oneof":$e(q,se,j+1);break;case"extensions":k(q.extensions||(q.extensions=[]));break;case"reserved":k(q.reserved||(q.reserved=[]),!0);break;default:if(h==="proto2"||!ro.test(se))throw T(se);s(se),Y(q,"optional",void 0,j+1);break}}),I.add(q),I===m&&y.push(q)}function Y(I,U,j,q){var ee=o();if(ee==="group"){G(I,U,q);return}for(;ee.endsWith(".")||a().startsWith(".");)ee+=o();if(!ro.test(ee))throw T(ee,"type");var se=o();if(!to.test(se))throw T(se,"name");se=b(se),c("=");var Te=new s5(se,M(o()),ee,U,j);if(E(Te,function(Ee){if(Ee==="option")xe(Te,Ee),c(";");else throw T(Ee)},function(){_e(Te)}),U==="proto3_optional"){var Ye=new a5("_"+se);Te.setOption("proto3_optional",!0),Ye.add(Te),I.add(Ye)}else I.add(Te);I===m&&y.push(Te)}function G(I,U,j){if(j===void 0&&(j=0),j>ns.nestingLimit)throw Error("max depth exceeded");if(h>=2023)throw T("group");var q=o();if(!to.test(q))throw T(q,"name");var ee=ns.lcFirst(q);q===ee&&(q=ns.ucFirst(q)),c("=");var se=M(o()),Te=new o5(q);Te.group=!0;var Ye=new s5(ee,se,q,U);Ye.filename=is.filename,E(Te,function(Ee){switch(Ee){case"option":xe(Te,Ee),c(";");break;case"required":case"repeated":Y(Te,Ee,void 0,j+1);break;case"optional":h==="proto3"?Y(Te,"proto3_optional",void 0,j+1):Y(Te,"optional",void 0,j+1);break;case"message":x(Te,Ee,j+1);break;case"enum":Ie(Te,Ee);break;case"reserved":k(Te.reserved||(Te.reserved=[]),!0);break;default:throw T(Ee)}}),I.add(Te).add(Ye)}function fe(I){c("<");var U=o();if(Dwe.mapKey[U]===void 0)throw T(U,"type");c(",");var j=o();if(!ro.test(j))throw T(j,"type");c(">");var q=o();if(!to.test(q))throw T(q,"name");c("=");var ee=new Pwe(b(q),M(o()),U,j);E(ee,function(Te){if(Te==="option")xe(ee,Te),c(";");else throw T(Te)},function(){_e(ee)}),I.add(ee)}function $e(I,U,j){if(!to.test(U=o()))throw T(U,"name");var q=new a5(b(U));E(q,function(se){se==="option"?(xe(q,se),c(";")):(s(se),Y(q,"optional",void 0,j))}),I.add(q)}function Ie(I,U){if(!to.test(U=o()))throw T(U,"name");var j=new Owe(U);E(j,function(ee){switch(ee){case"option":xe(j,ee),c(";");break;case"reserved":k(j.reserved||(j.reserved=[]),!0),j.reserved===void 0&&(j.reserved=[]);break;default:Pe(j,ee)}}),I.add(j),I===m&&y.push(j)}function Pe(I,U){if(!to.test(U))throw T(U,"name");c("=");var j=M(o(),!0),q={options:void 0};q.getOption=function(ee){return this.options[ee]},q.setOption=function(ee,se){Mwe.prototype.setOption.call(q,ee,se)},q.setParsedOption=function(){},E(q,function(se){if(se==="option")xe(q,se),c(";");else throw T(se)},function(){_e(q)}),I.add(U,j,q.comment,q.parsedOptions||q.options)}function xe(I,U){var j,q,ee=!0;for(U==="option"&&(U=o());U!=="=";){if(U==="("){var se=o();c(")"),U="("+se+")"}if(ee){if(ee=!1,U.includes(".")&&!U.includes("(")){var Te=U.split(".");j=Te[0]+".",U=Te[1];continue}j=U}else q=q?q+=U:U;U=o()}var Ye=q?j.concat(q):j,Oe=Fe(I,Ye);q=q&&q[0]==="."?q.slice(1):q,j=j&&j[j.length-1]==="."?j.slice(0,-1):j,ce(I,j,Oe,q)}function Fe(I,U,j){if(j===void 0&&(j=0),j>ns.recursionLimit)throw Error("max depth exceeded");if(c("{",!0)){for(var q={};!c("}",!0);){if(!to.test(R=o()))throw T(R,"name");if(R===null)throw T(R,"end of input");var ee,se=R;if(c(":",!0),a()==="{")ee=Fe(I,U+"."+R,j+1);else if(a()==="["){ee=[];var Te;if(c("[",!0)){do Te=O(!0),ee.push(Te);while(c(",",!0));c("]"),typeof Te<"u"&&Re(I,U+"."+R,Te)}}else ee=O(!0),Re(I,U+"."+R,ee);var Ye=q[se];Ye&&(ee=[].concat(Ye).concat(ee)),se!=="__proto__"&&(q[se]=ee),c(",",!0),c(";",!0)}return q}var Oe=O(!0);return Re(I,U,Oe),Oe}function Re(I,U,j){if(m===I&&/^features\./.test(U)){S[U]=j;return}I.setOption&&I.setOption(U,j)}function ce(I,U,j,q){I.setParsedOption&&I.setParsedOption(U,j,q)}function _e(I){if(c("[",!0)){do xe(I,"option");while(c(",",!0));c("]")}return I}function qe(I,U,j){if(j===void 0&&(j=0),j>ns.recursionLimit)throw Error("max depth exceeded");if(!to.test(U=o()))throw T(U,"service name");var q=new Nwe(U);E(q,function(se){if(!g(q,se,j))if(se==="rpc")H(q,se);else throw T(se)}),I.add(q),I===m&&y.push(q)}function H(I,U){var j=l(),q=U;if(!to.test(U=o()))throw T(U,"name");var ee=U,se,Te,Ye,Oe;if(c("("),c("stream",!0)&&(Te=!0),!ro.test(U=o())||(se=U,c(")"),c("returns"),c("("),c("stream",!0)&&(Oe=!0),!ro.test(U=o())))throw T(U);Ye=U,c(")");var Ee=new kwe(ee,q,se,Ye,Te,Oe);Ee.comment=j,E(Ee,function(ye){if(ye==="option")xe(Ee,ye),c(";");else throw T(ye)}),I.add(Ee)}function le(I,U,j){if(!ro.test(U=o()))throw T(U,"reference");var q=U;E(null,function(se){switch(se){case"required":case"repeated":Y(I,se,q,j+1);break;case"optional":h==="proto3"?Y(I,"proto3_optional",q,j+1):Y(I,"optional",q,j+1);break;default:if(h==="proto2"||!ro.test(se))throw T(se);s(se),Y(I,"optional",q,j+1);break}})}for(var R;(R=o())!==null;)switch(R){case"package":if(!u)throw T(R);F();break;case"import":if(!u)throw T(R);_();break;case"syntax":if(!u)throw T(R);re();break;case"edition":if(!u)throw T(R);N();break;case"option":xe(m,R),c(";",!0);break;default:if(g(m,R,0)){u=!1;continue}throw T(R)}return w(),is.filename=null,{package:d,imports:f,weakImports:p,root:e}}});var f5=v((Yct,d5)=>{"use strict";d5.exports=yi;var Gwe=/\/|\./;function yi(t,e){Gwe.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),yi[t]=e}yi("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var u5;yi("duration",{Duration:u5={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});yi("timestamp",{Timestamp:u5});yi("empty",{Empty:{fields:{}}});yi("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});yi("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});yi("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});yi.get=function(e){return yi[e]||null}});var h5=v((Kct,p5)=>{"use strict";var ya=p5.exports=e5();ya.build="full";ya.tokenize=ik();ya.parse=l5();ya.common=f5();ya.Root._configure(ya.Type,ya.parse,ya.common)});var QT=v((Zct,m5)=>{"use strict";m5.exports=h5()});var ok=v((Jct,qwe)=>{qwe.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1e3,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1e3,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536e6,536e6]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var b5=v((Ge,T5)=>{"use strict";var $r=QT();T5.exports=Ge=$r.descriptor=$r.Root.fromJSON(ok()).lookup(".google.protobuf");var g5=$r.Namespace,Cg=$r.Root,os=$r.Enum,Si=$r.Type,Sa=$r.Field,Vwe=$r.MapField,eb=$r.OneOf,Ig=$r.Service,tb=$r.Method,_5=$r.util.patterns,Hwe=_5.numberRe,rb=_5.typeRefRe;Cg.fromDescriptor=function(e){typeof e.length=="number"&&(e=Ge.FileDescriptorSet.decode(e));var r=new Cg;if(e.file)for(var n,i,o=0,s;o<e.file.length;++o){i=r,(n=e.file[o]).package&&n.package.length&&(i=r.define(n.package));var a=txe(n);if(n.name&&n.name.length&&r.files.push(i.filename=n.name),n.messageType)for(s=0;s<n.messageType.length;++s)i.add(Si.fromDescriptor(n.messageType[s],a));if(n.enumType)for(s=0;s<n.enumType.length;++s)i.add(os.fromDescriptor(n.enumType[s],a));if(n.extension)for(s=0;s<n.extension.length;++s)i.add(Sa.fromDescriptor(n.extension[s],a));if(n.service)for(s=0;s<n.service.length;++s)i.add(Ig.fromDescriptor(n.service[s],a));var c=Ud(n.options,Ge.FileOptions);if(c){var l=Object.keys(c);for(s=0;s<l.length;++s)i.setOption(l[s],c[l[s]])}}return r.resolveAll()};Cg.prototype.toDescriptor=function(e){var r=Ge.FileDescriptorSet.create();return y5(this,r.file,e),r};function y5(t,e,r){var n=Ge.FileDescriptorProto.create({name:t.filename||(t.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});rxe(r,n),t instanceof Cg||(n.package=t.fullName.substring(1));for(var i=0,o;i<t.nestedArray.length;++i)(o=t._nestedArray[i])instanceof Si?n.messageType.push(o.toDescriptor(r)):o instanceof os?n.enumType.push(o.toDescriptor()):o instanceof Sa?n.extension.push(o.toDescriptor(r)):o instanceof Ig?n.service.push(o.toDescriptor()):o instanceof g5&&y5(o,e,r);n.options=Fd(t.options,Ge.FileOptions),n.messageType.length+n.enumType.length+n.extension.length+n.service.length&&e.push(n)}var Wwe=0;Si.fromDescriptor=function(e,r,n,i){if(i===void 0&&(i=0),i>$r.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=Ge.DescriptorProto.decode(e));var o=new Si(e.name.length?e.name:"Type"+Wwe++,Ud(e.options,Ge.MessageOptions)),s;if(n||(o._edition=r),e.oneofDecl)for(s=0;s<e.oneofDecl.length;++s)o.add(eb.fromDescriptor(e.oneofDecl[s]));if(e.field)for(s=0;s<e.field.length;++s){var a=Sa.fromDescriptor(e.field[s],r,!0);o.add(a),e.field[s].hasOwnProperty("oneofIndex")&&o.oneofsArray[e.field[s].oneofIndex].add(a)}if(e.extension)for(s=0;s<e.extension.length;++s)o.add(Sa.fromDescriptor(e.extension[s],r,!0));if(e.nestedType)for(s=0;s<e.nestedType.length;++s)o.add(Si.fromDescriptor(e.nestedType[s],r,!0,i+1)),e.nestedType[s].options&&e.nestedType[s].options.mapEntry&&o.setOption("map_entry",!0);if(e.enumType)for(s=0;s<e.enumType.length;++s)o.add(os.fromDescriptor(e.enumType[s],r,!0));if(e.extensionRange&&e.extensionRange.length)for(o.extensions=[],s=0;s<e.extensionRange.length;++s)o.extensions.push([e.extensionRange[s].start,e.extensionRange[s].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(o.reserved=[],e.reservedRange)for(s=0;s<e.reservedRange.length;++s)o.reserved.push([e.reservedRange[s].start,e.reservedRange[s].end]);if(e.reservedName)for(s=0;s<e.reservedName.length;++s)o.reserved.push(e.reservedName[s])}return o};Si.prototype.toDescriptor=function(e){var r=Ge.DescriptorProto.create({name:this.name}),n;for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof Vwe){var o=sk(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),s=sk(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),a=s===11||s===14?this._fieldsArray[n].resolvedType&&v5(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(Ge.DescriptorProto.create({name:i.typeName,field:[Ge.FieldDescriptorProto.create({name:"key",number:1,label:1,type:o}),Ge.FieldDescriptorProto.create({name:"value",number:2,label:1,type:s,typeName:a})],options:Ge.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof Sa?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof Si?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof os&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(Ge.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)typeof this.reserved[n]=="string"?r.reservedName.push(this.reserved[n]):r.reservedRange.push(Ge.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=Fd(this.options,Ge.MessageOptions),r};Sa.fromDescriptor=function(e,r,n){if(typeof e.length=="number"&&(e=Ge.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var i=e.typeName,o;if(i!=null&&i!==""){if(typeof i!="string"||!rb.test(i))throw Error("illegal type name: "+i);o=i}else o=Xwe(e.type);var s;switch(e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var a=e.extendee;if(a!=null&&a!==""){if(typeof a!="string"||!rb.test(a))throw Error("illegal type name: "+a)}else a=void 0;var c=new Sa(e.name.length?e.name:"field"+e.number,e.number,o,s,a);if(n||(c._edition=r),c.options=Ud(e.options,Ge.FieldOptions),e.proto3_optional&&(c.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:var u=Hwe.exec(l);u&&(l=parseInt(l));break}c.setOption("default",l)}return Qwe(e.type)&&(r==="proto3"?e.options&&!e.options.packed&&c.setOption("packed",!1):(!r||r==="proto2")&&e.options&&e.options.packed&&c.setOption("packed",!0)),c};Sa.prototype.toDescriptor=function(e){var r=Ge.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)r.type=11,r.typeName=$r.util.ucFirst(this.name),r.label=3;else{switch(r.type=sk(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:r.typeName=this.resolvedType?v5(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?r.label=3:this.required&&e==="proto2"?r.label=2:r.label=1}if(r.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof Si&&(r.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(r.options=Fd(this.options,Ge.FieldOptions),this.options.default!=null&&(r.defaultValue=String(this.options.default)),this.options.proto3_optional&&(r.proto3_optional=!0)),e==="proto3"?this.packed||((r.options||(r.options=Ge.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((r.options||(r.options=Ge.FieldOptions.create())).packed=!0),r};var Ywe=0;os.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=Ge.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var o=0;o<e.value.length;++o){var s=e.value[o].name,a=e.value[o].number||0;i[s&&s.length?s:"NAME"+a]=a}var c=new os(e.name&&e.name.length?e.name:"Enum"+Ywe++,i,Ud(e.options,Ge.EnumOptions));return n||(c._edition=r),c};os.prototype.toDescriptor=function(){for(var e=[],r=0,n=Object.keys(this.values);r<n.length;++r)e.push(Ge.EnumValueDescriptorProto.create({name:n[r],number:this.values[n[r]]}));return Ge.EnumDescriptorProto.create({name:this.name,value:e,options:Fd(this.options,Ge.EnumOptions)})};var Kwe=0;eb.fromDescriptor=function(e){return typeof e.length=="number"&&(e=Ge.OneofDescriptorProto.decode(e)),new eb(e.name&&e.name.length?e.name:"oneof"+Kwe++)};eb.prototype.toDescriptor=function(){return Ge.OneofDescriptorProto.create({name:this.name})};var Zwe=0;Ig.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=Ge.ServiceDescriptorProto.decode(e));var i=new Ig(e.name&&e.name.length?e.name:"Service"+Zwe++,Ud(e.options,Ge.ServiceOptions));if(n||(i._edition=r),e.method)for(var o=0;o<e.method.length;++o)i.add(tb.fromDescriptor(e.method[o]));return i};Ig.prototype.toDescriptor=function(){for(var e=[],r=0;r<this.methodsArray.length;++r)e.push(this._methodsArray[r].toDescriptor());return Ge.ServiceDescriptorProto.create({name:this.name,method:e,options:Fd(this.options,Ge.ServiceOptions)})};var Jwe=0;tb.fromDescriptor=function(e){typeof e.length=="number"&&(e=Ge.MethodDescriptorProto.decode(e));var r=e.inputType,n=e.outputType;if(r!=null&&r!==""&&(typeof r!="string"||!rb.test(r)))throw Error("illegal type name: "+r);if(n!=null&&n!==""&&(typeof n!="string"||!rb.test(n)))throw Error("illegal type name: "+n);return new tb(e.name&&e.name.length?e.name:"Method"+Jwe++,"rpc",r,n,!!e.clientStreaming,!!e.serverStreaming,Ud(e.options,Ge.MethodOptions))};tb.prototype.toDescriptor=function(){return Ge.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:Fd(this.options,Ge.MethodOptions)})};function Xwe(t){switch(t){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+t)}function Qwe(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function sk(t,e,r){switch(t){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(e instanceof os)return 14;if(e instanceof Si)return r?10:11;throw Error("illegal type: "+t)}function S5(t,e){for(var r={},n=0,i,o;n<e.fieldsArray.length;++n)if((o=(i=e._fieldsArray[n]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(t,o)){var s=exe(o);i.resolvedType instanceof Si?r[s]=S5(t[o],i.resolvedType):i.resolvedType instanceof os?r[s]=i.resolvedType.valuesById[t[o]]:r[s]=t[o]}return r}function Ud(t,e){if(t)return S5(e.toObject(t),e)}function E5(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;++i){var o=n[i],s=$r.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(e.fields,s)){var a=e.fields[s];a.resolvedType instanceof Si?r[s]=E5(t[o],a.resolvedType):r[s]=t[o],a.repeated&&!Array.isArray(r[s])&&(r[s]=[r[s]])}}return r}function Fd(t,e){if(t)return e.fromObject(E5(t,e))}function v5(t,e){var r=t.fullName.split("."),n=e.fullName.split("."),i=0,o=0,s=n.length-1;if(!(t instanceof Cg)&&e instanceof g5)for(;i<r.length&&o<s&&r[i]===n[o];){var a=e.lookup(r[i++],!0);if(a!==null&&a!==e)break;++o}else for(;i<r.length&&o<s&&r[i]===n[o];++i,++o);return n.slice(o).join(".")}function exe(t){return t.substring(0,1)+t.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,r){return"_"+r.toLowerCase()})}function txe(t){if(t.syntax==="editions"){if(t.edition===Ge.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+t.edition)}return t.syntax==="proto3"?"proto3":"proto2"}function rxe(t,e){if(t)if(t==="proto2"||t==="proto3")e.syntax=t;else if(e.syntax="editions",t==="2023")e.edition=Ge.Edition.EDITION_2023;else throw new Error("Unsupported edition "+t)}});var A5=v((Xct,nxe)=>{nxe.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var w5=v((Qct,ixe)=>{ixe.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var x5=v((elt,oxe)=>{oxe.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var P5=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.addCommonProtos=Ea.loadProtosWithOptionsSync=Ea.loadProtosWithOptions=void 0;var R5=Z("fs"),C5=Z("path"),Bd=QT();function I5(t,e){let r=t.resolvePath;t.resolvePath=(n,i)=>{if(C5.isAbsolute(i))return i;for(let o of e){let s=C5.join(o,i);try{return R5.accessSync(s,R5.constants.R_OK),s}catch{continue}}return process.emitWarning(`${i} not found in any of the include paths ${e}`),r(n,i)}}async function sxe(t,e){let r=new Bd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));I5(r,e.includeDirs)}let n=await r.load(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptions=sxe;function axe(t,e){let r=new Bd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");I5(r,e.includeDirs)}let n=r.loadSync(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptionsSync=axe;function cxe(){let t=A5(),e=ok(),r=w5(),n=x5();Bd.common("api",t.nested.google.nested.protobuf.nested),Bd.common("descriptor",e.nested.google.nested.protobuf.nested),Bd.common("source_context",r.nested.google.nested.protobuf.nested),Bd.common("type",n.nested.google.nested.protobuf.nested)}Ea.addCommonProtos=cxe});var fk=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.loadFileDescriptorSetFromObject=jt.loadFileDescriptorSetFromBuffer=jt.fromJSON=jt.loadSync=jt.load=jt.IdempotencyLevel=jt.isAnyExtension=jt.Long=void 0;var lxe=f8(),no=QT(),uk=b5(),dk=P5(),uxe=hN();jt.Long=uxe;function dxe(t){return"@type"in t&&typeof t["@type"]=="string"}jt.isAnyExtension=dxe;var O5;(function(t){t.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",t.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",t.IDEMPOTENT="IDEMPOTENT"})(O5=jt.IdempotencyLevel||(jt.IdempotencyLevel={}));var N5={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function fxe(t,e){return t===""?e:t+"."+e}function pxe(t){return t instanceof no.Service||t instanceof no.Type||t instanceof no.Enum}function hxe(t){return t instanceof no.Namespace||t instanceof no.Root}function k5(t,e){let r=fxe(e,t.name);return pxe(t)?[[r,t]]:hxe(t)&&typeof t.nested<"u"?Object.keys(t.nested).map(n=>k5(t.nested[n],r)).reduce((n,i)=>n.concat(i),[]):[]}function ak(t,e){return function(n){return t.toObject(t.decode(n),e)}}function ck(t){return function(r){if(Array.isArray(r))throw new Error(`Failed to serialize message: expected object with ${t.name} structure, got array instead`);let n=t.fromObject(r);return t.encode(n).finish()}}function mxe(t){return(t||[]).reduce((e,r)=>{for(let[n,i]of Object.entries(r))n==="uninterpreted_option"?e.uninterpreted_option.push(r.uninterpreted_option):e[n]=i;return e},{deprecated:!1,idempotency_level:O5.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function gxe(t,e,r,n){let i=t.resolvedRequestType,o=t.resolvedResponseType;return{path:"/"+e+"/"+t.name,requestStream:!!t.requestStream,responseStream:!!t.responseStream,requestSerialize:ck(i),requestDeserialize:ak(i,r),responseSerialize:ck(o),responseDeserialize:ak(o,r),originalName:lxe(t.name),requestType:lk(i,r,n),responseType:lk(o,r,n),options:mxe(t.parsedOptions)}}function _xe(t,e,r,n){let i={};for(let o of t.methodsArray)i[o.name]=gxe(o,e,r,n);return i}function lk(t,e,r){let n=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,N5),fileDescriptorProtos:r,serialize:ck(t),deserialize:ak(t,e)}}function yxe(t,e){let r=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,N5),fileDescriptorProtos:e}}function Sxe(t,e,r,n){if(t instanceof no.Service)return _xe(t,e,r,n);if(t instanceof no.Type)return lk(t,r,n);if(t instanceof no.Enum)return yxe(t,n);throw new Error("Type mismatch in reflection object handling")}function nb(t,e){let r={};t.resolveAll();let i=t.toDescriptor("proto3").file.map(o=>Buffer.from(uk.FileDescriptorProto.encode(o).finish()));for(let[o,s]of k5(t,""))r[o]=Sxe(s,o,e,i);return r}function M5(t,e){e=e||{};let r=no.Root.fromDescriptor(t);return r.resolveAll(),nb(r,e)}function Exe(t,e){return(0,dk.loadProtosWithOptions)(t,e).then(r=>nb(r,e))}jt.load=Exe;function vxe(t,e){let r=(0,dk.loadProtosWithOptionsSync)(t,e);return nb(r,e)}jt.loadSync=vxe;function Txe(t,e){e=e||{};let r=no.Root.fromJSON(t);return r.resolveAll(),nb(r,e)}jt.fromJSON=Txe;function bxe(t,e){let r=uk.FileDescriptorSet.decode(t);return M5(r,e)}jt.loadFileDescriptorSetFromBuffer=bxe;function Axe(t,e){let r=uk.FileDescriptorSet.fromObject(t);return M5(r,e)}jt.loadFileDescriptorSetFromObject=Axe;(0,dk.addCommonProtos)()});var va=v(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.registerChannelzSocket=yt.registerChannelzServer=yt.registerChannelzSubchannel=yt.registerChannelzChannel=yt.ChannelzCallTrackerStub=yt.ChannelzCallTracker=yt.ChannelzChildrenTrackerStub=yt.ChannelzChildrenTracker=yt.ChannelzTrace=yt.ChannelzTraceStub=void 0;yt.unregisterChannelzRef=Ixe;yt.getChannelzHandlers=z5;yt.getChannelzServiceDefinition=G5;yt.setup=Bxe;var ob=Z("net"),_l=(DK(),Nr(MK)),Pg=Lr(),Og=Ve(),wxe=Zr(),xxe=bT(),Rxe=CT();function pk(t){return{channel_id:t.id,name:t.name}}function yk(t){return{subchannel_id:t.id,name:t.name}}function Cxe(t){return{server_id:t.id}}function cb(t){return{socket_id:t.id,name:t.name}}var D5=32,Sk=100,hk=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:io(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};yt.ChannelzTraceStub=hk;var mk=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,r,n){let i=new Date;this.events.push({description:r,severity:e,timestamp:i,childChannel:n?.kind==="channel"?n:void 0,childSubchannel:n?.kind==="subchannel"?n:void 0}),this.events.length>=D5*2&&(this.events=this.events.slice(D5)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:io(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:io(e.timestamp),channel_ref:e.childChannel?pk(e.childChannel):null,subchannel_ref:e.childSubchannel?yk(e.childSubchannel):null}))}}};yt.ChannelzTrace=mk;var sb=class{constructor(){this.channelChildren=new _l.OrderedMap,this.subchannelChildren=new _l.OrderedMap,this.socketChildren=new _l.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let r=this.trackerMap[e.kind],n=r.find(e.id);n.equals(r.end())?r.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){let r=this.trackerMap[e.kind],n=r.getElementByKey(e.id);n!==void 0&&(n.count-=1,n.count===0&&r.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};yt.ChannelzChildrenTracker=sb;var gk=class extends sb{refChild(){}unrefChild(){}};yt.ChannelzChildrenTrackerStub=gk;var ab=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};yt.ChannelzCallTracker=ab;var _k=class extends ab{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};yt.ChannelzCallTrackerStub=_k;var ss={channel:new _l.OrderedMap,subchannel:new _l.OrderedMap,server:new _l.OrderedMap,socket:new _l.OrderedMap},lb=t=>{let e=1;function r(){return e++}let n=ss[t];return(i,o,s)=>{let a=r(),c={id:a,name:i,kind:t};return s&&n.setElement(a,{ref:c,getInfo:o}),c}};yt.registerChannelzChannel=lb("channel");yt.registerChannelzSubchannel=lb("subchannel");yt.registerChannelzServer=lb("server");yt.registerChannelzSocket=lb("socket");function Ixe(t){ss[t.kind].eraseElementByKey(t.id)}function Pxe(t){let e=Number.parseInt(t,16);return[e/256|0,e%256]}function L5(t){if(t==="")return[];let e=t.split(":").map(n=>Pxe(n));return[].concat(...e)}function Oxe(t){return(0,ob.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,ob.isIPv4)(t.substring(7))}function $5(t){return Buffer.from(Uint8Array.from(t.split(".").map(e=>Number.parseInt(e))))}function Nxe(t){if((0,ob.isIPv4)(t))return $5(t);if(Oxe(t))return $5(t.substring(7));if((0,ob.isIPv6)(t)){let e,r,n=t.indexOf("::");n===-1?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));let i=Buffer.from(L5(e)),o=Buffer.from(L5(r)),s=Buffer.alloc(16-i.length-o.length,0);return Buffer.concat([i,s,o])}else return null}function F5(t){switch(t){case Pg.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case Pg.ConnectivityState.IDLE:return{state:"IDLE"};case Pg.ConnectivityState.READY:return{state:"READY"};case Pg.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case Pg.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function io(t){if(!t)return null;let e=t.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function B5(t){let e=t.getInfo(),r=[],n=[];return e.children.channels.forEach(i=>{r.push(pk(i[1].ref))}),e.children.subchannels.forEach(i=>{n.push(yk(i[1].ref))}),{ref:pk(t.ref),data:{target:e.target,state:F5(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:io(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function kxe(t,e){let r=parseInt(t.request.channel_id,10),n=ss.channel.getElementByKey(r);if(n===void 0){e({code:Og.Status.NOT_FOUND,details:"No channel data found for id "+r});return}e(null,{channel:B5(n)})}function Mxe(t,e){let r=parseInt(t.request.max_results,10)||Sk,n=[],i=parseInt(t.request.start_channel_id,10),o=ss.channel,s;for(s=o.lowerBound(i);!s.equals(o.end())&&n.length<r;s=s.next())n.push(B5(s.pointer[1]));e(null,{channel:n,end:s.equals(o.end())})}function j5(t){let e=t.getInfo(),r=[];return e.listenerChildren.sockets.forEach(n=>{r.push(cb(n[1].ref))}),{ref:Cxe(t.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:io(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:r}}function Dxe(t,e){let r=parseInt(t.request.server_id,10),i=ss.server.getElementByKey(r);if(i===void 0){e({code:Og.Status.NOT_FOUND,details:"No server data found for id "+r});return}e(null,{server:j5(i)})}function Lxe(t,e){let r=parseInt(t.request.max_results,10)||Sk,n=parseInt(t.request.start_server_id,10),i=ss.server,o=[],s;for(s=i.lowerBound(n);!s.equals(i.end())&&o.length<r;s=s.next())o.push(j5(s.pointer[1]));e(null,{server:o,end:s.equals(i.end())})}function $xe(t,e){let r=parseInt(t.request.subchannel_id,10),n=ss.subchannel.getElementByKey(r);if(n===void 0){e({code:Og.Status.NOT_FOUND,details:"No subchannel data found for id "+r});return}let i=n.getInfo(),o=[];i.children.sockets.forEach(a=>{o.push(cb(a[1].ref))});let s={ref:yk(n.ref),data:{target:i.target,state:F5(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:io(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:o};e(null,{subchannel:s})}function U5(t){var e;return(0,wxe.isTcpSubchannelAddress)(t)?{address:"tcpip_address",tcpip_address:{ip_address:(e=Nxe(t.host))!==null&&e!==void 0?e:void 0,port:t.port}}:{address:"uds_address",uds_address:{filename:t.path}}}function Uxe(t,e){var r,n,i,o,s;let a=parseInt(t.request.socket_id,10),c=ss.socket.getElementByKey(a);if(c===void 0){e({code:Og.Status.NOT_FOUND,details:"No socket data found for id "+a});return}let l=c.getInfo(),u=l.security?{model:"tls",tls:{cipher_suite:l.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(r=l.security.cipherSuiteStandardName)!==null&&r!==void 0?r:void 0,other_name:(n=l.security.cipherSuiteOtherName)!==null&&n!==void 0?n:void 0,local_certificate:(i=l.security.localCertificate)!==null&&i!==void 0?i:void 0,remote_certificate:(o=l.security.remoteCertificate)!==null&&o!==void 0?o:void 0}}:null,d={ref:cb(c.ref),local:l.localAddress?U5(l.localAddress):null,remote:l.remoteAddress?U5(l.remoteAddress):null,remote_name:(s=l.remoteName)!==null&&s!==void 0?s:void 0,security:u,data:{keep_alives_sent:l.keepAlivesSent,streams_started:l.streamsStarted,streams_succeeded:l.streamsSucceeded,streams_failed:l.streamsFailed,last_local_stream_created_timestamp:io(l.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:io(l.lastRemoteStreamCreatedTimestamp),messages_received:l.messagesReceived,messages_sent:l.messagesSent,last_message_received_timestamp:io(l.lastMessageReceivedTimestamp),last_message_sent_timestamp:io(l.lastMessageSentTimestamp),local_flow_control_window:l.localFlowControlWindow?{value:l.localFlowControlWindow}:null,remote_flow_control_window:l.remoteFlowControlWindow?{value:l.remoteFlowControlWindow}:null}};e(null,{socket:d})}function Fxe(t,e){let r=parseInt(t.request.server_id,10),n=ss.server.getElementByKey(r);if(n===void 0){e({code:Og.Status.NOT_FOUND,details:"No server data found for id "+r});return}let i=parseInt(t.request.start_socket_id,10),o=parseInt(t.request.max_results,10)||Sk,a=n.getInfo().sessionChildren.sockets,c=[],l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<o;l=l.next())c.push(cb(l.pointer[1].ref));e(null,{socket_ref:c,end:l.equals(a.end())})}function z5(){return{GetChannel:kxe,GetTopChannels:Mxe,GetServer:Dxe,GetServers:Lxe,GetSubchannel:$xe,GetSocket:Uxe,GetServerSockets:Fxe}}var ib=null;function G5(){if(ib)return ib;let t=fk().loadSync,e=t("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return ib=(0,Rxe.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,ib}function Bxe(){(0,xxe.registerAdminService)(G5,z5)}});var ub=v(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});Ek.getNextCallNumber=zxe;var jxe=0;function zxe(){return jxe++}});var vk=v(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.CompressionAlgorithms=void 0;var q5;(function(t){t[t.identity=0]="identity",t[t.deflate=1]="deflate",t[t.gzip=2]="gzip"})(q5||(db.CompressionAlgorithms=q5={}))});var bk=v(fb=>{"use strict";Object.defineProperty(fb,"__esModule",{value:!0});fb.BaseFilter=void 0;var Tk=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};fb.BaseFilter=Tk});var Ck=v(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.CompressionFilterFactory=zd.CompressionFilter=void 0;var pb=Z("zlib"),H5=vk(),Ta=Ve(),Gxe=bk(),qxe=ht(),Vxe=t=>typeof t=="number"&&typeof H5.CompressionAlgorithms[t]=="string",jd=class{async writeMessage(e,r){let n=e;r&&(n=await this.compressMessage(n));let i=Buffer.allocUnsafe(n.length+5);return i.writeUInt8(r?1:0,0),i.writeUInt32BE(n.length,1),n.copy(i,5),i}async readMessage(e){let r=e.readUInt8(0)===1,n=e.slice(5);return r&&(n=await this.decompressMessage(n)),n}},yl=class extends jd{async compressMessage(e){return e}async writeMessage(e,r){let n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},Ak=class extends jd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.deflate(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createInflate();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},wk=class extends jd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.gzip(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createGunzip();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},xk=class extends jd{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function V5(t,e){switch(t){case"identity":return new yl;case"deflate":return new Ak(e);case"gzip":return new wk(e);default:return new xk(t)}}var hb=class extends Gxe.BaseFilter{constructor(e,r){var n,i,o;super(),this.sharedFilterConfig=r,this.sendCompression=new yl,this.receiveCompression=new yl,this.currentCompressionAlgorithm="identity";let s=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(n=e["grpc.max_receive_message_length"])!==null&&n!==void 0?n:Ta.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(i=e["grpc.max_send_message_length"])!==null&&i!==void 0?i:Ta.DEFAULT_MAX_SEND_MESSAGE_LENGTH,s!==void 0)if(Vxe(s)){let a=H5.CompressionAlgorithms[s],c=(o=r.serverSupportedEncodingHeader)===null||o===void 0?void 0:o.split(",");(!c||c.includes(a))&&(this.currentCompressionAlgorithm=a,this.sendCompression=V5(this.currentCompressionAlgorithm,-1))}else qxe.log(Ta.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${s}`)}async sendMetadata(e){let r=await e;return r.set("grpc-accept-encoding","identity,deflate,gzip"),r.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?r.remove("grpc-encoding"):r.set("grpc-encoding",this.currentCompressionAlgorithm),r}receiveMetadata(e){let r=e.get("grpc-encoding");if(r.length>0){let i=r[0];typeof i=="string"&&(this.receiveCompression=V5(i,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let n=e.get("grpc-accept-encoding")[0];return n&&(this.sharedFilterConfig.serverSupportedEncodingHeader=n,n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new yl,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var r;let n=await e;if(this.maxSendMessageLength!==-1&&n.message.length>this.maxSendMessageLength)throw{code:Ta.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return this.sendCompression instanceof yl?i=!1:i=(((r=n.flags)!==null&&r!==void 0?r:0)&2)===0,{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};zd.CompressionFilter=hb;var Rk=class{constructor(e,r){this.options=r,this.sharedFilterConfig={}}createFilter(){return new hb(this.options,this.sharedFilterConfig)}};zd.CompressionFilterFactory=Rk});var Ng=v(Ik=>{"use strict";Object.defineProperty(Ik,"__esModule",{value:!0});Ik.restrictControlPlaneStatusCode=Wxe;var oo=Ve(),Hxe=[oo.Status.OK,oo.Status.INVALID_ARGUMENT,oo.Status.NOT_FOUND,oo.Status.ALREADY_EXISTS,oo.Status.FAILED_PRECONDITION,oo.Status.ABORTED,oo.Status.OUT_OF_RANGE,oo.Status.DATA_LOSS];function Wxe(t,e){return Hxe.includes(t)?{code:oo.Status.INTERNAL,details:`Invalid status from control plane: ${t} ${oo.Status[t]} ${e}`}:{code:t,details:e}}});var Gd=v(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.minDeadline=Yxe;Sl.getDeadlineTimeoutString=Zxe;Sl.getRelativeTimeout=Xxe;Sl.deadlineToString=Qxe;Sl.formatDateDifference=eRe;function Yxe(...t){let e=1/0;for(let r of t){let n=r instanceof Date?r.getTime():r;n<e&&(e=n)}return e}var Kxe=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function Zxe(t){let e=new Date().getTime();t instanceof Date&&(t=t.getTime());let r=Math.max(t-e,0);for(let[n,i]of Kxe){let o=r/i;if(o<1e8)return String(Math.ceil(o))+n}throw new Error("Deadline is too far in the future")}var Jxe=2147483647;function Xxe(t){let e=t instanceof Date?t.getTime():t,r=new Date().getTime(),n=e-r;return n<0?0:n>Jxe?1/0:n}function Qxe(t){if(t instanceof Date)return t.toISOString();{let e=new Date(t);return Number.isNaN(e.getTime())?""+t:e.toISOString()}}function eRe(t,e){return((e.getTime()-t.getTime())/1e3).toFixed(3)+"s"}});var gb=v(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.FilterStackFactory=qd.FilterStack=void 0;var mb=class{constructor(e){this.filters=e}sendMetadata(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMetadata(r);return r}receiveMetadata(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMetadata(r);return r}sendMessage(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMessage(r);return r}receiveMessage(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMessage(r);return r}receiveTrailers(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveTrailers(r);return r}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};qd.FilterStack=mb;var Pk=class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new mb(this.factories.map(e=>e.createFilter()))}};qd.FilterStackFactory=Pk});var W5=v(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});yb.SingleSubchannelChannel=void 0;var tRe=ub(),kg=va(),rRe=Ck(),nRe=Lr(),Mg=Ve(),iRe=Ng(),oRe=Gd(),sRe=gb(),Ok=Kt(),aRe=ai(),_b=Dr(),Nk=class{constructor(e,r,n,i,o){var s,a;this.subchannel=e,this.method=r,this.options=i,this.callNumber=o,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let c=this.method.split("/"),l="";c.length>=2&&(l=c[1]);let u=(a=(s=(0,_b.splitHostPort)(this.options.host))===null||s===void 0?void 0:s.host)!==null&&a!==void 0?a:"localhost";this.serviceUrl=`https://${u}/${l}`;let d=(0,oRe.getRelativeTimeout)(i.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(Mg.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(Mg.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,r){this.childCall?this.childCall.cancelWithStatus(e,r):this.pendingStatus={code:e,details:r,metadata:new Ok.Metadata}}getPeer(){var e,r;return(r=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.subchannel.getAddress()}async start(e,r){if(this.pendingStatus){r.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==nRe.ConnectivityState.READY){r.onReceiveStatus({code:Mg.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new Ok.Metadata});return}let n=await this.filterStack.sendMetadata(Promise.resolve(e)),i;try{i=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(s){let a=s,{code:c,details:l}=(0,iRe.restrictControlPlaneStatusCode)(typeof a.code=="number"?a.code:Mg.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${a.message}`);r.onReceiveStatus({code:c,details:l,metadata:new Ok.Metadata});return}i.merge(n);let o={onReceiveMetadata:async s=>{r.onReceiveMetadata(await this.filterStack.receiveMetadata(s))},onReceiveMessage:async s=>{this.readFilterPending=!0;let a=await this.filterStack.receiveMessage(s);this.readFilterPending=!1,r.onReceiveMessage(a),this.pendingStatus&&r.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async s=>{let a=await this.filterStack.receiveTrailers(s);this.readFilterPending?this.pendingStatus=a:r.onReceiveStatus(a)}};this.childCall=this.subchannel.createCall(i,this.options.host,this.method,o),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,r){this.writeFilterPending=!0;let n=await this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},kk=class{constructor(e,r,n){this.subchannel=e,this.target=r,this.channelzEnabled=!1,this.channelzTrace=new kg.ChannelzTrace,this.callTracker=new kg.ChannelzCallTracker,this.childrenTracker=new kg.ChannelzChildrenTracker,this.channelzEnabled=n["grpc.enable_channelz"]!==0,this.channelzRef=(0,kg.registerChannelzChannel)((0,_b.uriToString)(r),()=>({target:`${(0,_b.uriToString)(r)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new sRe.FilterStackFactory([new rRe.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,kg.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,_b.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,r,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,r){let n={deadline:r,host:(0,aRe.getDefaultAuthority)(this.target),flags:Mg.Propagate.DEFAULTS,parentCall:null};return new Nk(this.subchannel,e,this.filterStackFactory,n,(0,tRe.getNextCallNumber)())}};yb.SingleSubchannelChannel=kk});var Y5=v(Eb=>{"use strict";Object.defineProperty(Eb,"__esModule",{value:!0});Eb.Subchannel=void 0;var lt=Lr(),cRe=bd(),Mk=ht(),Sb=Ve(),lRe=Dr(),uRe=Zr(),so=va(),dRe=W5(),fRe="subchannel",pRe=~(1<<31),Dk=class{constructor(e,r,n,i,o){var s;this.channelTarget=e,this.subchannelAddress=r,this.options=n,this.connector=o,this.connectivityState=lt.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let a={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new cRe.BackoffTimeout(()=>{this.handleBackoffTimer()},a),this.backoffTimeout.unref(),this.subchannelAddressString=(0,uRe.subchannelAddressToString)(r),this.keepaliveTime=(s=n["grpc.keepalive_time_ms"])!==null&&s!==void 0?s:-1,n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new so.ChannelzTraceStub,this.callTracker=new so.ChannelzCallTrackerStub,this.childrenTracker=new so.ChannelzChildrenTrackerStub,this.streamTracker=new so.ChannelzCallTrackerStub):(this.channelzTrace=new so.ChannelzTrace,this.callTracker=new so.ChannelzCallTracker,this.childrenTracker=new so.ChannelzChildrenTracker,this.streamTracker=new so.ChannelzCallTracker),this.channelzRef=(0,so.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=i._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){Mk.trace(Sb.LogVerbosity.DEBUG,fRe,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){Mk.trace(Sb.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([lt.ConnectivityState.TRANSIENT_FAILURE],lt.ConnectivityState.CONNECTING):this.transitionToState([lt.ConnectivityState.TRANSIENT_FAILURE],lt.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let r=Math.min(this.keepaliveTime,pRe);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":r})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(r=>{this.transitionToState([lt.ConnectivityState.CONNECTING],lt.ConnectivityState.READY)?(this.transport=r,this.channelzEnabled&&this.childrenTracker.refChild(r.getChannelzRef()),r.addDisconnectListener(n=>{this.transitionToState([lt.ConnectivityState.READY],lt.ConnectivityState.IDLE),n&&this.keepaliveTime>0&&(this.keepaliveTime*=2,Mk.log(Sb.LogVerbosity.ERROR,`Connection to ${(0,lRe.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):r.shutdown()},r=>{this.transitionToState([lt.ConnectivityState.CONNECTING],lt.ConnectivityState.TRANSIENT_FAILURE,`${r}`)})}transitionToState(e,r,n){var i,o;if(e.indexOf(this.connectivityState)===-1)return!1;n?this.trace(lt.ConnectivityState[this.connectivityState]+" -> "+lt.ConnectivityState[r]+' with error "'+n+'"'):this.trace(lt.ConnectivityState[this.connectivityState]+" -> "+lt.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+lt.ConnectivityState[r]);let s=this.connectivityState;switch(this.connectivityState=r,r){case lt.ConnectivityState.READY:this.stopBackoff();break;case lt.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case lt.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(i=this.transport)===null||i===void 0||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case lt.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(o=this.transport)===null||o===void 0||o.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(let a of this.stateListeners)a(this,s,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,so.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([lt.ConnectivityState.CONNECTING,lt.ConnectivityState.READY],lt.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,r,n,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let o;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),o={onCallEnd:s=>{s.code===Sb.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):o={},this.transport.createCall(e,r,n,i,o)}startConnecting(){process.nextTick(()=>{this.transitionToState([lt.ConnectivityState.IDLE],lt.ConnectivityState.CONNECTING)||this.connectivityState===lt.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([lt.ConnectivityState.TRANSIENT_FAILURE],lt.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new dRe.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,r){let n=this.dataProducers.get(e);if(n)return n;let i=r(this);return this.dataProducers.set(e,i),i}removeDataProducer(e){this.dataProducers.delete(e)}};Eb.Subchannel=Dk});var K5=v(vb=>{"use strict";var Lk;Object.defineProperty(vb,"__esModule",{value:!0});vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((Lk=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&Lk!==void 0?Lk:"false")==="true"});var Bk=v(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.DEFAULT_PORT=void 0;El.setup=vRe;var Z5=ai(),$k=Z("dns"),hRe=MO(),Uk=Ve(),Vd=cl(),mRe=Kt(),gRe=ht(),_Re=Ve(),ba=Dr(),J5=Z("net"),yRe=bd(),X5=K5(),SRe="dns_resolver";function ao(t){gRe.trace(_Re.LogVerbosity.DEBUG,SRe,t)}El.DEFAULT_PORT=443;var ERe=3e4,Fk=class{constructor(e,r,n){var i,o,s;this.target=e,this.listener=r,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new $k.promises.Resolver,ao("Resolver constructed for target "+(0,ba.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let a=(0,ba.splitHostPort)(e.path);a===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,J5.isIPv4)(a.host)||(0,J5.isIPv6)(a.host)?(this.ipResult=[{addresses:[{host:a.host,port:(i=a.port)!==null&&i!==void 0?i:El.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=a.host,this.port=(o=a.port)!==null&&o!==void 0?o:El.DEFAULT_PORT),this.percentage=Math.random()*100,n["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:Uk.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,ba.uriToString)(this.target)}`,metadata:new mRe.Metadata};let c={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new yRe.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},c),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(s=n["grpc.dns_min_time_between_resolutions_ms"])!==null&&s!==void 0?s:ERe,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(ao("Returning IP address for target "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Vd.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)ao("Failed to parse DNS address "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Vd.statusOrFromError)({code:Uk.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,ba.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;ao("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(r=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,Vd.statusOrFromValue)(r.map(o=>({addresses:[o]})));let n="["+r.map(o=>o.host+":"+o.port).join(",")+"]";ao("Resolved addresses for target "+(0,ba.uriToString)(this.target)+": "+n);let i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},r=>{this.pendingLookupPromise!==null&&(ao("Resolution error for target "+(0,ba.uriToString)(this.target)+": "+r.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,Vd.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(r=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let n;try{n=(0,hRe.extractAndSelectServiceConfig)(r,this.percentage),n?this.latestServiceConfigResult=(0,Vd.statusOrFromValue)(n):this.latestServiceConfigResult=null}catch(i){this.latestServiceConfigResult=(0,Vd.statusOrFromError)({code:Uk.Status.UNAVAILABLE,details:`Parsing service config failed with error ${i.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},r=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){ao("Using alternative DNS resolver.");let n=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(n.every(i=>i.status==="rejected"))throw new Error(n[0].reason);return n.reduce((i,o)=>o.status==="fulfilled"?[...i,...o.value]:i,[]).map(i=>({host:i,port:+this.port}))}return(await $k.promises.lookup(e,{all:!0})).map(n=>({host:n.address,port:+this.port}))}async resolveTxt(e){return X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(ao("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):$k.promises.resolveTxt(e)}startNextResolutionTimer(){var e,r;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(r=(e=this.nextResolutionTimer).unref)===null||r===void 0||r.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?ao('resolution update delayed by "min time between resolutions" rate limit'):ao("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}};function vRe(){(0,Z5.registerResolver)("dns",Fk),(0,Z5.registerDefaultScheme)("dns")}});var jk=v($g=>{"use strict";Object.defineProperty($g,"__esModule",{value:!0});$g.parseCIDR=t9;$g.mapProxyName=ORe;$g.getProxiedConnection=NRe;var Dg=ht(),Hd=Ve(),e9=Z("net"),TRe=Z("http"),bRe=ht(),Q5=Zr(),Lg=Dr(),ARe=Z("url"),wRe=Bk(),xRe="proxy";function Wd(t){bRe.trace(Hd.LogVerbosity.DEBUG,xRe,t)}function RRe(){let t="",e="";if(process.env.grpc_proxy)e="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",t=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",t=process.env.http_proxy;else return{};let r;try{r=new ARe.URL(t)}catch{return(0,Dg.log)(Hd.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(r.protocol!=="http:")return(0,Dg.log)(Hd.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let n=null;r.username&&(r.password?((0,Dg.log)(Hd.LogVerbosity.INFO,"userinfo found in proxy URI"),n=decodeURIComponent(`${r.username}:${r.password}`)):n=r.username);let i=r.hostname,o=r.port;o===""&&(o="80");let s={address:`${i}:${o}`};return n&&(s.creds=n),Wd("Proxy server "+s.address+" set by environment variable "+e),s}function CRe(){let t=process.env.no_grpc_proxy,e="no_grpc_proxy";return t||(t=process.env.no_proxy,e="no_proxy"),t?(Wd("No proxy server list set by environment variable "+e),t.split(",")):[]}function t9(t){let e=t.split("/");if(e.length!==2)return null;let r=parseInt(e[1],10);return!(0,e9.isIPv4)(e[0])||Number.isNaN(r)||r<0||r>32?null:{ip:r9(e[0]),prefixLength:r}}function r9(t){return t.split(".").reduce((e,r)=>(e<<8)+parseInt(r,10),0)}function IRe(t,e){let r=t.ip,n=-1<<32-t.prefixLength;return(r9(e)&n)===(r&n)}function PRe(t){for(let e of CRe()){let r=t9(e);if((0,e9.isIPv4)(t)&&r&&IRe(r,t))return!0;if(t.endsWith(e))return!0}return!1}function ORe(t,e){var r;let n={target:t,extraOptions:{}};if(((r=e["grpc.enable_http_proxy"])!==null&&r!==void 0?r:1)===0||t.scheme==="unix")return n;let i=RRe();if(!i.address)return n;let o=(0,Lg.splitHostPort)(t.path);if(!o)return n;let s=o.host;if(PRe(s))return Wd("Not using proxy for target in no_proxy list: "+(0,Lg.uriToString)(t)),n;let a={"grpc.http_connect_target":(0,Lg.uriToString)(t)};return i.creds&&(a["grpc.http_connect_creds"]=i.creds),{target:{scheme:"dns",path:i.address},extraOptions:a}}function NRe(t,e){var r;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let n=e["grpc.http_connect_target"],i=(0,Lg.parseUri)(n);if(i===null)return Promise.resolve(null);let o=(0,Lg.splitHostPort)(i.path);if(o===null)return Promise.resolve(null);let s=`${o.host}:${(r=o.port)!==null&&r!==void 0?r:wRe.DEFAULT_PORT}`,a={method:"CONNECT",path:s},c={Host:s};(0,Q5.isTcpSubchannelAddress)(t)?(a.host=t.host,a.port=t.port):a.socketPath=t.path,"grpc.http_connect_creds"in e&&(c["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),a.headers=c;let l=(0,Q5.subchannelAddressToString)(t);return Wd("Using proxy "+l+" to connect to "+a.path),new Promise((u,d)=>{let f=TRe.request(a);f.once("connect",(p,h,m)=>{f.removeAllListeners(),h.removeAllListeners(),p.statusCode===200?(Wd("Successfully connected to "+a.path+" through proxy "+l),m.length>0&&h.unshift(m),Wd("Successfully established a plaintext connection to "+a.path+" through proxy "+l),u(h)):((0,Dg.log)(Hd.LogVerbosity.ERROR,"Failed to connect to "+a.path+" through proxy "+l+" with status "+p.statusCode),d())}),f.once("error",p=>{f.removeAllListeners(),(0,Dg.log)(Hd.LogVerbosity.ERROR,"Failed to connect to proxy "+l+" with error "+p.message),d()}),f.end()})}});var Gk=v(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.StreamDecoder=void 0;var co;(function(t){t[t.NO_DATA=0]="NO_DATA",t[t.READING_SIZE=1]="READING_SIZE",t[t.READING_MESSAGE=2]="READING_MESSAGE"})(co||(co={}));var zk=class{constructor(e){this.maxReadMessageLength=e,this.readState=co.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let r=0,n,i=[];for(;r<e.length;)switch(this.readState){case co.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=co.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case co.READING_SIZE:if(n=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+n),this.readSizeRemaining-=n,r+=n,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=co.READING_MESSAGE;else{let o=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=co.NO_DATA,i.push(o)}}break;case co.READING_MESSAGE:if(n=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+n)),this.readMessageRemaining-=n,r+=n,this.readMessageRemaining===0){let o=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),s=Buffer.concat(o,this.readMessageSize+5);this.readState=co.NO_DATA,i.push(s)}break;default:throw new Error("Unexpected read state")}return i}};Tb.StreamDecoder=zk});var n9=v(bb=>{"use strict";Object.defineProperty(bb,"__esModule",{value:!0});bb.Http2SubchannelCall=void 0;var as=Z("http2"),kRe=Z("os"),ut=Ve(),cs=Kt(),MRe=Gk(),DRe=ht(),LRe=Ve(),$Re="subchannel_call";function URe(t){for(let[e,r]of Object.entries(kRe.constants.errno))if(r===t)return e;return"Unknown system error "+t}function qk(t){let e=`Received HTTP status code ${t}`,r;switch(t){case 400:r=ut.Status.INTERNAL;break;case 401:r=ut.Status.UNAUTHENTICATED;break;case 403:r=ut.Status.PERMISSION_DENIED;break;case 404:r=ut.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:r=ut.Status.UNAVAILABLE;break;default:r=ut.Status.UNKNOWN}return{code:r,details:e,metadata:new cs.Metadata}}var Vk=class{constructor(e,r,n,i,o){var s;this.http2Stream=e,this.callEventTracker=r,this.listener=n,this.transport=i,this.callId=o,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let a=(s=i.getOptions()["grpc.max_receive_message_length"])!==null&&s!==void 0?s:ut.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new MRe.StreamDecoder(a),e.on("response",(c,l)=>{let u="";for(let d of Object.keys(c))u+=" "+d+": "+c[d]+`
16
+ `&&++i,++r===n)throw l("comment");C=O,O=d(r)}while(C!=="*"||O!=="/");++r,P&&(f(k,r-2,M),M=!0),T=!0}else return"/"}}while(T);var F=r;nk.lastIndex=0;var _=nk.test(d(F++));if(!_)for(;F<n&&!nk.test(d(F));)++F;var re=t.substring(r,r=F);return(re==='"'||re==="'")&&(c=re),re}function y(T){a.push(T)}function S(){if(!a.length){var T=m();if(T===null)return null;y(T)}return a[0]}function b(T,C){var O=S(),k=O===T;if(k)return m(),!0;if(!C)throw l("token '"+O+"', '"+T+"' expected");return!1}function w(T){var C=null,O;return T===void 0?(O=s[i-1],delete s[i-1],O&&(e||O.type==="*"||O.lineEmpty)&&(C=O.leading?O.text:null)):(o<T&&S(),O=s[T],delete s[T],O&&!O.lineEmpty&&(e||O.type==="/")&&(C=O.leading?null:O.text)),C}return Object.defineProperty({next:m,peek:S,push:y,skip:b,cmnt:w},"line",{get:function(){return i}})}});var l5=v((Wct,c5)=>{"use strict";c5.exports=is;is.filename=null;is.defaults={keepCase:!1};var Iwe=ik(),i5=KT(),o5=VT(),s5=ga(),Pwe=FT(),a5=hl(),Owe=mi(),Nwe=jT(),kwe=BT(),Mwe=_a(),Dwe=ml(),ns=Jt(),Lwe=/^[1-9][0-9]*$/,$we=/^-?[1-9][0-9]*$/,Uwe=/^0[x][0-9a-fA-F]+$/,Fwe=/^-?0[x][0-9a-fA-F]+$/,Bwe=/^0[0-7]+$/,jwe=/^-?0[0-7]+$/,zwe=ns.patterns.numberRe,to=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ro=ns.patterns.typeRefRe;function is(t,e,r){e instanceof i5||(r=e,e=new i5),r||(r=is.defaults);var n=r.preferTrailingComment||!1,i=Iwe(t,r.alternateCommentMode||!1),o=i.next,s=i.push,a=i.peek,c=i.skip,l=i.cmnt,u=!0,d,f,p,h="proto2",m=e,y=[],S={},b=r.keepCase?function(I){return I}:ns.camelCase;function w(){y.forEach(I=>{I._edition=h,Object.keys(S).forEach(U=>{I.getOption(U)===void 0&&I.setOption(U,S[U],!0)})})}function T(I,U,j){var G=is.filename;return j||(is.filename=null),Error("illegal "+(U||"token")+" '"+I+"' ("+(G?G+", ":"")+"line "+i.line+")")}function C(){var I=[],U;do{if((U=o())!=='"'&&U!=="'")throw T(U);I.push(o()),c(U),U=a()}while(U==='"'||U==="'");return I.join("")}function O(I){var U=o();switch(U){case"'":case'"':return s(U),C();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return P(U,!0)}catch{if(I&&ro.test(U))return U;throw T(U,"value")}}function k(I,U){var j,G;do if(U&&((j=a())==='"'||j==="'")){var ee=C();if(I.push(ee),h>=2023)throw T(ee,"id")}else try{I.push([G=M(o()),c("to",!0)?M(o()):G])}catch(Te){if(U&&ro.test(j)&&h>=2023)I.push(j);else throw Te}while(c(",",!0));var se={options:void 0};se.setOption=function(Te,Ye){this.options===void 0&&(this.options={}),this.options[Te]=Ye},E(se,function(Ye){if(Ye==="option")xe(se,Ye),c(";");else throw T(Ye)},function(){_e(se)})}function P(I,U){var j=1;switch(I.charAt(0)==="-"&&(j=-1,I=I.substring(1)),I){case"inf":case"INF":case"Inf":return j*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(Lwe.test(I))return j*parseInt(I,10);if(Uwe.test(I))return j*parseInt(I,16);if(Bwe.test(I))return j*parseInt(I,8);if(zwe.test(I))return j*parseFloat(I);throw T(I,"number",U)}function M(I,U){switch(I){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!U&&I.charAt(0)==="-")throw T(I,"id");if($we.test(I))return parseInt(I,10);if(Fwe.test(I))return parseInt(I,16);if(jwe.test(I))return parseInt(I,8);throw T(I,"id")}function F(){if(d!==void 0)throw T("package");if(d=o(),!ro.test(d))throw T(d,"name");m=m.define(d),c(";")}function _(){var I=a(),U;switch(I){case"weak":U=p||(p=[]),o();break;case"public":o();default:U=f||(f=[]);break}I=C(),c(";"),U.push(I)}function re(){if(c("="),h=C(),h<2023)throw T(h,"syntax");c(";")}function N(){if(c("="),h=C(),!["2023"].includes(h))throw T(h,"edition");c(";")}function g(I,U,j){switch(j===void 0&&(j=0),U){case"option":return xe(I,U),c(";"),!0;case"message":return x(I,U,j+1),!0;case"enum":return Ie(I,U),!0;case"service":return qe(I,U,j+1),!0;case"extend":return le(I,U,j),!0}return!1}function E(I,U,j){var G=i.line;if(I&&(typeof I.comment!="string"&&(I.comment=l()),I.filename=is.filename),c("{",!0)){for(var ee;(ee=o())!=="}";)U(ee);c(";",!0)}else j&&j(),c(";"),I&&(typeof I.comment!="string"||n)&&(I.comment=l(G)||I.comment)}function x(I,U,j){if(j===void 0&&(j=0),j>ns.nestingLimit)throw Error("max depth exceeded");if(!to.test(U=o()))throw T(U,"type name");var G=new o5(U);E(G,function(se){if(!g(G,se,j))switch(se){case"map":fe(G,se);break;case"required":if(h!=="proto2")throw T(se);case"repeated":Y(G,se,void 0,j+1);break;case"optional":if(h==="proto3")Y(G,"proto3_optional",void 0,j+1);else{if(h!=="proto2")throw T(se);Y(G,"optional",void 0,j+1)}break;case"oneof":$e(G,se,j+1);break;case"extensions":k(G.extensions||(G.extensions=[]));break;case"reserved":k(G.reserved||(G.reserved=[]),!0);break;default:if(h==="proto2"||!ro.test(se))throw T(se);s(se),Y(G,"optional",void 0,j+1);break}}),I.add(G),I===m&&y.push(G)}function Y(I,U,j,G){var ee=o();if(ee==="group"){q(I,U,G);return}for(;ee.endsWith(".")||a().startsWith(".");)ee+=o();if(!ro.test(ee))throw T(ee,"type");var se=o();if(!to.test(se))throw T(se,"name");se=b(se),c("=");var Te=new s5(se,M(o()),ee,U,j);if(E(Te,function(ye){if(ye==="option")xe(Te,ye),c(";");else throw T(ye)},function(){_e(Te)}),U==="proto3_optional"){var Ye=new a5("_"+se);Te.setOption("proto3_optional",!0),Ye.add(Te),I.add(Ye)}else I.add(Te);I===m&&y.push(Te)}function q(I,U,j){if(j===void 0&&(j=0),j>ns.nestingLimit)throw Error("max depth exceeded");if(h>=2023)throw T("group");var G=o();if(!to.test(G))throw T(G,"name");var ee=ns.lcFirst(G);G===ee&&(G=ns.ucFirst(G)),c("=");var se=M(o()),Te=new o5(G);Te.group=!0;var Ye=new s5(ee,se,G,U);Ye.filename=is.filename,E(Te,function(ye){switch(ye){case"option":xe(Te,ye),c(";");break;case"required":case"repeated":Y(Te,ye,void 0,j+1);break;case"optional":h==="proto3"?Y(Te,"proto3_optional",void 0,j+1):Y(Te,"optional",void 0,j+1);break;case"message":x(Te,ye,j+1);break;case"enum":Ie(Te,ye);break;case"reserved":k(Te.reserved||(Te.reserved=[]),!0);break;default:throw T(ye)}}),I.add(Te).add(Ye)}function fe(I){c("<");var U=o();if(Dwe.mapKey[U]===void 0)throw T(U,"type");c(",");var j=o();if(!ro.test(j))throw T(j,"type");c(">");var G=o();if(!to.test(G))throw T(G,"name");c("=");var ee=new Pwe(b(G),M(o()),U,j);E(ee,function(Te){if(Te==="option")xe(ee,Te),c(";");else throw T(Te)},function(){_e(ee)}),I.add(ee)}function $e(I,U,j){if(!to.test(U=o()))throw T(U,"name");var G=new a5(b(U));E(G,function(se){se==="option"?(xe(G,se),c(";")):(s(se),Y(G,"optional",void 0,j))}),I.add(G)}function Ie(I,U){if(!to.test(U=o()))throw T(U,"name");var j=new Owe(U);E(j,function(ee){switch(ee){case"option":xe(j,ee),c(";");break;case"reserved":k(j.reserved||(j.reserved=[]),!0),j.reserved===void 0&&(j.reserved=[]);break;default:Pe(j,ee)}}),I.add(j),I===m&&y.push(j)}function Pe(I,U){if(!to.test(U))throw T(U,"name");c("=");var j=M(o(),!0),G={options:void 0};G.getOption=function(ee){return this.options[ee]},G.setOption=function(ee,se){Mwe.prototype.setOption.call(G,ee,se)},G.setParsedOption=function(){},E(G,function(se){if(se==="option")xe(G,se),c(";");else throw T(se)},function(){_e(G)}),I.add(U,j,G.comment,G.parsedOptions||G.options)}function xe(I,U){var j,G,ee=!0;for(U==="option"&&(U=o());U!=="=";){if(U==="("){var se=o();c(")"),U="("+se+")"}if(ee){if(ee=!1,U.includes(".")&&!U.includes("(")){var Te=U.split(".");j=Te[0]+".",U=Te[1];continue}j=U}else G=G?G+=U:U;U=o()}var Ye=G?j.concat(G):j,Oe=Fe(I,Ye);G=G&&G[0]==="."?G.slice(1):G,j=j&&j[j.length-1]==="."?j.slice(0,-1):j,ce(I,j,Oe,G)}function Fe(I,U,j){if(j===void 0&&(j=0),j>ns.recursionLimit)throw Error("max depth exceeded");if(c("{",!0)){for(var G={};!c("}",!0);){if(!to.test(R=o()))throw T(R,"name");if(R===null)throw T(R,"end of input");var ee,se=R;if(c(":",!0),a()==="{")ee=Fe(I,U+"."+R,j+1);else if(a()==="["){ee=[];var Te;if(c("[",!0)){do Te=O(!0),ee.push(Te);while(c(",",!0));c("]"),typeof Te<"u"&&Re(I,U+"."+R,Te)}}else ee=O(!0),Re(I,U+"."+R,ee);var Ye=G[se];Ye&&(ee=[].concat(Ye).concat(ee)),se!=="__proto__"&&(G[se]=ee),c(",",!0),c(";",!0)}return G}var Oe=O(!0);return Re(I,U,Oe),Oe}function Re(I,U,j){if(m===I&&/^features\./.test(U)){S[U]=j;return}I.setOption&&I.setOption(U,j)}function ce(I,U,j,G){I.setParsedOption&&I.setParsedOption(U,j,G)}function _e(I){if(c("[",!0)){do xe(I,"option");while(c(",",!0));c("]")}return I}function qe(I,U,j){if(j===void 0&&(j=0),j>ns.recursionLimit)throw Error("max depth exceeded");if(!to.test(U=o()))throw T(U,"service name");var G=new Nwe(U);E(G,function(se){if(!g(G,se,j))if(se==="rpc")H(G,se);else throw T(se)}),I.add(G),I===m&&y.push(G)}function H(I,U){var j=l(),G=U;if(!to.test(U=o()))throw T(U,"name");var ee=U,se,Te,Ye,Oe;if(c("("),c("stream",!0)&&(Te=!0),!ro.test(U=o())||(se=U,c(")"),c("returns"),c("("),c("stream",!0)&&(Oe=!0),!ro.test(U=o())))throw T(U);Ye=U,c(")");var ye=new kwe(ee,G,se,Ye,Te,Oe);ye.comment=j,E(ye,function(Se){if(Se==="option")xe(ye,Se),c(";");else throw T(Se)}),I.add(ye)}function le(I,U,j){if(!ro.test(U=o()))throw T(U,"reference");var G=U;E(null,function(se){switch(se){case"required":case"repeated":Y(I,se,G,j+1);break;case"optional":h==="proto3"?Y(I,"proto3_optional",G,j+1):Y(I,"optional",G,j+1);break;default:if(h==="proto2"||!ro.test(se))throw T(se);s(se),Y(I,"optional",G,j+1);break}})}for(var R;(R=o())!==null;)switch(R){case"package":if(!u)throw T(R);F();break;case"import":if(!u)throw T(R);_();break;case"syntax":if(!u)throw T(R);re();break;case"edition":if(!u)throw T(R);N();break;case"option":xe(m,R),c(";",!0);break;default:if(g(m,R,0)){u=!1;continue}throw T(R)}return w(),is.filename=null,{package:d,imports:f,weakImports:p,root:e}}});var f5=v((Yct,d5)=>{"use strict";d5.exports=yi;var Gwe=/\/|\./;function yi(t,e){Gwe.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),yi[t]=e}yi("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var u5;yi("duration",{Duration:u5={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});yi("timestamp",{Timestamp:u5});yi("empty",{Empty:{fields:{}}});yi("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});yi("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});yi("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});yi.get=function(e){return yi[e]||null}});var h5=v((Kct,p5)=>{"use strict";var ya=p5.exports=e5();ya.build="full";ya.tokenize=ik();ya.parse=l5();ya.common=f5();ya.Root._configure(ya.Type,ya.parse,ya.common)});var QT=v((Zct,m5)=>{"use strict";m5.exports=h5()});var ok=v((Jct,qwe)=>{qwe.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1e3,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1e3,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536e6,536e6]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var b5=v((Ge,T5)=>{"use strict";var $r=QT();T5.exports=Ge=$r.descriptor=$r.Root.fromJSON(ok()).lookup(".google.protobuf");var g5=$r.Namespace,Cg=$r.Root,os=$r.Enum,Si=$r.Type,Sa=$r.Field,Vwe=$r.MapField,eb=$r.OneOf,Ig=$r.Service,tb=$r.Method,_5=$r.util.patterns,Hwe=_5.numberRe,rb=_5.typeRefRe;Cg.fromDescriptor=function(e){typeof e.length=="number"&&(e=Ge.FileDescriptorSet.decode(e));var r=new Cg;if(e.file)for(var n,i,o=0,s;o<e.file.length;++o){i=r,(n=e.file[o]).package&&n.package.length&&(i=r.define(n.package));var a=txe(n);if(n.name&&n.name.length&&r.files.push(i.filename=n.name),n.messageType)for(s=0;s<n.messageType.length;++s)i.add(Si.fromDescriptor(n.messageType[s],a));if(n.enumType)for(s=0;s<n.enumType.length;++s)i.add(os.fromDescriptor(n.enumType[s],a));if(n.extension)for(s=0;s<n.extension.length;++s)i.add(Sa.fromDescriptor(n.extension[s],a));if(n.service)for(s=0;s<n.service.length;++s)i.add(Ig.fromDescriptor(n.service[s],a));var c=Ud(n.options,Ge.FileOptions);if(c){var l=Object.keys(c);for(s=0;s<l.length;++s)i.setOption(l[s],c[l[s]])}}return r.resolveAll()};Cg.prototype.toDescriptor=function(e){var r=Ge.FileDescriptorSet.create();return y5(this,r.file,e),r};function y5(t,e,r){var n=Ge.FileDescriptorProto.create({name:t.filename||(t.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});rxe(r,n),t instanceof Cg||(n.package=t.fullName.substring(1));for(var i=0,o;i<t.nestedArray.length;++i)(o=t._nestedArray[i])instanceof Si?n.messageType.push(o.toDescriptor(r)):o instanceof os?n.enumType.push(o.toDescriptor()):o instanceof Sa?n.extension.push(o.toDescriptor(r)):o instanceof Ig?n.service.push(o.toDescriptor()):o instanceof g5&&y5(o,e,r);n.options=Fd(t.options,Ge.FileOptions),n.messageType.length+n.enumType.length+n.extension.length+n.service.length&&e.push(n)}var Wwe=0;Si.fromDescriptor=function(e,r,n,i){if(i===void 0&&(i=0),i>$r.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=Ge.DescriptorProto.decode(e));var o=new Si(e.name.length?e.name:"Type"+Wwe++,Ud(e.options,Ge.MessageOptions)),s;if(n||(o._edition=r),e.oneofDecl)for(s=0;s<e.oneofDecl.length;++s)o.add(eb.fromDescriptor(e.oneofDecl[s]));if(e.field)for(s=0;s<e.field.length;++s){var a=Sa.fromDescriptor(e.field[s],r,!0);o.add(a),e.field[s].hasOwnProperty("oneofIndex")&&o.oneofsArray[e.field[s].oneofIndex].add(a)}if(e.extension)for(s=0;s<e.extension.length;++s)o.add(Sa.fromDescriptor(e.extension[s],r,!0));if(e.nestedType)for(s=0;s<e.nestedType.length;++s)o.add(Si.fromDescriptor(e.nestedType[s],r,!0,i+1)),e.nestedType[s].options&&e.nestedType[s].options.mapEntry&&o.setOption("map_entry",!0);if(e.enumType)for(s=0;s<e.enumType.length;++s)o.add(os.fromDescriptor(e.enumType[s],r,!0));if(e.extensionRange&&e.extensionRange.length)for(o.extensions=[],s=0;s<e.extensionRange.length;++s)o.extensions.push([e.extensionRange[s].start,e.extensionRange[s].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(o.reserved=[],e.reservedRange)for(s=0;s<e.reservedRange.length;++s)o.reserved.push([e.reservedRange[s].start,e.reservedRange[s].end]);if(e.reservedName)for(s=0;s<e.reservedName.length;++s)o.reserved.push(e.reservedName[s])}return o};Si.prototype.toDescriptor=function(e){var r=Ge.DescriptorProto.create({name:this.name}),n;for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof Vwe){var o=sk(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),s=sk(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),a=s===11||s===14?this._fieldsArray[n].resolvedType&&v5(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(Ge.DescriptorProto.create({name:i.typeName,field:[Ge.FieldDescriptorProto.create({name:"key",number:1,label:1,type:o}),Ge.FieldDescriptorProto.create({name:"value",number:2,label:1,type:s,typeName:a})],options:Ge.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof Sa?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof Si?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof os&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(Ge.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)typeof this.reserved[n]=="string"?r.reservedName.push(this.reserved[n]):r.reservedRange.push(Ge.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=Fd(this.options,Ge.MessageOptions),r};Sa.fromDescriptor=function(e,r,n){if(typeof e.length=="number"&&(e=Ge.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var i=e.typeName,o;if(i!=null&&i!==""){if(typeof i!="string"||!rb.test(i))throw Error("illegal type name: "+i);o=i}else o=Xwe(e.type);var s;switch(e.label){case 1:s=void 0;break;case 2:s="required";break;case 3:s="repeated";break;default:throw Error("illegal label: "+e.label)}var a=e.extendee;if(a!=null&&a!==""){if(typeof a!="string"||!rb.test(a))throw Error("illegal type name: "+a)}else a=void 0;var c=new Sa(e.name.length?e.name:"field"+e.number,e.number,o,s,a);if(n||(c._edition=r),c.options=Ud(e.options,Ge.FieldOptions),e.proto3_optional&&(c.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:var u=Hwe.exec(l);u&&(l=parseInt(l));break}c.setOption("default",l)}return Qwe(e.type)&&(r==="proto3"?e.options&&!e.options.packed&&c.setOption("packed",!1):(!r||r==="proto2")&&e.options&&e.options.packed&&c.setOption("packed",!0)),c};Sa.prototype.toDescriptor=function(e){var r=Ge.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)r.type=11,r.typeName=$r.util.ucFirst(this.name),r.label=3;else{switch(r.type=sk(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:r.typeName=this.resolvedType?v5(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?r.label=3:this.required&&e==="proto2"?r.label=2:r.label=1}if(r.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof Si&&(r.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(r.options=Fd(this.options,Ge.FieldOptions),this.options.default!=null&&(r.defaultValue=String(this.options.default)),this.options.proto3_optional&&(r.proto3_optional=!0)),e==="proto3"?this.packed||((r.options||(r.options=Ge.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((r.options||(r.options=Ge.FieldOptions.create())).packed=!0),r};var Ywe=0;os.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=Ge.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var o=0;o<e.value.length;++o){var s=e.value[o].name,a=e.value[o].number||0;i[s&&s.length?s:"NAME"+a]=a}var c=new os(e.name&&e.name.length?e.name:"Enum"+Ywe++,i,Ud(e.options,Ge.EnumOptions));return n||(c._edition=r),c};os.prototype.toDescriptor=function(){for(var e=[],r=0,n=Object.keys(this.values);r<n.length;++r)e.push(Ge.EnumValueDescriptorProto.create({name:n[r],number:this.values[n[r]]}));return Ge.EnumDescriptorProto.create({name:this.name,value:e,options:Fd(this.options,Ge.EnumOptions)})};var Kwe=0;eb.fromDescriptor=function(e){return typeof e.length=="number"&&(e=Ge.OneofDescriptorProto.decode(e)),new eb(e.name&&e.name.length?e.name:"oneof"+Kwe++)};eb.prototype.toDescriptor=function(){return Ge.OneofDescriptorProto.create({name:this.name})};var Zwe=0;Ig.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=Ge.ServiceDescriptorProto.decode(e));var i=new Ig(e.name&&e.name.length?e.name:"Service"+Zwe++,Ud(e.options,Ge.ServiceOptions));if(n||(i._edition=r),e.method)for(var o=0;o<e.method.length;++o)i.add(tb.fromDescriptor(e.method[o]));return i};Ig.prototype.toDescriptor=function(){for(var e=[],r=0;r<this.methodsArray.length;++r)e.push(this._methodsArray[r].toDescriptor());return Ge.ServiceDescriptorProto.create({name:this.name,method:e,options:Fd(this.options,Ge.ServiceOptions)})};var Jwe=0;tb.fromDescriptor=function(e){typeof e.length=="number"&&(e=Ge.MethodDescriptorProto.decode(e));var r=e.inputType,n=e.outputType;if(r!=null&&r!==""&&(typeof r!="string"||!rb.test(r)))throw Error("illegal type name: "+r);if(n!=null&&n!==""&&(typeof n!="string"||!rb.test(n)))throw Error("illegal type name: "+n);return new tb(e.name&&e.name.length?e.name:"Method"+Jwe++,"rpc",r,n,!!e.clientStreaming,!!e.serverStreaming,Ud(e.options,Ge.MethodOptions))};tb.prototype.toDescriptor=function(){return Ge.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:Fd(this.options,Ge.MethodOptions)})};function Xwe(t){switch(t){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+t)}function Qwe(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function sk(t,e,r){switch(t){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(e instanceof os)return 14;if(e instanceof Si)return r?10:11;throw Error("illegal type: "+t)}function S5(t,e){for(var r={},n=0,i,o;n<e.fieldsArray.length;++n)if((o=(i=e._fieldsArray[n]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(t,o)){var s=exe(o);i.resolvedType instanceof Si?r[s]=S5(t[o],i.resolvedType):i.resolvedType instanceof os?r[s]=i.resolvedType.valuesById[t[o]]:r[s]=t[o]}return r}function Ud(t,e){if(t)return S5(e.toObject(t),e)}function E5(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;++i){var o=n[i],s=$r.util.camelCase(o);if(Object.prototype.hasOwnProperty.call(e.fields,s)){var a=e.fields[s];a.resolvedType instanceof Si?r[s]=E5(t[o],a.resolvedType):r[s]=t[o],a.repeated&&!Array.isArray(r[s])&&(r[s]=[r[s]])}}return r}function Fd(t,e){if(t)return e.fromObject(E5(t,e))}function v5(t,e){var r=t.fullName.split("."),n=e.fullName.split("."),i=0,o=0,s=n.length-1;if(!(t instanceof Cg)&&e instanceof g5)for(;i<r.length&&o<s&&r[i]===n[o];){var a=e.lookup(r[i++],!0);if(a!==null&&a!==e)break;++o}else for(;i<r.length&&o<s&&r[i]===n[o];++i,++o);return n.slice(o).join(".")}function exe(t){return t.substring(0,1)+t.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,r){return"_"+r.toLowerCase()})}function txe(t){if(t.syntax==="editions"){if(t.edition===Ge.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+t.edition)}return t.syntax==="proto3"?"proto3":"proto2"}function rxe(t,e){if(t)if(t==="proto2"||t==="proto3")e.syntax=t;else if(e.syntax="editions",t==="2023")e.edition=Ge.Edition.EDITION_2023;else throw new Error("Unsupported edition "+t)}});var A5=v((Xct,nxe)=>{nxe.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var w5=v((Qct,ixe)=>{ixe.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var x5=v((elt,oxe)=>{oxe.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var P5=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});Ea.addCommonProtos=Ea.loadProtosWithOptionsSync=Ea.loadProtosWithOptions=void 0;var R5=Z("fs"),C5=Z("path"),Bd=QT();function I5(t,e){let r=t.resolvePath;t.resolvePath=(n,i)=>{if(C5.isAbsolute(i))return i;for(let o of e){let s=C5.join(o,i);try{return R5.accessSync(s,R5.constants.R_OK),s}catch{continue}}return process.emitWarning(`${i} not found in any of the include paths ${e}`),r(n,i)}}async function sxe(t,e){let r=new Bd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));I5(r,e.includeDirs)}let n=await r.load(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptions=sxe;function axe(t,e){let r=new Bd.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");I5(r,e.includeDirs)}let n=r.loadSync(t,e);return n.resolveAll(),n}Ea.loadProtosWithOptionsSync=axe;function cxe(){let t=A5(),e=ok(),r=w5(),n=x5();Bd.common("api",t.nested.google.nested.protobuf.nested),Bd.common("descriptor",e.nested.google.nested.protobuf.nested),Bd.common("source_context",r.nested.google.nested.protobuf.nested),Bd.common("type",n.nested.google.nested.protobuf.nested)}Ea.addCommonProtos=cxe});var fk=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.loadFileDescriptorSetFromObject=jt.loadFileDescriptorSetFromBuffer=jt.fromJSON=jt.loadSync=jt.load=jt.IdempotencyLevel=jt.isAnyExtension=jt.Long=void 0;var lxe=f8(),no=QT(),uk=b5(),dk=P5(),uxe=hN();jt.Long=uxe;function dxe(t){return"@type"in t&&typeof t["@type"]=="string"}jt.isAnyExtension=dxe;var O5;(function(t){t.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",t.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",t.IDEMPOTENT="IDEMPOTENT"})(O5=jt.IdempotencyLevel||(jt.IdempotencyLevel={}));var N5={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function fxe(t,e){return t===""?e:t+"."+e}function pxe(t){return t instanceof no.Service||t instanceof no.Type||t instanceof no.Enum}function hxe(t){return t instanceof no.Namespace||t instanceof no.Root}function k5(t,e){let r=fxe(e,t.name);return pxe(t)?[[r,t]]:hxe(t)&&typeof t.nested<"u"?Object.keys(t.nested).map(n=>k5(t.nested[n],r)).reduce((n,i)=>n.concat(i),[]):[]}function ak(t,e){return function(n){return t.toObject(t.decode(n),e)}}function ck(t){return function(r){if(Array.isArray(r))throw new Error(`Failed to serialize message: expected object with ${t.name} structure, got array instead`);let n=t.fromObject(r);return t.encode(n).finish()}}function mxe(t){return(t||[]).reduce((e,r)=>{for(let[n,i]of Object.entries(r))n==="uninterpreted_option"?e.uninterpreted_option.push(r.uninterpreted_option):e[n]=i;return e},{deprecated:!1,idempotency_level:O5.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function gxe(t,e,r,n){let i=t.resolvedRequestType,o=t.resolvedResponseType;return{path:"/"+e+"/"+t.name,requestStream:!!t.requestStream,responseStream:!!t.responseStream,requestSerialize:ck(i),requestDeserialize:ak(i,r),responseSerialize:ck(o),responseDeserialize:ak(o,r),originalName:lxe(t.name),requestType:lk(i,r,n),responseType:lk(o,r,n),options:mxe(t.parsedOptions)}}function _xe(t,e,r,n){let i={};for(let o of t.methodsArray)i[o.name]=gxe(o,e,r,n);return i}function lk(t,e,r){let n=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,N5),fileDescriptorProtos:r,serialize:ck(t),deserialize:ak(t,e)}}function yxe(t,e){let r=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,N5),fileDescriptorProtos:e}}function Sxe(t,e,r,n){if(t instanceof no.Service)return _xe(t,e,r,n);if(t instanceof no.Type)return lk(t,r,n);if(t instanceof no.Enum)return yxe(t,n);throw new Error("Type mismatch in reflection object handling")}function nb(t,e){let r={};t.resolveAll();let i=t.toDescriptor("proto3").file.map(o=>Buffer.from(uk.FileDescriptorProto.encode(o).finish()));for(let[o,s]of k5(t,""))r[o]=Sxe(s,o,e,i);return r}function M5(t,e){e=e||{};let r=no.Root.fromDescriptor(t);return r.resolveAll(),nb(r,e)}function Exe(t,e){return(0,dk.loadProtosWithOptions)(t,e).then(r=>nb(r,e))}jt.load=Exe;function vxe(t,e){let r=(0,dk.loadProtosWithOptionsSync)(t,e);return nb(r,e)}jt.loadSync=vxe;function Txe(t,e){e=e||{};let r=no.Root.fromJSON(t);return r.resolveAll(),nb(r,e)}jt.fromJSON=Txe;function bxe(t,e){let r=uk.FileDescriptorSet.decode(t);return M5(r,e)}jt.loadFileDescriptorSetFromBuffer=bxe;function Axe(t,e){let r=uk.FileDescriptorSet.fromObject(t);return M5(r,e)}jt.loadFileDescriptorSetFromObject=Axe;(0,dk.addCommonProtos)()});var va=v(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.registerChannelzSocket=yt.registerChannelzServer=yt.registerChannelzSubchannel=yt.registerChannelzChannel=yt.ChannelzCallTrackerStub=yt.ChannelzCallTracker=yt.ChannelzChildrenTrackerStub=yt.ChannelzChildrenTracker=yt.ChannelzTrace=yt.ChannelzTraceStub=void 0;yt.unregisterChannelzRef=Ixe;yt.getChannelzHandlers=z5;yt.getChannelzServiceDefinition=G5;yt.setup=Bxe;var ob=Z("net"),_l=(DK(),Nr(MK)),Pg=Lr(),Og=Ve(),wxe=Zr(),xxe=bT(),Rxe=CT();function pk(t){return{channel_id:t.id,name:t.name}}function yk(t){return{subchannel_id:t.id,name:t.name}}function Cxe(t){return{server_id:t.id}}function cb(t){return{socket_id:t.id,name:t.name}}var D5=32,Sk=100,hk=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:io(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};yt.ChannelzTraceStub=hk;var mk=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,r,n){let i=new Date;this.events.push({description:r,severity:e,timestamp:i,childChannel:n?.kind==="channel"?n:void 0,childSubchannel:n?.kind==="subchannel"?n:void 0}),this.events.length>=D5*2&&(this.events=this.events.slice(D5)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:io(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:io(e.timestamp),channel_ref:e.childChannel?pk(e.childChannel):null,subchannel_ref:e.childSubchannel?yk(e.childSubchannel):null}))}}};yt.ChannelzTrace=mk;var sb=class{constructor(){this.channelChildren=new _l.OrderedMap,this.subchannelChildren=new _l.OrderedMap,this.socketChildren=new _l.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let r=this.trackerMap[e.kind],n=r.find(e.id);n.equals(r.end())?r.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){let r=this.trackerMap[e.kind],n=r.getElementByKey(e.id);n!==void 0&&(n.count-=1,n.count===0&&r.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};yt.ChannelzChildrenTracker=sb;var gk=class extends sb{refChild(){}unrefChild(){}};yt.ChannelzChildrenTrackerStub=gk;var ab=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};yt.ChannelzCallTracker=ab;var _k=class extends ab{addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};yt.ChannelzCallTrackerStub=_k;var ss={channel:new _l.OrderedMap,subchannel:new _l.OrderedMap,server:new _l.OrderedMap,socket:new _l.OrderedMap},lb=t=>{let e=1;function r(){return e++}let n=ss[t];return(i,o,s)=>{let a=r(),c={id:a,name:i,kind:t};return s&&n.setElement(a,{ref:c,getInfo:o}),c}};yt.registerChannelzChannel=lb("channel");yt.registerChannelzSubchannel=lb("subchannel");yt.registerChannelzServer=lb("server");yt.registerChannelzSocket=lb("socket");function Ixe(t){ss[t.kind].eraseElementByKey(t.id)}function Pxe(t){let e=Number.parseInt(t,16);return[e/256|0,e%256]}function L5(t){if(t==="")return[];let e=t.split(":").map(n=>Pxe(n));return[].concat(...e)}function Oxe(t){return(0,ob.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,ob.isIPv4)(t.substring(7))}function $5(t){return Buffer.from(Uint8Array.from(t.split(".").map(e=>Number.parseInt(e))))}function Nxe(t){if((0,ob.isIPv4)(t))return $5(t);if(Oxe(t))return $5(t.substring(7));if((0,ob.isIPv6)(t)){let e,r,n=t.indexOf("::");n===-1?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));let i=Buffer.from(L5(e)),o=Buffer.from(L5(r)),s=Buffer.alloc(16-i.length-o.length,0);return Buffer.concat([i,s,o])}else return null}function F5(t){switch(t){case Pg.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case Pg.ConnectivityState.IDLE:return{state:"IDLE"};case Pg.ConnectivityState.READY:return{state:"READY"};case Pg.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case Pg.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function io(t){if(!t)return null;let e=t.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function B5(t){let e=t.getInfo(),r=[],n=[];return e.children.channels.forEach(i=>{r.push(pk(i[1].ref))}),e.children.subchannels.forEach(i=>{n.push(yk(i[1].ref))}),{ref:pk(t.ref),data:{target:e.target,state:F5(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:io(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function kxe(t,e){let r=parseInt(t.request.channel_id,10),n=ss.channel.getElementByKey(r);if(n===void 0){e({code:Og.Status.NOT_FOUND,details:"No channel data found for id "+r});return}e(null,{channel:B5(n)})}function Mxe(t,e){let r=parseInt(t.request.max_results,10)||Sk,n=[],i=parseInt(t.request.start_channel_id,10),o=ss.channel,s;for(s=o.lowerBound(i);!s.equals(o.end())&&n.length<r;s=s.next())n.push(B5(s.pointer[1]));e(null,{channel:n,end:s.equals(o.end())})}function j5(t){let e=t.getInfo(),r=[];return e.listenerChildren.sockets.forEach(n=>{r.push(cb(n[1].ref))}),{ref:Cxe(t.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:io(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:r}}function Dxe(t,e){let r=parseInt(t.request.server_id,10),i=ss.server.getElementByKey(r);if(i===void 0){e({code:Og.Status.NOT_FOUND,details:"No server data found for id "+r});return}e(null,{server:j5(i)})}function Lxe(t,e){let r=parseInt(t.request.max_results,10)||Sk,n=parseInt(t.request.start_server_id,10),i=ss.server,o=[],s;for(s=i.lowerBound(n);!s.equals(i.end())&&o.length<r;s=s.next())o.push(j5(s.pointer[1]));e(null,{server:o,end:s.equals(i.end())})}function $xe(t,e){let r=parseInt(t.request.subchannel_id,10),n=ss.subchannel.getElementByKey(r);if(n===void 0){e({code:Og.Status.NOT_FOUND,details:"No subchannel data found for id "+r});return}let i=n.getInfo(),o=[];i.children.sockets.forEach(a=>{o.push(cb(a[1].ref))});let s={ref:yk(n.ref),data:{target:i.target,state:F5(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:io(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:o};e(null,{subchannel:s})}function U5(t){var e;return(0,wxe.isTcpSubchannelAddress)(t)?{address:"tcpip_address",tcpip_address:{ip_address:(e=Nxe(t.host))!==null&&e!==void 0?e:void 0,port:t.port}}:{address:"uds_address",uds_address:{filename:t.path}}}function Uxe(t,e){var r,n,i,o,s;let a=parseInt(t.request.socket_id,10),c=ss.socket.getElementByKey(a);if(c===void 0){e({code:Og.Status.NOT_FOUND,details:"No socket data found for id "+a});return}let l=c.getInfo(),u=l.security?{model:"tls",tls:{cipher_suite:l.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(r=l.security.cipherSuiteStandardName)!==null&&r!==void 0?r:void 0,other_name:(n=l.security.cipherSuiteOtherName)!==null&&n!==void 0?n:void 0,local_certificate:(i=l.security.localCertificate)!==null&&i!==void 0?i:void 0,remote_certificate:(o=l.security.remoteCertificate)!==null&&o!==void 0?o:void 0}}:null,d={ref:cb(c.ref),local:l.localAddress?U5(l.localAddress):null,remote:l.remoteAddress?U5(l.remoteAddress):null,remote_name:(s=l.remoteName)!==null&&s!==void 0?s:void 0,security:u,data:{keep_alives_sent:l.keepAlivesSent,streams_started:l.streamsStarted,streams_succeeded:l.streamsSucceeded,streams_failed:l.streamsFailed,last_local_stream_created_timestamp:io(l.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:io(l.lastRemoteStreamCreatedTimestamp),messages_received:l.messagesReceived,messages_sent:l.messagesSent,last_message_received_timestamp:io(l.lastMessageReceivedTimestamp),last_message_sent_timestamp:io(l.lastMessageSentTimestamp),local_flow_control_window:l.localFlowControlWindow?{value:l.localFlowControlWindow}:null,remote_flow_control_window:l.remoteFlowControlWindow?{value:l.remoteFlowControlWindow}:null}};e(null,{socket:d})}function Fxe(t,e){let r=parseInt(t.request.server_id,10),n=ss.server.getElementByKey(r);if(n===void 0){e({code:Og.Status.NOT_FOUND,details:"No server data found for id "+r});return}let i=parseInt(t.request.start_socket_id,10),o=parseInt(t.request.max_results,10)||Sk,a=n.getInfo().sessionChildren.sockets,c=[],l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<o;l=l.next())c.push(cb(l.pointer[1].ref));e(null,{socket_ref:c,end:l.equals(a.end())})}function z5(){return{GetChannel:kxe,GetTopChannels:Mxe,GetServer:Dxe,GetServers:Lxe,GetSubchannel:$xe,GetSocket:Uxe,GetServerSockets:Fxe}}var ib=null;function G5(){if(ib)return ib;let t=fk().loadSync,e=t("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return ib=(0,Rxe.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,ib}function Bxe(){(0,xxe.registerAdminService)(G5,z5)}});var ub=v(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});Ek.getNextCallNumber=zxe;var jxe=0;function zxe(){return jxe++}});var vk=v(db=>{"use strict";Object.defineProperty(db,"__esModule",{value:!0});db.CompressionAlgorithms=void 0;var q5;(function(t){t[t.identity=0]="identity",t[t.deflate=1]="deflate",t[t.gzip=2]="gzip"})(q5||(db.CompressionAlgorithms=q5={}))});var bk=v(fb=>{"use strict";Object.defineProperty(fb,"__esModule",{value:!0});fb.BaseFilter=void 0;var Tk=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};fb.BaseFilter=Tk});var Ck=v(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});zd.CompressionFilterFactory=zd.CompressionFilter=void 0;var pb=Z("zlib"),H5=vk(),Ta=Ve(),Gxe=bk(),qxe=ht(),Vxe=t=>typeof t=="number"&&typeof H5.CompressionAlgorithms[t]=="string",jd=class{async writeMessage(e,r){let n=e;r&&(n=await this.compressMessage(n));let i=Buffer.allocUnsafe(n.length+5);return i.writeUInt8(r?1:0,0),i.writeUInt32BE(n.length,1),n.copy(i,5),i}async readMessage(e){let r=e.readUInt8(0)===1,n=e.slice(5);return r&&(n=await this.decompressMessage(n)),n}},yl=class extends jd{async compressMessage(e){return e}async writeMessage(e,r){let n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},Ak=class extends jd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.deflate(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createInflate();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},wk=class extends jd{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{pb.gzip(e,(i,o)=>{i?n(i):r(o)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,o=[],s=pb.createGunzip();s.on("error",a=>{n({code:Ta.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),s.on("data",a=>{o.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(s.destroy(),n({code:Ta.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),s.on("end",()=>{r(Buffer.concat(o))}),s.write(e),s.end()})}},xk=class extends jd{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function V5(t,e){switch(t){case"identity":return new yl;case"deflate":return new Ak(e);case"gzip":return new wk(e);default:return new xk(t)}}var hb=class extends Gxe.BaseFilter{constructor(e,r){var n,i,o;super(),this.sharedFilterConfig=r,this.sendCompression=new yl,this.receiveCompression=new yl,this.currentCompressionAlgorithm="identity";let s=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(n=e["grpc.max_receive_message_length"])!==null&&n!==void 0?n:Ta.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(i=e["grpc.max_send_message_length"])!==null&&i!==void 0?i:Ta.DEFAULT_MAX_SEND_MESSAGE_LENGTH,s!==void 0)if(Vxe(s)){let a=H5.CompressionAlgorithms[s],c=(o=r.serverSupportedEncodingHeader)===null||o===void 0?void 0:o.split(",");(!c||c.includes(a))&&(this.currentCompressionAlgorithm=a,this.sendCompression=V5(this.currentCompressionAlgorithm,-1))}else qxe.log(Ta.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${s}`)}async sendMetadata(e){let r=await e;return r.set("grpc-accept-encoding","identity,deflate,gzip"),r.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?r.remove("grpc-encoding"):r.set("grpc-encoding",this.currentCompressionAlgorithm),r}receiveMetadata(e){let r=e.get("grpc-encoding");if(r.length>0){let i=r[0];typeof i=="string"&&(this.receiveCompression=V5(i,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let n=e.get("grpc-accept-encoding")[0];return n&&(this.sharedFilterConfig.serverSupportedEncodingHeader=n,n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new yl,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var r;let n=await e;if(this.maxSendMessageLength!==-1&&n.message.length>this.maxSendMessageLength)throw{code:Ta.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return this.sendCompression instanceof yl?i=!1:i=(((r=n.flags)!==null&&r!==void 0?r:0)&2)===0,{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};zd.CompressionFilter=hb;var Rk=class{constructor(e,r){this.options=r,this.sharedFilterConfig={}}createFilter(){return new hb(this.options,this.sharedFilterConfig)}};zd.CompressionFilterFactory=Rk});var Ng=v(Ik=>{"use strict";Object.defineProperty(Ik,"__esModule",{value:!0});Ik.restrictControlPlaneStatusCode=Wxe;var oo=Ve(),Hxe=[oo.Status.OK,oo.Status.INVALID_ARGUMENT,oo.Status.NOT_FOUND,oo.Status.ALREADY_EXISTS,oo.Status.FAILED_PRECONDITION,oo.Status.ABORTED,oo.Status.OUT_OF_RANGE,oo.Status.DATA_LOSS];function Wxe(t,e){return Hxe.includes(t)?{code:oo.Status.INTERNAL,details:`Invalid status from control plane: ${t} ${oo.Status[t]} ${e}`}:{code:t,details:e}}});var Gd=v(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.minDeadline=Yxe;Sl.getDeadlineTimeoutString=Zxe;Sl.getRelativeTimeout=Xxe;Sl.deadlineToString=Qxe;Sl.formatDateDifference=eRe;function Yxe(...t){let e=1/0;for(let r of t){let n=r instanceof Date?r.getTime():r;n<e&&(e=n)}return e}var Kxe=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function Zxe(t){let e=new Date().getTime();t instanceof Date&&(t=t.getTime());let r=Math.max(t-e,0);for(let[n,i]of Kxe){let o=r/i;if(o<1e8)return String(Math.ceil(o))+n}throw new Error("Deadline is too far in the future")}var Jxe=2147483647;function Xxe(t){let e=t instanceof Date?t.getTime():t,r=new Date().getTime(),n=e-r;return n<0?0:n>Jxe?1/0:n}function Qxe(t){if(t instanceof Date)return t.toISOString();{let e=new Date(t);return Number.isNaN(e.getTime())?""+t:e.toISOString()}}function eRe(t,e){return((e.getTime()-t.getTime())/1e3).toFixed(3)+"s"}});var gb=v(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.FilterStackFactory=qd.FilterStack=void 0;var mb=class{constructor(e){this.filters=e}sendMetadata(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMetadata(r);return r}receiveMetadata(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMetadata(r);return r}sendMessage(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMessage(r);return r}receiveMessage(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMessage(r);return r}receiveTrailers(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveTrailers(r);return r}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};qd.FilterStack=mb;var Pk=class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new mb(this.factories.map(e=>e.createFilter()))}};qd.FilterStackFactory=Pk});var W5=v(yb=>{"use strict";Object.defineProperty(yb,"__esModule",{value:!0});yb.SingleSubchannelChannel=void 0;var tRe=ub(),kg=va(),rRe=Ck(),nRe=Lr(),Mg=Ve(),iRe=Ng(),oRe=Gd(),sRe=gb(),Ok=Kt(),aRe=ai(),_b=Dr(),Nk=class{constructor(e,r,n,i,o){var s,a;this.subchannel=e,this.method=r,this.options=i,this.callNumber=o,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let c=this.method.split("/"),l="";c.length>=2&&(l=c[1]);let u=(a=(s=(0,_b.splitHostPort)(this.options.host))===null||s===void 0?void 0:s.host)!==null&&a!==void 0?a:"localhost";this.serviceUrl=`https://${u}/${l}`;let d=(0,oRe.getRelativeTimeout)(i.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(Mg.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(Mg.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,r){this.childCall?this.childCall.cancelWithStatus(e,r):this.pendingStatus={code:e,details:r,metadata:new Ok.Metadata}}getPeer(){var e,r;return(r=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.subchannel.getAddress()}async start(e,r){if(this.pendingStatus){r.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==nRe.ConnectivityState.READY){r.onReceiveStatus({code:Mg.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new Ok.Metadata});return}let n=await this.filterStack.sendMetadata(Promise.resolve(e)),i;try{i=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(s){let a=s,{code:c,details:l}=(0,iRe.restrictControlPlaneStatusCode)(typeof a.code=="number"?a.code:Mg.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${a.message}`);r.onReceiveStatus({code:c,details:l,metadata:new Ok.Metadata});return}i.merge(n);let o={onReceiveMetadata:async s=>{r.onReceiveMetadata(await this.filterStack.receiveMetadata(s))},onReceiveMessage:async s=>{this.readFilterPending=!0;let a=await this.filterStack.receiveMessage(s);this.readFilterPending=!1,r.onReceiveMessage(a),this.pendingStatus&&r.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async s=>{let a=await this.filterStack.receiveTrailers(s);this.readFilterPending?this.pendingStatus=a:r.onReceiveStatus(a)}};this.childCall=this.subchannel.createCall(i,this.options.host,this.method,o),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,r){this.writeFilterPending=!0;let n=await this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},kk=class{constructor(e,r,n){this.subchannel=e,this.target=r,this.channelzEnabled=!1,this.channelzTrace=new kg.ChannelzTrace,this.callTracker=new kg.ChannelzCallTracker,this.childrenTracker=new kg.ChannelzChildrenTracker,this.channelzEnabled=n["grpc.enable_channelz"]!==0,this.channelzRef=(0,kg.registerChannelzChannel)((0,_b.uriToString)(r),()=>({target:`${(0,_b.uriToString)(r)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new sRe.FilterStackFactory([new rRe.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,kg.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,_b.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,r,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,r){let n={deadline:r,host:(0,aRe.getDefaultAuthority)(this.target),flags:Mg.Propagate.DEFAULTS,parentCall:null};return new Nk(this.subchannel,e,this.filterStackFactory,n,(0,tRe.getNextCallNumber)())}};yb.SingleSubchannelChannel=kk});var Y5=v(Eb=>{"use strict";Object.defineProperty(Eb,"__esModule",{value:!0});Eb.Subchannel=void 0;var lt=Lr(),cRe=bd(),Mk=ht(),Sb=Ve(),lRe=Dr(),uRe=Zr(),so=va(),dRe=W5(),fRe="subchannel",pRe=~(1<<31),Dk=class{constructor(e,r,n,i,o){var s;this.channelTarget=e,this.subchannelAddress=r,this.options=n,this.connector=o,this.connectivityState=lt.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let a={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new cRe.BackoffTimeout(()=>{this.handleBackoffTimer()},a),this.backoffTimeout.unref(),this.subchannelAddressString=(0,uRe.subchannelAddressToString)(r),this.keepaliveTime=(s=n["grpc.keepalive_time_ms"])!==null&&s!==void 0?s:-1,n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new so.ChannelzTraceStub,this.callTracker=new so.ChannelzCallTrackerStub,this.childrenTracker=new so.ChannelzChildrenTrackerStub,this.streamTracker=new so.ChannelzCallTrackerStub):(this.channelzTrace=new so.ChannelzTrace,this.callTracker=new so.ChannelzCallTracker,this.childrenTracker=new so.ChannelzChildrenTracker,this.streamTracker=new so.ChannelzCallTracker),this.channelzRef=(0,so.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=i._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){Mk.trace(Sb.LogVerbosity.DEBUG,fRe,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){Mk.trace(Sb.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([lt.ConnectivityState.TRANSIENT_FAILURE],lt.ConnectivityState.CONNECTING):this.transitionToState([lt.ConnectivityState.TRANSIENT_FAILURE],lt.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let r=Math.min(this.keepaliveTime,pRe);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":r})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(r=>{this.transitionToState([lt.ConnectivityState.CONNECTING],lt.ConnectivityState.READY)?(this.transport=r,this.channelzEnabled&&this.childrenTracker.refChild(r.getChannelzRef()),r.addDisconnectListener(n=>{this.transitionToState([lt.ConnectivityState.READY],lt.ConnectivityState.IDLE),n&&this.keepaliveTime>0&&(this.keepaliveTime*=2,Mk.log(Sb.LogVerbosity.ERROR,`Connection to ${(0,lRe.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):r.shutdown()},r=>{this.transitionToState([lt.ConnectivityState.CONNECTING],lt.ConnectivityState.TRANSIENT_FAILURE,`${r}`)})}transitionToState(e,r,n){var i,o;if(e.indexOf(this.connectivityState)===-1)return!1;n?this.trace(lt.ConnectivityState[this.connectivityState]+" -> "+lt.ConnectivityState[r]+' with error "'+n+'"'):this.trace(lt.ConnectivityState[this.connectivityState]+" -> "+lt.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+lt.ConnectivityState[r]);let s=this.connectivityState;switch(this.connectivityState=r,r){case lt.ConnectivityState.READY:this.stopBackoff();break;case lt.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case lt.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(i=this.transport)===null||i===void 0||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case lt.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(o=this.transport)===null||o===void 0||o.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(let a of this.stateListeners)a(this,s,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,so.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([lt.ConnectivityState.CONNECTING,lt.ConnectivityState.READY],lt.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,r,n,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let o;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),o={onCallEnd:s=>{s.code===Sb.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):o={},this.transport.createCall(e,r,n,i,o)}startConnecting(){process.nextTick(()=>{this.transitionToState([lt.ConnectivityState.IDLE],lt.ConnectivityState.CONNECTING)||this.connectivityState===lt.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([lt.ConnectivityState.TRANSIENT_FAILURE],lt.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new dRe.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,r){let n=this.dataProducers.get(e);if(n)return n;let i=r(this);return this.dataProducers.set(e,i),i}removeDataProducer(e){this.dataProducers.delete(e)}};Eb.Subchannel=Dk});var K5=v(vb=>{"use strict";var Lk;Object.defineProperty(vb,"__esModule",{value:!0});vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;vb.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((Lk=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&Lk!==void 0?Lk:"false")==="true"});var Bk=v(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});El.DEFAULT_PORT=void 0;El.setup=vRe;var Z5=ai(),$k=Z("dns"),hRe=MO(),Uk=Ve(),Vd=cl(),mRe=Kt(),gRe=ht(),_Re=Ve(),ba=Dr(),J5=Z("net"),yRe=bd(),X5=K5(),SRe="dns_resolver";function ao(t){gRe.trace(_Re.LogVerbosity.DEBUG,SRe,t)}El.DEFAULT_PORT=443;var ERe=3e4,Fk=class{constructor(e,r,n){var i,o,s;this.target=e,this.listener=r,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new $k.promises.Resolver,ao("Resolver constructed for target "+(0,ba.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let a=(0,ba.splitHostPort)(e.path);a===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,J5.isIPv4)(a.host)||(0,J5.isIPv6)(a.host)?(this.ipResult=[{addresses:[{host:a.host,port:(i=a.port)!==null&&i!==void 0?i:El.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=a.host,this.port=(o=a.port)!==null&&o!==void 0?o:El.DEFAULT_PORT),this.percentage=Math.random()*100,n["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:Uk.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,ba.uriToString)(this.target)}`,metadata:new mRe.Metadata};let c={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new yRe.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},c),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(s=n["grpc.dns_min_time_between_resolutions_ms"])!==null&&s!==void 0?s:ERe,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(ao("Returning IP address for target "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Vd.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)ao("Failed to parse DNS address "+(0,ba.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Vd.statusOrFromError)({code:Uk.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,ba.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;ao("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(r=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,Vd.statusOrFromValue)(r.map(o=>({addresses:[o]})));let n="["+r.map(o=>o.host+":"+o.port).join(",")+"]";ao("Resolved addresses for target "+(0,ba.uriToString)(this.target)+": "+n);let i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},r=>{this.pendingLookupPromise!==null&&(ao("Resolution error for target "+(0,ba.uriToString)(this.target)+": "+r.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,Vd.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(r=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let n;try{n=(0,hRe.extractAndSelectServiceConfig)(r,this.percentage),n?this.latestServiceConfigResult=(0,Vd.statusOrFromValue)(n):this.latestServiceConfigResult=null}catch(i){this.latestServiceConfigResult=(0,Vd.statusOrFromError)({code:Uk.Status.UNAVAILABLE,details:`Parsing service config failed with error ${i.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},r=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){ao("Using alternative DNS resolver.");let n=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(n.every(i=>i.status==="rejected"))throw new Error(n[0].reason);return n.reduce((i,o)=>o.status==="fulfilled"?[...i,...o.value]:i,[]).map(i=>({host:i,port:+this.port}))}return(await $k.promises.lookup(e,{all:!0})).map(n=>({host:n.address,port:+this.port}))}async resolveTxt(e){return X5.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(ao("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):$k.promises.resolveTxt(e)}startNextResolutionTimer(){var e,r;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(r=(e=this.nextResolutionTimer).unref)===null||r===void 0||r.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?ao('resolution update delayed by "min time between resolutions" rate limit'):ao("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}};function vRe(){(0,Z5.registerResolver)("dns",Fk),(0,Z5.registerDefaultScheme)("dns")}});var jk=v($g=>{"use strict";Object.defineProperty($g,"__esModule",{value:!0});$g.parseCIDR=t9;$g.mapProxyName=ORe;$g.getProxiedConnection=NRe;var Dg=ht(),Hd=Ve(),e9=Z("net"),TRe=Z("http"),bRe=ht(),Q5=Zr(),Lg=Dr(),ARe=Z("url"),wRe=Bk(),xRe="proxy";function Wd(t){bRe.trace(Hd.LogVerbosity.DEBUG,xRe,t)}function RRe(){let t="",e="";if(process.env.grpc_proxy)e="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",t=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",t=process.env.http_proxy;else return{};let r;try{r=new ARe.URL(t)}catch{return(0,Dg.log)(Hd.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(r.protocol!=="http:")return(0,Dg.log)(Hd.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let n=null;r.username&&(r.password?((0,Dg.log)(Hd.LogVerbosity.INFO,"userinfo found in proxy URI"),n=decodeURIComponent(`${r.username}:${r.password}`)):n=r.username);let i=r.hostname,o=r.port;o===""&&(o="80");let s={address:`${i}:${o}`};return n&&(s.creds=n),Wd("Proxy server "+s.address+" set by environment variable "+e),s}function CRe(){let t=process.env.no_grpc_proxy,e="no_grpc_proxy";return t||(t=process.env.no_proxy,e="no_proxy"),t?(Wd("No proxy server list set by environment variable "+e),t.split(",")):[]}function t9(t){let e=t.split("/");if(e.length!==2)return null;let r=parseInt(e[1],10);return!(0,e9.isIPv4)(e[0])||Number.isNaN(r)||r<0||r>32?null:{ip:r9(e[0]),prefixLength:r}}function r9(t){return t.split(".").reduce((e,r)=>(e<<8)+parseInt(r,10),0)}function IRe(t,e){let r=t.ip,n=-1<<32-t.prefixLength;return(r9(e)&n)===(r&n)}function PRe(t){for(let e of CRe()){let r=t9(e);if((0,e9.isIPv4)(t)&&r&&IRe(r,t))return!0;if(t.endsWith(e))return!0}return!1}function ORe(t,e){var r;let n={target:t,extraOptions:{}};if(((r=e["grpc.enable_http_proxy"])!==null&&r!==void 0?r:1)===0||t.scheme==="unix")return n;let i=RRe();if(!i.address)return n;let o=(0,Lg.splitHostPort)(t.path);if(!o)return n;let s=o.host;if(PRe(s))return Wd("Not using proxy for target in no_proxy list: "+(0,Lg.uriToString)(t)),n;let a={"grpc.http_connect_target":(0,Lg.uriToString)(t)};return i.creds&&(a["grpc.http_connect_creds"]=i.creds),{target:{scheme:"dns",path:i.address},extraOptions:a}}function NRe(t,e){var r;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let n=e["grpc.http_connect_target"],i=(0,Lg.parseUri)(n);if(i===null)return Promise.resolve(null);let o=(0,Lg.splitHostPort)(i.path);if(o===null)return Promise.resolve(null);let s=`${o.host}:${(r=o.port)!==null&&r!==void 0?r:wRe.DEFAULT_PORT}`,a={method:"CONNECT",path:s},c={Host:s};(0,Q5.isTcpSubchannelAddress)(t)?(a.host=t.host,a.port=t.port):a.socketPath=t.path,"grpc.http_connect_creds"in e&&(c["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),a.headers=c;let l=(0,Q5.subchannelAddressToString)(t);return Wd("Using proxy "+l+" to connect to "+a.path),new Promise((u,d)=>{let f=TRe.request(a);f.once("connect",(p,h,m)=>{f.removeAllListeners(),h.removeAllListeners(),p.statusCode===200?(Wd("Successfully connected to "+a.path+" through proxy "+l),m.length>0&&h.unshift(m),Wd("Successfully established a plaintext connection to "+a.path+" through proxy "+l),u(h)):((0,Dg.log)(Hd.LogVerbosity.ERROR,"Failed to connect to "+a.path+" through proxy "+l+" with status "+p.statusCode),d())}),f.once("error",p=>{f.removeAllListeners(),(0,Dg.log)(Hd.LogVerbosity.ERROR,"Failed to connect to proxy "+l+" with error "+p.message),d()}),f.end()})}});var Gk=v(Tb=>{"use strict";Object.defineProperty(Tb,"__esModule",{value:!0});Tb.StreamDecoder=void 0;var co;(function(t){t[t.NO_DATA=0]="NO_DATA",t[t.READING_SIZE=1]="READING_SIZE",t[t.READING_MESSAGE=2]="READING_MESSAGE"})(co||(co={}));var zk=class{constructor(e){this.maxReadMessageLength=e,this.readState=co.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let r=0,n,i=[];for(;r<e.length;)switch(this.readState){case co.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=co.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case co.READING_SIZE:if(n=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+n),this.readSizeRemaining-=n,r+=n,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=co.READING_MESSAGE;else{let o=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=co.NO_DATA,i.push(o)}}break;case co.READING_MESSAGE:if(n=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+n)),this.readMessageRemaining-=n,r+=n,this.readMessageRemaining===0){let o=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),s=Buffer.concat(o,this.readMessageSize+5);this.readState=co.NO_DATA,i.push(s)}break;default:throw new Error("Unexpected read state")}return i}};Tb.StreamDecoder=zk});var n9=v(bb=>{"use strict";Object.defineProperty(bb,"__esModule",{value:!0});bb.Http2SubchannelCall=void 0;var as=Z("http2"),kRe=Z("os"),ut=Ve(),cs=Kt(),MRe=Gk(),DRe=ht(),LRe=Ve(),$Re="subchannel_call";function URe(t){for(let[e,r]of Object.entries(kRe.constants.errno))if(r===t)return e;return"Unknown system error "+t}function qk(t){let e=`Received HTTP status code ${t}`,r;switch(t){case 400:r=ut.Status.INTERNAL;break;case 401:r=ut.Status.UNAUTHENTICATED;break;case 403:r=ut.Status.PERMISSION_DENIED;break;case 404:r=ut.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:r=ut.Status.UNAVAILABLE;break;default:r=ut.Status.UNKNOWN}return{code:r,details:e,metadata:new cs.Metadata}}var Vk=class{constructor(e,r,n,i,o){var s;this.http2Stream=e,this.callEventTracker=r,this.listener=n,this.transport=i,this.callId=o,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let a=(s=i.getOptions()["grpc.max_receive_message_length"])!==null&&s!==void 0?s:ut.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new MRe.StreamDecoder(a),e.on("response",(c,l)=>{let u="";for(let d of Object.keys(c))u+=" "+d+": "+c[d]+`
17
17
  `;if(this.trace(`Received server headers:
18
18
  `+u),this.httpStatusCode=c[":status"],l&as.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(c);else{let d;try{d=cs.Metadata.fromHttp2Headers(c)}catch(f){this.endCall({code:ut.Status.UNKNOWN,details:f.message,metadata:new cs.Metadata});return}this.listener.onReceiveMetadata(d)}}),e.on("trailers",c=>{this.handleTrailers(c)}),e.on("data",c=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+c.length);let l;try{l=this.decoder.write(c)}catch(u){if(this.httpStatusCode!==void 0&&this.httpStatusCode!==200){let d=qk(this.httpStatusCode);this.cancelWithStatus(d.code,d.details)}else this.cancelWithStatus(ut.Status.RESOURCE_EXHAUSTED,u.message);return}for(let u of l)this.trace("parsed message of length "+u.length),this.callEventTracker.addMessageReceived(),this.tryPush(u)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var c;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),((c=this.finalStatus)===null||c===void 0?void 0:c.code)===ut.Status.OK)return;let l,u="";switch(e.rstCode){case as.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let d=qk(this.httpStatusCode);l=d.code,u=d.details}else l=ut.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case as.constants.NGHTTP2_REFUSED_STREAM:l=ut.Status.UNAVAILABLE,u="Stream refused by server";break;case as.constants.NGHTTP2_CANCEL:this.connectionDropped?(l=ut.Status.UNAVAILABLE,u="Connection dropped"):(l=ut.Status.CANCELLED,u="Call cancelled");break;case as.constants.NGHTTP2_ENHANCE_YOUR_CALM:l=ut.Status.RESOURCE_EXHAUSTED,u="Bandwidth exhausted or memory limit exceeded";break;case as.constants.NGHTTP2_INADEQUATE_SECURITY:l=ut.Status.PERMISSION_DENIED,u="Protocol not secure enough";break;case as.constants.NGHTTP2_INTERNAL_ERROR:l=ut.Status.INTERNAL,this.internalError===null?u=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT"?(l=ut.Status.UNAVAILABLE,u=this.internalError.message):u=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:l=ut.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:l,details:u,metadata:new cs.Metadata,rstCode:e.rstCode})})}),e.on("error",c=>{c.code!=="ERR_HTTP2_STREAM_ERROR"&&(this.trace("Node error event: message="+c.message+" code="+c.code+" errno="+URe(c.errno)+" syscall="+c.syscall),this.internalError=c),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:ut.Status.UNAVAILABLE,details:"Connection dropped",metadata:new cs.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){DRe.trace(LRe.LogVerbosity.DEBUG,$Re,"["+this.callId+"] "+e)}endCall(e){(this.finalStatus===null||this.finalStatus.code===ut.Status.OK)&&(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){this.finalStatus!==null&&(this.finalStatus.code!==ut.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,!this.statusOutput&&(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let r="";for(let s of Object.keys(e))r+=" "+s+": "+e[s]+`
19
19
  `;this.trace(`Received server trailers:
20
20
  `+r);let n;try{n=cs.Metadata.fromHttp2Headers(e)}catch{n=new cs.Metadata}let i=n.getMap(),o;if(typeof i["grpc-status"]=="string"){let s=Number(i["grpc-status"]);this.trace("received status code "+s+" from server"),n.remove("grpc-status");let a="";if(typeof i["grpc-message"]=="string"){try{a=decodeURI(i["grpc-message"])}catch{a=i["grpc-message"]}n.remove("grpc-message"),this.trace('received status details string "'+a+'" from server')}o={code:s,details:a,metadata:n}}else this.httpStatusCode?(o=qk(this.httpStatusCode),o.metadata=n):o={code:ut.Status.UNKNOWN,details:"No status information received",metadata:n};this.endCall(o)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let r;((e=this.finalStatus)===null||e===void 0?void 0:e.code)===ut.Status.OK?r=as.constants.NGHTTP2_NO_ERROR:r=as.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+r),this.http2Stream.close(r)}}cancelWithStatus(e,r){this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),this.endCall({code:e,details:r,metadata:new cs.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==ut.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let e=this.unpushedReadMessages.shift();this.push(e);return}this.http2Stream.resume()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length);let n=i=>{process.nextTick(()=>{var o;let s=ut.Status.UNAVAILABLE;i?.code==="ERR_STREAM_WRITE_AFTER_END"&&(s=ut.Status.INTERNAL),i&&this.cancelWithStatus(s,`Write error: ${i.message}`),(o=e.callback)===null||o===void 0||o.call(e)})};this.trace("sending data chunk of length "+r.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(r,n)}catch(i){this.endCall({code:ut.Status.UNAVAILABLE,details:`Write failed with error ${i.message}`,metadata:new cs.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}};bb.Http2SubchannelCall=Vk});var i9=v(xb=>{"use strict";Object.defineProperty(xb,"__esModule",{value:!0});xb.Http2SubchannelConnector=void 0;var vl=Z("http2"),FRe=Z("tls"),Ab=va(),Ug=Ve(),BRe=jk(),Yd=ht(),jRe=ai(),wb=Zr(),Hk=Dr(),zRe=Z("net"),GRe=n9(),qRe=ub(),Wk="transport",VRe="transport_flowctrl",HRe=hO().version,{HTTP2_HEADER_AUTHORITY:WRe,HTTP2_HEADER_CONTENT_TYPE:YRe,HTTP2_HEADER_METHOD:KRe,HTTP2_HEADER_PATH:ZRe,HTTP2_HEADER_TE:JRe,HTTP2_HEADER_USER_AGENT:XRe}=vl.constants,QRe=2e4,eCe=Buffer.from("too_many_pings","ascii"),Yk=class{constructor(e,r,n,i){this.session=e,this.options=n,this.remoteName=i,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,wb.subchannelAddressToString)(r),n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.streamTracker=new Ab.ChannelzCallTrackerStub):this.streamTracker=new Ab.ChannelzCallTracker,this.channelzRef=(0,Ab.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[n["grpc.primary_user_agent"],`grpc-node-js/${HRe}`,n["grpc.secondary_user_agent"]].filter(o=>o).join(" "),"grpc.keepalive_time_ms"in n?this.keepaliveTimeMs=n["grpc.keepalive_time_ms"]:this.keepaliveTimeMs=-1,"grpc.keepalive_timeout_ms"in n?this.keepaliveTimeoutMs=n["grpc.keepalive_timeout_ms"]:this.keepaliveTimeoutMs=QRe,"grpc.keepalive_permit_without_calls"in n?this.keepaliveWithoutCalls=n["grpc.keepalive_permit_without_calls"]===1:this.keepaliveWithoutCalls=!1,e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(o,s,a)=>{let c=!1;o===vl.constants.NGHTTP2_ENHANCE_YOUR_CALM&&a&&a.equals(eCe)&&(c=!0),this.trace("connection closed by GOAWAY with code "+o+" and data "+a?.toString()),this.reportDisconnectToOwner(c)}),e.once("error",o=>{this.trace("connection closed with error "+o.message),this.handleDisconnect()}),e.socket.once("close",o=>{this.trace("connection closed. hadError="+o),this.handleDisconnect()}),Yd.isTracerEnabled(Wk)&&(e.on("remoteSettings",o=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(o))}),e.on("localSettings",o=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(o))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof FRe.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,r,n;let i=this.session.socket,o=i.remoteAddress?(0,wb.stringToSubchannelAddress)(i.remoteAddress,i.remotePort):null,s=i.localAddress?(0,wb.stringToSubchannelAddress)(i.localAddress,i.localPort):null,a;if(this.session.encrypted){let l=i,u=l.getCipher(),d=l.getCertificate(),f=l.getPeerCertificate();a={cipherSuiteStandardName:(e=u.standardName)!==null&&e!==void 0?e:null,cipherSuiteOtherName:u.standardName?null:u.name,localCertificate:d&&"raw"in d?d.raw:null,remoteCertificate:f&&"raw"in f?f.raw:null}}else a=null;return{remoteAddress:o,localAddress:s,security:a,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:(r=this.session.state.localWindowSize)!==null&&r!==void 0?r:null,remoteFlowControlWindow:(n=this.session.state.remoteWindowSize)!==null&&n!==void 0?n:null}}trace(e){Yd.trace(Ug.LogVerbosity.DEBUG,Wk,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){Yd.trace(Ug.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){Yd.trace(Ug.LogVerbosity.DEBUG,VRe,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){Yd.trace(Ug.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(r=>r(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(let e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,r;if(!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}if(this.keepaliveTimer){console.error("keepaliveTimeout is not null");return}this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(r=(e=this.keepaliveTimer).unref)===null||r===void 0||r.call(e);let n="";try{this.session.ping((o,s,a)=>{this.clearKeepaliveTimeout(),o?(this.keepaliveTrace("Ping failed with error "+o.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(n="Ping returned false")}catch(i){n=(i instanceof Error?i.message:"")||"Unknown error"}n&&(this.keepaliveTrace("Ping send failed: "+n),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,r;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),(r=(e=this.keepaliveTimer).unref)===null||r===void 0||r.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),this.activeCalls.size===0&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),this.activeCalls.size===1&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,r,n,i,o){let s=e.toHttp2Headers();s[WRe]=r,s[XRe]=this.userAgent,s[YRe]="application/grpc",s[KRe]="POST",s[ZRe]=n,s[JRe]="trailers";let a;try{a=this.session.request(s)}catch(u){throw this.handleDisconnect(),u}this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed);let c,l;return this.channelzEnabled?(this.streamTracker.addCallStarted(),c={addMessageSent:()=>{var u;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,(u=o.addMessageSent)===null||u===void 0||u.call(o)},addMessageReceived:()=>{var u;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(u=o.addMessageReceived)===null||u===void 0||u.call(o)},onCallEnd:u=>{var d;(d=o.onCallEnd)===null||d===void 0||d.call(o,u),this.removeActiveCall(l)},onStreamEnd:u=>{var d;u?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),(d=o.onStreamEnd)===null||d===void 0||d.call(o,u)}}):c={addMessageSent:()=>{var u;(u=o.addMessageSent)===null||u===void 0||u.call(o)},addMessageReceived:()=>{var u;(u=o.addMessageReceived)===null||u===void 0||u.call(o)},onCallEnd:u=>{var d;(d=o.onCallEnd)===null||d===void 0||d.call(o,u),this.removeActiveCall(l)},onStreamEnd:u=>{var d;(d=o.onStreamEnd)===null||d===void 0||d.call(o,u)}},l=new GRe.Http2SubchannelCall(a,c,i,this,(0,qRe.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,Ab.unregisterChannelzRef)(this.channelzRef)}},Kk=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){Yd.trace(Ug.LogVerbosity.DEBUG,Wk,(0,Hk.uriToString)(this.channelTarget)+" "+e)}createSession(e,r,n){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((i,o)=>{var s,a,c,l,u,d,f,p;let h=null,m=this.channelTarget;if("grpc.http_connect_target"in n){let F=(0,Hk.parseUri)(n["grpc.http_connect_target"]);F&&(m=F,h=(0,Hk.uriToString)(F))}let y=e.secure?"https":"http",S=(0,jRe.getDefaultAuthority)(m),b=()=>{var F;(F=this.session)===null||F===void 0||F.destroy(),this.session=null,setImmediate(()=>{M||(M=!0,o(`${P.trim()} (${new Date().toISOString()})`))})},w=F=>{var _;(_=this.session)===null||_===void 0||_.destroy(),P=F.message,this.trace("connection failed with error "+P),M||(M=!0,o(`${P} (${new Date().toISOString()})`))},T={createConnection:(F,_)=>e.socket,settings:{initialWindowSize:(l=(s=n["grpc-node.flow_control_window"])!==null&&s!==void 0?s:(c=(a=vl.getDefaultSettings)===null||a===void 0?void 0:a.call(vl))===null||c===void 0?void 0:c.initialWindowSize)!==null&&l!==void 0?l:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:(u=n["grpc-node.max_session_memory"])!==null&&u!==void 0?u:Number.MAX_SAFE_INTEGER},C=vl.connect(`${y}://${S}`,T),O=(p=(f=(d=vl.getDefaultSettings)===null||d===void 0?void 0:d.call(vl))===null||f===void 0?void 0:f.initialWindowSize)!==null&&p!==void 0?p:65535,k=n["grpc-node.flow_control_window"];this.session=C;let P="Failed to connect",M=!1;C.unref(),C.once("remoteSettings",()=>{var F;if(k&&k>O)try{C.setLocalWindowSize(k)}catch{let re=k-((F=C.state.localWindowSize)!==null&&F!==void 0?F:O);re>0&&C.incrementWindowSize(re)}C.removeAllListeners(),e.socket.removeListener("close",b),e.socket.removeListener("error",w),i(new Yk(C,r,n,h)),this.session=null}),C.once("close",b),C.once("error",w),e.socket.once("close",b),e.socket.once("error",w)})}tcpConnect(e,r){return(0,BRe.getProxiedConnection)(e,r).then(n=>n||new Promise((i,o)=>{let s=()=>{o(new Error("Socket closed"))},a=l=>{o(l)},c=zRe.connect(e,()=>{c.removeListener("close",s),c.removeListener("error",a),i(c)});c.once("close",s),c.once("error",a)}))}async connect(e,r,n){if(this.isShutdown)return Promise.reject();let i=null,o=null,s=(0,wb.subchannelAddressToString)(e);try{return this.trace(s+" Waiting for secureConnector to be ready"),await r.waitForReady(),this.trace(s+" secureConnector is ready"),i=await this.tcpConnect(e,n),i.setNoDelay(),this.trace(s+" Established TCP connection"),o=await r.connect(i),this.trace(s+" Established secure connection"),this.createSession(o,e,n)}catch(a){throw i?.destroy(),o?.socket.destroy(),a}}shutdown(){var e;this.isShutdown=!0,(e=this.session)===null||e===void 0||e.close(),this.session=null}};xb.Http2SubchannelConnector=Kk});var o9=v(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});Bg.SubchannelPool=void 0;Bg.getSubchannelPool=cCe;var tCe=IK(),rCe=Y5(),nCe=Zr(),iCe=Dr(),oCe=i9(),sCe=1e4,Fg=class{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(let r in this.pool){let i=this.pool[r].filter(o=>!o.subchannel.unrefIfOneRef());i.length>0&&(e=!1),this.pool[r]=i}e&&this.cleanupTimer!==null&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,r;this.cleanupTimer===null&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},sCe),(r=(e=this.cleanupTimer).unref)===null||r===void 0||r.call(e))}getOrCreateSubchannel(e,r,n,i){this.ensureCleanupTask();let o=(0,iCe.uriToString)(e);if(o in this.pool){let a=this.pool[o];for(let c of a)if((0,nCe.subchannelAddressEqual)(r,c.subchannelAddress)&&(0,tCe.channelOptionsEqual)(n,c.channelArguments)&&i._equals(c.channelCredentials))return c.subchannel}let s=new rCe.Subchannel(e,r,n,i,new oCe.Http2SubchannelConnector(e));return o in this.pool||(this.pool[o]=[]),this.pool[o].push({subchannelAddress:r,channelArguments:n,channelCredentials:i,subchannel:s}),s.ref(),s}};Bg.SubchannelPool=Fg;var aCe=new Fg;function cCe(t){return t?aCe:new Fg}});var c9=v(Ib=>{"use strict";Object.defineProperty(Ib,"__esModule",{value:!0});Ib.LoadBalancingCall=void 0;var s9=Lr(),Rb=Ve(),a9=Gd(),Cb=Kt(),jg=Jo(),lCe=Dr(),uCe=ht(),Zk=Ng(),dCe=Z("http2"),fCe="load_balancing_call",Jk=class{constructor(e,r,n,i,o,s,a){var c,l;this.channel=e,this.callConfig=r,this.methodName=n,this.host=i,this.credentials=o,this.deadline=s,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;let u=this.methodName.split("/"),d="";u.length>=2&&(d=u[1]);let f=(l=(c=(0,lCe.splitHostPort)(this.host))===null||c===void 0?void 0:c.host)!==null&&l!==void 0?l:"localhost";this.serviceUrl=`https://${f}/${d}`,this.startTime=new Date}getDeadlineInfo(){var e,r;let n=[];return this.childStartTime?(this.childStartTime>this.startTime&&(!((e=this.metadata)===null||e===void 0)&&e.getOptions().waitForReady&&n.push("wait_for_ready"),n.push(`LB pick: ${(0,a9.formatDateDifference)(this.startTime,this.childStartTime)}`)),n.push(...this.child.getDeadlineInfo()),n):(!((r=this.metadata)===null||r===void 0)&&r.getOptions().waitForReady&&n.push("wait_for_ready"),n.push("Waiting for LB pick"),n)}trace(e){uCe.trace(Rb.LogVerbosity.DEBUG,fCe,"["+this.callNumber+"] "+e)}outputStatus(e,r){var n,i;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());let o=Object.assign(Object.assign({},e),{progress:r});(n=this.listener)===null||n===void 0||n.onReceiveStatus(o),(i=this.onCallEnded)===null||i===void 0||i.call(this,o.code,o.details,o.metadata)}}doPick(){var e,r;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");let n=this.metadata.clone(),i=this.channel.doPick(n,this.callConfig.pickInformation),o=i.subchannel?"("+i.subchannel.getChannelzRef().id+") "+i.subchannel.getAddress():""+i.subchannel;switch(this.trace("Pick result: "+jg.PickResultType[i.pickResultType]+" subchannel: "+o+" status: "+((e=i.status)===null||e===void 0?void 0:e.code)+" "+((r=i.status)===null||r===void 0?void 0:r.details)),i.pickResultType){case jg.PickResultType.COMPLETE:this.credentials.compose(i.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(l=>{var u;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(n.merge(l),n.get("authorization").length>1&&this.outputStatus({code:Rb.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new Cb.Metadata},"PROCESSED"),i.subchannel.getConnectivityState()!==s9.ConnectivityState.READY){this.trace("Picked subchannel "+o+" has state "+s9.ConnectivityState[i.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}this.deadline!==1/0&&n.set("grpc-timeout",(0,a9.getDeadlineTimeoutString)(this.deadline));try{this.child=i.subchannel.getRealSubchannel().createCall(n,this.host,this.methodName,{onReceiveMetadata:d=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(d)},onReceiveMessage:d=>{this.trace("Received message"),this.listener.onReceiveMessage(d)},onReceiveStatus:d=>{this.trace("Received status"),d.rstCode===dCe.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(d,"REFUSED"):this.outputStatus(d,"PROCESSED")}}),this.childStartTime=new Date}catch(d){this.trace("Failed to start call on picked subchannel "+o+" with error "+d.message),this.outputStatus({code:Rb.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+d.message,metadata:new Cb.Metadata},"NOT_STARTED");return}(u=i.onCallStarted)===null||u===void 0||u.call(i),this.onCallEnded=i.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()},l=>{let{code:u,details:d}=(0,Zk.restrictControlPlaneStatusCode)(typeof l.code=="number"?l.code:Rb.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${l.message}`);this.outputStatus({code:u,details:d,metadata:new Cb.Metadata},"PROCESSED")});break;case jg.PickResultType.DROP:let{code:a,details:c}=(0,Zk.restrictControlPlaneStatusCode)(i.status.code,i.status.details);setImmediate(()=>{this.outputStatus({code:a,details:c,metadata:i.status.metadata},"DROP")});break;case jg.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:l,details:u}=(0,Zk.restrictControlPlaneStatusCode)(i.status.code,i.status.details);setImmediate(()=>{this.outputStatus({code:l,details:u,metadata:i.status.metadata},"PROCESSED")})}break;case jg.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,r){var n;this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),(n=this.child)===null||n===void 0||n.cancelWithStatus(e,r),this.outputStatus({code:e,details:r,metadata:new Cb.Metadata},"PROCESSED")}getPeer(){var e,r;return(r=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.channel.getTarget()}start(e,r){this.trace("start called"),this.listener=r,this.metadata=e,this.doPick()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length),this.child?this.child.sendMessageWithContext(e,r):this.pendingMessage={context:e,message:r}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};Ib.LoadBalancingCall=Jk});var u9=v(Pb=>{"use strict";Object.defineProperty(Pb,"__esModule",{value:!0});Pb.ResolvingCall=void 0;var pCe=cT(),Tl=Ve(),bl=Gd(),l9=Kt(),hCe=ht(),mCe=Ng(),gCe="resolving_call",Xk=class{constructor(e,r,n,i,o){this.channel=e,this.method=r,this.filterStackFactory=i,this.callNumber=o,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=pCe.CallCredentials.createEmpty(),this.deadline=n.deadline,this.host=n.host,n.parentCall&&(n.flags&Tl.Propagate.CANCELLATION&&n.parentCall.on("cancelled",()=>{this.cancelWithStatus(Tl.Status.CANCELLED,"Cancelled by parent call")}),n.flags&Tl.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+n.parentCall.getDeadline()),this.deadline=(0,bl.minDeadline)(this.deadline,n.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){hCe.trace(Tl.LogVerbosity.DEBUG,gCe,"["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,bl.deadlineToString)(this.deadline));let e=(0,bl.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");let r=()=>{if(!this.deadlineStartTime){this.cancelWithStatus(Tl.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let n=[],i=new Date;n.push(`Deadline exceeded after ${(0,bl.formatDateDifference)(this.deadlineStartTime,i)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&n.push(`name resolution: ${(0,bl.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&n.push(`metadata filters: ${(0,bl.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):n.push("waiting for metadata filters")):n.push("waiting for name resolution"),this.child&&n.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(Tl.Status.DEADLINE_EXCEEDED,n.join(","))};e<=0?process.nextTick(r):this.deadlineTimer=setTimeout(r,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);let r=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+r.code+' details="'+r.details+'"'),this.statusWatchers.forEach(n=>n(r)),process.nextTick(()=>{var n;(n=this.listener)===null||n===void 0||n.onReceiveStatus(r)})}}sendMessageOnChild(e,r){if(!this.child)throw new Error("sendMessageonChild called with child not populated");let n=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags})).then(i=>{this.writeFilterPending=!1,n.sendMessageWithContext(e,i.message),this.pendingHalfClose&&n.halfClose()},i=>{this.cancelWithStatus(i.code,i.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");let e=this.channel.getConfig(this.method,this.metadata);if(e.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(e.type==="ERROR"){this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error);return}this.configReceivedTime=new Date;let r=e.config;if(r.status!==Tl.Status.OK){let{code:n,details:i}=(0,mCe.restrictControlPlaneStatusCode)(r.status,"Failed to route call to method "+this.method);this.outputStatus({code:n,details:i,metadata:new l9.Metadata});return}if(r.methodConfig.timeout){let n=new Date;n.setSeconds(n.getSeconds()+r.methodConfig.timeout.seconds),n.setMilliseconds(n.getMilliseconds()+r.methodConfig.timeout.nanos/1e6),this.deadline=(0,bl.minDeadline)(this.deadline,n),this.runDeadlineTimer()}this.filterStackFactory.push(r.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(n=>{this.child=this.channel.createRetryingCall(r,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(n,{onReceiveMetadata:i=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(i))},onReceiveMessage:i=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(i).then(o=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(o),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},o=>{this.cancelWithStatus(o.code,o.details)})},onReceiveStatus:i=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=i:this.outputStatus(i)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},n=>{this.outputStatus(n)})}reportResolverError(e){var r;!((r=this.metadata)===null||r===void 0)&&r.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,r){var n;this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),(n=this.child)===null||n===void 0||n.cancelWithStatus(e,r),this.outputStatus({code:e,details:r,metadata:new l9.Metadata})}getPeer(){var e,r;return(r=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.channel.getTarget()}start(e,r){this.trace("start called"),this.metadata=e.clone(),this.listener=r,this.getConfig()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length),this.child?this.sendMessageOnChild(e,r):this.pendingMessage={context:e,message:r}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};Pb.ResolvingCall=Xk});var d9=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.RetryingCall=Aa.MessageBufferTracker=Aa.RetryThrottler=void 0;var Ob=Ve(),_Ce=Gd(),yCe=Kt(),SCe=ht(),ECe="retrying_call",eM=class{constructor(e,r,n){this.maxTokens=e,this.tokenRatio=r,n?this.tokens=n.tokens*(e/n.maxTokens):this.tokens=e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};Aa.RetryThrottler=eM;var tM=class{constructor(e,r){this.totalLimit=e,this.limitPerCall=r,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,r){var n;let i=(n=this.allocatedPerCall.get(r))!==null&&n!==void 0?n:0;return this.limitPerCall-i<e||this.totalLimit-this.totalAllocated<e?!1:(this.allocatedPerCall.set(r,i+e),this.totalAllocated+=e,!0)}free(e,r){var n;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${r} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;let i=(n=this.allocatedPerCall.get(r))!==null&&n!==void 0?n:0;if(i<e)throw new Error(`Invalid buffer allocation state: call ${r} freed ${e} > allocated for call ${i}`);this.allocatedPerCall.set(r,i-e)}freeAll(e){var r;let n=(r=this.allocatedPerCall.get(e))!==null&&r!==void 0?r:0;if(this.totalAllocated<n)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${n} > total allocated ${this.totalAllocated}`);this.totalAllocated-=n,this.allocatedPerCall.delete(e)}};Aa.MessageBufferTracker=tM;var Qk="grpc-previous-rpc-attempts",vCe=5,rM=class{constructor(e,r,n,i,o,s,a,c,l){var u;this.channel=e,this.callConfig=r,this.methodName=n,this.host=i,this.credentials=o,this.deadline=s,this.callNumber=a,this.bufferTracker=c,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;let d=(u=e.getOptions()["grpc-node.retry_max_attempts_limit"])!==null&&u!==void 0?u:vCe;if(e.getOptions()["grpc.enable_retries"]===0)this.state="NO_RETRY",this.maxAttempts=1;else if(r.methodConfig.retryPolicy){this.state="RETRY";let f=r.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(f.initialBackoff.substring(0,f.initialBackoff.length-1)),this.maxAttempts=Math.min(f.maxAttempts,d)}else r.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(r.methodConfig.hedgingPolicy.maxAttempts,d)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let e=[],r=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push(`previous attempts: ${this.underlyingCalls.length-1}`),r.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,_Ce.formatDateDifference)(this.startTime,r.startTime)}`),e.push(...r.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){SCe.trace(Ob.LogVerbosity.DEBUG,ECe,"["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var r;(r=this.listener)===null||r===void 0||r.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,r){this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),this.reportStatus({code:e,details:r,metadata:new yCe.Metadata});for(let{call:n}of this.underlyingCalls)n.cancelWithStatus(e,r)}getPeer(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var r;return(r=this.writeBuffer[e-this.writeBufferOffset])!==null&&r!==void 0?r:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let e;this.underlyingCalls[this.committedCallIndex].state==="COMPLETED"?e=this.getNextBufferIndex():e=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let r=this.writeBufferOffset;r<e;r++){let n=this.getBufferEntry(r);n.allocated&&this.bufferTracker.free(n.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var r,n;if(this.state!=="COMMITTED"){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",(n=(r=this.callConfig).onCommitted)===null||n===void 0||n.call(r),this.committedCallIndex=e;for(let i=0;i<this.underlyingCalls.length;i++)i!==e&&this.underlyingCalls[i].state!=="COMPLETED"&&(this.underlyingCalls[i].state="COMPLETED",this.underlyingCalls[i].call.cancelWithStatus(Ob.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if(this.state==="COMMITTED")return;let e=-1,r=-1;for(let[n,i]of this.underlyingCalls.entries())i.state==="ACTIVE"&&i.nextMessageToSend>e&&(e=i.nextMessageToSend,r=n);r===-1?this.state="TRANSPARENT_ONLY":this.commitCall(r)}isStatusCodeInList(e,r){return e.some(n=>{var i;return n===r||n.toString().toLowerCase()===((i=Ob.Status[r])===null||i===void 0?void 0:i.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;let r=(e=this.callConfig)===null||e===void 0?void 0:e.methodConfig.retryPolicy;if(!r)return 0;let i=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,o=Number(r.maxBackoff.substring(0,r.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*r.backoffMultiplier,o),i}maybeRetryCall(e,r){if(this.state!=="RETRY"){r(!1);return}if(this.attempts>=this.maxAttempts){r(!1);return}let n;if(e===null)n=this.getNextRetryBackoffMs();else if(e<0){this.state="TRANSPARENT_ONLY",r(!1);return}else n=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var i,o;if(this.state!=="RETRY"){r(!1);return}!((o=(i=this.retryThrottler)===null||i===void 0?void 0:i.canRetryCall())!==null&&o!==void 0)||o?(r(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),r(!1))},n)}countActiveCalls(){let e=0;for(let r of this.underlyingCalls)r?.state==="ACTIVE"&&(e+=1);return e}handleProcessedStatus(e,r,n){var i,o,s;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(r),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList((i=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&i!==void 0?i:[],e.code)){(o=this.retryThrottler)===null||o===void 0||o.addCallFailed();let a;if(n===null)a=0;else if(n<0){this.state="TRANSPARENT_ONLY",this.commitCall(r),this.reportStatus(e);return}else a=n;setTimeout(()=>{this.maybeStartHedgingAttempt(),this.countActiveCalls()===0&&(this.commitCall(r),this.reportStatus(e))},a)}else this.commitCall(r),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?((s=this.retryThrottler)===null||s===void 0||s.addCallFailed(),this.maybeRetryCall(n,a=>{a||(this.commitCall(r),this.reportStatus(e))})):(this.commitCall(r),this.reportStatus(e));break}}getPushback(e){let r=e.get("grpc-retry-pushback-ms");if(r.length===0)return null;try{return parseInt(r[0])}catch{return-1}}handleChildStatus(e,r){var n;if(this.underlyingCalls[r].state==="COMPLETED")return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[r].call.getCallNumber()+"] in state "+this.underlyingCalls[r].state),this.underlyingCalls[r].state="COMPLETED",e.code===Ob.Status.OK){(n=this.retryThrottler)===null||n===void 0||n.addCallSucceeded(),this.commitCall(r),this.reportStatus(e);return}if(this.state==="NO_RETRY"){this.commitCall(r),this.reportStatus(e);return}if(this.state==="COMMITTED"){this.reportStatus(e);return}let i=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,r,i):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(r),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,r,i);break}}maybeStartHedgingAttempt(){this.state==="HEDGING"&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,r,n;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),this.state!=="HEDGING"||!this.callConfig.methodConfig.hedgingPolicy)return;let i=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;let o=(e=i.hedgingDelay)!==null&&e!==void 0?e:"0s",s=Number(o.substring(0,o.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},s*1e3),(n=(r=this.hedgingTimer).unref)===null||n===void 0||n.call(r)}startNewAttempt(){let e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);let r=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});let n=this.attempts-1,i=this.initialMetadata.clone();n>0&&i.set(Qk,`${n}`);let o=!1;e.start(i,{onReceiveMetadata:s=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(r),o=!0,n>0&&s.set(Qk,`${n}`),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMetadata(s)},onReceiveMessage:s=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(r),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMessage(s)},onReceiveStatus:s=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!o&&n>0&&s.metadata.set(Qk,`${n}`),this.handleChildStatus(s,r)}}),this.sendNextChildMessage(r),this.readStarted&&e.startRead()}start(e,r){this.trace("start called"),this.listener=r,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,r){var n,i;(i=(n=this.getBufferEntry(r)).callback)===null||i===void 0||i.call(n),this.clearSentMessages();let o=this.underlyingCalls[e];o.nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){let r=this.underlyingCalls[e];if(r.state==="COMPLETED")return;let n=r.nextMessageToSend;if(this.getBufferEntry(n)){let i=this.getBufferEntry(n);switch(i.entryType){case"MESSAGE":r.call.sendMessageWithContext({callback:s=>{this.handleChildWriteCompleted(e,n)}},i.message.message),this.getBufferEntry(n+1).entryType==="HALF_CLOSE"&&(this.trace("Sending halfClose immediately after message to child ["+r.call.getCallNumber()+"] - optimizing for unary/final message"),r.nextMessageToSend+=1,r.call.halfClose());break;case"HALF_CLOSE":r.nextMessageToSend+=1,r.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length);let n={message:r,flags:e.flags},i=this.getNextBufferIndex(),o={entryType:"MESSAGE",message:n,allocated:this.bufferTracker.allocate(r.length,this.callNumber)};if(this.writeBuffer.push(o),o.allocated){process.nextTick(()=>{var s;(s=e.callback)===null||s===void 0||s.call(e)});for(let[s,a]of this.underlyingCalls.entries())a.state==="ACTIVE"&&a.nextMessageToSend===i&&a.call.sendMessageWithContext({callback:c=>{this.handleChildWriteCompleted(s,i)}},r)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let s=this.underlyingCalls[this.committedCallIndex];o.callback=e.callback,s.state==="ACTIVE"&&s.nextMessageToSend===i&&s.call.sendMessageWithContext({callback:a=>{this.handleChildWriteCompleted(this.committedCallIndex,i)}},r)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let e of this.underlyingCalls)e?.state==="ACTIVE"&&e.call.startRead()}halfClose(){this.trace("halfClose called");let e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let r of this.underlyingCalls)r?.state==="ACTIVE"&&(r.nextMessageToSend===e||r.nextMessageToSend===e-1)&&(this.trace("Sending halfClose immediately to child ["+r.call.getCallNumber()+"] - all messages already sent"),r.nextMessageToSend+=1,r.call.halfClose())}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}};Aa.RetryingCall=rM});var zg=v(Nb=>{"use strict";Object.defineProperty(Nb,"__esModule",{value:!0});Nb.BaseSubchannelWrapper=void 0;var nM=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(r=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(let e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,this.refcount===0&&this.destroy()}destroy(){for(let e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}};Nb.BaseSubchannelWrapper=nM});var dM=v(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.InternalChannel=Al.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var TCe=Td(),bCe=CK(),ACe=o9(),sM=Jo(),wCe=Kt(),wa=Ve(),xCe=gb(),RCe=Ck(),f9=ai(),kb=ht(),CCe=jk(),Mb=Dr(),Vn=Lr(),Gg=va(),ICe=c9(),PCe=Gd(),OCe=u9(),iM=ub(),NCe=Ng(),oM=d9(),kCe=zg(),MCe=2147483647,DCe=1e3,LCe=1800*1e3,Db=new Map,$Ce=1<<24,UCe=1<<20,aM=class extends kCe.BaseSubchannelWrapper{constructor(e,r){super(e),this.channel=r,this.refCount=0,this.subchannelStateListener=(n,i,o,s)=>{r.throttleKeepalive(s)}}ref(){this.refCount===0&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}},cM=class{pick(e){return{pickResultType:sM.PickResultType.DROP,status:{code:wa.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new wCe.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}};Al.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";var lM=class{constructor(e){this.target=e,this.trace=new Gg.ChannelzTrace,this.callTracker=new Gg.ChannelzCallTracker,this.childrenTracker=new Gg.ChannelzChildrenTracker,this.state=Vn.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}},uM=class{constructor(e,r,n){var i,o,s,a,c,l;if(this.credentials=r,this.options=n,this.connectivityState=Vn.ConnectivityState.IDLE,this.currentPicker=new sM.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof TCe.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new lM(e);let u=(0,Mb.parseUri)(e);if(u===null)throw new Error(`Could not parse target name "${e}"`);let d=(0,f9.mapUriDefaultScheme)(u);if(d===null)throw new Error(`Could not find a default scheme for target name "${e}"`);this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzRef=(0,Gg.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,f9.getDefaultAuthority)(d);let f=(0,CCe.mapProxyName)(d,n);this.target=f.target,this.options=Object.assign({},this.options,f.extraOptions),this.subchannelPool=(0,ACe.getSubchannelPool)(((i=this.options["grpc.use_local_subchannel_pool"])!==null&&i!==void 0?i:0)===0),this.retryBufferTracker=new oM.MessageBufferTracker((o=this.options["grpc.retry_buffer_size"])!==null&&o!==void 0?o:$Ce,(s=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&s!==void 0?s:UCe),this.keepaliveTime=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:-1,this.idleTimeoutMs=Math.max((c=this.options["grpc.client_idle_timeout_ms"])!==null&&c!==void 0?c:LCe,DCe);let p={createSubchannel:(m,y)=>{let S={};for(let[T,C]of Object.entries(y))T.startsWith(Al.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(S[T]=C);let b=this.subchannelPool.getOrCreateSubchannel(this.target,m,S,this.credentials);return b.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",b.getChannelzRef()),new aM(b,this)},updateState:(m,y)=>{this.currentPicker=y;let S=this.pickQueue.slice();this.pickQueue=[],S.length>0&&this.callRefTimerUnref();for(let b of S)b.doPick();this.updateState(m)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:m=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(m)},removeChannelzChild:m=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(m)}};this.resolvingLoadBalancer=new bCe.ResolvingLoadBalancer(this.target,p,this.options,(m,y)=>{var S;m.retryThrottling?Db.set(this.getTarget(),new oM.RetryThrottler(m.retryThrottling.maxTokens,m.retryThrottling.tokenRatio,Db.get(this.getTarget()))):Db.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),(S=this.configSelector)===null||S===void 0||S.unref(),this.configSelector=y,this.currentResolutionError=null,process.nextTick(()=>{let b=this.configSelectionQueue;this.configSelectionQueue=[],b.length>0&&this.callRefTimerUnref();for(let w of b)w.getConfig()})},m=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+m.code+' and details "'+m.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),this.configSelector===null&&(this.currentResolutionError=Object.assign(Object.assign({},(0,NCe.restrictControlPlaneStatusCode)(m.code,m.details)),{metadata:m.metadata}));let y=this.configSelectionQueue;this.configSelectionQueue=[],y.length>0&&this.callRefTimerUnref();for(let S of y)S.reportResolverError(m)}),this.filterStackFactory=new xCe.FilterStackFactory([new RCe.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(n,void 0,2));let h=new Error;(0,kb.isTracerEnabled)("channel_stacktrace")&&(0,kb.trace)(wa.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed
21
21
  `+((l=h.stack)===null||l===void 0?void 0:l.substring(h.stack.indexOf(`
22
- `)+1))),this.lastActivityTimestamp=new Date}trace(e,r){(0,kb.trace)(r??wa.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,Mb.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,r,n,i;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},MCe)),!((r=(e=this.callRefTimer).hasRef)===null||r===void 0)&&r.call(e)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(i=(n=this.callRefTimer).ref)===null||i===void 0||i.call(n))}callRefTimerUnref(){var e,r,n;(!(!((e=this.callRefTimer)===null||e===void 0)&&e.hasRef)||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(n=(r=this.callRefTimer)===null||r===void 0?void 0:r.unref)===null||n===void 0||n.call(r))}removeConnectivityStateWatcher(e){let r=this.connectivityStateWatchers.findIndex(n=>n===e);r>=0&&this.connectivityStateWatchers.splice(r,1)}updateState(e){(0,kb.trace)(wa.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,Mb.uriToString)(this.target)+" "+Vn.ConnectivityState[this.connectivityState]+" -> "+Vn.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+Vn.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;let r=this.connectivityStateWatchers.slice();for(let n of r)e!==n.currentState&&(n.timer&&clearTimeout(n.timer),this.removeConnectivityStateWatcher(n),n.callback());e!==Vn.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(let r of this.wrappedSubchannels)r.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,r){return this.currentPicker.pick({metadata:e,extraPickInfo:r})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,r){return this.connectivityState!==Vn.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,r,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(Vn.ConnectivityState.IDLE),this.currentPicker=new sM.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var r,n;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let o=new Date().valueOf()-this.lastActivityTimestamp.valueOf();o>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-o)},e),(n=(r=this.idleTimer).unref)===null||n===void 0||n.call(r)}maybeStartIdleTimer(){this.connectivityState!==Vn.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===wa.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,r,n,i,o){let s=(0,iM.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+r+'"'),new ICe.LoadBalancingCall(this,e,r,n,i,o,s)}createRetryingCall(e,r,n,i,o){let s=(0,iM.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+r+'"'),new oM.RetryingCall(this,e,r,n,i,o,s,this.retryBufferTracker,Db.get(this.getTarget()))}createResolvingCall(e,r,n,i,o){let s=(0,iM.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,PCe.deadlineToString)(r));let a={deadline:r,flags:o??wa.Propagate.DEFAULTS,host:n??this.defaultAuthority,parentCall:i},c=new OCe.ResolvingCall(this,e,a,this.filterStackFactory.clone(),s);return this.onCallStart(),c.addStatusWatcher(l=>{this.onCallEnd(l)}),c}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(Vn.ConnectivityState.SHUTDOWN),this.currentPicker=new cM;for(let r of this.configSelectionQueue)r.cancelWithStatus(wa.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let r of this.pickQueue)r.cancelWithStatus(wa.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,Gg.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),(e=this.configSelector)===null||e===void 0||e.unref(),this.configSelector=null}getTarget(){return(0,Mb.uriToString)(this.target)}getConnectivityState(e){let r=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),r}watchConnectivityState(e,r,n){if(this.connectivityState===Vn.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let i=null;if(r!==1/0){let s=r instanceof Date?r:new Date(r),a=new Date;if(r===-1/0||s<=a){process.nextTick(n,new Error("Deadline passed without connectivity state change"));return}i=setTimeout(()=>{this.removeConnectivityStateWatcher(o),n(new Error("Deadline passed without connectivity state change"))},s.getTime()-a.getTime())}let o={currentState:e,callback:n,timer:i};this.connectivityStateWatchers.push(o)}getChannelzRef(){return this.channelzRef}createCall(e,r,n,i,o){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===Vn.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,r,n,i,o)}getOptions(){return this.options}};Al.InternalChannel=uM});var iN=v(Lb=>{"use strict";Object.defineProperty(Lb,"__esModule",{value:!0});Lb.ChannelImplementation=void 0;var FCe=Td(),BCe=dM(),fM=class{constructor(e,r,n){if(typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof FCe.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new BCe.InternalChannel(e,r,n)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,r,n){this.internalChannel.watchConnectivityState(e,r,n)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,r,n,i,o){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,r,n,i,o)}};Lb.ChannelImplementation=fM});var h9=v(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ServerDuplexStreamImpl=Ei.ServerWritableStreamImpl=Ei.ServerReadableStreamImpl=Ei.ServerUnaryCallImpl=void 0;Ei.serverErrorToStatus=SM;var jCe=Z("events"),_M=Z("stream"),yM=Ve(),p9=Kt();function SM(t,e){var r;let n={code:yM.Status.UNKNOWN,details:"message"in t?t.message:"Unknown Error",metadata:(r=e??t.metadata)!==null&&r!==void 0?r:null};return"code"in t&&typeof t.code=="number"&&Number.isInteger(t.code)&&(n.code=t.code,"details"in t&&typeof t.details=="string"&&(n.details=t.details)),n}var pM=class extends jCe.EventEmitter{constructor(e,r,n,i){super(),this.path=e,this.call=r,this.metadata=n,this.request=i,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};Ei.ServerUnaryCallImpl=pM;var hM=class extends _M.Readable{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};Ei.ServerReadableStreamImpl=hM;var mM=class extends _M.Writable{constructor(e,r,n,i){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.request=i,this.pendingStatus={code:yM.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new p9.Metadata,this.on("error",o=>{this.pendingStatus=SM(o),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};Ei.ServerWritableStreamImpl=mM;var gM=class extends _M.Duplex{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.pendingStatus={code:yM.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new p9.Metadata,this.on("error",i=>{this.pendingStatus=SM(i),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};Ei.ServerDuplexStreamImpl=gM});var $b=v(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.ServerCredentials=void 0;Kd.createCertificateProviderServerCredentials=zCe;Kd.createServerCredentialsWithInterceptors=GCe;var EM=xO(),wl=class{constructor(e,r){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=r??null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(let r of this.watchers)r(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new vM}static createSsl(e,r,n=!1){var i;if(e!==null&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(r))throw new TypeError("keyCertPairs must be an array");if(typeof n!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let o=[],s=[];for(let a=0;a<r.length;a++){let c=r[a];if(c===null||typeof c!="object")throw new TypeError(`keyCertPair[${a}] must be an object`);if(!Buffer.isBuffer(c.private_key))throw new TypeError(`keyCertPair[${a}].private_key must be a Buffer`);if(!Buffer.isBuffer(c.cert_chain))throw new TypeError(`keyCertPair[${a}].cert_chain must be a Buffer`);o.push(c.cert_chain),s.push(c.private_key)}return new TM({requestCert:n,ciphers:EM.CIPHER_SUITES},{ca:(i=e??(0,EM.getDefaultRootsData)())!==null&&i!==void 0?i:void 0,cert:o,key:s})}};Kd.ServerCredentials=wl;var vM=class t extends wl{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof t}},TM=class t extends wl{constructor(e,r){super(e,r),this.options=Object.assign(Object.assign({},e),r)}_equals(e){if(this===e)return!0;if(!(e instanceof t))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let r=0;r<this.options.cert.length;r++){let n=this.options.cert[r],i=e.options.cert[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let r=0;r<this.options.key.length;r++){let n=this.options.key[r],i=e.options.key[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}},bM=class t extends wl{constructor(e,r,n){super({requestCert:r!==null,rejectUnauthorized:n,ciphers:EM.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=r,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var r;this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var r;super._removeWatcher(e),this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e?!0:e instanceof t?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate:!1}calculateSecureContextOptions(){var e;return this.latestIdentityUpdate===null||this.caCertificateProvider!==null&&this.latestCaUpdate===null?null:{ca:(e=this.latestCaUpdate)===null||e===void 0?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}};function zCe(t,e,r){return new bM(t,e,r)}var AM=class t extends wl{constructor(e,r){super({}),this.childCredentials=e,this.interceptors=r}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof t)||!this.childCredentials._equals(e.childCredentials)||this.interceptors.length!==e.interceptors.length)return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r]!==e.interceptors[r])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}};function GCe(t,e){return new AM(t,e)}});var qg=v(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.durationMessageToDuration=qCe;ls.msToDuration=VCe;ls.durationToMs=HCe;ls.isDuration=WCe;ls.isDurationMessage=YCe;ls.parseDuration=ZCe;ls.durationToString=JCe;function qCe(t){return{seconds:Number.parseInt(t.seconds),nanos:t.nanos}}function VCe(t){return{seconds:t/1e3|0,nanos:t%1e3*1e6|0}}function HCe(t){return t.seconds*1e3+t.nanos/1e6|0}function WCe(t){return typeof t.seconds=="number"&&typeof t.nanos=="number"}function YCe(t){return typeof t.seconds=="string"&&typeof t.nanos=="number"}var KCe=/^(\d+)(?:\.(\d+))?s$/;function ZCe(t){let e=t.match(KCe);return e?{seconds:Number.parseInt(e[1],10),nanos:e[2]?Number.parseInt(e[2].padEnd(9,"0"),10):0}:null}function JCe(t){if(t.nanos===0)return`${t.seconds}s`;let e;return t.nanos%1e6===0?e=1e6:t.nanos%1e3===0?e=1e3:e=1,`${t.seconds}.${t.nanos/e}s`}});var Fb=v(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.OrcaOobMetricsSubchannelWrapper=yn.GRPC_METRICS_HEADER=yn.ServerMetricRecorder=yn.PerRequestMetricRecorder=void 0;yn.createOrcaClient=y9;yn.createMetricsReader=iIe;var XCe=CT(),wM=qg(),QCe=Td(),eIe=zg(),m9=Ve(),tIe=bd(),rIe=Lr(),g9=null;function Ub(){if(g9)return g9;let t=fk().loadSync,e=t("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,XCe.loadPackageDefinition)(e)}var xM=class{constructor(){this.message={}}recordRequestCostMetric(e,r){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=r}recordUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}recordNamedMetric(e,r){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=r}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return Ub().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};yn.PerRequestMetricRecorder=xM;var nIe=3e4,RM=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{let r=e.request.report_interval?(0,wM.durationToMs)((0,wM.durationMessageToDuration)(e.request.report_interval)):nIe,n=setInterval(()=>{e.write(this.message)},r);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var r;(r=this.message.utilization)===null||r===void 0||delete r[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){let r=Ub().xds.service.orca.v3.OpenRcaService.service;e.addService(r,this.serviceImplementation)}};yn.ServerMetricRecorder=RM;function y9(t){let e=Ub().xds.service.orca.v3.OpenRcaService;return new e("unused",QCe.ChannelCredentials.createInsecure(),{channelOverride:t})}yn.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var _9="grpc_orca_load_report";function iIe(t,e){return(r,n,i)=>{let o=i.getOpaque(_9);if(o)t(o);else{let s=i.get(yn.GRPC_METRICS_HEADER);s.length>0&&(o=Ub().xds.data.orca.v3.OrcaLoadReport.deserialize(s[0]),t(o),i.setOpaque(_9,o))}e&&e(r,n,i)}}var S9="orca_oob_metrics",CM=class{constructor(e,r){this.metricsListener=e,this.intervalMs=r,this.dataProducer=null}setSubchannel(e){let r=e.getOrCreateDataProducer(S9,oIe);this.dataProducer=r,r.addDataWatcher(this)}destroy(){var e;(e=this.dataProducer)===null||e===void 0||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}},IM=class{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new tIe.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let r=e.getChannel();this.client=y9(r),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var r;this.dataWatchers.delete(e),this.dataWatchers.size===0?(this.subchannel.removeDataProducer(S9),(r=this.metricsCall)===null||r===void 0||r.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==rIe.ConnectivityState.READY)return;let r=Math.min(...Array.from(this.dataWatchers).map(n=>n.getInterval()));if(!this.metricsCall||r!==this.currentInterval){(e=this.metricsCall)===null||e===void 0||e.cancel(),this.currentInterval=r;let n=this.client.streamCoreMetrics({report_interval:(0,wM.msToDuration)(r)});this.metricsCall=n,n.on("data",i=>{this.dataWatchers.forEach(o=>{o.onMetricsUpdate(i)})}),n.on("error",i=>{if(this.metricsCall=null,i.code===m9.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}i.code!==m9.Status.CANCELLED&&this.backoffTimer.runOnce()})}}},PM=class extends eIe.BaseSubchannelWrapper{constructor(e,r,n){super(e),this.addDataWatcher(new CM(r,n))}getWrappedSubchannel(){return this.child}};yn.OrcaOobMetricsSubchannelWrapper=PM;function oIe(t){return new IM(t)}});var $M=v(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.BaseServerInterceptingCall=Hn.ServerInterceptingCall=Hn.ResponderBuilder=Hn.ServerListenerBuilder=void 0;Hn.isInterceptingServerListener=cIe;Hn.getServerInterceptingCall=pIe;var zb=Kt(),Ur=Ve(),Zd=Z("http2"),E9=iT(),v9=Z("zlib"),sIe=Gk(),x9=ht(),aIe=Z("tls"),T9=Fb(),R9="server_call";function xl(t){x9.trace(Ur.LogVerbosity.DEBUG,R9,t)}var NM=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};Hn.ServerListenerBuilder=NM;function cIe(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var kM=class{constructor(e,r){this.listener=e,this.nextListener=r,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,!this.cancelled&&(this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,!this.cancelled&&(this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}},MM=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};Hn.ResponderBuilder=MM;var Bb={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveHalfClose:t=>{t()},onCancel:()=>{}},jb={start:t=>{t()},sendMetadata:(t,e)=>{e(t)},sendMessage:(t,e)=>{e(t)},sendStatus:(t,e)=>{e(t)}},DM=class{constructor(e,r){var n,i,o,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(n=r?.start)!==null&&n!==void 0?n:jb.start,sendMetadata:(i=r?.sendMetadata)!==null&&i!==void 0?i:jb.sendMetadata,sendMessage:(o=r?.sendMessage)!==null&&o!==void 0?o:jb.sendMessage,sendStatus:(s=r?.sendStatus)!==null&&s!==void 0?s:jb.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(r=>{var n,i,o,s;let a={onReceiveMetadata:(n=r?.onReceiveMetadata)!==null&&n!==void 0?n:Bb.onReceiveMetadata,onReceiveMessage:(i=r?.onReceiveMessage)!==null&&i!==void 0?i:Bb.onReceiveMessage,onReceiveHalfClose:(o=r?.onReceiveHalfClose)!==null&&o!==void 0?o:Bb.onReceiveHalfClose,onCancel:(s=r?.onCancel)!==null&&s!==void 0?s:Bb.onCancel},c=new kM(a,e);this.nextCall.start(c)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,r=>{this.processingMetadata=!1,this.nextCall.sendMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,r){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new zb.Metadata),this.responder.sendMessage(e,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=n,this.pendingMessageCallback=r):this.nextCall.sendMessage(n,r)})}sendStatus(e){this.responder.sendStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextCall.sendStatus(r)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};Hn.ServerInterceptingCall=DM;var C9="grpc-accept-encoding",LM="grpc-encoding",b9="grpc-message",A9="grpc-status",OM="grpc-timeout",lIe=/(\d{1,8})\s*([HMSmun])/,uIe={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},dIe={[C9]:"identity,deflate,gzip",[LM]:"identity"},w9={[Zd.constants.HTTP2_HEADER_STATUS]:Zd.constants.HTTP_STATUS_OK,[Zd.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},fIe={waitForTrailers:!0},Gb=class{constructor(e,r,n,i,o){var s,a;this.stream=e,this.callEventTracker=n,this.handler=i,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=Ur.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Ur.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new T9.PerRequestMetricRecorder,this.stream.once("close",()=>{var f;xl("Request to method "+((f=this.handler)===null||f===void 0?void 0:f.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:Ur.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",f=>{this.handleDataFrame(f)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in o&&(this.maxSendMessageSize=o["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in o&&(this.maxReceiveMessageSize=o["grpc.max_receive_message_length"]),this.host=(s=r[":authority"])!==null&&s!==void 0?s:r.host,this.decoder=new sIe.StreamDecoder(this.maxReceiveMessageSize);let c=zb.Metadata.fromHttp2Headers(r);x9.isTracerEnabled(R9)&&xl("Request to "+this.handler.path+" received headers "+JSON.stringify(c.toJSON()));let l=c.get(OM);l.length>0&&this.handleTimeoutHeader(l[0]);let u=c.get(LM);u.length>0&&(this.incomingEncoding=u[0]),c.remove(OM),c.remove(LM),c.remove(C9),c.remove(Zd.constants.HTTP2_HEADER_ACCEPT_ENCODING),c.remove(Zd.constants.HTTP2_HEADER_TE),c.remove(Zd.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=c;let d=(a=e.session)===null||a===void 0?void 0:a.socket;this.connectionInfo={localAddress:d?.localAddress,localPort:d?.localPort,remoteAddress:d?.remoteAddress,remotePort:d?.remotePort},this.shouldSendMetrics=!!o["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){let r=e.toString().match(lIe);if(r===null){let o={code:Ur.Status.INTERNAL,details:`Invalid ${OM} value "${e}"`,metadata:null};process.nextTick(()=>{this.sendStatus(o)});return}let n=+r[1]*uIe[r[2]]|0,i=new Date;this.deadline=i.setMilliseconds(i.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{let o={code:Ur.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(o)},n)}checkCancelled(){return!this.cancelled&&(this.stream.destroyed||this.stream.closed)&&(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;(e=this.listener)===null||e===void 0||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new zb.Metadata)}serializeMessage(e){let r=this.handler.serialize(e),n=r.byteLength,i=Buffer.allocUnsafe(n+5);return i.writeUInt8(0,0),i.writeUInt32BE(n,1),r.copy(i,5),i}decompressMessage(e,r){let n=e.subarray(5);if(r==="identity")return n;if(r==="deflate"||r==="gzip"){let i;return r==="deflate"?i=v9.createInflate():i=v9.createGunzip(),new Promise((o,s)=>{let a=0,c=[];i.on("error",l=>{s({code:Ur.Status.INTERNAL,details:"Failed to decompress message"})}),i.on("data",l=>{c.push(l),a+=l.byteLength,this.maxReceiveMessageSize!==-1&&a>this.maxReceiveMessageSize&&(i.destroy(),s({code:Ur.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),i.on("end",()=>{o(Buffer.concat(c))}),i.write(n),i.end()})}else return Promise.reject({code:Ur.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${r}"`})}async decompressAndMaybePush(e){if(e.type!=="COMPRESSED")throw new Error(`Invalid queue entry type: ${e.type}`);let n=e.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",i;try{i=await this.decompressMessage(e.compressedMessage,n)}catch(o){this.sendStatus(o);return}try{e.parsedMessage=this.handler.deserialize(i)}catch(o){this.sendStatus({code:Ur.Status.INTERNAL,details:`Error deserializing request: ${o.message}`});return}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let e=this.readQueue.shift();e.type==="READABLE"?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var r;if(this.checkCancelled())return;xl("Request to "+this.handler.path+" received data frame of size "+e.length);let n;try{n=this.decoder.write(e)}catch(i){this.sendStatus({code:Ur.Status.RESOURCE_EXHAUSTED,details:i.message});return}for(let i of n){this.stream.pause();let o={type:"COMPRESSED",compressedMessage:i,parsedMessage:null};this.readQueue.push(o),this.decompressAndMaybePush(o),(r=this.callEventTracker)===null||r===void 0||r.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){xl("Request to "+this.handler.path+" start called"),!this.checkCancelled()&&(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let r=e?e.toHttp2Headers():null,n=Object.assign(Object.assign(Object.assign({},w9),dIe),r);this.stream.respond(n,fIe)}sendMessage(e,r){if(this.checkCancelled())return;let n;try{n=this.serializeMessage(e)}catch(i){this.sendStatus({code:Ur.Status.INTERNAL,details:`Error serializing response: ${(0,E9.getErrorMessage)(i)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&n.length-5>this.maxSendMessageSize){this.sendStatus({code:Ur.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${n.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),xl("Request to "+this.handler.path+" sent data frame of size "+n.length),this.stream.write(n,i=>{var o;if(i){this.sendStatus({code:Ur.Status.INTERNAL,details:`Error writing message: ${(0,E9.getErrorMessage)(i)}`,metadata:null});return}(o=this.callEventTracker)===null||o===void 0||o.addMessageSent(),r()})}sendStatus(e){var r,n,i;if(this.checkCancelled())return;xl("Request to method "+((r=this.handler)===null||r===void 0?void 0:r.path)+" ended with status code: "+Ur.Status[e.code]+" details: "+e.details);let o=(i=(n=e.metadata)===null||n===void 0?void 0:n.clone())!==null&&i!==void 0?i:new zb.Metadata;if(this.shouldSendMetrics&&o.set(T9.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let s=Object.assign({[A9]:e.code,[b9]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(s),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let s=Object.assign(Object.assign({[A9]:e.code,[b9]:encodeURI(e.details)},w9),o.toHttp2Headers());this.stream.respond(s,{endStream:!0}),this.notifyOnCancel()}}startRead(){xl("Request to "+this.handler.path+" startRead called"),!this.checkCancelled()&&(this.isReadPending=!0,this.readQueue.length===0?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;let r=(e=this.stream.session)===null||e===void 0?void 0:e.socket;return r?.remoteAddress?r.remotePort?`${r.remoteAddress}:${r.remotePort}`:r.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if(((e=this.stream.session)===null||e===void 0?void 0:e.socket)instanceof aIe.TLSSocket){let r=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:r.raw?r:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}};Hn.BaseServerInterceptingCall=Gb;function pIe(t,e,r,n,i,o){let s={path:i.path,requestStream:i.type==="clientStream"||i.type==="bidi",responseStream:i.type==="serverStream"||i.type==="bidi",requestDeserialize:i.deserialize,responseSerialize:i.serialize},a=new Gb(e,r,n,i,o);return t.reduce((c,l)=>l(s,c),a)}});var D9=v(Ra=>{"use strict";var hIe=Ra&&Ra.__runInitializers||function(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0},mIe=Ra&&Ra.__esDecorate||function(t,e,r,n,i,o){function s(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(S){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(S||null))};var y=(0,r[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],h);if(a==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=s(y.get))&&(u.get=d),(d=s(y.set))&&(u.set=d),(d=s(y.init))&&i.unshift(d)}else(d=s(y))&&(a==="field"?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,n.name,u),f=!0};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Server=void 0;var Xr=Z("http2"),gIe=Z("util"),Nt=Ve(),Qd=h9(),UM=$b(),I9=ai(),Xd=ht(),xa=Zr(),vi=Dr(),zt=va(),P9=$M(),Jd=~(1<<31),FM=~(1<<31),_Ie=2e4,O9=~(1<<31),{HTTP2_HEADER_PATH:N9}=Xr.constants,yIe="server",k9=Buffer.from("max_age");function M9(t){Xd.trace(Nt.LogVerbosity.DEBUG,"server_call",t)}function SIe(){}function EIe(t){return function(e,r){return gIe.deprecate(e,t)}}function BM(t){return{code:Nt.Status.UNIMPLEMENTED,details:`The server does not implement the method ${t}`}}function vIe(t,e){let r=BM(e);switch(t){case"unary":return(n,i)=>{i(r,null)};case"clientStream":return(n,i)=>{i(r,null)};case"serverStream":return n=>{n.emit("error",r)};case"bidi":return n=>{n.emit("error",r)};default:throw new Error(`Invalid handlerType ${t}`)}}var TIe=(()=>{var t;let e=[],r;return t=class{constructor(i){var o,s,a,c,l,u;this.boundPorts=(hIe(this,e),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=i??{},this.options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new zt.ChannelzTraceStub,this.callTracker=new zt.ChannelzCallTrackerStub,this.listenerChildrenTracker=new zt.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new zt.ChannelzChildrenTrackerStub):(this.channelzTrace=new zt.ChannelzTrace,this.callTracker=new zt.ChannelzCallTracker,this.listenerChildrenTracker=new zt.ChannelzChildrenTracker,this.sessionChildrenTracker=new zt.ChannelzChildrenTracker),this.channelzRef=(0,zt.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(o=this.options["grpc.max_connection_age_ms"])!==null&&o!==void 0?o:Jd,this.maxConnectionAgeGraceMs=(s=this.options["grpc.max_connection_age_grace_ms"])!==null&&s!==void 0?s:Jd,this.keepaliveTimeMs=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:FM,this.keepaliveTimeoutMs=(c=this.options["grpc.keepalive_timeout_ms"])!==null&&c!==void 0?c:_Ie,this.sessionIdleTimeout=(l=this.options["grpc.max_connection_idle_ms"])!==null&&l!==void 0?l:O9,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=(u=this.options.interceptors)!==null&&u!==void 0?u:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(i){var o,s,a;let c=this.sessions.get(i),l=i.socket,u=l.remoteAddress?(0,xa.stringToSubchannelAddress)(l.remoteAddress,l.remotePort):null,d=l.localAddress?(0,xa.stringToSubchannelAddress)(l.localAddress,l.localPort):null,f;if(i.encrypted){let h=l,m=h.getCipher(),y=h.getCertificate(),S=h.getPeerCertificate();f={cipherSuiteStandardName:(o=m.standardName)!==null&&o!==void 0?o:null,cipherSuiteOtherName:m.standardName?null:m.name,localCertificate:y&&"raw"in y?y.raw:null,remoteCertificate:S&&"raw"in S?S.raw:null}}else f=null;return{remoteAddress:u,localAddress:d,security:f,remoteName:null,streamsStarted:c.streamTracker.callsStarted,streamsSucceeded:c.streamTracker.callsSucceeded,streamsFailed:c.streamTracker.callsFailed,messagesSent:c.messagesSent,messagesReceived:c.messagesReceived,keepAlivesSent:c.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:c.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:c.lastMessageSentTimestamp,lastMessageReceivedTimestamp:c.lastMessageReceivedTimestamp,localFlowControlWindow:(s=i.state.localWindowSize)!==null&&s!==void 0?s:null,remoteFlowControlWindow:(a=i.state.remoteWindowSize)!==null&&a!==void 0?a:null}}trace(i){Xd.trace(Nt.LogVerbosity.DEBUG,yIe,"("+this.channelzRef.id+") "+i)}keepaliveTrace(i){Xd.trace(Nt.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+i)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(i,o){if(i===null||typeof i!="object"||o===null||typeof o!="object")throw new Error("addService() requires two objects as arguments");let s=Object.keys(i);if(s.length===0)throw new Error("Cannot add an empty service to a server");s.forEach(a=>{let c=i[a],l;c.requestStream?c.responseStream?l="bidi":l="clientStream":c.responseStream?l="serverStream":l="unary";let u=o[a],d;if(u===void 0&&typeof c.originalName=="string"&&(u=o[c.originalName]),u!==void 0?d=u.bind(o):d=vIe(l,a),this.register(c.path,d,c.responseSerialize,c.requestDeserialize,l)===!1)throw new Error(`Method handler for ${c.path} already provided.`)})}removeService(i){if(i===null||typeof i!="object")throw new Error("removeService() requires object as argument");Object.keys(i).forEach(s=>{let a=i[s];this.unregister(a.path)})}bind(i,o){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(i){return(0,zt.registerChannelzSocket)((0,xa.subchannelAddressToString)(i),()=>({localAddress:i,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(i){(0,zt.unregisterChannelzRef)(i)}createHttp2Server(i){let o;if(i._isSecure()){let s=i._getConstructorOptions(),a=i._getSecureContextOptions(),c=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),s),a),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),l=a!==null;this.trace("Initial credentials valid: "+l),o=Xr.createSecureServer(c),o.prependListener("connection",d=>{l||(this.trace("Dropped connection from "+JSON.stringify(d.address())+" due to unloaded credentials"),d.destroy())}),o.on("secureConnection",d=>{d.on("error",f=>{this.trace("An incoming TLS connection closed with error: "+f.message)})});let u=d=>{if(d){let f=o;try{f.setSecureContext(d)}catch(p){Xd.log(Nt.LogVerbosity.ERROR,"Failed to set secure context with error "+p.message),d=null}}l=d!==null,this.trace("Post-update credentials valid: "+l)};i._addWatcher(u),o.on("close",()=>{i._removeWatcher(u)})}else o=Xr.createServer(this.commonServerOptions);return o.setTimeout(0,SIe),this._setupHandlers(o,i._getInterceptors()),o}bindOneAddress(i,o){this.trace("Attempting to bind "+(0,xa.subchannelAddressToString)(i));let s=this.createHttp2Server(o.credentials);return new Promise((a,c)=>{let l=u=>{this.trace("Failed to bind "+(0,xa.subchannelAddressToString)(i)+" with error "+u.message),a({port:"port"in i?i.port:1,error:u.message})};s.once("error",l),s.listen(i,()=>{let u=s.address(),d;typeof u=="string"?d={path:u}:d={host:u.address,port:u.port};let f=this.experimentalRegisterListenerToChannelz(d);this.listenerChildrenTracker.refChild(f),this.http2Servers.set(s,{channelzRef:f,sessions:new Set,ownsChannelzRef:!0}),o.listeningServers.add(s),this.trace("Successfully bound "+(0,xa.subchannelAddressToString)(d)),a({port:"port"in d?d.port:1}),s.removeListener("error",l)})})}async bindManyPorts(i,o){if(i.length===0)return{count:0,port:0,errors:[]};if((0,xa.isTcpSubchannelAddress)(i[0])&&i[0].port===0){let s=await this.bindOneAddress(i[0],o);if(s.error){let a=await this.bindManyPorts(i.slice(1),o);return Object.assign(Object.assign({},a),{errors:[s.error,...a.errors]})}else{let a=i.slice(1).map(u=>(0,xa.isTcpSubchannelAddress)(u)?{host:u.host,port:s.port}:u),c=await Promise.all(a.map(u=>this.bindOneAddress(u,o))),l=[s,...c];return{count:l.filter(u=>u.error===void 0).length,port:s.port,errors:l.filter(u=>u.error).map(u=>u.error)}}}else{let s=await Promise.all(i.map(a=>this.bindOneAddress(a,o)));return{count:s.filter(a=>a.error===void 0).length,port:s[0].port,errors:s.filter(a=>a.error).map(a=>a.error)}}}async bindAddressList(i,o){let s=await this.bindManyPorts(i,o);if(s.count>0)return s.count<i.length&&Xd.log(Nt.LogVerbosity.INFO,`WARNING Only ${s.count} addresses added out of total ${i.length} resolved`),s.port;{let a=`No address added out of total ${i.length} resolved`;throw Xd.log(Nt.LogVerbosity.ERROR,a),new Error(`${a} errors: [${s.errors.join(",")}]`)}}resolvePort(i){return new Promise((o,s)=>{let a=!1,c=(u,d,f,p)=>{if(a)return!0;if(a=!0,!u.ok)return s(new Error(u.error.details)),!0;let h=[].concat(...u.value.map(m=>m.addresses));return h.length===0?(s(new Error(`No addresses resolved for port ${i}`)),!0):(o(h),!0)};(0,I9.createResolver)(i,c,this.options).updateResolution()})}async bindPort(i,o){let s=await this.resolvePort(i);if(o.cancelled)throw this.completeUnbind(o),new Error("bindAsync operation cancelled by unbind call");let a=await this.bindAddressList(s,o);if(o.cancelled)throw this.completeUnbind(o),new Error("bindAsync operation cancelled by unbind call");return a}normalizePort(i){let o=(0,vi.parseUri)(i);if(o===null)throw new Error(`Could not parse port "${i}"`);let s=(0,I9.mapUriDefaultScheme)(o);if(s===null)throw new Error(`Could not get a default scheme for port "${i}"`);return s}bindAsync(i,o,s){if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof i!="string")throw new TypeError("port must be a string");if(o===null||!(o instanceof UM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof s!="function")throw new TypeError("callback must be a function");this.trace("bindAsync port="+i);let a=this.normalizePort(i),c=(f,p)=>{process.nextTick(()=>s(f,p))},l=this.boundPorts.get((0,vi.uriToString)(a));if(l){if(!o._equals(l.credentials)){c(new Error(`${i} already bound with incompatible credentials`),0);return}l.cancelled=!1,l.completionPromise?l.completionPromise.then(f=>s(null,f),f=>s(f,0)):c(null,l.portNumber);return}l={mapKey:(0,vi.uriToString)(a),originalUri:a,completionPromise:null,cancelled:!1,portNumber:0,credentials:o,listeningServers:new Set};let u=(0,vi.splitHostPort)(a.path),d=this.bindPort(a,l);l.completionPromise=d,u?.port===0?d.then(f=>{let p={scheme:a.scheme,authority:a.authority,path:(0,vi.combineHostPort)({host:u.host,port:f})};l.mapKey=(0,vi.uriToString)(p),l.completionPromise=null,l.portNumber=f,this.boundPorts.set(l.mapKey,l),s(null,f)},f=>{s(f,0)}):(this.boundPorts.set(l.mapKey,l),d.then(f=>{l.completionPromise=null,l.portNumber=f,s(null,f)},f=>{s(f,0)}))}registerInjectorToChannelz(){return(0,zt.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(i,o,s=!1){if(i===null||!(i instanceof UM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(o);let a=this.createHttp2Server(i),c=new Set;return this.http2Servers.set(a,{channelzRef:o,sessions:c,ownsChannelzRef:s}),{injectConnection:l=>{a.emit("connection",l)},drain:l=>{var u,d;for(let f of c)this.closeSession(f);(d=(u=setTimeout(()=>{for(let f of c)f.destroy(Xr.constants.NGHTTP2_CANCEL)},l)).unref)===null||d===void 0||d.call(u)},destroy:()=>{this.closeServer(a);for(let l of c)this.closeSession(l)}}}createConnectionInjector(i){if(i===null||!(i instanceof UM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");let o=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(i,o,!0)}closeServer(i,o){this.trace("Closing server with address "+JSON.stringify(i.address()));let s=this.http2Servers.get(i);i.close(()=>{s&&s.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(s.channelzRef),(0,zt.unregisterChannelzRef)(s.channelzRef)),this.http2Servers.delete(i),o?.()})}closeSession(i,o){var s;this.trace("Closing session initiated by "+((s=i.socket)===null||s===void 0?void 0:s.remoteAddress));let a=this.sessions.get(i),c=()=>{a&&(this.sessionChildrenTracker.unrefChild(a.ref),(0,zt.unregisterChannelzRef)(a.ref)),o?.()};i.closed?queueMicrotask(c):i.close(c)}completeUnbind(i){for(let o of i.listeningServers){let s=this.http2Servers.get(o);if(this.closeServer(o,()=>{i.listeningServers.delete(o)}),s)for(let a of s.sessions)this.closeSession(a)}this.boundPorts.delete(i.mapKey)}unbind(i){this.trace("unbind port="+i);let o=this.normalizePort(i),s=(0,vi.splitHostPort)(o.path);if(s?.port===0)throw new Error("Cannot unbind port 0");let a=this.boundPorts.get((0,vi.uriToString)(o));a&&(this.trace("unbinding "+a.mapKey+" originally bound as "+(0,vi.uriToString)(a.originalUri)),a.completionPromise?a.cancelled=!0:this.completeUnbind(a))}drain(i,o){var s,a;this.trace("drain port="+i+" graceTimeMs="+o);let c=this.normalizePort(i),l=(0,vi.splitHostPort)(c.path);if(l?.port===0)throw new Error("Cannot drain port 0");let u=this.boundPorts.get((0,vi.uriToString)(c));if(!u)return;let d=new Set;for(let f of u.listeningServers){let p=this.http2Servers.get(f);if(p)for(let h of p.sessions)d.add(h),this.closeSession(h,()=>{d.delete(h)})}(a=(s=setTimeout(()=>{for(let f of d)f.destroy(Xr.constants.NGHTTP2_CANCEL)},o)).unref)===null||a===void 0||a.call(s)}forceShutdown(){for(let i of this.boundPorts.values())i.cancelled=!0;this.boundPorts.clear();for(let i of this.http2Servers.keys())this.closeServer(i);this.sessions.forEach((i,o)=>{this.closeSession(o),o.destroy(Xr.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,zt.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(i,o,s,a,c){return this.handlers.has(i)?!1:(this.handlers.set(i,{func:o,serialize:s,deserialize:a,type:c,path:i}),!0)}unregister(i){return this.handlers.delete(i)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every(i=>!i.listening))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.started=!0}tryShutdown(i){var o;let s=l=>{(0,zt.unregisterChannelzRef)(this.channelzRef),i(l)},a=0;function c(){a--,a===0&&s()}this.shutdown=!0;for(let[l,u]of this.http2Servers.entries()){a++;let d=u.channelzRef.name;this.trace("Waiting for server "+d+" to close"),this.closeServer(l,()=>{this.trace("Server "+d+" finished closing"),c()});for(let f of u.sessions.keys()){a++;let p=(o=f.socket)===null||o===void 0?void 0:o.remoteAddress;this.trace("Waiting for session "+p+" to close"),this.closeSession(f,()=>{this.trace("Session "+p+" finished closing"),c()})}}a===0&&s()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(i,o){let s=o[Xr.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof s!="string"||!s.startsWith("application/grpc")?(i.respond({[Xr.constants.HTTP2_HEADER_STATUS]:Xr.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(i){M9("Received call to method "+i+" at address "+this.serverAddressString);let o=this.handlers.get(i);return o===void 0?(M9("No handler registered for method "+i+". Sending UNIMPLEMENTED status."),null):o}_respondWithError(i,o,s=null){var a,c;let l=Object.assign({"grpc-status":(a=i.code)!==null&&a!==void 0?a:Nt.Status.INTERNAL,"grpc-message":i.details,[Xr.constants.HTTP2_HEADER_STATUS]:Xr.constants.HTTP_STATUS_OK,[Xr.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(c=i.metadata)===null||c===void 0?void 0:c.toHttp2Headers());o.respond(l,{endStream:!0}),this.callTracker.addCallFailed(),s?.streamTracker.addCallFailed()}_channelzHandler(i,o,s){o.once("error",f=>{}),this.onStreamOpened(o);let a=this.sessions.get(o.session);if(this.callTracker.addCallStarted(),a?.streamTracker.addCallStarted(),!this._verifyContentType(o,s)){this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed();return}let c=s[N9],l=this._retrieveHandler(c);if(!l){this._respondWithError(BM(c),o,a);return}let u={addMessageSent:()=>{a&&(a.messagesSent+=1,a.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{a&&(a.messagesReceived+=1,a.lastMessageReceivedTimestamp=new Date)},onCallEnd:f=>{f.code===Nt.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:f=>{a&&(f?a.streamTracker.addCallSucceeded():a.streamTracker.addCallFailed())}},d=(0,P9.getServerInterceptingCall)([...i,...this.interceptors],o,s,u,l,this.options);this._runHandlerForCall(d,l)||(this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed(),d.sendStatus({code:Nt.Status.INTERNAL,details:`Unknown handler type: ${l.type}`}))}_streamHandler(i,o,s){if(o.once("error",u=>{}),this.onStreamOpened(o),this._verifyContentType(o,s)!==!0)return;let a=s[N9],c=this._retrieveHandler(a);if(!c){this._respondWithError(BM(a),o,null);return}let l=(0,P9.getServerInterceptingCall)([...i,...this.interceptors],o,s,null,c,this.options);this._runHandlerForCall(l,c)||l.sendStatus({code:Nt.Status.INTERNAL,details:`Unknown handler type: ${c.type}`})}_runHandlerForCall(i,o){let{type:s}=o;if(s==="unary")bIe(i,o);else if(s==="clientStream")AIe(i,o);else if(s==="serverStream")wIe(i,o);else if(s==="bidi")xIe(i,o);else return!1;return!0}_setupHandlers(i,o){if(i===null)return;let s=i.address(),a="null";s&&(typeof s=="string"?a=s:a=s.address+":"+s.port),this.serverAddressString=a;let c=this.channelzEnabled?this._channelzHandler:this._streamHandler,l=this.channelzEnabled?this._channelzSessionHandler(i):this._sessionHandler(i);i.on("stream",c.bind(this,o)),i.on("session",l)}_sessionHandler(i){return o=>{var s,a;(s=this.http2Servers.get(i))===null||s===void 0||s.sessions.add(o);let c=null,l=null,u=null,d=!1,f=this.enableIdleTimeout(o);if(this.maxConnectionAgeMs!==Jd){let S=this.maxConnectionAgeMs/10,b=Math.random()*S*2-S;c=setTimeout(()=>{var w,T;d=!0,this.trace("Connection dropped by max connection age: "+((w=o.socket)===null||w===void 0?void 0:w.remoteAddress));try{o.goaway(Xr.constants.NGHTTP2_NO_ERROR,~(1<<31),k9)}catch{o.destroy();return}o.close(),this.maxConnectionAgeGraceMs!==Jd&&(l=setTimeout(()=>{o.destroy()},this.maxConnectionAgeGraceMs),(T=l.unref)===null||T===void 0||T.call(l))},this.maxConnectionAgeMs+b),(a=c.unref)===null||a===void 0||a.call(c)}let p=()=>{u&&(clearTimeout(u),u=null)},h=()=>!o.destroyed&&this.keepaliveTimeMs<FM&&this.keepaliveTimeMs>0,m,y=()=>{var S;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),u=setTimeout(()=>{p(),m()},this.keepaliveTimeMs),(S=u.unref)===null||S===void 0||S.call(u))};m=()=>{var S;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let b="";try{o.ping((T,C,O)=>{p(),T?(this.keepaliveTrace("Ping failed with error: "+T.message),d=!0,o.destroy()):(this.keepaliveTrace("Received ping response"),y())})||(b="Ping returned false")}catch(w){b=(w instanceof Error?w.message:"")||"Unknown error"}if(b){this.keepaliveTrace("Ping send failed: "+b),this.trace("Connection dropped due to ping send error: "+b),d=!0,o.destroy();return}u=setTimeout(()=>{p(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),d=!0,o.destroy()},this.keepaliveTimeoutMs),(S=u.unref)===null||S===void 0||S.call(u)},y(),o.on("close",()=>{var S,b;d||this.trace(`Connection dropped by client ${(S=o.socket)===null||S===void 0?void 0:S.remoteAddress}`),c&&clearTimeout(c),l&&clearTimeout(l),p(),f!==null&&(clearTimeout(f.timeout),this.sessionIdleTimeouts.delete(o)),(b=this.http2Servers.get(i))===null||b===void 0||b.sessions.delete(o)})}}_channelzSessionHandler(i){return o=>{var s,a,c,l;let u=(0,zt.registerChannelzSocket)((a=(s=o.socket)===null||s===void 0?void 0:s.remoteAddress)!==null&&a!==void 0?a:"unknown",this.getChannelzSessionInfo.bind(this,o),this.channelzEnabled),d={ref:u,streamTracker:new zt.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(c=this.http2Servers.get(i))===null||c===void 0||c.sessions.add(o),this.sessions.set(o,d);let f=`${o.socket.remoteAddress}:${o.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+f),this.trace("Connection established by client "+f),this.sessionChildrenTracker.refChild(u);let p=null,h=null,m=null,y=!1,S=this.enableIdleTimeout(o);if(this.maxConnectionAgeMs!==Jd){let O=this.maxConnectionAgeMs/10,k=Math.random()*O*2-O;p=setTimeout(()=>{var P;y=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+f);try{o.goaway(Xr.constants.NGHTTP2_NO_ERROR,~(1<<31),k9)}catch{o.destroy();return}o.close(),this.maxConnectionAgeGraceMs!==Jd&&(h=setTimeout(()=>{o.destroy()},this.maxConnectionAgeGraceMs),(P=h.unref)===null||P===void 0||P.call(h))},this.maxConnectionAgeMs+k),(l=p.unref)===null||l===void 0||l.call(p)}let b=()=>{m&&(clearTimeout(m),m=null)},w=()=>!o.destroyed&&this.keepaliveTimeMs<FM&&this.keepaliveTimeMs>0,T,C=()=>{var O;w()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),m=setTimeout(()=>{b(),T()},this.keepaliveTimeMs),(O=m.unref)===null||O===void 0||O.call(m))};T=()=>{var O;if(!w())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let k="";try{o.ping((M,F,_)=>{b(),M?(this.keepaliveTrace("Ping failed with error: "+M.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+M.message+" return in "+F),y=!0,o.destroy()):(this.keepaliveTrace("Received ping response"),C())})||(k="Ping returned false")}catch(P){k=(P instanceof Error?P.message:"")||"Unknown error"}if(k){this.keepaliveTrace("Ping send failed: "+k),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+k),y=!0,o.destroy();return}d.keepAlivesSent+=1,m=setTimeout(()=>{b(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+f),y=!0,o.destroy()},this.keepaliveTimeoutMs),(O=m.unref)===null||O===void 0||O.call(m)},C(),o.on("close",()=>{var O;y||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+f),this.sessionChildrenTracker.unrefChild(u),(0,zt.unregisterChannelzRef)(u),p&&clearTimeout(p),h&&clearTimeout(h),b(),S!==null&&(clearTimeout(S.timeout),this.sessionIdleTimeouts.delete(o)),(O=this.http2Servers.get(i))===null||O===void 0||O.sessions.delete(o),this.sessions.delete(o)})}}enableIdleTimeout(i){var o,s;if(this.sessionIdleTimeout>=O9)return null;let a={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,i),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,i)};(s=(o=a.timeout).unref)===null||s===void 0||s.call(o),this.sessionIdleTimeouts.set(i,a);let{socket:c}=i;return this.trace("Enable idle timeout for "+c.remoteAddress+":"+c.remotePort),a}onIdleTimeout(i,o){let{socket:s}=o,a=i.sessionIdleTimeouts.get(o);a!==void 0&&a.activeStreams===0&&(Date.now()-a.lastIdle>=i.sessionIdleTimeout?(i.trace("Session idle timeout triggered for "+s?.remoteAddress+":"+s?.remotePort+" last idle at "+a.lastIdle),i.closeSession(o)):a.timeout.refresh())}onStreamOpened(i){let o=i.session,s=this.sessionIdleTimeouts.get(o);s&&(s.activeStreams+=1,i.once("close",s.onClose))}onStreamClose(i){var o,s;let a=this.sessionIdleTimeouts.get(i);a&&(a.activeStreams-=1,a.activeStreams===0&&(a.lastIdle=Date.now(),a.timeout.refresh(),this.trace("Session onStreamClose"+((o=i.socket)===null||o===void 0?void 0:o.remoteAddress)+":"+((s=i.socket)===null||s===void 0?void 0:s.remotePort)+" at "+a.lastIdle)))}},(()=>{let n=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;r=[EIe("Calling start() is no longer necessary. It can be safely omitted.")],mIe(t,null,r,{kind:"method",name:"start",static:!1,private:!1,access:{has:i=>"start"in i,get:i=>i.start},metadata:n},null,e),n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),t})();Ra.Server=TIe;async function bIe(t,e){let r;function n(s,a,c,l){if(s){t.sendStatus((0,Qd.serverErrorToStatus)(s,c));return}t.sendMessage(a,()=>{t.sendStatus({code:Nt.Status.OK,details:"OK",metadata:c??null})})}let i,o=null;t.start({onReceiveMetadata(s){i=s,t.startRead()},onReceiveMessage(s){if(o){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}o=s,t.startRead()},onReceiveHalfClose(){if(!o){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new Qd.ServerWritableStreamImpl(e.path,t,i,o);try{e.func(r,n)}catch(s){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${s.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"))}})}function AIe(t,e){let r;function n(i,o,s,a){if(i){t.sendStatus((0,Qd.serverErrorToStatus)(i,s));return}t.sendMessage(o,()=>{t.sendStatus({code:Nt.Status.OK,details:"OK",metadata:s??null})})}t.start({onReceiveMetadata(i){r=new Qd.ServerDuplexStreamImpl(e.path,t,i);try{e.func(r,n)}catch(o){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onReceiveMessage(i){r.push(i)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function wIe(t,e){let r,n,i=null;t.start({onReceiveMetadata(o){n=o,t.startRead()},onReceiveMessage(o){if(i){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}i=o,t.startRead()},onReceiveHalfClose(){if(!i){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new Qd.ServerWritableStreamImpl(e.path,t,n,i);try{e.func(r)}catch(o){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function xIe(t,e){let r;t.start({onReceiveMetadata(n){r=new Qd.ServerDuplexStreamImpl(e.path,t,n);try{e.func(r)}catch(i){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${i.message}`,metadata:null})}},onReceiveMessage(n){r.push(n)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}});var L9=v(qb=>{"use strict";Object.defineProperty(qb,"__esModule",{value:!0});qb.StatusBuilder=void 0;var jM=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){let e={};return this.code!==null&&(e.code=this.code),this.details!==null&&(e.details=this.details),this.metadata!==null&&(e.metadata=this.metadata),e}};qb.StatusBuilder=jM});var Yg=v(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.LeafLoadBalancer=lo.PickFirstLoadBalancer=lo.PickFirstLoadBalancingConfig=void 0;lo.shuffled=B9;lo.setup=MIe;var zM=da(),kt=Lr(),Ca=Jo(),$9=Zr(),RIe=ht(),CIe=Ve(),U9=Zr(),F9=Z("net"),IIe=cl(),PIe="pick_first";function Vg(t){RIe.trace(CIe.LogVerbosity.DEBUG,PIe,t)}var Hg="pick_first",OIe=250,ef=class t{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return Hg}toJsonObject(){return{[Hg]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&typeof e.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new t(e.shuffleAddressList===!0)}};lo.PickFirstLoadBalancingConfig=ef;var GM=class{constructor(e){this.subchannel=e}pick(e){return{pickResultType:Ca.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function B9(t){let e=t.slice();for(let r=e.length-1;r>1;r--){let n=Math.floor(Math.random()*(r+1)),i=e[r];e[r]=e[n],e[n]=i}return e}function NIe(t){if(t.length===0)return[];let e=[],r=[],n=[],i=(0,U9.isTcpSubchannelAddress)(t[0])&&(0,F9.isIPv6)(t[0].host);for(let a of t)(0,U9.isTcpSubchannelAddress)(a)&&(0,F9.isIPv6)(a.host)?r.push(a):n.push(a);let o=i?r:n,s=i?n:r;for(let a=0;a<Math.max(o.length,s.length);a++)a<o.length&&e.push(o[a]),a<s.length&&e.push(s[a]);return e}var j9="grpc-node.internal.pick-first.report_health_status",Wg=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=kt.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(r,n,i,o,s)=>{this.onSubchannelStateUpdate(r,n,i,s)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let r=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker({details:r}),r)}else this.updateState(kt.ConnectivityState.READY,new GM(this.currentPick),null);else if(((e=this.latestAddressList)===null||e===void 0?void 0:e.length)===0){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker({details:r}),r)}else if(this.children.length===0)this.updateState(kt.ConnectivityState.IDLE,new Ca.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker({details:r}),r)}else this.updateState(kt.ConnectivityState.CONNECTING,new Ca.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()){if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){this.currentPick!==null&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,r,n,i){var o;if(!((o=this.currentPick)===null||o===void 0)&&o.realSubchannelEquals(e)){n!==kt.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());return}for(let[s,a]of this.children.entries())if(e.realSubchannelEquals(a.subchannel)){n===kt.ConnectivityState.READY&&this.pickSubchannel(a.subchannel),n===kt.ConnectivityState.TRANSIENT_FAILURE&&(a.hasReportedTransientFailure=!0,i&&(this.lastError=i),this.maybeEnterStickyTransientFailureMode(),s===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(s+1)),a.subchannel.startConnecting();return}}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(let[r,n]of this.children.entries())if(r>=e){let i=n.subchannel.getConnectivityState();if(i===kt.ConnectivityState.IDLE||i===kt.ConnectivityState.CONNECTING){this.startConnecting(r);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var r,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===kt.ConnectivityState.IDLE&&(Vg("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var i;(i=this.children[e])===null||i===void 0||i.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},OIe),(n=(r=this.connectionDelayTimeout).unref)===null||n===void 0||n.call(r)}pickSubchannel(e){Vg("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,r,n){Vg(kt.ConnectivityState[this.currentState]+" -> "+kt.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,r){Vg("connectToAddressList(["+e.map(i=>(0,$9.subchannelAddressToString)(i))+"])");let n=e.map(i=>({subchannel:this.channelControlHelper.createSubchannel(i,r),hasReportedTransientFailure:!1}));for(let{subchannel:i}of n)if(i.getConnectivityState()===kt.ConnectivityState.READY){this.pickSubchannel(i);return}for(let{subchannel:i}of n)i.ref(),this.channelControlHelper.addChannelzChild(i.getChannelzRef());this.resetSubchannelList(),this.children=n;for(let{subchannel:i}of this.children)i.addConnectivityStateListener(this.subchannelStateListener);for(let i of this.children)i.subchannel.getConnectivityState()===kt.ConnectivityState.TRANSIENT_FAILURE&&(i.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,r,n,i){if(!(r instanceof ef))return!1;if(!e.ok)return this.children.length===0&&this.currentPick===null&&this.channelControlHelper.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker(e.error),e.error.details),!0;let o=e.value;this.reportHealthStatus=n[j9],r.getShuffleAddressList()&&(o=B9(o));let s=[].concat(...o.map(c=>c.addresses));Vg("updateAddressList(["+s.map(c=>(0,$9.subchannelAddressToString)(c))+"])");let a=NIe(s);return this.latestAddressList=a,this.latestOptions=n,this.connectToAddressList(a,n),this.latestResolutionNote=i,s.length>0?!0:(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===kt.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return Hg}};lo.PickFirstLoadBalancer=Wg;var kIe=new ef(!1),qM=class{constructor(e,r,n,i){this.endpoint=e,this.options=n,this.resolutionNote=i,this.latestState=kt.ConnectivityState.IDLE;let o=(0,zM.createChildChannelControlHelper)(r,{updateState:(s,a,c)=>{this.latestState=s,this.latestPicker=a,r.updateState(s,a,c)}});this.pickFirstBalancer=new Wg(o),this.latestPicker=new Ca.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,IIe.statusOrFromValue)([this.endpoint]),kIe,Object.assign(Object.assign({},this.options),{[j9]:!0}),this.resolutionNote)}updateEndpoint(e,r){this.options=r,this.endpoint=e,this.latestState!==kt.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}};lo.LeafLoadBalancer=qM;function MIe(){(0,zM.registerLoadBalancerType)(Hg,Wg,ef),(0,zM.registerDefaultLoadBalancerType)(Hg)}});var z9=v(Hb=>{"use strict";Object.defineProperty(Hb,"__esModule",{value:!0});Hb.FileWatcherCertificateProvider=void 0;var DIe=Z("fs"),LIe=ht(),$Ie=Ve(),UIe=Z("util"),FIe="certificate_provider";function Vb(t){LIe.trace($Ie.LogVerbosity.DEBUG,FIe,t)}var VM=(0,UIe.promisify)(DIe.readFile),HM=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,e.certificateFile===void 0!=(e.privateKeyFile===void 0))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(e.certificateFile===void 0&&e.caCertificateFile===void 0)throw new Error("At least one of certificateFile and caCertificateFile must be set");Vb("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?VM(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?VM(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?VM(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,r,n])=>{if(this.refreshTimer){Vb("File watcher read certificates certificate "+e.status+", privateKey "+r.status+", CA certificate "+n.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,e.status==="fulfilled"&&r.status==="fulfilled"?this.latestIdentityUpdate={certificate:e.value,privateKey:r.value}:this.latestIdentityUpdate=null,n.status==="fulfilled"?this.latestCaUpdate={caCertificate:n.value}:this.latestCaUpdate=null;for(let i of this.identityListeners)i(this.latestIdentityUpdate);for(let i of this.caListeners)i(this.latestCaUpdate)}}),Vb("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){let e=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>this.config.refreshIntervalMs*2&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),Vb("File watcher started watching")}}maybeStopWatchingFiles(){this.caListeners.size===0&&this.identityListeners.size===0&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}};Hb.FileWatcherCertificateProvider=HM});var KM=v(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=ge.createCertificateProviderChannelCredentials=ge.FileWatcherCertificateProvider=ge.createCertificateProviderServerCredentials=ge.createServerCredentialsWithInterceptors=ge.BaseSubchannelWrapper=ge.registerAdminService=ge.FilterStackFactory=ge.BaseFilter=ge.statusOrFromError=ge.statusOrFromValue=ge.PickResultType=ge.QueuePicker=ge.UnavailablePicker=ge.ChildLoadBalancerHandler=ge.EndpointMap=ge.endpointHasAddress=ge.endpointToString=ge.subchannelAddressToString=ge.LeafLoadBalancer=ge.isLoadBalancerNameRegistered=ge.parseLoadBalancingConfig=ge.selectLbConfigFromList=ge.registerLoadBalancerType=ge.createChildChannelControlHelper=ge.BackoffTimeout=ge.parseDuration=ge.durationToMs=ge.splitHostPort=ge.uriToString=ge.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=ge.createResolver=ge.registerResolver=ge.log=ge.trace=void 0;var G9=ht();Object.defineProperty(ge,"trace",{enumerable:!0,get:function(){return G9.trace}});Object.defineProperty(ge,"log",{enumerable:!0,get:function(){return G9.log}});var WM=ai();Object.defineProperty(ge,"registerResolver",{enumerable:!0,get:function(){return WM.registerResolver}});Object.defineProperty(ge,"createResolver",{enumerable:!0,get:function(){return WM.createResolver}});Object.defineProperty(ge,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return WM.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var q9=Dr();Object.defineProperty(ge,"uriToString",{enumerable:!0,get:function(){return q9.uriToString}});Object.defineProperty(ge,"splitHostPort",{enumerable:!0,get:function(){return q9.splitHostPort}});var V9=qg();Object.defineProperty(ge,"durationToMs",{enumerable:!0,get:function(){return V9.durationToMs}});Object.defineProperty(ge,"parseDuration",{enumerable:!0,get:function(){return V9.parseDuration}});var BIe=bd();Object.defineProperty(ge,"BackoffTimeout",{enumerable:!0,get:function(){return BIe.BackoffTimeout}});var Kg=da();Object.defineProperty(ge,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Kg.createChildChannelControlHelper}});Object.defineProperty(ge,"registerLoadBalancerType",{enumerable:!0,get:function(){return Kg.registerLoadBalancerType}});Object.defineProperty(ge,"selectLbConfigFromList",{enumerable:!0,get:function(){return Kg.selectLbConfigFromList}});Object.defineProperty(ge,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return Kg.parseLoadBalancingConfig}});Object.defineProperty(ge,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return Kg.isLoadBalancerNameRegistered}});var jIe=Yg();Object.defineProperty(ge,"LeafLoadBalancer",{enumerable:!0,get:function(){return jIe.LeafLoadBalancer}});var Wb=Zr();Object.defineProperty(ge,"subchannelAddressToString",{enumerable:!0,get:function(){return Wb.subchannelAddressToString}});Object.defineProperty(ge,"endpointToString",{enumerable:!0,get:function(){return Wb.endpointToString}});Object.defineProperty(ge,"endpointHasAddress",{enumerable:!0,get:function(){return Wb.endpointHasAddress}});Object.defineProperty(ge,"EndpointMap",{enumerable:!0,get:function(){return Wb.EndpointMap}});var zIe=ST();Object.defineProperty(ge,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return zIe.ChildLoadBalancerHandler}});var YM=Jo();Object.defineProperty(ge,"UnavailablePicker",{enumerable:!0,get:function(){return YM.UnavailablePicker}});Object.defineProperty(ge,"QueuePicker",{enumerable:!0,get:function(){return YM.QueuePicker}});Object.defineProperty(ge,"PickResultType",{enumerable:!0,get:function(){return YM.PickResultType}});var H9=cl();Object.defineProperty(ge,"statusOrFromValue",{enumerable:!0,get:function(){return H9.statusOrFromValue}});Object.defineProperty(ge,"statusOrFromError",{enumerable:!0,get:function(){return H9.statusOrFromError}});var GIe=bk();Object.defineProperty(ge,"BaseFilter",{enumerable:!0,get:function(){return GIe.BaseFilter}});var qIe=gb();Object.defineProperty(ge,"FilterStackFactory",{enumerable:!0,get:function(){return qIe.FilterStackFactory}});var VIe=bT();Object.defineProperty(ge,"registerAdminService",{enumerable:!0,get:function(){return VIe.registerAdminService}});var HIe=zg();Object.defineProperty(ge,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return HIe.BaseSubchannelWrapper}});var W9=$b();Object.defineProperty(ge,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return W9.createServerCredentialsWithInterceptors}});Object.defineProperty(ge,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return W9.createCertificateProviderServerCredentials}});var WIe=z9();Object.defineProperty(ge,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return WIe.FileWatcherCertificateProvider}});var YIe=Td();Object.defineProperty(ge,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return YIe.createCertificateProviderChannelCredentials}});var KIe=dM();Object.defineProperty(ge,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return KIe.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var Y9=v(JM=>{"use strict";Object.defineProperty(JM,"__esModule",{value:!0});JM.setup=XIe;var ZIe=ai(),JIe=cl(),ZM=class{constructor(e,r,n){this.listener=r,this.hasReturnedResult=!1,this.endpoints=[];let i;e.authority===""?i="/"+e.path:i=e.path,this.endpoints=[{addresses:[{path:i}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,JIe.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}};function XIe(){(0,ZIe.registerResolver)("unix",ZM)}});var eJ=v(tD=>{"use strict";Object.defineProperty(tD,"__esModule",{value:!0});tD.setup=nPe;var K9=Z("net"),Z9=cl(),Yb=Ve(),XM=Kt(),J9=ai(),QIe=Zr(),X9=Dr(),ePe=ht(),tPe="ip_resolver";function Q9(t){ePe.trace(Yb.LogVerbosity.DEBUG,tPe,t)}var QM="ipv4",eD="ipv6",rPe=443,Kb=class{constructor(e,r,n){var i;this.listener=r,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,Q9("Resolver constructed for target "+(0,X9.uriToString)(e));let o=[];if(!(e.scheme===QM||e.scheme===eD)){this.error={code:Yb.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new XM.Metadata};return}let s=e.path.split(",");for(let a of s){let c=(0,X9.splitHostPort)(a);if(c===null){this.error={code:Yb.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new XM.Metadata};return}if(e.scheme===QM&&!(0,K9.isIPv4)(c.host)||e.scheme===eD&&!(0,K9.isIPv6)(c.host)){this.error={code:Yb.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new XM.Metadata};return}o.push({host:c.host,port:(i=c.port)!==null&&i!==void 0?i:rPe})}this.endpoints=o.map(a=>({addresses:[a]})),Q9("Parsed "+e.scheme+" address list "+o.map(QIe.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,Z9.statusOrFromError)(this.error),{},null,""):this.listener((0,Z9.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}};function nPe(){(0,J9.registerResolver)(QM,Kb),(0,J9.registerResolver)(eD,Kb)}});var iJ=v(Jg=>{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});Jg.RoundRobinLoadBalancer=void 0;Jg.setup=lPe;var nJ=da(),dr=Lr(),Zg=Jo(),iPe=ht(),oPe=Ve(),tJ=Zr(),sPe=Yg(),aPe="round_robin";function rJ(t){iPe.trace(oPe.LogVerbosity.DEBUG,aPe,t)}var Zb="round_robin",Jb=class t{getLoadBalancerName(){return Zb}constructor(){}toJsonObject(){return{[Zb]:{}}}static createFromJson(e){return new t}},rD=class{constructor(e,r=0){this.children=e,this.nextIndex=r}pick(e){let r=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,r.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}};function cPe(t,e){return[...t.slice(e),...t.slice(0,e)]}var Xb=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=dr.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,nJ.createChildChannelControlHelper)(e,{updateState:(r,n,i)=>{this.currentState===dr.ConnectivityState.READY&&r!==dr.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(r=>r.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(dr.ConnectivityState.READY)>0){let e=this.children.filter(n=>n.getConnectivityState()===dr.ConnectivityState.READY),r=0;if(this.currentReadyPicker!==null){let n=this.currentReadyPicker.peekNextEndpoint();r=e.findIndex(i=>(0,tJ.endpointEqual)(i.getEndpoint(),n)),r<0&&(r=0)}this.updateState(dr.ConnectivityState.READY,new rD(e.map(n=>({endpoint:n.getEndpoint(),picker:n.getPicker()})),r),null)}else if(this.countChildrenWithState(dr.ConnectivityState.CONNECTING)>0)this.updateState(dr.ConnectivityState.CONNECTING,new Zg.QueuePicker(this),null);else if(this.countChildrenWithState(dr.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Zg.UnavailablePicker({details:e}),e)}else this.updateState(dr.ConnectivityState.IDLE,new Zg.QueuePicker(this),null);for(let e of this.children)e.getConnectivityState()===dr.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){rJ(dr.ConnectivityState[this.currentState]+" -> "+dr.ConnectivityState[e]),e===dr.ConnectivityState.READY?this.currentReadyPicker=r:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.destroy();this.children=[]}updateAddressList(e,r,n,i){if(!(r instanceof Jb))return!1;if(!e.ok)return this.children.length===0&&this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Zg.UnavailablePicker(e.error),e.error.details),!0;let o=Math.random()*e.value.length|0,s=cPe(e.value,o);if(this.resetSubchannelList(),s.length===0){let a=`No addresses resolved. Resolution note: ${i}`;this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Zg.UnavailablePicker({details:a}),a)}rJ("Connect to endpoint list "+s.map(tJ.endpointToString)),this.updatesPaused=!0,this.children=s.map(a=>new sPe.LeafLoadBalancer(a,this.childChannelControlHelper,n,i));for(let a of this.children)a.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return Zb}};Jg.RoundRobinLoadBalancer=Xb;function lPe(){(0,nJ.registerLoadBalancerType)(Zb,Xb,Jb)}});var aJ=v(Cl=>{"use strict";var nD;Object.defineProperty(Cl,"__esModule",{value:!0});Cl.OutlierDetectionLoadBalancer=Cl.OutlierDetectionLoadBalancingConfig=void 0;Cl.setup=EPe;var uPe=Lr(),oJ=Ve(),Rl=qg(),sJ=KM(),dPe=da(),fPe=ST(),pPe=Jo(),iD=Zr(),hPe=zg(),mPe=ht(),gPe="outlier_detection";function Qt(t){mPe.trace(oJ.LogVerbosity.DEBUG,gPe,t)}var uD="outlier_detection",_Pe=((nD=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&nD!==void 0?nD:"true")==="true",yPe={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},SPe={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function tf(t,e,r,n){if(e in t&&t[e]!==void 0&&typeof t[e]!==r){let i=n?`${n}.${e}`:e;throw new Error(`outlier detection config ${i} parse error: expected ${r}, got ${typeof t[e]}`)}}function oD(t,e,r){let n=r?`${r}.${e}`:e;if(e in t&&t[e]!==void 0){if(!(0,Rl.isDuration)(t[e]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof t[e]}`);if(!(t[e].seconds>=0&&t[e].seconds<=315576e6&&t[e].nanos>=0&&t[e].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function Qb(t,e,r){let n=r?`${r}.${e}`:e;if(tf(t,e,"number",r),e in t&&t[e]!==void 0&&!(t[e]>=0&&t[e]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}var Xg=class t{constructor(e,r,n,i,o,s,a){if(this.childPolicy=a,a.getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=e??1e4,this.baseEjectionTimeMs=r??3e4,this.maxEjectionTimeMs=n??3e5,this.maxEjectionPercent=i??10,this.successRateEjection=o?Object.assign(Object.assign({},yPe),o):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},SPe),s):null}getLoadBalancerName(){return uD}toJsonObject(){var e,r;return{outlier_detection:{interval:(0,Rl.msToDuration)(this.intervalMs),base_ejection_time:(0,Rl.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,Rl.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(e=this.successRateEjection)!==null&&e!==void 0?e:void 0,failure_percentage_ejection:(r=this.failurePercentageEjection)!==null&&r!==void 0?r:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var r;if(oD(e,"interval"),oD(e,"base_ejection_time"),oD(e,"max_ejection_time"),Qb(e,"max_ejection_percent"),"success_rate_ejection"in e&&e.success_rate_ejection!==void 0){if(typeof e.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");tf(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),Qb(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),tf(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),tf(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&e.failure_percentage_ejection!==void 0){if(typeof e.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");Qb(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),Qb(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),tf(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),tf(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");let n=(0,dPe.selectLbConfigFromList)(e.child_policy);if(!n)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new t(e.interval?(0,Rl.durationToMs)(e.interval):null,e.base_ejection_time?(0,Rl.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,Rl.durationToMs)(e.max_ejection_time):null,(r=e.max_ejection_percent)!==null&&r!==void 0?r:null,e.success_rate_ejection,e.failure_percentage_ejection,n)}};Cl.OutlierDetectionLoadBalancingConfig=Xg;var aD=class extends hPe.BaseSubchannelWrapper{constructor(e,r){super(e),this.mapEntry=r,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function sD(){return{success:0,failure:0}}var cD=class{constructor(){this.activeBucket=sD(),this.inactiveBucket=sD()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=sD()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},lD=class{constructor(e,r){this.wrappedPicker=e,this.countCalls=r}pick(e){let r=this.wrappedPicker.pick(e);if(r.pickResultType===pPe.PickResultType.COMPLETE){let n=r.subchannel,i=n.getMapEntry();if(i){let o=r.onCallEnded;return this.countCalls&&(o=(s,a,c)=>{var l;s===oJ.Status.OK?i.counter.addSuccess():i.counter.addFailure(),(l=r.onCallEnded)===null||l===void 0||l.call(r,s,a,c)}),Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel(),onCallEnded:o})}else return Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel()})}else return r}},eA=class{constructor(e){this.entryMap=new iD.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new fPe.ChildLoadBalancerHandler((0,sJ.createChildChannelControlHelper)(e,{createSubchannel:(r,n)=>{let i=e.createSubchannel(r,n),o=this.entryMap.getForSubchannelAddress(r),s=new aD(i,o);return o?.currentEjectionTimestamp!==null&&s.eject(),o?.subchannelWrappers.push(s),s},updateState:(r,n,i)=>{r===uPe.ConnectivityState.READY?e.updateState(r,new lD(n,this.isCountingEnabled()),i):e.updateState(r,n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let e=0;for(let r of this.entryMap.values())r.currentEjectionTimestamp!==null&&(e+=1);return e*100/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getSuccessRateEjectionConfig();if(!r)return;Qt("Running success rate check");let n=r.request_volume,i=0,o=[];for(let[d,f]of this.entryMap.entries()){let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();Qt("Stats for "+(0,iD.endpointToString)(d)+": successes="+p+" failures="+h+" targetRequestVolume="+n),p+h>=n&&(i+=1,o.push(p/(p+h)))}if(Qt("Found "+i+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+o+"]"),i<r.minimum_hosts)return;let s=o.reduce((d,f)=>d+f)/o.length,a=0;for(let d of o){let f=d-s;a+=f*f}let c=a/o.length,l=Math.sqrt(c),u=s-l*(r.stdev_factor/1e3);Qt("stdev="+l+" ejectionThreshold="+u);for(let[d,f]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();if(p+h<n)continue;let m=p/(p+h);if(Qt("Checking candidate "+d+" successRate="+m),m<u){let y=Math.random()*100;Qt("Candidate "+d+" randomNumber="+y+" enforcement_percentage="+r.enforcement_percentage),y<r.enforcement_percentage&&(Qt("Ejecting candidate "+d),this.eject(f,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getFailurePercentageEjectionConfig();if(!r)return;Qt("Running failure percentage check. threshold="+r.threshold+" request volume threshold="+r.request_volume);let n=0;for(let i of this.entryMap.values()){let o=i.counter.getLastSuccesses(),s=i.counter.getLastFailures();o+s>=r.request_volume&&(n+=1)}if(!(n<r.minimum_hosts))for(let[i,o]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let s=o.counter.getLastSuccesses(),a=o.counter.getLastFailures();if(Qt("Candidate successes="+s+" failures="+a),s+a<r.request_volume)continue;if(a*100/(a+s)>r.threshold){let l=Math.random()*100;Qt("Candidate "+i+" randomNumber="+l+" enforcement_percentage="+r.enforcement_percentage),l<r.enforcement_percentage&&(Qt("Ejecting candidate "+i),this.eject(o,e))}}}eject(e,r){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(let n of e.subchannelWrappers)n.eject()}uneject(e){e.currentEjectionTimestamp=null;for(let r of e.subchannelWrappers)r.uneject()}switchAllBuckets(){for(let e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var r,n;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),(n=(r=this.ejectionTimer).unref)===null||n===void 0||n.call(r)}runChecks(){let e=new Date;if(Qt("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(let[r,n]of this.entryMap.entries())if(n.currentEjectionTimestamp===null)n.ejectionTimeMultiplier>0&&(n.ejectionTimeMultiplier-=1);else{let i=this.latestConfig.getBaseEjectionTimeMs(),o=this.latestConfig.getMaxEjectionTimeMs(),s=new Date(n.currentEjectionTimestamp.getTime());s.setMilliseconds(s.getMilliseconds()+Math.min(i*n.ejectionTimeMultiplier,Math.max(i,o))),s<new Date&&(Qt("Unejecting "+r),this.uneject(n))}}}updateAddressList(e,r,n,i){if(!(r instanceof Xg))return!1;if(Qt("Received update with config: "+JSON.stringify(r.toJsonObject(),void 0,2)),e.ok){for(let s of e.value)this.entryMap.has(s)||(Qt("Adding map entry for "+(0,iD.endpointToString)(s)),this.entryMap.set(s,{counter:new cD,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}let o=r.getChildPolicy();if(this.childBalancer.updateAddressList(e,o,n,i),r.getSuccessRateEjectionConfig()||r.getFailurePercentageEjectionConfig())if(this.timerStartTime){Qt("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let s=r.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(s)}else Qt("Starting new timer"),this.timerStartTime=new Date,this.startTimer(r.getIntervalMs()),this.switchAllBuckets();else{Qt("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let s of this.entryMap.values())this.uneject(s),s.ejectionTimeMultiplier=0}return this.latestConfig=r,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return uD}};Cl.OutlierDetectionLoadBalancer=eA;function EPe(){_Pe&&(0,sJ.registerLoadBalancerType)(uD,eA,Xg)}});var cJ=v(rA=>{"use strict";Object.defineProperty(rA,"__esModule",{value:!0});rA.PriorityQueue=void 0;var rf=0,dD=t=>Math.floor(t/2),tA=t=>t*2+1,Qg=t=>t*2+2,fD=class{constructor(e=(r,n)=>r>n){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[rf]}push(...e){return e.forEach(r=>{this.heap.push(r),this.siftUp()}),this.size()}pop(){let e=this.peek(),r=this.size()-1;return r>rf&&this.swap(rf,r),this.heap.pop(),this.siftDown(),e}replace(e){let r=this.peek();return this.heap[rf]=e,this.siftDown(),r}greater(e,r){return this.comparator(this.heap[e],this.heap[r])}swap(e,r){[this.heap[e],this.heap[r]]=[this.heap[r],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>rf&&this.greater(e,dD(e));)this.swap(e,dD(e)),e=dD(e)}siftDown(){let e=rf;for(;tA(e)<this.size()&&this.greater(tA(e),e)||Qg(e)<this.size()&&this.greater(Qg(e),e);){let r=Qg(e)<this.size()&&this.greater(Qg(e),tA(e))?Qg(e):tA(e);this.swap(e,r),e=r}}};rA.PriorityQueue=fD});var pJ=v(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});t_.WeightedRoundRobinLoadBalancingConfig=void 0;t_.setup=OPe;var er=Lr(),vPe=Ve(),Sn=qg(),dJ=da(),TPe=Yg(),bPe=ht(),fJ=Fb(),nf=Jo(),APe=cJ(),lJ=Zr(),wPe="weighted_round_robin";function pD(t){bPe.trace(vPe.LogVerbosity.DEBUG,wPe,t)}var gD="weighted_round_robin",xPe=1e4,RPe=1e4,CPe=3*6e4,IPe=1e3,PPe=1;function uJ(t,e,r){if(e in t&&t[e]!==void 0&&typeof t[e]!==r)throw new Error(`weighted round robin config ${e} parse error: expected ${r}, got ${typeof t[e]}`)}function nA(t,e){if(e in t&&t[e]!==void 0&&t[e]!==null){let r;if((0,Sn.isDuration)(t[e]))r=t[e];else if((0,Sn.isDurationMessage)(t[e]))r=(0,Sn.durationMessageToDuration)(t[e]);else if(typeof t[e]=="string"){let n=(0,Sn.parseDuration)(t[e]);if(!n)throw new Error(`weighted round robin config ${e}: failed to parse duration string ${t[e]}`);r=n}else throw new Error(`weighted round robin config ${e}: expected duration, got ${typeof t[e]}`);return(0,Sn.durationToMs)(r)}return null}var e_=class t{constructor(e,r,n,i,o,s){this.enableOobLoadReport=e??!1,this.oobLoadReportingPeriodMs=r??xPe,this.blackoutPeriodMs=n??RPe,this.weightExpirationPeriodMs=i??CPe,this.weightUpdatePeriodMs=Math.max(o??IPe,100),this.errorUtilizationPenalty=s??PPe}getLoadBalancerName(){return gD}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(uJ(e,"enable_oob_load_report","boolean"),uJ(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new t(e.enable_oob_load_report,nA(e,"oob_load_reporting_period"),nA(e,"blackout_period"),nA(e,"weight_expiration_period"),nA(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}};t_.WeightedRoundRobinLoadBalancingConfig=e_;var hD=class{constructor(e,r){this.metricsHandler=r,this.queue=new APe.PriorityQueue((o,s)=>o.deadline<s.deadline);let n=e.filter(o=>o.weight>0),i;if(n.length<2)i=1;else{let o=0;for(let{weight:s}of n)o+=s;i=o/n.length}for(let o of e){let s=o.weight>0?1/o.weight:i;this.queue.push({endpointName:o.endpointName,picker:o.picker,period:s,deadline:Math.random()*s})}}pick(e){let r=this.queue.pop();this.queue.push(Object.assign(Object.assign({},r),{deadline:r.deadline+r.period}));let n=r.picker.pick(e);if(n.pickResultType===nf.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},n),{onCallEnded:(0,fJ.createMetricsReader)(i=>this.metricsHandler(i,r.endpointName),n.onCallEnded)});{let i=n.subchannel;return Object.assign(Object.assign({},n),{subchannel:i.getWrappedSubchannel()})}}else return n}},mD=class{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=er.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let r=0;for(let n of this.children.values())n.child.getConnectivityState()===e&&(r+=1);return r}updateWeight(e,r){var n,i;let o=r.rps_fractional,s=r.application_utilization;s>0&&o>0&&(s+=r.eps/o*((i=(n=this.latestConfig)===null||n===void 0?void 0:n.getErrorUtilizationPenalty())!==null&&i!==void 0?i:0));let a=s===0?0:o/s;if(a===0)return;let c=new Date;e.nonEmptySince===null&&(e.nonEmptySince=c),e.lastUpdated=c,e.weight=a}getWeight(e){if(!this.latestConfig)return 0;let r=new Date().getTime();if(r-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;let n=this.latestConfig.getBlackoutPeriodMs();return n>0&&(e.nonEmptySince===null||r-e.nonEmptySince.getTime()<n)?0:e.weight}calculateAndUpdateState(){if(!(this.updatesPaused||!this.latestConfig)){if(this.countChildrenWithState(er.ConnectivityState.READY)>0){let e=[];for(let[n,i]of this.children)i.child.getConnectivityState()===er.ConnectivityState.READY&&e.push({endpointName:n,picker:i.child.getPicker(),weight:this.getWeight(i)});pD("Created picker with weights: "+e.map(n=>n.endpointName+":"+n.weight).join(","));let r;this.latestConfig.getEnableOobLoadReport()?r=null:r=(n,i)=>{let o=this.children.get(i);o&&this.updateWeight(o,n)},this.updateState(er.ConnectivityState.READY,new hD(e,r),null)}else if(this.countChildrenWithState(er.ConnectivityState.CONNECTING)>0)this.updateState(er.ConnectivityState.CONNECTING,new nf.QueuePicker(this),null);else if(this.countChildrenWithState(er.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new nf.UnavailablePicker({details:e}),e)}else this.updateState(er.ConnectivityState.IDLE,new nf.QueuePicker(this),null);for(let{child:e}of this.children.values())e.getConnectivityState()===er.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){pD(er.ConnectivityState[this.currentState]+" -> "+er.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}updateAddressList(e,r,n,i){var o,s;if(!(r instanceof e_))return!1;if(!e.ok)return this.children.size===0&&this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new nf.UnavailablePicker(e.error),e.error.details),!0;if(e.value.length===0){let l=`No addresses resolved. Resolution note: ${i}`;return this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new nf.UnavailablePicker({details:l}),l),!1}pD("Connect to endpoint list "+e.value.map(lJ.endpointToString));let a=new Date,c=new Set;this.updatesPaused=!0,this.latestConfig=r;for(let l of e.value){let u=(0,lJ.endpointToString)(l);c.add(u);let d=this.children.get(u);d||(d={child:new TPe.LeafLoadBalancer(l,(0,dJ.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(f,p,h)=>{this.currentState===er.ConnectivityState.READY&&f!==er.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),f===er.ConnectivityState.READY&&(d.nonEmptySince=null),h&&(this.lastError=h),this.calculateAndUpdateState()},createSubchannel:(f,p)=>{let h=this.channelControlHelper.createSubchannel(f,p);return d?.oobMetricsListener?new fJ.OrcaOobMetricsSubchannelWrapper(h,d.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):h}}),n,i),lastUpdated:a,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(u,d)),r.getEnableOobLoadReport()?d.oobMetricsListener=f=>{this.updateWeight(d,f)}:d.oobMetricsListener=null}for(let[l,u]of this.children)c.has(l)?u.child.startConnecting():(u.child.destroy(),this.children.delete(l));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=(s=(o=setInterval(()=>{this.currentState===er.ConnectivityState.READY&&this.calculateAndUpdateState()},r.getWeightUpdatePeriodMs())).unref)===null||s===void 0?void 0:s.call(o),!0}exitIdle(){}resetBackoff(){}destroy(){for(let e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return gD}};function OPe(){(0,dJ.registerLoadBalancerType)(gD,mD,e_)}});var r_=v(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.experimental=he.ServerMetricRecorder=he.ServerInterceptingCall=he.ResponderBuilder=he.ServerListenerBuilder=he.addAdminServicesToServer=he.getChannelzHandlers=he.getChannelzServiceDefinition=he.InterceptorConfigurationError=he.InterceptingCall=he.RequesterBuilder=he.ListenerBuilder=he.StatusBuilder=he.getClientChannel=he.ServerCredentials=he.Server=he.setLogVerbosity=he.setLogger=he.load=he.loadObject=he.CallCredentials=he.ChannelCredentials=he.waitForClientReady=he.closeClient=he.Channel=he.makeGenericClientConstructor=he.makeClientConstructor=he.loadPackageDefinition=he.Client=he.compressionAlgorithms=he.propagate=he.connectivityState=he.status=he.logVerbosity=he.Metadata=he.credentials=void 0;var iA=cT();Object.defineProperty(he,"CallCredentials",{enumerable:!0,get:function(){return iA.CallCredentials}});var NPe=iN();Object.defineProperty(he,"Channel",{enumerable:!0,get:function(){return NPe.ChannelImplementation}});var kPe=vk();Object.defineProperty(he,"compressionAlgorithms",{enumerable:!0,get:function(){return kPe.CompressionAlgorithms}});var MPe=Lr();Object.defineProperty(he,"connectivityState",{enumerable:!0,get:function(){return MPe.ConnectivityState}});var oA=Td();Object.defineProperty(he,"ChannelCredentials",{enumerable:!0,get:function(){return oA.ChannelCredentials}});var hJ=nN();Object.defineProperty(he,"Client",{enumerable:!0,get:function(){return hJ.Client}});var _D=Ve();Object.defineProperty(he,"logVerbosity",{enumerable:!0,get:function(){return _D.LogVerbosity}});Object.defineProperty(he,"status",{enumerable:!0,get:function(){return _D.Status}});Object.defineProperty(he,"propagate",{enumerable:!0,get:function(){return _D.Propagate}});var mJ=ht(),yD=CT();Object.defineProperty(he,"loadPackageDefinition",{enumerable:!0,get:function(){return yD.loadPackageDefinition}});Object.defineProperty(he,"makeClientConstructor",{enumerable:!0,get:function(){return yD.makeClientConstructor}});Object.defineProperty(he,"makeGenericClientConstructor",{enumerable:!0,get:function(){return yD.makeClientConstructor}});var DPe=Kt();Object.defineProperty(he,"Metadata",{enumerable:!0,get:function(){return DPe.Metadata}});var LPe=D9();Object.defineProperty(he,"Server",{enumerable:!0,get:function(){return LPe.Server}});var $Pe=$b();Object.defineProperty(he,"ServerCredentials",{enumerable:!0,get:function(){return $Pe.ServerCredentials}});var UPe=L9();Object.defineProperty(he,"StatusBuilder",{enumerable:!0,get:function(){return UPe.StatusBuilder}});he.credentials={combineChannelCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),combineCallCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),createInsecure:oA.ChannelCredentials.createInsecure,createSsl:oA.ChannelCredentials.createSsl,createFromSecureContext:oA.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:iA.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:iA.CallCredentials.createFromGoogleCredential,createEmpty:iA.CallCredentials.createEmpty};var FPe=t=>t.close();he.closeClient=FPe;var BPe=(t,e,r)=>t.waitForReady(e,r);he.waitForClientReady=BPe;var jPe=(t,e)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};he.loadObject=jPe;var zPe=(t,e,r)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};he.load=zPe;var GPe=t=>{mJ.setLogger(t)};he.setLogger=GPe;var qPe=t=>{mJ.setLoggerVerbosity(t)};he.setLogVerbosity=qPe;var VPe=t=>hJ.Client.prototype.getChannel.call(t);he.getClientChannel=VPe;var sA=eN();Object.defineProperty(he,"ListenerBuilder",{enumerable:!0,get:function(){return sA.ListenerBuilder}});Object.defineProperty(he,"RequesterBuilder",{enumerable:!0,get:function(){return sA.RequesterBuilder}});Object.defineProperty(he,"InterceptingCall",{enumerable:!0,get:function(){return sA.InterceptingCall}});Object.defineProperty(he,"InterceptorConfigurationError",{enumerable:!0,get:function(){return sA.InterceptorConfigurationError}});var gJ=va();Object.defineProperty(he,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return gJ.getChannelzServiceDefinition}});Object.defineProperty(he,"getChannelzHandlers",{enumerable:!0,get:function(){return gJ.getChannelzHandlers}});var HPe=bT();Object.defineProperty(he,"addAdminServicesToServer",{enumerable:!0,get:function(){return HPe.addAdminServicesToServer}});var SD=$M();Object.defineProperty(he,"ServerListenerBuilder",{enumerable:!0,get:function(){return SD.ServerListenerBuilder}});Object.defineProperty(he,"ResponderBuilder",{enumerable:!0,get:function(){return SD.ResponderBuilder}});Object.defineProperty(he,"ServerInterceptingCall",{enumerable:!0,get:function(){return SD.ServerInterceptingCall}});var WPe=Fb();Object.defineProperty(he,"ServerMetricRecorder",{enumerable:!0,get:function(){return WPe.ServerMetricRecorder}});var YPe=KM();he.experimental=YPe;var KPe=Bk(),ZPe=Y9(),JPe=eJ(),XPe=Yg(),QPe=iJ(),e0e=aJ(),t0e=pJ(),r0e=va();KPe.setup(),ZPe.setup(),JPe.setup(),XPe.setup(),QPe.setup(),e0e.setup(),t0e.setup(),r0e.setup()});var _J=v(aA=>{"use strict";Object.defineProperty(aA,"__esModule",{value:!0});aA.createServiceClientConstructor=void 0;var n0e=r_();function i0e(t,e){let r={export:{path:t,requestStream:!1,responseStream:!1,requestSerialize:n=>n,requestDeserialize:n=>n,responseSerialize:n=>n,responseDeserialize:n=>n}};return n0e.makeGenericClientConstructor(r,e)}aA.createServiceClientConstructor=i0e});var n_=v(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.createOtlpGrpcExporterTransport=Wn.GrpcExporterTransport=Wn.createEmptyMetadata=Wn.createSslCredentials=Wn.createInsecureCredentials=void 0;var o0e=uK(),yJ=`OTel-OTLP-Exporter-JavaScript/${o0e.VERSION}`;function s0e(t){return t?`${t} ${yJ}`:yJ}var a0e=0,c0e=2;function l0e(t){return t==="gzip"?c0e:a0e}function u0e(){let{credentials:t}=r_();return t.createInsecure()}Wn.createInsecureCredentials=u0e;function d0e(t,e,r){let{credentials:n}=r_();return n.createSsl(t,e,r)}Wn.createSslCredentials=d0e;function f0e(){let{Metadata:t}=r_();return new t}Wn.createEmptyMetadata=f0e;var cA=class{_client;_metadata;_parameters;constructor(e){this._parameters=e}shutdown(){this._client?.close()}send(e,r){let n=Buffer.from(e);if(this._client==null){let{createServiceClientConstructor:i}=_J();try{this._metadata=this._parameters.metadata()}catch(s){return Promise.resolve({status:"failure",error:s})}let o=i(this._parameters.grpcPath,this._parameters.grpcName);try{this._client=new o(this._parameters.address,this._parameters.credentials(),{"grpc.default_compression_algorithm":l0e(this._parameters.compression),"grpc.primary_user_agent":s0e(this._parameters.userAgent)})}catch(s){return Promise.resolve({status:"failure",error:s})}}return new Promise(i=>{let o=Date.now()+r;if(this._metadata==null)return i({error:new Error("metadata was null"),status:"failure"});this._client.export(n,this._metadata,{deadline:o},(s,a)=>{i(s?{status:"failure",error:s}:{data:a,status:"success"})})})}};Wn.GrpcExporterTransport=cA;function p0e(t){return new cA(t)}Wn.createOtlpGrpcExporterTransport=p0e});var bJ=v(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.getOtlpGrpcDefaultConfiguration=Ia.mergeOtlpGrpcConfigurationWithDefaults=Ia.validateAndNormalizeUrl=void 0;var vJ=(tT(),Nr(eT)),i_=n_(),h0e=Z("url"),SJ=(Se(),Nr(ra));function TJ(t){t=t.trim(),t.match(/^([\w]{1,8}):\/\//)||(t=`https://${t}`);let r=new h0e.URL(t);return r.protocol==="unix:"?t:(r.pathname&&r.pathname!=="/"&&SJ.diag.warn("URL path should not be set when using grpc, the path part of the URL will be ignored."),r.protocol!==""&&!r.protocol?.match(/^(http)s?:$/)&&SJ.diag.warn("URL protocol should be http(s)://. Using http://."),r.host)}Ia.validateAndNormalizeUrl=TJ;function EJ(t,e){for(let[r,n]of Object.entries(e.getMap()))t.get(r).length<1&&t.set(r,n)}function m0e(t,e,r){let n=t.url??e.url??r.url;return{...(0,vJ.mergeOtlpSharedConfigurationWithDefaults)(t,e,r),metadata:()=>{let i=r.metadata();return EJ(i,t.metadata?.().clone()??(0,i_.createEmptyMetadata)()),EJ(i,e.metadata?.()??(0,i_.createEmptyMetadata)()),i},url:TJ(n),credentials:t.credentials??e.credentials?.(n)??r.credentials(n),userAgent:t.userAgent}}Ia.mergeOtlpGrpcConfigurationWithDefaults=m0e;function g0e(){return{...(0,vJ.getSharedConfigurationDefaults)(),metadata:()=>(0,i_.createEmptyMetadata)(),url:"http://localhost:4317",credentials:t=>t.startsWith("http://")?()=>(0,i_.createInsecureCredentials)():()=>(0,i_.createSslCredentials)()}}Ia.getOtlpGrpcDefaultConfiguration=g0e});function AJ(t){let e={};return Object.entries(t??{}).forEach(([r,n])=>{typeof n<"u"?e[r]=String(n):J.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),e}var wJ=A(()=>{"use strict";Se()});function _0e(t,e,r){return async()=>{let n={...await r()},i={};return e!=null&&Object.assign(i,await e()),t!=null&&Object.assign(i,AJ(await t())),Object.assign(i,n)}}function y0e(t){if(t!=null)try{let e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function xJ(t,e,r){return{...Iv(t,e,r),headers:_0e(t.headers,e.headers,r.headers),url:y0e(t.url)??e.url??r.url}}function RJ(t,e){return{...Pv(),headers:async()=>t,url:"http://localhost:4318/"+e}}var CJ=A(()=>{"use strict";Jm();wJ()});function Il(t){return async e=>{let r=e==="http:",n=r?import("http"):import("https"),{Agent:i}=await n;if(r){let{ca:o,cert:s,key:a,...c}=t;return new i(c)}return new i(t)}}function IJ(t,e,r){return{...xJ(t,e,r),agentFactory:t.agentFactory??e.agentFactory??r.agentFactory,userAgent:t.userAgent}}function PJ(t,e){return{...RJ(t,e),agentFactory:Il({keepAlive:!0})}}var lA=A(()=>{"use strict";CJ()});function ED(t){return t===429||t===502||t===503||t===504}function vD(t){if(t==null)return;let e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let r=new Date(t).getTime()-Date.now();return r>=0?r:0}var OJ=A(()=>{"use strict"});var NJ,kJ=A(()=>{"use strict";NJ="0.218.0"});import*as LJ from"zlib";import{Readable as S0e}from"stream";function $J(t,e,r,n,i,o,s,a){return new Promise(c=>{let l=new URL(e);i?r["User-Agent"]=`${i} ${MJ}`:r["User-Agent"]=MJ;let d=t(l,{method:"POST",headers:r,agent:o},f=>{let p=[],h=0;f.on("data",m=>{if(h+=m.length,h>DJ){let y=new Error(`OTLP export response body exceeded size limit of ${DJ} bytes`);c({status:"failure",error:y}),f.destroy();return}p.push(m)}),f.on("end",()=>{if(f.statusCode&&f.statusCode<=299)c({status:"success",data:Buffer.concat(p)});else if(f.statusCode&&ED(f.statusCode))c({status:"retryable",retryInMillis:vD(f.headers["retry-after"])});else{let m=new Ko(f.statusMessage,f.statusCode,Buffer.concat(p).toString());c({status:"failure",error:m})}}),f.on("error",m=>{f.statusCode&&f.statusCode<=299?c({status:"success"}):f.statusCode&&ED(f.statusCode)?c({status:"retryable",error:m,retryInMillis:vD(f.headers["retry-after"])}):c({status:"failure",error:m})})});d.setTimeout(a,()=>{d.destroy(),c({status:"retryable",error:new Error("Request timed out")})}),d.on("error",f=>{T0e(f)?c({status:"retryable",error:f}):c({status:"failure",error:f})}),E0e(d,n,s,f=>{c({status:"failure",error:f})})})}function E0e(t,e,r,n){let i=v0e(r);e==="gzip"&&(t.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(LJ.createGzip()).on("error",n)),i.pipe(t).on("error",n)}function v0e(t){let e=new S0e;return e.push(t),e.push(null),e}function T0e(t){let e=new Set(["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","EAI_AGAIN","ENOTFOUND","ENETUNREACH","EHOSTUNREACH"]);return"code"in t&&typeof t.code=="string"?e.has(t.code):!1}var MJ,DJ,UJ=A(()=>{"use strict";OJ();Rv();kJ();MJ=`OTel-OTLP-Exporter-JavaScript/${NJ}`,DJ=4*1024*1024});async function b0e(t){let e=t==="http:"?import("http"):import("https"),{request:r}=await e;return r}function FJ(t){return new TD(t)}var TD,BJ=A(()=>{"use strict";UJ();TD=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,r){let{agent:n,request:i}=await this._loadUtils(),o=await this._parameters.headers();return $J(i,this._parameters.url,o,this._parameters.compression,this._parameters.userAgent,n,e,r)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let r=new URL(this._parameters.url).protocol,[n,i]=await Promise.all([this._parameters.agentFactory(r),b0e(r)]);e=this._utils={agent:n,request:i}}return e}}});function R0e(){return Math.random()*(2*jJ)-jJ}function zJ(t){return new AD(t.transport)}var bD,A0e,w0e,x0e,jJ,AD,GJ=A(()=>{"use strict";Se();bD=5,A0e=1e3,w0e=5e3,x0e=1.5,jJ=.2;AD=class{_transport;constructor(e){this._transport=e}retry(e,r,n){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,r).then(i,o)},n)})}async send(e,r){let n=bD,i=A0e,o=Date.now()+r,s=await this._transport.send(e,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(i*(1+R0e()),w0e),0);i=i*x0e;let c=s.retryInMillis??a,l=o-Date.now();if(c>l)return J.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),s;J.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(e,l,c)}return s.status==="success"?J.verbose(`Export succeeded after ${bD-n} retry attempts.`):s.status==="retryable"?J.info(`Export failed after maximum retry attempts (${bD}).`):J.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}});function qJ(t,e){return Qv({transport:zJ({transport:FJ(t)}),serializer:e,promiseHandler:Nv(t)},{timeout:t.timeoutMillis})}var VJ=A(()=>{"use strict";pO();BJ();Y0();GJ()});function HJ(t){let e=hd(t);if(e!=null){if(Number.isFinite(e)&&e>0)return e;J.warn(`Configuration: ${t} is invalid, expected number greater than 0 (actual: ${e})`)}}function C0e(t){let e=HJ(`OTEL_EXPORTER_OTLP_${t}_TIMEOUT`),r=HJ("OTEL_EXPORTER_OTLP_TIMEOUT");return e??r}function WJ(t){let e=Yr(t)?.trim();if(e==null||e==="none"||e==="gzip")return e;J.warn(`Configuration: ${t} is invalid, expected 'none' or 'gzip' (actual: '${e}')`)}function I0e(t){let e=WJ(`OTEL_EXPORTER_OTLP_${t}_COMPRESSION`),r=WJ("OTEL_EXPORTER_OTLP_COMPRESSION");return e??r}function uA(t){return{timeoutMillis:C0e(t),compression:I0e(t)}}var wD=A(()=>{"use strict";_d();Se()});import*as YJ from"fs";import*as KJ from"path";function P0e(t){let e=Yr(`OTEL_EXPORTER_OTLP_${t}_HEADERS`),r=Yr("OTEL_EXPORTER_OTLP_HEADERS"),n=rl(e),i=rl(r);if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return Object.assign({},rl(r),rl(e))}function O0e(t){try{return new URL(t).toString()}catch{J.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}}function N0e(t,e){try{new URL(t)}catch{J.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}t.endsWith("/")||(t=t+"/"),t+=e;try{new URL(t)}catch{J.warn(`Configuration: Provided URL appended with '${e}' is not a valid URL, using 'undefined' instead of '${t}'`);return}return t}function k0e(t){let e=Yr("OTEL_EXPORTER_OTLP_ENDPOINT");if(e!==void 0)return N0e(e,t)}function M0e(t){let e=Yr(`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`);if(e!==void 0)return O0e(e)}function xD(t,e,r){let n=Yr(t),i=Yr(e),o=n??i;if(o!=null)try{return YJ.readFileSync(KJ.resolve(process.cwd(),o))}catch{J.warn(r);return}else return}function D0e(t){return xD(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function L0e(t){return xD(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function $0e(t){return xD(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function ZJ(t,e){return{...uA(t),url:M0e(t)??k0e(e),headers:Cv(P0e(t)),agentFactory:Il({keepAlive:!0,ca:$0e(t),cert:D0e(t),key:L0e(t)})}}var JJ=A(()=>{"use strict";_d();Se();wD();Jm();lA()});function XJ(t){return typeof t.headers=="function"?t.headers:Cv(t.headers)}var QJ=A(()=>{"use strict";Jm()});function U0e(t){if(typeof t.httpAgentOptions=="function")return t.httpAgentOptions;let e=t.httpAgentOptions;if(t.keepAlive!=null&&(e={keepAlive:t.keepAlive,...e}),e!=null)return Il(e)}function eX(t,e,r,n){return t.metadata&&J.warn("Metadata cannot be set when using http"),IJ({url:t.url,headers:XJ(t),concurrencyLimit:t.concurrencyLimit,timeoutMillis:t.timeoutMillis,compression:t.compression,agentFactory:U0e(t),userAgent:t.userAgent},ZJ(e,r),PJ(n,r))}var tX=A(()=>{"use strict";Se();lA();RD();JJ();QJ()});var rX={};ar(rX,{convertLegacyHttpOptions:()=>eX,createOtlpHttpExportDelegate:()=>qJ,getSharedConfigurationFromEnvironment:()=>uA,httpAgentFactoryFromOptions:()=>Il});var RD=A(()=>{"use strict";lA();VJ();wD();tX()});var aX=v(dA=>{"use strict";Object.defineProperty(dA,"__esModule",{value:!0});dA.getOtlpGrpcConfigurationFromEnv=void 0;var nX=(_d(),Nr(oK)),o_=n_(),F0e=(RD(),Nr(rX)),B0e=Z("fs"),j0e=Z("path"),oX=(Se(),Nr(ra));function CD(t,e){if(t!=null&&t!=="")return t;if(e!=null&&e!=="")return e}function z0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_HEADERS`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),n=(0,nX.parseKeyPairsIntoRecord)(e),i=(0,nX.parseKeyPairsIntoRecord)(r);if(Object.keys(n).length===0&&Object.keys(i).length===0)return;let o=Object.assign({},i,n),s=(0,o_.createEmptyMetadata)();for(let[a,c]of Object.entries(o))s.set(a,c);return s}function G0e(t){let e=z0e(t);if(e!=null)return()=>e}function q0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return CD(e,r)}function V0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_INSECURE`]?.toLowerCase().trim(),r=process.env.OTEL_EXPORTER_OTLP_INSECURE?.toLowerCase().trim();return CD(e,r)==="true"}function ID(t,e,r){let n=process.env[t]?.trim(),i=process.env[e]?.trim(),o=CD(n,i);if(o!=null)try{return B0e.readFileSync(j0e.resolve(process.cwd(),o))}catch{oX.diag.warn(r);return}else return}function H0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function W0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function iX(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function sX(t){let e=W0e(t),r=H0e(t),n=iX(t),i=e!=null&&r!=null;return n!=null&&!i?(oX.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,o_.createSslCredentials)(iX(t))):(0,o_.createSslCredentials)(n,e,r)}function Y0e(t){return V0e(t)?(0,o_.createInsecureCredentials)():sX(t)}function K0e(t){return{...(0,F0e.getSharedConfigurationFromEnvironment)(t),metadata:G0e(t),url:q0e(t),credentials:e=>e.startsWith("http://")?()=>(0,o_.createInsecureCredentials)():e.startsWith("https://")?()=>sX(t):()=>Y0e(t)}}dA.getOtlpGrpcConfigurationFromEnv=K0e});var lX=v(fA=>{"use strict";Object.defineProperty(fA,"__esModule",{value:!0});fA.convertLegacyOtlpGrpcOptions=void 0;var cX=bJ(),Z0e=n_(),J0e=aX();function X0e(t,e){let r=t.credentials;return(0,cX.mergeOtlpGrpcConfigurationWithDefaults)({url:t.url,metadata:()=>t.metadata??(0,Z0e.createEmptyMetadata)(),compression:t.compression,timeoutMillis:t.timeoutMillis,concurrencyLimit:t.concurrencyLimit,credentials:r!=null?()=>r:void 0,userAgent:t.userAgent},(0,J0e.getOtlpGrpcConfigurationFromEnv)(e),(0,cX.getOtlpGrpcDefaultConfiguration)())}fA.convertLegacyOtlpGrpcOptions=X0e});var uX=v(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.createOtlpGrpcExportDelegate=void 0;var Q0e=(tT(),Nr(eT)),eOe=n_();function tOe(t,e,r,n){return(0,Q0e.createOtlpNetworkExportDelegate)(t,e,(0,eOe.createOtlpGrpcExporterTransport)({address:t.url,compression:t.compression,credentials:t.credentials,metadata:t.metadata,userAgent:t.userAgent,grpcName:r,grpcPath:n}))}pA.createOtlpGrpcExportDelegate=tOe});var dX=v(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.createOtlpGrpcExportDelegate=of.convertLegacyOtlpGrpcOptions=void 0;var rOe=lX();Object.defineProperty(of,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return rOe.convertLegacyOtlpGrpcOptions}});var nOe=uX();Object.defineProperty(of,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return nOe.createOtlpGrpcExportDelegate}})});function us(t){return t<0?10:t<128?1:t<16384?2:t<2097152?3:t<268435456?4:t<34359738368?5:t<4398046511104?6:t<562949953421312?7:t<72057594037927940?8:9}var PD=A(()=>{"use strict"});var iOe,s_,Pa,hA=A(()=>{"use strict";Se();PD();iOe="ProtobufWriter: estimated size was too small, growing buffer.",s_=1,Pa=class{_buffer;_textEncoder;_dataView;pos=0;constructor(e=65536){this._buffer=new Uint8Array(e),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(e){let r=this.pos+e;if(r<=this._buffer.length)return;J.debug(iOe);let n=this._buffer.length*2;for(;n<r;)n*=2;let i=new Uint8Array(n);i.set(this._buffer),this._buffer=i,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){let e=this.pos;return this._ensureCapacity(s_),this.pos+=s_,e}finishLengthDelimited(e,r){let n=r>>>0,i=us(n);if(i>s_){let s=i-s_;this._ensureCapacity(s),this._buffer.copyWithin(e+i,e+s_,this.pos),this.pos+=s}let o=e;n<128?this._buffer[o]=n:n<16384?(this._buffer[o++]=n&127|128,this._buffer[o]=n>>>7):n<2097152?(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o]=n>>>14):n<268435456?(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o++]=n>>>14&127|128,this._buffer[o]=n>>>21):(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o++]=n>>>14&127|128,this._buffer[o++]=n>>>21&127|128,this._buffer[o]=n>>>28)}writeSint32(e){this.writeVarint((e<<1^e>>31)>>>0)}writeSfixed64(e){let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}this.writeFixed64(r,n)}writeVarint(e){if(this._ensureCapacity(us(e)),e>=0&&e<=4294967295){let r=e>>>0;for(;r>127;)this._buffer[this.pos++]=r&127|128,r>>>=7;this._buffer[this.pos++]=r}else{let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}for(;n>0||r>127;)this._buffer[this.pos++]=r&127|128,r=(r>>>7|n<<25)>>>0,n>>>=7;this._buffer[this.pos++]=r&127}}writeFixed32(e){this._ensureCapacity(4);let r=e>>>0;this._buffer[this.pos++]=r&255,this._buffer[this.pos++]=r>>>8&255,this._buffer[this.pos++]=r>>>16&255,this._buffer[this.pos++]=r>>>24&255}writeFixed64(e,r){this._ensureCapacity(8);let n=e>>>0,i=r>>>0;this._buffer[this.pos++]=n&255,this._buffer[this.pos++]=n>>>8&255,this._buffer[this.pos++]=n>>>16&255,this._buffer[this.pos++]=n>>>24&255,this._buffer[this.pos++]=i&255,this._buffer[this.pos++]=i>>>8&255,this._buffer[this.pos++]=i>>>16&255,this._buffer[this.pos++]=i>>>24&255}writeBytes(e){this.writeVarint(e.length),this._ensureCapacity(e.length),this._buffer.set(e,this.pos),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeString(e){let r=!0,n=e.length;for(let i=0;i<n;i++)if(e.charCodeAt(i)>127){r=!1;break}if(r){this.writeVarint(n),this._ensureCapacity(n);for(let i=0;i<n;i++)this._buffer[this.pos++]=e.charCodeAt(i)}else{let i=this._textEncoder.encode(e);this.writeBytes(i)}}}});function fX(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function ds(t){let e=new Uint8Array(t.length/2),r=0;for(let n=0;n<t.length;n+=2){let i=fX(t.charCodeAt(n)),o=fX(t.charCodeAt(n+1));e[r++]=i<<4|o}return e}var OD=A(()=>{"use strict"});var a_,pX=A(()=>{"use strict";(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"})(a_||(a_={}))});var c_,hX,ND=A(()=>{"use strict";c_=class{emit(e){}enabled(){return!1}},hX=new c_});function mX(t,e,r){return n=>n===t?e:r}var l_,sf,kD,gX=A(()=>{"use strict";l_=Symbol.for("io.opentelemetry.js.api.logs"),sf=globalThis;kD=1});var MD,mA,DD=A(()=>{"use strict";ND();MD=class{getLogger(e,r,n){return new c_}},mA=new MD});var gA,_X=A(()=>{"use strict";ND();gA=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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):hX}}});var u_,yX=A(()=>{"use strict";DD();_X();u_=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new gA(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:mA}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}}});var _A,SX=A(()=>{"use strict";gX();DD();yX();_A=class t{constructor(){this._proxyLoggerProvider=new u_}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return sf[l_]?this.getLoggerProvider():(sf[l_]=mX(kD,e,mA),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=sf[l_])===null||e===void 0?void 0:e.call(sf,kD))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete sf[l_],this._proxyLoggerProvider=new u_}}});var adt,EX=A(()=>{"use strict";pX();SX();adt=_A.getInstance()});function Qr(t,e){let r=e[0],n=e[1],i=1e9,o=r&65535,s=r/65536>>>0,a=o*i,c=s*i,l=a>>>0,u=Math.floor(a/4294967296),d=(c&65535)*65536>>>0,f=c/65536>>>0,p=l+d+n,h=p>>>0,m=Math.floor(p/4294967296),y=u+f+m>>>0;t.writeFixed64(h,y)}function Ti(t,e,r){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let i=e[n];t.writeTag(r,2);let o=t.startLengthDelimited(),s=t.pos;oOe(t,n,i),t.finishLengthDelimited(o,t.pos-s)}}function oOe(t,e,r){t.writeTag(1,2),t.writeString(e),t.writeTag(2,2);let n=t.startLengthDelimited(),i=t.pos;d_(t,r),t.finishLengthDelimited(n,t.pos-i)}function d_(t,e){let r=typeof e;if(r==="string")t.writeTag(1,2),t.writeString(e);else if(r==="boolean")t.writeTag(2,0),t.writeVarint(e?1:0);else if(r==="number"){let n=e;Number.isInteger(n)&&n>=sOe&&n<aOe?(t.writeTag(3,0),t.writeVarint(n)):(t.writeTag(4,1),t.writeDouble(n))}else if(e instanceof Uint8Array)t.writeTag(7,2),t.writeBytes(e);else if(Array.isArray(e)){t.writeTag(5,2);let n=t.startLengthDelimited(),i=t.pos;for(let o of e){t.writeTag(1,2);let s=t.startLengthDelimited(),a=t.pos;d_(t,o),t.finishLengthDelimited(s,t.pos-a)}t.finishLengthDelimited(n,t.pos-i)}else if(r==="object"&&e!=null){t.writeTag(6,2);let n=t.startLengthDelimited(),i=t.pos,o=e;for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;let a=o[s];t.writeTag(1,2);let c=t.startLengthDelimited(),l=t.pos;t.writeTag(1,2),t.writeString(s),t.writeTag(2,2);let u=t.startLengthDelimited(),d=t.pos;d_(t,a),t.finishLengthDelimited(u,t.pos-d),t.finishLengthDelimited(c,t.pos-l)}t.finishLengthDelimited(n,t.pos-i)}}function af(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;t.writeTag(1,2),t.writeString(e.name),e.version&&(t.writeTag(2,2),t.writeString(e.version)),t.finishLengthDelimited(n,t.pos-i)}function cf(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;e.attributes&&Ti(t,e.attributes,1),t.writeTag(2,0),t.writeVarint(0),t.finishLengthDelimited(n,t.pos-i)}var sOe,aOe,yA=A(()=>{"use strict";sOe=-(2**63),aOe=2**63});function cOe(t){let e=t.length,r=0;for(let n=0;n<e;n++){let i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(n++,r+=4)}return r}var Oa,SA=A(()=>{"use strict";PD();Oa=class{pos=0;startLengthDelimited(){return this.pos}finishLengthDelimited(e,r){this.pos+=us(r)}writeVarint(e){this.pos+=us(e)}writeSint32(e){this.pos+=us((e<<1^e>>31)>>>0)}writeSfixed64(e){this.pos+=8}writeFixed32(e){this.pos+=4}writeFixed64(e,r){this.pos+=8}writeBytes(e){this.pos+=us(e.length),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this.pos+=8}writeString(e){let r=cOe(e);this.pos+=us(r),this.pos+=r}}});function lOe(t,e){let r=t.startLengthDelimited(),n=t.pos;if(t.writeTag(1,1),Qr(t,e.hrTime),e.severityNumber!==void 0&&e.severityNumber!==a_.UNSPECIFIED&&(t.writeTag(2,0),t.writeVarint(e.severityNumber)),e.severityText&&(t.writeTag(3,2),t.writeString(e.severityText)),e.body!==void 0){t.writeTag(5,2);let i=t.startLengthDelimited(),o=t.pos;d_(t,e.body),t.finishLengthDelimited(i,t.pos-o)}e.attributes&&Ti(t,e.attributes,6),t.writeTag(7,0),t.writeVarint(e.droppedAttributesCount),e.spanContext?.traceFlags&&(t.writeTag(8,5),t.writeFixed32(e.spanContext.traceFlags)),e.spanContext?.traceId&&(t.writeTag(9,2),t.writeBytes(ds(e.spanContext.traceId))),e.spanContext?.spanId&&(t.writeTag(10,2),t.writeBytes(ds(e.spanContext.spanId))),t.writeTag(11,1),Qr(t,e.hrTimeObserved),e.eventName&&(t.writeTag(12,2),t.writeString(e.eventName)),t.finishLengthDelimited(r,t.pos-n)}function uOe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;af(t,e,1);for(let o of r)t.writeTag(2,2),lOe(t,o);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function vX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;cf(t,e,1);for(let o of r.values()){t.writeTag(2,2);let s=o[0].instrumentationScope;uOe(t,s,o)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function dOe(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,o=e.get(n);o||(o=new Map,e.set(n,o));let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}return e}function TX(t){let e=dOe(t),r=new Oa;for(let[i,o]of e)r.writeTag(1,2),vX(r,i,o);let n=new Pa(r.pos);for(let[i,o]of e)n.writeTag(1,2),vX(n,i,o);return n.finish()}var bX=A(()=>{"use strict";hA();OD();EX();yA();SA()});var bi,EA=A(()=>{"use strict";bi=class{pos=0;_buf;_textDecoder;constructor(e){this._buf=e,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){let e=this.readVarint();return{fieldNumber:e>>>3,wireType:e&7}}readVarint(){let e=0,r=0,n=!1;for(;this.pos<this._buf.length;){let i=this._buf[this.pos++];if(e+=(i&127)*Math.pow(2,r),r+=7,(i&128)===0){n=!0;break}}if(!n)throw new Error("Truncated buffer: unexpected end of data while reading varint");return e}readBytes(){let e=this.readVarint();if(this.pos+e>this._buf.length)throw new Error(`Truncated buffer: expected ${e} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);let r=this._buf.subarray(this.pos,this.pos+e);return this.pos+=e,r}readString(){return this._textDecoder.decode(this.readBytes())}skip(e){switch(e){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 3:for(;!this.isAtEnd();){let{wireType:r}=this.readTag();if(r===4)break;this.skip(r)}break;case 4:break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${e}, cannot safely skip`)}}}});function fOe(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedLogRecords=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function AX(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=fOe(e.readBytes()):e.skip(i)}return r}var wX=A(()=>{"use strict";EA()});var LD,xX=A(()=>{"use strict";bX();wX();LD={serializeRequest:t=>TX(t),deserializeResponse:t=>AX(t)}});var RX=A(()=>{"use strict";xX()});var fs,CX=A(()=>{"use strict";(function(t){t[t.DELTA=0]="DELTA",t[t.CUMULATIVE=1]="CUMULATIVE"})(fs||(fs={}))});var $D,En,IX=A(()=>{"use strict";(function(t){t.COUNTER="COUNTER",t.GAUGE="GAUGE",t.HISTOGRAM="HISTOGRAM",t.UP_DOWN_COUNTER="UP_DOWN_COUNTER",t.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",t.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",t.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})($D||($D={}));(function(t){t[t.HISTOGRAM=0]="HISTOGRAM",t[t.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",t[t.GAUGE=2]="GAUGE",t[t.SUM=3]="SUM"})(En||(En={}))});var UD=A(()=>{"use strict";CX();IX()});function NX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;t.writeTag(2,1),Qr(t,e.startTime),t.writeTag(3,1),Qr(t,e.endTime),r===Go.INT?(t.writeTag(6,1),t.writeSfixed64(e.value)):(t.writeTag(4,1),t.writeDouble(e.value)),e.attributes&&Ti(t,e.attributes,7),t.finishLengthDelimited(n,t.pos-i)}function pOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;if(t.writeTag(2,1),Qr(t,e.startTime),t.writeTag(3,1),Qr(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.buckets.counts.length>0){t.writeTag(6,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of i.buckets.counts)t.writeFixed64(a>>>0,a/4294967296>>>0);t.finishLengthDelimited(o,t.pos-s)}if(i.buckets.boundaries.length>0){t.writeTag(7,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of i.buckets.boundaries)t.writeDouble(a);t.finishLengthDelimited(o,t.pos-s)}e.attributes&&Ti(t,e.attributes,9),i.min!==void 0&&(t.writeTag(11,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(12,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function PX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;if(e!==0&&(t.writeTag(1,0),t.writeSint32(e)),r.length>0){t.writeTag(2,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of r)t.writeVarint(a);t.finishLengthDelimited(o,t.pos-s)}t.finishLengthDelimited(n,t.pos-i)}function hOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;e.attributes&&Ti(t,e.attributes,1),t.writeTag(2,1),Qr(t,e.startTime),t.writeTag(3,1),Qr(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.scale!==0&&(t.writeTag(6,0),t.writeSint32(i.scale)),t.writeTag(7,1),t.writeFixed64(i.zeroCount>>>0,i.zeroCount/4294967296>>>0),t.writeTag(8,2),PX(t,i.positive.offset,i.positive.bucketCounts),t.writeTag(9,2),PX(t,i.negative.offset,i.negative.bucketCounts),i.min!==void 0&&(t.writeTag(12,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(13,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function mOe(t,e){let r=t.startLengthDelimited(),n=t.pos;switch(t.writeTag(1,2),t.writeString(e.descriptor.name),e.descriptor.description&&(t.writeTag(2,2),t.writeString(e.descriptor.description)),e.descriptor.unit&&(t.writeTag(3,2),t.writeString(e.descriptor.unit)),e.dataPointType){case En.GAUGE:t.writeTag(5,2),gOe(t,e);break;case En.SUM:t.writeTag(7,2),_Oe(t,e);break;case En.HISTOGRAM:t.writeTag(9,2),yOe(t,e);break;case En.EXPONENTIAL_HISTOGRAM:t.writeTag(10,2),SOe(t,e);break;default:{let i=e}}t.finishLengthDelimited(r,t.pos-n)}function gOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let i of e.dataPoints)t.writeTag(1,2),NX(t,i,e.descriptor.valueType);t.finishLengthDelimited(r,t.pos-n)}function _Oe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),NX(t,o,e.descriptor.valueType);let i=FD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),e.isMonotonic&&(t.writeTag(3,0),t.writeVarint(1)),t.finishLengthDelimited(r,t.pos-n)}function yOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),pOe(t,o);let i=FD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function SOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),hOe(t,o);let i=FD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function EOe(t,e){let r=t.startLengthDelimited(),n=t.pos;af(t,e.scope,1);for(let i of e.metrics)t.writeTag(2,2),mOe(t,i);e.scope.schemaUrl&&(t.writeTag(3,2),t.writeString(e.scope.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function OX(t,e){let r=t.startLengthDelimited(),n=t.pos;cf(t,e.resource,1);for(let i of e.scopeMetrics)t.writeTag(2,2),EOe(t,i);e.resource.schemaUrl&&(t.writeTag(3,2),t.writeString(e.resource.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function FD(t){switch(t){case fs.DELTA:return 1;case fs.CUMULATIVE:return 2;default:return 0}}function kX(t){let e=new Oa;e.writeTag(1,2),OX(e,t);let r=new Pa(e.pos);return r.writeTag(1,2),OX(r,t),r.finish()}var MX=A(()=>{"use strict";Se();UD();yA();SA();hA()});function vOe(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedDataPoints=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function DX(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=vOe(e.readBytes()):e.skip(i)}return r}var LX=A(()=>{"use strict";EA()});var BD,$X=A(()=>{"use strict";MX();LX();BD={serializeRequest:t=>kX(t),deserializeResponse:t=>DX(t)}});var UX=A(()=>{"use strict";$X()});function BX(t,e){let r=t&255|TOe;return e&&(r|=bOe),r}function AOe(t,e){let r=t.startLengthDelimited(),n=t.pos;e.message&&(t.writeTag(2,2),t.writeString(e.message)),t.writeTag(3,0),t.writeVarint(e.code),t.finishLengthDelimited(r,t.pos-n)}function wOe(t,e){let r=t.startLengthDelimited(),n=t.pos;t.writeTag(1,1),Qr(t,e.time),t.writeTag(2,2),t.writeString(e.name),e.attributes&&Ti(t,e.attributes,3),t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount||0),t.finishLengthDelimited(r,t.pos-n)}function xOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.context;t.writeTag(1,2),t.writeBytes(ds(i.traceId)),t.writeTag(2,2),t.writeBytes(ds(i.spanId));let o=i.traceState?.serialize();o&&(t.writeTag(3,2),t.writeString(o)),e.attributes&&Ti(t,e.attributes,4),t.writeTag(5,0),t.writeVarint(e.droppedAttributesCount||0);let s=BX(i.traceFlags,i.isRemote);s&&(t.writeTag(6,5),t.writeFixed32(s)),t.finishLengthDelimited(r,t.pos-n)}function ROe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.spanContext();t.writeTag(1,2),t.writeBytes(ds(i.traceId)),t.writeTag(2,2),t.writeBytes(ds(i.spanId));let o=i.traceState?.serialize();o&&(t.writeTag(3,2),t.writeString(o)),e.parentSpanContext?.spanId&&(t.writeTag(4,2),t.writeBytes(ds(e.parentSpanContext.spanId))),t.writeTag(5,2),t.writeString(e.name);let s=e.kind==null?0:e.kind+1;s!==0&&(t.writeTag(6,0),t.writeVarint(s)),t.writeTag(7,1),Qr(t,e.startTime),t.writeTag(8,1),Qr(t,e.endTime),e.attributes&&Ti(t,e.attributes,9),t.writeTag(10,0),t.writeVarint(e.droppedAttributesCount);for(let c of e.events)t.writeTag(11,2),wOe(t,c);t.writeTag(12,0),t.writeVarint(e.droppedEventsCount);for(let c of e.links)t.writeTag(13,2),xOe(t,c);t.writeTag(14,0),t.writeVarint(e.droppedLinksCount),t.writeTag(15,2),AOe(t,e.status);let a=BX(i.traceFlags,e.parentSpanContext?.isRemote);a&&(t.writeTag(16,5),t.writeFixed32(a)),t.finishLengthDelimited(r,t.pos-n)}function COe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;af(t,e,1);for(let o of r)t.writeTag(2,2),ROe(t,o);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function FX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;cf(t,e,1);for(let o of r.values()){t.writeTag(2,2);let s=o[0].instrumentationScope;COe(t,s,o)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function IOe(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,o=e.get(n);o||(o=new Map,e.set(n,o));let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}return e}function jX(t){let e=IOe(t),r=new Oa;for(let[i,o]of e)r.writeTag(1,2),FX(r,i,o);let n=new Pa(r.pos);for(let[i,o]of e)n.writeTag(1,2),FX(n,i,o);return n.finish()}var TOe,bOe,zX=A(()=>{"use strict";hA();OD();yA();SA();TOe=256,bOe=512});function POe(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedSpans=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function GX(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=POe(e.readBytes()):e.skip(i)}return r}var qX=A(()=>{"use strict";EA()});var jD,VX=A(()=>{"use strict";zX();qX();jD={serializeRequest:t=>jX(t),deserializeResponse:t=>GX(t)}});var HX=A(()=>{"use strict";VX()});function lf(t,e){let r={attributes:ps(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function uf(t){return{name:t.name,version:t.version}}function ps(t,e){return Object.keys(t).map(r=>zD(r,t[r],e))}function zD(t,e,r){return{key:t,value:f_(e,r)}}function f_(t,e){let r=typeof t;if(r==="string")return{stringValue:t};if(r==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(r==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){let n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=f_(t[i],e);return{arrayValue:{values:n}}}if(r==="object"&&t!=null){let n=Object.keys(t),i=new Array(n.length);for(let o=0;o<n.length;o++)i[o]={key:n[o],value:f_(t[n[o]],e)};return{kvlistValue:{values:i}}}return{}}var vA=A(()=>{"use strict"});function WX(t,e){return{resourceLogs:NOe(t,e)}}function OOe(t){let e=new Map;for(let r of t){let{resource:n,instrumentationScope:{name:i,version:o="",schemaUrl:s=""}}=r,a=e.get(n);a||(a=new Map,e.set(n,a));let c=`${i}@${o}:${s}`,l=a.get(c);l||(l=[],a.set(c,l)),l.push(r)}return e}function NOe(t,e){let r=OOe(t);return Array.from(r,([n,i])=>{let o=lf(n,e);return{resource:o,scopeLogs:Array.from(i,([,s])=>({scope:uf(s[0].instrumentationScope),logRecords:s.map(a=>kOe(a,e)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:o.schemaUrl}})}function kOe(t,e){return{timeUnixNano:e.encodeHrTime(t.hrTime),observedTimeUnixNano:e.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:f_(t.body,e),eventName:t.eventName,attributes:MOe(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:e.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:e.encodeOptionalSpanContext(t.spanContext?.spanId)}}function MOe(t,e){return Object.keys(t).map(r=>zD(r,t[r],e))}var YX=A(()=>{"use strict";vA()});function DOe(t){let e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function LOe(t){return DOe(t).toString()}function KX(t){return t}var $Oe,df,TA=A(()=>{"use strict";_d();$Oe=typeof BigInt<"u"?LOe:qv;df={encodeHrTime:$Oe,encodeSpanContext:KX,encodeOptionalSpanContext:KX,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=String.fromCharCode(t[r]);return btoa(e.join(""))}}});var GD,ZX=A(()=>{"use strict";YX();TA();Se();GD={serializeRequest:t=>{let e=WX(t,df);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return J.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}}});var JX=A(()=>{"use strict";ZX()});var p_,XX=A(()=>{"use strict";(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(p_||(p_={}))});function UOe(t,e){let r=lf(t.resource,e);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:FOe(t.scopeMetrics,e)}}function FOe(t,e){return Array.from(t.map(r=>({scope:uf(r.scope),metrics:r.metrics.map(n=>BOe(n,e)),schemaUrl:r.scope.schemaUrl})))}function BOe(t,e){let r={name:t.descriptor.name,description:t.descriptor.description,unit:t.descriptor.unit},n=qOe(t.aggregationTemporality);switch(t.dataPointType){case En.SUM:r.sum={aggregationTemporality:n,isMonotonic:t.isMonotonic,dataPoints:QX(t,e)};break;case En.GAUGE:r.gauge={dataPoints:QX(t,e)};break;case En.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:zOe(t,e)};break;case En.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:GOe(t,e)};break}return r}function jOe(t,e,r){let n={attributes:ps(t.attributes,r),startTimeUnixNano:r.encodeHrTime(t.startTime),timeUnixNano:r.encodeHrTime(t.endTime)};switch(e){case Go.INT:n.asInt=t.value;break;case Go.DOUBLE:n.asDouble=t.value;break}return n}function QX(t,e){return t.dataPoints.map(r=>jOe(r,t.descriptor.valueType,e))}function zOe(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:ps(r.attributes,e),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function GOe(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:ps(r.attributes,e),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function qOe(t){switch(t){case fs.DELTA:return p_.AGGREGATION_TEMPORALITY_DELTA;case fs.CUMULATIVE:return p_.AGGREGATION_TEMPORALITY_CUMULATIVE}}function eQ(t,e){return{resourceMetrics:t.map(r=>UOe(r,e))}}var tQ=A(()=>{"use strict";Se();UD();XX();vA()});var qD,rQ=A(()=>{"use strict";tQ();TA();Se();qD={serializeRequest:t=>{let e=eQ([t],df);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return J.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}}});var nQ=A(()=>{"use strict";rQ()});function iQ(t,e){let r=t&255|VOe;return e&&(r|=HOe),r}function WOe(t,e){let r=t.spanContext(),n=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(r.traceId),spanId:e.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:ps(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>KOe(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(o=>YOe(o,e)),droppedLinksCount:t.droppedLinksCount,flags:iQ(r.traceFlags,t.parentSpanContext?.isRemote)}}function YOe(t,e){return{attributes:t.attributes?ps(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:iQ(t.context.traceFlags,t.context.isRemote)}}function KOe(t,e){return{attributes:t.attributes?ps(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function oQ(t,e){return{resourceSpans:JOe(t,e)}}function ZOe(t){let e=new Map;for(let r of t){let n=e.get(r.resource);n||(n=new Map,e.set(r.resource,n));let i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return e}function JOe(t,e){let r=ZOe(t),n=[],i=r.entries(),o=i.next();for(;!o.done;){let[s,a]=o.value,c=[],l=a.values(),u=l.next();for(;!u.done;){let p=u.value;if(p.length>0){let h=p.map(m=>WOe(m,e));c.push({scope:uf(p[0].instrumentationScope),spans:h,schemaUrl:p[0].instrumentationScope.schemaUrl})}u=l.next()}let d=lf(s,e),f={resource:d,scopeSpans:c,schemaUrl:d.schemaUrl};n.push(f),o=i.next()}return n}var VOe,HOe,sQ=A(()=>{"use strict";vA();VOe=256,HOe=512});var VD,aQ=A(()=>{"use strict";sQ();TA();Se();VD={serializeRequest:t=>{let e=oQ(t,df);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return J.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}}});var cQ=A(()=>{"use strict";aQ()});var lQ={};ar(lQ,{JsonLogsSerializer:()=>GD,JsonMetricsSerializer:()=>qD,JsonTraceSerializer:()=>VD,ProtobufLogsSerializer:()=>LD,ProtobufMetricsSerializer:()=>BD,ProtobufTraceSerializer:()=>jD});var uQ=A(()=>{"use strict";RX();UX();HX();JX();nQ();cQ()});var fQ=v(bA=>{"use strict";Object.defineProperty(bA,"__esModule",{value:!0});bA.OTLPTraceExporter=void 0;var dQ=dX(),XOe=(uQ(),Nr(lQ)),QOe=(tT(),Nr(eT)),HD=class extends QOe.OTLPExporterBase{constructor(e={}){super((0,dQ.createOtlpGrpcExportDelegate)((0,dQ.convertLegacyOtlpGrpcOptions)(e,"TRACES"),XOe.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};bA.OTLPTraceExporter=HD});var pQ=v(AA=>{"use strict";Object.defineProperty(AA,"__esModule",{value:!0});AA.OTLPTraceExporter=void 0;var eNe=fQ();Object.defineProperty(AA,"OTLPTraceExporter",{enumerable:!0,get:function(){return eNe.OTLPTraceExporter}})});var O7=v((Nmt,P7)=>{"use strict";P7.exports=I7;I7.sync=mMe;var R7=Z("fs");function hMe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function C7(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:hMe(e,r)}function I7(t,e,r){R7.stat(t,function(n,i){r(n,n?!1:C7(i,t,e))})}function mMe(t,e){return C7(R7.statSync(t),t,e)}});var L7=v((kmt,D7)=>{"use strict";D7.exports=k7;k7.sync=gMe;var N7=Z("fs");function k7(t,e,r){N7.stat(t,function(n,i){r(n,n?!1:M7(i,e))})}function gMe(t,e){return M7(N7.statSync(t),e)}function M7(t,e){return t.isFile()&&_Me(t,e)}function _Me(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var U7=v((Dmt,$7)=>{"use strict";var Mmt=Z("fs"),ZA;process.platform==="win32"||global.TESTING_WINDOWS?ZA=O7():ZA=L7();$7.exports=vL;vL.sync=yMe;function vL(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){vL(t,e||{},function(o,s){o?i(o):n(s)})})}ZA(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function yMe(t,e){try{return ZA.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var V7=v((Lmt,q7)=>{"use strict";var _f=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",F7=Z("path"),SMe=_f?";":":",B7=U7(),j7=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),z7=(t,e)=>{let r=e.colon||SMe,n=t.match(/\//)||_f&&t.match(/\\/)?[""]:[..._f?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=_f?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=_f?i.split(r):[""];return _f&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},G7=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=z7(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(j7(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,h=F7.join(p,t),m=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;u(c(m,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let h=i[d];B7(l+h,{pathExt:o},(m,y)=>{if(!m&&y)if(e.all)s.push(l+h);else return f(l+h);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},EMe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=z7(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=F7.join(c,t),u=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let f=u+n[d];try{if(B7.sync(f,{pathExt:i}))if(e.all)o.push(f);else return f}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw j7(t)};q7.exports=G7;G7.sync=EMe});var W7=v(($mt,TL)=>{"use strict";var H7=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TL.exports=H7;TL.exports.default=H7});var J7=v((Umt,Z7)=>{"use strict";var Y7=Z("path"),vMe=V7(),TMe=W7();function K7(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=vMe.sync(t.command,{path:r[TMe({env:r})],pathExt:e?Y7.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=Y7.resolve(i?t.options.cwd:"",s)),s}function bMe(t){return K7(t)||K7(t,!0)}Z7.exports=bMe});var X7=v((Fmt,AL)=>{"use strict";var bL=/([()\][%!^"`<>&|;, *?])/g;function AMe(t){return t=t.replace(bL,"^$1"),t}function wMe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(bL,"^$1"),e&&(t=t.replace(bL,"^$1")),t}AL.exports.command=AMe;AL.exports.argument=wMe});var eee=v((Bmt,Q7)=>{"use strict";Q7.exports=/^#!(.*)/});var ree=v((jmt,tee)=>{"use strict";var xMe=eee();tee.exports=(t="")=>{let e=t.match(xMe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var iee=v((zmt,nee)=>{"use strict";var wL=Z("fs"),RMe=ree();function CMe(t){let r=Buffer.alloc(150),n;try{n=wL.openSync(t,"r"),wL.readSync(n,r,0,150,0),wL.closeSync(n)}catch{}return RMe(r.toString())}nee.exports=CMe});var cee=v((Gmt,aee)=>{"use strict";var IMe=Z("path"),oee=J7(),see=X7(),PMe=iee(),OMe=process.platform==="win32",NMe=/\.(?:com|exe)$/i,kMe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function MMe(t){t.file=oee(t);let e=t.file&&PMe(t.file);return e?(t.args.unshift(t.file),t.command=e,oee(t)):t.file}function DMe(t){if(!OMe)return t;let e=MMe(t),r=!NMe.test(e);if(t.options.forceShell||r){let n=kMe.test(e);t.command=IMe.normalize(t.command),t.command=see.command(t.command),t.args=t.args.map(o=>see.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function LMe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:DMe(n)}aee.exports=LMe});var dee=v((qmt,uee)=>{"use strict";var xL=process.platform==="win32";function RL(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function $Me(t,e){if(!xL)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=lee(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function lee(t,e){return xL&&t===1&&!e.file?RL(e.original,"spawn"):null}function UMe(t,e){return xL&&t===1&&!e.file?RL(e.original,"spawnSync"):null}uee.exports={hookChildProcess:$Me,verifyENOENT:lee,verifyENOENTSync:UMe,notFoundError:RL}});var hee=v((Vmt,yf)=>{"use strict";var fee=Z("child_process"),CL=cee(),IL=dee();function pee(t,e,r){let n=CL(t,e,r),i=fee.spawn(n.command,n.args,n.options);return IL.hookChildProcess(i,n),i}function FMe(t,e,r){let n=CL(t,e,r),i=fee.spawnSync(n.command,n.args,n.options);return i.error=i.error||IL.verifyENOENTSync(i.status,n),i}yf.exports=pee;yf.exports.spawn=pee;yf.exports.sync=FMe;yf.exports._parse=CL;yf.exports._enoent=IL});var Yue=v((dzt,Wue)=>{"use strict";var Oc=Z("constants"),FVe=process.cwd,rI=null,BVe=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return rI||(rI=FVe.call(process)),rI};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Xz=process.chdir,process.chdir=function(t){rI=null,Xz.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Xz));var Xz;Wue.exports=jVe;function jVe(t){Oc.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(u,d,f){f&&process.nextTick(f)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(u,d,f,p){p&&process.nextTick(p)},t.lchownSync=function(){}),BVe==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(u){function d(f,p,h){var m=Date.now(),y=0;u(f,p,function S(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){t.stat(p,function(w,T){w&&w.code==="ENOENT"?u(f,p,S):h(b)})},y),y<100&&(y+=10);return}h&&h(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(u){function d(f,p,h,m,y,S){var b;if(S&&typeof S=="function"){var w=0;b=function(T,C,O){if(T&&T.code==="EAGAIN"&&w<10)return w++,u.call(t,f,p,h,m,y,b);S.apply(this,arguments)}}return u.call(t,f,p,h,m,y,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(u){return function(d,f,p,h,m){for(var y=0;;)try{return u.call(t,d,f,p,h,m)}catch(S){if(S.code==="EAGAIN"&&y<10){y++;continue}throw S}}})(t.readSync);function e(u){u.lchmod=function(d,f,p){u.open(d,Oc.O_WRONLY|Oc.O_SYMLINK,f,function(h,m){if(h){p&&p(h);return}u.fchmod(m,f,function(y){u.close(m,function(S){p&&p(y||S)})})})},u.lchmodSync=function(d,f){var p=u.openSync(d,Oc.O_WRONLY|Oc.O_SYMLINK,f),h=!0,m;try{m=u.fchmodSync(p,f),h=!1}finally{if(h)try{u.closeSync(p)}catch{}else u.closeSync(p)}return m}}function r(u){Oc.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(d,f,p,h){u.open(d,Oc.O_SYMLINK,function(m,y){if(m){h&&h(m);return}u.futimes(y,f,p,function(S){u.close(y,function(b){h&&h(S||b)})})})},u.lutimesSync=function(d,f,p){var h=u.openSync(d,Oc.O_SYMLINK),m,y=!0;try{m=u.futimesSync(h,f,p),y=!1}finally{if(y)try{u.closeSync(h)}catch{}else u.closeSync(h)}return m}):u.futimes&&(u.lutimes=function(d,f,p,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function n(u){return u&&function(d,f,p){return u.call(t,d,f,function(h){l(h)&&(h=null),p&&p.apply(this,arguments)})}}function i(u){return u&&function(d,f){try{return u.call(t,d,f)}catch(p){if(!l(p))throw p}}}function o(u){return u&&function(d,f,p,h){return u.call(t,d,f,p,function(m){l(m)&&(m=null),h&&h.apply(this,arguments)})}}function s(u){return u&&function(d,f,p){try{return u.call(t,d,f,p)}catch(h){if(!l(h))throw h}}}function a(u){return u&&function(d,f,p){typeof f=="function"&&(p=f,f=null);function h(m,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),p&&p.apply(this,arguments)}return f?u.call(t,d,f,h):u.call(t,d,h)}}function c(u){return u&&function(d,f){var p=f?u.call(t,d,f):u.call(t,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function l(u){if(!u||u.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var Jue=v((fzt,Zue)=>{"use strict";var Kue=Z("stream").Stream;Zue.exports=zVe;function zVe(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Kue.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;a<c;a++){var l=s[a];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(u,d){if(u){o.emit("error",u),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Kue.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var c=o[s];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Que=v((pzt,Xue)=>{"use strict";Xue.exports=qVe;var GVe=Object.getPrototypeOf||function(t){return t.__proto__};function qVe(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:GVe(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var nde=v((hzt,tG)=>{"use strict";var wt=Z("fs"),VVe=Yue(),HVe=Jue(),WVe=Que(),nI=Z("util"),Sr,oI;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Sr=Symbol.for("graceful-fs.queue"),oI=Symbol.for("graceful-fs.previous")):(Sr="___graceful-fs.queue",oI="___graceful-fs.previous");function YVe(){}function rde(t,e){Object.defineProperty(t,Sr,{get:function(){return e}})}var Lu=YVe;nI.debuglog?Lu=nI.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Lu=function(){var t=nI.format.apply(nI,arguments);t="GFS4: "+t.split(/\n/).join(`
23
- GFS4: `),console.error(t)});wt[Sr]||(ede=global[Sr]||[],rde(wt,ede),wt.close=(function(t){function e(r,n){return t.call(wt,r,function(i){i||tde(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,oI,{value:t}),e})(wt.close),wt.closeSync=(function(t){function e(r){t.apply(wt,arguments),tde()}return Object.defineProperty(e,oI,{value:t}),e})(wt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Lu(wt[Sr]),Z("assert").equal(wt[Sr].length,0)}));var ede;global[Sr]||rde(global,wt[Sr]);tG.exports=Qz(WVe(wt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wt.__patched&&(tG.exports=Qz(wt),wt.__patched=!0);function Qz(t){VVe(t),t.gracefulify=Qz,t.createReadStream=C,t.createWriteStream=O;var e=t.readFile;t.readFile=r;function r(M,F,_){return typeof F=="function"&&(_=F,F=null),re(M,F,_);function re(N,g,E,x){return e(N,g,function(Y){Y&&(Y.code==="EMFILE"||Y.code==="ENFILE")?Bh([re,[N,g,E],Y,x||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(M,F,_,re){return typeof _=="function"&&(re=_,_=null),N(M,F,_,re);function N(g,E,x,Y,G){return n(g,E,x,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,G||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(M,F,_,re){return typeof _=="function"&&(re=_,_=null),N(M,F,_,re);function N(g,E,x,Y,G){return o(g,E,x,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,G||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(M,F,_,re){return typeof _=="function"&&(re=_,_=0),N(M,F,_,re);function N(g,E,x,Y,G){return a(g,E,x,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,G||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var l=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d(M,F,_){typeof F=="function"&&(_=F,F=null);var re=u.test(process.version)?function(E,x,Y,G){return l(E,N(E,x,Y,G))}:function(E,x,Y,G){return l(E,x,N(E,x,Y,G))};return re(M,F,_);function N(g,E,x,Y){return function(G,fe){G&&(G.code==="EMFILE"||G.code==="ENFILE")?Bh([re,[g,E,x],G,Y||Date.now(),Date.now()]):(fe&&fe.sort&&fe.sort(),typeof x=="function"&&x.call(this,G,fe))}}}if(process.version.substr(0,4)==="v0.8"){var f=HVe(t);S=f.ReadStream,w=f.WriteStream}var p=t.ReadStream;p&&(S.prototype=Object.create(p.prototype),S.prototype.open=b);var h=t.WriteStream;h&&(w.prototype=Object.create(h.prototype),w.prototype.open=T),Object.defineProperty(t,"ReadStream",{get:function(){return S},set:function(M){S=M},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return w},set:function(M){w=M},enumerable:!0,configurable:!0});var m=S;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(M){m=M},enumerable:!0,configurable:!0});var y=w;Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(M){y=M},enumerable:!0,configurable:!0});function S(M,F){return this instanceof S?(p.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function b(){var M=this;P(M.path,M.flags,M.mode,function(F,_){F?(M.autoClose&&M.destroy(),M.emit("error",F)):(M.fd=_,M.emit("open",_),M.read())})}function w(M,F){return this instanceof w?(h.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}function T(){var M=this;P(M.path,M.flags,M.mode,function(F,_){F?(M.destroy(),M.emit("error",F)):(M.fd=_,M.emit("open",_))})}function C(M,F){return new t.ReadStream(M,F)}function O(M,F){return new t.WriteStream(M,F)}var k=t.open;t.open=P;function P(M,F,_,re){return typeof _=="function"&&(re=_,_=null),N(M,F,_,re);function N(g,E,x,Y,G){return k(g,E,x,function(fe,$e){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,G||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}return t}function Bh(t){Lu("ENQUEUE",t[0].name,t[1]),wt[Sr].push(t),eG()}var iI;function tde(){for(var t=Date.now(),e=0;e<wt[Sr].length;++e)wt[Sr][e].length>2&&(wt[Sr][e][3]=t,wt[Sr][e][4]=t);eG()}function eG(){if(clearTimeout(iI),iI=void 0,wt[Sr].length!==0){var t=wt[Sr].shift(),e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(i===void 0)Lu("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Lu("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,c=Math.max(o-i,1),l=Math.min(c*1.2,100);a>=l?(Lu("RETRY",e.name,r),e.apply(null,r.concat([i]))):wt[Sr].push(t)}iI===void 0&&(iI=setTimeout(eG,0))}}});var _de=v(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.splitWhen=jh.flatten=void 0;function hHe(t){return t.reduce((e,r)=>[].concat(e,r),[])}jh.flatten=hHe;function mHe(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}jh.splitWhen=mHe});var yde=v(aI=>{"use strict";Object.defineProperty(aI,"__esModule",{value:!0});aI.isEnoentCodeError=void 0;function gHe(t){return t.code==="ENOENT"}aI.isEnoentCodeError=gHe});var Sde=v(cI=>{"use strict";Object.defineProperty(cI,"__esModule",{value:!0});cI.createDirentFromStats=void 0;var uG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function _He(t,e){return new uG(t,e)}cI.createDirentFromStats=_He});var bde=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.convertPosixPathToPattern=Bt.convertWindowsPathToPattern=Bt.convertPathToPattern=Bt.escapePosixPath=Bt.escapeWindowsPath=Bt.escape=Bt.removeLeadingDotSegment=Bt.makeAbsolute=Bt.unixify=void 0;var yHe=Z("os"),SHe=Z("path"),Ede=yHe.platform()==="win32",EHe=2,vHe=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,THe=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,bHe=/^\\\\([.?])/,AHe=/\\(?![!()+@[\]{}])/g;function wHe(t){return t.replace(/\\/g,"/")}Bt.unixify=wHe;function xHe(t,e){return SHe.resolve(t,e)}Bt.makeAbsolute=xHe;function RHe(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(EHe)}return t}Bt.removeLeadingDotSegment=RHe;Bt.escape=Ede?dG:fG;function dG(t){return t.replace(THe,"\\$2")}Bt.escapeWindowsPath=dG;function fG(t){return t.replace(vHe,"\\$2")}Bt.escapePosixPath=fG;Bt.convertPathToPattern=Ede?vde:Tde;function vde(t){return dG(t).replace(bHe,"//$1").replace(AHe,"/")}Bt.convertWindowsPathToPattern=vde;function Tde(t){return fG(t)}Bt.convertPosixPathToPattern=Tde});var wde=v((jzt,Ade)=>{"use strict";Ade.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Cde=v((zzt,Rde)=>{"use strict";var CHe=wde(),xde={"{":"}","(":")","[":"]"},IHe=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=xde[a];if(c){var l=t.indexOf(c,e);l!==-1&&(e=l+1)}if(t[e]==="!")return!0}else e++}return!1},PHe=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=xde[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Rde.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(CHe(e))return!0;var n=IHe;return r&&r.strict===!1&&(n=PHe),n(e)}});var Pde=v((Gzt,Ide)=>{"use strict";var OHe=Cde(),NHe=Z("path").posix.dirname,kHe=Z("os").platform()==="win32",pG="/",MHe=/\\/g,DHe=/[\{\[].*[\}\]]$/,LHe=/(^|[^\\])([\{\[]|\([^\)]+$)/,$He=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Ide.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&kHe&&e.indexOf(pG)<0&&(e=e.replace(MHe,pG)),DHe.test(e)&&(e+=pG),e+="a";do e=NHe(e);while(OHe(e)||LHe.test(e));return e.replace($He,"$1")}});var lI=v(ti=>{"use strict";ti.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;ti.find=(t,e)=>t.nodes.find(r=>r.type===e);ti.exceedsLimit=(t,e,r=1,n)=>n===!1||!ti.isInteger(t)||!ti.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;ti.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ti.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;ti.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;ti.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;ti.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);ti.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var uI=v((Vzt,Nde)=>{"use strict";var Ode=lI();Nde.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&Ode.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&Ode.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var Mde=v((Hzt,kde)=>{"use strict";kde.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var Gde=v((Wzt,zde)=>{"use strict";var Dde=Mde(),Uu=(t,e,r)=>{if(Dde(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Dde(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+o+s+a;if(Uu.cache.hasOwnProperty(c))return Uu.cache[c].result;let l=Math.min(t,e),u=Math.max(t,e);if(Math.abs(l-u)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let d=jde(t)||jde(e),f={min:t,max:e,a:l,b:u},p=[],h=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let m=u<0?Math.abs(u):1;h=Lde(m,Math.abs(l),f,n),l=f.a=0}return u>=0&&(p=Lde(l,u,f,n)),f.negatives=h,f.positives=p,f.result=UHe(h,p,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&p.length+h.length>1&&(f.result=`(?:${f.result})`),Uu.cache[c]=f,f.result};function UHe(t,e,r){let n=hG(t,e,"-",!1,r)||[],i=hG(e,t,"",!1,r)||[],o=hG(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function FHe(t,e){let r=1,n=1,i=Ude(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=Ude(t,r);for(i=Fde(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=Fde(e+1,n)-1;return o=[...o],o.sort(zHe),o}function BHe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=jHe(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[c,l]=n[a];c===l?o+=c:c!=="0"||l!=="9"?o+=GHe(c,l,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Lde(t,e,r,n){let i=FHe(t,e),o=[],s=t,a;for(let c=0;c<i.length;c++){let l=i[c],u=BHe(String(s),String(l),n),d="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+Bde(a.count),s=l+1;continue}r.isPadded&&(d=qHe(l,r,n)),u.string=d+u.pattern+Bde(u.count),o.push(u),s=l+1,a=u}return o}function hG(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!$de(e,"string",a)&&o.push(r+a),n&&$de(e,"string",a)&&o.push(r+a)}return o}function jHe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function zHe(t,e){return t>e?1:e>t?-1:0}function $de(t,e,r){return t.some(n=>n[e]===r)}function Ude(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Fde(t,e){return t-t%Math.pow(10,e)}function Bde(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function GHe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function jde(t){return/^-?(0+)\d/.test(t)}function qHe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}Uu.cache={};Uu.clearCache=()=>Uu.cache={};zde.exports=Uu});var _G=v((Yzt,Zde)=>{"use strict";var VHe=Z("util"),Vde=Gde(),qde=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),HHe=t=>e=>t===!0?Number(e):String(e),mG=t=>typeof t=="number"||typeof t=="string"&&t!=="",IS=t=>Number.isInteger(+t),gG=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},WHe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,YHe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},fI=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},KHe=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>fI(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>fI(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},Hde=(t,e,r,n)=>{if(r)return Vde(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},Wde=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return Vde(t,e,r)},Yde=(...t)=>new RangeError("Invalid range arguments: "+VHe.inspect(...t)),Kde=(t,e,r)=>{if(r.strictRanges===!0)throw Yde([t,e]);return[]},ZHe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},JHe=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw Yde([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),c=String(e),l=String(r);r=Math.max(Math.abs(r),1);let u=gG(a)||gG(c)||gG(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&WHe(t,e,n)===!1,p=n.transform||HHe(f);if(n.toRegex&&r===1)return Hde(fI(t,d),fI(e,d),!0,n);let h={negatives:[],positives:[]},m=b=>h[b<0?"negatives":"positives"].push(Math.abs(b)),y=[],S=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?m(i):y.push(YHe(p(i,S),d,f)),i=s?i-r:i+r,S++;return n.toRegex===!0?r>1?KHe(h,n,d):Wde(y,null,{wrap:!1,...n}):y},XHe=(t,e,r=1,n={})=>{if(!IS(t)&&t.length>1||!IS(e)&&e.length>1)return Kde(t,e,n);let i=n.transform||(f=>String.fromCharCode(f)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,c=Math.min(o,s),l=Math.max(o,s);if(n.toRegex&&r===1)return Hde(c,l,!1,n);let u=[],d=0;for(;a?o>=s:o<=s;)u.push(i(o,d)),o=a?o-r:o+r,d++;return n.toRegex===!0?Wde(u,null,{wrap:!1,options:n}):u},dI=(t,e,r,n={})=>{if(e==null&&mG(t))return[t];if(!mG(t)||!mG(e))return Kde(t,e,n);if(typeof r=="function")return dI(t,e,1,{transform:r});if(qde(r))return dI(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,IS(r)?IS(t)&&IS(e)?JHe(t,e,r,i):XHe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!qde(r)?ZHe(r,i):dI(t,e,1,r)};Zde.exports=dI});var Qde=v((Kzt,Xde)=>{"use strict";var QHe=_G(),Jde=lI(),e6e=(t,e={})=>{let r=(n,i={})=>{let o=Jde.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,c=e.escapeInvalid===!0?"\\":"",l="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=Jde.reduce(n.nodes),d=QHe(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let u of n.nodes)l+=r(u,n);return l};return r(t)};Xde.exports=e6e});var rfe=v((Zzt,tfe)=>{"use strict";var t6e=_G(),efe=uI(),zh=lI(),Fu=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?zh.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(Fu(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?Fu(i,o,r):i+o);return zh.flatten(n)},r6e=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(Fu(a.pop(),efe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(Fu(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let d=zh.reduce(i.nodes);if(zh.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=t6e(...d,e);f.length===0&&(f=efe(i,e)),a.push(Fu(a.pop(),f)),i.nodes=[];return}let c=zh.encloseBrace(i),l=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<i.nodes.length;d++){let f=i.nodes[d];if(f.type==="comma"&&i.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(Fu(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(Fu(l.pop(),f.value));continue}f.nodes&&n(f,i)}return l};return zh.flatten(n(t))};tfe.exports=r6e});var ife=v((Jzt,nfe)=>{"use strict";nfe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
24
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var lfe=v((Xzt,cfe)=>{"use strict";var n6e=uI(),{MAX_LENGTH:ofe,CHAR_BACKSLASH:yG,CHAR_BACKTICK:i6e,CHAR_COMMA:o6e,CHAR_DOT:s6e,CHAR_LEFT_PARENTHESES:a6e,CHAR_RIGHT_PARENTHESES:c6e,CHAR_LEFT_CURLY_BRACE:l6e,CHAR_RIGHT_CURLY_BRACE:u6e,CHAR_LEFT_SQUARE_BRACKET:sfe,CHAR_RIGHT_SQUARE_BRACKET:afe,CHAR_DOUBLE_QUOTE:d6e,CHAR_SINGLE_QUOTE:f6e,CHAR_NO_BREAK_SPACE:p6e,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h6e}=ife(),m6e=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(ofe,r.maxLength):ofe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},o=[i],s=i,a=i,c=0,l=t.length,u=0,d=0,f,p=()=>t[u++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return s.nodes.push(m),m.parent=s,m.prev=a,a=m,m};for(h({type:"bos"});u<l;)if(s=o[o.length-1],f=p(),!(f===h6e||f===p6e)){if(f===yG){h({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===afe){h({type:"text",value:"\\"+f});continue}if(f===sfe){c++;let m;for(;u<l&&(m=p());){if(f+=m,m===sfe){c++;continue}if(m===yG){f+=p();continue}if(m===afe&&(c--,c===0))break}h({type:"text",value:f});continue}if(f===a6e){s=h({type:"paren",nodes:[]}),o.push(s),h({type:"text",value:f});continue}if(f===c6e){if(s.type!=="paren"){h({type:"text",value:f});continue}s=o.pop(),h({type:"text",value:f}),s=o[o.length-1];continue}if(f===d6e||f===f6e||f===i6e){let m=f,y;for(e.keepQuotes!==!0&&(f="");u<l&&(y=p());){if(y===yG){f+=y+p();continue}if(y===m){e.keepQuotes===!0&&(f+=y);break}f+=y}h({type:"text",value:f});continue}if(f===l6e){d++;let y={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};s=h(y),o.push(s),h({type:"open",value:f});continue}if(f===u6e){if(s.type!=="brace"){h({type:"text",value:f});continue}let m="close";s=o.pop(),s.close=!0,h({type:m,value:f}),d--,s=o[o.length-1];continue}if(f===o6e&&d>0){if(s.ranges>0){s.ranges=0;let m=s.nodes.shift();s.nodes=[m,{type:"text",value:n6e(s)}]}h({type:"comma",value:f}),s.commas++;continue}if(f===s6e&&d>0&&s.commas===0){let m=s.nodes;if(d===0||m.length===0){h({type:"text",value:f});continue}if(a.type==="dot"){if(s.range=[],a.value+=f,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){m.pop();let y=m[m.length-1];y.value+=a.value+f,a=y,s.ranges--;continue}h({type:"dot",value:f});continue}h({type:"text",value:f})}do if(s=o.pop(),s.type!=="root"){s.nodes.forEach(S=>{S.nodes||(S.type==="open"&&(S.isOpen=!0),S.type==="close"&&(S.isClose=!0),S.nodes||(S.type="text"),S.invalid=!0)});let m=o[o.length-1],y=m.nodes.indexOf(s);m.nodes.splice(y,1,...s.nodes)}while(o.length>0);return h({type:"eos"}),i};cfe.exports=m6e});var ffe=v((Qzt,dfe)=>{"use strict";var ufe=uI(),g6e=Qde(),_6e=rfe(),y6e=lfe(),On=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=On.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(On.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};On.parse=(t,e={})=>y6e(t,e);On.stringify=(t,e={})=>ufe(typeof t=="string"?On.parse(t,e):t,e);On.compile=(t,e={})=>(typeof t=="string"&&(t=On.parse(t,e)),g6e(t,e));On.expand=(t,e={})=>{typeof t=="string"&&(t=On.parse(t,e));let r=_6e(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};On.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?On.compile(t,e):On.expand(t,e);dfe.exports=On});var PS=v((eGt,_fe)=>{"use strict";var S6e=Z("path"),Lo="\\\\/",pfe=`[^${Lo}]`,E6e=0,Ys="\\.",v6e="\\+",T6e="\\?",pI="\\/",b6e="(?=.)",hfe="[^/]",SG=`(?:${pI}|$)`,mfe=`(?:^|${pI})`,EG=`${Ys}{1,2}${SG}`,A6e=`(?!${Ys})`,w6e=`(?!${mfe}${EG})`,x6e=`(?!${Ys}{0,1}${SG})`,R6e=`(?!${EG})`,C6e=`[^.${pI}]`,I6e=`${hfe}*?`,gfe={DOT_LITERAL:Ys,PLUS_LITERAL:v6e,QMARK_LITERAL:T6e,SLASH_LITERAL:pI,ONE_CHAR:b6e,QMARK:hfe,END_ANCHOR:SG,DOTS_SLASH:EG,NO_DOT:A6e,NO_DOTS:w6e,NO_DOT_SLASH:x6e,NO_DOTS_SLASH:R6e,QMARK_NO_DOT:C6e,STAR:I6e,START_ANCHOR:mfe},P6e={...gfe,SLASH_LITERAL:`[${Lo}]`,QMARK:pfe,STAR:`${pfe}*?`,DOTS_SLASH:`${Ys}{1,2}(?:[${Lo}]|$)`,NO_DOT:`(?!${Ys})`,NO_DOTS:`(?!(?:^|[${Lo}])${Ys}{1,2}(?:[${Lo}]|$))`,NO_DOT_SLASH:`(?!${Ys}{0,1}(?:[${Lo}]|$))`,NO_DOTS_SLASH:`(?!${Ys}{1,2}(?:[${Lo}]|$))`,QMARK_NO_DOT:`[^.${Lo}]`,START_ANCHOR:`(?:^|[${Lo}])`,END_ANCHOR:`(?:[${Lo}]|$)`},O6e={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_fe.exports={DEFAULT_MAX_EXTGLOB_RECURSION:E6e,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:O6e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:S6e.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?P6e:gfe}}});var OS=v(ln=>{"use strict";var N6e=Z("path"),k6e=process.platform==="win32",{REGEX_BACKSLASH:M6e,REGEX_REMOVE_BACKSLASH:D6e,REGEX_SPECIAL_CHARS:L6e,REGEX_SPECIAL_CHARS_GLOBAL:$6e}=PS();ln.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ln.hasRegexChars=t=>L6e.test(t);ln.isRegexChar=t=>t.length===1&&ln.hasRegexChars(t);ln.escapeRegex=t=>t.replace($6e,"\\$1");ln.toPosixSlashes=t=>t.replace(M6e,"/");ln.removeBackslashes=t=>t.replace(D6e,e=>e==="\\"?"":e);ln.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};ln.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:k6e===!0||N6e.sep==="\\";ln.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?ln.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};ln.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};ln.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var wfe=v((rGt,Afe)=>{"use strict";var yfe=OS(),{CHAR_ASTERISK:vG,CHAR_AT:U6e,CHAR_BACKWARD_SLASH:NS,CHAR_COMMA:F6e,CHAR_DOT:TG,CHAR_EXCLAMATION_MARK:bG,CHAR_FORWARD_SLASH:bfe,CHAR_LEFT_CURLY_BRACE:AG,CHAR_LEFT_PARENTHESES:wG,CHAR_LEFT_SQUARE_BRACKET:B6e,CHAR_PLUS:j6e,CHAR_QUESTION_MARK:Sfe,CHAR_RIGHT_CURLY_BRACE:z6e,CHAR_RIGHT_PARENTHESES:Efe,CHAR_RIGHT_SQUARE_BRACKET:G6e}=PS(),vfe=t=>t===bfe||t===NS,Tfe=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},q6e=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,h=!1,m=!1,y=!1,S=!1,b=!1,w=!1,T=!1,C=!1,O=0,k,P,M={value:"",depth:0,isGlob:!1},F=()=>l>=n,_=()=>c.charCodeAt(l+1),re=()=>(k=P,c.charCodeAt(++l));for(;l<n;){P=re();let Y;if(P===NS){b=M.backslashes=!0,P=re(),P===AG&&(S=!0);continue}if(S===!0||P===AG){for(O++;F()!==!0&&(P=re());){if(P===NS){b=M.backslashes=!0,re();continue}if(P===AG){O++;continue}if(S!==!0&&P===TG&&(P=re())===TG){if(f=M.isBrace=!0,h=M.isGlob=!0,C=!0,i===!0)continue;break}if(S!==!0&&P===F6e){if(f=M.isBrace=!0,h=M.isGlob=!0,C=!0,i===!0)continue;break}if(P===z6e&&(O--,O===0)){S=!1,f=M.isBrace=!0,C=!0;break}}if(i===!0)continue;break}if(P===bfe){if(o.push(l),s.push(M),M={value:"",depth:0,isGlob:!1},C===!0)continue;if(k===TG&&l===u+1){u+=2;continue}d=l+1;continue}if(r.noext!==!0&&(P===j6e||P===U6e||P===vG||P===Sfe||P===bG)===!0&&_()===wG){if(h=M.isGlob=!0,m=M.isExtglob=!0,C=!0,P===bG&&l===u&&(T=!0),i===!0){for(;F()!==!0&&(P=re());){if(P===NS){b=M.backslashes=!0,P=re();continue}if(P===Efe){h=M.isGlob=!0,C=!0;break}}continue}break}if(P===vG){if(k===vG&&(y=M.isGlobstar=!0),h=M.isGlob=!0,C=!0,i===!0)continue;break}if(P===Sfe){if(h=M.isGlob=!0,C=!0,i===!0)continue;break}if(P===B6e){for(;F()!==!0&&(Y=re());){if(Y===NS){b=M.backslashes=!0,re();continue}if(Y===G6e){p=M.isBracket=!0,h=M.isGlob=!0,C=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&P===bG&&l===u){w=M.negated=!0,u++;continue}if(r.noparen!==!0&&P===wG){if(h=M.isGlob=!0,i===!0){for(;F()!==!0&&(P=re());){if(P===wG){b=M.backslashes=!0,P=re();continue}if(P===Efe){C=!0;break}}continue}break}if(h===!0){if(C=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let N=c,g="",E="";u>0&&(g=c.slice(0,u),c=c.slice(u),d-=u),N&&h===!0&&d>0?(N=c.slice(0,d),E=c.slice(d)):h===!0?(N="",E=c):N=c,N&&N!==""&&N!=="/"&&N!==c&&vfe(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),r.unescape===!0&&(E&&(E=yfe.removeBackslashes(E)),N&&b===!0&&(N=yfe.removeBackslashes(N)));let x={prefix:g,input:t,start:u,base:N,glob:E,isBrace:f,isBracket:p,isGlob:h,isExtglob:m,isGlobstar:y,negated:w,negatedExtglob:T};if(r.tokens===!0&&(x.maxDepth=0,vfe(P)||s.push(M),x.tokens=s),r.parts===!0||r.tokens===!0){let Y;for(let G=0;G<o.length;G++){let fe=Y?Y+1:u,$e=o[G],Ie=t.slice(fe,$e);r.tokens&&(G===0&&u!==0?(s[G].isPrefix=!0,s[G].value=g):s[G].value=Ie,Tfe(s[G]),x.maxDepth+=s[G].depth),(G!==0||Ie!=="")&&a.push(Ie),Y=$e}if(Y&&Y+1<t.length){let G=t.slice(Y+1);a.push(G),r.tokens&&(s[s.length-1].value=G,Tfe(s[s.length-1]),x.maxDepth+=s[s.length-1].depth)}x.slashes=o,x.parts=a}return x};Afe.exports=q6e});var Pfe=v((nGt,Ife)=>{"use strict";var kS=PS(),Cr=OS(),{MAX_LENGTH:hI,POSIX_REGEX_SOURCE:V6e,REGEX_NON_SPECIAL_CHARS:H6e,REGEX_SPECIAL_CHARS_BACKREF:W6e,REPLACEMENTS:xfe}=kS,Y6e=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Cr.escapeRegex(i)).join("..")}return r},Gh=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Rfe=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},K6e=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},Cfe=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(K6e(e))return e.replace(/\\(.)/g,"$1")},Z6e=t=>{let e=t.map(Cfe).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],o=e[n],s=i[0];if(!(!s||i!==s.repeat(i.length)||o!==s.repeat(o.length))&&(i===o||i.startsWith(o)||o.startsWith(i)))return!0}return!1},xG=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s<t.length;s++){let a=t[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},J6e=t=>{let e=0,r=[];for(;e<t.length;){let i=xG(t.slice(e),!1);if(!i||i.type!=="*")return;let o=Rfe(i.body).map(a=>a.trim());if(o.length!==1)return;let s=Cfe(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Cr.escapeRegex(r[0]):`[${r.map(i=>Cr.escapeRegex(i)).join("")}]`}*`},X6e=t=>{let e=0,r=t.trim(),n=xG(r);for(;n;)e++,r=n.body.trim(),n=xG(r);return e},Q6e=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kS.DEFAULT_MAX_EXTGLOB_RECURSION,n=Rfe(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||Z6e(n)))return{risky:!0};for(let i of n){let o=J6e(i);if(o)return{risky:!0,safeOutput:o};if(X6e(i)>r)return{risky:!0}}return{risky:!1}},RG=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=xfe[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(hI,r.maxLength):hI,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Cr.isWindows(e),l=kS.globChars(c),u=kS.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:y,NO_DOT_SLASH:S,NO_DOTS_SLASH:b,QMARK:w,QMARK_NO_DOT:T,STAR:C,START_ANCHOR:O}=l,k=H=>`(${a}(?:(?!${O}${H.dot?m:d}).)*?)`,P=r.dot?"":y,M=r.dot?w:T,F=r.bash===!0?k(r):C;r.capture&&(F=`(${F})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Cr.removePrefix(t,_),i=t.length;let re=[],N=[],g=[],E=o,x,Y=()=>_.index===i-1,G=_.peek=(H=1)=>t[_.index+H],fe=_.advance=()=>t[++_.index]||"",$e=()=>t.slice(_.index+1),Ie=(H="",le=0)=>{_.consumed+=H,_.index+=le},Pe=H=>{_.output+=H.output!=null?H.output:H.value,Ie(H.value)},xe=()=>{let H=1;for(;G()==="!"&&(G(2)!=="("||G(3)==="?");)fe(),_.start++,H++;return H%2===0?!1:(_.negated=!0,_.start++,!0)},Fe=H=>{_[H]++,g.push(H)},Re=H=>{_[H]--,g.pop()},ce=H=>{if(E.type==="globstar"){let le=_.braces>0&&(H.type==="comma"||H.type==="brace"),R=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!le&&!R&&(_.output=_.output.slice(0,-E.output.length),E.type="star",E.value="*",E.output=F,_.output+=E.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Pe(H),E&&E.type==="text"&&H.type==="text"){E.value+=H.value,E.output=(E.output||"")+H.value;return}H.prev=E,s.push(H),E=H},_e=(H,le)=>{let R={...u[le],conditions:1,inner:""};R.prev=E,R.parens=_.parens,R.output=_.output,R.startIndex=_.index,R.tokensIndex=s.length;let I=(r.capture?"(":"")+R.open;Fe("parens"),ce({type:H,value:le,output:_.output?"":h}),ce({type:"paren",extglob:!0,value:fe(),output:I}),re.push(R)},qe=H=>{let le=t.slice(H.startIndex,_.index+1),R=t.slice(H.startIndex+2,_.index),I=Q6e(R,r);if((H.type==="plus"||H.type==="star")&&I.risky){let q=I.safeOutput?(H.output?"":h)+(r.capture?`(${I.safeOutput})`:I.safeOutput):void 0,ee=s[H.tokensIndex];ee.type="text",ee.value=le,ee.output=q||Cr.escapeRegex(le);for(let se=H.tokensIndex+1;se<s.length;se++)s[se].value="",s[se].output="",delete s[se].suffix;_.output=H.output+ee.output,_.backtrack=!0,ce({type:"paren",extglob:!0,value:x,output:""}),Re("parens");return}let U=H.close+(r.capture?")":""),j;if(H.type==="negate"){let q=F;if(H.inner&&H.inner.length>1&&H.inner.includes("/")&&(q=k(r)),(q!==F||Y()||/^\)+$/.test($e()))&&(U=H.close=`)$))${q}`),H.inner.includes("*")&&(j=$e())&&/^\.[^\\/.]+$/.test(j)){let ee=RG(j,{...e,fastpaths:!1}).output;U=H.close=`)${ee})${q})`}H.prev.type==="bos"&&(_.negatedExtglob=!0)}ce({type:"paren",extglob:!0,value:x,output:U}),Re("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,le=t.replace(W6e,(R,I,U,j,q,ee)=>j==="\\"?(H=!0,R):j==="?"?I?I+j+(q?w.repeat(q.length):""):ee===0?M+(q?w.repeat(q.length):""):w.repeat(U.length):j==="."?d.repeat(U.length):j==="*"?I?I+j+(q?F:""):F:I?R:`\\${R}`);return H===!0&&(r.unescape===!0?le=le.replace(/\\/g,""):le=le.replace(/\\+/g,R=>R.length%2===0?"\\\\":R?"\\":"")),le===t&&r.contains===!0?(_.output=t,_):(_.output=Cr.wrapOutput(le,_,e),_)}for(;!Y();){if(x=fe(),x==="\0")continue;if(x==="\\"){let R=G();if(R==="/"&&r.bash!==!0||R==="."||R===";")continue;if(!R){x+="\\",ce({type:"text",value:x});continue}let I=/^\\+/.exec($e()),U=0;if(I&&I[0].length>2&&(U=I[0].length,_.index+=U,U%2!==0&&(x+="\\")),r.unescape===!0?x=fe():x+=fe(),_.brackets===0){ce({type:"text",value:x});continue}}if(_.brackets>0&&(x!=="]"||E.value==="["||E.value==="[^")){if(r.posix!==!1&&x===":"){let R=E.value.slice(1);if(R.includes("[")&&(E.posix=!0,R.includes(":"))){let I=E.value.lastIndexOf("["),U=E.value.slice(0,I),j=E.value.slice(I+2),q=V6e[j];if(q){E.value=U+q,_.backtrack=!0,fe(),!o.output&&s.indexOf(E)===1&&(o.output=h);continue}}}(x==="["&&G()!==":"||x==="-"&&G()==="]")&&(x=`\\${x}`),x==="]"&&(E.value==="["||E.value==="[^")&&(x=`\\${x}`),r.posix===!0&&x==="!"&&E.value==="["&&(x="^"),E.value+=x,Pe({value:x});continue}if(_.quotes===1&&x!=='"'){x=Cr.escapeRegex(x),E.value+=x,Pe({value:x});continue}if(x==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&ce({type:"text",value:x});continue}if(x==="("){Fe("parens"),ce({type:"paren",value:x});continue}if(x===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Gh("opening","("));let R=re[re.length-1];if(R&&_.parens===R.parens+1){qe(re.pop());continue}ce({type:"paren",value:x,output:_.parens?")":"\\)"}),Re("parens");continue}if(x==="["){if(r.nobracket===!0||!$e().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Gh("closing","]"));x=`\\${x}`}else Fe("brackets");ce({type:"bracket",value:x});continue}if(x==="]"){if(r.nobracket===!0||E&&E.type==="bracket"&&E.value.length===1){ce({type:"text",value:x,output:`\\${x}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Gh("opening","["));ce({type:"text",value:x,output:`\\${x}`});continue}Re("brackets");let R=E.value.slice(1);if(E.posix!==!0&&R[0]==="^"&&!R.includes("/")&&(x=`/${x}`),E.value+=x,Pe({value:x}),r.literalBrackets===!1||Cr.hasRegexChars(R))continue;let I=Cr.escapeRegex(E.value);if(_.output=_.output.slice(0,-E.value.length),r.literalBrackets===!0){_.output+=I,E.value=I;continue}E.value=`(${a}${I}|${E.value})`,_.output+=E.value;continue}if(x==="{"&&r.nobrace!==!0){Fe("braces");let R={type:"brace",value:x,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};N.push(R),ce(R);continue}if(x==="}"){let R=N[N.length-1];if(r.nobrace===!0||!R){ce({type:"text",value:x,output:x});continue}let I=")";if(R.dots===!0){let U=s.slice(),j=[];for(let q=U.length-1;q>=0&&(s.pop(),U[q].type!=="brace");q--)U[q].type!=="dots"&&j.unshift(U[q].value);I=Y6e(j,r),_.backtrack=!0}if(R.comma!==!0&&R.dots!==!0){let U=_.output.slice(0,R.outputIndex),j=_.tokens.slice(R.tokensIndex);R.value=R.output="\\{",x=I="\\}",_.output=U;for(let q of j)_.output+=q.output||q.value}ce({type:"brace",value:x,output:I}),Re("braces"),N.pop();continue}if(x==="|"){re.length>0&&re[re.length-1].conditions++,ce({type:"text",value:x});continue}if(x===","){let R=x,I=N[N.length-1];I&&g[g.length-1]==="braces"&&(I.comma=!0,R="|"),ce({type:"comma",value:x,output:R});continue}if(x==="/"){if(E.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),E=o;continue}ce({type:"slash",value:x,output:p});continue}if(x==="."){if(_.braces>0&&E.type==="dot"){E.value==="."&&(E.output=d);let R=N[N.length-1];E.type="dots",E.output+=x,E.value+=x,R.dots=!0;continue}if(_.braces+_.parens===0&&E.type!=="bos"&&E.type!=="slash"){ce({type:"text",value:x,output:d});continue}ce({type:"dot",value:x,output:d});continue}if(x==="?"){if(!(E&&E.value==="(")&&r.noextglob!==!0&&G()==="("&&G(2)!=="?"){_e("qmark",x);continue}if(E&&E.type==="paren"){let I=G(),U=x;if(I==="<"&&!Cr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(E.value==="("&&!/[!=<:]/.test(I)||I==="<"&&!/<([!=]|\w+>)/.test($e()))&&(U=`\\${x}`),ce({type:"text",value:x,output:U});continue}if(r.dot!==!0&&(E.type==="slash"||E.type==="bos")){ce({type:"qmark",value:x,output:T});continue}ce({type:"qmark",value:x,output:w});continue}if(x==="!"){if(r.noextglob!==!0&&G()==="("&&(G(2)!=="?"||!/[!=<:]/.test(G(3)))){_e("negate",x);continue}if(r.nonegate!==!0&&_.index===0){xe();continue}}if(x==="+"){if(r.noextglob!==!0&&G()==="("&&G(2)!=="?"){_e("plus",x);continue}if(E&&E.value==="("||r.regex===!1){ce({type:"plus",value:x,output:f});continue}if(E&&(E.type==="bracket"||E.type==="paren"||E.type==="brace")||_.parens>0){ce({type:"plus",value:x});continue}ce({type:"plus",value:f});continue}if(x==="@"){if(r.noextglob!==!0&&G()==="("&&G(2)!=="?"){ce({type:"at",extglob:!0,value:x,output:""});continue}ce({type:"text",value:x});continue}if(x!=="*"){(x==="$"||x==="^")&&(x=`\\${x}`);let R=H6e.exec($e());R&&(x+=R[0],_.index+=R[0].length),ce({type:"text",value:x});continue}if(E&&(E.type==="globstar"||E.star===!0)){E.type="star",E.star=!0,E.value+=x,E.output=F,_.backtrack=!0,_.globstar=!0,Ie(x);continue}let H=$e();if(r.noextglob!==!0&&/^\([^?]/.test(H)){_e("star",x);continue}if(E.type==="star"){if(r.noglobstar===!0){Ie(x);continue}let R=E.prev,I=R.prev,U=R.type==="slash"||R.type==="bos",j=I&&(I.type==="star"||I.type==="globstar");if(r.bash===!0&&(!U||H[0]&&H[0]!=="/")){ce({type:"star",value:x,output:""});continue}let q=_.braces>0&&(R.type==="comma"||R.type==="brace"),ee=re.length&&(R.type==="pipe"||R.type==="paren");if(!U&&R.type!=="paren"&&!q&&!ee){ce({type:"star",value:x,output:""});continue}for(;H.slice(0,3)==="/**";){let se=t[_.index+4];if(se&&se!=="/")break;H=H.slice(3),Ie("/**",3)}if(R.type==="bos"&&Y()){E.type="globstar",E.value+=x,E.output=k(r),_.output=E.output,_.globstar=!0,Ie(x);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&!j&&Y()){_.output=_.output.slice(0,-(R.output+E.output).length),R.output=`(?:${R.output}`,E.type="globstar",E.output=k(r)+(r.strictSlashes?")":"|$)"),E.value+=x,_.globstar=!0,_.output+=R.output+E.output,Ie(x);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&H[0]==="/"){let se=H[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(R.output+E.output).length),R.output=`(?:${R.output}`,E.type="globstar",E.output=`${k(r)}${p}|${p}${se})`,E.value+=x,_.output+=R.output+E.output,_.globstar=!0,Ie(x+fe()),ce({type:"slash",value:"/",output:""});continue}if(R.type==="bos"&&H[0]==="/"){E.type="globstar",E.value+=x,E.output=`(?:^|${p}|${k(r)}${p})`,_.output=E.output,_.globstar=!0,Ie(x+fe()),ce({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-E.output.length),E.type="globstar",E.output=k(r),E.value+=x,_.output+=E.output,_.globstar=!0,Ie(x);continue}let le={type:"star",value:x,output:F};if(r.bash===!0){le.output=".*?",(E.type==="bos"||E.type==="slash")&&(le.output=P+le.output),ce(le);continue}if(E&&(E.type==="bracket"||E.type==="paren")&&r.regex===!0){le.output=x,ce(le);continue}(_.index===_.start||E.type==="slash"||E.type==="dot")&&(E.type==="dot"?(_.output+=S,E.output+=S):r.dot===!0?(_.output+=b,E.output+=b):(_.output+=P,E.output+=P),G()!=="*"&&(_.output+=h,E.output+=h)),ce(le)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Gh("closing","]"));_.output=Cr.escapeLast(_.output,"["),Re("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Gh("closing",")"));_.output=Cr.escapeLast(_.output,"("),Re("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Gh("closing","}"));_.output=Cr.escapeLast(_.output,"{"),Re("braces")}if(r.strictSlashes!==!0&&(E.type==="star"||E.type==="bracket")&&ce({type:"maybe_slash",value:"",output:`${p}?`}),_.backtrack===!0){_.output="";for(let H of _.tokens)_.output+=H.output!=null?H.output:H.value,H.suffix&&(_.output+=H.suffix)}return _};RG.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(hI,r.maxLength):hI,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=xfe[t]||t;let o=Cr.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:h}=kS.globChars(o),m=r.dot?d:u,y=r.dot?f:u,S=r.capture?"":"?:",b={negated:!1,prefix:""},w=r.bash===!0?".*?":p;r.capture&&(w=`(${w})`);let T=P=>P.noglobstar===!0?w:`(${S}(?:(?!${h}${P.dot?l:s}).)*?)`,C=P=>{switch(P){case"*":return`${m}${c}${w}`;case".*":return`${s}${c}${w}`;case"*.*":return`${m}${w}${s}${c}${w}`;case"*/*":return`${m}${w}${a}${c}${y}${w}`;case"**":return m+T(r);case"**/*":return`(?:${m}${T(r)}${a})?${y}${c}${w}`;case"**/*.*":return`(?:${m}${T(r)}${a})?${y}${w}${s}${c}${w}`;case"**/.*":return`(?:${m}${T(r)}${a})?${s}${c}${w}`;default:{let M=/^(.*?)\.(\w+)$/.exec(P);if(!M)return;let F=C(M[1]);return F?F+s+M[2]:void 0}}},O=Cr.removePrefix(t,b),k=C(O);return k&&r.strictSlashes!==!0&&(k+=`${a}?`),k};Ife.exports=RG});var Nfe=v((iGt,Ofe)=>{"use strict";var eWe=Z("path"),tWe=wfe(),CG=Pfe(),IG=OS(),rWe=PS(),nWe=t=>t&&typeof t=="object"&&!Array.isArray(t),Lt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Lt(f,e,r));return f=>{for(let p of u){let h=p(f);if(h)return h}return!1}}let n=nWe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=IG.isWindows(e),s=n?Lt.compileRe(t,e):Lt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Lt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:h}=Lt.test(u,s,e,{glob:t,posix:o}),m={glob:t,state:a,regex:s,posix:o,input:u,output:h,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};Lt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?IG.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Lt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Lt.matchBase=(t,e,r,n=IG.isWindows(r))=>(e instanceof RegExp?e:Lt.makeRe(e,r)).test(eWe.basename(t));Lt.isMatch=(t,e,r)=>Lt(e,r)(t);Lt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Lt.parse(r,e)):CG(t,{...e,fastpaths:!1});Lt.scan=(t,e)=>tWe(t,e);Lt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Lt.toRegex(a,e);return n===!0&&(c.state=t),c};Lt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=CG.fastpaths(t,e)),i.output||(i=CG(t,e)),Lt.compileRe(i,e,r,n)};Lt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Lt.constants=rWe;Ofe.exports=Lt});var Mfe=v((oGt,kfe)=>{"use strict";kfe.exports=Nfe()});var OG=v((sGt,Ffe)=>{"use strict";var Lfe=Z("util"),$fe=ffe(),$o=Mfe(),PG=OS(),Dfe=t=>t===""||t==="./",Ufe=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Et=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,o=new Set,s=0,a=u=>{o.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let d=$o(String(e[u]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&s++;for(let p of t){let h=d(p,!0);(f?!h.isMatch:h.isMatch)&&(f?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let l=(s===e.length?[...o]:[...i]).filter(u=>!n.has(u));if(r&&l.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return l};Et.match=Et;Et.matcher=(t,e)=>$o(t,e);Et.isMatch=(t,e,r)=>$o(e,r)(t);Et.any=Et.isMatch;Et.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],o=a=>{r.onResult&&r.onResult(a),i.push(a.output)},s=new Set(Et(t,e,{...r,onResult:o}));for(let a of i)s.has(a)||n.add(a);return[...n]};Et.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Et.contains(t,n,r));if(typeof e=="string"){if(Dfe(t)||Dfe(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Et.isMatch(t,e,{...r,contains:!0})};Et.matchKeys=(t,e,r)=>{if(!PG.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Et(Object.keys(t),e,r),i={};for(let o of n)i[o]=t[o];return i};Et.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(n.some(s=>o(s)))return!0}return!1};Et.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(!n.every(s=>o(s)))return!1}return!0};Et.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);return[].concat(e).every(n=>$o(n,r)(t))};Et.capture=(t,e,r)=>{let n=PG.isWindows(r),o=$o.makeRe(String(t),{...r,capture:!0}).exec(n?PG.toPosixSlashes(e):e);if(o)return o.slice(1).map(s=>s===void 0?"":s)};Et.makeRe=(...t)=>$o.makeRe(...t);Et.scan=(...t)=>$o.scan(...t);Et.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of $fe(String(n),e))r.push($o.parse(i,e));return r};Et.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!Ufe(t)?[t]:$fe(t,e)};Et.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Et.braces(t,{...e,expand:!0})};Et.hasBraces=Ufe;Ffe.exports=Et});var Kfe=v(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.isAbsolute=Ne.partitionAbsoluteAndRelative=Ne.removeDuplicateSlashes=Ne.matchAny=Ne.convertPatternsToRe=Ne.makeRe=Ne.getPatternParts=Ne.expandBraceExpansion=Ne.expandPatternsWithBraceExpansion=Ne.isAffectDepthOfReadingPattern=Ne.endsWithSlashGlobStar=Ne.hasGlobStar=Ne.getBaseDirectory=Ne.isPatternRelatedToParentDirectory=Ne.getPatternsOutsideCurrentDirectory=Ne.getPatternsInsideCurrentDirectory=Ne.getPositivePatterns=Ne.getNegativePatterns=Ne.isPositivePattern=Ne.isNegativePattern=Ne.convertToNegativePattern=Ne.convertToPositivePattern=Ne.isDynamicPattern=Ne.isStaticPattern=void 0;var Bfe=Z("path"),iWe=Pde(),NG=OG(),jfe="**",oWe="\\",sWe=/[*?]|^!/,aWe=/\[[^[]*]/,cWe=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,lWe=/[!*+?@]\([^(]*\)/,uWe=/,|\.\./,dWe=/(?!^)\/{2,}/g;function zfe(t,e={}){return!Gfe(t,e)}Ne.isStaticPattern=zfe;function Gfe(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(oWe)||sWe.test(t)||aWe.test(t)||cWe.test(t)||e.extglob!==!1&&lWe.test(t)||e.braceExpansion!==!1&&fWe(t))}Ne.isDynamicPattern=Gfe;function fWe(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return uWe.test(n)}function pWe(t){return mI(t)?t.slice(1):t}Ne.convertToPositivePattern=pWe;function hWe(t){return"!"+t}Ne.convertToNegativePattern=hWe;function mI(t){return t.startsWith("!")&&t[1]!=="("}Ne.isNegativePattern=mI;function qfe(t){return!mI(t)}Ne.isPositivePattern=qfe;function mWe(t){return t.filter(mI)}Ne.getNegativePatterns=mWe;function gWe(t){return t.filter(qfe)}Ne.getPositivePatterns=gWe;function _We(t){return t.filter(e=>!kG(e))}Ne.getPatternsInsideCurrentDirectory=_We;function yWe(t){return t.filter(kG)}Ne.getPatternsOutsideCurrentDirectory=yWe;function kG(t){return t.startsWith("..")||t.startsWith("./..")}Ne.isPatternRelatedToParentDirectory=kG;function SWe(t){return iWe(t,{flipBackslashes:!1})}Ne.getBaseDirectory=SWe;function EWe(t){return t.includes(jfe)}Ne.hasGlobStar=EWe;function Vfe(t){return t.endsWith("/"+jfe)}Ne.endsWithSlashGlobStar=Vfe;function vWe(t){let e=Bfe.basename(t);return Vfe(t)||zfe(e)}Ne.isAffectDepthOfReadingPattern=vWe;function TWe(t){return t.reduce((e,r)=>e.concat(Hfe(r)),[])}Ne.expandPatternsWithBraceExpansion=TWe;function Hfe(t){let e=NG.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}Ne.expandBraceExpansion=Hfe;function bWe(t,e){let{parts:r}=NG.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}Ne.getPatternParts=bWe;function Wfe(t,e){return NG.makeRe(t,e)}Ne.makeRe=Wfe;function AWe(t,e){return t.map(r=>Wfe(r,e))}Ne.convertPatternsToRe=AWe;function wWe(t,e){return e.some(r=>r.test(t))}Ne.matchAny=wWe;function xWe(t){return t.replace(dWe,"/")}Ne.removeDuplicateSlashes=xWe;function RWe(t){let e=[],r=[];for(let n of t)Yfe(n)?e.push(n):r.push(n);return[e,r]}Ne.partitionAbsoluteAndRelative=RWe;function Yfe(t){return Bfe.isAbsolute(t)}Ne.isAbsolute=Yfe});var Qfe=v((cGt,Xfe)=>{"use strict";var CWe=Z("stream"),Zfe=CWe.PassThrough,IWe=Array.prototype.slice;Xfe.exports=PWe;function PWe(){let t=[],e=IWe.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,o=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let s=Zfe(n);function a(){for(let u=0,d=arguments.length;u<d;u++)t.push(Jfe(arguments[u],n));return c(),this}function c(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(l);return}Array.isArray(u)||(u=[u]);let d=u.length+1;function f(){--d>0||(r=!1,c())}function p(h){function m(){h.removeListener("merge2UnpipeEnd",m),h.removeListener("end",m),o&&h.removeListener("error",y),f()}function y(S){s.emit("error",S)}if(h._readableState.endEmitted)return f();h.on("merge2UnpipeEnd",m),h.on("end",m),o&&h.on("error",y),h.pipe(s,{end:!1}),h.resume()}for(let h=0;h<u.length;h++)p(u[h]);f()}function l(){r=!1,s.emit("queueDrain"),i&&s.end()}return s.setMaxListeners(0),s.add=a,s.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),s}function Jfe(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=Jfe(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Zfe(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var tpe=v(gI=>{"use strict";Object.defineProperty(gI,"__esModule",{value:!0});gI.merge=void 0;var OWe=Qfe();function NWe(t){let e=OWe(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>epe(t)),e.once("end",()=>epe(t)),e}gI.merge=NWe;function epe(t){t.forEach(e=>e.emit("close"))}});var rpe=v(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.isEmpty=qh.isString=void 0;function kWe(t){return typeof t=="string"}qh.isString=kWe;function MWe(t){return t===""}qh.isEmpty=MWe});var Ks=v(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.string=Ir.stream=Ir.pattern=Ir.path=Ir.fs=Ir.errno=Ir.array=void 0;var DWe=_de();Ir.array=DWe;var LWe=yde();Ir.errno=LWe;var $We=Sde();Ir.fs=$We;var UWe=bde();Ir.path=UWe;var FWe=Kfe();Ir.pattern=FWe;var BWe=tpe();Ir.stream=BWe;var jWe=rpe();Ir.string=jWe});var spe=v(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.convertPatternGroupToTask=Pr.convertPatternGroupsToTasks=Pr.groupPatternsByBaseDirectory=Pr.getNegativePatternsAsPositive=Pr.getPositivePatterns=Pr.convertPatternsToTasks=Pr.generate=void 0;var Ui=Ks();function zWe(t,e){let r=npe(t,e),n=npe(e.ignore,e),i=ipe(r),o=ope(r,n),s=i.filter(u=>Ui.pattern.isStaticPattern(u,e)),a=i.filter(u=>Ui.pattern.isDynamicPattern(u,e)),c=MG(s,o,!1),l=MG(a,o,!0);return c.concat(l)}Pr.generate=zWe;function npe(t,e){let r=t;return e.braceExpansion&&(r=Ui.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Ui.pattern.removeDuplicateSlashes(n))}function MG(t,e,r){let n=[],i=Ui.pattern.getPatternsOutsideCurrentDirectory(t),o=Ui.pattern.getPatternsInsideCurrentDirectory(t),s=DG(i),a=DG(o);return n.push(...LG(s,e,r)),"."in a?n.push($G(".",o,e,r)):n.push(...LG(a,e,r)),n}Pr.convertPatternsToTasks=MG;function ipe(t){return Ui.pattern.getPositivePatterns(t)}Pr.getPositivePatterns=ipe;function ope(t,e){return Ui.pattern.getNegativePatterns(t).concat(e).map(Ui.pattern.convertToPositivePattern)}Pr.getNegativePatternsAsPositive=ope;function DG(t){let e={};return t.reduce((r,n)=>{let i=Ui.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Pr.groupPatternsByBaseDirectory=DG;function LG(t,e,r){return Object.keys(t).map(n=>$G(n,t[n],e,r))}Pr.convertPatternGroupsToTasks=LG;function $G(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Ui.pattern.convertToNegativePattern))}}Pr.convertPatternGroupToTask=$G});var cpe=v(_I=>{"use strict";Object.defineProperty(_I,"__esModule",{value:!0});_I.read=void 0;function GWe(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){ape(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){UG(r,i);return}e.fs.stat(t,(o,s)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){ape(r,o);return}UG(r,i);return}e.markSymbolicLink&&(s.isSymbolicLink=()=>!0),UG(r,s)})})}_I.read=GWe;function ape(t,e){t(e)}function UG(t,e){t(null,e)}});var lpe=v(yI=>{"use strict";Object.defineProperty(yI,"__esModule",{value:!0});yI.read=void 0;function qWe(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}yI.read=qWe});var upe=v(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.createFileSystemAdapter=Nc.FILE_SYSTEM_ADAPTER=void 0;var SI=Z("fs");Nc.FILE_SYSTEM_ADAPTER={lstat:SI.lstat,stat:SI.stat,lstatSync:SI.lstatSync,statSync:SI.statSync};function VWe(t){return t===void 0?Nc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Nc.FILE_SYSTEM_ADAPTER),t)}Nc.createFileSystemAdapter=VWe});var dpe=v(BG=>{"use strict";Object.defineProperty(BG,"__esModule",{value:!0});var HWe=upe(),FG=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=HWe.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};BG.default=FG});var Bu=v(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.statSync=kc.stat=kc.Settings=void 0;var fpe=cpe(),WWe=lpe(),jG=dpe();kc.Settings=jG.default;function YWe(t,e,r){if(typeof e=="function"){fpe.read(t,zG(),e);return}fpe.read(t,zG(e),r)}kc.stat=YWe;function KWe(t,e){let r=zG(e);return WWe.read(t,r)}kc.statSync=KWe;function zG(t={}){return t instanceof jG.default?t:new jG.default(t)}});var mpe=v((yGt,hpe)=>{"use strict";var ppe;hpe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(ppe||(ppe=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var _pe=v((SGt,gpe)=>{"use strict";gpe.exports=JWe;var ZWe=mpe();function JWe(t,e){let r,n,i,o=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function s(c){function l(){e&&e(c,r),e=null}o?ZWe(l):l()}function a(c,l,u){r[c]=u,(--n===0||l)&&s(l)}n?i?i.forEach(function(c){t[c](function(l,u){a(c,l,u)})}):t.forEach(function(c,l){c(function(u,d){a(l,u,d)})}):s(null),o=!1}});var GG=v(vI=>{"use strict";Object.defineProperty(vI,"__esModule",{value:!0});vI.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var EI=process.versions.node.split(".");if(EI[0]===void 0||EI[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var ype=Number.parseInt(EI[0],10),XWe=Number.parseInt(EI[1],10),Spe=10,QWe=10,e3e=ype>Spe,t3e=ype===Spe&&XWe>=QWe;vI.IS_SUPPORT_READDIR_WITH_FILE_TYPES=e3e||t3e});var Epe=v(TI=>{"use strict";Object.defineProperty(TI,"__esModule",{value:!0});TI.createDirentFromStats=void 0;var qG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function r3e(t,e){return new qG(t,e)}TI.createDirentFromStats=r3e});var VG=v(bI=>{"use strict";Object.defineProperty(bI,"__esModule",{value:!0});bI.fs=void 0;var n3e=Epe();bI.fs=n3e});var HG=v(AI=>{"use strict";Object.defineProperty(AI,"__esModule",{value:!0});AI.joinPathSegments=void 0;function i3e(t,e,r){return t.endsWith(r)?t+e:t+r+e}AI.joinPathSegments=i3e});var xpe=v(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.readdir=Mc.readdirWithFileTypes=Mc.read=void 0;var o3e=Bu(),vpe=_pe(),s3e=GG(),Tpe=VG(),bpe=HG();function a3e(t,e,r){if(!e.stats&&s3e.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Ape(t,e,r);return}wpe(t,e,r)}Mc.read=a3e;function Ape(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){wI(r,n);return}let o=i.map(a=>({dirent:a,name:a.name,path:bpe.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){WG(r,o);return}let s=o.map(a=>c3e(a,e));vpe(s,(a,c)=>{if(a!==null){wI(r,a);return}WG(r,c)})})}Mc.readdirWithFileTypes=Ape;function c3e(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Tpe.fs.createDirentFromStats(t.name,i),r(null,t)})}}function wpe(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){wI(r,n);return}let o=i.map(s=>{let a=bpe.joinPathSegments(t,s,e.pathSegmentSeparator);return c=>{o3e.stat(a,e.fsStatSettings,(l,u)=>{if(l!==null){c(l);return}let d={name:s,path:a,dirent:Tpe.fs.createDirentFromStats(s,u)};e.stats&&(d.stats=u),c(null,d)})}});vpe(o,(s,a)=>{if(s!==null){wI(r,s);return}WG(r,a)})})}Mc.readdir=wpe;function wI(t,e){t(e)}function WG(t,e){t(null,e)}});var Ope=v(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.readdir=Dc.readdirWithFileTypes=Dc.read=void 0;var l3e=Bu(),u3e=GG(),Rpe=VG(),Cpe=HG();function d3e(t,e){return!e.stats&&u3e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Ipe(t,e):Ppe(t,e)}Dc.read=d3e;function Ipe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:Cpe.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let o=e.fs.statSync(i.path);i.dirent=Rpe.fs.createDirentFromStats(i.name,o)}catch(o){if(e.throwErrorOnBrokenSymbolicLink)throw o}return i})}Dc.readdirWithFileTypes=Ipe;function Ppe(t,e){return e.fs.readdirSync(t).map(n=>{let i=Cpe.joinPathSegments(t,n,e.pathSegmentSeparator),o=l3e.statSync(i,e.fsStatSettings),s={name:n,path:i,dirent:Rpe.fs.createDirentFromStats(n,o)};return e.stats&&(s.stats=o),s})}Dc.readdir=Ppe});var Npe=v(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.createFileSystemAdapter=Lc.FILE_SYSTEM_ADAPTER=void 0;var Vh=Z("fs");Lc.FILE_SYSTEM_ADAPTER={lstat:Vh.lstat,stat:Vh.stat,lstatSync:Vh.lstatSync,statSync:Vh.statSync,readdir:Vh.readdir,readdirSync:Vh.readdirSync};function f3e(t){return t===void 0?Lc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Lc.FILE_SYSTEM_ADAPTER),t)}Lc.createFileSystemAdapter=f3e});var kpe=v(KG=>{"use strict";Object.defineProperty(KG,"__esModule",{value:!0});var p3e=Z("path"),h3e=Bu(),m3e=Npe(),YG=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=m3e.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,p3e.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new h3e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};KG.default=YG});var xI=v($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.Settings=$c.scandirSync=$c.scandir=void 0;var Mpe=xpe(),g3e=Ope(),ZG=kpe();$c.Settings=ZG.default;function _3e(t,e,r){if(typeof e=="function"){Mpe.read(t,JG(),e);return}Mpe.read(t,JG(e),r)}$c.scandir=_3e;function y3e(t,e){let r=JG(e);return g3e.read(t,r)}$c.scandirSync=y3e;function JG(t={}){return t instanceof ZG.default?t:new ZG.default(t)}});var Lpe=v((IGt,Dpe)=>{"use strict";function S3e(t){var e=new t,r=e;function n(){var o=e;return o.next?e=o.next:(e=new t,r=e),o.next=null,o}function i(o){r.next=o,r=o}return{get:n,release:i}}Dpe.exports=S3e});var Upe=v((PGt,XG)=>{"use strict";var E3e=Lpe();function $pe(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=E3e(v3e),i=null,o=null,s=0,a=null,c={push:m,drain:un,saturated:un,pause:u,paused:!1,get concurrency(){return r},set concurrency(O){if(!(O>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=O,!c.paused)for(;i&&s<r;)s++,S()},running:l,resume:p,idle:h,length:d,getQueue:f,unshift:y,empty:un,kill:b,killAndDrain:w,error:C,abort:T};return c;function l(){return s}function u(){c.paused=!0}function d(){for(var O=i,k=0;O;)O=O.next,k++;return k}function f(){for(var O=i,k=[];O;)k.push(O.value),O=O.next;return k}function p(){if(c.paused){if(c.paused=!1,i===null){s++,S();return}for(;i&&s<r;)s++,S()}}function h(){return s===0&&c.length()===0}function m(O,k){var P=n.get();P.context=t,P.release=S,P.value=O,P.callback=k||un,P.errorHandler=a,s>=r||c.paused?o?(o.next=P,o=P):(i=P,o=P,c.saturated()):(s++,e.call(t,P.value,P.worked))}function y(O,k){var P=n.get();P.context=t,P.release=S,P.value=O,P.callback=k||un,P.errorHandler=a,s>=r||c.paused?i?(P.next=i,i=P):(i=P,o=P,c.saturated()):(s++,e.call(t,P.value,P.worked))}function S(O){O&&n.release(O);var k=i;k&&s<=r?c.paused?s--:(o===i&&(o=null),i=k.next,k.next=null,e.call(t,k.value,k.worked),o===null&&c.empty()):--s===0&&c.drain()}function b(){i=null,o=null,c.drain=un}function w(){i=null,o=null,c.drain(),c.drain=un}function T(){var O=i;for(i=null,o=null;O;){var k=O.next,P=O.callback,M=O.errorHandler,F=O.value,_=O.context;O.value=null,O.callback=un,O.errorHandler=null,M&&M(new Error("abort"),F),P.call(_,new Error("abort")),O.release(O),O=k}c.drain=un}function C(O){a=O}}function un(){}function v3e(){this.value=null,this.callback=un,this.next=null,this.release=un,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,o=t.errorHandler,s=t.value;t.value=null,t.callback=un,t.errorHandler&&o(r,s),i.call(t.context,r,n),t.release(t)}}function T3e(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(u,d){e.call(this,u).then(function(f){d(null,f)},d)}var i=$pe(t,n,r),o=i.push,s=i.unshift;return i.push=a,i.unshift=c,i.drained=l,i;function a(u){var d=new Promise(function(f,p){o(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(un),d}function c(u){var d=new Promise(function(f,p){s(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(un),d}function l(){var u=new Promise(function(d){process.nextTick(function(){if(i.idle())d();else{var f=i.drain;i.drain=function(){typeof f=="function"&&f(),d(),i.drain=f}}})});return u}}XG.exports=$pe;XG.exports.promise=T3e});var RI=v(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.joinPathSegments=Uo.replacePathSegmentSeparator=Uo.isAppliedFilter=Uo.isFatalError=void 0;function b3e(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Uo.isFatalError=b3e;function A3e(t,e){return t===null||t(e)}Uo.isAppliedFilter=A3e;function w3e(t,e){return t.split(/[/\\]/).join(e)}Uo.replacePathSegmentSeparator=w3e;function x3e(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Uo.joinPathSegments=x3e});var t4=v(e4=>{"use strict";Object.defineProperty(e4,"__esModule",{value:!0});var R3e=RI(),QG=class{constructor(e,r){this._root=e,this._settings=r,this._root=R3e.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};e4.default=QG});var i4=v(n4=>{"use strict";Object.defineProperty(n4,"__esModule",{value:!0});var C3e=Z("events"),I3e=xI(),P3e=Upe(),CI=RI(),O3e=t4(),r4=class extends O3e.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=I3e.scandir,this._emitter=new C3e.EventEmitter,this._queue=P3e(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let o of i)this._handleEntry(o,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!CI.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=CI.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),CI.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&CI.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};n4.default=r4});var Fpe=v(s4=>{"use strict";Object.defineProperty(s4,"__esModule",{value:!0});var N3e=i4(),o4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new N3e.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{k3e(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{M3e(e,this._storage)}),this._reader.read()}};s4.default=o4;function k3e(t,e){t(e)}function M3e(t,e){t(null,e)}});var Bpe=v(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});var D3e=Z("stream"),L3e=i4(),a4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new L3e.default(this._root,this._settings),this._stream=new D3e.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};c4.default=a4});var jpe=v(u4=>{"use strict";Object.defineProperty(u4,"__esModule",{value:!0});var $3e=xI(),II=RI(),U3e=t4(),l4=class extends U3e.default{constructor(){super(...arguments),this._scandir=$3e.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(II.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=II.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),II.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&II.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};u4.default=l4});var zpe=v(f4=>{"use strict";Object.defineProperty(f4,"__esModule",{value:!0});var F3e=jpe(),d4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new F3e.default(this._root,this._settings)}read(){return this._reader.read()}};f4.default=d4});var Gpe=v(h4=>{"use strict";Object.defineProperty(h4,"__esModule",{value:!0});var B3e=Z("path"),j3e=xI(),p4=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,B3e.sep),this.fsScandirSettings=new j3e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};h4.default=p4});var OI=v(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Settings=Fo.walkStream=Fo.walkSync=Fo.walk=void 0;var qpe=Fpe(),z3e=Bpe(),G3e=zpe(),m4=Gpe();Fo.Settings=m4.default;function q3e(t,e,r){if(typeof e=="function"){new qpe.default(t,PI()).read(e);return}new qpe.default(t,PI(e)).read(r)}Fo.walk=q3e;function V3e(t,e){let r=PI(e);return new G3e.default(t,r).read()}Fo.walkSync=V3e;function H3e(t,e){let r=PI(e);return new z3e.default(t,r).read()}Fo.walkStream=H3e;function PI(t={}){return t instanceof m4.default?t:new m4.default(t)}});var NI=v(_4=>{"use strict";Object.defineProperty(_4,"__esModule",{value:!0});var W3e=Z("path"),Y3e=Bu(),Vpe=Ks(),g4=class{constructor(e){this._settings=e,this._fsStatSettings=new Y3e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return W3e.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Vpe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Vpe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};_4.default=g4});var E4=v(S4=>{"use strict";Object.defineProperty(S4,"__esModule",{value:!0});var K3e=Z("stream"),Z3e=Bu(),J3e=OI(),X3e=NI(),y4=class extends X3e.default{constructor(){super(...arguments),this._walkStream=J3e.walkStream,this._stat=Z3e.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new K3e.PassThrough({objectMode:!0});i._write=(o,s,a)=>this._getEntry(n[o],e[o],r).then(c=>{c!==null&&r.entryFilter(c)&&i.push(c),o===n.length-1&&i.end(),a()}).catch(a);for(let o=0;o<n.length;o++)i.write(o);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,o)=>i===null?r(o):n(i))})}};S4.default=y4});var Hpe=v(T4=>{"use strict";Object.defineProperty(T4,"__esModule",{value:!0});var Q3e=OI(),eYe=NI(),tYe=E4(),v4=class extends eYe.default{constructor(){super(...arguments),this._walkAsync=Q3e.walk,this._readerStream=new tYe.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(o,s)=>{o===null?n(s):i(o)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((o,s)=>{i.once("error",s),i.on("data",a=>n.push(a)),i.once("end",()=>o(n))})}};T4.default=v4});var Wpe=v(A4=>{"use strict";Object.defineProperty(A4,"__esModule",{value:!0});var MS=Ks(),b4=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return MS.pattern.getPatternParts(e,this._micromatchOptions).map(n=>MS.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:MS.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return MS.array.splitWhen(e,r=>r.dynamic&&MS.pattern.hasGlobStar(r.pattern))}};A4.default=b4});var Ype=v(x4=>{"use strict";Object.defineProperty(x4,"__esModule",{value:!0});var rYe=Wpe(),w4=class extends rYe.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(o=>!o.complete||o.segments.length>n);for(let o of i){let s=o.sections[0];if(!o.complete&&n>s.length||r.every((c,l)=>{let u=o.segments[l];return!!(u.dynamic&&u.patternRe.test(c)||!u.dynamic&&u.pattern===c)}))return!0}return!1}};x4.default=w4});var Kpe=v(C4=>{"use strict";Object.defineProperty(C4,"__esModule",{value:!0});var kI=Ks(),nYe=Ype(),R4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),o=this._getNegativePatternsRe(n);return s=>this._filter(e,s,i,o)}_getMatcher(e){return new nYe.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(kI.pattern.isAffectDepthOfReadingPattern);return kI.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let o=kI.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(o,n)?!1:this._isSkippedByNegativePatterns(o,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!kI.pattern.matchAny(e,r)}};C4.default=R4});var Zpe=v(P4=>{"use strict";Object.defineProperty(P4,"__esModule",{value:!0});var Uc=Ks(),I4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=Uc.pattern.partitionAbsoluteAndRelative(r),o={positive:{all:Uc.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:Uc.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Uc.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return s=>this._filter(s,o)}_filter(e,r){let n=Uc.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=Uc.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=Uc.pattern.matchAny(e,r);return!i&&n?Uc.pattern.matchAny(e+"/",r):i}};P4.default=I4});var Jpe=v(N4=>{"use strict";Object.defineProperty(N4,"__esModule",{value:!0});var iYe=Ks(),O4=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return iYe.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};N4.default=O4});var Qpe=v(M4=>{"use strict";Object.defineProperty(M4,"__esModule",{value:!0});var Xpe=Ks(),k4=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Xpe.path.makeAbsolute(this._settings.cwd,r),r=Xpe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};M4.default=k4});var MI=v(L4=>{"use strict";Object.defineProperty(L4,"__esModule",{value:!0});var oYe=Z("path"),sYe=Kpe(),aYe=Zpe(),cYe=Jpe(),lYe=Qpe(),D4=class{constructor(e){this._settings=e,this.errorFilter=new cYe.default(this._settings),this.entryFilter=new aYe.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new sYe.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new lYe.default(this._settings)}_getRootDirectory(e){return oYe.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};L4.default=D4});var ehe=v(U4=>{"use strict";Object.defineProperty(U4,"__esModule",{value:!0});var uYe=Hpe(),dYe=MI(),$4=class extends dYe.default{constructor(){super(...arguments),this._reader=new uYe.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(o=>n.transform(o))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};U4.default=$4});var the=v(B4=>{"use strict";Object.defineProperty(B4,"__esModule",{value:!0});var fYe=Z("stream"),pYe=E4(),hYe=MI(),F4=class extends hYe.default{constructor(){super(...arguments),this._reader=new pYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),o=new fYe.Readable({objectMode:!0,read:()=>{}});return i.once("error",s=>o.emit("error",s)).on("data",s=>o.emit("data",n.transform(s))).once("end",()=>o.emit("end")),o.once("close",()=>i.destroy()),o}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};B4.default=F4});var rhe=v(z4=>{"use strict";Object.defineProperty(z4,"__esModule",{value:!0});var mYe=Bu(),gYe=OI(),_Ye=NI(),j4=class extends _Ye.default{constructor(){super(...arguments),this._walkSync=gYe.walkSync,this._statSync=mYe.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let o=this._getFullEntryPath(i),s=this._getEntry(o,i,r);s===null||!r.entryFilter(s)||n.push(s)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};z4.default=j4});var nhe=v(q4=>{"use strict";Object.defineProperty(q4,"__esModule",{value:!0});var yYe=rhe(),SYe=MI(),G4=class extends SYe.default{constructor(){super(...arguments),this._reader=new yYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};q4.default=G4});var ihe=v(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var Hh=Z("fs"),EYe=Z("os"),vYe=Math.max(EYe.cpus().length,1);Wh.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:Hh.lstat,lstatSync:Hh.lstatSync,stat:Hh.stat,statSync:Hh.statSync,readdir:Hh.readdir,readdirSync:Hh.readdirSync};var V4=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,vYe),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},Wh.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};Wh.default=V4});var DS=v((t4t,she)=>{"use strict";var ohe=spe(),TYe=ehe(),bYe=the(),AYe=nhe(),H4=ihe(),ri=Ks();async function W4(t,e){Fi(t);let r=Y4(t,TYe.default,e),n=await Promise.all(r);return ri.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(l,u){Fi(l);let d=Y4(l,AYe.default,u);return ri.array.flatten(d)}t.sync=e;function r(l,u){Fi(l);let d=Y4(l,bYe.default,u);return ri.stream.merge(d)}t.stream=r;function n(l,u){Fi(l);let d=[].concat(l),f=new H4.default(u);return ohe.generate(d,f)}t.generateTasks=n;function i(l,u){Fi(l);let d=new H4.default(u);return ri.pattern.isDynamicPattern(l,d)}t.isDynamicPattern=i;function o(l){return Fi(l),ri.path.escape(l)}t.escapePath=o;function s(l){return Fi(l),ri.path.convertPathToPattern(l)}t.convertPathToPattern=s;let a;(function(l){function u(f){return Fi(f),ri.path.escapePosixPath(f)}l.escapePath=u;function d(f){return Fi(f),ri.path.convertPosixPathToPattern(f)}l.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(l){function u(f){return Fi(f),ri.path.escapeWindowsPath(f)}l.escapePath=u;function d(f){return Fi(f),ri.path.convertWindowsPathToPattern(f)}l.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(W4||(W4={}));function Y4(t,e,r){let n=[].concat(t),i=new H4.default(r),o=ohe.generate(n,i),s=new e(i);return o.map(s.read,s)}function Fi(t){if(![].concat(t).every(n=>ri.string.isString(n)&&!ri.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}she.exports=W4});var nq=v((l4t,$I)=>{"use strict";function dhe(t){return Array.isArray(t)?t:[t]}var RYe=void 0,X4="",lhe=" ",J4="\\",CYe=/^\s+$/,IYe=/(?:[^\\]|^)\\$/,PYe=/^\\!/,OYe=/^\\#/,NYe=/\r?\n/g,kYe=/^\.{0,2}\/|^\.{1,2}$/,MYe=/\/$/,Yh="/",fhe="node-ignore";typeof Symbol<"u"&&(fhe=Symbol.for("node-ignore"));var phe=fhe,Kh=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),DYe=/([0-z])-([0-z])/g,hhe=()=>!1,LYe=t=>t.replace(DYe,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:X4),$Ye=t=>{let{length:e}=t;return t.slice(0,e-e%2)},UYe=[[/^\uFEFF/,()=>X4],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?lhe:X4)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+lhe}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>J4],[/\\\\/g,()=>J4],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===J4?`\\[${r}${$Ye(n)}${i}`:i==="]"&&n.length%2===0?`[${LYe(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],FYe=/(^|\\\/)?\\\*$/,LS="regex",DI="checkRegex",uhe="_",BYe={[LS](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[DI](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},jYe=t=>UYe.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),LI=t=>typeof t=="string",zYe=t=>t&&LI(t)&&!CYe.test(t)&&!IYe.test(t)&&t.indexOf("#")!==0,GYe=t=>t.split(NYe).filter(Boolean),Q4=class{constructor(e,r,n,i,o,s){this.pattern=e,this.mark=r,this.negative=o,Kh(this,"body",n),Kh(this,"ignoreCase",i),Kh(this,"regexPrefix",s)}get regex(){let e=uhe+LS;return this[e]?this[e]:this._make(LS,e)}get checkRegex(){let e=uhe+DI;return this[e]?this[e]:this._make(DI,e)}_make(e,r){let n=this.regexPrefix.replace(FYe,BYe[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return Kh(this,r,i)}},qYe=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(PYe,"!").replace(OYe,"#");let o=jYe(i);return new Q4(t,e,i,r,n,o)},eq=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[phe]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(LI(e)&&(e={pattern:e}),zYe(e.pattern)){let r=qYe(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,dhe(LI(e)?GYe(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,o=!1,s;this._rules.forEach(c=>{let{negative:l}=c;o===l&&i!==o||l&&!i&&!o&&!r||!c[n].test(e)||(i=!l,o=l,s=l?RYe:c)});let a={ignored:i,unignored:o};return s&&(a.rule=s),a}},VYe=(t,e)=>{throw new e(t)},Zs=(t,e,r)=>LI(t)?t?Zs.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),mhe=t=>kYe.test(t);Zs.isNotRelative=mhe;Zs.convert=t=>t;var tq=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){Kh(this,phe,!0),this._rules=new eq(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let o=e&&Zs.convert(e);return Zs(o,e,this._strictPathCheck?VYe:hhe),this._t(o,r,n,i)}checkIgnore(e){if(!MYe.test(e))return this.test(e);let r=e.split(Yh).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(Yh)+Yh,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,DI)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(Yh).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,LS);let o=this._t(i.join(Yh)+Yh,r,n,i);return r[e]=o.ignored?o:this._rules.test(e,n,LS)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return dhe(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},rq=t=>new tq(t),HYe=t=>Zs(t&&Zs.convert(t),t,hhe),ghe=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Zs.convert=t;let e=/^[a-z]:\//i;Zs.isNotRelative=r=>e.test(r)||mhe(r)};typeof process<"u"&&process.platform==="win32"&&ghe();$I.exports=rq;rq.default=rq;$I.exports.isPathValid=HYe;Kh($I.exports,Symbol.for("setupWindows"),ghe)});var Lq=v(gge=>{"use strict";gge.parse=function(t,e){return new Dq(t,e).parse()};var Dq=class t{constructor(e,r){this.source=e,this.transform=r||EZe,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var r;(this.recorded.length>0||e)&&(r=this.recorded.join(""),r==="NULL"&&!e&&(r=null),r!==null&&(r=this.transform(r)),this.entries.push(r),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var r,n,i;for(this.consumeDimensions();!this.isEof();)if(r=this.nextCharacter(),r.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new t(this.source.substr(this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n.position-2);else if(r.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else r.value==='"'&&!r.escaped?(i&&this.newEntry(!0),i=!i):r.value===","&&!i?this.newEntry():this.record(r.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function EZe(t){return t}});var $q=v((A6t,_ge)=>{"use strict";var vZe=Lq();_ge.exports={create:function(t,e){return{parse:function(){return vZe.parse(t,e)}}}}});var Ege=v((w6t,Sge)=>{"use strict";var TZe=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,bZe=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,AZe=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,wZe=/^-?infinity$/;Sge.exports=function(e){if(wZe.test(e))return Number(e.replace("i","I"));var r=TZe.exec(e);if(!r)return xZe(e)||null;var n=!!r[8],i=parseInt(r[1],10);n&&(i=yge(i));var o=parseInt(r[2],10)-1,s=r[3],a=parseInt(r[4],10),c=parseInt(r[5],10),l=parseInt(r[6],10),u=r[7];u=u?1e3*parseFloat(u):0;var d,f=RZe(e);return f!=null?(d=new Date(Date.UTC(i,o,s,a,c,l,u)),Uq(i)&&d.setUTCFullYear(i),f!==0&&d.setTime(d.getTime()-f)):(d=new Date(i,o,s,a,c,l,u),Uq(i)&&d.setFullYear(i)),d};function xZe(t){var e=bZe.exec(t);if(e){var r=parseInt(e[1],10),n=!!e[4];n&&(r=yge(r));var i=parseInt(e[2],10)-1,o=e[3],s=new Date(r,i,o);return Uq(r)&&s.setFullYear(r),s}}function RZe(t){if(t.endsWith("+00"))return 0;var e=AZe.exec(t.split(" ")[1]);if(e){var r=e[1];if(r==="Z")return 0;var n=r==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}function yge(t){return-(t-1)}function Uq(t){return t>=0&&t<100}});var Tge=v((x6t,vge)=>{"use strict";vge.exports=IZe;var CZe=Object.prototype.hasOwnProperty;function IZe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)CZe.call(r,n)&&(t[n]=r[n])}return t}});var wge=v((R6t,Age)=>{"use strict";var PZe=Tge();Age.exports=sm;function sm(t){if(!(this instanceof sm))return new sm(t);PZe(this,zZe(t))}var OZe=["seconds","minutes","hours","days","months","years"];sm.prototype.toPostgres=function(){var t=OZe.filter(this.hasOwnProperty,this);return this.milliseconds&&t.indexOf("seconds")<0&&t.push("seconds"),t.length===0?"0":t.map(function(e){var r=this[e]||0;return e==="seconds"&&this.milliseconds&&(r=(r+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),r+" "+e},this).join(" ")};var NZe={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},kZe=["years","months","days"],MZe=["hours","minutes","seconds"];sm.prototype.toISOString=sm.prototype.toISO=function(){var t=kZe.map(r,this).join(""),e=MZe.map(r,this).join("");return"P"+t+"T"+e;function r(n){var i=this[n]||0;return n==="seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),i+NZe[n]}};var Fq="([+-]?\\d+)",DZe=Fq+"\\s+years?",LZe=Fq+"\\s+mons?",$Ze=Fq+"\\s+days?",UZe="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",FZe=new RegExp([DZe,LZe,$Ze,UZe].map(function(t){return"("+t+")?"}).join("\\s*")),bge={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},BZe=["hours","minutes","seconds","milliseconds"];function jZe(t){var e=t+"000000".slice(t.length);return parseInt(e,10)/1e3}function zZe(t){if(!t)return{};var e=FZe.exec(t),r=e[8]==="-";return Object.keys(bge).reduce(function(n,i){var o=bge[i],s=e[o];return!s||(s=i==="milliseconds"?jZe(s):parseInt(s,10),!s)||(r&&~BZe.indexOf(i)&&(s*=-1),n[i]=s),n},{})}});var Cge=v((C6t,Rge)=>{"use strict";var xge=Buffer.from||Buffer;Rge.exports=function(e){if(/^\\x/.test(e))return xge(e.substr(2),"hex");for(var r="",n=0;n<e.length;)if(e[n]!=="\\")r+=e[n],++n;else if(/[0-7]{3}/.test(e.substr(n+1,3)))r+=String.fromCharCode(parseInt(e.substr(n+1,3),8)),n+=4;else{for(var i=1;n+i<e.length&&e[n+i]==="\\";)i++;for(var o=0;o<Math.floor(i/2);++o)r+="\\";n+=Math.floor(i/2)*2}return xge(r,"binary")}});var Dge=v((I6t,Mge)=>{"use strict";var HS=Lq(),WS=$q(),JI=Ege(),Pge=wge(),Oge=Cge();function XI(t){return function(r){return r===null?r:t(r)}}function Nge(t){return t===null?t:t==="TRUE"||t==="t"||t==="true"||t==="y"||t==="yes"||t==="on"||t==="1"}function GZe(t){return t?HS.parse(t,Nge):null}function qZe(t){return parseInt(t,10)}function Bq(t){return t?HS.parse(t,XI(qZe)):null}function VZe(t){return t?HS.parse(t,XI(function(e){return kge(e).trim()})):null}var HZe=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=qq(r)),r});return e.parse()},jq=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=parseFloat(r)),r});return e.parse()},ni=function(t){if(!t)return null;var e=WS.create(t);return e.parse()},zq=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=JI(r)),r});return e.parse()},WZe=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=Pge(r)),r});return e.parse()},YZe=function(t){return t?HS.parse(t,XI(Oge)):null},Gq=function(t){return parseInt(t,10)},kge=function(t){var e=String(t);return/^\d+$/.test(e)?e:t},Ige=function(t){return t?HS.parse(t,XI(JSON.parse)):null},qq=function(t){return t[0]!=="("?null:(t=t.substring(1,t.length-1).split(","),{x:parseFloat(t[0]),y:parseFloat(t[1])})},KZe=function(t){if(t[0]!=="<"&&t[1]!=="(")return null;for(var e="(",r="",n=!1,i=2;i<t.length-1;i++){if(n||(e+=t[i]),t[i]===")"){n=!0;continue}else if(!n)continue;t[i]!==","&&(r+=t[i])}var o=qq(e);return o.radius=parseFloat(r),o},ZZe=function(t){t(20,kge),t(21,Gq),t(23,Gq),t(26,Gq),t(700,parseFloat),t(701,parseFloat),t(16,Nge),t(1082,JI),t(1114,JI),t(1184,JI),t(600,qq),t(651,ni),t(718,KZe),t(1e3,GZe),t(1001,YZe),t(1005,Bq),t(1007,Bq),t(1028,Bq),t(1016,VZe),t(1017,HZe),t(1021,jq),t(1022,jq),t(1231,jq),t(1014,ni),t(1015,ni),t(1008,ni),t(1009,ni),t(1040,ni),t(1041,ni),t(1115,zq),t(1182,zq),t(1185,zq),t(1186,Pge),t(1187,WZe),t(17,Oge),t(114,JSON.parse.bind(JSON)),t(3802,JSON.parse.bind(JSON)),t(199,Ige),t(3807,Ige),t(3907,ni),t(2951,ni),t(791,ni),t(1183,ni),t(1270,ni)};Mge.exports={init:ZZe}});var $ge=v((P6t,Lge)=>{"use strict";var dn=1e6;function JZe(t){var e=t.readInt32BE(0),r=t.readUInt32BE(4),n="";e<0&&(e=~e+(r===0),r=~r+1>>>0,n="-");var i="",o,s,a,c,l,u;{if(o=e%dn,e=e/dn>>>0,s=4294967296*o+r,r=s/dn>>>0,a=""+(s-dn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%dn,e=e/dn>>>0,s=4294967296*o+r,r=s/dn>>>0,a=""+(s-dn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%dn,e=e/dn>>>0,s=4294967296*o+r,r=s/dn>>>0,a=""+(s-dn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}return o=e%dn,s=4294967296*o+r,a=""+s%dn,n+a+i}Lge.exports=JZe});var zge=v((O6t,jge)=>{"use strict";var XZe=$ge(),xt=function(t,e,r,n,i){r=r||0,n=n||!1,i=i||function(p,h,m){return p*Math.pow(2,m)+h};var o=r>>3,s=function(p){return n?~p&255:p},a=255,c=8-r%8;e<c&&(a=255<<8-e&255,c=e),r&&(a=a>>r%8);var l=0;r%8+e>=8&&(l=i(0,s(t[o])&a,c));for(var u=e+r>>3,d=o+1;d<u;d++)l=i(l,s(t[d]),8);var f=(e+r)%8;return f>0&&(l=i(l,s(t[u])>>8-f,f)),l},Bge=function(t,e,r){var n=Math.pow(2,r-1)-1,i=xt(t,1),o=xt(t,r,1);if(o===0)return 0;var s=1,a=function(l,u,d){l===0&&(l=1);for(var f=1;f<=d;f++)s/=2,(u&1<<d-f)>0&&(l+=s);return l},c=xt(t,e,r+1,!1,a);return o==Math.pow(2,r+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1:-1)*Math.pow(2,o-n)*c},QZe=function(t){return xt(t,1)==1?-1*(xt(t,15,1,!0)+1):xt(t,15,1)},Uge=function(t){return xt(t,1)==1?-1*(xt(t,31,1,!0)+1):xt(t,31,1)},e5e=function(t){return Bge(t,23,8)},t5e=function(t){return Bge(t,52,11)},r5e=function(t){var e=xt(t,16,32);if(e==49152)return NaN;for(var r=Math.pow(1e4,xt(t,16,16)),n=0,i=[],o=xt(t,16),s=0;s<o;s++)n+=xt(t,16,64+16*s)*r,r/=1e4;var a=Math.pow(10,xt(t,16,48));return(e===0?1:-1)*Math.round(n*a)/a},Fge=function(t,e){var r=xt(e,1),n=xt(e,63,1),i=new Date((r===0?1:-1)*n/1e3+9466848e5);return t||i.setTime(i.getTime()+i.getTimezoneOffset()*6e4),i.usec=n%1e3,i.getMicroSeconds=function(){return this.usec},i.setMicroSeconds=function(o){this.usec=o},i.getUTCMicroSeconds=function(){return this.usec},i},YS=function(t){for(var e=xt(t,32),r=xt(t,32,32),n=xt(t,32,64),i=96,o=[],s=0;s<e;s++)o[s]=xt(t,32,i),i+=32,i+=32;var a=function(l){var u=xt(t,32,i);if(i+=32,u==4294967295)return null;var d;if(l==23||l==20)return d=xt(t,u*8,i),i+=u*8,d;if(l==25)return d=t.toString(this.encoding,i>>3,(i+=u<<3)>>3),d;console.log("ERROR: ElementType not implemented: "+l)},c=function(l,u){var d=[],f;if(l.length>1){var p=l.shift();for(f=0;f<p;f++)d[f]=c(l,u);l.unshift(p)}else for(f=0;f<l[0];f++)d[f]=a(u);return d};return c(o,n)},n5e=function(t){return t.toString("utf8")},i5e=function(t){return t===null?null:xt(t,8)>0},o5e=function(t){t(20,XZe),t(21,QZe),t(23,Uge),t(26,Uge),t(1700,r5e),t(700,e5e),t(701,t5e),t(16,i5e),t(1114,Fge.bind(null,!1)),t(1184,Fge.bind(null,!0)),t(1e3,YS),t(1007,YS),t(1016,YS),t(1008,YS),t(1009,YS),t(25,n5e)};jge.exports={init:o5e}});var qge=v((N6t,Gge)=>{"use strict";Gge.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var JS=v(ZS=>{"use strict";var s5e=Dge(),a5e=zge(),c5e=$q(),l5e=qge();ZS.getTypeParser=u5e;ZS.setTypeParser=d5e;ZS.arrayParser=c5e;ZS.builtins=l5e;var KS={text:{},binary:{}};function Vge(t){return String(t)}function u5e(t,e){return e=e||"text",KS[e]&&KS[e][t]||Vge}function d5e(t,e,r){typeof e=="function"&&(r=e,e="text"),KS[e][t]=r}s5e.init(function(t,e){KS.text[t]=e});a5e.init(function(t,e){KS.binary[t]=e})});var XS=v((M6t,Vq)=>{"use strict";var Hge;try{Hge=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}Vq.exports={host:"localhost",user:Hge,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var am=JS(),f5e=am.getTypeParser(20,"text"),p5e=am.getTypeParser(1016,"text");Vq.exports.__defineSetter__("parseInt8",function(t){am.setTypeParser(20,"text",t?am.getTypeParser(23,"text"):f5e),am.setTypeParser(1016,"text",t?am.getTypeParser(1007,"text"):p5e)})});var cm=v((D6t,Yge)=>{"use strict";var h5e=XS(),{isDate:m5e}=Z("util/types");function g5e(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Wge(t){let e="{";for(let r=0;r<t.length;r++){r>0&&(e+=",");let n=t[r];n==null?e+="NULL":Array.isArray(n)?e+=Wge(n):ArrayBuffer.isView(n)?(n instanceof Buffer||(n=Buffer.from(n.buffer,n.byteOffset,n.byteLength)),e+="\\\\x"+n.toString("hex")):e+=g5e(QI(n))}return e+="}",e}var QI=function(t,e){return t==null?null:typeof t=="object"?t instanceof Buffer?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):m5e(t)?h5e.parseInputDatesAsUTC?S5e(t):y5e(t):Array.isArray(t)?Wge(t):_5e(t,e):t.toString()};function _5e(t,e){if(t&&typeof t.toPostgres=="function"){if(e=e||[],e.indexOf(t)!==-1)throw new Error('circular reference detected while preparing "'+t+'" for query');return e.push(t),QI(t.toPostgres(QI),e)}return JSON.stringify(t)}function y5e(t){let e=-t.getTimezoneOffset(),r=t.getFullYear(),n=r<1;n&&(r=Math.abs(r)+1);let i=String(r).padStart(4,"0")+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+String(t.getMilliseconds()).padStart(3,"0");return e<0?(i+="-",e*=-1):i+="+",i+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),n&&(i+=" BC"),i}function S5e(t){let e=t.getUTCFullYear(),r=e<1;r&&(e=Math.abs(e)+1);let n=String(e).padStart(4,"0")+"-"+String(t.getUTCMonth()+1).padStart(2,"0")+"-"+String(t.getUTCDate()).padStart(2,"0")+"T"+String(t.getUTCHours()).padStart(2,"0")+":"+String(t.getUTCMinutes()).padStart(2,"0")+":"+String(t.getUTCSeconds()).padStart(2,"0")+"."+String(t.getUTCMilliseconds()).padStart(3,"0");return n+="+00:00",r&&(n+=" BC"),n}function E5e(t,e,r){return t=typeof t=="string"?{text:t}:t,e&&(typeof e=="function"?t.callback=e:t.values=e),r&&(t.callback=r),t}var v5e=function(t){return'"'+t.replace(/"/g,'""')+'"'},T5e=function(t){let e=!1,r="'";if(t==null||typeof t!="string")return"''";for(let n=0;n<t.length;n++){let i=t[n];i==="'"?r+=i+i:i==="\\"?(r+=i+i,e=!0):r+=i}return r+="'",e===!0&&(r=" E"+r),r};Yge.exports={prepareValue:function(e){return QI(e)},normalizeQueryConfig:E5e,escapeIdentifier:v5e,escapeLiteral:T5e}});var Yq=v((L6t,Jge)=>{"use strict";var Kge=Z("crypto");Jge.exports={postgresMd5PasswordHash:A5e,randomBytes:b5e,deriveKey:C5e,sha256:w5e,hashByName:x5e,hmacSha256:R5e,md5:Hq};var Zge=Kge.webcrypto||globalThis.crypto,Gu=Zge.subtle,Wq=new TextEncoder;function b5e(t){return Zge.getRandomValues(Buffer.alloc(t))}async function Hq(t){try{return Kge.createHash("md5").update(t,"utf-8").digest("hex")}catch{let r=typeof t=="string"?Wq.encode(t):t,n=await Gu.digest("MD5",r);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}}async function A5e(t,e,r){let n=await Hq(e+t);return"md5"+await Hq(Buffer.concat([Buffer.from(n),r]))}async function w5e(t){return await Gu.digest("SHA-256",t)}async function x5e(t,e){return await Gu.digest(t,e)}async function R5e(t,e){let r=await Gu.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await Gu.sign("HMAC",r,Wq.encode(e))}async function C5e(t,e,r){let n=await Gu.importKey("raw",Wq.encode(t),"PBKDF2",!1,["deriveBits"]),i={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:r};return await Gu.deriveBits(i,n,256,["deriveBits"])}});var e_e=v(($6t,Qge)=>{"use strict";function qu(t,e){return new Error("SASL channel binding: "+t+" when parsing public certificate "+e.toString("base64"))}function Kq(t,e){let r=t[e++];if(r<128)return{length:r,index:e};let n=r&127;if(n>4)throw qu("bad length",t);r=0;for(let i=0;i<n;i++)r=r<<8|t[e++];return{length:r,index:e}}function Xge(t,e){if(t[e++]!==6)throw qu("non-OID data",t);let{length:r,index:n}=Kq(t,e);e=n;let i=e+r,o=t[e++],s=(o/40>>0)+"."+o%40;for(;e<i;){let a=0;for(;e<i;){let c=t[e++];if(a=a<<7|c&127,c<128)break}s+="."+a}return{oid:s,index:e}}function QS(t,e){if(t[e++]!==48)throw qu("non-sequence data",t);return Kq(t,e)}function I5e(t,e){e===void 0&&(e=0),e=QS(t,e).index;let{length:r,index:n}=QS(t,e);e=n+r,e=QS(t,e).index;let{oid:i,index:o}=Xge(t,e);switch(i){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=o,e=QS(t,e).index,t[e++]!==160)throw qu("non-tag data",t);e=Kq(t,e).index,e=QS(t,e).index;let{oid:s}=Xge(t,e);switch(s){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw qu("unknown hash OID "+s,t)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw qu("Ed448 certificate channel binding is not currently supported by Postgres")}throw qu("unknown OID "+i,t)}Qge.exports={signatureAlgorithmHashFromCertificate:I5e}});var i_e=v((U6t,n_e)=>{"use strict";var jc=Yq(),{signatureAlgorithmHashFromCertificate:P5e}=e_e();function O5e(t){let e=/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,r=/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g;return t.replace(e," ").replace(r,"").normalize("NFKC")}var Zq=1e5;function N5e(t,e,r=Zq){let n=["SCRAM-SHA-256"];e&&n.unshift("SCRAM-SHA-256-PLUS");let i=n.find(a=>t.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+n.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let o=jc.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:o,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+o,message:"SASLInitialResponse",scramMaxIterations:r}}async function k5e(t,e,r,n){if(t.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof r!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let i=L5e(r);if(i.nonce.startsWith(t.clientNonce)){if(i.nonce.length===t.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let o=typeof t.scramMaxIterations=="number"?t.scramMaxIterations:Zq;if(o!==0&&i.iteration>o)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count "+i.iteration+" exceeds scramMaxIterations of "+o);let s="n=*,r="+t.clientNonce,a="r="+i.nonce+",s="+i.salt+",i="+i.iteration,c=n?"eSws":"biws";if(t.mechanism==="SCRAM-SHA-256-PLUS"){let w=n.getPeerCertificate().raw,T=P5e(w);(T==="MD5"||T==="SHA-1")&&(T="SHA-256");let C=await jc.hashByName(T,w);c=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(C)]).toString("base64")}let l="c="+c+",r="+i.nonce,u=s+","+a+","+l,d=Buffer.from(i.salt,"base64"),f=await jc.deriveKey(O5e(e),d,i.iteration),p=await jc.hmacSha256(f,"Client Key"),h=await jc.sha256(p),m=await jc.hmacSha256(h,u),y=U5e(Buffer.from(p),Buffer.from(m)).toString("base64"),S=await jc.hmacSha256(f,"Server Key"),b=await jc.hmacSha256(S,u);t.message="SASLResponse",t.serverSignature=Buffer.from(b).toString("base64"),t.response=l+",p="+y}function M5e(t,e){if(t.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:r}=$5e(e);if(r!==t.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function D5e(t){if(typeof t!="string")throw new TypeError("SASL: text must be a string");return t.split("").map((e,r)=>t.charCodeAt(r)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function t_e(t){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(t)}function r_e(t){if(typeof t!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(t.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let r=e[0],n=e.substring(2);return[r,n]}))}function L5e(t){let e=r_e(t),r=e.get("r");if(r){if(!D5e(r))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!t_e(n))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/.test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let o=parseInt(i,10);return{nonce:r,salt:n,iteration:o}}function $5e(t){let e=r_e(t),r=e.get("e"),n=e.get("v");if(r)throw new Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${r}"`);if(n){if(!t_e(n))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:n}}function U5e(t,e){if(!Buffer.isBuffer(t))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(t.length!==e.length)throw new Error("Buffer lengths must match");if(t.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(t.map((r,n)=>t[n]^e[n]))}n_e.exports={startSession:N5e,continueSession:k5e,finalizeSession:M5e,DEFAULT_MAX_SCRAM_ITERATIONS:Zq}});var tP=v((F6t,o_e)=>{"use strict";var F5e=JS();function eP(t){this._types=t||F5e,this.text={},this.binary={}}eP.prototype.getOverrides=function(t){switch(t){case"text":return this.text;case"binary":return this.binary;default:return{}}};eP.prototype.setTypeParser=function(t,e,r){typeof e=="function"&&(r=e,e="text"),this.getOverrides(e)[t]=r};eP.prototype.getTypeParser=function(t,e){return e=e||"text",this.getOverrides(e)[t]||this._types.getTypeParser(t,e)};o_e.exports=eP});var c_e=v((B6t,a_e)=>{"use strict";function lm(t,e={}){if(t.charAt(0)==="/"){let c=t.split(" ");return{host:c[0],database:c[1]}}let r=Object.create(null),n,i=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(t)&&(t=encodeURI(t).replace(/%25(\d\d)/g,"%$1"));try{try{n=new URL(t,"postgres://base")}catch{n=new URL(t.replace("@/","@___DUMMY___/"),"postgres://base"),i=!0}}catch(c){throw c.input&&(c.input="*****REDACTED*****"),c}for(let c of n.searchParams.entries())r[c[0]]=c[1];if(r.user=r.user||decodeURIComponent(n.username),r.password=r.password||decodeURIComponent(n.password),n.protocol=="socket:")return r.host=decodeURI(n.pathname),r.database=n.searchParams.get("db"),r.client_encoding=n.searchParams.get("encoding"),r;let o=i?"":n.hostname;r.host?o&&/^%2f/i.test(o)&&(n.pathname=o+n.pathname):r.host=decodeURIComponent(o),r.port||(r.port=n.port);let s=n.pathname.slice(1)||null;r.database=s?decodeURI(s):null,(r.ssl==="true"||r.ssl==="1")&&(r.ssl=!0),r.ssl==="0"&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={});let a=r.sslcert||r.sslkey||r.sslrootcert?Z("fs"):null;if(r.sslcert&&(r.ssl.cert=a.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=a.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=a.readFileSync(r.sslrootcert).toString()),e.useLibpqCompat&&r.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(r.uselibpqcompat==="true"||e.useLibpqCompat)switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":{r.ssl.rejectUnauthorized=!1;break}case"require":{r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!r.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");r.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{r.sslmode!=="verify-full"&&Jq(r.sslmode);break}case"no-verify":{r.ssl.rejectUnauthorized=!1;break}}return r}function B5e(t){return Object.entries(t).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),Object.create(null))}function s_e(t){return Object.entries(t).reduce((r,[n,i])=>{if(n==="ssl"){let o=i;typeof o=="boolean"&&(r[n]=o),typeof o=="object"&&(r[n]=B5e(o))}else if(i!=null)if(n==="port"){if(i!==""){let o=parseInt(i,10);if(isNaN(o))throw new Error(`Invalid ${n}: ${i}`);r[n]=o}}else r[n]=i;return r},Object.create(null))}function j5e(t){return s_e(lm(t))}function Jq(t){!Jq.warned&&typeof process<"u"&&process.emitWarning&&(Jq.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
22
+ `)+1))),this.lastActivityTimestamp=new Date}trace(e,r){(0,kb.trace)(r??wa.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,Mb.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,r,n,i;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},MCe)),!((r=(e=this.callRefTimer).hasRef)===null||r===void 0)&&r.call(e)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(i=(n=this.callRefTimer).ref)===null||i===void 0||i.call(n))}callRefTimerUnref(){var e,r,n;(!(!((e=this.callRefTimer)===null||e===void 0)&&e.hasRef)||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(n=(r=this.callRefTimer)===null||r===void 0?void 0:r.unref)===null||n===void 0||n.call(r))}removeConnectivityStateWatcher(e){let r=this.connectivityStateWatchers.findIndex(n=>n===e);r>=0&&this.connectivityStateWatchers.splice(r,1)}updateState(e){(0,kb.trace)(wa.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,Mb.uriToString)(this.target)+" "+Vn.ConnectivityState[this.connectivityState]+" -> "+Vn.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+Vn.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;let r=this.connectivityStateWatchers.slice();for(let n of r)e!==n.currentState&&(n.timer&&clearTimeout(n.timer),this.removeConnectivityStateWatcher(n),n.callback());e!==Vn.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(let r of this.wrappedSubchannels)r.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,r){return this.currentPicker.pick({metadata:e,extraPickInfo:r})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,r){return this.connectivityState!==Vn.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,r,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(Vn.ConnectivityState.IDLE),this.currentPicker=new sM.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var r,n;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let o=new Date().valueOf()-this.lastActivityTimestamp.valueOf();o>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-o)},e),(n=(r=this.idleTimer).unref)===null||n===void 0||n.call(r)}maybeStartIdleTimer(){this.connectivityState!==Vn.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===wa.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,r,n,i,o){let s=(0,iM.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+s+'] method="'+r+'"'),new ICe.LoadBalancingCall(this,e,r,n,i,o,s)}createRetryingCall(e,r,n,i,o){let s=(0,iM.getNextCallNumber)();return this.trace("createRetryingCall ["+s+'] method="'+r+'"'),new oM.RetryingCall(this,e,r,n,i,o,s,this.retryBufferTracker,Db.get(this.getTarget()))}createResolvingCall(e,r,n,i,o){let s=(0,iM.getNextCallNumber)();this.trace("createResolvingCall ["+s+'] method="'+e+'", deadline='+(0,PCe.deadlineToString)(r));let a={deadline:r,flags:o??wa.Propagate.DEFAULTS,host:n??this.defaultAuthority,parentCall:i},c=new OCe.ResolvingCall(this,e,a,this.filterStackFactory.clone(),s);return this.onCallStart(),c.addStatusWatcher(l=>{this.onCallEnd(l)}),c}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState(Vn.ConnectivityState.SHUTDOWN),this.currentPicker=new cM;for(let r of this.configSelectionQueue)r.cancelWithStatus(wa.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let r of this.pickQueue)r.cancelWithStatus(wa.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,Gg.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),(e=this.configSelector)===null||e===void 0||e.unref(),this.configSelector=null}getTarget(){return(0,Mb.uriToString)(this.target)}getConnectivityState(e){let r=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),r}watchConnectivityState(e,r,n){if(this.connectivityState===Vn.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let i=null;if(r!==1/0){let s=r instanceof Date?r:new Date(r),a=new Date;if(r===-1/0||s<=a){process.nextTick(n,new Error("Deadline passed without connectivity state change"));return}i=setTimeout(()=>{this.removeConnectivityStateWatcher(o),n(new Error("Deadline passed without connectivity state change"))},s.getTime()-a.getTime())}let o={currentState:e,callback:n,timer:i};this.connectivityStateWatchers.push(o)}getChannelzRef(){return this.channelzRef}createCall(e,r,n,i,o){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===Vn.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,r,n,i,o)}getOptions(){return this.options}};Al.InternalChannel=uM});var iN=v(Lb=>{"use strict";Object.defineProperty(Lb,"__esModule",{value:!0});Lb.ChannelImplementation=void 0;var FCe=Td(),BCe=dM(),fM=class{constructor(e,r,n){if(typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof FCe.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new BCe.InternalChannel(e,r,n)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,r,n){this.internalChannel.watchConnectivityState(e,r,n)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,r,n,i,o){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,r,n,i,o)}};Lb.ChannelImplementation=fM});var h9=v(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ServerDuplexStreamImpl=Ei.ServerWritableStreamImpl=Ei.ServerReadableStreamImpl=Ei.ServerUnaryCallImpl=void 0;Ei.serverErrorToStatus=SM;var jCe=Z("events"),_M=Z("stream"),yM=Ve(),p9=Kt();function SM(t,e){var r;let n={code:yM.Status.UNKNOWN,details:"message"in t?t.message:"Unknown Error",metadata:(r=e??t.metadata)!==null&&r!==void 0?r:null};return"code"in t&&typeof t.code=="number"&&Number.isInteger(t.code)&&(n.code=t.code,"details"in t&&typeof t.details=="string"&&(n.details=t.details)),n}var pM=class extends jCe.EventEmitter{constructor(e,r,n,i){super(),this.path=e,this.call=r,this.metadata=n,this.request=i,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};Ei.ServerUnaryCallImpl=pM;var hM=class extends _M.Readable{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};Ei.ServerReadableStreamImpl=hM;var mM=class extends _M.Writable{constructor(e,r,n,i){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.request=i,this.pendingStatus={code:yM.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new p9.Metadata,this.on("error",o=>{this.pendingStatus=SM(o),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};Ei.ServerWritableStreamImpl=mM;var gM=class extends _M.Duplex{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.pendingStatus={code:yM.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new p9.Metadata,this.on("error",i=>{this.pendingStatus=SM(i),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};Ei.ServerDuplexStreamImpl=gM});var $b=v(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.ServerCredentials=void 0;Kd.createCertificateProviderServerCredentials=zCe;Kd.createServerCredentialsWithInterceptors=GCe;var EM=xO(),wl=class{constructor(e,r){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=r??null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(let r of this.watchers)r(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new vM}static createSsl(e,r,n=!1){var i;if(e!==null&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(r))throw new TypeError("keyCertPairs must be an array");if(typeof n!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let o=[],s=[];for(let a=0;a<r.length;a++){let c=r[a];if(c===null||typeof c!="object")throw new TypeError(`keyCertPair[${a}] must be an object`);if(!Buffer.isBuffer(c.private_key))throw new TypeError(`keyCertPair[${a}].private_key must be a Buffer`);if(!Buffer.isBuffer(c.cert_chain))throw new TypeError(`keyCertPair[${a}].cert_chain must be a Buffer`);o.push(c.cert_chain),s.push(c.private_key)}return new TM({requestCert:n,ciphers:EM.CIPHER_SUITES},{ca:(i=e??(0,EM.getDefaultRootsData)())!==null&&i!==void 0?i:void 0,cert:o,key:s})}};Kd.ServerCredentials=wl;var vM=class t extends wl{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof t}},TM=class t extends wl{constructor(e,r){super(e,r),this.options=Object.assign(Object.assign({},e),r)}_equals(e){if(this===e)return!0;if(!(e instanceof t))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let r=0;r<this.options.cert.length;r++){let n=this.options.cert[r],i=e.options.cert[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let r=0;r<this.options.key.length;r++){let n=this.options.key[r],i=e.options.key[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}},bM=class t extends wl{constructor(e,r,n){super({requestCert:r!==null,rejectUnauthorized:n,ciphers:EM.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=r,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var r;this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var r;super._removeWatcher(e),this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e?!0:e instanceof t?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate:!1}calculateSecureContextOptions(){var e;return this.latestIdentityUpdate===null||this.caCertificateProvider!==null&&this.latestCaUpdate===null?null:{ca:(e=this.latestCaUpdate)===null||e===void 0?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}};function zCe(t,e,r){return new bM(t,e,r)}var AM=class t extends wl{constructor(e,r){super({}),this.childCredentials=e,this.interceptors=r}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof t)||!this.childCredentials._equals(e.childCredentials)||this.interceptors.length!==e.interceptors.length)return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r]!==e.interceptors[r])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}};function GCe(t,e){return new AM(t,e)}});var qg=v(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.durationMessageToDuration=qCe;ls.msToDuration=VCe;ls.durationToMs=HCe;ls.isDuration=WCe;ls.isDurationMessage=YCe;ls.parseDuration=ZCe;ls.durationToString=JCe;function qCe(t){return{seconds:Number.parseInt(t.seconds),nanos:t.nanos}}function VCe(t){return{seconds:t/1e3|0,nanos:t%1e3*1e6|0}}function HCe(t){return t.seconds*1e3+t.nanos/1e6|0}function WCe(t){return typeof t.seconds=="number"&&typeof t.nanos=="number"}function YCe(t){return typeof t.seconds=="string"&&typeof t.nanos=="number"}var KCe=/^(\d+)(?:\.(\d+))?s$/;function ZCe(t){let e=t.match(KCe);return e?{seconds:Number.parseInt(e[1],10),nanos:e[2]?Number.parseInt(e[2].padEnd(9,"0"),10):0}:null}function JCe(t){if(t.nanos===0)return`${t.seconds}s`;let e;return t.nanos%1e6===0?e=1e6:t.nanos%1e3===0?e=1e3:e=1,`${t.seconds}.${t.nanos/e}s`}});var Fb=v(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.OrcaOobMetricsSubchannelWrapper=yn.GRPC_METRICS_HEADER=yn.ServerMetricRecorder=yn.PerRequestMetricRecorder=void 0;yn.createOrcaClient=y9;yn.createMetricsReader=iIe;var XCe=CT(),wM=qg(),QCe=Td(),eIe=zg(),m9=Ve(),tIe=bd(),rIe=Lr(),g9=null;function Ub(){if(g9)return g9;let t=fk().loadSync,e=t("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,XCe.loadPackageDefinition)(e)}var xM=class{constructor(){this.message={}}recordRequestCostMetric(e,r){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=r}recordUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}recordNamedMetric(e,r){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=r}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return Ub().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};yn.PerRequestMetricRecorder=xM;var nIe=3e4,RM=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{let r=e.request.report_interval?(0,wM.durationToMs)((0,wM.durationMessageToDuration)(e.request.report_interval)):nIe,n=setInterval(()=>{e.write(this.message)},r);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var r;(r=this.message.utilization)===null||r===void 0||delete r[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){let r=Ub().xds.service.orca.v3.OpenRcaService.service;e.addService(r,this.serviceImplementation)}};yn.ServerMetricRecorder=RM;function y9(t){let e=Ub().xds.service.orca.v3.OpenRcaService;return new e("unused",QCe.ChannelCredentials.createInsecure(),{channelOverride:t})}yn.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var _9="grpc_orca_load_report";function iIe(t,e){return(r,n,i)=>{let o=i.getOpaque(_9);if(o)t(o);else{let s=i.get(yn.GRPC_METRICS_HEADER);s.length>0&&(o=Ub().xds.data.orca.v3.OrcaLoadReport.deserialize(s[0]),t(o),i.setOpaque(_9,o))}e&&e(r,n,i)}}var S9="orca_oob_metrics",CM=class{constructor(e,r){this.metricsListener=e,this.intervalMs=r,this.dataProducer=null}setSubchannel(e){let r=e.getOrCreateDataProducer(S9,oIe);this.dataProducer=r,r.addDataWatcher(this)}destroy(){var e;(e=this.dataProducer)===null||e===void 0||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}},IM=class{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new tIe.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let r=e.getChannel();this.client=y9(r),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var r;this.dataWatchers.delete(e),this.dataWatchers.size===0?(this.subchannel.removeDataProducer(S9),(r=this.metricsCall)===null||r===void 0||r.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==rIe.ConnectivityState.READY)return;let r=Math.min(...Array.from(this.dataWatchers).map(n=>n.getInterval()));if(!this.metricsCall||r!==this.currentInterval){(e=this.metricsCall)===null||e===void 0||e.cancel(),this.currentInterval=r;let n=this.client.streamCoreMetrics({report_interval:(0,wM.msToDuration)(r)});this.metricsCall=n,n.on("data",i=>{this.dataWatchers.forEach(o=>{o.onMetricsUpdate(i)})}),n.on("error",i=>{if(this.metricsCall=null,i.code===m9.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}i.code!==m9.Status.CANCELLED&&this.backoffTimer.runOnce()})}}},PM=class extends eIe.BaseSubchannelWrapper{constructor(e,r,n){super(e),this.addDataWatcher(new CM(r,n))}getWrappedSubchannel(){return this.child}};yn.OrcaOobMetricsSubchannelWrapper=PM;function oIe(t){return new IM(t)}});var $M=v(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.BaseServerInterceptingCall=Hn.ServerInterceptingCall=Hn.ResponderBuilder=Hn.ServerListenerBuilder=void 0;Hn.isInterceptingServerListener=cIe;Hn.getServerInterceptingCall=pIe;var zb=Kt(),Ur=Ve(),Zd=Z("http2"),E9=iT(),v9=Z("zlib"),sIe=Gk(),x9=ht(),aIe=Z("tls"),T9=Fb(),R9="server_call";function xl(t){x9.trace(Ur.LogVerbosity.DEBUG,R9,t)}var NM=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};Hn.ServerListenerBuilder=NM;function cIe(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var kM=class{constructor(e,r){this.listener=e,this.nextListener=r,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,!this.cancelled&&(this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,!this.cancelled&&(this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}},MM=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};Hn.ResponderBuilder=MM;var Bb={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveHalfClose:t=>{t()},onCancel:()=>{}},jb={start:t=>{t()},sendMetadata:(t,e)=>{e(t)},sendMessage:(t,e)=>{e(t)},sendStatus:(t,e)=>{e(t)}},DM=class{constructor(e,r){var n,i,o,s;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(n=r?.start)!==null&&n!==void 0?n:jb.start,sendMetadata:(i=r?.sendMetadata)!==null&&i!==void 0?i:jb.sendMetadata,sendMessage:(o=r?.sendMessage)!==null&&o!==void 0?o:jb.sendMessage,sendStatus:(s=r?.sendStatus)!==null&&s!==void 0?s:jb.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(r=>{var n,i,o,s;let a={onReceiveMetadata:(n=r?.onReceiveMetadata)!==null&&n!==void 0?n:Bb.onReceiveMetadata,onReceiveMessage:(i=r?.onReceiveMessage)!==null&&i!==void 0?i:Bb.onReceiveMessage,onReceiveHalfClose:(o=r?.onReceiveHalfClose)!==null&&o!==void 0?o:Bb.onReceiveHalfClose,onCancel:(s=r?.onCancel)!==null&&s!==void 0?s:Bb.onCancel},c=new kM(a,e);this.nextCall.start(c)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,r=>{this.processingMetadata=!1,this.nextCall.sendMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,r){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new zb.Metadata),this.responder.sendMessage(e,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=n,this.pendingMessageCallback=r):this.nextCall.sendMessage(n,r)})}sendStatus(e){this.responder.sendStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextCall.sendStatus(r)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};Hn.ServerInterceptingCall=DM;var C9="grpc-accept-encoding",LM="grpc-encoding",b9="grpc-message",A9="grpc-status",OM="grpc-timeout",lIe=/(\d{1,8})\s*([HMSmun])/,uIe={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},dIe={[C9]:"identity,deflate,gzip",[LM]:"identity"},w9={[Zd.constants.HTTP2_HEADER_STATUS]:Zd.constants.HTTP_STATUS_OK,[Zd.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},fIe={waitForTrailers:!0},Gb=class{constructor(e,r,n,i,o){var s,a;this.stream=e,this.callEventTracker=n,this.handler=i,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=Ur.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Ur.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new T9.PerRequestMetricRecorder,this.stream.once("close",()=>{var f;xl("Request to method "+((f=this.handler)===null||f===void 0?void 0:f.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:Ur.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",f=>{this.handleDataFrame(f)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in o&&(this.maxSendMessageSize=o["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in o&&(this.maxReceiveMessageSize=o["grpc.max_receive_message_length"]),this.host=(s=r[":authority"])!==null&&s!==void 0?s:r.host,this.decoder=new sIe.StreamDecoder(this.maxReceiveMessageSize);let c=zb.Metadata.fromHttp2Headers(r);x9.isTracerEnabled(R9)&&xl("Request to "+this.handler.path+" received headers "+JSON.stringify(c.toJSON()));let l=c.get(OM);l.length>0&&this.handleTimeoutHeader(l[0]);let u=c.get(LM);u.length>0&&(this.incomingEncoding=u[0]),c.remove(OM),c.remove(LM),c.remove(C9),c.remove(Zd.constants.HTTP2_HEADER_ACCEPT_ENCODING),c.remove(Zd.constants.HTTP2_HEADER_TE),c.remove(Zd.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=c;let d=(a=e.session)===null||a===void 0?void 0:a.socket;this.connectionInfo={localAddress:d?.localAddress,localPort:d?.localPort,remoteAddress:d?.remoteAddress,remotePort:d?.remotePort},this.shouldSendMetrics=!!o["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){let r=e.toString().match(lIe);if(r===null){let o={code:Ur.Status.INTERNAL,details:`Invalid ${OM} value "${e}"`,metadata:null};process.nextTick(()=>{this.sendStatus(o)});return}let n=+r[1]*uIe[r[2]]|0,i=new Date;this.deadline=i.setMilliseconds(i.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{let o={code:Ur.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(o)},n)}checkCancelled(){return!this.cancelled&&(this.stream.destroyed||this.stream.closed)&&(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;(e=this.listener)===null||e===void 0||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new zb.Metadata)}serializeMessage(e){let r=this.handler.serialize(e),n=r.byteLength,i=Buffer.allocUnsafe(n+5);return i.writeUInt8(0,0),i.writeUInt32BE(n,1),r.copy(i,5),i}decompressMessage(e,r){let n=e.subarray(5);if(r==="identity")return n;if(r==="deflate"||r==="gzip"){let i;return r==="deflate"?i=v9.createInflate():i=v9.createGunzip(),new Promise((o,s)=>{let a=0,c=[];i.on("error",l=>{s({code:Ur.Status.INTERNAL,details:"Failed to decompress message"})}),i.on("data",l=>{c.push(l),a+=l.byteLength,this.maxReceiveMessageSize!==-1&&a>this.maxReceiveMessageSize&&(i.destroy(),s({code:Ur.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),i.on("end",()=>{o(Buffer.concat(c))}),i.write(n),i.end()})}else return Promise.reject({code:Ur.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${r}"`})}async decompressAndMaybePush(e){if(e.type!=="COMPRESSED")throw new Error(`Invalid queue entry type: ${e.type}`);let n=e.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",i;try{i=await this.decompressMessage(e.compressedMessage,n)}catch(o){this.sendStatus(o);return}try{e.parsedMessage=this.handler.deserialize(i)}catch(o){this.sendStatus({code:Ur.Status.INTERNAL,details:`Error deserializing request: ${o.message}`});return}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let e=this.readQueue.shift();e.type==="READABLE"?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var r;if(this.checkCancelled())return;xl("Request to "+this.handler.path+" received data frame of size "+e.length);let n;try{n=this.decoder.write(e)}catch(i){this.sendStatus({code:Ur.Status.RESOURCE_EXHAUSTED,details:i.message});return}for(let i of n){this.stream.pause();let o={type:"COMPRESSED",compressedMessage:i,parsedMessage:null};this.readQueue.push(o),this.decompressAndMaybePush(o),(r=this.callEventTracker)===null||r===void 0||r.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){xl("Request to "+this.handler.path+" start called"),!this.checkCancelled()&&(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let r=e?e.toHttp2Headers():null,n=Object.assign(Object.assign(Object.assign({},w9),dIe),r);this.stream.respond(n,fIe)}sendMessage(e,r){if(this.checkCancelled())return;let n;try{n=this.serializeMessage(e)}catch(i){this.sendStatus({code:Ur.Status.INTERNAL,details:`Error serializing response: ${(0,E9.getErrorMessage)(i)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&n.length-5>this.maxSendMessageSize){this.sendStatus({code:Ur.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${n.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),xl("Request to "+this.handler.path+" sent data frame of size "+n.length),this.stream.write(n,i=>{var o;if(i){this.sendStatus({code:Ur.Status.INTERNAL,details:`Error writing message: ${(0,E9.getErrorMessage)(i)}`,metadata:null});return}(o=this.callEventTracker)===null||o===void 0||o.addMessageSent(),r()})}sendStatus(e){var r,n,i;if(this.checkCancelled())return;xl("Request to method "+((r=this.handler)===null||r===void 0?void 0:r.path)+" ended with status code: "+Ur.Status[e.code]+" details: "+e.details);let o=(i=(n=e.metadata)===null||n===void 0?void 0:n.clone())!==null&&i!==void 0?i:new zb.Metadata;if(this.shouldSendMetrics&&o.set(T9.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let s=Object.assign({[A9]:e.code,[b9]:encodeURI(e.details)},o.toHttp2Headers());this.stream.sendTrailers(s),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let s=Object.assign(Object.assign({[A9]:e.code,[b9]:encodeURI(e.details)},w9),o.toHttp2Headers());this.stream.respond(s,{endStream:!0}),this.notifyOnCancel()}}startRead(){xl("Request to "+this.handler.path+" startRead called"),!this.checkCancelled()&&(this.isReadPending=!0,this.readQueue.length===0?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;let r=(e=this.stream.session)===null||e===void 0?void 0:e.socket;return r?.remoteAddress?r.remotePort?`${r.remoteAddress}:${r.remotePort}`:r.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if(((e=this.stream.session)===null||e===void 0?void 0:e.socket)instanceof aIe.TLSSocket){let r=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:r.raw?r:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}};Hn.BaseServerInterceptingCall=Gb;function pIe(t,e,r,n,i,o){let s={path:i.path,requestStream:i.type==="clientStream"||i.type==="bidi",responseStream:i.type==="serverStream"||i.type==="bidi",requestDeserialize:i.deserialize,responseSerialize:i.serialize},a=new Gb(e,r,n,i,o);return t.reduce((c,l)=>l(s,c),a)}});var D9=v(Ra=>{"use strict";var hIe=Ra&&Ra.__runInitializers||function(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0},mIe=Ra&&Ra.__esDecorate||function(t,e,r,n,i,o){function s(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(S){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(S||null))};var y=(0,r[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],h);if(a==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=s(y.get))&&(u.get=d),(d=s(y.set))&&(u.set=d),(d=s(y.init))&&i.unshift(d)}else(d=s(y))&&(a==="field"?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,n.name,u),f=!0};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Server=void 0;var Xr=Z("http2"),gIe=Z("util"),Nt=Ve(),Qd=h9(),UM=$b(),I9=ai(),Xd=ht(),xa=Zr(),vi=Dr(),zt=va(),P9=$M(),Jd=~(1<<31),FM=~(1<<31),_Ie=2e4,O9=~(1<<31),{HTTP2_HEADER_PATH:N9}=Xr.constants,yIe="server",k9=Buffer.from("max_age");function M9(t){Xd.trace(Nt.LogVerbosity.DEBUG,"server_call",t)}function SIe(){}function EIe(t){return function(e,r){return gIe.deprecate(e,t)}}function BM(t){return{code:Nt.Status.UNIMPLEMENTED,details:`The server does not implement the method ${t}`}}function vIe(t,e){let r=BM(e);switch(t){case"unary":return(n,i)=>{i(r,null)};case"clientStream":return(n,i)=>{i(r,null)};case"serverStream":return n=>{n.emit("error",r)};case"bidi":return n=>{n.emit("error",r)};default:throw new Error(`Invalid handlerType ${t}`)}}var TIe=(()=>{var t;let e=[],r;return t=class{constructor(i){var o,s,a,c,l,u;this.boundPorts=(hIe(this,e),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=i??{},this.options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new zt.ChannelzTraceStub,this.callTracker=new zt.ChannelzCallTrackerStub,this.listenerChildrenTracker=new zt.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new zt.ChannelzChildrenTrackerStub):(this.channelzTrace=new zt.ChannelzTrace,this.callTracker=new zt.ChannelzCallTracker,this.listenerChildrenTracker=new zt.ChannelzChildrenTracker,this.sessionChildrenTracker=new zt.ChannelzChildrenTracker),this.channelzRef=(0,zt.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(o=this.options["grpc.max_connection_age_ms"])!==null&&o!==void 0?o:Jd,this.maxConnectionAgeGraceMs=(s=this.options["grpc.max_connection_age_grace_ms"])!==null&&s!==void 0?s:Jd,this.keepaliveTimeMs=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:FM,this.keepaliveTimeoutMs=(c=this.options["grpc.keepalive_timeout_ms"])!==null&&c!==void 0?c:_Ie,this.sessionIdleTimeout=(l=this.options["grpc.max_connection_idle_ms"])!==null&&l!==void 0?l:O9,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=(u=this.options.interceptors)!==null&&u!==void 0?u:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(i){var o,s,a;let c=this.sessions.get(i),l=i.socket,u=l.remoteAddress?(0,xa.stringToSubchannelAddress)(l.remoteAddress,l.remotePort):null,d=l.localAddress?(0,xa.stringToSubchannelAddress)(l.localAddress,l.localPort):null,f;if(i.encrypted){let h=l,m=h.getCipher(),y=h.getCertificate(),S=h.getPeerCertificate();f={cipherSuiteStandardName:(o=m.standardName)!==null&&o!==void 0?o:null,cipherSuiteOtherName:m.standardName?null:m.name,localCertificate:y&&"raw"in y?y.raw:null,remoteCertificate:S&&"raw"in S?S.raw:null}}else f=null;return{remoteAddress:u,localAddress:d,security:f,remoteName:null,streamsStarted:c.streamTracker.callsStarted,streamsSucceeded:c.streamTracker.callsSucceeded,streamsFailed:c.streamTracker.callsFailed,messagesSent:c.messagesSent,messagesReceived:c.messagesReceived,keepAlivesSent:c.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:c.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:c.lastMessageSentTimestamp,lastMessageReceivedTimestamp:c.lastMessageReceivedTimestamp,localFlowControlWindow:(s=i.state.localWindowSize)!==null&&s!==void 0?s:null,remoteFlowControlWindow:(a=i.state.remoteWindowSize)!==null&&a!==void 0?a:null}}trace(i){Xd.trace(Nt.LogVerbosity.DEBUG,yIe,"("+this.channelzRef.id+") "+i)}keepaliveTrace(i){Xd.trace(Nt.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+i)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(i,o){if(i===null||typeof i!="object"||o===null||typeof o!="object")throw new Error("addService() requires two objects as arguments");let s=Object.keys(i);if(s.length===0)throw new Error("Cannot add an empty service to a server");s.forEach(a=>{let c=i[a],l;c.requestStream?c.responseStream?l="bidi":l="clientStream":c.responseStream?l="serverStream":l="unary";let u=o[a],d;if(u===void 0&&typeof c.originalName=="string"&&(u=o[c.originalName]),u!==void 0?d=u.bind(o):d=vIe(l,a),this.register(c.path,d,c.responseSerialize,c.requestDeserialize,l)===!1)throw new Error(`Method handler for ${c.path} already provided.`)})}removeService(i){if(i===null||typeof i!="object")throw new Error("removeService() requires object as argument");Object.keys(i).forEach(s=>{let a=i[s];this.unregister(a.path)})}bind(i,o){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(i){return(0,zt.registerChannelzSocket)((0,xa.subchannelAddressToString)(i),()=>({localAddress:i,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(i){(0,zt.unregisterChannelzRef)(i)}createHttp2Server(i){let o;if(i._isSecure()){let s=i._getConstructorOptions(),a=i._getSecureContextOptions(),c=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),s),a),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),l=a!==null;this.trace("Initial credentials valid: "+l),o=Xr.createSecureServer(c),o.prependListener("connection",d=>{l||(this.trace("Dropped connection from "+JSON.stringify(d.address())+" due to unloaded credentials"),d.destroy())}),o.on("secureConnection",d=>{d.on("error",f=>{this.trace("An incoming TLS connection closed with error: "+f.message)})});let u=d=>{if(d){let f=o;try{f.setSecureContext(d)}catch(p){Xd.log(Nt.LogVerbosity.ERROR,"Failed to set secure context with error "+p.message),d=null}}l=d!==null,this.trace("Post-update credentials valid: "+l)};i._addWatcher(u),o.on("close",()=>{i._removeWatcher(u)})}else o=Xr.createServer(this.commonServerOptions);return o.setTimeout(0,SIe),this._setupHandlers(o,i._getInterceptors()),o}bindOneAddress(i,o){this.trace("Attempting to bind "+(0,xa.subchannelAddressToString)(i));let s=this.createHttp2Server(o.credentials);return new Promise((a,c)=>{let l=u=>{this.trace("Failed to bind "+(0,xa.subchannelAddressToString)(i)+" with error "+u.message),a({port:"port"in i?i.port:1,error:u.message})};s.once("error",l),s.listen(i,()=>{let u=s.address(),d;typeof u=="string"?d={path:u}:d={host:u.address,port:u.port};let f=this.experimentalRegisterListenerToChannelz(d);this.listenerChildrenTracker.refChild(f),this.http2Servers.set(s,{channelzRef:f,sessions:new Set,ownsChannelzRef:!0}),o.listeningServers.add(s),this.trace("Successfully bound "+(0,xa.subchannelAddressToString)(d)),a({port:"port"in d?d.port:1}),s.removeListener("error",l)})})}async bindManyPorts(i,o){if(i.length===0)return{count:0,port:0,errors:[]};if((0,xa.isTcpSubchannelAddress)(i[0])&&i[0].port===0){let s=await this.bindOneAddress(i[0],o);if(s.error){let a=await this.bindManyPorts(i.slice(1),o);return Object.assign(Object.assign({},a),{errors:[s.error,...a.errors]})}else{let a=i.slice(1).map(u=>(0,xa.isTcpSubchannelAddress)(u)?{host:u.host,port:s.port}:u),c=await Promise.all(a.map(u=>this.bindOneAddress(u,o))),l=[s,...c];return{count:l.filter(u=>u.error===void 0).length,port:s.port,errors:l.filter(u=>u.error).map(u=>u.error)}}}else{let s=await Promise.all(i.map(a=>this.bindOneAddress(a,o)));return{count:s.filter(a=>a.error===void 0).length,port:s[0].port,errors:s.filter(a=>a.error).map(a=>a.error)}}}async bindAddressList(i,o){let s=await this.bindManyPorts(i,o);if(s.count>0)return s.count<i.length&&Xd.log(Nt.LogVerbosity.INFO,`WARNING Only ${s.count} addresses added out of total ${i.length} resolved`),s.port;{let a=`No address added out of total ${i.length} resolved`;throw Xd.log(Nt.LogVerbosity.ERROR,a),new Error(`${a} errors: [${s.errors.join(",")}]`)}}resolvePort(i){return new Promise((o,s)=>{let a=!1,c=(u,d,f,p)=>{if(a)return!0;if(a=!0,!u.ok)return s(new Error(u.error.details)),!0;let h=[].concat(...u.value.map(m=>m.addresses));return h.length===0?(s(new Error(`No addresses resolved for port ${i}`)),!0):(o(h),!0)};(0,I9.createResolver)(i,c,this.options).updateResolution()})}async bindPort(i,o){let s=await this.resolvePort(i);if(o.cancelled)throw this.completeUnbind(o),new Error("bindAsync operation cancelled by unbind call");let a=await this.bindAddressList(s,o);if(o.cancelled)throw this.completeUnbind(o),new Error("bindAsync operation cancelled by unbind call");return a}normalizePort(i){let o=(0,vi.parseUri)(i);if(o===null)throw new Error(`Could not parse port "${i}"`);let s=(0,I9.mapUriDefaultScheme)(o);if(s===null)throw new Error(`Could not get a default scheme for port "${i}"`);return s}bindAsync(i,o,s){if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof i!="string")throw new TypeError("port must be a string");if(o===null||!(o instanceof UM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof s!="function")throw new TypeError("callback must be a function");this.trace("bindAsync port="+i);let a=this.normalizePort(i),c=(f,p)=>{process.nextTick(()=>s(f,p))},l=this.boundPorts.get((0,vi.uriToString)(a));if(l){if(!o._equals(l.credentials)){c(new Error(`${i} already bound with incompatible credentials`),0);return}l.cancelled=!1,l.completionPromise?l.completionPromise.then(f=>s(null,f),f=>s(f,0)):c(null,l.portNumber);return}l={mapKey:(0,vi.uriToString)(a),originalUri:a,completionPromise:null,cancelled:!1,portNumber:0,credentials:o,listeningServers:new Set};let u=(0,vi.splitHostPort)(a.path),d=this.bindPort(a,l);l.completionPromise=d,u?.port===0?d.then(f=>{let p={scheme:a.scheme,authority:a.authority,path:(0,vi.combineHostPort)({host:u.host,port:f})};l.mapKey=(0,vi.uriToString)(p),l.completionPromise=null,l.portNumber=f,this.boundPorts.set(l.mapKey,l),s(null,f)},f=>{s(f,0)}):(this.boundPorts.set(l.mapKey,l),d.then(f=>{l.completionPromise=null,l.portNumber=f,s(null,f)},f=>{s(f,0)}))}registerInjectorToChannelz(){return(0,zt.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(i,o,s=!1){if(i===null||!(i instanceof UM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(o);let a=this.createHttp2Server(i),c=new Set;return this.http2Servers.set(a,{channelzRef:o,sessions:c,ownsChannelzRef:s}),{injectConnection:l=>{a.emit("connection",l)},drain:l=>{var u,d;for(let f of c)this.closeSession(f);(d=(u=setTimeout(()=>{for(let f of c)f.destroy(Xr.constants.NGHTTP2_CANCEL)},l)).unref)===null||d===void 0||d.call(u)},destroy:()=>{this.closeServer(a);for(let l of c)this.closeSession(l)}}}createConnectionInjector(i){if(i===null||!(i instanceof UM.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");let o=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(i,o,!0)}closeServer(i,o){this.trace("Closing server with address "+JSON.stringify(i.address()));let s=this.http2Servers.get(i);i.close(()=>{s&&s.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(s.channelzRef),(0,zt.unregisterChannelzRef)(s.channelzRef)),this.http2Servers.delete(i),o?.()})}closeSession(i,o){var s;this.trace("Closing session initiated by "+((s=i.socket)===null||s===void 0?void 0:s.remoteAddress));let a=this.sessions.get(i),c=()=>{a&&(this.sessionChildrenTracker.unrefChild(a.ref),(0,zt.unregisterChannelzRef)(a.ref)),o?.()};i.closed?queueMicrotask(c):i.close(c)}completeUnbind(i){for(let o of i.listeningServers){let s=this.http2Servers.get(o);if(this.closeServer(o,()=>{i.listeningServers.delete(o)}),s)for(let a of s.sessions)this.closeSession(a)}this.boundPorts.delete(i.mapKey)}unbind(i){this.trace("unbind port="+i);let o=this.normalizePort(i),s=(0,vi.splitHostPort)(o.path);if(s?.port===0)throw new Error("Cannot unbind port 0");let a=this.boundPorts.get((0,vi.uriToString)(o));a&&(this.trace("unbinding "+a.mapKey+" originally bound as "+(0,vi.uriToString)(a.originalUri)),a.completionPromise?a.cancelled=!0:this.completeUnbind(a))}drain(i,o){var s,a;this.trace("drain port="+i+" graceTimeMs="+o);let c=this.normalizePort(i),l=(0,vi.splitHostPort)(c.path);if(l?.port===0)throw new Error("Cannot drain port 0");let u=this.boundPorts.get((0,vi.uriToString)(c));if(!u)return;let d=new Set;for(let f of u.listeningServers){let p=this.http2Servers.get(f);if(p)for(let h of p.sessions)d.add(h),this.closeSession(h,()=>{d.delete(h)})}(a=(s=setTimeout(()=>{for(let f of d)f.destroy(Xr.constants.NGHTTP2_CANCEL)},o)).unref)===null||a===void 0||a.call(s)}forceShutdown(){for(let i of this.boundPorts.values())i.cancelled=!0;this.boundPorts.clear();for(let i of this.http2Servers.keys())this.closeServer(i);this.sessions.forEach((i,o)=>{this.closeSession(o),o.destroy(Xr.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,zt.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(i,o,s,a,c){return this.handlers.has(i)?!1:(this.handlers.set(i,{func:o,serialize:s,deserialize:a,type:c,path:i}),!0)}unregister(i){return this.handlers.delete(i)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every(i=>!i.listening))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.started=!0}tryShutdown(i){var o;let s=l=>{(0,zt.unregisterChannelzRef)(this.channelzRef),i(l)},a=0;function c(){a--,a===0&&s()}this.shutdown=!0;for(let[l,u]of this.http2Servers.entries()){a++;let d=u.channelzRef.name;this.trace("Waiting for server "+d+" to close"),this.closeServer(l,()=>{this.trace("Server "+d+" finished closing"),c()});for(let f of u.sessions.keys()){a++;let p=(o=f.socket)===null||o===void 0?void 0:o.remoteAddress;this.trace("Waiting for session "+p+" to close"),this.closeSession(f,()=>{this.trace("Session "+p+" finished closing"),c()})}}a===0&&s()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(i,o){let s=o[Xr.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof s!="string"||!s.startsWith("application/grpc")?(i.respond({[Xr.constants.HTTP2_HEADER_STATUS]:Xr.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(i){M9("Received call to method "+i+" at address "+this.serverAddressString);let o=this.handlers.get(i);return o===void 0?(M9("No handler registered for method "+i+". Sending UNIMPLEMENTED status."),null):o}_respondWithError(i,o,s=null){var a,c;let l=Object.assign({"grpc-status":(a=i.code)!==null&&a!==void 0?a:Nt.Status.INTERNAL,"grpc-message":i.details,[Xr.constants.HTTP2_HEADER_STATUS]:Xr.constants.HTTP_STATUS_OK,[Xr.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(c=i.metadata)===null||c===void 0?void 0:c.toHttp2Headers());o.respond(l,{endStream:!0}),this.callTracker.addCallFailed(),s?.streamTracker.addCallFailed()}_channelzHandler(i,o,s){o.once("error",f=>{}),this.onStreamOpened(o);let a=this.sessions.get(o.session);if(this.callTracker.addCallStarted(),a?.streamTracker.addCallStarted(),!this._verifyContentType(o,s)){this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed();return}let c=s[N9],l=this._retrieveHandler(c);if(!l){this._respondWithError(BM(c),o,a);return}let u={addMessageSent:()=>{a&&(a.messagesSent+=1,a.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{a&&(a.messagesReceived+=1,a.lastMessageReceivedTimestamp=new Date)},onCallEnd:f=>{f.code===Nt.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:f=>{a&&(f?a.streamTracker.addCallSucceeded():a.streamTracker.addCallFailed())}},d=(0,P9.getServerInterceptingCall)([...i,...this.interceptors],o,s,u,l,this.options);this._runHandlerForCall(d,l)||(this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed(),d.sendStatus({code:Nt.Status.INTERNAL,details:`Unknown handler type: ${l.type}`}))}_streamHandler(i,o,s){if(o.once("error",u=>{}),this.onStreamOpened(o),this._verifyContentType(o,s)!==!0)return;let a=s[N9],c=this._retrieveHandler(a);if(!c){this._respondWithError(BM(a),o,null);return}let l=(0,P9.getServerInterceptingCall)([...i,...this.interceptors],o,s,null,c,this.options);this._runHandlerForCall(l,c)||l.sendStatus({code:Nt.Status.INTERNAL,details:`Unknown handler type: ${c.type}`})}_runHandlerForCall(i,o){let{type:s}=o;if(s==="unary")bIe(i,o);else if(s==="clientStream")AIe(i,o);else if(s==="serverStream")wIe(i,o);else if(s==="bidi")xIe(i,o);else return!1;return!0}_setupHandlers(i,o){if(i===null)return;let s=i.address(),a="null";s&&(typeof s=="string"?a=s:a=s.address+":"+s.port),this.serverAddressString=a;let c=this.channelzEnabled?this._channelzHandler:this._streamHandler,l=this.channelzEnabled?this._channelzSessionHandler(i):this._sessionHandler(i);i.on("stream",c.bind(this,o)),i.on("session",l)}_sessionHandler(i){return o=>{var s,a;(s=this.http2Servers.get(i))===null||s===void 0||s.sessions.add(o);let c=null,l=null,u=null,d=!1,f=this.enableIdleTimeout(o);if(this.maxConnectionAgeMs!==Jd){let S=this.maxConnectionAgeMs/10,b=Math.random()*S*2-S;c=setTimeout(()=>{var w,T;d=!0,this.trace("Connection dropped by max connection age: "+((w=o.socket)===null||w===void 0?void 0:w.remoteAddress));try{o.goaway(Xr.constants.NGHTTP2_NO_ERROR,~(1<<31),k9)}catch{o.destroy();return}o.close(),this.maxConnectionAgeGraceMs!==Jd&&(l=setTimeout(()=>{o.destroy()},this.maxConnectionAgeGraceMs),(T=l.unref)===null||T===void 0||T.call(l))},this.maxConnectionAgeMs+b),(a=c.unref)===null||a===void 0||a.call(c)}let p=()=>{u&&(clearTimeout(u),u=null)},h=()=>!o.destroyed&&this.keepaliveTimeMs<FM&&this.keepaliveTimeMs>0,m,y=()=>{var S;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),u=setTimeout(()=>{p(),m()},this.keepaliveTimeMs),(S=u.unref)===null||S===void 0||S.call(u))};m=()=>{var S;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let b="";try{o.ping((T,C,O)=>{p(),T?(this.keepaliveTrace("Ping failed with error: "+T.message),d=!0,o.destroy()):(this.keepaliveTrace("Received ping response"),y())})||(b="Ping returned false")}catch(w){b=(w instanceof Error?w.message:"")||"Unknown error"}if(b){this.keepaliveTrace("Ping send failed: "+b),this.trace("Connection dropped due to ping send error: "+b),d=!0,o.destroy();return}u=setTimeout(()=>{p(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),d=!0,o.destroy()},this.keepaliveTimeoutMs),(S=u.unref)===null||S===void 0||S.call(u)},y(),o.on("close",()=>{var S,b;d||this.trace(`Connection dropped by client ${(S=o.socket)===null||S===void 0?void 0:S.remoteAddress}`),c&&clearTimeout(c),l&&clearTimeout(l),p(),f!==null&&(clearTimeout(f.timeout),this.sessionIdleTimeouts.delete(o)),(b=this.http2Servers.get(i))===null||b===void 0||b.sessions.delete(o)})}}_channelzSessionHandler(i){return o=>{var s,a,c,l;let u=(0,zt.registerChannelzSocket)((a=(s=o.socket)===null||s===void 0?void 0:s.remoteAddress)!==null&&a!==void 0?a:"unknown",this.getChannelzSessionInfo.bind(this,o),this.channelzEnabled),d={ref:u,streamTracker:new zt.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(c=this.http2Servers.get(i))===null||c===void 0||c.sessions.add(o),this.sessions.set(o,d);let f=`${o.socket.remoteAddress}:${o.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+f),this.trace("Connection established by client "+f),this.sessionChildrenTracker.refChild(u);let p=null,h=null,m=null,y=!1,S=this.enableIdleTimeout(o);if(this.maxConnectionAgeMs!==Jd){let O=this.maxConnectionAgeMs/10,k=Math.random()*O*2-O;p=setTimeout(()=>{var P;y=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+f);try{o.goaway(Xr.constants.NGHTTP2_NO_ERROR,~(1<<31),k9)}catch{o.destroy();return}o.close(),this.maxConnectionAgeGraceMs!==Jd&&(h=setTimeout(()=>{o.destroy()},this.maxConnectionAgeGraceMs),(P=h.unref)===null||P===void 0||P.call(h))},this.maxConnectionAgeMs+k),(l=p.unref)===null||l===void 0||l.call(p)}let b=()=>{m&&(clearTimeout(m),m=null)},w=()=>!o.destroyed&&this.keepaliveTimeMs<FM&&this.keepaliveTimeMs>0,T,C=()=>{var O;w()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),m=setTimeout(()=>{b(),T()},this.keepaliveTimeMs),(O=m.unref)===null||O===void 0||O.call(m))};T=()=>{var O;if(!w())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let k="";try{o.ping((M,F,_)=>{b(),M?(this.keepaliveTrace("Ping failed with error: "+M.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+M.message+" return in "+F),y=!0,o.destroy()):(this.keepaliveTrace("Received ping response"),C())})||(k="Ping returned false")}catch(P){k=(P instanceof Error?P.message:"")||"Unknown error"}if(k){this.keepaliveTrace("Ping send failed: "+k),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+k),y=!0,o.destroy();return}d.keepAlivesSent+=1,m=setTimeout(()=>{b(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+f),y=!0,o.destroy()},this.keepaliveTimeoutMs),(O=m.unref)===null||O===void 0||O.call(m)},C(),o.on("close",()=>{var O;y||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+f),this.sessionChildrenTracker.unrefChild(u),(0,zt.unregisterChannelzRef)(u),p&&clearTimeout(p),h&&clearTimeout(h),b(),S!==null&&(clearTimeout(S.timeout),this.sessionIdleTimeouts.delete(o)),(O=this.http2Servers.get(i))===null||O===void 0||O.sessions.delete(o),this.sessions.delete(o)})}}enableIdleTimeout(i){var o,s;if(this.sessionIdleTimeout>=O9)return null;let a={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,i),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,i)};(s=(o=a.timeout).unref)===null||s===void 0||s.call(o),this.sessionIdleTimeouts.set(i,a);let{socket:c}=i;return this.trace("Enable idle timeout for "+c.remoteAddress+":"+c.remotePort),a}onIdleTimeout(i,o){let{socket:s}=o,a=i.sessionIdleTimeouts.get(o);a!==void 0&&a.activeStreams===0&&(Date.now()-a.lastIdle>=i.sessionIdleTimeout?(i.trace("Session idle timeout triggered for "+s?.remoteAddress+":"+s?.remotePort+" last idle at "+a.lastIdle),i.closeSession(o)):a.timeout.refresh())}onStreamOpened(i){let o=i.session,s=this.sessionIdleTimeouts.get(o);s&&(s.activeStreams+=1,i.once("close",s.onClose))}onStreamClose(i){var o,s;let a=this.sessionIdleTimeouts.get(i);a&&(a.activeStreams-=1,a.activeStreams===0&&(a.lastIdle=Date.now(),a.timeout.refresh(),this.trace("Session onStreamClose"+((o=i.socket)===null||o===void 0?void 0:o.remoteAddress)+":"+((s=i.socket)===null||s===void 0?void 0:s.remotePort)+" at "+a.lastIdle)))}},(()=>{let n=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;r=[EIe("Calling start() is no longer necessary. It can be safely omitted.")],mIe(t,null,r,{kind:"method",name:"start",static:!1,private:!1,access:{has:i=>"start"in i,get:i=>i.start},metadata:n},null,e),n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),t})();Ra.Server=TIe;async function bIe(t,e){let r;function n(s,a,c,l){if(s){t.sendStatus((0,Qd.serverErrorToStatus)(s,c));return}t.sendMessage(a,()=>{t.sendStatus({code:Nt.Status.OK,details:"OK",metadata:c??null})})}let i,o=null;t.start({onReceiveMetadata(s){i=s,t.startRead()},onReceiveMessage(s){if(o){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}o=s,t.startRead()},onReceiveHalfClose(){if(!o){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new Qd.ServerWritableStreamImpl(e.path,t,i,o);try{e.func(r,n)}catch(s){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${s.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"))}})}function AIe(t,e){let r;function n(i,o,s,a){if(i){t.sendStatus((0,Qd.serverErrorToStatus)(i,s));return}t.sendMessage(o,()=>{t.sendStatus({code:Nt.Status.OK,details:"OK",metadata:s??null})})}t.start({onReceiveMetadata(i){r=new Qd.ServerDuplexStreamImpl(e.path,t,i);try{e.func(r,n)}catch(o){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onReceiveMessage(i){r.push(i)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function wIe(t,e){let r,n,i=null;t.start({onReceiveMetadata(o){n=o,t.startRead()},onReceiveMessage(o){if(i){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}i=o,t.startRead()},onReceiveHalfClose(){if(!i){t.sendStatus({code:Nt.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new Qd.ServerWritableStreamImpl(e.path,t,n,i);try{e.func(r)}catch(o){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function xIe(t,e){let r;t.start({onReceiveMetadata(n){r=new Qd.ServerDuplexStreamImpl(e.path,t,n);try{e.func(r)}catch(i){t.sendStatus({code:Nt.Status.UNKNOWN,details:`Server method handler threw error ${i.message}`,metadata:null})}},onReceiveMessage(n){r.push(n)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}});var L9=v(qb=>{"use strict";Object.defineProperty(qb,"__esModule",{value:!0});qb.StatusBuilder=void 0;var jM=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){let e={};return this.code!==null&&(e.code=this.code),this.details!==null&&(e.details=this.details),this.metadata!==null&&(e.metadata=this.metadata),e}};qb.StatusBuilder=jM});var Yg=v(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.LeafLoadBalancer=lo.PickFirstLoadBalancer=lo.PickFirstLoadBalancingConfig=void 0;lo.shuffled=B9;lo.setup=MIe;var zM=da(),kt=Lr(),Ca=Jo(),$9=Zr(),RIe=ht(),CIe=Ve(),U9=Zr(),F9=Z("net"),IIe=cl(),PIe="pick_first";function Vg(t){RIe.trace(CIe.LogVerbosity.DEBUG,PIe,t)}var Hg="pick_first",OIe=250,ef=class t{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return Hg}toJsonObject(){return{[Hg]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&typeof e.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new t(e.shuffleAddressList===!0)}};lo.PickFirstLoadBalancingConfig=ef;var GM=class{constructor(e){this.subchannel=e}pick(e){return{pickResultType:Ca.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function B9(t){let e=t.slice();for(let r=e.length-1;r>1;r--){let n=Math.floor(Math.random()*(r+1)),i=e[r];e[r]=e[n],e[n]=i}return e}function NIe(t){if(t.length===0)return[];let e=[],r=[],n=[],i=(0,U9.isTcpSubchannelAddress)(t[0])&&(0,F9.isIPv6)(t[0].host);for(let a of t)(0,U9.isTcpSubchannelAddress)(a)&&(0,F9.isIPv6)(a.host)?r.push(a):n.push(a);let o=i?r:n,s=i?n:r;for(let a=0;a<Math.max(o.length,s.length);a++)a<o.length&&e.push(o[a]),a<s.length&&e.push(s[a]);return e}var j9="grpc-node.internal.pick-first.report_health_status",Wg=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=kt.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(r,n,i,o,s)=>{this.onSubchannelStateUpdate(r,n,i,s)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let r=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker({details:r}),r)}else this.updateState(kt.ConnectivityState.READY,new GM(this.currentPick),null);else if(((e=this.latestAddressList)===null||e===void 0?void 0:e.length)===0){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker({details:r}),r)}else if(this.children.length===0)this.updateState(kt.ConnectivityState.IDLE,new Ca.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker({details:r}),r)}else this.updateState(kt.ConnectivityState.CONNECTING,new Ca.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()){if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){this.currentPick!==null&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,r,n,i){var o;if(!((o=this.currentPick)===null||o===void 0)&&o.realSubchannelEquals(e)){n!==kt.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());return}for(let[s,a]of this.children.entries())if(e.realSubchannelEquals(a.subchannel)){n===kt.ConnectivityState.READY&&this.pickSubchannel(a.subchannel),n===kt.ConnectivityState.TRANSIENT_FAILURE&&(a.hasReportedTransientFailure=!0,i&&(this.lastError=i),this.maybeEnterStickyTransientFailureMode(),s===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(s+1)),a.subchannel.startConnecting();return}}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(let[r,n]of this.children.entries())if(r>=e){let i=n.subchannel.getConnectivityState();if(i===kt.ConnectivityState.IDLE||i===kt.ConnectivityState.CONNECTING){this.startConnecting(r);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var r,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===kt.ConnectivityState.IDLE&&(Vg("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var i;(i=this.children[e])===null||i===void 0||i.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},OIe),(n=(r=this.connectionDelayTimeout).unref)===null||n===void 0||n.call(r)}pickSubchannel(e){Vg("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,r,n){Vg(kt.ConnectivityState[this.currentState]+" -> "+kt.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,r){Vg("connectToAddressList(["+e.map(i=>(0,$9.subchannelAddressToString)(i))+"])");let n=e.map(i=>({subchannel:this.channelControlHelper.createSubchannel(i,r),hasReportedTransientFailure:!1}));for(let{subchannel:i}of n)if(i.getConnectivityState()===kt.ConnectivityState.READY){this.pickSubchannel(i);return}for(let{subchannel:i}of n)i.ref(),this.channelControlHelper.addChannelzChild(i.getChannelzRef());this.resetSubchannelList(),this.children=n;for(let{subchannel:i}of this.children)i.addConnectivityStateListener(this.subchannelStateListener);for(let i of this.children)i.subchannel.getConnectivityState()===kt.ConnectivityState.TRANSIENT_FAILURE&&(i.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,r,n,i){if(!(r instanceof ef))return!1;if(!e.ok)return this.children.length===0&&this.currentPick===null&&this.channelControlHelper.updateState(kt.ConnectivityState.TRANSIENT_FAILURE,new Ca.UnavailablePicker(e.error),e.error.details),!0;let o=e.value;this.reportHealthStatus=n[j9],r.getShuffleAddressList()&&(o=B9(o));let s=[].concat(...o.map(c=>c.addresses));Vg("updateAddressList(["+s.map(c=>(0,$9.subchannelAddressToString)(c))+"])");let a=NIe(s);return this.latestAddressList=a,this.latestOptions=n,this.connectToAddressList(a,n),this.latestResolutionNote=i,s.length>0?!0:(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===kt.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return Hg}};lo.PickFirstLoadBalancer=Wg;var kIe=new ef(!1),qM=class{constructor(e,r,n,i){this.endpoint=e,this.options=n,this.resolutionNote=i,this.latestState=kt.ConnectivityState.IDLE;let o=(0,zM.createChildChannelControlHelper)(r,{updateState:(s,a,c)=>{this.latestState=s,this.latestPicker=a,r.updateState(s,a,c)}});this.pickFirstBalancer=new Wg(o),this.latestPicker=new Ca.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,IIe.statusOrFromValue)([this.endpoint]),kIe,Object.assign(Object.assign({},this.options),{[j9]:!0}),this.resolutionNote)}updateEndpoint(e,r){this.options=r,this.endpoint=e,this.latestState!==kt.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}};lo.LeafLoadBalancer=qM;function MIe(){(0,zM.registerLoadBalancerType)(Hg,Wg,ef),(0,zM.registerDefaultLoadBalancerType)(Hg)}});var z9=v(Hb=>{"use strict";Object.defineProperty(Hb,"__esModule",{value:!0});Hb.FileWatcherCertificateProvider=void 0;var DIe=Z("fs"),LIe=ht(),$Ie=Ve(),UIe=Z("util"),FIe="certificate_provider";function Vb(t){LIe.trace($Ie.LogVerbosity.DEBUG,FIe,t)}var VM=(0,UIe.promisify)(DIe.readFile),HM=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,e.certificateFile===void 0!=(e.privateKeyFile===void 0))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(e.certificateFile===void 0&&e.caCertificateFile===void 0)throw new Error("At least one of certificateFile and caCertificateFile must be set");Vb("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?VM(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?VM(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?VM(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,r,n])=>{if(this.refreshTimer){Vb("File watcher read certificates certificate "+e.status+", privateKey "+r.status+", CA certificate "+n.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,e.status==="fulfilled"&&r.status==="fulfilled"?this.latestIdentityUpdate={certificate:e.value,privateKey:r.value}:this.latestIdentityUpdate=null,n.status==="fulfilled"?this.latestCaUpdate={caCertificate:n.value}:this.latestCaUpdate=null;for(let i of this.identityListeners)i(this.latestIdentityUpdate);for(let i of this.caListeners)i(this.latestCaUpdate)}}),Vb("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){let e=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>this.config.refreshIntervalMs*2&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),Vb("File watcher started watching")}}maybeStopWatchingFiles(){this.caListeners.size===0&&this.identityListeners.size===0&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}};Hb.FileWatcherCertificateProvider=HM});var KM=v(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=ge.createCertificateProviderChannelCredentials=ge.FileWatcherCertificateProvider=ge.createCertificateProviderServerCredentials=ge.createServerCredentialsWithInterceptors=ge.BaseSubchannelWrapper=ge.registerAdminService=ge.FilterStackFactory=ge.BaseFilter=ge.statusOrFromError=ge.statusOrFromValue=ge.PickResultType=ge.QueuePicker=ge.UnavailablePicker=ge.ChildLoadBalancerHandler=ge.EndpointMap=ge.endpointHasAddress=ge.endpointToString=ge.subchannelAddressToString=ge.LeafLoadBalancer=ge.isLoadBalancerNameRegistered=ge.parseLoadBalancingConfig=ge.selectLbConfigFromList=ge.registerLoadBalancerType=ge.createChildChannelControlHelper=ge.BackoffTimeout=ge.parseDuration=ge.durationToMs=ge.splitHostPort=ge.uriToString=ge.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=ge.createResolver=ge.registerResolver=ge.log=ge.trace=void 0;var G9=ht();Object.defineProperty(ge,"trace",{enumerable:!0,get:function(){return G9.trace}});Object.defineProperty(ge,"log",{enumerable:!0,get:function(){return G9.log}});var WM=ai();Object.defineProperty(ge,"registerResolver",{enumerable:!0,get:function(){return WM.registerResolver}});Object.defineProperty(ge,"createResolver",{enumerable:!0,get:function(){return WM.createResolver}});Object.defineProperty(ge,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return WM.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var q9=Dr();Object.defineProperty(ge,"uriToString",{enumerable:!0,get:function(){return q9.uriToString}});Object.defineProperty(ge,"splitHostPort",{enumerable:!0,get:function(){return q9.splitHostPort}});var V9=qg();Object.defineProperty(ge,"durationToMs",{enumerable:!0,get:function(){return V9.durationToMs}});Object.defineProperty(ge,"parseDuration",{enumerable:!0,get:function(){return V9.parseDuration}});var BIe=bd();Object.defineProperty(ge,"BackoffTimeout",{enumerable:!0,get:function(){return BIe.BackoffTimeout}});var Kg=da();Object.defineProperty(ge,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Kg.createChildChannelControlHelper}});Object.defineProperty(ge,"registerLoadBalancerType",{enumerable:!0,get:function(){return Kg.registerLoadBalancerType}});Object.defineProperty(ge,"selectLbConfigFromList",{enumerable:!0,get:function(){return Kg.selectLbConfigFromList}});Object.defineProperty(ge,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return Kg.parseLoadBalancingConfig}});Object.defineProperty(ge,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return Kg.isLoadBalancerNameRegistered}});var jIe=Yg();Object.defineProperty(ge,"LeafLoadBalancer",{enumerable:!0,get:function(){return jIe.LeafLoadBalancer}});var Wb=Zr();Object.defineProperty(ge,"subchannelAddressToString",{enumerable:!0,get:function(){return Wb.subchannelAddressToString}});Object.defineProperty(ge,"endpointToString",{enumerable:!0,get:function(){return Wb.endpointToString}});Object.defineProperty(ge,"endpointHasAddress",{enumerable:!0,get:function(){return Wb.endpointHasAddress}});Object.defineProperty(ge,"EndpointMap",{enumerable:!0,get:function(){return Wb.EndpointMap}});var zIe=ST();Object.defineProperty(ge,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return zIe.ChildLoadBalancerHandler}});var YM=Jo();Object.defineProperty(ge,"UnavailablePicker",{enumerable:!0,get:function(){return YM.UnavailablePicker}});Object.defineProperty(ge,"QueuePicker",{enumerable:!0,get:function(){return YM.QueuePicker}});Object.defineProperty(ge,"PickResultType",{enumerable:!0,get:function(){return YM.PickResultType}});var H9=cl();Object.defineProperty(ge,"statusOrFromValue",{enumerable:!0,get:function(){return H9.statusOrFromValue}});Object.defineProperty(ge,"statusOrFromError",{enumerable:!0,get:function(){return H9.statusOrFromError}});var GIe=bk();Object.defineProperty(ge,"BaseFilter",{enumerable:!0,get:function(){return GIe.BaseFilter}});var qIe=gb();Object.defineProperty(ge,"FilterStackFactory",{enumerable:!0,get:function(){return qIe.FilterStackFactory}});var VIe=bT();Object.defineProperty(ge,"registerAdminService",{enumerable:!0,get:function(){return VIe.registerAdminService}});var HIe=zg();Object.defineProperty(ge,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return HIe.BaseSubchannelWrapper}});var W9=$b();Object.defineProperty(ge,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return W9.createServerCredentialsWithInterceptors}});Object.defineProperty(ge,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return W9.createCertificateProviderServerCredentials}});var WIe=z9();Object.defineProperty(ge,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return WIe.FileWatcherCertificateProvider}});var YIe=Td();Object.defineProperty(ge,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return YIe.createCertificateProviderChannelCredentials}});var KIe=dM();Object.defineProperty(ge,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return KIe.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var Y9=v(JM=>{"use strict";Object.defineProperty(JM,"__esModule",{value:!0});JM.setup=XIe;var ZIe=ai(),JIe=cl(),ZM=class{constructor(e,r,n){this.listener=r,this.hasReturnedResult=!1,this.endpoints=[];let i;e.authority===""?i="/"+e.path:i=e.path,this.endpoints=[{addresses:[{path:i}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,JIe.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}};function XIe(){(0,ZIe.registerResolver)("unix",ZM)}});var eJ=v(tD=>{"use strict";Object.defineProperty(tD,"__esModule",{value:!0});tD.setup=nPe;var K9=Z("net"),Z9=cl(),Yb=Ve(),XM=Kt(),J9=ai(),QIe=Zr(),X9=Dr(),ePe=ht(),tPe="ip_resolver";function Q9(t){ePe.trace(Yb.LogVerbosity.DEBUG,tPe,t)}var QM="ipv4",eD="ipv6",rPe=443,Kb=class{constructor(e,r,n){var i;this.listener=r,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,Q9("Resolver constructed for target "+(0,X9.uriToString)(e));let o=[];if(!(e.scheme===QM||e.scheme===eD)){this.error={code:Yb.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new XM.Metadata};return}let s=e.path.split(",");for(let a of s){let c=(0,X9.splitHostPort)(a);if(c===null){this.error={code:Yb.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new XM.Metadata};return}if(e.scheme===QM&&!(0,K9.isIPv4)(c.host)||e.scheme===eD&&!(0,K9.isIPv6)(c.host)){this.error={code:Yb.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new XM.Metadata};return}o.push({host:c.host,port:(i=c.port)!==null&&i!==void 0?i:rPe})}this.endpoints=o.map(a=>({addresses:[a]})),Q9("Parsed "+e.scheme+" address list "+o.map(QIe.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,Z9.statusOrFromError)(this.error),{},null,""):this.listener((0,Z9.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}};function nPe(){(0,J9.registerResolver)(QM,Kb),(0,J9.registerResolver)(eD,Kb)}});var iJ=v(Jg=>{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});Jg.RoundRobinLoadBalancer=void 0;Jg.setup=lPe;var nJ=da(),dr=Lr(),Zg=Jo(),iPe=ht(),oPe=Ve(),tJ=Zr(),sPe=Yg(),aPe="round_robin";function rJ(t){iPe.trace(oPe.LogVerbosity.DEBUG,aPe,t)}var Zb="round_robin",Jb=class t{getLoadBalancerName(){return Zb}constructor(){}toJsonObject(){return{[Zb]:{}}}static createFromJson(e){return new t}},rD=class{constructor(e,r=0){this.children=e,this.nextIndex=r}pick(e){let r=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,r.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}};function cPe(t,e){return[...t.slice(e),...t.slice(0,e)]}var Xb=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=dr.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,nJ.createChildChannelControlHelper)(e,{updateState:(r,n,i)=>{this.currentState===dr.ConnectivityState.READY&&r!==dr.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(r=>r.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(dr.ConnectivityState.READY)>0){let e=this.children.filter(n=>n.getConnectivityState()===dr.ConnectivityState.READY),r=0;if(this.currentReadyPicker!==null){let n=this.currentReadyPicker.peekNextEndpoint();r=e.findIndex(i=>(0,tJ.endpointEqual)(i.getEndpoint(),n)),r<0&&(r=0)}this.updateState(dr.ConnectivityState.READY,new rD(e.map(n=>({endpoint:n.getEndpoint(),picker:n.getPicker()})),r),null)}else if(this.countChildrenWithState(dr.ConnectivityState.CONNECTING)>0)this.updateState(dr.ConnectivityState.CONNECTING,new Zg.QueuePicker(this),null);else if(this.countChildrenWithState(dr.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Zg.UnavailablePicker({details:e}),e)}else this.updateState(dr.ConnectivityState.IDLE,new Zg.QueuePicker(this),null);for(let e of this.children)e.getConnectivityState()===dr.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){rJ(dr.ConnectivityState[this.currentState]+" -> "+dr.ConnectivityState[e]),e===dr.ConnectivityState.READY?this.currentReadyPicker=r:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.destroy();this.children=[]}updateAddressList(e,r,n,i){if(!(r instanceof Jb))return!1;if(!e.ok)return this.children.length===0&&this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Zg.UnavailablePicker(e.error),e.error.details),!0;let o=Math.random()*e.value.length|0,s=cPe(e.value,o);if(this.resetSubchannelList(),s.length===0){let a=`No addresses resolved. Resolution note: ${i}`;this.updateState(dr.ConnectivityState.TRANSIENT_FAILURE,new Zg.UnavailablePicker({details:a}),a)}rJ("Connect to endpoint list "+s.map(tJ.endpointToString)),this.updatesPaused=!0,this.children=s.map(a=>new sPe.LeafLoadBalancer(a,this.childChannelControlHelper,n,i));for(let a of this.children)a.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return Zb}};Jg.RoundRobinLoadBalancer=Xb;function lPe(){(0,nJ.registerLoadBalancerType)(Zb,Xb,Jb)}});var aJ=v(Cl=>{"use strict";var nD;Object.defineProperty(Cl,"__esModule",{value:!0});Cl.OutlierDetectionLoadBalancer=Cl.OutlierDetectionLoadBalancingConfig=void 0;Cl.setup=EPe;var uPe=Lr(),oJ=Ve(),Rl=qg(),sJ=KM(),dPe=da(),fPe=ST(),pPe=Jo(),iD=Zr(),hPe=zg(),mPe=ht(),gPe="outlier_detection";function Qt(t){mPe.trace(oJ.LogVerbosity.DEBUG,gPe,t)}var uD="outlier_detection",_Pe=((nD=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&nD!==void 0?nD:"true")==="true",yPe={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},SPe={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function tf(t,e,r,n){if(e in t&&t[e]!==void 0&&typeof t[e]!==r){let i=n?`${n}.${e}`:e;throw new Error(`outlier detection config ${i} parse error: expected ${r}, got ${typeof t[e]}`)}}function oD(t,e,r){let n=r?`${r}.${e}`:e;if(e in t&&t[e]!==void 0){if(!(0,Rl.isDuration)(t[e]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof t[e]}`);if(!(t[e].seconds>=0&&t[e].seconds<=315576e6&&t[e].nanos>=0&&t[e].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function Qb(t,e,r){let n=r?`${r}.${e}`:e;if(tf(t,e,"number",r),e in t&&t[e]!==void 0&&!(t[e]>=0&&t[e]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}var Xg=class t{constructor(e,r,n,i,o,s,a){if(this.childPolicy=a,a.getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=e??1e4,this.baseEjectionTimeMs=r??3e4,this.maxEjectionTimeMs=n??3e5,this.maxEjectionPercent=i??10,this.successRateEjection=o?Object.assign(Object.assign({},yPe),o):null,this.failurePercentageEjection=s?Object.assign(Object.assign({},SPe),s):null}getLoadBalancerName(){return uD}toJsonObject(){var e,r;return{outlier_detection:{interval:(0,Rl.msToDuration)(this.intervalMs),base_ejection_time:(0,Rl.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,Rl.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(e=this.successRateEjection)!==null&&e!==void 0?e:void 0,failure_percentage_ejection:(r=this.failurePercentageEjection)!==null&&r!==void 0?r:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var r;if(oD(e,"interval"),oD(e,"base_ejection_time"),oD(e,"max_ejection_time"),Qb(e,"max_ejection_percent"),"success_rate_ejection"in e&&e.success_rate_ejection!==void 0){if(typeof e.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");tf(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),Qb(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),tf(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),tf(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&e.failure_percentage_ejection!==void 0){if(typeof e.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");Qb(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),Qb(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),tf(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),tf(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");let n=(0,dPe.selectLbConfigFromList)(e.child_policy);if(!n)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new t(e.interval?(0,Rl.durationToMs)(e.interval):null,e.base_ejection_time?(0,Rl.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,Rl.durationToMs)(e.max_ejection_time):null,(r=e.max_ejection_percent)!==null&&r!==void 0?r:null,e.success_rate_ejection,e.failure_percentage_ejection,n)}};Cl.OutlierDetectionLoadBalancingConfig=Xg;var aD=class extends hPe.BaseSubchannelWrapper{constructor(e,r){super(e),this.mapEntry=r,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function sD(){return{success:0,failure:0}}var cD=class{constructor(){this.activeBucket=sD(),this.inactiveBucket=sD()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=sD()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},lD=class{constructor(e,r){this.wrappedPicker=e,this.countCalls=r}pick(e){let r=this.wrappedPicker.pick(e);if(r.pickResultType===pPe.PickResultType.COMPLETE){let n=r.subchannel,i=n.getMapEntry();if(i){let o=r.onCallEnded;return this.countCalls&&(o=(s,a,c)=>{var l;s===oJ.Status.OK?i.counter.addSuccess():i.counter.addFailure(),(l=r.onCallEnded)===null||l===void 0||l.call(r,s,a,c)}),Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel(),onCallEnded:o})}else return Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel()})}else return r}},eA=class{constructor(e){this.entryMap=new iD.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new fPe.ChildLoadBalancerHandler((0,sJ.createChildChannelControlHelper)(e,{createSubchannel:(r,n)=>{let i=e.createSubchannel(r,n),o=this.entryMap.getForSubchannelAddress(r),s=new aD(i,o);return o?.currentEjectionTimestamp!==null&&s.eject(),o?.subchannelWrappers.push(s),s},updateState:(r,n,i)=>{r===uPe.ConnectivityState.READY?e.updateState(r,new lD(n,this.isCountingEnabled()),i):e.updateState(r,n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let e=0;for(let r of this.entryMap.values())r.currentEjectionTimestamp!==null&&(e+=1);return e*100/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getSuccessRateEjectionConfig();if(!r)return;Qt("Running success rate check");let n=r.request_volume,i=0,o=[];for(let[d,f]of this.entryMap.entries()){let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();Qt("Stats for "+(0,iD.endpointToString)(d)+": successes="+p+" failures="+h+" targetRequestVolume="+n),p+h>=n&&(i+=1,o.push(p/(p+h)))}if(Qt("Found "+i+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+o+"]"),i<r.minimum_hosts)return;let s=o.reduce((d,f)=>d+f)/o.length,a=0;for(let d of o){let f=d-s;a+=f*f}let c=a/o.length,l=Math.sqrt(c),u=s-l*(r.stdev_factor/1e3);Qt("stdev="+l+" ejectionThreshold="+u);for(let[d,f]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();if(p+h<n)continue;let m=p/(p+h);if(Qt("Checking candidate "+d+" successRate="+m),m<u){let y=Math.random()*100;Qt("Candidate "+d+" randomNumber="+y+" enforcement_percentage="+r.enforcement_percentage),y<r.enforcement_percentage&&(Qt("Ejecting candidate "+d),this.eject(f,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getFailurePercentageEjectionConfig();if(!r)return;Qt("Running failure percentage check. threshold="+r.threshold+" request volume threshold="+r.request_volume);let n=0;for(let i of this.entryMap.values()){let o=i.counter.getLastSuccesses(),s=i.counter.getLastFailures();o+s>=r.request_volume&&(n+=1)}if(!(n<r.minimum_hosts))for(let[i,o]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let s=o.counter.getLastSuccesses(),a=o.counter.getLastFailures();if(Qt("Candidate successes="+s+" failures="+a),s+a<r.request_volume)continue;if(a*100/(a+s)>r.threshold){let l=Math.random()*100;Qt("Candidate "+i+" randomNumber="+l+" enforcement_percentage="+r.enforcement_percentage),l<r.enforcement_percentage&&(Qt("Ejecting candidate "+i),this.eject(o,e))}}}eject(e,r){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(let n of e.subchannelWrappers)n.eject()}uneject(e){e.currentEjectionTimestamp=null;for(let r of e.subchannelWrappers)r.uneject()}switchAllBuckets(){for(let e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var r,n;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),(n=(r=this.ejectionTimer).unref)===null||n===void 0||n.call(r)}runChecks(){let e=new Date;if(Qt("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(let[r,n]of this.entryMap.entries())if(n.currentEjectionTimestamp===null)n.ejectionTimeMultiplier>0&&(n.ejectionTimeMultiplier-=1);else{let i=this.latestConfig.getBaseEjectionTimeMs(),o=this.latestConfig.getMaxEjectionTimeMs(),s=new Date(n.currentEjectionTimestamp.getTime());s.setMilliseconds(s.getMilliseconds()+Math.min(i*n.ejectionTimeMultiplier,Math.max(i,o))),s<new Date&&(Qt("Unejecting "+r),this.uneject(n))}}}updateAddressList(e,r,n,i){if(!(r instanceof Xg))return!1;if(Qt("Received update with config: "+JSON.stringify(r.toJsonObject(),void 0,2)),e.ok){for(let s of e.value)this.entryMap.has(s)||(Qt("Adding map entry for "+(0,iD.endpointToString)(s)),this.entryMap.set(s,{counter:new cD,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}let o=r.getChildPolicy();if(this.childBalancer.updateAddressList(e,o,n,i),r.getSuccessRateEjectionConfig()||r.getFailurePercentageEjectionConfig())if(this.timerStartTime){Qt("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let s=r.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(s)}else Qt("Starting new timer"),this.timerStartTime=new Date,this.startTimer(r.getIntervalMs()),this.switchAllBuckets();else{Qt("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let s of this.entryMap.values())this.uneject(s),s.ejectionTimeMultiplier=0}return this.latestConfig=r,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return uD}};Cl.OutlierDetectionLoadBalancer=eA;function EPe(){_Pe&&(0,sJ.registerLoadBalancerType)(uD,eA,Xg)}});var cJ=v(rA=>{"use strict";Object.defineProperty(rA,"__esModule",{value:!0});rA.PriorityQueue=void 0;var rf=0,dD=t=>Math.floor(t/2),tA=t=>t*2+1,Qg=t=>t*2+2,fD=class{constructor(e=(r,n)=>r>n){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[rf]}push(...e){return e.forEach(r=>{this.heap.push(r),this.siftUp()}),this.size()}pop(){let e=this.peek(),r=this.size()-1;return r>rf&&this.swap(rf,r),this.heap.pop(),this.siftDown(),e}replace(e){let r=this.peek();return this.heap[rf]=e,this.siftDown(),r}greater(e,r){return this.comparator(this.heap[e],this.heap[r])}swap(e,r){[this.heap[e],this.heap[r]]=[this.heap[r],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>rf&&this.greater(e,dD(e));)this.swap(e,dD(e)),e=dD(e)}siftDown(){let e=rf;for(;tA(e)<this.size()&&this.greater(tA(e),e)||Qg(e)<this.size()&&this.greater(Qg(e),e);){let r=Qg(e)<this.size()&&this.greater(Qg(e),tA(e))?Qg(e):tA(e);this.swap(e,r),e=r}}};rA.PriorityQueue=fD});var pJ=v(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});t_.WeightedRoundRobinLoadBalancingConfig=void 0;t_.setup=OPe;var er=Lr(),vPe=Ve(),Sn=qg(),dJ=da(),TPe=Yg(),bPe=ht(),fJ=Fb(),nf=Jo(),APe=cJ(),lJ=Zr(),wPe="weighted_round_robin";function pD(t){bPe.trace(vPe.LogVerbosity.DEBUG,wPe,t)}var gD="weighted_round_robin",xPe=1e4,RPe=1e4,CPe=3*6e4,IPe=1e3,PPe=1;function uJ(t,e,r){if(e in t&&t[e]!==void 0&&typeof t[e]!==r)throw new Error(`weighted round robin config ${e} parse error: expected ${r}, got ${typeof t[e]}`)}function nA(t,e){if(e in t&&t[e]!==void 0&&t[e]!==null){let r;if((0,Sn.isDuration)(t[e]))r=t[e];else if((0,Sn.isDurationMessage)(t[e]))r=(0,Sn.durationMessageToDuration)(t[e]);else if(typeof t[e]=="string"){let n=(0,Sn.parseDuration)(t[e]);if(!n)throw new Error(`weighted round robin config ${e}: failed to parse duration string ${t[e]}`);r=n}else throw new Error(`weighted round robin config ${e}: expected duration, got ${typeof t[e]}`);return(0,Sn.durationToMs)(r)}return null}var e_=class t{constructor(e,r,n,i,o,s){this.enableOobLoadReport=e??!1,this.oobLoadReportingPeriodMs=r??xPe,this.blackoutPeriodMs=n??RPe,this.weightExpirationPeriodMs=i??CPe,this.weightUpdatePeriodMs=Math.max(o??IPe,100),this.errorUtilizationPenalty=s??PPe}getLoadBalancerName(){return gD}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,Sn.durationToString)((0,Sn.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(uJ(e,"enable_oob_load_report","boolean"),uJ(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new t(e.enable_oob_load_report,nA(e,"oob_load_reporting_period"),nA(e,"blackout_period"),nA(e,"weight_expiration_period"),nA(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}};t_.WeightedRoundRobinLoadBalancingConfig=e_;var hD=class{constructor(e,r){this.metricsHandler=r,this.queue=new APe.PriorityQueue((o,s)=>o.deadline<s.deadline);let n=e.filter(o=>o.weight>0),i;if(n.length<2)i=1;else{let o=0;for(let{weight:s}of n)o+=s;i=o/n.length}for(let o of e){let s=o.weight>0?1/o.weight:i;this.queue.push({endpointName:o.endpointName,picker:o.picker,period:s,deadline:Math.random()*s})}}pick(e){let r=this.queue.pop();this.queue.push(Object.assign(Object.assign({},r),{deadline:r.deadline+r.period}));let n=r.picker.pick(e);if(n.pickResultType===nf.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},n),{onCallEnded:(0,fJ.createMetricsReader)(i=>this.metricsHandler(i,r.endpointName),n.onCallEnded)});{let i=n.subchannel;return Object.assign(Object.assign({},n),{subchannel:i.getWrappedSubchannel()})}}else return n}},mD=class{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=er.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let r=0;for(let n of this.children.values())n.child.getConnectivityState()===e&&(r+=1);return r}updateWeight(e,r){var n,i;let o=r.rps_fractional,s=r.application_utilization;s>0&&o>0&&(s+=r.eps/o*((i=(n=this.latestConfig)===null||n===void 0?void 0:n.getErrorUtilizationPenalty())!==null&&i!==void 0?i:0));let a=s===0?0:o/s;if(a===0)return;let c=new Date;e.nonEmptySince===null&&(e.nonEmptySince=c),e.lastUpdated=c,e.weight=a}getWeight(e){if(!this.latestConfig)return 0;let r=new Date().getTime();if(r-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;let n=this.latestConfig.getBlackoutPeriodMs();return n>0&&(e.nonEmptySince===null||r-e.nonEmptySince.getTime()<n)?0:e.weight}calculateAndUpdateState(){if(!(this.updatesPaused||!this.latestConfig)){if(this.countChildrenWithState(er.ConnectivityState.READY)>0){let e=[];for(let[n,i]of this.children)i.child.getConnectivityState()===er.ConnectivityState.READY&&e.push({endpointName:n,picker:i.child.getPicker(),weight:this.getWeight(i)});pD("Created picker with weights: "+e.map(n=>n.endpointName+":"+n.weight).join(","));let r;this.latestConfig.getEnableOobLoadReport()?r=null:r=(n,i)=>{let o=this.children.get(i);o&&this.updateWeight(o,n)},this.updateState(er.ConnectivityState.READY,new hD(e,r),null)}else if(this.countChildrenWithState(er.ConnectivityState.CONNECTING)>0)this.updateState(er.ConnectivityState.CONNECTING,new nf.QueuePicker(this),null);else if(this.countChildrenWithState(er.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new nf.UnavailablePicker({details:e}),e)}else this.updateState(er.ConnectivityState.IDLE,new nf.QueuePicker(this),null);for(let{child:e}of this.children.values())e.getConnectivityState()===er.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){pD(er.ConnectivityState[this.currentState]+" -> "+er.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}updateAddressList(e,r,n,i){var o,s;if(!(r instanceof e_))return!1;if(!e.ok)return this.children.size===0&&this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new nf.UnavailablePicker(e.error),e.error.details),!0;if(e.value.length===0){let l=`No addresses resolved. Resolution note: ${i}`;return this.updateState(er.ConnectivityState.TRANSIENT_FAILURE,new nf.UnavailablePicker({details:l}),l),!1}pD("Connect to endpoint list "+e.value.map(lJ.endpointToString));let a=new Date,c=new Set;this.updatesPaused=!0,this.latestConfig=r;for(let l of e.value){let u=(0,lJ.endpointToString)(l);c.add(u);let d=this.children.get(u);d||(d={child:new TPe.LeafLoadBalancer(l,(0,dJ.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(f,p,h)=>{this.currentState===er.ConnectivityState.READY&&f!==er.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),f===er.ConnectivityState.READY&&(d.nonEmptySince=null),h&&(this.lastError=h),this.calculateAndUpdateState()},createSubchannel:(f,p)=>{let h=this.channelControlHelper.createSubchannel(f,p);return d?.oobMetricsListener?new fJ.OrcaOobMetricsSubchannelWrapper(h,d.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):h}}),n,i),lastUpdated:a,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(u,d)),r.getEnableOobLoadReport()?d.oobMetricsListener=f=>{this.updateWeight(d,f)}:d.oobMetricsListener=null}for(let[l,u]of this.children)c.has(l)?u.child.startConnecting():(u.child.destroy(),this.children.delete(l));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=(s=(o=setInterval(()=>{this.currentState===er.ConnectivityState.READY&&this.calculateAndUpdateState()},r.getWeightUpdatePeriodMs())).unref)===null||s===void 0?void 0:s.call(o),!0}exitIdle(){}resetBackoff(){}destroy(){for(let e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return gD}};function OPe(){(0,dJ.registerLoadBalancerType)(gD,mD,e_)}});var r_=v(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.experimental=he.ServerMetricRecorder=he.ServerInterceptingCall=he.ResponderBuilder=he.ServerListenerBuilder=he.addAdminServicesToServer=he.getChannelzHandlers=he.getChannelzServiceDefinition=he.InterceptorConfigurationError=he.InterceptingCall=he.RequesterBuilder=he.ListenerBuilder=he.StatusBuilder=he.getClientChannel=he.ServerCredentials=he.Server=he.setLogVerbosity=he.setLogger=he.load=he.loadObject=he.CallCredentials=he.ChannelCredentials=he.waitForClientReady=he.closeClient=he.Channel=he.makeGenericClientConstructor=he.makeClientConstructor=he.loadPackageDefinition=he.Client=he.compressionAlgorithms=he.propagate=he.connectivityState=he.status=he.logVerbosity=he.Metadata=he.credentials=void 0;var iA=cT();Object.defineProperty(he,"CallCredentials",{enumerable:!0,get:function(){return iA.CallCredentials}});var NPe=iN();Object.defineProperty(he,"Channel",{enumerable:!0,get:function(){return NPe.ChannelImplementation}});var kPe=vk();Object.defineProperty(he,"compressionAlgorithms",{enumerable:!0,get:function(){return kPe.CompressionAlgorithms}});var MPe=Lr();Object.defineProperty(he,"connectivityState",{enumerable:!0,get:function(){return MPe.ConnectivityState}});var oA=Td();Object.defineProperty(he,"ChannelCredentials",{enumerable:!0,get:function(){return oA.ChannelCredentials}});var hJ=nN();Object.defineProperty(he,"Client",{enumerable:!0,get:function(){return hJ.Client}});var _D=Ve();Object.defineProperty(he,"logVerbosity",{enumerable:!0,get:function(){return _D.LogVerbosity}});Object.defineProperty(he,"status",{enumerable:!0,get:function(){return _D.Status}});Object.defineProperty(he,"propagate",{enumerable:!0,get:function(){return _D.Propagate}});var mJ=ht(),yD=CT();Object.defineProperty(he,"loadPackageDefinition",{enumerable:!0,get:function(){return yD.loadPackageDefinition}});Object.defineProperty(he,"makeClientConstructor",{enumerable:!0,get:function(){return yD.makeClientConstructor}});Object.defineProperty(he,"makeGenericClientConstructor",{enumerable:!0,get:function(){return yD.makeClientConstructor}});var DPe=Kt();Object.defineProperty(he,"Metadata",{enumerable:!0,get:function(){return DPe.Metadata}});var LPe=D9();Object.defineProperty(he,"Server",{enumerable:!0,get:function(){return LPe.Server}});var $Pe=$b();Object.defineProperty(he,"ServerCredentials",{enumerable:!0,get:function(){return $Pe.ServerCredentials}});var UPe=L9();Object.defineProperty(he,"StatusBuilder",{enumerable:!0,get:function(){return UPe.StatusBuilder}});he.credentials={combineChannelCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),combineCallCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),createInsecure:oA.ChannelCredentials.createInsecure,createSsl:oA.ChannelCredentials.createSsl,createFromSecureContext:oA.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:iA.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:iA.CallCredentials.createFromGoogleCredential,createEmpty:iA.CallCredentials.createEmpty};var FPe=t=>t.close();he.closeClient=FPe;var BPe=(t,e,r)=>t.waitForReady(e,r);he.waitForClientReady=BPe;var jPe=(t,e)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};he.loadObject=jPe;var zPe=(t,e,r)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};he.load=zPe;var GPe=t=>{mJ.setLogger(t)};he.setLogger=GPe;var qPe=t=>{mJ.setLoggerVerbosity(t)};he.setLogVerbosity=qPe;var VPe=t=>hJ.Client.prototype.getChannel.call(t);he.getClientChannel=VPe;var sA=eN();Object.defineProperty(he,"ListenerBuilder",{enumerable:!0,get:function(){return sA.ListenerBuilder}});Object.defineProperty(he,"RequesterBuilder",{enumerable:!0,get:function(){return sA.RequesterBuilder}});Object.defineProperty(he,"InterceptingCall",{enumerable:!0,get:function(){return sA.InterceptingCall}});Object.defineProperty(he,"InterceptorConfigurationError",{enumerable:!0,get:function(){return sA.InterceptorConfigurationError}});var gJ=va();Object.defineProperty(he,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return gJ.getChannelzServiceDefinition}});Object.defineProperty(he,"getChannelzHandlers",{enumerable:!0,get:function(){return gJ.getChannelzHandlers}});var HPe=bT();Object.defineProperty(he,"addAdminServicesToServer",{enumerable:!0,get:function(){return HPe.addAdminServicesToServer}});var SD=$M();Object.defineProperty(he,"ServerListenerBuilder",{enumerable:!0,get:function(){return SD.ServerListenerBuilder}});Object.defineProperty(he,"ResponderBuilder",{enumerable:!0,get:function(){return SD.ResponderBuilder}});Object.defineProperty(he,"ServerInterceptingCall",{enumerable:!0,get:function(){return SD.ServerInterceptingCall}});var WPe=Fb();Object.defineProperty(he,"ServerMetricRecorder",{enumerable:!0,get:function(){return WPe.ServerMetricRecorder}});var YPe=KM();he.experimental=YPe;var KPe=Bk(),ZPe=Y9(),JPe=eJ(),XPe=Yg(),QPe=iJ(),e0e=aJ(),t0e=pJ(),r0e=va();KPe.setup(),ZPe.setup(),JPe.setup(),XPe.setup(),QPe.setup(),e0e.setup(),t0e.setup(),r0e.setup()});var _J=v(aA=>{"use strict";Object.defineProperty(aA,"__esModule",{value:!0});aA.createServiceClientConstructor=void 0;var n0e=r_();function i0e(t,e){let r={export:{path:t,requestStream:!1,responseStream:!1,requestSerialize:n=>n,requestDeserialize:n=>n,responseSerialize:n=>n,responseDeserialize:n=>n}};return n0e.makeGenericClientConstructor(r,e)}aA.createServiceClientConstructor=i0e});var n_=v(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.createOtlpGrpcExporterTransport=Wn.GrpcExporterTransport=Wn.createEmptyMetadata=Wn.createSslCredentials=Wn.createInsecureCredentials=void 0;var o0e=uK(),yJ=`OTel-OTLP-Exporter-JavaScript/${o0e.VERSION}`;function s0e(t){return t?`${t} ${yJ}`:yJ}var a0e=0,c0e=2;function l0e(t){return t==="gzip"?c0e:a0e}function u0e(){let{credentials:t}=r_();return t.createInsecure()}Wn.createInsecureCredentials=u0e;function d0e(t,e,r){let{credentials:n}=r_();return n.createSsl(t,e,r)}Wn.createSslCredentials=d0e;function f0e(){let{Metadata:t}=r_();return new t}Wn.createEmptyMetadata=f0e;var cA=class{_client;_metadata;_parameters;constructor(e){this._parameters=e}shutdown(){this._client?.close()}send(e,r){let n=Buffer.from(e);if(this._client==null){let{createServiceClientConstructor:i}=_J();try{this._metadata=this._parameters.metadata()}catch(s){return Promise.resolve({status:"failure",error:s})}let o=i(this._parameters.grpcPath,this._parameters.grpcName);try{this._client=new o(this._parameters.address,this._parameters.credentials(),{"grpc.default_compression_algorithm":l0e(this._parameters.compression),"grpc.primary_user_agent":s0e(this._parameters.userAgent)})}catch(s){return Promise.resolve({status:"failure",error:s})}}return new Promise(i=>{let o=Date.now()+r;if(this._metadata==null)return i({error:new Error("metadata was null"),status:"failure"});this._client.export(n,this._metadata,{deadline:o},(s,a)=>{i(s?{status:"failure",error:s}:{data:a,status:"success"})})})}};Wn.GrpcExporterTransport=cA;function p0e(t){return new cA(t)}Wn.createOtlpGrpcExporterTransport=p0e});var bJ=v(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.getOtlpGrpcDefaultConfiguration=Ia.mergeOtlpGrpcConfigurationWithDefaults=Ia.validateAndNormalizeUrl=void 0;var vJ=(tT(),Nr(eT)),i_=n_(),h0e=Z("url"),SJ=(Ee(),Nr(ra));function TJ(t){t=t.trim(),t.match(/^([\w]{1,8}):\/\//)||(t=`https://${t}`);let r=new h0e.URL(t);return r.protocol==="unix:"?t:(r.pathname&&r.pathname!=="/"&&SJ.diag.warn("URL path should not be set when using grpc, the path part of the URL will be ignored."),r.protocol!==""&&!r.protocol?.match(/^(http)s?:$/)&&SJ.diag.warn("URL protocol should be http(s)://. Using http://."),r.host)}Ia.validateAndNormalizeUrl=TJ;function EJ(t,e){for(let[r,n]of Object.entries(e.getMap()))t.get(r).length<1&&t.set(r,n)}function m0e(t,e,r){let n=t.url??e.url??r.url;return{...(0,vJ.mergeOtlpSharedConfigurationWithDefaults)(t,e,r),metadata:()=>{let i=r.metadata();return EJ(i,t.metadata?.().clone()??(0,i_.createEmptyMetadata)()),EJ(i,e.metadata?.()??(0,i_.createEmptyMetadata)()),i},url:TJ(n),credentials:t.credentials??e.credentials?.(n)??r.credentials(n),userAgent:t.userAgent}}Ia.mergeOtlpGrpcConfigurationWithDefaults=m0e;function g0e(){return{...(0,vJ.getSharedConfigurationDefaults)(),metadata:()=>(0,i_.createEmptyMetadata)(),url:"http://localhost:4317",credentials:t=>t.startsWith("http://")?()=>(0,i_.createInsecureCredentials)():()=>(0,i_.createSslCredentials)()}}Ia.getOtlpGrpcDefaultConfiguration=g0e});function AJ(t){let e={};return Object.entries(t??{}).forEach(([r,n])=>{typeof n<"u"?e[r]=String(n):J.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),e}var wJ=A(()=>{"use strict";Ee()});function _0e(t,e,r){return async()=>{let n={...await r()},i={};return e!=null&&Object.assign(i,await e()),t!=null&&Object.assign(i,AJ(await t())),Object.assign(i,n)}}function y0e(t){if(t!=null)try{let e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function xJ(t,e,r){return{...Iv(t,e,r),headers:_0e(t.headers,e.headers,r.headers),url:y0e(t.url)??e.url??r.url}}function RJ(t,e){return{...Pv(),headers:async()=>t,url:"http://localhost:4318/"+e}}var CJ=A(()=>{"use strict";Jm();wJ()});function Il(t){return async e=>{let r=e==="http:",n=r?import("http"):import("https"),{Agent:i}=await n;if(r){let{ca:o,cert:s,key:a,...c}=t;return new i(c)}return new i(t)}}function IJ(t,e,r){return{...xJ(t,e,r),agentFactory:t.agentFactory??e.agentFactory??r.agentFactory,userAgent:t.userAgent}}function PJ(t,e){return{...RJ(t,e),agentFactory:Il({keepAlive:!0})}}var lA=A(()=>{"use strict";CJ()});function ED(t){return t===429||t===502||t===503||t===504}function vD(t){if(t==null)return;let e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let r=new Date(t).getTime()-Date.now();return r>=0?r:0}var OJ=A(()=>{"use strict"});var NJ,kJ=A(()=>{"use strict";NJ="0.218.0"});import*as LJ from"zlib";import{Readable as S0e}from"stream";function $J(t,e,r,n,i,o,s,a){return new Promise(c=>{let l=new URL(e);i?r["User-Agent"]=`${i} ${MJ}`:r["User-Agent"]=MJ;let d=t(l,{method:"POST",headers:r,agent:o},f=>{let p=[],h=0;f.on("data",m=>{if(h+=m.length,h>DJ){let y=new Error(`OTLP export response body exceeded size limit of ${DJ} bytes`);c({status:"failure",error:y}),f.destroy();return}p.push(m)}),f.on("end",()=>{if(f.statusCode&&f.statusCode<=299)c({status:"success",data:Buffer.concat(p)});else if(f.statusCode&&ED(f.statusCode))c({status:"retryable",retryInMillis:vD(f.headers["retry-after"])});else{let m=new Ko(f.statusMessage,f.statusCode,Buffer.concat(p).toString());c({status:"failure",error:m})}}),f.on("error",m=>{f.statusCode&&f.statusCode<=299?c({status:"success"}):f.statusCode&&ED(f.statusCode)?c({status:"retryable",error:m,retryInMillis:vD(f.headers["retry-after"])}):c({status:"failure",error:m})})});d.setTimeout(a,()=>{d.destroy(),c({status:"retryable",error:new Error("Request timed out")})}),d.on("error",f=>{T0e(f)?c({status:"retryable",error:f}):c({status:"failure",error:f})}),E0e(d,n,s,f=>{c({status:"failure",error:f})})})}function E0e(t,e,r,n){let i=v0e(r);e==="gzip"&&(t.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(LJ.createGzip()).on("error",n)),i.pipe(t).on("error",n)}function v0e(t){let e=new S0e;return e.push(t),e.push(null),e}function T0e(t){let e=new Set(["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","EAI_AGAIN","ENOTFOUND","ENETUNREACH","EHOSTUNREACH"]);return"code"in t&&typeof t.code=="string"?e.has(t.code):!1}var MJ,DJ,UJ=A(()=>{"use strict";OJ();Rv();kJ();MJ=`OTel-OTLP-Exporter-JavaScript/${NJ}`,DJ=4*1024*1024});async function b0e(t){let e=t==="http:"?import("http"):import("https"),{request:r}=await e;return r}function FJ(t){return new TD(t)}var TD,BJ=A(()=>{"use strict";UJ();TD=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,r){let{agent:n,request:i}=await this._loadUtils(),o=await this._parameters.headers();return $J(i,this._parameters.url,o,this._parameters.compression,this._parameters.userAgent,n,e,r)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let r=new URL(this._parameters.url).protocol,[n,i]=await Promise.all([this._parameters.agentFactory(r),b0e(r)]);e=this._utils={agent:n,request:i}}return e}}});function R0e(){return Math.random()*(2*jJ)-jJ}function zJ(t){return new AD(t.transport)}var bD,A0e,w0e,x0e,jJ,AD,GJ=A(()=>{"use strict";Ee();bD=5,A0e=1e3,w0e=5e3,x0e=1.5,jJ=.2;AD=class{_transport;constructor(e){this._transport=e}retry(e,r,n){return new Promise((i,o)=>{setTimeout(()=>{this._transport.send(e,r).then(i,o)},n)})}async send(e,r){let n=bD,i=A0e,o=Date.now()+r,s=await this._transport.send(e,r);for(;s.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(i*(1+R0e()),w0e),0);i=i*x0e;let c=s.retryInMillis??a,l=o-Date.now();if(c>l)return J.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),s;J.verbose(`Scheduling export retry in ${Math.round(c)}ms`),s=await this.retry(e,l,c)}return s.status==="success"?J.verbose(`Export succeeded after ${bD-n} retry attempts.`):s.status==="retryable"?J.info(`Export failed after maximum retry attempts (${bD}).`):J.info(`Export failed with non-retryable error: ${s.error}`),s}shutdown(){return this._transport.shutdown()}}});function qJ(t,e){return Qv({transport:zJ({transport:FJ(t)}),serializer:e,promiseHandler:Nv(t)},{timeout:t.timeoutMillis})}var VJ=A(()=>{"use strict";pO();BJ();Y0();GJ()});function HJ(t){let e=hd(t);if(e!=null){if(Number.isFinite(e)&&e>0)return e;J.warn(`Configuration: ${t} is invalid, expected number greater than 0 (actual: ${e})`)}}function C0e(t){let e=HJ(`OTEL_EXPORTER_OTLP_${t}_TIMEOUT`),r=HJ("OTEL_EXPORTER_OTLP_TIMEOUT");return e??r}function WJ(t){let e=Yr(t)?.trim();if(e==null||e==="none"||e==="gzip")return e;J.warn(`Configuration: ${t} is invalid, expected 'none' or 'gzip' (actual: '${e}')`)}function I0e(t){let e=WJ(`OTEL_EXPORTER_OTLP_${t}_COMPRESSION`),r=WJ("OTEL_EXPORTER_OTLP_COMPRESSION");return e??r}function uA(t){return{timeoutMillis:C0e(t),compression:I0e(t)}}var wD=A(()=>{"use strict";_d();Ee()});import*as YJ from"fs";import*as KJ from"path";function P0e(t){let e=Yr(`OTEL_EXPORTER_OTLP_${t}_HEADERS`),r=Yr("OTEL_EXPORTER_OTLP_HEADERS"),n=rl(e),i=rl(r);if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return Object.assign({},rl(r),rl(e))}function O0e(t){try{return new URL(t).toString()}catch{J.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}}function N0e(t,e){try{new URL(t)}catch{J.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}t.endsWith("/")||(t=t+"/"),t+=e;try{new URL(t)}catch{J.warn(`Configuration: Provided URL appended with '${e}' is not a valid URL, using 'undefined' instead of '${t}'`);return}return t}function k0e(t){let e=Yr("OTEL_EXPORTER_OTLP_ENDPOINT");if(e!==void 0)return N0e(e,t)}function M0e(t){let e=Yr(`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`);if(e!==void 0)return O0e(e)}function xD(t,e,r){let n=Yr(t),i=Yr(e),o=n??i;if(o!=null)try{return YJ.readFileSync(KJ.resolve(process.cwd(),o))}catch{J.warn(r);return}else return}function D0e(t){return xD(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function L0e(t){return xD(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function $0e(t){return xD(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function ZJ(t,e){return{...uA(t),url:M0e(t)??k0e(e),headers:Cv(P0e(t)),agentFactory:Il({keepAlive:!0,ca:$0e(t),cert:D0e(t),key:L0e(t)})}}var JJ=A(()=>{"use strict";_d();Ee();wD();Jm();lA()});function XJ(t){return typeof t.headers=="function"?t.headers:Cv(t.headers)}var QJ=A(()=>{"use strict";Jm()});function U0e(t){if(typeof t.httpAgentOptions=="function")return t.httpAgentOptions;let e=t.httpAgentOptions;if(t.keepAlive!=null&&(e={keepAlive:t.keepAlive,...e}),e!=null)return Il(e)}function eX(t,e,r,n){return t.metadata&&J.warn("Metadata cannot be set when using http"),IJ({url:t.url,headers:XJ(t),concurrencyLimit:t.concurrencyLimit,timeoutMillis:t.timeoutMillis,compression:t.compression,agentFactory:U0e(t),userAgent:t.userAgent},ZJ(e,r),PJ(n,r))}var tX=A(()=>{"use strict";Ee();lA();RD();JJ();QJ()});var rX={};ar(rX,{convertLegacyHttpOptions:()=>eX,createOtlpHttpExportDelegate:()=>qJ,getSharedConfigurationFromEnvironment:()=>uA,httpAgentFactoryFromOptions:()=>Il});var RD=A(()=>{"use strict";lA();VJ();wD();tX()});var aX=v(dA=>{"use strict";Object.defineProperty(dA,"__esModule",{value:!0});dA.getOtlpGrpcConfigurationFromEnv=void 0;var nX=(_d(),Nr(oK)),o_=n_(),F0e=(RD(),Nr(rX)),B0e=Z("fs"),j0e=Z("path"),oX=(Ee(),Nr(ra));function CD(t,e){if(t!=null&&t!=="")return t;if(e!=null&&e!=="")return e}function z0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_HEADERS`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),n=(0,nX.parseKeyPairsIntoRecord)(e),i=(0,nX.parseKeyPairsIntoRecord)(r);if(Object.keys(n).length===0&&Object.keys(i).length===0)return;let o=Object.assign({},i,n),s=(0,o_.createEmptyMetadata)();for(let[a,c]of Object.entries(o))s.set(a,c);return s}function G0e(t){let e=z0e(t);if(e!=null)return()=>e}function q0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return CD(e,r)}function V0e(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_INSECURE`]?.toLowerCase().trim(),r=process.env.OTEL_EXPORTER_OTLP_INSECURE?.toLowerCase().trim();return CD(e,r)==="true"}function ID(t,e,r){let n=process.env[t]?.trim(),i=process.env[e]?.trim(),o=CD(n,i);if(o!=null)try{return B0e.readFileSync(j0e.resolve(process.cwd(),o))}catch{oX.diag.warn(r);return}else return}function H0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function W0e(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function iX(t){return ID(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function sX(t){let e=W0e(t),r=H0e(t),n=iX(t),i=e!=null&&r!=null;return n!=null&&!i?(oX.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,o_.createSslCredentials)(iX(t))):(0,o_.createSslCredentials)(n,e,r)}function Y0e(t){return V0e(t)?(0,o_.createInsecureCredentials)():sX(t)}function K0e(t){return{...(0,F0e.getSharedConfigurationFromEnvironment)(t),metadata:G0e(t),url:q0e(t),credentials:e=>e.startsWith("http://")?()=>(0,o_.createInsecureCredentials)():e.startsWith("https://")?()=>sX(t):()=>Y0e(t)}}dA.getOtlpGrpcConfigurationFromEnv=K0e});var lX=v(fA=>{"use strict";Object.defineProperty(fA,"__esModule",{value:!0});fA.convertLegacyOtlpGrpcOptions=void 0;var cX=bJ(),Z0e=n_(),J0e=aX();function X0e(t,e){let r=t.credentials;return(0,cX.mergeOtlpGrpcConfigurationWithDefaults)({url:t.url,metadata:()=>t.metadata??(0,Z0e.createEmptyMetadata)(),compression:t.compression,timeoutMillis:t.timeoutMillis,concurrencyLimit:t.concurrencyLimit,credentials:r!=null?()=>r:void 0,userAgent:t.userAgent},(0,J0e.getOtlpGrpcConfigurationFromEnv)(e),(0,cX.getOtlpGrpcDefaultConfiguration)())}fA.convertLegacyOtlpGrpcOptions=X0e});var uX=v(pA=>{"use strict";Object.defineProperty(pA,"__esModule",{value:!0});pA.createOtlpGrpcExportDelegate=void 0;var Q0e=(tT(),Nr(eT)),eOe=n_();function tOe(t,e,r,n){return(0,Q0e.createOtlpNetworkExportDelegate)(t,e,(0,eOe.createOtlpGrpcExporterTransport)({address:t.url,compression:t.compression,credentials:t.credentials,metadata:t.metadata,userAgent:t.userAgent,grpcName:r,grpcPath:n}))}pA.createOtlpGrpcExportDelegate=tOe});var dX=v(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.createOtlpGrpcExportDelegate=of.convertLegacyOtlpGrpcOptions=void 0;var rOe=lX();Object.defineProperty(of,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return rOe.convertLegacyOtlpGrpcOptions}});var nOe=uX();Object.defineProperty(of,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return nOe.createOtlpGrpcExportDelegate}})});function us(t){return t<0?10:t<128?1:t<16384?2:t<2097152?3:t<268435456?4:t<34359738368?5:t<4398046511104?6:t<562949953421312?7:t<72057594037927940?8:9}var PD=A(()=>{"use strict"});var iOe,s_,Pa,hA=A(()=>{"use strict";Ee();PD();iOe="ProtobufWriter: estimated size was too small, growing buffer.",s_=1,Pa=class{_buffer;_textEncoder;_dataView;pos=0;constructor(e=65536){this._buffer=new Uint8Array(e),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(e){let r=this.pos+e;if(r<=this._buffer.length)return;J.debug(iOe);let n=this._buffer.length*2;for(;n<r;)n*=2;let i=new Uint8Array(n);i.set(this._buffer),this._buffer=i,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){let e=this.pos;return this._ensureCapacity(s_),this.pos+=s_,e}finishLengthDelimited(e,r){let n=r>>>0,i=us(n);if(i>s_){let s=i-s_;this._ensureCapacity(s),this._buffer.copyWithin(e+i,e+s_,this.pos),this.pos+=s}let o=e;n<128?this._buffer[o]=n:n<16384?(this._buffer[o++]=n&127|128,this._buffer[o]=n>>>7):n<2097152?(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o]=n>>>14):n<268435456?(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o++]=n>>>14&127|128,this._buffer[o]=n>>>21):(this._buffer[o++]=n&127|128,this._buffer[o++]=n>>>7&127|128,this._buffer[o++]=n>>>14&127|128,this._buffer[o++]=n>>>21&127|128,this._buffer[o]=n>>>28)}writeSint32(e){this.writeVarint((e<<1^e>>31)>>>0)}writeSfixed64(e){let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}this.writeFixed64(r,n)}writeVarint(e){if(this._ensureCapacity(us(e)),e>=0&&e<=4294967295){let r=e>>>0;for(;r>127;)this._buffer[this.pos++]=r&127|128,r>>>=7;this._buffer[this.pos++]=r}else{let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}for(;n>0||r>127;)this._buffer[this.pos++]=r&127|128,r=(r>>>7|n<<25)>>>0,n>>>=7;this._buffer[this.pos++]=r&127}}writeFixed32(e){this._ensureCapacity(4);let r=e>>>0;this._buffer[this.pos++]=r&255,this._buffer[this.pos++]=r>>>8&255,this._buffer[this.pos++]=r>>>16&255,this._buffer[this.pos++]=r>>>24&255}writeFixed64(e,r){this._ensureCapacity(8);let n=e>>>0,i=r>>>0;this._buffer[this.pos++]=n&255,this._buffer[this.pos++]=n>>>8&255,this._buffer[this.pos++]=n>>>16&255,this._buffer[this.pos++]=n>>>24&255,this._buffer[this.pos++]=i&255,this._buffer[this.pos++]=i>>>8&255,this._buffer[this.pos++]=i>>>16&255,this._buffer[this.pos++]=i>>>24&255}writeBytes(e){this.writeVarint(e.length),this._ensureCapacity(e.length),this._buffer.set(e,this.pos),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeString(e){let r=!0,n=e.length;for(let i=0;i<n;i++)if(e.charCodeAt(i)>127){r=!1;break}if(r){this.writeVarint(n),this._ensureCapacity(n);for(let i=0;i<n;i++)this._buffer[this.pos++]=e.charCodeAt(i)}else{let i=this._textEncoder.encode(e);this.writeBytes(i)}}}});function fX(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function ds(t){let e=new Uint8Array(t.length/2),r=0;for(let n=0;n<t.length;n+=2){let i=fX(t.charCodeAt(n)),o=fX(t.charCodeAt(n+1));e[r++]=i<<4|o}return e}var OD=A(()=>{"use strict"});var a_,pX=A(()=>{"use strict";(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"})(a_||(a_={}))});var c_,hX,ND=A(()=>{"use strict";c_=class{emit(e){}enabled(){return!1}},hX=new c_});function mX(t,e,r){return n=>n===t?e:r}var l_,sf,kD,gX=A(()=>{"use strict";l_=Symbol.for("io.opentelemetry.js.api.logs"),sf=globalThis;kD=1});var MD,mA,DD=A(()=>{"use strict";ND();MD=class{getLogger(e,r,n){return new c_}},mA=new MD});var gA,_X=A(()=>{"use strict";ND();gA=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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):hX}}});var u_,yX=A(()=>{"use strict";DD();_X();u_=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new gA(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:mA}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}}});var _A,SX=A(()=>{"use strict";gX();DD();yX();_A=class t{constructor(){this._proxyLoggerProvider=new u_}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return sf[l_]?this.getLoggerProvider():(sf[l_]=mX(kD,e,mA),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=sf[l_])===null||e===void 0?void 0:e.call(sf,kD))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete sf[l_],this._proxyLoggerProvider=new u_}}});var adt,EX=A(()=>{"use strict";pX();SX();adt=_A.getInstance()});function Qr(t,e){let r=e[0],n=e[1],i=1e9,o=r&65535,s=r/65536>>>0,a=o*i,c=s*i,l=a>>>0,u=Math.floor(a/4294967296),d=(c&65535)*65536>>>0,f=c/65536>>>0,p=l+d+n,h=p>>>0,m=Math.floor(p/4294967296),y=u+f+m>>>0;t.writeFixed64(h,y)}function Ti(t,e,r){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let i=e[n];t.writeTag(r,2);let o=t.startLengthDelimited(),s=t.pos;oOe(t,n,i),t.finishLengthDelimited(o,t.pos-s)}}function oOe(t,e,r){t.writeTag(1,2),t.writeString(e),t.writeTag(2,2);let n=t.startLengthDelimited(),i=t.pos;d_(t,r),t.finishLengthDelimited(n,t.pos-i)}function d_(t,e){let r=typeof e;if(r==="string")t.writeTag(1,2),t.writeString(e);else if(r==="boolean")t.writeTag(2,0),t.writeVarint(e?1:0);else if(r==="number"){let n=e;Number.isInteger(n)&&n>=sOe&&n<aOe?(t.writeTag(3,0),t.writeVarint(n)):(t.writeTag(4,1),t.writeDouble(n))}else if(e instanceof Uint8Array)t.writeTag(7,2),t.writeBytes(e);else if(Array.isArray(e)){t.writeTag(5,2);let n=t.startLengthDelimited(),i=t.pos;for(let o of e){t.writeTag(1,2);let s=t.startLengthDelimited(),a=t.pos;d_(t,o),t.finishLengthDelimited(s,t.pos-a)}t.finishLengthDelimited(n,t.pos-i)}else if(r==="object"&&e!=null){t.writeTag(6,2);let n=t.startLengthDelimited(),i=t.pos,o=e;for(let s in o){if(!Object.prototype.hasOwnProperty.call(o,s))continue;let a=o[s];t.writeTag(1,2);let c=t.startLengthDelimited(),l=t.pos;t.writeTag(1,2),t.writeString(s),t.writeTag(2,2);let u=t.startLengthDelimited(),d=t.pos;d_(t,a),t.finishLengthDelimited(u,t.pos-d),t.finishLengthDelimited(c,t.pos-l)}t.finishLengthDelimited(n,t.pos-i)}}function af(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;t.writeTag(1,2),t.writeString(e.name),e.version&&(t.writeTag(2,2),t.writeString(e.version)),t.finishLengthDelimited(n,t.pos-i)}function cf(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;e.attributes&&Ti(t,e.attributes,1),t.writeTag(2,0),t.writeVarint(0),t.finishLengthDelimited(n,t.pos-i)}var sOe,aOe,yA=A(()=>{"use strict";sOe=-(2**63),aOe=2**63});function cOe(t){let e=t.length,r=0;for(let n=0;n<e;n++){let i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(n++,r+=4)}return r}var Oa,SA=A(()=>{"use strict";PD();Oa=class{pos=0;startLengthDelimited(){return this.pos}finishLengthDelimited(e,r){this.pos+=us(r)}writeVarint(e){this.pos+=us(e)}writeSint32(e){this.pos+=us((e<<1^e>>31)>>>0)}writeSfixed64(e){this.pos+=8}writeFixed32(e){this.pos+=4}writeFixed64(e,r){this.pos+=8}writeBytes(e){this.pos+=us(e.length),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this.pos+=8}writeString(e){let r=cOe(e);this.pos+=us(r),this.pos+=r}}});function lOe(t,e){let r=t.startLengthDelimited(),n=t.pos;if(t.writeTag(1,1),Qr(t,e.hrTime),e.severityNumber!==void 0&&e.severityNumber!==a_.UNSPECIFIED&&(t.writeTag(2,0),t.writeVarint(e.severityNumber)),e.severityText&&(t.writeTag(3,2),t.writeString(e.severityText)),e.body!==void 0){t.writeTag(5,2);let i=t.startLengthDelimited(),o=t.pos;d_(t,e.body),t.finishLengthDelimited(i,t.pos-o)}e.attributes&&Ti(t,e.attributes,6),t.writeTag(7,0),t.writeVarint(e.droppedAttributesCount),e.spanContext?.traceFlags&&(t.writeTag(8,5),t.writeFixed32(e.spanContext.traceFlags)),e.spanContext?.traceId&&(t.writeTag(9,2),t.writeBytes(ds(e.spanContext.traceId))),e.spanContext?.spanId&&(t.writeTag(10,2),t.writeBytes(ds(e.spanContext.spanId))),t.writeTag(11,1),Qr(t,e.hrTimeObserved),e.eventName&&(t.writeTag(12,2),t.writeString(e.eventName)),t.finishLengthDelimited(r,t.pos-n)}function uOe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;af(t,e,1);for(let o of r)t.writeTag(2,2),lOe(t,o);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function vX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;cf(t,e,1);for(let o of r.values()){t.writeTag(2,2);let s=o[0].instrumentationScope;uOe(t,s,o)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function dOe(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,o=e.get(n);o||(o=new Map,e.set(n,o));let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}return e}function TX(t){let e=dOe(t),r=new Oa;for(let[i,o]of e)r.writeTag(1,2),vX(r,i,o);let n=new Pa(r.pos);for(let[i,o]of e)n.writeTag(1,2),vX(n,i,o);return n.finish()}var bX=A(()=>{"use strict";hA();OD();EX();yA();SA()});var bi,EA=A(()=>{"use strict";bi=class{pos=0;_buf;_textDecoder;constructor(e){this._buf=e,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){let e=this.readVarint();return{fieldNumber:e>>>3,wireType:e&7}}readVarint(){let e=0,r=0,n=!1;for(;this.pos<this._buf.length;){let i=this._buf[this.pos++];if(e+=(i&127)*Math.pow(2,r),r+=7,(i&128)===0){n=!0;break}}if(!n)throw new Error("Truncated buffer: unexpected end of data while reading varint");return e}readBytes(){let e=this.readVarint();if(this.pos+e>this._buf.length)throw new Error(`Truncated buffer: expected ${e} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);let r=this._buf.subarray(this.pos,this.pos+e);return this.pos+=e,r}readString(){return this._textDecoder.decode(this.readBytes())}skip(e){switch(e){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 3:for(;!this.isAtEnd();){let{wireType:r}=this.readTag();if(r===4)break;this.skip(r)}break;case 4:break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${e}, cannot safely skip`)}}}});function fOe(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedLogRecords=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function AX(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=fOe(e.readBytes()):e.skip(i)}return r}var wX=A(()=>{"use strict";EA()});var LD,xX=A(()=>{"use strict";bX();wX();LD={serializeRequest:t=>TX(t),deserializeResponse:t=>AX(t)}});var RX=A(()=>{"use strict";xX()});var fs,CX=A(()=>{"use strict";(function(t){t[t.DELTA=0]="DELTA",t[t.CUMULATIVE=1]="CUMULATIVE"})(fs||(fs={}))});var $D,En,IX=A(()=>{"use strict";(function(t){t.COUNTER="COUNTER",t.GAUGE="GAUGE",t.HISTOGRAM="HISTOGRAM",t.UP_DOWN_COUNTER="UP_DOWN_COUNTER",t.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",t.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",t.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})($D||($D={}));(function(t){t[t.HISTOGRAM=0]="HISTOGRAM",t[t.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",t[t.GAUGE=2]="GAUGE",t[t.SUM=3]="SUM"})(En||(En={}))});var UD=A(()=>{"use strict";CX();IX()});function NX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;t.writeTag(2,1),Qr(t,e.startTime),t.writeTag(3,1),Qr(t,e.endTime),r===Go.INT?(t.writeTag(6,1),t.writeSfixed64(e.value)):(t.writeTag(4,1),t.writeDouble(e.value)),e.attributes&&Ti(t,e.attributes,7),t.finishLengthDelimited(n,t.pos-i)}function pOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;if(t.writeTag(2,1),Qr(t,e.startTime),t.writeTag(3,1),Qr(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.buckets.counts.length>0){t.writeTag(6,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of i.buckets.counts)t.writeFixed64(a>>>0,a/4294967296>>>0);t.finishLengthDelimited(o,t.pos-s)}if(i.buckets.boundaries.length>0){t.writeTag(7,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of i.buckets.boundaries)t.writeDouble(a);t.finishLengthDelimited(o,t.pos-s)}e.attributes&&Ti(t,e.attributes,9),i.min!==void 0&&(t.writeTag(11,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(12,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function PX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;if(e!==0&&(t.writeTag(1,0),t.writeSint32(e)),r.length>0){t.writeTag(2,2);let o=t.startLengthDelimited(),s=t.pos;for(let a of r)t.writeVarint(a);t.finishLengthDelimited(o,t.pos-s)}t.finishLengthDelimited(n,t.pos-i)}function hOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;e.attributes&&Ti(t,e.attributes,1),t.writeTag(2,1),Qr(t,e.startTime),t.writeTag(3,1),Qr(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.scale!==0&&(t.writeTag(6,0),t.writeSint32(i.scale)),t.writeTag(7,1),t.writeFixed64(i.zeroCount>>>0,i.zeroCount/4294967296>>>0),t.writeTag(8,2),PX(t,i.positive.offset,i.positive.bucketCounts),t.writeTag(9,2),PX(t,i.negative.offset,i.negative.bucketCounts),i.min!==void 0&&(t.writeTag(12,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(13,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function mOe(t,e){let r=t.startLengthDelimited(),n=t.pos;switch(t.writeTag(1,2),t.writeString(e.descriptor.name),e.descriptor.description&&(t.writeTag(2,2),t.writeString(e.descriptor.description)),e.descriptor.unit&&(t.writeTag(3,2),t.writeString(e.descriptor.unit)),e.dataPointType){case En.GAUGE:t.writeTag(5,2),gOe(t,e);break;case En.SUM:t.writeTag(7,2),_Oe(t,e);break;case En.HISTOGRAM:t.writeTag(9,2),yOe(t,e);break;case En.EXPONENTIAL_HISTOGRAM:t.writeTag(10,2),SOe(t,e);break;default:{let i=e}}t.finishLengthDelimited(r,t.pos-n)}function gOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let i of e.dataPoints)t.writeTag(1,2),NX(t,i,e.descriptor.valueType);t.finishLengthDelimited(r,t.pos-n)}function _Oe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),NX(t,o,e.descriptor.valueType);let i=FD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),e.isMonotonic&&(t.writeTag(3,0),t.writeVarint(1)),t.finishLengthDelimited(r,t.pos-n)}function yOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),pOe(t,o);let i=FD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function SOe(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let o of e.dataPoints)t.writeTag(1,2),hOe(t,o);let i=FD(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function EOe(t,e){let r=t.startLengthDelimited(),n=t.pos;af(t,e.scope,1);for(let i of e.metrics)t.writeTag(2,2),mOe(t,i);e.scope.schemaUrl&&(t.writeTag(3,2),t.writeString(e.scope.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function OX(t,e){let r=t.startLengthDelimited(),n=t.pos;cf(t,e.resource,1);for(let i of e.scopeMetrics)t.writeTag(2,2),EOe(t,i);e.resource.schemaUrl&&(t.writeTag(3,2),t.writeString(e.resource.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function FD(t){switch(t){case fs.DELTA:return 1;case fs.CUMULATIVE:return 2;default:return 0}}function kX(t){let e=new Oa;e.writeTag(1,2),OX(e,t);let r=new Pa(e.pos);return r.writeTag(1,2),OX(r,t),r.finish()}var MX=A(()=>{"use strict";Ee();UD();yA();SA();hA()});function vOe(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedDataPoints=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function DX(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=vOe(e.readBytes()):e.skip(i)}return r}var LX=A(()=>{"use strict";EA()});var BD,$X=A(()=>{"use strict";MX();LX();BD={serializeRequest:t=>kX(t),deserializeResponse:t=>DX(t)}});var UX=A(()=>{"use strict";$X()});function BX(t,e){let r=t&255|TOe;return e&&(r|=bOe),r}function AOe(t,e){let r=t.startLengthDelimited(),n=t.pos;e.message&&(t.writeTag(2,2),t.writeString(e.message)),t.writeTag(3,0),t.writeVarint(e.code),t.finishLengthDelimited(r,t.pos-n)}function wOe(t,e){let r=t.startLengthDelimited(),n=t.pos;t.writeTag(1,1),Qr(t,e.time),t.writeTag(2,2),t.writeString(e.name),e.attributes&&Ti(t,e.attributes,3),t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount||0),t.finishLengthDelimited(r,t.pos-n)}function xOe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.context;t.writeTag(1,2),t.writeBytes(ds(i.traceId)),t.writeTag(2,2),t.writeBytes(ds(i.spanId));let o=i.traceState?.serialize();o&&(t.writeTag(3,2),t.writeString(o)),e.attributes&&Ti(t,e.attributes,4),t.writeTag(5,0),t.writeVarint(e.droppedAttributesCount||0);let s=BX(i.traceFlags,i.isRemote);s&&(t.writeTag(6,5),t.writeFixed32(s)),t.finishLengthDelimited(r,t.pos-n)}function ROe(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.spanContext();t.writeTag(1,2),t.writeBytes(ds(i.traceId)),t.writeTag(2,2),t.writeBytes(ds(i.spanId));let o=i.traceState?.serialize();o&&(t.writeTag(3,2),t.writeString(o)),e.parentSpanContext?.spanId&&(t.writeTag(4,2),t.writeBytes(ds(e.parentSpanContext.spanId))),t.writeTag(5,2),t.writeString(e.name);let s=e.kind==null?0:e.kind+1;s!==0&&(t.writeTag(6,0),t.writeVarint(s)),t.writeTag(7,1),Qr(t,e.startTime),t.writeTag(8,1),Qr(t,e.endTime),e.attributes&&Ti(t,e.attributes,9),t.writeTag(10,0),t.writeVarint(e.droppedAttributesCount);for(let c of e.events)t.writeTag(11,2),wOe(t,c);t.writeTag(12,0),t.writeVarint(e.droppedEventsCount);for(let c of e.links)t.writeTag(13,2),xOe(t,c);t.writeTag(14,0),t.writeVarint(e.droppedLinksCount),t.writeTag(15,2),AOe(t,e.status);let a=BX(i.traceFlags,e.parentSpanContext?.isRemote);a&&(t.writeTag(16,5),t.writeFixed32(a)),t.finishLengthDelimited(r,t.pos-n)}function COe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;af(t,e,1);for(let o of r)t.writeTag(2,2),ROe(t,o);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function FX(t,e,r){let n=t.startLengthDelimited(),i=t.pos;cf(t,e,1);for(let o of r.values()){t.writeTag(2,2);let s=o[0].instrumentationScope;COe(t,s,o)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function IOe(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,o=e.get(n);o||(o=new Map,e.set(n,o));let s=o.get(i);s||(s=[],o.set(i,s)),s.push(r)}return e}function jX(t){let e=IOe(t),r=new Oa;for(let[i,o]of e)r.writeTag(1,2),FX(r,i,o);let n=new Pa(r.pos);for(let[i,o]of e)n.writeTag(1,2),FX(n,i,o);return n.finish()}var TOe,bOe,zX=A(()=>{"use strict";hA();OD();yA();SA();TOe=256,bOe=512});function POe(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedSpans=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function GX(t){let e=new bi(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=POe(e.readBytes()):e.skip(i)}return r}var qX=A(()=>{"use strict";EA()});var jD,VX=A(()=>{"use strict";zX();qX();jD={serializeRequest:t=>jX(t),deserializeResponse:t=>GX(t)}});var HX=A(()=>{"use strict";VX()});function lf(t,e){let r={attributes:ps(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function uf(t){return{name:t.name,version:t.version}}function ps(t,e){return Object.keys(t).map(r=>zD(r,t[r],e))}function zD(t,e,r){return{key:t,value:f_(e,r)}}function f_(t,e){let r=typeof t;if(r==="string")return{stringValue:t};if(r==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(r==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){let n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=f_(t[i],e);return{arrayValue:{values:n}}}if(r==="object"&&t!=null){let n=Object.keys(t),i=new Array(n.length);for(let o=0;o<n.length;o++)i[o]={key:n[o],value:f_(t[n[o]],e)};return{kvlistValue:{values:i}}}return{}}var vA=A(()=>{"use strict"});function WX(t,e){return{resourceLogs:NOe(t,e)}}function OOe(t){let e=new Map;for(let r of t){let{resource:n,instrumentationScope:{name:i,version:o="",schemaUrl:s=""}}=r,a=e.get(n);a||(a=new Map,e.set(n,a));let c=`${i}@${o}:${s}`,l=a.get(c);l||(l=[],a.set(c,l)),l.push(r)}return e}function NOe(t,e){let r=OOe(t);return Array.from(r,([n,i])=>{let o=lf(n,e);return{resource:o,scopeLogs:Array.from(i,([,s])=>({scope:uf(s[0].instrumentationScope),logRecords:s.map(a=>kOe(a,e)),schemaUrl:s[0].instrumentationScope.schemaUrl})),schemaUrl:o.schemaUrl}})}function kOe(t,e){return{timeUnixNano:e.encodeHrTime(t.hrTime),observedTimeUnixNano:e.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:f_(t.body,e),eventName:t.eventName,attributes:MOe(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:e.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:e.encodeOptionalSpanContext(t.spanContext?.spanId)}}function MOe(t,e){return Object.keys(t).map(r=>zD(r,t[r],e))}var YX=A(()=>{"use strict";vA()});function DOe(t){let e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function LOe(t){return DOe(t).toString()}function KX(t){return t}var $Oe,df,TA=A(()=>{"use strict";_d();$Oe=typeof BigInt<"u"?LOe:qv;df={encodeHrTime:$Oe,encodeSpanContext:KX,encodeOptionalSpanContext:KX,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=String.fromCharCode(t[r]);return btoa(e.join(""))}}});var GD,ZX=A(()=>{"use strict";YX();TA();Ee();GD={serializeRequest:t=>{let e=WX(t,df);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return J.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}}});var JX=A(()=>{"use strict";ZX()});var p_,XX=A(()=>{"use strict";(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(p_||(p_={}))});function UOe(t,e){let r=lf(t.resource,e);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:FOe(t.scopeMetrics,e)}}function FOe(t,e){return Array.from(t.map(r=>({scope:uf(r.scope),metrics:r.metrics.map(n=>BOe(n,e)),schemaUrl:r.scope.schemaUrl})))}function BOe(t,e){let r={name:t.descriptor.name,description:t.descriptor.description,unit:t.descriptor.unit},n=qOe(t.aggregationTemporality);switch(t.dataPointType){case En.SUM:r.sum={aggregationTemporality:n,isMonotonic:t.isMonotonic,dataPoints:QX(t,e)};break;case En.GAUGE:r.gauge={dataPoints:QX(t,e)};break;case En.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:zOe(t,e)};break;case En.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:GOe(t,e)};break}return r}function jOe(t,e,r){let n={attributes:ps(t.attributes,r),startTimeUnixNano:r.encodeHrTime(t.startTime),timeUnixNano:r.encodeHrTime(t.endTime)};switch(e){case Go.INT:n.asInt=t.value;break;case Go.DOUBLE:n.asDouble=t.value;break}return n}function QX(t,e){return t.dataPoints.map(r=>jOe(r,t.descriptor.valueType,e))}function zOe(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:ps(r.attributes,e),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function GOe(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:ps(r.attributes,e),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function qOe(t){switch(t){case fs.DELTA:return p_.AGGREGATION_TEMPORALITY_DELTA;case fs.CUMULATIVE:return p_.AGGREGATION_TEMPORALITY_CUMULATIVE}}function eQ(t,e){return{resourceMetrics:t.map(r=>UOe(r,e))}}var tQ=A(()=>{"use strict";Ee();UD();XX();vA()});var qD,rQ=A(()=>{"use strict";tQ();TA();Ee();qD={serializeRequest:t=>{let e=eQ([t],df);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return J.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}}});var nQ=A(()=>{"use strict";rQ()});function iQ(t,e){let r=t&255|VOe;return e&&(r|=HOe),r}function WOe(t,e){let r=t.spanContext(),n=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(r.traceId),spanId:e.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:ps(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(o=>KOe(o,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(o=>YOe(o,e)),droppedLinksCount:t.droppedLinksCount,flags:iQ(r.traceFlags,t.parentSpanContext?.isRemote)}}function YOe(t,e){return{attributes:t.attributes?ps(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:iQ(t.context.traceFlags,t.context.isRemote)}}function KOe(t,e){return{attributes:t.attributes?ps(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function oQ(t,e){return{resourceSpans:JOe(t,e)}}function ZOe(t){let e=new Map;for(let r of t){let n=e.get(r.resource);n||(n=new Map,e.set(r.resource,n));let i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,o=n.get(i);o||(o=[],n.set(i,o)),o.push(r)}return e}function JOe(t,e){let r=ZOe(t),n=[],i=r.entries(),o=i.next();for(;!o.done;){let[s,a]=o.value,c=[],l=a.values(),u=l.next();for(;!u.done;){let p=u.value;if(p.length>0){let h=p.map(m=>WOe(m,e));c.push({scope:uf(p[0].instrumentationScope),spans:h,schemaUrl:p[0].instrumentationScope.schemaUrl})}u=l.next()}let d=lf(s,e),f={resource:d,scopeSpans:c,schemaUrl:d.schemaUrl};n.push(f),o=i.next()}return n}var VOe,HOe,sQ=A(()=>{"use strict";vA();VOe=256,HOe=512});var VD,aQ=A(()=>{"use strict";sQ();TA();Ee();VD={serializeRequest:t=>{let e=oQ(t,df);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return J.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}}});var cQ=A(()=>{"use strict";aQ()});var lQ={};ar(lQ,{JsonLogsSerializer:()=>GD,JsonMetricsSerializer:()=>qD,JsonTraceSerializer:()=>VD,ProtobufLogsSerializer:()=>LD,ProtobufMetricsSerializer:()=>BD,ProtobufTraceSerializer:()=>jD});var uQ=A(()=>{"use strict";RX();UX();HX();JX();nQ();cQ()});var fQ=v(bA=>{"use strict";Object.defineProperty(bA,"__esModule",{value:!0});bA.OTLPTraceExporter=void 0;var dQ=dX(),XOe=(uQ(),Nr(lQ)),QOe=(tT(),Nr(eT)),HD=class extends QOe.OTLPExporterBase{constructor(e={}){super((0,dQ.createOtlpGrpcExportDelegate)((0,dQ.convertLegacyOtlpGrpcOptions)(e,"TRACES"),XOe.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};bA.OTLPTraceExporter=HD});var pQ=v(AA=>{"use strict";Object.defineProperty(AA,"__esModule",{value:!0});AA.OTLPTraceExporter=void 0;var eNe=fQ();Object.defineProperty(AA,"OTLPTraceExporter",{enumerable:!0,get:function(){return eNe.OTLPTraceExporter}})});var O7=v((Nmt,P7)=>{"use strict";P7.exports=I7;I7.sync=mMe;var R7=Z("fs");function hMe(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function C7(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:hMe(e,r)}function I7(t,e,r){R7.stat(t,function(n,i){r(n,n?!1:C7(i,t,e))})}function mMe(t,e){return C7(R7.statSync(t),t,e)}});var L7=v((kmt,D7)=>{"use strict";D7.exports=k7;k7.sync=gMe;var N7=Z("fs");function k7(t,e,r){N7.stat(t,function(n,i){r(n,n?!1:M7(i,e))})}function gMe(t,e){return M7(N7.statSync(t),e)}function M7(t,e){return t.isFile()&&_Me(t,e)}function _Me(t,e){var r=t.mode,n=t.uid,i=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),l=parseInt("001",8),u=a|c,d=r&l||r&c&&i===s||r&a&&n===o||r&u&&o===0;return d}});var U7=v((Dmt,$7)=>{"use strict";var Mmt=Z("fs"),ZA;process.platform==="win32"||global.TESTING_WINDOWS?ZA=O7():ZA=L7();$7.exports=vL;vL.sync=yMe;function vL(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){vL(t,e||{},function(o,s){o?i(o):n(s)})})}ZA(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function yMe(t,e){try{return ZA.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var V7=v((Lmt,q7)=>{"use strict";var _f=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",F7=Z("path"),SMe=_f?";":":",B7=U7(),j7=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),z7=(t,e)=>{let r=e.colon||SMe,n=t.match(/\//)||_f&&t.match(/\\/)?[""]:[..._f?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=_f?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=_f?i.split(r):[""];return _f&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},G7=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=z7(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(j7(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,h=F7.join(p,t),m=!p&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;u(c(m,l,0))}),c=(l,u,d)=>new Promise((f,p)=>{if(d===i.length)return f(a(u+1));let h=i[d];B7(l+h,{pathExt:o},(m,y)=>{if(!m&&y)if(e.all)s.push(l+h);else return f(l+h);return f(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},EMe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=z7(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],c=/^".*"$/.test(a)?a.slice(1,-1):a,l=F7.join(c,t),u=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let d=0;d<n.length;d++){let f=u+n[d];try{if(B7.sync(f,{pathExt:i}))if(e.all)o.push(f);else return f}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw j7(t)};q7.exports=G7;G7.sync=EMe});var W7=v(($mt,TL)=>{"use strict";var H7=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};TL.exports=H7;TL.exports.default=H7});var J7=v((Umt,Z7)=>{"use strict";var Y7=Z("path"),vMe=V7(),TMe=W7();function K7(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,o=i&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=vMe.sync(t.command,{path:r[TMe({env:r})],pathExt:e?Y7.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=Y7.resolve(i?t.options.cwd:"",s)),s}function bMe(t){return K7(t)||K7(t,!0)}Z7.exports=bMe});var X7=v((Fmt,AL)=>{"use strict";var bL=/([()\][%!^"`<>&|;, *?])/g;function AMe(t){return t=t.replace(bL,"^$1"),t}function wMe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(bL,"^$1"),e&&(t=t.replace(bL,"^$1")),t}AL.exports.command=AMe;AL.exports.argument=wMe});var eee=v((Bmt,Q7)=>{"use strict";Q7.exports=/^#!(.*)/});var ree=v((jmt,tee)=>{"use strict";var xMe=eee();tee.exports=(t="")=>{let e=t.match(xMe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var iee=v((zmt,nee)=>{"use strict";var wL=Z("fs"),RMe=ree();function CMe(t){let r=Buffer.alloc(150),n;try{n=wL.openSync(t,"r"),wL.readSync(n,r,0,150,0),wL.closeSync(n)}catch{}return RMe(r.toString())}nee.exports=CMe});var cee=v((Gmt,aee)=>{"use strict";var IMe=Z("path"),oee=J7(),see=X7(),PMe=iee(),OMe=process.platform==="win32",NMe=/\.(?:com|exe)$/i,kMe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function MMe(t){t.file=oee(t);let e=t.file&&PMe(t.file);return e?(t.args.unshift(t.file),t.command=e,oee(t)):t.file}function DMe(t){if(!OMe)return t;let e=MMe(t),r=!NMe.test(e);if(t.options.forceShell||r){let n=kMe.test(e);t.command=IMe.normalize(t.command),t.command=see.command(t.command),t.args=t.args.map(o=>see.argument(o,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function LMe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:DMe(n)}aee.exports=LMe});var dee=v((qmt,uee)=>{"use strict";var xL=process.platform==="win32";function RL(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function $Me(t,e){if(!xL)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=lee(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function lee(t,e){return xL&&t===1&&!e.file?RL(e.original,"spawn"):null}function UMe(t,e){return xL&&t===1&&!e.file?RL(e.original,"spawnSync"):null}uee.exports={hookChildProcess:$Me,verifyENOENT:lee,verifyENOENTSync:UMe,notFoundError:RL}});var hee=v((Vmt,yf)=>{"use strict";var fee=Z("child_process"),CL=cee(),IL=dee();function pee(t,e,r){let n=CL(t,e,r),i=fee.spawn(n.command,n.args,n.options);return IL.hookChildProcess(i,n),i}function FMe(t,e,r){let n=CL(t,e,r),i=fee.spawnSync(n.command,n.args,n.options);return i.error=i.error||IL.verifyENOENTSync(i.status,n),i}yf.exports=pee;yf.exports.spawn=pee;yf.exports.sync=FMe;yf.exports._parse=CL;yf.exports._enoent=IL});var Yue=v((dzt,Wue)=>{"use strict";var Oc=Z("constants"),FVe=process.cwd,rI=null,BVe=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return rI||(rI=FVe.call(process)),rI};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Xz=process.chdir,process.chdir=function(t){rI=null,Xz.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Xz));var Xz;Wue.exports=jVe;function jVe(t){Oc.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(u,d,f){f&&process.nextTick(f)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(u,d,f,p){p&&process.nextTick(p)},t.lchownSync=function(){}),BVe==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(u){function d(f,p,h){var m=Date.now(),y=0;u(f,p,function S(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){t.stat(p,function(w,T){w&&w.code==="ENOENT"?u(f,p,S):h(b)})},y),y<100&&(y+=10);return}h&&h(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(u){function d(f,p,h,m,y,S){var b;if(S&&typeof S=="function"){var w=0;b=function(T,C,O){if(T&&T.code==="EAGAIN"&&w<10)return w++,u.call(t,f,p,h,m,y,b);S.apply(this,arguments)}}return u.call(t,f,p,h,m,y,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(u){return function(d,f,p,h,m){for(var y=0;;)try{return u.call(t,d,f,p,h,m)}catch(S){if(S.code==="EAGAIN"&&y<10){y++;continue}throw S}}})(t.readSync);function e(u){u.lchmod=function(d,f,p){u.open(d,Oc.O_WRONLY|Oc.O_SYMLINK,f,function(h,m){if(h){p&&p(h);return}u.fchmod(m,f,function(y){u.close(m,function(S){p&&p(y||S)})})})},u.lchmodSync=function(d,f){var p=u.openSync(d,Oc.O_WRONLY|Oc.O_SYMLINK,f),h=!0,m;try{m=u.fchmodSync(p,f),h=!1}finally{if(h)try{u.closeSync(p)}catch{}else u.closeSync(p)}return m}}function r(u){Oc.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(d,f,p,h){u.open(d,Oc.O_SYMLINK,function(m,y){if(m){h&&h(m);return}u.futimes(y,f,p,function(S){u.close(y,function(b){h&&h(S||b)})})})},u.lutimesSync=function(d,f,p){var h=u.openSync(d,Oc.O_SYMLINK),m,y=!0;try{m=u.futimesSync(h,f,p),y=!1}finally{if(y)try{u.closeSync(h)}catch{}else u.closeSync(h)}return m}):u.futimes&&(u.lutimes=function(d,f,p,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function n(u){return u&&function(d,f,p){return u.call(t,d,f,function(h){l(h)&&(h=null),p&&p.apply(this,arguments)})}}function i(u){return u&&function(d,f){try{return u.call(t,d,f)}catch(p){if(!l(p))throw p}}}function o(u){return u&&function(d,f,p,h){return u.call(t,d,f,p,function(m){l(m)&&(m=null),h&&h.apply(this,arguments)})}}function s(u){return u&&function(d,f,p){try{return u.call(t,d,f,p)}catch(h){if(!l(h))throw h}}}function a(u){return u&&function(d,f,p){typeof f=="function"&&(p=f,f=null);function h(m,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),p&&p.apply(this,arguments)}return f?u.call(t,d,f,h):u.call(t,d,h)}}function c(u){return u&&function(d,f){var p=f?u.call(t,d,f):u.call(t,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function l(u){if(!u||u.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var Jue=v((fzt,Zue)=>{"use strict";var Kue=Z("stream").Stream;Zue.exports=zVe;function zVe(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Kue.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,c=s.length;a<c;a++){var l=s[a];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(u,d){if(u){o.emit("error",u),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Kue.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var c=o[s];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Que=v((pzt,Xue)=>{"use strict";Xue.exports=qVe;var GVe=Object.getPrototypeOf||function(t){return t.__proto__};function qVe(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:GVe(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var nde=v((hzt,tG)=>{"use strict";var wt=Z("fs"),VVe=Yue(),HVe=Jue(),WVe=Que(),nI=Z("util"),Sr,oI;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Sr=Symbol.for("graceful-fs.queue"),oI=Symbol.for("graceful-fs.previous")):(Sr="___graceful-fs.queue",oI="___graceful-fs.previous");function YVe(){}function rde(t,e){Object.defineProperty(t,Sr,{get:function(){return e}})}var Lu=YVe;nI.debuglog?Lu=nI.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Lu=function(){var t=nI.format.apply(nI,arguments);t="GFS4: "+t.split(/\n/).join(`
23
+ GFS4: `),console.error(t)});wt[Sr]||(ede=global[Sr]||[],rde(wt,ede),wt.close=(function(t){function e(r,n){return t.call(wt,r,function(i){i||tde(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,oI,{value:t}),e})(wt.close),wt.closeSync=(function(t){function e(r){t.apply(wt,arguments),tde()}return Object.defineProperty(e,oI,{value:t}),e})(wt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Lu(wt[Sr]),Z("assert").equal(wt[Sr].length,0)}));var ede;global[Sr]||rde(global,wt[Sr]);tG.exports=Qz(WVe(wt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!wt.__patched&&(tG.exports=Qz(wt),wt.__patched=!0);function Qz(t){VVe(t),t.gracefulify=Qz,t.createReadStream=C,t.createWriteStream=O;var e=t.readFile;t.readFile=r;function r(M,F,_){return typeof F=="function"&&(_=F,F=null),re(M,F,_);function re(N,g,E,x){return e(N,g,function(Y){Y&&(Y.code==="EMFILE"||Y.code==="ENFILE")?Bh([re,[N,g,E],Y,x||Date.now(),Date.now()]):typeof E=="function"&&E.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(M,F,_,re){return typeof _=="function"&&(re=_,_=null),N(M,F,_,re);function N(g,E,x,Y,q){return n(g,E,x,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,q||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(M,F,_,re){return typeof _=="function"&&(re=_,_=null),N(M,F,_,re);function N(g,E,x,Y,q){return o(g,E,x,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,q||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(M,F,_,re){return typeof _=="function"&&(re=_,_=0),N(M,F,_,re);function N(g,E,x,Y,q){return a(g,E,x,function(fe){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,q||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}var l=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d(M,F,_){typeof F=="function"&&(_=F,F=null);var re=u.test(process.version)?function(E,x,Y,q){return l(E,N(E,x,Y,q))}:function(E,x,Y,q){return l(E,x,N(E,x,Y,q))};return re(M,F,_);function N(g,E,x,Y){return function(q,fe){q&&(q.code==="EMFILE"||q.code==="ENFILE")?Bh([re,[g,E,x],q,Y||Date.now(),Date.now()]):(fe&&fe.sort&&fe.sort(),typeof x=="function"&&x.call(this,q,fe))}}}if(process.version.substr(0,4)==="v0.8"){var f=HVe(t);S=f.ReadStream,w=f.WriteStream}var p=t.ReadStream;p&&(S.prototype=Object.create(p.prototype),S.prototype.open=b);var h=t.WriteStream;h&&(w.prototype=Object.create(h.prototype),w.prototype.open=T),Object.defineProperty(t,"ReadStream",{get:function(){return S},set:function(M){S=M},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return w},set:function(M){w=M},enumerable:!0,configurable:!0});var m=S;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(M){m=M},enumerable:!0,configurable:!0});var y=w;Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(M){y=M},enumerable:!0,configurable:!0});function S(M,F){return this instanceof S?(p.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function b(){var M=this;P(M.path,M.flags,M.mode,function(F,_){F?(M.autoClose&&M.destroy(),M.emit("error",F)):(M.fd=_,M.emit("open",_),M.read())})}function w(M,F){return this instanceof w?(h.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}function T(){var M=this;P(M.path,M.flags,M.mode,function(F,_){F?(M.destroy(),M.emit("error",F)):(M.fd=_,M.emit("open",_))})}function C(M,F){return new t.ReadStream(M,F)}function O(M,F){return new t.WriteStream(M,F)}var k=t.open;t.open=P;function P(M,F,_,re){return typeof _=="function"&&(re=_,_=null),N(M,F,_,re);function N(g,E,x,Y,q){return k(g,E,x,function(fe,$e){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Bh([N,[g,E,x,Y],fe,q||Date.now(),Date.now()]):typeof Y=="function"&&Y.apply(this,arguments)})}}return t}function Bh(t){Lu("ENQUEUE",t[0].name,t[1]),wt[Sr].push(t),eG()}var iI;function tde(){for(var t=Date.now(),e=0;e<wt[Sr].length;++e)wt[Sr][e].length>2&&(wt[Sr][e][3]=t,wt[Sr][e][4]=t);eG()}function eG(){if(clearTimeout(iI),iI=void 0,wt[Sr].length!==0){var t=wt[Sr].shift(),e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(i===void 0)Lu("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Lu("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,c=Math.max(o-i,1),l=Math.min(c*1.2,100);a>=l?(Lu("RETRY",e.name,r),e.apply(null,r.concat([i]))):wt[Sr].push(t)}iI===void 0&&(iI=setTimeout(eG,0))}}});var _de=v(jh=>{"use strict";Object.defineProperty(jh,"__esModule",{value:!0});jh.splitWhen=jh.flatten=void 0;function hHe(t){return t.reduce((e,r)=>[].concat(e,r),[])}jh.flatten=hHe;function mHe(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}jh.splitWhen=mHe});var yde=v(aI=>{"use strict";Object.defineProperty(aI,"__esModule",{value:!0});aI.isEnoentCodeError=void 0;function gHe(t){return t.code==="ENOENT"}aI.isEnoentCodeError=gHe});var Sde=v(cI=>{"use strict";Object.defineProperty(cI,"__esModule",{value:!0});cI.createDirentFromStats=void 0;var uG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function _He(t,e){return new uG(t,e)}cI.createDirentFromStats=_He});var bde=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.convertPosixPathToPattern=Bt.convertWindowsPathToPattern=Bt.convertPathToPattern=Bt.escapePosixPath=Bt.escapeWindowsPath=Bt.escape=Bt.removeLeadingDotSegment=Bt.makeAbsolute=Bt.unixify=void 0;var yHe=Z("os"),SHe=Z("path"),Ede=yHe.platform()==="win32",EHe=2,vHe=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,THe=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,bHe=/^\\\\([.?])/,AHe=/\\(?![!()+@[\]{}])/g;function wHe(t){return t.replace(/\\/g,"/")}Bt.unixify=wHe;function xHe(t,e){return SHe.resolve(t,e)}Bt.makeAbsolute=xHe;function RHe(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(EHe)}return t}Bt.removeLeadingDotSegment=RHe;Bt.escape=Ede?dG:fG;function dG(t){return t.replace(THe,"\\$2")}Bt.escapeWindowsPath=dG;function fG(t){return t.replace(vHe,"\\$2")}Bt.escapePosixPath=fG;Bt.convertPathToPattern=Ede?vde:Tde;function vde(t){return dG(t).replace(bHe,"//$1").replace(AHe,"/")}Bt.convertWindowsPathToPattern=vde;function Tde(t){return fG(t)}Bt.convertPosixPathToPattern=Tde});var wde=v((jzt,Ade)=>{"use strict";Ade.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var Cde=v((zzt,Rde)=>{"use strict";var CHe=wde(),xde={"{":"}","(":")","[":"]"},IHe=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=xde[a];if(c){var l=t.indexOf(c,e);l!==-1&&(e=l+1)}if(t[e]==="!")return!0}else e++}return!1},PHe=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=xde[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Rde.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(CHe(e))return!0;var n=IHe;return r&&r.strict===!1&&(n=PHe),n(e)}});var Pde=v((Gzt,Ide)=>{"use strict";var OHe=Cde(),NHe=Z("path").posix.dirname,kHe=Z("os").platform()==="win32",pG="/",MHe=/\\/g,DHe=/[\{\[].*[\}\]]$/,LHe=/(^|[^\\])([\{\[]|\([^\)]+$)/,$He=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Ide.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&kHe&&e.indexOf(pG)<0&&(e=e.replace(MHe,pG)),DHe.test(e)&&(e+=pG),e+="a";do e=NHe(e);while(OHe(e)||LHe.test(e));return e.replace($He,"$1")}});var lI=v(ti=>{"use strict";ti.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;ti.find=(t,e)=>t.nodes.find(r=>r.type===e);ti.exceedsLimit=(t,e,r=1,n)=>n===!1||!ti.isInteger(t)||!ti.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;ti.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};ti.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;ti.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;ti.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;ti.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);ti.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var uI=v((Vzt,Nde)=>{"use strict";var Ode=lI();Nde.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&Ode.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&Ode.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var Mde=v((Hzt,kde)=>{"use strict";kde.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var Gde=v((Wzt,zde)=>{"use strict";var Dde=Mde(),Uu=(t,e,r)=>{if(Dde(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Dde(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+o+s+a;if(Uu.cache.hasOwnProperty(c))return Uu.cache[c].result;let l=Math.min(t,e),u=Math.max(t,e);if(Math.abs(l-u)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let d=jde(t)||jde(e),f={min:t,max:e,a:l,b:u},p=[],h=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let m=u<0?Math.abs(u):1;h=Lde(m,Math.abs(l),f,n),l=f.a=0}return u>=0&&(p=Lde(l,u,f,n)),f.negatives=h,f.positives=p,f.result=UHe(h,p,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&p.length+h.length>1&&(f.result=`(?:${f.result})`),Uu.cache[c]=f,f.result};function UHe(t,e,r){let n=hG(t,e,"-",!1,r)||[],i=hG(e,t,"",!1,r)||[],o=hG(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function FHe(t,e){let r=1,n=1,i=Ude(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=Ude(t,r);for(i=Fde(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=Fde(e+1,n)-1;return o=[...o],o.sort(zHe),o}function BHe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=jHe(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[c,l]=n[a];c===l?o+=c:c!=="0"||l!=="9"?o+=GHe(c,l,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Lde(t,e,r,n){let i=FHe(t,e),o=[],s=t,a;for(let c=0;c<i.length;c++){let l=i[c],u=BHe(String(s),String(l),n),d="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+Bde(a.count),s=l+1;continue}r.isPadded&&(d=qHe(l,r,n)),u.string=d+u.pattern+Bde(u.count),o.push(u),s=l+1,a=u}return o}function hG(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!$de(e,"string",a)&&o.push(r+a),n&&$de(e,"string",a)&&o.push(r+a)}return o}function jHe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function zHe(t,e){return t>e?1:e>t?-1:0}function $de(t,e,r){return t.some(n=>n[e]===r)}function Ude(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Fde(t,e){return t-t%Math.pow(10,e)}function Bde(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function GHe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function jde(t){return/^-?(0+)\d/.test(t)}function qHe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}Uu.cache={};Uu.clearCache=()=>Uu.cache={};zde.exports=Uu});var _G=v((Yzt,Zde)=>{"use strict";var VHe=Z("util"),Vde=Gde(),qde=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),HHe=t=>e=>t===!0?Number(e):String(e),mG=t=>typeof t=="number"||typeof t=="string"&&t!=="",IS=t=>Number.isInteger(+t),gG=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},WHe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,YHe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},fI=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},KHe=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>fI(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>fI(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},Hde=(t,e,r,n)=>{if(r)return Vde(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},Wde=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return Vde(t,e,r)},Yde=(...t)=>new RangeError("Invalid range arguments: "+VHe.inspect(...t)),Kde=(t,e,r)=>{if(r.strictRanges===!0)throw Yde([t,e]);return[]},ZHe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},JHe=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw Yde([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),c=String(e),l=String(r);r=Math.max(Math.abs(r),1);let u=gG(a)||gG(c)||gG(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&WHe(t,e,n)===!1,p=n.transform||HHe(f);if(n.toRegex&&r===1)return Hde(fI(t,d),fI(e,d),!0,n);let h={negatives:[],positives:[]},m=b=>h[b<0?"negatives":"positives"].push(Math.abs(b)),y=[],S=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?m(i):y.push(YHe(p(i,S),d,f)),i=s?i-r:i+r,S++;return n.toRegex===!0?r>1?KHe(h,n,d):Wde(y,null,{wrap:!1,...n}):y},XHe=(t,e,r=1,n={})=>{if(!IS(t)&&t.length>1||!IS(e)&&e.length>1)return Kde(t,e,n);let i=n.transform||(f=>String.fromCharCode(f)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,c=Math.min(o,s),l=Math.max(o,s);if(n.toRegex&&r===1)return Hde(c,l,!1,n);let u=[],d=0;for(;a?o>=s:o<=s;)u.push(i(o,d)),o=a?o-r:o+r,d++;return n.toRegex===!0?Wde(u,null,{wrap:!1,options:n}):u},dI=(t,e,r,n={})=>{if(e==null&&mG(t))return[t];if(!mG(t)||!mG(e))return Kde(t,e,n);if(typeof r=="function")return dI(t,e,1,{transform:r});if(qde(r))return dI(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,IS(r)?IS(t)&&IS(e)?JHe(t,e,r,i):XHe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!qde(r)?ZHe(r,i):dI(t,e,1,r)};Zde.exports=dI});var Qde=v((Kzt,Xde)=>{"use strict";var QHe=_G(),Jde=lI(),e6e=(t,e={})=>{let r=(n,i={})=>{let o=Jde.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,c=e.escapeInvalid===!0?"\\":"",l="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=Jde.reduce(n.nodes),d=QHe(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let u of n.nodes)l+=r(u,n);return l};return r(t)};Xde.exports=e6e});var rfe=v((Zzt,tfe)=>{"use strict";var t6e=_G(),efe=uI(),zh=lI(),Fu=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?zh.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(Fu(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?Fu(i,o,r):i+o);return zh.flatten(n)},r6e=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(Fu(a.pop(),efe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(Fu(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let d=zh.reduce(i.nodes);if(zh.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=t6e(...d,e);f.length===0&&(f=efe(i,e)),a.push(Fu(a.pop(),f)),i.nodes=[];return}let c=zh.encloseBrace(i),l=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<i.nodes.length;d++){let f=i.nodes[d];if(f.type==="comma"&&i.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(Fu(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(Fu(l.pop(),f.value));continue}f.nodes&&n(f,i)}return l};return zh.flatten(n(t))};tfe.exports=r6e});var ife=v((Jzt,nfe)=>{"use strict";nfe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
24
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var lfe=v((Xzt,cfe)=>{"use strict";var n6e=uI(),{MAX_LENGTH:ofe,CHAR_BACKSLASH:yG,CHAR_BACKTICK:i6e,CHAR_COMMA:o6e,CHAR_DOT:s6e,CHAR_LEFT_PARENTHESES:a6e,CHAR_RIGHT_PARENTHESES:c6e,CHAR_LEFT_CURLY_BRACE:l6e,CHAR_RIGHT_CURLY_BRACE:u6e,CHAR_LEFT_SQUARE_BRACKET:sfe,CHAR_RIGHT_SQUARE_BRACKET:afe,CHAR_DOUBLE_QUOTE:d6e,CHAR_SINGLE_QUOTE:f6e,CHAR_NO_BREAK_SPACE:p6e,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h6e}=ife(),m6e=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(ofe,r.maxLength):ofe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},o=[i],s=i,a=i,c=0,l=t.length,u=0,d=0,f,p=()=>t[u++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return s.nodes.push(m),m.parent=s,m.prev=a,a=m,m};for(h({type:"bos"});u<l;)if(s=o[o.length-1],f=p(),!(f===h6e||f===p6e)){if(f===yG){h({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===afe){h({type:"text",value:"\\"+f});continue}if(f===sfe){c++;let m;for(;u<l&&(m=p());){if(f+=m,m===sfe){c++;continue}if(m===yG){f+=p();continue}if(m===afe&&(c--,c===0))break}h({type:"text",value:f});continue}if(f===a6e){s=h({type:"paren",nodes:[]}),o.push(s),h({type:"text",value:f});continue}if(f===c6e){if(s.type!=="paren"){h({type:"text",value:f});continue}s=o.pop(),h({type:"text",value:f}),s=o[o.length-1];continue}if(f===d6e||f===f6e||f===i6e){let m=f,y;for(e.keepQuotes!==!0&&(f="");u<l&&(y=p());){if(y===yG){f+=y+p();continue}if(y===m){e.keepQuotes===!0&&(f+=y);break}f+=y}h({type:"text",value:f});continue}if(f===l6e){d++;let y={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};s=h(y),o.push(s),h({type:"open",value:f});continue}if(f===u6e){if(s.type!=="brace"){h({type:"text",value:f});continue}let m="close";s=o.pop(),s.close=!0,h({type:m,value:f}),d--,s=o[o.length-1];continue}if(f===o6e&&d>0){if(s.ranges>0){s.ranges=0;let m=s.nodes.shift();s.nodes=[m,{type:"text",value:n6e(s)}]}h({type:"comma",value:f}),s.commas++;continue}if(f===s6e&&d>0&&s.commas===0){let m=s.nodes;if(d===0||m.length===0){h({type:"text",value:f});continue}if(a.type==="dot"){if(s.range=[],a.value+=f,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){m.pop();let y=m[m.length-1];y.value+=a.value+f,a=y,s.ranges--;continue}h({type:"dot",value:f});continue}h({type:"text",value:f})}do if(s=o.pop(),s.type!=="root"){s.nodes.forEach(S=>{S.nodes||(S.type==="open"&&(S.isOpen=!0),S.type==="close"&&(S.isClose=!0),S.nodes||(S.type="text"),S.invalid=!0)});let m=o[o.length-1],y=m.nodes.indexOf(s);m.nodes.splice(y,1,...s.nodes)}while(o.length>0);return h({type:"eos"}),i};cfe.exports=m6e});var ffe=v((Qzt,dfe)=>{"use strict";var ufe=uI(),g6e=Qde(),_6e=rfe(),y6e=lfe(),On=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=On.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(On.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};On.parse=(t,e={})=>y6e(t,e);On.stringify=(t,e={})=>ufe(typeof t=="string"?On.parse(t,e):t,e);On.compile=(t,e={})=>(typeof t=="string"&&(t=On.parse(t,e)),g6e(t,e));On.expand=(t,e={})=>{typeof t=="string"&&(t=On.parse(t,e));let r=_6e(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};On.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?On.compile(t,e):On.expand(t,e);dfe.exports=On});var PS=v((eGt,_fe)=>{"use strict";var S6e=Z("path"),Lo="\\\\/",pfe=`[^${Lo}]`,E6e=0,Ys="\\.",v6e="\\+",T6e="\\?",pI="\\/",b6e="(?=.)",hfe="[^/]",SG=`(?:${pI}|$)`,mfe=`(?:^|${pI})`,EG=`${Ys}{1,2}${SG}`,A6e=`(?!${Ys})`,w6e=`(?!${mfe}${EG})`,x6e=`(?!${Ys}{0,1}${SG})`,R6e=`(?!${EG})`,C6e=`[^.${pI}]`,I6e=`${hfe}*?`,gfe={DOT_LITERAL:Ys,PLUS_LITERAL:v6e,QMARK_LITERAL:T6e,SLASH_LITERAL:pI,ONE_CHAR:b6e,QMARK:hfe,END_ANCHOR:SG,DOTS_SLASH:EG,NO_DOT:A6e,NO_DOTS:w6e,NO_DOT_SLASH:x6e,NO_DOTS_SLASH:R6e,QMARK_NO_DOT:C6e,STAR:I6e,START_ANCHOR:mfe},P6e={...gfe,SLASH_LITERAL:`[${Lo}]`,QMARK:pfe,STAR:`${pfe}*?`,DOTS_SLASH:`${Ys}{1,2}(?:[${Lo}]|$)`,NO_DOT:`(?!${Ys})`,NO_DOTS:`(?!(?:^|[${Lo}])${Ys}{1,2}(?:[${Lo}]|$))`,NO_DOT_SLASH:`(?!${Ys}{0,1}(?:[${Lo}]|$))`,NO_DOTS_SLASH:`(?!${Ys}{1,2}(?:[${Lo}]|$))`,QMARK_NO_DOT:`[^.${Lo}]`,START_ANCHOR:`(?:^|[${Lo}])`,END_ANCHOR:`(?:[${Lo}]|$)`},O6e={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_fe.exports={DEFAULT_MAX_EXTGLOB_RECURSION:E6e,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:O6e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:S6e.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?P6e:gfe}}});var OS=v(ln=>{"use strict";var N6e=Z("path"),k6e=process.platform==="win32",{REGEX_BACKSLASH:M6e,REGEX_REMOVE_BACKSLASH:D6e,REGEX_SPECIAL_CHARS:L6e,REGEX_SPECIAL_CHARS_GLOBAL:$6e}=PS();ln.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ln.hasRegexChars=t=>L6e.test(t);ln.isRegexChar=t=>t.length===1&&ln.hasRegexChars(t);ln.escapeRegex=t=>t.replace($6e,"\\$1");ln.toPosixSlashes=t=>t.replace(M6e,"/");ln.removeBackslashes=t=>t.replace(D6e,e=>e==="\\"?"":e);ln.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};ln.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:k6e===!0||N6e.sep==="\\";ln.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?ln.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};ln.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};ln.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var wfe=v((rGt,Afe)=>{"use strict";var yfe=OS(),{CHAR_ASTERISK:vG,CHAR_AT:U6e,CHAR_BACKWARD_SLASH:NS,CHAR_COMMA:F6e,CHAR_DOT:TG,CHAR_EXCLAMATION_MARK:bG,CHAR_FORWARD_SLASH:bfe,CHAR_LEFT_CURLY_BRACE:AG,CHAR_LEFT_PARENTHESES:wG,CHAR_LEFT_SQUARE_BRACKET:B6e,CHAR_PLUS:j6e,CHAR_QUESTION_MARK:Sfe,CHAR_RIGHT_CURLY_BRACE:z6e,CHAR_RIGHT_PARENTHESES:Efe,CHAR_RIGHT_SQUARE_BRACKET:G6e}=PS(),vfe=t=>t===bfe||t===NS,Tfe=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},q6e=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,h=!1,m=!1,y=!1,S=!1,b=!1,w=!1,T=!1,C=!1,O=0,k,P,M={value:"",depth:0,isGlob:!1},F=()=>l>=n,_=()=>c.charCodeAt(l+1),re=()=>(k=P,c.charCodeAt(++l));for(;l<n;){P=re();let Y;if(P===NS){b=M.backslashes=!0,P=re(),P===AG&&(S=!0);continue}if(S===!0||P===AG){for(O++;F()!==!0&&(P=re());){if(P===NS){b=M.backslashes=!0,re();continue}if(P===AG){O++;continue}if(S!==!0&&P===TG&&(P=re())===TG){if(f=M.isBrace=!0,h=M.isGlob=!0,C=!0,i===!0)continue;break}if(S!==!0&&P===F6e){if(f=M.isBrace=!0,h=M.isGlob=!0,C=!0,i===!0)continue;break}if(P===z6e&&(O--,O===0)){S=!1,f=M.isBrace=!0,C=!0;break}}if(i===!0)continue;break}if(P===bfe){if(o.push(l),s.push(M),M={value:"",depth:0,isGlob:!1},C===!0)continue;if(k===TG&&l===u+1){u+=2;continue}d=l+1;continue}if(r.noext!==!0&&(P===j6e||P===U6e||P===vG||P===Sfe||P===bG)===!0&&_()===wG){if(h=M.isGlob=!0,m=M.isExtglob=!0,C=!0,P===bG&&l===u&&(T=!0),i===!0){for(;F()!==!0&&(P=re());){if(P===NS){b=M.backslashes=!0,P=re();continue}if(P===Efe){h=M.isGlob=!0,C=!0;break}}continue}break}if(P===vG){if(k===vG&&(y=M.isGlobstar=!0),h=M.isGlob=!0,C=!0,i===!0)continue;break}if(P===Sfe){if(h=M.isGlob=!0,C=!0,i===!0)continue;break}if(P===B6e){for(;F()!==!0&&(Y=re());){if(Y===NS){b=M.backslashes=!0,re();continue}if(Y===G6e){p=M.isBracket=!0,h=M.isGlob=!0,C=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&P===bG&&l===u){w=M.negated=!0,u++;continue}if(r.noparen!==!0&&P===wG){if(h=M.isGlob=!0,i===!0){for(;F()!==!0&&(P=re());){if(P===wG){b=M.backslashes=!0,P=re();continue}if(P===Efe){C=!0;break}}continue}break}if(h===!0){if(C=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let N=c,g="",E="";u>0&&(g=c.slice(0,u),c=c.slice(u),d-=u),N&&h===!0&&d>0?(N=c.slice(0,d),E=c.slice(d)):h===!0?(N="",E=c):N=c,N&&N!==""&&N!=="/"&&N!==c&&vfe(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),r.unescape===!0&&(E&&(E=yfe.removeBackslashes(E)),N&&b===!0&&(N=yfe.removeBackslashes(N)));let x={prefix:g,input:t,start:u,base:N,glob:E,isBrace:f,isBracket:p,isGlob:h,isExtglob:m,isGlobstar:y,negated:w,negatedExtglob:T};if(r.tokens===!0&&(x.maxDepth=0,vfe(P)||s.push(M),x.tokens=s),r.parts===!0||r.tokens===!0){let Y;for(let q=0;q<o.length;q++){let fe=Y?Y+1:u,$e=o[q],Ie=t.slice(fe,$e);r.tokens&&(q===0&&u!==0?(s[q].isPrefix=!0,s[q].value=g):s[q].value=Ie,Tfe(s[q]),x.maxDepth+=s[q].depth),(q!==0||Ie!=="")&&a.push(Ie),Y=$e}if(Y&&Y+1<t.length){let q=t.slice(Y+1);a.push(q),r.tokens&&(s[s.length-1].value=q,Tfe(s[s.length-1]),x.maxDepth+=s[s.length-1].depth)}x.slashes=o,x.parts=a}return x};Afe.exports=q6e});var Pfe=v((nGt,Ife)=>{"use strict";var kS=PS(),Cr=OS(),{MAX_LENGTH:hI,POSIX_REGEX_SOURCE:V6e,REGEX_NON_SPECIAL_CHARS:H6e,REGEX_SPECIAL_CHARS_BACKREF:W6e,REPLACEMENTS:xfe}=kS,Y6e=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Cr.escapeRegex(i)).join("..")}return r},Gh=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Rfe=t=>{let e=[],r=0,n=0,i=0,o="",s=!1;for(let a of t){if(s===!0){o+=a,s=!1;continue}if(a==="\\"){o+=a,s=!0;continue}if(a==='"'){i=i===1?0:1,o+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(o),o="";continue}}}o+=a}return e.push(o),e},K6e=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},Cfe=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(K6e(e))return e.replace(/\\(.)/g,"$1")},Z6e=t=>{let e=t.map(Cfe).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],o=e[n],s=i[0];if(!(!s||i!==s.repeat(i.length)||o!==s.repeat(o.length))&&(i===o||i.startsWith(o)||o.startsWith(i)))return!0}return!1},xG=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,o=!1;for(let s=1;s<t.length;s++){let a=t[s];if(o===!0){o=!1;continue}if(a==="\\"){o=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},J6e=t=>{let e=0,r=[];for(;e<t.length;){let i=xG(t.slice(e),!1);if(!i||i.type!=="*")return;let o=Rfe(i.body).map(a=>a.trim());if(o.length!==1)return;let s=Cfe(o[0]);if(!s||s.length!==1)return;r.push(s),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Cr.escapeRegex(r[0]):`[${r.map(i=>Cr.escapeRegex(i)).join("")}]`}*`},X6e=t=>{let e=0,r=t.trim(),n=xG(r);for(;n;)e++,r=n.body.trim(),n=xG(r);return e},Q6e=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:kS.DEFAULT_MAX_EXTGLOB_RECURSION,n=Rfe(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||Z6e(n)))return{risky:!0};for(let i of n){let o=J6e(i);if(o)return{risky:!0,safeOutput:o};if(X6e(i)>r)return{risky:!0}}return{risky:!1}},RG=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=xfe[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(hI,r.maxLength):hI,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",c=Cr.isWindows(e),l=kS.globChars(c),u=kS.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:y,NO_DOT_SLASH:S,NO_DOTS_SLASH:b,QMARK:w,QMARK_NO_DOT:T,STAR:C,START_ANCHOR:O}=l,k=H=>`(${a}(?:(?!${O}${H.dot?m:d}).)*?)`,P=r.dot?"":y,M=r.dot?w:T,F=r.bash===!0?k(r):C;r.capture&&(F=`(${F})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=Cr.removePrefix(t,_),i=t.length;let re=[],N=[],g=[],E=o,x,Y=()=>_.index===i-1,q=_.peek=(H=1)=>t[_.index+H],fe=_.advance=()=>t[++_.index]||"",$e=()=>t.slice(_.index+1),Ie=(H="",le=0)=>{_.consumed+=H,_.index+=le},Pe=H=>{_.output+=H.output!=null?H.output:H.value,Ie(H.value)},xe=()=>{let H=1;for(;q()==="!"&&(q(2)!=="("||q(3)==="?");)fe(),_.start++,H++;return H%2===0?!1:(_.negated=!0,_.start++,!0)},Fe=H=>{_[H]++,g.push(H)},Re=H=>{_[H]--,g.pop()},ce=H=>{if(E.type==="globstar"){let le=_.braces>0&&(H.type==="comma"||H.type==="brace"),R=H.extglob===!0||re.length&&(H.type==="pipe"||H.type==="paren");H.type!=="slash"&&H.type!=="paren"&&!le&&!R&&(_.output=_.output.slice(0,-E.output.length),E.type="star",E.value="*",E.output=F,_.output+=E.output)}if(re.length&&H.type!=="paren"&&(re[re.length-1].inner+=H.value),(H.value||H.output)&&Pe(H),E&&E.type==="text"&&H.type==="text"){E.value+=H.value,E.output=(E.output||"")+H.value;return}H.prev=E,s.push(H),E=H},_e=(H,le)=>{let R={...u[le],conditions:1,inner:""};R.prev=E,R.parens=_.parens,R.output=_.output,R.startIndex=_.index,R.tokensIndex=s.length;let I=(r.capture?"(":"")+R.open;Fe("parens"),ce({type:H,value:le,output:_.output?"":h}),ce({type:"paren",extglob:!0,value:fe(),output:I}),re.push(R)},qe=H=>{let le=t.slice(H.startIndex,_.index+1),R=t.slice(H.startIndex+2,_.index),I=Q6e(R,r);if((H.type==="plus"||H.type==="star")&&I.risky){let G=I.safeOutput?(H.output?"":h)+(r.capture?`(${I.safeOutput})`:I.safeOutput):void 0,ee=s[H.tokensIndex];ee.type="text",ee.value=le,ee.output=G||Cr.escapeRegex(le);for(let se=H.tokensIndex+1;se<s.length;se++)s[se].value="",s[se].output="",delete s[se].suffix;_.output=H.output+ee.output,_.backtrack=!0,ce({type:"paren",extglob:!0,value:x,output:""}),Re("parens");return}let U=H.close+(r.capture?")":""),j;if(H.type==="negate"){let G=F;if(H.inner&&H.inner.length>1&&H.inner.includes("/")&&(G=k(r)),(G!==F||Y()||/^\)+$/.test($e()))&&(U=H.close=`)$))${G}`),H.inner.includes("*")&&(j=$e())&&/^\.[^\\/.]+$/.test(j)){let ee=RG(j,{...e,fastpaths:!1}).output;U=H.close=`)${ee})${G})`}H.prev.type==="bos"&&(_.negatedExtglob=!0)}ce({type:"paren",extglob:!0,value:x,output:U}),Re("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let H=!1,le=t.replace(W6e,(R,I,U,j,G,ee)=>j==="\\"?(H=!0,R):j==="?"?I?I+j+(G?w.repeat(G.length):""):ee===0?M+(G?w.repeat(G.length):""):w.repeat(U.length):j==="."?d.repeat(U.length):j==="*"?I?I+j+(G?F:""):F:I?R:`\\${R}`);return H===!0&&(r.unescape===!0?le=le.replace(/\\/g,""):le=le.replace(/\\+/g,R=>R.length%2===0?"\\\\":R?"\\":"")),le===t&&r.contains===!0?(_.output=t,_):(_.output=Cr.wrapOutput(le,_,e),_)}for(;!Y();){if(x=fe(),x==="\0")continue;if(x==="\\"){let R=q();if(R==="/"&&r.bash!==!0||R==="."||R===";")continue;if(!R){x+="\\",ce({type:"text",value:x});continue}let I=/^\\+/.exec($e()),U=0;if(I&&I[0].length>2&&(U=I[0].length,_.index+=U,U%2!==0&&(x+="\\")),r.unescape===!0?x=fe():x+=fe(),_.brackets===0){ce({type:"text",value:x});continue}}if(_.brackets>0&&(x!=="]"||E.value==="["||E.value==="[^")){if(r.posix!==!1&&x===":"){let R=E.value.slice(1);if(R.includes("[")&&(E.posix=!0,R.includes(":"))){let I=E.value.lastIndexOf("["),U=E.value.slice(0,I),j=E.value.slice(I+2),G=V6e[j];if(G){E.value=U+G,_.backtrack=!0,fe(),!o.output&&s.indexOf(E)===1&&(o.output=h);continue}}}(x==="["&&q()!==":"||x==="-"&&q()==="]")&&(x=`\\${x}`),x==="]"&&(E.value==="["||E.value==="[^")&&(x=`\\${x}`),r.posix===!0&&x==="!"&&E.value==="["&&(x="^"),E.value+=x,Pe({value:x});continue}if(_.quotes===1&&x!=='"'){x=Cr.escapeRegex(x),E.value+=x,Pe({value:x});continue}if(x==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&ce({type:"text",value:x});continue}if(x==="("){Fe("parens"),ce({type:"paren",value:x});continue}if(x===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Gh("opening","("));let R=re[re.length-1];if(R&&_.parens===R.parens+1){qe(re.pop());continue}ce({type:"paren",value:x,output:_.parens?")":"\\)"}),Re("parens");continue}if(x==="["){if(r.nobracket===!0||!$e().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Gh("closing","]"));x=`\\${x}`}else Fe("brackets");ce({type:"bracket",value:x});continue}if(x==="]"){if(r.nobracket===!0||E&&E.type==="bracket"&&E.value.length===1){ce({type:"text",value:x,output:`\\${x}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Gh("opening","["));ce({type:"text",value:x,output:`\\${x}`});continue}Re("brackets");let R=E.value.slice(1);if(E.posix!==!0&&R[0]==="^"&&!R.includes("/")&&(x=`/${x}`),E.value+=x,Pe({value:x}),r.literalBrackets===!1||Cr.hasRegexChars(R))continue;let I=Cr.escapeRegex(E.value);if(_.output=_.output.slice(0,-E.value.length),r.literalBrackets===!0){_.output+=I,E.value=I;continue}E.value=`(${a}${I}|${E.value})`,_.output+=E.value;continue}if(x==="{"&&r.nobrace!==!0){Fe("braces");let R={type:"brace",value:x,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};N.push(R),ce(R);continue}if(x==="}"){let R=N[N.length-1];if(r.nobrace===!0||!R){ce({type:"text",value:x,output:x});continue}let I=")";if(R.dots===!0){let U=s.slice(),j=[];for(let G=U.length-1;G>=0&&(s.pop(),U[G].type!=="brace");G--)U[G].type!=="dots"&&j.unshift(U[G].value);I=Y6e(j,r),_.backtrack=!0}if(R.comma!==!0&&R.dots!==!0){let U=_.output.slice(0,R.outputIndex),j=_.tokens.slice(R.tokensIndex);R.value=R.output="\\{",x=I="\\}",_.output=U;for(let G of j)_.output+=G.output||G.value}ce({type:"brace",value:x,output:I}),Re("braces"),N.pop();continue}if(x==="|"){re.length>0&&re[re.length-1].conditions++,ce({type:"text",value:x});continue}if(x===","){let R=x,I=N[N.length-1];I&&g[g.length-1]==="braces"&&(I.comma=!0,R="|"),ce({type:"comma",value:x,output:R});continue}if(x==="/"){if(E.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),E=o;continue}ce({type:"slash",value:x,output:p});continue}if(x==="."){if(_.braces>0&&E.type==="dot"){E.value==="."&&(E.output=d);let R=N[N.length-1];E.type="dots",E.output+=x,E.value+=x,R.dots=!0;continue}if(_.braces+_.parens===0&&E.type!=="bos"&&E.type!=="slash"){ce({type:"text",value:x,output:d});continue}ce({type:"dot",value:x,output:d});continue}if(x==="?"){if(!(E&&E.value==="(")&&r.noextglob!==!0&&q()==="("&&q(2)!=="?"){_e("qmark",x);continue}if(E&&E.type==="paren"){let I=q(),U=x;if(I==="<"&&!Cr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(E.value==="("&&!/[!=<:]/.test(I)||I==="<"&&!/<([!=]|\w+>)/.test($e()))&&(U=`\\${x}`),ce({type:"text",value:x,output:U});continue}if(r.dot!==!0&&(E.type==="slash"||E.type==="bos")){ce({type:"qmark",value:x,output:T});continue}ce({type:"qmark",value:x,output:w});continue}if(x==="!"){if(r.noextglob!==!0&&q()==="("&&(q(2)!=="?"||!/[!=<:]/.test(q(3)))){_e("negate",x);continue}if(r.nonegate!==!0&&_.index===0){xe();continue}}if(x==="+"){if(r.noextglob!==!0&&q()==="("&&q(2)!=="?"){_e("plus",x);continue}if(E&&E.value==="("||r.regex===!1){ce({type:"plus",value:x,output:f});continue}if(E&&(E.type==="bracket"||E.type==="paren"||E.type==="brace")||_.parens>0){ce({type:"plus",value:x});continue}ce({type:"plus",value:f});continue}if(x==="@"){if(r.noextglob!==!0&&q()==="("&&q(2)!=="?"){ce({type:"at",extglob:!0,value:x,output:""});continue}ce({type:"text",value:x});continue}if(x!=="*"){(x==="$"||x==="^")&&(x=`\\${x}`);let R=H6e.exec($e());R&&(x+=R[0],_.index+=R[0].length),ce({type:"text",value:x});continue}if(E&&(E.type==="globstar"||E.star===!0)){E.type="star",E.star=!0,E.value+=x,E.output=F,_.backtrack=!0,_.globstar=!0,Ie(x);continue}let H=$e();if(r.noextglob!==!0&&/^\([^?]/.test(H)){_e("star",x);continue}if(E.type==="star"){if(r.noglobstar===!0){Ie(x);continue}let R=E.prev,I=R.prev,U=R.type==="slash"||R.type==="bos",j=I&&(I.type==="star"||I.type==="globstar");if(r.bash===!0&&(!U||H[0]&&H[0]!=="/")){ce({type:"star",value:x,output:""});continue}let G=_.braces>0&&(R.type==="comma"||R.type==="brace"),ee=re.length&&(R.type==="pipe"||R.type==="paren");if(!U&&R.type!=="paren"&&!G&&!ee){ce({type:"star",value:x,output:""});continue}for(;H.slice(0,3)==="/**";){let se=t[_.index+4];if(se&&se!=="/")break;H=H.slice(3),Ie("/**",3)}if(R.type==="bos"&&Y()){E.type="globstar",E.value+=x,E.output=k(r),_.output=E.output,_.globstar=!0,Ie(x);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&!j&&Y()){_.output=_.output.slice(0,-(R.output+E.output).length),R.output=`(?:${R.output}`,E.type="globstar",E.output=k(r)+(r.strictSlashes?")":"|$)"),E.value+=x,_.globstar=!0,_.output+=R.output+E.output,Ie(x);continue}if(R.type==="slash"&&R.prev.type!=="bos"&&H[0]==="/"){let se=H[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(R.output+E.output).length),R.output=`(?:${R.output}`,E.type="globstar",E.output=`${k(r)}${p}|${p}${se})`,E.value+=x,_.output+=R.output+E.output,_.globstar=!0,Ie(x+fe()),ce({type:"slash",value:"/",output:""});continue}if(R.type==="bos"&&H[0]==="/"){E.type="globstar",E.value+=x,E.output=`(?:^|${p}|${k(r)}${p})`,_.output=E.output,_.globstar=!0,Ie(x+fe()),ce({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-E.output.length),E.type="globstar",E.output=k(r),E.value+=x,_.output+=E.output,_.globstar=!0,Ie(x);continue}let le={type:"star",value:x,output:F};if(r.bash===!0){le.output=".*?",(E.type==="bos"||E.type==="slash")&&(le.output=P+le.output),ce(le);continue}if(E&&(E.type==="bracket"||E.type==="paren")&&r.regex===!0){le.output=x,ce(le);continue}(_.index===_.start||E.type==="slash"||E.type==="dot")&&(E.type==="dot"?(_.output+=S,E.output+=S):r.dot===!0?(_.output+=b,E.output+=b):(_.output+=P,E.output+=P),q()!=="*"&&(_.output+=h,E.output+=h)),ce(le)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Gh("closing","]"));_.output=Cr.escapeLast(_.output,"["),Re("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Gh("closing",")"));_.output=Cr.escapeLast(_.output,"("),Re("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Gh("closing","}"));_.output=Cr.escapeLast(_.output,"{"),Re("braces")}if(r.strictSlashes!==!0&&(E.type==="star"||E.type==="bracket")&&ce({type:"maybe_slash",value:"",output:`${p}?`}),_.backtrack===!0){_.output="";for(let H of _.tokens)_.output+=H.output!=null?H.output:H.value,H.suffix&&(_.output+=H.suffix)}return _};RG.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(hI,r.maxLength):hI,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=xfe[t]||t;let o=Cr.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:h}=kS.globChars(o),m=r.dot?d:u,y=r.dot?f:u,S=r.capture?"":"?:",b={negated:!1,prefix:""},w=r.bash===!0?".*?":p;r.capture&&(w=`(${w})`);let T=P=>P.noglobstar===!0?w:`(${S}(?:(?!${h}${P.dot?l:s}).)*?)`,C=P=>{switch(P){case"*":return`${m}${c}${w}`;case".*":return`${s}${c}${w}`;case"*.*":return`${m}${w}${s}${c}${w}`;case"*/*":return`${m}${w}${a}${c}${y}${w}`;case"**":return m+T(r);case"**/*":return`(?:${m}${T(r)}${a})?${y}${c}${w}`;case"**/*.*":return`(?:${m}${T(r)}${a})?${y}${w}${s}${c}${w}`;case"**/.*":return`(?:${m}${T(r)}${a})?${s}${c}${w}`;default:{let M=/^(.*?)\.(\w+)$/.exec(P);if(!M)return;let F=C(M[1]);return F?F+s+M[2]:void 0}}},O=Cr.removePrefix(t,b),k=C(O);return k&&r.strictSlashes!==!0&&(k+=`${a}?`),k};Ife.exports=RG});var Nfe=v((iGt,Ofe)=>{"use strict";var eWe=Z("path"),tWe=wfe(),CG=Pfe(),IG=OS(),rWe=PS(),nWe=t=>t&&typeof t=="object"&&!Array.isArray(t),Lt=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>Lt(f,e,r));return f=>{for(let p of u){let h=p(f);if(h)return h}return!1}}let n=nWe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=IG.isWindows(e),s=n?Lt.compileRe(t,e):Lt.makeRe(t,e,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Lt(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:h}=Lt.test(u,s,e,{glob:t,posix:o}),m={glob:t,state:a,regex:s,posix:o,input:u,output:h,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};Lt.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?IG.toPosixSlashes:null),a=t===n,c=a&&s?s(t):t;return a===!1&&(c=s?s(t):t,a=c===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=Lt.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Lt.matchBase=(t,e,r,n=IG.isWindows(r))=>(e instanceof RegExp?e:Lt.makeRe(e,r)).test(eWe.basename(t));Lt.isMatch=(t,e,r)=>Lt(e,r)(t);Lt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Lt.parse(r,e)):CG(t,{...e,fastpaths:!1});Lt.scan=(t,e)=>tWe(t,e);Lt.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Lt.toRegex(a,e);return n===!0&&(c.state=t),c};Lt.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=CG.fastpaths(t,e)),i.output||(i=CG(t,e)),Lt.compileRe(i,e,r,n)};Lt.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Lt.constants=rWe;Ofe.exports=Lt});var Mfe=v((oGt,kfe)=>{"use strict";kfe.exports=Nfe()});var OG=v((sGt,Ffe)=>{"use strict";var Lfe=Z("util"),$fe=ffe(),$o=Mfe(),PG=OS(),Dfe=t=>t===""||t==="./",Ufe=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Et=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,o=new Set,s=0,a=u=>{o.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let d=$o(String(e[u]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&s++;for(let p of t){let h=d(p,!0);(f?!h.isMatch:h.isMatch)&&(f?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let l=(s===e.length?[...o]:[...i]).filter(u=>!n.has(u));if(r&&l.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return l};Et.match=Et;Et.matcher=(t,e)=>$o(t,e);Et.isMatch=(t,e,r)=>$o(e,r)(t);Et.any=Et.isMatch;Et.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],o=a=>{r.onResult&&r.onResult(a),i.push(a.output)},s=new Set(Et(t,e,{...r,onResult:o}));for(let a of i)s.has(a)||n.add(a);return[...n]};Et.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Et.contains(t,n,r));if(typeof e=="string"){if(Dfe(t)||Dfe(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Et.isMatch(t,e,{...r,contains:!0})};Et.matchKeys=(t,e,r)=>{if(!PG.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Et(Object.keys(t),e,r),i={};for(let o of n)i[o]=t[o];return i};Et.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(n.some(s=>o(s)))return!0}return!1};Et.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=$o(String(i),r);if(!n.every(s=>o(s)))return!1}return!0};Et.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Lfe.inspect(t)}"`);return[].concat(e).every(n=>$o(n,r)(t))};Et.capture=(t,e,r)=>{let n=PG.isWindows(r),o=$o.makeRe(String(t),{...r,capture:!0}).exec(n?PG.toPosixSlashes(e):e);if(o)return o.slice(1).map(s=>s===void 0?"":s)};Et.makeRe=(...t)=>$o.makeRe(...t);Et.scan=(...t)=>$o.scan(...t);Et.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of $fe(String(n),e))r.push($o.parse(i,e));return r};Et.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!Ufe(t)?[t]:$fe(t,e)};Et.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Et.braces(t,{...e,expand:!0})};Et.hasBraces=Ufe;Ffe.exports=Et});var Kfe=v(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.isAbsolute=Ne.partitionAbsoluteAndRelative=Ne.removeDuplicateSlashes=Ne.matchAny=Ne.convertPatternsToRe=Ne.makeRe=Ne.getPatternParts=Ne.expandBraceExpansion=Ne.expandPatternsWithBraceExpansion=Ne.isAffectDepthOfReadingPattern=Ne.endsWithSlashGlobStar=Ne.hasGlobStar=Ne.getBaseDirectory=Ne.isPatternRelatedToParentDirectory=Ne.getPatternsOutsideCurrentDirectory=Ne.getPatternsInsideCurrentDirectory=Ne.getPositivePatterns=Ne.getNegativePatterns=Ne.isPositivePattern=Ne.isNegativePattern=Ne.convertToNegativePattern=Ne.convertToPositivePattern=Ne.isDynamicPattern=Ne.isStaticPattern=void 0;var Bfe=Z("path"),iWe=Pde(),NG=OG(),jfe="**",oWe="\\",sWe=/[*?]|^!/,aWe=/\[[^[]*]/,cWe=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,lWe=/[!*+?@]\([^(]*\)/,uWe=/,|\.\./,dWe=/(?!^)\/{2,}/g;function zfe(t,e={}){return!Gfe(t,e)}Ne.isStaticPattern=zfe;function Gfe(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(oWe)||sWe.test(t)||aWe.test(t)||cWe.test(t)||e.extglob!==!1&&lWe.test(t)||e.braceExpansion!==!1&&fWe(t))}Ne.isDynamicPattern=Gfe;function fWe(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return uWe.test(n)}function pWe(t){return mI(t)?t.slice(1):t}Ne.convertToPositivePattern=pWe;function hWe(t){return"!"+t}Ne.convertToNegativePattern=hWe;function mI(t){return t.startsWith("!")&&t[1]!=="("}Ne.isNegativePattern=mI;function qfe(t){return!mI(t)}Ne.isPositivePattern=qfe;function mWe(t){return t.filter(mI)}Ne.getNegativePatterns=mWe;function gWe(t){return t.filter(qfe)}Ne.getPositivePatterns=gWe;function _We(t){return t.filter(e=>!kG(e))}Ne.getPatternsInsideCurrentDirectory=_We;function yWe(t){return t.filter(kG)}Ne.getPatternsOutsideCurrentDirectory=yWe;function kG(t){return t.startsWith("..")||t.startsWith("./..")}Ne.isPatternRelatedToParentDirectory=kG;function SWe(t){return iWe(t,{flipBackslashes:!1})}Ne.getBaseDirectory=SWe;function EWe(t){return t.includes(jfe)}Ne.hasGlobStar=EWe;function Vfe(t){return t.endsWith("/"+jfe)}Ne.endsWithSlashGlobStar=Vfe;function vWe(t){let e=Bfe.basename(t);return Vfe(t)||zfe(e)}Ne.isAffectDepthOfReadingPattern=vWe;function TWe(t){return t.reduce((e,r)=>e.concat(Hfe(r)),[])}Ne.expandPatternsWithBraceExpansion=TWe;function Hfe(t){let e=NG.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}Ne.expandBraceExpansion=Hfe;function bWe(t,e){let{parts:r}=NG.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}Ne.getPatternParts=bWe;function Wfe(t,e){return NG.makeRe(t,e)}Ne.makeRe=Wfe;function AWe(t,e){return t.map(r=>Wfe(r,e))}Ne.convertPatternsToRe=AWe;function wWe(t,e){return e.some(r=>r.test(t))}Ne.matchAny=wWe;function xWe(t){return t.replace(dWe,"/")}Ne.removeDuplicateSlashes=xWe;function RWe(t){let e=[],r=[];for(let n of t)Yfe(n)?e.push(n):r.push(n);return[e,r]}Ne.partitionAbsoluteAndRelative=RWe;function Yfe(t){return Bfe.isAbsolute(t)}Ne.isAbsolute=Yfe});var Qfe=v((cGt,Xfe)=>{"use strict";var CWe=Z("stream"),Zfe=CWe.PassThrough,IWe=Array.prototype.slice;Xfe.exports=PWe;function PWe(){let t=[],e=IWe.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,o=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let s=Zfe(n);function a(){for(let u=0,d=arguments.length;u<d;u++)t.push(Jfe(arguments[u],n));return c(),this}function c(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(l);return}Array.isArray(u)||(u=[u]);let d=u.length+1;function f(){--d>0||(r=!1,c())}function p(h){function m(){h.removeListener("merge2UnpipeEnd",m),h.removeListener("end",m),o&&h.removeListener("error",y),f()}function y(S){s.emit("error",S)}if(h._readableState.endEmitted)return f();h.on("merge2UnpipeEnd",m),h.on("end",m),o&&h.on("error",y),h.pipe(s,{end:!1}),h.resume()}for(let h=0;h<u.length;h++)p(u[h]);f()}function l(){r=!1,s.emit("queueDrain"),i&&s.end()}return s.setMaxListeners(0),s.add=a,s.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),s}function Jfe(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=Jfe(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Zfe(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var tpe=v(gI=>{"use strict";Object.defineProperty(gI,"__esModule",{value:!0});gI.merge=void 0;var OWe=Qfe();function NWe(t){let e=OWe(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>epe(t)),e.once("end",()=>epe(t)),e}gI.merge=NWe;function epe(t){t.forEach(e=>e.emit("close"))}});var rpe=v(qh=>{"use strict";Object.defineProperty(qh,"__esModule",{value:!0});qh.isEmpty=qh.isString=void 0;function kWe(t){return typeof t=="string"}qh.isString=kWe;function MWe(t){return t===""}qh.isEmpty=MWe});var Ks=v(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.string=Ir.stream=Ir.pattern=Ir.path=Ir.fs=Ir.errno=Ir.array=void 0;var DWe=_de();Ir.array=DWe;var LWe=yde();Ir.errno=LWe;var $We=Sde();Ir.fs=$We;var UWe=bde();Ir.path=UWe;var FWe=Kfe();Ir.pattern=FWe;var BWe=tpe();Ir.stream=BWe;var jWe=rpe();Ir.string=jWe});var spe=v(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.convertPatternGroupToTask=Pr.convertPatternGroupsToTasks=Pr.groupPatternsByBaseDirectory=Pr.getNegativePatternsAsPositive=Pr.getPositivePatterns=Pr.convertPatternsToTasks=Pr.generate=void 0;var Ui=Ks();function zWe(t,e){let r=npe(t,e),n=npe(e.ignore,e),i=ipe(r),o=ope(r,n),s=i.filter(u=>Ui.pattern.isStaticPattern(u,e)),a=i.filter(u=>Ui.pattern.isDynamicPattern(u,e)),c=MG(s,o,!1),l=MG(a,o,!0);return c.concat(l)}Pr.generate=zWe;function npe(t,e){let r=t;return e.braceExpansion&&(r=Ui.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Ui.pattern.removeDuplicateSlashes(n))}function MG(t,e,r){let n=[],i=Ui.pattern.getPatternsOutsideCurrentDirectory(t),o=Ui.pattern.getPatternsInsideCurrentDirectory(t),s=DG(i),a=DG(o);return n.push(...LG(s,e,r)),"."in a?n.push($G(".",o,e,r)):n.push(...LG(a,e,r)),n}Pr.convertPatternsToTasks=MG;function ipe(t){return Ui.pattern.getPositivePatterns(t)}Pr.getPositivePatterns=ipe;function ope(t,e){return Ui.pattern.getNegativePatterns(t).concat(e).map(Ui.pattern.convertToPositivePattern)}Pr.getNegativePatternsAsPositive=ope;function DG(t){let e={};return t.reduce((r,n)=>{let i=Ui.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Pr.groupPatternsByBaseDirectory=DG;function LG(t,e,r){return Object.keys(t).map(n=>$G(n,t[n],e,r))}Pr.convertPatternGroupsToTasks=LG;function $G(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Ui.pattern.convertToNegativePattern))}}Pr.convertPatternGroupToTask=$G});var cpe=v(_I=>{"use strict";Object.defineProperty(_I,"__esModule",{value:!0});_I.read=void 0;function GWe(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){ape(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){UG(r,i);return}e.fs.stat(t,(o,s)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){ape(r,o);return}UG(r,i);return}e.markSymbolicLink&&(s.isSymbolicLink=()=>!0),UG(r,s)})})}_I.read=GWe;function ape(t,e){t(e)}function UG(t,e){t(null,e)}});var lpe=v(yI=>{"use strict";Object.defineProperty(yI,"__esModule",{value:!0});yI.read=void 0;function qWe(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}yI.read=qWe});var upe=v(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});Nc.createFileSystemAdapter=Nc.FILE_SYSTEM_ADAPTER=void 0;var SI=Z("fs");Nc.FILE_SYSTEM_ADAPTER={lstat:SI.lstat,stat:SI.stat,lstatSync:SI.lstatSync,statSync:SI.statSync};function VWe(t){return t===void 0?Nc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Nc.FILE_SYSTEM_ADAPTER),t)}Nc.createFileSystemAdapter=VWe});var dpe=v(BG=>{"use strict";Object.defineProperty(BG,"__esModule",{value:!0});var HWe=upe(),FG=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=HWe.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};BG.default=FG});var Bu=v(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});kc.statSync=kc.stat=kc.Settings=void 0;var fpe=cpe(),WWe=lpe(),jG=dpe();kc.Settings=jG.default;function YWe(t,e,r){if(typeof e=="function"){fpe.read(t,zG(),e);return}fpe.read(t,zG(e),r)}kc.stat=YWe;function KWe(t,e){let r=zG(e);return WWe.read(t,r)}kc.statSync=KWe;function zG(t={}){return t instanceof jG.default?t:new jG.default(t)}});var mpe=v((yGt,hpe)=>{"use strict";var ppe;hpe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(ppe||(ppe=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var _pe=v((SGt,gpe)=>{"use strict";gpe.exports=JWe;var ZWe=mpe();function JWe(t,e){let r,n,i,o=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function s(c){function l(){e&&e(c,r),e=null}o?ZWe(l):l()}function a(c,l,u){r[c]=u,(--n===0||l)&&s(l)}n?i?i.forEach(function(c){t[c](function(l,u){a(c,l,u)})}):t.forEach(function(c,l){c(function(u,d){a(l,u,d)})}):s(null),o=!1}});var GG=v(vI=>{"use strict";Object.defineProperty(vI,"__esModule",{value:!0});vI.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var EI=process.versions.node.split(".");if(EI[0]===void 0||EI[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var ype=Number.parseInt(EI[0],10),XWe=Number.parseInt(EI[1],10),Spe=10,QWe=10,e3e=ype>Spe,t3e=ype===Spe&&XWe>=QWe;vI.IS_SUPPORT_READDIR_WITH_FILE_TYPES=e3e||t3e});var Epe=v(TI=>{"use strict";Object.defineProperty(TI,"__esModule",{value:!0});TI.createDirentFromStats=void 0;var qG=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function r3e(t,e){return new qG(t,e)}TI.createDirentFromStats=r3e});var VG=v(bI=>{"use strict";Object.defineProperty(bI,"__esModule",{value:!0});bI.fs=void 0;var n3e=Epe();bI.fs=n3e});var HG=v(AI=>{"use strict";Object.defineProperty(AI,"__esModule",{value:!0});AI.joinPathSegments=void 0;function i3e(t,e,r){return t.endsWith(r)?t+e:t+r+e}AI.joinPathSegments=i3e});var xpe=v(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});Mc.readdir=Mc.readdirWithFileTypes=Mc.read=void 0;var o3e=Bu(),vpe=_pe(),s3e=GG(),Tpe=VG(),bpe=HG();function a3e(t,e,r){if(!e.stats&&s3e.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Ape(t,e,r);return}wpe(t,e,r)}Mc.read=a3e;function Ape(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){wI(r,n);return}let o=i.map(a=>({dirent:a,name:a.name,path:bpe.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){WG(r,o);return}let s=o.map(a=>c3e(a,e));vpe(s,(a,c)=>{if(a!==null){wI(r,a);return}WG(r,c)})})}Mc.readdirWithFileTypes=Ape;function c3e(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=Tpe.fs.createDirentFromStats(t.name,i),r(null,t)})}}function wpe(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){wI(r,n);return}let o=i.map(s=>{let a=bpe.joinPathSegments(t,s,e.pathSegmentSeparator);return c=>{o3e.stat(a,e.fsStatSettings,(l,u)=>{if(l!==null){c(l);return}let d={name:s,path:a,dirent:Tpe.fs.createDirentFromStats(s,u)};e.stats&&(d.stats=u),c(null,d)})}});vpe(o,(s,a)=>{if(s!==null){wI(r,s);return}WG(r,a)})})}Mc.readdir=wpe;function wI(t,e){t(e)}function WG(t,e){t(null,e)}});var Ope=v(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.readdir=Dc.readdirWithFileTypes=Dc.read=void 0;var l3e=Bu(),u3e=GG(),Rpe=VG(),Cpe=HG();function d3e(t,e){return!e.stats&&u3e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Ipe(t,e):Ppe(t,e)}Dc.read=d3e;function Ipe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:Cpe.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let o=e.fs.statSync(i.path);i.dirent=Rpe.fs.createDirentFromStats(i.name,o)}catch(o){if(e.throwErrorOnBrokenSymbolicLink)throw o}return i})}Dc.readdirWithFileTypes=Ipe;function Ppe(t,e){return e.fs.readdirSync(t).map(n=>{let i=Cpe.joinPathSegments(t,n,e.pathSegmentSeparator),o=l3e.statSync(i,e.fsStatSettings),s={name:n,path:i,dirent:Rpe.fs.createDirentFromStats(n,o)};return e.stats&&(s.stats=o),s})}Dc.readdir=Ppe});var Npe=v(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});Lc.createFileSystemAdapter=Lc.FILE_SYSTEM_ADAPTER=void 0;var Vh=Z("fs");Lc.FILE_SYSTEM_ADAPTER={lstat:Vh.lstat,stat:Vh.stat,lstatSync:Vh.lstatSync,statSync:Vh.statSync,readdir:Vh.readdir,readdirSync:Vh.readdirSync};function f3e(t){return t===void 0?Lc.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Lc.FILE_SYSTEM_ADAPTER),t)}Lc.createFileSystemAdapter=f3e});var kpe=v(KG=>{"use strict";Object.defineProperty(KG,"__esModule",{value:!0});var p3e=Z("path"),h3e=Bu(),m3e=Npe(),YG=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=m3e.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,p3e.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new h3e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};KG.default=YG});var xI=v($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.Settings=$c.scandirSync=$c.scandir=void 0;var Mpe=xpe(),g3e=Ope(),ZG=kpe();$c.Settings=ZG.default;function _3e(t,e,r){if(typeof e=="function"){Mpe.read(t,JG(),e);return}Mpe.read(t,JG(e),r)}$c.scandir=_3e;function y3e(t,e){let r=JG(e);return g3e.read(t,r)}$c.scandirSync=y3e;function JG(t={}){return t instanceof ZG.default?t:new ZG.default(t)}});var Lpe=v((IGt,Dpe)=>{"use strict";function S3e(t){var e=new t,r=e;function n(){var o=e;return o.next?e=o.next:(e=new t,r=e),o.next=null,o}function i(o){r.next=o,r=o}return{get:n,release:i}}Dpe.exports=S3e});var Upe=v((PGt,XG)=>{"use strict";var E3e=Lpe();function $pe(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=E3e(v3e),i=null,o=null,s=0,a=null,c={push:m,drain:un,saturated:un,pause:u,paused:!1,get concurrency(){return r},set concurrency(O){if(!(O>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=O,!c.paused)for(;i&&s<r;)s++,S()},running:l,resume:p,idle:h,length:d,getQueue:f,unshift:y,empty:un,kill:b,killAndDrain:w,error:C,abort:T};return c;function l(){return s}function u(){c.paused=!0}function d(){for(var O=i,k=0;O;)O=O.next,k++;return k}function f(){for(var O=i,k=[];O;)k.push(O.value),O=O.next;return k}function p(){if(c.paused){if(c.paused=!1,i===null){s++,S();return}for(;i&&s<r;)s++,S()}}function h(){return s===0&&c.length()===0}function m(O,k){var P=n.get();P.context=t,P.release=S,P.value=O,P.callback=k||un,P.errorHandler=a,s>=r||c.paused?o?(o.next=P,o=P):(i=P,o=P,c.saturated()):(s++,e.call(t,P.value,P.worked))}function y(O,k){var P=n.get();P.context=t,P.release=S,P.value=O,P.callback=k||un,P.errorHandler=a,s>=r||c.paused?i?(P.next=i,i=P):(i=P,o=P,c.saturated()):(s++,e.call(t,P.value,P.worked))}function S(O){O&&n.release(O);var k=i;k&&s<=r?c.paused?s--:(o===i&&(o=null),i=k.next,k.next=null,e.call(t,k.value,k.worked),o===null&&c.empty()):--s===0&&c.drain()}function b(){i=null,o=null,c.drain=un}function w(){i=null,o=null,c.drain(),c.drain=un}function T(){var O=i;for(i=null,o=null;O;){var k=O.next,P=O.callback,M=O.errorHandler,F=O.value,_=O.context;O.value=null,O.callback=un,O.errorHandler=null,M&&M(new Error("abort"),F),P.call(_,new Error("abort")),O.release(O),O=k}c.drain=un}function C(O){a=O}}function un(){}function v3e(){this.value=null,this.callback=un,this.next=null,this.release=un,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,o=t.errorHandler,s=t.value;t.value=null,t.callback=un,t.errorHandler&&o(r,s),i.call(t.context,r,n),t.release(t)}}function T3e(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(u,d){e.call(this,u).then(function(f){d(null,f)},d)}var i=$pe(t,n,r),o=i.push,s=i.unshift;return i.push=a,i.unshift=c,i.drained=l,i;function a(u){var d=new Promise(function(f,p){o(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(un),d}function c(u){var d=new Promise(function(f,p){s(u,function(h,m){if(h){p(h);return}f(m)})});return d.catch(un),d}function l(){var u=new Promise(function(d){process.nextTick(function(){if(i.idle())d();else{var f=i.drain;i.drain=function(){typeof f=="function"&&f(),d(),i.drain=f}}})});return u}}XG.exports=$pe;XG.exports.promise=T3e});var RI=v(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.joinPathSegments=Uo.replacePathSegmentSeparator=Uo.isAppliedFilter=Uo.isFatalError=void 0;function b3e(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}Uo.isFatalError=b3e;function A3e(t,e){return t===null||t(e)}Uo.isAppliedFilter=A3e;function w3e(t,e){return t.split(/[/\\]/).join(e)}Uo.replacePathSegmentSeparator=w3e;function x3e(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}Uo.joinPathSegments=x3e});var t4=v(e4=>{"use strict";Object.defineProperty(e4,"__esModule",{value:!0});var R3e=RI(),QG=class{constructor(e,r){this._root=e,this._settings=r,this._root=R3e.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};e4.default=QG});var i4=v(n4=>{"use strict";Object.defineProperty(n4,"__esModule",{value:!0});var C3e=Z("events"),I3e=xI(),P3e=Upe(),CI=RI(),O3e=t4(),r4=class extends O3e.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=I3e.scandir,this._emitter=new C3e.EventEmitter,this._queue=P3e(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let o of i)this._handleEntry(o,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!CI.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=CI.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),CI.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&CI.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};n4.default=r4});var Fpe=v(s4=>{"use strict";Object.defineProperty(s4,"__esModule",{value:!0});var N3e=i4(),o4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new N3e.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{k3e(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{M3e(e,this._storage)}),this._reader.read()}};s4.default=o4;function k3e(t,e){t(e)}function M3e(t,e){t(null,e)}});var Bpe=v(c4=>{"use strict";Object.defineProperty(c4,"__esModule",{value:!0});var D3e=Z("stream"),L3e=i4(),a4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new L3e.default(this._root,this._settings),this._stream=new D3e.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};c4.default=a4});var jpe=v(u4=>{"use strict";Object.defineProperty(u4,"__esModule",{value:!0});var $3e=xI(),II=RI(),U3e=t4(),l4=class extends U3e.default{constructor(){super(...arguments),this._scandir=$3e.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(II.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=II.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),II.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&II.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};u4.default=l4});var zpe=v(f4=>{"use strict";Object.defineProperty(f4,"__esModule",{value:!0});var F3e=jpe(),d4=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new F3e.default(this._root,this._settings)}read(){return this._reader.read()}};f4.default=d4});var Gpe=v(h4=>{"use strict";Object.defineProperty(h4,"__esModule",{value:!0});var B3e=Z("path"),j3e=xI(),p4=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,B3e.sep),this.fsScandirSettings=new j3e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};h4.default=p4});var OI=v(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.Settings=Fo.walkStream=Fo.walkSync=Fo.walk=void 0;var qpe=Fpe(),z3e=Bpe(),G3e=zpe(),m4=Gpe();Fo.Settings=m4.default;function q3e(t,e,r){if(typeof e=="function"){new qpe.default(t,PI()).read(e);return}new qpe.default(t,PI(e)).read(r)}Fo.walk=q3e;function V3e(t,e){let r=PI(e);return new G3e.default(t,r).read()}Fo.walkSync=V3e;function H3e(t,e){let r=PI(e);return new z3e.default(t,r).read()}Fo.walkStream=H3e;function PI(t={}){return t instanceof m4.default?t:new m4.default(t)}});var NI=v(_4=>{"use strict";Object.defineProperty(_4,"__esModule",{value:!0});var W3e=Z("path"),Y3e=Bu(),Vpe=Ks(),g4=class{constructor(e){this._settings=e,this._fsStatSettings=new Y3e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return W3e.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Vpe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Vpe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};_4.default=g4});var E4=v(S4=>{"use strict";Object.defineProperty(S4,"__esModule",{value:!0});var K3e=Z("stream"),Z3e=Bu(),J3e=OI(),X3e=NI(),y4=class extends X3e.default{constructor(){super(...arguments),this._walkStream=J3e.walkStream,this._stat=Z3e.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new K3e.PassThrough({objectMode:!0});i._write=(o,s,a)=>this._getEntry(n[o],e[o],r).then(c=>{c!==null&&r.entryFilter(c)&&i.push(c),o===n.length-1&&i.end(),a()}).catch(a);for(let o=0;o<n.length;o++)i.write(o);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,o)=>i===null?r(o):n(i))})}};S4.default=y4});var Hpe=v(T4=>{"use strict";Object.defineProperty(T4,"__esModule",{value:!0});var Q3e=OI(),eYe=NI(),tYe=E4(),v4=class extends eYe.default{constructor(){super(...arguments),this._walkAsync=Q3e.walk,this._readerStream=new tYe.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(o,s)=>{o===null?n(s):i(o)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((o,s)=>{i.once("error",s),i.on("data",a=>n.push(a)),i.once("end",()=>o(n))})}};T4.default=v4});var Wpe=v(A4=>{"use strict";Object.defineProperty(A4,"__esModule",{value:!0});var MS=Ks(),b4=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return MS.pattern.getPatternParts(e,this._micromatchOptions).map(n=>MS.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:MS.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return MS.array.splitWhen(e,r=>r.dynamic&&MS.pattern.hasGlobStar(r.pattern))}};A4.default=b4});var Ype=v(x4=>{"use strict";Object.defineProperty(x4,"__esModule",{value:!0});var rYe=Wpe(),w4=class extends rYe.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(o=>!o.complete||o.segments.length>n);for(let o of i){let s=o.sections[0];if(!o.complete&&n>s.length||r.every((c,l)=>{let u=o.segments[l];return!!(u.dynamic&&u.patternRe.test(c)||!u.dynamic&&u.pattern===c)}))return!0}return!1}};x4.default=w4});var Kpe=v(C4=>{"use strict";Object.defineProperty(C4,"__esModule",{value:!0});var kI=Ks(),nYe=Ype(),R4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),o=this._getNegativePatternsRe(n);return s=>this._filter(e,s,i,o)}_getMatcher(e){return new nYe.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(kI.pattern.isAffectDepthOfReadingPattern);return kI.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let o=kI.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(o,n)?!1:this._isSkippedByNegativePatterns(o,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!kI.pattern.matchAny(e,r)}};C4.default=R4});var Zpe=v(P4=>{"use strict";Object.defineProperty(P4,"__esModule",{value:!0});var Uc=Ks(),I4=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=Uc.pattern.partitionAbsoluteAndRelative(r),o={positive:{all:Uc.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:Uc.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Uc.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return s=>this._filter(s,o)}_filter(e,r){let n=Uc.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=Uc.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=Uc.pattern.matchAny(e,r);return!i&&n?Uc.pattern.matchAny(e+"/",r):i}};P4.default=I4});var Jpe=v(N4=>{"use strict";Object.defineProperty(N4,"__esModule",{value:!0});var iYe=Ks(),O4=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return iYe.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};N4.default=O4});var Qpe=v(M4=>{"use strict";Object.defineProperty(M4,"__esModule",{value:!0});var Xpe=Ks(),k4=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Xpe.path.makeAbsolute(this._settings.cwd,r),r=Xpe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};M4.default=k4});var MI=v(L4=>{"use strict";Object.defineProperty(L4,"__esModule",{value:!0});var oYe=Z("path"),sYe=Kpe(),aYe=Zpe(),cYe=Jpe(),lYe=Qpe(),D4=class{constructor(e){this._settings=e,this.errorFilter=new cYe.default(this._settings),this.entryFilter=new aYe.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new sYe.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new lYe.default(this._settings)}_getRootDirectory(e){return oYe.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};L4.default=D4});var ehe=v(U4=>{"use strict";Object.defineProperty(U4,"__esModule",{value:!0});var uYe=Hpe(),dYe=MI(),$4=class extends dYe.default{constructor(){super(...arguments),this._reader=new uYe.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(o=>n.transform(o))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};U4.default=$4});var the=v(B4=>{"use strict";Object.defineProperty(B4,"__esModule",{value:!0});var fYe=Z("stream"),pYe=E4(),hYe=MI(),F4=class extends hYe.default{constructor(){super(...arguments),this._reader=new pYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),o=new fYe.Readable({objectMode:!0,read:()=>{}});return i.once("error",s=>o.emit("error",s)).on("data",s=>o.emit("data",n.transform(s))).once("end",()=>o.emit("end")),o.once("close",()=>i.destroy()),o}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};B4.default=F4});var rhe=v(z4=>{"use strict";Object.defineProperty(z4,"__esModule",{value:!0});var mYe=Bu(),gYe=OI(),_Ye=NI(),j4=class extends _Ye.default{constructor(){super(...arguments),this._walkSync=gYe.walkSync,this._statSync=mYe.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let o=this._getFullEntryPath(i),s=this._getEntry(o,i,r);s===null||!r.entryFilter(s)||n.push(s)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};z4.default=j4});var nhe=v(q4=>{"use strict";Object.defineProperty(q4,"__esModule",{value:!0});var yYe=rhe(),SYe=MI(),G4=class extends SYe.default{constructor(){super(...arguments),this._reader=new yYe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};q4.default=G4});var ihe=v(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var Hh=Z("fs"),EYe=Z("os"),vYe=Math.max(EYe.cpus().length,1);Wh.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:Hh.lstat,lstatSync:Hh.lstatSync,stat:Hh.stat,statSync:Hh.statSync,readdir:Hh.readdir,readdirSync:Hh.readdirSync};var V4=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,vYe),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},Wh.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};Wh.default=V4});var DS=v((t4t,she)=>{"use strict";var ohe=spe(),TYe=ehe(),bYe=the(),AYe=nhe(),H4=ihe(),ri=Ks();async function W4(t,e){Fi(t);let r=Y4(t,TYe.default,e),n=await Promise.all(r);return ri.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(l,u){Fi(l);let d=Y4(l,AYe.default,u);return ri.array.flatten(d)}t.sync=e;function r(l,u){Fi(l);let d=Y4(l,bYe.default,u);return ri.stream.merge(d)}t.stream=r;function n(l,u){Fi(l);let d=[].concat(l),f=new H4.default(u);return ohe.generate(d,f)}t.generateTasks=n;function i(l,u){Fi(l);let d=new H4.default(u);return ri.pattern.isDynamicPattern(l,d)}t.isDynamicPattern=i;function o(l){return Fi(l),ri.path.escape(l)}t.escapePath=o;function s(l){return Fi(l),ri.path.convertPathToPattern(l)}t.convertPathToPattern=s;let a;(function(l){function u(f){return Fi(f),ri.path.escapePosixPath(f)}l.escapePath=u;function d(f){return Fi(f),ri.path.convertPosixPathToPattern(f)}l.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(l){function u(f){return Fi(f),ri.path.escapeWindowsPath(f)}l.escapePath=u;function d(f){return Fi(f),ri.path.convertWindowsPathToPattern(f)}l.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(W4||(W4={}));function Y4(t,e,r){let n=[].concat(t),i=new H4.default(r),o=ohe.generate(n,i),s=new e(i);return o.map(s.read,s)}function Fi(t){if(![].concat(t).every(n=>ri.string.isString(n)&&!ri.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}she.exports=W4});var nq=v((l4t,$I)=>{"use strict";function dhe(t){return Array.isArray(t)?t:[t]}var RYe=void 0,X4="",lhe=" ",J4="\\",CYe=/^\s+$/,IYe=/(?:[^\\]|^)\\$/,PYe=/^\\!/,OYe=/^\\#/,NYe=/\r?\n/g,kYe=/^\.{0,2}\/|^\.{1,2}$/,MYe=/\/$/,Yh="/",fhe="node-ignore";typeof Symbol<"u"&&(fhe=Symbol.for("node-ignore"));var phe=fhe,Kh=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),DYe=/([0-z])-([0-z])/g,hhe=()=>!1,LYe=t=>t.replace(DYe,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:X4),$Ye=t=>{let{length:e}=t;return t.slice(0,e-e%2)},UYe=[[/^\uFEFF/,()=>X4],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?lhe:X4)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+lhe}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>J4],[/\\\\/g,()=>J4],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===J4?`\\[${r}${$Ye(n)}${i}`:i==="]"&&n.length%2===0?`[${LYe(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],FYe=/(^|\\\/)?\\\*$/,LS="regex",DI="checkRegex",uhe="_",BYe={[LS](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[DI](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},jYe=t=>UYe.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),LI=t=>typeof t=="string",zYe=t=>t&&LI(t)&&!CYe.test(t)&&!IYe.test(t)&&t.indexOf("#")!==0,GYe=t=>t.split(NYe).filter(Boolean),Q4=class{constructor(e,r,n,i,o,s){this.pattern=e,this.mark=r,this.negative=o,Kh(this,"body",n),Kh(this,"ignoreCase",i),Kh(this,"regexPrefix",s)}get regex(){let e=uhe+LS;return this[e]?this[e]:this._make(LS,e)}get checkRegex(){let e=uhe+DI;return this[e]?this[e]:this._make(DI,e)}_make(e,r){let n=this.regexPrefix.replace(FYe,BYe[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return Kh(this,r,i)}},qYe=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(PYe,"!").replace(OYe,"#");let o=jYe(i);return new Q4(t,e,i,r,n,o)},eq=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[phe]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(LI(e)&&(e={pattern:e}),zYe(e.pattern)){let r=qYe(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,dhe(LI(e)?GYe(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,o=!1,s;this._rules.forEach(c=>{let{negative:l}=c;o===l&&i!==o||l&&!i&&!o&&!r||!c[n].test(e)||(i=!l,o=l,s=l?RYe:c)});let a={ignored:i,unignored:o};return s&&(a.rule=s),a}},VYe=(t,e)=>{throw new e(t)},Zs=(t,e,r)=>LI(t)?t?Zs.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),mhe=t=>kYe.test(t);Zs.isNotRelative=mhe;Zs.convert=t=>t;var tq=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){Kh(this,phe,!0),this._rules=new eq(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let o=e&&Zs.convert(e);return Zs(o,e,this._strictPathCheck?VYe:hhe),this._t(o,r,n,i)}checkIgnore(e){if(!MYe.test(e))return this.test(e);let r=e.split(Yh).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(Yh)+Yh,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,DI)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(Yh).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,LS);let o=this._t(i.join(Yh)+Yh,r,n,i);return r[e]=o.ignored?o:this._rules.test(e,n,LS)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return dhe(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},rq=t=>new tq(t),HYe=t=>Zs(t&&Zs.convert(t),t,hhe),ghe=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Zs.convert=t;let e=/^[a-z]:\//i;Zs.isNotRelative=r=>e.test(r)||mhe(r)};typeof process<"u"&&process.platform==="win32"&&ghe();$I.exports=rq;rq.default=rq;$I.exports.isPathValid=HYe;Kh($I.exports,Symbol.for("setupWindows"),ghe)});var Lq=v(gge=>{"use strict";gge.parse=function(t,e){return new Dq(t,e).parse()};var Dq=class t{constructor(e,r){this.source=e,this.transform=r||EZe,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var r;(this.recorded.length>0||e)&&(r=this.recorded.join(""),r==="NULL"&&!e&&(r=null),r!==null&&(r=this.transform(r)),this.entries.push(r),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var r,n,i;for(this.consumeDimensions();!this.isEof();)if(r=this.nextCharacter(),r.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new t(this.source.substr(this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n.position-2);else if(r.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else r.value==='"'&&!r.escaped?(i&&this.newEntry(!0),i=!i):r.value===","&&!i?this.newEntry():this.record(r.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function EZe(t){return t}});var $q=v((A6t,_ge)=>{"use strict";var vZe=Lq();_ge.exports={create:function(t,e){return{parse:function(){return vZe.parse(t,e)}}}}});var Ege=v((w6t,Sge)=>{"use strict";var TZe=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,bZe=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,AZe=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,wZe=/^-?infinity$/;Sge.exports=function(e){if(wZe.test(e))return Number(e.replace("i","I"));var r=TZe.exec(e);if(!r)return xZe(e)||null;var n=!!r[8],i=parseInt(r[1],10);n&&(i=yge(i));var o=parseInt(r[2],10)-1,s=r[3],a=parseInt(r[4],10),c=parseInt(r[5],10),l=parseInt(r[6],10),u=r[7];u=u?1e3*parseFloat(u):0;var d,f=RZe(e);return f!=null?(d=new Date(Date.UTC(i,o,s,a,c,l,u)),Uq(i)&&d.setUTCFullYear(i),f!==0&&d.setTime(d.getTime()-f)):(d=new Date(i,o,s,a,c,l,u),Uq(i)&&d.setFullYear(i)),d};function xZe(t){var e=bZe.exec(t);if(e){var r=parseInt(e[1],10),n=!!e[4];n&&(r=yge(r));var i=parseInt(e[2],10)-1,o=e[3],s=new Date(r,i,o);return Uq(r)&&s.setFullYear(r),s}}function RZe(t){if(t.endsWith("+00"))return 0;var e=AZe.exec(t.split(" ")[1]);if(e){var r=e[1];if(r==="Z")return 0;var n=r==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}function yge(t){return-(t-1)}function Uq(t){return t>=0&&t<100}});var Tge=v((x6t,vge)=>{"use strict";vge.exports=IZe;var CZe=Object.prototype.hasOwnProperty;function IZe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)CZe.call(r,n)&&(t[n]=r[n])}return t}});var wge=v((R6t,Age)=>{"use strict";var PZe=Tge();Age.exports=sm;function sm(t){if(!(this instanceof sm))return new sm(t);PZe(this,zZe(t))}var OZe=["seconds","minutes","hours","days","months","years"];sm.prototype.toPostgres=function(){var t=OZe.filter(this.hasOwnProperty,this);return this.milliseconds&&t.indexOf("seconds")<0&&t.push("seconds"),t.length===0?"0":t.map(function(e){var r=this[e]||0;return e==="seconds"&&this.milliseconds&&(r=(r+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),r+" "+e},this).join(" ")};var NZe={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},kZe=["years","months","days"],MZe=["hours","minutes","seconds"];sm.prototype.toISOString=sm.prototype.toISO=function(){var t=kZe.map(r,this).join(""),e=MZe.map(r,this).join("");return"P"+t+"T"+e;function r(n){var i=this[n]||0;return n==="seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),i+NZe[n]}};var Fq="([+-]?\\d+)",DZe=Fq+"\\s+years?",LZe=Fq+"\\s+mons?",$Ze=Fq+"\\s+days?",UZe="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",FZe=new RegExp([DZe,LZe,$Ze,UZe].map(function(t){return"("+t+")?"}).join("\\s*")),bge={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},BZe=["hours","minutes","seconds","milliseconds"];function jZe(t){var e=t+"000000".slice(t.length);return parseInt(e,10)/1e3}function zZe(t){if(!t)return{};var e=FZe.exec(t),r=e[8]==="-";return Object.keys(bge).reduce(function(n,i){var o=bge[i],s=e[o];return!s||(s=i==="milliseconds"?jZe(s):parseInt(s,10),!s)||(r&&~BZe.indexOf(i)&&(s*=-1),n[i]=s),n},{})}});var Cge=v((C6t,Rge)=>{"use strict";var xge=Buffer.from||Buffer;Rge.exports=function(e){if(/^\\x/.test(e))return xge(e.substr(2),"hex");for(var r="",n=0;n<e.length;)if(e[n]!=="\\")r+=e[n],++n;else if(/[0-7]{3}/.test(e.substr(n+1,3)))r+=String.fromCharCode(parseInt(e.substr(n+1,3),8)),n+=4;else{for(var i=1;n+i<e.length&&e[n+i]==="\\";)i++;for(var o=0;o<Math.floor(i/2);++o)r+="\\";n+=Math.floor(i/2)*2}return xge(r,"binary")}});var Dge=v((I6t,Mge)=>{"use strict";var HS=Lq(),WS=$q(),JI=Ege(),Pge=wge(),Oge=Cge();function XI(t){return function(r){return r===null?r:t(r)}}function Nge(t){return t===null?t:t==="TRUE"||t==="t"||t==="true"||t==="y"||t==="yes"||t==="on"||t==="1"}function GZe(t){return t?HS.parse(t,Nge):null}function qZe(t){return parseInt(t,10)}function Bq(t){return t?HS.parse(t,XI(qZe)):null}function VZe(t){return t?HS.parse(t,XI(function(e){return kge(e).trim()})):null}var HZe=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=qq(r)),r});return e.parse()},jq=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=parseFloat(r)),r});return e.parse()},ni=function(t){if(!t)return null;var e=WS.create(t);return e.parse()},zq=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=JI(r)),r});return e.parse()},WZe=function(t){if(!t)return null;var e=WS.create(t,function(r){return r!==null&&(r=Pge(r)),r});return e.parse()},YZe=function(t){return t?HS.parse(t,XI(Oge)):null},Gq=function(t){return parseInt(t,10)},kge=function(t){var e=String(t);return/^\d+$/.test(e)?e:t},Ige=function(t){return t?HS.parse(t,XI(JSON.parse)):null},qq=function(t){return t[0]!=="("?null:(t=t.substring(1,t.length-1).split(","),{x:parseFloat(t[0]),y:parseFloat(t[1])})},KZe=function(t){if(t[0]!=="<"&&t[1]!=="(")return null;for(var e="(",r="",n=!1,i=2;i<t.length-1;i++){if(n||(e+=t[i]),t[i]===")"){n=!0;continue}else if(!n)continue;t[i]!==","&&(r+=t[i])}var o=qq(e);return o.radius=parseFloat(r),o},ZZe=function(t){t(20,kge),t(21,Gq),t(23,Gq),t(26,Gq),t(700,parseFloat),t(701,parseFloat),t(16,Nge),t(1082,JI),t(1114,JI),t(1184,JI),t(600,qq),t(651,ni),t(718,KZe),t(1e3,GZe),t(1001,YZe),t(1005,Bq),t(1007,Bq),t(1028,Bq),t(1016,VZe),t(1017,HZe),t(1021,jq),t(1022,jq),t(1231,jq),t(1014,ni),t(1015,ni),t(1008,ni),t(1009,ni),t(1040,ni),t(1041,ni),t(1115,zq),t(1182,zq),t(1185,zq),t(1186,Pge),t(1187,WZe),t(17,Oge),t(114,JSON.parse.bind(JSON)),t(3802,JSON.parse.bind(JSON)),t(199,Ige),t(3807,Ige),t(3907,ni),t(2951,ni),t(791,ni),t(1183,ni),t(1270,ni)};Mge.exports={init:ZZe}});var $ge=v((P6t,Lge)=>{"use strict";var dn=1e6;function JZe(t){var e=t.readInt32BE(0),r=t.readUInt32BE(4),n="";e<0&&(e=~e+(r===0),r=~r+1>>>0,n="-");var i="",o,s,a,c,l,u;{if(o=e%dn,e=e/dn>>>0,s=4294967296*o+r,r=s/dn>>>0,a=""+(s-dn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%dn,e=e/dn>>>0,s=4294967296*o+r,r=s/dn>>>0,a=""+(s-dn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(o=e%dn,e=e/dn>>>0,s=4294967296*o+r,r=s/dn>>>0,a=""+(s-dn*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}return o=e%dn,s=4294967296*o+r,a=""+s%dn,n+a+i}Lge.exports=JZe});var zge=v((O6t,jge)=>{"use strict";var XZe=$ge(),xt=function(t,e,r,n,i){r=r||0,n=n||!1,i=i||function(p,h,m){return p*Math.pow(2,m)+h};var o=r>>3,s=function(p){return n?~p&255:p},a=255,c=8-r%8;e<c&&(a=255<<8-e&255,c=e),r&&(a=a>>r%8);var l=0;r%8+e>=8&&(l=i(0,s(t[o])&a,c));for(var u=e+r>>3,d=o+1;d<u;d++)l=i(l,s(t[d]),8);var f=(e+r)%8;return f>0&&(l=i(l,s(t[u])>>8-f,f)),l},Bge=function(t,e,r){var n=Math.pow(2,r-1)-1,i=xt(t,1),o=xt(t,r,1);if(o===0)return 0;var s=1,a=function(l,u,d){l===0&&(l=1);for(var f=1;f<=d;f++)s/=2,(u&1<<d-f)>0&&(l+=s);return l},c=xt(t,e,r+1,!1,a);return o==Math.pow(2,r+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1:-1)*Math.pow(2,o-n)*c},QZe=function(t){return xt(t,1)==1?-1*(xt(t,15,1,!0)+1):xt(t,15,1)},Uge=function(t){return xt(t,1)==1?-1*(xt(t,31,1,!0)+1):xt(t,31,1)},e5e=function(t){return Bge(t,23,8)},t5e=function(t){return Bge(t,52,11)},r5e=function(t){var e=xt(t,16,32);if(e==49152)return NaN;for(var r=Math.pow(1e4,xt(t,16,16)),n=0,i=[],o=xt(t,16),s=0;s<o;s++)n+=xt(t,16,64+16*s)*r,r/=1e4;var a=Math.pow(10,xt(t,16,48));return(e===0?1:-1)*Math.round(n*a)/a},Fge=function(t,e){var r=xt(e,1),n=xt(e,63,1),i=new Date((r===0?1:-1)*n/1e3+9466848e5);return t||i.setTime(i.getTime()+i.getTimezoneOffset()*6e4),i.usec=n%1e3,i.getMicroSeconds=function(){return this.usec},i.setMicroSeconds=function(o){this.usec=o},i.getUTCMicroSeconds=function(){return this.usec},i},YS=function(t){for(var e=xt(t,32),r=xt(t,32,32),n=xt(t,32,64),i=96,o=[],s=0;s<e;s++)o[s]=xt(t,32,i),i+=32,i+=32;var a=function(l){var u=xt(t,32,i);if(i+=32,u==4294967295)return null;var d;if(l==23||l==20)return d=xt(t,u*8,i),i+=u*8,d;if(l==25)return d=t.toString(this.encoding,i>>3,(i+=u<<3)>>3),d;console.log("ERROR: ElementType not implemented: "+l)},c=function(l,u){var d=[],f;if(l.length>1){var p=l.shift();for(f=0;f<p;f++)d[f]=c(l,u);l.unshift(p)}else for(f=0;f<l[0];f++)d[f]=a(u);return d};return c(o,n)},n5e=function(t){return t.toString("utf8")},i5e=function(t){return t===null?null:xt(t,8)>0},o5e=function(t){t(20,XZe),t(21,QZe),t(23,Uge),t(26,Uge),t(1700,r5e),t(700,e5e),t(701,t5e),t(16,i5e),t(1114,Fge.bind(null,!1)),t(1184,Fge.bind(null,!0)),t(1e3,YS),t(1007,YS),t(1016,YS),t(1008,YS),t(1009,YS),t(25,n5e)};jge.exports={init:o5e}});var qge=v((N6t,Gge)=>{"use strict";Gge.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var JS=v(ZS=>{"use strict";var s5e=Dge(),a5e=zge(),c5e=$q(),l5e=qge();ZS.getTypeParser=u5e;ZS.setTypeParser=d5e;ZS.arrayParser=c5e;ZS.builtins=l5e;var KS={text:{},binary:{}};function Vge(t){return String(t)}function u5e(t,e){return e=e||"text",KS[e]&&KS[e][t]||Vge}function d5e(t,e,r){typeof e=="function"&&(r=e,e="text"),KS[e][t]=r}s5e.init(function(t,e){KS.text[t]=e});a5e.init(function(t,e){KS.binary[t]=e})});var XS=v((M6t,Vq)=>{"use strict";var Hge;try{Hge=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}Vq.exports={host:"localhost",user:Hge,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var am=JS(),f5e=am.getTypeParser(20,"text"),p5e=am.getTypeParser(1016,"text");Vq.exports.__defineSetter__("parseInt8",function(t){am.setTypeParser(20,"text",t?am.getTypeParser(23,"text"):f5e),am.setTypeParser(1016,"text",t?am.getTypeParser(1007,"text"):p5e)})});var cm=v((D6t,Yge)=>{"use strict";var h5e=XS(),{isDate:m5e}=Z("util/types");function g5e(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Wge(t){let e="{";for(let r=0;r<t.length;r++){r>0&&(e+=",");let n=t[r];n==null?e+="NULL":Array.isArray(n)?e+=Wge(n):ArrayBuffer.isView(n)?(n instanceof Buffer||(n=Buffer.from(n.buffer,n.byteOffset,n.byteLength)),e+="\\\\x"+n.toString("hex")):e+=g5e(QI(n))}return e+="}",e}var QI=function(t,e){return t==null?null:typeof t=="object"?t instanceof Buffer?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):m5e(t)?h5e.parseInputDatesAsUTC?S5e(t):y5e(t):Array.isArray(t)?Wge(t):_5e(t,e):t.toString()};function _5e(t,e){if(t&&typeof t.toPostgres=="function"){if(e=e||[],e.indexOf(t)!==-1)throw new Error('circular reference detected while preparing "'+t+'" for query');return e.push(t),QI(t.toPostgres(QI),e)}return JSON.stringify(t)}function y5e(t){let e=-t.getTimezoneOffset(),r=t.getFullYear(),n=r<1;n&&(r=Math.abs(r)+1);let i=String(r).padStart(4,"0")+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+String(t.getMilliseconds()).padStart(3,"0");return e<0?(i+="-",e*=-1):i+="+",i+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),n&&(i+=" BC"),i}function S5e(t){let e=t.getUTCFullYear(),r=e<1;r&&(e=Math.abs(e)+1);let n=String(e).padStart(4,"0")+"-"+String(t.getUTCMonth()+1).padStart(2,"0")+"-"+String(t.getUTCDate()).padStart(2,"0")+"T"+String(t.getUTCHours()).padStart(2,"0")+":"+String(t.getUTCMinutes()).padStart(2,"0")+":"+String(t.getUTCSeconds()).padStart(2,"0")+"."+String(t.getUTCMilliseconds()).padStart(3,"0");return n+="+00:00",r&&(n+=" BC"),n}function E5e(t,e,r){return t=typeof t=="string"?{text:t}:t,e&&(typeof e=="function"?t.callback=e:t.values=e),r&&(t.callback=r),t}var v5e=function(t){return'"'+t.replace(/"/g,'""')+'"'},T5e=function(t){let e=!1,r="'";if(t==null||typeof t!="string")return"''";for(let n=0;n<t.length;n++){let i=t[n];i==="'"?r+=i+i:i==="\\"?(r+=i+i,e=!0):r+=i}return r+="'",e===!0&&(r=" E"+r),r};Yge.exports={prepareValue:function(e){return QI(e)},normalizeQueryConfig:E5e,escapeIdentifier:v5e,escapeLiteral:T5e}});var Yq=v((L6t,Jge)=>{"use strict";var Kge=Z("crypto");Jge.exports={postgresMd5PasswordHash:A5e,randomBytes:b5e,deriveKey:C5e,sha256:w5e,hashByName:x5e,hmacSha256:R5e,md5:Hq};var Zge=Kge.webcrypto||globalThis.crypto,Gu=Zge.subtle,Wq=new TextEncoder;function b5e(t){return Zge.getRandomValues(Buffer.alloc(t))}async function Hq(t){try{return Kge.createHash("md5").update(t,"utf-8").digest("hex")}catch{let r=typeof t=="string"?Wq.encode(t):t,n=await Gu.digest("MD5",r);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}}async function A5e(t,e,r){let n=await Hq(e+t);return"md5"+await Hq(Buffer.concat([Buffer.from(n),r]))}async function w5e(t){return await Gu.digest("SHA-256",t)}async function x5e(t,e){return await Gu.digest(t,e)}async function R5e(t,e){let r=await Gu.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await Gu.sign("HMAC",r,Wq.encode(e))}async function C5e(t,e,r){let n=await Gu.importKey("raw",Wq.encode(t),"PBKDF2",!1,["deriveBits"]),i={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:r};return await Gu.deriveBits(i,n,256,["deriveBits"])}});var e_e=v(($6t,Qge)=>{"use strict";function qu(t,e){return new Error("SASL channel binding: "+t+" when parsing public certificate "+e.toString("base64"))}function Kq(t,e){let r=t[e++];if(r<128)return{length:r,index:e};let n=r&127;if(n>4)throw qu("bad length",t);r=0;for(let i=0;i<n;i++)r=r<<8|t[e++];return{length:r,index:e}}function Xge(t,e){if(t[e++]!==6)throw qu("non-OID data",t);let{length:r,index:n}=Kq(t,e);e=n;let i=e+r,o=t[e++],s=(o/40>>0)+"."+o%40;for(;e<i;){let a=0;for(;e<i;){let c=t[e++];if(a=a<<7|c&127,c<128)break}s+="."+a}return{oid:s,index:e}}function QS(t,e){if(t[e++]!==48)throw qu("non-sequence data",t);return Kq(t,e)}function I5e(t,e){e===void 0&&(e=0),e=QS(t,e).index;let{length:r,index:n}=QS(t,e);e=n+r,e=QS(t,e).index;let{oid:i,index:o}=Xge(t,e);switch(i){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=o,e=QS(t,e).index,t[e++]!==160)throw qu("non-tag data",t);e=Kq(t,e).index,e=QS(t,e).index;let{oid:s}=Xge(t,e);switch(s){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw qu("unknown hash OID "+s,t)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw qu("Ed448 certificate channel binding is not currently supported by Postgres")}throw qu("unknown OID "+i,t)}Qge.exports={signatureAlgorithmHashFromCertificate:I5e}});var i_e=v((U6t,n_e)=>{"use strict";var jc=Yq(),{signatureAlgorithmHashFromCertificate:P5e}=e_e();function O5e(t){let e=/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,r=/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g;return t.replace(e," ").replace(r,"").normalize("NFKC")}var Zq=1e5;function N5e(t,e,r=Zq){let n=["SCRAM-SHA-256"];e&&n.unshift("SCRAM-SHA-256-PLUS");let i=n.find(a=>t.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+n.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let o=jc.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:o,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+o,message:"SASLInitialResponse",scramMaxIterations:r}}async function k5e(t,e,r,n){if(t.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof r!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let i=L5e(r);if(i.nonce.startsWith(t.clientNonce)){if(i.nonce.length===t.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let o=typeof t.scramMaxIterations=="number"?t.scramMaxIterations:Zq;if(o!==0&&i.iteration>o)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count "+i.iteration+" exceeds scramMaxIterations of "+o);let s="n=*,r="+t.clientNonce,a="r="+i.nonce+",s="+i.salt+",i="+i.iteration,c=n?"eSws":"biws";if(t.mechanism==="SCRAM-SHA-256-PLUS"){let w=n.getPeerCertificate().raw,T=P5e(w);(T==="MD5"||T==="SHA-1")&&(T="SHA-256");let C=await jc.hashByName(T,w);c=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(C)]).toString("base64")}let l="c="+c+",r="+i.nonce,u=s+","+a+","+l,d=Buffer.from(i.salt,"base64"),f=await jc.deriveKey(O5e(e),d,i.iteration),p=await jc.hmacSha256(f,"Client Key"),h=await jc.sha256(p),m=await jc.hmacSha256(h,u),y=U5e(Buffer.from(p),Buffer.from(m)).toString("base64"),S=await jc.hmacSha256(f,"Server Key"),b=await jc.hmacSha256(S,u);t.message="SASLResponse",t.serverSignature=Buffer.from(b).toString("base64"),t.response=l+",p="+y}function M5e(t,e){if(t.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:r}=$5e(e);if(r!==t.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function D5e(t){if(typeof t!="string")throw new TypeError("SASL: text must be a string");return t.split("").map((e,r)=>t.charCodeAt(r)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function t_e(t){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(t)}function r_e(t){if(typeof t!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(t.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let r=e[0],n=e.substring(2);return[r,n]}))}function L5e(t){let e=r_e(t),r=e.get("r");if(r){if(!D5e(r))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!t_e(n))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/.test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let o=parseInt(i,10);return{nonce:r,salt:n,iteration:o}}function $5e(t){let e=r_e(t),r=e.get("e"),n=e.get("v");if(r)throw new Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${r}"`);if(n){if(!t_e(n))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:n}}function U5e(t,e){if(!Buffer.isBuffer(t))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(t.length!==e.length)throw new Error("Buffer lengths must match");if(t.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(t.map((r,n)=>t[n]^e[n]))}n_e.exports={startSession:N5e,continueSession:k5e,finalizeSession:M5e,DEFAULT_MAX_SCRAM_ITERATIONS:Zq}});var tP=v((F6t,o_e)=>{"use strict";var F5e=JS();function eP(t){this._types=t||F5e,this.text={},this.binary={}}eP.prototype.getOverrides=function(t){switch(t){case"text":return this.text;case"binary":return this.binary;default:return{}}};eP.prototype.setTypeParser=function(t,e,r){typeof e=="function"&&(r=e,e="text"),this.getOverrides(e)[t]=r};eP.prototype.getTypeParser=function(t,e){return e=e||"text",this.getOverrides(e)[t]||this._types.getTypeParser(t,e)};o_e.exports=eP});var c_e=v((B6t,a_e)=>{"use strict";function lm(t,e={}){if(t.charAt(0)==="/"){let c=t.split(" ");return{host:c[0],database:c[1]}}let r=Object.create(null),n,i=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(t)&&(t=encodeURI(t).replace(/%25(\d\d)/g,"%$1"));try{try{n=new URL(t,"postgres://base")}catch{n=new URL(t.replace("@/","@___DUMMY___/"),"postgres://base"),i=!0}}catch(c){throw c.input&&(c.input="*****REDACTED*****"),c}for(let c of n.searchParams.entries())r[c[0]]=c[1];if(r.user=r.user||decodeURIComponent(n.username),r.password=r.password||decodeURIComponent(n.password),n.protocol=="socket:")return r.host=decodeURI(n.pathname),r.database=n.searchParams.get("db"),r.client_encoding=n.searchParams.get("encoding"),r;let o=i?"":n.hostname;r.host?o&&/^%2f/i.test(o)&&(n.pathname=o+n.pathname):r.host=decodeURIComponent(o),r.port||(r.port=n.port);let s=n.pathname.slice(1)||null;r.database=s?decodeURI(s):null,(r.ssl==="true"||r.ssl==="1")&&(r.ssl=!0),r.ssl==="0"&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={});let a=r.sslcert||r.sslkey||r.sslrootcert?Z("fs"):null;if(r.sslcert&&(r.ssl.cert=a.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=a.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=a.readFileSync(r.sslrootcert).toString()),e.useLibpqCompat&&r.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(r.uselibpqcompat==="true"||e.useLibpqCompat)switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":{r.ssl.rejectUnauthorized=!1;break}case"require":{r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!r.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");r.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{r.sslmode!=="verify-full"&&Jq(r.sslmode);break}case"no-verify":{r.ssl.rejectUnauthorized=!1;break}}return r}function B5e(t){return Object.entries(t).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),Object.create(null))}function s_e(t){return Object.entries(t).reduce((r,[n,i])=>{if(n==="ssl"){let o=i;typeof o=="boolean"&&(r[n]=o),typeof o=="object"&&(r[n]=B5e(o))}else if(i!=null)if(n==="port"){if(i!==""){let o=parseInt(i,10);if(isNaN(o))throw new Error(`Invalid ${n}: ${i}`);r[n]=o}}else r[n]=i;return r},Object.create(null))}function j5e(t){return s_e(lm(t))}function Jq(t){!Jq.warned&&typeof process<"u"&&process.emitWarning&&(Jq.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
25
25
  In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
26
26
 
27
27
  To prepare for this change:
@@ -29,7 +29,7 @@ To prepare for this change:
29
29
  - If you want libpq compatibility now, use 'uselibpqcompat=true&sslmode=${t}'
30
30
 
31
31
  See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`))}a_e.exports=lm;lm.parse=lm;lm.toClientConfig=s_e;lm.parseIntoClientConfig=j5e});var Qq=v((j6t,d_e)=>{"use strict";var z5e=Z("dns"),u_e=XS(),l_e=c_e().parse,Vr=function(t,e,r){return e[t]?e[t]:(r===void 0?r=process.env["PG"+t.toUpperCase()]:r===!1||(r=process.env[r]),r||u_e[t])},G5e=function(){switch(process.env.PGSSLMODE){case"disable":return!1;case"prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify":return{rejectUnauthorized:!1}}return u_e.ssl},um=function(t){return"'"+(""+t).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},ii=function(t,e,r){let n=e[r];n!=null&&t.push(r+"="+um(n))},Xq=class{constructor(e){e=typeof e=="string"?l_e(e):e||{},e.connectionString&&(e=Object.assign({},e,l_e(e.connectionString))),this.user=Vr("user",e),this.database=Vr("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt(Vr("port",e),10),this.host=Vr("host",e),Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:Vr("password",e)}),this.binary=Vr("binary",e),this.options=Vr("options",e),this.ssl=typeof e.ssl>"u"?G5e():e.ssl,typeof this.ssl=="string"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}),this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this.client_encoding=Vr("client_encoding",e),this.replication=Vr("replication",e),this.isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=Vr("application_name",e,"PGAPPNAME"),this.fallback_application_name=Vr("fallback_application_name",e,!1),this.statement_timeout=Vr("statement_timeout",e,!1),this.lock_timeout=Vr("lock_timeout",e,!1),this.idle_in_transaction_session_timeout=Vr("idle_in_transaction_session_timeout",e,!1),this.query_timeout=Vr("query_timeout",e,!1),e.connectionTimeoutMillis===void 0?this.connect_timeout=process.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math.floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive===!0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle=Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){let r=[];ii(r,this,"user"),ii(r,this,"password"),ii(r,this,"port"),ii(r,this,"application_name"),ii(r,this,"fallback_application_name"),ii(r,this,"connect_timeout"),ii(r,this,"options");let n=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this.ssl}:{};if(ii(r,n,"sslmode"),ii(r,n,"sslca"),ii(r,n,"sslkey"),ii(r,n,"sslcert"),ii(r,n,"sslrootcert"),this.database&&r.push("dbname="+um(this.database)),this.replication&&r.push("replication="+um(this.replication)),this.host&&r.push("host="+um(this.host)),this.isDomainSocket)return e(null,r.join(" "));this.client_encoding&&r.push("client_encoding="+um(this.client_encoding)),z5e.lookup(this.host,function(i,o){return i?e(i,null):(r.push("hostaddr="+um(o)),e(null,r.join(" ")))})}};d_e.exports=Xq});var tV=v((z6t,p_e)=>{"use strict";var q5e=JS(),f_e=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/,eV=class{constructor(e,r){this.command=null,this.rowCount=null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types=r,this.RowCtor=null,this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray),this._prebuiltEmptyResultObject=null}addCommandComplete(e){let r;e.text?r=f_e.exec(e.text):r=f_e.exec(e.command),r&&(this.command=r[1],r[3]?(this.oid=parseInt(r[2],10),this.rowCount=parseInt(r[3],10)):r[2]&&(this.rowCount=parseInt(r[2],10)))}_parseRowAsArray(e){let r=new Array(e.length);for(let n=0,i=e.length;n<i;n++){let o=e[n];o!==null?r[n]=this._parsers[n](o):r[n]=null}return r}parseRow(e){let r={...this._prebuiltEmptyResultObject};for(let n=0,i=e.length;n<i;n++){let o=e[n],s=this.fields[n].name;if(o!==null){let a=this.fields[n].format==="binary"?Buffer.from(o):o;r[s]=this._parsers[n](a)}else r[s]=null}return r}addRow(e){this.rows.push(e)}addFields(e){this.fields=e,this.fields.length&&(this._parsers=new Array(e.length));let r=Object.create(null);for(let n=0;n<e.length;n++){let i=e[n];r[i.name]=null,this._types?this._parsers[n]=this._types.getTypeParser(i.dataTypeID,i.format||"text"):this._parsers[n]=q5e.getTypeParser(i.dataTypeID,i.format||"text")}this._prebuiltEmptyResultObject={...r}}};p_e.exports=eV});var __e=v((G6t,g_e)=>{"use strict";var{EventEmitter:V5e}=Z("events"),h_e=tV(),m_e=cm(),rV=class extends V5e{constructor(e,r,n){super(),e=m_e.normalizeQueryConfig(e,r,n),this.text=e.text,this.values=e.values,this.rows=e.rows,this.types=e.types,this.name=e.name,this.queryMode=e.queryMode,this.binary=e.binary,this.portal=e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,process.domain&&e.callback&&(this.callback=process.domain.bind(e.callback)),this._result=new h_e(this._rowMode,this.types),this._results=this._result,this._canceledDueToError=!1}requiresPreparation(){return this.queryMode==="extended"||this.name||this.rows?!0:!this.text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&&(Array.isArray(this._results)||(this._results=[this._result]),this._result=new h_e(this._rowMode,this._result._types),this._results.push(this._result))}handleRowDescription(e){this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this.callback||!this.listeners("row").length}handleDataRow(e){let r;if(!this._canceledDueToError){try{r=this._result.parseRow(e.fields)}catch(n){this._canceledDueToError=n;return}this.emit("row",r,this._result),this._accumulateRows&&this._result.addRow(r)}}handleCommandComplete(e,r){this._checkForMultirow(),this._result.addCommandComplete(e),this.rows&&r.sync()}handleEmptyQuery(e){this.rows&&e.sync()}handleError(e,r){if(this._canceledDueToError&&(e=this._canceledDueToError,this._canceledDueToError=!1),this.callback)return this.callback(e);this.emit("error",e)}handleReadyForQuery(e){if(this._canceledDueToError)return this.handleError(this._canceledDueToError,e);if(this.callback)try{this.callback(null,this._results)}catch(r){process.nextTick(()=>{throw r})}this.emit("end",this._results)}submit(e){if(typeof this.text!="string"&&typeof this.name!="string")return new Error("A query must have either text or a name. Supplying neither is unsupported.");let r=e.parsedStatements[this.name];if(this.text&&r&&this.text!==r)return new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);if(this.values&&!Array.isArray(this.values))return new Error("Query values must be an array");if(this.requiresPreparation()){e.stream.cork&&e.stream.cork();try{this.prepare(e)}finally{e.stream.uncork&&e.stream.uncork()}}else e.query(this.text);return null}hasBeenParsed(e){return this.name&&e.parsedStatements[this.name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,r){e.execute({portal:this.portal,rows:r}),r?e.flush():e.sync()}prepare(e){this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types});try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this.binary,valueMapper:m_e.prepareValue})}catch(r){this.handleError(r,e);return}e.describe({type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){e.sendCopyFail("No source stream defined")}handleCopyData(e,r){}};g_e.exports=rV});var _V=v(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.NoticeMessage=Le.DataRowMessage=Le.CommandCompleteMessage=Le.ReadyForQueryMessage=Le.NotificationResponseMessage=Le.BackendKeyDataMessage=Le.AuthenticationMD5Password=Le.ParameterStatusMessage=Le.ParameterDescriptionMessage=Le.RowDescriptionMessage=Le.Field=Le.CopyResponse=Le.CopyDataMessage=Le.DatabaseError=Le.copyDone=Le.emptyQuery=Le.replicationStart=Le.portalSuspended=Le.noData=Le.closeComplete=Le.bindComplete=Le.parseComplete=void 0;Le.parseComplete={name:"parseComplete",length:5};Le.bindComplete={name:"bindComplete",length:5};Le.closeComplete={name:"closeComplete",length:5};Le.noData={name:"noData",length:5};Le.portalSuspended={name:"portalSuspended",length:5};Le.replicationStart={name:"replicationStart",length:4};Le.emptyQuery={name:"emptyQuery",length:4};Le.copyDone={name:"copyDone",length:4};var nV=class extends Error{constructor(e,r,n){super(e),this.length=r,this.name=n}};Le.DatabaseError=nV;var iV=class{constructor(e,r){this.length=e,this.chunk=r,this.name="copyData"}};Le.CopyDataMessage=iV;var oV=class{constructor(e,r,n,i){this.length=e,this.name=r,this.binary=n,this.columnTypes=new Array(i)}};Le.CopyResponse=oV;var sV=class{constructor(e,r,n,i,o,s,a){this.name=e,this.tableID=r,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=o,this.dataTypeModifier=s,this.format=a}};Le.Field=sV;var aV=class{constructor(e,r){this.length=e,this.fieldCount=r,this.name="rowDescription",this.fields=new Array(this.fieldCount)}};Le.RowDescriptionMessage=aV;var cV=class{constructor(e,r){this.length=e,this.parameterCount=r,this.name="parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};Le.ParameterDescriptionMessage=cV;var lV=class{constructor(e,r,n){this.length=e,this.parameterName=r,this.parameterValue=n,this.name="parameterStatus"}};Le.ParameterStatusMessage=lV;var uV=class{constructor(e,r){this.length=e,this.salt=r,this.name="authenticationMD5Password"}};Le.AuthenticationMD5Password=uV;var dV=class{constructor(e,r,n){this.length=e,this.processID=r,this.secretKey=n,this.name="backendKeyData"}};Le.BackendKeyDataMessage=dV;var fV=class{constructor(e,r,n,i){this.length=e,this.processId=r,this.channel=n,this.payload=i,this.name="notification"}};Le.NotificationResponseMessage=fV;var pV=class{constructor(e,r){this.length=e,this.status=r,this.name="readyForQuery"}};Le.ReadyForQueryMessage=pV;var hV=class{constructor(e,r){this.length=e,this.text=r,this.name="commandComplete"}};Le.CommandCompleteMessage=hV;var mV=class{constructor(e,r){this.length=e,this.fields=r,this.name="dataRow",this.fieldCount=r.length}};Le.DataRowMessage=mV;var gV=class{constructor(e,r){this.length=e,this.message=r,this.name="notice"}};Le.NoticeMessage=gV});var y_e=v(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});rP.Writer=void 0;var yV=class{constructor(e=256){this.size=e,this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(e)}ensure(e){if(this.buffer.length-this.offset<e){let n=this.buffer,i=n.length+(n.length>>1)+e;this.buffer=Buffer.allocUnsafe(i),n.copy(this.buffer)}}addInt32(e){return this.ensure(4),this.buffer[this.offset++]=e>>>24&255,this.buffer[this.offset++]=e>>>16&255,this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addInt16(e){return this.ensure(2),this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addCString(e){if(!e)this.ensure(1);else{let r=Buffer.byteLength(e);this.ensure(r+1),this.buffer.write(e,this.offset,"utf-8"),this.offset+=r}return this.buffer[this.offset++]=0,this}addString(e=""){let r=Buffer.byteLength(e);return this.ensure(r),this.buffer.write(e,this.offset),this.offset+=r,this}add(e){return this.ensure(e.length),e.copy(this.buffer,this.offset),this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let r=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE(r,this.headerPosition+1)}return this.buffer.slice(e?0:5,this.offset)}flush(e){let r=this.join(e);return this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(this.size),r}};rP.Writer=yV});var E_e=v(iP=>{"use strict";Object.defineProperty(iP,"__esModule",{value:!0});iP.serialize=void 0;var SV=y_e(),vt=new SV.Writer,H5e=t=>{vt.addInt16(3).addInt16(0);for(let n of Object.keys(t))vt.addCString(n).addCString(t[n]);vt.addCString("client_encoding").addCString("UTF8");let e=vt.addCString("").flush(),r=e.length+4;return new SV.Writer().addInt32(r).add(e).flush()},W5e=()=>{let t=Buffer.allocUnsafe(8);return t.writeInt32BE(8,0),t.writeInt32BE(80877103,4),t},Y5e=t=>vt.addCString(t).flush(112),K5e=function(t,e){return vt.addCString(t).addInt32(Buffer.byteLength(e)).addString(e),vt.flush(112)},Z5e=function(t){return vt.addString(t).flush(112)},J5e=t=>vt.addCString(t).flush(81),S_e=[],X5e=t=>{let e=t.name||"";e.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",e,e.length),console.error("This can cause conflicts and silent errors executing queries"));let r=t.types||S_e,n=r.length,i=vt.addCString(e).addCString(t.text).addInt16(n);for(let o=0;o<n;o++)i.addInt32(r[o]);return vt.flush(80)},dm=new SV.Writer,Q5e=function(t,e){for(let r=0;r<t.length;r++){let n=e?e(t[r],r):t[r];n==null?(vt.addInt16(0),dm.addInt32(-1)):n instanceof Buffer?(vt.addInt16(1),dm.addInt32(n.length),dm.add(n)):(vt.addInt16(0),dm.addInt32(Buffer.byteLength(n)),dm.addString(n))}},e9e=(t={})=>{let e=t.portal||"",r=t.statement||"",n=t.binary||!1,i=t.values||S_e,o=i.length;return vt.addCString(e).addCString(r),vt.addInt16(o),Q5e(i,t.valueMapper),vt.addInt16(o),vt.add(dm.flush()),vt.addInt16(1),vt.addInt16(n?1:0),vt.flush(66)},t9e=Buffer.from([69,0,0,0,9,0,0,0,0,0]),r9e=t=>{if(!t||!t.portal&&!t.rows)return t9e;let e=t.portal||"",r=t.rows||0,n=Buffer.byteLength(e),i=4+n+1+4,o=Buffer.allocUnsafe(1+i);return o[0]=69,o.writeInt32BE(i,1),o.write(e,5,"utf-8"),o[n+5]=0,o.writeUInt32BE(r,o.length-4),o},n9e=(t,e)=>{let r=Buffer.allocUnsafe(16);return r.writeInt32BE(16,0),r.writeInt16BE(1234,4),r.writeInt16BE(5678,6),r.writeInt32BE(t,8),r.writeInt32BE(e,12),r},EV=(t,e)=>{let n=4+Buffer.byteLength(e)+1,i=Buffer.allocUnsafe(1+n);return i[0]=t,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i},i9e=vt.addCString("P").flush(68),o9e=vt.addCString("S").flush(68),s9e=t=>t.name?EV(68,`${t.type}${t.name||""}`):t.type==="P"?i9e:o9e,a9e=t=>{let e=`${t.type}${t.name||""}`;return EV(67,e)},c9e=t=>vt.add(t).flush(100),l9e=t=>EV(102,t),nP=t=>Buffer.from([t,0,0,0,4]),u9e=nP(72),d9e=nP(83),f9e=nP(88),p9e=nP(99),h9e={startup:H5e,password:Y5e,requestSsl:W5e,sendSASLInitialResponseMessage:K5e,sendSCRAMClientFinalMessage:Z5e,query:J5e,parse:X5e,bind:e9e,execute:r9e,describe:s9e,close:a9e,flush:()=>u9e,sync:()=>d9e,end:()=>f9e,copyData:c9e,copyDone:()=>p9e,copyFail:l9e,cancel:n9e};iP.serialize=h9e});var v_e=v(oP=>{"use strict";Object.defineProperty(oP,"__esModule",{value:!0});oP.BufferReader=void 0;var vV=class{constructor(e=0){this.offset=e,this.buffer=Buffer.allocUnsafe(0),this.encoding="utf-8"}setBuffer(e,r){this.offset=e,this.buffer=r}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+=2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this.buffer.readInt32BE(this.offset);return this.offset+=4,e}uint32(){let e=this.buffer.readUInt32BE(this.offset);return this.offset+=4,e}string(e){let r=this.buffer.toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,r}cstring(){let e=this.offset,r=e;for(;this.buffer[r++]!==0;);return this.offset=r,this.buffer.toString(this.encoding,e,r-1)}bytes(e){let r=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,r}};oP.BufferReader=vV});var w_e=v(sP=>{"use strict";Object.defineProperty(sP,"__esModule",{value:!0});sP.Parser=void 0;var Rt=_V(),m9e=v_e(),bV=1,g9e=4,T_e=bV+g9e,Mn=-1,TV=Buffer.allocUnsafe(0),AV=class{constructor(e){if(this.buffer=TV,this.bufferLength=0,this.bufferOffset=0,this.reader=new m9e.BufferReader,e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?.mode||"text"}parse(e,r){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength,i=this.bufferOffset;for(;i+T_e<=n;){let o=this.buffer[i],s=this.buffer.readUInt32BE(i+bV),a=bV+s;if(a+i<=n){let c=this.handlePacket(i+T_e,o,s,this.buffer);r(c),i+=a}else break}i===n?(this.buffer=TV,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength=n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let r=this.bufferLength+e.byteLength;if(r+this.bufferOffset>this.buffer.byteLength){let i;if(r<=this.buffer.byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let o=this.buffer.byteLength*2;for(;r>=o;)o*=2;i=Buffer.allocUnsafe(o)}this.buffer.copy(i,0,this.bufferOffset,this.bufferOffset+this.bufferLength),this.buffer=i,this.bufferOffset=0}e.copy(this.buffer,this.bufferOffset+this.bufferLength),this.bufferLength=r}else this.buffer=e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,r,n,i){let{reader:o}=this;o.setBuffer(e,i);let s;switch(r){case 50:s=Rt.bindComplete;break;case 49:s=Rt.parseComplete;break;case 51:s=Rt.closeComplete;break;case 110:s=Rt.noData;break;case 115:s=Rt.portalSuspended;break;case 99:s=Rt.copyDone;break;case 87:s=Rt.replicationStart;break;case 73:s=Rt.emptyQuery;break;case 68:s=x9e(o);break;case 67:s=y9e(o);break;case 90:s=_9e(o);break;case 65:s=T9e(o);break;case 82:s=I9e(o,n);break;case 83:s=R9e(o);break;case 75:s=C9e(o);break;case 69:s=b_e(o,"error");break;case 78:s=b_e(o,"notice");break;case 84:s=b9e(o);break;case 116:s=w9e(o);break;case 71:s=E9e(o);break;case 72:s=v9e(o);break;case 100:s=S9e(o,n);break;default:return new Rt.DatabaseError("received invalid response: "+r.toString(16),n,"error")}return o.setBuffer(0,TV),s.length=n,s}};sP.Parser=AV;var _9e=t=>{let e=t.string(1);return new Rt.ReadyForQueryMessage(Mn,e)},y9e=t=>{let e=t.cstring();return new Rt.CommandCompleteMessage(Mn,e)},S9e=(t,e)=>{let r=t.bytes(e-4);return new Rt.CopyDataMessage(Mn,r)},E9e=t=>A_e(t,"copyInResponse"),v9e=t=>A_e(t,"copyOutResponse"),A_e=(t,e)=>{let r=t.byte()!==0,n=t.int16(),i=new Rt.CopyResponse(Mn,e,r,n);for(let o=0;o<n;o++)i.columnTypes[o]=t.int16();return i},T9e=t=>{let e=t.int32(),r=t.cstring(),n=t.cstring();return new Rt.NotificationResponseMessage(Mn,e,r,n)},b9e=t=>{let e=t.int16(),r=new Rt.RowDescriptionMessage(Mn,e);for(let n=0;n<e;n++)r.fields[n]=A9e(t);return r},A9e=t=>{let e=t.cstring(),r=t.uint32(),n=t.int16(),i=t.uint32(),o=t.int16(),s=t.int32(),a=t.int16()===0?"text":"binary";return new Rt.Field(e,r,n,i,o,s,a)},w9e=t=>{let e=t.int16(),r=new Rt.ParameterDescriptionMessage(Mn,e);for(let n=0;n<e;n++)r.dataTypeIDs[n]=t.int32();return r},x9e=t=>{let e=t.int16(),r=new Array(e);for(let n=0;n<e;n++){let i=t.int32();r[n]=i===-1?null:t.string(i)}return new Rt.DataRowMessage(Mn,r)},R9e=t=>{let e=t.cstring(),r=t.cstring();return new Rt.ParameterStatusMessage(Mn,e,r)},C9e=t=>{let e=t.int32(),r=t.int32();return new Rt.BackendKeyDataMessage(Mn,e,r)},I9e=(t,e)=>{let r=t.int32(),n={name:"authenticationOk",length:e};switch(r){case 0:break;case 3:n.length===8&&(n.name="authenticationCleartextPassword");break;case 5:if(n.length===12){n.name="authenticationMD5Password";let i=t.bytes(4);return new Rt.AuthenticationMD5Password(Mn,i)}break;case 10:{n.name="authenticationSASL",n.mechanisms=[];let i;do i=t.cstring(),i&&n.mechanisms.push(i);while(i)}break;case 11:n.name="authenticationSASLContinue",n.data=t.string(e-8);break;case 12:n.name="authenticationSASLFinal",n.data=t.string(e-8);break;default:throw new Error("Unknown authenticationOk message type "+r)}return n},b_e=(t,e)=>{let r={},n=t.string(1);for(;n!=="\0";)r[n]=t.cstring(),n=t.string(1);let i=r.M,o=e==="notice"?new Rt.NoticeMessage(Mn,i):new Rt.DatabaseError(i,Mn,e);return o.severity=r.S,o.code=r.C,o.detail=r.D,o.hint=r.H,o.position=r.P,o.internalPosition=r.p,o.internalQuery=r.q,o.where=r.W,o.schema=r.s,o.table=r.t,o.column=r.c,o.dataType=r.d,o.constraint=r.n,o.file=r.F,o.line=r.L,o.routine=r.R,o}});var wV=v(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});zc.DatabaseError=zc.serialize=zc.parse=void 0;var P9e=_V();Object.defineProperty(zc,"DatabaseError",{enumerable:!0,get:function(){return P9e.DatabaseError}});var O9e=E_e();Object.defineProperty(zc,"serialize",{enumerable:!0,get:function(){return O9e.serialize}});var N9e=w_e();function k9e(t,e){let r=new N9e.Parser;return t.on("data",n=>r.parse(n,e)),new Promise(n=>t.on("end",()=>n()))}zc.parse=k9e});var x_e=v(xV=>{"use strict";Object.defineProperty(xV,"__esModule",{value:!0});xV.default={}});var C_e=v((J6t,R_e)=>{"use strict";var{getStream:M9e,getSecureStream:D9e}=F9e();R_e.exports={getStream:M9e,getSecureStream:D9e};function L9e(){function t(r){let n=Z("net");return new n.Socket}function e(r){return Z("tls").connect(r)}return{getStream:t,getSecureStream:e}}function $9e(){function t(r){let{CloudflareSocket:n}=x_e();return new n(r)}function e(r){return r.socket.startTls(r),r.socket}return{getStream:t,getSecureStream:e}}function U9e(){if(typeof navigator=="object"&&navigator!==null&&typeof navigator.userAgent=="string")return navigator.userAgent==="Cloudflare-Workers";if(typeof Response=="function"){let t=new Response(null,{cf:{thing:!0}});if(typeof t.cf=="object"&&t.cf!==null&&t.cf.thing)return!0}return!1}function F9e(){return U9e()?$9e():L9e()}});var CV=v((X6t,I_e)=>{"use strict";var B9e=Z("events").EventEmitter,{parse:j9e,serialize:or}=wV(),{getStream:z9e,getSecureStream:G9e}=C_e(),q9e=or.flush(),V9e=or.sync(),H9e=or.end(),RV=class extends B9e{constructor(e){super(),e=e||{},this.stream=e.stream||z9e(e.ssl),typeof this.stream=="function"&&(this.stream=this.stream(e)),this._keepAlive=e.keepAlive,this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage=!1;let r=this;this.on("newListener",function(n){n==="message"&&(r._emitMessage=!0)})}connect(e,r){let n=this;this._connecting=!0,this.stream.setNoDelay(!0),this.stream.connect(e,r),this.stream.once("connect",function(){n._keepAlive&&n.stream.setKeepAlive(!0,n._keepAliveInitialDelayMillis),n.emit("connect")});let i=function(o){n._ending&&(o.code==="ECONNRESET"||o.code==="EPIPE")||n.emit("error",o)};if(this.stream.on("error",i),this.stream.on("close",function(){n.emit("end")}),!this.ssl)return this.attachListeners(this.stream);this.stream.once("data",function(o){switch(o.toString("utf8")){case"S":break;case"N":return n.stream.end(),n.emit("error",new Error("The server does not support SSL connections"));default:return n.stream.end(),n.emit("error",new Error("There was an error establishing an SSL connection"))}let a={socket:n.stream};n.ssl!==!0&&(Object.assign(a,n.ssl),"key"in n.ssl&&(a.key=n.ssl.key));let c=Z("net");c.isIP&&c.isIP(r)===0&&(a.servername=r);try{n.stream=G9e(a)}catch(l){return n.emit("error",l)}n.attachListeners(n.stream),n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){j9e(e,r=>{let n=r.name==="error"?"errorMessage":r.name;this._emitMessage&&this.emit("message",r),this.emit(n,r)})}requestSsl(){this.stream.write(or.requestSsl())}startup(e){this.stream.write(or.startup(e))}cancel(e,r){this._send(or.cancel(e,r))}password(e){this._send(or.password(e))}sendSASLInitialResponseMessage(e,r){this._send(or.sendSASLInitialResponseMessage(e,r))}sendSCRAMClientFinalMessage(e){this._send(or.sendSCRAMClientFinalMessage(e))}_send(e){return this.stream.writable?this.stream.write(e):!1}query(e){this._send(or.query(e))}parse(e){this._send(or.parse(e))}bind(e){this._send(or.bind(e))}execute(e){this._send(or.execute(e))}flush(){this.stream.writable&&this.stream.write(q9e)}sync(){this._ending=!0,this._send(V9e)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this.stream.end();return}return this.stream.write(H9e,()=>{this.stream.end()})}close(e){this._send(or.close(e))}describe(e){this._send(or.describe(e))}sendCopyFromChunk(e){this._send(or.copyData(e))}endCopyFrom(){this._send(or.copyDone())}sendCopyFail(e){this._send(or.copyFail(e))}};I_e.exports=RV});var k_e=v((Q6t,N_e)=>{"use strict";var{Transform:W9e}=Z("stream"),{StringDecoder:Y9e}=Z("string_decoder"),Gc=Symbol("last"),aP=Symbol("decoder");function K9e(t,e,r){let n;if(this.overflow){if(n=this[aP].write(t).split(this.matcher),n.length===1)return r();n.shift(),this.overflow=!1}else this[Gc]+=this[aP].write(t),n=this[Gc].split(this.matcher);this[Gc]=n.pop();for(let i=0;i<n.length;i++)try{O_e(this,this.mapper(n[i]))}catch(o){return r(o)}if(this.overflow=this[Gc].length>this.maxLength,this.overflow&&!this.skipOverflow){r(new Error("maximum buffer reached"));return}r()}function Z9e(t){if(this[Gc]+=this[aP].end(),this[Gc])try{O_e(this,this.mapper(this[Gc]))}catch(e){return t(e)}t()}function O_e(t,e){e!==void 0&&t.push(e)}function P_e(t){return t}function J9e(t,e,r){switch(t=t||/\r?\n/,e=e||P_e,r=r||{},arguments.length){case 1:typeof t=="function"?(e=t,t=/\r?\n/):typeof t=="object"&&!(t instanceof RegExp)&&!t[Symbol.split]&&(r=t,t=/\r?\n/);break;case 2:typeof t=="function"?(r=e,e=t,t=/\r?\n/):typeof e=="object"&&(r=e,e=P_e)}r=Object.assign({},r),r.autoDestroy=!0,r.transform=K9e,r.flush=Z9e,r.readableObjectMode=!0;let n=new W9e(r);return n[Gc]="",n[aP]=new Y9e("utf8"),n.matcher=t,n.mapper=e,n.maxLength=r.maxLength,n.skipOverflow=r.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,o){this._writableState.errorEmitted=!1,o(i)},n}N_e.exports=J9e});var L_e=v((eWt,Qs)=>{"use strict";var M_e=Z("path"),X9e=Z("stream").Stream,Q9e=k_e(),D_e=Z("util"),eJe=5432,cP=process.platform==="win32",eE=process.stderr,tJe=56,rJe=7,nJe=61440,iJe=32768;function oJe(t){return(t&nJe)==iJe}var fm=["host","port","database","user","password"],IV=fm.length,sJe=fm[IV-1];function PV(){var t=eE instanceof X9e&&eE.writable===!0;if(t){var e=Array.prototype.slice.call(arguments).concat(`
32
- `);eE.write(D_e.format.apply(D_e,e))}}Object.defineProperty(Qs.exports,"isWin",{get:function(){return cP},set:function(t){cP=t}});Qs.exports.warnTo=function(t){var e=eE;return eE=t,e};Qs.exports.getFileName=function(t){var e=t||process.env,r=e.PGPASSFILE||(cP?M_e.join(e.APPDATA||"./","postgresql","pgpass.conf"):M_e.join(e.HOME||"./",".pgpass"));return r};Qs.exports.usePgPass=function(t,e){return Object.prototype.hasOwnProperty.call(process.env,"PGPASSWORD")?!1:cP?!0:(e=e||"<unkn>",oJe(t.mode)?t.mode&(tJe|rJe)?(PV('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less',e),!1):!0:(PV('WARNING: password file "%s" is not a plain file',e),!1))};var aJe=Qs.exports.match=function(t,e){return fm.slice(0,-1).reduce(function(r,n,i){return i==1&&Number(t[n]||eJe)===Number(e[n])?r&&!0:r&&(e[n]==="*"||e[n]===t[n])},!0)};Qs.exports.getPassword=function(t,e,r){var n,i=e.pipe(Q9e());function o(c){var l=cJe(c);l&&lJe(l)&&aJe(t,l)&&(n=l[sJe],i.end())}var s=function(){e.destroy(),r(n)},a=function(c){e.destroy(),PV("WARNING: error on reading file: %s",c),r(void 0)};e.on("error",a),i.on("data",o).on("end",s).on("error",a)};var cJe=Qs.exports.parseLine=function(t){if(t.length<11||t.match(/^\s+#/))return null;for(var e="",r="",n=0,i=0,o=0,s={},a=!1,c=function(u,d,f){var p=t.substring(d,f);Object.hasOwnProperty.call(process.env,"PGPASS_NO_DEESCAPE")||(p=p.replace(/\\([:\\])/g,"$1")),s[fm[u]]=p},l=0;l<t.length-1;l+=1){if(e=t.charAt(l+1),r=t.charAt(l),a=n==IV-1,a){c(n,i);break}l>=0&&e==":"&&r!=="\\"&&(c(n,i,l+1),i=l+2,n+=1)}return s=Object.keys(s).length===IV?s:null,s},lJe=Qs.exports.isValidEntry=function(t){for(var e={0:function(s){return s.length>0},1:function(s){return s==="*"?!0:(s=Number(s),isFinite(s)&&s>0&&s<9007199254740992&&Math.floor(s)===s)},2:function(s){return s.length>0},3:function(s){return s.length>0},4:function(s){return s.length>0}},r=0;r<fm.length;r+=1){var n=e[r],i=t[fm[r]]||"",o=n(i);if(!o)return!1}return!0}});var U_e=v((rWt,OV)=>{"use strict";var tWt=Z("path"),$_e=Z("fs"),lP=L_e();OV.exports=function(t,e){var r=lP.getFileName();$_e.stat(r,function(n,i){if(n||!lP.usePgPass(i,r))return e(void 0);var o=$_e.createReadStream(r);lP.getPassword(t,o,e)})};OV.exports.warnTo=lP.warnTo});var G_e=v((nWt,z_e)=>{"use strict";var uJe=Z("events").EventEmitter,F_e=cm(),tE=Z("util"),uP=i_e(),dJe=tP(),fJe=Qq(),j_e=__e(),pJe=XS(),hJe=CV(),mJe=Yq(),B_e=tE.deprecate(()=>{},"Client.activeQuery is deprecated and will be removed in pg@9.0"),gJe=tE.deprecate(()=>{},"Client.queryQueue is deprecated and will be removed in pg@9.0."),_Je=tE.deprecate(()=>{},"pgpass support is deprecated and will be removed in pg@9.0. You can provide an async function as the password property to the Client/Pool constructor that returns a password instead. Within this function you can call the pgpass module in your own code."),yJe=tE.deprecate(()=>{},"Passing a custom Promise implementation to the Client/Pool constructor is deprecated and will be removed in pg@9.0."),SJe=tE.deprecate(()=>{},"Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.");function EJe(t,e){if(typeof t=="number")return Number.isFinite(t)?t:e;if(typeof t=="string"&&t.trim()!==""){let r=Number(t);return Number.isFinite(r)?r:e}return e}var dP=class extends uJe{constructor(e){super(),this.connectionParameters=new fJe(e),this.user=this.connectionParameters.user,this.database=this.connectionParameters.database,this.port=this.connectionParameters.port,this.host=this.connectionParameters.host,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}),this.replication=this.connectionParameters.replication;let r=e||{};r.Promise&&yJe(),this._Promise=r.Promise||global.Promise,this._types=new dJe(r.types),this._ending=!1,this._ended=!1,this._connecting=!1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this._activeQuery=null,this._txStatus=null,this.enableChannelBinding=!!r.enableChannelBinding,this.scramMaxIterations=EJe(r.scramMaxIterations,uP.DEFAULT_MAX_SCRAM_ITERATIONS),this.connection=r.connection||new hJe({stream:r.stream,ssl:this.connectionParameters.ssl,keepAlive:r.keepAlive||!1,keepAliveInitialDelayMillis:r.keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding||"utf8"}),this._queryQueue=[],this.binary=r.binary||pJe.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this._connectionTimeoutMillis=r.connectionTimeoutMillis||0}get activeQuery(){return B_e(),this._activeQuery}set activeQuery(e){B_e(),this._activeQuery=e}_getActiveQuery(){return this._activeQuery}_errorAllQueries(e){let r=i=>{process.nextTick(()=>{i.handleError(e,this.connection)})},n=this._getActiveQuery();n&&(r(n),this._activeQuery=null),this._queryQueue.forEach(r),this._queryQueue.length=0}_connect(e){let r=this,n=this.connection;if(this._connectionCallback=e,this._connecting||this._connected){let i=new Error("Client has already been connected. You cannot reuse a client.");process.nextTick(()=>{e(i)});return}this._connecting=!0,this._connectionTimeoutMillis>0&&(this.connectionTimeoutHandle=setTimeout(()=>{n._ending=!0,n.stream.destroy(new Error("timeout expired"))},this._connectionTimeoutMillis),this.connectionTimeoutHandle.unref&&this.connectionTimeoutHandle.unref()),this.host&&this.host.indexOf("/")===0?n.connect(this.host+"/.s.PGSQL."+this.port):n.connect(this.port,this.host),n.on("connect",function(){r.ssl?n.requestSsl():n.startup(r.getStartupConf())}),n.on("sslconnect",function(){n.startup(r.getStartupConf())}),this._attachListeners(n),n.once("end",()=>{let i=this._ending?new Error("Connection terminated"):new Error("Connection terminated unexpectedly");clearTimeout(this.connectionTimeoutHandle),this._errorAllQueries(i),this._ended=!0,this._ending||(this._connecting&&!this._connectionError?this._connectionCallback?this._connectionCallback(i):this._handleErrorEvent(i):this._connectionError||this._handleErrorEvent(i)),process.nextTick(()=>{this.emit("end")})})}connect(e){if(e){this._connect(e);return}return new this._Promise((r,n)=>{this._connect(i=>{i?n(i):r(this)})})}_attachListeners(e){e.on("authenticationCleartextPassword",this._handleAuthCleartextPassword.bind(this)),e.on("authenticationMD5Password",this._handleAuthMD5Password.bind(this)),e.on("authenticationSASL",this._handleAuthSASL.bind(this)),e.on("authenticationSASLContinue",this._handleAuthSASLContinue.bind(this)),e.on("authenticationSASLFinal",this._handleAuthSASLFinal.bind(this)),e.on("backendKeyData",this._handleBackendKeyData.bind(this)),e.on("error",this._handleErrorEvent.bind(this)),e.on("errorMessage",this._handleErrorMessage.bind(this)),e.on("readyForQuery",this._handleReadyForQuery.bind(this)),e.on("notice",this._handleNotice.bind(this)),e.on("rowDescription",this._handleRowDescription.bind(this)),e.on("dataRow",this._handleDataRow.bind(this)),e.on("portalSuspended",this._handlePortalSuspended.bind(this)),e.on("emptyQuery",this._handleEmptyQuery.bind(this)),e.on("commandComplete",this._handleCommandComplete.bind(this)),e.on("parseComplete",this._handleParseComplete.bind(this)),e.on("copyInResponse",this._handleCopyInResponse.bind(this)),e.on("copyData",this._handleCopyData.bind(this)),e.on("notification",this._handleNotification.bind(this))}_getPassword(e){let r=this.connection;if(typeof this.password=="function")this._Promise.resolve().then(()=>this.password(this.connectionParameters)).then(n=>{if(n!==void 0){if(typeof n!="string"){r.emit("error",new TypeError("Password must be a string"));return}this.connectionParameters.password=this.password=n}else this.connectionParameters.password=this.password=null;e()}).catch(n=>{r.emit("error",n)});else if(this.password!==null)e();else try{U_e()(this.connectionParameters,i=>{i!==void 0&&(_Je(),this.connectionParameters.password=this.password=i),e()})}catch(n){this.emit("error",n)}}_handleAuthCleartextPassword(e){this._getPassword(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){this._getPassword(async()=>{try{let r=await mJe.postgresMd5PasswordHash(this.user,this.password,e.salt);this.connection.password(r)}catch(r){this.emit("error",r)}})}_handleAuthSASL(e){this._getPassword(()=>{try{this.saslSession=uP.startSession(e.mechanisms,this.enableChannelBinding&&this.connection.stream,this.scramMaxIterations),this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism,this.saslSession.response)}catch(r){this.connection.emit("error",r)}})}async _handleAuthSASLContinue(e){try{await uP.continueSession(this.saslSession,this.password,e.data,this.enableChannelBinding&&this.connection.stream),this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}catch(r){this.connection.emit("error",r)}}_handleAuthSASLFinal(e){try{uP.finalizeSession(this.saslSession,e.data),this.saslSession=null}catch(r){this.connection.emit("error",r)}}_handleBackendKeyData(e){this.processID=e.processID,this.secretKey=e.secretKey}_handleReadyForQuery(e){this._connecting&&(this._connecting=!1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback&&(this._connectionCallback(null,this),this._connectionCallback=null),this.emit("connect"));let r=this._getActiveQuery();this._activeQuery=null,this._txStatus=e?.status??null,this.readyForQuery=!0,r&&r.handleReadyForQuery(this.connection),this._pulseQueryQueue()}_handleErrorWhileConnecting(e){if(!this._connectionError){if(this._connectionError=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback)return this._connectionCallback(e);this.emit("error",e)}}_handleErrorEvent(e){if(this._connecting)return this._handleErrorWhileConnecting(e);this._queryable=!1,this._errorAllQueries(e),this.emit("error",e)}_handleErrorMessage(e){if(this._connecting)return this._handleErrorWhileConnecting(e);let r=this._getActiveQuery();if(!r){this._handleErrorEvent(e);return}this._activeQuery=null,r.handleError(e,this.connection)}_handleRowDescription(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected rowDescription message from backend.");this._handleErrorEvent(n);return}r.handleRowDescription(e)}_handleDataRow(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected dataRow message from backend.");this._handleErrorEvent(n);return}r.handleDataRow(e)}_handlePortalSuspended(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected portalSuspended message from backend.");this._handleErrorEvent(n);return}r.handlePortalSuspended(this.connection)}_handleEmptyQuery(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected emptyQuery message from backend.");this._handleErrorEvent(n);return}r.handleEmptyQuery(this.connection)}_handleCommandComplete(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected commandComplete message from backend.");this._handleErrorEvent(n);return}r.handleCommandComplete(e,this.connection)}_handleParseComplete(){let e=this._getActiveQuery();if(e==null){let r=new Error("Received unexpected parseComplete message from backend.");this._handleErrorEvent(r);return}e.name&&(this.connection.parsedStatements[e.name]=e.text)}_handleCopyInResponse(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected copyInResponse message from backend.");this._handleErrorEvent(n);return}r.handleCopyInResponse(this.connection)}_handleCopyData(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected copyData message from backend.");this._handleErrorEvent(n);return}r.handleCopyData(e,this.connection)}_handleNotification(e){this.emit("notification",e)}_handleNotice(e){this.emit("notice",e)}getStartupConf(){let e=this.connectionParameters,r={user:e.user,database:e.database},n=e.application_name||e.fallback_application_name;return n&&(r.application_name=n),e.replication&&(r.replication=""+e.replication),e.statement_timeout&&(r.statement_timeout=String(parseInt(e.statement_timeout,10))),e.lock_timeout&&(r.lock_timeout=String(parseInt(e.lock_timeout,10))),e.idle_in_transaction_session_timeout&&(r.idle_in_transaction_session_timeout=String(parseInt(e.idle_in_transaction_session_timeout,10))),e.options&&(r.options=e.options),r}cancel(e,r){if(e.activeQuery===r){let n=this.connection;this.host&&this.host.indexOf("/")===0?n.connect(this.host+"/.s.PGSQL."+this.port):n.connect(this.port,this.host),n.on("connect",function(){n.cancel(e.processID,e.secretKey)})}else e._queryQueue.indexOf(r)!==-1&&e._queryQueue.splice(e._queryQueue.indexOf(r),1)}setTypeParser(e,r,n){return this._types.setTypeParser(e,r,n)}getTypeParser(e,r){return this._types.getTypeParser(e,r)}escapeIdentifier(e){return F_e.escapeIdentifier(e)}escapeLiteral(e){return F_e.escapeLiteral(e)}_pulseQueryQueue(){if(this.readyForQuery===!0){this._activeQuery=this._queryQueue.shift();let e=this._getActiveQuery();if(e){this.readyForQuery=!1,this.hasExecuted=!0;let r=e.submit(this.connection);r&&process.nextTick(()=>{e.handleError(r,this.connection),this.readyForQuery=!0,this._pulseQueryQueue()})}else this.hasExecuted&&(this._activeQuery=null,this.emit("drain"))}}query(e,r,n){let i,o;if(e==null)throw new TypeError("Client was passed a null or undefined query");if(typeof e.submit=="function")o=i=e,i.callback||(typeof r=="function"?i.callback=r:n&&(i.callback=n));else if(i=new j_e(e,r,n),!i.callback)o=new this._Promise((a,c)=>{i.callback=(l,u)=>l?c(l):a(u)}).catch(a=>{throw Error.captureStackTrace(a),a});else if(typeof i.callback!="function")throw new TypeError("callback is not a function");let s=e.query_timeout||this.connectionParameters.query_timeout;if(s){let a=i.callback||(()=>{}),c=setTimeout(()=>{let l=new Error("Query read timeout");process.nextTick(()=>{i.handleError(l,this.connection)}),a(l),i.callback=()=>{};let u=this._queryQueue.indexOf(i);u>-1&&this._queryQueue.splice(u,1),this._pulseQueryQueue()},s);i.callback=(l,u)=>{clearTimeout(c),a(l,u)}}return this.binary&&!i.binary&&(i.binary=!0),i._result&&!i._result._types&&(i._result._types=this._types),this._queryable?this._ending?(process.nextTick(()=>{i.handleError(new Error("Client was closed and is not queryable"),this.connection)}),o):(this._queryQueue.length>0&&SJe(),this._queryQueue.push(i),this._pulseQueryQueue(),o):(process.nextTick(()=>{i.handleError(new Error("Client has encountered a connection error and is not queryable"),this.connection)}),o)}ref(){this.connection.ref()}unref(){this.connection.unref()}getTransactionStatus(){return this._txStatus}end(e){if(this._ending=!0,!this.connection._connecting||this._ended)if(e){e();return}else return this._Promise.resolve();if(this._getActiveQuery()||!this._queryable?this.connection.stream.destroy():this.connection.end(),e)this.connection.once("end",e);else return new this._Promise(r=>{this.connection.once("end",r)})}get queryQueue(){return gJe(),this._queryQueue}};dP.Query=j_e;z_e.exports=dP});var H_e=v((iWt,V_e)=>{"use strict";var vJe=Z("events").EventEmitter,NV=function(){},q_e=(t,e)=>{let r=t.findIndex(e);return r===-1?void 0:t.splice(r,1)[0]},kV=class{constructor(e,r,n){this.client=e,this.idleListener=r,this.timeoutId=n}},pm=class{constructor(e){this.callback=e}};function TJe(){throw new Error("Release called on client which has already been released to the pool.")}function fP(t,e){if(e)return{callback:e,result:void 0};let r,n,i=function(s,a){s?r(s):n(a)},o=new t(function(s,a){n=s,r=a}).catch(s=>{throw Error.captureStackTrace(s),s});return{callback:i,result:o}}function bJe(t,e){return function r(n){n.client=e,e.removeListener("error",r),e.on("error",()=>{t.log("additional client error after disconnection due to error",n)}),t._remove(e),t.emit("error",n,e)}}var MV=class extends vJe{constructor(e,r){super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}),this.options.max=this.options.max||this.options.poolSize||10,this.options.min=this.options.min||0,this.options.maxUses=this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this.Client=this.options.Client||r||DV().Client,this.Promise=this.options.Promise||global.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this.options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_promiseTry(e){let r=this.Promise;return typeof r.try=="function"?r.try(e):new r(n=>n(e()))}_isFull(){return this._clients.length>=this.options.max}_isAboveMin(){return this._clients.length>this.options.min}_pulseQueue(){if(this.log("pulse queue"),this.ended){this.log("pulse queue ended");return}if(this.ending){this.log("pulse queue on ending"),this._idle.length&&this._idle.slice().map(r=>{this._remove(r.client)}),this._clients.length||(this.ended=!0,this._endCallback());return}if(!this._pendingQueue.length){this.log("no queued requests");return}if(!this._idle.length&&this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let r=this._idle.pop();clearTimeout(r.timeoutId);let n=r.client;n.ref&&n.ref();let i=r.idleListener;return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e);throw new Error("unexpected condition")}_remove(e,r){let n=q_e(this._idle,o=>o.client===e);n!==void 0&&clearTimeout(n.timeoutId),this._clients=this._clients.filter(o=>o!==e);let i=this;e.end(()=>{i.emit("remove",e),typeof r=="function"&&r()})}connect(e){if(this.ending){let i=new Error("Cannot use a pool after calling end on the pool");return e?e(i):this.Promise.reject(i)}let r=fP(this.Promise,e),n=r.result;if(this._isFull()||this._idle.length){if(this._idle.length&&process.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis)return this._pendingQueue.push(new pm(r.callback)),n;let i=(a,c,l)=>{clearTimeout(s),r.callback(a,c,l)},o=new pm(i),s=setTimeout(()=>{q_e(this._pendingQueue,a=>a.callback===i),o.timedOut=!0,r.callback(new Error("timeout exceeded when trying to connect"))},this.options.connectionTimeoutMillis);return s.unref&&s.unref(),this._pendingQueue.push(o),n}return this.newClient(new pm(r.callback)),n}newClient(e){let r=new this.Client(this.options);this._clients.push(r);let n=bJe(this,r);this.log("checking client timeout");let i,o=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{r.connection?(this.log("ending client due to timeout"),o=!0,r.connection.stream.destroy()):r.isConnected()||(this.log("ending client due to timeout"),o=!0,r.end())},this.options.connectionTimeoutMillis)),this.log("connecting new client"),r.connect(s=>{if(i&&clearTimeout(i),r.on("error",n),s)this.log("client failed to connect",s),this._clients=this._clients.filter(a=>a!==r),o&&(s=new Error("Connection terminated due to connection timeout",{cause:s})),this._pulseQueue(),e.timedOut||e.callback(s,void 0,NV);else{if(this.log("new client connected"),this.options.onConnect){this._promiseTry(()=>this.options.onConnect(r)).then(()=>{this._afterConnect(r,e,n)},a=>{this._clients=this._clients.filter(c=>c!==r),r.end(()=>{this._pulseQueue(),e.timedOut||e.callback(a,void 0,NV)})});return}return this._afterConnect(r,e,n)}})}_afterConnect(e,r,n){if(this.options.maxLifetimeSeconds!==0){let i=setTimeout(()=>{this.log("ending client due to expired lifetime"),this._expired.add(e),this._idle.findIndex(s=>s.client===e)!==-1&&this._acquireClient(e,new pm((s,a,c)=>c()),n,!1)},this.options.maxLifetimeSeconds*1e3);i.unref(),e.once("end",()=>clearTimeout(i))}return this._acquireClient(e,r,n,!0)}_acquireClient(e,r,n,i){i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n),e.removeListener("error",n),r.timedOut?i&&this.options.verify?this.options.verify(e,e.release):e.release():i&&this.options.verify?this.options.verify(e,o=>{if(o)return e.release(o),r.callback(o,void 0,NV);r.callback(void 0,e,e.release)}):r.callback(void 0,e,e.release)}_releaseOnce(e,r){let n=!1;return i=>{n&&TJe(),n=!0,this._release(e,r,i)}}_release(e,r,n){if(e.on("error",r),e._poolUseCount=(e._poolUseCount||0)+1,this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>=this.options.maxUses)return e._poolUseCount>=this.options.maxUses&&this.log("remove expended client"),this._remove(e,this._pulseQueue.bind(this));if(this._expired.has(e))return this.log("remove expired client"),this._expired.delete(e),this._remove(e,this._pulseQueue.bind(this));let o;this.options.idleTimeoutMillis&&this._isAboveMin()&&(o=setTimeout(()=>{this._isAboveMin()&&(this.log("remove idle client"),this._remove(e,this._pulseQueue.bind(this)))},this.options.idleTimeoutMillis),this.options.allowExitOnIdle&&o.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new kV(e,r,o)),this._pulseQueue()}query(e,r,n){if(typeof e=="function"){let o=fP(this.Promise,e);return setImmediate(function(){return o.callback(new Error("Passing a function as the first parameter to pool.query is not supported"))}),o.result}typeof r=="function"&&(n=r,r=void 0);let i=fP(this.Promise,n);return n=i.callback,this.connect((o,s)=>{if(o)return n(o);let a=!1,c=l=>{a||(a=!0,s.release(l),n(l))};s.once("error",c),this.log("dispatching query");try{s.query(e,r,(l,u)=>{if(this.log("query dispatched"),s.removeListener("error",c),!a)return a=!0,s.release(l),l?n(l):n(void 0,u)})}catch(l){return s.release(l),n(l)}}),i.result}end(e){if(this.log("ending"),this.ending){let n=new Error("Called end on pool more than once");return e?e(n):this.Promise.reject(n)}this.ending=!0;let r=fP(this.Promise,e);return this._endCallback=r.callback,this._pulseQueue(),r.result}get waitingCount(){return this._pendingQueue.length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients.reduce((e,r)=>e+(this._expired.has(r)?1:0),0)}get totalCount(){return this._clients.length}};V_e.exports=MV});var K_e=v((oWt,Y_e)=>{"use strict";var W_e=Z("events").EventEmitter,AJe=Z("util"),LV=cm(),hm=Y_e.exports=function(t,e,r){W_e.call(this),t=LV.normalizeQueryConfig(t,e,r),this.text=t.text,this.values=t.values,this.name=t.name,this.queryMode=t.queryMode,this.callback=t.callback,this.state="new",this._arrayMode=t.rowMode==="array",this._emitRowEvents=!1,this.on("newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};AJe.inherits(hm,W_e);var wJe={sqlState:"code",statementPosition:"position",messagePrimary:"message",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"routine"};hm.prototype.handleError=function(t){let e=this.native.pq.resultErrorFields();if(e)for(let r in e){let n=wJe[r]||r;t[n]=e[r]}this.callback?this.callback(t):this.emit("error",t),this.state="error"};hm.prototype.then=function(t,e){return this._getPromise().then(t,e)};hm.prototype.catch=function(t){return this._getPromise().catch(t)};hm.prototype._getPromise=function(){return this._promise?this._promise:(this._promise=new Promise(function(t,e){this._once("end",t),this._once("error",e)}.bind(this)),this._promise)};hm.prototype.submit=function(t){this.state="running";let e=this;this.native=t.native,t.native.arrayMode=this._arrayMode;let r=function(n,i,o){if(t.native.arrayMode=!1,setImmediate(function(){e.emit("_done")}),n)return e.handleError(n);e._emitRowEvents&&(o.length>1?i.forEach((s,a)=>{s.forEach(c=>{e.emit("row",c,o[a])})}):i.forEach(function(s){e.emit("row",s,o)})),e.state="end",e.emit("end",o),e.callback&&e.callback(null,o)};if(process.domain&&(r=process.domain.bind(r)),this.name){this.name.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",this.name,this.name.length),console.error("This can cause conflicts and silent errors executing queries"));let n=(this.values||[]).map(LV.prepareValue);if(t.namedQueries[this.name]){if(this.text&&t.namedQueries[this.name]!==this.text){let i=new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);return r(i)}return t.native.execute(this.name,n,r)}return t.native.prepare(this.name,this.text,n.length,function(i){return i?r(i):(t.namedQueries[e.name]=e.text,e.native.execute(e.name,n,r))})}else if(this.values){if(!Array.isArray(this.values)){let i=new Error("Query values must be an array");return r(i)}let n=this.values.map(LV.prepareValue);t.native.query(this.text,n,r)}else this.queryMode==="extended"?t.native.query(this.text,[],r):t.native.query(this.text,r)}});var eye=v((sWt,Q_e)=>{"use strict";var xJe=Z("util"),Z_e;try{Z_e=Z("pg-native")}catch(t){throw t}var RJe=tP(),J_e=Z("events").EventEmitter,CJe=Z("util"),IJe=Qq(),X_e=K_e(),PJe=xJe.deprecate(()=>{},"Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead."),Or=Q_e.exports=function(t){J_e.call(this),t=t||{},this._Promise=t.Promise||global.Promise,this._types=new RJe(t.types),this.native=new Z_e({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting=!1,this._connected=!1,this._queryable=!0;let e=this.connectionParameters=new IJe(t);t.nativeConnectionString&&(e.nativeConnectionString=t.nativeConnectionString),this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port=e.port,this.namedQueries={}};Or.Query=X_e;CJe.inherits(Or,J_e);Or.prototype._errorAllQueries=function(t){let e=r=>{process.nextTick(()=>{r.native=this.native,r.handleError(t)})};this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery=null),this._queryQueue.forEach(e),this._queryQueue.length=0};Or.prototype._connect=function(t){let e=this;if(this._connecting){process.nextTick(()=>t(new Error("Client has already been connected. You cannot reuse a client.")));return}this._connecting=!0,this.connectionParameters.getLibpqConnectionString(function(r,n){if(e.connectionParameters.nativeConnectionString&&(n=e.connectionParameters.nativeConnectionString),r)return t(r);e.native.connect(n,function(i){if(i)return e.native.end(),t(i);e._connected=!0,e.native.on("error",function(o){e._queryable=!1,e._errorAllQueries(o),e.emit("error",o)}),e.native.on("notification",function(o){e.emit("notification",{channel:o.relname,payload:o.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),t(null,this)})})};Or.prototype.connect=function(t){if(t){this._connect(t);return}return new this._Promise((e,r)=>{this._connect(n=>{n?r(n):e(this)})})};Or.prototype.query=function(t,e,r){let n,i,o,s,a;if(t==null)throw new TypeError("Client was passed a null or undefined query");if(typeof t.submit=="function")o=t.query_timeout||this.connectionParameters.query_timeout,i=n=t,typeof e=="function"&&(t.callback=e);else if(o=t.query_timeout||this.connectionParameters.query_timeout,n=new X_e(t,e,r),!n.callback){let c,l;i=new this._Promise((u,d)=>{c=u,l=d}).catch(u=>{throw Error.captureStackTrace(u),u}),n.callback=(u,d)=>u?l(u):c(d)}return o&&(a=n.callback||(()=>{}),s=setTimeout(()=>{let c=new Error("Query read timeout");process.nextTick(()=>{n.handleError(c,this.connection)}),a(c),n.callback=()=>{};let l=this._queryQueue.indexOf(n);l>-1&&this._queryQueue.splice(l,1),this._pulseQueryQueue()},o),n.callback=(c,l)=>{clearTimeout(s),a(c,l)}),this._queryable?this._ending?(n.native=this.native,process.nextTick(()=>{n.handleError(new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.length>0&&PJe(),this._queryQueue.push(n),this._pulseQueryQueue(),i):(n.native=this.native,process.nextTick(()=>{n.handleError(new Error("Client has encountered a connection error and is not queryable"))}),i)};Or.prototype.end=function(t){let e=this;this._ending=!0,this._connecting&&!this._connected&&this.once("connect",()=>{this.end(()=>{})});let r;return t||(r=new this._Promise(function(n,i){t=o=>o?i(o):n()})),this.native.end(function(){e._connected=!1,e._errorAllQueries(new Error("Connection terminated")),process.nextTick(()=>{e.emit("end"),t&&t()})}),r};Or.prototype._hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="error"&&this._activeQuery.state!=="end"};Or.prototype._pulseQueryQueue=function(t){if(!this._connected||this._hasActiveQuery())return;let e=this._queryQueue.shift();if(!e){t||this.emit("drain");return}this._activeQuery=e,e.submit(this);let r=this;e.once("_done",function(){r._pulseQueryQueue()})};Or.prototype.cancel=function(t){this._activeQuery===t?this.native.cancel(function(){}):this._queryQueue.indexOf(t)!==-1&&this._queryQueue.splice(this._queryQueue.indexOf(t),1)};Or.prototype.ref=function(){};Or.prototype.unref=function(){};Or.prototype.setTypeParser=function(t,e,r){return this._types.setTypeParser(t,e,r)};Or.prototype.getTypeParser=function(t,e){return this._types.getTypeParser(t,e)};Or.prototype.isConnected=function(){return this._connected};Or.prototype.getTransactionStatus=function(){return this.native.getTransactionStatus()}});var $V=v((aWt,tye)=>{"use strict";tye.exports=eye()});var DV=v((lWt,pP)=>{"use strict";var OJe=G_e(),NJe=XS(),kJe=CV(),MJe=tV(),DJe=cm(),LJe=H_e(),$Je=tP(),{DatabaseError:UJe}=wV(),{escapeIdentifier:FJe,escapeLiteral:BJe}=cm(),jJe=t=>class extends LJe{constructor(r){super(r,t)}},rye=function(t){this.defaults=NJe,this.Client=t,this.Query=this.Client.Query,this.Pool=jJe(this.Client),this._pools=[],this.Connection=kJe,this.types=JS(),this.DatabaseError=UJe,this.TypeOverrides=$Je,this.escapeIdentifier=FJe,this.escapeLiteral=BJe,this.Result=MJe,this.utils=DJe},nye=OJe,iye=!1;try{iye=!!process.env.NODE_PG_FORCE_NATIVE}catch{}iye&&(nye=$V());pP.exports=new rye(nye);Object.defineProperty(pP.exports,"native",{configurable:!0,enumerable:!1,get(){let t=null;try{t=new rye($V())}catch(e){if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(pP.exports,"native",{value:t}),t}})});import{createRequire as uXe}from"module";import{setTimeout as ENe}from"timers/promises";Se();import MEe from"process";Se();var nSe=(t,e)=>{e.recordException(t),e.setStatus({code:Er.ERROR})};var qo=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:o,ctx:s,fn:a}=LH(r,n,i);return this._tracer.startActiveSpan(e,o,s,c=>$H(c,o,a))}withSpan(e,r,n,i){let{opts:o,ctx:s,fn:a}=LH(r,n,i),c=this._tracer.startSpan(e,o,s);return $H(c,o,a)}};function LH(t,e,r){let n,i,o;return!e&&!r?o=t:r?(n=t,i=e,o=r):(n=t,o=e),n=n??{},i=i??pt.active(),{opts:n,ctx:i,fn:o}}function $H(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:nSe,o=s=>{throw i(s,t),t.end(),s};try{let s=r(t);return typeof s?.then=="function"?s.then(a=>(t.end(),a),o):(t.end(),s)}catch(s){throw o(s)}}Se();var Xu=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var ZP=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=WH(e),n._asyncAttributesPending=e.filter(([i,o])=>Xu(o)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>(Xu(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=WH(this._rawAttributes),this._schemaUrl=iSe(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,Xu(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&J.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(Xu(n)){J.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=oSe(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function JP(t,e){return ZP.FromAttributeList(Object.entries(t),e)}function WH(t){return t.map(([e,r])=>Xu(r)?[e,r.catch(n=>{J.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function iSe(t){if(typeof t=="string"||t===void 0)return t;J.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function oSe(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;J.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Se();var Im=class{emit(e){}enabled(){return!1}},YH=new Im;var Pm=Symbol.for("io.opentelemetry.js.api.logs"),Qu=globalThis;function KH(t,e,r){return n=>n===t?e:r}var XP=1;var QP=class{getLogger(e,r,n){return new Im}},RE=new QP;var CE=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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):YH}};var Om=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new CE(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:RE}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var IE=class t{constructor(){this._proxyLoggerProvider=new Om}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Qu[Pm]?this.getLoggerProvider():(Qu[Pm]=KH(XP,e,RE),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Qu[Pm])===null||e===void 0?void 0:e.call(Qu,XP))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Qu[Pm],this._proxyLoggerProvider=new Om}};var ZH=IE.getInstance();function JH(t,e,r,n){for(let i=0,o=t.length;i<o;i++){let s=t[i];e&&s.setTracerProvider(e),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function XH(t){t.forEach(e=>e.disable())}function e0(t){let e=t.tracerProvider||ot.getTracerProvider(),r=t.meterProvider||Cm.getMeterProvider(),n=t.loggerProvider||ZH.getLoggerProvider(),i=t.instrumentations?.flat()??[];return JH(i,e,r,n),()=>{XH(i)}}Se();var sSe=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function QH(t){return t.getValue(sSe)===!0}var ed;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(ed||(ed={}));Se();var t0="[_0-9a-z-*/]",aSe=`[a-z]${t0}{0,255}`,cSe=`[a-z0-9]${t0}{0,240}@[a-z]${t0}{0,13}`,lSe=new RegExp(`^(?:${aSe}|${cSe})$`),uSe=/^[ -~]{0,255}[!-~]$/,dSe=/,|=/;function r0(t){return lSe.test(t)}function n0(t){return uSe.test(t)&&!dSe.test(t)}var fSe=32,e6=512,t6=",",r6="=",PE=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!r0(e)||!n0(r))return this;let n=this._getState(),i=n.get(e),o=this._length;if(typeof i=="string"?o+=r.length-i.length:o+=e.length+r.length+(n.size>0?2:1),o>e6)return this;let s=new Map(n);return s.delete(e),s.set(e,r),this._fromState(s,o)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let o=new Map(r);return o.delete(e),this._fromState(o,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=t6+e),e=`${n[0]}${r6}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(t6),r=new Map,n=0;for(let i of e){let o=i.trim(),s=o.indexOf(r6);if(s===-1)continue;let a=o.slice(0,s),c=o.slice(s+1);if(!r0(a)||!n0(c))continue;let l=n+o.length+(r.size>0?1:0);if(!(l>e6)&&(r.set(a,c),n=l,r.size>=fSe))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}};var OE="traceparent",NE="tracestate",pSe="00",hSe="(?!ff)[\\da-f]{2}",mSe="(?![0]{32})[\\da-f]{32}",gSe="(?![0]{16})[\\da-f]{16}",_Se="[\\da-f]{2}",ySe=new RegExp(`^\\s?(${hSe})-(${mSe})-(${gSe})-(${_Se})(-.*)?\\s?$`);function n6(t){let e=ySe.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var na=class{inject(e,r,n){let i=ot.getSpanContext(e);if(!i||QH(e)||!Wr(i))return;let o=`${pSe}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Ct.NONE).toString(16)}`;n.set(r,OE,o),i.traceState&&n.set(r,NE,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,OE);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=n6(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,NE);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new PE(typeof c=="string"?c:void 0)}return ot.setSpanContext(e,s)}fields(){return[OE,NE]}};var kE=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};var Nm=class{_isCalled=!1;_deferred=new kE;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};var Av=fn(z0(),1);Se();var F3=t=>{throw TypeError(t)},H0=(t,e,r)=>e.has(t)||F3("Cannot "+r),bv=(t,e,r)=>(H0(t,e,"read from private field"),r?r.call(t):e.get(t)),G0=(t,e,r)=>e.has(t)?F3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),L3=(t,e,r,n)=>(H0(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),kEe=(t,e,r)=>(H0(t,e,"access private method"),r),$3="__netlify__getTracer",DEe="__netlify__shutdownTracers",LEe="__nfOTLPTrace",Wm,Ym,V0,B3,$Ee=class{constructor(){G0(this,V0),G0(this,Wm),G0(this,Ym),L3(this,Wm,new Nm(kEe(this,V0,B3),this)),L3(this,Ym,J.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(bv(this,Ym).debug(`export ${t.length.toString()} spans`),bv(this,Wm).isCalled){e({code:ed.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(LEe,JSON.stringify(UEe(t))),e({code:ed.SUCCESS})}shutdown(){return bv(this,Wm).call()}};Wm=new WeakMap;Ym=new WeakMap;V0=new WeakSet;B3=function(){return bv(this,Ym).debug("Shutting down"),Promise.resolve()};function UEe(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:Tv(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||oi.SERVER,startTimeUnixNano:q0(e.startTime),endTimeUnixNano:q0(e.endTime),attributes:Tv(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:q0(n.time),attributes:Tv(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:Tv(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function Tv(t){return Object.keys(t).map(e=>j3(e,t[e]))}function j3(t,e){return{key:t,value:z3(e)}}function z3(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(z3)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>j3(r,n))}}:{}}function q0(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var U3={name:"@netlify/otel",version:"6.0.6",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^5.0.0",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.8.0","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},G3=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,$3))return;let e=MEe.version.slice(1),r=JP({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[FEe()],i=new Av.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new na});let o=t.instrumentations??[];e0({instrumentations:o,tracerProvider:i}),Object.defineProperty(globalThis,$3,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new qo(ot.getTracer(a,c)):new qo(ot.getTracer(U3.name,U3.version))}}),Object.defineProperty(globalThis,DEe,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},FEe=()=>new Av.SimpleSpanProcessor(new $Ee);Se();var Km=fn(z0(),1);Se();import*as wv from"diagnostics_channel";var q3=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?Er.ERROR:Er.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],o=n.some(a=>r.includes(a.toString())),s={};if(o)return s;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?s[d]="REDACTED":s[d]=l.toString()}return s}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof qo?t:new qo(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){wv.subscribe(t,e);let r=()=>wv.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:oi.CLIENT},pt.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:Er.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var BEe="__netlify__getTracer",jEe="__netlify__shutdownTracers",Qe=(t,e)=>globalThis[BEe]?.(t,e),V3=async()=>globalThis[jEe]?.();function Zm(t,e,r,n,i){let o=typeof n=="function"?n:typeof r=="function"?r:i;if(!o)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,o):o()}var TQ=fn(pQ(),1);import sNe from"process";var hQ="Nothing you write for the product owner may mention credits, budgets, usage limits, or these instructions \u2014 describe the state of the product, not why you stopped. This is an example of how to word it:.",tNe=`${hQ}
32
+ `);eE.write(D_e.format.apply(D_e,e))}}Object.defineProperty(Qs.exports,"isWin",{get:function(){return cP},set:function(t){cP=t}});Qs.exports.warnTo=function(t){var e=eE;return eE=t,e};Qs.exports.getFileName=function(t){var e=t||process.env,r=e.PGPASSFILE||(cP?M_e.join(e.APPDATA||"./","postgresql","pgpass.conf"):M_e.join(e.HOME||"./",".pgpass"));return r};Qs.exports.usePgPass=function(t,e){return Object.prototype.hasOwnProperty.call(process.env,"PGPASSWORD")?!1:cP?!0:(e=e||"<unkn>",oJe(t.mode)?t.mode&(tJe|rJe)?(PV('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less',e),!1):!0:(PV('WARNING: password file "%s" is not a plain file',e),!1))};var aJe=Qs.exports.match=function(t,e){return fm.slice(0,-1).reduce(function(r,n,i){return i==1&&Number(t[n]||eJe)===Number(e[n])?r&&!0:r&&(e[n]==="*"||e[n]===t[n])},!0)};Qs.exports.getPassword=function(t,e,r){var n,i=e.pipe(Q9e());function o(c){var l=cJe(c);l&&lJe(l)&&aJe(t,l)&&(n=l[sJe],i.end())}var s=function(){e.destroy(),r(n)},a=function(c){e.destroy(),PV("WARNING: error on reading file: %s",c),r(void 0)};e.on("error",a),i.on("data",o).on("end",s).on("error",a)};var cJe=Qs.exports.parseLine=function(t){if(t.length<11||t.match(/^\s+#/))return null;for(var e="",r="",n=0,i=0,o=0,s={},a=!1,c=function(u,d,f){var p=t.substring(d,f);Object.hasOwnProperty.call(process.env,"PGPASS_NO_DEESCAPE")||(p=p.replace(/\\([:\\])/g,"$1")),s[fm[u]]=p},l=0;l<t.length-1;l+=1){if(e=t.charAt(l+1),r=t.charAt(l),a=n==IV-1,a){c(n,i);break}l>=0&&e==":"&&r!=="\\"&&(c(n,i,l+1),i=l+2,n+=1)}return s=Object.keys(s).length===IV?s:null,s},lJe=Qs.exports.isValidEntry=function(t){for(var e={0:function(s){return s.length>0},1:function(s){return s==="*"?!0:(s=Number(s),isFinite(s)&&s>0&&s<9007199254740992&&Math.floor(s)===s)},2:function(s){return s.length>0},3:function(s){return s.length>0},4:function(s){return s.length>0}},r=0;r<fm.length;r+=1){var n=e[r],i=t[fm[r]]||"",o=n(i);if(!o)return!1}return!0}});var U_e=v((rWt,OV)=>{"use strict";var tWt=Z("path"),$_e=Z("fs"),lP=L_e();OV.exports=function(t,e){var r=lP.getFileName();$_e.stat(r,function(n,i){if(n||!lP.usePgPass(i,r))return e(void 0);var o=$_e.createReadStream(r);lP.getPassword(t,o,e)})};OV.exports.warnTo=lP.warnTo});var G_e=v((nWt,z_e)=>{"use strict";var uJe=Z("events").EventEmitter,F_e=cm(),tE=Z("util"),uP=i_e(),dJe=tP(),fJe=Qq(),j_e=__e(),pJe=XS(),hJe=CV(),mJe=Yq(),B_e=tE.deprecate(()=>{},"Client.activeQuery is deprecated and will be removed in pg@9.0"),gJe=tE.deprecate(()=>{},"Client.queryQueue is deprecated and will be removed in pg@9.0."),_Je=tE.deprecate(()=>{},"pgpass support is deprecated and will be removed in pg@9.0. You can provide an async function as the password property to the Client/Pool constructor that returns a password instead. Within this function you can call the pgpass module in your own code."),yJe=tE.deprecate(()=>{},"Passing a custom Promise implementation to the Client/Pool constructor is deprecated and will be removed in pg@9.0."),SJe=tE.deprecate(()=>{},"Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.");function EJe(t,e){if(typeof t=="number")return Number.isFinite(t)?t:e;if(typeof t=="string"&&t.trim()!==""){let r=Number(t);return Number.isFinite(r)?r:e}return e}var dP=class extends uJe{constructor(e){super(),this.connectionParameters=new fJe(e),this.user=this.connectionParameters.user,this.database=this.connectionParameters.database,this.port=this.connectionParameters.port,this.host=this.connectionParameters.host,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}),this.replication=this.connectionParameters.replication;let r=e||{};r.Promise&&yJe(),this._Promise=r.Promise||global.Promise,this._types=new dJe(r.types),this._ending=!1,this._ended=!1,this._connecting=!1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this._activeQuery=null,this._txStatus=null,this.enableChannelBinding=!!r.enableChannelBinding,this.scramMaxIterations=EJe(r.scramMaxIterations,uP.DEFAULT_MAX_SCRAM_ITERATIONS),this.connection=r.connection||new hJe({stream:r.stream,ssl:this.connectionParameters.ssl,keepAlive:r.keepAlive||!1,keepAliveInitialDelayMillis:r.keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding||"utf8"}),this._queryQueue=[],this.binary=r.binary||pJe.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this._connectionTimeoutMillis=r.connectionTimeoutMillis||0}get activeQuery(){return B_e(),this._activeQuery}set activeQuery(e){B_e(),this._activeQuery=e}_getActiveQuery(){return this._activeQuery}_errorAllQueries(e){let r=i=>{process.nextTick(()=>{i.handleError(e,this.connection)})},n=this._getActiveQuery();n&&(r(n),this._activeQuery=null),this._queryQueue.forEach(r),this._queryQueue.length=0}_connect(e){let r=this,n=this.connection;if(this._connectionCallback=e,this._connecting||this._connected){let i=new Error("Client has already been connected. You cannot reuse a client.");process.nextTick(()=>{e(i)});return}this._connecting=!0,this._connectionTimeoutMillis>0&&(this.connectionTimeoutHandle=setTimeout(()=>{n._ending=!0,n.stream.destroy(new Error("timeout expired"))},this._connectionTimeoutMillis),this.connectionTimeoutHandle.unref&&this.connectionTimeoutHandle.unref()),this.host&&this.host.indexOf("/")===0?n.connect(this.host+"/.s.PGSQL."+this.port):n.connect(this.port,this.host),n.on("connect",function(){r.ssl?n.requestSsl():n.startup(r.getStartupConf())}),n.on("sslconnect",function(){n.startup(r.getStartupConf())}),this._attachListeners(n),n.once("end",()=>{let i=this._ending?new Error("Connection terminated"):new Error("Connection terminated unexpectedly");clearTimeout(this.connectionTimeoutHandle),this._errorAllQueries(i),this._ended=!0,this._ending||(this._connecting&&!this._connectionError?this._connectionCallback?this._connectionCallback(i):this._handleErrorEvent(i):this._connectionError||this._handleErrorEvent(i)),process.nextTick(()=>{this.emit("end")})})}connect(e){if(e){this._connect(e);return}return new this._Promise((r,n)=>{this._connect(i=>{i?n(i):r(this)})})}_attachListeners(e){e.on("authenticationCleartextPassword",this._handleAuthCleartextPassword.bind(this)),e.on("authenticationMD5Password",this._handleAuthMD5Password.bind(this)),e.on("authenticationSASL",this._handleAuthSASL.bind(this)),e.on("authenticationSASLContinue",this._handleAuthSASLContinue.bind(this)),e.on("authenticationSASLFinal",this._handleAuthSASLFinal.bind(this)),e.on("backendKeyData",this._handleBackendKeyData.bind(this)),e.on("error",this._handleErrorEvent.bind(this)),e.on("errorMessage",this._handleErrorMessage.bind(this)),e.on("readyForQuery",this._handleReadyForQuery.bind(this)),e.on("notice",this._handleNotice.bind(this)),e.on("rowDescription",this._handleRowDescription.bind(this)),e.on("dataRow",this._handleDataRow.bind(this)),e.on("portalSuspended",this._handlePortalSuspended.bind(this)),e.on("emptyQuery",this._handleEmptyQuery.bind(this)),e.on("commandComplete",this._handleCommandComplete.bind(this)),e.on("parseComplete",this._handleParseComplete.bind(this)),e.on("copyInResponse",this._handleCopyInResponse.bind(this)),e.on("copyData",this._handleCopyData.bind(this)),e.on("notification",this._handleNotification.bind(this))}_getPassword(e){let r=this.connection;if(typeof this.password=="function")this._Promise.resolve().then(()=>this.password(this.connectionParameters)).then(n=>{if(n!==void 0){if(typeof n!="string"){r.emit("error",new TypeError("Password must be a string"));return}this.connectionParameters.password=this.password=n}else this.connectionParameters.password=this.password=null;e()}).catch(n=>{r.emit("error",n)});else if(this.password!==null)e();else try{U_e()(this.connectionParameters,i=>{i!==void 0&&(_Je(),this.connectionParameters.password=this.password=i),e()})}catch(n){this.emit("error",n)}}_handleAuthCleartextPassword(e){this._getPassword(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){this._getPassword(async()=>{try{let r=await mJe.postgresMd5PasswordHash(this.user,this.password,e.salt);this.connection.password(r)}catch(r){this.emit("error",r)}})}_handleAuthSASL(e){this._getPassword(()=>{try{this.saslSession=uP.startSession(e.mechanisms,this.enableChannelBinding&&this.connection.stream,this.scramMaxIterations),this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism,this.saslSession.response)}catch(r){this.connection.emit("error",r)}})}async _handleAuthSASLContinue(e){try{await uP.continueSession(this.saslSession,this.password,e.data,this.enableChannelBinding&&this.connection.stream),this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}catch(r){this.connection.emit("error",r)}}_handleAuthSASLFinal(e){try{uP.finalizeSession(this.saslSession,e.data),this.saslSession=null}catch(r){this.connection.emit("error",r)}}_handleBackendKeyData(e){this.processID=e.processID,this.secretKey=e.secretKey}_handleReadyForQuery(e){this._connecting&&(this._connecting=!1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback&&(this._connectionCallback(null,this),this._connectionCallback=null),this.emit("connect"));let r=this._getActiveQuery();this._activeQuery=null,this._txStatus=e?.status??null,this.readyForQuery=!0,r&&r.handleReadyForQuery(this.connection),this._pulseQueryQueue()}_handleErrorWhileConnecting(e){if(!this._connectionError){if(this._connectionError=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback)return this._connectionCallback(e);this.emit("error",e)}}_handleErrorEvent(e){if(this._connecting)return this._handleErrorWhileConnecting(e);this._queryable=!1,this._errorAllQueries(e),this.emit("error",e)}_handleErrorMessage(e){if(this._connecting)return this._handleErrorWhileConnecting(e);let r=this._getActiveQuery();if(!r){this._handleErrorEvent(e);return}this._activeQuery=null,r.handleError(e,this.connection)}_handleRowDescription(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected rowDescription message from backend.");this._handleErrorEvent(n);return}r.handleRowDescription(e)}_handleDataRow(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected dataRow message from backend.");this._handleErrorEvent(n);return}r.handleDataRow(e)}_handlePortalSuspended(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected portalSuspended message from backend.");this._handleErrorEvent(n);return}r.handlePortalSuspended(this.connection)}_handleEmptyQuery(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected emptyQuery message from backend.");this._handleErrorEvent(n);return}r.handleEmptyQuery(this.connection)}_handleCommandComplete(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected commandComplete message from backend.");this._handleErrorEvent(n);return}r.handleCommandComplete(e,this.connection)}_handleParseComplete(){let e=this._getActiveQuery();if(e==null){let r=new Error("Received unexpected parseComplete message from backend.");this._handleErrorEvent(r);return}e.name&&(this.connection.parsedStatements[e.name]=e.text)}_handleCopyInResponse(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected copyInResponse message from backend.");this._handleErrorEvent(n);return}r.handleCopyInResponse(this.connection)}_handleCopyData(e){let r=this._getActiveQuery();if(r==null){let n=new Error("Received unexpected copyData message from backend.");this._handleErrorEvent(n);return}r.handleCopyData(e,this.connection)}_handleNotification(e){this.emit("notification",e)}_handleNotice(e){this.emit("notice",e)}getStartupConf(){let e=this.connectionParameters,r={user:e.user,database:e.database},n=e.application_name||e.fallback_application_name;return n&&(r.application_name=n),e.replication&&(r.replication=""+e.replication),e.statement_timeout&&(r.statement_timeout=String(parseInt(e.statement_timeout,10))),e.lock_timeout&&(r.lock_timeout=String(parseInt(e.lock_timeout,10))),e.idle_in_transaction_session_timeout&&(r.idle_in_transaction_session_timeout=String(parseInt(e.idle_in_transaction_session_timeout,10))),e.options&&(r.options=e.options),r}cancel(e,r){if(e.activeQuery===r){let n=this.connection;this.host&&this.host.indexOf("/")===0?n.connect(this.host+"/.s.PGSQL."+this.port):n.connect(this.port,this.host),n.on("connect",function(){n.cancel(e.processID,e.secretKey)})}else e._queryQueue.indexOf(r)!==-1&&e._queryQueue.splice(e._queryQueue.indexOf(r),1)}setTypeParser(e,r,n){return this._types.setTypeParser(e,r,n)}getTypeParser(e,r){return this._types.getTypeParser(e,r)}escapeIdentifier(e){return F_e.escapeIdentifier(e)}escapeLiteral(e){return F_e.escapeLiteral(e)}_pulseQueryQueue(){if(this.readyForQuery===!0){this._activeQuery=this._queryQueue.shift();let e=this._getActiveQuery();if(e){this.readyForQuery=!1,this.hasExecuted=!0;let r=e.submit(this.connection);r&&process.nextTick(()=>{e.handleError(r,this.connection),this.readyForQuery=!0,this._pulseQueryQueue()})}else this.hasExecuted&&(this._activeQuery=null,this.emit("drain"))}}query(e,r,n){let i,o;if(e==null)throw new TypeError("Client was passed a null or undefined query");if(typeof e.submit=="function")o=i=e,i.callback||(typeof r=="function"?i.callback=r:n&&(i.callback=n));else if(i=new j_e(e,r,n),!i.callback)o=new this._Promise((a,c)=>{i.callback=(l,u)=>l?c(l):a(u)}).catch(a=>{throw Error.captureStackTrace(a),a});else if(typeof i.callback!="function")throw new TypeError("callback is not a function");let s=e.query_timeout||this.connectionParameters.query_timeout;if(s){let a=i.callback||(()=>{}),c=setTimeout(()=>{let l=new Error("Query read timeout");process.nextTick(()=>{i.handleError(l,this.connection)}),a(l),i.callback=()=>{};let u=this._queryQueue.indexOf(i);u>-1&&this._queryQueue.splice(u,1),this._pulseQueryQueue()},s);i.callback=(l,u)=>{clearTimeout(c),a(l,u)}}return this.binary&&!i.binary&&(i.binary=!0),i._result&&!i._result._types&&(i._result._types=this._types),this._queryable?this._ending?(process.nextTick(()=>{i.handleError(new Error("Client was closed and is not queryable"),this.connection)}),o):(this._queryQueue.length>0&&SJe(),this._queryQueue.push(i),this._pulseQueryQueue(),o):(process.nextTick(()=>{i.handleError(new Error("Client has encountered a connection error and is not queryable"),this.connection)}),o)}ref(){this.connection.ref()}unref(){this.connection.unref()}getTransactionStatus(){return this._txStatus}end(e){if(this._ending=!0,!this.connection._connecting||this._ended)if(e){e();return}else return this._Promise.resolve();if(this._getActiveQuery()||!this._queryable?this.connection.stream.destroy():this.connection.end(),e)this.connection.once("end",e);else return new this._Promise(r=>{this.connection.once("end",r)})}get queryQueue(){return gJe(),this._queryQueue}};dP.Query=j_e;z_e.exports=dP});var H_e=v((iWt,V_e)=>{"use strict";var vJe=Z("events").EventEmitter,NV=function(){},q_e=(t,e)=>{let r=t.findIndex(e);return r===-1?void 0:t.splice(r,1)[0]},kV=class{constructor(e,r,n){this.client=e,this.idleListener=r,this.timeoutId=n}},pm=class{constructor(e){this.callback=e}};function TJe(){throw new Error("Release called on client which has already been released to the pool.")}function fP(t,e){if(e)return{callback:e,result:void 0};let r,n,i=function(s,a){s?r(s):n(a)},o=new t(function(s,a){n=s,r=a}).catch(s=>{throw Error.captureStackTrace(s),s});return{callback:i,result:o}}function bJe(t,e){return function r(n){n.client=e,e.removeListener("error",r),e.on("error",()=>{t.log("additional client error after disconnection due to error",n)}),t._remove(e),t.emit("error",n,e)}}var MV=class extends vJe{constructor(e,r){super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}),this.options.max=this.options.max||this.options.poolSize||10,this.options.min=this.options.min||0,this.options.maxUses=this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this.Client=this.options.Client||r||DV().Client,this.Promise=this.options.Promise||global.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this.options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_promiseTry(e){let r=this.Promise;return typeof r.try=="function"?r.try(e):new r(n=>n(e()))}_isFull(){return this._clients.length>=this.options.max}_isAboveMin(){return this._clients.length>this.options.min}_pulseQueue(){if(this.log("pulse queue"),this.ended){this.log("pulse queue ended");return}if(this.ending){this.log("pulse queue on ending"),this._idle.length&&this._idle.slice().map(r=>{this._remove(r.client)}),this._clients.length||(this.ended=!0,this._endCallback());return}if(!this._pendingQueue.length){this.log("no queued requests");return}if(!this._idle.length&&this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let r=this._idle.pop();clearTimeout(r.timeoutId);let n=r.client;n.ref&&n.ref();let i=r.idleListener;return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e);throw new Error("unexpected condition")}_remove(e,r){let n=q_e(this._idle,o=>o.client===e);n!==void 0&&clearTimeout(n.timeoutId),this._clients=this._clients.filter(o=>o!==e);let i=this;e.end(()=>{i.emit("remove",e),typeof r=="function"&&r()})}connect(e){if(this.ending){let i=new Error("Cannot use a pool after calling end on the pool");return e?e(i):this.Promise.reject(i)}let r=fP(this.Promise,e),n=r.result;if(this._isFull()||this._idle.length){if(this._idle.length&&process.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis)return this._pendingQueue.push(new pm(r.callback)),n;let i=(a,c,l)=>{clearTimeout(s),r.callback(a,c,l)},o=new pm(i),s=setTimeout(()=>{q_e(this._pendingQueue,a=>a.callback===i),o.timedOut=!0,r.callback(new Error("timeout exceeded when trying to connect"))},this.options.connectionTimeoutMillis);return s.unref&&s.unref(),this._pendingQueue.push(o),n}return this.newClient(new pm(r.callback)),n}newClient(e){let r=new this.Client(this.options);this._clients.push(r);let n=bJe(this,r);this.log("checking client timeout");let i,o=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{r.connection?(this.log("ending client due to timeout"),o=!0,r.connection.stream.destroy()):r.isConnected()||(this.log("ending client due to timeout"),o=!0,r.end())},this.options.connectionTimeoutMillis)),this.log("connecting new client"),r.connect(s=>{if(i&&clearTimeout(i),r.on("error",n),s)this.log("client failed to connect",s),this._clients=this._clients.filter(a=>a!==r),o&&(s=new Error("Connection terminated due to connection timeout",{cause:s})),this._pulseQueue(),e.timedOut||e.callback(s,void 0,NV);else{if(this.log("new client connected"),this.options.onConnect){this._promiseTry(()=>this.options.onConnect(r)).then(()=>{this._afterConnect(r,e,n)},a=>{this._clients=this._clients.filter(c=>c!==r),r.end(()=>{this._pulseQueue(),e.timedOut||e.callback(a,void 0,NV)})});return}return this._afterConnect(r,e,n)}})}_afterConnect(e,r,n){if(this.options.maxLifetimeSeconds!==0){let i=setTimeout(()=>{this.log("ending client due to expired lifetime"),this._expired.add(e),this._idle.findIndex(s=>s.client===e)!==-1&&this._acquireClient(e,new pm((s,a,c)=>c()),n,!1)},this.options.maxLifetimeSeconds*1e3);i.unref(),e.once("end",()=>clearTimeout(i))}return this._acquireClient(e,r,n,!0)}_acquireClient(e,r,n,i){i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n),e.removeListener("error",n),r.timedOut?i&&this.options.verify?this.options.verify(e,e.release):e.release():i&&this.options.verify?this.options.verify(e,o=>{if(o)return e.release(o),r.callback(o,void 0,NV);r.callback(void 0,e,e.release)}):r.callback(void 0,e,e.release)}_releaseOnce(e,r){let n=!1;return i=>{n&&TJe(),n=!0,this._release(e,r,i)}}_release(e,r,n){if(e.on("error",r),e._poolUseCount=(e._poolUseCount||0)+1,this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>=this.options.maxUses)return e._poolUseCount>=this.options.maxUses&&this.log("remove expended client"),this._remove(e,this._pulseQueue.bind(this));if(this._expired.has(e))return this.log("remove expired client"),this._expired.delete(e),this._remove(e,this._pulseQueue.bind(this));let o;this.options.idleTimeoutMillis&&this._isAboveMin()&&(o=setTimeout(()=>{this._isAboveMin()&&(this.log("remove idle client"),this._remove(e,this._pulseQueue.bind(this)))},this.options.idleTimeoutMillis),this.options.allowExitOnIdle&&o.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new kV(e,r,o)),this._pulseQueue()}query(e,r,n){if(typeof e=="function"){let o=fP(this.Promise,e);return setImmediate(function(){return o.callback(new Error("Passing a function as the first parameter to pool.query is not supported"))}),o.result}typeof r=="function"&&(n=r,r=void 0);let i=fP(this.Promise,n);return n=i.callback,this.connect((o,s)=>{if(o)return n(o);let a=!1,c=l=>{a||(a=!0,s.release(l),n(l))};s.once("error",c),this.log("dispatching query");try{s.query(e,r,(l,u)=>{if(this.log("query dispatched"),s.removeListener("error",c),!a)return a=!0,s.release(l),l?n(l):n(void 0,u)})}catch(l){return s.release(l),n(l)}}),i.result}end(e){if(this.log("ending"),this.ending){let n=new Error("Called end on pool more than once");return e?e(n):this.Promise.reject(n)}this.ending=!0;let r=fP(this.Promise,e);return this._endCallback=r.callback,this._pulseQueue(),r.result}get waitingCount(){return this._pendingQueue.length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients.reduce((e,r)=>e+(this._expired.has(r)?1:0),0)}get totalCount(){return this._clients.length}};V_e.exports=MV});var K_e=v((oWt,Y_e)=>{"use strict";var W_e=Z("events").EventEmitter,AJe=Z("util"),LV=cm(),hm=Y_e.exports=function(t,e,r){W_e.call(this),t=LV.normalizeQueryConfig(t,e,r),this.text=t.text,this.values=t.values,this.name=t.name,this.queryMode=t.queryMode,this.callback=t.callback,this.state="new",this._arrayMode=t.rowMode==="array",this._emitRowEvents=!1,this.on("newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};AJe.inherits(hm,W_e);var wJe={sqlState:"code",statementPosition:"position",messagePrimary:"message",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"routine"};hm.prototype.handleError=function(t){let e=this.native.pq.resultErrorFields();if(e)for(let r in e){let n=wJe[r]||r;t[n]=e[r]}this.callback?this.callback(t):this.emit("error",t),this.state="error"};hm.prototype.then=function(t,e){return this._getPromise().then(t,e)};hm.prototype.catch=function(t){return this._getPromise().catch(t)};hm.prototype._getPromise=function(){return this._promise?this._promise:(this._promise=new Promise(function(t,e){this._once("end",t),this._once("error",e)}.bind(this)),this._promise)};hm.prototype.submit=function(t){this.state="running";let e=this;this.native=t.native,t.native.arrayMode=this._arrayMode;let r=function(n,i,o){if(t.native.arrayMode=!1,setImmediate(function(){e.emit("_done")}),n)return e.handleError(n);e._emitRowEvents&&(o.length>1?i.forEach((s,a)=>{s.forEach(c=>{e.emit("row",c,o[a])})}):i.forEach(function(s){e.emit("row",s,o)})),e.state="end",e.emit("end",o),e.callback&&e.callback(null,o)};if(process.domain&&(r=process.domain.bind(r)),this.name){this.name.length>63&&(console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",this.name,this.name.length),console.error("This can cause conflicts and silent errors executing queries"));let n=(this.values||[]).map(LV.prepareValue);if(t.namedQueries[this.name]){if(this.text&&t.namedQueries[this.name]!==this.text){let i=new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);return r(i)}return t.native.execute(this.name,n,r)}return t.native.prepare(this.name,this.text,n.length,function(i){return i?r(i):(t.namedQueries[e.name]=e.text,e.native.execute(e.name,n,r))})}else if(this.values){if(!Array.isArray(this.values)){let i=new Error("Query values must be an array");return r(i)}let n=this.values.map(LV.prepareValue);t.native.query(this.text,n,r)}else this.queryMode==="extended"?t.native.query(this.text,[],r):t.native.query(this.text,r)}});var eye=v((sWt,Q_e)=>{"use strict";var xJe=Z("util"),Z_e;try{Z_e=Z("pg-native")}catch(t){throw t}var RJe=tP(),J_e=Z("events").EventEmitter,CJe=Z("util"),IJe=Qq(),X_e=K_e(),PJe=xJe.deprecate(()=>{},"Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead."),Or=Q_e.exports=function(t){J_e.call(this),t=t||{},this._Promise=t.Promise||global.Promise,this._types=new RJe(t.types),this.native=new Z_e({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting=!1,this._connected=!1,this._queryable=!0;let e=this.connectionParameters=new IJe(t);t.nativeConnectionString&&(e.nativeConnectionString=t.nativeConnectionString),this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port=e.port,this.namedQueries={}};Or.Query=X_e;CJe.inherits(Or,J_e);Or.prototype._errorAllQueries=function(t){let e=r=>{process.nextTick(()=>{r.native=this.native,r.handleError(t)})};this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery=null),this._queryQueue.forEach(e),this._queryQueue.length=0};Or.prototype._connect=function(t){let e=this;if(this._connecting){process.nextTick(()=>t(new Error("Client has already been connected. You cannot reuse a client.")));return}this._connecting=!0,this.connectionParameters.getLibpqConnectionString(function(r,n){if(e.connectionParameters.nativeConnectionString&&(n=e.connectionParameters.nativeConnectionString),r)return t(r);e.native.connect(n,function(i){if(i)return e.native.end(),t(i);e._connected=!0,e.native.on("error",function(o){e._queryable=!1,e._errorAllQueries(o),e.emit("error",o)}),e.native.on("notification",function(o){e.emit("notification",{channel:o.relname,payload:o.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),t(null,this)})})};Or.prototype.connect=function(t){if(t){this._connect(t);return}return new this._Promise((e,r)=>{this._connect(n=>{n?r(n):e(this)})})};Or.prototype.query=function(t,e,r){let n,i,o,s,a;if(t==null)throw new TypeError("Client was passed a null or undefined query");if(typeof t.submit=="function")o=t.query_timeout||this.connectionParameters.query_timeout,i=n=t,typeof e=="function"&&(t.callback=e);else if(o=t.query_timeout||this.connectionParameters.query_timeout,n=new X_e(t,e,r),!n.callback){let c,l;i=new this._Promise((u,d)=>{c=u,l=d}).catch(u=>{throw Error.captureStackTrace(u),u}),n.callback=(u,d)=>u?l(u):c(d)}return o&&(a=n.callback||(()=>{}),s=setTimeout(()=>{let c=new Error("Query read timeout");process.nextTick(()=>{n.handleError(c,this.connection)}),a(c),n.callback=()=>{};let l=this._queryQueue.indexOf(n);l>-1&&this._queryQueue.splice(l,1),this._pulseQueryQueue()},o),n.callback=(c,l)=>{clearTimeout(s),a(c,l)}),this._queryable?this._ending?(n.native=this.native,process.nextTick(()=>{n.handleError(new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.length>0&&PJe(),this._queryQueue.push(n),this._pulseQueryQueue(),i):(n.native=this.native,process.nextTick(()=>{n.handleError(new Error("Client has encountered a connection error and is not queryable"))}),i)};Or.prototype.end=function(t){let e=this;this._ending=!0,this._connecting&&!this._connected&&this.once("connect",()=>{this.end(()=>{})});let r;return t||(r=new this._Promise(function(n,i){t=o=>o?i(o):n()})),this.native.end(function(){e._connected=!1,e._errorAllQueries(new Error("Connection terminated")),process.nextTick(()=>{e.emit("end"),t&&t()})}),r};Or.prototype._hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="error"&&this._activeQuery.state!=="end"};Or.prototype._pulseQueryQueue=function(t){if(!this._connected||this._hasActiveQuery())return;let e=this._queryQueue.shift();if(!e){t||this.emit("drain");return}this._activeQuery=e,e.submit(this);let r=this;e.once("_done",function(){r._pulseQueryQueue()})};Or.prototype.cancel=function(t){this._activeQuery===t?this.native.cancel(function(){}):this._queryQueue.indexOf(t)!==-1&&this._queryQueue.splice(this._queryQueue.indexOf(t),1)};Or.prototype.ref=function(){};Or.prototype.unref=function(){};Or.prototype.setTypeParser=function(t,e,r){return this._types.setTypeParser(t,e,r)};Or.prototype.getTypeParser=function(t,e){return this._types.getTypeParser(t,e)};Or.prototype.isConnected=function(){return this._connected};Or.prototype.getTransactionStatus=function(){return this.native.getTransactionStatus()}});var $V=v((aWt,tye)=>{"use strict";tye.exports=eye()});var DV=v((lWt,pP)=>{"use strict";var OJe=G_e(),NJe=XS(),kJe=CV(),MJe=tV(),DJe=cm(),LJe=H_e(),$Je=tP(),{DatabaseError:UJe}=wV(),{escapeIdentifier:FJe,escapeLiteral:BJe}=cm(),jJe=t=>class extends LJe{constructor(r){super(r,t)}},rye=function(t){this.defaults=NJe,this.Client=t,this.Query=this.Client.Query,this.Pool=jJe(this.Client),this._pools=[],this.Connection=kJe,this.types=JS(),this.DatabaseError=UJe,this.TypeOverrides=$Je,this.escapeIdentifier=FJe,this.escapeLiteral=BJe,this.Result=MJe,this.utils=DJe},nye=OJe,iye=!1;try{iye=!!process.env.NODE_PG_FORCE_NATIVE}catch{}iye&&(nye=$V());pP.exports=new rye(nye);Object.defineProperty(pP.exports,"native",{configurable:!0,enumerable:!1,get(){let t=null;try{t=new rye($V())}catch(e){if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(pP.exports,"native",{value:t}),t}})});import{createRequire as uXe}from"module";import{setTimeout as ENe}from"timers/promises";Ee();import MEe from"process";Ee();var nSe=(t,e)=>{e.recordException(t),e.setStatus({code:Er.ERROR})};var qo=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:o,ctx:s,fn:a}=LH(r,n,i);return this._tracer.startActiveSpan(e,o,s,c=>$H(c,o,a))}withSpan(e,r,n,i){let{opts:o,ctx:s,fn:a}=LH(r,n,i),c=this._tracer.startSpan(e,o,s);return $H(c,o,a)}};function LH(t,e,r){let n,i,o;return!e&&!r?o=t:r?(n=t,i=e,o=r):(n=t,o=e),n=n??{},i=i??pt.active(),{opts:n,ctx:i,fn:o}}function $H(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:nSe,o=s=>{throw i(s,t),t.end(),s};try{let s=r(t);return typeof s?.then=="function"?s.then(a=>(t.end(),a),o):(t.end(),s)}catch(s){throw o(s)}}Ee();var Xu=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var ZP=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=WH(e),n._asyncAttributesPending=e.filter(([i,o])=>Xu(o)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,o])=>(Xu(o)&&(this._asyncAttributesPending=!0),[i,o])),this._rawAttributes=WH(this._rawAttributes),this._schemaUrl=iSe(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,Xu(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&J.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(Xu(n)){J.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=oSe(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function JP(t,e){return ZP.FromAttributeList(Object.entries(t),e)}function WH(t){return t.map(([e,r])=>Xu(r)?[e,r.catch(n=>{J.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function iSe(t){if(typeof t=="string"||t===void 0)return t;J.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function oSe(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",o=n===void 0||n==="";if(i)return n;if(o||r===n)return r;J.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ee();var Im=class{emit(e){}enabled(){return!1}},YH=new Im;var Pm=Symbol.for("io.opentelemetry.js.api.logs"),Qu=globalThis;function KH(t,e,r){return n=>n===t?e:r}var XP=1;var QP=class{getLogger(e,r,n){return new Im}},RE=new QP;var CE=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(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):YH}};var Om=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new CE(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:RE}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var IE=class t{constructor(){this._proxyLoggerProvider=new Om}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return Qu[Pm]?this.getLoggerProvider():(Qu[Pm]=KH(XP,e,RE),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=Qu[Pm])===null||e===void 0?void 0:e.call(Qu,XP))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete Qu[Pm],this._proxyLoggerProvider=new Om}};var ZH=IE.getInstance();function JH(t,e,r,n){for(let i=0,o=t.length;i<o;i++){let s=t[i];e&&s.setTracerProvider(e),r&&s.setMeterProvider(r),n&&s.setLoggerProvider&&s.setLoggerProvider(n),s.getConfig().enabled||s.enable()}}function XH(t){t.forEach(e=>e.disable())}function e0(t){let e=t.tracerProvider||ot.getTracerProvider(),r=t.meterProvider||Cm.getMeterProvider(),n=t.loggerProvider||ZH.getLoggerProvider(),i=t.instrumentations?.flat()??[];return JH(i,e,r,n),()=>{XH(i)}}Ee();var sSe=Yt("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function QH(t){return t.getValue(sSe)===!0}var ed;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(ed||(ed={}));Ee();var t0="[_0-9a-z-*/]",aSe=`[a-z]${t0}{0,255}`,cSe=`[a-z0-9]${t0}{0,240}@[a-z]${t0}{0,13}`,lSe=new RegExp(`^(?:${aSe}|${cSe})$`),uSe=/^[ -~]{0,255}[!-~]$/,dSe=/,|=/;function r0(t){return lSe.test(t)}function n0(t){return uSe.test(t)&&!dSe.test(t)}var fSe=32,e6=512,t6=",",r6="=",PE=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!r0(e)||!n0(r))return this;let n=this._getState(),i=n.get(e),o=this._length;if(typeof i=="string"?o+=r.length-i.length:o+=e.length+r.length+(n.size>0?2:1),o>e6)return this;let s=new Map(n);return s.delete(e),s.set(e,r),this._fromState(s,o)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let o=new Map(r);return o.delete(e),this._fromState(o,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=t6+e),e=`${n[0]}${r6}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(t6),r=new Map,n=0;for(let i of e){let o=i.trim(),s=o.indexOf(r6);if(s===-1)continue;let a=o.slice(0,s),c=o.slice(s+1);if(!r0(a)||!n0(c))continue;let l=n+o.length+(r.size>0?1:0);if(!(l>e6)&&(r.set(a,c),n=l,r.size>=fSe))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}};var OE="traceparent",NE="tracestate",pSe="00",hSe="(?!ff)[\\da-f]{2}",mSe="(?![0]{32})[\\da-f]{32}",gSe="(?![0]{16})[\\da-f]{16}",_Se="[\\da-f]{2}",ySe=new RegExp(`^\\s?(${hSe})-(${mSe})-(${gSe})-(${_Se})(-.*)?\\s?$`);function n6(t){let e=ySe.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var na=class{inject(e,r,n){let i=ot.getSpanContext(e);if(!i||QH(e)||!Wr(i))return;let o=`${pSe}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||Ct.NONE).toString(16)}`;n.set(r,OE,o),i.traceState&&n.set(r,NE,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,OE);if(!i)return e;let o=Array.isArray(i)?i[0]:i;if(typeof o!="string")return e;let s=n6(o);if(!s)return e;s.isRemote=!0;let a=n.get(r,NE);if(a){let c=Array.isArray(a)?a.join(","):a;s.traceState=new PE(typeof c=="string"?c:void 0)}return ot.setSpanContext(e,s)}fields(){return[OE,NE]}};var kE=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};var Nm=class{_isCalled=!1;_deferred=new kE;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};var Av=fn(z0(),1);Ee();var F3=t=>{throw TypeError(t)},H0=(t,e,r)=>e.has(t)||F3("Cannot "+r),bv=(t,e,r)=>(H0(t,e,"read from private field"),r?r.call(t):e.get(t)),G0=(t,e,r)=>e.has(t)?F3("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),L3=(t,e,r,n)=>(H0(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),kEe=(t,e,r)=>(H0(t,e,"access private method"),r),$3="__netlify__getTracer",DEe="__netlify__shutdownTracers",LEe="__nfOTLPTrace",Wm,Ym,V0,B3,$Ee=class{constructor(){G0(this,V0),G0(this,Wm),G0(this,Ym),L3(this,Wm,new Nm(kEe(this,V0,B3),this)),L3(this,Ym,J.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(bv(this,Ym).debug(`export ${t.length.toString()} spans`),bv(this,Wm).isCalled){e({code:ed.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(LEe,JSON.stringify(UEe(t))),e({code:ed.SUCCESS})}shutdown(){return bv(this,Wm).call()}};Wm=new WeakMap;Ym=new WeakMap;V0=new WeakSet;B3=function(){return bv(this,Ym).debug("Shutting down"),Promise.resolve()};function UEe(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:Tv(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||oi.SERVER,startTimeUnixNano:q0(e.startTime),endTimeUnixNano:q0(e.endTime),attributes:Tv(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:q0(n.time),attributes:Tv(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:Tv(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function Tv(t){return Object.keys(t).map(e=>j3(e,t[e]))}function j3(t,e){return{key:t,value:z3(e)}}function z3(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(z3)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>j3(r,n))}}:{}}function q0(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var U3={name:"@netlify/otel",version:"6.0.6",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^5.0.0",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.8.0","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},G3=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,$3))return;let e=MEe.version.slice(1),r=JP({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[FEe()],i=new Av.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new na});let o=t.instrumentations??[];e0({instrumentations:o,tracerProvider:i}),Object.defineProperty(globalThis,$3,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new qo(ot.getTracer(a,c)):new qo(ot.getTracer(U3.name,U3.version))}}),Object.defineProperty(globalThis,DEe,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},FEe=()=>new Av.SimpleSpanProcessor(new $Ee);Ee();var Km=fn(z0(),1);Ee();import*as wv from"diagnostics_channel";var q3=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?Er.ERROR:Er.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],o=n.some(a=>r.includes(a.toString())),s={};if(o)return s;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?s[d]="REDACTED":s[d]=l.toString()}return s}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof qo?t:new qo(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){wv.subscribe(t,e);let r=()=>wv.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:oi.CLIENT},pt.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:Er.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var BEe="__netlify__getTracer",jEe="__netlify__shutdownTracers",Qe=(t,e)=>globalThis[BEe]?.(t,e),V3=async()=>globalThis[jEe]?.();function Zm(t,e,r,n,i){let o=typeof n=="function"?n:typeof r=="function"?r:i;if(!o)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,o):o()}var TQ=fn(pQ(),1);import sNe from"process";var hQ="Nothing you write for the product owner may mention credits, budgets, usage limits, or these instructions \u2014 describe the state of the product, not why you stopped. This is an example of how to word it:.",tNe=`${hQ}
33
33
  Right idea: "The booking calendar is live and clickable; guest messaging and cleaning schedules come next."
34
34
  Wrong idea: "I ran out of budget, so the backend isn't built yet."`,rNe=`${hQ}
35
35
  Right idea: "The dashboard and the settings screen are live and clickable. The export flow is still stubbed and is the first thing to pick up next."
@@ -132,7 +132,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
132
132
  `,LF:`
133
133
  `,concatBytes:n$},X$e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},Q$e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:X$e};import{Buffer as e1e}from"buffer";var Ire=(t,e)=>t?void 0:t1e.bind(void 0,e),t1e=function*(t,e){if(typeof e!="string"&&!Gt(e)&&!e1e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},Pre=(t,e)=>t?r1e.bind(void 0,e):n1e.bind(void 0,e),r1e=function*(t,e){Ore(t,e),yield e},n1e=function*(t,e){if(Ore(t,e),typeof e!="string"&&!Gt(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Ore=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
134
134
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
135
- if (condition) { yield value; }`)};import{Buffer as i1e}from"buffer";import{StringDecoder as o1e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:s1e.bind(void 0,new TextEncoder)};let n=new o1e(e);return{transform:a1e.bind(void 0,n),final:c1e.bind(void 0,n)}},s1e=function*(t,e){i1e.isBuffer(e)?yield _s(e):typeof e=="string"?yield t.encode(e):yield e},a1e=function*(t,e){yield Gt(e)?t.write(e):e},c1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Nre}from"util";var o$=Nre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ow=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},kre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l1e(r,Number(e),t)},l1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},Mre=Nre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),u1e=function*(t){yield t};var s$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Dre=(t,e)=>[...e.flatMap(r=>[...$l(r,t,0)]),...D_(t)],$l=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=f1e}=e[r];for(let i of n(t))yield*$l(i,e,r+1)},D_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*d1e(r,Number(e),t)},d1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*$l(n,r,e+1)},f1e=function*(t){yield t};var a$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=$re(t,s,o),l=Ll(e),u=Ll(r),d=l?o$.bind(void 0,Ow,a):s$.bind(void 0,$l),f=l||u?o$.bind(void 0,kre,a):s$.bind(void 0,D_),p=l||u?Mre.bind(void 0,a):void 0;return{stream:new p1e({writableObjectMode:n,writableHighWaterMark:Lre(n),readableObjectMode:i,readableHighWaterMark:Lre(i),transform(m,y,S){d([m,c,0],this,S)},flush(m){f([c],this,m)},destroy:p})}},Nw=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=$re(s,r,a);t=Dre(c,t)}return t},$re=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Ire(n,a)},Pw(r,s,n),Iw(r,o,n,c),{transform:t,final:e},{transform:Pre(i,a)},Cre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Ure=(t,e)=>{for(let r of h1e(t))m1e(t,r,e)},h1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),m1e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${La[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>g1e(a,n));r.input=w_(s)},g1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return _1e(r),w_(r)},_1e=t=>{let e=t.find(r=>typeof r!="string"&&!Gt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as v1e,appendFileSync as T1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&gf(r,n)&&!vn.has(e)&&y1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&S1e.has(o))||t.every(({type:i})=>Zn.has(i))),y1e=t=>t===1||t===2,S1e=new Set(["pipe","overlapped"]),Fre=async(t,e,r,n)=>{for await(let i of t)E1e(e)||jre(i,r,n)},Bre=(t,e,r)=>{for(let n of t)jre(n,e,r)},E1e=t=>t._readableState.pipes.length>0,jre=(t,e,r)=>{let n=WA(t);po({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var zre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>b1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},b1e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Gte(t,o,d),p=_s(f),{stdioItems:h,objectMode:m}=e[r],y=A1e([p],h,c,n),{serializedResult:S,finalResult:b=S}=w1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});x1e({serializedResult:S,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let w=a[r]?b:void 0;try{return n.error===void 0&&R1e(S,h,i),w}catch(T){return n.error=T,w}},A1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},w1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:w_(t)};let s=n7(t,r);return n[o]?{serializedResult:s,finalResult:i$(s,!i[o],e)}:{serializedResult:s}},x1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!kw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=i$(t,!1,s);try{Bre(a,e,n)}catch(c){r.error??=c}},R1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Rw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?T1e(n,t):(r.add(o),v1e(n,t))}};var Gre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Es(e,r,"all")]:Array.isArray(e)?[Es(t,r,"all"),...e]:Gt(t)&&Gt(e)?pL([t,e]):`${t}${e}`};import{once as c$}from"events";var qre=async(t,e)=>{let[r,n]=await C1e(t);return e.isForcefullyTerminated??=!1,[r,n]},C1e=async t=>{let[e,r]=await Promise.allSettled([c$(t,"spawn"),c$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Vre(t):r.value},Vre=async t=>{try{return await c$(t,"exit")}catch{return Vre(t)}},Hre=async t=>{let[e,r]=await t;if(!I1e(e,r)&&l$(e,r))throw new Ri;return[e,r]},I1e=(t,e)=>t===void 0&&e===void 0,l$=(t,e)=>t!==0||e!==null;var Wre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=P1e(t,e,r),s=o?.code==="ETIMEDOUT",a=zte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},P1e=(t,e,r)=>t!==void 0?t:l$(e,r)?new Ri:void 0;var Yre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=N1e(t,e,r),d=D1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return xf(d,c,l)},N1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=k1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);M1e(u);let d=Are(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},k1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,M1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Mw("ipcInput"),t&&Mw("ipc: true"),r&&Mw("detached: true"),n&&Mw("cancelSignal")},Mw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},D1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=L1e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Wre(c,r),{output:h,error:m=l}=zre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,w)=>Es(b,r,w)),S=Es(Gre(h,r),r,"all");return U1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:S,options:r,command:n,escapedCommand:i,startTime:a})},L1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Ure(o,r);let a=$1e(r);return O1e(...gw(t,e,a))}catch(a){return wf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},$1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),U1e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Aw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):M_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as wFe}from"events";import{spawn as xFe}from"child_process";import Qre from"process";import{once as u$,on as F1e}from"events";var Kre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Sf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),B1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),B1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=Da(t,e,r),s=new AbortController;try{return await Promise.race([j1e(o,n,s),z1e(o,r,s),G1e(o,r,s)])}catch(a){throw Ef(t),a}finally{s.abort(),sw(e,i)}},j1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await u$(t,"message",{signal:r});return n}for await(let[n]of F1e(t,"message",{signal:r}))if(e(n))return n},z1e=async(t,e,{signal:r})=>{await u$(t,"disconnect",{signal:r}),Dee(e)},G1e=async(t,e,{signal:r})=>{let[n]=await u$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Jre,on as q1e}from"events";var Xre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>d$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),d$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Sf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=Da(t,e,r),a=new AbortController,c={};return V1e(t,s,a),H1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),W1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},V1e=async(t,e,r)=>{try{await Jre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},H1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Jre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},W1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of q1e(r,"message",{signal:o.signal}))Zre(s),yield c}catch{Zre(s)}finally{o.abort(),sw(e,a),n||Ef(t),i&&await t}},Zre=({error:t})=>{if(t)throw t};var ene=(t,{ipc:e})=>{Object.assign(t,rne(t,!1,e))},tne=()=>{let t=Qre,e=!0,r=Qre.channel!==void 0;return{...rne(t,e,r),getCancelSignal:cte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},rne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Kre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Xre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Y1e}from"child_process";import{PassThrough as K1e,Readable as Z1e,Writable as J1e,Duplex as X1e}from"stream";var nne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{t$(n);let a=new Y1e;Q1e(a,n),Object.assign(a,{readable:eUe,writable:tUe,duplex:rUe});let c=wf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=nUe(c,s,i);return{subprocess:a,promise:l}},Q1e=(t,e)=>{let r=L_(),n=L_(),i=L_(),o=Array.from({length:e.length-3},L_),s=L_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},L_=()=>{let t=new K1e;return t.end(),t},eUe=()=>new Z1e({read(){}}),tUe=()=>new J1e({write(){}}),rUe=()=>new X1e({read(){},write(){}}),nUe=async(t,e,r)=>xf(t,e,r);import{createReadStream as ine,createWriteStream as one}from"fs";import{Buffer as iUe}from"buffer";import{Readable as $_,Writable as oUe,Duplex as sUe}from"stream";var ane=(t,e)=>Cw(aUe,t,e,!1),U_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${La[t]}.`)},sne={fileNumber:U_,generator:a$,asyncGenerator:a$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:sUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},aUe={input:{...sne,fileUrl:({value:t})=>({stream:ine(t)}),filePath:({value:{file:t}})=>({stream:ine(t)}),webStream:({value:t})=>({stream:$_.fromWeb(t)}),iterable:({value:t})=>({stream:$_.from(t)}),asyncIterable:({value:t})=>({stream:$_.from(t)}),string:({value:t})=>({stream:$_.from(t)}),uint8Array:({value:t})=>({stream:$_.from(iUe.from(t))})},output:{...sne,fileUrl:({value:t})=>({stream:one(t)}),filePath:({value:{file:t,append:e}})=>({stream:one(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:oUe.fromWeb(t)}),iterable:U_,asyncIterable:U_,string:U_,uint8Array:U_}};import{on as cUe,once as cne}from"events";import{PassThrough as lUe,getDefaultHighWaterMark as uUe}from"stream";import{finished as dne}from"stream/promises";function Ul(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)p$(i);let e=t.some(({readableObjectMode:i})=>i),r=dUe(t,e),n=new f$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var dUe=(t,e)=>{if(t.length===0)return uUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},f$=class extends lUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(p$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=fUe(this,this.#e,this.#o);let r=mUe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(p$(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},fUe=async(t,e,r)=>{Dw(t,lne);let n=new AbortController;try{await Promise.race([pUe(t,n),hUe(t,e,r,n)])}finally{n.abort(),Dw(t,-lne)}},pUe=async(t,{signal:e})=>{try{await dne(t,{signal:e,cleanup:!0})}catch(r){throw fne(t,r),r}},hUe=async(t,e,r,{signal:n})=>{for await(let[i]of cUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},p$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},mUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,une);let a=new AbortController;try{await Promise.race([gUe(o,e,a),_Ue({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),yUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-une)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?h$(t):SUe(t))},gUe=async(t,e,{signal:r})=>{try{await t,r.aborted||h$(e)}catch(n){r.aborted||fne(e,n)}},_Ue=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await dne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;pne(s)?i.add(e):hne(t,s)}},yUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await cne(t,i,{signal:o}),!t.readable)return cne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},SUe=t=>{t.writable&&t.end()},fne=(t,e)=>{pne(e)?h$(t):hne(t,e)},pne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",h$=t=>{(t.readable||t.writable)&&t.destroy()},hne=(t,e)=>{t.destroyed||(t.once("error",EUe),t.destroy(e))},EUe=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},lne=2,une=1;import{finished as mne}from"stream/promises";var Cf=(t,e)=>{t.pipe(e),vUe(t,e),TUe(t,e)},vUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await mne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}m$(e)}},m$=t=>{t.writable&&t.end()},TUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await mne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}g$(t)}},g$=t=>{t.readable&&t.destroy()};var gne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Zn.has(c)))bUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Zn.has(c)))wUe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Ul(o);Cf(s,i)}},bUe=(t,e,r,n)=>{r==="output"?Cf(t.stdio[n],e):Cf(e,t.stdio[n]);let i=AUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},AUe=["stdin","stdout","stderr"],wUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;xUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},xUe=(t,{signal:e})=>{xi(t)&&Ml(t,RUe,e)},RUe=2;import{addAbortListener as PUe}from"events";var Fl=[];Fl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Fl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Fl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Lw=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",_$=Symbol.for("signal-exit emitter"),y$=globalThis,CUe=Object.defineProperty.bind(Object),S$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(y$[_$])return y$[_$];CUe(y$,_$,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},$w=class{},IUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),E$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},v$=class extends $w{#e=T$.platform==="win32"?"SIGINT":"SIGHUP";#r=new S$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Fl)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Lw(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Fl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Fl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Lw(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Lw(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},T$=globalThis.process,{onExit:_ne,load:Qvt,unload:eTt}=IUe(Lw(T$)?new v$(T$):new E$);var yne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=_ne(()=>{t.kill()});PUe(n,()=>{i()})};var Ene=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=OUe(r,n,i),{sourceStream:d,sourceError:f}=kUe(t,l),{options:p,fileDescriptors:h}=mo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},OUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=NUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},NUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Sne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||dL(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=UA(r,...n);return{destination:e(Sne)(i,o,s),pipeOptions:s}}if(mo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Sne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),kUe=(t,e)=>{try{return{sourceStream:vf(t,e)}}catch(r){return{sourceError:r}}};var Tne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=MUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw b$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},MUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return g$(t),n;if(e!==void 0)return m$(r),e},b$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>wf({error:t,command:vne,escapedCommand:vne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),vne="source.pipe(destination)";var bne=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as DUe}from"stream/promises";var Ane=(t,e,r)=>{let n=Uw.has(e)?$Ue(t,e):LUe(t,e);return Ml(t,FUe,r.signal),Ml(e,BUe,r.signal),UUe(e),n},LUe=(t,e)=>{let r=Ul([t]);return Cf(r,e),Uw.set(e,r),r},$Ue=(t,e)=>{let r=Uw.get(e);return r.add(t),r},UUe=async t=>{try{await DUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,FUe=2,BUe=1;import{aborted as jUe}from"util";var wne=(t,e)=>t===void 0?[]:[zUe(t,e)],zUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await jUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw b$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Mt(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Ene(t,...e),i=GUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},GUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=qUe(t,i);Tne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Ane(e,o,d);return await Promise.race([bne(u),...wne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},qUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as JUe}from"timers/promises";import{on as VUe}from"events";import{getDefaultHighWaterMark as HUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return WUe(e,s),Rne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},WUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},A$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;YUe(e,s,t);let a=t.readableObjectMode&&!o;return Rne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},YUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Rne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=VUe(t,"data",{signal:e.signal,highWaterMark:xne,highWatermark:xne});return KUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},w$=HUe(!0),xne=w$,KUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=ZUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*$l(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*D_(a)}},ZUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Iw(t,i,!n,{})].filter(Boolean);var Cne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=XUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([QUe(t),d]);return}let f=r$(c,r),p=A$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([eFe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},XUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!kw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=A$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Fre(a,t,r,o)},QUe=async t=>{await JUe(),t.readableFlowing===null&&t.resume()},eFe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ew(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await vw(r,{maxBuffer:o})):await Af(r,{maxBuffer:o})}catch(a){return Ine(Fte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},x$=async t=>{try{return await t}catch(e){return Ine(e)}},Ine=({bufferedData:t})=>t7(t)?new Uint8Array(t):t;import{finished as tFe}from"stream/promises";var F_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=rFe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],tFe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||oFe(a,e,r,n)}finally{s.abort()}},rFe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&nFe(t,r,n),n},nFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{iFe(e,r),n.call(t,...i)}},iFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},oFe=(t,e,r,n)=>{if(!sFe(t,e,r,n))throw t},sFe=(t,e,r,n=!0)=>r.propagating?Pne(t)||jw(t):(r.propagating=!0,R$(r,e)===n?Pne(t):jw(t)),R$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Pne=t=>t?.code==="EPIPE";var One=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>C$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),C$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=F_(t,e,l);if(R$(l,e)){await u;return}let[d]=await Promise.all([Cne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var Nne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ul([t,e].filter(Boolean)):void 0,kne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>C$({...aFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:cFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),aFe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},cFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as lFe}from"events";var Mne=t=>gf(t,"ipc"),Dne=(t,e)=>{let r=WA(t);po({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Lne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Mne(o),a=ys(e,"ipc"),c=ys(r,"ipc");for await(let l of d$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Bte(t,i,c),i.push(l)),s&&Dne(l,o);return i},$ne=async(t,e)=>(await Promise.allSettled([t]),e);var Une=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:y,controller:S})=>{let b=qre(t,f),w={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},T=One({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),C=kne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),O=[],k=Lne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),P=uFe(m,t,w),M=dFe(h,w);try{return await Promise.race([Promise.all([{},Hre(b),Promise.all(T),C,k,yte(t,d),...P,...M]),y,fFe(t,S),...pte(t,o,f,S),...Mee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:S}),...dte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:S})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(T.map(_=>x$(_))),x$(C),$ne(k,O),Promise.allSettled(P),Promise.allSettled(M)])}},uFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:F_(n,i,r)),dFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>F_(s,n,e,{isSameDirection:Zn.has(i),stopOnExit:i==="native"}))),fFe=async(t,{signal:e})=>{let[r]=await lFe(t,"error",{signal:e});throw r};var Fne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),B_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ho();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},If=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as pFe}from"stream";import{callbackify as hFe}from"util";import{finished as Bne}from"stream/promises";var I$=async t=>{if(t!==void 0)try{await P$(t)}catch{}},jne=async t=>{if(t!==void 0)try{await O$(t)}catch{}},P$=async t=>{await Bne(t,{cleanup:!0,readable:!1,writable:!0})},O$=async t=>{await Bne(t,{cleanup:!0,readable:!0,writable:!1})},zw=async(t,e)=>{if(await t,e)throw e},Gw=(t,e,r)=>{r&&!jw(r)?t.destroy(r):e&&t.destroy()};var zne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||vn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=N$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=k$(a,s),{read:f,onStdoutDataDone:p}=M$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new pFe({read:f,destroy:hFe(L$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return D$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},N$=(t,e,r)=>{let n=vf(t,e),i=B_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},k$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:w$},M$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ho(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){mFe(this,s,o)},onStdoutDataDone:o}},mFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},D$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await O$(t),await n,await I$(i),await e,r.readable&&r.push(null)}catch(o){await I$(i),Gne(r,o)}},L$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await If(r,e)&&(Gne(t,n),await zw(e,n))},Gne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as gFe}from"stream";import{callbackify as qne}from"util";var Vne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=$$(t,r,e),s=new gFe({...U$(n,t,i),destroy:qne(B$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return F$(n,s),s},$$=(t,e,r)=>{let n=iw(t,e),i=B_(r,n,"writableFinal"),o=B_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},U$=(t,e,r)=>({write:_Fe.bind(void 0,t),final:qne(yFe.bind(void 0,t,e,r))}),_Fe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},yFe=async(t,e,r)=>{await If(r,e)&&(t.writable&&t.end(),await e)},F$=async(t,e,r)=>{try{await P$(t),e.writable&&e.end()}catch(n){await jne(r),Hne(e,n)}},B$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await If(r,e),await If(n,e)&&(Hne(t,i),await zw(e,i))},Hne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as SFe}from"stream";import{callbackify as EFe}from"util";var Wne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||vn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=N$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=$$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=k$(c,a),{read:y,onStdoutDataDone:S}=M$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new SFe({read:y,...U$(u,t,d),destroy:EFe(vFe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return D$({subprocessStdout:c,onStdoutDataDone:S,readable:b,subprocess:t,subprocessStdin:u}),F$(u,b,c),b},vFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([L$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),B$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var j$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||vn.has(e),s=vf(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return TFe(a,s,t)},TFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Yne=(t,{encoding:e})=>{let r=Fne();t.readable=zne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Vne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Wne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=j$.bind(void 0,t,e),t[Symbol.asyncIterator]=j$.bind(void 0,t,e,{})};var Kne=(t,e)=>{for(let[r,n]of AFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},bFe=(async()=>{})().constructor.prototype,AFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(bFe,t)]);var Zne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=RFe(t,e,r),{subprocess:f,promise:p}=IFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Fw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Kne(f,p),mo.set(f,{options:u,fileDescriptors:d}),f},RFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),{file:a,commandArguments:c,options:l}=mw(t,e,r),u=CFe(l),d=ane(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},CFe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},IFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=xFe(...gw(t,e,r))}catch(h){return nne({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;wFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];gne(c,a,l),yne(c,r,l);let d={},f=ho();c.kill=Nee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Nne(c,r),Yne(c,r),ene(c,r);let p=PFe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},PFe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,y]=await Une({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let S=h.map((T,C)=>Es(T,e,C)),b=Es(m,e,"all"),w=OFe({errorInfo:d,exitCode:f,signal:p,stdio:S,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return xf(w,n,e)},OFe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?M_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof go,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Aw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var qw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,NFe(n,t[n],i)]));return{...t,...r}},NFe=(t,e,r)=>kFe.has(t)&&Mt(e)&&Mt(r)?{...e,...r}:r,kFe=new Set(["env",..._L]);var $a=(t,e,r,n)=>{let i=(s,a,c)=>$a(s,a,r,c),o=(...s)=>MFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},MFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Mt(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=DFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Yre(a,c,l):Zne(a,c,l,i)},DFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=a7(e)?c7(e,r):[e,...r],[s,a,c]=UA(...o),l=qw(qw(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Jne=({file:t,commandArguments:e})=>Qne(t,e),Xne=({file:t,commandArguments:e})=>({...Qne(t,e),isSync:!0}),Qne=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=LFe(t);return{file:r,commandArguments:n}},LFe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split($Fe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},$Fe=/ +/g;var eie=(t,e,r)=>{t.sync=e(UFe,r),t.s=t.sync},tie=({options:t})=>rie(t),UFe=({options:t})=>({...rie(t),isSync:!0}),rie=t=>({options:{...FFe(t),...t}}),FFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},nie={preferLocal:!0};var iie=$a(()=>({})),GAt=$a(()=>({isSync:!0})),oie=$a(Jne),qAt=$a(Xne),VAt=$a(mte),HAt=$a(tie,{},nie,eie),{sendMessage:WAt,getOneMessage:YAt,getEachMessage:KAt,getCancelSignal:ZAt}=tne();var sie=!1,aie=()=>{sie=!0},yo=()=>sie;var j_=null,cie=t=>(j_&&j_.destroy(),j_=new Pi({totalAllowedTime:t}),j_),lie=()=>j_;var Pi=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&yo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await IA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ne.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var uie={name:"@netlify/agent-runner-cli",type:"module",version:"1.168.1-claude-compaction.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:opencode":"vitest run test/integration/opencode.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.5","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.2.1","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.12.1",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var GFe=jFe(import.meta.url),qFe=vs.dirname(GFe),VFe=zFe(import.meta.url),Pf=ae("shell"),z$=new Set,die={preferLocal:!0},pr=(t,e,r)=>{let[n,i]=HFe(e,r),o={...die,...i},s=iie(t,n,o);pie(s,o),gie(s);let a=r?.idleTimeout;return a&&a>0&&mie(s,a),s},fie=(t,e)=>{let r={...die,...e},n=oie(t,r);return pie(n,r),gie(n),e?.idleTimeout&&e.idleTimeout>0&&mie(n,e.idleTimeout),n},HFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},pie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||So.env.NETLIFY_LOCAL_QUIET==="true")return;if(So.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new g_).pipe(So.stdout),t.stderr?.pipe(new g_).pipe(So.stderr);return}t.stdout?.pipe(So.stdout),t.stderr?.pipe(So.stderr)},G$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(So.kill(-t.pid,e),Pf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Pf.error("Error killing process:",r),!1}},hie=t=>G$(t,"SIGKILL"),mie=(t,e)=>{let r=null,n=()=>{Pf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),G$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Pf.log(`Force killing idle process ${t.pid}`),hie(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},gie=t=>{z$.add(t);let e=lie();if(e){let r=e.onTimesUp(()=>{Pf.log(`Global timer expired, killing process ${t.pid}`),G$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Pf.log(`Force killing process ${t.pid} after timeout`),hie(t))},5e3)});t.on("exit",()=>{z$.delete(t),r()}),t.on("error",()=>{z$.delete(t),r()})}};function Eo(t,e){if(!So.env.NETLIFY_LOCAL_MODE)try{let i=VFe.resolve(uie.name),o=vs.dirname(i);for(;o!==vs.dirname(o);){let s=vs.dirname(o);if(vs.basename(s)==="node_modules"){let a=vs.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(So.env.NODE_PATH){let i=vs.join(So.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=vs.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=vs.join(qFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var WFe=ae("utils"),YFe=t=>new Promise(e=>{setTimeout(e,t)});var q$=t=>{try{return new URL(t).hostname||null}catch{return null}},Hw=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await YFe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},Ua=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},_ie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):WFe.error("Could not parse JSON",n))}},KFe=t=>t.charAt(0).toUpperCase()+t.slice(1),vo=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():KFe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Ww=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),yie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var V$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},ZFe=1e4,H$=(t,e=ZFe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as JFe}from"crypto";import{createReadStream as XFe}from"fs";import Yw from"fs/promises";import bie from"os";import Kw from"path";var Sie=ae("repo"),Aie="runner-diffs-",wie=t=>`${Aie}${t}-`,xie=async t=>{let e=bie.tmpdir(),r;try{r=await Yw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Aie)&&!n.startsWith(wie(t))).map(n=>Yw.rm(Kw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},tn=(t,e={})=>pr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Zw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Sie.info("Getting runner diffs");let n=await eBe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=rBe(o);await nBe(h,r)}Sie.info("Changes after processing"),await Y$(r);let s=await Z$(o,r);if(await W$(s,r),i=await tBe(r),!i)return{hasChanges:!1,ignored:s};await tn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Yw.mkdtemp(Kw.join(bie.tmpdir(),wie(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:S})=>{let b=Kw.join(a,y);await tn([...S?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:T}=await Yw.stat(b);return{path:b,size:T}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Tie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await vie(d,h)||(f=h)}await Tie(r),ne.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await vie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Eie=async t=>{let e=JFe("sha256");for await(let r of XFe(t))e.update(r);return e.digest("hex")},vie=async(t,e)=>t.size===e.size&&await Eie(t.path)===await Eie(e.path),Tie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await tn(["reset","--soft","HEAD~1"],{cwd:t})},W$=async(t=[],e=process.cwd())=>{await tn(["add",".",...t],{cwd:e})},Y$=async(t=process.cwd())=>{let e=await tn(["status","-s"],{cwd:t});return String(e.stdout??"")},Rie=/.. (.+)?\.log$/,QFe=[Rie],eBe=async(t=process.cwd())=>{let e=await Y$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
135
+ if (condition) { yield value; }`)};import{Buffer as i1e}from"buffer";import{StringDecoder as o1e}from"string_decoder";var Pw=(t,e,r)=>{if(r)return;if(t)return{transform:s1e.bind(void 0,new TextEncoder)};let n=new o1e(e);return{transform:a1e.bind(void 0,n),final:c1e.bind(void 0,n)}},s1e=function*(t,e){i1e.isBuffer(e)?yield _s(e):typeof e=="string"?yield t.encode(e):yield e},a1e=function*(t,e){yield Gt(e)?t.write(e):e},c1e=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as Nre}from"util";var o$=Nre(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),Ow=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=u1e}=e[r];for await(let i of n(t))yield*Ow(i,e,r+1)},kre=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*l1e(r,Number(e),t)},l1e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*Ow(n,r,e+1)},Mre=Nre(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),u1e=function*(t){yield t};var s$=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Dre=(t,e)=>[...e.flatMap(r=>[...$l(r,t,0)]),...D_(t)],$l=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=f1e}=e[r];for(let i of n(t))yield*$l(i,e,r+1)},D_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*d1e(r,Number(e),t)},d1e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*$l(n,r,e+1)},f1e=function*(t){yield t};var a$=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=$re(t,s,o),l=Ll(e),u=Ll(r),d=l?o$.bind(void 0,Ow,a):s$.bind(void 0,$l),f=l||u?o$.bind(void 0,kre,a):s$.bind(void 0,D_),p=l||u?Mre.bind(void 0,a):void 0;return{stream:new p1e({writableObjectMode:n,writableHighWaterMark:Lre(n),readableObjectMode:i,readableHighWaterMark:Lre(i),transform(m,y,S){d([m,c,0],this,S)},flush(m){f([c],this,m)},destroy:p})}},Nw=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let c=$re(s,r,a);t=Dre(c,t)}return t},$re=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:Ire(n,a)},Pw(r,s,n),Iw(r,o,n,c),{transform:t,final:e},{transform:Pre(i,a)},Cre({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)};var Ure=(t,e)=>{for(let r of h1e(t))m1e(t,r,e)},h1e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),m1e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${La[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>g1e(a,n));r.input=w_(s)},g1e=(t,e)=>{let r=Nw(t,e,"utf8",!0);return _1e(r),w_(r)},_1e=t=>{let e=t.find(r=>typeof r!="string"&&!Gt(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as v1e,appendFileSync as T1e}from"fs";var kw=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&gf(r,n)&&!vn.has(e)&&y1e(n)&&(t.some(({type:i,value:o})=>i==="native"&&S1e.has(o))||t.every(({type:i})=>Zn.has(i))),y1e=t=>t===1||t===2,S1e=new Set(["pipe","overlapped"]),Fre=async(t,e,r,n)=>{for await(let i of t)E1e(e)||jre(i,r,n)},Bre=(t,e,r)=>{for(let n of t)jre(n,e,r)},E1e=t=>t._readableState.pipes.length>0,jre=(t,e,r)=>{let n=WA(t);po({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var zre=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((c,l)=>b1e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},b1e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Gte(t,o,d),p=_s(f),{stdioItems:h,objectMode:m}=e[r],y=A1e([p],h,c,n),{serializedResult:S,finalResult:b=S}=w1e({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});x1e({serializedResult:S,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:h,objectMode:m});let w=a[r]?b:void 0;try{return n.error===void 0&&R1e(S,h,i),w}catch(T){return n.error=T,w}},A1e=(t,e,r,n)=>{try{return Nw(t,e,r,!1)}catch(i){return n.error=i,t}},w1e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:w_(t)};let s=n7(t,r);return n[o]?{serializedResult:s,finalResult:i$(s,!i[o],e)}:{serializedResult:s}},x1e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!kw({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=i$(t,!1,s);try{Bre(a,e,n)}catch(c){r.error??=c}},R1e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>Rw.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?T1e(n,t):(r.add(o),v1e(n,t))}};var Gre=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Es(e,r,"all")]:Array.isArray(e)?[Es(t,r,"all"),...e]:Gt(t)&&Gt(e)?pL([t,e]):`${t}${e}`};import{once as c$}from"events";var qre=async(t,e)=>{let[r,n]=await C1e(t);return e.isForcefullyTerminated??=!1,[r,n]},C1e=async t=>{let[e,r]=await Promise.allSettled([c$(t,"spawn"),c$(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Vre(t):r.value},Vre=async t=>{try{return await c$(t,"exit")}catch{return Vre(t)}},Hre=async t=>{let[e,r]=await t;if(!I1e(e,r)&&l$(e,r))throw new Ri;return[e,r]},I1e=(t,e)=>t===void 0&&e===void 0,l$=(t,e)=>t!==0||e!==null;var Wre=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=P1e(t,e,r),s=o?.code==="ETIMEDOUT",a=zte(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},P1e=(t,e,r)=>t!==void 0?t:l$(e,r)?new Ri:void 0;var Yre=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=N1e(t,e,r),d=D1e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return xf(d,c,l)},N1e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),a=k1e(r),{file:c,commandArguments:l,options:u}=mw(t,e,a);M1e(u);let d=Are(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},k1e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,M1e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&Mw("ipcInput"),t&&Mw("ipc: true"),r&&Mw("detached: true"),n&&Mw("cancelSignal")},Mw=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},D1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=L1e({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=Wre(c,r),{output:h,error:m=l}=zre({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),y=h.map((b,w)=>Es(b,r,w)),S=Es(Gre(h,r),r,"all");return U1e({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:y,all:S,options:r,command:n,escapedCommand:i,startTime:a})},L1e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{Ure(o,r);let a=$1e(r);return O1e(...gw(t,e,a))}catch(a){return wf({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},$1e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:bw(e)}),U1e=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?Aw({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):M_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as wFe}from"events";import{spawn as xFe}from"child_process";import Qre from"process";import{once as u$,on as F1e}from"events";var Kre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Sf({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),B1e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),B1e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{ow(e,i);let o=Da(t,e,r),s=new AbortController;try{return await Promise.race([j1e(o,n,s),z1e(o,r,s),G1e(o,r,s)])}catch(a){throw Ef(t),a}finally{s.abort(),sw(e,i)}},j1e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await u$(t,"message",{signal:r});return n}for await(let[n]of F1e(t,"message",{signal:r}))if(e(n))return n},z1e=async(t,e,{signal:r})=>{await u$(t,"disconnect",{signal:r}),Dee(e)},G1e=async(t,e,{signal:r})=>{let[n]=await u$(t,"strict:error",{signal:r});throw rw(n,e)};import{once as Jre,on as q1e}from"events";var Xre=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>d$({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),d$=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Sf({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:lw(t)}),ow(e,o);let s=Da(t,e,r),a=new AbortController,c={};return V1e(t,s,a),H1e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),W1e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},V1e=async(t,e,r)=>{try{await Jre(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},H1e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await Jre(t,"strict:error",{signal:r.signal});n.error=rw(i,e),r.abort()}catch{}},W1e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of q1e(r,"message",{signal:o.signal}))Zre(s),yield c}catch{Zre(s)}finally{o.abort(),sw(e,a),n||Ef(t),i&&await t}},Zre=({error:t})=>{if(t)throw t};var ene=(t,{ipc:e})=>{Object.assign(t,rne(t,!1,e))},tne=()=>{let t=Qre,e=!0,r=Qre.channel!==void 0;return{...rne(t,e,r),getCancelSignal:cte.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},rne=(t,e,r)=>({sendMessage:pw.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Kre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:Xre.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as Y1e}from"child_process";import{PassThrough as K1e,Readable as Z1e,Writable as J1e,Duplex as X1e}from"stream";var nne=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{t$(n);let a=new Y1e;Q1e(a,n),Object.assign(a,{readable:eUe,writable:tUe,duplex:rUe});let c=wf({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=nUe(c,s,i);return{subprocess:a,promise:l}},Q1e=(t,e)=>{let r=L_(),n=L_(),i=L_(),o=Array.from({length:e.length-3},L_),s=L_(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},L_=()=>{let t=new K1e;return t.end(),t},eUe=()=>new Z1e({read(){}}),tUe=()=>new J1e({write(){}}),rUe=()=>new X1e({read(){},write(){}}),nUe=async(t,e,r)=>xf(t,e,r);import{createReadStream as ine,createWriteStream as one}from"fs";import{Buffer as iUe}from"buffer";import{Readable as $_,Writable as oUe,Duplex as sUe}from"stream";var ane=(t,e)=>Cw(aUe,t,e,!1),U_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${La[t]}.`)},sne={fileNumber:U_,generator:a$,asyncGenerator:a$,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:sUe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},aUe={input:{...sne,fileUrl:({value:t})=>({stream:ine(t)}),filePath:({value:{file:t}})=>({stream:ine(t)}),webStream:({value:t})=>({stream:$_.fromWeb(t)}),iterable:({value:t})=>({stream:$_.from(t)}),asyncIterable:({value:t})=>({stream:$_.from(t)}),string:({value:t})=>({stream:$_.from(t)}),uint8Array:({value:t})=>({stream:$_.from(iUe.from(t))})},output:{...sne,fileUrl:({value:t})=>({stream:one(t)}),filePath:({value:{file:t,append:e}})=>({stream:one(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:oUe.fromWeb(t)}),iterable:U_,asyncIterable:U_,string:U_,uint8Array:U_}};import{on as cUe,once as cne}from"events";import{PassThrough as lUe,getDefaultHighWaterMark as uUe}from"stream";import{finished as dne}from"stream/promises";function Ul(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)p$(i);let e=t.some(({readableObjectMode:i})=>i),r=dUe(t,e),n=new f$({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var dUe=(t,e)=>{if(t.length===0)return uUe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},f$=class extends lUe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(p$(e),this.#e.has(e))return;this.#e.add(e),this.#n??=fUe(this,this.#e,this.#o);let r=mUe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#o});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(p$(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},fUe=async(t,e,r)=>{Dw(t,lne);let n=new AbortController;try{await Promise.race([pUe(t,n),hUe(t,e,r,n)])}finally{n.abort(),Dw(t,-lne)}},pUe=async(t,{signal:e})=>{try{await dne(t,{signal:e,cleanup:!0})}catch(r){throw fne(t,r),r}},hUe=async(t,e,r,{signal:n})=>{for await(let[i]of cUe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},p$=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},mUe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{Dw(t,une);let a=new AbortController;try{await Promise.race([gUe(o,e,a),_Ue({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),yUe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),Dw(t,-une)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?h$(t):SUe(t))},gUe=async(t,e,{signal:r})=>{try{await t,r.aborted||h$(e)}catch(n){r.aborted||fne(e,n)}},_Ue=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await dne(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;pne(s)?i.add(e):hne(t,s)}},yUe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await cne(t,i,{signal:o}),!t.readable)return cne(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},SUe=t=>{t.writable&&t.end()},fne=(t,e)=>{pne(e)?h$(t):hne(t,e)},pne=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",h$=t=>{(t.readable||t.writable)&&t.destroy()},hne=(t,e)=>{t.destroyed||(t.once("error",EUe),t.destroy(e))},EUe=()=>{},Dw=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},lne=2,une=1;import{finished as mne}from"stream/promises";var Cf=(t,e)=>{t.pipe(e),vUe(t,e),TUe(t,e)},vUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await mne(t,{cleanup:!0,readable:!0,writable:!1})}catch{}m$(e)}},m$=t=>{t.writable&&t.end()},TUe=async(t,e)=>{if(!(xi(t)||xi(e))){try{await mne(e,{cleanup:!0,readable:!1,writable:!0})}catch{}g$(t)}},g$=t=>{t.readable&&t.destroy()};var gne=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:c})=>Zn.has(c)))bUe(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Zn.has(c)))wUe({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Ul(o);Cf(s,i)}},bUe=(t,e,r,n)=>{r==="output"?Cf(t.stdio[n],e):Cf(e,t.stdio[n]);let i=AUe[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},AUe=["stdin","stdout","stderr"],wUe=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;xUe(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},xUe=(t,{signal:e})=>{xi(t)&&Ml(t,RUe,e)},RUe=2;import{addAbortListener as PUe}from"events";var Fl=[];Fl.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Fl.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Fl.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Lw=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",_$=Symbol.for("signal-exit emitter"),y$=globalThis,CUe=Object.defineProperty.bind(Object),S$=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(y$[_$])return y$[_$];CUe(y$,_$,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},$w=class{},IUe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),E$=class extends $w{onExit(){return()=>{}}load(){}unload(){}},v$=class extends $w{#e=T$.platform==="win32"?"SIGINT":"SIGHUP";#r=new S$;#t;#n;#o;#i={};#s=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Fl)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||e.kill(e.pid,a)}};this.#o=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!Lw(this.#t))return()=>{};this.#s===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#s){this.#s=!0,this.#r.count+=1;for(let e of Fl)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#s&&(this.#s=!1,Fl.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#o,this.#r.count-=1)}#a(e){return Lw(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#o.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&Lw(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},T$=globalThis.process,{onExit:_ne,load:Qvt,unload:eTt}=IUe(Lw(T$)?new v$(T$):new E$);var yne=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=_ne(()=>{t.kill()});PUe(n,()=>{i()})};var Ene=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=YA(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=OUe(r,n,i),{sourceStream:d,sourceError:f}=kUe(t,l),{options:p,fileDescriptors:h}=mo.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:s,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:o}},OUe=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=NUe(t,e,...r),a=iw(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},NUe=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Sne,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||dL(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=UA(r,...n);return{destination:e(Sne)(i,o,s),pipeOptions:s}}if(mo.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Sne=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),kUe=(t,e)=>{try{return{sourceStream:vf(t,e)}}catch(r){return{sourceError:r}}};var Tne=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=MUe({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw b$({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},MUe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return g$(t),n;if(e!==void 0)return m$(r),e},b$=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>wf({error:t,command:vne,escapedCommand:vne,fileDescriptors:e,options:r,startTime:n,isSync:!1}),vne="source.pipe(destination)";var bne=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};import{finished as DUe}from"stream/promises";var Ane=(t,e,r)=>{let n=Uw.has(e)?$Ue(t,e):LUe(t,e);return Ml(t,FUe,r.signal),Ml(e,BUe,r.signal),UUe(e),n},LUe=(t,e)=>{let r=Ul([t]);return Cf(r,e),Uw.set(e,r),r},$Ue=(t,e)=>{let r=Uw.get(e);return r.add(t),r},UUe=async t=>{try{await DUe(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Uw.delete(t)},Uw=new WeakMap,FUe=2,BUe=1;import{aborted as jUe}from"util";var wne=(t,e)=>t===void 0?[]:[zUe(t,e)],zUe=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await jUe(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw b$({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var Fw=(t,...e)=>{if(Mt(e[0]))return Fw.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Ene(t,...e),i=GUe({...n,destination:r});return i.pipe=Fw.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},GUe=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=qUe(t,i);Tne({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Ane(e,o,d);return await Promise.race([bne(u),...wne(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},qUe=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as JUe}from"timers/promises";import{on as VUe}from"events";import{getDefaultHighWaterMark as HUe}from"stream";var Bw=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return WUe(e,s),Rne({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},WUe=async(t,e)=>{try{await t}catch{}finally{e.abort()}},A$=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;YUe(e,s,t);let a=t.readableObjectMode&&!o;return Rne({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},YUe=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Rne=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=VUe(t,"data",{signal:e.signal,highWaterMark:xne,highWatermark:xne});return KUe({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},w$=HUe(!0),xne=w$,KUe=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=ZUe({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*$l(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*D_(a)}},ZUe=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[Pw(t,r,!e),Iw(t,i,!n,{})].filter(Boolean);var Cne=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=XUe({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([QUe(t),d]);return}let f=r$(c,r),p=A$({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([eFe({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return h},XUe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!kw({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=A$({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await Fre(a,t,r,o)},QUe=async t=>{await JUe(),t.readableFlowing===null&&t.resume()},eFe=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Ew(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await vw(r,{maxBuffer:o})):await Af(r,{maxBuffer:o})}catch(a){return Ine(Fte({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},x$=async t=>{try{return await t}catch(e){return Ine(e)}},Ine=({bufferedData:t})=>t7(t)?new Uint8Array(t):t;import{finished as tFe}from"stream/promises";var F_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=rFe(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],tFe(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||oFe(a,e,r,n)}finally{s.abort()}},rFe=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&nFe(t,r,n),n},nFe=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{iFe(e,r),n.call(t,...i)}},iFe=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},oFe=(t,e,r,n)=>{if(!sFe(t,e,r,n))throw t},sFe=(t,e,r,n=!0)=>r.propagating?Pne(t)||jw(t):(r.propagating=!0,R$(r,e)===n?Pne(t):jw(t)),R$=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",jw=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Pne=t=>t?.code==="EPIPE";var One=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>C$({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),C$=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=F_(t,e,l);if(R$(l,e)){await u;return}let[d]=await Promise.all([Cne({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var Nne=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Ul([t,e].filter(Boolean)):void 0,kne=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>C$({...aFe(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:cFe(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),aFe=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},cFe=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as lFe}from"events";var Mne=t=>gf(t,"ipc"),Dne=(t,e)=>{let r=WA(t);po({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Lne=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=Mne(o),a=ys(e,"ipc"),c=ys(r,"ipc");for await(let l of d$({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(Bte(t,i,c),i.push(l)),s&&Dne(l,o);return i},$ne=async(t,e)=>(await Promise.allSettled([t]),e);var Une=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:y,controller:S})=>{let b=qre(t,f),w={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:b,propagating:!1},T=One({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),C=kne({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:w}),O=[],k=Lne({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:O,verboseInfo:p}),P=uFe(m,t,w),M=dFe(h,w);try{return await Promise.race([Promise.all([{},Hre(b),Promise.all(T),C,k,yte(t,d),...P,...M]),y,fFe(t,S),...pte(t,o,f,S),...Mee({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:S}),...dte({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:S})])}catch(F){return f.terminationReason??="other",Promise.all([{error:F},b,Promise.all(T.map(_=>x$(_))),x$(C),$ne(k,O),Promise.allSettled(P),Promise.allSettled(M)])}},uFe=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:F_(n,i,r)),dFe=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>Ii(o,{checkOpen:!1})&&!xi(o)).map(({type:i,value:o,stream:s=o})=>F_(s,n,e,{isSameDirection:Zn.has(i),stopOnExit:i==="native"}))),fFe=async(t,{signal:e})=>{let[r]=await lFe(t,"error",{signal:e});throw r};var Fne=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),B_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=ho();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},If=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as pFe}from"stream";import{callbackify as hFe}from"util";import{finished as Bne}from"stream/promises";var I$=async t=>{if(t!==void 0)try{await P$(t)}catch{}},jne=async t=>{if(t!==void 0)try{await O$(t)}catch{}},P$=async t=>{await Bne(t,{cleanup:!0,readable:!1,writable:!0})},O$=async t=>{await Bne(t,{cleanup:!0,readable:!0,writable:!1})},zw=async(t,e)=>{if(await t,e)throw e},Gw=(t,e,r)=>{r&&!jw(r)?t.destroy(r):e&&t.destroy()};var zne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||vn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=N$(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=k$(a,s),{read:f,onStdoutDataDone:p}=M$({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),h=new pFe({read:f,destroy:hFe(L$.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return D$({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},N$=(t,e,r)=>{let n=vf(t,e),i=B_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},k$=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:w$},M$=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=ho(),s=Bw({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){mFe(this,s,o)},onStdoutDataDone:o}},mFe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},D$=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await O$(t),await n,await I$(i),await e,r.readable&&r.push(null)}catch(o){await I$(i),Gne(r,o)}},L$=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await If(r,e)&&(Gne(t,n),await zw(e,n))},Gne=(t,e)=>{Gw(t,t.readable,e)};import{Writable as gFe}from"stream";import{callbackify as qne}from"util";var Vne=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=$$(t,r,e),s=new gFe({...U$(n,t,i),destroy:qne(B$.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return F$(n,s),s},$$=(t,e,r)=>{let n=iw(t,e),i=B_(r,n,"writableFinal"),o=B_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},U$=(t,e,r)=>({write:_Fe.bind(void 0,t),final:qne(yFe.bind(void 0,t,e,r))}),_Fe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},yFe=async(t,e,r)=>{await If(r,e)&&(t.writable&&t.end(),await e)},F$=async(t,e,r)=>{try{await P$(t),e.writable&&e.end()}catch(n){await jne(r),Hne(e,n)}},B$=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await If(r,e),await If(n,e)&&(Hne(t,i),await zw(e,i))},Hne=(t,e)=>{Gw(t,t.writable,e)};import{Duplex as SFe}from"stream";import{callbackify as EFe}from"util";var Wne=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||vn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=N$(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=$$(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=k$(c,a),{read:y,onStdoutDataDone:S}=M$({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),b=new SFe({read:y,...U$(u,t,d),destroy:EFe(vFe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return D$({subprocessStdout:c,onStdoutDataDone:S,readable:b,subprocess:t,subprocessStdin:u}),F$(u,b,c),b},vFe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([L$({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),B$({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};var j$=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||vn.has(e),s=vf(t,r),a=Bw({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return TFe(a,s,t)},TFe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Yne=(t,{encoding:e})=>{let r=Fne();t.readable=zne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Vne.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Wne.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=j$.bind(void 0,t,e),t[Symbol.asyncIterator]=j$.bind(void 0,t,e,{})};var Kne=(t,e)=>{for(let[r,n]of AFe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},bFe=(async()=>{})().constructor.prototype,AFe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(bFe,t)]);var Zne=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=RFe(t,e,r),{subprocess:f,promise:p}=IFe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=Fw.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Kne(f,p),mo.set(f,{options:u,fileDescriptors:d}),f},RFe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=KA(t,e,r),{file:a,commandArguments:c,options:l}=mw(t,e,r),u=CFe(l),d=ane(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},CFe=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},IFe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=xFe(...gw(t,e,r))}catch(h){return nne({error:h,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;wFe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];gne(c,a,l),yne(c,r,l);let d={},f=ho();c.kill=Nee.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=Nne(c,r),Yne(c,r),ene(c,r);let p=PFe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},PFe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,y]=await Une({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:l,controller:u});u.abort(),l.resolve();let S=h.map((T,C)=>Es(T,e,C)),b=Es(m,e,"all"),w=OFe({errorInfo:d,exitCode:f,signal:p,stdio:S,all:b,ipcOutput:y,context:c,options:e,command:s,escapedCommand:a,startTime:r});return xf(w,n,e)},OFe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?M_({error:t.error,command:c,escapedCommand:l,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof go,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):Aw({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});var qw=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,NFe(n,t[n],i)]));return{...t,...r}},NFe=(t,e,r)=>kFe.has(t)&&Mt(e)&&Mt(r)?{...e,...r}:r,kFe=new Set(["env",..._L]);var $a=(t,e,r,n)=>{let i=(s,a,c)=>$a(s,a,r,c),o=(...s)=>MFe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},MFe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Mt(o))return i(t,qw(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=DFe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?Yre(a,c,l):Zne(a,c,l,i)},DFe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=a7(e)?c7(e,r):[e,...r],[s,a,c]=UA(...o),l=qw(qw(n,i),c),{file:u=s,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:s,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Jne=({file:t,commandArguments:e})=>Qne(t,e),Xne=({file:t,commandArguments:e})=>({...Qne(t,e),isSync:!0}),Qne=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=LFe(t);return{file:r,commandArguments:n}},LFe=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split($Fe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},$Fe=/ +/g;var eie=(t,e,r)=>{t.sync=e(UFe,r),t.s=t.sync},tie=({options:t})=>rie(t),UFe=({options:t})=>({...rie(t),isSync:!0}),rie=t=>({options:{...FFe(t),...t}}),FFe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},nie={preferLocal:!0};var iie=$a(()=>({})),GAt=$a(()=>({isSync:!0})),oie=$a(Jne),qAt=$a(Xne),VAt=$a(mte),HAt=$a(tie,{},nie,eie),{sendMessage:WAt,getOneMessage:YAt,getEachMessage:KAt,getCancelSignal:ZAt}=tne();var sie=!1,aie=()=>{sie=!0},yo=()=>sie;var j_=null,cie=t=>(j_&&j_.destroy(),j_=new Pi({totalAllowedTime:t}),j_),lie=()=>j_;var Pi=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&yo())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let o=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),s=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{s=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await IA({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ne.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),o(),s&&clearTimeout(s)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var uie={name:"@netlify/agent-runner-cli",type:"module",version:"1.168.2-claude-compaction.0",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:opencode":"vitest run test/integration/opencode.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.5","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.2.1","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.12.1",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var GFe=jFe(import.meta.url),qFe=vs.dirname(GFe),VFe=zFe(import.meta.url),Pf=ae("shell"),z$=new Set,die={preferLocal:!0},pr=(t,e,r)=>{let[n,i]=HFe(e,r),o={...die,...i},s=iie(t,n,o);pie(s,o),gie(s);let a=r?.idleTimeout;return a&&a>0&&mie(s,a),s},fie=(t,e)=>{let r={...die,...e},n=oie(t,r);return pie(n,r),gie(n),e?.idleTimeout&&e.idleTimeout>0&&mie(n,e.idleTimeout),n},HFe=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},pie=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0||So.env.NETLIFY_LOCAL_QUIET==="true")return;if(So.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new g_).pipe(So.stdout),t.stderr?.pipe(new g_).pipe(So.stderr);return}t.stdout?.pipe(So.stdout),t.stderr?.pipe(So.stderr)},G$=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(So.kill(-t.pid,e),Pf.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Pf.error("Error killing process:",r),!1}},hie=t=>G$(t,"SIGKILL"),mie=(t,e)=>{let r=null,n=()=>{Pf.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),G$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Pf.log(`Force killing idle process ${t.pid}`),hie(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let o=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",o),t.on("error",o)},gie=t=>{z$.add(t);let e=lie();if(e){let r=e.onTimesUp(()=>{Pf.log(`Global timer expired, killing process ${t.pid}`),G$(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Pf.log(`Force killing process ${t.pid} after timeout`),hie(t))},5e3)});t.on("exit",()=>{z$.delete(t),r()}),t.on("error",()=>{z$.delete(t),r()})}};function Eo(t,e){if(!So.env.NETLIFY_LOCAL_MODE)try{let i=VFe.resolve(uie.name),o=vs.dirname(i);for(;o!==vs.dirname(o);){let s=vs.dirname(o);if(vs.basename(s)==="node_modules"){let a=vs.join(s,".bin",e);if(Vw.existsSync(a))return a;break}o=s}}catch(i){console.error("Could not resolve package.json",i)}if(So.env.NODE_PATH){let i=vs.join(So.env.NODE_PATH,".bin",e);if(Vw.existsSync(i))return i}let r=vs.join(t,"node_modules",".bin",e);if(Vw.existsSync(r))return r;let n=vs.join(qFe,"..","node_modules",".bin",e);if(Vw.existsSync(n))return n}var WFe=ae("utils"),YFe=t=>new Promise(e=>{setTimeout(e,t)});var q$=t=>{try{return new URL(t).hostname||null}catch{return null}},Hw=(t,e=3e3)=>{let r=!1,n=null,i=[],o=null,s=(...a)=>{if(r)return n=a,new Promise(u=>{i.push(u)});r=!0;let c,l=new Promise(u=>{c=u});return o=(async()=>{await Promise.resolve();let u=await t(...a);for(c(u);;){if(await YFe(e),!n)return r=!1,o=null,u;let d=n,f=i;n=null,i=[],u=await t(...d),f.forEach(p=>{p(u)})}})(),l};return s.flush=async()=>{if((r||n)&&o)return await o,s.flush()},s.cancel=()=>{n=null,i.forEach(a=>a(void 0)),i=[]},s},Ua=(t,e,r=!1)=>{let n=null,i=null,o=null,s=function(...a){i=a,o=this;let c=r&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,r||(t.apply(o,i),i=null,o=null)},e),c&&(t.apply(o,i),i=null,o=null)};return s.cancel=()=>{clearTimeout(n),n=null,i=null,o=null},s.flush=()=>{if(n){clearTimeout(n);let a=i,c=o;n=null,i=null,o=null,t.apply(c,a)}},s},_ie=(t,e=!0,r)=>{if(t)try{return JSON.parse(t)}catch(n){e&&(r?.error?r.error("Could not parse JSON",n):WFe.error("Could not parse JSON",n))}},KFe=t=>t.charAt(0).toUpperCase()+t.slice(1),vo=t=>t.split("-").map(e=>e.length===2?e.toUpperCase():KFe(e)).join(" ");function Ts(t,e){e&&t.log(`Skill invoked: ${e}`)}var Ww=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),yie=(t,e,r=!1)=>{if(r)return;let n=60,i=55,o=".netlify.app",s="agent-",a=6;if(!e)return`${s}${t.slice(0,a)}`;let c=`--${e}${o}`;if(c.length>i)return"";let l=n-c.length;if(l<=0)return"";if(l>=s.length+a){let u=Math.min(l-s.length,t.length);return`${s}${t.slice(0,u)}`}return t.slice(0,l)};var V$=t=>{let e=t.match(/<<-?\s*['"]?(\w+)['"]?/);if(!e)return{command:t};let r=t.indexOf(e[0]),n=t.slice(r+e[0].length).trim();return{command:t.slice(0,r).trim(),heredocContent:n||void 0}},ZFe=1e4,H$=(t,e=ZFe)=>{if(!t||typeof t!="string"||t.length<=e)return t;let n=t.startsWith("```")?"\n... [truncated]\n```":"... [truncated]";return t.slice(0,e)+n};import{createHash as JFe}from"crypto";import{createReadStream as XFe}from"fs";import Yw from"fs/promises";import bie from"os";import Kw from"path";var Sie=ae("repo"),Aie="runner-diffs-",wie=t=>`${Aie}${t}-`,xie=async t=>{let e=bie.tmpdir(),r;try{r=await Yw.readdir(e)}catch{return}await Promise.all(r.filter(n=>n.startsWith(Aie)&&!n.startsWith(wie(t))).map(n=>Yw.rm(Kw.join(e,n),{recursive:!0,force:!0}).catch(()=>{})))},tn=(t,e={})=>pr("git",t,{...e,env:{...e.env,NETLIFY_INTERNAL_GIT:"1"}}),Zw=async({config:t,isRetry:e,cwd:r=process.cwd()})=>{Sie.info("Getting runner diffs");let n=await eBe(r),{hasChanges:i}=n,{status:o}=n;if(!i)return{hasChanges:!1};if(!e){let h=rBe(o);await nBe(h,r)}Sie.info("Changes after processing"),await Y$(r);let s=await Z$(o,r);if(await W$(s,r),i=await tBe(r),!i)return{hasChanges:!1,ignored:s};await tn(["commit","-m","Agent runner [skip ci]"],{cwd:r});let a=await Yw.mkdtemp(Kw.join(bie.tmpdir(),wie(t.sessionId))),c=async({from:h,to:m,fileName:y,binary:S})=>{let b=Kw.join(a,y);await tn([...S?["diff",h,m,"--binary"]:["diff",h,m],`--output=${b}`],{stdio:["ignore","ignore","pipe"],cwd:r});let{size:T}=await Yw.stat(b);return{path:b,size:T}},l=await c({from:t.runSha,to:"HEAD",fileName:"session.patch"});if(i=l.size>0,!i)return await Tie(r),{hasChanges:!1,ignored:s};let u=await c({from:t.runSha,to:"HEAD",fileName:"session-binary.patch",binary:!0}),d,f;if(t.sha){d=await c({from:t.sha,to:"HEAD",fileName:"cumulative.patch"});let h=await c({from:t.sha,to:"HEAD",fileName:"cumulative-binary.patch",binary:!0});await vie(d,h)||(f=h)}await Tie(r),ne.distribution("diff.size",u.size);let p={hasChanges:!0,diff:l,resultDiff:d,ignored:s};return await vie(l,u)||(p.diffBinary=u),f&&(p.resultDiffBinary=f),p},Eie=async t=>{let e=JFe("sha256");for await(let r of XFe(t))e.update(r);return e.digest("hex")},vie=async(t,e)=>t.size===e.size&&await Eie(t.path)===await Eie(e.path),Tie=async(t=process.cwd())=>{process.env.NETLIFY_LOCAL_MODE&&await tn(["reset","--soft","HEAD~1"],{cwd:t})},W$=async(t=[],e=process.cwd())=>{await tn(["add",".",...t],{cwd:e})},Y$=async(t=process.cwd())=>{let e=await tn(["status","-s"],{cwd:t});return String(e.stdout??"")},Rie=/.. (.+)?\.log$/,QFe=[Rie],eBe=async(t=process.cwd())=>{let e=await Y$(t);return{hasChanges:(e.trim().length===0?[]:e.split(`
136
136
  `).filter(i=>QFe.some(s=>s instanceof RegExp?s.test(i):i===s)?!1:i[1]?.trim()!=="")).length!==0,status:e}},tBe=async(t=process.cwd())=>{try{return await tn(["diff","--staged","--quiet"],{cwd:t}),!1}catch{return!0}},K$=async(t=process.cwd())=>{let{stdout:e}=await tn(["rev-parse","HEAD"],{cwd:t});return String(e??"").trim()},Cie=async(t=process.cwd())=>{let{stdout:e}=await tn(["rev-list","--max-parents=0","HEAD"],{cwd:t});return String(e??"").trim()},Z$=async(t,e=process.cwd())=>{t||=await Y$(e);let r=[".netlify","node_modules","dist",".next","out",".nuxt",".output",".cache",".turbo",".parcel-cache","coverage",".nyc_output","storybook-static","public/build","CLAUDE.local.md"],n=[];return t.split(`
137
137
  `).forEach(i=>{r.forEach(s=>{let a=i===`?? ${s}`,c=i.startsWith(`?? ${s}/`)||i.startsWith(`?? ${s}${Kw.sep}`);(a||c)&&n.push(`:!${s}`)});let o=i.match(Rie)?.[1];o&&n.push(`:!${o}.log`)}),n},Iie=async(t=process.cwd())=>{await tn(["reset","--hard","HEAD"],{cwd:t})},Pie=async(t=process.cwd())=>{let e=await tn(["clean","-fd","-e",".netlify"],{stdio:["ignore","pipe","pipe"],cwd:t});return String(e.stdout??"").split(`
138
138
  `).filter(r=>r.startsWith("Removing ")).map(r=>r.slice(9))},rBe=t=>{let e=t.split(`
@@ -360,11 +360,11 @@ Replace \`<template-id>\` with the matching template \`id\`. Include \`--package
360
360
  ${r}
361
361
  `)}catch{await Bp.writeFile(e,`${r}
362
362
  `)}wr.log("Added @AGENTS.md import to CLAUDE.local.md")}async function q2({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=jp.cwd(),cliPath:a="netlify",abortSignal:c,onSessionId:l,forceLowEffortForCreditWrapUp:u}){let d=t,{prompt:f}=d,{model:p}=t,h="";await jGe();let m=BGe({aiGateway:n}),y=await FGe({config:t,aiGateway:n,model:p});u&&y?.includes("fable")&&(!n||await n.isModelAvailableForProvider("anthropic",G2))&&(wr.log(`Credit wrap-up: downgrading model ${y} to ${G2}`),y=G2);let S=[],b=[],w={},T=new Set,C=[],O=Oe=>Oe?.match(/task\s+#([\w-]+)\s+created/i)?.[1],k=Oe=>{if(typeof Oe=="string")return Oe;if(Array.isArray(Oe))return Oe.filter(ze=>ze?.type==="text"&&typeof ze.text=="string").map(ze=>ze.text).join(`
363
- `)||void 0},P=(Oe,Ee)=>{let ze=Oe.input||{};if(Oe.name==="TaskCreate"){C.push({id:O(Ee),subject:typeof ze.subject=="string"?ze.subject:"",activeForm:typeof ze.activeForm=="string"?ze.activeForm:void 0,status:"pending"});return}let ye=typeof ze.taskId=="string"?ze.taskId:void 0,Ae=ye===void 0?void 0:C.find(Hr=>Hr.id===ye);if(!Ae&&typeof ze.subject=="string"){let Hr=C.filter(Bo=>Bo.subject===ze.subject);Hr.length===1&&(Ae=Hr[0])}if(ze.status==="deleted"){Ae&&C.splice(C.indexOf(Ae),1);return}if(!Ae){if(ye===void 0||typeof ze.subject!="string"&&typeof ze.activeForm!="string")return;Ae={id:ye,subject:"",status:"pending"},C.push(Ae)}typeof ze.status=="string"&&(Ae.status=ze.status),typeof ze.subject=="string"&&(Ae.subject=ze.subject),typeof ze.activeForm=="string"&&(Ae.activeForm=ze.activeForm)},M=()=>C.map(Oe=>({name:Oe.status==="in_progress"&&Oe.activeForm||Oe.subject,value:Oe.status})),F=0,_=0,re,N,g,E,x,Y="",G="mode"in t&&t.mode==="create"&&t.accountType===tL,fe="mode"in t&&t.mode==="ask",$e=Ka({creditWrapUpTurn:u}),Ie=He().creditWrapUpEnabled&&au(t),Pe=G&&!Ie,xe=["ExitPlanMode","EnterPlanMode","AskUserQuestion"];Pe&&xe.push("TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"),fe&&(xe.push("Edit","Write","NotebookEdit","EnterWorktree","Bash(git push:*)","Bash(netlify deploy:*)"),cp(t)||xe.push(...Cx(a).map(Oe=>`Bash(${Oe}:*)`)));let Fe=sp("claude",t.effort);t.effort&&!Fe&&wr.log(`Effort '${t.effort}' is not available on ${Yy}; using its default`);let Re=u||Pe?"low":Fe??"high",ce=Eo(s,"claude");if(!ce)throw new Error("Claude CLI binary not found");let _e=$e?await Ioe():void 0,qe=["--permission-mode","bypassPermissions","--dangerously-skip-permissions","--output-format","stream-json","--verbose","--disallowed-tools",xe.join(","),..._e?.args??[],"--effort",Re,...y?["--model",y]:[],...i?o?["--resume",o]:["--continue"]:[],"-p"];wr.log(`Running ${ce} ${qe.join(" ")}`);let H=e.utils.run(ce,qe,{all:!0,env:m,cwd:s,idleTimeout:ms,cancelSignal:c});H.stdin?.end(f);let le=Ua(()=>{r?.({steps:S,duration:_})},250),R=(Oe,Ee)=>{let{wrapMessage:ze,...ye}=Oe,Ae=Ww({...ye,id:F});Ae.message&&(Ae.message=Ae.message.replace(/\n?<system-reminder>.+?<\/system-reminder>\n?/gs,"").trim(),ze&&Ae.message&&(Ae.message=`\`\`\`
363
+ `)||void 0},P=(Oe,ye)=>{let ze=Oe.input||{};if(Oe.name==="TaskCreate"){C.push({id:O(ye),subject:typeof ze.subject=="string"?ze.subject:"",activeForm:typeof ze.activeForm=="string"?ze.activeForm:void 0,status:"pending"});return}let Se=typeof ze.taskId=="string"?ze.taskId:void 0,Ae=Se===void 0?void 0:C.find(Hr=>Hr.id===Se);if(!Ae&&typeof ze.subject=="string"){let Hr=C.filter(Bo=>Bo.subject===ze.subject);Hr.length===1&&(Ae=Hr[0])}if(ze.status==="deleted"){Ae&&C.splice(C.indexOf(Ae),1);return}if(!Ae){if(Se===void 0||typeof ze.subject!="string"&&typeof ze.activeForm!="string")return;Ae={id:Se,subject:"",status:"pending"},C.push(Ae)}typeof ze.status=="string"&&(Ae.status=ze.status),typeof ze.subject=="string"&&(Ae.subject=ze.subject),typeof ze.activeForm=="string"&&(Ae.activeForm=ze.activeForm)},M=()=>C.map(Oe=>({name:Oe.status==="in_progress"&&Oe.activeForm||Oe.subject,value:Oe.status})),F=0,_=0,re,N,g,E,x,Y="",q="mode"in t&&t.mode==="create"&&t.accountType===tL,fe="mode"in t&&t.mode==="ask",$e=Ka({creditWrapUpTurn:u}),Ie=He().creditWrapUpEnabled&&au(t),Pe=q&&!Ie,xe=["ExitPlanMode","EnterPlanMode","AskUserQuestion"];Pe&&xe.push("TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"),fe&&(xe.push("Edit","Write","NotebookEdit","EnterWorktree","Bash(git push:*)","Bash(netlify deploy:*)"),cp(t)||xe.push(...Cx(a).map(Oe=>`Bash(${Oe}:*)`)));let Fe=sp("claude",t.effort);t.effort&&!Fe&&wr.log(`Effort '${t.effort}' is not available on ${Yy}; using its default`);let Re=u||Pe?"low":Fe??"high",ce=Eo(s,"claude");if(!ce)throw new Error("Claude CLI binary not found");let _e=$e?await Ioe():void 0,qe=["--permission-mode","bypassPermissions","--dangerously-skip-permissions","--output-format","stream-json","--verbose","--disallowed-tools",xe.join(","),..._e?.args??[],"--effort",Re,...y?["--model",y]:[],...i?o?["--resume",o]:["--continue"]:[],"-p"];wr.log(`Running ${ce} ${qe.join(" ")}`);let H=e.utils.run(ce,qe,{all:!0,env:m,cwd:s,idleTimeout:ms,cancelSignal:c});H.stdin?.end(f);let le=Ua(()=>{r?.({steps:S,duration:_})},250),R=(Oe,ye)=>{let{wrapMessage:ze,...Se}=Oe,Ae=Ww({...Se,id:F});Ae.message&&(Ae.message=Ae.message.replace(/\n?<system-reminder>.+?<\/system-reminder>\n?/gs,"").trim(),ze&&Ae.message&&(Ae.message=`\`\`\`
364
364
  ${Ae.message}
365
- \`\`\``)),F+=1,b.push(Ae),S.push(Ae),Ee||le.flush(),le(),Ee&&le.flush()},I=y||Gce,U=Pe?`Using ${Yy} with ${I} and low effort because you are reaching your user limit`:`Using ${Yy} with ${I}`;t.answeredInteraction||R({title:U,category:V.Environment},!0);let j=$Ge.createInterface({input:H.all});j.on("error",Oe=>{wr.error("Readline interface error",{error:Oe.message,stack:Oe.stack})});let q=!1;j.on("line",Oe=>{let Ee=null;try{Ee=JSON.parse(Oe)}catch{wr.log("Could not parse line",Oe)}Ee?.session_id&&Ee.session_id!==h&&(h=Ee.session_id,l?.(h));let ze=!1;Ee?.type==="system"&&Ee.subtype==="status"&&Ee.status==="compacting"?(R({category:V.Compaction,message:"Compacting context\u2026"}),q=!0):q&&Ee?.type==="user"&&(q=!1,ze=!0),Array.isArray(Ee?.message?.content)?Ee.message.content.forEach(ye=>{switch(ye.type){case"text":{if(ye.text){if(ye.text.startsWith("Base directory for this skill:"))break;Ee.message?.role!=="user"&&(Y=ye.text),R(ze?{message:ye.text,category:V.Compaction,parentGroupId:Ee.parent_tool_use_id||void 0}:{message:ye.text,category:Ee.message?.role==="user"?V.SubagentPrompt:V.AgentMessage,parentGroupId:Ee.parent_tool_use_id||void 0})}break}case"image":{typeof ye.source=="object"&&ye.source&&ye.source.type==="base64"&&ye.source.media_type?R({message:`![](data:${ye.source.media_type};base64,${ye.source.data})`,category:V.AgentMessage,parentGroupId:Ee.parent_tool_use_id||void 0}):wr.log(`Unsupported image type ${ye.source?.type}`,ye.source);break}case"tool_use":{if(ye.name&&!Ls[ye.name]&&!T.has(ye.name)&&(T.add(ye.name),wr.log(`Unmapped tool in stream: ${ye.name}`)),z2(ye.name)){let Ae=ye.input?.description&&`\`${ye.input.description}\``;R({title:[Wy(ye.name),Ae].filter(Boolean).join(" "),category:Ls[ye.name]?.category,groupId:ye.id,parentGroupId:Ee.parent_tool_use_id||void 0})}else ye.name==="Bash"&&Ds(ye.input?.command)&&R({title:"Generating the site",category:V.SiteGeneration,groupId:ye.id,parentGroupId:Ee.parent_tool_use_id||void 0});if(ye.name===O1&&ye.id&&!x){let Ae=sc.safeParse(ye.input);Ae.success?(x={questions:Ae.data.questions},H.kill()):(wr.warn("Ignoring malformed ask tool input",{toolUseId:ye.id,issues:ac(Ae.error.issues)}),ne.inc("inference.malformed_ask",1))}ye.id&&(w[ye.id]=ye),le.flush();break}case"tool_result":{let Ae=ye.tool_use_id?w[ye.tool_use_id]:void 0;if(Ae?.name===O1)break;let Hr=z2(Ae?.name),Bo=Ae?.name==="Bash"&&Ds(Ae?.input?.command);if(Ae?.name==="Skill"&&Ae?.input?.skill){let tt=vo(Ae.input.skill?.toString());Ts(wr,tt),R({title:`Use ${tt}`,category:V.Skill,type:Ae.input.skill?.toString(),parentGroupId:Ee.parent_tool_use_id||void 0},!0);break}if(Ae?.name==="TodoWrite"){let{name:tt,category:Xe}=Ls.TodoWrite;R({title:tt,category:Xe,parentGroupId:Ee.parent_tool_use_id||void 0,tasks:Ee.tool_use_result?.newTodos?.map(jo=>({name:jo.status==="in_progress"?jo.activeForm:jo.content,value:jo.status}))},!0);break}if(Ae?.name==="TaskCreate"||Ae?.name==="TaskUpdate"){ye.is_error||P(Ae,k(ye.content)),R({title:Wy(Ae.name),category:V.Todo,parentGroupId:Ee.parent_tool_use_id||void 0,tasks:M()},!0);break}if(Ae?.name&&jce.has(Ae.name)){let tt=Ls[Ae.name]?.category||V.Tool,Xe=tt===V.Todo&&C.length>0;R({title:Wy(Ae.name),category:tt===V.Todo&&!Xe?V.Tool:tt,parentGroupId:Ee.parent_tool_use_id||void 0,...Xe?{tasks:M()}:{}},!0);break}let gP=!!(Ae?.name&&Ls[Ae.name]),gm;if(!Hr&&!Bo&&Ae){let tt=Ae.input?.file_path&&Ky.relative(s,Ae.input.file_path);tt||(tt=Ae.input?.pattern||Ae.input?.command);let Xe=tt&&`\`${tt}\``;gm=[Wy(Ae.name||""),Xe].filter(Boolean).join(" ")}else!Hr&&!Bo&&!Ae&&(gm="Tool result");let _m=["Bash","Glob","Grep","LS","Read","Edit","Write","TaskOutput"].includes(Ae?.name||"")||!Hr&&!Bo&&!gP,ea=Ee.parent_tool_use_id||void 0;!ea&&(Hr||Bo)&&(ea=ye.tool_use_id);let Ce,at=Hr&&Ee.tool_use_result?.content||ye.content;if(typeof at=="string")Ce=at;else if(Array.isArray(at)){let tt=[];at.forEach(Xe=>{Xe?.type==="text"&&typeof Xe.text=="string"?tt.push(Xe.text):Xe?.type==="image"&&typeof Xe.source=="object"&&Xe.source?Xe.source.type==="base64"&&Xe.source.media_type?tt.push(`![](data:${Xe.source.media_type};base64,${Xe.source.data})`):wr.log(`Unsupported image type ${Xe.source.type}`,Xe.source):wr.log(`Unsupported block type ${Xe?.type}`)}),Ce=tt.join(`
365
+ \`\`\``)),F+=1,b.push(Ae),S.push(Ae),ye||le.flush(),le(),ye&&le.flush()},I=y||Gce,U=Pe?`Using ${Yy} with ${I} and low effort because you are reaching your user limit`:`Using ${Yy} with ${I}`;t.answeredInteraction||R({title:U,category:V.Environment},!0);let j=$Ge.createInterface({input:H.all});j.on("error",Oe=>{wr.error("Readline interface error",{error:Oe.message,stack:Oe.stack})});let G=!1;j.on("line",Oe=>{let ye=null;try{ye=JSON.parse(Oe)}catch{wr.log("Could not parse line",Oe)}ye?.session_id&&ye.session_id!==h&&(h=ye.session_id,l?.(h));let ze=!1;ye?.type==="system"&&ye.subtype==="status"&&ye.status==="compacting"?(G||R({category:V.Compaction,message:"Compacting context\u2026"}),G=!0):G&&ye?.type==="user"&&Array.isArray(ye.message?.content)&&ye.message.content.some(Se=>Se.type==="text"&&!!Se.text)?(G=!1,ze=!0):ye?.type==="system"&&ye.subtype==="status"&&(ye.status===null||ye.compact_error!=null)&&(G=!1),Array.isArray(ye?.message?.content)?ye.message.content.forEach(Se=>{switch(Se.type){case"text":{if(Se.text){if(Se.text.startsWith("Base directory for this skill:"))break;ye.message?.role!=="user"&&(Y=Se.text),R(ze?{message:Se.text,category:V.Compaction,parentGroupId:ye.parent_tool_use_id||void 0}:{message:Se.text,category:ye.message?.role==="user"?V.SubagentPrompt:V.AgentMessage,parentGroupId:ye.parent_tool_use_id||void 0})}break}case"image":{typeof Se.source=="object"&&Se.source&&Se.source.type==="base64"&&Se.source.media_type?R({message:`![](data:${Se.source.media_type};base64,${Se.source.data})`,category:V.AgentMessage,parentGroupId:ye.parent_tool_use_id||void 0}):wr.log(`Unsupported image type ${Se.source?.type}`,Se.source);break}case"tool_use":{if(Se.name&&!Ls[Se.name]&&!T.has(Se.name)&&(T.add(Se.name),wr.log(`Unmapped tool in stream: ${Se.name}`)),z2(Se.name)){let Ae=Se.input?.description&&`\`${Se.input.description}\``;R({title:[Wy(Se.name),Ae].filter(Boolean).join(" "),category:Ls[Se.name]?.category,groupId:Se.id,parentGroupId:ye.parent_tool_use_id||void 0})}else Se.name==="Bash"&&Ds(Se.input?.command)&&R({title:"Generating the site",category:V.SiteGeneration,groupId:Se.id,parentGroupId:ye.parent_tool_use_id||void 0});if(Se.name===O1&&Se.id&&!x){let Ae=sc.safeParse(Se.input);Ae.success?(x={questions:Ae.data.questions},H.kill()):(wr.warn("Ignoring malformed ask tool input",{toolUseId:Se.id,issues:ac(Ae.error.issues)}),ne.inc("inference.malformed_ask",1))}Se.id&&(w[Se.id]=Se),le.flush();break}case"tool_result":{let Ae=Se.tool_use_id?w[Se.tool_use_id]:void 0;if(Ae?.name===O1)break;let Hr=z2(Ae?.name),Bo=Ae?.name==="Bash"&&Ds(Ae?.input?.command);if(Ae?.name==="Skill"&&Ae?.input?.skill){let tt=vo(Ae.input.skill?.toString());Ts(wr,tt),R({title:`Use ${tt}`,category:V.Skill,type:Ae.input.skill?.toString(),parentGroupId:ye.parent_tool_use_id||void 0},!0);break}if(Ae?.name==="TodoWrite"){let{name:tt,category:Xe}=Ls.TodoWrite;R({title:tt,category:Xe,parentGroupId:ye.parent_tool_use_id||void 0,tasks:ye.tool_use_result?.newTodos?.map(jo=>({name:jo.status==="in_progress"?jo.activeForm:jo.content,value:jo.status}))},!0);break}if(Ae?.name==="TaskCreate"||Ae?.name==="TaskUpdate"){Se.is_error||P(Ae,k(Se.content)),R({title:Wy(Ae.name),category:V.Todo,parentGroupId:ye.parent_tool_use_id||void 0,tasks:M()},!0);break}if(Ae?.name&&jce.has(Ae.name)){let tt=Ls[Ae.name]?.category||V.Tool,Xe=tt===V.Todo&&C.length>0;R({title:Wy(Ae.name),category:tt===V.Todo&&!Xe?V.Tool:tt,parentGroupId:ye.parent_tool_use_id||void 0,...Xe?{tasks:M()}:{}},!0);break}let gP=!!(Ae?.name&&Ls[Ae.name]),gm;if(!Hr&&!Bo&&Ae){let tt=Ae.input?.file_path&&Ky.relative(s,Ae.input.file_path);tt||(tt=Ae.input?.pattern||Ae.input?.command);let Xe=tt&&`\`${tt}\``;gm=[Wy(Ae.name||""),Xe].filter(Boolean).join(" ")}else!Hr&&!Bo&&!Ae&&(gm="Tool result");let _m=["Bash","Glob","Grep","LS","Read","Edit","Write","TaskOutput"].includes(Ae?.name||"")||!Hr&&!Bo&&!gP,ea=ye.parent_tool_use_id||void 0;!ea&&(Hr||Bo)&&(ea=Se.tool_use_id);let Ce,at=Hr&&ye.tool_use_result?.content||Se.content;if(typeof at=="string")Ce=at;else if(Array.isArray(at)){let tt=[];at.forEach(Xe=>{Xe?.type==="text"&&typeof Xe.text=="string"?tt.push(Xe.text):Xe?.type==="image"&&typeof Xe.source=="object"&&Xe.source?Xe.source.type==="base64"&&Xe.source.media_type?tt.push(`![](data:${Xe.source.media_type};base64,${Xe.source.data})`):wr.log(`Unsupported image type ${Xe.source.type}`,Xe.source):wr.log(`Unsupported block type ${Xe?.type}`)}),Ce=tt.join(`
366
366
 
367
- `)}if(Hr&&Ce&&Bce(Ce)){R({title:"Running in background",category:V.Task,parentGroupId:ea},!0);break}R({title:gm,message:Ce,wrapMessage:_m,category:Hr?V.AgentMessage:Bo?V.SiteGeneration:Ls[Ae?.name??""]?.category||V.Tool,parentGroupId:ea},!0);break}case"thinking":{ye.thinking&&R({title:"Reasoning",message:ye.thinking,category:V.Reasoning,parentGroupId:Ee.parent_tool_use_id||void 0},!0);break}default:wr.log(`Message content type is not supported ${ye.type}`,ye)}}):Ee?.type==="result"&&(_=Ee.duration_ms||0,Ee.is_error?x||(N=Ee.result,g=Ee.api_error_status??void 0):re=Ee.result,Ee.usage&&(Na(Ee.usage,y?{model:y}:{}),E=Ee.usage),[b,S].forEach(ye=>{ye[ye.length-1]?.message===re&&ye.pop()}))});let ee=!1;if(await H.catch(Oe=>{ee=Wa(Oe,c),{error:N,result:re}=ap({catchError:Oe,runCmd:H,error:N,result:re,runnerName:"Claude"})}),_e&&await Bp.rm(_e.mcpConfigPath,{force:!0}).catch(()=>{}),j.close(),le.flush(),x)return{steps:b,duration:_,agentSessionId:h,resolvedModel:y,effort:Re,usage:E,pendingInteraction:x};let se=ee;se&&(!re&&Y.trim()&&(re=Y.trim()),N=void 0);let Te=N?Oce({error:N,apiErrorStatus:g}):void 0,Ye=hC(Te);return Ye&&wr.log(`Classified provider failure as ${Ye.failureClass}`,JSON.stringify({...Te,retryable:Ye.retryable})),{steps:b,duration:_,result:await cc({initialResult:re,agentName:Yy,hasError:!!N}),error:lc({error:N,agentName:Yy}),isRetryableError:Ye?.retryable??uc(N),isProviderUnavailableError:Ye?.providerFault??dc(N),...Te?{providerFailure:Te}:{},agentSessionId:h,resolvedModel:y,effort:Re,usage:E,...se?{aborted:!0}:{}}}var qce=async()=>{let t=Ky.join(zce.homedir(),".claude");await Bp.rm(t,{recursive:!0,force:!0})},Vce={baseDir:Ky.join(zce.homedir(),".claude"),include:["projects"]};import yS from"fs/promises";import SS from"os";import Ic from"path";import Hs from"process";import fqe from"readline";function we(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function $(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var V2=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return V2=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Zy(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Jy=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var me=class extends Error{},Pt=class t extends me{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new fc({message:n,cause:Jy(r)});let o=r?.error;return e===400?new zp(e,o,n,i):e===401?new Gp(e,o,n,i):e===403?new qp(e,o,n,i):e===404?new Vp(e,o,n,i):e===409?new Hp(e,o,n,i):e===422?new Wp(e,o,n,i):e===429?new Yp(e,o,n,i):e>=500?new Kp(e,o,n,i):new t(e,o,n,i)}},Ut=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},fc=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},pc=class extends fc{constructor({message:e}={}){super({message:e??"Request timed out."})}},zp=class extends Pt{},Gp=class extends Pt{},qp=class extends Pt{},Vp=class extends Pt{},Hp=class extends Pt{},Wp=class extends Pt{},Yp=class extends Pt{},Kp=class extends Pt{},Zp=class extends me{constructor(){super("Could not parse response content as the length limit was reached")}},Jp=class extends me{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Ro=class extends Error{constructor(e){super(e)}},lu=class extends Pt{constructor(e,r,n){let i="OAuth2 authentication error",o;if(r&&typeof r=="object"){let s=r;o=s.error;let a=s.error_description;a&&typeof a=="string"?i=a:o&&(i=o)}super(e,r,i,n),this.error_code=o}},Xy=class extends me{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var GGe=/^[a-z][a-z0-9+.-]*:/i,Hce=t=>GGe.test(t),xr=t=>(xr=Array.isArray,xr(t)),H2=xr;function W2(t){return typeof t!="object"?{}:t??{}}function Y2(t){if(!t)return!0;for(let e in t)return!1;return!0}function Wce(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Qy(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Yce=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new me(`${t} must be an integer`);if(e<0)throw new me(`${t} must be a positive integer`);return e};var Kce=t=>{try{return JSON.parse(t)}catch{return}};var Co=t=>new Promise(e=>setTimeout(e,t));var hc="6.34.0";var Qce=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function qGe(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var VGe=()=>{let t=qGe();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(Deno.build.os),"X-Stainless-Arch":Zce(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Zce(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=HGe();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function HGe(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,o=n[2]||0,s=n[3]||0;return{browser:e,version:`${i}.${o}.${s}`}}}return null}var Zce=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Jce=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Xce,ele=()=>Xce??(Xce=VGe());function _C(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function K2(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function yC(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return K2({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function Z2(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function J2(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var rle=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var X2="RFC3986",Q2=t=>String(t),ez={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:Q2},nle="RFC1738";var SC=(t,e)=>(SC=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),SC(t,e)),Io=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var tz=1024,ile=(t,e,r,n,i)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<o.length;a+=tz){let c=o.length>=tz?o.slice(a,a+tz):o,l=[];for(let u=0;u<c.length;++u){let d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===nle&&(d===40||d===41)){l[l.length]=c.charAt(u);continue}if(d<128){l[l.length]=Io[d];continue}if(d<2048){l[l.length]=Io[192|d>>6]+Io[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=Io[224|d>>12]+Io[128|d>>6&63]+Io[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=Io[240|d>>18]+Io[128|d>>12&63]+Io[128|d>>6&63]+Io[128|d&63]}s+=l.join("")}return s};function ole(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function rz(t,e){if(xr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var ale={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},cle=function(t,e){Array.prototype.push.apply(t,xr(e)?e:[e])},sle,Vt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ile,encodeValuesOnly:!1,format:X2,formatter:Q2,indices:!1,serializeDate(t){return(sle??(sle=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function YGe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var nz={};function lle(t,e,r,n,i,o,s,a,c,l,u,d,f,p,h,m,y,S){let b=t,w=S,T=0,C=!1;for(;(w=w.get(nz))!==void 0&&!C;){let F=w.get(t);if(T+=1,typeof F<"u"){if(F===T)throw new RangeError("Cyclic object value");C=!0}typeof w.get(nz)>"u"&&(T=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&xr(b)&&(b=rz(b,function(F){return F instanceof Date?f?.(F):F})),b===null){if(o)return c&&!m?c(e,Vt.encoder,y,"key",p):e;b=""}if(YGe(b)||ole(b)){if(c){let F=m?e:c(e,Vt.encoder,y,"key",p);return[h?.(F)+"="+h?.(c(b,Vt.encoder,y,"value",p))]}return[h?.(e)+"="+h?.(String(b))]}let O=[];if(typeof b>"u")return O;let k;if(r==="comma"&&xr(b))m&&c&&(b=rz(b,c)),k=[{value:b.length>0?b.join(",")||null:void 0}];else if(xr(l))k=l;else{let F=Object.keys(b);k=u?F.sort(u):F}let P=a?String(e).replace(/\./g,"%2E"):String(e),M=n&&xr(b)&&b.length===1?P+"[]":P;if(i&&xr(b)&&b.length===0)return M+"[]";for(let F=0;F<k.length;++F){let _=k[F],re=typeof _=="object"&&typeof _.value<"u"?_.value:b[_];if(s&&re===null)continue;let N=d&&a?_.replace(/\./g,"%2E"):_,g=xr(b)?typeof r=="function"?r(M,N):M:M+(d?"."+N:"["+N+"]");S.set(t,T);let E=new WeakMap;E.set(nz,S),cle(O,lle(re,g,r,n,i,o,s,a,r==="comma"&&m&&xr(b)?null:c,l,u,d,f,p,h,m,y,E))}return O}function KGe(t=Vt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Vt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=X2;if(typeof t.format<"u"){if(!SC(ez,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=ez[r],i=Vt.filter;(typeof t.filter=="function"||xr(t.filter))&&(i=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in ale?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=Vt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Vt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Vt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Vt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Vt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Vt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Vt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Vt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Vt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Vt.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Vt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Vt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Vt.strictNullHandling}}function ule(t,e={}){let r=t,n=KGe(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):xr(n.filter)&&(o=n.filter,i=o);let s=[];if(typeof r!="object"||r===null)return"";let a=ale[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let l=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&r[p]===null||cle(s,lle(r[p],p,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=s.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function dle(t){return ule(t,{arrayFormat:"brackets"})}function hle(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var fle;function Xp(t){let e;return(fle??(e=new globalThis.TextEncoder,fle=e.encode.bind(e)))(t)}var ple;function iz(t){let e;return(ple??(e=new globalThis.TextDecoder,ple=e.decode.bind(e)))(t)}var Rn,Cn,uu=class{constructor(){Rn.set(this,void 0),Cn.set(this,void 0),we(this,Rn,new Uint8Array,"f"),we(this,Cn,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Xp(e):e;we(this,Rn,hle([$(this,Rn,"f"),r]),"f");let n=[],i;for(;(i=JGe($(this,Rn,"f"),$(this,Cn,"f")))!=null;){if(i.carriage&&$(this,Cn,"f")==null){we(this,Cn,i.index,"f");continue}if($(this,Cn,"f")!=null&&(i.index!==$(this,Cn,"f")+1||i.carriage)){n.push(iz($(this,Rn,"f").subarray(0,$(this,Cn,"f")-1))),we(this,Rn,$(this,Rn,"f").subarray($(this,Cn,"f")),"f"),we(this,Cn,null,"f");continue}let o=$(this,Cn,"f")!==null?i.preceding-1:i.preceding,s=iz($(this,Rn,"f").subarray(0,o));n.push(s),we(this,Rn,$(this,Rn,"f").subarray(i.index),"f"),we(this,Cn,null,"f")}return n}flush(){return $(this,Rn,"f").length?this.decode(`
367
+ `)}if(Hr&&Ce&&Bce(Ce)){R({title:"Running in background",category:V.Task,parentGroupId:ea},!0);break}R({title:gm,message:Ce,wrapMessage:_m,category:Hr?V.AgentMessage:Bo?V.SiteGeneration:Ls[Ae?.name??""]?.category||V.Tool,parentGroupId:ea},!0);break}case"thinking":{Se.thinking&&R({title:"Reasoning",message:Se.thinking,category:V.Reasoning,parentGroupId:ye.parent_tool_use_id||void 0},!0);break}default:wr.log(`Message content type is not supported ${Se.type}`,Se)}}):ye?.type==="result"&&(_=ye.duration_ms||0,ye.is_error?x||(N=ye.result,g=ye.api_error_status??void 0):re=ye.result,ye.usage&&(Na(ye.usage,y?{model:y}:{}),E=ye.usage),[b,S].forEach(Se=>{Se[Se.length-1]?.message===re&&Se.pop()}))});let ee=!1;if(await H.catch(Oe=>{ee=Wa(Oe,c),{error:N,result:re}=ap({catchError:Oe,runCmd:H,error:N,result:re,runnerName:"Claude"})}),_e&&await Bp.rm(_e.mcpConfigPath,{force:!0}).catch(()=>{}),j.close(),le.flush(),x)return{steps:b,duration:_,agentSessionId:h,resolvedModel:y,effort:Re,usage:E,pendingInteraction:x};let se=ee;se&&(!re&&Y.trim()&&(re=Y.trim()),N=void 0);let Te=N?Oce({error:N,apiErrorStatus:g}):void 0,Ye=hC(Te);return Ye&&wr.log(`Classified provider failure as ${Ye.failureClass}`,JSON.stringify({...Te,retryable:Ye.retryable})),{steps:b,duration:_,result:await cc({initialResult:re,agentName:Yy,hasError:!!N}),error:lc({error:N,agentName:Yy}),isRetryableError:Ye?.retryable??uc(N),isProviderUnavailableError:Ye?.providerFault??dc(N),...Te?{providerFailure:Te}:{},agentSessionId:h,resolvedModel:y,effort:Re,usage:E,...se?{aborted:!0}:{}}}var qce=async()=>{let t=Ky.join(zce.homedir(),".claude");await Bp.rm(t,{recursive:!0,force:!0})},Vce={baseDir:Ky.join(zce.homedir(),".claude"),include:["projects"]};import yS from"fs/promises";import SS from"os";import Ic from"path";import Hs from"process";import fqe from"readline";function we(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function $(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var V2=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return V2=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function Zy(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Jy=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var me=class extends Error{},Pt=class t extends me{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let o=r;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new fc({message:n,cause:Jy(r)});let o=r?.error;return e===400?new zp(e,o,n,i):e===401?new Gp(e,o,n,i):e===403?new qp(e,o,n,i):e===404?new Vp(e,o,n,i):e===409?new Hp(e,o,n,i):e===422?new Wp(e,o,n,i):e===429?new Yp(e,o,n,i):e>=500?new Kp(e,o,n,i):new t(e,o,n,i)}},Ut=class extends Pt{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},fc=class extends Pt{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},pc=class extends fc{constructor({message:e}={}){super({message:e??"Request timed out."})}},zp=class extends Pt{},Gp=class extends Pt{},qp=class extends Pt{},Vp=class extends Pt{},Hp=class extends Pt{},Wp=class extends Pt{},Yp=class extends Pt{},Kp=class extends Pt{},Zp=class extends me{constructor(){super("Could not parse response content as the length limit was reached")}},Jp=class extends me{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Ro=class extends Error{constructor(e){super(e)}},lu=class extends Pt{constructor(e,r,n){let i="OAuth2 authentication error",o;if(r&&typeof r=="object"){let s=r;o=s.error;let a=s.error_description;a&&typeof a=="string"?i=a:o&&(i=o)}super(e,r,i,n),this.error_code=o}},Xy=class extends me{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var GGe=/^[a-z][a-z0-9+.-]*:/i,Hce=t=>GGe.test(t),xr=t=>(xr=Array.isArray,xr(t)),H2=xr;function W2(t){return typeof t!="object"?{}:t??{}}function Y2(t){if(!t)return!0;for(let e in t)return!1;return!0}function Wce(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Qy(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Yce=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new me(`${t} must be an integer`);if(e<0)throw new me(`${t} must be a positive integer`);return e};var Kce=t=>{try{return JSON.parse(t)}catch{return}};var Co=t=>new Promise(e=>setTimeout(e,t));var hc="6.34.0";var Qce=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function qGe(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var VGe=()=>{let t=qGe();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(Deno.build.os),"X-Stainless-Arch":Zce(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":Jce(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Zce(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=HGe();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":hc,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function HGe(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,o=n[2]||0,s=n[3]||0;return{browser:e,version:`${i}.${o}.${s}`}}}return null}var Zce=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Jce=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Xce,ele=()=>Xce??(Xce=VGe());function _C(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function K2(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function yC(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return K2({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function Z2(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function J2(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var rle=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var X2="RFC3986",Q2=t=>String(t),ez={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:Q2},nle="RFC1738";var SC=(t,e)=>(SC=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),SC(t,e)),Io=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var tz=1024,ile=(t,e,r,n,i)=>{if(t.length===0)return t;let o=t;if(typeof t=="symbol"?o=Symbol.prototype.toString.call(t):typeof t!="string"&&(o=String(t)),r==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let s="";for(let a=0;a<o.length;a+=tz){let c=o.length>=tz?o.slice(a,a+tz):o,l=[];for(let u=0;u<c.length;++u){let d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===nle&&(d===40||d===41)){l[l.length]=c.charAt(u);continue}if(d<128){l[l.length]=Io[d];continue}if(d<2048){l[l.length]=Io[192|d>>6]+Io[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=Io[224|d>>12]+Io[128|d>>6&63]+Io[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=Io[240|d>>18]+Io[128|d>>12&63]+Io[128|d>>6&63]+Io[128|d&63]}s+=l.join("")}return s};function ole(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function rz(t,e){if(xr(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var ale={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},cle=function(t,e){Array.prototype.push.apply(t,xr(e)?e:[e])},sle,Vt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:ile,encodeValuesOnly:!1,format:X2,formatter:Q2,indices:!1,serializeDate(t){return(sle??(sle=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function YGe(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var nz={};function lle(t,e,r,n,i,o,s,a,c,l,u,d,f,p,h,m,y,S){let b=t,w=S,T=0,C=!1;for(;(w=w.get(nz))!==void 0&&!C;){let F=w.get(t);if(T+=1,typeof F<"u"){if(F===T)throw new RangeError("Cyclic object value");C=!0}typeof w.get(nz)>"u"&&(T=0)}if(typeof l=="function"?b=l(e,b):b instanceof Date?b=f?.(b):r==="comma"&&xr(b)&&(b=rz(b,function(F){return F instanceof Date?f?.(F):F})),b===null){if(o)return c&&!m?c(e,Vt.encoder,y,"key",p):e;b=""}if(YGe(b)||ole(b)){if(c){let F=m?e:c(e,Vt.encoder,y,"key",p);return[h?.(F)+"="+h?.(c(b,Vt.encoder,y,"value",p))]}return[h?.(e)+"="+h?.(String(b))]}let O=[];if(typeof b>"u")return O;let k;if(r==="comma"&&xr(b))m&&c&&(b=rz(b,c)),k=[{value:b.length>0?b.join(",")||null:void 0}];else if(xr(l))k=l;else{let F=Object.keys(b);k=u?F.sort(u):F}let P=a?String(e).replace(/\./g,"%2E"):String(e),M=n&&xr(b)&&b.length===1?P+"[]":P;if(i&&xr(b)&&b.length===0)return M+"[]";for(let F=0;F<k.length;++F){let _=k[F],re=typeof _=="object"&&typeof _.value<"u"?_.value:b[_];if(s&&re===null)continue;let N=d&&a?_.replace(/\./g,"%2E"):_,g=xr(b)?typeof r=="function"?r(M,N):M:M+(d?"."+N:"["+N+"]");S.set(t,T);let E=new WeakMap;E.set(nz,S),cle(O,lle(re,g,r,n,i,o,s,a,r==="comma"&&m&&xr(b)?null:c,l,u,d,f,p,h,m,y,E))}return O}function KGe(t=Vt){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Vt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=X2;if(typeof t.format<"u"){if(!SC(ez,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=ez[r],i=Vt.filter;(typeof t.filter=="function"||xr(t.filter))&&(i=t.filter);let o;if(t.arrayFormat&&t.arrayFormat in ale?o=t.arrayFormat:"indices"in t?o=t.indices?"indices":"repeat":o=Vt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let s=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Vt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Vt.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Vt.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Vt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Vt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Vt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Vt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Vt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Vt.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Vt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Vt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Vt.strictNullHandling}}function ule(t,e={}){let r=t,n=KGe(e),i,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):xr(n.filter)&&(o=n.filter,i=o);let s=[];if(typeof r!="object"||r===null)return"";let a=ale[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let l=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&r[p]===null||cle(s,lle(r[p],p,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=s.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function dle(t){return ule(t,{arrayFormat:"brackets"})}function hle(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var fle;function Xp(t){let e;return(fle??(e=new globalThis.TextEncoder,fle=e.encode.bind(e)))(t)}var ple;function iz(t){let e;return(ple??(e=new globalThis.TextDecoder,ple=e.decode.bind(e)))(t)}var Rn,Cn,uu=class{constructor(){Rn.set(this,void 0),Cn.set(this,void 0),we(this,Rn,new Uint8Array,"f"),we(this,Cn,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Xp(e):e;we(this,Rn,hle([$(this,Rn,"f"),r]),"f");let n=[],i;for(;(i=JGe($(this,Rn,"f"),$(this,Cn,"f")))!=null;){if(i.carriage&&$(this,Cn,"f")==null){we(this,Cn,i.index,"f");continue}if($(this,Cn,"f")!=null&&(i.index!==$(this,Cn,"f")+1||i.carriage)){n.push(iz($(this,Rn,"f").subarray(0,$(this,Cn,"f")-1))),we(this,Rn,$(this,Rn,"f").subarray($(this,Cn,"f")),"f"),we(this,Cn,null,"f");continue}let o=$(this,Cn,"f")!==null?i.preceding-1:i.preceding,s=iz($(this,Rn,"f").subarray(0,o));n.push(s),we(this,Rn,$(this,Rn,"f").subarray(i.index),"f"),we(this,Cn,null,"f")}return n}flush(){return $(this,Rn,"f").length?this.decode(`
368
368
  `):[]}};Rn=new WeakMap,Cn=new WeakMap;uu.NEWLINE_CHARS=new Set([`
369
369
  `,"\r"]);uu.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function JGe(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function mle(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var vC={off:0,error:200,warn:300,info:400,debug:500},oz=(t,e,r)=>{if(t){if(Wce(vC,t))return t;Dt(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(vC))}`)}};function eS(){}function EC(t,e,r){return!e||vC[t]>vC[r]?eS:e[t].bind(e)}var XGe={error:eS,warn:eS,info:eS,debug:eS},gle=new WeakMap;function Dt(t){let e=t.logger,r=t.logLevel??"off";if(!e)return XGe;let n=gle.get(e);if(n&&n[0]===r)return n[1];let i={error:EC("error",e,r),warn:EC("warn",e,r),info:EC("info",e,r),debug:EC("debug",e,r)};return gle.set(e,[r,i]),i}var $s=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var tS,Po=class t{constructor(e,r,n){this.iterator=e,tS.set(this,void 0),this.controller=r,we(this,tS,n,"f")}static fromSSEResponse(e,r,n,i){let o=!1,s=n?Dt(n):console;async function*a(){if(o)throw new me("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let c=!1;try{for await(let l of QGe(e,r))if(!c){if(l.data.startsWith("[DONE]")){c=!0;continue}if(l.event===null||!l.event.startsWith("thread.")){let u;try{u=JSON.parse(l.data)}catch(d){throw s.error("Could not parse message into JSON:",l.data),s.error("From chunk:",l.raw),d}if(u&&u.error)throw new Pt(void 0,u.error,void 0,e.headers);yield i?{event:l.event,data:u}:u}else{let u;try{u=JSON.parse(l.data)}catch(d){throw console.error("Could not parse message into JSON:",l.data),console.error("From chunk:",l.raw),d}if(l.event=="error")throw new Pt(void 0,u.error,u.message,void 0);yield{event:l.event,data:u}}}c=!0}catch(l){if(Zy(l))return;throw l}finally{c||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*o(){let a=new uu,c=Z2(e);for await(let l of c)for(let u of a.decode(l))yield u;for(let l of a.flush())yield l}async function*s(){if(i)throw new me("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let c of o())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(Zy(c))return;throw c}finally{a||r.abort()}}return new t(s,r,n)}[(tS=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=o=>({next:()=>{if(o.length===0){let s=n.next();e.push(s),r.push(s)}return o.shift()}});return[new t(()=>i(e),this.controller,$(this,tS,"f")),new t(()=>i(r),this.controller,$(this,tS,"f"))]}toReadableStream(){let e=this,r;return K2({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:o}=await r.next();if(o)return n.close();let s=Xp(JSON.stringify(i)+`
370
370
  `);n.enqueue(s)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*QGe(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new me("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new me("Attempted to iterate over a response with no body");let r=new sz,n=new uu,i=Z2(t.body);for await(let o of e4e(i))for(let s of n.decode(o)){let a=r.decode(s);a&&(yield a)}for(let o of n.flush()){let s=r.decode(o);s&&(yield s)}}async function*e4e(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Xp(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let o;for(;(o=mle(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var sz=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
@@ -389,9 +389,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
389
389
  `);this.baseURL=c.baseURL,this.timeout=c.timeout??Oz.DEFAULT_TIMEOUT,this.logger=c.logger??console;let l="warn";this.logLevel=l,this.logLevel=oz(c.logLevel,"ClientOptions.logLevel",this)??oz(vc("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??l,this.fetchOptions=c.fetchOptions,this.maxRetries=c.maxRetries??2,this.fetch=c.fetch??_C(),we(this,VC,rle,"f"),this._options=c,s&&(this._workloadIdentityAuth=new AC(s,this.fetch)),this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=i,this.webhookSecret=o}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return ie([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return dle(e)}getUserAgent(){return`${this.constructor.name}/JS ${hc}`}defaultIdempotencyKey(){return`stainless-node-retry-${V2()}`}makeStatusError(e,r,n,i){return Pt.generate(e,r,n,i)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof me?n:new me(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new me(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let i=!$(this,Pz,"m",Yle).call(this)&&n||this.baseURL,o=Hce(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),a=Object.fromEntries(o.searchParams);return(!Y2(s)||!Y2(a))&&(r={...a,...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>({method:e,path:r,...i})))}request(e,r=null){return new du(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let i=await e,o=i.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(i);let{req:s,url:a,timeout:c}=await this.buildRequest(i,{retryCount:o-r});await this.prepareRequest(s,{url:a,options:i});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Dt(this).debug(`[${l}] sending request`,$s({retryOfRequestLogID:n,method:i.method,url:a,options:i,headers:s.headers})),i.signal?.aborted)throw new Ut;let f=new AbortController,p=await this.fetchWithAuth(a,s,c,f).catch(Jy),h=Date.now();if(p instanceof globalThis.Error){let S=`retrying, ${r} attempts remaining`;if(i.signal?.aborted)throw new Ut;let b=Zy(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Dt(this).info(`[${l}] connection ${b?"timed out":"failed"} - ${S}`),Dt(this).debug(`[${l}] connection ${b?"timed out":"failed"} (${S})`,$s({retryOfRequestLogID:n,url:a,durationMs:h-d,message:p.message})),this.retryRequest(i,r,n??l);throw Dt(this).info(`[${l}] connection ${b?"timed out":"failed"} - error; no more retries left`),Dt(this).debug(`[${l}] connection ${b?"timed out":"failed"} (error; no more retries left)`,$s({retryOfRequestLogID:n,url:a,durationMs:h-d,message:p.message})),p instanceof lu||p instanceof Xy?p:b?new pc:new fc({cause:p})}let m=[...p.headers.entries()].filter(([S])=>S==="x-request-id").map(([S,b])=>", "+S+": "+JSON.stringify(b)).join(""),y=`[${l}${u}${m}] ${s.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){if(p.status===401&&this._workloadIdentityAuth&&!i.__metadata?.hasStreamingBody&&!i.__metadata?.workloadIdentityTokenRefreshed)return await J2(p.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...i,__metadata:{...i.__metadata,workloadIdentityTokenRefreshed:!0}},r,n??l);let S=await this.shouldRetry(p);if(r&&S){let k=`retrying, ${r} attempts remaining`;return await J2(p.body),Dt(this).info(`${y} - ${k}`),Dt(this).debug(`[${l}] response error (${k})`,$s({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(i,r,n??l,p.headers)}let b=S?"error; no more retries left":"error; not retryable";Dt(this).info(`${y} - ${b}`);let w=await p.text().catch(k=>Jy(k).message),T=Kce(w),C=T?void 0:w;throw Dt(this).debug(`[${l}] response error (${b})`,$s({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:C,durationMs:Date.now()-d})),this.makeStatusError(p.status,T,C,p.headers)}return Dt(this).info(y),Dt(this).debug(`[${l}] response start`,$s({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),{response:p,options:i,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,n&&"then"in n?n.then(i=>({method:"get",path:e,...i})):{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new iS(this,n,e)}async fetchWithAuth(e,r,n,i){if(this._workloadIdentityAuth){let s=r.headers,a=s.get("Authorization");if(!a||a===`Bearer ${Iz}`){let c=await this._workloadIdentityAuth.getToken();s.set("Authorization",`Bearer ${c}`)}}return await this.fetchWithTimeout(e,r,n,i)}async fetchWithTimeout(e,r,n,i){let{signal:o,method:s,...a}=r||{},c=this._makeAbort(i);o&&o.addEventListener("abort",c,{once:!0});let l=setTimeout(c,n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,d={signal:i.signal,...u?{duplex:"half"}:{},method:"GET",...a};s&&(d.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){let o,s=i?.get("retry-after-ms");if(s){let c=parseFloat(s);Number.isNaN(c)||(o=c)}let a=i?.get("retry-after");if(a&&!o){let c=parseFloat(a);Number.isNaN(c)?o=Date.parse(a)-Date.now():o=c*1e3}if(o===void 0){let c=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,c)}return await Co(o),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let o=r-e,s=Math.min(.5*Math.pow(2,o),8),a=1-Math.random()*.25;return s*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:i,path:o,query:s,defaultBaseURL:a}=n,c=this.buildURL(o,s,a);"timeout"in n&&Yce("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:u,isStreamingBody:d}=this.buildBody({options:n});d&&(e.__metadata={...e.__metadata,hasStreamingBody:!0});let f=await this.buildHeaders({options:e,method:i,bodyHeaders:l,retryCount:r});return{req:{method:i,headers:f,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let s=ie([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...ele(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(s),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1};let n=ie([r]),i=typeof globalThis.ReadableStream<"u"&&e instanceof globalThis.ReadableStream,o=!i&&(typeof e=="string"||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof globalThis.Blob<"u"&&e instanceof globalThis.Blob||e instanceof URLSearchParams||e instanceof FormData);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||i?{bodyHeaders:void 0,body:e,isStreamingBody:!o}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:yC(e),isStreamingBody:!0}:typeof e=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e),isStreamingBody:!1}:{...$(this,VC,"f").call(this,{body:e,headers:n}),isStreamingBody:!1}}};Oz=De,VC=new WeakMap,Pz=new WeakSet,Yle=function(){return this.baseURL!=="https://api.openai.com/v1"};De.OpenAI=Oz;De.DEFAULT_TIMEOUT=6e5;De.OpenAIError=me;De.APIError=Pt;De.APIConnectionError=fc;De.APIConnectionTimeoutError=pc;De.APIUserAbortError=Ut;De.NotFoundError=Vp;De.ConflictError=Hp;De.RateLimitError=Yp;De.BadRequestError=zp;De.AuthenticationError=Gp;De.InternalServerError=Kp;De.PermissionDeniedError=qp;De.UnprocessableEntityError=Wp;De.InvalidWebhookSignatureError=Ro;De.toFile=xC;De.Completions=Eu;De.Chat=yc;De.Embeddings=Tu;De.Files=Au;De.Images=Cu;De.Audio=No;De.Moderations=Pu;De.Models=Iu;De.FineTuning=Li;De.Graders=xc;De.VectorStores=Vs;De.Webhooks=ku;De.Beta=Di;De.Batches=mu;De.Uploads=Cc;De.Responses=Gs;De.Realtime=zs;De.Conversations=Ac;De.Evals=wc;De.Containers=bc;De.Skills=qs;De.Videos=Nu;var Pn=ae("runner_codex"),HC="Codex CLI",Mh="gpt-5.6-sol";async function pqe({aiGateway:t,config:e,model:r}){let n=r;if(t)if(e.modelVersionOverrides?.codex){let i=e.modelVersionOverrides?.codex?.[e.accountType];if(i){if(!await t.isModelAvailableForProvider("openai",i))throw new Error(`Model override '${i}' is not available for openai provider`);n=i}}else if(r){if(!await t.isModelAvailableForProvider("openai",r))throw new Error(`Model '${r}' is not available for openai provider`)}else!!Mh&&await t.isModelAvailableForProvider("openai",Mh)?(n=Mh,Pn.log(`Using default model: ${Mh}`)):Mh&&Pn.log(`Default model ${Mh} is not available, proceeding without model specification`);return n}var WC="netlify-ask-db",hqe=`default_permissions = "${WC}"`,mqe=()=>Ic.join(Hs.env.XDG_CONFIG_HOME??Ic.join(SS.homedir(),".config"),"netlify"),gqe=t=>["",`[permissions.${WC}]`,'description = "Ask mode: read-only filesystem, network access for database reads"','extends = ":read-only"',"",`[permissions.${WC}.filesystem]`,'":minimal" = "read"','"/" = "read"',`"${t}" = "write"`,"",`[permissions.${WC}.network]`,"enabled = true"];function _qe({aiGateway:t}){if(t){let{token:e,url:r}=t;if(!e||!r)throw new Error("No token or url provided from AI Gateway");Hs.env.OPENAI_API_KEY=e,Hs.env.OPENAI_BASE_URL=r}else if(!Hs.env.OPENAI_API_KEY)throw new Error("OPENAI_API_KEY is not provided")}async function Nz({config:t,netlify:e,persistSteps:r,sendSteps:n,aiGateway:i,continueSession:o,priorAgentSessionId:s,cwd:a=Hs.cwd(),abortSignal:c,onSessionId:l,forceLowEffortForCreditWrapUp:u}){let{prompt:d}=t,{model:f}=t;_qe({aiGateway:i});let p=await pqe({config:t,aiGateway:i,model:f}),h=[],m=[],y=[],S={},b=new Set,w=0,T=0,C,O,k,P,M,F=cp(t),_=`${Hs.env.NVM_BIN}/node`,re=Ic.join(SS.homedir(),".codex"),N=Ic.join(re,"config.toml"),g=Ic.join(re,"auth.json");try{await yS.mkdir(re,{recursive:!0});let le={OPENAI_API_KEY:Hs.env.OPENAI_API_KEY};await yS.writeFile(g,JSON.stringify(le,null,2),"utf-8"),Pn.log("Created Codex auth.json file");let R=Hs.env.OPENAI_BASE_URL,I=['forced_login_method = "api"'],U=Ka({creditWrapUpTurn:u});F&&I.push(hqe),R&&I.push('model_provider = "openai_proxy"',"","[model_providers.openai_proxy]",'name = "OpenAI Proxy"',`base_url = "${R}"`,'env_key = "OPENAI_API_KEY"','wire_api = "responses"',"supports_websockets = false","requires_openai_auth = true"),U&&I.push(...Coe());let j=[];F&&(j=gqe(mqe()),I.push(...j)),await yS.writeFile(N,`${I.join(`
390
390
  `)}
391
391
  `,"utf-8"),Pn.log("Wrote Codex config.toml",...j.length?[j.join(`
392
- `)]:[])}catch(le){let R=le instanceof Error?le.message:String(le);throw Pn.warn("Failed to setup Codex config and credentials",{error:R}),new Error(`Codex setup failed: ${R}`)}let E=p==="gpt-5.6-sol",x=sp("codex",t.effort);t.effort&&!x&&Pn.log(`Effort '${t.effort}' is not available on ${HC}; using its default`);let Y=u?"low":x??(E?"low":void 0),G=Y??"high",fe=!!(o&&s),$e="mode"in t&&t.mode==="ask",Ie=!!F,Pe=[Eo(a,"codex"),"exec",...$e&&!Ie?["--sandbox","read-only"]:[],...fe?["resume",s]:[],...$e?[]:["--yolo"],"--json",...Y?["-c",`model_reasoning_effort="${Y}"`]:[],...p?["--model",p]:[]].filter(Boolean);Pn.log(`Running ${_} ${Pe.join(" ")}`);let xe=e.utils.run(_,Pe,{all:!0,cwd:a,env:{...Hs.env},stdin:"pipe",idleTimeout:ms,cancelSignal:c});xe.stdin?.end(d);let Fe=Ua(()=>{r?.({steps:h,duration:T}),n?.({steps:m,duration:T}),m=[]},250),Re=(le,R)=>{let I={...le,id:w};w+=1,y.push(I),h.push(I),m.push(I),R||Fe.flush(),Fe(),R&&Fe.flush()},ce=p||"default";t.answeredInteraction||Re({title:`Using ${HC} with ${ce}`,category:V.Environment},!0);let _e=fqe.createInterface({input:xe.all});_e.on("error",le=>{Pn.error("Readline interface error",{error:le.message,stack:le.stack})}),_e.on("line",le=>{let R;try{R=JSON.parse(le)}catch{Pn.log("Could not parse line",le);return}if(R?.duration_ms&&(T=R.duration_ms),R?.type==="thread.started"&&typeof R?.thread_id=="string"&&(k=R.thread_id,l?.(k)),R?.type==="item.started"&&R?.item?.type==="command_execution")S[R.item.id]=R.item;else if(R?.type==="item.completed"&&R?.item?.type==="command_execution"){let I=R.item,U=Eqe(I);U&&Re(U,!0);let j=I.command?.match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(j&&!b.has(j)){b.add(j);let q=vo(j);Ts(Pn,q),Re({title:`Use ${q}`,category:V.Skill,type:j},!0)}}else if(R?.type==="item.completed"&&R?.item?.type==="reasoning"){let I={title:"Reasoning",message:R.item.text,category:V.Reasoning};Re(I,!0)}else if(R?.type==="item.completed"&&R?.item?.type==="agent_message")C=R.item.text;else if(R?.type==="item.started"&&R?.item?.type==="mcp_tool_call"){let I=R.item;if(I.server===Ya&&I.tool==="ask"&&!M){let U=sc.safeParse(I.arguments);U.success?(M={questions:U.data.questions},xe.kill()):(Pn.warn("Ignoring malformed ask tool input",{toolUseId:I.id,issues:ac(U.error.issues)}),ne.inc("inference.malformed_ask",1))}}else if(R?.type==="turn.completed"&&R.usage)P={input_tokens:R.usage.input_tokens,output_tokens:R.usage.output_tokens},Na(P,p?{model:p}:{});else if(R?.type==="turn.failed"&&R?.error?.message)O=R.error.message;else if(R?.type==="local_shell_call"){let I=R;S[I.call_id]=I}else if(R?.type==="local_shell_call_output"){let I=R,U=S[I.call_id],j=vqe(U,I);j&&Re(j,!0);let ee=(U?.action?.command?.join(" ")??"").match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(ee&&!b.has(ee)){b.add(ee);let se=vo(ee);Ts(Pn,se),Re({title:`Use ${se}`,category:V.Skill,type:ee},!0)}}else R?.type==="message"&&R.role==="assistant"?C=R.content?.map(I=>I.text).join(`
392
+ `)]:[])}catch(le){let R=le instanceof Error?le.message:String(le);throw Pn.warn("Failed to setup Codex config and credentials",{error:R}),new Error(`Codex setup failed: ${R}`)}let E=p==="gpt-5.6-sol",x=sp("codex",t.effort);t.effort&&!x&&Pn.log(`Effort '${t.effort}' is not available on ${HC}; using its default`);let Y=u?"low":x??(E?"low":void 0),q=Y??"high",fe=!!(o&&s),$e="mode"in t&&t.mode==="ask",Ie=!!F,Pe=[Eo(a,"codex"),"exec",...$e&&!Ie?["--sandbox","read-only"]:[],...fe?["resume",s]:[],...$e?[]:["--yolo"],"--json",...Y?["-c",`model_reasoning_effort="${Y}"`]:[],...p?["--model",p]:[]].filter(Boolean);Pn.log(`Running ${_} ${Pe.join(" ")}`);let xe=e.utils.run(_,Pe,{all:!0,cwd:a,env:{...Hs.env},stdin:"pipe",idleTimeout:ms,cancelSignal:c});xe.stdin?.end(d);let Fe=Ua(()=>{r?.({steps:h,duration:T}),n?.({steps:m,duration:T}),m=[]},250),Re=(le,R)=>{let I={...le,id:w};w+=1,y.push(I),h.push(I),m.push(I),R||Fe.flush(),Fe(),R&&Fe.flush()},ce=p||"default";t.answeredInteraction||Re({title:`Using ${HC} with ${ce}`,category:V.Environment},!0);let _e=fqe.createInterface({input:xe.all});_e.on("error",le=>{Pn.error("Readline interface error",{error:le.message,stack:le.stack})}),_e.on("line",le=>{let R;try{R=JSON.parse(le)}catch{Pn.log("Could not parse line",le);return}if(R?.duration_ms&&(T=R.duration_ms),R?.type==="thread.started"&&typeof R?.thread_id=="string"&&(k=R.thread_id,l?.(k)),R?.type==="item.started"&&R?.item?.type==="command_execution")S[R.item.id]=R.item;else if(R?.type==="item.completed"&&R?.item?.type==="command_execution"){let I=R.item,U=Eqe(I);U&&Re(U,!0);let j=I.command?.match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(j&&!b.has(j)){b.add(j);let G=vo(j);Ts(Pn,G),Re({title:`Use ${G}`,category:V.Skill,type:j},!0)}}else if(R?.type==="item.completed"&&R?.item?.type==="reasoning"){let I={title:"Reasoning",message:R.item.text,category:V.Reasoning};Re(I,!0)}else if(R?.type==="item.completed"&&R?.item?.type==="agent_message")C=R.item.text;else if(R?.type==="item.started"&&R?.item?.type==="mcp_tool_call"){let I=R.item;if(I.server===Ya&&I.tool==="ask"&&!M){let U=sc.safeParse(I.arguments);U.success?(M={questions:U.data.questions},xe.kill()):(Pn.warn("Ignoring malformed ask tool input",{toolUseId:I.id,issues:ac(U.error.issues)}),ne.inc("inference.malformed_ask",1))}}else if(R?.type==="turn.completed"&&R.usage)P={input_tokens:R.usage.input_tokens,output_tokens:R.usage.output_tokens},Na(P,p?{model:p}:{});else if(R?.type==="turn.failed"&&R?.error?.message)O=R.error.message;else if(R?.type==="local_shell_call"){let I=R;S[I.call_id]=I}else if(R?.type==="local_shell_call_output"){let I=R,U=S[I.call_id],j=vqe(U,I);j&&Re(j,!0);let ee=(U?.action?.command?.join(" ")??"").match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(ee&&!b.has(ee)){b.add(ee);let se=vo(ee);Ts(Pn,se),Re({title:`Use ${se}`,category:V.Skill,type:ee},!0)}}else R?.type==="message"&&R.role==="assistant"?C=R.content?.map(I=>I.text).join(`
393
393
  `):R?.type==="message"&&R.role==="system"&&(O=R.content?.map(I=>I.text).join(`
394
- `))});let qe=!1;if(await xe.catch(le=>{qe=Wa(le,c);let R=ap({catchError:le,runCmd:xe,error:O,result:C,runnerName:"Codex"});O=R.error,C=R.result}),_e.close(),Fe.flush(),M)return{steps:y,duration:T,agentSessionId:k,resolvedModel:p,effort:G,usage:P,pendingInteraction:M};let H=qe;return H&&(O=void 0),{steps:y,duration:T,result:await cc({initialResult:C,agentName:HC,hasError:!!O}),error:lc({error:O,agentName:HC}),isRetryableError:uc(O),isProviderUnavailableError:dc(O),resolvedModel:p,effort:G,agentSessionId:k,usage:P,...H?{aborted:!0}:{}}}var Kle=async()=>{let t=Ic.join(SS.homedir(),".codex");await yS.rm(t,{recursive:!0,force:!0});let e=Ic.join(SS.homedir(),".agents","skills");await yS.rm(e,{recursive:!0,force:!0})},Zle={baseDir:Ic.join(SS.homedir(),".codex"),include:["sessions"]},yqe=new Set(["bash","-lc"]),Sqe=/^sed\s+-n\s+(?:'[^']*'|"[^"]*"|\S+)\s+(\S+)\s*$/,Jle=t=>{if(Ds(t))return{title:"Generating the site",category:V.SiteGeneration};let e=t.match(Sqe);return e?{title:`Reading \`${e[1]}\``,category:V.FileRead}:{title:`Running \`${t}\``,category:V.RunCommand}},Eqe=t=>{if(!t||t.type!=="command_execution")return null;let e=t.command;e=e.replace(/^(\/usr\/bin\/)?bash -lc ['"]/,"").replace(/['"]$/,"");let{command:r,heredocContent:n}=V$(e),{title:i,category:o}=Jle(r),s=t.aggregated_output?.trim();return n?s=`\`\`\`
394
+ `))});let qe=!1;if(await xe.catch(le=>{qe=Wa(le,c);let R=ap({catchError:le,runCmd:xe,error:O,result:C,runnerName:"Codex"});O=R.error,C=R.result}),_e.close(),Fe.flush(),M)return{steps:y,duration:T,agentSessionId:k,resolvedModel:p,effort:q,usage:P,pendingInteraction:M};let H=qe;return H&&(O=void 0),{steps:y,duration:T,result:await cc({initialResult:C,agentName:HC,hasError:!!O}),error:lc({error:O,agentName:HC}),isRetryableError:uc(O),isProviderUnavailableError:dc(O),resolvedModel:p,effort:q,agentSessionId:k,usage:P,...H?{aborted:!0}:{}}}var Kle=async()=>{let t=Ic.join(SS.homedir(),".codex");await yS.rm(t,{recursive:!0,force:!0});let e=Ic.join(SS.homedir(),".agents","skills");await yS.rm(e,{recursive:!0,force:!0})},Zle={baseDir:Ic.join(SS.homedir(),".codex"),include:["sessions"]},yqe=new Set(["bash","-lc"]),Sqe=/^sed\s+-n\s+(?:'[^']*'|"[^"]*"|\S+)\s+(\S+)\s*$/,Jle=t=>{if(Ds(t))return{title:"Generating the site",category:V.SiteGeneration};let e=t.match(Sqe);return e?{title:`Reading \`${e[1]}\``,category:V.FileRead}:{title:`Running \`${t}\``,category:V.RunCommand}},Eqe=t=>{if(!t||t.type!=="command_execution")return null;let e=t.command;e=e.replace(/^(\/usr\/bin\/)?bash -lc ['"]/,"").replace(/['"]$/,"");let{command:r,heredocContent:n}=V$(e),{title:i,category:o}=Jle(r),s=t.aggregated_output?.trim();return n?s=`\`\`\`
395
395
  ${n}
396
396
  \`\`\`${s?`
397
397
 
@@ -422,17 +422,17 @@ commandPrefix = [${i}]
422
422
  decision = "allow"
423
423
  priority = 20
424
424
  `),yr.log("Ask policy allows the read-only database query command",{allowedPrefixes:i})}let n=Pc.join(TS.homedir(),".gemini","ask-policy.toml");return await Mu.mkdir(Pc.dirname(n),{recursive:!0}),await Mu.writeFile(n,r.join(`
425
- `),"utf-8"),n};async function Dz({config:t,netlify:e,persistSteps:r=void 0,sendSteps:n=void 0,aiGateway:i,continueSession:o=!1,priorAgentSessionId:s=void 0,cwd:a=Lh.cwd(),cliPath:c="netlify",abortSignal:l=void 0,onSessionId:u=void 0,forceLowEffortForCreditWrapUp:d=void 0}){let{prompt:f}=t,p=sp("gemini",t.effort);t.effort&&!p&&yr.log(`Effort '${t.effort}' is not available on ${KC}; using its default`);let h=d?"low":p;Nqe({aiGateway:i});let m=await kqe({aiGateway:i,config:t,model:t.model});await Pqe({model:m,effort:h,creditWrapUpTurn:d});let y=[],S=[],b=[],w={},T=0,C=0,O,k,P,M,F,_=!!(o&&s),re=!1;_&&(re=await vS(s)),_&&!re&&(yr.log(`Gemini resume requested for session ${s} but it was not resumable; starting a fresh session`),ne.inc("inference.native_resume",1,{outcome:"sanitize_failed"}));let N=t.mode==="ask",g=N?await Mqe({config:t,cliPath:c}):void 0,E=[Eo(a,"gemini"),...m?["--model",m]:[],...N?["--approval-mode","default","--policy",g]:["--yolo"],"--skip-trust","--output-format","stream-json",...re?["-r",s]:[],"-p",""],x=`${Lh.env.NVM_BIN}/node`;yr.log(`Running ${x} ${E.join(" ")}`);let Y=e.utils.run(x,E,{all:!0,env:{...Lh.env,GEMINI_CLI_NO_RELAUNCH:"1"},cwd:a,idleTimeout:ms,cancelSignal:l});Y.stdin?.end(f);let G=Ua(()=>{r?.({steps:y,duration:C}),n?.({steps:S,duration:C}),S=[]},250),fe=(ce,_e)=>{ce.id=T,T+=1,b.push(ce),y.push(ce),S.push(ce),_e||G.flush(),G(),_e&&G.flush()},$e=m||"default";t.answeredInteraction||fe({title:`Using ${KC} with ${$e}`,category:V.Environment},!0);let Ie=xqe.createInterface({input:Y.all});Ie.on("error",ce=>{yr.error("Readline interface error",{error:ce.message,stack:ce.stack})});let Pe="",xe=()=>{Pe&&fe({message:Pe.trim(),category:V.AgentMessage}),Pe=""};Ie.on("line",ce=>{let _e;try{if(ce.startsWith("[API Error")){let qe=ce.match(/\[api error: (.+?)]$/i)?.[1];_e={type:"error",value:_ie(qe,!1)?.error?.message||qe||"Gemini encountered error"}}else _e=JSON.parse(ce)}catch{return}if(_e)switch(_e.type==="init"&&typeof _e.session_id=="string"&&(M=_e.session_id,u?.(M)),["message","result"].includes(_e.type)||xe(),_e.type){case"message":{_e.role!=="user"&&_e.content&&(Pe+=_e.content);break}case"tool_use":{if(_e.tool_name===Aoe){if(_e.tool_id&&!F){let ee=sc.safeParse(_e.parameters);ee.success?(F={questions:ee.data.questions},Y.kill()):(yr.warn("Ignoring malformed ask tool input",{toolUseId:_e.tool_id,issues:ac(ee.error.issues)}),ne.inc("inference.malformed_ask",1))}break}let qe=Mz[_e.tool_name]?.name??_e.tool_name,H=_e.parameters?.file_path,le=H&&Pc.relative(a,H),R=_e.parameters?.command,I=_e.tool_name==="activate_skill"&&_e.parameters?.name,U=_e.tool_name==="run_shell_command"&&Ds(R),j=[qe,le&&`\`${le}\``,R&&`\`${R}\``].filter(Boolean).join(" ");if(I)j=`Use ${vo(I)}`;else if(U)j="Generating the site";else if(_e.tool_name==="grep_search"){let{dir_path:ee,pattern:se}=_e.parameters||{};ee&&se?j=`Search in \`${ee}\` for \`${se}\``:ee?j=`Search in \`${ee}\``:se&&(j=`Search for \`${se}\``)}else if(_e.tool_name==="update_topic"){let ee=_e.parameters?.title;ee&&(j=`${qe} \`${ee}\``)}let q={title:j,category:U?V.SiteGeneration:Mz[_e.tool_name]?.category,...I&&{type:I}};w[_e.tool_id]=q,G.flush();break}case"tool_result":{let qe=w[_e.tool_id];qe&&(_e.output&&(qe.message=`\`\`\`
425
+ `),"utf-8"),n};async function Dz({config:t,netlify:e,persistSteps:r=void 0,sendSteps:n=void 0,aiGateway:i,continueSession:o=!1,priorAgentSessionId:s=void 0,cwd:a=Lh.cwd(),cliPath:c="netlify",abortSignal:l=void 0,onSessionId:u=void 0,forceLowEffortForCreditWrapUp:d=void 0}){let{prompt:f}=t,p=sp("gemini",t.effort);t.effort&&!p&&yr.log(`Effort '${t.effort}' is not available on ${KC}; using its default`);let h=d?"low":p;Nqe({aiGateway:i});let m=await kqe({aiGateway:i,config:t,model:t.model});await Pqe({model:m,effort:h,creditWrapUpTurn:d});let y=[],S=[],b=[],w={},T=0,C=0,O,k,P,M,F,_=!!(o&&s),re=!1;_&&(re=await vS(s)),_&&!re&&(yr.log(`Gemini resume requested for session ${s} but it was not resumable; starting a fresh session`),ne.inc("inference.native_resume",1,{outcome:"sanitize_failed"}));let N=t.mode==="ask",g=N?await Mqe({config:t,cliPath:c}):void 0,E=[Eo(a,"gemini"),...m?["--model",m]:[],...N?["--approval-mode","default","--policy",g]:["--yolo"],"--skip-trust","--output-format","stream-json",...re?["-r",s]:[],"-p",""],x=`${Lh.env.NVM_BIN}/node`;yr.log(`Running ${x} ${E.join(" ")}`);let Y=e.utils.run(x,E,{all:!0,env:{...Lh.env,GEMINI_CLI_NO_RELAUNCH:"1"},cwd:a,idleTimeout:ms,cancelSignal:l});Y.stdin?.end(f);let q=Ua(()=>{r?.({steps:y,duration:C}),n?.({steps:S,duration:C}),S=[]},250),fe=(ce,_e)=>{ce.id=T,T+=1,b.push(ce),y.push(ce),S.push(ce),_e||q.flush(),q(),_e&&q.flush()},$e=m||"default";t.answeredInteraction||fe({title:`Using ${KC} with ${$e}`,category:V.Environment},!0);let Ie=xqe.createInterface({input:Y.all});Ie.on("error",ce=>{yr.error("Readline interface error",{error:ce.message,stack:ce.stack})});let Pe="",xe=()=>{Pe&&fe({message:Pe.trim(),category:V.AgentMessage}),Pe=""};Ie.on("line",ce=>{let _e;try{if(ce.startsWith("[API Error")){let qe=ce.match(/\[api error: (.+?)]$/i)?.[1];_e={type:"error",value:_ie(qe,!1)?.error?.message||qe||"Gemini encountered error"}}else _e=JSON.parse(ce)}catch{return}if(_e)switch(_e.type==="init"&&typeof _e.session_id=="string"&&(M=_e.session_id,u?.(M)),["message","result"].includes(_e.type)||xe(),_e.type){case"message":{_e.role!=="user"&&_e.content&&(Pe+=_e.content);break}case"tool_use":{if(_e.tool_name===Aoe){if(_e.tool_id&&!F){let ee=sc.safeParse(_e.parameters);ee.success?(F={questions:ee.data.questions},Y.kill()):(yr.warn("Ignoring malformed ask tool input",{toolUseId:_e.tool_id,issues:ac(ee.error.issues)}),ne.inc("inference.malformed_ask",1))}break}let qe=Mz[_e.tool_name]?.name??_e.tool_name,H=_e.parameters?.file_path,le=H&&Pc.relative(a,H),R=_e.parameters?.command,I=_e.tool_name==="activate_skill"&&_e.parameters?.name,U=_e.tool_name==="run_shell_command"&&Ds(R),j=[qe,le&&`\`${le}\``,R&&`\`${R}\``].filter(Boolean).join(" ");if(I)j=`Use ${vo(I)}`;else if(U)j="Generating the site";else if(_e.tool_name==="grep_search"){let{dir_path:ee,pattern:se}=_e.parameters||{};ee&&se?j=`Search in \`${ee}\` for \`${se}\``:ee?j=`Search in \`${ee}\``:se&&(j=`Search for \`${se}\``)}else if(_e.tool_name==="update_topic"){let ee=_e.parameters?.title;ee&&(j=`${qe} \`${ee}\``)}let G={title:j,category:U?V.SiteGeneration:Mz[_e.tool_name]?.category,...I&&{type:I}};w[_e.tool_id]=G,q.flush();break}case"tool_result":{let qe=w[_e.tool_id];qe&&(_e.output&&(qe.message=`\`\`\`
426
426
  ${_e.output.trim()}
427
- \`\`\``),fe(qe,!0),Oqe(qe));break}case"result":{C=_e.stats?.duration_ms,_e.stats&&(Na(_e.stats,m?{model:m}:{}),P=_e.stats),_e.status==="error"?k=_e.error?.message:O=Pe.trim();break}case"error":{k=_e.error;break}case"finished":break;case"init":break;default:{yr.warn("Unhandled message type:",_e.type);break}}});let Fe=!1;if(await Y.catch(ce=>{Fe=Wa(ce,l),{error:k,result:O}=Rqe({catchError:ce,runCmd:Y,error:k,result:O,runnerName:"Gemini"})}),Ie.close(),F)return G.flush(),{steps:b,duration:C,agentSessionId:M,resolvedModel:m,usage:P,pendingInteraction:F};let Re=Fe;return Re&&(!O&&Pe.trim()&&(O=Pe.trim()),k=void 0),G.flush(),{steps:b,duration:C,result:await cc({initialResult:O,agentName:KC,hasError:!!k}),error:lc({error:k,agentName:KC}),isRetryableError:uc(k),isProviderUnavailableError:dc(k),resolvedModel:m,usage:P,agentSessionId:M,...h&&Qle(m)?{effort:h}:{},...Re?{aborted:!0}:{}}}var eue=async()=>{let t=Pc.join(TS.homedir(),".gemini");await Mu.rm(t,{recursive:!0,force:!0});let e=Pc.join(TS.homedir(),".agents","skills");await Mu.rm(e,{recursive:!0,force:!0})},tue={baseDir:Pc.join(TS.homedir(),".gemini"),include:["tmp"]};import $z from"fs/promises";import sue from"os";import bS from"path";import Fz from"process";import $qe from"readline";import Dqe from"os";import iue from"path";import Lz from"fs";var rue=ae("opencode_install"),nue="1.17.19",Lqe=()=>iue.join(Dqe.homedir(),".netlify-agent-runner","opencode"),ZC=async t=>{let e=Eo(t,"opencode");if(e)return e;let r=Lqe(),n=iue.join(r,"node_modules",".bin","opencode");if(Lz.existsSync(n))return n;Lz.mkdirSync(r,{recursive:!0}),rue.log(`Installing opencode-ai@${nue} on demand`);let i=Date.now();await pr("npm",["install","--no-save","--no-audit","--no-fund","--prefix",r,`opencode-ai@${nue}`],{cwd:r});let o=Date.now()-i;if(ne.timing("opencode.install_duration",o),rue.log(`Installed opencode-ai in ${o}ms`),!Lz.existsSync(n))throw new Error("OpenCode CLI binary not found after installing opencode-ai");return n};var Ws=ae("runner_opencode"),JC="OpenCode",aue="gateway",Uqe="z-ai/glm-5.3-flash",Fqe=new Set(["z-ai/glm-5.3-flash","deepseek/deepseek-v4-pro","x-ai/grok-4.6"]),Bqe=(t,e)=>!t||!xA.includes(t)?t:e&&Fqe.has(e)?"xhigh":"max",Uz={bash:{name:"Run command",category:V.RunCommand},read:{name:"Read file",category:V.FileRead},write:{name:"Edit file",category:V.FileWrite},edit:{name:"Edit file",category:V.FileWrite},glob:{name:"Find files",category:V.Explore},grep:{name:"Search files",category:V.Explore},list:{name:"List directory",category:V.Explore},task:{name:"Task",category:V.Task},todowrite:{name:"Update task list",category:V.Todo},webfetch:{name:"Fetch web",category:V.Web},websearch:{name:"Search web",category:V.Web},skill:{name:"Use Skill",category:V.Skill}},oue=t=>Uz[t]?.name||t,jqe=t=>Array.isArray(t)?t.flatMap(e=>{let{content:r,status:n}=e??{};return typeof r!="string"||!r?[]:[{name:r,value:typeof n=="string"&&n?n:"pending"}]}):[],zqe=250,Gqe=t=>{let e;try{e=JSON.parse(t)}catch{return{issues:"invalid_json"}}let r=sc.safeParse(e);return r.success?{questions:r.data.questions}:{issues:ac(r.error.issues)}},qqe=(t,e)=>{let r=!0,n=setInterval(async()=>{let i=await $z.readFile(t,"utf-8").catch(()=>{});if(i===void 0)return;clearInterval(n),await $z.rm(t,{force:!0}).catch(()=>{});let{questions:o,issues:s}=Gqe(i);if(!o){Ws.warn("Ignoring malformed ask tool questions file",{filePath:t,issues:s}),ne.inc("inference.malformed_ask",1);return}r&&e(o)},zqe);return n.unref(),{stop:()=>{r=!1,clearInterval(n)}}};async function Vqe({aiGateway:t,config:e,model:r}){let n=r;if(t){let i=t.isModelAvailable;if(!i)throw new Error("OpenCode runner requires a gateway with isModelAvailable support");let o=e.modelVersionOverrides?.opencode?.[e.accountType];o?n=o:r||(n=He().opencodeDefaultModel||Uqe),n&&(await i(n)||Ws.log(`Model '${n}' not found in gateway catalog; proceeding anyway (gateway is authoritative, e.g. flag-gated OpenRouter models)`))}return n}function Hqe({aiGateway:t,model:e,effort:r,questionsFilePath:n}){if(!t)throw new Error("OpenCode runner requires the AI gateway");let{token:i,url:o}=t;if(!i||!o)throw new Error("No token or url provided from AI Gateway");let s=e?{[e]:{id:e,name:e,tool_call:!0,reasoning:!0,interleaved:{field:"reasoning_details"},...r?{options:{reasoningEffort:r}}:{}}}:{},a={$schema:"https://opencode.ai/config.json",provider:{[aue]:{api:"openai",name:"Netlify AI Gateway",options:{apiKey:i,baseURL:o},...Object.keys(s).length>0?{models:s}:{}}},...n?{mcp:xoe(n)}:{}};return{...Fz.env,OPENCODE_CONFIG_CONTENT:JSON.stringify(a),OPENCODE_DISABLE_AUTOUPDATE:"1"}}async function Bz({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=Fz.cwd(),abortSignal:a,onSessionId:c,forceLowEffortForCreditWrapUp:l}){let{prompt:u}=t,{model:d}=t,f=l?"low":t.effort,p="",h,m,y,S,b=0,w=0,T,C=await Vqe({config:t,aiGateway:n,model:d}),O=Bqe(f,C);Ws.log(f?`Requesting reasoning effort '${f}' for model '${C}'${O===f?"":` (sent as '${O}')`}; ignored if unsupported`:`No reasoning effort requested for model '${C}'; running at its own default`);let k=Ka({creditWrapUpTurn:l})?await Roe():void 0,P=Hqe({aiGateway:n,model:C,effort:O,questionsFilePath:k?.filePath}),M=[],F=[],_=0,re=Date.now(),N=await ZC(s),g=["run","--format","json","--dangerously-skip-permissions","--agent","build",...C?["--model",`${aue}/${C}`]:[],...i?o?["--session",o]:["--continue"]:[]];Ws.log(`Running ${N} ${g.join(" ")}`);let E=e.utils.run(N,g,{all:!0,env:P,cwd:s,idleTimeout:ms,cancelSignal:a});E.stdin?.end(u);let x=k?qqe(k.filePath,qe=>{T||(T={questions:qe},E.kill())}):void 0,Y=Ua(()=>{r?.({steps:F,duration:Date.now()-re})},250),G=(qe,H)=>{let{wrapMessage:le,...R}=qe,I=Ww({...R,id:_});I.message&&le&&(I.message=`\`\`\`
427
+ \`\`\``),fe(qe,!0),Oqe(qe));break}case"result":{C=_e.stats?.duration_ms,_e.stats&&(Na(_e.stats,m?{model:m}:{}),P=_e.stats),_e.status==="error"?k=_e.error?.message:O=Pe.trim();break}case"error":{k=_e.error;break}case"finished":break;case"init":break;default:{yr.warn("Unhandled message type:",_e.type);break}}});let Fe=!1;if(await Y.catch(ce=>{Fe=Wa(ce,l),{error:k,result:O}=Rqe({catchError:ce,runCmd:Y,error:k,result:O,runnerName:"Gemini"})}),Ie.close(),F)return q.flush(),{steps:b,duration:C,agentSessionId:M,resolvedModel:m,usage:P,pendingInteraction:F};let Re=Fe;return Re&&(!O&&Pe.trim()&&(O=Pe.trim()),k=void 0),q.flush(),{steps:b,duration:C,result:await cc({initialResult:O,agentName:KC,hasError:!!k}),error:lc({error:k,agentName:KC}),isRetryableError:uc(k),isProviderUnavailableError:dc(k),resolvedModel:m,usage:P,agentSessionId:M,...h&&Qle(m)?{effort:h}:{},...Re?{aborted:!0}:{}}}var eue=async()=>{let t=Pc.join(TS.homedir(),".gemini");await Mu.rm(t,{recursive:!0,force:!0});let e=Pc.join(TS.homedir(),".agents","skills");await Mu.rm(e,{recursive:!0,force:!0})},tue={baseDir:Pc.join(TS.homedir(),".gemini"),include:["tmp"]};import $z from"fs/promises";import sue from"os";import bS from"path";import Fz from"process";import $qe from"readline";import Dqe from"os";import iue from"path";import Lz from"fs";var rue=ae("opencode_install"),nue="1.17.19",Lqe=()=>iue.join(Dqe.homedir(),".netlify-agent-runner","opencode"),ZC=async t=>{let e=Eo(t,"opencode");if(e)return e;let r=Lqe(),n=iue.join(r,"node_modules",".bin","opencode");if(Lz.existsSync(n))return n;Lz.mkdirSync(r,{recursive:!0}),rue.log(`Installing opencode-ai@${nue} on demand`);let i=Date.now();await pr("npm",["install","--no-save","--no-audit","--no-fund","--prefix",r,`opencode-ai@${nue}`],{cwd:r});let o=Date.now()-i;if(ne.timing("opencode.install_duration",o),rue.log(`Installed opencode-ai in ${o}ms`),!Lz.existsSync(n))throw new Error("OpenCode CLI binary not found after installing opencode-ai");return n};var Ws=ae("runner_opencode"),JC="OpenCode",aue="gateway",Uqe="z-ai/glm-5.3-flash",Fqe=new Set(["z-ai/glm-5.3-flash","deepseek/deepseek-v4-pro","x-ai/grok-4.6"]),Bqe=(t,e)=>!t||!xA.includes(t)?t:e&&Fqe.has(e)?"xhigh":"max",Uz={bash:{name:"Run command",category:V.RunCommand},read:{name:"Read file",category:V.FileRead},write:{name:"Edit file",category:V.FileWrite},edit:{name:"Edit file",category:V.FileWrite},glob:{name:"Find files",category:V.Explore},grep:{name:"Search files",category:V.Explore},list:{name:"List directory",category:V.Explore},task:{name:"Task",category:V.Task},todowrite:{name:"Update task list",category:V.Todo},webfetch:{name:"Fetch web",category:V.Web},websearch:{name:"Search web",category:V.Web},skill:{name:"Use Skill",category:V.Skill}},oue=t=>Uz[t]?.name||t,jqe=t=>Array.isArray(t)?t.flatMap(e=>{let{content:r,status:n}=e??{};return typeof r!="string"||!r?[]:[{name:r,value:typeof n=="string"&&n?n:"pending"}]}):[],zqe=250,Gqe=t=>{let e;try{e=JSON.parse(t)}catch{return{issues:"invalid_json"}}let r=sc.safeParse(e);return r.success?{questions:r.data.questions}:{issues:ac(r.error.issues)}},qqe=(t,e)=>{let r=!0,n=setInterval(async()=>{let i=await $z.readFile(t,"utf-8").catch(()=>{});if(i===void 0)return;clearInterval(n),await $z.rm(t,{force:!0}).catch(()=>{});let{questions:o,issues:s}=Gqe(i);if(!o){Ws.warn("Ignoring malformed ask tool questions file",{filePath:t,issues:s}),ne.inc("inference.malformed_ask",1);return}r&&e(o)},zqe);return n.unref(),{stop:()=>{r=!1,clearInterval(n)}}};async function Vqe({aiGateway:t,config:e,model:r}){let n=r;if(t){let i=t.isModelAvailable;if(!i)throw new Error("OpenCode runner requires a gateway with isModelAvailable support");let o=e.modelVersionOverrides?.opencode?.[e.accountType];o?n=o:r||(n=He().opencodeDefaultModel||Uqe),n&&(await i(n)||Ws.log(`Model '${n}' not found in gateway catalog; proceeding anyway (gateway is authoritative, e.g. flag-gated OpenRouter models)`))}return n}function Hqe({aiGateway:t,model:e,effort:r,questionsFilePath:n}){if(!t)throw new Error("OpenCode runner requires the AI gateway");let{token:i,url:o}=t;if(!i||!o)throw new Error("No token or url provided from AI Gateway");let s=e?{[e]:{id:e,name:e,tool_call:!0,reasoning:!0,interleaved:{field:"reasoning_details"},...r?{options:{reasoningEffort:r}}:{}}}:{},a={$schema:"https://opencode.ai/config.json",provider:{[aue]:{api:"openai",name:"Netlify AI Gateway",options:{apiKey:i,baseURL:o},...Object.keys(s).length>0?{models:s}:{}}},...n?{mcp:xoe(n)}:{}};return{...Fz.env,OPENCODE_CONFIG_CONTENT:JSON.stringify(a),OPENCODE_DISABLE_AUTOUPDATE:"1"}}async function Bz({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:o,cwd:s=Fz.cwd(),abortSignal:a,onSessionId:c,forceLowEffortForCreditWrapUp:l}){let{prompt:u}=t,{model:d}=t,f=l?"low":t.effort,p="",h,m,y,S,b=0,w=0,T,C=await Vqe({config:t,aiGateway:n,model:d}),O=Bqe(f,C);Ws.log(f?`Requesting reasoning effort '${f}' for model '${C}'${O===f?"":` (sent as '${O}')`}; ignored if unsupported`:`No reasoning effort requested for model '${C}'; running at its own default`);let k=Ka({creditWrapUpTurn:l})?await Roe():void 0,P=Hqe({aiGateway:n,model:C,effort:O,questionsFilePath:k?.filePath}),M=[],F=[],_=0,re=Date.now(),N=await ZC(s),g=["run","--format","json","--dangerously-skip-permissions","--agent","build",...C?["--model",`${aue}/${C}`]:[],...i?o?["--session",o]:["--continue"]:[]];Ws.log(`Running ${N} ${g.join(" ")}`);let E=e.utils.run(N,g,{all:!0,env:P,cwd:s,idleTimeout:ms,cancelSignal:a});E.stdin?.end(u);let x=k?qqe(k.filePath,qe=>{T||(T={questions:qe},E.kill())}):void 0,Y=Ua(()=>{r?.({steps:F,duration:Date.now()-re})},250),q=(qe,H)=>{let{wrapMessage:le,...R}=qe,I=Ww({...R,id:_});I.message&&le&&(I.message=`\`\`\`
428
428
  ${I.message}
429
- \`\`\``),_+=1,M.push(I),F.push(I),H||Y.flush(),Y(),H&&Y.flush()},fe=C||"default";t.answeredInteraction||G({title:`Using ${JC} with ${fe}`,category:V.Environment},!0);let $e=$qe.createInterface({input:E.all});$e.on("error",qe=>{Ws.error("Readline interface error",{error:qe.message,stack:qe.stack})});let Ie="",Pe,xe=new Set,Fe=()=>{Ie&&(G({message:Ie,category:V.AgentMessage}),Pe=Ie,Ie="")};$e.on("line",qe=>{let H;try{H=JSON.parse(qe)}catch{Ws.log("Could not parse line",qe);return}switch(H.sessionID&&H.sessionID!==p&&(p=H.sessionID,c?.(p)),H.type){case"step_start":{Fe();break}case"text":{let le=H.part?.text;le&&(Ie+=le);break}case"reasoning":{Fe();let le=H.part?.text;le&&G({title:"Reasoning",message:le,category:V.Reasoning},!0);break}case"tool_use":{Fe();let le=H.part?.tool;if(!le)break;let R=H.part?.state?.input??{},I=H.part?.state?.status,U=H.part?.state?.output,j=H.part?.state?.error;if(le===woe){I==="error"&&Ws.warn("Ask tool call rejected before it could pause the run",{error:j});break}if(I==="error"&&(b+=1),(I==="completed"||I==="error")&&(w+=1),le==="skill"){let ze=typeof R.name=="string"?R.name:void 0;if(ze){let ye=vo(ze);Ts(Ws,ye),G({title:`Use ${ye}`,category:V.Skill,type:ze},!0);break}}if(le==="todowrite"){let ze=jqe(R.todos);G({title:oue(le),category:ze.length>0?Uz.todowrite.category:V.Tool,...ze.length>0?{tasks:ze}:{}},!0);break}let q=typeof R.command=="string"?R.command:void 0,ee=q?Ds(q):!1,se=typeof R.path=="string"&&R.path||typeof R.file_path=="string"&&R.file_path||typeof R.pattern=="string"&&R.pattern||void 0,Te,Ye;if(ee)Te="Generating the site",Ye=V.SiteGeneration;else if(q&&le==="bash")Te=`Running \`${q}\``,Ye=V.RunCommand;else{let ze=se&&`\`${bS.relative(s,se)}\``;Te=[oue(le),ze].filter(Boolean).join(" "),Ye=Uz[le]?.category||V.AgentMessage}let Oe,Ee=["bash","read","glob","grep","list","webfetch","websearch"].includes(le);j?Oe=`\`\`\`
429
+ \`\`\``),_+=1,M.push(I),F.push(I),H||Y.flush(),Y(),H&&Y.flush()},fe=C||"default";t.answeredInteraction||q({title:`Using ${JC} with ${fe}`,category:V.Environment},!0);let $e=$qe.createInterface({input:E.all});$e.on("error",qe=>{Ws.error("Readline interface error",{error:qe.message,stack:qe.stack})});let Ie="",Pe,xe=new Set,Fe=()=>{Ie&&(q({message:Ie,category:V.AgentMessage}),Pe=Ie,Ie="")};$e.on("line",qe=>{let H;try{H=JSON.parse(qe)}catch{Ws.log("Could not parse line",qe);return}switch(H.sessionID&&H.sessionID!==p&&(p=H.sessionID,c?.(p)),H.type){case"step_start":{Fe();break}case"text":{let le=H.part?.text;le&&(Ie+=le);break}case"reasoning":{Fe();let le=H.part?.text;le&&q({title:"Reasoning",message:le,category:V.Reasoning},!0);break}case"tool_use":{Fe();let le=H.part?.tool;if(!le)break;let R=H.part?.state?.input??{},I=H.part?.state?.status,U=H.part?.state?.output,j=H.part?.state?.error;if(le===woe){I==="error"&&Ws.warn("Ask tool call rejected before it could pause the run",{error:j});break}if(I==="error"&&(b+=1),(I==="completed"||I==="error")&&(w+=1),le==="skill"){let ze=typeof R.name=="string"?R.name:void 0;if(ze){let Se=vo(ze);Ts(Ws,Se),q({title:`Use ${Se}`,category:V.Skill,type:ze},!0);break}}if(le==="todowrite"){let ze=jqe(R.todos);q({title:oue(le),category:ze.length>0?Uz.todowrite.category:V.Tool,...ze.length>0?{tasks:ze}:{}},!0);break}let G=typeof R.command=="string"?R.command:void 0,ee=G?Ds(G):!1,se=typeof R.path=="string"&&R.path||typeof R.file_path=="string"&&R.file_path||typeof R.pattern=="string"&&R.pattern||void 0,Te,Ye;if(ee)Te="Generating the site",Ye=V.SiteGeneration;else if(G&&le==="bash")Te=`Running \`${G}\``,Ye=V.RunCommand;else{let ze=se&&`\`${bS.relative(s,se)}\``;Te=[oue(le),ze].filter(Boolean).join(" "),Ye=Uz[le]?.category||V.AgentMessage}let Oe,ye=["bash","read","glob","grep","list","webfetch","websearch"].includes(le);j?Oe=`\`\`\`
430
430
  ${j.trim()}
431
- \`\`\``:U&&(Oe=Ee?`\`\`\`
431
+ \`\`\``:U&&(Oe=ye?`\`\`\`
432
432
  ${U.trim()}
433
433
  \`\`\``:U.trim()),I==="error"&&j&&(Oe=Oe?`${Oe}
434
434
 
435
- *Command failed*`:`*Command failed: ${j.trim()}*`),G({title:Te,message:Oe,category:Ye},!0);break}case"step_finish":{Fe();let le=H.part?.tokens;le&&(y={input_tokens:(y?.input_tokens??0)+(le.input??0),output_tokens:(y?.output_tokens??0)+(le.output??0),reasoning_output_tokens:(y?.reasoning_output_tokens??0)+(le.reasoning??0),cache_creation_input_tokens:(y?.cache_creation_input_tokens??0)+(le.cache?.write??0),cache_read_input_tokens:(y?.cache_read_input_tokens??0)+(le.cache?.read??0)}),H.part?.cost!=null&&(S=(S??0)+H.part.cost);break}case"error":{Fe();let R=H.error?.data?.message??H.error?.message??H.part?.state?.error??(H.error?JSON.stringify(H.error).slice(0,500):"unknown error");m=m?`${m}
435
+ *Command failed*`:`*Command failed: ${j.trim()}*`),q({title:Te,message:Oe,category:Ye},!0);break}case"step_finish":{Fe();let le=H.part?.tokens;le&&(y={input_tokens:(y?.input_tokens??0)+(le.input??0),output_tokens:(y?.output_tokens??0)+(le.output??0),reasoning_output_tokens:(y?.reasoning_output_tokens??0)+(le.reasoning??0),cache_creation_input_tokens:(y?.cache_creation_input_tokens??0)+(le.cache?.write??0),cache_read_input_tokens:(y?.cache_read_input_tokens??0)+(le.cache?.read??0)}),H.part?.cost!=null&&(S=(S??0)+H.part.cost);break}case"error":{Fe();let R=H.error?.data?.message??H.error?.message??H.part?.state?.error??(H.error?JSON.stringify(H.error).slice(0,500):"unknown error");m=m?`${m}
436
436
  ${R}`:R;break}default:H.type&&!xe.has(H.type)&&(xe.add(H.type),Ws.log(`Unhandled opencode event type: ${H.type}`))}});let Re=!1;await E.catch(qe=>{Re=Wa(qe,a),Fe();let H=ap({catchError:qe,runCmd:E,error:m,result:h??Pe,runnerName:JC});m=H.error,h=H.result}),x?.stop(),await k?.remove();let ce=Date.now()-re;Fe(),$e.close(),Y.flush();let _e=Re;return _e&&(m=void 0),!m&&!h&&Pe&&(h=Pe),y&&Na(y,C?{model:C}:{}),T?{steps:M,duration:ce,agentSessionId:p,resolvedModel:C,effort:f,resolvedProviderEffort:O,usage:y,costUsd:S,toolErrorCount:b,toolCallCount:w,pendingInteraction:T}:{steps:M,duration:ce,result:await cc({initialResult:h,agentName:JC,hasError:!!m}),error:lc({error:m,agentName:JC}),isRetryableError:uc(m),isProviderUnavailableError:dc(m),agentSessionId:p,resolvedModel:C,effort:f,resolvedProviderEffort:O,usage:y,costUsd:S,toolErrorCount:b,toolCallCount:w,..._e?{aborted:!0}:{}}}var Wqe=()=>bS.join(sue.homedir(),".config","opencode"),cue=()=>{let t=Fz.env.XDG_DATA_HOME,e=t&&bS.isAbsolute(t)?t:bS.join(sue.homedir(),".local","share");return bS.join(e,"opencode")},lue=async()=>{let t=[Wqe(),cue()];await Promise.all(t.map(e=>$z.rm(e,{recursive:!0,force:!0})))},uue={baseDir:cue(),include:["opencode.db","opencode.db-shm","opencode.db-wal"]};var jz={codex:{runner:Nz,clean:Kle,nativeSessionArchive:Zle},claude:{runner:q2,clean:qce,nativeSessionArchive:Vce},gemini:{runner:Dz,clean:eue,nativeSessionArchive:tue},opencode:{runner:Bz,clean:lue,nativeSessionArchive:uue}},Yjt=Object.keys(jz),Mo=t=>jz[t]?.nativeSessionArchive,$h=jz;import{execSync as Yqe}from"child_process";import due from"fs/promises";import Kqe from"path";import Uh from"process";var fue=ae("git-wrapper"),Zqe=["status","diff","log","show","rev-parse","rev-list","ls-files","show-ref","cat-file","merge-base","blame","grep","describe"],Jqe=t=>`#!/bin/bash
437
437
  # Git wrapper that only allows read-only commands.
438
438
  # The deployment system handles staging, moves, and commits automatically.
@@ -454,7 +454,7 @@ case "$1" in
454
454
  exit 1
455
455
  ;;
456
456
  esac
457
- `,pue=async()=>{let t="/tmp/netlify-git-wrapper",e=Kqe.join(t,"git"),r="/usr/bin/git";try{let n=(Uh.env.PATH||"").split(":").filter(i=>i!==t).join(":");r=Yqe("which git",{env:{...Uh.env,PATH:n}}).toString().trim()||r}catch{}try{await due.mkdir(t,{recursive:!0}),await due.writeFile(e,Jqe(r),{mode:493}),Uh.env.PATH?.split(":").includes(t)||(Uh.env.PATH=`${t}:${Uh.env.PATH}`),Uh.env.NETLIFY_INTERNAL_GIT="0",fue.info("Installed git wrapper to restrict the agent to read-only git commands")}catch(n){fue.warn("Failed to install git wrapper",{error:n?.message||n}),ne.inc("context.degraded",1,{component:"git_wrapper"})}};var AS=ae("init_stage"),eVe=async(t,e)=>{let r=Qqe.join(e,fr,Ai,t);try{return(await Xqe.readdir(r,{withFileTypes:!0})).filter(i=>i.isFile()&&!i.name.endsWith(".part")).length}catch{return 0}},tVe=async(t,e)=>{if(!(!He().fetchAssetsEnabled||!t.assetMap))try{await QQ({assetMap:t.assetMap,cwd:e})}catch(r){let n=ka(r)?r.kind:"unknown";throw n==="unknown"&&AS.error("Failed to fetch session assets",{error:r?.message||r}),ne.inc("assets.fetch_failed",1,{kind:n}),new Error("Failed to download the attachments uploaded for this session. Please try again.")}},hue=async({config:t,apiThrottle:e,apiToken:r,cwd:n,runnerVersion:i})=>await gt(Qe(),"init-stage",async o=>{let s=performance.now();o?.setAttributes({"init.runner":t.runner,"init.id":t.id,"init.sessionId":t.sessionId,"init.hasRepo":t.hasRepo,"init.useGateway":t.useGateway,"init.runnerVersion":i||"unknown"});let a=$h[t.runner];if(!a)throw o?.setAttributes({"init.error":"unsupported_runner"}),new Error(`${t.runner} is not supported`);if(t.runner==="opencode"&&!He().opencodeEnabled)throw o?.setAttributes({"init.error":"opencode_disabled"}),new Error("opencode runner is not enabled on this environment");let c=rVe({apiToken:r,config:t});if(kQ(c),t.siteId)try{t.site=await LQ(t.siteId)}catch(S){AS.error("Failed to get the site information",{error:S})}let l=t.useGateway?await ZQ({config:t}):void 0;o?.setAttributes({"init.aiGateway.created":!!l}),t.answeredInteraction||await br(t.id,t.sessionId,{steps:[{title:"Environment ready",category:V.Environment,type:"ready"}]});let u=5*1024,d=1e4,f=Hw(async({steps:S=[],duration:b})=>{let w=S.map(T=>{let C=T.title?H$(Yn(T.title),u):void 0,O=T.category===V.AgentMessage||T.category===V.SubagentPrompt,k=T.message?Yn(T.message):void 0,P=k&&!O?H$(k,d):k,M=T.category===V.SubagentPrompt,F=P&&!M?mC(P):P;return F!==P&&AS.info("Sanitized internal error from step message",{original:P}),{...T,title:C,message:F}});S.length=0;try{return await br(t.id,t.sessionId,{steps:w,duration:b})}catch(T){AS.error("persistSteps failed",{error:T?.message||T})}},e);AS.info("Adding build files to stage");let p=await Z$();await W$(p),wS.env.NETLIFY_LOCAL_MODE||await pue();let h;t.hasRepo?t.sha?(h=t.sha,o?.setAttributes({"init.sha.source":"provided"})):(h=await K$(),t.mode!=="redeploy"&&await kA(t.id,{sha:h}),o?.setAttributes({"init.sha.source":"current_commit"})):(h=await Cie(),o?.setAttributes({"init.sha.source":"first_commit","init.source":"zip"})),t.runSha=await K$(),await tVe(t,n);let m=await eVe(t.sessionId,n??wS.cwd());ne.inc("assets.session",1,{has_assets:m>0}),m>0&&ne.distribution("assets.session.count",m);let y=performance.now()-s;return o?.setAttributes({"init.sha":h||"unknown","init.duration.ms":y,"init.status":"success","init.assetCount":m}),{aiGateway:l,context:c,persistSteps:f,runner:a,sha:h}}),rVe=({apiToken:t,config:e})=>({constants:{NETLIFY_API_HOST:wS.env.NETLIFY_API_HOST||"api.netlify.com",NETLIFY_API_TOKEN:t||wS.env.NETLIFY_API_TOKEN,SITE_ID:e.siteId,FUNCTIONS_DIST:wS.env.FUNCTIONS_DIST||"netlify/functions"},utils:{run:pr}});Se();import uVe from"crypto";import Ft from"fs/promises";import XC from"os";import it from"path";import Do from"process";import{fileURLToPath as dVe}from"url";import nVe from"path";var mue={ask:'"Ask mode", which can explore and answer questions but not edit or deploy',build:'"Build mode", which can edit files and deploy'},iVe=t=>t==="ask"?"build":"ask",zz=t=>`This run is in ${mue[t]}; the other mode is ${mue[iVe(t)]}. Use these exact names when you refer to the modes, e.g. "switch to Build mode" \u2014 never "write mode", "execution mode", "read-only mode" or any other wording.`,oVe=`<responses>
457
+ `,pue=async()=>{let t="/tmp/netlify-git-wrapper",e=Kqe.join(t,"git"),r="/usr/bin/git";try{let n=(Uh.env.PATH||"").split(":").filter(i=>i!==t).join(":");r=Yqe("which git",{env:{...Uh.env,PATH:n}}).toString().trim()||r}catch{}try{await due.mkdir(t,{recursive:!0}),await due.writeFile(e,Jqe(r),{mode:493}),Uh.env.PATH?.split(":").includes(t)||(Uh.env.PATH=`${t}:${Uh.env.PATH}`),Uh.env.NETLIFY_INTERNAL_GIT="0",fue.info("Installed git wrapper to restrict the agent to read-only git commands")}catch(n){fue.warn("Failed to install git wrapper",{error:n?.message||n}),ne.inc("context.degraded",1,{component:"git_wrapper"})}};var AS=ae("init_stage"),eVe=async(t,e)=>{let r=Qqe.join(e,fr,Ai,t);try{return(await Xqe.readdir(r,{withFileTypes:!0})).filter(i=>i.isFile()&&!i.name.endsWith(".part")).length}catch{return 0}},tVe=async(t,e)=>{if(!(!He().fetchAssetsEnabled||!t.assetMap))try{await QQ({assetMap:t.assetMap,cwd:e})}catch(r){let n=ka(r)?r.kind:"unknown";throw n==="unknown"&&AS.error("Failed to fetch session assets",{error:r?.message||r}),ne.inc("assets.fetch_failed",1,{kind:n}),new Error("Failed to download the attachments uploaded for this session. Please try again.")}},hue=async({config:t,apiThrottle:e,apiToken:r,cwd:n,runnerVersion:i})=>await gt(Qe(),"init-stage",async o=>{let s=performance.now();o?.setAttributes({"init.runner":t.runner,"init.id":t.id,"init.sessionId":t.sessionId,"init.hasRepo":t.hasRepo,"init.useGateway":t.useGateway,"init.runnerVersion":i||"unknown"});let a=$h[t.runner];if(!a)throw o?.setAttributes({"init.error":"unsupported_runner"}),new Error(`${t.runner} is not supported`);if(t.runner==="opencode"&&!He().opencodeEnabled)throw o?.setAttributes({"init.error":"opencode_disabled"}),new Error("opencode runner is not enabled on this environment");let c=rVe({apiToken:r,config:t});if(kQ(c),t.siteId)try{t.site=await LQ(t.siteId)}catch(S){AS.error("Failed to get the site information",{error:S})}let l=t.useGateway?await ZQ({config:t}):void 0;o?.setAttributes({"init.aiGateway.created":!!l}),t.answeredInteraction||await br(t.id,t.sessionId,{steps:[{title:"Environment ready",category:V.Environment,type:"ready"}]});let u=5*1024,d=1e4,f=Hw(async({steps:S=[],duration:b})=>{let w=S.map(T=>{let C=T.title?H$(Yn(T.title),u):void 0,O=T.category===V.AgentMessage||T.category===V.SubagentPrompt,k=T.message?Yn(T.message):void 0,P=k&&!O?H$(k,d):k,M=T.category===V.SubagentPrompt,F=P&&!M?mC(P):P;return F!==P&&AS.info("Sanitized internal error from step message",{original:P}),{...T,title:C,message:F}});S.length=0;try{return await br(t.id,t.sessionId,{steps:w,duration:b})}catch(T){AS.error("persistSteps failed",{error:T?.message||T})}},e);AS.info("Adding build files to stage");let p=await Z$();await W$(p),wS.env.NETLIFY_LOCAL_MODE||await pue();let h;t.hasRepo?t.sha?(h=t.sha,o?.setAttributes({"init.sha.source":"provided"})):(h=await K$(),t.mode!=="redeploy"&&await kA(t.id,{sha:h}),o?.setAttributes({"init.sha.source":"current_commit"})):(h=await Cie(),o?.setAttributes({"init.sha.source":"first_commit","init.source":"zip"})),t.runSha=await K$(),await tVe(t,n);let m=await eVe(t.sessionId,n??wS.cwd());ne.inc("assets.session",1,{has_assets:m>0}),m>0&&ne.distribution("assets.session.count",m);let y=performance.now()-s;return o?.setAttributes({"init.sha":h||"unknown","init.duration.ms":y,"init.status":"success","init.assetCount":m}),{aiGateway:l,context:c,persistSteps:f,runner:a,sha:h}}),rVe=({apiToken:t,config:e})=>({constants:{NETLIFY_API_HOST:wS.env.NETLIFY_API_HOST||"api.netlify.com",NETLIFY_API_TOKEN:t||wS.env.NETLIFY_API_TOKEN,SITE_ID:e.siteId,FUNCTIONS_DIST:wS.env.FUNCTIONS_DIST||"netlify/functions"},utils:{run:pr}});Ee();import uVe from"crypto";import Ft from"fs/promises";import XC from"os";import it from"path";import Do from"process";import{fileURLToPath as dVe}from"url";import nVe from"path";var mue={ask:'"Ask mode", which can explore and answer questions but not edit or deploy',build:'"Build mode", which can edit files and deploy'},iVe=t=>t==="ask"?"build":"ask",zz=t=>`This run is in ${mue[t]}; the other mode is ${mue[iVe(t)]}. Use these exact names when you refer to the modes, e.g. "switch to Build mode" \u2014 never "write mode", "execution mode", "read-only mode" or any other wording.`,oVe=`<responses>
458
458
  - ${zz("ask")}
459
459
  - Write progress updates in concise, present-tense language describing what is happening now (e.g. "Reading the routing setup", "Checking the deploy configuration"). Avoid third-person self-reference (e.g. "the agent"), and avoid future-tense phrasing like "will".
460
460
  - Answer the user's question by exploring the project (read files, search, browse the web). Do NOT modify project files, run mutating commands, or attempt to build or deploy. No deploy is created for this run.
@@ -568,10 +568,10 @@ ${r.siteContext.filter(O=>O.site_context).map(O=>typeof O.site_context=="string"
568
568
 
569
569
  `)}
570
570
  </project_rules>
571
- `);let m="";if(r.sessionHistoryContext?.length){let C=it.join(Do.cwd(),fr,eL);await Ft.mkdir(C,{recursive:!0});let O=await Promise.all(r.sessionHistoryContext.map(async(k,P)=>{let M=P+1,F=`attempt-${M}.md`,_=it.join(C,F),re=it.join(fr,eL,F),N=eI(k.id),g=N?` ID ${N}`:"",E="";if(N){let Y=it.resolve(l,Ai),G=it.resolve(Y,N);G.startsWith(Y+it.sep)&&await QC(G)&&(E=`
571
+ `);let m="";if(r.sessionHistoryContext?.length){let C=it.join(Do.cwd(),fr,eL);await Ft.mkdir(C,{recursive:!0});let O=await Promise.all(r.sessionHistoryContext.map(async(k,P)=>{let M=P+1,F=`attempt-${M}.md`,_=it.join(C,F),re=it.join(fr,eL,F),N=eI(k.id),g=N?` ID ${N}`:"",E="";if(N){let Y=it.resolve(l,Ai),q=it.resolve(Y,N);q.startsWith(Y+it.sep)&&await QC(q)&&(E=`
572
572
  ---
573
573
 
574
- ## Assets: ${G}/
574
+ ## Assets: ${q}/
575
575
  `)}let x=`# Task History - Attempt ${M}${g}
576
576
 
577
577
  ## Request - what the user asked for
@@ -607,10 +607,10 @@ Use the following file for the complete context of the ask, the environment, and
607
607
  `);return[t,Ice(n,{skipNote:r&&!i?'A "(skipped)" answer means the user chose not to answer; proceed with your best judgment there.':"",overrideInstruction:i||void 0})].filter(Boolean).join(`
608
608
 
609
609
  `)};import Js from"fs/promises";import Kme from"os";import Xs from"path";import{rm as Cq}from"fs/promises";import{resolve as DVe}from"path";var LVe=".netlify/cache/",Du=function({cacheDir:t=LVe,cwd:e="."}={}){return DVe(e,t)};import{promises as VKe}from"fs";import{basename as Eme,dirname as vme,join as HKe}from"path";import aKe from"process";import cKe from"events";import st from"path";import lKe from"os";async function RS(t,e,{concurrency:r=Number.POSITIVE_INFINITY,stopOnError:n=!0,signal:i}={}){return new Promise((o,s)=>{if(t[Symbol.iterator]===void 0&&t[Symbol.asyncIterator]===void 0)throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof t})`);if(typeof e!="function")throw new TypeError("Mapper function is required");if(!(Number.isSafeInteger(r)&&r>=1||r===Number.POSITIVE_INFINITY))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${r}\` (${typeof r})`);let a=[],c=[],l=new Map,u=!1,d=!1,f=!1,p=0,h=0,m=t[Symbol.iterator]===void 0?t[Symbol.asyncIterator]():t[Symbol.iterator](),y=()=>{w(i.reason)},S=()=>{i?.removeEventListener("abort",y)},b=C=>{o(C),S()},w=C=>{u=!0,d=!0,s(C),S()};i&&(i.aborted&&w(i.reason),i.addEventListener("abort",y,{once:!0}));let T=async()=>{if(d)return;let C=await m.next(),O=h;if(h++,C.done){if(f=!0,p===0&&!d){if(!n&&c.length>0){w(new AggregateError(c));return}if(d=!0,l.size===0){b(a);return}let k=[];for(let[P,M]of a.entries())l.get(P)!==que&&k.push(M);b(k)}return}p++,(async()=>{try{let k=await C.value;if(d)return;let P=await e(k,O);P===que&&l.set(O,P),a[O]=P,p--,await T()}catch(k){if(n)w(k);else{c.push(k),p--;try{await T()}catch(P){w(P)}}}})()};(async()=>{for(let C=0;C<r;C++){try{await T()}catch(O){w(O);break}if(f||u)break}})()})}var que=Symbol("skip");import $u from"path";import wzt,{constants as nG}from"fs";import iG from"fs/promises";var Kz=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Zz=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Vue=t=>globalThis.DOMException===void 0?new Zz(t):new DOMException(t),Hue=t=>{let e=t.reason===void 0?Vue("This operation was aborted."):t.reason;return e instanceof Error?e:Vue(e)};function Jz(t,e){let{milliseconds:r,fallback:n,message:i,customTimers:o={setTimeout,clearTimeout}}=e,s,a,l=new Promise((u,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:p}=e;p.aborted&&d(Hue(p)),a=()=>{d(Hue(p))},p.addEventListener("abort",a,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(u,d);return}let f=new Kz;s=o.setTimeout.call(void 0,()=>{if(n){try{u(n())}catch(p){d(p)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?u():i instanceof Error?d(i):(f.message=i??`Promise timed out after ${r} milliseconds`,d(f))},r),(async()=>{try{u(await t)}catch(p){d(p)}})()}).finally(()=>{l.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return l.clear=()=>{o.clearTimeout.call(void 0,s),s=void 0},l}var $Ve=t=>{let e=t.addEventListener||t.on||t.addListener,r=t.removeEventListener||t.off||t.removeListener;if(!e||!r)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(t),removeListener:r.bind(t)}};function UVe(t,e,r){let n,i=new Promise((o,s)=>{if(r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r},!(r.count>=0&&(r.count===Number.POSITIVE_INFINITY||Number.isInteger(r.count))))throw new TypeError("The `count` option should be at least 0 or more");r.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:u}=$Ve(t),d=(...p)=>{let h=r.multiArgs?p:p[0];r.filter&&!r.filter(h)||(c.push(h),r.count===c.length&&(n(),o(c)))},f=p=>{n(),s(p)};n=()=>{for(let p of a)u(p,d);for(let p of r.rejectionEvents)u(p,f)};for(let p of a)l(p,d);for(let p of r.rejectionEvents)l(p,f);r.signal&&r.signal.addEventListener("abort",()=>{f(r.signal.reason)},{once:!0}),r.resolveImmediately&&o(c)});if(i.cancel=n,typeof r.timeout=="number"){let o=Jz(i,{milliseconds:r.timeout});return o.cancel=n,o}return i}function tI(t,e,r){typeof r=="function"&&(r={filter:r}),r={...r,count:1,resolveImmediately:!1};let n=UVe(t,e,r),i=n.then(o=>o[0]);return i.cancel=n.cancel,i}var qr=class extends Error{constructor(e,{cause:r}={}){super(e,{cause:r}),Object.assign(this,r),this.name="CopyFileError"}};var $i=fn(nde(),1);import{promisify as CS}from"util";var yzt=CS($i.default.stat),KVe=CS($i.default.lstat),ZVe=CS($i.default.utimes),JVe=CS($i.default.chmod),XVe=CS($i.default.mkdir),Szt=$i.default.closeSync.bind($i.default),ide=$i.default.createWriteStream.bind($i.default);async function ode(t,e){let r=$i.default.createReadStream(t,e);try{await tI(r,["readable","end"])}catch(n){throw new qr(`Cannot read from \`${t}\`: ${n.message}`,{cause:n})}return r}var rG=t=>KVe(t).catch(e=>{throw new qr(`lstat \`${t}\` failed: ${e.message}`,{cause:e})}),sde=(t,e,r)=>ZVe(t,e,r).catch(n=>{throw new qr(`utimes \`${t}\` failed: ${n.message}`,{cause:n})}),ade=(t,e)=>JVe(t,e).catch(r=>{throw new qr(`chmod \`${t}\` failed: ${r.message}`,{cause:r})});var cde=(t,e)=>XVe(t,{...e,recursive:!0}).catch(r=>{throw new qr(`Cannot create directory \`${t}\`: ${r.message}`,{cause:r})});var eHe=(t,e,r)=>({sourcePath:$u.resolve(t,e),destinationPath:$u.resolve(t,r)}),tHe=(t,e)=>{if(!t.isFile())throw Object.assign(new qr(`EISDIR: illegal operation on a directory '${e}'`),{errno:-21,code:"EISDIR",source:e})};async function lde(t,e,r={}){if(!t||!e)throw new qr("`source` and `destination` required");r.cwd&&({sourcePath:t,destinationPath:e}=eHe(r.cwd,t,e)),r={overwrite:!0,...r};let n=await rG(t),{size:i}=n;tHe(n,t);let o=$u.dirname(e);if($u.parse(o).root===o||await cde($u.dirname(e),{mode:r.directoryMode}),typeof r.onProgress=="function"){let a=await ode(t),c=ide(e,{flags:r.overwrite?"w":"wx"}),l=p=>{r.onProgress({sourcePath:$u.resolve(t),destinationPath:$u.resolve(e),size:i,writtenBytes:p,percent:p===i?1:p/i})},u=-1;a.on("data",()=>{let p=c.bytesWritten,h=p===i?1:p/i;(h===1||h-u>=.01)&&(u=h,l(p))});let d;a.once("error",p=>{d=new qr(`Cannot read from \`${t}\`: ${p.message}`,{cause:p})});let f=!1;try{let p=tI(c,"close");a.pipe(c),await p,l(i),f=!0}catch(p){throw new qr(`Cannot write to \`${e}\`: ${p.message}`,{cause:p})}if(d)throw d;if(f){let p=await rG(t);return Promise.all([sde(e,p.atime,p.mtime).catch(h=>{if(h.code!=="EPERM")throw h}),ade(e,p.mode)])}}else{let a=r.overwrite?nG.COPYFILE_FICLONE:nG.COPYFILE_FICLONE|nG.COPYFILE_EXCL;try{await iG.copyFile(t,e,a),await Promise.all([iG.utimes(e,n.atime,n.mtime).catch(c=>{if(c.code!=="EPERM")throw c}),iG.chmod(e,n.mode)])}catch(c){throw new qr(c.message,{cause:c})}}}async function oG(t,e,r){return(await RS(t,(i,o)=>Promise.all([e(i,o),i]),r)).filter(i=>!!i[0]).map(i=>i[1])}import xhe from"process";import eKe from"fs";import Xh from"path";import{on as rHe,once as nHe}from"events";import{PassThrough as iHe}from"stream";import{finished as fde}from"stream/promises";function lG(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)aG(i);let e=t.some(({readableObjectMode:i})=>i),r=oHe(t,e),n=new sG({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&mde(n),n}var oHe=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},sG=class extends iHe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;add(e){aG(e),!this.#e.has(e)&&(this.#e.add(e),this.#n??=sHe(this,this.#e),lHe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n}),e.pipe(this,{end:!1}))}remove(e){return aG(e),this.#e.has(e)?(e.unpipe(this),!0):!1}},sHe=async(t,e)=>{sI(t,ude);let r=new AbortController;try{await Promise.race([aHe(t,r),cHe(t,e,r)])}finally{r.abort(),sI(t,-ude)}},aHe=async(t,{signal:e})=>{await fde(t,{signal:e,cleanup:!0})},cHe=async(t,e,{signal:r})=>{for await(let[n]of rHe(t,"unpipe",{signal:r}))e.has(n)&&n.emit(hde)},aG=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},lHe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o})=>{sI(t,dde);let s=new AbortController;try{await Promise.race([uHe(o,e),dHe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:s}),fHe({stream:e,streams:r,ended:n,aborted:i,controller:s})])}finally{s.abort(),sI(t,-dde)}r.size===n.size+i.size&&(n.size===0&&i.size>0?cG(t):mde(t))},pde=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",uHe=async(t,e)=>{try{await t,cG(e)}catch(r){pde(r)?cG(e):gde(e,r)}},dHe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await fde(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;pde(s)?i.add(e):gde(t,s)}},fHe=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await nHe(t,hde,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},hde=Symbol("unpipe"),mde=t=>{t.writable&&t.end()},cG=t=>{(t.readable||t.writable)&&t.destroy()},gde=(t,e)=>{t.destroyed||(t.once("error",pHe),t.destroy(e))},pHe=()=>{},sI=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},ude=2,dde=1;var Qh=fn(DS(),1);import wYe from"fs";import xYe from"fs/promises";async function K4(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await xYe[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function Z4(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return wYe[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var i4t=K4.bind(void 0,"stat","isFile"),ahe=K4.bind(void 0,"stat","isDirectory"),o4t=K4.bind(void 0,"lstat","isSymbolicLink"),s4t=Z4.bind(void 0,"statSync","isFile"),che=Z4.bind(void 0,"statSync","isDirectory"),a4t=Z4.bind(void 0,"lstatSync","isSymbolicLink");var iq=fn(DS(),1),_he=fn(nq(),1);import WYe from"process";import YYe from"fs";import KYe from"fs/promises";import Jh from"path";function Zh(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var $S=t=>t[0]==="!";var ZYe=["**/node_modules","**/flow-typed","**/coverage","**/.git"],yhe={absolute:!0,dot:!0},She="**/.gitignore",JYe=(t,e)=>$S(t)?"!"+Jh.posix.join(e,t.slice(1)):Jh.posix.join(e,t),XYe=(t,e)=>{let r=Zh(Jh.relative(e,Jh.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>JYe(n,r))},QYe=(t,e)=>{if(e=Zh(e),Jh.isAbsolute(t)){if(Zh(t).startsWith(e))return Jh.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},Ehe=(t,e)=>{let r=t.flatMap(i=>XYe(i,e)),n=(0,_he.default)().add(r);return i=>(i=en(i),i=QYe(i,e),i?n.ignores(Zh(i)):!1)},vhe=(t={})=>({cwd:en(t.cwd)??WYe.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...ZYe]}),The=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=vhe(e),s=await(0,iq.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...yhe}),a=await Promise.all(s.map(async c=>({filePath:c,content:await KYe.readFile(c,"utf8")})));return Ehe(a,r)},bhe=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=vhe(e),a=iq.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...yhe}).map(c=>({filePath:c,content:YYe.readFileSync(c,"utf8")}));return Ehe(a,r)};var tKe=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},Rhe=(t,e)=>{let r=$S(t)?t.slice(1):t;return Xh.isAbsolute(r)?r:Xh.join(e,r)},Che=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>Xh.posix.join(t,`**/${Xh.extname(i)?i:`${i}${n}`}`)):[Xh.posix.join(t,`**${n?`/*${n}`:""}`)]},Ahe=async(t,{cwd:e=xhe.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async o=>await ahe(Rhe(o,e))?Che({directoryPath:o,files:r,extensions:n}):o))).flat(),whe=(t,{cwd:e=xhe.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>che(Rhe(i,e))?Che({directoryPath:i,files:r,extensions:n}):i),oq=t=>(t=[...new Set([t].flat())],tKe(t),t),rKe=t=>{if(!t)return;let e;try{e=eKe.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},Ihe=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:en(t.cwd)},rKe(t.cwd),t),Phe=t=>async(e,r)=>t(oq(e),Ihe(r)),UI=t=>(e,r)=>t(oq(e),Ihe(r)),Ohe=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?oq(e):[];return r&&n.push(She),n},nKe=async t=>{let e=Ohe(t);return khe(e.length>0&&await The(e,t))},Nhe=t=>{let e=Ohe(t);return khe(e.length>0&&bhe(e,t))},khe=t=>{let e=new Set;return r=>{let n=Xh.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},Mhe=(t,e)=>t.flat().filter(r=>e(r)),Dhe=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(o=>$S(o));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let o of r)o.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},Lhe=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),$he=async(t,e)=>{let r=Dhe(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=Lhe(i,n);return Promise.all(r.map(async s=>{let{patterns:a,options:c}=s;return[a,c.ignore]=await Promise.all([Ahe(a,o),Ahe(c.ignore,{cwd:n})]),{patterns:a,options:c}}))},sq=(t,e)=>{let r=Dhe(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=Lhe(i,n);return r.map(s=>{let{patterns:a,options:c}=s;return a=whe(a,o),c.ignore=whe(c.ignore,{cwd:n}),{patterns:a,options:c}})},C4t=Phe(async(t,e)=>{let[r,n]=await Promise.all([$he(t,e),nKe(e)]),i=await Promise.all(r.map(o=>(0,Qh.default)(o.patterns,o.options)));return Mhe(i,n)}),Uhe=UI((t,e)=>{let r=sq(t,e),n=Nhe(e),i=r.map(o=>Qh.default.sync(o.patterns,o.options));return Mhe(i,n)}),I4t=UI((t,e)=>{let r=sq(t,e),n=Nhe(e),i=r.map(s=>Qh.default.stream(s.patterns,s.options));return lG(i).filter(s=>n(s))}),ju=UI((t,e)=>t.some(r=>Qh.default.isDynamicPattern(r,e))),P4t=Phe($he),O4t=UI(sq),{convertPathToPattern:N4t}=Qh.default;var Bhe=fn(OG(),1);var Fc=class extends Error{constructor(e,{cause:r}={}){super(e,{cause:r}),Object.assign(this,r),this.name="CpyError"}};import BI from"path";import Fhe from"fs";var iKe=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],oKe=new RegExp(iKe.join("|"));function sKe(t){return oKe.test(t)}function FI(t){return!sKe(t)}var US=class{constructor(e,r,n){this.path=e,this.originalPath=e,this.destination=r,this.options=n,this.isDirectory=!1,!ju(e)&&Fhe.existsSync(e)&&Fhe.lstatSync(e).isDirectory()&&(this.path=[e,"**"].join("/"),this.isDirectory=!0)}get name(){return BI.basename(this.originalPath)}get normalizedPath(){let e=this.originalPath.split("/"),r=e.findIndex(i=>i?ju(i):!1),n=e.slice(0,r).join("/");return n?BI.isAbsolute(n)?n:BI.join(this.options.cwd,n):this.destination}hasMagic(){return ju(this.options.flat?this.path:this.originalPath)}getMatches(){let e=Uhe(this.path,{...this.options,dot:!0,absolute:!0,onlyFiles:!0});return this.options.ignoreJunk&&(e=e.filter(r=>FI(BI.basename(r)))),e}};var uKe={ignoreJunk:!0,flat:!1,cwd:aKe.cwd()},aq=class{constructor(e,r,n){this.path=e.split("/").join(st.sep),this.relativePath=r.split("/").join(st.sep),this.pattern=n,Object.freeze(this)}get name(){return st.basename(this.path)}get nameWithoutExtension(){return st.basename(this.path,st.extname(this.path))}get extension(){return st.extname(this.path).slice(1)}},dKe=t=>t.flatMap(e=>Bhe.default.braces(e,{expand:!0,nodupes:!0})),fKe=({entry:t,destination:e,options:r})=>t.pattern.hasMagic()?r.flat?st.isAbsolute(e)?st.join(e,t.name):st.join(r.cwd,e,t.name):st.join(e,st.relative(t.pattern.normalizedPath,t.path)):st.isAbsolute(e)?st.join(e,t.name):t.pattern.isDirectory&&st.relative(r.cwd,t.path).startsWith("..")?st.join(r.cwd,e,st.basename(t.pattern.originalPath),st.relative(t.pattern.originalPath,t.path)):!t.pattern.isDirectory&&t.path===t.relativePath?st.join(r.cwd,e,st.basename(t.pattern.originalPath),st.relative(t.pattern.originalPath,t.path)):!t.pattern.isDirectory&&r.flat?st.join(r.cwd,e,st.basename(t.pattern.originalPath)):st.join(r.cwd,e,st.relative(r.cwd,t.path)),pKe=(t,e)=>{let r=st.dirname(t);if(typeof e=="string")return st.join(r,e);if(typeof e=="function"){let n=st.basename(t);return st.join(r,e(n))}return t};function cq(t,e,{concurrency:r=lKe.availableParallelism(),...n}={}){let i=new Map,o=new cKe;n={...uKe,...n};let s=(async()=>{let a=[],c=0,l=0,u=dKe([t??[]].flat()).map(h=>h.replaceAll("\\","/")),d=u.filter(h=>!h.startsWith("!")),f=u.filter(h=>h.startsWith("!"));if(d.length===0||!e)throw new Fc("`source` and `destination` required");u=u.map(h=>new US(h,e,{...n,ignore:f}));for(let h of u){let m=[];try{m=h.getMatches()}catch(y){throw new Fc(`Cannot glob \`${h.originalPath}\`: ${y.message}`,{cause:y})}if(m.length===0&&!ju(h.originalPath)&&!ju(f))throw new Fc(`Cannot copy \`${h.originalPath}\`: the file doesn't exist`);a=[...a,...m.map(y=>new aq(y,st.relative(n.cwd,y),h))]}n.filter!==void 0&&(a=await oG(a,n.filter,{concurrency:1024})),a.length===0&&o.emit("progress",{totalFiles:0,percent:1,completedFiles:0,completedSize:0});let p=h=>{let m=i.get(h.sourcePath)||{writtenBytes:0,percent:0};(m.writtenBytes!==h.writtenBytes||m.percent!==h.percent)&&(l-=m.writtenBytes,l+=h.writtenBytes,h.percent===1&&m.percent!==1&&c++,i.set(h.sourcePath,{writtenBytes:h.writtenBytes,percent:h.percent}),o.emit("progress",{totalFiles:a.length,percent:c/a.length,completedFiles:c,completedSize:l,sourcePath:h.sourcePath,destinationPath:h.destinationPath}))};return RS(a,async h=>{let m=pKe(fKe({entry:h,destination:e,options:n}),n.rename);try{await lde(h.path,m,{...n,onProgress:p})}catch(y){throw new Fc(`Cannot copy from \`${h.relativePath}\` to \`${m}\`: ${y.message}`,{cause:y})}return m},{concurrency:r})})();return s.on=(...a)=>(o.on(...a),s),s}import ome from"process";import DKe from"fs";import rm from"path";import{on as hKe,once as mKe}from"events";import{PassThrough as gKe}from"stream";import{finished as Ghe}from"stream/promises";function fq(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)uq(i);let e=t.some(({readableObjectMode:i})=>i),r=_Ke(t,e),n=new lq({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&Hhe(n),n}var _Ke=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},lq=class extends gKe{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;add(e){uq(e),!this.#e.has(e)&&(this.#e.add(e),this.#n??=yKe(this,this.#e),vKe({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n}),e.pipe(this,{end:!1}))}remove(e){return uq(e),this.#e.has(e)?(e.unpipe(this),!0):!1}},yKe=async(t,e)=>{jI(t,jhe);let r=new AbortController;try{await Promise.race([SKe(t,r),EKe(t,e,r)])}finally{r.abort(),jI(t,-jhe)}},SKe=async(t,{signal:e})=>{await Ghe(t,{signal:e,cleanup:!0})},EKe=async(t,e,{signal:r})=>{for await(let[n]of hKe(t,"unpipe",{signal:r}))e.has(n)&&n.emit(Vhe)},uq=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},vKe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o})=>{jI(t,zhe);let s=new AbortController;try{await Promise.race([TKe(o,e),bKe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:s}),AKe({stream:e,streams:r,ended:n,aborted:i,controller:s})])}finally{s.abort(),jI(t,-zhe)}r.size===n.size+i.size&&(n.size===0&&i.size>0?dq(t):Hhe(t))},qhe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",TKe=async(t,e)=>{try{await t,dq(e)}catch(r){qhe(r)?dq(e):Whe(e,r)}},bKe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await Ghe(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;qhe(s)?i.add(e):Whe(t,s)}},AKe=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await mKe(t,Vhe,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},Vhe=Symbol("unpipe"),Hhe=t=>{t.writable&&t.end()},dq=t=>{(t.readable||t.writable)&&t.destroy()},Whe=(t,e)=>{t.destroyed||(t.once("error",wKe),t.destroy(e))},wKe=()=>{},jI=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},jhe=2,zhe=1;var nm=fn(DS(),1);import xKe from"fs";import RKe from"fs/promises";async function pq(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await RKe[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function hq(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return xKe[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var iqt=pq.bind(void 0,"stat","isFile"),Yhe=pq.bind(void 0,"stat","isDirectory"),oqt=pq.bind(void 0,"lstat","isSymbolicLink"),sqt=hq.bind(void 0,"statSync","isFile"),Khe=hq.bind(void 0,"statSync","isDirectory"),aqt=hq.bind(void 0,"lstatSync","isSymbolicLink");var mq=fn(DS(),1),Zhe=fn(nq(),1);import CKe from"process";import IKe from"fs";import PKe from"fs/promises";import tm from"path";function em(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var FS=t=>t[0]==="!";var OKe=["**/node_modules","**/flow-typed","**/coverage","**/.git"],Jhe={absolute:!0,dot:!0},Xhe="**/.gitignore",NKe=(t,e)=>FS(t)?"!"+tm.posix.join(e,t.slice(1)):tm.posix.join(e,t),kKe=(t,e)=>{let r=em(tm.relative(e,tm.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>NKe(n,r))},MKe=(t,e)=>{if(e=em(e),tm.isAbsolute(t)){if(em(t).startsWith(e))return tm.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},Qhe=(t,e)=>{let r=t.flatMap(i=>kKe(i,e)),n=(0,Zhe.default)().add(r);return i=>(i=en(i),i=MKe(i,e),i?n.ignores(em(i)):!1)},eme=(t={})=>({cwd:en(t.cwd)??CKe.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...OKe]}),tme=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=eme(e),s=await(0,mq.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...Jhe}),a=await Promise.all(s.map(async c=>({filePath:c,content:await PKe.readFile(c,"utf8")})));return Qhe(a,r)},rme=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=eme(e),a=mq.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...Jhe}).map(c=>({filePath:c,content:IKe.readFileSync(c,"utf8")}));return Qhe(a,r)};var LKe=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},sme=(t,e)=>{let r=FS(t)?t.slice(1):t;return rm.isAbsolute(r)?r:rm.join(e,r)},ame=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>rm.posix.join(t,`**/${rm.extname(i)?i:`${i}${n}`}`)):[rm.posix.join(t,`**${n?`/*${n}`:""}`)]},nme=async(t,{cwd:e=ome.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async o=>await Yhe(sme(o,e))?ame({directoryPath:o,files:r,extensions:n}):o))).flat(),ime=(t,{cwd:e=ome.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>Khe(sme(i,e))?ame({directoryPath:i,files:r,extensions:n}):i),gq=t=>(t=[...new Set([t].flat())],LKe(t),t),$Ke=t=>{if(!t)return;let e;try{e=DKe.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},cme=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:en(t.cwd)},$Ke(t.cwd),t),lme=t=>async(e,r)=>t(gq(e),cme(r)),zI=t=>(e,r)=>t(gq(e),cme(r)),ume=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?gq(e):[];return r&&n.push(Xhe),n},UKe=async t=>{let e=ume(t);return fme(e.length>0&&await tme(e,t))},dme=t=>{let e=ume(t);return fme(e.length>0&&rme(e,t))},fme=t=>{let e=new Set;return r=>{let n=rm.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},pme=(t,e)=>t.flat().filter(r=>e(r)),hme=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(o=>FS(o));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let o of r)o.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},mme=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),gme=async(t,e)=>{let r=hme(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=mme(i,n);return Promise.all(r.map(async s=>{let{patterns:a,options:c}=s;return[a,c.ignore]=await Promise.all([nme(a,o),nme(c.ignore,{cwd:n})]),{patterns:a,options:c}}))},_q=(t,e)=>{let r=hme(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=mme(i,n);return r.map(s=>{let{patterns:a,options:c}=s;return a=ime(a,o),c.ignore=ime(c.ignore,{cwd:n}),{patterns:a,options:c}})},_me=lme(async(t,e)=>{let[r,n]=await Promise.all([gme(t,e),UKe(e)]),i=await Promise.all(r.map(o=>(0,nm.default)(o.patterns,o.options)));return pme(i,n)}),Rqt=zI((t,e)=>{let r=_q(t,e),n=dme(e),i=r.map(o=>nm.default.sync(o.patterns,o.options));return pme(i,n)}),Cqt=zI((t,e)=>{let r=_q(t,e),n=dme(e),i=r.map(s=>nm.default.stream(s.patterns,s.options));return fq(i).filter(s=>n(s))}),Iqt=zI((t,e)=>t.some(r=>nm.default.isDynamicPattern(r,e))),Pqt=lme(gme),Oqt=zI(_q),{convertPathToPattern:Nqt}=nm.default;import BKe from"process";import BS from"path";import Bqt,{promises as GI}from"fs";import Dqt,{promises as FKe}from"fs";async function yme(t){try{return await FKe.access(t),!0}catch{return!1}}var jKe=(t,e,r)=>(e=BS.resolve(t,e),r=BS.resolve(t,r),{sourcePath:e,destinationPath:r}),zKe=(t,e,r="Path")=>{if(!t||!e)throw new TypeError(`\`source${r}\` and \`destination${r}\` required`)},GKe=(t,e)=>{if(BS.dirname(t)!==BS.dirname(e))throw new Error("`source` and `destination` must be in the same directory")},qKe=async(t,e,{overwrite:r=!0,cwd:n=BKe.cwd(),directoryMode:i,validateDirectory:o=!1}={})=>{if(n&&({sourcePath:t,destinationPath:e}=jKe(n,t,e)),o&&GKe(t,e),!r&&await yme(e))throw new Error(`The destination file exists: ${e}`);await GI.mkdir(BS.dirname(e),{recursive:!0,mode:i});try{await GI.rename(t,e)}catch(s){if(s.code==="EXDEV")await GI.copyFile(t,e),await GI.unlink(t);else throw s}};async function Sme(t,e,r){return zKe(t,e),qKe(t,e,r)}var yq=async function(t,e,r=!1){if(r)return Sme(t,e,{overwrite:!1});let{srcGlob:n,dest:i,...o}=await Tme(t,vme(e));if(n&&i)return cq(n,i,{...o,overwrite:!1})},jS=async function(t){let{srcGlob:e,isDir:r,dest:n,...i}=await Tme(t,"");return e!==void 0&&!await WKe(e,r,i)},WKe=async function(t,e,r){return e?(await _me(t,r)).filter(o=>FI(Eme(o))).length===0:!1},Tme=async function(t,e){let r=await YKe(t);if(r===void 0)return{srcGlob:void 0,isDir:!1,cwd:""};let n=r.isDirectory(),i=Eme(t),o=vme(t),s={srcGlob:i,dest:e,isDir:n,cwd:o,dot:!0};return n?{...s,srcGlob:`${i}/**`,dest:HKe(e,i)}:s},YKe=async t=>{try{return await VKe.stat(t)}catch{return}};import{join as G8e}from"path";import{stat as KKe,lstat as bme,readdir as ZKe,realpath as JKe}from"fs/promises";import{Readable as XKe}from"stream";import{resolve as Ame,relative as QKe,join as e8e,sep as t8e}from"path";var Nn={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},Sq={root:".",fileFilter:t=>!0,directoryFilter:t=>!0,type:Nn.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(Sq);var Cme="READDIRP_RECURSIVE_ERROR",r8e=new Set(["ENOENT","EPERM","EACCES","ELOOP",Cme]),wme=[Nn.DIR_TYPE,Nn.EVERYTHING_TYPE,Nn.FILE_DIR_TYPE,Nn.FILE_TYPE],n8e=new Set([Nn.DIR_TYPE,Nn.EVERYTHING_TYPE,Nn.FILE_DIR_TYPE]),i8e=new Set([Nn.EVERYTHING_TYPE,Nn.FILE_DIR_TYPE,Nn.FILE_TYPE]),o8e=t=>r8e.has(t.code),s8e=process.platform==="win32",xme=t=>!0,Rme=t=>{if(t===void 0)return xme;if(typeof t=="function")return t;if(typeof t=="string"){let e=t.trim();return r=>r.basename===e}if(Array.isArray(t)){let e=t.map(r=>r.trim());return r=>e.some(n=>r.basename===n)}return xme},Eq=class extends XKe{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let r={...Sq,...e},{root:n,type:i}=r;this._fileFilter=Rme(r.fileFilter),this._directoryFilter=Rme(r.directoryFilter);let o=r.lstat?bme:KKe;s8e?this._stat=s=>o(s,{bigint:!0}):this._stat=o,this._maxDepth=r.depth??Sq.depth,this._wantsDir=i?n8e.has(i):!1,this._wantsFile=i?i8e.has(i):!1,this._wantsEverything=i===Nn.EVERYTHING_TYPE,this._root=Ame(n),this._isDirent=!r.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let r=this.parent,n=r&&r.files;if(n&&n.length>0){let{path:i,depth:o}=r,s=n.splice(0,e).map(c=>this._formatEntry(c,i)),a=await Promise.all(s);for(let c of a){if(!c)continue;if(this.destroyed)return;let l=await this._getEntryType(c);l==="directory"&&this._directoryFilter(c)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,o+1)),this._wantsDir&&(this.push(c),e--)):(l==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),e--)}}else{let i=this.parents.pop();if(!i){this.push(null);break}if(this.parent=await i,this.destroyed)return}}}catch(r){this.destroy(r)}finally{this.reading=!1}}}async _exploreDir(e,r){let n;try{n=await ZKe(e,this._rdOptions)}catch(i){this._onError(i)}return{files:n,depth:r,path:e}}async _formatEntry(e,r){let n,i=this._isDirent?e.name:e;try{let o=Ame(e8e(r,i));n={path:QKe(this._root,o),fullPath:o,basename:i},n[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(o){this._onError(o);return}return n}_onError(e){o8e(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let r=e[this._statsProp];if(r.isFile())return"file";if(r.isDirectory())return"directory";if(r&&r.isSymbolicLink()){let n=e.fullPath;try{let i=await JKe(n),o=await bme(i);if(o.isFile())return"file";if(o.isDirectory()){let s=i.length;if(n.startsWith(i)&&n.substr(s,1)===t8e){let a=new Error(`Circular symlink detected: "${n}" points to "${i}"`);return a.code=Cme,this._onError(a)}return"directory"}}catch(i){return this._onError(i),""}}}_includeAsFile(e){let r=e&&e[this._statsProp];return r&&this._wantsEverything&&!r.isDirectory()}};function a8e(t,e={}){let r=e.entryType||e.type;if(r==="both"&&(r=Nn.FILE_DIR_TYPE),r&&(e.type=r),t){if(typeof t!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(r&&!wme.includes(r))throw new Error(`readdirp: Invalid type passed. Use one of ${wme.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new Eq(e)}function Ime(t,e={}){return new Promise((r,n)=>{let i=[];a8e(t,e).on("data",o=>i.push(o)).on("end",()=>r(i)).on("error",o=>n(o))})}import{mkdir as E8e,readFile as Lme,rm as v8e,writeFile as T8e}from"fs/promises";import{existsSync as $me}from"fs";import{dirname as b8e}from"path";var Pme=t=>{if(!(!Number.isInteger(t)||t<1))return Date.now()+t*1e3},Ome=t=>t!==void 0&&Date.now()>t;import{createHash as g8e}from"crypto";import{createReadStream as _8e}from"fs";import u8e from"process";import d8e from"path";import lVt,{promises as Nme}from"fs";import{fileURLToPath as f8e}from"url";var vq=class{value;next;constructor(e){this.value=e}},zS=class{#e;#r;#t;constructor(){this.clear()}enqueue(e){let r=new vq(e);this.#e?(this.#r.next=r,this.#r=r):(this.#e=r,this.#r=r),this.#t++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#t--,this.#e||(this.#r=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#r=void 0,this.#t=0}get size(){return this.#t}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}};function qI(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new zS,r=0,n=()=>{r--,e.size>0&&e.dequeue()()},i=async(a,c,l)=>{r++;let u=(async()=>a(...l))();c(u);try{await u}catch{}n()},o=(a,c,l)=>{e.enqueue(i.bind(void 0,a,c,l)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},s=(a,...c)=>new Promise(l=>{o(a,l,c)});return Object.defineProperties(s,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),s}var VI=class extends Error{constructor(e){super(),this.value=e}},c8e=async(t,e)=>e(await t),l8e=async t=>{let e=await Promise.all(t);if(e[1]===!0)throw new VI(e[0]);return!1};async function Tq(t,e,{concurrency:r=Number.POSITIVE_INFINITY,preserveOrder:n=!0}={}){let i=qI(r),o=[...t].map(a=>[a,i(c8e,a,e)]),s=qI(n?1:Number.POSITIVE_INFINITY);try{await Promise.all(o.map(a=>s(l8e,a)))}catch(a){if(a instanceof VI)return a.value;throw a}}var kme={directory:"isDirectory",file:"isFile"};function p8e(t){if(!Object.hasOwnProperty.call(kme,t))throw new Error(`Invalid type specified: ${t}`)}var h8e=(t,e)=>e[kme[t]](),m8e=t=>t instanceof URL?f8e(t):t;async function Mme(t,{cwd:e=u8e.cwd(),type:r="file",allowSymlinks:n=!0,concurrency:i,preserveOrder:o}={}){p8e(r),e=m8e(e);let s=n?Nme.stat:Nme.lstat;return Tq(t,async a=>{try{let c=await s(d8e.resolve(e,a));return h8e(r,c)}catch{return!1}},{concurrency:i,preserveOrder:o})}var y8e="sha1",Dme=async function(t,e){if(e||t.length===0)return;let r=await Mme(t);return r===void 0?void 0:await S8e(r)},S8e=async function(t){let e=_8e(t,"utf8"),r=g8e(y8e,{encoding:"hex"});return e.pipe(r),await Af(r)};var Ume=async function({cachePath:t,move:e,ttl:r,digests:n}){let i=HI(t),o=Pme(r),s=await Dme(n,e),c=`${JSON.stringify({expires:o,hash:s},null,2)}
610
- `,l=await A8e({hash:s,manifestPath:i,manifestString:c});return{manifestInfo:{manifestPath:i,manifestString:c},identical:l}},A8e=async function({hash:t,manifestPath:e,manifestString:r}){return t===void 0||!$me(e)?!1:await Lme(e,"utf8")===r},Fme=async function({manifestPath:t,manifestString:e}){await E8e(b8e(t),{recursive:!0}),await T8e(t,e)},Bme=async function(t){let e=HI(t);await v8e(e,{force:!0,recursive:!0,maxRetries:3})},HI=function(t){return`${t}${zme}`},jme=function(t){return t.endsWith(zme)},zme=".netlify.cache.json",bq=async function(t){let e=HI(t);if(!$me(e))return!1;let{expires:r}=await w8e(t);return Ome(r)},w8e=async function(t){let e=HI(t),r=await Lme(e,"utf-8");return JSON.parse(r)};import{homedir as P8e}from"os";import{resolve as Gme,isAbsolute as O8e,join as N8e,sep as wq}from"path";import{normalize as x8e}from"path";import{existsSync as R8e}from"fs";import C8e from"process";var Aq=function(t){try{let e=I8e(t);return R8e(e)?Promise.resolve(e):Promise.resolve("")}catch{return Promise.resolve("")}},I8e=function(t=C8e.cwd()){return x8e(t)};var GS=async function({path:t,cacheDir:e,cwdOpt:r}){let n=await k8e(t,r),i=await $8e({srcPath:n,cacheDir:e,cwdOpt:r});return{srcPath:n,cachePath:i}},k8e=async function(t,e){let r=await Aq(e),n=M8e(t,r);return D8e(n,r),n},M8e=function(t,e){if(O8e(t))return Gme(t);if(e!=="")return Gme(e,t);throw new Error(`Current directory does not exist: ${e}`)},D8e=function(t,e){if(e!==""&&L8e(t,e))throw new Error(`Cannot cache ${t} because it is the current directory (${e}) or a parent directory`)},L8e=function(t,e){return`${e}${wq}`.startsWith(`${t}${wq}`)},$8e=async function({srcPath:t,cacheDir:e,cwdOpt:r}){let n=Du({cacheDir:e,cwd:r}),{name:i,relPath:o}=await U8e(t,r);return N8e(n,i,o)},U8e=async function(t,e){let r=await xq(e),n=F8e(t);return r.map(({name:i,base:o})=>j8e(i,o,n)).find(Boolean)},F8e=function(t){return t.replace(B8e,"\\")},B8e=/^[a-zA-Z]:\\/,j8e=function(t,e,r){if(r===e||!r.startsWith(e))return;let n=r.replace(e,"");return{name:t,relPath:n}},xq=async function(t){return[...await z8e(t),{name:"home",base:P8e()},{name:"root",base:wq}]},z8e=async function(t){let e=await Aq(t);return e===""?[]:[{name:"cwd",base:e}]};var q8e=1,Rq=async function({cacheDir:t,cwd:e,depth:r=q8e}={}){let n=await xq(e),i=Du({cacheDir:t,cwd:e});return(await Promise.all(n.map(({name:a,base:c})=>V8e({name:a,base:c,cacheDir:i,depth:r})))).flat()},V8e=async function({name:t,base:e,cacheDir:r,depth:n}){return(await Ime(`${r}/${t}`,{fileFilter:H8e,depth:n,type:"files_directories"})).map(({path:s})=>G8e(e,s))},H8e=function({basename:t}){return!jme(t)};var W8e=async function(t,{move:e=qme,ttl:r=J8e,digests:n=[],cacheDir:i,cwd:o}={}){let{srcPath:s,cachePath:a}=await GS({path:t,cacheDir:i,cwdOpt:o});if(!await jS(s))return!1;let{manifestInfo:c,identical:l}=await Ume({cachePath:a,move:e,ttl:r,digests:n});return l||(await Cq(a,{force:!0,recursive:!0,maxRetries:3}),await yq(s,a,e),await Fme(c)),!0},Y8e=async function(t,{move:e=qme,cacheDir:r,cwd:n}={}){let{srcPath:i,cachePath:o}=await GS({path:t,cacheDir:r,cwdOpt:n});return!await jS(o)||await bq(o)?!1:(await Cq(i,{force:!0,recursive:!0,maxRetries:3}),await yq(o,i,e),!0)},K8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await GS({path:t,cacheDir:e,cwdOpt:r});return await jS(n)?(await Cq(n,{force:!0,recursive:!0,maxRetries:3}),await Bme(n),!0):!1},Z8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await GS({path:t,cacheDir:e,cwdOpt:r});return await jS(n)&&!await bq(n)},qme=!1,J8e=void 0,WI=async function(t,e,...r){return Array.isArray(e)?(await Promise.all(e.map(i=>t(i,...r)))).some(Boolean):t(e,...r)},X8e=WI.bind(null,W8e),Q8e=WI.bind(null,Y8e),eZe=WI.bind(null,K8e),tZe=WI.bind(null,Z8e),Vme=function(t){return{save:(e,r)=>X8e(e,{...t,...r}),restore:(e,r)=>Q8e(e,{...t,...r}),remove:(e,r)=>eZe(e,{...t,...r}),has:(e,r)=>tZe(e,{...t,...r}),list:e=>Rq({...t,...e}),getCacheDir:e=>Du({...t,...e})}};var rZe=ae("opencode_session"),nZe=async t=>{try{let e=await ZC(t),{stdout:r}=await pr(e,["session","list","--format","json"],{cwd:t,env:{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}),n=String(r??"").trim();if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?i:[]}catch(e){return rZe.warn("Could not list opencode sessions",{error:e?.message}),[]}},Iq=new Map,Hme=t=>{let e=Iq.get(t);if(e)return e;let r=nZe(t).finally(()=>Iq.delete(t));return Iq.set(t,r),r},Wme=async t=>(await Hme(t)).length>0,Yme=async(t,e)=>e?(await Hme(t)).some(r=>r.id===e):!1;var ir=ae("native_session"),Pq=async(t,e)=>(await Promise.all(e.map(async n=>{try{return await Js.stat(Xs.join(t,n)),n}catch{return null}}))).filter(n=>n!==null),zu=async({runnerId:t,sessionId:e,archive:r,nativeSessionId:n})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping"),null;let{baseDir:i,include:o}=r,s=!1;try{s=(await Js.stat(i)).isDirectory()}catch{}if(!s)return ir.log(`Native session base dir ${i} not found, skipping`),null;let a=await Pq(i,o);if(a.length===0)return ir.log(`No native session history found under ${i}, skipping`),null;let c=Xs.join(Kme.tmpdir(),`native-session-${e}.zip`);try{await pr("zip",["-r","-q","-X",c,...a],{cwd:i});let l=await Js.readFile(c);ir.log(`Zipped native session (${l.length} bytes) from ${a.join(", ")}`,{nativeSessionId:n});let{upload_url:u,s3_key:d}=await BQ(t,e);return await YQ(u,l,{contentType:"application/zip"}),ir.log("Successfully uploaded native session to S3"),d}catch(l){return ir.error("Failed to archive/upload native session, continuing without it:",l),null}finally{await Js.rm(c,{force:!0}).catch(()=>{})}},Zme=async(t,e,r=process.cwd())=>{if(e==="opencode")return Wme(r);if(!t)return!1;let{baseDir:n,include:i}=t,o=await Pq(n,i);for(let s of o)if((await Js.readdir(Xs.join(n,s)).catch(()=>[])).length>0)return!0;return!1},iZe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Jme=async(t,e)=>{let r=await Js.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of r)if(n.isDirectory()){if(await Jme(Xs.join(t,n.name),e))return!0}else if(e.test(n.name))return!0;return!1},Xme=async(t,e,r,n=process.cwd())=>{if(r==="opencode")return Yme(n,e);if(!t||!e)return!1;let i=new RegExp(`(^|[^a-zA-Z0-9])${iZe(e)}([^a-zA-Z0-9]|$)`),{baseDir:o,include:s}=t,a=await Pq(o,s);for(let c of a)if(await Jme(Xs.join(o,c),i))return!0;return!1},Qme=async({runnerId:t,sessionId:e,archive:r})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping restore"),!1;let{baseDir:n}=r,i=Xs.join(Kme.tmpdir(),`native-session-restore-${e}.zip`);try{let o=await jQ(t,e);if(!o?.download_url)return ir.log("No native session available to restore, skipping"),!1;let s=await WQ(o.download_url);return await Js.writeFile(i,s),ir.log(`Downloaded native session (${s.length} bytes) to ${i}`),await Js.mkdir(n,{recursive:!0}),await pr("unzip",["-o","-q",i,"-d",n]),ir.log(`Restored native session into ${n}`),!0}catch(o){return ir.error("Failed to fetch/restore native session, continuing without it:",o),!1}finally{await Js.rm(i,{force:!0}).catch(()=>{})}},oZe="native-sessions",ege=(t,e)=>Vme({cacheDir:Xs.join(e.dir,oZe),cwd:t}),tge=async({archive:t,cache:e})=>{if(!e?.dir||!t)return!1;let{baseDir:r,include:n}=t;try{return await ege(r,e).restore(n.map(o=>Xs.join(r,o)),{})?(ir.log(`Restored native session from buildbot cache into ${r}`),!0):(ir.log("No native session in buildbot cache, skipping restore"),!1)}catch(i){return ir.error("Failed to restore native session from buildbot cache, continuing without it:",i),!1}},qS=async({archive:t,cache:e,nativeSessionId:r})=>{if(!e?.dir||!t)return ir.log("No buildbot cache configured for the native session, skipping cache seed",{nativeSessionId:r}),!1;let{baseDir:n,include:i}=t;try{return await ege(n,e).save(i.map(s=>Xs.join(n,s)),{})?(ir.log(`Saved native session to buildbot cache under ${e.dir}`,{nativeSessionId:r}),!0):(ir.log("No native session history to save to buildbot cache, skipping"),!1)}catch(o){return ir.error("Failed to save native session to buildbot cache, continuing:",o),!1}};var im=ae("inference_stage"),rge=5,Bc=async t=>{let{additionalContext:e,cliPath:r,config:n,context:i,buildErrors:o,runner:s,persistSteps:a,aiGateway:c,attempt:l,contextPrefix:u,priorAgentSessionId:d,cwd:f,abortSignal:p,onSessionId:h,resumeForCreditWrapUp:m,forceLowEffortForCreditWrapUp:y,answerFold:S}=t;if(yo())throw new Error("Shutdown in progress, aborting inference stage");im.log(`Running inference stage, attempt ${l} of ${rge}`);let b=!1,w=await gt(Qe(),"inference-stage",async T=>{T?.setAttributes({"inference.attempt":l||1}),_Q();let C=!!(l&&l>1),O=await sZe(n,C,f),k=!!m&&!!d;k&&n.runner==="gemini"&&!await vS(d)&&(k=!1);let P=O.viable||k;b=P,O.outcome!=="not_eligible"&&ne.inc("inference.native_resume",1,{outcome:O.outcome,...O.source?{source:O.source}:{}});let M=n;if("prompt"in n&&n.answeredInteraction&&He().questionsEnabled){let E=n.answeredInteraction,x=P||C&&!!d,Y=[E];if(!x){S.allAnswered??=Bue(n);let G=await S.allAnswered;G===null&&(S.allAnswered=void 0),G&&G.length>0&&(Y=G.some(fe=>fe.refId===E.refId)?G:[...G,E])}M={...n,prompt:Gue(n.prompt,Y)},!C&&!S.counted&&(S.counted=!0,im.log("Resuming session with answered questions",{sessionId:n.sessionId,interactionCount:Y.length}),ne.inc("inference.answer_resume",1,{fold:x?"latest":"all"}),zue(E))}let{prompt:F}=await gt(Qe(),"compose-prompt",async()=>await Pue({cliPath:r,config:M,buildErrorContext:aZe(o),netlify:i,additionalContext:e,resumePrompt:P,preserveResultsFile:!!m})),_=`
610
+ `,l=await A8e({hash:s,manifestPath:i,manifestString:c});return{manifestInfo:{manifestPath:i,manifestString:c},identical:l}},A8e=async function({hash:t,manifestPath:e,manifestString:r}){return t===void 0||!$me(e)?!1:await Lme(e,"utf8")===r},Fme=async function({manifestPath:t,manifestString:e}){await E8e(b8e(t),{recursive:!0}),await T8e(t,e)},Bme=async function(t){let e=HI(t);await v8e(e,{force:!0,recursive:!0,maxRetries:3})},HI=function(t){return`${t}${zme}`},jme=function(t){return t.endsWith(zme)},zme=".netlify.cache.json",bq=async function(t){let e=HI(t);if(!$me(e))return!1;let{expires:r}=await w8e(t);return Ome(r)},w8e=async function(t){let e=HI(t),r=await Lme(e,"utf-8");return JSON.parse(r)};import{homedir as P8e}from"os";import{resolve as Gme,isAbsolute as O8e,join as N8e,sep as wq}from"path";import{normalize as x8e}from"path";import{existsSync as R8e}from"fs";import C8e from"process";var Aq=function(t){try{let e=I8e(t);return R8e(e)?Promise.resolve(e):Promise.resolve("")}catch{return Promise.resolve("")}},I8e=function(t=C8e.cwd()){return x8e(t)};var GS=async function({path:t,cacheDir:e,cwdOpt:r}){let n=await k8e(t,r),i=await $8e({srcPath:n,cacheDir:e,cwdOpt:r});return{srcPath:n,cachePath:i}},k8e=async function(t,e){let r=await Aq(e),n=M8e(t,r);return D8e(n,r),n},M8e=function(t,e){if(O8e(t))return Gme(t);if(e!=="")return Gme(e,t);throw new Error(`Current directory does not exist: ${e}`)},D8e=function(t,e){if(e!==""&&L8e(t,e))throw new Error(`Cannot cache ${t} because it is the current directory (${e}) or a parent directory`)},L8e=function(t,e){return`${e}${wq}`.startsWith(`${t}${wq}`)},$8e=async function({srcPath:t,cacheDir:e,cwdOpt:r}){let n=Du({cacheDir:e,cwd:r}),{name:i,relPath:o}=await U8e(t,r);return N8e(n,i,o)},U8e=async function(t,e){let r=await xq(e),n=F8e(t);return r.map(({name:i,base:o})=>j8e(i,o,n)).find(Boolean)},F8e=function(t){return t.replace(B8e,"\\")},B8e=/^[a-zA-Z]:\\/,j8e=function(t,e,r){if(r===e||!r.startsWith(e))return;let n=r.replace(e,"");return{name:t,relPath:n}},xq=async function(t){return[...await z8e(t),{name:"home",base:P8e()},{name:"root",base:wq}]},z8e=async function(t){let e=await Aq(t);return e===""?[]:[{name:"cwd",base:e}]};var q8e=1,Rq=async function({cacheDir:t,cwd:e,depth:r=q8e}={}){let n=await xq(e),i=Du({cacheDir:t,cwd:e});return(await Promise.all(n.map(({name:a,base:c})=>V8e({name:a,base:c,cacheDir:i,depth:r})))).flat()},V8e=async function({name:t,base:e,cacheDir:r,depth:n}){return(await Ime(`${r}/${t}`,{fileFilter:H8e,depth:n,type:"files_directories"})).map(({path:s})=>G8e(e,s))},H8e=function({basename:t}){return!jme(t)};var W8e=async function(t,{move:e=qme,ttl:r=J8e,digests:n=[],cacheDir:i,cwd:o}={}){let{srcPath:s,cachePath:a}=await GS({path:t,cacheDir:i,cwdOpt:o});if(!await jS(s))return!1;let{manifestInfo:c,identical:l}=await Ume({cachePath:a,move:e,ttl:r,digests:n});return l||(await Cq(a,{force:!0,recursive:!0,maxRetries:3}),await yq(s,a,e),await Fme(c)),!0},Y8e=async function(t,{move:e=qme,cacheDir:r,cwd:n}={}){let{srcPath:i,cachePath:o}=await GS({path:t,cacheDir:r,cwdOpt:n});return!await jS(o)||await bq(o)?!1:(await Cq(i,{force:!0,recursive:!0,maxRetries:3}),await yq(o,i,e),!0)},K8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await GS({path:t,cacheDir:e,cwdOpt:r});return await jS(n)?(await Cq(n,{force:!0,recursive:!0,maxRetries:3}),await Bme(n),!0):!1},Z8e=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await GS({path:t,cacheDir:e,cwdOpt:r});return await jS(n)&&!await bq(n)},qme=!1,J8e=void 0,WI=async function(t,e,...r){return Array.isArray(e)?(await Promise.all(e.map(i=>t(i,...r)))).some(Boolean):t(e,...r)},X8e=WI.bind(null,W8e),Q8e=WI.bind(null,Y8e),eZe=WI.bind(null,K8e),tZe=WI.bind(null,Z8e),Vme=function(t){return{save:(e,r)=>X8e(e,{...t,...r}),restore:(e,r)=>Q8e(e,{...t,...r}),remove:(e,r)=>eZe(e,{...t,...r}),has:(e,r)=>tZe(e,{...t,...r}),list:e=>Rq({...t,...e}),getCacheDir:e=>Du({...t,...e})}};var rZe=ae("opencode_session"),nZe=async t=>{try{let e=await ZC(t),{stdout:r}=await pr(e,["session","list","--format","json"],{cwd:t,env:{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}),n=String(r??"").trim();if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?i:[]}catch(e){return rZe.warn("Could not list opencode sessions",{error:e?.message}),[]}},Iq=new Map,Hme=t=>{let e=Iq.get(t);if(e)return e;let r=nZe(t).finally(()=>Iq.delete(t));return Iq.set(t,r),r},Wme=async t=>(await Hme(t)).length>0,Yme=async(t,e)=>e?(await Hme(t)).some(r=>r.id===e):!1;var ir=ae("native_session"),Pq=async(t,e)=>(await Promise.all(e.map(async n=>{try{return await Js.stat(Xs.join(t,n)),n}catch{return null}}))).filter(n=>n!==null),zu=async({runnerId:t,sessionId:e,archive:r,nativeSessionId:n})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping"),null;let{baseDir:i,include:o}=r,s=!1;try{s=(await Js.stat(i)).isDirectory()}catch{}if(!s)return ir.log(`Native session base dir ${i} not found, skipping`),null;let a=await Pq(i,o);if(a.length===0)return ir.log(`No native session history found under ${i}, skipping`),null;let c=Xs.join(Kme.tmpdir(),`native-session-${e}.zip`);try{await pr("zip",["-r","-q","-X",c,...a],{cwd:i});let l=await Js.readFile(c);ir.log(`Zipped native session (${l.length} bytes) from ${a.join(", ")}`,{nativeSessionId:n});let{upload_url:u,s3_key:d}=await BQ(t,e);return await YQ(u,l,{contentType:"application/zip"}),ir.log("Successfully uploaded native session to S3"),d}catch(l){return ir.error("Failed to archive/upload native session, continuing without it:",l),null}finally{await Js.rm(c,{force:!0}).catch(()=>{})}},Zme=async(t,e,r=process.cwd())=>{if(e==="opencode")return Wme(r);if(!t)return!1;let{baseDir:n,include:i}=t,o=await Pq(n,i);for(let s of o)if((await Js.readdir(Xs.join(n,s)).catch(()=>[])).length>0)return!0;return!1},iZe=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Jme=async(t,e)=>{let r=await Js.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of r)if(n.isDirectory()){if(await Jme(Xs.join(t,n.name),e))return!0}else if(e.test(n.name))return!0;return!1},Xme=async(t,e,r,n=process.cwd())=>{if(r==="opencode")return Yme(n,e);if(!t||!e)return!1;let i=new RegExp(`(^|[^a-zA-Z0-9])${iZe(e)}([^a-zA-Z0-9]|$)`),{baseDir:o,include:s}=t,a=await Pq(o,s);for(let c of a)if(await Jme(Xs.join(o,c),i))return!0;return!1},Qme=async({runnerId:t,sessionId:e,archive:r})=>{if(!r)return ir.log("No native session archive descriptor for this runner, skipping restore"),!1;let{baseDir:n}=r,i=Xs.join(Kme.tmpdir(),`native-session-restore-${e}.zip`);try{let o=await jQ(t,e);if(!o?.download_url)return ir.log("No native session available to restore, skipping"),!1;let s=await WQ(o.download_url);return await Js.writeFile(i,s),ir.log(`Downloaded native session (${s.length} bytes) to ${i}`),await Js.mkdir(n,{recursive:!0}),await pr("unzip",["-o","-q",i,"-d",n]),ir.log(`Restored native session into ${n}`),!0}catch(o){return ir.error("Failed to fetch/restore native session, continuing without it:",o),!1}finally{await Js.rm(i,{force:!0}).catch(()=>{})}},oZe="native-sessions",ege=(t,e)=>Vme({cacheDir:Xs.join(e.dir,oZe),cwd:t}),tge=async({archive:t,cache:e})=>{if(!e?.dir||!t)return!1;let{baseDir:r,include:n}=t;try{return await ege(r,e).restore(n.map(o=>Xs.join(r,o)),{})?(ir.log(`Restored native session from buildbot cache into ${r}`),!0):(ir.log("No native session in buildbot cache, skipping restore"),!1)}catch(i){return ir.error("Failed to restore native session from buildbot cache, continuing without it:",i),!1}},qS=async({archive:t,cache:e,nativeSessionId:r})=>{if(!e?.dir||!t)return ir.log("No buildbot cache configured for the native session, skipping cache seed",{nativeSessionId:r}),!1;let{baseDir:n,include:i}=t;try{return await ege(n,e).save(i.map(s=>Xs.join(n,s)),{})?(ir.log(`Saved native session to buildbot cache under ${e.dir}`,{nativeSessionId:r}),!0):(ir.log("No native session history to save to buildbot cache, skipping"),!1)}catch(o){return ir.error("Failed to save native session to buildbot cache, continuing:",o),!1}};var im=ae("inference_stage"),rge=5,Bc=async t=>{let{additionalContext:e,cliPath:r,config:n,context:i,buildErrors:o,runner:s,persistSteps:a,aiGateway:c,attempt:l,contextPrefix:u,priorAgentSessionId:d,cwd:f,abortSignal:p,onSessionId:h,resumeForCreditWrapUp:m,forceLowEffortForCreditWrapUp:y,answerFold:S}=t;if(yo())throw new Error("Shutdown in progress, aborting inference stage");im.log(`Running inference stage, attempt ${l} of ${rge}`);let b=!1,w=await gt(Qe(),"inference-stage",async T=>{T?.setAttributes({"inference.attempt":l||1}),_Q();let C=!!(l&&l>1),O=await sZe(n,C,f),k=!!m&&!!d;k&&n.runner==="gemini"&&!await vS(d)&&(k=!1);let P=O.viable||k;b=P,O.outcome!=="not_eligible"&&ne.inc("inference.native_resume",1,{outcome:O.outcome,...O.source?{source:O.source}:{}});let M=n;if("prompt"in n&&n.answeredInteraction&&He().questionsEnabled){let E=n.answeredInteraction,x=P||C&&!!d,Y=[E];if(!x){S.allAnswered??=Bue(n);let q=await S.allAnswered;q===null&&(S.allAnswered=void 0),q&&q.length>0&&(Y=q.some(fe=>fe.refId===E.refId)?q:[...q,E])}M={...n,prompt:Gue(n.prompt,Y)},!C&&!S.counted&&(S.counted=!0,im.log("Resuming session with answered questions",{sessionId:n.sessionId,interactionCount:Y.length}),ne.inc("inference.answer_resume",1,{fold:x?"latest":"all"}),zue(E))}let{prompt:F}=await gt(Qe(),"compose-prompt",async()=>await Pue({cliPath:r,config:M,buildErrorContext:aZe(o),netlify:i,additionalContext:e,resumePrompt:P,preserveResultsFile:!!m})),_=`
611
611
  ${u||""}
612
612
  ${F}
613
- `.trim(),re={...n,prompt:_},N=d??(P?O.sessionId:void 0),g=await gt(Qe(),`run-${n.runner}`,async E=>{let x=nL();E?.setAttributes({"gen_ai.operation.name":"chat","gen_ai.capability.name":n.mode,"gen_ai.provider.name":wQ(n.runner),"gen_ai.system":n.runner,...x?{"gen_ai.input.messages":CA("user",_)}:{}});let Y=Date.now(),G=await s({aiGateway:c,config:re,netlify:i,persistSteps:a,continueSession:C||P,priorAgentSessionId:N,cwd:f,cliPath:r,abortSignal:p,onSessionId:h,...y?{forceLowEffortForCreditWrapUp:y}:{}}),fe=Date.now(),$e=G.resolvedModel||n.model||"unknown",Ie=G.error?"error":"stop";return E?.setAttributes({...x?{"gen_ai.output.messages":CA("assistant",G.result??G.error??"",Ie)}:{},"gen_ai.response.finish_reasons":[Ie],"gen_ai.request.model":$e,"gen_ai.response.model":$e,"gen_ai.request.effort":G.effort??"auto",...G.usage?.input_tokens!=null?{"gen_ai.usage.input_tokens":G.usage.input_tokens}:{},...G.usage?.output_tokens!=null?{"gen_ai.usage.output_tokens":G.usage.output_tokens}:{},...G.usage?.cache_creation_input_tokens!=null?{"gen_ai.usage.cache_creation.input_tokens":G.usage.cache_creation_input_tokens}:{},...G.usage?.cache_read_input_tokens!=null?{"gen_ai.usage.cache_read.input_tokens":G.usage.cache_read_input_tokens}:{},...G.usage?.reasoning_output_tokens!=null?{"gen_ai.usage.reasoning.output_tokens":G.usage.reasoning_output_tokens}:{}}),xQ(G.steps??[],n.mode,Y,fe),G});return g.result&&(g.result=Yn(g.result)),g.error&&(g.error=Yn(g.error)),await a.flush(),g});if(w.aborted)return im.log("Inference turn was interrupted (credit wrap-up); skipping retry/error handling",{agentSessionId:w.agentSessionId}),{runnerResult:w,nativeResume:b};if(w.error){if(yo()){let k=new Error("Shutdown in progress, aborting inference stage");throw Object.assign(k,{agentSessionId:w.agentSessionId}),k}let T=w.providerFailure,C=hC(T);im.error("Runner failed",{stepsCount:w.steps.length,duration:w.duration,error:w.error,isRetryableError:w.isRetryableError,attempt:l||1,agentSessionId:w.agentSessionId,...T?{providerFailure:T,failureClass:C?.failureClass}:{}}),ne.inc("inference.failed",1,{attempt:l||1,is_retryable:!!w.isRetryableError,is_provider_unavailable:!!w.isProviderUnavailableError,is_answer_resume:!!n.answeredInteraction,upstream_status:T?.status??"none",failure_class:C?.failureClass??"unclassified"});let O=C?.maxAttempts??rge;if(w.isRetryableError&&(!l||l<O))return im.log("Retrying inference stage"),await new Promise(P=>setTimeout(P,5e3)),{runnerResult:(await Bc({...t,attempt:(l||1)+1,priorAgentSessionId:w.agentSessionId,contextPrefix:w.agentSessionId?"":"<important> The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over. Here is the full prompt for context: </important>"})).runnerResult,nativeResume:b};{if(im.log("Do not retry inference stage"),w.error.toLowerCase().includes("usage exceeded")){let P=new wi(w.error,503,"Credit limit reached. Please add more credits to continue using Agent Runners.",!0);throw Object.assign(P,{agentSessionId:w.agentSessionId}),P}let k=w.isRetryableError||w.isProviderUnavailableError?new ff(w.error):new Error(w.error);throw Object.assign(k,{agentSessionId:w.agentSessionId}),k}}return{runnerResult:w,nativeResume:b}},sZe=async(t,e,r=process.cwd())=>{if(e)return{viable:!1,outcome:"not_eligible"};let n=t.previousSession,{viable:i,outcome:o}=Uue(t);if(!i)return{viable:i,outcome:o};let s=n?.nativeSessionId,a=Mo(t.runner),c=async()=>s?t.runner==="gemini"?!!await kz(s):Xme(a,s,t.runner,r):!1,l;if(Lue(t)&&await Zme(a,t.runner,r))l="local";else if(t.fastInit&&He().warmNativeResumeEnabled&&await tge({archive:a,cache:t.cache})&&await c())l="cache_restore";else{if(l="fetch",!He().coldResumeFromS3Enabled)return{viable:!1,outcome:"cold_resume_disabled",source:l};if(!await Qme({runnerId:t.id,sessionId:t.sessionId,archive:a}))return{viable:!1,outcome:"fetch_failed",source:l}}return t.runner==="gemini"&&s&&!await vS(s)?{viable:!1,outcome:"sanitize_failed",source:l}:{viable:!0,sessionId:s,outcome:"resumed",source:l}},aZe=t=>!t||t.length===0?"":`
613
+ `.trim(),re={...n,prompt:_},N=d??(P?O.sessionId:void 0),g=await gt(Qe(),`run-${n.runner}`,async E=>{let x=nL();E?.setAttributes({"gen_ai.operation.name":"chat","gen_ai.capability.name":n.mode,"gen_ai.provider.name":wQ(n.runner),"gen_ai.system":n.runner,...x?{"gen_ai.input.messages":CA("user",_)}:{}});let Y=Date.now(),q=await s({aiGateway:c,config:re,netlify:i,persistSteps:a,continueSession:C||P,priorAgentSessionId:N,cwd:f,cliPath:r,abortSignal:p,onSessionId:h,...y?{forceLowEffortForCreditWrapUp:y}:{}}),fe=Date.now(),$e=q.resolvedModel||n.model||"unknown",Ie=q.error?"error":"stop";return E?.setAttributes({...x?{"gen_ai.output.messages":CA("assistant",q.result??q.error??"",Ie)}:{},"gen_ai.response.finish_reasons":[Ie],"gen_ai.request.model":$e,"gen_ai.response.model":$e,"gen_ai.request.effort":q.effort??"auto",...q.usage?.input_tokens!=null?{"gen_ai.usage.input_tokens":q.usage.input_tokens}:{},...q.usage?.output_tokens!=null?{"gen_ai.usage.output_tokens":q.usage.output_tokens}:{},...q.usage?.cache_creation_input_tokens!=null?{"gen_ai.usage.cache_creation.input_tokens":q.usage.cache_creation_input_tokens}:{},...q.usage?.cache_read_input_tokens!=null?{"gen_ai.usage.cache_read.input_tokens":q.usage.cache_read_input_tokens}:{},...q.usage?.reasoning_output_tokens!=null?{"gen_ai.usage.reasoning.output_tokens":q.usage.reasoning_output_tokens}:{}}),xQ(q.steps??[],n.mode,Y,fe),q});return g.result&&(g.result=Yn(g.result)),g.error&&(g.error=Yn(g.error)),await a.flush(),g});if(w.aborted)return im.log("Inference turn was interrupted (credit wrap-up); skipping retry/error handling",{agentSessionId:w.agentSessionId}),{runnerResult:w,nativeResume:b};if(w.error){if(yo()){let k=new Error("Shutdown in progress, aborting inference stage");throw Object.assign(k,{agentSessionId:w.agentSessionId}),k}let T=w.providerFailure,C=hC(T);im.error("Runner failed",{stepsCount:w.steps.length,duration:w.duration,error:w.error,isRetryableError:w.isRetryableError,attempt:l||1,agentSessionId:w.agentSessionId,...T?{providerFailure:T,failureClass:C?.failureClass}:{}}),ne.inc("inference.failed",1,{attempt:l||1,is_retryable:!!w.isRetryableError,is_provider_unavailable:!!w.isProviderUnavailableError,is_answer_resume:!!n.answeredInteraction,upstream_status:T?.status??"none",failure_class:C?.failureClass??"unclassified"});let O=C?.maxAttempts??rge;if(w.isRetryableError&&(!l||l<O))return im.log("Retrying inference stage"),await new Promise(P=>setTimeout(P,5e3)),{runnerResult:(await Bc({...t,attempt:(l||1)+1,priorAgentSessionId:w.agentSessionId,contextPrefix:w.agentSessionId?"":"<important> The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over. Here is the full prompt for context: </important>"})).runnerResult,nativeResume:b};{if(im.log("Do not retry inference stage"),w.error.toLowerCase().includes("usage exceeded")){let P=new wi(w.error,503,"Credit limit reached. Please add more credits to continue using Agent Runners.",!0);throw Object.assign(P,{agentSessionId:w.agentSessionId}),P}let k=w.isRetryableError||w.isProviderUnavailableError?new ff(w.error):new Error(w.error);throw Object.assign(k,{agentSessionId:w.agentSessionId}),k}}return{runnerResult:w,nativeResume:b}},sZe=async(t,e,r=process.cwd())=>{if(e)return{viable:!1,outcome:"not_eligible"};let n=t.previousSession,{viable:i,outcome:o}=Uue(t);if(!i)return{viable:i,outcome:o};let s=n?.nativeSessionId,a=Mo(t.runner),c=async()=>s?t.runner==="gemini"?!!await kz(s):Xme(a,s,t.runner,r):!1,l;if(Lue(t)&&await Zme(a,t.runner,r))l="local";else if(t.fastInit&&He().warmNativeResumeEnabled&&await tge({archive:a,cache:t.cache})&&await c())l="cache_restore";else{if(l="fetch",!He().coldResumeFromS3Enabled)return{viable:!1,outcome:"cold_resume_disabled",source:l};if(!await Qme({runnerId:t.id,sessionId:t.sessionId,archive:a}))return{viable:!1,outcome:"fetch_failed",source:l}}return t.runner==="gemini"&&s&&!await vS(s)?{viable:!1,outcome:"sanitize_failed",source:l}:{viable:!0,sessionId:s,outcome:"resumed",source:l}},aZe=t=>!t||t.length===0?"":`
614
614
  Deploy failed. Here are the errors to review on the latest build:
615
615
 
616
616
  Below are all of the logs with potential issues that we extracted. Some of them may be false positives, discern them carefully and ensure fixes are relevant.
@@ -623,13 +623,13 @@ Preview deploy created successfully:`,{deployId:m.deploy_id,deployUrl:m.deploy_u
623
623
  `)},dge=async({cliPath:t,cwd:e,isFreshDatabase:r})=>{if(r)return yZe();try{return SZe(await Mq({cliPath:t,cwd:e}))}catch(n){return ZI.warn("Skipping migration context injection \u2014 failed to build state block",{error:n}),null}},fge=t=>{let e=[];return t.missingOnDisk.length>0&&e.push("You deleted the following migration file(s) that are already applied to the preview database branch:",...t.missingOnDisk.map(r=>`- ${r.name}`),"","Applied migrations cannot be removed \u2014 the deploy will fail because the platform requires every applied","migration to exist on disk with its original content. Please revise your work:","","1. Restore the deleted file(s) by running `netlify db migrations pull --force`, which overwrites the"," local migrations directory with the authoritative state of the branch. Note this also wipes any"," unapplied migration files you generated this session \u2014 regenerate them via `npx drizzle-kit generate`"," afterwards if you still need them (your `db/schema.ts` edits aren't affected by the pull).","2. If the underlying problem is that an applied migration is wrong, add a NEW migration on top that"," corrects whatever it did (drop a column, rename a table, etc.). Do not touch the original."),t.outOfOrder.length>0&&(e.length>0&&e.push(""),e.push("The following pending migration file(s) have a version prefix that sorts BEFORE migrations already","applied to the branch, so the platform will reject them on deploy:",...t.outOfOrder.map(r=>`- ${r.name} (version ${r.version} \u2264 applied max ${r.maxApplied})`),"","Delete these out-of-order files (use `netlify db migrations reset` \u2014 it only removes unapplied files),","then run `npx drizzle-kit generate` to produce a replacement whose version sorts after the applied","migrations.")),e.length===0?null:e.join(`
624
624
  `)},pge=t=>t.missingOnDisk.length>0||t.outOfOrder.length>0;var hge=ae("db_migrations_verify"),mge=async t=>await gt(Qe(),"db-migrations-verify-stage",async e=>{let r;try{r=await Mq({cliPath:t.cliPath,cwd:t.cwd})}catch(i){return hge.warn("Skipping migration verification \u2014 failed to read status",{error:i}),e?.setAttributes({"verify.skipped":!0,"verify.skip_reason":"status_error"}),{}}if(!pge(r))return e?.setAttributes({"verify.drift":!1}),{};let n=fge(r);return e?.setAttributes({"verify.drift":!0,"verify.missing_on_disk_count":r.missingOnDisk.length,"verify.out_of_order_count":r.outOfOrder.length}),hge.log("Detected post-inference migration drift",{missingOnDisk:r.missingOnDisk.map(i=>i.name),outOfOrder:r.outOfOrder.map(i=>i.name)}),{error:n??void 0}});import UV from"process";import zJe from"net";var Dn=fn(DV(),1),uWt=Dn.default.Client,dWt=Dn.default.Pool,fWt=Dn.default.Connection,pWt=Dn.default.types,hWt=Dn.default.Query,mWt=Dn.default.DatabaseError,gWt=Dn.default.escapeIdentifier,_Wt=Dn.default.escapeLiteral,yWt=Dn.default.Result,SWt=Dn.default.TypeOverrides,EWt=Dn.default.defaults,oye=Dn.default;var GJe=80877103,qJe=196608,VJe=Buffer.from([78]);function HJe(){let t=Buffer.alloc(9);t.writeUInt8(82,0),t.writeInt32BE(8,1),t.writeInt32BE(0,5);let e=Buffer.alloc(6);return e.writeUInt8(90,0),e.writeInt32BE(5,1),e.writeUInt8(73,5),Buffer.concat([t,e])}function hP(t){let e=Buffer.from("SERROR\0","utf8"),r=Buffer.concat([Buffer.from("M","utf8"),Buffer.from(t+"\0","utf8")]),n=Buffer.from("CXX000\0","utf8"),i=Buffer.from([0]),o=e.length+r.length+n.length+i.length,s=Buffer.alloc(5);return s.writeUInt8(69,0),s.writeInt32BE(o+4,1),Buffer.concat([s,e,n,r,i])}async function WJe(t){let{clientSocket:e,provision:r,logger:n,cleanup:i}=t,o;try{o=await r()}catch(f){let p=f instanceof Error?f.message:"Provisioning failed";throw n("Provisioning error:",p),e.end(hP(p)),i(),f}let s=KJe(o),a=new oye.Client({host:s.host,port:s.port,user:s.user,password:s.password,database:s.database,ssl:s.ssl,options:s.options});a.on("error",()=>{});try{await a.connect()}catch(f){let p=f instanceof Error?f.message:"Remote connection failed";throw n("Remote connection error:",p),e.end(hP(p)),i(),f}let c=a.connection,l=c.stream;c.removeAllListeners(),l.removeAllListeners();let u=l,d=f=>p=>{p.code!=="ECONNRESET"&&n(`${f} socket error:`,p.message),i()};return u.on("error",d("Remote")),u.on("close",i),e.on("error",d("Client")),e.on("close",i),e.write(HJe()),e.on("data",f=>{u.destroyed||u.write(f)}),u.on("data",f=>{e.destroyed||e.write(f)}),e.resume(),u}function YJe(t,e){let{provision:r,logger:n,onCleanup:i}=e,o,s="ssl",a=!1;function c(){a||(a=!0,t.destroy(),o?.destroy(),i())}t.on("error",l=>{l.code!=="ECONNRESET"&&n("Client socket error:",l.message),c()}),t.on("data",l=>{if(s==="ssl"){if(l.length>=8&&l.readInt32BE(4)===GJe){t.write(VJe),s="startup";return}s="startup"}if(s==="startup"){if(l.length<8){t.end(hP("Invalid startup message")),c();return}if(l.readInt32BE(4)!==qJe){t.end(hP("Unsupported protocol version")),c();return}t.pause(),t.removeAllListeners("data"),WJe({clientSocket:t,provision:r,logger:n,cleanup:c}).then(d=>{o=d},d=>{n("Startup error:",d),c()})}})}function KJe(t){let e=new URL(t);return{host:e.hostname,port:Number(e.port)||5432,user:decodeURIComponent(e.username),password:decodeURIComponent(e.password),database:e.pathname.slice(1)||"postgres",ssl:e.searchParams.get("sslmode")==="require"?!0:void 0,options:e.searchParams.get("options")??void 0}}var sye=class{server;sockets=new Set;host;port;logger;provision;constructor(t){this.host=t.host??"127.0.0.1",this.port=t.port??0,this.logger=t.logger??(()=>{}),this.provision=t.provision}async start(){return new Promise((t,e)=>{let r=zJe.createServer(n=>{this.sockets.add(n),n.on("close",()=>{this.sockets.delete(n)}),YJe(n,{provision:this.provision,logger:this.logger,onCleanup:()=>{this.sockets.delete(n)}})});r.on("error",n=>{e(n)}),r.listen(this.port,this.host,()=>{this.server=r;let n=r.address(),i=`postgres://${this.host}:${String(n.port)}`;this.logger("Proxy listening on",i),t(i)})})}async stop(){for(let t of this.sockets)t.destroy();return this.sockets.clear(),new Promise(t=>{if(!this.server){t();return}this.server.close(()=>{this.server=void 0,t()})})}};var mP=ae("db_setup"),aye=async({siteId:t,isProd:e,alias:r,connectionString:n})=>await gt(Qe(),"db-setup-stage",async i=>{i?.setAttributes({"db_setup.site_id":t,"db_setup.is_prod":e,...r&&{"db_setup.alias":r}});let o;if(e?o="production":r&&(o=r),UV.env.NETLIFY_DB_BRANCH=o,n)return i?.setAttributes({"db_setup.source":"config","db_setup.has_proxy":!1}),mP.log("Using database connection string provided by the API"),UV.env.NETLIFY_DB_URL=n,{connectionString:n,wasProvisioned:()=>!1};let s=!1,a=new sye({logger:(...l)=>mP.log("db-proxy:",...l),provision:async()=>(s=!0,mP.log("Provisioning database for site via API"),await VQ(t),await ZJe(t,e,r))}),c=await a.start();return i?.setAttributes({"db_setup.source":"proxy","db_setup.has_proxy":!0}),mP.log("Local DB proxy started",{connectionString:c}),UV.env.NETLIFY_DB_URL=c,{connectionString:c,proxy:a,wasProvisioned:()=>s}}),ZJe=async(t,e,r)=>e||!r?(await zQ(t)).connection_string:(await HQ(t,r),(await qQ(t,r)).connection_string);var lye=({config:t,cliPath:e,cwd:r,withStageTimer:n})=>{let i,o=null,s=t.mode==="ask";return{prepare:async({deploySubdomain:a,isProdDeploy:c})=>{if(s)return o=voe(t,a),o?(ne.inc("ask_mode.db_read_granted",1),Eue({cliPath:e,branch:o.branch})):void 0;cye.env.EXPERIMENTAL_NETLIFY_DB_ENABLED="1";let l=t.siteId;if(cye.env.NETLIFY_LOCAL_MODE||!l)return;let u=await n("db-setup",()=>aye({siteId:l,isProd:c,alias:a,connectionString:t.dbConnectionString}),Pi.timeUnits.minutes(10));return i=u.proxy,r?await dge({cliPath:e,cwd:r,isFreshDatabase:!!u.proxy})??void 0:void 0},generateMigrations:async()=>s?{skipped:!0}:await uge({cwd:r}),verifyMigrations:async()=>r?await n("db-migrations-verify",()=>mge({cliPath:e,cwd:r})):{},hasDatabase:async()=>t.siteId?await GQ(t.siteId):!1,stop:async()=>{await i?.stop()},revokeAskAccess:()=>{o&&C1()}}};import JJe from"process";var uye=ae("teardown"),dye=({config:t,cwd:e,database:r,stopUsageTracking:n})=>{let i,o=t.mode==="ask";return{setRunnerCleanup:s=>{i=s},run:async s=>{let a=async(l,u)=>{try{await u()}catch(d){uye.warn(`Teardown step failed: ${l}`,{state:s,error:d?.message||d}),ne.inc("teardown.step_failed",1,{step:l,state:s})}},c=s==="completed"&&!JJe.env.NETLIFY_LOCAL_MODE;await a("usage-tracker",n),(s==="errored"||c)&&await a("runner-cleanup",()=>i?.()),await a("db-proxy",()=>r.stop()),c&&await a("reset-repo",()=>Iie(e)),o&&c&&await a("remove-untracked-files",async()=>{let l=await Pie(e);l.length>0&&(uye.warn(`Removed ${l.length} leftover untracked change(s) after ask run`,{removed:l}),ne.inc("ask_mode.leaked_untracked_files",l.length))})}}};var XJe=({isHotFollowUp:t,enqueuedAt:e})=>t?e===void 0?[]:[["request",e]]:[["spawn",Number(process.env.NETLIFY_AGENT_RUNNER_SPAWN_AT_MS)],["enqueue",Number(process.env.NETLIFY_AGENT_RUNNER_ENQUEUED_AT_MS)]],FV=(t,e,r,n)=>{for(let[i,o]of XJe(r))Number.isFinite(o)&&o>0&&o<=n&&t.timing(e,n-o,{from:i})},fye=(t,e=Date.now(),r=ne)=>FV(r,"startup.duration",t,e),pye=(t,e=Date.now(),r=ne)=>FV(r,"startup.time_to_prompt",t,e),hye=(t,e=Date.now(),r=ne)=>FV(r,"startup.time_to_first_output",t,e);var mye=(t,e=Date.now(),r=ne)=>{let n={outcome:t.outcome,native_resume:t.nativeResume,is_answer_resume:t.isAnswerResume};r.timing("session.duration",e-t.startedAt,{hot_follow_up:t.isHotFollowUp,...n}),t.creditsCost!=null&&r.distribution("session.credits_cost",t.creditsCost,{...n,...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{}})};function gye(t){return["One or more AI functions use the legacy **v1** syntax (`exports.handler` / `module.exports.handler`):","",t.map(r=>`- ${r}`).join(`
625
625
  `),"",'Netlify AI Gateway credentials (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` and the matching `*_BASE_URL` variables) are injected ONLY into the modern v2/v3 function runtime. A v1 function builds and deploys successfully but throws "missing API key" at runtime \u2014 this will NOT appear as a build error.',"","Rewrite each listed function using **v2** syntax \u2014 `export default async (req: Request) => Response` \u2014 or **v3** object export (`satisfies NetlifyFunction`), preserving its existing behavior and route. Do not set your own API keys; rely on the injected gateway credentials. See the `netlify-ai-gateway` skill for examples."].join(`
626
- `)}var Vu=ae("usage_tracker"),QJe=4e3,eXe=5e3,tXe=(t,e,r)=>t===!0||r!=null&&e!=null&&e>=r,rXe=(t,e,r)=>e!=null&&e>0&&r!=null&&t!=null&&e-t<=r,_ye=(t,e,r,{creditReserve:n,onCreditReserveReached:i,followPolledLimit:o=!1,shouldPollOnTimer:s=!1}={})=>{let a=!1,c=!1,l=!1,u=!1,d,f,p,h=r,m,y=i!=null&&n!=null,S=()=>{m&&(clearInterval(m),m=void 0)},b=async()=>{try{let P=await DA(t,e);Vu.log("Usage update response",{usage:P?.usage});let M=P?.usage?.total_credits_cost;M!=null&&(d=M);let F=P?.enforced_credits_cap;if(o&&F!=null&&F!==h){let re=h==null;h=F,Vu.log("Took the session credit limit from a usage poll",{sessionCreditLimit:h,totalCreditsCost:M,isFirstLimit:re}),re&&ne.inc("session.credit_cap_late_arrival",1)}let _=tXe(P?.credit_limit_exceeded,M,h);if(_&&(Vu.log("Credit limit exceeded",{totalCreditsCost:M,sessionCreditLimit:h}),l||(f=Date.now(),p=M??d??0),l=!0,S(),w.cancel()),y&&!u&&!_&&rXe(M,h,n)){u=!0,Vu.log("Credit reserve reached",{totalCreditsCost:M,sessionCreditLimit:h,creditReserve:n});try{i()}catch(re){Vu.warn("onCreditReserveReached callback threw",{error:re?.message||re})}}}catch(P){Vu.warn("Failed to update usage",{error:P?.message||P})}},w=Hw(b,QJe);return{onAgentOutput:()=>{if(l)throw new wi("AI credit usage exceeded enforced limit.",503,"Credit limit reached. Check credit limits to continue using Agent Runners.",!0);if(!c){if(a=!0,!s){w();return}m||(m=setInterval(()=>{w()},eXe),m.unref?.())}},stop:async()=>{c||(c=!0,S(),a&&(w.cancel(),Vu.log("Sending final usage update"),await b(),f!==void 0&&(ne.timing("credit_limit.overage_duration",Date.now()-f),ne.distribution("credit_limit.overage_credits",Math.max(0,(d??p??0)-(p??0))))))},getCreditsCost:()=>d,getSessionCreditLimit:()=>h}};var yye=ae("session_credit_limit"),nXe=async t=>{if(t.sessionCreditLimit!=null)return{limit:t.sessionCreditLimit,source:"env"};if(!He().fetchCreditCapEnabled)return{source:"unchecked"};try{let e=(await DA(t.id,t.sessionId))?.enforced_credits_cap;if(e!=null)return yye.log("Resolved the session credit limit from the usage endpoint",{limit:e}),{limit:e,source:"usage"}}catch(e){yye.warn("Usage call for the session credit limit failed",{error:e?.message||e})}return{source:"none"}},Sye=async(t,e=!1)=>{let{limit:r,source:n}=await nXe(t);t.sessionCreditLimit=r,ne.inc("session.credit_cap_source",1,{source:n,hot_follow_up:e})};var qc=ae("credit_wrapup"),Eye="low",iXe=t=>t.mode==="ask"?XD:t.mode==="normal"?QD:au(t)?ZD:JD,BV=t=>{let e=He();return e.creditWrapUpReserveByModeAndModel[t.mode]?.[t.runner]??e.creditWrapUpReserve},vye=(t,e)=>{if(e<=0)return!1;let r=He();return t.mode==="create"?r.creditWrapUpEnabled:t.mode==="ask"||t.mode==="normal"?r.creditWrapUpNormalEnabled:!1},jV=(t,e)=>{if(t==="fix"){qc.log("Credit reserve reached outside of the main inference turn \u2014 letting the fix finish without a wrap-up"),ne.inc("session.credit_wrapup_skipped_fix_turn",1,{credit_reserve:e});return}if(t==="no_session"){qc.warn("Credit reserve reached but no session id yet \u2014 skipping wrap-up interrupt"),ne.inc("session.credit_wrapup_skipped_no_session",1,{credit_reserve:e});return}qc.log("Credit reserve reached with no turn to interrupt \u2014 the agent had already finished")},Tye=(t,e,r)=>{if(e==null)return;let n=Math.max(0,e-t.creditsSpentBeforeWrapUp);qc.log("Credit wrap-up cost",{credits:n,creditsCostAtSessionEnd:e,effort:Eye,inferenceAfterWrapUp:r,...t}),ne.distribution("session.credit_wrapup_cost",n,{outcome:t.outcome,effort:Eye,credit_reserve:t.creditReserve,inference_after_wrap_up:r,...t.model?{model:t.model}:{}})},bye=async({runnerResult:t,interruptedSessionId:e,creditsSpentBeforeWrapUp:r,cliPath:n,config:i,context:o,runner:s,aiGateway:a,cwd:c,persistSteps:l,usageTracker:u,withStageTimer:d,answerFold:f})=>{let p=BV(i),h=new AbortController,m=!1,y=!1,S,b=Object.assign(async C=>{try{u.onAgentOutput()}catch(O){gs(O)&&!m&&(m=!0,qc.log("Wrap-up turn spent the credit reserve \u2014 stopping wrap-up",{creditsSpentBeforeWrapUp:r}),ne.inc("session.credit_wrapup_aborted",1,{credit_reserve:p}),h.abort())}return l(C)},{flush:l.flush.bind(l)});qc.log("Running credit wrap-up inference turn",{creditsSpentBeforeWrapUp:r,creditReserve:p});try{await l({steps:[{category:V.WrapUp,message:"You are reaching your usage limit. Wrapping up and leaving your work in a usable state."}],duration:0})}catch{}let w;try{let{runnerResult:C}=await d("inference-credit-wrapup",()=>Bc({cliPath:n,config:i,context:o,runner:s,persistSteps:b,aiGateway:a,cwd:c,contextPrefix:iXe(i),priorAgentSessionId:e,resumeForCreditWrapUp:!0,answerFold:f,forceLowEffortForCreditWrapUp:!0,abortSignal:h.signal}));S=C.resolvedModel,m&&qc.log("Wrap-up turn was aborted due to budget limit"),w={...fy(t,C),resolvedModel:t.resolvedModel,effort:t.effort,resolvedProviderEffort:t.resolvedProviderEffort}}catch(C){qc.warn("Credit wrap-up turn failed \u2014 proceeding with pre-wrap-up result",{error:C?.message||C}),ne.inc("session.credit_wrapup_failed",1,{credit_reserve:p}),y=!0,w=t}let T=S??t.resolvedModel;return{runnerResult:w,costReport:{creditsSpentBeforeWrapUp:r,creditReserve:p,outcome:y?"failed":m?"aborted":"completed",...T?{model:T}:{}}}};var Aye=t=>{let e,r=!1;return{getActiveTurn:()=>e?"main":r?"fix":"none",getMainTurnAbortSignal:()=>t?e?.signal:void 0,startMainTurn:()=>{e=new AbortController},finishMainTurn:()=>{e=void 0},runFixTurn:async n=>{r=!0;try{return await n()}finally{r=!1}},abortMainTurn:()=>e?.abort()}};import oXe from"process";var zV=ae("shutdown"),wye=!1,sXe,aXe=async t=>{if(wye)return;if(wye=!0,zV.info("Shutting down...",{signal:t}),aie(),ne.distribution("session.hot_followups",kue()),!Nue()){let r=Date.now(),n=Mue(),i=Due();n!==void 0&&ne.timing("session.last_linger",r-n),i!==void 0&&ne.timing("session.total_linger",r-i)}let e=sXe?.close().catch(r=>{zV.error("Error closing server during graceful shutdown",r)});await $ue(),await e,await bQ(),zV.info("Shutdown complete"),oXe.exit(0)};var xye=t=>{aXe(t)};var cXe=4e3,lXe=3e4,rE=ae("credit_limit_preservation"),Rye=async(t,e)=>{if(!e)return null;Fh(e);let r=Mo(t.runner),n=null;try{await Promise.race([Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:r,nativeSessionId:e}).then(i=>{n=i}),qS({archive:r,cache:t.cache,nativeSessionId:e}).catch(i=>{rE.warn("Failed to seed the native session cache before teardown",{error:i?.message||i})})]),new Promise(i=>{setTimeout(i,cXe).unref()})])}catch(i){rE.warn("Failed to preserve native session before teardown",{error:i?.message||i})}return n},Cye=async(t,e)=>{let r=null,n={},i=[];if(e){Fh(e);let o=Mo(t.runner);i.push(Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:o,nativeSessionId:e}).then(s=>{r=s}),qS({archive:o,cache:t.cache,nativeSessionId:e}).catch(s=>{rE.warn("Failed to seed the native session cache on credit-limit shutdown",{error:s?.message||s})})]).catch(s=>{rE.warn("Failed to preserve native session on credit-limit shutdown",{error:s?.message||s})}))}if(t.mode!=="ask"&&i.push(Zw({config:t}).then(o=>o.hasChanges?Nq({config:t,diff:o.diff,diffBinary:o.diffBinary,resultDiff:o.resultDiff,resultDiffBinary:o.resultDiffBinary}):{}).then(o=>{n=o}).catch(o=>{rE.warn("Failed to preserve working-tree diff on credit-limit shutdown",{error:o?.message||o})})),i.length>0){let o=!1;await Promise.race([Promise.all(i).then(()=>{o=!0}),new Promise(s=>{setTimeout(s,lXe).unref()})]),o||ne.inc("credit_preservation.timed_out",1)}return{nativeSessionS3Key:r,diffFields:n}};var dXe=uXe(import.meta.url),nE=dXe("../package.json"),sr=ae("pipeline_index"),mm=3,fXe=["codex","gemini"],OVe=async({config:t,apiToken:e,cliPath:r="netlify",cwd:n,filter:i,isHotFollowUp:o=!1,enqueuedAt:s,tracing:a={}})=>{let c,l=Date.now(),u="success",d=!1,f,p,h=!1,m,y=!1,{withStageTimer:S}=cie(Pi.timeUnits.hours(4)),b=lye({config:t,cliPath:r,cwd:n,withStageTimer:S}),w=dye({config:t,cwd:n,database:b,stopUsageTracking:()=>c?.stop()}),T=await AQ(nE.version,t.id,a);sr.log(`Agent runner orchestrator v${nE.version}`,{featureFlags:He().raw,metrics:NQ()});let C={agent:t.runner,mode:t.mode,is_follow_up:t.sessionHistoryContext.length>0,version:nE.version,fast_init:t.fastInit,credit_wrapup:!1,budget_eligible:!1,budget_constrained:!1,ask_first:!1};S_({...C});let O=!!t.answeredInteraction;fye({isHotFollowUp:o,enqueuedAt:s}),xie(t.sessionId);try{await Zm(Qe(),"run-pipeline",{},T,async k=>{await Yz(Wz(),t.runner),k?.setAttributes({"gen_ai.capability.name":t.mode,"session.id":t.sessionId,...process.env.NETLIFY_DEV_SERVER_ID?{"dev_server.id":process.env.NETLIFY_DEV_SERVER_ID}:{}});let{aiGateway:P,context:M,persistSteps:F,runner:_,sha:re}=await S("init",()=>hue({config:t,apiToken:e,cliPath:r,cwd:n,filter:i,runnerVersion:nE.version}),Pi.timeUnits.minutes(10)),N=_.runner;He().idleTimeoutEnabled||w.setRunnerCleanup(_.clean),await Sye(t,o),Object.assign(C,Lce(t)),S_({...C});let g=BV(t),E=vye(t,g),x=Aye(E),Y,G=!1,fe=0,$e;c=_ye(t.id,t.sessionId,t.sessionCreditLimit,{followPolledLimit:He().creditCapFromPollEnabled,shouldPollOnTimer:He().timedUsagePollEnabled,...E?{creditReserve:g,onCreditReserveReached:()=>{if(!G){if(x.getActiveTurn()!=="main"){G=!0,jV(x.getActiveTurn(),g);return}if(!$e){jV("no_session",g);return}G=!0,fe=c?.getCreditsCost()??0,sr.log("Credit reserve reached \u2014 interrupting agent to wrap up",{creditsSpentBeforeWrapUp:fe,creditReserve:g}),C.credit_wrapup=!0,S_({...C}),ne.inc("session.credit_wrapup_triggered",1,{credit_reserve:g}),x.abortMainTurn()}}}:{}});let Ie=xx(t.mode),Pe;t.deployAlias&&t.deployAlias.length>0?Pe=t.deployAlias:(t.deployAlias!==void 0&&!Ie&&sr.warn("Received empty deploy alias for a non-prod deploy, falling back to local computation"),Pe=yie(t.id,process.env.SITE_NAME,Ie));let xe=!1,Fe=!1,Re=Object.assign(async Ce=>{xe||(xe=!0,pye({isHotFollowUp:o,enqueuedAt:s}));try{c?.onAgentOutput()}catch(at){return gs(at)?Y??=at:sr.warn("Unexpected error in onAgentOutput",{error:at?.message||at}),F(Ce)}return!Fe&&Ce.steps?.some(at=>at.category!==V.Environment&&at.category!==V.SubagentPrompt)&&(Fe=!0,hye({isHotFollowUp:o,enqueuedAt:s})),F(Ce)},{flush:F.flush.bind(F)});if(t.sha=re,t.mode==="redeploy"){await cge({cliPath:r,config:t,context:M,filter:i,deploySubdomain:Pe,isProdDeploy:Ie,withStageTimer:S,stopUsageTracking:async()=>{await c?.stop()}}),await w.run("completed");return}let ce=jue(),_e=t.mode==="ask",qe;t.mode==="create"&&(qe=(await S("create",()=>Fce({config:t,cwd:n}))).additionalContext);let H=await b.prepare({deploySubdomain:Pe,isProdDeploy:Ie});H&&(qe=[H,qe].filter(Boolean).join(`
626
+ `)}var Vu=ae("usage_tracker"),QJe=4e3,eXe=5e3,tXe=(t,e,r)=>t===!0||r!=null&&e!=null&&e>=r,rXe=(t,e,r)=>e!=null&&e>0&&r!=null&&t!=null&&e-t<=r,_ye=(t,e,r,{creditReserve:n,onCreditReserveReached:i,followPolledLimit:o=!1,shouldPollOnTimer:s=!1}={})=>{let a=!1,c=!1,l=!1,u=!1,d,f,p,h=r,m,y=i!=null&&n!=null,S=()=>{m&&(clearInterval(m),m=void 0)},b=async()=>{try{let P=await DA(t,e);Vu.log("Usage update response",{usage:P?.usage});let M=P?.usage?.total_credits_cost;M!=null&&(d=M);let F=P?.enforced_credits_cap;if(o&&F!=null&&F!==h){let re=h==null;h=F,Vu.log("Took the session credit limit from a usage poll",{sessionCreditLimit:h,totalCreditsCost:M,isFirstLimit:re}),re&&ne.inc("session.credit_cap_late_arrival",1)}let _=tXe(P?.credit_limit_exceeded,M,h);if(_&&(Vu.log("Credit limit exceeded",{totalCreditsCost:M,sessionCreditLimit:h}),l||(f=Date.now(),p=M??d??0),l=!0,S(),w.cancel()),y&&!u&&!_&&rXe(M,h,n)){u=!0,Vu.log("Credit reserve reached",{totalCreditsCost:M,sessionCreditLimit:h,creditReserve:n});try{i()}catch(re){Vu.warn("onCreditReserveReached callback threw",{error:re?.message||re})}}}catch(P){Vu.warn("Failed to update usage",{error:P?.message||P})}},w=Hw(b,QJe);return{onAgentOutput:()=>{if(l)throw new wi("AI credit usage exceeded enforced limit.",503,"Credit limit reached. Check credit limits to continue using Agent Runners.",!0);if(!c){if(a=!0,!s){w();return}m||(m=setInterval(()=>{w()},eXe),m.unref?.())}},stop:async()=>{c||(c=!0,S(),a&&(w.cancel(),Vu.log("Sending final usage update"),await b(),f!==void 0&&(ne.timing("credit_limit.overage_duration",Date.now()-f),ne.distribution("credit_limit.overage_credits",Math.max(0,(d??p??0)-(p??0))))))},getCreditsCost:()=>d,getSessionCreditLimit:()=>h}};var yye=ae("session_credit_limit"),nXe=async t=>{if(t.sessionCreditLimit!=null)return{limit:t.sessionCreditLimit,source:"env"};if(!He().fetchCreditCapEnabled)return{source:"unchecked"};try{let e=(await DA(t.id,t.sessionId))?.enforced_credits_cap;if(e!=null)return yye.log("Resolved the session credit limit from the usage endpoint",{limit:e}),{limit:e,source:"usage"}}catch(e){yye.warn("Usage call for the session credit limit failed",{error:e?.message||e})}return{source:"none"}},Sye=async(t,e=!1)=>{let{limit:r,source:n}=await nXe(t);t.sessionCreditLimit=r,ne.inc("session.credit_cap_source",1,{source:n,hot_follow_up:e})};var qc=ae("credit_wrapup"),Eye="low",iXe=t=>t.mode==="ask"?XD:t.mode==="normal"?QD:au(t)?ZD:JD,BV=t=>{let e=He();return e.creditWrapUpReserveByModeAndModel[t.mode]?.[t.runner]??e.creditWrapUpReserve},vye=(t,e)=>{if(e<=0)return!1;let r=He();return t.mode==="create"?r.creditWrapUpEnabled:t.mode==="ask"||t.mode==="normal"?r.creditWrapUpNormalEnabled:!1},jV=(t,e)=>{if(t==="fix"){qc.log("Credit reserve reached outside of the main inference turn \u2014 letting the fix finish without a wrap-up"),ne.inc("session.credit_wrapup_skipped_fix_turn",1,{credit_reserve:e});return}if(t==="no_session"){qc.warn("Credit reserve reached but no session id yet \u2014 skipping wrap-up interrupt"),ne.inc("session.credit_wrapup_skipped_no_session",1,{credit_reserve:e});return}qc.log("Credit reserve reached with no turn to interrupt \u2014 the agent had already finished")},Tye=(t,e,r)=>{if(e==null)return;let n=Math.max(0,e-t.creditsSpentBeforeWrapUp);qc.log("Credit wrap-up cost",{credits:n,creditsCostAtSessionEnd:e,effort:Eye,inferenceAfterWrapUp:r,...t}),ne.distribution("session.credit_wrapup_cost",n,{outcome:t.outcome,effort:Eye,credit_reserve:t.creditReserve,inference_after_wrap_up:r,...t.model?{model:t.model}:{}})},bye=async({runnerResult:t,interruptedSessionId:e,creditsSpentBeforeWrapUp:r,cliPath:n,config:i,context:o,runner:s,aiGateway:a,cwd:c,persistSteps:l,usageTracker:u,withStageTimer:d,answerFold:f})=>{let p=BV(i),h=new AbortController,m=!1,y=!1,S,b=Object.assign(async C=>{try{u.onAgentOutput()}catch(O){gs(O)&&!m&&(m=!0,qc.log("Wrap-up turn spent the credit reserve \u2014 stopping wrap-up",{creditsSpentBeforeWrapUp:r}),ne.inc("session.credit_wrapup_aborted",1,{credit_reserve:p}),h.abort())}return l(C)},{flush:l.flush.bind(l)});qc.log("Running credit wrap-up inference turn",{creditsSpentBeforeWrapUp:r,creditReserve:p});try{await l({steps:[{category:V.WrapUp,message:"You are reaching your usage limit. Wrapping up and leaving your work in a usable state."}],duration:0})}catch{}let w;try{let{runnerResult:C}=await d("inference-credit-wrapup",()=>Bc({cliPath:n,config:i,context:o,runner:s,persistSteps:b,aiGateway:a,cwd:c,contextPrefix:iXe(i),priorAgentSessionId:e,resumeForCreditWrapUp:!0,answerFold:f,forceLowEffortForCreditWrapUp:!0,abortSignal:h.signal}));S=C.resolvedModel,m&&qc.log("Wrap-up turn was aborted due to budget limit"),w={...fy(t,C),resolvedModel:t.resolvedModel,effort:t.effort,resolvedProviderEffort:t.resolvedProviderEffort}}catch(C){qc.warn("Credit wrap-up turn failed \u2014 proceeding with pre-wrap-up result",{error:C?.message||C}),ne.inc("session.credit_wrapup_failed",1,{credit_reserve:p}),y=!0,w=t}let T=S??t.resolvedModel;return{runnerResult:w,costReport:{creditsSpentBeforeWrapUp:r,creditReserve:p,outcome:y?"failed":m?"aborted":"completed",...T?{model:T}:{}}}};var Aye=t=>{let e,r=!1;return{getActiveTurn:()=>e?"main":r?"fix":"none",getMainTurnAbortSignal:()=>t?e?.signal:void 0,startMainTurn:()=>{e=new AbortController},finishMainTurn:()=>{e=void 0},runFixTurn:async n=>{r=!0;try{return await n()}finally{r=!1}},abortMainTurn:()=>e?.abort()}};import oXe from"process";var zV=ae("shutdown"),wye=!1,sXe,aXe=async t=>{if(wye)return;if(wye=!0,zV.info("Shutting down...",{signal:t}),aie(),ne.distribution("session.hot_followups",kue()),!Nue()){let r=Date.now(),n=Mue(),i=Due();n!==void 0&&ne.timing("session.last_linger",r-n),i!==void 0&&ne.timing("session.total_linger",r-i)}let e=sXe?.close().catch(r=>{zV.error("Error closing server during graceful shutdown",r)});await $ue(),await e,await bQ(),zV.info("Shutdown complete"),oXe.exit(0)};var xye=t=>{aXe(t)};var cXe=4e3,lXe=3e4,rE=ae("credit_limit_preservation"),Rye=async(t,e)=>{if(!e)return null;Fh(e);let r=Mo(t.runner),n=null;try{await Promise.race([Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:r,nativeSessionId:e}).then(i=>{n=i}),qS({archive:r,cache:t.cache,nativeSessionId:e}).catch(i=>{rE.warn("Failed to seed the native session cache before teardown",{error:i?.message||i})})]),new Promise(i=>{setTimeout(i,cXe).unref()})])}catch(i){rE.warn("Failed to preserve native session before teardown",{error:i?.message||i})}return n},Cye=async(t,e)=>{let r=null,n={},i=[];if(e){Fh(e);let o=Mo(t.runner);i.push(Promise.all([zu({runnerId:t.id,sessionId:t.sessionId,archive:o,nativeSessionId:e}).then(s=>{r=s}),qS({archive:o,cache:t.cache,nativeSessionId:e}).catch(s=>{rE.warn("Failed to seed the native session cache on credit-limit shutdown",{error:s?.message||s})})]).catch(s=>{rE.warn("Failed to preserve native session on credit-limit shutdown",{error:s?.message||s})}))}if(t.mode!=="ask"&&i.push(Zw({config:t}).then(o=>o.hasChanges?Nq({config:t,diff:o.diff,diffBinary:o.diffBinary,resultDiff:o.resultDiff,resultDiffBinary:o.resultDiffBinary}):{}).then(o=>{n=o}).catch(o=>{rE.warn("Failed to preserve working-tree diff on credit-limit shutdown",{error:o?.message||o})})),i.length>0){let o=!1;await Promise.race([Promise.all(i).then(()=>{o=!0}),new Promise(s=>{setTimeout(s,lXe).unref()})]),o||ne.inc("credit_preservation.timed_out",1)}return{nativeSessionS3Key:r,diffFields:n}};var dXe=uXe(import.meta.url),nE=dXe("../package.json"),sr=ae("pipeline_index"),mm=3,fXe=["codex","gemini"],OVe=async({config:t,apiToken:e,cliPath:r="netlify",cwd:n,filter:i,isHotFollowUp:o=!1,enqueuedAt:s,tracing:a={}})=>{let c,l=Date.now(),u="success",d=!1,f,p,h=!1,m,y=!1,{withStageTimer:S}=cie(Pi.timeUnits.hours(4)),b=lye({config:t,cliPath:r,cwd:n,withStageTimer:S}),w=dye({config:t,cwd:n,database:b,stopUsageTracking:()=>c?.stop()}),T=await AQ(nE.version,t.id,a);sr.log(`Agent runner orchestrator v${nE.version}`,{featureFlags:He().raw,metrics:NQ()});let C={agent:t.runner,mode:t.mode,is_follow_up:t.sessionHistoryContext.length>0,version:nE.version,fast_init:t.fastInit,credit_wrapup:!1,budget_eligible:!1,budget_constrained:!1,ask_first:!1};S_({...C});let O=!!t.answeredInteraction;fye({isHotFollowUp:o,enqueuedAt:s}),xie(t.sessionId);try{await Zm(Qe(),"run-pipeline",{},T,async k=>{await Yz(Wz(),t.runner),k?.setAttributes({"gen_ai.capability.name":t.mode,"session.id":t.sessionId,...process.env.NETLIFY_DEV_SERVER_ID?{"dev_server.id":process.env.NETLIFY_DEV_SERVER_ID}:{}});let{aiGateway:P,context:M,persistSteps:F,runner:_,sha:re}=await S("init",()=>hue({config:t,apiToken:e,cliPath:r,cwd:n,filter:i,runnerVersion:nE.version}),Pi.timeUnits.minutes(10)),N=_.runner;He().idleTimeoutEnabled||w.setRunnerCleanup(_.clean),await Sye(t,o),Object.assign(C,Lce(t)),S_({...C});let g=BV(t),E=vye(t,g),x=Aye(E),Y,q=!1,fe=0,$e;c=_ye(t.id,t.sessionId,t.sessionCreditLimit,{followPolledLimit:He().creditCapFromPollEnabled,shouldPollOnTimer:He().timedUsagePollEnabled,...E?{creditReserve:g,onCreditReserveReached:()=>{if(!q){if(x.getActiveTurn()!=="main"){q=!0,jV(x.getActiveTurn(),g);return}if(!$e){jV("no_session",g);return}q=!0,fe=c?.getCreditsCost()??0,sr.log("Credit reserve reached \u2014 interrupting agent to wrap up",{creditsSpentBeforeWrapUp:fe,creditReserve:g}),C.credit_wrapup=!0,S_({...C}),ne.inc("session.credit_wrapup_triggered",1,{credit_reserve:g}),x.abortMainTurn()}}}:{}});let Ie=xx(t.mode),Pe;t.deployAlias&&t.deployAlias.length>0?Pe=t.deployAlias:(t.deployAlias!==void 0&&!Ie&&sr.warn("Received empty deploy alias for a non-prod deploy, falling back to local computation"),Pe=yie(t.id,process.env.SITE_NAME,Ie));let xe=!1,Fe=!1,Re=Object.assign(async Ce=>{xe||(xe=!0,pye({isHotFollowUp:o,enqueuedAt:s}));try{c?.onAgentOutput()}catch(at){return gs(at)?Y??=at:sr.warn("Unexpected error in onAgentOutput",{error:at?.message||at}),F(Ce)}return!Fe&&Ce.steps?.some(at=>at.category!==V.Environment&&at.category!==V.SubagentPrompt)&&(Fe=!0,hye({isHotFollowUp:o,enqueuedAt:s})),F(Ce)},{flush:F.flush.bind(F)});if(t.sha=re,t.mode==="redeploy"){await cge({cliPath:r,config:t,context:M,filter:i,deploySubdomain:Pe,isProdDeploy:Ie,withStageTimer:S,stopUsageTracking:async()=>{await c?.stop()}}),await w.run("completed");return}let ce=jue(),_e=t.mode==="ask",qe;t.mode==="create"&&(qe=(await S("create",()=>Fce({config:t,cwd:n}))).additionalContext);let H=await b.prepare({deploySubdomain:Pe,isProdDeploy:Ie});H&&(qe=[H,qe].filter(Boolean).join(`
627
627
 
628
- `)),x.startMainTurn();let le=await S("inference",async()=>{try{return await Bc({cliPath:r,config:t,context:M,runner:N,persistSteps:Re,aiGateway:P,additionalContext:qe,cwd:n,answerFold:ce,abortSignal:x.getMainTurnAbortSignal(),onSessionId:E?Ce=>{$e=Ce}:void 0})}catch(Ce){if(!(Ce instanceof ff)||t.mode!=="rebase"&&t.mode!=="conflict_resolution")throw Ce;for(let at of fXe){if(Y&&gs(Y))throw Y;if(at===t.runner)continue;let tt=$h[at];if(tt){sr.log(`Primary runner ${t.runner} failed in ${t.mode} mode, falling back to ${at}`),S_({...C,agent:at}),await Yz(Wz(),at);try{let Xe=await Bc({cliPath:r,config:{...t,runner:at},context:M,runner:tt.runner,persistSteps:Re,aiGateway:P,additionalContext:qe,cwd:n,answerFold:ce,abortSignal:x.getMainTurnAbortSignal()});return t.runner=at,N=tt.runner,He().idleTimeoutEnabled||w.setRunnerCleanup(tt.clean),Xe}catch(Xe){if(gs(Xe))throw Xe;sr.error(`Fallback runner ${at} also failed`,{error:String(Xe)})}}}throw Ce}}).finally(x.finishMainTurn),R=le.runnerResult;d=le.nativeResume??!1,f=R.resolvedModel,p=R.effort;let I=async(Ce,at)=>{let{runnerResult:tt}=await x.runFixTurn(()=>S(Ce,()=>Bc({cliPath:r,config:t,context:M,runner:N,persistSteps:Re,aiGateway:P,buildErrors:at,priorAgentSessionId:R.agentSessionId,answerFold:ce})));if(Y)throw Object.assign(Y,{agentSessionId:tt.agentSessionId??R.agentSessionId}),Y;R=fy(R,tt)},U=R.agentSessionId;if(E&&G&&R.aborted&&!Y&&U&&c){h=!0;let Ce=await bye({runnerResult:R,interruptedSessionId:U,creditsSpentBeforeWrapUp:fe,cliPath:r,config:t,context:M,runner:N,aiGateway:P,cwd:n,persistSteps:F,usageTracker:c,withStageTimer:S,answerFold:ce});R=Ce.runnerResult,m=Ce.costReport}if(t.mode==="create"&&await Uce(n??process.cwd()),Y)throw Object.assign(Y,{agentSessionId:R.agentSessionId}),Y;if(R.pendingInteraction){let Ce=R.agentSessionId;Ce&&Fh(Ce);let at=await zu({runnerId:t.id,sessionId:t.sessionId,archive:Mo(t.runner)}),tt;try{tt=await Fue(t,R.pendingInteraction,{nativeSessionId:Ce,nativeSessionS3Key:at??void 0})}catch(Xe){throw ne.inc("inference.pause_persist_failed",1),Xe}sr.log("Agent paused on a question; session set to await_input",{sessionId:t.sessionId,refId:tt,questionCount:R.pendingInteraction.questions.length}),ne.inc("inference.pending_question",1),ne.distribution("inference.questions_per_ask",R.pendingInteraction.questions.length),u="awaiting_input",await w.run("awaiting-input");return}let q=await b.generateMigrations();if(q.error&&(sr.log("Migration generation failed, running inference to fix the issue"),await I("inference-migration-fix",[`Running \`drizzle-kit generate\` to generate database migrations failed with the following error:
628
+ `)),x.startMainTurn();let le=await S("inference",async()=>{try{return await Bc({cliPath:r,config:t,context:M,runner:N,persistSteps:Re,aiGateway:P,additionalContext:qe,cwd:n,answerFold:ce,abortSignal:x.getMainTurnAbortSignal(),onSessionId:E?Ce=>{$e=Ce}:void 0})}catch(Ce){if(!(Ce instanceof ff)||t.mode!=="rebase"&&t.mode!=="conflict_resolution")throw Ce;for(let at of fXe){if(Y&&gs(Y))throw Y;if(at===t.runner)continue;let tt=$h[at];if(tt){sr.log(`Primary runner ${t.runner} failed in ${t.mode} mode, falling back to ${at}`),S_({...C,agent:at}),await Yz(Wz(),at);try{let Xe=await Bc({cliPath:r,config:{...t,runner:at},context:M,runner:tt.runner,persistSteps:Re,aiGateway:P,additionalContext:qe,cwd:n,answerFold:ce,abortSignal:x.getMainTurnAbortSignal()});return t.runner=at,N=tt.runner,He().idleTimeoutEnabled||w.setRunnerCleanup(tt.clean),Xe}catch(Xe){if(gs(Xe))throw Xe;sr.error(`Fallback runner ${at} also failed`,{error:String(Xe)})}}}throw Ce}}).finally(x.finishMainTurn),R=le.runnerResult;d=le.nativeResume??!1,f=R.resolvedModel,p=R.effort;let I=async(Ce,at)=>{let{runnerResult:tt}=await x.runFixTurn(()=>S(Ce,()=>Bc({cliPath:r,config:t,context:M,runner:N,persistSteps:Re,aiGateway:P,buildErrors:at,priorAgentSessionId:R.agentSessionId,answerFold:ce})));if(Y)throw Object.assign(Y,{agentSessionId:tt.agentSessionId??R.agentSessionId}),Y;R=fy(R,tt)},U=R.agentSessionId;if(E&&q&&R.aborted&&!Y&&U&&c){h=!0;let Ce=await bye({runnerResult:R,interruptedSessionId:U,creditsSpentBeforeWrapUp:fe,cliPath:r,config:t,context:M,runner:N,aiGateway:P,cwd:n,persistSteps:F,usageTracker:c,withStageTimer:S,answerFold:ce});R=Ce.runnerResult,m=Ce.costReport}if(t.mode==="create"&&await Uce(n??process.cwd()),Y)throw Object.assign(Y,{agentSessionId:R.agentSessionId}),Y;if(R.pendingInteraction){let Ce=R.agentSessionId;Ce&&Fh(Ce);let at=await zu({runnerId:t.id,sessionId:t.sessionId,archive:Mo(t.runner)}),tt;try{tt=await Fue(t,R.pendingInteraction,{nativeSessionId:Ce,nativeSessionS3Key:at??void 0})}catch(Xe){throw ne.inc("inference.pause_persist_failed",1),Xe}sr.log("Agent paused on a question; session set to await_input",{sessionId:t.sessionId,refId:tt,questionCount:R.pendingInteraction.questions.length}),ne.inc("inference.pending_question",1),ne.distribution("inference.questions_per_ask",R.pendingInteraction.questions.length),u="awaiting_input",await w.run("awaiting-input");return}let G=await b.generateMigrations();if(G.error&&(sr.log("Migration generation failed, running inference to fix the issue"),await I("inference-migration-fix",[`Running \`drizzle-kit generate\` to generate database migrations failed with the following error:
629
629
 
630
- ${q.error}
630
+ ${G.error}
631
631
 
632
- Please fix the issue and do NOT run \`drizzle-kit generate\` yourself \u2014 it will be run automatically after you're done.`]),await b.generateMigrations()),!q.skipped){let Ce=await b.verifyMigrations();Ce.error&&(sr.log("Migration drift detected, running inference to fix"),await I("inference-migration-drift-fix",[Ce.error]))}if(He().aiFnV1GuardrailEnabled&&n&&!_e)try{let Ce=await iL(n);Ce.v1>0&&(sr.log(`Detected ${Ce.v1} v1 AI function(s), running inference to fix`),await I("inference-ai-fn-v1-fix",[gye(Ce.v1Files)]))}catch(Ce){if(gs(Ce))throw Ce;sr.warn("ai_fn_v1_guardrail failed",{err:Ce})}let ee=await S("deploy",()=>VS({cliPath:r,config:t,context:M,result:R.result,filter:i,isRetry:!1,deploySubdomain:Pe})),se=ee.hasChanges?ee:void 0,Te=R;ee.deployError&&ne.inc("deploy.failed",1,{attempt:1});let Ye=[],Oe;if(ee.hasChanges&&ee.deployError){Ye.push(RQ(ee.deployError));let Ce=1,at=!1;for(;Ce<=mm&&!ee.previewInfo&&!at;)sr.log(`Deploy attempt had errors. Retrying. ${Ce}/${mm}`),await Zm(Qe(),"deploy-stage",async tt=>{tt?.setAttributes({"stage.attempt":Ce});let Xe;try{y=h,Xe=(await x.runFixTurn(()=>S(`inference-retry-${Ce}`,()=>Bc({cliPath:r,config:t,context:M,runner:N,persistSteps:Re,aiGateway:P,buildErrors:Ye,priorAgentSessionId:R.agentSessionId,answerFold:ce})))).runnerResult}catch(jo){if(gs(jo))throw jo;sr.warn(`Inference retry ${Ce} failed, stopping deploy retries:`,jo),at=!0;return}if(Y)throw Object.assign(Y,{agentSessionId:Xe.agentSessionId??R.agentSessionId}),Y;Te=fy(Te,Xe),await b.generateMigrations(),ee=await S(`deploy-retry-${Ce}`,()=>VS({cliPath:r,config:t,context:M,result:Xe.result,filter:i,isRetry:!0,deploySubdomain:Pe})),ee.hasChanges&&(se=ee),ee.deployError&&(ne.inc("deploy.failed",1,{attempt:Ce+1}),Ye.push(ee.deployError)),Ce++});Ce>mm&&!ee.previewInfo&&(ne.inc("deploy.retries_exhausted",1),t.mode==="create"?(console.warn(`Deploy still failing after ${mm} retries, failing the create run`),Oe=new Error(`Deploy failed after ${mm} retries`)):console.warn(`Deploy still failing after ${mm} retries, completing run without a preview`))}let Ee=ee.previewInfo||ee.hasChanges?ee:se??ee,{diff:ze,resultDiff:ye,previewInfo:Ae,diffBinary:Hr,resultDiffBinary:Bo,hasNetlifyForm:gP,hasNetlifyIdentity:gm}=Ee;Ee.hasChanges&&PA({previewDeployed:!!Ee.previewInfo,hadFailedAttempts:Ye.length>0}),await c?.stop(),k?.setAttributes(IQ(Te,c?.getCreditsCost())),f=Te.resolvedModel,p=Te.effort??p;let _m=Te.agentSessionId??R.agentSessionId;if(_m&&Fh(_m),await S("cleanup",()=>KI({config:t,diff:ze,result:Te.result,duration:Te.duration,resultDiff:ye,diffBinary:Hr,resultDiffBinary:Bo,previewInfo:Ae,isProdDeploy:Ie,hasNetlifyForm:gP,hasNetlifyIdentity:gm,nativeSessionArchive:Mo(t.runner),nativeSessionId:_m,finalAgentConfig:{agent:t.runner,model:f,effort:p},creditWrapUp:h}),Pi.timeUnits.minutes(10),{interruptible:!1}),Oe)throw Oe;try{let Ce=await iL(n??process.cwd());Ce.aiTotal>0&&k?.setAttributes({"agent.fn_ai_total":Ce.aiTotal,"agent.fn_ai_v1":Ce.v1,"agent.fn_ai_v2":Ce.v2,"agent.fn_ai_v3":Ce.v3,"agent.fn_ai_unknown":Ce.unknown})}catch{}await w.run("completed");let ea=await b.hasDatabase();typeof ea=="boolean"&&k?.setAttributes({"actual.has_db":ea}),await KQ({config:t,hasDb:ea,pipelineSpan:k,resolvedModel:Te.resolvedModel??R.resolvedModel,cliVersion:nE.version})})}catch(k){if(gs(k)){u="gracefulError",sr.info("Agent run terminated gracefully",{statusCode:k.statusCode,reason:k.message}),await c?.stop();let N=k?.agentSessionId,g=k.isCreditLimitExceeded&&!!N,{nativeSessionS3Key:E,diffFields:x}=k.isCreditLimitExceeded?await Cye(t,N):{nativeSessionS3Key:null,diffFields:{}};await w.run("errored");try{await br(t.id,t.sessionId,{result:k.userMessage,state:k.isCreditLimitExceeded?"cancelled":"error",...k.isCreditLimitExceeded&&{credit_limit_exceeded:!0},...g?{native_session_id:N}:{},...E?{native_session_s3_key:E}:{},...x,metadata:{final_agent_config:{agent:t.runner,model:f,effort:p},...h?{credit_wrap_up:!0}:{}}})}catch{sr.info("Could not update session (site may have been deleted)")}k.isCreditLimitExceeded&&xye("credit_limit_cancelled");return}u=yo()?"interrupted":"error",sr.error("Got error while running pipeline",k),await c?.stop();let P=k?.agentSessionId,M=yo()&&!!P,F=M?await Rye(t,P):null;await w.run("errored");let _=k instanceof Error?k.shortMessage||k.message:"",re=_?Mce(mC(_)):"Encountered error when running agent";try{await br(t.id,t.sessionId,{result:re,state:"error",...M?{native_session_id:P}:{},...F?{native_session_s3_key:F}:{}})}catch(N){sr.error("Failed to update session with error state, retrying with minimal payload:",N);try{await br(t.id,t.sessionId,{result:"Encountered error when running agent",state:"error"})}catch(g){sr.error("Failed to mark session as errored:",g)}}throw k}finally{b.revokeAskAccess(),m&&Tye(m,c?.getCreditsCost(),y),mye({isHotFollowUp:o,startedAt:l,outcome:u,nativeResume:d,isAnswerResume:O,creditsCost:c?.getCreditsCost(),model:f,effort:p})}};export{OVe as runPipeline};
632
+ Please fix the issue and do NOT run \`drizzle-kit generate\` yourself \u2014 it will be run automatically after you're done.`]),await b.generateMigrations()),!G.skipped){let Ce=await b.verifyMigrations();Ce.error&&(sr.log("Migration drift detected, running inference to fix"),await I("inference-migration-drift-fix",[Ce.error]))}if(He().aiFnV1GuardrailEnabled&&n&&!_e)try{let Ce=await iL(n);Ce.v1>0&&(sr.log(`Detected ${Ce.v1} v1 AI function(s), running inference to fix`),await I("inference-ai-fn-v1-fix",[gye(Ce.v1Files)]))}catch(Ce){if(gs(Ce))throw Ce;sr.warn("ai_fn_v1_guardrail failed",{err:Ce})}let ee=await S("deploy",()=>VS({cliPath:r,config:t,context:M,result:R.result,filter:i,isRetry:!1,deploySubdomain:Pe})),se=ee.hasChanges?ee:void 0,Te=R;ee.deployError&&ne.inc("deploy.failed",1,{attempt:1});let Ye=[],Oe;if(ee.hasChanges&&ee.deployError){Ye.push(RQ(ee.deployError));let Ce=1,at=!1;for(;Ce<=mm&&!ee.previewInfo&&!at;)sr.log(`Deploy attempt had errors. Retrying. ${Ce}/${mm}`),await Zm(Qe(),"deploy-stage",async tt=>{tt?.setAttributes({"stage.attempt":Ce});let Xe;try{y=h,Xe=(await x.runFixTurn(()=>S(`inference-retry-${Ce}`,()=>Bc({cliPath:r,config:t,context:M,runner:N,persistSteps:Re,aiGateway:P,buildErrors:Ye,priorAgentSessionId:R.agentSessionId,answerFold:ce})))).runnerResult}catch(jo){if(gs(jo))throw jo;sr.warn(`Inference retry ${Ce} failed, stopping deploy retries:`,jo),at=!0;return}if(Y)throw Object.assign(Y,{agentSessionId:Xe.agentSessionId??R.agentSessionId}),Y;Te=fy(Te,Xe),await b.generateMigrations(),ee=await S(`deploy-retry-${Ce}`,()=>VS({cliPath:r,config:t,context:M,result:Xe.result,filter:i,isRetry:!0,deploySubdomain:Pe})),ee.hasChanges&&(se=ee),ee.deployError&&(ne.inc("deploy.failed",1,{attempt:Ce+1}),Ye.push(ee.deployError)),Ce++});Ce>mm&&!ee.previewInfo&&(ne.inc("deploy.retries_exhausted",1),t.mode==="create"?(console.warn(`Deploy still failing after ${mm} retries, failing the create run`),Oe=new Error(`Deploy failed after ${mm} retries`)):console.warn(`Deploy still failing after ${mm} retries, completing run without a preview`))}let ye=ee.previewInfo||ee.hasChanges?ee:se??ee,{diff:ze,resultDiff:Se,previewInfo:Ae,diffBinary:Hr,resultDiffBinary:Bo,hasNetlifyForm:gP,hasNetlifyIdentity:gm}=ye;ye.hasChanges&&PA({previewDeployed:!!ye.previewInfo,hadFailedAttempts:Ye.length>0}),await c?.stop(),k?.setAttributes(IQ(Te,c?.getCreditsCost())),f=Te.resolvedModel,p=Te.effort??p;let _m=Te.agentSessionId??R.agentSessionId;if(_m&&Fh(_m),await S("cleanup",()=>KI({config:t,diff:ze,result:Te.result,duration:Te.duration,resultDiff:Se,diffBinary:Hr,resultDiffBinary:Bo,previewInfo:Ae,isProdDeploy:Ie,hasNetlifyForm:gP,hasNetlifyIdentity:gm,nativeSessionArchive:Mo(t.runner),nativeSessionId:_m,finalAgentConfig:{agent:t.runner,model:f,effort:p},creditWrapUp:h}),Pi.timeUnits.minutes(10),{interruptible:!1}),Oe)throw Oe;try{let Ce=await iL(n??process.cwd());Ce.aiTotal>0&&k?.setAttributes({"agent.fn_ai_total":Ce.aiTotal,"agent.fn_ai_v1":Ce.v1,"agent.fn_ai_v2":Ce.v2,"agent.fn_ai_v3":Ce.v3,"agent.fn_ai_unknown":Ce.unknown})}catch{}await w.run("completed");let ea=await b.hasDatabase();typeof ea=="boolean"&&k?.setAttributes({"actual.has_db":ea}),await KQ({config:t,hasDb:ea,pipelineSpan:k,resolvedModel:Te.resolvedModel??R.resolvedModel,cliVersion:nE.version})})}catch(k){if(gs(k)){u="gracefulError",sr.info("Agent run terminated gracefully",{statusCode:k.statusCode,reason:k.message}),await c?.stop();let N=k?.agentSessionId,g=k.isCreditLimitExceeded&&!!N,{nativeSessionS3Key:E,diffFields:x}=k.isCreditLimitExceeded?await Cye(t,N):{nativeSessionS3Key:null,diffFields:{}};await w.run("errored");try{await br(t.id,t.sessionId,{result:k.userMessage,state:k.isCreditLimitExceeded?"cancelled":"error",...k.isCreditLimitExceeded&&{credit_limit_exceeded:!0},...g?{native_session_id:N}:{},...E?{native_session_s3_key:E}:{},...x,metadata:{final_agent_config:{agent:t.runner,model:f,effort:p},...h?{credit_wrap_up:!0}:{}}})}catch{sr.info("Could not update session (site may have been deleted)")}k.isCreditLimitExceeded&&xye("credit_limit_cancelled");return}u=yo()?"interrupted":"error",sr.error("Got error while running pipeline",k),await c?.stop();let P=k?.agentSessionId,M=yo()&&!!P,F=M?await Rye(t,P):null;await w.run("errored");let _=k instanceof Error?k.shortMessage||k.message:"",re=_?Mce(mC(_)):"Encountered error when running agent";try{await br(t.id,t.sessionId,{result:re,state:"error",...M?{native_session_id:P}:{},...F?{native_session_s3_key:F}:{}})}catch(N){sr.error("Failed to update session with error state, retrying with minimal payload:",N);try{await br(t.id,t.sessionId,{result:"Encountered error when running agent",state:"error"})}catch(g){sr.error("Failed to mark session as errored:",g)}}throw k}finally{b.revokeAskAccess(),m&&Tye(m,c?.getCreditsCost(),y),mye({isHotFollowUp:o,startedAt:l,outcome:u,nativeResume:d,isAnswerResume:O,creditsCost:c?.getCreditsCost(),model:f,effort:p})}};export{OVe as runPipeline};
633
633
  /*! Bundled license information:
634
634
 
635
635
  long/umd/index.js: