@linzumi/cli 1.0.264 → 1.0.266
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/impl-res/cloud-supervisor.mjs +90 -88
- package/dist/impl-res/index.js +327 -294
- package/dist/impl-res/mcp-server.mjs +28 -27
- package/dist/impl-ts/cloud-supervisor.mjs +90 -88
- package/dist/impl-ts/index.js +518 -486
- package/dist/impl-ts/mcp-server.mjs +4 -3
- package/dist/impl-ts/tcp-tunnel-cli.mjs +2 -2
- package/dist/mcp-server.mjs +4 -3
- package/dist/tcp-tunnel-cli.mjs +2 -2
- package/package.json +1 -1
- package/scripts/build-core-commander-seams-parity-oracle.mjs +111 -17
|
@@ -39,11 +39,11 @@ ${g.toString(16)}\r
|
|
|
39
39
|
0\r
|
|
40
40
|
\r
|
|
41
41
|
`,"latin1"),t!==null&&n!==t){if(r[ki])throw new Pe;process.emitWarning(new Pe)}A[j].timeout&&A[j].timeoutType===Ut&&A[j].timeout.refresh&&A[j].timeout.refresh(),r[De]()}}destroy(A){let{socket:t,client:r,abort:n}=this;t[me]=!1,A&&(b(r[cA]<=1,"pipeline should only contain this request"),n(A))}};hQ.exports=Vw});var FQ=f((eU,kQ)=>{"use strict";var TA=h("node:assert"),{pipeline:zw}=h("node:stream"),J=G(),{RequestContentLengthMismatchError:Ni,RequestAbortedError:fQ,SocketError:mr,InformationalError:Si}=H(),{kUrl:Zn,kReset:Xn,kClient:Mt,kRunning:jn,kPending:Zw,kQueue:ke,kPendingIdx:Ui,kRunningIdx:HA,kError:qA,kSocket:aA,kStrictContentLength:Kw,kOnError:Mi,kMaxConcurrentStreams:mQ,kHTTP2Session:VA,kResume:Fe,kSize:Xw,kHTTPContext:jw}=Z(),Ee=Symbol("open streams"),yQ,wQ=!1,Kn;try{Kn=h("node:http2")}catch{Kn={constants:{}}}var{constants:{HTTP2_HEADER_AUTHORITY:$w,HTTP2_HEADER_METHOD:Ap,HTTP2_HEADER_PATH:ep,HTTP2_HEADER_SCHEME:tp,HTTP2_HEADER_CONTENT_LENGTH:rp,HTTP2_HEADER_EXPECT:np,HTTP2_HEADER_STATUS:op}}=Kn;function sp(e){let A=[];for(let[t,r]of Object.entries(e))if(Array.isArray(r))for(let n of r)A.push(Buffer.from(t),Buffer.from(n));else A.push(Buffer.from(t),Buffer.from(r));return A}async function ip(e,A){e[aA]=A,wQ||(wQ=!0,process.emitWarning("H2 support is experimental, expect them to change at any time.",{code:"UNDICI-H2"}));let t=Kn.connect(e[Zn],{createConnection:()=>A,peerMaxConcurrentStreams:e[mQ]});t[Ee]=0,t[Mt]=e,t[aA]=A,J.addListener(t,"error",gp),J.addListener(t,"frameError",cp),J.addListener(t,"end",lp),J.addListener(t,"goaway",Qp),J.addListener(t,"close",function(){let{[Mt]:n}=this,{[aA]:o}=n,s=this[aA][qA]||this[qA]||new mr("closed",J.getSocketInfo(o));if(n[VA]=null,n.destroyed){TA(n[Zw]===0);let i=n[ke].splice(n[HA]);for(let a=0;a<i.length;a++){let g=i[a];J.errorRequest(n,g,s)}}}),t.unref(),e[VA]=t,A[VA]=t,J.addListener(A,"error",function(n){TA(n.code!=="ERR_TLS_CERT_ALTNAME_INVALID"),this[qA]=n,this[Mt][Mi](n)}),J.addListener(A,"end",function(){J.destroy(this,new mr("other side closed",J.getSocketInfo(this)))}),J.addListener(A,"close",function(){let n=this[qA]||new mr("closed",J.getSocketInfo(this));e[aA]=null,this[VA]!=null&&this[VA].destroy(n),e[Ui]=e[HA],TA(e[jn]===0),e.emit("disconnect",e[Zn],[e],n),e[Fe]()});let r=!1;return A.on("close",()=>{r=!0}),{version:"h2",defaultPipelining:1/0,write(...n){return Bp(e,...n)},resume(){ap(e)},destroy(n,o){r?queueMicrotask(o):A.destroy(n).on("close",o)},get destroyed(){return A.destroyed},busy(){return!1}}}function ap(e){let A=e[aA];A?.destroyed===!1&&(e[Xw]===0&&e[mQ]===0?(A.unref(),e[VA].unref()):(A.ref(),e[VA].ref()))}function gp(e){TA(e.code!=="ERR_TLS_CERT_ALTNAME_INVALID"),this[aA][qA]=e,this[Mt][Mi](e)}function cp(e,A,t){if(t===0){let r=new Si(`HTTP/2: "frameError" received - type ${e}, code ${A}`);this[aA][qA]=r,this[Mt][Mi](r)}}function lp(){let e=new mr("other side closed",J.getSocketInfo(this[aA]));this.destroy(e),J.destroy(this[aA],e)}function Qp(e){let A=this[qA]||new mr(`HTTP/2: "GOAWAY" frame received with code ${e}`,J.getSocketInfo(this)),t=this[Mt];if(t[aA]=null,t[jw]=null,this[VA]!=null&&(this[VA].destroy(A),this[VA]=null),J.destroy(this[aA],A),t[HA]<t[ke].length){let r=t[ke][t[HA]];t[ke][t[HA]++]=null,J.errorRequest(t,r,A),t[Ui]=t[HA]}TA(t[jn]===0),t.emit("disconnect",t[Zn],[t],A),t[Fe]()}function Ep(e){return e!=="GET"&&e!=="HEAD"&&e!=="OPTIONS"&&e!=="TRACE"&&e!=="CONNECT"}function Bp(e,A){let t=e[VA],{method:r,path:n,host:o,upgrade:s,expectContinue:i,signal:a,headers:g}=A,{body:c}=A;if(s)return J.errorRequest(e,A,new Error("Upgrade not supported for H2")),!1;let l={};for(let p=0;p<g.length;p+=2){let F=g[p+0],L=g[p+1];if(Array.isArray(L))for(let Y=0;Y<L.length;Y++)l[F]?l[F]+=`,${L[Y]}`:l[F]=L[Y];else l[F]=L}let Q,{hostname:E,port:B}=e[Zn];l[$w]=o||`${E}${B?`:${B}`:""}`,l[Ap]=r;let C=p=>{A.aborted||A.completed||(p=p||new fQ,J.errorRequest(e,A,p),Q!=null&&J.destroy(Q,p),J.destroy(c,p),e[ke][e[HA]++]=null,e[Fe]())};try{A.onConnect(C)}catch(p){J.errorRequest(e,A,p)}if(A.aborted)return!1;if(r==="CONNECT")return t.ref(),Q=t.request(l,{endStream:!1,signal:a}),Q.id&&!Q.pending?(A.onUpgrade(null,null,Q),++t[Ee],e[ke][e[HA]++]=null):Q.once("ready",()=>{A.onUpgrade(null,null,Q),++t[Ee],e[ke][e[HA]++]=null}),Q.once("close",()=>{t[Ee]-=1,t[Ee]===0&&t.unref()}),!0;l[ep]=n,l[tp]="https";let d=r==="PUT"||r==="POST"||r==="PATCH";c&&typeof c.read=="function"&&c.read(0);let I=J.bodyLength(c);if(J.isFormDataLike(c)){yQ??=bt().extractBody;let[p,F]=yQ(c);l["content-type"]=F,c=p.stream,I=p.length}if(I==null&&(I=A.contentLength),(I===0||!d)&&(I=null),Ep(r)&&I>0&&A.contentLength!=null&&A.contentLength!==I){if(e[Kw])return J.errorRequest(e,A,new Ni),!1;process.emitWarning(new Ni)}I!=null&&(TA(c,"no body must not have content length"),l[rp]=`${I}`),t.ref();let u=r==="GET"||r==="HEAD"||c===null;return i?(l[np]="100-continue",Q=t.request(l,{endStream:u,signal:a}),Q.once("continue",D)):(Q=t.request(l,{endStream:u,signal:a}),D()),++t[Ee],Q.once("response",p=>{let{[op]:F,...L}=p;if(A.onResponseStarted(),A.aborted){let Y=new fQ;J.errorRequest(e,A,Y),J.destroy(Q,Y);return}A.onHeaders(Number(F),sp(L),Q.resume.bind(Q),"")===!1&&Q.pause(),Q.on("data",Y=>{A.onData(Y)===!1&&Q.pause()})}),Q.once("end",()=>{(Q.state?.state==null||Q.state.state<6)&&A.onComplete([]),t[Ee]===0&&t.unref(),C(new Si("HTTP/2: stream half-closed (remote)")),e[ke][e[HA]++]=null,e[Ui]=e[HA],e[Fe]()}),Q.once("close",()=>{t[Ee]-=1,t[Ee]===0&&t.unref()}),Q.once("error",function(p){C(p)}),Q.once("frameError",(p,F)=>{C(new Si(`HTTP/2: "frameError" received - type ${p}, code ${F}`))}),!0;function D(){!c||I===0?pQ(C,Q,null,e,A,e[aA],I,d):J.isBuffer(c)?pQ(C,Q,c,e,A,e[aA],I,d):J.isBlobLike(c)?typeof c.stream=="function"?DQ(C,Q,c.stream(),e,A,e[aA],I,d):Cp(C,Q,c,e,A,e[aA],I,d):J.isStream(c)?Ip(C,e[aA],d,Q,c,e,A,I):J.isIterable(c)?DQ(C,Q,c,e,A,e[aA],I,d):TA(!1)}}function pQ(e,A,t,r,n,o,s,i){try{t!=null&&J.isBuffer(t)&&(TA(s===t.byteLength,"buffer body must have content length"),A.cork(),A.write(t),A.uncork(),A.end(),n.onBodySent(t)),i||(o[Xn]=!0),n.onRequestSent(),r[Fe]()}catch(a){e(a)}}function Ip(e,A,t,r,n,o,s,i){TA(i!==0||o[jn]===0,"stream body cannot be pipelined");let a=zw(n,r,c=>{c?(J.destroy(a,c),e(c)):(J.removeAllListeners(a),s.onRequestSent(),t||(A[Xn]=!0),o[Fe]())});J.addListener(a,"data",g);function g(c){s.onBodySent(c)}}async function Cp(e,A,t,r,n,o,s,i){TA(s===t.size,"blob body must have content length");try{if(s!=null&&s!==t.size)throw new Ni;let a=Buffer.from(await t.arrayBuffer());A.cork(),A.write(a),A.uncork(),A.end(),n.onBodySent(a),n.onRequestSent(),i||(o[Xn]=!0),r[Fe]()}catch(a){e(a)}}async function DQ(e,A,t,r,n,o,s,i){TA(s!==0||r[jn]===0,"iterator body cannot be pipelined");let a=null;function g(){if(a){let l=a;a=null,l()}}let c=()=>new Promise((l,Q)=>{TA(a===null),o[qA]?Q(o[qA]):a=l});A.on("close",g).on("drain",g);try{for await(let l of t){if(o[qA])throw o[qA];let Q=A.write(l);n.onBodySent(l),Q||await c()}A.end(),n.onRequestSent(),i||(o[Xn]=!0),r[Fe]()}catch(l){e(l)}finally{A.off("close",g).off("drain",g)}}kQ.exports=ip});var Ao=f((tU,NQ)=>{"use strict";var re=G(),{kBodyUsed:kr}=Z(),Ti=h("node:assert"),{InvalidArgumentError:up}=H(),hp=h("node:events"),dp=[300,301,302,303,307,308],RQ=Symbol("body"),$n=class{constructor(A){this[RQ]=A,this[kr]=!1}async*[Symbol.asyncIterator](){Ti(!this[kr],"disturbed"),this[kr]=!0,yield*this[RQ]}},Li=class{constructor(A,t,r,n){if(t!=null&&(!Number.isInteger(t)||t<0))throw new up("maxRedirections must be a positive number");re.validateHandler(n,r.method,r.upgrade),this.dispatch=A,this.location=null,this.abort=null,this.opts={...r,maxRedirections:0},this.maxRedirections=t,this.handler=n,this.history=[],this.redirectionLimitReached=!1,re.isStream(this.opts.body)?(re.bodyLength(this.opts.body)===0&&this.opts.body.on("data",function(){Ti(!1)}),typeof this.opts.body.readableDidRead!="boolean"&&(this.opts.body[kr]=!1,hp.prototype.on.call(this.opts.body,"data",function(){this[kr]=!0}))):this.opts.body&&typeof this.opts.body.pipeTo=="function"?this.opts.body=new $n(this.opts.body):this.opts.body&&typeof this.opts.body!="string"&&!ArrayBuffer.isView(this.opts.body)&&re.isIterable(this.opts.body)&&(this.opts.body=new $n(this.opts.body))}onConnect(A){this.abort=A,this.handler.onConnect(A,{history:this.history})}onUpgrade(A,t,r){this.handler.onUpgrade(A,t,r)}onError(A){this.handler.onError(A)}onHeaders(A,t,r,n){if(this.location=this.history.length>=this.maxRedirections||re.isDisturbed(this.opts.body)?null:fp(A,t),this.opts.throwOnMaxRedirect&&this.history.length>=this.maxRedirections){this.request&&this.request.abort(new Error("max redirects")),this.redirectionLimitReached=!0,this.abort(new Error("max redirects"));return}if(this.opts.origin&&this.history.push(new URL(this.opts.path,this.opts.origin)),!this.location)return this.handler.onHeaders(A,t,r,n);let{origin:o,pathname:s,search:i}=re.parseURL(new URL(this.location,this.opts.origin&&new URL(this.opts.path,this.opts.origin))),a=i?`${s}${i}`:s;this.opts.headers=yp(this.opts.headers,A===303,this.opts.origin!==o),this.opts.path=a,this.opts.origin=o,this.opts.maxRedirections=0,this.opts.query=null,A===303&&this.opts.method!=="HEAD"&&(this.opts.method="GET",this.opts.body=null)}onData(A){if(!this.location)return this.handler.onData(A)}onComplete(A){this.location?(this.location=null,this.abort=null,this.dispatch(this.opts,this)):this.handler.onComplete(A)}onBodySent(A){this.handler.onBodySent&&this.handler.onBodySent(A)}};function fp(e,A){if(dp.indexOf(e)===-1)return null;for(let t=0;t<A.length;t+=2)if(A[t].length===8&&re.headerNameToString(A[t])==="location")return A[t+1]}function bQ(e,A,t){if(e.length===4)return re.headerNameToString(e)==="host";if(A&&re.headerNameToString(e).startsWith("content-"))return!0;if(t&&(e.length===13||e.length===6||e.length===19)){let r=re.headerNameToString(e);return r==="authorization"||r==="cookie"||r==="proxy-authorization"}return!1}function yp(e,A,t){let r=[];if(Array.isArray(e))for(let n=0;n<e.length;n+=2)bQ(e[n],A,t)||r.push(e[n],e[n+1]);else if(e&&typeof e=="object")for(let n of Object.keys(e))bQ(n,A,t)||r.push(n,e[n]);else Ti(e==null,"headers must be an object or an array");return r}NQ.exports=Li});var eo=f((rU,SQ)=>{"use strict";var wp=Ao();function pp({maxRedirections:e}){return A=>function(r,n){let{maxRedirections:o=e}=r;if(!o)return A(r,n);let s=new wp(A,o,r,n);return r={...r,maxRedirections:0},A(r,s)}}SQ.exports=pp});var Yt=f((nU,HQ)=>{"use strict";var Be=h("node:assert"),GQ=h("node:net"),Dp=h("node:http"),_e=G(),{channels:Lt}=Ct(),mp=Oc(),kp=ft(),{InvalidArgumentError:AA,InformationalError:Fp,ClientDestroyedError:Rp}=H(),bp=Er(),{kUrl:ne,kServerName:Re,kClient:Np,kBusy:Yi,kConnect:Sp,kResuming:ze,kRunning:Sr,kPending:Ur,kSize:Nr,kQueue:WA,kConnected:Up,kConnecting:Tt,kNeedDrain:Ne,kKeepAliveDefaultTimeout:UQ,kHostHeader:Mp,kPendingIdx:OA,kRunningIdx:Ie,kError:Lp,kPipelining:to,kKeepAliveTimeoutValue:Tp,kMaxHeadersSize:Yp,kKeepAliveMaxTimeout:Gp,kKeepAliveTimeoutThreshold:Jp,kHeadersTimeout:xp,kBodyTimeout:vp,kStrictContentLength:Hp,kConnector:Fr,kMaxRedirections:Vp,kMaxRequests:Gi,kCounter:qp,kClose:Wp,kDestroy:Op,kDispatch:Pp,kInterceptors:MQ,kLocalAddress:Rr,kMaxResponseSize:_p,kOnError:zp,kHTTPContext:eA,kMaxConcurrentStreams:Zp,kResume:br}=Z(),Kp=dQ(),Xp=FQ(),LQ=!1,be=Symbol("kClosedResolve"),TQ=()=>{};function JQ(e){return e[to]??e[eA]?.defaultPipelining??1}var Ji=class extends kp{constructor(A,{interceptors:t,maxHeaderSize:r,headersTimeout:n,socketTimeout:o,requestTimeout:s,connectTimeout:i,bodyTimeout:a,idleTimeout:g,keepAlive:c,keepAliveTimeout:l,maxKeepAliveTimeout:Q,keepAliveMaxTimeout:E,keepAliveTimeoutThreshold:B,socketPath:C,pipelining:d,tls:I,strictContentLength:u,maxCachedSessions:D,maxRedirections:p,connect:F,maxRequestsPerClient:L,localAddress:Y,maxResponseSize:$,autoSelectFamily:sA,autoSelectFamilyAttemptTimeout:Qt,maxConcurrentStreams:ye,allowH2:CA,webSocket:Et}={}){if(super({webSocket:Et}),c!==void 0)throw new AA("unsupported keepAlive, use pipelining=0 instead");if(o!==void 0)throw new AA("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");if(s!==void 0)throw new AA("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");if(g!==void 0)throw new AA("unsupported idleTimeout, use keepAliveTimeout instead");if(Q!==void 0)throw new AA("unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead");if(r!=null&&!Number.isFinite(r))throw new AA("invalid maxHeaderSize");if(C!=null&&typeof C!="string")throw new AA("invalid socketPath");if(i!=null&&(!Number.isFinite(i)||i<0))throw new AA("invalid connectTimeout");if(l!=null&&(!Number.isFinite(l)||l<=0))throw new AA("invalid keepAliveTimeout");if(E!=null&&(!Number.isFinite(E)||E<=0))throw new AA("invalid keepAliveMaxTimeout");if(B!=null&&!Number.isFinite(B))throw new AA("invalid keepAliveTimeoutThreshold");if(n!=null&&(!Number.isInteger(n)||n<0))throw new AA("headersTimeout must be a positive integer or zero");if(a!=null&&(!Number.isInteger(a)||a<0))throw new AA("bodyTimeout must be a positive integer or zero");if(F!=null&&typeof F!="function"&&typeof F!="object")throw new AA("connect must be a function or an object");if(p!=null&&(!Number.isInteger(p)||p<0))throw new AA("maxRedirections must be a positive number");if(L!=null&&(!Number.isInteger(L)||L<0))throw new AA("maxRequestsPerClient must be a positive number");if(Y!=null&&(typeof Y!="string"||GQ.isIP(Y)===0))throw new AA("localAddress must be valid string IP address");if($!=null&&(!Number.isInteger($)||$<-1))throw new AA("maxResponseSize must be a positive number");if(Qt!=null&&(!Number.isInteger(Qt)||Qt<-1))throw new AA("autoSelectFamilyAttemptTimeout must be a positive number");if(CA!=null&&typeof CA!="boolean")throw new AA("allowH2 must be a valid boolean value");if(ye!=null&&(typeof ye!="number"||ye<1))throw new AA("maxConcurrentStreams must be a positive integer, greater than 0");typeof F!="function"&&(F=bp({...I,maxCachedSessions:D,allowH2:CA,socketPath:C,timeout:i,...sA?{autoSelectFamily:sA,autoSelectFamilyAttemptTimeout:Qt}:void 0,...F})),t?.Client&&Array.isArray(t.Client)?(this[MQ]=t.Client,LQ||(LQ=!0,process.emitWarning("Client.Options#interceptor is deprecated. Use Dispatcher#compose instead.",{code:"UNDICI-CLIENT-INTERCEPTOR-DEPRECATED"}))):this[MQ]=[jp({maxRedirections:p})],this[ne]=_e.parseOrigin(A),this[Fr]=F,this[to]=d??1,this[Yp]=r||Dp.maxHeaderSize,this[UQ]=l??4e3,this[Gp]=E??6e5,this[Jp]=B??2e3,this[Tp]=this[UQ],this[Re]=null,this[Rr]=Y??null,this[ze]=0,this[Ne]=0,this[Mp]=`host: ${this[ne].hostname}${this[ne].port?`:${this[ne].port}`:""}\r
|
|
42
|
-
`,this[vp]=a??3e5,this[xp]=n??3e5,this[Hp]=u??!0,this[Vp]=p,this[Gi]=L,this[be]=null,this[_p]=$>-1?$:-1,this[Zp]=ye??100,this[eA]=null,this[WA]=[],this[Ie]=0,this[OA]=0,this[br]=Bt=>xi(this,Bt),this[zp]=Bt=>xQ(this,Bt)}get pipelining(){return this[to]}set pipelining(A){this[to]=A,this[br](!0)}get[Ur](){return this[WA].length-this[OA]}get[Sr](){return this[OA]-this[Ie]}get[Nr](){return this[WA].length-this[Ie]}get[Up](){return!!this[eA]&&!this[Tt]&&!this[eA].destroyed}get[Yi](){return!!(this[eA]?.busy(null)||this[Nr]>=(JQ(this)||1)||this[Ur]>0)}[Sp](A){vQ(this),this.once("connect",A)}[Pp](A,t){let r=A.origin||this[ne].origin,n=new mp(r,A,t);return this[WA].push(n),this[ze]||(_e.bodyLength(n.body)==null&&_e.isIterable(n.body)?(this[ze]=1,queueMicrotask(()=>xi(this))):this[br](!0)),this[ze]&&this[Ne]!==2&&this[Yi]&&(this[Ne]=2),this[Ne]<2}async[Wp](){return new Promise(A=>{this[Nr]?this[be]=A:A(null)})}async[Op](A){return new Promise(t=>{let r=this[WA].splice(this[OA]);for(let o=0;o<r.length;o++){let s=r[o];_e.errorRequest(this,s,A)}let n=()=>{this[be]&&(this[be](),this[be]=null),t(null)};this[eA]?(this[eA].destroy(A,n),this[eA]=null):queueMicrotask(n),this[br]()})}},jp=eo();function xQ(e,A){if(e[Sr]===0&&A.code!=="UND_ERR_INFO"&&A.code!=="UND_ERR_SOCKET"){Be(e[OA]===e[Ie]);let t=e[WA].splice(e[Ie]);for(let r=0;r<t.length;r++){let n=t[r];_e.errorRequest(e,n,A)}Be(e[Nr]===0)}}async function vQ(e){Be(!e[Tt]),Be(!e[eA]);let{host:A,hostname:t,protocol:r,port:n}=e[ne];if(t[0]==="["){let o=t.indexOf("]");Be(o!==-1);let s=t.substring(1,o);Be(GQ.isIP(s)),t=s}e[Tt]=!0,Lt.beforeConnect.hasSubscribers&&Lt.beforeConnect.publish({connectParams:{host:A,hostname:t,protocol:r,port:n,version:e[eA]?.version,servername:e[Re],localAddress:e[Rr]},connector:e[Fr]});try{let o=await new Promise((s,i)=>{e[Fr]({host:A,hostname:t,protocol:r,port:n,servername:e[Re],localAddress:e[Rr]},(a,g)=>{a?i(a):s(g)})});if(e.destroyed){_e.destroy(o.on("error",TQ),new Rp);return}Be(o);try{e[eA]=o.alpnProtocol==="h2"?await Xp(e,o):await Kp(e,o)}catch(s){throw o.destroy().on("error",TQ),s}e[Tt]=!1,o[qp]=0,o[Gi]=e[Gi],o[Np]=e,o[Lp]=null,Lt.connected.hasSubscribers&&Lt.connected.publish({connectParams:{host:A,hostname:t,protocol:r,port:n,version:e[eA]?.version,servername:e[Re],localAddress:e[Rr]},connector:e[Fr],socket:o}),e.emit("connect",e[ne],[e])}catch(o){if(e.destroyed)return;if(e[Tt]=!1,Lt.connectError.hasSubscribers&&Lt.connectError.publish({connectParams:{host:A,hostname:t,protocol:r,port:n,version:e[eA]?.version,servername:e[Re],localAddress:e[Rr]},connector:e[Fr],error:o}),o.code==="ERR_TLS_CERT_ALTNAME_INVALID")for(Be(e[Sr]===0);e[Ur]>0&&e[WA][e[OA]].servername===e[Re];){let s=e[WA][e[OA]++];_e.errorRequest(e,s,o)}else xQ(e,o);e.emit("connectionError",e[ne],[e],o)}e[br]()}function YQ(e){e[Ne]=0,e.emit("drain",e[ne],[e])}function xi(e,A){e[ze]!==2&&(e[ze]=2,$p(e,A),e[ze]=0,e[Ie]>256&&(e[WA].splice(0,e[Ie]),e[OA]-=e[Ie],e[Ie]=0))}function $p(e,A){for(;;){if(e.destroyed){Be(e[Ur]===0);return}if(e[be]&&!e[Nr]){e[be](),e[be]=null;return}if(e[eA]&&e[eA].resume(),e[Yi])e[Ne]=2;else if(e[Ne]===2){A?(e[Ne]=1,queueMicrotask(()=>YQ(e))):YQ(e);continue}if(e[Ur]===0||e[Sr]>=(JQ(e)||1))return;let t=e[WA][e[OA]];if(e[ne].protocol==="https:"&&e[Re]!==t.servername){if(e[Sr]>0)return;e[Re]=t.servername,e[eA]?.destroy(new Fp("servername changed"),()=>{e[eA]=null,xi(e)})}if(e[Tt])return;if(!e[eA]){vQ(e);return}if(e[eA].destroyed||e[eA].busy(t))return;!t.aborted&&e[eA].write(t)?e[OA]++:e[WA].splice(e[OA],1)}}HQ.exports=Ji});var vi=f((sU,VQ)=>{"use strict";var ro=class{constructor(){this.bottom=0,this.top=0,this.list=new Array(2048),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(A){this.list[this.top]=A,this.top=this.top+1&2047}shift(){let A=this.list[this.bottom];return A===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&2047,A)}};VQ.exports=class{constructor(){this.head=this.tail=new ro}isEmpty(){return this.head.isEmpty()}push(A){this.head.isFull()&&(this.head=this.head.next=new ro),this.head.push(A)}shift(){let A=this.tail,t=A.shift();return A.isEmpty()&&A.next!==null&&(this.tail=A.next),t}}});var WQ=f((iU,qQ)=>{var{kFree:AD,kConnected:eD,kPending:tD,kQueued:rD,kRunning:nD,kSize:oD}=Z(),Ze=Symbol("pool"),Hi=class{constructor(A){this[Ze]=A}get connected(){return this[Ze][eD]}get free(){return this[Ze][AD]}get pending(){return this[Ze][tD]}get queued(){return this[Ze][rD]}get running(){return this[Ze][nD]}get size(){return this[Ze][oD]}};qQ.exports=Hi});var _i=f((aU,AE)=>{"use strict";var sD=ft(),iD=vi(),{kConnected:Vi,kSize:OQ,kRunning:PQ,kPending:_Q,kQueued:Mr,kBusy:aD,kFree:gD,kUrl:cD,kClose:lD,kDestroy:QD,kDispatch:ED}=Z(),BD=WQ(),dA=Symbol("clients"),IA=Symbol("needDrain"),Lr=Symbol("queue"),qi=Symbol("closed resolve"),Wi=Symbol("onDrain"),zQ=Symbol("onConnect"),ZQ=Symbol("onDisconnect"),KQ=Symbol("onConnectionError"),Oi=Symbol("get dispatcher"),jQ=Symbol("add client"),$Q=Symbol("remove client"),XQ=Symbol("stats"),Pi=class extends sD{constructor(A){super(A),this[Lr]=new iD,this[dA]=[],this[Mr]=0;let t=this;this[Wi]=function(n,o){let s=t[Lr],i=!1;for(;!i;){let a=s.shift();if(!a)break;t[Mr]--,i=!this.dispatch(a.opts,a.handler)}this[IA]=i,!this[IA]&&t[IA]&&(t[IA]=!1,t.emit("drain",n,[t,...o])),t[qi]&&s.isEmpty()&&Promise.all(t[dA].map(a=>a.close())).then(t[qi])},this[zQ]=(r,n)=>{t.emit("connect",r,[t,...n])},this[ZQ]=(r,n,o)=>{t.emit("disconnect",r,[t,...n],o)},this[KQ]=(r,n,o)=>{t.emit("connectionError",r,[t,...n],o)},this[XQ]=new BD(this)}get[aD](){return this[IA]}get[Vi](){return this[dA].filter(A=>A[Vi]).length}get[gD](){return this[dA].filter(A=>A[Vi]&&!A[IA]).length}get[_Q](){let A=this[Mr];for(let{[_Q]:t}of this[dA])A+=t;return A}get[PQ](){let A=0;for(let{[PQ]:t}of this[dA])A+=t;return A}get[OQ](){let A=this[Mr];for(let{[OQ]:t}of this[dA])A+=t;return A}get stats(){return this[XQ]}async[lD](){this[Lr].isEmpty()?await Promise.all(this[dA].map(A=>A.close())):await new Promise(A=>{this[qi]=A})}async[QD](A){for(;;){let t=this[Lr].shift();if(!t)break;t.handler.onError(A)}await Promise.all(this[dA].map(t=>t.destroy(A)))}[ED](A,t){let r=this[Oi]();return r?r.dispatch(A,t)||(r[IA]=!0,this[IA]=!this[Oi]()):(this[IA]=!0,this[Lr].push({opts:A,handler:t}),this[Mr]++),!this[IA]}[jQ](A){return A.on("drain",this[Wi]).on("connect",this[zQ]).on("disconnect",this[ZQ]).on("connectionError",this[KQ]),this[dA].push(A),this[IA]&&queueMicrotask(()=>{this[IA]&&this[Wi](A[cD],[this,A])}),this}[$Q](A){A.close(()=>{let t=this[dA].indexOf(A);t!==-1&&this[dA].splice(t,1)}),this[IA]=this[dA].some(t=>!t[IA]&&t.closed!==!0&&t.destroyed!==!0)}};AE.exports={PoolBase:Pi,kClients:dA,kNeedDrain:IA,kAddClient:jQ,kRemoveClient:$Q,kGetDispatcher:Oi}});var Gt=f((gU,nE)=>{"use strict";var{PoolBase:ID,kClients:no,kNeedDrain:CD,kAddClient:uD,kGetDispatcher:hD}=_i(),dD=Yt(),{InvalidArgumentError:zi}=H(),eE=G(),{kUrl:tE,kInterceptors:fD}=Z(),yD=Er(),Zi=Symbol("options"),Ki=Symbol("connections"),rE=Symbol("factory");function wD(e,A){return new dD(e,A)}var Xi=class extends ID{constructor(A,{connections:t,factory:r=wD,connect:n,connectTimeout:o,tls:s,maxCachedSessions:i,socketPath:a,autoSelectFamily:g,autoSelectFamilyAttemptTimeout:c,allowH2:l,...Q}={}){if(t!=null&&(!Number.isFinite(t)||t<0))throw new zi("invalid connections");if(typeof r!="function")throw new zi("factory must be a function.");if(n!=null&&typeof n!="function"&&typeof n!="object")throw new zi("connect must be a function or an object");typeof n!="function"&&(n=yD({...s,maxCachedSessions:i,allowH2:l,socketPath:a,timeout:o,...g?{autoSelectFamily:g,autoSelectFamilyAttemptTimeout:c}:void 0,...n})),super(Q),this[fD]=Q.interceptors?.Pool&&Array.isArray(Q.interceptors.Pool)?Q.interceptors.Pool:[],this[Ki]=t||null,this[tE]=eE.parseOrigin(A),this[Zi]={...eE.deepClone(Q),connect:n,allowH2:l},this[Zi].interceptors=Q.interceptors?{...Q.interceptors}:void 0,this[rE]=r,this.on("connectionError",(E,B,C)=>{for(let d of B){let I=this[no].indexOf(d);I!==-1&&this[no].splice(I,1)}})}[hD](){for(let A of this[no])if(!A[CD])return A;if(!this[Ki]||this[no].length<this[Ki]){let A=this[rE](this[tE],this[Zi]);return this[uD](A),A}}};nE.exports=Xi});var gE=f((cU,aE)=>{"use strict";var{BalancedPoolMissingUpstreamError:pD,InvalidArgumentError:DD}=H(),{PoolBase:mD,kClients:lA,kNeedDrain:Tr,kAddClient:kD,kRemoveClient:FD,kGetDispatcher:RD}=_i(),bD=Gt(),{kUrl:ji,kInterceptors:ND}=Z(),{parseOrigin:oE}=G(),sE=Symbol("factory"),oo=Symbol("options"),iE=Symbol("kGreatestCommonDivisor"),Ke=Symbol("kCurrentWeight"),Xe=Symbol("kIndex"),YA=Symbol("kWeight"),so=Symbol("kMaxWeightPerServer"),io=Symbol("kErrorPenalty");function SD(e,A){if(e===0)return A;for(;A!==0;){let t=A;A=e%A,e=t}return e}function UD(e,A){return new bD(e,A)}var $i=class extends mD{constructor(A=[],{factory:t=UD,...r}={}){if(super(),this[oo]=r,this[Xe]=-1,this[Ke]=0,this[so]=this[oo].maxWeightPerServer||100,this[io]=this[oo].errorPenalty||15,Array.isArray(A)||(A=[A]),typeof t!="function")throw new DD("factory must be a function.");this[ND]=r.interceptors?.BalancedPool&&Array.isArray(r.interceptors.BalancedPool)?r.interceptors.BalancedPool:[],this[sE]=t;for(let n of A)this.addUpstream(n);this._updateBalancedPoolStats()}addUpstream(A){let t=oE(A).origin;if(this[lA].find(n=>n[ji].origin===t&&n.closed!==!0&&n.destroyed!==!0))return this;let r=this[sE](t,Object.assign({},this[oo]));this[kD](r),r.on("connect",()=>{r[YA]=Math.min(this[so],r[YA]+this[io])}),r.on("connectionError",()=>{r[YA]=Math.max(1,r[YA]-this[io]),this._updateBalancedPoolStats()}),r.on("disconnect",(...n)=>{let o=n[2];o&&o.code==="UND_ERR_SOCKET"&&(r[YA]=Math.max(1,r[YA]-this[io]),this._updateBalancedPoolStats())});for(let n of this[lA])n[YA]=this[so];return this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let A=0;for(let t=0;t<this[lA].length;t++)A=SD(this[lA][t][YA],A);this[iE]=A}removeUpstream(A){let t=oE(A).origin,r=this[lA].find(n=>n[ji].origin===t&&n.closed!==!0&&n.destroyed!==!0);return r&&this[FD](r),this}get upstreams(){return this[lA].filter(A=>A.closed!==!0&&A.destroyed!==!0).map(A=>A[ji].origin)}[RD](){if(this[lA].length===0)throw new pD;if(!this[lA].find(o=>!o[Tr]&&o.closed!==!0&&o.destroyed!==!0)||this[lA].map(o=>o[Tr]).reduce((o,s)=>o&&s,!0))return;let r=0,n=this[lA].findIndex(o=>!o[Tr]);for(;r++<this[lA].length;){this[Xe]=(this[Xe]+1)%this[lA].length;let o=this[lA][this[Xe]];if(o[YA]>this[lA][n][YA]&&!o[Tr]&&(n=this[Xe]),this[Xe]===0&&(this[Ke]=this[Ke]-this[iE],this[Ke]<=0&&(this[Ke]=this[so])),o[YA]>=this[Ke]&&!o[Tr])return o}return this[Ke]=this[lA][n][YA],this[Xe]=n,this[lA][n]}};aE.exports=$i});var Jt=f((lU,CE)=>{"use strict";var{InvalidArgumentError:ao}=H(),{kClients:Se,kRunning:cE,kClose:MD,kDestroy:LD,kDispatch:TD,kInterceptors:YD}=Z(),GD=ft(),JD=Gt(),xD=Yt(),vD=G(),HD=eo(),lE=Symbol("onConnect"),QE=Symbol("onDisconnect"),EE=Symbol("onConnectionError"),VD=Symbol("maxRedirections"),BE=Symbol("onDrain"),IE=Symbol("factory"),Aa=Symbol("options");function qD(e,A){return A&&A.connections===1?new xD(e,A):new JD(e,A)}var ea=class extends GD{constructor({factory:A=qD,maxRedirections:t=0,connect:r,...n}={}){if(typeof A!="function")throw new ao("factory must be a function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new ao("connect must be a function or an object");if(!Number.isInteger(t)||t<0)throw new ao("maxRedirections must be a positive number");super(n),r&&typeof r!="function"&&(r={...r}),this[YD]=n.interceptors?.Agent&&Array.isArray(n.interceptors.Agent)?n.interceptors.Agent:[HD({maxRedirections:t})],this[Aa]={...vD.deepClone(n),connect:r},this[Aa].interceptors=n.interceptors?{...n.interceptors}:void 0,this[VD]=t,this[IE]=A,this[Se]=new Map,this[BE]=(o,s)=>{this.emit("drain",o,[this,...s])},this[lE]=(o,s)=>{this.emit("connect",o,[this,...s])},this[QE]=(o,s,i)=>{this.emit("disconnect",o,[this,...s],i)},this[EE]=(o,s,i)=>{this.emit("connectionError",o,[this,...s],i)}}get[cE](){let A=0;for(let t of this[Se].values())A+=t[cE];return A}[TD](A,t){let r;if(A.origin&&(typeof A.origin=="string"||A.origin instanceof URL))r=String(A.origin);else throw new ao("opts.origin must be a non-empty string or URL.");let n=this[Se].get(r);return n||(n=this[IE](A.origin,this[Aa]).on("drain",this[BE]).on("connect",this[lE]).on("disconnect",this[QE]).on("connectionError",this[EE]),this[Se].set(r,n)),n.dispatch(A,t)}async[MD](){let A=[];for(let t of this[Se].values())A.push(t.close());this[Se].clear(),await Promise.all(A)}async[LD](A){let t=[];for(let r of this[Se].values())t.push(r.destroy(A));this[Se].clear(),await Promise.all(t)}};CE.exports=ea});var sa=f((QU,FE)=>{"use strict";var{kProxy:ta,kClose:wE,kDestroy:pE,kDispatch:uE,kInterceptors:WD}=Z(),{URL:je}=h("node:url"),OD=Jt(),DE=Gt(),mE=ft(),{InvalidArgumentError:xt,RequestAbortedError:PD,SecureProxyConnectionError:_D}=H(),hE=Er(),kE=Yt(),go=Symbol("proxy agent"),co=Symbol("proxy client"),Ue=Symbol("proxy headers"),ra=Symbol("request tls settings"),dE=Symbol("proxy tls settings"),fE=Symbol("connect endpoint function"),yE=Symbol("tunnel proxy");function zD(e){return e==="https:"?443:80}function ZD(e,A){return new DE(e,A)}var KD=()=>{};function XD(e,A){return A.connections===1?new kE(e,A):new DE(e,A)}var na=class extends mE{#A;constructor(A,{headers:t={},connect:r,factory:n}){if(super(),!A)throw new xt("Proxy URL is mandatory");this[Ue]=t,n?this.#A=n(A,{connect:r}):this.#A=new kE(A,{connect:r})}[uE](A,t){let r=t.onHeaders;t.onHeaders=function(i,a,g){if(i===407){typeof t.onError=="function"&&t.onError(new xt("Proxy Authentication Required (407)"));return}r&&r.call(this,i,a,g)};let{origin:n,path:o="/",headers:s={}}=A;if(A.path=n+o,!("host"in s)&&!("Host"in s)){let{host:i}=new je(n);s.host=i}return A.headers={...this[Ue],...s},this.#A[uE](A,t)}async[wE](){return this.#A.close()}async[pE](A){return this.#A.destroy(A)}},oa=class extends mE{constructor(A){if(super(),!A||typeof A=="object"&&!(A instanceof je)&&!A.uri)throw new xt("Proxy uri is mandatory");let{clientFactory:t=ZD}=A;if(typeof t!="function")throw new xt("Proxy opts.clientFactory must be a function.");let{proxyTunnel:r=!0}=A,n=this.#A(A),{href:o,origin:s,port:i,protocol:a,username:g,password:c,hostname:l}=n;if(this[ta]={uri:o,protocol:a},this[WD]=A.interceptors?.ProxyAgent&&Array.isArray(A.interceptors.ProxyAgent)?A.interceptors.ProxyAgent:[],this[ra]=A.requestTls,this[dE]=A.proxyTls,this[Ue]=A.headers||{},this[yE]=r,A.auth&&A.token)throw new xt("opts.auth cannot be used in combination with opts.token");A.auth?this[Ue]["proxy-authorization"]=`Basic ${A.auth}`:A.token?this[Ue]["proxy-authorization"]=A.token:g&&c&&(this[Ue]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(g)}:${decodeURIComponent(c)}`).toString("base64")}`);let Q=hE({...A.proxyTls});this[fE]=hE({...A.requestTls});let E=A.factory||XD,B=(C,d)=>{let{protocol:I}=new je(C);return!this[yE]&&I==="http:"&&this[ta].protocol==="http:"?new na(this[ta].uri,{headers:this[Ue],connect:Q,factory:E}):E(C,d)};this[co]=t(n,{connect:Q}),this[go]=new OD({...A,factory:B,connect:async(C,d)=>{let I=C.host;C.port||(I+=`:${zD(C.protocol)}`);try{let{socket:u,statusCode:D}=await this[co].connect({origin:s,port:i,path:I,signal:C.signal,headers:{...this[Ue],host:C.host},servername:this[dE]?.servername||l});if(D!==200&&(u.on("error",KD).destroy(),d(new PD(`Proxy response (${D}) !== 200 when HTTP Tunneling`))),C.protocol!=="https:"){d(null,u);return}let p;this[ra]?p=this[ra].servername:p=C.servername,this[fE]({...C,servername:p,httpSocket:u},d)}catch(u){u.code==="ERR_TLS_CERT_ALTNAME_INVALID"?d(new _D(u)):d(u)}}})}dispatch(A,t){let r=jD(A.headers);if($D(r),r&&!("host"in r)&&!("Host"in r)){let{host:n}=new je(A.origin);r.host=n}return this[go].dispatch({...A,headers:r},t)}#A(A){return typeof A=="string"?new je(A):A instanceof je?A:new je(A.uri)}async[wE](){await this[go].close(),await this[co].close()}async[pE](){await this[go].destroy(),await this[co].destroy()}};function jD(e){if(Array.isArray(e)){let A={};for(let t=0;t<e.length;t+=2)A[e[t]]=e[t+1];return A}return e}function $D(e){if(e&&Object.keys(e).find(t=>t.toLowerCase()==="proxy-authorization"))throw new xt("Proxy-Authorization should be sent in ProxyAgent constructor")}FE.exports=oa});var ME=f((EU,UE)=>{"use strict";var A0=ft(),{kClose:e0,kDestroy:t0,kClosed:RE,kDestroyed:bE,kDispatch:r0,kNoProxyAgent:Yr,kHttpProxyAgent:Me,kHttpsProxyAgent:$e}=Z(),NE=sa(),n0=Jt(),o0={"http:":80,"https:":443},SE=!1,ia=class extends A0{#A=null;#e=null;#t=null;constructor(A={}){super(),this.#t=A,SE||(SE=!0,process.emitWarning("EnvHttpProxyAgent is experimental, expect them to change at any time.",{code:"UNDICI-EHPA"}));let{httpProxy:t,httpsProxy:r,noProxy:n,...o}=A;this[Yr]=new n0(o);let s=t??process.env.http_proxy??process.env.HTTP_PROXY;s?this[Me]=new NE({...o,uri:s}):this[Me]=this[Yr];let i=r??process.env.https_proxy??process.env.HTTPS_PROXY;i?this[$e]=new NE({...o,uri:i}):this[$e]=this[Me],this.#r()}[r0](A,t){let r=new URL(A.origin);return this.#o(r).dispatch(A,t)}async[e0](){await this[Yr].close(),this[Me][RE]||await this[Me].close(),this[$e][RE]||await this[$e].close()}async[t0](A){await this[Yr].destroy(A),this[Me][bE]||await this[Me].destroy(A),this[$e][bE]||await this[$e].destroy(A)}#o(A){let{protocol:t,host:r,port:n}=A;return r=r.replace(/:\d*$/,"").toLowerCase(),n=Number.parseInt(n,10)||o0[t]||0,this.#n(r,n)?t==="https:"?this[$e]:this[Me]:this[Yr]}#n(A,t){if(this.#s&&this.#r(),this.#e.length===0)return!0;if(this.#A==="*")return!1;for(let r=0;r<this.#e.length;r++){let n=this.#e[r];if(!(n.port&&n.port!==t)){if(/^[.*]/.test(n.hostname)){if(A.endsWith(n.hostname.replace(/^\*/,"")))return!1}else if(A===n.hostname)return!1}}return!0}#r(){let A=this.#t.noProxy??this.#i,t=A.split(/[,\s]/),r=[];for(let n=0;n<t.length;n++){let o=t[n];if(!o)continue;let s=o.match(/^(.+):(\d+)$/);r.push({hostname:(s?s[1]:o).toLowerCase(),port:s?Number.parseInt(s[2],10):0})}this.#A=A,this.#e=r}get#s(){return this.#t.noProxy!==void 0?!1:this.#A!==this.#i}get#i(){return process.env.no_proxy??process.env.NO_PROXY??""}};UE.exports=ia});var lo=f((BU,GE)=>{"use strict";var vt=h("node:assert"),{kRetryHandlerDefaultRetry:LE}=Z(),{RequestRetryError:Gr}=H(),{isDisturbed:TE,parseHeaders:s0,parseRangeHeader:YE,wrapRequestBody:i0}=G();function a0(e){let A=Date.now();return new Date(e).getTime()-A}var aa=class e{constructor(A,t){let{retryOptions:r,...n}=A,{retry:o,maxRetries:s,maxTimeout:i,minTimeout:a,timeoutFactor:g,methods:c,errorCodes:l,retryAfter:Q,statusCodes:E}=r??{};this.dispatch=t.dispatch,this.handler=t.handler,this.opts={...n,body:i0(A.body)},this.abort=null,this.aborted=!1,this.retryOpts={retry:o??e[LE],retryAfter:Q??!0,maxTimeout:i??30*1e3,minTimeout:a??500,timeoutFactor:g??2,maxRetries:s??5,methods:c??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:E??[500,502,503,504,429],errorCodes:l??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE","UND_ERR_SOCKET"]},this.retryCount=0,this.retryCountCheckpoint=0,this.start=0,this.end=null,this.etag=null,this.resume=null,this.handler.onConnect(B=>{this.aborted=!0,this.abort?this.abort(B):this.reason=B})}onRequestSent(){this.handler.onRequestSent&&this.handler.onRequestSent()}onUpgrade(A,t,r){this.handler.onUpgrade&&this.handler.onUpgrade(A,t,r)}onConnect(A){this.aborted?A(this.reason):this.abort=A}onBodySent(A){if(this.handler.onBodySent)return this.handler.onBodySent(A)}static[LE](A,{state:t,opts:r},n){let{statusCode:o,code:s,headers:i}=A,{method:a,retryOptions:g}=r,{maxRetries:c,minTimeout:l,maxTimeout:Q,timeoutFactor:E,statusCodes:B,errorCodes:C,methods:d}=g,{counter:I}=t;if(s&&s!=="UND_ERR_REQ_RETRY"&&!C.includes(s)){n(A);return}if(Array.isArray(d)&&!d.includes(a)){n(A);return}if(o!=null&&Array.isArray(B)&&!B.includes(o)){n(A);return}if(I>c){n(A);return}let u=i?.["retry-after"];u&&(u=Number(u),u=Number.isNaN(u)?a0(u):u*1e3);let D=u>0?Math.min(u,Q):Math.min(l*E**(I-1),Q);setTimeout(()=>n(null),D)}onHeaders(A,t,r,n){let o=s0(t);if(this.retryCount+=1,A>=300)return this.retryOpts.statusCodes.includes(A)===!1?this.handler.onHeaders(A,t,r,n):(this.abort(new Gr("Request failed",A,{headers:o,data:{count:this.retryCount}})),!1);if(this.resume!=null){if(this.resume=null,A!==206&&(this.start>0||A!==200))return this.abort(new Gr("server does not support the range header and the payload was partially consumed",A,{headers:o,data:{count:this.retryCount}})),!1;let i=YE(o["content-range"]);if(!i)return this.abort(new Gr("Content-Range mismatch",A,{headers:o,data:{count:this.retryCount}})),!1;if(this.etag!=null&&this.etag!==o.etag)return this.abort(new Gr("ETag mismatch",A,{headers:o,data:{count:this.retryCount}})),!1;let{start:a,size:g,end:c=g-1}=i;return vt(this.start===a,"content-range mismatch"),vt(this.end==null||this.end===c,"content-range mismatch"),this.resume=r,!0}if(this.end==null){if(A===206){let i=YE(o["content-range"]);if(i==null)return this.handler.onHeaders(A,t,r,n);let{start:a,size:g,end:c=g-1}=i;vt(a!=null&&Number.isFinite(a),"content-range mismatch"),vt(c!=null&&Number.isFinite(c),"invalid content-length"),this.start=a,this.end=c}if(this.end==null){let i=o["content-length"];this.end=i!=null?Number(i)-1:null}return vt(Number.isFinite(this.start)),vt(this.end==null||Number.isFinite(this.end),"invalid content-length"),this.resume=r,this.etag=o.etag!=null?o.etag:null,this.etag!=null&&this.etag.startsWith("W/")&&(this.etag=null),this.handler.onHeaders(A,t,r,n)}let s=new Gr("Request failed",A,{headers:o,data:{count:this.retryCount}});return this.abort(s),!1}onData(A){return this.start+=A.length,this.handler.onData(A)}onComplete(A){return this.retryCount=0,this.handler.onComplete(A)}onError(A){if(this.aborted||TE(this.opts.body))return this.handler.onError(A);this.retryCount-this.retryCountCheckpoint>0?this.retryCount=this.retryCountCheckpoint+(this.retryCount-this.retryCountCheckpoint):this.retryCount+=1,this.retryOpts.retry(A,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},t.bind(this));function t(r){if(r!=null||this.aborted||TE(this.opts.body))return this.handler.onError(r);if(this.start!==0){let n={range:`bytes=${this.start}-${this.end??""}`};this.etag!=null&&(n["if-match"]=this.etag),this.opts={...this.opts,headers:{...this.opts.headers,...n}}}try{this.retryCountCheckpoint=this.retryCount,this.dispatch(this.opts,this)}catch(n){this.handler.onError(n)}}}};GE.exports=aa});var xE=f((IU,JE)=>{"use strict";var g0=lr(),c0=lo(),ga=class extends g0{#A=null;#e=null;constructor(A,t={}){super(t),this.#A=A,this.#e=t}dispatch(A,t){let r=new c0({...A,retryOptions:this.#e},{dispatch:this.#A.dispatch.bind(this.#A),handler:t});return this.#A.dispatch(A,r)}close(){return this.#A.close()}destroy(){return this.#A.destroy()}};JE.exports=ga});var Ia=f((CU,zE)=>{"use strict";var WE=h("node:assert"),{Readable:l0}=h("node:stream"),{RequestAbortedError:OE,NotSupportedError:Q0,InvalidArgumentError:E0,AbortError:ca}=H(),PE=G(),{ReadableStreamFrom:B0}=G(),DA=Symbol("kConsume"),Jr=Symbol("kReading"),Le=Symbol("kBody"),vE=Symbol("kAbort"),_E=Symbol("kContentType"),HE=Symbol("kContentLength"),I0=()=>{},la=class extends l0{constructor({resume:A,abort:t,contentType:r="",contentLength:n,highWaterMark:o=64*1024}){super({autoDestroy:!0,read:A,highWaterMark:o}),this._readableState.dataEmitted=!1,this[vE]=t,this[DA]=null,this[Le]=null,this[_E]=r,this[HE]=n,this[Jr]=!1}destroy(A){return!A&&!this._readableState.endEmitted&&(A=new OE),A&&this[vE](),super.destroy(A)}_destroy(A,t){this[Jr]?t(A):setImmediate(()=>{t(A)})}on(A,...t){return(A==="data"||A==="readable")&&(this[Jr]=!0),super.on(A,...t)}addListener(A,...t){return this.on(A,...t)}off(A,...t){let r=super.off(A,...t);return(A==="data"||A==="readable")&&(this[Jr]=this.listenerCount("data")>0||this.listenerCount("readable")>0),r}removeListener(A,...t){return this.off(A,...t)}push(A){return this[DA]&&A!==null?(Ea(this[DA],A),this[Jr]?super.push(A):!0):super.push(A)}async text(){return xr(this,"text")}async json(){return xr(this,"json")}async blob(){return xr(this,"blob")}async bytes(){return xr(this,"bytes")}async arrayBuffer(){return xr(this,"arrayBuffer")}async formData(){throw new Q0}get bodyUsed(){return PE.isDisturbed(this)}get body(){return this[Le]||(this[Le]=B0(this),this[DA]&&(this[Le].getReader(),WE(this[Le].locked))),this[Le]}async dump(A){let t=Number.isFinite(A?.limit)?A.limit:131072,r=A?.signal;if(r!=null&&(typeof r!="object"||!("aborted"in r)))throw new E0("signal must be an AbortSignal");return r?.throwIfAborted(),this._readableState.closeEmitted?null:await new Promise((n,o)=>{this[HE]>t&&this.destroy(new ca);let s=()=>{this.destroy(r.reason??new ca)};r?.addEventListener("abort",s),this.on("close",function(){r?.removeEventListener("abort",s),r?.aborted?o(r.reason??new ca):n(null)}).on("error",I0).on("data",function(i){t-=i.length,t<=0&&this.destroy()}).resume()})}};function C0(e){return e[Le]&&e[Le].locked===!0||e[DA]}function u0(e){return PE.isDisturbed(e)||C0(e)}async function xr(e,A){return WE(!e[DA]),new Promise((t,r)=>{if(u0(e)){let n=e._readableState;n.destroyed&&n.closeEmitted===!1?e.on("error",o=>{r(o)}).on("close",()=>{r(new TypeError("unusable"))}):r(n.errored??new TypeError("unusable"))}else queueMicrotask(()=>{e[DA]={type:A,stream:e,resolve:t,reject:r,length:0,body:[]},e.on("error",function(n){Ba(this[DA],n)}).on("close",function(){this[DA].body!==null&&Ba(this[DA],new OE)}),h0(e[DA])})})}function h0(e){if(e.body===null)return;let{_readableState:A}=e.stream;if(A.bufferIndex){let t=A.bufferIndex,r=A.buffer.length;for(let n=t;n<r;n++)Ea(e,A.buffer[n])}else for(let t of A.buffer)Ea(e,t);for(A.endEmitted?qE(this[DA]):e.stream.on("end",function(){qE(this[DA])}),e.stream.resume();e.stream.read()!=null;);}function Qa(e,A){if(e.length===0||A===0)return"";let t=e.length===1?e[0]:Buffer.concat(e,A),r=t.length,n=r>2&&t[0]===239&&t[1]===187&&t[2]===191?3:0;return t.utf8Slice(n,r)}function VE(e,A){if(e.length===0||A===0)return new Uint8Array(0);if(e.length===1)return new Uint8Array(e[0]);let t=new Uint8Array(Buffer.allocUnsafeSlow(A).buffer),r=0;for(let n=0;n<e.length;++n){let o=e[n];t.set(o,r),r+=o.length}return t}function qE(e){let{type:A,body:t,resolve:r,stream:n,length:o}=e;try{A==="text"?r(Qa(t,o)):A==="json"?r(JSON.parse(Qa(t,o))):A==="arrayBuffer"?r(VE(t,o).buffer):A==="blob"?r(new Blob(t,{type:n[_E]})):A==="bytes"&&r(VE(t,o)),Ba(e)}catch(s){n.destroy(s)}}function Ea(e,A){e.length+=A.length,e.body.push(A)}function Ba(e,A){e.body!==null&&(A?e.reject(A):e.resolve(),e.type=null,e.stream=null,e.resolve=null,e.reject=null,e.length=0,e.body=null)}zE.exports={Readable:la,chunksDecode:Qa}});var Ca=f((uU,$E)=>{var d0=h("node:assert"),{ResponseStatusCodeError:ZE}=H(),{chunksDecode:KE}=Ia(),f0=128*1024;async function y0({callback:e,body:A,contentType:t,statusCode:r,statusMessage:n,headers:o}){d0(A);let s=[],i=0;try{for await(let l of A)if(s.push(l),i+=l.length,i>f0){s=[],i=0;break}}catch{s=[],i=0}let a=`Response status code ${r}${n?`: ${n}`:""}`;if(r===204||!t||!i){queueMicrotask(()=>e(new ZE(a,r,o)));return}let g=Error.stackTraceLimit;Error.stackTraceLimit=0;let c;try{XE(t)?c=JSON.parse(KE(s,i)):jE(t)&&(c=KE(s,i))}catch{}finally{Error.stackTraceLimit=g}queueMicrotask(()=>e(new ZE(a,r,o,c)))}var XE=e=>e.length>15&&e[11]==="/"&&e[0]==="a"&&e[1]==="p"&&e[2]==="p"&&e[3]==="l"&&e[4]==="i"&&e[5]==="c"&&e[6]==="a"&&e[7]==="t"&&e[8]==="i"&&e[9]==="o"&&e[10]==="n"&&e[12]==="j"&&e[13]==="s"&&e[14]==="o"&&e[15]==="n",jE=e=>e.length>4&&e[4]==="/"&&e[0]==="t"&&e[1]==="e"&&e[2]==="x"&&e[3]==="t";$E.exports={getResolveErrorBodyCallback:y0,isContentTypeApplicationJson:XE,isContentTypeText:jE}});var tB=f((hU,ua)=>{"use strict";var w0=h("node:assert"),{Readable:p0}=Ia(),{InvalidArgumentError:Ht,RequestAbortedError:AB}=H(),mA=G(),{getResolveErrorBodyCallback:D0}=Ca(),{AsyncResource:m0}=h("node:async_hooks"),Qo=class extends m0{constructor(A,t){if(!A||typeof A!="object")throw new Ht("invalid opts");let{signal:r,method:n,opaque:o,body:s,onInfo:i,responseHeaders:a,throwOnError:g,highWaterMark:c}=A;try{if(typeof t!="function")throw new Ht("invalid callback");if(c&&(typeof c!="number"||c<0))throw new Ht("invalid highWaterMark");if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new Ht("signal must be an EventEmitter or EventTarget");if(n==="CONNECT")throw new Ht("invalid method");if(i&&typeof i!="function")throw new Ht("invalid onInfo callback");super("UNDICI_REQUEST")}catch(l){throw mA.isStream(s)&&mA.destroy(s.on("error",mA.nop),l),l}this.method=n,this.responseHeaders=a||null,this.opaque=o||null,this.callback=t,this.res=null,this.abort=null,this.body=s,this.trailers={},this.context=null,this.onInfo=i||null,this.throwOnError=g,this.highWaterMark=c,this.signal=r,this.reason=null,this.removeAbortListener=null,mA.isStream(s)&&s.on("error",l=>{this.onError(l)}),this.signal&&(this.signal.aborted?this.reason=this.signal.reason??new AB:this.removeAbortListener=mA.addAbortListener(this.signal,()=>{this.reason=this.signal.reason??new AB,this.res?mA.destroy(this.res.on("error",mA.nop),this.reason):this.abort&&this.abort(this.reason),this.removeAbortListener&&(this.res?.off("close",this.removeAbortListener),this.removeAbortListener(),this.removeAbortListener=null)}))}onConnect(A,t){if(this.reason){A(this.reason);return}w0(this.callback),this.abort=A,this.context=t}onHeaders(A,t,r,n){let{callback:o,opaque:s,abort:i,context:a,responseHeaders:g,highWaterMark:c}=this,l=g==="raw"?mA.parseRawHeaders(t):mA.parseHeaders(t);if(A<200){this.onInfo&&this.onInfo({statusCode:A,headers:l});return}let Q=g==="raw"?mA.parseHeaders(t):l,E=Q["content-type"],B=Q["content-length"],C=new p0({resume:r,abort:i,contentType:E,contentLength:this.method!=="HEAD"&&B?Number(B):null,highWaterMark:c});this.removeAbortListener&&C.on("close",this.removeAbortListener),this.callback=null,this.res=C,o!==null&&(this.throwOnError&&A>=400?this.runInAsyncScope(D0,null,{callback:o,body:C,contentType:E,statusCode:A,statusMessage:n,headers:l}):this.runInAsyncScope(o,null,null,{statusCode:A,headers:l,trailers:this.trailers,opaque:s,body:C,context:a}))}onData(A){return this.res.push(A)}onComplete(A){mA.parseHeaders(A,this.trailers),this.res.push(null)}onError(A){let{res:t,callback:r,body:n,opaque:o}=this;r&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(r,null,A,{opaque:o})})),t&&(this.res=null,queueMicrotask(()=>{mA.destroy(t,A)})),n&&(this.body=null,mA.destroy(n,A)),this.removeAbortListener&&(t?.off("close",this.removeAbortListener),this.removeAbortListener(),this.removeAbortListener=null)}};function eB(e,A){if(A===void 0)return new Promise((t,r)=>{eB.call(this,e,(n,o)=>n?r(n):t(o))});try{this.dispatch(e,new Qo(e,A))}catch(t){if(typeof A!="function")throw t;let r=e?.opaque;queueMicrotask(()=>A(t,{opaque:r}))}}ua.exports=eB;ua.exports.RequestHandler=Qo});var vr=f((dU,oB)=>{var{addAbortListener:k0}=G(),{RequestAbortedError:F0}=H(),Vt=Symbol("kListener"),oe=Symbol("kSignal");function rB(e){e.abort?e.abort(e[oe]?.reason):e.reason=e[oe]?.reason??new F0,nB(e)}function R0(e,A){if(e.reason=null,e[oe]=null,e[Vt]=null,!!A){if(A.aborted){rB(e);return}e[oe]=A,e[Vt]=()=>{rB(e)},k0(e[oe],e[Vt])}}function nB(e){e[oe]&&("removeEventListener"in e[oe]?e[oe].removeEventListener("abort",e[Vt]):e[oe].removeListener("abort",e[Vt]),e[oe]=null,e[Vt]=null)}oB.exports={addSignal:R0,removeSignal:nB}});var gB=f((fU,aB)=>{"use strict";var b0=h("node:assert"),{finished:N0,PassThrough:S0}=h("node:stream"),{InvalidArgumentError:qt,InvalidReturnValueError:U0}=H(),PA=G(),{getResolveErrorBodyCallback:M0}=Ca(),{AsyncResource:L0}=h("node:async_hooks"),{addSignal:T0,removeSignal:sB}=vr(),ha=class extends L0{constructor(A,t,r){if(!A||typeof A!="object")throw new qt("invalid opts");let{signal:n,method:o,opaque:s,body:i,onInfo:a,responseHeaders:g,throwOnError:c}=A;try{if(typeof r!="function")throw new qt("invalid callback");if(typeof t!="function")throw new qt("invalid factory");if(n&&typeof n.on!="function"&&typeof n.addEventListener!="function")throw new qt("signal must be an EventEmitter or EventTarget");if(o==="CONNECT")throw new qt("invalid method");if(a&&typeof a!="function")throw new qt("invalid onInfo callback");super("UNDICI_STREAM")}catch(l){throw PA.isStream(i)&&PA.destroy(i.on("error",PA.nop),l),l}this.responseHeaders=g||null,this.opaque=s||null,this.factory=t,this.callback=r,this.res=null,this.abort=null,this.context=null,this.trailers=null,this.body=i,this.onInfo=a||null,this.throwOnError=c||!1,PA.isStream(i)&&i.on("error",l=>{this.onError(l)}),T0(this,n)}onConnect(A,t){if(this.reason){A(this.reason);return}b0(this.callback),this.abort=A,this.context=t}onHeaders(A,t,r,n){let{factory:o,opaque:s,context:i,callback:a,responseHeaders:g}=this,c=g==="raw"?PA.parseRawHeaders(t):PA.parseHeaders(t);if(A<200){this.onInfo&&this.onInfo({statusCode:A,headers:c});return}this.factory=null;let l;if(this.throwOnError&&A>=400){let B=(g==="raw"?PA.parseHeaders(t):c)["content-type"];l=new S0,this.callback=null,this.runInAsyncScope(M0,null,{callback:a,body:l,contentType:B,statusCode:A,statusMessage:n,headers:c})}else{if(o===null)return;if(l=this.runInAsyncScope(o,null,{statusCode:A,headers:c,opaque:s,context:i}),!l||typeof l.write!="function"||typeof l.end!="function"||typeof l.on!="function")throw new U0("expected Writable");N0(l,{readable:!1},E=>{let{callback:B,res:C,opaque:d,trailers:I,abort:u}=this;this.res=null,(E||!C.readable)&&PA.destroy(C,E),this.callback=null,this.runInAsyncScope(B,null,E||null,{opaque:d,trailers:I}),E&&u()})}return l.on("drain",r),this.res=l,(l.writableNeedDrain!==void 0?l.writableNeedDrain:l._writableState?.needDrain)!==!0}onData(A){let{res:t}=this;return t?t.write(A):!0}onComplete(A){let{res:t}=this;sB(this),t&&(this.trailers=PA.parseHeaders(A),t.end())}onError(A){let{res:t,callback:r,opaque:n,body:o}=this;sB(this),this.factory=null,t?(this.res=null,PA.destroy(t,A)):r&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(r,null,A,{opaque:n})})),o&&(this.body=null,PA.destroy(o,A))}};function iB(e,A,t){if(t===void 0)return new Promise((r,n)=>{iB.call(this,e,A,(o,s)=>o?n(o):r(s))});try{this.dispatch(e,new ha(e,A,t))}catch(r){if(typeof t!="function")throw r;let n=e?.opaque;queueMicrotask(()=>t(r,{opaque:n}))}}aB.exports=iB});var EB=f((yU,QB)=>{"use strict";var{Readable:lB,Duplex:Y0,PassThrough:G0}=h("node:stream"),{InvalidArgumentError:Hr,InvalidReturnValueError:J0,RequestAbortedError:da}=H(),GA=G(),{AsyncResource:x0}=h("node:async_hooks"),{addSignal:v0,removeSignal:H0}=vr(),cB=h("node:assert"),Wt=Symbol("resume"),fa=class extends lB{constructor(){super({autoDestroy:!0}),this[Wt]=null}_read(){let{[Wt]:A}=this;A&&(this[Wt]=null,A())}_destroy(A,t){this._read(),t(A)}},ya=class extends lB{constructor(A){super({autoDestroy:!0}),this[Wt]=A}_read(){this[Wt]()}_destroy(A,t){!A&&!this._readableState.endEmitted&&(A=new da),t(A)}},wa=class extends x0{constructor(A,t){if(!A||typeof A!="object")throw new Hr("invalid opts");if(typeof t!="function")throw new Hr("invalid handler");let{signal:r,method:n,opaque:o,onInfo:s,responseHeaders:i}=A;if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new Hr("signal must be an EventEmitter or EventTarget");if(n==="CONNECT")throw new Hr("invalid method");if(s&&typeof s!="function")throw new Hr("invalid onInfo callback");super("UNDICI_PIPELINE"),this.opaque=o||null,this.responseHeaders=i||null,this.handler=t,this.abort=null,this.context=null,this.onInfo=s||null,this.req=new fa().on("error",GA.nop),this.ret=new Y0({readableObjectMode:A.objectMode,autoDestroy:!0,read:()=>{let{body:a}=this;a?.resume&&a.resume()},write:(a,g,c)=>{let{req:l}=this;l.push(a,g)||l._readableState.destroyed?c():l[Wt]=c},destroy:(a,g)=>{let{body:c,req:l,res:Q,ret:E,abort:B}=this;!a&&!E._readableState.endEmitted&&(a=new da),B&&a&&B(),GA.destroy(c,a),GA.destroy(l,a),GA.destroy(Q,a),H0(this),g(a)}}).on("prefinish",()=>{let{req:a}=this;a.push(null)}),this.res=null,v0(this,r)}onConnect(A,t){let{ret:r,res:n}=this;if(this.reason){A(this.reason);return}cB(!n,"pipeline cannot be retried"),cB(!r.destroyed),this.abort=A,this.context=t}onHeaders(A,t,r){let{opaque:n,handler:o,context:s}=this;if(A<200){if(this.onInfo){let a=this.responseHeaders==="raw"?GA.parseRawHeaders(t):GA.parseHeaders(t);this.onInfo({statusCode:A,headers:a})}return}this.res=new ya(r);let i;try{this.handler=null;let a=this.responseHeaders==="raw"?GA.parseRawHeaders(t):GA.parseHeaders(t);i=this.runInAsyncScope(o,null,{statusCode:A,headers:a,opaque:n,body:this.res,context:s})}catch(a){throw this.res.on("error",GA.nop),a}if(!i||typeof i.on!="function")throw new J0("expected Readable");i.on("data",a=>{let{ret:g,body:c}=this;!g.push(a)&&c.pause&&c.pause()}).on("error",a=>{let{ret:g}=this;GA.destroy(g,a)}).on("end",()=>{let{ret:a}=this;a.push(null)}).on("close",()=>{let{ret:a}=this;a._readableState.ended||GA.destroy(a,new da)}),this.body=i}onData(A){let{res:t}=this;return t.push(A)}onComplete(A){let{res:t}=this;t.push(null)}onError(A){let{ret:t}=this;this.handler=null,GA.destroy(t,A)}};function V0(e,A){try{let t=new wa(e,A);return this.dispatch({...e,body:t.req},t),t.ret}catch(t){return new G0().destroy(t)}}QB.exports=V0});var dB=f((wU,hB)=>{"use strict";var{InvalidArgumentError:pa,SocketError:q0}=H(),{AsyncResource:W0}=h("node:async_hooks"),BB=G(),{addSignal:O0,removeSignal:IB}=vr(),CB=h("node:assert"),Da=class extends W0{constructor(A,t){if(!A||typeof A!="object")throw new pa("invalid opts");if(typeof t!="function")throw new pa("invalid callback");let{signal:r,opaque:n,responseHeaders:o}=A;if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new pa("signal must be an EventEmitter or EventTarget");super("UNDICI_UPGRADE"),this.responseHeaders=o||null,this.opaque=n||null,this.callback=t,this.abort=null,this.context=null,O0(this,r)}onConnect(A,t){if(this.reason){A(this.reason);return}CB(this.callback),this.abort=A,this.context=null}onHeaders(){throw new q0("bad upgrade",null)}onUpgrade(A,t,r){CB(A===101);let{callback:n,opaque:o,context:s}=this;IB(this),this.callback=null;let i=this.responseHeaders==="raw"?BB.parseRawHeaders(t):BB.parseHeaders(t);this.runInAsyncScope(n,null,null,{headers:i,socket:r,opaque:o,context:s})}onError(A){let{callback:t,opaque:r}=this;IB(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,A,{opaque:r})}))}};function uB(e,A){if(A===void 0)return new Promise((t,r)=>{uB.call(this,e,(n,o)=>n?r(n):t(o))});try{let t=new Da(e,A);this.dispatch({...e,method:e.method||"GET",upgrade:e.protocol||"Websocket"},t)}catch(t){if(typeof A!="function")throw t;let r=e?.opaque;queueMicrotask(()=>A(t,{opaque:r}))}}hB.exports=uB});var DB=f((pU,pB)=>{"use strict";var P0=h("node:assert"),{AsyncResource:_0}=h("node:async_hooks"),{InvalidArgumentError:ma,SocketError:z0}=H(),fB=G(),{addSignal:Z0,removeSignal:yB}=vr(),ka=class extends _0{constructor(A,t){if(!A||typeof A!="object")throw new ma("invalid opts");if(typeof t!="function")throw new ma("invalid callback");let{signal:r,opaque:n,responseHeaders:o}=A;if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new ma("signal must be an EventEmitter or EventTarget");super("UNDICI_CONNECT"),this.opaque=n||null,this.responseHeaders=o||null,this.callback=t,this.abort=null,Z0(this,r)}onConnect(A,t){if(this.reason){A(this.reason);return}P0(this.callback),this.abort=A,this.context=t}onHeaders(){throw new z0("bad connect",null)}onUpgrade(A,t,r){let{callback:n,opaque:o,context:s}=this;yB(this),this.callback=null;let i=t;i!=null&&(i=this.responseHeaders==="raw"?fB.parseRawHeaders(t):fB.parseHeaders(t)),this.runInAsyncScope(n,null,null,{statusCode:A,headers:i,socket:r,opaque:o,context:s})}onError(A){let{callback:t,opaque:r}=this;yB(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,A,{opaque:r})}))}};function wB(e,A){if(A===void 0)return new Promise((t,r)=>{wB.call(this,e,(n,o)=>n?r(n):t(o))});try{let t=new ka(e,A);this.dispatch({...e,method:"CONNECT"},t)}catch(t){if(typeof A!="function")throw t;let r=e?.opaque;queueMicrotask(()=>A(t,{opaque:r}))}}pB.exports=wB});var mB=f((DU,Ot)=>{"use strict";Ot.exports.request=tB();Ot.exports.stream=gB();Ot.exports.pipeline=EB();Ot.exports.upgrade=dB();Ot.exports.connect=DB()});var Ra=f((mU,FB)=>{"use strict";var{UndiciError:K0}=H(),kB=Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED"),Fa=class e extends K0{constructor(A){super(A),Error.captureStackTrace(this,e),this.name="MockNotMatchedError",this.message=A||"The request does not match any registered mock dispatches",this.code="UND_MOCK_ERR_MOCK_NOT_MATCHED"}static[Symbol.hasInstance](A){return A&&A[kB]===!0}[kB]=!0};FB.exports={MockNotMatchedError:Fa}});var Pt=f((kU,RB)=>{"use strict";RB.exports={kAgent:Symbol("agent"),kOptions:Symbol("options"),kFactory:Symbol("factory"),kDispatches:Symbol("dispatches"),kDispatchKey:Symbol("dispatch key"),kDefaultHeaders:Symbol("default headers"),kDefaultTrailers:Symbol("default trailers"),kContentLength:Symbol("content length"),kMockAgent:Symbol("mock agent"),kMockAgentSet:Symbol("mock agent set"),kMockAgentGet:Symbol("mock agent get"),kMockDispatch:Symbol("mock dispatch"),kClose:Symbol("close"),kOriginalClose:Symbol("original agent close"),kOrigin:Symbol("origin"),kIsMockActive:Symbol("is mock active"),kNetConnect:Symbol("net connect"),kGetNetConnect:Symbol("get net connect"),kConnected:Symbol("connected")}});var Vr=f((FU,xB)=>{"use strict";var{MockNotMatchedError:At}=Ra(),{kDispatches:Eo,kMockAgent:X0,kOriginalDispatch:j0,kOrigin:$0,kGetNetConnect:Am}=Pt(),{buildURL:em}=G(),{STATUS_CODES:tm}=h("node:http"),{types:{isPromise:rm}}=h("node:util");function Ce(e,A){return typeof e=="string"?e===A:e instanceof RegExp?e.test(A):typeof e=="function"?e(A)===!0:!1}function NB(e){return Object.fromEntries(Object.entries(e).map(([A,t])=>[A.toLocaleLowerCase(),t]))}function SB(e,A){if(Array.isArray(e)){for(let t=0;t<e.length;t+=2)if(e[t].toLocaleLowerCase()===A.toLocaleLowerCase())return e[t+1];return}else return typeof e.get=="function"?e.get(A):NB(e)[A.toLocaleLowerCase()]}function Sa(e){let A=e.slice(),t=[];for(let r=0;r<A.length;r+=2)t.push([A[r],A[r+1]]);return Object.fromEntries(t)}function UB(e,A){if(typeof e.headers=="function")return Array.isArray(A)&&(A=Sa(A)),e.headers(A?NB(A):{});if(typeof e.headers>"u")return!0;if(typeof A!="object"||typeof e.headers!="object")return!1;for(let[t,r]of Object.entries(e.headers)){let n=SB(A,t);if(!Ce(r,n))return!1}return!0}function bB(e){if(typeof e!="string")return e;let A=e.split("?");if(A.length!==2)return e;let t=new URLSearchParams(A.pop());return t.sort(),[...A,t.toString()].join("?")}function nm(e,{path:A,method:t,body:r,headers:n}){let o=Ce(e.path,A),s=Ce(e.method,t),i=typeof e.body<"u"?Ce(e.body,r):!0,a=UB(e,n);return o&&s&&i&&a}function MB(e){return Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer?e:typeof e=="object"?JSON.stringify(e):e.toString()}function LB(e,A){let t=A.query?em(A.path,A.query):A.path,r=typeof t=="string"?bB(t):t,n=e.filter(({consumed:o})=>!o).filter(({path:o})=>Ce(bB(o),r));if(n.length===0)throw new At(`Mock dispatch not matched for path '${r}'`);if(n=n.filter(({method:o})=>Ce(o,A.method)),n.length===0)throw new At(`Mock dispatch not matched for method '${A.method}' on path '${r}'`);if(n=n.filter(({body:o})=>typeof o<"u"?Ce(o,A.body):!0),n.length===0)throw new At(`Mock dispatch not matched for body '${A.body}' on path '${r}'`);if(n=n.filter(o=>UB(o,A.headers)),n.length===0){let o=typeof A.headers=="object"?JSON.stringify(A.headers):A.headers;throw new At(`Mock dispatch not matched for headers '${o}' on path '${r}'`)}return n[0]}function om(e,A,t){let r={timesInvoked:0,times:1,persist:!1,consumed:!1},n=typeof t=="function"?{callback:t}:{...t},o={...r,...A,pending:!0,data:{error:null,...n}};return e.push(o),o}function ba(e,A){let t=e.findIndex(r=>r.consumed?nm(r,A):!1);t!==-1&&e.splice(t,1)}function TB(e){let{path:A,method:t,body:r,headers:n,query:o}=e;return{path:A,method:t,body:r,headers:n,query:o}}function Na(e){let A=Object.keys(e),t=[];for(let r=0;r<A.length;++r){let n=A[r],o=e[n],s=Buffer.from(`${n}`);if(Array.isArray(o))for(let i=0;i<o.length;++i)t.push(s,Buffer.from(`${o[i]}`));else t.push(s,Buffer.from(`${o}`))}return t}function YB(e){return tm[e]||"unknown"}async function sm(e){let A=[];for await(let t of e)A.push(t);return Buffer.concat(A).toString("utf8")}function GB(e,A){let t=TB(e),r=LB(this[Eo],t);r.timesInvoked++,r.data.callback&&(r.data={...r.data,...r.data.callback(e)});let{data:{statusCode:n,data:o,headers:s,trailers:i,error:a},delay:g,persist:c}=r,{timesInvoked:l,times:Q}=r;if(r.consumed=!c&&l>=Q,r.pending=l<Q,a!==null)return ba(this[Eo],t),A.onError(a),!0;typeof g=="number"&&g>0?setTimeout(()=>{E(this[Eo])},g):E(this[Eo]);function E(C,d=o){let I=Array.isArray(e.headers)?Sa(e.headers):e.headers,u=typeof d=="function"?d({...e,headers:I}):d;if(rm(u)){u.then(L=>E(C,L));return}let D=MB(u),p=Na(s),F=Na(i);A.onConnect?.(L=>A.onError(L),null),A.onHeaders?.(n,p,B,YB(n)),A.onData?.(Buffer.from(D)),A.onComplete?.(F),ba(C,t)}function B(){}return!0}function im(){let e=this[X0],A=this[$0],t=this[j0];return function(n,o){if(e.isMockActive)try{GB.call(this,n,o)}catch(s){if(s instanceof At){let i=e[Am]();if(i===!1)throw new At(`${s.message}: subsequent request to origin ${A} was not allowed (net.connect disabled)`);if(JB(i,A))t.call(this,n,o);else throw new At(`${s.message}: subsequent request to origin ${A} was not allowed (net.connect is not enabled for this origin)`)}else throw s}else t.call(this,n,o)}}function JB(e,A){let t=new URL(A);return e===!0?!0:!!(Array.isArray(e)&&e.some(r=>Ce(r,t.host)))}function am(e){if(e){let{agent:A,...t}=e;return t}}xB.exports={getResponseData:MB,getMockDispatch:LB,addMockDispatch:om,deleteMockDispatch:ba,buildKey:TB,generateKeyValues:Na,matchValue:Ce,getResponse:sm,getStatusText:YB,mockDispatch:GB,buildMockDispatch:im,checkNetConnect:JB,buildMockOptions:am,getHeaderByName:SB,buildHeadersFromArray:Sa}});var Ja=f((RU,Ga)=>{"use strict";var{getResponseData:gm,buildKey:cm,addMockDispatch:Ua}=Vr(),{kDispatches:Bo,kDispatchKey:Io,kDefaultHeaders:Ma,kDefaultTrailers:La,kContentLength:Ta,kMockDispatch:Co}=Pt(),{InvalidArgumentError:se}=H(),{buildURL:lm}=G(),_t=class{constructor(A){this[Co]=A}delay(A){if(typeof A!="number"||!Number.isInteger(A)||A<=0)throw new se("waitInMs must be a valid integer > 0");return this[Co].delay=A,this}persist(){return this[Co].persist=!0,this}times(A){if(typeof A!="number"||!Number.isInteger(A)||A<=0)throw new se("repeatTimes must be a valid integer > 0");return this[Co].times=A,this}},Ya=class{constructor(A,t){if(typeof A!="object")throw new se("opts must be an object");if(typeof A.path>"u")throw new se("opts.path must be defined");if(typeof A.method>"u"&&(A.method="GET"),typeof A.path=="string")if(A.query)A.path=lm(A.path,A.query);else{let r=new URL(A.path,"data://");A.path=r.pathname+r.search}typeof A.method=="string"&&(A.method=A.method.toUpperCase()),this[Io]=cm(A),this[Bo]=t,this[Ma]={},this[La]={},this[Ta]=!1}createMockScopeDispatchData({statusCode:A,data:t,responseOptions:r}){let n=gm(t),o=this[Ta]?{"content-length":n.length}:{},s={...this[Ma],...o,...r.headers},i={...this[La],...r.trailers};return{statusCode:A,data:t,headers:s,trailers:i}}validateReplyParameters(A){if(typeof A.statusCode>"u")throw new se("statusCode must be defined");if(typeof A.responseOptions!="object"||A.responseOptions===null)throw new se("responseOptions must be an object")}reply(A){if(typeof A=="function"){let o=i=>{let a=A(i);if(typeof a!="object"||a===null)throw new se("reply options callback must return an object");let g={data:"",responseOptions:{},...a};return this.validateReplyParameters(g),{...this.createMockScopeDispatchData(g)}},s=Ua(this[Bo],this[Io],o);return new _t(s)}let t={statusCode:A,data:arguments[1]===void 0?"":arguments[1],responseOptions:arguments[2]===void 0?{}:arguments[2]};this.validateReplyParameters(t);let r=this.createMockScopeDispatchData(t),n=Ua(this[Bo],this[Io],r);return new _t(n)}replyWithError(A){if(typeof A>"u")throw new se("error must be defined");let t=Ua(this[Bo],this[Io],{error:A});return new _t(t)}defaultReplyHeaders(A){if(typeof A>"u")throw new se("headers must be defined");return this[Ma]=A,this}defaultReplyTrailers(A){if(typeof A>"u")throw new se("trailers must be defined");return this[La]=A,this}replyContentLength(){return this[Ta]=!0,this}};Ga.exports.MockInterceptor=Ya;Ga.exports.MockScope=_t});var Ha=f((bU,PB)=>{"use strict";var{promisify:Qm}=h("node:util"),Em=Yt(),{buildMockDispatch:Bm}=Vr(),{kDispatches:vB,kMockAgent:HB,kClose:VB,kOriginalClose:qB,kOrigin:WB,kOriginalDispatch:Im,kConnected:xa}=Pt(),{MockInterceptor:Cm}=Ja(),OB=Z(),{InvalidArgumentError:um}=H(),va=class extends Em{constructor(A,t){if(super(A,t),!t||!t.agent||typeof t.agent.dispatch!="function")throw new um("Argument opts.agent must implement Agent");this[HB]=t.agent,this[WB]=A,this[vB]=[],this[xa]=1,this[Im]=this.dispatch,this[qB]=this.close.bind(this),this.dispatch=Bm.call(this),this.close=this[VB]}get[OB.kConnected](){return this[xa]}intercept(A){return new Cm(A,this[vB])}async[VB](){await Qm(this[qB])(),this[xa]=0,this[HB][OB.kClients].delete(this[WB])}};PB.exports=va});var Wa=f((NU,$B)=>{"use strict";var{promisify:hm}=h("node:util"),dm=Gt(),{buildMockDispatch:fm}=Vr(),{kDispatches:_B,kMockAgent:zB,kClose:ZB,kOriginalClose:KB,kOrigin:XB,kOriginalDispatch:ym,kConnected:Va}=Pt(),{MockInterceptor:wm}=Ja(),jB=Z(),{InvalidArgumentError:pm}=H(),qa=class extends dm{constructor(A,t){if(super(A,t),!t||!t.agent||typeof t.agent.dispatch!="function")throw new pm("Argument opts.agent must implement Agent");this[zB]=t.agent,this[XB]=A,this[_B]=[],this[Va]=1,this[ym]=this.dispatch,this[KB]=this.close.bind(this),this.dispatch=fm.call(this),this.close=this[ZB]}get[jB.kConnected](){return this[Va]}intercept(A){return new wm(A,this[_B])}async[ZB](){await hm(this[KB])(),this[Va]=0,this[zB][jB.kClients].delete(this[XB])}};$B.exports=qa});var eI=f((UU,AI)=>{"use strict";var Dm={pronoun:"it",is:"is",was:"was",this:"this"},mm={pronoun:"they",is:"are",was:"were",this:"these"};AI.exports=class{constructor(A,t){this.singular=A,this.plural=t}pluralize(A){let t=A===1,r=t?Dm:mm,n=t?this.singular:this.plural;return{...r,count:A,noun:n}}}});var rI=f((LU,tI)=>{"use strict";var{Transform:km}=h("node:stream"),{Console:Fm}=h("node:console"),Rm=process.versions.icu?"\u2705":"Y ",bm=process.versions.icu?"\u274C":"N ";tI.exports=class{constructor({disableColors:A}={}){this.transform=new km({transform(t,r,n){n(null,t)}}),this.logger=new Fm({stdout:this.transform,inspectOptions:{colors:!A&&!process.env.CI}})}format(A){let t=A.map(({method:r,path:n,data:{statusCode:o},persist:s,times:i,timesInvoked:a,origin:g})=>({Method:r,Origin:g,Path:n,"Status code":o,Persistent:s?Rm:bm,Invocations:a,Remaining:s?1/0:i-a}));return this.logger.table(t),this.transform.read().toString()}}});var iI=f((TU,sI)=>{"use strict";var{kClients:et}=Z(),Nm=Jt(),{kAgent:Oa,kMockAgentSet:uo,kMockAgentGet:nI,kDispatches:Pa,kIsMockActive:ho,kNetConnect:tt,kGetNetConnect:Sm,kOptions:fo,kFactory:yo}=Pt(),Um=Ha(),Mm=Wa(),{matchValue:Lm,buildMockOptions:Tm}=Vr(),{InvalidArgumentError:oI,UndiciError:Ym}=H(),Gm=lr(),Jm=eI(),xm=rI(),_a=class extends Gm{constructor(A){if(super(A),this[tt]=!0,this[ho]=!0,A?.agent&&typeof A.agent.dispatch!="function")throw new oI("Argument opts.agent must implement Agent");let t=A?.agent?A.agent:new Nm(A);this[Oa]=t,this[et]=t[et],this[fo]=Tm(A)}get(A){let t=this[nI](A);return t||(t=this[yo](A),this[uo](A,t)),t}dispatch(A,t){return this.get(A.origin),this[Oa].dispatch(A,t)}async close(){await this[Oa].close(),this[et].clear()}deactivate(){this[ho]=!1}activate(){this[ho]=!0}enableNetConnect(A){if(typeof A=="string"||typeof A=="function"||A instanceof RegExp)Array.isArray(this[tt])?this[tt].push(A):this[tt]=[A];else if(typeof A>"u")this[tt]=!0;else throw new oI("Unsupported matcher. Must be one of String|Function|RegExp.")}disableNetConnect(){this[tt]=!1}get isMockActive(){return this[ho]}[uo](A,t){this[et].set(A,t)}[yo](A){let t=Object.assign({agent:this},this[fo]);return this[fo]&&this[fo].connections===1?new Um(A,t):new Mm(A,t)}[nI](A){let t=this[et].get(A);if(t)return t;if(typeof A!="string"){let r=this[yo]("http://localhost:9999");return this[uo](A,r),r}for(let[r,n]of Array.from(this[et]))if(n&&typeof r!="string"&&Lm(r,A)){let o=this[yo](A);return this[uo](A,o),o[Pa]=n[Pa],o}}[Sm](){return this[tt]}pendingInterceptors(){let A=this[et];return Array.from(A.entries()).flatMap(([t,r])=>r[Pa].map(n=>({...n,origin:t}))).filter(({pending:t})=>t)}assertNoPendingInterceptors({pendingInterceptorsFormatter:A=new xm}={}){let t=this.pendingInterceptors();if(t.length===0)return;let r=new Jm("interceptor","interceptors").pluralize(t.length);throw new Ym(`
|
|
42
|
+
`,this[vp]=a??3e5,this[xp]=n??3e5,this[Hp]=u??!0,this[Vp]=p,this[Gi]=L,this[be]=null,this[_p]=$>-1?$:-1,this[Zp]=ye??100,this[eA]=null,this[WA]=[],this[Ie]=0,this[OA]=0,this[br]=Bt=>xi(this,Bt),this[zp]=Bt=>xQ(this,Bt)}get pipelining(){return this[to]}set pipelining(A){this[to]=A,this[br](!0)}get[Ur](){return this[WA].length-this[OA]}get[Sr](){return this[OA]-this[Ie]}get[Nr](){return this[WA].length-this[Ie]}get[Up](){return!!this[eA]&&!this[Tt]&&!this[eA].destroyed}get[Yi](){return!!(this[eA]?.busy(null)||this[Nr]>=(JQ(this)||1)||this[Ur]>0)}[Sp](A){vQ(this),this.once("connect",A)}[Pp](A,t){let r=A.origin||this[ne].origin,n=new mp(r,A,t);return this[WA].push(n),this[ze]||(_e.bodyLength(n.body)==null&&_e.isIterable(n.body)?(this[ze]=1,queueMicrotask(()=>xi(this))):this[br](!0)),this[ze]&&this[Ne]!==2&&this[Yi]&&(this[Ne]=2),this[Ne]<2}async[Wp](){return new Promise(A=>{this[Nr]?this[be]=A:A(null)})}async[Op](A){return new Promise(t=>{let r=this[WA].splice(this[OA]);for(let o=0;o<r.length;o++){let s=r[o];_e.errorRequest(this,s,A)}let n=()=>{this[be]&&(this[be](),this[be]=null),t(null)};this[eA]?(this[eA].destroy(A,n),this[eA]=null):queueMicrotask(n),this[br]()})}},jp=eo();function xQ(e,A){if(e[Sr]===0&&A.code!=="UND_ERR_INFO"&&A.code!=="UND_ERR_SOCKET"){Be(e[OA]===e[Ie]);let t=e[WA].splice(e[Ie]);for(let r=0;r<t.length;r++){let n=t[r];_e.errorRequest(e,n,A)}Be(e[Nr]===0)}}async function vQ(e){Be(!e[Tt]),Be(!e[eA]);let{host:A,hostname:t,protocol:r,port:n}=e[ne];if(t[0]==="["){let o=t.indexOf("]");Be(o!==-1);let s=t.substring(1,o);Be(GQ.isIP(s)),t=s}e[Tt]=!0,Lt.beforeConnect.hasSubscribers&&Lt.beforeConnect.publish({connectParams:{host:A,hostname:t,protocol:r,port:n,version:e[eA]?.version,servername:e[Re],localAddress:e[Rr]},connector:e[Fr]});try{let o=await new Promise((s,i)=>{e[Fr]({host:A,hostname:t,protocol:r,port:n,servername:e[Re],localAddress:e[Rr]},(a,g)=>{a?i(a):s(g)})});if(e.destroyed){_e.destroy(o.on("error",TQ),new Rp);return}Be(o);try{e[eA]=o.alpnProtocol==="h2"?await Xp(e,o):await Kp(e,o)}catch(s){throw o.destroy().on("error",TQ),s}e[Tt]=!1,o[qp]=0,o[Gi]=e[Gi],o[Np]=e,o[Lp]=null,Lt.connected.hasSubscribers&&Lt.connected.publish({connectParams:{host:A,hostname:t,protocol:r,port:n,version:e[eA]?.version,servername:e[Re],localAddress:e[Rr]},connector:e[Fr],socket:o}),e.emit("connect",e[ne],[e])}catch(o){if(e.destroyed)return;if(e[Tt]=!1,Lt.connectError.hasSubscribers&&Lt.connectError.publish({connectParams:{host:A,hostname:t,protocol:r,port:n,version:e[eA]?.version,servername:e[Re],localAddress:e[Rr]},connector:e[Fr],error:o}),o.code==="ERR_TLS_CERT_ALTNAME_INVALID")for(Be(e[Sr]===0);e[Ur]>0&&e[WA][e[OA]].servername===e[Re];){let s=e[WA][e[OA]++];_e.errorRequest(e,s,o)}else xQ(e,o);e.emit("connectionError",e[ne],[e],o)}e[br]()}function YQ(e){e[Ne]=0,e.emit("drain",e[ne],[e])}function xi(e,A){e[ze]!==2&&(e[ze]=2,$p(e,A),e[ze]=0,e[Ie]>256&&(e[WA].splice(0,e[Ie]),e[OA]-=e[Ie],e[Ie]=0))}function $p(e,A){for(;;){if(e.destroyed){Be(e[Ur]===0);return}if(e[be]&&!e[Nr]){e[be](),e[be]=null;return}if(e[eA]&&e[eA].resume(),e[Yi])e[Ne]=2;else if(e[Ne]===2){A?(e[Ne]=1,queueMicrotask(()=>YQ(e))):YQ(e);continue}if(e[Ur]===0||e[Sr]>=(JQ(e)||1))return;let t=e[WA][e[OA]];if(e[ne].protocol==="https:"&&e[Re]!==t.servername){if(e[Sr]>0)return;e[Re]=t.servername,e[eA]?.destroy(new Fp("servername changed"),()=>{e[eA]=null,xi(e)})}if(e[Tt])return;if(!e[eA]){vQ(e);return}if(e[eA].destroyed||e[eA].busy(t))return;!t.aborted&&e[eA].write(t)?e[OA]++:e[WA].splice(e[OA],1)}}HQ.exports=Ji});var vi=f((sU,VQ)=>{"use strict";var ro=class{constructor(){this.bottom=0,this.top=0,this.list=new Array(2048),this.next=null}isEmpty(){return this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(A){this.list[this.top]=A,this.top=this.top+1&2047}shift(){let A=this.list[this.bottom];return A===void 0?null:(this.list[this.bottom]=void 0,this.bottom=this.bottom+1&2047,A)}};VQ.exports=class{constructor(){this.head=this.tail=new ro}isEmpty(){return this.head.isEmpty()}push(A){this.head.isFull()&&(this.head=this.head.next=new ro),this.head.push(A)}shift(){let A=this.tail,t=A.shift();return A.isEmpty()&&A.next!==null&&(this.tail=A.next),t}}});var WQ=f((iU,qQ)=>{var{kFree:AD,kConnected:eD,kPending:tD,kQueued:rD,kRunning:nD,kSize:oD}=Z(),Ze=Symbol("pool"),Hi=class{constructor(A){this[Ze]=A}get connected(){return this[Ze][eD]}get free(){return this[Ze][AD]}get pending(){return this[Ze][tD]}get queued(){return this[Ze][rD]}get running(){return this[Ze][nD]}get size(){return this[Ze][oD]}};qQ.exports=Hi});var _i=f((aU,AE)=>{"use strict";var sD=ft(),iD=vi(),{kConnected:Vi,kSize:OQ,kRunning:PQ,kPending:_Q,kQueued:Mr,kBusy:aD,kFree:gD,kUrl:cD,kClose:lD,kDestroy:QD,kDispatch:ED}=Z(),BD=WQ(),dA=Symbol("clients"),IA=Symbol("needDrain"),Lr=Symbol("queue"),qi=Symbol("closed resolve"),Wi=Symbol("onDrain"),zQ=Symbol("onConnect"),ZQ=Symbol("onDisconnect"),KQ=Symbol("onConnectionError"),Oi=Symbol("get dispatcher"),jQ=Symbol("add client"),$Q=Symbol("remove client"),XQ=Symbol("stats"),Pi=class extends sD{constructor(A){super(A),this[Lr]=new iD,this[dA]=[],this[Mr]=0;let t=this;this[Wi]=function(n,o){let s=t[Lr],i=!1;for(;!i;){let a=s.shift();if(!a)break;t[Mr]--,i=!this.dispatch(a.opts,a.handler)}this[IA]=i,!this[IA]&&t[IA]&&(t[IA]=!1,t.emit("drain",n,[t,...o])),t[qi]&&s.isEmpty()&&Promise.all(t[dA].map(a=>a.close())).then(t[qi])},this[zQ]=(r,n)=>{t.emit("connect",r,[t,...n])},this[ZQ]=(r,n,o)=>{t.emit("disconnect",r,[t,...n],o)},this[KQ]=(r,n,o)=>{t.emit("connectionError",r,[t,...n],o)},this[XQ]=new BD(this)}get[aD](){return this[IA]}get[Vi](){return this[dA].filter(A=>A[Vi]).length}get[gD](){return this[dA].filter(A=>A[Vi]&&!A[IA]).length}get[_Q](){let A=this[Mr];for(let{[_Q]:t}of this[dA])A+=t;return A}get[PQ](){let A=0;for(let{[PQ]:t}of this[dA])A+=t;return A}get[OQ](){let A=this[Mr];for(let{[OQ]:t}of this[dA])A+=t;return A}get stats(){return this[XQ]}async[lD](){this[Lr].isEmpty()?await Promise.all(this[dA].map(A=>A.close())):await new Promise(A=>{this[qi]=A})}async[QD](A){for(;;){let t=this[Lr].shift();if(!t)break;t.handler.onError(A)}await Promise.all(this[dA].map(t=>t.destroy(A)))}[ED](A,t){let r=this[Oi]();return r?r.dispatch(A,t)||(r[IA]=!0,this[IA]=!this[Oi]()):(this[IA]=!0,this[Lr].push({opts:A,handler:t}),this[Mr]++),!this[IA]}[jQ](A){return A.on("drain",this[Wi]).on("connect",this[zQ]).on("disconnect",this[ZQ]).on("connectionError",this[KQ]),this[dA].push(A),this[IA]&&queueMicrotask(()=>{this[IA]&&this[Wi](A[cD],[this,A])}),this}[$Q](A){A.close(()=>{let t=this[dA].indexOf(A);t!==-1&&this[dA].splice(t,1)}),this[IA]=this[dA].some(t=>!t[IA]&&t.closed!==!0&&t.destroyed!==!0)}};AE.exports={PoolBase:Pi,kClients:dA,kNeedDrain:IA,kAddClient:jQ,kRemoveClient:$Q,kGetDispatcher:Oi}});var Gt=f((gU,nE)=>{"use strict";var{PoolBase:ID,kClients:no,kNeedDrain:CD,kAddClient:uD,kGetDispatcher:hD}=_i(),dD=Yt(),{InvalidArgumentError:zi}=H(),eE=G(),{kUrl:tE,kInterceptors:fD}=Z(),yD=Er(),Zi=Symbol("options"),Ki=Symbol("connections"),rE=Symbol("factory");function wD(e,A){return new dD(e,A)}var Xi=class extends ID{constructor(A,{connections:t,factory:r=wD,connect:n,connectTimeout:o,tls:s,maxCachedSessions:i,socketPath:a,autoSelectFamily:g,autoSelectFamilyAttemptTimeout:c,allowH2:l,...Q}={}){if(t!=null&&(!Number.isFinite(t)||t<0))throw new zi("invalid connections");if(typeof r!="function")throw new zi("factory must be a function.");if(n!=null&&typeof n!="function"&&typeof n!="object")throw new zi("connect must be a function or an object");typeof n!="function"&&(n=yD({...s,maxCachedSessions:i,allowH2:l,socketPath:a,timeout:o,...g?{autoSelectFamily:g,autoSelectFamilyAttemptTimeout:c}:void 0,...n})),super(Q),this[fD]=Q.interceptors?.Pool&&Array.isArray(Q.interceptors.Pool)?Q.interceptors.Pool:[],this[Ki]=t||null,this[tE]=eE.parseOrigin(A),this[Zi]={...eE.deepClone(Q),connect:n,allowH2:l},this[Zi].interceptors=Q.interceptors?{...Q.interceptors}:void 0,this[rE]=r,this.on("connectionError",(E,B,C)=>{for(let d of B){let I=this[no].indexOf(d);I!==-1&&this[no].splice(I,1)}})}[hD](){for(let A of this[no])if(!A[CD])return A;if(!this[Ki]||this[no].length<this[Ki]){let A=this[rE](this[tE],this[Zi]);return this[uD](A),A}}};nE.exports=Xi});var gE=f((cU,aE)=>{"use strict";var{BalancedPoolMissingUpstreamError:pD,InvalidArgumentError:DD}=H(),{PoolBase:mD,kClients:lA,kNeedDrain:Tr,kAddClient:kD,kRemoveClient:FD,kGetDispatcher:RD}=_i(),bD=Gt(),{kUrl:ji,kInterceptors:ND}=Z(),{parseOrigin:oE}=G(),sE=Symbol("factory"),oo=Symbol("options"),iE=Symbol("kGreatestCommonDivisor"),Ke=Symbol("kCurrentWeight"),Xe=Symbol("kIndex"),YA=Symbol("kWeight"),so=Symbol("kMaxWeightPerServer"),io=Symbol("kErrorPenalty");function SD(e,A){if(e===0)return A;for(;A!==0;){let t=A;A=e%A,e=t}return e}function UD(e,A){return new bD(e,A)}var $i=class extends mD{constructor(A=[],{factory:t=UD,...r}={}){if(super(),this[oo]=r,this[Xe]=-1,this[Ke]=0,this[so]=this[oo].maxWeightPerServer||100,this[io]=this[oo].errorPenalty||15,Array.isArray(A)||(A=[A]),typeof t!="function")throw new DD("factory must be a function.");this[ND]=r.interceptors?.BalancedPool&&Array.isArray(r.interceptors.BalancedPool)?r.interceptors.BalancedPool:[],this[sE]=t;for(let n of A)this.addUpstream(n);this._updateBalancedPoolStats()}addUpstream(A){let t=oE(A).origin;if(this[lA].find(n=>n[ji].origin===t&&n.closed!==!0&&n.destroyed!==!0))return this;let r=this[sE](t,Object.assign({},this[oo]));this[kD](r),r.on("connect",()=>{r[YA]=Math.min(this[so],r[YA]+this[io])}),r.on("connectionError",()=>{r[YA]=Math.max(1,r[YA]-this[io]),this._updateBalancedPoolStats()}),r.on("disconnect",(...n)=>{let o=n[2];o&&o.code==="UND_ERR_SOCKET"&&(r[YA]=Math.max(1,r[YA]-this[io]),this._updateBalancedPoolStats())});for(let n of this[lA])n[YA]=this[so];return this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let A=0;for(let t=0;t<this[lA].length;t++)A=SD(this[lA][t][YA],A);this[iE]=A}removeUpstream(A){let t=oE(A).origin,r=this[lA].find(n=>n[ji].origin===t&&n.closed!==!0&&n.destroyed!==!0);return r&&this[FD](r),this}get upstreams(){return this[lA].filter(A=>A.closed!==!0&&A.destroyed!==!0).map(A=>A[ji].origin)}[RD](){if(this[lA].length===0)throw new pD;if(!this[lA].find(o=>!o[Tr]&&o.closed!==!0&&o.destroyed!==!0)||this[lA].map(o=>o[Tr]).reduce((o,s)=>o&&s,!0))return;let r=0,n=this[lA].findIndex(o=>!o[Tr]);for(;r++<this[lA].length;){this[Xe]=(this[Xe]+1)%this[lA].length;let o=this[lA][this[Xe]];if(o[YA]>this[lA][n][YA]&&!o[Tr]&&(n=this[Xe]),this[Xe]===0&&(this[Ke]=this[Ke]-this[iE],this[Ke]<=0&&(this[Ke]=this[so])),o[YA]>=this[Ke]&&!o[Tr])return o}return this[Ke]=this[lA][n][YA],this[Xe]=n,this[lA][n]}};aE.exports=$i});var Jt=f((lU,CE)=>{"use strict";var{InvalidArgumentError:ao}=H(),{kClients:Se,kRunning:cE,kClose:MD,kDestroy:LD,kDispatch:TD,kInterceptors:YD}=Z(),GD=ft(),JD=Gt(),xD=Yt(),vD=G(),HD=eo(),lE=Symbol("onConnect"),QE=Symbol("onDisconnect"),EE=Symbol("onConnectionError"),VD=Symbol("maxRedirections"),BE=Symbol("onDrain"),IE=Symbol("factory"),Aa=Symbol("options");function qD(e,A){return A&&A.connections===1?new xD(e,A):new JD(e,A)}var ea=class extends GD{constructor({factory:A=qD,maxRedirections:t=0,connect:r,...n}={}){if(typeof A!="function")throw new ao("factory must be a function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new ao("connect must be a function or an object");if(!Number.isInteger(t)||t<0)throw new ao("maxRedirections must be a positive number");super(n),r&&typeof r!="function"&&(r={...r}),this[YD]=n.interceptors?.Agent&&Array.isArray(n.interceptors.Agent)?n.interceptors.Agent:[HD({maxRedirections:t})],this[Aa]={...vD.deepClone(n),connect:r},this[Aa].interceptors=n.interceptors?{...n.interceptors}:void 0,this[VD]=t,this[IE]=A,this[Se]=new Map,this[BE]=(o,s)=>{this.emit("drain",o,[this,...s])},this[lE]=(o,s)=>{this.emit("connect",o,[this,...s])},this[QE]=(o,s,i)=>{this.emit("disconnect",o,[this,...s],i)},this[EE]=(o,s,i)=>{this.emit("connectionError",o,[this,...s],i)}}get[cE](){let A=0;for(let t of this[Se].values())A+=t[cE];return A}[TD](A,t){let r;if(A.origin&&(typeof A.origin=="string"||A.origin instanceof URL))r=String(A.origin);else throw new ao("opts.origin must be a non-empty string or URL.");let n=this[Se].get(r);return n||(n=this[IE](A.origin,this[Aa]).on("drain",this[BE]).on("connect",this[lE]).on("disconnect",this[QE]).on("connectionError",this[EE]),this[Se].set(r,n)),n.dispatch(A,t)}async[MD](){let A=[];for(let t of this[Se].values())A.push(t.close());this[Se].clear(),await Promise.all(A)}async[LD](A){let t=[];for(let r of this[Se].values())t.push(r.destroy(A));this[Se].clear(),await Promise.all(t)}};CE.exports=ea});var sa=f((QU,FE)=>{"use strict";var{kProxy:ta,kClose:wE,kDestroy:pE,kDispatch:uE,kInterceptors:WD}=Z(),{URL:je}=h("node:url"),OD=Jt(),DE=Gt(),mE=ft(),{InvalidArgumentError:xt,RequestAbortedError:PD,SecureProxyConnectionError:_D}=H(),hE=Er(),kE=Yt(),go=Symbol("proxy agent"),co=Symbol("proxy client"),Ue=Symbol("proxy headers"),ra=Symbol("request tls settings"),dE=Symbol("proxy tls settings"),fE=Symbol("connect endpoint function"),yE=Symbol("tunnel proxy");function zD(e){return e==="https:"?443:80}function ZD(e,A){return new DE(e,A)}var KD=()=>{};function XD(e,A){return A.connections===1?new kE(e,A):new DE(e,A)}var na=class extends mE{#A;constructor(A,{headers:t={},connect:r,factory:n}){if(super(),!A)throw new xt("Proxy URL is mandatory");this[Ue]=t,n?this.#A=n(A,{connect:r}):this.#A=new kE(A,{connect:r})}[uE](A,t){let r=t.onHeaders;t.onHeaders=function(i,a,g){if(i===407){typeof t.onError=="function"&&t.onError(new xt("Proxy Authentication Required (407)"));return}r&&r.call(this,i,a,g)};let{origin:n,path:o="/",headers:s={}}=A;if(A.path=n+o,!("host"in s)&&!("Host"in s)){let{host:i}=new je(n);s.host=i}return A.headers={...this[Ue],...s},this.#A[uE](A,t)}async[wE](){return this.#A.close()}async[pE](A){return this.#A.destroy(A)}},oa=class extends mE{constructor(A){if(super(),!A||typeof A=="object"&&!(A instanceof je)&&!A.uri)throw new xt("Proxy uri is mandatory");let{clientFactory:t=ZD}=A;if(typeof t!="function")throw new xt("Proxy opts.clientFactory must be a function.");let{proxyTunnel:r=!0}=A,n=this.#A(A),{href:o,origin:s,port:i,protocol:a,username:g,password:c,hostname:l}=n;if(this[ta]={uri:o,protocol:a},this[WD]=A.interceptors?.ProxyAgent&&Array.isArray(A.interceptors.ProxyAgent)?A.interceptors.ProxyAgent:[],this[ra]=A.requestTls,this[dE]=A.proxyTls,this[Ue]=A.headers||{},this[yE]=r,A.auth&&A.token)throw new xt("opts.auth cannot be used in combination with opts.token");A.auth?this[Ue]["proxy-authorization"]=`Basic ${A.auth}`:A.token?this[Ue]["proxy-authorization"]=A.token:g&&c&&(this[Ue]["proxy-authorization"]=`Basic ${Buffer.from(`${decodeURIComponent(g)}:${decodeURIComponent(c)}`).toString("base64")}`);let Q=hE({...A.proxyTls});this[fE]=hE({...A.requestTls});let E=A.factory||XD,B=(C,d)=>{let{protocol:I}=new je(C);return!this[yE]&&I==="http:"&&this[ta].protocol==="http:"?new na(this[ta].uri,{headers:this[Ue],connect:Q,factory:E}):E(C,d)};this[co]=t(n,{connect:Q}),this[go]=new OD({...A,factory:B,connect:async(C,d)=>{let I=C.host;C.port||(I+=`:${zD(C.protocol)}`);try{let{socket:u,statusCode:D}=await this[co].connect({origin:s,port:i,path:I,signal:C.signal,headers:{...this[Ue],host:C.host},servername:this[dE]?.servername||l});if(D!==200&&(u.on("error",KD).destroy(),d(new PD(`Proxy response (${D}) !== 200 when HTTP Tunneling`))),C.protocol!=="https:"){d(null,u);return}let p;this[ra]?p=this[ra].servername:p=C.servername,this[fE]({...C,servername:p,httpSocket:u},d)}catch(u){u.code==="ERR_TLS_CERT_ALTNAME_INVALID"?d(new _D(u)):d(u)}}})}dispatch(A,t){let r=jD(A.headers);if($D(r),r&&!("host"in r)&&!("Host"in r)){let{host:n}=new je(A.origin);r.host=n}return this[go].dispatch({...A,headers:r},t)}#A(A){return typeof A=="string"?new je(A):A instanceof je?A:new je(A.uri)}async[wE](){await this[go].close(),await this[co].close()}async[pE](){await this[go].destroy(),await this[co].destroy()}};function jD(e){if(Array.isArray(e)){let A={};for(let t=0;t<e.length;t+=2)A[e[t]]=e[t+1];return A}return e}function $D(e){if(e&&Object.keys(e).find(t=>t.toLowerCase()==="proxy-authorization"))throw new xt("Proxy-Authorization should be sent in ProxyAgent constructor")}FE.exports=oa});var ME=f((EU,UE)=>{"use strict";var Am=ft(),{kClose:em,kDestroy:tm,kClosed:RE,kDestroyed:bE,kDispatch:rm,kNoProxyAgent:Yr,kHttpProxyAgent:Me,kHttpsProxyAgent:$e}=Z(),NE=sa(),nm=Jt(),om={"http:":80,"https:":443},SE=!1,ia=class extends Am{#A=null;#e=null;#t=null;constructor(A={}){super(),this.#t=A,SE||(SE=!0,process.emitWarning("EnvHttpProxyAgent is experimental, expect them to change at any time.",{code:"UNDICI-EHPA"}));let{httpProxy:t,httpsProxy:r,noProxy:n,...o}=A;this[Yr]=new nm(o);let s=t??process.env.http_proxy??process.env.HTTP_PROXY;s?this[Me]=new NE({...o,uri:s}):this[Me]=this[Yr];let i=r??process.env.https_proxy??process.env.HTTPS_PROXY;i?this[$e]=new NE({...o,uri:i}):this[$e]=this[Me],this.#r()}[rm](A,t){let r=new URL(A.origin);return this.#o(r).dispatch(A,t)}async[em](){await this[Yr].close(),this[Me][RE]||await this[Me].close(),this[$e][RE]||await this[$e].close()}async[tm](A){await this[Yr].destroy(A),this[Me][bE]||await this[Me].destroy(A),this[$e][bE]||await this[$e].destroy(A)}#o(A){let{protocol:t,host:r,port:n}=A;return r=r.replace(/:\d*$/,"").toLowerCase(),n=Number.parseInt(n,10)||om[t]||0,this.#n(r,n)?t==="https:"?this[$e]:this[Me]:this[Yr]}#n(A,t){if(this.#s&&this.#r(),this.#e.length===0)return!0;if(this.#A==="*")return!1;for(let r=0;r<this.#e.length;r++){let n=this.#e[r];if(!(n.port&&n.port!==t)){if(/^[.*]/.test(n.hostname)){if(A.endsWith(n.hostname.replace(/^\*/,"")))return!1}else if(A===n.hostname)return!1}}return!0}#r(){let A=this.#t.noProxy??this.#i,t=A.split(/[,\s]/),r=[];for(let n=0;n<t.length;n++){let o=t[n];if(!o)continue;let s=o.match(/^(.+):(\d+)$/);r.push({hostname:(s?s[1]:o).toLowerCase(),port:s?Number.parseInt(s[2],10):0})}this.#A=A,this.#e=r}get#s(){return this.#t.noProxy!==void 0?!1:this.#A!==this.#i}get#i(){return process.env.no_proxy??process.env.NO_PROXY??""}};UE.exports=ia});var lo=f((BU,GE)=>{"use strict";var vt=h("node:assert"),{kRetryHandlerDefaultRetry:LE}=Z(),{RequestRetryError:Gr}=H(),{isDisturbed:TE,parseHeaders:sm,parseRangeHeader:YE,wrapRequestBody:im}=G();function am(e){let A=Date.now();return new Date(e).getTime()-A}var aa=class e{constructor(A,t){let{retryOptions:r,...n}=A,{retry:o,maxRetries:s,maxTimeout:i,minTimeout:a,timeoutFactor:g,methods:c,errorCodes:l,retryAfter:Q,statusCodes:E}=r??{};this.dispatch=t.dispatch,this.handler=t.handler,this.opts={...n,body:im(A.body)},this.abort=null,this.aborted=!1,this.retryOpts={retry:o??e[LE],retryAfter:Q??!0,maxTimeout:i??30*1e3,minTimeout:a??500,timeoutFactor:g??2,maxRetries:s??5,methods:c??["GET","HEAD","OPTIONS","PUT","DELETE","TRACE"],statusCodes:E??[500,502,503,504,429],errorCodes:l??["ECONNRESET","ECONNREFUSED","ENOTFOUND","ENETDOWN","ENETUNREACH","EHOSTDOWN","EHOSTUNREACH","EPIPE","UND_ERR_SOCKET"]},this.retryCount=0,this.retryCountCheckpoint=0,this.start=0,this.end=null,this.etag=null,this.resume=null,this.handler.onConnect(B=>{this.aborted=!0,this.abort?this.abort(B):this.reason=B})}onRequestSent(){this.handler.onRequestSent&&this.handler.onRequestSent()}onUpgrade(A,t,r){this.handler.onUpgrade&&this.handler.onUpgrade(A,t,r)}onConnect(A){this.aborted?A(this.reason):this.abort=A}onBodySent(A){if(this.handler.onBodySent)return this.handler.onBodySent(A)}static[LE](A,{state:t,opts:r},n){let{statusCode:o,code:s,headers:i}=A,{method:a,retryOptions:g}=r,{maxRetries:c,minTimeout:l,maxTimeout:Q,timeoutFactor:E,statusCodes:B,errorCodes:C,methods:d}=g,{counter:I}=t;if(s&&s!=="UND_ERR_REQ_RETRY"&&!C.includes(s)){n(A);return}if(Array.isArray(d)&&!d.includes(a)){n(A);return}if(o!=null&&Array.isArray(B)&&!B.includes(o)){n(A);return}if(I>c){n(A);return}let u=i?.["retry-after"];u&&(u=Number(u),u=Number.isNaN(u)?am(u):u*1e3);let D=u>0?Math.min(u,Q):Math.min(l*E**(I-1),Q);setTimeout(()=>n(null),D)}onHeaders(A,t,r,n){let o=sm(t);if(this.retryCount+=1,A>=300)return this.retryOpts.statusCodes.includes(A)===!1?this.handler.onHeaders(A,t,r,n):(this.abort(new Gr("Request failed",A,{headers:o,data:{count:this.retryCount}})),!1);if(this.resume!=null){if(this.resume=null,A!==206&&(this.start>0||A!==200))return this.abort(new Gr("server does not support the range header and the payload was partially consumed",A,{headers:o,data:{count:this.retryCount}})),!1;let i=YE(o["content-range"]);if(!i)return this.abort(new Gr("Content-Range mismatch",A,{headers:o,data:{count:this.retryCount}})),!1;if(this.etag!=null&&this.etag!==o.etag)return this.abort(new Gr("ETag mismatch",A,{headers:o,data:{count:this.retryCount}})),!1;let{start:a,size:g,end:c=g-1}=i;return vt(this.start===a,"content-range mismatch"),vt(this.end==null||this.end===c,"content-range mismatch"),this.resume=r,!0}if(this.end==null){if(A===206){let i=YE(o["content-range"]);if(i==null)return this.handler.onHeaders(A,t,r,n);let{start:a,size:g,end:c=g-1}=i;vt(a!=null&&Number.isFinite(a),"content-range mismatch"),vt(c!=null&&Number.isFinite(c),"invalid content-length"),this.start=a,this.end=c}if(this.end==null){let i=o["content-length"];this.end=i!=null?Number(i)-1:null}return vt(Number.isFinite(this.start)),vt(this.end==null||Number.isFinite(this.end),"invalid content-length"),this.resume=r,this.etag=o.etag!=null?o.etag:null,this.etag!=null&&this.etag.startsWith("W/")&&(this.etag=null),this.handler.onHeaders(A,t,r,n)}let s=new Gr("Request failed",A,{headers:o,data:{count:this.retryCount}});return this.abort(s),!1}onData(A){return this.start+=A.length,this.handler.onData(A)}onComplete(A){return this.retryCount=0,this.handler.onComplete(A)}onError(A){if(this.aborted||TE(this.opts.body))return this.handler.onError(A);this.retryCount-this.retryCountCheckpoint>0?this.retryCount=this.retryCountCheckpoint+(this.retryCount-this.retryCountCheckpoint):this.retryCount+=1,this.retryOpts.retry(A,{state:{counter:this.retryCount},opts:{retryOptions:this.retryOpts,...this.opts}},t.bind(this));function t(r){if(r!=null||this.aborted||TE(this.opts.body))return this.handler.onError(r);if(this.start!==0){let n={range:`bytes=${this.start}-${this.end??""}`};this.etag!=null&&(n["if-match"]=this.etag),this.opts={...this.opts,headers:{...this.opts.headers,...n}}}try{this.retryCountCheckpoint=this.retryCount,this.dispatch(this.opts,this)}catch(n){this.handler.onError(n)}}}};GE.exports=aa});var xE=f((IU,JE)=>{"use strict";var gm=lr(),cm=lo(),ga=class extends gm{#A=null;#e=null;constructor(A,t={}){super(t),this.#A=A,this.#e=t}dispatch(A,t){let r=new cm({...A,retryOptions:this.#e},{dispatch:this.#A.dispatch.bind(this.#A),handler:t});return this.#A.dispatch(A,r)}close(){return this.#A.close()}destroy(){return this.#A.destroy()}};JE.exports=ga});var Ia=f((CU,zE)=>{"use strict";var WE=h("node:assert"),{Readable:lm}=h("node:stream"),{RequestAbortedError:OE,NotSupportedError:Qm,InvalidArgumentError:Em,AbortError:ca}=H(),PE=G(),{ReadableStreamFrom:Bm}=G(),DA=Symbol("kConsume"),Jr=Symbol("kReading"),Le=Symbol("kBody"),vE=Symbol("kAbort"),_E=Symbol("kContentType"),HE=Symbol("kContentLength"),Im=()=>{},la=class extends lm{constructor({resume:A,abort:t,contentType:r="",contentLength:n,highWaterMark:o=64*1024}){super({autoDestroy:!0,read:A,highWaterMark:o}),this._readableState.dataEmitted=!1,this[vE]=t,this[DA]=null,this[Le]=null,this[_E]=r,this[HE]=n,this[Jr]=!1}destroy(A){return!A&&!this._readableState.endEmitted&&(A=new OE),A&&this[vE](),super.destroy(A)}_destroy(A,t){this[Jr]?t(A):setImmediate(()=>{t(A)})}on(A,...t){return(A==="data"||A==="readable")&&(this[Jr]=!0),super.on(A,...t)}addListener(A,...t){return this.on(A,...t)}off(A,...t){let r=super.off(A,...t);return(A==="data"||A==="readable")&&(this[Jr]=this.listenerCount("data")>0||this.listenerCount("readable")>0),r}removeListener(A,...t){return this.off(A,...t)}push(A){return this[DA]&&A!==null?(Ea(this[DA],A),this[Jr]?super.push(A):!0):super.push(A)}async text(){return xr(this,"text")}async json(){return xr(this,"json")}async blob(){return xr(this,"blob")}async bytes(){return xr(this,"bytes")}async arrayBuffer(){return xr(this,"arrayBuffer")}async formData(){throw new Qm}get bodyUsed(){return PE.isDisturbed(this)}get body(){return this[Le]||(this[Le]=Bm(this),this[DA]&&(this[Le].getReader(),WE(this[Le].locked))),this[Le]}async dump(A){let t=Number.isFinite(A?.limit)?A.limit:131072,r=A?.signal;if(r!=null&&(typeof r!="object"||!("aborted"in r)))throw new Em("signal must be an AbortSignal");return r?.throwIfAborted(),this._readableState.closeEmitted?null:await new Promise((n,o)=>{this[HE]>t&&this.destroy(new ca);let s=()=>{this.destroy(r.reason??new ca)};r?.addEventListener("abort",s),this.on("close",function(){r?.removeEventListener("abort",s),r?.aborted?o(r.reason??new ca):n(null)}).on("error",Im).on("data",function(i){t-=i.length,t<=0&&this.destroy()}).resume()})}};function Cm(e){return e[Le]&&e[Le].locked===!0||e[DA]}function um(e){return PE.isDisturbed(e)||Cm(e)}async function xr(e,A){return WE(!e[DA]),new Promise((t,r)=>{if(um(e)){let n=e._readableState;n.destroyed&&n.closeEmitted===!1?e.on("error",o=>{r(o)}).on("close",()=>{r(new TypeError("unusable"))}):r(n.errored??new TypeError("unusable"))}else queueMicrotask(()=>{e[DA]={type:A,stream:e,resolve:t,reject:r,length:0,body:[]},e.on("error",function(n){Ba(this[DA],n)}).on("close",function(){this[DA].body!==null&&Ba(this[DA],new OE)}),hm(e[DA])})})}function hm(e){if(e.body===null)return;let{_readableState:A}=e.stream;if(A.bufferIndex){let t=A.bufferIndex,r=A.buffer.length;for(let n=t;n<r;n++)Ea(e,A.buffer[n])}else for(let t of A.buffer)Ea(e,t);for(A.endEmitted?qE(this[DA]):e.stream.on("end",function(){qE(this[DA])}),e.stream.resume();e.stream.read()!=null;);}function Qa(e,A){if(e.length===0||A===0)return"";let t=e.length===1?e[0]:Buffer.concat(e,A),r=t.length,n=r>2&&t[0]===239&&t[1]===187&&t[2]===191?3:0;return t.utf8Slice(n,r)}function VE(e,A){if(e.length===0||A===0)return new Uint8Array(0);if(e.length===1)return new Uint8Array(e[0]);let t=new Uint8Array(Buffer.allocUnsafeSlow(A).buffer),r=0;for(let n=0;n<e.length;++n){let o=e[n];t.set(o,r),r+=o.length}return t}function qE(e){let{type:A,body:t,resolve:r,stream:n,length:o}=e;try{A==="text"?r(Qa(t,o)):A==="json"?r(JSON.parse(Qa(t,o))):A==="arrayBuffer"?r(VE(t,o).buffer):A==="blob"?r(new Blob(t,{type:n[_E]})):A==="bytes"&&r(VE(t,o)),Ba(e)}catch(s){n.destroy(s)}}function Ea(e,A){e.length+=A.length,e.body.push(A)}function Ba(e,A){e.body!==null&&(A?e.reject(A):e.resolve(),e.type=null,e.stream=null,e.resolve=null,e.reject=null,e.length=0,e.body=null)}zE.exports={Readable:la,chunksDecode:Qa}});var Ca=f((uU,$E)=>{var dm=h("node:assert"),{ResponseStatusCodeError:ZE}=H(),{chunksDecode:KE}=Ia(),fm=128*1024;async function ym({callback:e,body:A,contentType:t,statusCode:r,statusMessage:n,headers:o}){dm(A);let s=[],i=0;try{for await(let l of A)if(s.push(l),i+=l.length,i>fm){s=[],i=0;break}}catch{s=[],i=0}let a=`Response status code ${r}${n?`: ${n}`:""}`;if(r===204||!t||!i){queueMicrotask(()=>e(new ZE(a,r,o)));return}let g=Error.stackTraceLimit;Error.stackTraceLimit=0;let c;try{XE(t)?c=JSON.parse(KE(s,i)):jE(t)&&(c=KE(s,i))}catch{}finally{Error.stackTraceLimit=g}queueMicrotask(()=>e(new ZE(a,r,o,c)))}var XE=e=>e.length>15&&e[11]==="/"&&e[0]==="a"&&e[1]==="p"&&e[2]==="p"&&e[3]==="l"&&e[4]==="i"&&e[5]==="c"&&e[6]==="a"&&e[7]==="t"&&e[8]==="i"&&e[9]==="o"&&e[10]==="n"&&e[12]==="j"&&e[13]==="s"&&e[14]==="o"&&e[15]==="n",jE=e=>e.length>4&&e[4]==="/"&&e[0]==="t"&&e[1]==="e"&&e[2]==="x"&&e[3]==="t";$E.exports={getResolveErrorBodyCallback:ym,isContentTypeApplicationJson:XE,isContentTypeText:jE}});var tB=f((hU,ua)=>{"use strict";var wm=h("node:assert"),{Readable:pm}=Ia(),{InvalidArgumentError:Ht,RequestAbortedError:AB}=H(),mA=G(),{getResolveErrorBodyCallback:Dm}=Ca(),{AsyncResource:mm}=h("node:async_hooks"),Qo=class extends mm{constructor(A,t){if(!A||typeof A!="object")throw new Ht("invalid opts");let{signal:r,method:n,opaque:o,body:s,onInfo:i,responseHeaders:a,throwOnError:g,highWaterMark:c}=A;try{if(typeof t!="function")throw new Ht("invalid callback");if(c&&(typeof c!="number"||c<0))throw new Ht("invalid highWaterMark");if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new Ht("signal must be an EventEmitter or EventTarget");if(n==="CONNECT")throw new Ht("invalid method");if(i&&typeof i!="function")throw new Ht("invalid onInfo callback");super("UNDICI_REQUEST")}catch(l){throw mA.isStream(s)&&mA.destroy(s.on("error",mA.nop),l),l}this.method=n,this.responseHeaders=a||null,this.opaque=o||null,this.callback=t,this.res=null,this.abort=null,this.body=s,this.trailers={},this.context=null,this.onInfo=i||null,this.throwOnError=g,this.highWaterMark=c,this.signal=r,this.reason=null,this.removeAbortListener=null,mA.isStream(s)&&s.on("error",l=>{this.onError(l)}),this.signal&&(this.signal.aborted?this.reason=this.signal.reason??new AB:this.removeAbortListener=mA.addAbortListener(this.signal,()=>{this.reason=this.signal.reason??new AB,this.res?mA.destroy(this.res.on("error",mA.nop),this.reason):this.abort&&this.abort(this.reason),this.removeAbortListener&&(this.res?.off("close",this.removeAbortListener),this.removeAbortListener(),this.removeAbortListener=null)}))}onConnect(A,t){if(this.reason){A(this.reason);return}wm(this.callback),this.abort=A,this.context=t}onHeaders(A,t,r,n){let{callback:o,opaque:s,abort:i,context:a,responseHeaders:g,highWaterMark:c}=this,l=g==="raw"?mA.parseRawHeaders(t):mA.parseHeaders(t);if(A<200){this.onInfo&&this.onInfo({statusCode:A,headers:l});return}let Q=g==="raw"?mA.parseHeaders(t):l,E=Q["content-type"],B=Q["content-length"],C=new pm({resume:r,abort:i,contentType:E,contentLength:this.method!=="HEAD"&&B?Number(B):null,highWaterMark:c});this.removeAbortListener&&C.on("close",this.removeAbortListener),this.callback=null,this.res=C,o!==null&&(this.throwOnError&&A>=400?this.runInAsyncScope(Dm,null,{callback:o,body:C,contentType:E,statusCode:A,statusMessage:n,headers:l}):this.runInAsyncScope(o,null,null,{statusCode:A,headers:l,trailers:this.trailers,opaque:s,body:C,context:a}))}onData(A){return this.res.push(A)}onComplete(A){mA.parseHeaders(A,this.trailers),this.res.push(null)}onError(A){let{res:t,callback:r,body:n,opaque:o}=this;r&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(r,null,A,{opaque:o})})),t&&(this.res=null,queueMicrotask(()=>{mA.destroy(t,A)})),n&&(this.body=null,mA.destroy(n,A)),this.removeAbortListener&&(t?.off("close",this.removeAbortListener),this.removeAbortListener(),this.removeAbortListener=null)}};function eB(e,A){if(A===void 0)return new Promise((t,r)=>{eB.call(this,e,(n,o)=>n?r(n):t(o))});try{this.dispatch(e,new Qo(e,A))}catch(t){if(typeof A!="function")throw t;let r=e?.opaque;queueMicrotask(()=>A(t,{opaque:r}))}}ua.exports=eB;ua.exports.RequestHandler=Qo});var vr=f((dU,oB)=>{var{addAbortListener:km}=G(),{RequestAbortedError:Fm}=H(),Vt=Symbol("kListener"),oe=Symbol("kSignal");function rB(e){e.abort?e.abort(e[oe]?.reason):e.reason=e[oe]?.reason??new Fm,nB(e)}function Rm(e,A){if(e.reason=null,e[oe]=null,e[Vt]=null,!!A){if(A.aborted){rB(e);return}e[oe]=A,e[Vt]=()=>{rB(e)},km(e[oe],e[Vt])}}function nB(e){e[oe]&&("removeEventListener"in e[oe]?e[oe].removeEventListener("abort",e[Vt]):e[oe].removeListener("abort",e[Vt]),e[oe]=null,e[Vt]=null)}oB.exports={addSignal:Rm,removeSignal:nB}});var gB=f((fU,aB)=>{"use strict";var bm=h("node:assert"),{finished:Nm,PassThrough:Sm}=h("node:stream"),{InvalidArgumentError:qt,InvalidReturnValueError:Um}=H(),PA=G(),{getResolveErrorBodyCallback:Mm}=Ca(),{AsyncResource:Lm}=h("node:async_hooks"),{addSignal:Tm,removeSignal:sB}=vr(),ha=class extends Lm{constructor(A,t,r){if(!A||typeof A!="object")throw new qt("invalid opts");let{signal:n,method:o,opaque:s,body:i,onInfo:a,responseHeaders:g,throwOnError:c}=A;try{if(typeof r!="function")throw new qt("invalid callback");if(typeof t!="function")throw new qt("invalid factory");if(n&&typeof n.on!="function"&&typeof n.addEventListener!="function")throw new qt("signal must be an EventEmitter or EventTarget");if(o==="CONNECT")throw new qt("invalid method");if(a&&typeof a!="function")throw new qt("invalid onInfo callback");super("UNDICI_STREAM")}catch(l){throw PA.isStream(i)&&PA.destroy(i.on("error",PA.nop),l),l}this.responseHeaders=g||null,this.opaque=s||null,this.factory=t,this.callback=r,this.res=null,this.abort=null,this.context=null,this.trailers=null,this.body=i,this.onInfo=a||null,this.throwOnError=c||!1,PA.isStream(i)&&i.on("error",l=>{this.onError(l)}),Tm(this,n)}onConnect(A,t){if(this.reason){A(this.reason);return}bm(this.callback),this.abort=A,this.context=t}onHeaders(A,t,r,n){let{factory:o,opaque:s,context:i,callback:a,responseHeaders:g}=this,c=g==="raw"?PA.parseRawHeaders(t):PA.parseHeaders(t);if(A<200){this.onInfo&&this.onInfo({statusCode:A,headers:c});return}this.factory=null;let l;if(this.throwOnError&&A>=400){let B=(g==="raw"?PA.parseHeaders(t):c)["content-type"];l=new Sm,this.callback=null,this.runInAsyncScope(Mm,null,{callback:a,body:l,contentType:B,statusCode:A,statusMessage:n,headers:c})}else{if(o===null)return;if(l=this.runInAsyncScope(o,null,{statusCode:A,headers:c,opaque:s,context:i}),!l||typeof l.write!="function"||typeof l.end!="function"||typeof l.on!="function")throw new Um("expected Writable");Nm(l,{readable:!1},E=>{let{callback:B,res:C,opaque:d,trailers:I,abort:u}=this;this.res=null,(E||!C.readable)&&PA.destroy(C,E),this.callback=null,this.runInAsyncScope(B,null,E||null,{opaque:d,trailers:I}),E&&u()})}return l.on("drain",r),this.res=l,(l.writableNeedDrain!==void 0?l.writableNeedDrain:l._writableState?.needDrain)!==!0}onData(A){let{res:t}=this;return t?t.write(A):!0}onComplete(A){let{res:t}=this;sB(this),t&&(this.trailers=PA.parseHeaders(A),t.end())}onError(A){let{res:t,callback:r,opaque:n,body:o}=this;sB(this),this.factory=null,t?(this.res=null,PA.destroy(t,A)):r&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(r,null,A,{opaque:n})})),o&&(this.body=null,PA.destroy(o,A))}};function iB(e,A,t){if(t===void 0)return new Promise((r,n)=>{iB.call(this,e,A,(o,s)=>o?n(o):r(s))});try{this.dispatch(e,new ha(e,A,t))}catch(r){if(typeof t!="function")throw r;let n=e?.opaque;queueMicrotask(()=>t(r,{opaque:n}))}}aB.exports=iB});var EB=f((yU,QB)=>{"use strict";var{Readable:lB,Duplex:Ym,PassThrough:Gm}=h("node:stream"),{InvalidArgumentError:Hr,InvalidReturnValueError:Jm,RequestAbortedError:da}=H(),GA=G(),{AsyncResource:xm}=h("node:async_hooks"),{addSignal:vm,removeSignal:Hm}=vr(),cB=h("node:assert"),Wt=Symbol("resume"),fa=class extends lB{constructor(){super({autoDestroy:!0}),this[Wt]=null}_read(){let{[Wt]:A}=this;A&&(this[Wt]=null,A())}_destroy(A,t){this._read(),t(A)}},ya=class extends lB{constructor(A){super({autoDestroy:!0}),this[Wt]=A}_read(){this[Wt]()}_destroy(A,t){!A&&!this._readableState.endEmitted&&(A=new da),t(A)}},wa=class extends xm{constructor(A,t){if(!A||typeof A!="object")throw new Hr("invalid opts");if(typeof t!="function")throw new Hr("invalid handler");let{signal:r,method:n,opaque:o,onInfo:s,responseHeaders:i}=A;if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new Hr("signal must be an EventEmitter or EventTarget");if(n==="CONNECT")throw new Hr("invalid method");if(s&&typeof s!="function")throw new Hr("invalid onInfo callback");super("UNDICI_PIPELINE"),this.opaque=o||null,this.responseHeaders=i||null,this.handler=t,this.abort=null,this.context=null,this.onInfo=s||null,this.req=new fa().on("error",GA.nop),this.ret=new Ym({readableObjectMode:A.objectMode,autoDestroy:!0,read:()=>{let{body:a}=this;a?.resume&&a.resume()},write:(a,g,c)=>{let{req:l}=this;l.push(a,g)||l._readableState.destroyed?c():l[Wt]=c},destroy:(a,g)=>{let{body:c,req:l,res:Q,ret:E,abort:B}=this;!a&&!E._readableState.endEmitted&&(a=new da),B&&a&&B(),GA.destroy(c,a),GA.destroy(l,a),GA.destroy(Q,a),Hm(this),g(a)}}).on("prefinish",()=>{let{req:a}=this;a.push(null)}),this.res=null,vm(this,r)}onConnect(A,t){let{ret:r,res:n}=this;if(this.reason){A(this.reason);return}cB(!n,"pipeline cannot be retried"),cB(!r.destroyed),this.abort=A,this.context=t}onHeaders(A,t,r){let{opaque:n,handler:o,context:s}=this;if(A<200){if(this.onInfo){let a=this.responseHeaders==="raw"?GA.parseRawHeaders(t):GA.parseHeaders(t);this.onInfo({statusCode:A,headers:a})}return}this.res=new ya(r);let i;try{this.handler=null;let a=this.responseHeaders==="raw"?GA.parseRawHeaders(t):GA.parseHeaders(t);i=this.runInAsyncScope(o,null,{statusCode:A,headers:a,opaque:n,body:this.res,context:s})}catch(a){throw this.res.on("error",GA.nop),a}if(!i||typeof i.on!="function")throw new Jm("expected Readable");i.on("data",a=>{let{ret:g,body:c}=this;!g.push(a)&&c.pause&&c.pause()}).on("error",a=>{let{ret:g}=this;GA.destroy(g,a)}).on("end",()=>{let{ret:a}=this;a.push(null)}).on("close",()=>{let{ret:a}=this;a._readableState.ended||GA.destroy(a,new da)}),this.body=i}onData(A){let{res:t}=this;return t.push(A)}onComplete(A){let{res:t}=this;t.push(null)}onError(A){let{ret:t}=this;this.handler=null,GA.destroy(t,A)}};function Vm(e,A){try{let t=new wa(e,A);return this.dispatch({...e,body:t.req},t),t.ret}catch(t){return new Gm().destroy(t)}}QB.exports=Vm});var dB=f((wU,hB)=>{"use strict";var{InvalidArgumentError:pa,SocketError:qm}=H(),{AsyncResource:Wm}=h("node:async_hooks"),BB=G(),{addSignal:Om,removeSignal:IB}=vr(),CB=h("node:assert"),Da=class extends Wm{constructor(A,t){if(!A||typeof A!="object")throw new pa("invalid opts");if(typeof t!="function")throw new pa("invalid callback");let{signal:r,opaque:n,responseHeaders:o}=A;if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new pa("signal must be an EventEmitter or EventTarget");super("UNDICI_UPGRADE"),this.responseHeaders=o||null,this.opaque=n||null,this.callback=t,this.abort=null,this.context=null,Om(this,r)}onConnect(A,t){if(this.reason){A(this.reason);return}CB(this.callback),this.abort=A,this.context=null}onHeaders(){throw new qm("bad upgrade",null)}onUpgrade(A,t,r){CB(A===101);let{callback:n,opaque:o,context:s}=this;IB(this),this.callback=null;let i=this.responseHeaders==="raw"?BB.parseRawHeaders(t):BB.parseHeaders(t);this.runInAsyncScope(n,null,null,{headers:i,socket:r,opaque:o,context:s})}onError(A){let{callback:t,opaque:r}=this;IB(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,A,{opaque:r})}))}};function uB(e,A){if(A===void 0)return new Promise((t,r)=>{uB.call(this,e,(n,o)=>n?r(n):t(o))});try{let t=new Da(e,A);this.dispatch({...e,method:e.method||"GET",upgrade:e.protocol||"Websocket"},t)}catch(t){if(typeof A!="function")throw t;let r=e?.opaque;queueMicrotask(()=>A(t,{opaque:r}))}}hB.exports=uB});var DB=f((pU,pB)=>{"use strict";var Pm=h("node:assert"),{AsyncResource:_m}=h("node:async_hooks"),{InvalidArgumentError:ma,SocketError:zm}=H(),fB=G(),{addSignal:Zm,removeSignal:yB}=vr(),ka=class extends _m{constructor(A,t){if(!A||typeof A!="object")throw new ma("invalid opts");if(typeof t!="function")throw new ma("invalid callback");let{signal:r,opaque:n,responseHeaders:o}=A;if(r&&typeof r.on!="function"&&typeof r.addEventListener!="function")throw new ma("signal must be an EventEmitter or EventTarget");super("UNDICI_CONNECT"),this.opaque=n||null,this.responseHeaders=o||null,this.callback=t,this.abort=null,Zm(this,r)}onConnect(A,t){if(this.reason){A(this.reason);return}Pm(this.callback),this.abort=A,this.context=t}onHeaders(){throw new zm("bad connect",null)}onUpgrade(A,t,r){let{callback:n,opaque:o,context:s}=this;yB(this),this.callback=null;let i=t;i!=null&&(i=this.responseHeaders==="raw"?fB.parseRawHeaders(t):fB.parseHeaders(t)),this.runInAsyncScope(n,null,null,{statusCode:A,headers:i,socket:r,opaque:o,context:s})}onError(A){let{callback:t,opaque:r}=this;yB(this),t&&(this.callback=null,queueMicrotask(()=>{this.runInAsyncScope(t,null,A,{opaque:r})}))}};function wB(e,A){if(A===void 0)return new Promise((t,r)=>{wB.call(this,e,(n,o)=>n?r(n):t(o))});try{let t=new ka(e,A);this.dispatch({...e,method:"CONNECT"},t)}catch(t){if(typeof A!="function")throw t;let r=e?.opaque;queueMicrotask(()=>A(t,{opaque:r}))}}pB.exports=wB});var mB=f((DU,Ot)=>{"use strict";Ot.exports.request=tB();Ot.exports.stream=gB();Ot.exports.pipeline=EB();Ot.exports.upgrade=dB();Ot.exports.connect=DB()});var Ra=f((mU,FB)=>{"use strict";var{UndiciError:Km}=H(),kB=Symbol.for("undici.error.UND_MOCK_ERR_MOCK_NOT_MATCHED"),Fa=class e extends Km{constructor(A){super(A),Error.captureStackTrace(this,e),this.name="MockNotMatchedError",this.message=A||"The request does not match any registered mock dispatches",this.code="UND_MOCK_ERR_MOCK_NOT_MATCHED"}static[Symbol.hasInstance](A){return A&&A[kB]===!0}[kB]=!0};FB.exports={MockNotMatchedError:Fa}});var Pt=f((kU,RB)=>{"use strict";RB.exports={kAgent:Symbol("agent"),kOptions:Symbol("options"),kFactory:Symbol("factory"),kDispatches:Symbol("dispatches"),kDispatchKey:Symbol("dispatch key"),kDefaultHeaders:Symbol("default headers"),kDefaultTrailers:Symbol("default trailers"),kContentLength:Symbol("content length"),kMockAgent:Symbol("mock agent"),kMockAgentSet:Symbol("mock agent set"),kMockAgentGet:Symbol("mock agent get"),kMockDispatch:Symbol("mock dispatch"),kClose:Symbol("close"),kOriginalClose:Symbol("original agent close"),kOrigin:Symbol("origin"),kIsMockActive:Symbol("is mock active"),kNetConnect:Symbol("net connect"),kGetNetConnect:Symbol("get net connect"),kConnected:Symbol("connected")}});var Vr=f((FU,xB)=>{"use strict";var{MockNotMatchedError:At}=Ra(),{kDispatches:Eo,kMockAgent:Xm,kOriginalDispatch:jm,kOrigin:$m,kGetNetConnect:A0}=Pt(),{buildURL:e0}=G(),{STATUS_CODES:t0}=h("node:http"),{types:{isPromise:r0}}=h("node:util");function Ce(e,A){return typeof e=="string"?e===A:e instanceof RegExp?e.test(A):typeof e=="function"?e(A)===!0:!1}function NB(e){return Object.fromEntries(Object.entries(e).map(([A,t])=>[A.toLocaleLowerCase(),t]))}function SB(e,A){if(Array.isArray(e)){for(let t=0;t<e.length;t+=2)if(e[t].toLocaleLowerCase()===A.toLocaleLowerCase())return e[t+1];return}else return typeof e.get=="function"?e.get(A):NB(e)[A.toLocaleLowerCase()]}function Sa(e){let A=e.slice(),t=[];for(let r=0;r<A.length;r+=2)t.push([A[r],A[r+1]]);return Object.fromEntries(t)}function UB(e,A){if(typeof e.headers=="function")return Array.isArray(A)&&(A=Sa(A)),e.headers(A?NB(A):{});if(typeof e.headers>"u")return!0;if(typeof A!="object"||typeof e.headers!="object")return!1;for(let[t,r]of Object.entries(e.headers)){let n=SB(A,t);if(!Ce(r,n))return!1}return!0}function bB(e){if(typeof e!="string")return e;let A=e.split("?");if(A.length!==2)return e;let t=new URLSearchParams(A.pop());return t.sort(),[...A,t.toString()].join("?")}function n0(e,{path:A,method:t,body:r,headers:n}){let o=Ce(e.path,A),s=Ce(e.method,t),i=typeof e.body<"u"?Ce(e.body,r):!0,a=UB(e,n);return o&&s&&i&&a}function MB(e){return Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer?e:typeof e=="object"?JSON.stringify(e):e.toString()}function LB(e,A){let t=A.query?e0(A.path,A.query):A.path,r=typeof t=="string"?bB(t):t,n=e.filter(({consumed:o})=>!o).filter(({path:o})=>Ce(bB(o),r));if(n.length===0)throw new At(`Mock dispatch not matched for path '${r}'`);if(n=n.filter(({method:o})=>Ce(o,A.method)),n.length===0)throw new At(`Mock dispatch not matched for method '${A.method}' on path '${r}'`);if(n=n.filter(({body:o})=>typeof o<"u"?Ce(o,A.body):!0),n.length===0)throw new At(`Mock dispatch not matched for body '${A.body}' on path '${r}'`);if(n=n.filter(o=>UB(o,A.headers)),n.length===0){let o=typeof A.headers=="object"?JSON.stringify(A.headers):A.headers;throw new At(`Mock dispatch not matched for headers '${o}' on path '${r}'`)}return n[0]}function o0(e,A,t){let r={timesInvoked:0,times:1,persist:!1,consumed:!1},n=typeof t=="function"?{callback:t}:{...t},o={...r,...A,pending:!0,data:{error:null,...n}};return e.push(o),o}function ba(e,A){let t=e.findIndex(r=>r.consumed?n0(r,A):!1);t!==-1&&e.splice(t,1)}function TB(e){let{path:A,method:t,body:r,headers:n,query:o}=e;return{path:A,method:t,body:r,headers:n,query:o}}function Na(e){let A=Object.keys(e),t=[];for(let r=0;r<A.length;++r){let n=A[r],o=e[n],s=Buffer.from(`${n}`);if(Array.isArray(o))for(let i=0;i<o.length;++i)t.push(s,Buffer.from(`${o[i]}`));else t.push(s,Buffer.from(`${o}`))}return t}function YB(e){return t0[e]||"unknown"}async function s0(e){let A=[];for await(let t of e)A.push(t);return Buffer.concat(A).toString("utf8")}function GB(e,A){let t=TB(e),r=LB(this[Eo],t);r.timesInvoked++,r.data.callback&&(r.data={...r.data,...r.data.callback(e)});let{data:{statusCode:n,data:o,headers:s,trailers:i,error:a},delay:g,persist:c}=r,{timesInvoked:l,times:Q}=r;if(r.consumed=!c&&l>=Q,r.pending=l<Q,a!==null)return ba(this[Eo],t),A.onError(a),!0;typeof g=="number"&&g>0?setTimeout(()=>{E(this[Eo])},g):E(this[Eo]);function E(C,d=o){let I=Array.isArray(e.headers)?Sa(e.headers):e.headers,u=typeof d=="function"?d({...e,headers:I}):d;if(r0(u)){u.then(L=>E(C,L));return}let D=MB(u),p=Na(s),F=Na(i);A.onConnect?.(L=>A.onError(L),null),A.onHeaders?.(n,p,B,YB(n)),A.onData?.(Buffer.from(D)),A.onComplete?.(F),ba(C,t)}function B(){}return!0}function i0(){let e=this[Xm],A=this[$m],t=this[jm];return function(n,o){if(e.isMockActive)try{GB.call(this,n,o)}catch(s){if(s instanceof At){let i=e[A0]();if(i===!1)throw new At(`${s.message}: subsequent request to origin ${A} was not allowed (net.connect disabled)`);if(JB(i,A))t.call(this,n,o);else throw new At(`${s.message}: subsequent request to origin ${A} was not allowed (net.connect is not enabled for this origin)`)}else throw s}else t.call(this,n,o)}}function JB(e,A){let t=new URL(A);return e===!0?!0:!!(Array.isArray(e)&&e.some(r=>Ce(r,t.host)))}function a0(e){if(e){let{agent:A,...t}=e;return t}}xB.exports={getResponseData:MB,getMockDispatch:LB,addMockDispatch:o0,deleteMockDispatch:ba,buildKey:TB,generateKeyValues:Na,matchValue:Ce,getResponse:s0,getStatusText:YB,mockDispatch:GB,buildMockDispatch:i0,checkNetConnect:JB,buildMockOptions:a0,getHeaderByName:SB,buildHeadersFromArray:Sa}});var Ja=f((RU,Ga)=>{"use strict";var{getResponseData:g0,buildKey:c0,addMockDispatch:Ua}=Vr(),{kDispatches:Bo,kDispatchKey:Io,kDefaultHeaders:Ma,kDefaultTrailers:La,kContentLength:Ta,kMockDispatch:Co}=Pt(),{InvalidArgumentError:se}=H(),{buildURL:l0}=G(),_t=class{constructor(A){this[Co]=A}delay(A){if(typeof A!="number"||!Number.isInteger(A)||A<=0)throw new se("waitInMs must be a valid integer > 0");return this[Co].delay=A,this}persist(){return this[Co].persist=!0,this}times(A){if(typeof A!="number"||!Number.isInteger(A)||A<=0)throw new se("repeatTimes must be a valid integer > 0");return this[Co].times=A,this}},Ya=class{constructor(A,t){if(typeof A!="object")throw new se("opts must be an object");if(typeof A.path>"u")throw new se("opts.path must be defined");if(typeof A.method>"u"&&(A.method="GET"),typeof A.path=="string")if(A.query)A.path=l0(A.path,A.query);else{let r=new URL(A.path,"data://");A.path=r.pathname+r.search}typeof A.method=="string"&&(A.method=A.method.toUpperCase()),this[Io]=c0(A),this[Bo]=t,this[Ma]={},this[La]={},this[Ta]=!1}createMockScopeDispatchData({statusCode:A,data:t,responseOptions:r}){let n=g0(t),o=this[Ta]?{"content-length":n.length}:{},s={...this[Ma],...o,...r.headers},i={...this[La],...r.trailers};return{statusCode:A,data:t,headers:s,trailers:i}}validateReplyParameters(A){if(typeof A.statusCode>"u")throw new se("statusCode must be defined");if(typeof A.responseOptions!="object"||A.responseOptions===null)throw new se("responseOptions must be an object")}reply(A){if(typeof A=="function"){let o=i=>{let a=A(i);if(typeof a!="object"||a===null)throw new se("reply options callback must return an object");let g={data:"",responseOptions:{},...a};return this.validateReplyParameters(g),{...this.createMockScopeDispatchData(g)}},s=Ua(this[Bo],this[Io],o);return new _t(s)}let t={statusCode:A,data:arguments[1]===void 0?"":arguments[1],responseOptions:arguments[2]===void 0?{}:arguments[2]};this.validateReplyParameters(t);let r=this.createMockScopeDispatchData(t),n=Ua(this[Bo],this[Io],r);return new _t(n)}replyWithError(A){if(typeof A>"u")throw new se("error must be defined");let t=Ua(this[Bo],this[Io],{error:A});return new _t(t)}defaultReplyHeaders(A){if(typeof A>"u")throw new se("headers must be defined");return this[Ma]=A,this}defaultReplyTrailers(A){if(typeof A>"u")throw new se("trailers must be defined");return this[La]=A,this}replyContentLength(){return this[Ta]=!0,this}};Ga.exports.MockInterceptor=Ya;Ga.exports.MockScope=_t});var Ha=f((bU,PB)=>{"use strict";var{promisify:Q0}=h("node:util"),E0=Yt(),{buildMockDispatch:B0}=Vr(),{kDispatches:vB,kMockAgent:HB,kClose:VB,kOriginalClose:qB,kOrigin:WB,kOriginalDispatch:I0,kConnected:xa}=Pt(),{MockInterceptor:C0}=Ja(),OB=Z(),{InvalidArgumentError:u0}=H(),va=class extends E0{constructor(A,t){if(super(A,t),!t||!t.agent||typeof t.agent.dispatch!="function")throw new u0("Argument opts.agent must implement Agent");this[HB]=t.agent,this[WB]=A,this[vB]=[],this[xa]=1,this[I0]=this.dispatch,this[qB]=this.close.bind(this),this.dispatch=B0.call(this),this.close=this[VB]}get[OB.kConnected](){return this[xa]}intercept(A){return new C0(A,this[vB])}async[VB](){await Q0(this[qB])(),this[xa]=0,this[HB][OB.kClients].delete(this[WB])}};PB.exports=va});var Wa=f((NU,$B)=>{"use strict";var{promisify:h0}=h("node:util"),d0=Gt(),{buildMockDispatch:f0}=Vr(),{kDispatches:_B,kMockAgent:zB,kClose:ZB,kOriginalClose:KB,kOrigin:XB,kOriginalDispatch:y0,kConnected:Va}=Pt(),{MockInterceptor:w0}=Ja(),jB=Z(),{InvalidArgumentError:p0}=H(),qa=class extends d0{constructor(A,t){if(super(A,t),!t||!t.agent||typeof t.agent.dispatch!="function")throw new p0("Argument opts.agent must implement Agent");this[zB]=t.agent,this[XB]=A,this[_B]=[],this[Va]=1,this[y0]=this.dispatch,this[KB]=this.close.bind(this),this.dispatch=f0.call(this),this.close=this[ZB]}get[jB.kConnected](){return this[Va]}intercept(A){return new w0(A,this[_B])}async[ZB](){await h0(this[KB])(),this[Va]=0,this[zB][jB.kClients].delete(this[XB])}};$B.exports=qa});var eI=f((UU,AI)=>{"use strict";var D0={pronoun:"it",is:"is",was:"was",this:"this"},m0={pronoun:"they",is:"are",was:"were",this:"these"};AI.exports=class{constructor(A,t){this.singular=A,this.plural=t}pluralize(A){let t=A===1,r=t?D0:m0,n=t?this.singular:this.plural;return{...r,count:A,noun:n}}}});var rI=f((LU,tI)=>{"use strict";var{Transform:k0}=h("node:stream"),{Console:F0}=h("node:console"),R0=process.versions.icu?"\u2705":"Y ",b0=process.versions.icu?"\u274C":"N ";tI.exports=class{constructor({disableColors:A}={}){this.transform=new k0({transform(t,r,n){n(null,t)}}),this.logger=new F0({stdout:this.transform,inspectOptions:{colors:!A&&!process.env.CI}})}format(A){let t=A.map(({method:r,path:n,data:{statusCode:o},persist:s,times:i,timesInvoked:a,origin:g})=>({Method:r,Origin:g,Path:n,"Status code":o,Persistent:s?R0:b0,Invocations:a,Remaining:s?1/0:i-a}));return this.logger.table(t),this.transform.read().toString()}}});var iI=f((TU,sI)=>{"use strict";var{kClients:et}=Z(),N0=Jt(),{kAgent:Oa,kMockAgentSet:uo,kMockAgentGet:nI,kDispatches:Pa,kIsMockActive:ho,kNetConnect:tt,kGetNetConnect:S0,kOptions:fo,kFactory:yo}=Pt(),U0=Ha(),M0=Wa(),{matchValue:L0,buildMockOptions:T0}=Vr(),{InvalidArgumentError:oI,UndiciError:Y0}=H(),G0=lr(),J0=eI(),x0=rI(),_a=class extends G0{constructor(A){if(super(A),this[tt]=!0,this[ho]=!0,A?.agent&&typeof A.agent.dispatch!="function")throw new oI("Argument opts.agent must implement Agent");let t=A?.agent?A.agent:new N0(A);this[Oa]=t,this[et]=t[et],this[fo]=T0(A)}get(A){let t=this[nI](A);return t||(t=this[yo](A),this[uo](A,t)),t}dispatch(A,t){return this.get(A.origin),this[Oa].dispatch(A,t)}async close(){await this[Oa].close(),this[et].clear()}deactivate(){this[ho]=!1}activate(){this[ho]=!0}enableNetConnect(A){if(typeof A=="string"||typeof A=="function"||A instanceof RegExp)Array.isArray(this[tt])?this[tt].push(A):this[tt]=[A];else if(typeof A>"u")this[tt]=!0;else throw new oI("Unsupported matcher. Must be one of String|Function|RegExp.")}disableNetConnect(){this[tt]=!1}get isMockActive(){return this[ho]}[uo](A,t){this[et].set(A,t)}[yo](A){let t=Object.assign({agent:this},this[fo]);return this[fo]&&this[fo].connections===1?new U0(A,t):new M0(A,t)}[nI](A){let t=this[et].get(A);if(t)return t;if(typeof A!="string"){let r=this[yo]("http://localhost:9999");return this[uo](A,r),r}for(let[r,n]of Array.from(this[et]))if(n&&typeof r!="string"&&L0(r,A)){let o=this[yo](A);return this[uo](A,o),o[Pa]=n[Pa],o}}[S0](){return this[tt]}pendingInterceptors(){let A=this[et];return Array.from(A.entries()).flatMap(([t,r])=>r[Pa].map(n=>({...n,origin:t}))).filter(({pending:t})=>t)}assertNoPendingInterceptors({pendingInterceptorsFormatter:A=new x0}={}){let t=this.pendingInterceptors();if(t.length===0)return;let r=new J0("interceptor","interceptors").pluralize(t.length);throw new Y0(`
|
|
43
43
|
${r.count} ${r.noun} ${r.is} pending:
|
|
44
44
|
|
|
45
45
|
${A.format(t)}
|
|
46
|
-
`.trim())}};sI.exports=_a});var wo=f((YU,lI)=>{"use strict";var aI=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:vm}=H(),Hm=Jt();cI()===void 0&&gI(new Hm);function gI(e){if(!e||typeof e.dispatch!="function")throw new vm("Argument agent must implement Agent");Object.defineProperty(globalThis,aI,{value:e,writable:!0,enumerable:!1,configurable:!1})}function cI(){return globalThis[aI]}lI.exports={setGlobalDispatcher:gI,getGlobalDispatcher:cI}});var po=f((JU,QI)=>{"use strict";QI.exports=class{#A;constructor(A){if(typeof A!="object"||A===null)throw new TypeError("handler must be an object");this.#A=A}onConnect(...A){return this.#A.onConnect?.(...A)}onError(...A){return this.#A.onError?.(...A)}onUpgrade(...A){return this.#A.onUpgrade?.(...A)}onResponseStarted(...A){return this.#A.onResponseStarted?.(...A)}onHeaders(...A){return this.#A.onHeaders?.(...A)}onData(...A){return this.#A.onData?.(...A)}onComplete(...A){return this.#A.onComplete?.(...A)}onBodySent(...A){return this.#A.onBodySent?.(...A)}}});var BI=f((xU,EI)=>{"use strict";var Vm=Ao();EI.exports=e=>{let A=e?.maxRedirections;return t=>function(n,o){let{maxRedirections:s=A,...i}=n;if(!s)return t(n,o);let a=new Vm(t,s,n,o);return t(i,a)}}});var CI=f((vU,II)=>{"use strict";var qm=lo();II.exports=e=>A=>function(r,n){return A(r,new qm({...r,retryOptions:{...e,...r.retryOptions}},{handler:n,dispatch:A}))}});var hI=f((HU,uI)=>{"use strict";var Wm=G(),{InvalidArgumentError:Om,RequestAbortedError:Pm}=H(),_m=po(),za=class extends _m{#A=1024*1024;#e=null;#t=!1;#o=!1;#n=0;#r=null;#s=null;constructor({maxSize:A},t){if(super(t),A!=null&&(!Number.isFinite(A)||A<1))throw new Om("maxSize must be a number greater than 0");this.#A=A??this.#A,this.#s=t}onConnect(A){this.#e=A,this.#s.onConnect(this.#i.bind(this))}#i(A){this.#o=!0,this.#r=A}onHeaders(A,t,r,n){let s=Wm.parseHeaders(t)["content-length"];if(s!=null&&s>this.#A)throw new Pm(`Response size (${s}) larger than maxSize (${this.#A})`);return this.#o?!0:this.#s.onHeaders(A,t,r,n)}onError(A){this.#t||(A=this.#r??A,this.#s.onError(A))}onData(A){return this.#n=this.#n+A.length,this.#n>=this.#A&&(this.#t=!0,this.#o?this.#s.onError(this.#r):this.#s.onComplete([])),!0}onComplete(A){if(!this.#t){if(this.#o){this.#s.onError(this.reason);return}this.#s.onComplete(A)}}};function zm({maxSize:e}={maxSize:1024*1024}){return A=>function(r,n){let{dumpMaxSize:o=e}=r,s=new za({maxSize:o},n);return A(r,s)}}uI.exports=zm});var yI=f((VU,fI)=>{"use strict";var{isIP:Zm}=h("node:net"),{lookup:Km}=h("node:dns"),Xm=po(),{InvalidArgumentError:zt,InformationalError:jm}=H(),dI=Math.pow(2,31)-1,Za=class{#A=0;#e=0;#t=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(A){this.#A=A.maxTTL,this.#e=A.maxItems,this.dualStack=A.dualStack,this.affinity=A.affinity,this.lookup=A.lookup??this.#o,this.pick=A.pick??this.#n}get full(){return this.#t.size===this.#e}runLookup(A,t,r){let n=this.#t.get(A.hostname);if(n==null&&this.full){r(null,A.origin);return}let o={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#A,maxItems:this.#e};if(n==null)this.lookup(A,o,(s,i)=>{if(s||i==null||i.length===0){r(s??new jm("No DNS entries found"));return}this.setRecords(A,i);let a=this.#t.get(A.hostname),g=this.pick(A,a,o.affinity),c;typeof g.port=="number"?c=`:${g.port}`:A.port!==""?c=`:${A.port}`:c="",r(null,`${A.protocol}//${g.family===6?`[${g.address}]`:g.address}${c}`)});else{let s=this.pick(A,n,o.affinity);if(s==null){this.#t.delete(A.hostname),this.runLookup(A,t,r);return}let i;typeof s.port=="number"?i=`:${s.port}`:A.port!==""?i=`:${A.port}`:i="",r(null,`${A.protocol}//${s.family===6?`[${s.address}]`:s.address}${i}`)}}#o(A,t,r){Km(A.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(n,o)=>{if(n)return r(n);let s=new Map;for(let i of o)s.set(`${i.address}:${i.family}`,i);r(null,s.values())})}#n(A,t,r){let n=null,{records:o,offset:s}=t,i;if(this.dualStack?(r==null&&(s==null||s===dI?(t.offset=0,r=4):(t.offset++,r=(t.offset&1)===1?6:4)),o[r]!=null&&o[r].ips.length>0?i=o[r]:i=o[r===4?6:4]):i=o[r],i==null||i.ips.length===0)return n;i.offset==null||i.offset===dI?i.offset=0:i.offset++;let a=i.offset%i.ips.length;return n=i.ips[a]??null,n==null?n:Date.now()-n.timestamp>n.ttl?(i.ips.splice(a,1),this.pick(A,t,r)):n}setRecords(A,t){let r=Date.now(),n={records:{4:null,6:null}};for(let o of t){o.timestamp=r,typeof o.ttl=="number"?o.ttl=Math.min(o.ttl,this.#A):o.ttl=this.#A;let s=n.records[o.family]??{ips:[]};s.ips.push(o),n.records[o.family]=s}this.#t.set(A.hostname,n)}getHandler(A,t){return new Ka(this,A,t)}},Ka=class extends Xm{#A=null;#e=null;#t=null;#o=null;#n=null;constructor(A,{origin:t,handler:r,dispatch:n},o){super(r),this.#n=t,this.#o=r,this.#e={...o},this.#A=A,this.#t=n}onError(A){switch(A.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#A.dualStack){this.#A.runLookup(this.#n,this.#e,(t,r)=>{if(t)return this.#o.onError(t);let n={...this.#e,origin:r};this.#t(n,this)});return}this.#o.onError(A);return}case"ENOTFOUND":this.#A.deleteRecord(this.#n);default:this.#o.onError(A);break}}};fI.exports=e=>{if(e?.maxTTL!=null&&(typeof e?.maxTTL!="number"||e?.maxTTL<0))throw new zt("Invalid maxTTL. Must be a positive number");if(e?.maxItems!=null&&(typeof e?.maxItems!="number"||e?.maxItems<1))throw new zt("Invalid maxItems. Must be a positive number and greater than zero");if(e?.affinity!=null&&e?.affinity!==4&&e?.affinity!==6)throw new zt("Invalid affinity. Must be either 4 or 6");if(e?.dualStack!=null&&typeof e?.dualStack!="boolean")throw new zt("Invalid dualStack. Must be a boolean");if(e?.lookup!=null&&typeof e?.lookup!="function")throw new zt("Invalid lookup. Must be a function");if(e?.pick!=null&&typeof e?.pick!="function")throw new zt("Invalid pick. Must be a function");let A=e?.dualStack??!0,t;A?t=e?.affinity??null:t=e?.affinity??4;let r={maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:A,affinity:t,maxItems:e?.maxItems??1/0},n=new Za(r);return o=>function(i,a){let g=i.origin.constructor===URL?i.origin:new URL(i.origin);return Zm(g.hostname)!==0?o(i,a):(n.runLookup(g,i,(c,l)=>{if(c)return a.onError(c);let Q=null;Q={...i,servername:g.hostname,origin:l,headers:{host:g.hostname,...i.headers}},o(Q,n.getHandler({origin:g,dispatch:o,handler:a},i))}),!0)}}});var rt=f((qU,RI)=>{"use strict";var{kConstruct:$m}=Z(),{kEnumerableProperty:Zt}=G(),{iteratorMixin:Ak,isValidHeaderName:qr,isValidHeaderValue:pI}=pA(),{webidl:v}=gA(),Xa=h("node:assert"),Do=h("node:util"),tA=Symbol("headers map"),kA=Symbol("headers map sorted");function wI(e){return e===10||e===13||e===9||e===32}function DI(e){let A=0,t=e.length;for(;t>A&&wI(e.charCodeAt(t-1));)--t;for(;t>A&&wI(e.charCodeAt(A));)++A;return A===0&&t===e.length?e:e.substring(A,t)}function mI(e,A){if(Array.isArray(A))for(let t=0;t<A.length;++t){let r=A[t];if(r.length!==2)throw v.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});ja(e,r[0],r[1])}else if(typeof A=="object"&&A!==null){let t=Object.keys(A);for(let r=0;r<t.length;++r)ja(e,t[r],A[t[r]])}else throw v.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function ja(e,A,t){if(t=DI(t),qr(A)){if(!pI(t))throw v.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header value"})}else throw v.errors.invalidArgument({prefix:"Headers.append",value:A,type:"header name"});if(FI(e)==="immutable")throw new TypeError("immutable");return $a(e).append(A,t,!1)}function kI(e,A){return e[0]<A[0]?-1:1}var mo=class e{cookies=null;constructor(A){A instanceof e?(this[tA]=new Map(A[tA]),this[kA]=A[kA],this.cookies=A.cookies===null?null:[...A.cookies]):(this[tA]=new Map(A),this[kA]=null)}contains(A,t){return this[tA].has(t?A:A.toLowerCase())}clear(){this[tA].clear(),this[kA]=null,this.cookies=null}append(A,t,r){this[kA]=null;let n=r?A:A.toLowerCase(),o=this[tA].get(n);if(o){let s=n==="cookie"?"; ":", ";this[tA].set(n,{name:o.name,value:`${o.value}${s}${t}`})}else this[tA].set(n,{name:A,value:t});n==="set-cookie"&&(this.cookies??=[]).push(t)}set(A,t,r){this[kA]=null;let n=r?A:A.toLowerCase();n==="set-cookie"&&(this.cookies=[t]),this[tA].set(n,{name:A,value:t})}delete(A,t){this[kA]=null,t||(A=A.toLowerCase()),A==="set-cookie"&&(this.cookies=null),this[tA].delete(A)}get(A,t){return this[tA].get(t?A:A.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:A,1:{value:t}}of this[tA])yield[A,t]}get entries(){let A={};if(this[tA].size!==0)for(let{name:t,value:r}of this[tA].values())A[t]=r;return A}rawValues(){return this[tA].values()}get entriesList(){let A=[];if(this[tA].size!==0)for(let{0:t,1:{name:r,value:n}}of this[tA])if(t==="set-cookie")for(let o of this.cookies)A.push([r,o]);else A.push([r,n]);return A}toSortedArray(){let A=this[tA].size,t=new Array(A);if(A<=32){if(A===0)return t;let r=this[tA][Symbol.iterator](),n=r.next().value;t[0]=[n[0],n[1].value],Xa(n[1].value!==null);for(let o=1,s=0,i=0,a=0,g=0,c,l;o<A;++o){for(l=r.next().value,c=t[o]=[l[0],l[1].value],Xa(c[1]!==null),a=0,i=o;a<i;)g=a+(i-a>>1),t[g][0]<=c[0]?a=g+1:i=g;if(o!==g){for(s=o;s>a;)t[s]=t[--s];t[a]=c}}if(!r.next().done)throw new TypeError("Unreachable");return t}else{let r=0;for(let{0:n,1:{value:o}}of this[tA])t[r++]=[n,o],Xa(o!==null);return t.sort(kI)}}},_A=class e{#A;#e;constructor(A=void 0){v.util.markAsUncloneable(this),A!==$m&&(this.#e=new mo,this.#A="none",A!==void 0&&(A=v.converters.HeadersInit(A,"Headers contructor","init"),mI(this,A)))}append(A,t){v.brandCheck(this,e),v.argumentLengthCheck(arguments,2,"Headers.append");let r="Headers.append";return A=v.converters.ByteString(A,r,"name"),t=v.converters.ByteString(t,r,"value"),ja(this,A,t)}delete(A){if(v.brandCheck(this,e),v.argumentLengthCheck(arguments,1,"Headers.delete"),A=v.converters.ByteString(A,"Headers.delete","name"),!qr(A))throw v.errors.invalidArgument({prefix:"Headers.delete",value:A,type:"header name"});if(this.#A==="immutable")throw new TypeError("immutable");this.#e.contains(A,!1)&&this.#e.delete(A,!1)}get(A){v.brandCheck(this,e),v.argumentLengthCheck(arguments,1,"Headers.get");let t="Headers.get";if(A=v.converters.ByteString(A,t,"name"),!qr(A))throw v.errors.invalidArgument({prefix:t,value:A,type:"header name"});return this.#e.get(A,!1)}has(A){v.brandCheck(this,e),v.argumentLengthCheck(arguments,1,"Headers.has");let t="Headers.has";if(A=v.converters.ByteString(A,t,"name"),!qr(A))throw v.errors.invalidArgument({prefix:t,value:A,type:"header name"});return this.#e.contains(A,!1)}set(A,t){v.brandCheck(this,e),v.argumentLengthCheck(arguments,2,"Headers.set");let r="Headers.set";if(A=v.converters.ByteString(A,r,"name"),t=v.converters.ByteString(t,r,"value"),t=DI(t),qr(A)){if(!pI(t))throw v.errors.invalidArgument({prefix:r,value:t,type:"header value"})}else throw v.errors.invalidArgument({prefix:r,value:A,type:"header name"});if(this.#A==="immutable")throw new TypeError("immutable");this.#e.set(A,t,!1)}getSetCookie(){v.brandCheck(this,e);let A=this.#e.cookies;return A?[...A]:[]}get[kA](){if(this.#e[kA])return this.#e[kA];let A=[],t=this.#e.toSortedArray(),r=this.#e.cookies;if(r===null||r.length===1)return this.#e[kA]=t;for(let n=0;n<t.length;++n){let{0:o,1:s}=t[n];if(o==="set-cookie")for(let i=0;i<r.length;++i)A.push([o,r[i]]);else A.push([o,s])}return this.#e[kA]=A}[Do.inspect.custom](A,t){return t.depth??=A,`Headers ${Do.formatWithOptions(t,this.#e.entries)}`}static getHeadersGuard(A){return A.#A}static setHeadersGuard(A,t){A.#A=t}static getHeadersList(A){return A.#e}static setHeadersList(A,t){A.#e=t}},{getHeadersGuard:FI,setHeadersGuard:ek,getHeadersList:$a,setHeadersList:tk}=_A;Reflect.deleteProperty(_A,"getHeadersGuard");Reflect.deleteProperty(_A,"setHeadersGuard");Reflect.deleteProperty(_A,"getHeadersList");Reflect.deleteProperty(_A,"setHeadersList");Ak("Headers",_A,kA,0,1);Object.defineProperties(_A.prototype,{append:Zt,delete:Zt,get:Zt,has:Zt,set:Zt,getSetCookie:Zt,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Do.inspect.custom]:{enumerable:!1}});v.converters.HeadersInit=function(e,A,t){if(v.util.Type(e)==="Object"){let r=Reflect.get(e,Symbol.iterator);if(!Do.types.isProxy(e)&&r===_A.prototype.entries)try{return $a(e).entriesList}catch{}return typeof r=="function"?v.converters["sequence<sequence<ByteString>>"](e,A,t,r.bind(e)):v.converters["record<ByteString, ByteString>"](e,A,t)}throw v.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};RI.exports={fill:mI,compareHeaderName:kI,Headers:_A,HeadersList:mo,getHeadersGuard:FI,setHeadersGuard:ek,setHeadersList:tk,getHeadersList:$a}});var Or=f((WU,vI)=>{"use strict";var{Headers:LI,HeadersList:bI,fill:rk,getHeadersGuard:nk,setHeadersGuard:TI,setHeadersList:YI}=rt(),{extractBody:NI,cloneBody:ok,mixinBody:sk,hasFinalizationRegistry:GI,streamRegistry:JI,bodyUnusable:ik}=bt(),Ag=G(),SI=h("node:util"),{kEnumerableProperty:FA}=Ag,{isValidReasonPhrase:ak,isCancelled:gk,isAborted:ck,isBlobLike:lk,serializeJavascriptValueToJSONString:Qk,isErrorLike:Ek,isomorphicEncode:Bk,environmentSettingsObject:Ik}=pA(),{redirectStatusSet:Ck,nullBodyStatus:uk}=Br(),{kState:X,kHeaders:ue}=pe(),{webidl:T}=gA(),{FormData:hk}=fr(),{URLSerializer:UI}=uA(),{kConstruct:Fo}=Z(),eg=h("node:assert"),{types:dk}=h("node:util"),fk=new TextEncoder("utf-8"),nt=class e{static error(){return Wr(Ro(),"immutable")}static json(A,t={}){T.argumentLengthCheck(arguments,1,"Response.json"),t!==null&&(t=T.converters.ResponseInit(t));let r=fk.encode(Qk(A)),n=NI(r),o=Wr(Kt({}),"response");return MI(o,t,{body:n[0],type:"application/json"}),o}static redirect(A,t=302){T.argumentLengthCheck(arguments,1,"Response.redirect"),A=T.converters.USVString(A),t=T.converters["unsigned short"](t);let r;try{r=new URL(A,Ik.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${A}`,{cause:s})}if(!Ck.has(t))throw new RangeError(`Invalid status code ${t}`);let n=Wr(Kt({}),"immutable");n[X].status=t;let o=Bk(UI(r));return n[X].headersList.append("location",o,!0),n}constructor(A=null,t={}){if(T.util.markAsUncloneable(this),A===Fo)return;A!==null&&(A=T.converters.BodyInit(A)),t=T.converters.ResponseInit(t),this[X]=Kt({}),this[ue]=new LI(Fo),TI(this[ue],"response"),YI(this[ue],this[X].headersList);let r=null;if(A!=null){let[n,o]=NI(A);r={body:n,type:o}}MI(this,t,r)}get type(){return T.brandCheck(this,e),this[X].type}get url(){T.brandCheck(this,e);let A=this[X].urlList,t=A[A.length-1]??null;return t===null?"":UI(t,!0)}get redirected(){return T.brandCheck(this,e),this[X].urlList.length>1}get status(){return T.brandCheck(this,e),this[X].status}get ok(){return T.brandCheck(this,e),this[X].status>=200&&this[X].status<=299}get statusText(){return T.brandCheck(this,e),this[X].statusText}get headers(){return T.brandCheck(this,e),this[ue]}get body(){return T.brandCheck(this,e),this[X].body?this[X].body.stream:null}get bodyUsed(){return T.brandCheck(this,e),!!this[X].body&&Ag.isDisturbed(this[X].body.stream)}clone(){if(T.brandCheck(this,e),ik(this))throw T.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let A=tg(this[X]);return GI&&this[X].body?.stream&&JI.register(this,new WeakRef(this[X].body.stream)),Wr(A,nk(this[ue]))}[SI.inspect.custom](A,t){t.depth===null&&(t.depth=2),t.colors??=!0;let r={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${SI.formatWithOptions(t,r)}`}};sk(nt);Object.defineProperties(nt.prototype,{type:FA,url:FA,status:FA,ok:FA,redirected:FA,statusText:FA,headers:FA,clone:FA,body:FA,bodyUsed:FA,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(nt,{json:FA,redirect:FA,error:FA});function tg(e){if(e.internalResponse)return xI(tg(e.internalResponse),e.type);let A=Kt({...e,body:null});return e.body!=null&&(A.body=ok(A,e.body)),A}function Kt(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new bI(e?.headersList):new bI,urlList:e?.urlList?[...e.urlList]:[]}}function Ro(e){let A=Ek(e);return Kt({type:"error",status:0,error:A?e:new Error(e&&String(e)),aborted:e&&e.name==="AbortError"})}function yk(e){return e.type==="error"&&e.status===0}function ko(e,A){return A={internalResponse:e,...A},new Proxy(e,{get(t,r){return r in A?A[r]:t[r]},set(t,r,n){return eg(!(r in A)),t[r]=n,!0}})}function xI(e,A){if(A==="basic")return ko(e,{type:"basic",headersList:e.headersList});if(A==="cors")return ko(e,{type:"cors",headersList:e.headersList});if(A==="opaque")return ko(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(A==="opaqueredirect")return ko(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});eg(!1)}function wk(e,A=null){return eg(gk(e)),ck(e)?Ro(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:A})):Ro(Object.assign(new DOMException("Request was cancelled."),{cause:A}))}function MI(e,A,t){if(A.status!==null&&(A.status<200||A.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in A&&A.statusText!=null&&!ak(String(A.statusText)))throw new TypeError("Invalid statusText");if("status"in A&&A.status!=null&&(e[X].status=A.status),"statusText"in A&&A.statusText!=null&&(e[X].statusText=A.statusText),"headers"in A&&A.headers!=null&&rk(e[ue],A.headers),t){if(uk.includes(e.status))throw T.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});e[X].body=t.body,t.type!=null&&!e[X].headersList.contains("content-type",!0)&&e[X].headersList.append("content-type",t.type,!0)}}function Wr(e,A){let t=new nt(Fo);return t[X]=e,t[ue]=new LI(Fo),YI(t[ue],e.headersList),TI(t[ue],A),GI&&e.body?.stream&&JI.register(t,new WeakRef(e.body.stream)),t}T.converters.ReadableStream=T.interfaceConverter(ReadableStream);T.converters.FormData=T.interfaceConverter(hk);T.converters.URLSearchParams=T.interfaceConverter(URLSearchParams);T.converters.XMLHttpRequestBodyInit=function(e,A,t){return typeof e=="string"?T.converters.USVString(e,A,t):lk(e)?T.converters.Blob(e,A,t,{strict:!1}):ArrayBuffer.isView(e)||dk.isArrayBuffer(e)?T.converters.BufferSource(e,A,t):Ag.isFormDataLike(e)?T.converters.FormData(e,A,t,{strict:!1}):e instanceof URLSearchParams?T.converters.URLSearchParams(e,A,t):T.converters.DOMString(e,A,t)};T.converters.BodyInit=function(e,A,t){return e instanceof ReadableStream?T.converters.ReadableStream(e,A,t):e?.[Symbol.asyncIterator]?e:T.converters.XMLHttpRequestBodyInit(e,A,t)};T.converters.ResponseInit=T.dictionaryConverter([{key:"status",converter:T.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:T.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:T.converters.HeadersInit}]);vI.exports={isNetworkError:yk,makeNetworkError:Ro,makeResponse:Kt,makeAppropriateNetworkError:wk,filterResponse:xI,Response:nt,cloneResponse:tg,fromInnerResponse:Wr}});var WI=f((OU,qI)=>{"use strict";var{kConnected:HI,kSize:VI}=Z(),rg=class{constructor(A){this.value=A}deref(){return this.value[HI]===0&&this.value[VI]===0?void 0:this.value}},ng=class{constructor(A){this.finalizer=A}register(A,t){A.on&&A.on("disconnect",()=>{A[HI]===0&&A[VI]===0&&this.finalizer(t)})}unregister(A){}};qI.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:rg,FinalizationRegistry:ng}):{WeakRef,FinalizationRegistry}}});var Xt=f((PU,oC)=>{"use strict";var{extractBody:pk,mixinBody:Dk,cloneBody:mk,bodyUnusable:OI}=bt(),{Headers:AC,fill:kk,HeadersList:Uo,setHeadersGuard:sg,getHeadersGuard:Fk,setHeadersList:eC,getHeadersList:PI}=rt(),{FinalizationRegistry:Rk}=WI()(),No=G(),_I=h("node:util"),{isValidHTTPToken:bk,sameOrigin:zI,environmentSettingsObject:bo}=pA(),{forbiddenMethodsSet:Nk,corsSafeListedMethodsSet:Sk,referrerPolicy:Uk,requestRedirect:Mk,requestMode:Lk,requestCredentials:Tk,requestCache:Yk,requestDuplex:Gk}=Br(),{kEnumerableProperty:rA,normalizedMethodRecordsBase:Jk,normalizedMethodRecords:xk}=No,{kHeaders:RA,kSignal:So,kState:z,kDispatcher:og}=pe(),{webidl:N}=gA(),{URLSerializer:vk}=uA(),{kConstruct:Mo}=Z(),Hk=h("node:assert"),{getMaxListeners:ZI,setMaxListeners:KI,getEventListeners:Vk,defaultMaxListeners:XI}=h("node:events"),qk=Symbol("abortController"),tC=new Rk(({signal:e,abort:A})=>{e.removeEventListener("abort",A)}),Lo=new WeakMap;function jI(e){return A;function A(){let t=e.deref();if(t!==void 0){tC.unregister(A),this.removeEventListener("abort",A),t.abort(this.reason);let r=Lo.get(t.signal);if(r!==void 0){if(r.size!==0){for(let n of r){let o=n.deref();o!==void 0&&o.abort(this.reason)}r.clear()}Lo.delete(t.signal)}}}}var $I=!1,Te=class e{constructor(A,t={}){if(N.util.markAsUncloneable(this),A===Mo)return;let r="Request constructor";N.argumentLengthCheck(arguments,1,r),A=N.converters.RequestInfo(A,r,"input"),t=N.converters.RequestInit(t,r,"init");let n=null,o=null,s=bo.settingsObject.baseUrl,i=null;if(typeof A=="string"){this[og]=t.dispatcher;let I;try{I=new URL(A,s)}catch(u){throw new TypeError("Failed to parse URL from "+A,{cause:u})}if(I.username||I.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+A);n=To({urlList:[I]}),o="cors"}else this[og]=t.dispatcher||A[og],Hk(A instanceof e),n=A[z],i=A[So];let a=bo.settingsObject.origin,g="client";if(n.window?.constructor?.name==="EnvironmentSettingsObject"&&zI(n.window,a)&&(g=n.window),t.window!=null)throw new TypeError(`'window' option '${g}' must be null`);"window"in t&&(g="no-window"),n=To({method:n.method,headersList:n.headersList,unsafeRequest:n.unsafeRequest,client:bo.settingsObject,window:g,priority:n.priority,origin:n.origin,referrer:n.referrer,referrerPolicy:n.referrerPolicy,mode:n.mode,credentials:n.credentials,cache:n.cache,redirect:n.redirect,integrity:n.integrity,keepalive:n.keepalive,reloadNavigation:n.reloadNavigation,historyNavigation:n.historyNavigation,urlList:[...n.urlList]});let c=Object.keys(t).length!==0;if(c&&(n.mode==="navigate"&&(n.mode="same-origin"),n.reloadNavigation=!1,n.historyNavigation=!1,n.origin="client",n.referrer="client",n.referrerPolicy="",n.url=n.urlList[n.urlList.length-1],n.urlList=[n.url]),t.referrer!==void 0){let I=t.referrer;if(I==="")n.referrer="no-referrer";else{let u;try{u=new URL(I,s)}catch(D){throw new TypeError(`Referrer "${I}" is not a valid URL.`,{cause:D})}u.protocol==="about:"&&u.hostname==="client"||a&&!zI(u,bo.settingsObject.baseUrl)?n.referrer="client":n.referrer=u}}t.referrerPolicy!==void 0&&(n.referrerPolicy=t.referrerPolicy);let l;if(t.mode!==void 0?l=t.mode:l=o,l==="navigate")throw N.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(l!=null&&(n.mode=l),t.credentials!==void 0&&(n.credentials=t.credentials),t.cache!==void 0&&(n.cache=t.cache),n.cache==="only-if-cached"&&n.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(t.redirect!==void 0&&(n.redirect=t.redirect),t.integrity!=null&&(n.integrity=String(t.integrity)),t.keepalive!==void 0&&(n.keepalive=!!t.keepalive),t.method!==void 0){let I=t.method,u=xk[I];if(u!==void 0)n.method=u;else{if(!bk(I))throw new TypeError(`'${I}' is not a valid HTTP method.`);let D=I.toUpperCase();if(Nk.has(D))throw new TypeError(`'${I}' HTTP method is unsupported.`);I=Jk[D]??I,n.method=I}!$I&&n.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),$I=!0)}t.signal!==void 0&&(i=t.signal),this[z]=n;let Q=new AbortController;if(this[So]=Q.signal,i!=null){if(!i||typeof i.aborted!="boolean"||typeof i.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(i.aborted)Q.abort(i.reason);else{this[qk]=Q;let I=new WeakRef(Q),u=jI(I);try{(typeof ZI=="function"&&ZI(i)===XI||Vk(i,"abort").length>=XI)&&KI(1500,i)}catch{}No.addAbortListener(i,u),tC.register(Q,{signal:i,abort:u},u)}}if(this[RA]=new AC(Mo),eC(this[RA],n.headersList),sg(this[RA],"request"),l==="no-cors"){if(!Sk.has(n.method))throw new TypeError(`'${n.method} is unsupported in no-cors mode.`);sg(this[RA],"request-no-cors")}if(c){let I=PI(this[RA]),u=t.headers!==void 0?t.headers:new Uo(I);if(I.clear(),u instanceof Uo){for(let{name:D,value:p}of u.rawValues())I.append(D,p,!1);I.cookies=u.cookies}else kk(this[RA],u)}let E=A instanceof e?A[z].body:null;if((t.body!=null||E!=null)&&(n.method==="GET"||n.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let B=null;if(t.body!=null){let[I,u]=pk(t.body,n.keepalive);B=I,u&&!PI(this[RA]).contains("content-type",!0)&&this[RA].append("content-type",u)}let C=B??E;if(C!=null&&C.source==null){if(B!=null&&t.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(n.mode!=="same-origin"&&n.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');n.useCORSPreflightFlag=!0}let d=C;if(B==null&&E!=null){if(OI(A))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let I=new TransformStream;E.stream.pipeThrough(I),d={source:E.source,length:E.length,stream:I.readable}}this[z].body=d}get method(){return N.brandCheck(this,e),this[z].method}get url(){return N.brandCheck(this,e),vk(this[z].url)}get headers(){return N.brandCheck(this,e),this[RA]}get destination(){return N.brandCheck(this,e),this[z].destination}get referrer(){return N.brandCheck(this,e),this[z].referrer==="no-referrer"?"":this[z].referrer==="client"?"about:client":this[z].referrer.toString()}get referrerPolicy(){return N.brandCheck(this,e),this[z].referrerPolicy}get mode(){return N.brandCheck(this,e),this[z].mode}get credentials(){return this[z].credentials}get cache(){return N.brandCheck(this,e),this[z].cache}get redirect(){return N.brandCheck(this,e),this[z].redirect}get integrity(){return N.brandCheck(this,e),this[z].integrity}get keepalive(){return N.brandCheck(this,e),this[z].keepalive}get isReloadNavigation(){return N.brandCheck(this,e),this[z].reloadNavigation}get isHistoryNavigation(){return N.brandCheck(this,e),this[z].historyNavigation}get signal(){return N.brandCheck(this,e),this[So]}get body(){return N.brandCheck(this,e),this[z].body?this[z].body.stream:null}get bodyUsed(){return N.brandCheck(this,e),!!this[z].body&&No.isDisturbed(this[z].body.stream)}get duplex(){return N.brandCheck(this,e),"half"}clone(){if(N.brandCheck(this,e),OI(this))throw new TypeError("unusable");let A=rC(this[z]),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let r=Lo.get(this.signal);r===void 0&&(r=new Set,Lo.set(this.signal,r));let n=new WeakRef(t);r.add(n),No.addAbortListener(t.signal,jI(n))}return nC(A,t.signal,Fk(this[RA]))}[_I.inspect.custom](A,t){t.depth===null&&(t.depth=2),t.colors??=!0;let r={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${_I.formatWithOptions(t,r)}`}};Dk(Te);function To(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new Uo(e.headersList):new Uo}}function rC(e){let A=To({...e,body:null});return e.body!=null&&(A.body=mk(A,e.body)),A}function nC(e,A,t){let r=new Te(Mo);return r[z]=e,r[So]=A,r[RA]=new AC(Mo),eC(r[RA],e.headersList),sg(r[RA],t),r}Object.defineProperties(Te.prototype,{method:rA,url:rA,headers:rA,redirect:rA,clone:rA,signal:rA,duplex:rA,destination:rA,body:rA,bodyUsed:rA,isHistoryNavigation:rA,isReloadNavigation:rA,keepalive:rA,integrity:rA,cache:rA,credentials:rA,attribute:rA,referrerPolicy:rA,referrer:rA,mode:rA,[Symbol.toStringTag]:{value:"Request",configurable:!0}});N.converters.Request=N.interfaceConverter(Te);N.converters.RequestInfo=function(e,A,t){return typeof e=="string"?N.converters.USVString(e,A,t):e instanceof Te?N.converters.Request(e,A,t):N.converters.USVString(e,A,t)};N.converters.AbortSignal=N.interfaceConverter(AbortSignal);N.converters.RequestInit=N.dictionaryConverter([{key:"method",converter:N.converters.ByteString},{key:"headers",converter:N.converters.HeadersInit},{key:"body",converter:N.nullableConverter(N.converters.BodyInit)},{key:"referrer",converter:N.converters.USVString},{key:"referrerPolicy",converter:N.converters.DOMString,allowedValues:Uk},{key:"mode",converter:N.converters.DOMString,allowedValues:Lk},{key:"credentials",converter:N.converters.DOMString,allowedValues:Tk},{key:"cache",converter:N.converters.DOMString,allowedValues:Yk},{key:"redirect",converter:N.converters.DOMString,allowedValues:Mk},{key:"integrity",converter:N.converters.DOMString},{key:"keepalive",converter:N.converters.boolean},{key:"signal",converter:N.nullableConverter(e=>N.converters.AbortSignal(e,"RequestInit","signal",{strict:!1}))},{key:"window",converter:N.converters.any},{key:"duplex",converter:N.converters.DOMString,allowedValues:Gk},{key:"dispatcher",converter:N.converters.any}]);oC.exports={Request:Te,makeRequest:To,fromInnerRequest:nC,cloneRequest:rC}});var _r=f((_U,fC)=>{"use strict";var{makeNetworkError:W,makeAppropriateNetworkError:Yo,filterResponse:ig,makeResponse:Go,fromInnerResponse:Wk}=Or(),{HeadersList:sC}=rt(),{Request:Ok,cloneRequest:Pk}=Xt(),Ye=h("node:zlib"),{bytesMatch:_k,makePolicyContainer:zk,clonePolicyContainer:Zk,requestBadPort:Kk,TAOCheck:Xk,appendRequestOriginHeader:jk,responseLocationURL:$k,requestCurrentURL:ie,setRequestReferrerPolicyOnRedirect:AF,tryUpgradeRequestToAPotentiallyTrustworthyURL:eF,createOpaqueTimingInfo:Qg,appendFetchMetadata:tF,corsCheck:rF,crossOriginResourcePolicyCheck:nF,determineRequestsReferrer:oF,coarsenedSharedCurrentTime:Pr,createDeferredPromise:sF,isBlobLike:iF,sameOrigin:lg,isCancelled:ot,isAborted:iC,isErrorLike:aF,fullyReadBody:gF,readableStreamClose:cF,isomorphicEncode:Jo,urlIsLocal:lF,urlIsHttpHttpsScheme:Eg,urlHasHttpsScheme:QF,clampAndCoarsenConnectionTimingInfo:EF,simpleRangeHeaderValue:BF,buildContentRange:IF,createInflate:CF,extractMimeType:uF}=pA(),{kState:lC,kDispatcher:hF}=pe(),st=h("node:assert"),{safelyExtractBody:Bg,extractBody:aC}=bt(),{redirectStatusSet:QC,nullBodyStatus:EC,safeMethodsSet:dF,requestBodyHeader:fF,subresourceSet:yF}=Br(),wF=h("node:events"),{Readable:pF,pipeline:DF,finished:mF}=h("node:stream"),{addAbortListener:kF,isErrored:FF,isReadable:xo,bufferToLowerCasedHeaderName:gC}=G(),{dataURLProcessor:RF,serializeAMimeType:bF,minimizeSupportedMimeType:NF}=uA(),{getGlobalDispatcher:SF}=wo(),{webidl:UF}=gA(),{STATUS_CODES:MF}=h("node:http"),LF=["GET","HEAD"],TF=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",ag,vo=class extends wF{constructor(A){super(),this.dispatcher=A,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(A){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(A),this.emit("terminated",A))}abort(A){this.state==="ongoing"&&(this.state="aborted",A||(A=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=A,this.connection?.destroy(A),this.emit("terminated",A))}};function YF(e){BC(e,"fetch")}function GF(e,A=void 0){UF.argumentLengthCheck(arguments,1,"globalThis.fetch");let t=sF(),r;try{r=new Ok(e,A)}catch(c){return t.reject(c),t.promise}let n=r[lC];if(r.signal.aborted)return gg(t,n,null,r.signal.reason),t.promise;n.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(n.serviceWorkers="none");let s=null,i=!1,a=null;return kF(r.signal,()=>{i=!0,st(a!=null),a.abort(r.signal.reason);let c=s?.deref();gg(t,n,c,r.signal.reason)}),a=CC({request:n,processResponseEndOfBody:YF,processResponse:c=>{if(!i){if(c.aborted){gg(t,n,s,a.serializedAbortReason);return}if(c.type==="error"){t.reject(new TypeError("fetch failed",{cause:c.error}));return}s=new WeakRef(Wk(c,"immutable")),t.resolve(s.deref()),t=null}},dispatcher:r[hF]}),t.promise}function BC(e,A="other"){if(e.type==="error"&&e.aborted||!e.urlList?.length)return;let t=e.urlList[0],r=e.timingInfo,n=e.cacheState;Eg(t)&&r!==null&&(e.timingAllowPassed||(r=Qg({startTime:r.startTime}),n=""),r.endTime=Pr(),e.timingInfo=r,IC(r,t.href,A,globalThis,n))}var IC=performance.markResourceTiming;function gg(e,A,t,r){if(e&&e.reject(r),A.body!=null&&xo(A.body?.stream)&&A.body.stream.cancel(r).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),t==null)return;let n=t[lC];n.body!=null&&xo(n.body?.stream)&&n.body.stream.cancel(r).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o})}function CC({request:e,processRequestBodyChunkLength:A,processRequestEndOfBody:t,processResponse:r,processResponseEndOfBody:n,processResponseConsumeBody:o,useParallelQueue:s=!1,dispatcher:i=SF()}){st(i);let a=null,g=!1;e.client!=null&&(a=e.client.globalObject,g=e.client.crossOriginIsolatedCapability);let c=Pr(g),l=Qg({startTime:c}),Q={controller:new vo(i),request:e,timingInfo:l,processRequestBodyChunkLength:A,processRequestEndOfBody:t,processResponse:r,processResponseConsumeBody:o,processResponseEndOfBody:n,taskDestination:a,crossOriginIsolatedCapability:g};return st(!e.body||e.body.stream),e.window==="client"&&(e.window=e.client?.globalObject?.constructor?.name==="Window"?e.client:"no-window"),e.origin==="client"&&(e.origin=e.client.origin),e.policyContainer==="client"&&(e.client!=null?e.policyContainer=Zk(e.client.policyContainer):e.policyContainer=zk()),e.headersList.contains("accept",!0)||e.headersList.append("accept","*/*",!0),e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,yF.has(e.destination),uC(Q).catch(E=>{Q.controller.terminate(E)}),Q.controller}async function uC(e,A=!1){let t=e.request,r=null;if(t.localURLsOnly&&!lF(ie(t))&&(r=W("local URLs only")),eF(t),Kk(t)==="blocked"&&(r=W("bad port")),t.referrerPolicy===""&&(t.referrerPolicy=t.policyContainer.referrerPolicy),t.referrer!=="no-referrer"&&(t.referrer=oF(t)),r===null&&(r=await(async()=>{let o=ie(t);return lg(o,t.url)&&t.responseTainting==="basic"||o.protocol==="data:"||t.mode==="navigate"||t.mode==="websocket"?(t.responseTainting="basic",await cC(e)):t.mode==="same-origin"?W('request mode cannot be "same-origin"'):t.mode==="no-cors"?t.redirect!=="follow"?W('redirect mode cannot be "follow" for "no-cors" request'):(t.responseTainting="opaque",await cC(e)):Eg(ie(t))?(t.responseTainting="cors",await hC(e)):W("URL scheme must be a HTTP(S) scheme")})()),A)return r;r.status!==0&&!r.internalResponse&&(t.responseTainting,t.responseTainting==="basic"?r=ig(r,"basic"):t.responseTainting==="cors"?r=ig(r,"cors"):t.responseTainting==="opaque"?r=ig(r,"opaque"):st(!1));let n=r.status===0?r:r.internalResponse;if(n.urlList.length===0&&n.urlList.push(...t.urlList),t.timingAllowFailed||(r.timingAllowPassed=!0),r.type==="opaque"&&n.status===206&&n.rangeRequested&&!t.headers.contains("range",!0)&&(r=n=W()),r.status!==0&&(t.method==="HEAD"||t.method==="CONNECT"||EC.includes(n.status))&&(n.body=null,e.controller.dump=!0),t.integrity){let o=i=>cg(e,W(i));if(t.responseTainting==="opaque"||r.body==null){o(r.error);return}let s=i=>{if(!_k(i,t.integrity)){o("integrity mismatch");return}r.body=Bg(i)[0],cg(e,r)};await gF(r.body,s,o)}else cg(e,r)}function cC(e){if(ot(e)&&e.request.redirectCount===0)return Promise.resolve(Yo(e));let{request:A}=e,{protocol:t}=ie(A);switch(t){case"about:":return Promise.resolve(W("about scheme is not supported"));case"blob:":{ag||(ag=h("node:buffer").resolveObjectURL);let r=ie(A);if(r.search.length!==0)return Promise.resolve(W("NetworkError when attempting to fetch resource."));let n=ag(r.toString());if(A.method!=="GET"||!iF(n))return Promise.resolve(W("invalid method"));let o=Go(),s=n.size,i=Jo(`${s}`),a=n.type;if(A.headersList.contains("range",!0)){o.rangeRequested=!0;let g=A.headersList.get("range",!0),c=BF(g,!0);if(c==="failure")return Promise.resolve(W("failed to fetch the data URL"));let{rangeStartValue:l,rangeEndValue:Q}=c;if(l===null)l=s-Q,Q=l+Q-1;else{if(l>=s)return Promise.resolve(W("Range start is greater than the blob's size."));(Q===null||Q>=s)&&(Q=s-1)}let E=n.slice(l,Q,a),B=aC(E);o.body=B[0];let C=Jo(`${E.size}`),d=IF(l,Q,s);o.status=206,o.statusText="Partial Content",o.headersList.set("content-length",C,!0),o.headersList.set("content-type",a,!0),o.headersList.set("content-range",d,!0)}else{let g=aC(n);o.statusText="OK",o.body=g[0],o.headersList.set("content-length",i,!0),o.headersList.set("content-type",a,!0)}return Promise.resolve(o)}case"data:":{let r=ie(A),n=RF(r);if(n==="failure")return Promise.resolve(W("failed to fetch the data URL"));let o=bF(n.mimeType);return Promise.resolve(Go({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:o}]],body:Bg(n.body)[0]}))}case"file:":return Promise.resolve(W("not implemented... yet..."));case"http:":case"https:":return hC(e).catch(r=>W(r));default:return Promise.resolve(W("unknown scheme"))}}function JF(e,A){e.request.done=!0,e.processResponseDone!=null&&queueMicrotask(()=>e.processResponseDone(A))}function cg(e,A){let t=e.timingInfo,r=()=>{let o=Date.now();e.request.destination==="document"&&(e.controller.fullTimingInfo=t),e.controller.reportTimingSteps=()=>{if(e.request.url.protocol!=="https:")return;t.endTime=o;let i=A.cacheState,a=A.bodyInfo;A.timingAllowPassed||(t=Qg(t),i="");let g=0;if(e.request.mode!=="navigator"||!A.hasCrossOriginRedirects){g=A.status;let c=uF(A.headersList);c!=="failure"&&(a.contentType=NF(c))}e.request.initiatorType!=null&&IC(t,e.request.url.href,e.request.initiatorType,globalThis,i,a,g)};let s=()=>{e.request.done=!0,e.processResponseEndOfBody!=null&&queueMicrotask(()=>e.processResponseEndOfBody(A)),e.request.initiatorType!=null&&e.controller.reportTimingSteps()};queueMicrotask(()=>s())};e.processResponse!=null&&queueMicrotask(()=>{e.processResponse(A),e.processResponse=null});let n=A.type==="error"?A:A.internalResponse??A;n.body==null?r():mF(n.body.stream,()=>{r()})}async function hC(e){let A=e.request,t=null,r=null,n=e.timingInfo;if(A.serviceWorkers,t===null){if(A.redirect==="follow"&&(A.serviceWorkers="none"),r=t=await dC(e),A.responseTainting==="cors"&&rF(A,t)==="failure")return W("cors failure");Xk(A,t)==="failure"&&(A.timingAllowFailed=!0)}return(A.responseTainting==="opaque"||t.type==="opaque")&&nF(A.origin,A.client,A.destination,r)==="blocked"?W("blocked"):(QC.has(r.status)&&(A.redirect!=="manual"&&e.controller.connection.destroy(void 0,!1),A.redirect==="error"?t=W("unexpected redirect"):A.redirect==="manual"?t=r:A.redirect==="follow"?t=await xF(e,t):st(!1)),t.timingInfo=n,t)}function xF(e,A){let t=e.request,r=A.internalResponse?A.internalResponse:A,n;try{if(n=$k(r,ie(t).hash),n==null)return A}catch(s){return Promise.resolve(W(s))}if(!Eg(n))return Promise.resolve(W("URL scheme must be a HTTP(S) scheme"));if(t.redirectCount===20)return Promise.resolve(W("redirect count exceeded"));if(t.redirectCount+=1,t.mode==="cors"&&(n.username||n.password)&&!lg(t,n))return Promise.resolve(W('cross origin not allowed for request mode "cors"'));if(t.responseTainting==="cors"&&(n.username||n.password))return Promise.resolve(W('URL cannot contain credentials for request mode "cors"'));if(r.status!==303&&t.body!=null&&t.body.source==null)return Promise.resolve(W());if([301,302].includes(r.status)&&t.method==="POST"||r.status===303&&!LF.includes(t.method)){t.method="GET",t.body=null;for(let s of fF)t.headersList.delete(s)}lg(ie(t),n)||(t.headersList.delete("authorization",!0),t.headersList.delete("proxy-authorization",!0),t.headersList.delete("cookie",!0),t.headersList.delete("host",!0)),t.body!=null&&(st(t.body.source!=null),t.body=Bg(t.body.source)[0]);let o=e.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=Pr(e.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),t.urlList.push(n),AF(t,r),uC(e,!0)}async function dC(e,A=!1,t=!1){let r=e.request,n=null,o=null,s=null,i=null,a=!1;r.window==="no-window"&&r.redirect==="error"?(n=e,o=r):(o=Pk(r),n={...e},n.request=o);let g=r.credentials==="include"||r.credentials==="same-origin"&&r.responseTainting==="basic",c=o.body?o.body.length:null,l=null;if(o.body==null&&["POST","PUT"].includes(o.method)&&(l="0"),c!=null&&(l=Jo(`${c}`)),l!=null&&o.headersList.append("content-length",l,!0),c!=null&&o.keepalive,o.referrer instanceof URL&&o.headersList.append("referer",Jo(o.referrer.href),!0),jk(o),tF(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",TF),o.cache==="default"&&(o.headersList.contains("if-modified-since",!0)||o.headersList.contains("if-none-match",!0)||o.headersList.contains("if-unmodified-since",!0)||o.headersList.contains("if-match",!0)||o.headersList.contains("if-range",!0))&&(o.cache="no-store"),o.cache==="no-cache"&&!o.preventNoCacheCacheControlHeaderModification&&!o.headersList.contains("cache-control",!0)&&o.headersList.append("cache-control","max-age=0",!0),(o.cache==="no-store"||o.cache==="reload")&&(o.headersList.contains("pragma",!0)||o.headersList.append("pragma","no-cache",!0),o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","no-cache",!0)),o.headersList.contains("range",!0)&&o.headersList.append("accept-encoding","identity",!0),o.headersList.contains("accept-encoding",!0)||(QF(ie(o))?o.headersList.append("accept-encoding","br, gzip, deflate",!0):o.headersList.append("accept-encoding","gzip, deflate",!0)),o.headersList.delete("host",!0),i==null&&(o.cache="no-store"),o.cache!=="no-store"&&o.cache,s==null){if(o.cache==="only-if-cached")return W("only if cached");let Q=await vF(n,g,t);!dF.has(o.method)&&Q.status>=200&&Q.status<=399,a&&Q.status,s==null&&(s=Q)}if(s.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=g,s.status===407)return r.window==="no-window"?W():ot(e)?Yo(e):W("proxy authentication required");if(s.status===421&&!t&&(r.body==null||r.body.source!=null)){if(ot(e))return Yo(e);e.controller.connection.destroy(),s=await dC(e,A,!0)}return s}async function vF(e,A=!1,t=!1){st(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(B,C=!0){this.destroyed||(this.destroyed=!0,C&&this.abort?.(B??new DOMException("The operation was aborted.","AbortError")))}};let r=e.request,n=null,o=e.timingInfo;null==null&&(r.cache="no-store");let i=t?"yes":"no";r.mode;let a=null;if(r.body==null&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(r.body!=null){let B=async function*(I){ot(e)||(yield I,e.processRequestBodyChunkLength?.(I.byteLength))},C=()=>{ot(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},d=I=>{ot(e)||(I.name==="AbortError"?e.controller.abort():e.controller.terminate(I))};a=(async function*(){try{for await(let I of r.body.stream)yield*B(I);C()}catch(I){d(I)}})()}try{let{body:B,status:C,statusText:d,headersList:I,socket:u}=await E({body:a});if(u)n=Go({status:C,statusText:d,headersList:I,socket:u});else{let D=B[Symbol.asyncIterator]();e.controller.next=()=>D.next(),n=Go({status:C,statusText:d,headersList:I})}}catch(B){return B.name==="AbortError"?(e.controller.connection.destroy(),Yo(e,B)):W(B)}let g=async()=>{await e.controller.resume()},c=B=>{ot(e)||e.controller.abort(B)},l=new ReadableStream({async start(B){e.controller.controller=B},async pull(B){await g(B)},async cancel(B){await c(B)},type:"bytes"});n.body={stream:l,source:null,length:null},e.controller.onAborted=Q,e.controller.on("terminated",Q),e.controller.resume=async()=>{for(;;){let B,C;try{let{done:I,value:u}=await e.controller.next();if(iC(e))break;B=I?void 0:u}catch(I){e.controller.ended&&!o.encodedBodySize?B=void 0:(B=I,C=!0)}if(B===void 0){cF(e.controller.controller),JF(e,n);return}if(o.decodedBodySize+=B?.byteLength??0,C){e.controller.terminate(B);return}let d=new Uint8Array(B);if(d.byteLength&&e.controller.controller.enqueue(d),FF(l)){e.controller.terminate();return}if(e.controller.controller.desiredSize<=0)return}};function Q(B){iC(e)?(n.aborted=!0,xo(l)&&e.controller.controller.error(e.controller.serializedAbortReason)):xo(l)&&e.controller.controller.error(new TypeError("terminated",{cause:aF(B)?B:void 0})),e.controller.connection.destroy()}return n;function E({body:B}){let C=ie(r),d=e.controller.dispatcher;return new Promise((I,u)=>d.dispatch({path:C.pathname+C.search,origin:C.origin,method:r.method,body:d.isMockActive?r.body&&(r.body.source||r.body.stream):B,headers:r.headersList.entries,maxRedirections:0,upgrade:r.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(D){let{connection:p}=e.controller;o.finalConnectionTimingInfo=EF(void 0,o.postRedirectStartTime,e.crossOriginIsolatedCapability),p.destroyed?D(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",D),this.abort=p.abort=D),o.finalNetworkRequestStartTime=Pr(e.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=Pr(e.crossOriginIsolatedCapability)},onHeaders(D,p,F,L){if(D<200)return;let Y="",$=new sC;for(let CA=0;CA<p.length;CA+=2)$.append(gC(p[CA]),p[CA+1].toString("latin1"),!0);Y=$.get("location",!0),this.body=new pF({read:F});let sA=[],Qt=Y&&r.redirect==="follow"&&QC.has(D);if(r.method!=="HEAD"&&r.method!=="CONNECT"&&!EC.includes(D)&&!Qt){let CA=$.get("content-encoding",!0),Et=CA?CA.toLowerCase().split(","):[],Bt=5;if(Et.length>Bt)return u(new Error(`too many content-encodings in response: ${Et.length}, maximum allowed is ${Bt}`)),!0;for(let Bs=Et.length-1;Bs>=0;--Bs){let Qn=Et[Bs].trim();if(Qn==="x-gzip"||Qn==="gzip")sA.push(Ye.createGunzip({flush:Ye.constants.Z_SYNC_FLUSH,finishFlush:Ye.constants.Z_SYNC_FLUSH}));else if(Qn==="deflate")sA.push(CF({flush:Ye.constants.Z_SYNC_FLUSH,finishFlush:Ye.constants.Z_SYNC_FLUSH}));else if(Qn==="br")sA.push(Ye.createBrotliDecompress({flush:Ye.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ye.constants.BROTLI_OPERATION_FLUSH}));else{sA.length=0;break}}}let ye=this.onError.bind(this);return I({status:D,statusText:L,headersList:$,body:sA.length?DF(this.body,...sA,CA=>{CA&&this.onError(CA)}).on("error",ye):this.body.on("error",ye)}),!0},onData(D){if(e.controller.dump)return;let p=D;return o.encodedBodySize+=p.byteLength,this.body.push(p)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.onAborted&&e.controller.off("terminated",e.controller.onAborted),e.controller.ended=!0,this.body.push(null)},onError(D){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(D),e.controller.terminate(D),u(D)},onUpgrade(D,p,F){if(D!==101)return;let L=new sC;for(let Y=0;Y<p.length;Y+=2)L.append(gC(p[Y]),p[Y+1].toString("latin1"),!0);return I({status:D,statusText:MF[D],headersList:L,socket:F}),!0}}))}}fC.exports={fetch:GF,Fetch:vo,fetching:CC,finalizeAndReportTiming:BC}});var Ig=f((zU,yC)=>{"use strict";yC.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var pC=f((ZU,wC)=>{"use strict";var{webidl:bA}=gA(),Ho=Symbol("ProgressEvent state"),Cg=class e extends Event{constructor(A,t={}){A=bA.converters.DOMString(A,"ProgressEvent constructor","type"),t=bA.converters.ProgressEventInit(t??{}),super(A,t),this[Ho]={lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total}}get lengthComputable(){return bA.brandCheck(this,e),this[Ho].lengthComputable}get loaded(){return bA.brandCheck(this,e),this[Ho].loaded}get total(){return bA.brandCheck(this,e),this[Ho].total}};bA.converters.ProgressEventInit=bA.dictionaryConverter([{key:"lengthComputable",converter:bA.converters.boolean,defaultValue:()=>!1},{key:"loaded",converter:bA.converters["unsigned long long"],defaultValue:()=>0},{key:"total",converter:bA.converters["unsigned long long"],defaultValue:()=>0},{key:"bubbles",converter:bA.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:bA.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:bA.converters.boolean,defaultValue:()=>!1}]);wC.exports={ProgressEvent:Cg}});var mC=f((KU,DC)=>{"use strict";function HF(e){if(!e)return"failure";switch(e.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}DC.exports={getEncoding:HF}});var MC=f((XU,UC)=>{"use strict";var{kState:jt,kError:ug,kResult:kC,kAborted:zr,kLastProgressEventFired:hg}=Ig(),{ProgressEvent:VF}=pC(),{getEncoding:FC}=mC(),{serializeAMimeType:qF,parseMIMEType:RC}=uA(),{types:WF}=h("node:util"),{StringDecoder:bC}=h("string_decoder"),{btoa:NC}=h("node:buffer"),OF={enumerable:!0,writable:!1,configurable:!1};function PF(e,A,t,r){if(e[jt]==="loading")throw new DOMException("Invalid state","InvalidStateError");e[jt]="loading",e[kC]=null,e[ug]=null;let o=A.stream().getReader(),s=[],i=o.read(),a=!0;(async()=>{for(;!e[zr];)try{let{done:g,value:c}=await i;if(a&&!e[zr]&&queueMicrotask(()=>{Ge("loadstart",e)}),a=!1,!g&&WF.isUint8Array(c))s.push(c),(e[hg]===void 0||Date.now()-e[hg]>=50)&&!e[zr]&&(e[hg]=Date.now(),queueMicrotask(()=>{Ge("progress",e)})),i=o.read();else if(g){queueMicrotask(()=>{e[jt]="done";try{let l=_F(s,t,A.type,r);if(e[zr])return;e[kC]=l,Ge("load",e)}catch(l){e[ug]=l,Ge("error",e)}e[jt]!=="loading"&&Ge("loadend",e)});break}}catch(g){if(e[zr])return;queueMicrotask(()=>{e[jt]="done",e[ug]=g,Ge("error",e),e[jt]!=="loading"&&Ge("loadend",e)});break}})()}function Ge(e,A){let t=new VF(e,{bubbles:!1,cancelable:!1});A.dispatchEvent(t)}function _F(e,A,t,r){switch(A){case"DataURL":{let n="data:",o=RC(t||"application/octet-stream");o!=="failure"&&(n+=qF(o)),n+=";base64,";let s=new bC("latin1");for(let i of e)n+=NC(s.write(i));return n+=NC(s.end()),n}case"Text":{let n="failure";if(r&&(n=FC(r)),n==="failure"&&t){let o=RC(t);o!=="failure"&&(n=FC(o.parameters.get("charset")))}return n==="failure"&&(n="UTF-8"),zF(e,n)}case"ArrayBuffer":return SC(e).buffer;case"BinaryString":{let n="",o=new bC("latin1");for(let s of e)n+=o.write(s);return n+=o.end(),n}}}function zF(e,A){let t=SC(e),r=ZF(t),n=0;r!==null&&(A=r,n=r==="UTF-8"?3:2);let o=t.slice(n);return new TextDecoder(A).decode(o)}function ZF(e){let[A,t,r]=e;return A===239&&t===187&&r===191?"UTF-8":A===254&&t===255?"UTF-16BE":A===255&&t===254?"UTF-16LE":null}function SC(e){let A=e.reduce((r,n)=>r+n.byteLength,0),t=0;return e.reduce((r,n)=>(r.set(n,t),t+=n.byteLength,r),new Uint8Array(A))}UC.exports={staticPropertyDescriptors:OF,readOperation:PF,fireAProgressEvent:Ge}});var GC=f((jU,YC)=>{"use strict";var{staticPropertyDescriptors:$t,readOperation:Vo,fireAProgressEvent:LC}=MC(),{kState:it,kError:TC,kResult:qo,kEvents:V,kAborted:KF}=Ig(),{webidl:O}=gA(),{kEnumerableProperty:fA}=G(),zA=class e extends EventTarget{constructor(){super(),this[it]="empty",this[qo]=null,this[TC]=null,this[V]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(A){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),A=O.converters.Blob(A,{strict:!1}),Vo(this,A,"ArrayBuffer")}readAsBinaryString(A){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),A=O.converters.Blob(A,{strict:!1}),Vo(this,A,"BinaryString")}readAsText(A,t=void 0){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsText"),A=O.converters.Blob(A,{strict:!1}),t!==void 0&&(t=O.converters.DOMString(t,"FileReader.readAsText","encoding")),Vo(this,A,"Text",t)}readAsDataURL(A){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),A=O.converters.Blob(A,{strict:!1}),Vo(this,A,"DataURL")}abort(){if(this[it]==="empty"||this[it]==="done"){this[qo]=null;return}this[it]==="loading"&&(this[it]="done",this[qo]=null),this[KF]=!0,LC("abort",this),this[it]!=="loading"&&LC("loadend",this)}get readyState(){switch(O.brandCheck(this,e),this[it]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return O.brandCheck(this,e),this[qo]}get error(){return O.brandCheck(this,e),this[TC]}get onloadend(){return O.brandCheck(this,e),this[V].loadend}set onloadend(A){O.brandCheck(this,e),this[V].loadend&&this.removeEventListener("loadend",this[V].loadend),typeof A=="function"?(this[V].loadend=A,this.addEventListener("loadend",A)):this[V].loadend=null}get onerror(){return O.brandCheck(this,e),this[V].error}set onerror(A){O.brandCheck(this,e),this[V].error&&this.removeEventListener("error",this[V].error),typeof A=="function"?(this[V].error=A,this.addEventListener("error",A)):this[V].error=null}get onloadstart(){return O.brandCheck(this,e),this[V].loadstart}set onloadstart(A){O.brandCheck(this,e),this[V].loadstart&&this.removeEventListener("loadstart",this[V].loadstart),typeof A=="function"?(this[V].loadstart=A,this.addEventListener("loadstart",A)):this[V].loadstart=null}get onprogress(){return O.brandCheck(this,e),this[V].progress}set onprogress(A){O.brandCheck(this,e),this[V].progress&&this.removeEventListener("progress",this[V].progress),typeof A=="function"?(this[V].progress=A,this.addEventListener("progress",A)):this[V].progress=null}get onload(){return O.brandCheck(this,e),this[V].load}set onload(A){O.brandCheck(this,e),this[V].load&&this.removeEventListener("load",this[V].load),typeof A=="function"?(this[V].load=A,this.addEventListener("load",A)):this[V].load=null}get onabort(){return O.brandCheck(this,e),this[V].abort}set onabort(A){O.brandCheck(this,e),this[V].abort&&this.removeEventListener("abort",this[V].abort),typeof A=="function"?(this[V].abort=A,this.addEventListener("abort",A)):this[V].abort=null}};zA.EMPTY=zA.prototype.EMPTY=0;zA.LOADING=zA.prototype.LOADING=1;zA.DONE=zA.prototype.DONE=2;Object.defineProperties(zA.prototype,{EMPTY:$t,LOADING:$t,DONE:$t,readAsArrayBuffer:fA,readAsBinaryString:fA,readAsText:fA,readAsDataURL:fA,abort:fA,readyState:fA,result:fA,error:fA,onloadstart:fA,onprogress:fA,onload:fA,onabort:fA,onerror:fA,onloadend:fA,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(zA,{EMPTY:$t,LOADING:$t,DONE:$t});YC.exports={FileReader:zA}});var Wo=f(($U,JC)=>{"use strict";JC.exports={kConstruct:Z().kConstruct}});var HC=f((AM,vC)=>{"use strict";var XF=h("node:assert"),{URLSerializer:xC}=uA(),{isValidHeaderName:jF}=pA();function $F(e,A,t=!1){let r=xC(e,t),n=xC(A,t);return r===n}function AR(e){XF(e!==null);let A=[];for(let t of e.split(","))t=t.trim(),jF(t)&&A.push(t);return A}vC.exports={urlEquals:$F,getFieldValues:AR}});var WC=f((eM,qC)=>{"use strict";var{kConstruct:eR}=Wo(),{urlEquals:tR,getFieldValues:dg}=HC(),{kEnumerableProperty:at,isDisturbed:rR}=G(),{webidl:k}=gA(),{Response:nR,cloneResponse:oR,fromInnerResponse:sR}=Or(),{Request:he,fromInnerRequest:iR}=Xt(),{kState:ZA}=pe(),{fetching:aR}=_r(),{urlIsHttpHttpsScheme:Oo,createDeferredPromise:Ar,readAllBytes:gR}=pA(),fg=h("node:assert"),Po=class e{#A;constructor(){arguments[0]!==eR&&k.illegalConstructor(),k.util.markAsUncloneable(this),this.#A=arguments[1]}async match(A,t={}){k.brandCheck(this,e);let r="Cache.match";k.argumentLengthCheck(arguments,1,r),A=k.converters.RequestInfo(A,r,"request"),t=k.converters.CacheQueryOptions(t,r,"options");let n=this.#n(A,t,1);if(n.length!==0)return n[0]}async matchAll(A=void 0,t={}){k.brandCheck(this,e);let r="Cache.matchAll";return A!==void 0&&(A=k.converters.RequestInfo(A,r,"request")),t=k.converters.CacheQueryOptions(t,r,"options"),this.#n(A,t)}async add(A){k.brandCheck(this,e);let t="Cache.add";k.argumentLengthCheck(arguments,1,t),A=k.converters.RequestInfo(A,t,"request");let r=[A];return await this.addAll(r)}async addAll(A){k.brandCheck(this,e);let t="Cache.addAll";k.argumentLengthCheck(arguments,1,t);let r=[],n=[];for(let Q of A){if(Q===void 0)throw k.errors.conversionFailed({prefix:t,argument:"Argument 1",types:["undefined is not allowed"]});if(Q=k.converters.RequestInfo(Q),typeof Q=="string")continue;let E=Q[ZA];if(!Oo(E.url)||E.method!=="GET")throw k.errors.exception({header:t,message:"Expected http/s scheme when method is not GET."})}let o=[];for(let Q of A){let E=new he(Q)[ZA];if(!Oo(E.url))throw k.errors.exception({header:t,message:"Expected http/s scheme."});E.initiator="fetch",E.destination="subresource",n.push(E);let B=Ar();o.push(aR({request:E,processResponse(C){if(C.type==="error"||C.status===206||C.status<200||C.status>299)B.reject(k.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(C.headersList.contains("vary")){let d=dg(C.headersList.get("vary"));for(let I of d)if(I==="*"){B.reject(k.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let u of o)u.abort();return}}},processResponseEndOfBody(C){if(C.aborted){B.reject(new DOMException("aborted","AbortError"));return}B.resolve(C)}})),r.push(B.promise)}let i=await Promise.all(r),a=[],g=0;for(let Q of i){let E={type:"put",request:n[g],response:Q};a.push(E),g++}let c=Ar(),l=null;try{this.#e(a)}catch(Q){l=Q}return queueMicrotask(()=>{l===null?c.resolve(void 0):c.reject(l)}),c.promise}async put(A,t){k.brandCheck(this,e);let r="Cache.put";k.argumentLengthCheck(arguments,2,r),A=k.converters.RequestInfo(A,r,"request"),t=k.converters.Response(t,r,"response");let n=null;if(A instanceof he?n=A[ZA]:n=new he(A)[ZA],!Oo(n.url)||n.method!=="GET")throw k.errors.exception({header:r,message:"Expected an http/s scheme when method is not GET"});let o=t[ZA];if(o.status===206)throw k.errors.exception({header:r,message:"Got 206 status"});if(o.headersList.contains("vary")){let E=dg(o.headersList.get("vary"));for(let B of E)if(B==="*")throw k.errors.exception({header:r,message:"Got * vary field value"})}if(o.body&&(rR(o.body.stream)||o.body.stream.locked))throw k.errors.exception({header:r,message:"Response body is locked or disturbed"});let s=oR(o),i=Ar();if(o.body!=null){let B=o.body.stream.getReader();gR(B).then(i.resolve,i.reject)}else i.resolve(void 0);let a=[],g={type:"put",request:n,response:s};a.push(g);let c=await i.promise;s.body!=null&&(s.body.source=c);let l=Ar(),Q=null;try{this.#e(a)}catch(E){Q=E}return queueMicrotask(()=>{Q===null?l.resolve():l.reject(Q)}),l.promise}async delete(A,t={}){k.brandCheck(this,e);let r="Cache.delete";k.argumentLengthCheck(arguments,1,r),A=k.converters.RequestInfo(A,r,"request"),t=k.converters.CacheQueryOptions(t,r,"options");let n=null;if(A instanceof he){if(n=A[ZA],n.method!=="GET"&&!t.ignoreMethod)return!1}else fg(typeof A=="string"),n=new he(A)[ZA];let o=[],s={type:"delete",request:n,options:t};o.push(s);let i=Ar(),a=null,g;try{g=this.#e(o)}catch(c){a=c}return queueMicrotask(()=>{a===null?i.resolve(!!g?.length):i.reject(a)}),i.promise}async keys(A=void 0,t={}){k.brandCheck(this,e);let r="Cache.keys";A!==void 0&&(A=k.converters.RequestInfo(A,r,"request")),t=k.converters.CacheQueryOptions(t,r,"options");let n=null;if(A!==void 0)if(A instanceof he){if(n=A[ZA],n.method!=="GET"&&!t.ignoreMethod)return[]}else typeof A=="string"&&(n=new he(A)[ZA]);let o=Ar(),s=[];if(A===void 0)for(let i of this.#A)s.push(i[0]);else{let i=this.#t(n,t);for(let a of i)s.push(a[0])}return queueMicrotask(()=>{let i=[];for(let a of s){let g=iR(a,new AbortController().signal,"immutable");i.push(g)}o.resolve(Object.freeze(i))}),o.promise}#e(A){let t=this.#A,r=[...t],n=[],o=[];try{for(let s of A){if(s.type!=="delete"&&s.type!=="put")throw k.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#t(s.request,s.options,n).length)throw new DOMException("???","InvalidStateError");let i;if(s.type==="delete"){if(i=this.#t(s.request,s.options),i.length===0)return[];for(let a of i){let g=t.indexOf(a);fg(g!==-1),t.splice(g,1)}}else if(s.type==="put"){if(s.response==null)throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let a=s.request;if(!Oo(a.url))throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(a.method!=="GET")throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});i=this.#t(s.request);for(let g of i){let c=t.indexOf(g);fg(c!==-1),t.splice(c,1)}t.push([s.request,s.response]),n.push([s.request,s.response])}o.push([s.request,s.response])}return o}catch(s){throw this.#A.length=0,this.#A=r,s}}#t(A,t,r){let n=[],o=r??this.#A;for(let s of o){let[i,a]=s;this.#o(A,i,a,t)&&n.push(s)}return n}#o(A,t,r=null,n){let o=new URL(A.url),s=new URL(t.url);if(n?.ignoreSearch&&(s.search="",o.search=""),!tR(o,s,!0))return!1;if(r==null||n?.ignoreVary||!r.headersList.contains("vary"))return!0;let i=dg(r.headersList.get("vary"));for(let a of i){if(a==="*")return!1;let g=t.headersList.get(a),c=A.headersList.get(a);if(g!==c)return!1}return!0}#n(A,t,r=1/0){let n=null;if(A!==void 0)if(A instanceof he){if(n=A[ZA],n.method!=="GET"&&!t.ignoreMethod)return[]}else typeof A=="string"&&(n=new he(A)[ZA]);let o=[];if(A===void 0)for(let i of this.#A)o.push(i[1]);else{let i=this.#t(n,t);for(let a of i)o.push(a[1])}let s=[];for(let i of o){let a=sR(i,"immutable");if(s.push(a.clone()),s.length>=r)break}return Object.freeze(s)}};Object.defineProperties(Po.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:at,matchAll:at,add:at,addAll:at,put:at,delete:at,keys:at});var VC=[{key:"ignoreSearch",converter:k.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:k.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:k.converters.boolean,defaultValue:()=>!1}];k.converters.CacheQueryOptions=k.dictionaryConverter(VC);k.converters.MultiCacheQueryOptions=k.dictionaryConverter([...VC,{key:"cacheName",converter:k.converters.DOMString}]);k.converters.Response=k.interfaceConverter(nR);k.converters["sequence<RequestInfo>"]=k.sequenceConverter(k.converters.RequestInfo);qC.exports={Cache:Po}});var PC=f((tM,OC)=>{"use strict";var{kConstruct:Zr}=Wo(),{Cache:_o}=WC(),{webidl:QA}=gA(),{kEnumerableProperty:Kr}=G(),zo=class e{#A=new Map;constructor(){arguments[0]!==Zr&&QA.illegalConstructor(),QA.util.markAsUncloneable(this)}async match(A,t={}){if(QA.brandCheck(this,e),QA.argumentLengthCheck(arguments,1,"CacheStorage.match"),A=QA.converters.RequestInfo(A),t=QA.converters.MultiCacheQueryOptions(t),t.cacheName!=null){if(this.#A.has(t.cacheName)){let r=this.#A.get(t.cacheName);return await new _o(Zr,r).match(A,t)}}else for(let r of this.#A.values()){let o=await new _o(Zr,r).match(A,t);if(o!==void 0)return o}}async has(A){QA.brandCheck(this,e);let t="CacheStorage.has";return QA.argumentLengthCheck(arguments,1,t),A=QA.converters.DOMString(A,t,"cacheName"),this.#A.has(A)}async open(A){QA.brandCheck(this,e);let t="CacheStorage.open";if(QA.argumentLengthCheck(arguments,1,t),A=QA.converters.DOMString(A,t,"cacheName"),this.#A.has(A)){let n=this.#A.get(A);return new _o(Zr,n)}let r=[];return this.#A.set(A,r),new _o(Zr,r)}async delete(A){QA.brandCheck(this,e);let t="CacheStorage.delete";return QA.argumentLengthCheck(arguments,1,t),A=QA.converters.DOMString(A,t,"cacheName"),this.#A.delete(A)}async keys(){return QA.brandCheck(this,e),[...this.#A.keys()]}};Object.defineProperties(zo.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Kr,has:Kr,open:Kr,delete:Kr,keys:Kr});OC.exports={CacheStorage:zo}});var zC=f((rM,_C)=>{"use strict";_C.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var yg=f((nM,$C)=>{"use strict";function cR(e){for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t>=0&&t<=8||t>=10&&t<=31||t===127)return!0}return!1}function ZC(e){for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t<33||t>126||t===34||t===40||t===41||t===60||t===62||t===64||t===44||t===59||t===58||t===92||t===47||t===91||t===93||t===63||t===61||t===123||t===125)throw new Error("Invalid cookie name")}}function KC(e){let A=e.length,t=0;if(e[0]==='"'){if(A===1||e[A-1]!=='"')throw new Error("Invalid cookie value");--A,++t}for(;t<A;){let r=e.charCodeAt(t++);if(r<33||r>126||r===34||r===44||r===59||r===92)throw new Error("Invalid cookie value")}}function XC(e){for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t<32||t===127||t===59)throw new Error("Invalid cookie path")}}function lR(e){if(e.startsWith("-")||e.endsWith(".")||e.endsWith("-"))throw new Error("Invalid cookie domain")}var QR=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ER=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Zo=Array(61).fill(0).map((e,A)=>A.toString().padStart(2,"0"));function jC(e){return typeof e=="number"&&(e=new Date(e)),`${QR[e.getUTCDay()]}, ${Zo[e.getUTCDate()]} ${ER[e.getUTCMonth()]} ${e.getUTCFullYear()} ${Zo[e.getUTCHours()]}:${Zo[e.getUTCMinutes()]}:${Zo[e.getUTCSeconds()]} GMT`}function BR(e){if(e<0)throw new Error("Invalid cookie max-age")}function IR(e){if(e.name.length===0)return null;ZC(e.name),KC(e.value);let A=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&A.push("Secure"),e.httpOnly&&A.push("HttpOnly"),typeof e.maxAge=="number"&&(BR(e.maxAge),A.push(`Max-Age=${e.maxAge}`)),e.domain&&(lR(e.domain),A.push(`Domain=${e.domain}`)),e.path&&(XC(e.path),A.push(`Path=${e.path}`)),e.expires&&e.expires.toString()!=="Invalid Date"&&A.push(`Expires=${jC(e.expires)}`),e.sameSite&&A.push(`SameSite=${e.sameSite}`);for(let t of e.unparsed){if(!t.includes("="))throw new Error("Invalid unparsed");let[r,...n]=t.split("=");A.push(`${r.trim()}=${n.join("=")}`)}return A.join("; ")}$C.exports={isCTLExcludingHtab:cR,validateCookieName:ZC,validateCookiePath:XC,validateCookieValue:KC,toIMFDate:jC,stringify:IR}});var eu=f((oM,Au)=>{"use strict";var{maxNameValuePairSize:CR,maxAttributeValueSize:uR}=zC(),{isCTLExcludingHtab:hR}=yg(),{collectASequenceOfCodePointsFast:Ko}=uA(),dR=h("node:assert");function fR(e){if(hR(e))return null;let A="",t="",r="",n="";if(e.includes(";")){let o={position:0};A=Ko(";",e,o),t=e.slice(o.position)}else A=e;if(!A.includes("="))n=A;else{let o={position:0};r=Ko("=",A,o),n=A.slice(o.position+1)}return r=r.trim(),n=n.trim(),r.length+n.length>CR?null:{name:r,value:n,...er(t)}}function er(e,A={}){if(e.length===0)return A;dR(e[0]===";"),e=e.slice(1);let t="";e.includes(";")?(t=Ko(";",e,{position:0}),e=e.slice(t.length)):(t=e,e="");let r="",n="";if(t.includes("=")){let s={position:0};r=Ko("=",t,s),n=t.slice(s.position+1)}else r=t;if(r=r.trim(),n=n.trim(),n.length>uR)return er(e,A);let o=r.toLowerCase();if(o==="expires"){let s=new Date(n);A.expires=s}else if(o==="max-age"){let s=n.charCodeAt(0);if((s<48||s>57)&&n[0]!=="-"||!/^\d+$/.test(n))return er(e,A);let i=Number(n);A.maxAge=i}else if(o==="domain"){let s=n;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),A.domain=s}else if(o==="path"){let s="";n.length===0||n[0]!=="/"?s="/":s=n,A.path=s}else if(o==="secure")A.secure=!0;else if(o==="httponly")A.httpOnly=!0;else if(o==="samesite"){let s="Default",i=n.toLowerCase();i.includes("none")&&(s="None"),i.includes("strict")&&(s="Strict"),i.includes("lax")&&(s="Lax"),A.sameSite=s}else A.unparsed??=[],A.unparsed.push(`${r}=${n}`);return er(e,A)}Au.exports={parseSetCookie:fR,parseUnparsedAttributes:er}});var nu=f((sM,ru)=>{"use strict";var{parseSetCookie:yR}=eu(),{stringify:wR}=yg(),{webidl:x}=gA(),{Headers:Xo}=rt();function pR(e){x.argumentLengthCheck(arguments,1,"getCookies"),x.brandCheck(e,Xo,{strict:!1});let A=e.get("cookie"),t={};if(!A)return t;for(let r of A.split(";")){let[n,...o]=r.split("=");t[n.trim()]=o.join("=")}return t}function DR(e,A,t){x.brandCheck(e,Xo,{strict:!1});let r="deleteCookie";x.argumentLengthCheck(arguments,2,r),A=x.converters.DOMString(A,r,"name"),t=x.converters.DeleteCookieAttributes(t),tu(e,{name:A,value:"",expires:new Date(0),...t})}function mR(e){x.argumentLengthCheck(arguments,1,"getSetCookies"),x.brandCheck(e,Xo,{strict:!1});let A=e.getSetCookie();return A?A.map(t=>yR(t)):[]}function tu(e,A){x.argumentLengthCheck(arguments,2,"setCookie"),x.brandCheck(e,Xo,{strict:!1}),A=x.converters.Cookie(A);let t=wR(A);t&&e.append("Set-Cookie",t)}x.converters.DeleteCookieAttributes=x.dictionaryConverter([{converter:x.nullableConverter(x.converters.DOMString),key:"path",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.DOMString),key:"domain",defaultValue:()=>null}]);x.converters.Cookie=x.dictionaryConverter([{converter:x.converters.DOMString,key:"name"},{converter:x.converters.DOMString,key:"value"},{converter:x.nullableConverter(e=>typeof e=="number"?x.converters["unsigned long long"](e):new Date(e)),key:"expires",defaultValue:()=>null},{converter:x.nullableConverter(x.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.DOMString),key:"path",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.boolean),key:"secure",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:x.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:x.sequenceConverter(x.converters.DOMString),key:"unparsed",defaultValue:()=>new Array(0)}]);ru.exports={getCookies:pR,deleteCookie:DR,getSetCookies:mR,setCookie:tu}});var rr=f((iM,su)=>{"use strict";var{webidl:m}=gA(),{kEnumerableProperty:yA}=G(),{kConstruct:ou}=Z(),{MessagePort:kR}=h("node:worker_threads"),tr=class e extends Event{#A;constructor(A,t={}){if(A===ou){super(arguments[1],arguments[2]),m.util.markAsUncloneable(this);return}let r="MessageEvent constructor";m.argumentLengthCheck(arguments,1,r),A=m.converters.DOMString(A,r,"type"),t=m.converters.MessageEventInit(t,r,"eventInitDict"),super(A,t),this.#A=t,m.util.markAsUncloneable(this)}get data(){return m.brandCheck(this,e),this.#A.data}get origin(){return m.brandCheck(this,e),this.#A.origin}get lastEventId(){return m.brandCheck(this,e),this.#A.lastEventId}get source(){return m.brandCheck(this,e),this.#A.source}get ports(){return m.brandCheck(this,e),Object.isFrozen(this.#A.ports)||Object.freeze(this.#A.ports),this.#A.ports}initMessageEvent(A,t=!1,r=!1,n=null,o="",s="",i=null,a=[]){return m.brandCheck(this,e),m.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new e(A,{bubbles:t,cancelable:r,data:n,origin:o,lastEventId:s,source:i,ports:a})}static createFastMessageEvent(A,t){let r=new e(ou,A,t);return r.#A=t,r.#A.data??=null,r.#A.origin??="",r.#A.lastEventId??="",r.#A.source??=null,r.#A.ports??=[],r}},{createFastMessageEvent:FR}=tr;delete tr.createFastMessageEvent;var jo=class e extends Event{#A;constructor(A,t={}){let r="CloseEvent constructor";m.argumentLengthCheck(arguments,1,r),A=m.converters.DOMString(A,r,"type"),t=m.converters.CloseEventInit(t),super(A,t),this.#A=t,m.util.markAsUncloneable(this)}get wasClean(){return m.brandCheck(this,e),this.#A.wasClean}get code(){return m.brandCheck(this,e),this.#A.code}get reason(){return m.brandCheck(this,e),this.#A.reason}},$o=class e extends Event{#A;constructor(A,t){let r="ErrorEvent constructor";m.argumentLengthCheck(arguments,1,r),super(A,t),m.util.markAsUncloneable(this),A=m.converters.DOMString(A,r,"type"),t=m.converters.ErrorEventInit(t??{}),this.#A=t}get message(){return m.brandCheck(this,e),this.#A.message}get filename(){return m.brandCheck(this,e),this.#A.filename}get lineno(){return m.brandCheck(this,e),this.#A.lineno}get colno(){return m.brandCheck(this,e),this.#A.colno}get error(){return m.brandCheck(this,e),this.#A.error}};Object.defineProperties(tr.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:yA,origin:yA,lastEventId:yA,source:yA,ports:yA,initMessageEvent:yA});Object.defineProperties(jo.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:yA,code:yA,wasClean:yA});Object.defineProperties($o.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:yA,filename:yA,lineno:yA,colno:yA,error:yA});m.converters.MessagePort=m.interfaceConverter(kR);m.converters["sequence<MessagePort>"]=m.sequenceConverter(m.converters.MessagePort);var wg=[{key:"bubbles",converter:m.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:m.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:m.converters.boolean,defaultValue:()=>!1}];m.converters.MessageEventInit=m.dictionaryConverter([...wg,{key:"data",converter:m.converters.any,defaultValue:()=>null},{key:"origin",converter:m.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:m.converters.DOMString,defaultValue:()=>""},{key:"source",converter:m.nullableConverter(m.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:m.converters["sequence<MessagePort>"],defaultValue:()=>new Array(0)}]);m.converters.CloseEventInit=m.dictionaryConverter([...wg,{key:"wasClean",converter:m.converters.boolean,defaultValue:()=>!1},{key:"code",converter:m.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:m.converters.USVString,defaultValue:()=>""}]);m.converters.ErrorEventInit=m.dictionaryConverter([...wg,{key:"message",converter:m.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:m.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:m.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:m.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:m.converters.any}]);su.exports={MessageEvent:tr,CloseEvent:jo,ErrorEvent:$o,createFastMessageEvent:FR}});var gt=f((aM,iu)=>{"use strict";var RR="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",bR={enumerable:!0,writable:!1,configurable:!1},NR={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},SR={NOT_SENT:0,PROCESSING:1,SENT:2},UR={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},MR=2**16-1,LR={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},TR=Buffer.allocUnsafe(0),YR={string:1,typedArray:2,arrayBuffer:3,blob:4};iu.exports={uid:RR,sentCloseFrameState:SR,staticPropertyDescriptors:bR,states:NR,opcodes:UR,maxUnsigned16Bit:MR,parserStates:LR,emptyBuffer:TR,sendHints:YR}});var Xr=f((gM,au)=>{"use strict";au.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var An=f((cM,uu)=>{"use strict";var{kReadyState:jr,kController:GR,kResponse:JR,kBinaryType:xR,kWebSocketURL:vR}=Xr(),{states:$r,opcodes:Je}=gt(),{ErrorEvent:HR,createFastMessageEvent:VR}=rr(),{isUtf8:qR}=h("node:buffer"),{collectASequenceOfCodePointsFast:WR,removeHTTPWhitespace:gu}=uA();function OR(e){return e[jr]===$r.CONNECTING}function PR(e){return e[jr]===$r.OPEN}function _R(e){return e[jr]===$r.CLOSING}function zR(e){return e[jr]===$r.CLOSED}function pg(e,A,t=(n,o)=>new Event(n,o),r={}){let n=t(e,r);A.dispatchEvent(n)}function ZR(e,A,t){if(e[jr]!==$r.OPEN)return;let r;if(A===Je.TEXT)try{r=Cu(t)}catch{lu(e,"Received invalid UTF-8 in text frame.");return}else A===Je.BINARY&&(e[xR]==="blob"?r=new Blob([t]):r=KR(t));pg("message",e,VR,{origin:e[vR].origin,data:r})}function KR(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function XR(e){if(e.length===0)return!1;for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t<33||t>126||t===34||t===40||t===41||t===44||t===47||t===58||t===59||t===60||t===61||t===62||t===63||t===64||t===91||t===92||t===93||t===123||t===125)return!1}return!0}function jR(e){return e>=1e3&&e<1015?e!==1004&&e!==1005&&e!==1006:e>=3e3&&e<=4999}function lu(e,A){let{[GR]:t,[JR]:r}=e;t.abort(),r?.socket&&!r.socket.destroyed&&r.socket.destroy(),A&&pg("error",e,(n,o)=>new HR(n,o),{error:new Error(A),message:A})}function Qu(e){return e===Je.CLOSE||e===Je.PING||e===Je.PONG}function Eu(e){return e===Je.CONTINUATION}function Bu(e){return e===Je.TEXT||e===Je.BINARY}function $R(e){return Bu(e)||Eu(e)||Qu(e)}function Ab(e){let A={position:0},t=new Map;for(;A.position<e.length;){let r=WR(";",e,A),[n,o=""]=r.split("=");t.set(gu(n,!0,!1),gu(o,!1,!0)),A.position++}return t}function eb(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<48||r>57)return!1}let A=Number.parseInt(e,10);return A>=8&&A<=15}var Iu=typeof process.versions.icu=="string",cu=Iu?new TextDecoder("utf-8",{fatal:!0}):void 0,Cu=Iu?cu.decode.bind(cu):function(e){if(qR(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};uu.exports={isConnecting:OR,isEstablished:PR,isClosing:_R,isClosed:zR,fireEvent:pg,isValidSubprotocol:XR,isValidStatusCode:jR,failWebsocketConnection:lu,websocketMessageReceived:ZR,utf8Decode:Cu,isControlFrame:Qu,isContinuationFrame:Eu,isTextBinaryFrame:Bu,isValidOpcode:$R,parseExtensions:Ab,isValidClientWindowBits:eb}});var es=f((lM,hu)=>{"use strict";var{maxUnsigned16Bit:tb}=gt(),As=16386,Dg,en=null,nr=As;try{Dg=h("node:crypto")}catch{Dg={randomFillSync:function(A,t,r){for(let n=0;n<A.length;++n)A[n]=Math.random()*255|0;return A}}}function rb(){return nr===As&&(nr=0,Dg.randomFillSync(en??=Buffer.allocUnsafe(As),0,As)),[en[nr++],en[nr++],en[nr++],en[nr++]]}var mg=class{constructor(A){this.frameData=A}createFrame(A){let t=this.frameData,r=rb(),n=t?.byteLength??0,o=n,s=6;n>tb?(s+=8,o=127):n>125&&(s+=2,o=126);let i=Buffer.allocUnsafe(n+s);i[0]=i[1]=0,i[0]|=128,i[0]=(i[0]&240)+A;i[s-4]=r[0],i[s-3]=r[1],i[s-2]=r[2],i[s-1]=r[3],i[1]=o,o===126?i.writeUInt16BE(n,2):o===127&&(i[2]=i[3]=0,i.writeUIntBE(n,4,6)),i[1]|=128;for(let a=0;a<n;++a)i[s+a]=t[a]^r[a&3];return i}};hu.exports={WebsocketFrameSend:mg}});var Fg=f((QM,mu)=>{"use strict";var{uid:nb,states:tn,sentCloseFrameState:ts,emptyBuffer:ob,opcodes:sb}=gt(),{kReadyState:rn,kSentClose:rs,kByteParser:fu,kReceivedClose:du,kResponse:yu}=Xr(),{fireEvent:ib,failWebsocketConnection:xe,isClosing:ab,isClosed:gb,isEstablished:cb,parseExtensions:lb}=An(),{channels:or}=Ct(),{CloseEvent:Qb}=rr(),{makeRequest:Eb}=Xt(),{fetching:Bb}=_r(),{Headers:Ib,getHeadersList:Cb}=rt(),{getDecodeSplit:ub}=pA(),{WebsocketFrameSend:hb}=es(),kg;try{kg=h("node:crypto")}catch{}function db(e,A,t,r,n,o){let s=e;s.protocol=e.protocol==="ws:"?"http:":"https:";let i=Eb({urlList:[s],client:t,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(o.headers){let l=Cb(new Ib(o.headers));i.headersList=l}let a=kg.randomBytes(16).toString("base64");i.headersList.append("sec-websocket-key",a),i.headersList.append("sec-websocket-version","13");for(let l of A)i.headersList.append("sec-websocket-protocol",l);return i.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),Bb({request:i,useParallelQueue:!0,dispatcher:o.dispatcher,processResponse(l){if(l.type==="error"||l.status!==101){xe(r,"Received network error or non-101 status code.");return}if(A.length!==0&&!l.headersList.get("Sec-WebSocket-Protocol")){xe(r,"Server did not respond with sent protocols.");return}if(l.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){xe(r,'Server did not set Upgrade header to "websocket".');return}if(l.headersList.get("Connection")?.toLowerCase()!=="upgrade"){xe(r,'Server did not set Connection header to "upgrade".');return}let Q=l.headersList.get("Sec-WebSocket-Accept"),E=kg.createHash("sha1").update(a+nb).digest("base64");if(Q!==E){xe(r,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let B=l.headersList.get("Sec-WebSocket-Extensions"),C;if(B!==null&&(C=lb(B),!C.has("permessage-deflate"))){xe(r,"Sec-WebSocket-Extensions header does not match.");return}let d=l.headersList.get("Sec-WebSocket-Protocol");if(d!==null&&!ub("sec-websocket-protocol",i.headersList).includes(d)){xe(r,"Protocol was not set in the opening handshake.");return}l.socket.on("data",wu),l.socket.on("close",pu),l.socket.on("error",Du),or.open.hasSubscribers&&or.open.publish({address:l.socket.address(),protocol:d,extensions:B}),n(l,C)}})}function fb(e,A,t,r){if(!(ab(e)||gb(e)))if(!cb(e))xe(e,"Connection was closed before it was established."),e[rn]=tn.CLOSING;else if(e[rs]===ts.NOT_SENT){e[rs]=ts.PROCESSING;let n=new hb;A!==void 0&&t===void 0?(n.frameData=Buffer.allocUnsafe(2),n.frameData.writeUInt16BE(A,0)):A!==void 0&&t!==void 0?(n.frameData=Buffer.allocUnsafe(2+r),n.frameData.writeUInt16BE(A,0),n.frameData.write(t,2,"utf-8")):n.frameData=ob,e[yu].socket.write(n.createFrame(sb.CLOSE)),e[rs]=ts.SENT,e[rn]=tn.CLOSING}else e[rn]=tn.CLOSING}function wu(e){this.ws[fu].write(e)||this.pause()}function pu(){let{ws:e}=this,{[yu]:A}=e;A.socket.off("data",wu),A.socket.off("close",pu),A.socket.off("error",Du);let t=e[rs]===ts.SENT&&e[du],r=1005,n="",o=e[fu].closingInfo;o&&!o.error?(r=o.code??1005,n=o.reason):e[du]||(r=1006),e[rn]=tn.CLOSED,ib("close",e,(s,i)=>new Qb(s,i),{wasClean:t,code:r,reason:n}),or.close.hasSubscribers&&or.close.publish({websocket:e,code:r,reason:n})}function Du(e){let{ws:A}=this;A[rn]=tn.CLOSING,or.socketError.hasSubscribers&&or.socketError.publish(e),this.destroy()}mu.exports={establishWebSocketConnection:db,closeWebSocketConnection:fb}});var Fu=f((EM,ku)=>{"use strict";var{createInflateRaw:yb,Z_DEFAULT_WINDOWBITS:wb}=h("node:zlib"),{isValidClientWindowBits:pb}=An(),{MessageSizeExceededError:Db}=H(),mb=Buffer.from([0,0,255,255]),ns=Symbol("kBuffer"),nn=Symbol("kLength"),Rg=class{#A;#e={};#t=0;constructor(A,t){this.#e.serverNoContextTakeover=A.has("server_no_context_takeover"),this.#e.serverMaxWindowBits=A.get("server_max_window_bits"),this.#t=t.maxPayloadSize}decompress(A,t,r){if(!this.#A){let n=wb;if(this.#e.serverMaxWindowBits){if(!pb(this.#e.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}n=Number.parseInt(this.#e.serverMaxWindowBits)}try{this.#A=yb({windowBits:n})}catch(o){r(o);return}this.#A[ns]=[],this.#A[nn]=0,this.#A.on("data",o=>{if(this.#A[nn]+=o.length,this.#t>0&&this.#A[nn]>this.#t){r(new Db),this.#A.removeAllListeners(),this.#A=null;return}this.#A[ns].push(o)}),this.#A.on("error",o=>{this.#A=null,r(o)})}this.#A.write(A),t&&this.#A.write(mb),this.#A.flush(()=>{if(!this.#A)return;let n=Buffer.concat(this.#A[ns],this.#A[nn]);this.#A[ns].length=0,this.#A[nn]=0,r(null,n)})}};ku.exports={PerMessageDeflate:Rg}});var Gu=f((BM,Yu)=>{"use strict";var{Writable:kb}=h("node:stream"),Fb=h("node:assert"),{parserStates:wA,opcodes:sr,states:Rb,emptyBuffer:Ru,sentCloseFrameState:bu}=gt(),{kReadyState:bb,kSentClose:Nu,kResponse:Su,kReceivedClose:Uu}=Xr(),{channels:os}=Ct(),{isValidStatusCode:Nb,isValidOpcode:Sb,failWebsocketConnection:EA,websocketMessageReceived:Mu,utf8Decode:Ub,isControlFrame:bg,isTextBinaryFrame:Ng,isContinuationFrame:Mb}=An(),{WebsocketFrameSend:Lu}=es(),{closeWebSocketConnection:Lb}=Fg(),{PerMessageDeflate:Tb}=Fu(),{MessageSizeExceededError:Tu}=H(),Sg=class extends kb{#A=[];#e=0;#t=0;#o=!1;#n=wA.INFO;#r={};#s=[];#i;#a;constructor(A,t,r={}){super(),this.ws=A,this.#i=t??new Map,this.#a=r.maxPayloadSize??0,this.#i.has("permessage-deflate")&&this.#i.set("permessage-deflate",new Tb(t,r))}_write(A,t,r){this.#A.push(A),this.#t+=A.length,this.#o=!0,this.run(r)}#g(){return this.#a>0&&!bg(this.#r.opcode)&&this.#r.payloadLength>this.#a?(EA(this.ws,"Payload size exceeds maximum allowed size"),!1):!0}run(A){for(;this.#o;)if(this.#n===wA.INFO){if(this.#t<2)return A();let t=this.consume(2),r=(t[0]&128)!==0,n=t[0]&15,o=(t[1]&128)===128,s=!r&&n!==sr.CONTINUATION,i=t[1]&127,a=t[0]&64,g=t[0]&32,c=t[0]&16;if(!Sb(n))return EA(this.ws,"Invalid opcode received"),A();if(o)return EA(this.ws,"Frame cannot be masked"),A();if(a!==0&&!this.#i.has("permessage-deflate")){EA(this.ws,"Expected RSV1 to be clear.");return}if(g!==0||c!==0){EA(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!Ng(n)){EA(this.ws,"Invalid frame type was fragmented.");return}if(Ng(n)&&this.#s.length>0){EA(this.ws,"Expected continuation frame");return}if(this.#r.fragmented&&s){EA(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((i>125||s)&&bg(n)){EA(this.ws,"Control frame either too large or fragmented");return}if(Mb(n)&&this.#s.length===0&&!this.#r.compressed){EA(this.ws,"Unexpected continuation frame");return}if(i<=125){if(this.#r.payloadLength=i,this.#n=wA.READ_DATA,!this.#g())return}else i===126?this.#n=wA.PAYLOADLENGTH_16:i===127&&(this.#n=wA.PAYLOADLENGTH_64);Ng(n)&&(this.#r.binaryType=n,this.#r.compressed=a!==0),this.#r.opcode=n,this.#r.masked=o,this.#r.fin=r,this.#r.fragmented=s}else if(this.#n===wA.PAYLOADLENGTH_16){if(this.#t<2)return A();let t=this.consume(2);if(this.#r.payloadLength=t.readUInt16BE(0),this.#n=wA.READ_DATA,!this.#g())return}else if(this.#n===wA.PAYLOADLENGTH_64){if(this.#t<8)return A();let t=this.consume(8),r=t.readUInt32BE(0),n=t.readUInt32BE(4);if(r!==0||n>2**31-1){EA(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#r.payloadLength=n,this.#n=wA.READ_DATA,!this.#g())return}else if(this.#n===wA.READ_DATA){if(this.#t<this.#r.payloadLength)return A();let t=this.consume(this.#r.payloadLength);if(bg(this.#r.opcode))this.#o=this.parseControlFrame(t),this.#n=wA.INFO;else if(this.#r.compressed){this.#i.get("permessage-deflate").decompress(t,this.#r.fin,(r,n)=>{if(r){EA(this.ws,r.message);return}if(this.writeFragments(n),this.#a>0&&this.#e>this.#a){EA(this.ws,new Tu().message);return}if(!this.#r.fin){this.#n=wA.INFO,this.#o=!0,this.run(A);return}Mu(this.ws,this.#r.binaryType,this.consumeFragments()),this.#o=!0,this.#n=wA.INFO,this.run(A)}),this.#o=!1;break}else{if(this.writeFragments(t),this.#a>0&&this.#e>this.#a){EA(this.ws,new Tu().message);return}!this.#r.fragmented&&this.#r.fin&&Mu(this.ws,this.#r.binaryType,this.consumeFragments()),this.#n=wA.INFO}}}consume(A){if(A>this.#t)throw new Error("Called consume() before buffers satiated.");if(A===0)return Ru;if(this.#A[0].length===A)return this.#t-=this.#A[0].length,this.#A.shift();let t=Buffer.allocUnsafe(A),r=0;for(;r!==A;){let n=this.#A[0],{length:o}=n;if(o+r===A){t.set(this.#A.shift(),r);break}else if(o+r>A){t.set(n.subarray(0,A-r),r),this.#A[0]=n.subarray(A-r);break}else t.set(this.#A.shift(),r),r+=n.length}return this.#t-=A,t}writeFragments(A){this.#e+=A.length,this.#s.push(A)}consumeFragments(){let A=this.#s;if(A.length===1)return this.#e=0,A.shift();let t=Buffer.concat(A,this.#e);return this.#s=[],this.#e=0,t}parseCloseBody(A){Fb(A.length!==1);let t;if(A.length>=2&&(t=A.readUInt16BE(0)),t!==void 0&&!Nb(t))return{code:1002,reason:"Invalid status code",error:!0};let r=A.subarray(2);r[0]===239&&r[1]===187&&r[2]===191&&(r=r.subarray(3));try{r=Ub(r)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:t,reason:r,error:!1}}parseControlFrame(A){let{opcode:t,payloadLength:r}=this.#r;if(t===sr.CLOSE){if(r===1)return EA(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#r.closeInfo=this.parseCloseBody(A),this.#r.closeInfo.error){let{code:n,reason:o}=this.#r.closeInfo;return Lb(this.ws,n,o,o.length),EA(this.ws,o),!1}if(this.ws[Nu]!==bu.SENT){let n=Ru;this.#r.closeInfo.code&&(n=Buffer.allocUnsafe(2),n.writeUInt16BE(this.#r.closeInfo.code,0));let o=new Lu(n);this.ws[Su].socket.write(o.createFrame(sr.CLOSE),s=>{s||(this.ws[Nu]=bu.SENT)})}return this.ws[bb]=Rb.CLOSING,this.ws[Uu]=!0,!1}else if(t===sr.PING){if(!this.ws[Uu]){let n=new Lu(A);this.ws[Su].socket.write(n.createFrame(sr.PONG)),os.ping.hasSubscribers&&os.ping.publish({payload:A})}}else t===sr.PONG&&os.pong.hasSubscribers&&os.pong.publish({payload:A});return!0}get closingInfo(){return this.#r.closeInfo}};Yu.exports={ByteParser:Sg}});var Vu=f((IM,Hu)=>{"use strict";var{WebsocketFrameSend:Yb}=es(),{opcodes:Ju,sendHints:ir}=gt(),Gb=vi(),xu=Buffer[Symbol.species],Ug=class{#A=new Gb;#e=!1;#t;constructor(A){this.#t=A}add(A,t,r){if(r!==ir.blob){let o=vu(A,r);if(!this.#e)this.#t.write(o,t);else{let s={promise:null,callback:t,frame:o};this.#A.push(s)}return}let n={promise:A.arrayBuffer().then(o=>{n.promise=null,n.frame=vu(o,r)}),callback:t,frame:null};this.#A.push(n),this.#e||this.#o()}async#o(){this.#e=!0;let A=this.#A;for(;!A.isEmpty();){let t=A.shift();t.promise!==null&&await t.promise,this.#t.write(t.frame,t.callback),t.callback=t.frame=null}this.#e=!1}};function vu(e,A){return new Yb(Jb(e,A)).createFrame(A===ir.string?Ju.TEXT:Ju.BINARY)}function Jb(e,A){switch(A){case ir.string:return Buffer.from(e);case ir.arrayBuffer:case ir.blob:return new xu(e);case ir.typedArray:return new xu(e.buffer,e.byteOffset,e.byteLength)}}Hu.exports={SendQueue:Ug}});var ju=f((CM,Xu)=>{"use strict";var{webidl:U}=gA(),{URLSerializer:xb}=uA(),{environmentSettingsObject:qu}=pA(),{staticPropertyDescriptors:ve,states:on,sentCloseFrameState:vb,sendHints:ss}=gt(),{kWebSocketURL:Wu,kReadyState:Mg,kController:Ou,kBinaryType:is,kResponse:Pu,kSentClose:Hb,kByteParser:Vb}=Xr(),{isConnecting:qb,isEstablished:Wb,isClosing:Ob,isValidSubprotocol:Pb,fireEvent:_u}=An(),{establishWebSocketConnection:_b,closeWebSocketConnection:zu}=Fg(),{ByteParser:zb}=Gu(),{kEnumerableProperty:JA,isBlobLike:Zu}=G(),{getGlobalDispatcher:Zb}=wo(),{types:Ku}=h("node:util"),{ErrorEvent:Kb,CloseEvent:Xb}=rr(),{SendQueue:jb}=Vu(),NA=class e extends EventTarget{#A={open:null,error:null,close:null,message:null};#e=0;#t="";#o="";#n;constructor(A,t=[]){super(),U.util.markAsUncloneable(this);let r="WebSocket constructor";U.argumentLengthCheck(arguments,1,r);let n=U.converters["DOMString or sequence<DOMString> or WebSocketInit"](t,r,"options");A=U.converters.USVString(A,r,"url"),t=n.protocols;let o=qu.settingsObject.baseUrl,s;try{s=new URL(A,o)}catch(a){throw new DOMException(a,"SyntaxError")}if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${s.protocol}`,"SyntaxError");if(s.hash||s.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof t=="string"&&(t=[t]),t.length!==new Set(t.map(a=>a.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(t.length>0&&!t.every(a=>Pb(a)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[Wu]=new URL(s.href);let i=qu.settingsObject;this[Ou]=_b(s,t,i,this,(a,g)=>this.#r(a,g),n),this[Mg]=e.CONNECTING,this[Hb]=vb.NOT_SENT,this[is]="blob"}close(A=void 0,t=void 0){U.brandCheck(this,e);let r="WebSocket.close";if(A!==void 0&&(A=U.converters["unsigned short"](A,r,"code",{clamp:!0})),t!==void 0&&(t=U.converters.USVString(t,r,"reason")),A!==void 0&&A!==1e3&&(A<3e3||A>4999))throw new DOMException("invalid code","InvalidAccessError");let n=0;if(t!==void 0&&(n=Buffer.byteLength(t),n>123))throw new DOMException(`Reason must be less than 123 bytes; received ${n}`,"SyntaxError");zu(this,A,t,n)}send(A){U.brandCheck(this,e);let t="WebSocket.send";if(U.argumentLengthCheck(arguments,1,t),A=U.converters.WebSocketSendData(A,t,"data"),qb(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!Wb(this)||Ob(this)))if(typeof A=="string"){let r=Buffer.byteLength(A);this.#e+=r,this.#n.add(A,()=>{this.#e-=r},ss.string)}else Ku.isArrayBuffer(A)?(this.#e+=A.byteLength,this.#n.add(A,()=>{this.#e-=A.byteLength},ss.arrayBuffer)):ArrayBuffer.isView(A)?(this.#e+=A.byteLength,this.#n.add(A,()=>{this.#e-=A.byteLength},ss.typedArray)):Zu(A)&&(this.#e+=A.size,this.#n.add(A,()=>{this.#e-=A.size},ss.blob))}get readyState(){return U.brandCheck(this,e),this[Mg]}get bufferedAmount(){return U.brandCheck(this,e),this.#e}get url(){return U.brandCheck(this,e),xb(this[Wu])}get extensions(){return U.brandCheck(this,e),this.#o}get protocol(){return U.brandCheck(this,e),this.#t}get onopen(){return U.brandCheck(this,e),this.#A.open}set onopen(A){U.brandCheck(this,e),this.#A.open&&this.removeEventListener("open",this.#A.open),typeof A=="function"?(this.#A.open=A,this.addEventListener("open",A)):this.#A.open=null}get onerror(){return U.brandCheck(this,e),this.#A.error}set onerror(A){U.brandCheck(this,e),this.#A.error&&this.removeEventListener("error",this.#A.error),typeof A=="function"?(this.#A.error=A,this.addEventListener("error",A)):this.#A.error=null}get onclose(){return U.brandCheck(this,e),this.#A.close}set onclose(A){U.brandCheck(this,e),this.#A.close&&this.removeEventListener("close",this.#A.close),typeof A=="function"?(this.#A.close=A,this.addEventListener("close",A)):this.#A.close=null}get onmessage(){return U.brandCheck(this,e),this.#A.message}set onmessage(A){U.brandCheck(this,e),this.#A.message&&this.removeEventListener("message",this.#A.message),typeof A=="function"?(this.#A.message=A,this.addEventListener("message",A)):this.#A.message=null}get binaryType(){return U.brandCheck(this,e),this[is]}set binaryType(A){U.brandCheck(this,e),A!=="blob"&&A!=="arraybuffer"?this[is]="blob":this[is]=A}#r(A,t){this[Pu]=A;let r=this[Ou]?.dispatcher?.webSocketOptions?.maxPayloadSize,n=new zb(this,t,{maxPayloadSize:r});n.on("drain",$b),n.on("error",AN.bind(this)),A.socket.ws=this,this[Vb]=n,this.#n=new jb(A.socket),this[Mg]=on.OPEN;let o=A.headersList.get("sec-websocket-extensions");o!==null&&(this.#o=o);let s=A.headersList.get("sec-websocket-protocol");s!==null&&(this.#t=s),_u("open",this)}};NA.CONNECTING=NA.prototype.CONNECTING=on.CONNECTING;NA.OPEN=NA.prototype.OPEN=on.OPEN;NA.CLOSING=NA.prototype.CLOSING=on.CLOSING;NA.CLOSED=NA.prototype.CLOSED=on.CLOSED;Object.defineProperties(NA.prototype,{CONNECTING:ve,OPEN:ve,CLOSING:ve,CLOSED:ve,url:JA,readyState:JA,bufferedAmount:JA,onopen:JA,onerror:JA,onclose:JA,close:JA,onmessage:JA,binaryType:JA,send:JA,extensions:JA,protocol:JA,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(NA,{CONNECTING:ve,OPEN:ve,CLOSING:ve,CLOSED:ve});U.converters["sequence<DOMString>"]=U.sequenceConverter(U.converters.DOMString);U.converters["DOMString or sequence<DOMString>"]=function(e,A,t){return U.util.Type(e)==="Object"&&Symbol.iterator in e?U.converters["sequence<DOMString>"](e):U.converters.DOMString(e,A,t)};U.converters.WebSocketInit=U.dictionaryConverter([{key:"protocols",converter:U.converters["DOMString or sequence<DOMString>"],defaultValue:()=>new Array(0)},{key:"dispatcher",converter:U.converters.any,defaultValue:()=>Zb()},{key:"headers",converter:U.nullableConverter(U.converters.HeadersInit)}]);U.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return U.util.Type(e)==="Object"&&!(Symbol.iterator in e)?U.converters.WebSocketInit(e):{protocols:U.converters["DOMString or sequence<DOMString>"](e)}};U.converters.WebSocketSendData=function(e){if(U.util.Type(e)==="Object"){if(Zu(e))return U.converters.Blob(e,{strict:!1});if(ArrayBuffer.isView(e)||Ku.isArrayBuffer(e))return U.converters.BufferSource(e)}return U.converters.USVString(e)};function $b(){this.ws[Pu].socket.resume()}function AN(e){let A,t;e instanceof Xb?(A=e.reason,t=e.code):A=e.message,_u("error",this,()=>new Kb("error",{error:e,message:A})),zu(this,t)}Xu.exports={WebSocket:NA}});var Lg=f((uM,$u)=>{"use strict";function eN(e){return e.indexOf("\0")===-1}function tN(e){if(e.length===0)return!1;for(let A=0;A<e.length;A++)if(e.charCodeAt(A)<48||e.charCodeAt(A)>57)return!1;return!0}function rN(e){return new Promise(A=>{setTimeout(A,e).unref()})}$u.exports={isValidLastEventId:eN,isASCIINumber:tN,delay:rN}});var rh=f((hM,th)=>{"use strict";var{Transform:nN}=h("node:stream"),{isASCIINumber:Ah,isValidLastEventId:eh}=Lg(),de=[239,187,191],Tg=10,as=13,oN=58,sN=32,Yg=class extends nN{state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(A={}){A.readableObjectMode=!0,super(A),this.state=A.eventSourceSettings||{},A.push&&(this.push=A.push)}_transform(A,t,r){if(A.length===0){r();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,A]):this.buffer=A,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===de[0]){r();return}this.checkBOM=!1,r();return;case 2:if(this.buffer[0]===de[0]&&this.buffer[1]===de[1]){r();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===de[0]&&this.buffer[1]===de[1]&&this.buffer[2]===de[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,r();return}this.checkBOM=!1;break;default:this.buffer[0]===de[0]&&this.buffer[1]===de[1]&&this.buffer[2]===de[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1;break}for(;this.pos<this.buffer.length;){if(this.eventEndCheck){if(this.crlfCheck){if(this.buffer[this.pos]===Tg){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(this.buffer[this.pos]===Tg||this.buffer[this.pos]===as){this.buffer[this.pos]===as&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(this.event.data!==void 0||this.event.event||this.event.id||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(this.buffer[this.pos]===Tg||this.buffer[this.pos]===as){this.buffer[this.pos]===as&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0;continue}this.pos++}r()}parseLine(A,t){if(A.length===0)return;let r=A.indexOf(oN);if(r===0)return;let n="",o="";if(r!==-1){n=A.subarray(0,r).toString("utf8");let s=r+1;A[s]===sN&&++s,o=A.subarray(s).toString("utf8")}else n=A.toString("utf8"),o="";switch(n){case"data":t[n]===void 0?t[n]=o:t[n]+=`
|
|
46
|
+
`.trim())}};sI.exports=_a});var wo=f((YU,lI)=>{"use strict";var aI=Symbol.for("undici.globalDispatcher.1"),{InvalidArgumentError:v0}=H(),H0=Jt();cI()===void 0&&gI(new H0);function gI(e){if(!e||typeof e.dispatch!="function")throw new v0("Argument agent must implement Agent");Object.defineProperty(globalThis,aI,{value:e,writable:!0,enumerable:!1,configurable:!1})}function cI(){return globalThis[aI]}lI.exports={setGlobalDispatcher:gI,getGlobalDispatcher:cI}});var po=f((JU,QI)=>{"use strict";QI.exports=class{#A;constructor(A){if(typeof A!="object"||A===null)throw new TypeError("handler must be an object");this.#A=A}onConnect(...A){return this.#A.onConnect?.(...A)}onError(...A){return this.#A.onError?.(...A)}onUpgrade(...A){return this.#A.onUpgrade?.(...A)}onResponseStarted(...A){return this.#A.onResponseStarted?.(...A)}onHeaders(...A){return this.#A.onHeaders?.(...A)}onData(...A){return this.#A.onData?.(...A)}onComplete(...A){return this.#A.onComplete?.(...A)}onBodySent(...A){return this.#A.onBodySent?.(...A)}}});var BI=f((xU,EI)=>{"use strict";var V0=Ao();EI.exports=e=>{let A=e?.maxRedirections;return t=>function(n,o){let{maxRedirections:s=A,...i}=n;if(!s)return t(n,o);let a=new V0(t,s,n,o);return t(i,a)}}});var CI=f((vU,II)=>{"use strict";var q0=lo();II.exports=e=>A=>function(r,n){return A(r,new q0({...r,retryOptions:{...e,...r.retryOptions}},{handler:n,dispatch:A}))}});var hI=f((HU,uI)=>{"use strict";var W0=G(),{InvalidArgumentError:O0,RequestAbortedError:P0}=H(),_0=po(),za=class extends _0{#A=1024*1024;#e=null;#t=!1;#o=!1;#n=0;#r=null;#s=null;constructor({maxSize:A},t){if(super(t),A!=null&&(!Number.isFinite(A)||A<1))throw new O0("maxSize must be a number greater than 0");this.#A=A??this.#A,this.#s=t}onConnect(A){this.#e=A,this.#s.onConnect(this.#i.bind(this))}#i(A){this.#o=!0,this.#r=A}onHeaders(A,t,r,n){let s=W0.parseHeaders(t)["content-length"];if(s!=null&&s>this.#A)throw new P0(`Response size (${s}) larger than maxSize (${this.#A})`);return this.#o?!0:this.#s.onHeaders(A,t,r,n)}onError(A){this.#t||(A=this.#r??A,this.#s.onError(A))}onData(A){return this.#n=this.#n+A.length,this.#n>=this.#A&&(this.#t=!0,this.#o?this.#s.onError(this.#r):this.#s.onComplete([])),!0}onComplete(A){if(!this.#t){if(this.#o){this.#s.onError(this.reason);return}this.#s.onComplete(A)}}};function z0({maxSize:e}={maxSize:1024*1024}){return A=>function(r,n){let{dumpMaxSize:o=e}=r,s=new za({maxSize:o},n);return A(r,s)}}uI.exports=z0});var yI=f((VU,fI)=>{"use strict";var{isIP:Z0}=h("node:net"),{lookup:K0}=h("node:dns"),X0=po(),{InvalidArgumentError:zt,InformationalError:j0}=H(),dI=Math.pow(2,31)-1,Za=class{#A=0;#e=0;#t=new Map;dualStack=!0;affinity=null;lookup=null;pick=null;constructor(A){this.#A=A.maxTTL,this.#e=A.maxItems,this.dualStack=A.dualStack,this.affinity=A.affinity,this.lookup=A.lookup??this.#o,this.pick=A.pick??this.#n}get full(){return this.#t.size===this.#e}runLookup(A,t,r){let n=this.#t.get(A.hostname);if(n==null&&this.full){r(null,A.origin);return}let o={affinity:this.affinity,dualStack:this.dualStack,lookup:this.lookup,pick:this.pick,...t.dns,maxTTL:this.#A,maxItems:this.#e};if(n==null)this.lookup(A,o,(s,i)=>{if(s||i==null||i.length===0){r(s??new j0("No DNS entries found"));return}this.setRecords(A,i);let a=this.#t.get(A.hostname),g=this.pick(A,a,o.affinity),c;typeof g.port=="number"?c=`:${g.port}`:A.port!==""?c=`:${A.port}`:c="",r(null,`${A.protocol}//${g.family===6?`[${g.address}]`:g.address}${c}`)});else{let s=this.pick(A,n,o.affinity);if(s==null){this.#t.delete(A.hostname),this.runLookup(A,t,r);return}let i;typeof s.port=="number"?i=`:${s.port}`:A.port!==""?i=`:${A.port}`:i="",r(null,`${A.protocol}//${s.family===6?`[${s.address}]`:s.address}${i}`)}}#o(A,t,r){K0(A.hostname,{all:!0,family:this.dualStack===!1?this.affinity:0,order:"ipv4first"},(n,o)=>{if(n)return r(n);let s=new Map;for(let i of o)s.set(`${i.address}:${i.family}`,i);r(null,s.values())})}#n(A,t,r){let n=null,{records:o,offset:s}=t,i;if(this.dualStack?(r==null&&(s==null||s===dI?(t.offset=0,r=4):(t.offset++,r=(t.offset&1)===1?6:4)),o[r]!=null&&o[r].ips.length>0?i=o[r]:i=o[r===4?6:4]):i=o[r],i==null||i.ips.length===0)return n;i.offset==null||i.offset===dI?i.offset=0:i.offset++;let a=i.offset%i.ips.length;return n=i.ips[a]??null,n==null?n:Date.now()-n.timestamp>n.ttl?(i.ips.splice(a,1),this.pick(A,t,r)):n}setRecords(A,t){let r=Date.now(),n={records:{4:null,6:null}};for(let o of t){o.timestamp=r,typeof o.ttl=="number"?o.ttl=Math.min(o.ttl,this.#A):o.ttl=this.#A;let s=n.records[o.family]??{ips:[]};s.ips.push(o),n.records[o.family]=s}this.#t.set(A.hostname,n)}getHandler(A,t){return new Ka(this,A,t)}},Ka=class extends X0{#A=null;#e=null;#t=null;#o=null;#n=null;constructor(A,{origin:t,handler:r,dispatch:n},o){super(r),this.#n=t,this.#o=r,this.#e={...o},this.#A=A,this.#t=n}onError(A){switch(A.code){case"ETIMEDOUT":case"ECONNREFUSED":{if(this.#A.dualStack){this.#A.runLookup(this.#n,this.#e,(t,r)=>{if(t)return this.#o.onError(t);let n={...this.#e,origin:r};this.#t(n,this)});return}this.#o.onError(A);return}case"ENOTFOUND":this.#A.deleteRecord(this.#n);default:this.#o.onError(A);break}}};fI.exports=e=>{if(e?.maxTTL!=null&&(typeof e?.maxTTL!="number"||e?.maxTTL<0))throw new zt("Invalid maxTTL. Must be a positive number");if(e?.maxItems!=null&&(typeof e?.maxItems!="number"||e?.maxItems<1))throw new zt("Invalid maxItems. Must be a positive number and greater than zero");if(e?.affinity!=null&&e?.affinity!==4&&e?.affinity!==6)throw new zt("Invalid affinity. Must be either 4 or 6");if(e?.dualStack!=null&&typeof e?.dualStack!="boolean")throw new zt("Invalid dualStack. Must be a boolean");if(e?.lookup!=null&&typeof e?.lookup!="function")throw new zt("Invalid lookup. Must be a function");if(e?.pick!=null&&typeof e?.pick!="function")throw new zt("Invalid pick. Must be a function");let A=e?.dualStack??!0,t;A?t=e?.affinity??null:t=e?.affinity??4;let r={maxTTL:e?.maxTTL??1e4,lookup:e?.lookup??null,pick:e?.pick??null,dualStack:A,affinity:t,maxItems:e?.maxItems??1/0},n=new Za(r);return o=>function(i,a){let g=i.origin.constructor===URL?i.origin:new URL(i.origin);return Z0(g.hostname)!==0?o(i,a):(n.runLookup(g,i,(c,l)=>{if(c)return a.onError(c);let Q=null;Q={...i,servername:g.hostname,origin:l,headers:{host:g.hostname,...i.headers}},o(Q,n.getHandler({origin:g,dispatch:o,handler:a},i))}),!0)}}});var rt=f((qU,RI)=>{"use strict";var{kConstruct:$0}=Z(),{kEnumerableProperty:Zt}=G(),{iteratorMixin:Ak,isValidHeaderName:qr,isValidHeaderValue:pI}=pA(),{webidl:v}=gA(),Xa=h("node:assert"),Do=h("node:util"),tA=Symbol("headers map"),kA=Symbol("headers map sorted");function wI(e){return e===10||e===13||e===9||e===32}function DI(e){let A=0,t=e.length;for(;t>A&&wI(e.charCodeAt(t-1));)--t;for(;t>A&&wI(e.charCodeAt(A));)++A;return A===0&&t===e.length?e:e.substring(A,t)}function mI(e,A){if(Array.isArray(A))for(let t=0;t<A.length;++t){let r=A[t];if(r.length!==2)throw v.errors.exception({header:"Headers constructor",message:`expected name/value pair to be length 2, found ${r.length}.`});ja(e,r[0],r[1])}else if(typeof A=="object"&&A!==null){let t=Object.keys(A);for(let r=0;r<t.length;++r)ja(e,t[r],A[t[r]])}else throw v.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})}function ja(e,A,t){if(t=DI(t),qr(A)){if(!pI(t))throw v.errors.invalidArgument({prefix:"Headers.append",value:t,type:"header value"})}else throw v.errors.invalidArgument({prefix:"Headers.append",value:A,type:"header name"});if(FI(e)==="immutable")throw new TypeError("immutable");return $a(e).append(A,t,!1)}function kI(e,A){return e[0]<A[0]?-1:1}var mo=class e{cookies=null;constructor(A){A instanceof e?(this[tA]=new Map(A[tA]),this[kA]=A[kA],this.cookies=A.cookies===null?null:[...A.cookies]):(this[tA]=new Map(A),this[kA]=null)}contains(A,t){return this[tA].has(t?A:A.toLowerCase())}clear(){this[tA].clear(),this[kA]=null,this.cookies=null}append(A,t,r){this[kA]=null;let n=r?A:A.toLowerCase(),o=this[tA].get(n);if(o){let s=n==="cookie"?"; ":", ";this[tA].set(n,{name:o.name,value:`${o.value}${s}${t}`})}else this[tA].set(n,{name:A,value:t});n==="set-cookie"&&(this.cookies??=[]).push(t)}set(A,t,r){this[kA]=null;let n=r?A:A.toLowerCase();n==="set-cookie"&&(this.cookies=[t]),this[tA].set(n,{name:A,value:t})}delete(A,t){this[kA]=null,t||(A=A.toLowerCase()),A==="set-cookie"&&(this.cookies=null),this[tA].delete(A)}get(A,t){return this[tA].get(t?A:A.toLowerCase())?.value??null}*[Symbol.iterator](){for(let{0:A,1:{value:t}}of this[tA])yield[A,t]}get entries(){let A={};if(this[tA].size!==0)for(let{name:t,value:r}of this[tA].values())A[t]=r;return A}rawValues(){return this[tA].values()}get entriesList(){let A=[];if(this[tA].size!==0)for(let{0:t,1:{name:r,value:n}}of this[tA])if(t==="set-cookie")for(let o of this.cookies)A.push([r,o]);else A.push([r,n]);return A}toSortedArray(){let A=this[tA].size,t=new Array(A);if(A<=32){if(A===0)return t;let r=this[tA][Symbol.iterator](),n=r.next().value;t[0]=[n[0],n[1].value],Xa(n[1].value!==null);for(let o=1,s=0,i=0,a=0,g=0,c,l;o<A;++o){for(l=r.next().value,c=t[o]=[l[0],l[1].value],Xa(c[1]!==null),a=0,i=o;a<i;)g=a+(i-a>>1),t[g][0]<=c[0]?a=g+1:i=g;if(o!==g){for(s=o;s>a;)t[s]=t[--s];t[a]=c}}if(!r.next().done)throw new TypeError("Unreachable");return t}else{let r=0;for(let{0:n,1:{value:o}}of this[tA])t[r++]=[n,o],Xa(o!==null);return t.sort(kI)}}},_A=class e{#A;#e;constructor(A=void 0){v.util.markAsUncloneable(this),A!==$0&&(this.#e=new mo,this.#A="none",A!==void 0&&(A=v.converters.HeadersInit(A,"Headers contructor","init"),mI(this,A)))}append(A,t){v.brandCheck(this,e),v.argumentLengthCheck(arguments,2,"Headers.append");let r="Headers.append";return A=v.converters.ByteString(A,r,"name"),t=v.converters.ByteString(t,r,"value"),ja(this,A,t)}delete(A){if(v.brandCheck(this,e),v.argumentLengthCheck(arguments,1,"Headers.delete"),A=v.converters.ByteString(A,"Headers.delete","name"),!qr(A))throw v.errors.invalidArgument({prefix:"Headers.delete",value:A,type:"header name"});if(this.#A==="immutable")throw new TypeError("immutable");this.#e.contains(A,!1)&&this.#e.delete(A,!1)}get(A){v.brandCheck(this,e),v.argumentLengthCheck(arguments,1,"Headers.get");let t="Headers.get";if(A=v.converters.ByteString(A,t,"name"),!qr(A))throw v.errors.invalidArgument({prefix:t,value:A,type:"header name"});return this.#e.get(A,!1)}has(A){v.brandCheck(this,e),v.argumentLengthCheck(arguments,1,"Headers.has");let t="Headers.has";if(A=v.converters.ByteString(A,t,"name"),!qr(A))throw v.errors.invalidArgument({prefix:t,value:A,type:"header name"});return this.#e.contains(A,!1)}set(A,t){v.brandCheck(this,e),v.argumentLengthCheck(arguments,2,"Headers.set");let r="Headers.set";if(A=v.converters.ByteString(A,r,"name"),t=v.converters.ByteString(t,r,"value"),t=DI(t),qr(A)){if(!pI(t))throw v.errors.invalidArgument({prefix:r,value:t,type:"header value"})}else throw v.errors.invalidArgument({prefix:r,value:A,type:"header name"});if(this.#A==="immutable")throw new TypeError("immutable");this.#e.set(A,t,!1)}getSetCookie(){v.brandCheck(this,e);let A=this.#e.cookies;return A?[...A]:[]}get[kA](){if(this.#e[kA])return this.#e[kA];let A=[],t=this.#e.toSortedArray(),r=this.#e.cookies;if(r===null||r.length===1)return this.#e[kA]=t;for(let n=0;n<t.length;++n){let{0:o,1:s}=t[n];if(o==="set-cookie")for(let i=0;i<r.length;++i)A.push([o,r[i]]);else A.push([o,s])}return this.#e[kA]=A}[Do.inspect.custom](A,t){return t.depth??=A,`Headers ${Do.formatWithOptions(t,this.#e.entries)}`}static getHeadersGuard(A){return A.#A}static setHeadersGuard(A,t){A.#A=t}static getHeadersList(A){return A.#e}static setHeadersList(A,t){A.#e=t}},{getHeadersGuard:FI,setHeadersGuard:ek,getHeadersList:$a,setHeadersList:tk}=_A;Reflect.deleteProperty(_A,"getHeadersGuard");Reflect.deleteProperty(_A,"setHeadersGuard");Reflect.deleteProperty(_A,"getHeadersList");Reflect.deleteProperty(_A,"setHeadersList");Ak("Headers",_A,kA,0,1);Object.defineProperties(_A.prototype,{append:Zt,delete:Zt,get:Zt,has:Zt,set:Zt,getSetCookie:Zt,[Symbol.toStringTag]:{value:"Headers",configurable:!0},[Do.inspect.custom]:{enumerable:!1}});v.converters.HeadersInit=function(e,A,t){if(v.util.Type(e)==="Object"){let r=Reflect.get(e,Symbol.iterator);if(!Do.types.isProxy(e)&&r===_A.prototype.entries)try{return $a(e).entriesList}catch{}return typeof r=="function"?v.converters["sequence<sequence<ByteString>>"](e,A,t,r.bind(e)):v.converters["record<ByteString, ByteString>"](e,A,t)}throw v.errors.conversionFailed({prefix:"Headers constructor",argument:"Argument 1",types:["sequence<sequence<ByteString>>","record<ByteString, ByteString>"]})};RI.exports={fill:mI,compareHeaderName:kI,Headers:_A,HeadersList:mo,getHeadersGuard:FI,setHeadersGuard:ek,setHeadersList:tk,getHeadersList:$a}});var Or=f((WU,vI)=>{"use strict";var{Headers:LI,HeadersList:bI,fill:rk,getHeadersGuard:nk,setHeadersGuard:TI,setHeadersList:YI}=rt(),{extractBody:NI,cloneBody:ok,mixinBody:sk,hasFinalizationRegistry:GI,streamRegistry:JI,bodyUnusable:ik}=bt(),Ag=G(),SI=h("node:util"),{kEnumerableProperty:FA}=Ag,{isValidReasonPhrase:ak,isCancelled:gk,isAborted:ck,isBlobLike:lk,serializeJavascriptValueToJSONString:Qk,isErrorLike:Ek,isomorphicEncode:Bk,environmentSettingsObject:Ik}=pA(),{redirectStatusSet:Ck,nullBodyStatus:uk}=Br(),{kState:X,kHeaders:ue}=pe(),{webidl:T}=gA(),{FormData:hk}=fr(),{URLSerializer:UI}=uA(),{kConstruct:Fo}=Z(),eg=h("node:assert"),{types:dk}=h("node:util"),fk=new TextEncoder("utf-8"),nt=class e{static error(){return Wr(Ro(),"immutable")}static json(A,t={}){T.argumentLengthCheck(arguments,1,"Response.json"),t!==null&&(t=T.converters.ResponseInit(t));let r=fk.encode(Qk(A)),n=NI(r),o=Wr(Kt({}),"response");return MI(o,t,{body:n[0],type:"application/json"}),o}static redirect(A,t=302){T.argumentLengthCheck(arguments,1,"Response.redirect"),A=T.converters.USVString(A),t=T.converters["unsigned short"](t);let r;try{r=new URL(A,Ik.settingsObject.baseUrl)}catch(s){throw new TypeError(`Failed to parse URL from ${A}`,{cause:s})}if(!Ck.has(t))throw new RangeError(`Invalid status code ${t}`);let n=Wr(Kt({}),"immutable");n[X].status=t;let o=Bk(UI(r));return n[X].headersList.append("location",o,!0),n}constructor(A=null,t={}){if(T.util.markAsUncloneable(this),A===Fo)return;A!==null&&(A=T.converters.BodyInit(A)),t=T.converters.ResponseInit(t),this[X]=Kt({}),this[ue]=new LI(Fo),TI(this[ue],"response"),YI(this[ue],this[X].headersList);let r=null;if(A!=null){let[n,o]=NI(A);r={body:n,type:o}}MI(this,t,r)}get type(){return T.brandCheck(this,e),this[X].type}get url(){T.brandCheck(this,e);let A=this[X].urlList,t=A[A.length-1]??null;return t===null?"":UI(t,!0)}get redirected(){return T.brandCheck(this,e),this[X].urlList.length>1}get status(){return T.brandCheck(this,e),this[X].status}get ok(){return T.brandCheck(this,e),this[X].status>=200&&this[X].status<=299}get statusText(){return T.brandCheck(this,e),this[X].statusText}get headers(){return T.brandCheck(this,e),this[ue]}get body(){return T.brandCheck(this,e),this[X].body?this[X].body.stream:null}get bodyUsed(){return T.brandCheck(this,e),!!this[X].body&&Ag.isDisturbed(this[X].body.stream)}clone(){if(T.brandCheck(this,e),ik(this))throw T.errors.exception({header:"Response.clone",message:"Body has already been consumed."});let A=tg(this[X]);return GI&&this[X].body?.stream&&JI.register(this,new WeakRef(this[X].body.stream)),Wr(A,nk(this[ue]))}[SI.inspect.custom](A,t){t.depth===null&&(t.depth=2),t.colors??=!0;let r={status:this.status,statusText:this.statusText,headers:this.headers,body:this.body,bodyUsed:this.bodyUsed,ok:this.ok,redirected:this.redirected,type:this.type,url:this.url};return`Response ${SI.formatWithOptions(t,r)}`}};sk(nt);Object.defineProperties(nt.prototype,{type:FA,url:FA,status:FA,ok:FA,redirected:FA,statusText:FA,headers:FA,clone:FA,body:FA,bodyUsed:FA,[Symbol.toStringTag]:{value:"Response",configurable:!0}});Object.defineProperties(nt,{json:FA,redirect:FA,error:FA});function tg(e){if(e.internalResponse)return xI(tg(e.internalResponse),e.type);let A=Kt({...e,body:null});return e.body!=null&&(A.body=ok(A,e.body)),A}function Kt(e){return{aborted:!1,rangeRequested:!1,timingAllowPassed:!1,requestIncludesCredentials:!1,type:"default",status:200,timingInfo:null,cacheState:"",statusText:"",...e,headersList:e?.headersList?new bI(e?.headersList):new bI,urlList:e?.urlList?[...e.urlList]:[]}}function Ro(e){let A=Ek(e);return Kt({type:"error",status:0,error:A?e:new Error(e&&String(e)),aborted:e&&e.name==="AbortError"})}function yk(e){return e.type==="error"&&e.status===0}function ko(e,A){return A={internalResponse:e,...A},new Proxy(e,{get(t,r){return r in A?A[r]:t[r]},set(t,r,n){return eg(!(r in A)),t[r]=n,!0}})}function xI(e,A){if(A==="basic")return ko(e,{type:"basic",headersList:e.headersList});if(A==="cors")return ko(e,{type:"cors",headersList:e.headersList});if(A==="opaque")return ko(e,{type:"opaque",urlList:Object.freeze([]),status:0,statusText:"",body:null});if(A==="opaqueredirect")return ko(e,{type:"opaqueredirect",status:0,statusText:"",headersList:[],body:null});eg(!1)}function wk(e,A=null){return eg(gk(e)),ck(e)?Ro(Object.assign(new DOMException("The operation was aborted.","AbortError"),{cause:A})):Ro(Object.assign(new DOMException("Request was cancelled."),{cause:A}))}function MI(e,A,t){if(A.status!==null&&(A.status<200||A.status>599))throw new RangeError('init["status"] must be in the range of 200 to 599, inclusive.');if("statusText"in A&&A.statusText!=null&&!ak(String(A.statusText)))throw new TypeError("Invalid statusText");if("status"in A&&A.status!=null&&(e[X].status=A.status),"statusText"in A&&A.statusText!=null&&(e[X].statusText=A.statusText),"headers"in A&&A.headers!=null&&rk(e[ue],A.headers),t){if(uk.includes(e.status))throw T.errors.exception({header:"Response constructor",message:`Invalid response status code ${e.status}`});e[X].body=t.body,t.type!=null&&!e[X].headersList.contains("content-type",!0)&&e[X].headersList.append("content-type",t.type,!0)}}function Wr(e,A){let t=new nt(Fo);return t[X]=e,t[ue]=new LI(Fo),YI(t[ue],e.headersList),TI(t[ue],A),GI&&e.body?.stream&&JI.register(t,new WeakRef(e.body.stream)),t}T.converters.ReadableStream=T.interfaceConverter(ReadableStream);T.converters.FormData=T.interfaceConverter(hk);T.converters.URLSearchParams=T.interfaceConverter(URLSearchParams);T.converters.XMLHttpRequestBodyInit=function(e,A,t){return typeof e=="string"?T.converters.USVString(e,A,t):lk(e)?T.converters.Blob(e,A,t,{strict:!1}):ArrayBuffer.isView(e)||dk.isArrayBuffer(e)?T.converters.BufferSource(e,A,t):Ag.isFormDataLike(e)?T.converters.FormData(e,A,t,{strict:!1}):e instanceof URLSearchParams?T.converters.URLSearchParams(e,A,t):T.converters.DOMString(e,A,t)};T.converters.BodyInit=function(e,A,t){return e instanceof ReadableStream?T.converters.ReadableStream(e,A,t):e?.[Symbol.asyncIterator]?e:T.converters.XMLHttpRequestBodyInit(e,A,t)};T.converters.ResponseInit=T.dictionaryConverter([{key:"status",converter:T.converters["unsigned short"],defaultValue:()=>200},{key:"statusText",converter:T.converters.ByteString,defaultValue:()=>""},{key:"headers",converter:T.converters.HeadersInit}]);vI.exports={isNetworkError:yk,makeNetworkError:Ro,makeResponse:Kt,makeAppropriateNetworkError:wk,filterResponse:xI,Response:nt,cloneResponse:tg,fromInnerResponse:Wr}});var WI=f((OU,qI)=>{"use strict";var{kConnected:HI,kSize:VI}=Z(),rg=class{constructor(A){this.value=A}deref(){return this.value[HI]===0&&this.value[VI]===0?void 0:this.value}},ng=class{constructor(A){this.finalizer=A}register(A,t){A.on&&A.on("disconnect",()=>{A[HI]===0&&A[VI]===0&&this.finalizer(t)})}unregister(A){}};qI.exports=function(){return process.env.NODE_V8_COVERAGE&&process.version.startsWith("v18")?(process._rawDebug("Using compatibility WeakRef and FinalizationRegistry"),{WeakRef:rg,FinalizationRegistry:ng}):{WeakRef,FinalizationRegistry}}});var Xt=f((PU,oC)=>{"use strict";var{extractBody:pk,mixinBody:Dk,cloneBody:mk,bodyUnusable:OI}=bt(),{Headers:AC,fill:kk,HeadersList:Uo,setHeadersGuard:sg,getHeadersGuard:Fk,setHeadersList:eC,getHeadersList:PI}=rt(),{FinalizationRegistry:Rk}=WI()(),No=G(),_I=h("node:util"),{isValidHTTPToken:bk,sameOrigin:zI,environmentSettingsObject:bo}=pA(),{forbiddenMethodsSet:Nk,corsSafeListedMethodsSet:Sk,referrerPolicy:Uk,requestRedirect:Mk,requestMode:Lk,requestCredentials:Tk,requestCache:Yk,requestDuplex:Gk}=Br(),{kEnumerableProperty:rA,normalizedMethodRecordsBase:Jk,normalizedMethodRecords:xk}=No,{kHeaders:RA,kSignal:So,kState:z,kDispatcher:og}=pe(),{webidl:N}=gA(),{URLSerializer:vk}=uA(),{kConstruct:Mo}=Z(),Hk=h("node:assert"),{getMaxListeners:ZI,setMaxListeners:KI,getEventListeners:Vk,defaultMaxListeners:XI}=h("node:events"),qk=Symbol("abortController"),tC=new Rk(({signal:e,abort:A})=>{e.removeEventListener("abort",A)}),Lo=new WeakMap;function jI(e){return A;function A(){let t=e.deref();if(t!==void 0){tC.unregister(A),this.removeEventListener("abort",A),t.abort(this.reason);let r=Lo.get(t.signal);if(r!==void 0){if(r.size!==0){for(let n of r){let o=n.deref();o!==void 0&&o.abort(this.reason)}r.clear()}Lo.delete(t.signal)}}}}var $I=!1,Te=class e{constructor(A,t={}){if(N.util.markAsUncloneable(this),A===Mo)return;let r="Request constructor";N.argumentLengthCheck(arguments,1,r),A=N.converters.RequestInfo(A,r,"input"),t=N.converters.RequestInit(t,r,"init");let n=null,o=null,s=bo.settingsObject.baseUrl,i=null;if(typeof A=="string"){this[og]=t.dispatcher;let I;try{I=new URL(A,s)}catch(u){throw new TypeError("Failed to parse URL from "+A,{cause:u})}if(I.username||I.password)throw new TypeError("Request cannot be constructed from a URL that includes credentials: "+A);n=To({urlList:[I]}),o="cors"}else this[og]=t.dispatcher||A[og],Hk(A instanceof e),n=A[z],i=A[So];let a=bo.settingsObject.origin,g="client";if(n.window?.constructor?.name==="EnvironmentSettingsObject"&&zI(n.window,a)&&(g=n.window),t.window!=null)throw new TypeError(`'window' option '${g}' must be null`);"window"in t&&(g="no-window"),n=To({method:n.method,headersList:n.headersList,unsafeRequest:n.unsafeRequest,client:bo.settingsObject,window:g,priority:n.priority,origin:n.origin,referrer:n.referrer,referrerPolicy:n.referrerPolicy,mode:n.mode,credentials:n.credentials,cache:n.cache,redirect:n.redirect,integrity:n.integrity,keepalive:n.keepalive,reloadNavigation:n.reloadNavigation,historyNavigation:n.historyNavigation,urlList:[...n.urlList]});let c=Object.keys(t).length!==0;if(c&&(n.mode==="navigate"&&(n.mode="same-origin"),n.reloadNavigation=!1,n.historyNavigation=!1,n.origin="client",n.referrer="client",n.referrerPolicy="",n.url=n.urlList[n.urlList.length-1],n.urlList=[n.url]),t.referrer!==void 0){let I=t.referrer;if(I==="")n.referrer="no-referrer";else{let u;try{u=new URL(I,s)}catch(D){throw new TypeError(`Referrer "${I}" is not a valid URL.`,{cause:D})}u.protocol==="about:"&&u.hostname==="client"||a&&!zI(u,bo.settingsObject.baseUrl)?n.referrer="client":n.referrer=u}}t.referrerPolicy!==void 0&&(n.referrerPolicy=t.referrerPolicy);let l;if(t.mode!==void 0?l=t.mode:l=o,l==="navigate")throw N.errors.exception({header:"Request constructor",message:"invalid request mode navigate."});if(l!=null&&(n.mode=l),t.credentials!==void 0&&(n.credentials=t.credentials),t.cache!==void 0&&(n.cache=t.cache),n.cache==="only-if-cached"&&n.mode!=="same-origin")throw new TypeError("'only-if-cached' can be set only with 'same-origin' mode");if(t.redirect!==void 0&&(n.redirect=t.redirect),t.integrity!=null&&(n.integrity=String(t.integrity)),t.keepalive!==void 0&&(n.keepalive=!!t.keepalive),t.method!==void 0){let I=t.method,u=xk[I];if(u!==void 0)n.method=u;else{if(!bk(I))throw new TypeError(`'${I}' is not a valid HTTP method.`);let D=I.toUpperCase();if(Nk.has(D))throw new TypeError(`'${I}' HTTP method is unsupported.`);I=Jk[D]??I,n.method=I}!$I&&n.method==="patch"&&(process.emitWarning("Using `patch` is highly likely to result in a `405 Method Not Allowed`. `PATCH` is much more likely to succeed.",{code:"UNDICI-FETCH-patch"}),$I=!0)}t.signal!==void 0&&(i=t.signal),this[z]=n;let Q=new AbortController;if(this[So]=Q.signal,i!=null){if(!i||typeof i.aborted!="boolean"||typeof i.addEventListener!="function")throw new TypeError("Failed to construct 'Request': member signal is not of type AbortSignal.");if(i.aborted)Q.abort(i.reason);else{this[qk]=Q;let I=new WeakRef(Q),u=jI(I);try{(typeof ZI=="function"&&ZI(i)===XI||Vk(i,"abort").length>=XI)&&KI(1500,i)}catch{}No.addAbortListener(i,u),tC.register(Q,{signal:i,abort:u},u)}}if(this[RA]=new AC(Mo),eC(this[RA],n.headersList),sg(this[RA],"request"),l==="no-cors"){if(!Sk.has(n.method))throw new TypeError(`'${n.method} is unsupported in no-cors mode.`);sg(this[RA],"request-no-cors")}if(c){let I=PI(this[RA]),u=t.headers!==void 0?t.headers:new Uo(I);if(I.clear(),u instanceof Uo){for(let{name:D,value:p}of u.rawValues())I.append(D,p,!1);I.cookies=u.cookies}else kk(this[RA],u)}let E=A instanceof e?A[z].body:null;if((t.body!=null||E!=null)&&(n.method==="GET"||n.method==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body.");let B=null;if(t.body!=null){let[I,u]=pk(t.body,n.keepalive);B=I,u&&!PI(this[RA]).contains("content-type",!0)&&this[RA].append("content-type",u)}let C=B??E;if(C!=null&&C.source==null){if(B!=null&&t.duplex==null)throw new TypeError("RequestInit: duplex option is required when sending a body.");if(n.mode!=="same-origin"&&n.mode!=="cors")throw new TypeError('If request is made from ReadableStream, mode should be "same-origin" or "cors"');n.useCORSPreflightFlag=!0}let d=C;if(B==null&&E!=null){if(OI(A))throw new TypeError("Cannot construct a Request with a Request object that has already been used.");let I=new TransformStream;E.stream.pipeThrough(I),d={source:E.source,length:E.length,stream:I.readable}}this[z].body=d}get method(){return N.brandCheck(this,e),this[z].method}get url(){return N.brandCheck(this,e),vk(this[z].url)}get headers(){return N.brandCheck(this,e),this[RA]}get destination(){return N.brandCheck(this,e),this[z].destination}get referrer(){return N.brandCheck(this,e),this[z].referrer==="no-referrer"?"":this[z].referrer==="client"?"about:client":this[z].referrer.toString()}get referrerPolicy(){return N.brandCheck(this,e),this[z].referrerPolicy}get mode(){return N.brandCheck(this,e),this[z].mode}get credentials(){return this[z].credentials}get cache(){return N.brandCheck(this,e),this[z].cache}get redirect(){return N.brandCheck(this,e),this[z].redirect}get integrity(){return N.brandCheck(this,e),this[z].integrity}get keepalive(){return N.brandCheck(this,e),this[z].keepalive}get isReloadNavigation(){return N.brandCheck(this,e),this[z].reloadNavigation}get isHistoryNavigation(){return N.brandCheck(this,e),this[z].historyNavigation}get signal(){return N.brandCheck(this,e),this[So]}get body(){return N.brandCheck(this,e),this[z].body?this[z].body.stream:null}get bodyUsed(){return N.brandCheck(this,e),!!this[z].body&&No.isDisturbed(this[z].body.stream)}get duplex(){return N.brandCheck(this,e),"half"}clone(){if(N.brandCheck(this,e),OI(this))throw new TypeError("unusable");let A=rC(this[z]),t=new AbortController;if(this.signal.aborted)t.abort(this.signal.reason);else{let r=Lo.get(this.signal);r===void 0&&(r=new Set,Lo.set(this.signal,r));let n=new WeakRef(t);r.add(n),No.addAbortListener(t.signal,jI(n))}return nC(A,t.signal,Fk(this[RA]))}[_I.inspect.custom](A,t){t.depth===null&&(t.depth=2),t.colors??=!0;let r={method:this.method,url:this.url,headers:this.headers,destination:this.destination,referrer:this.referrer,referrerPolicy:this.referrerPolicy,mode:this.mode,credentials:this.credentials,cache:this.cache,redirect:this.redirect,integrity:this.integrity,keepalive:this.keepalive,isReloadNavigation:this.isReloadNavigation,isHistoryNavigation:this.isHistoryNavigation,signal:this.signal};return`Request ${_I.formatWithOptions(t,r)}`}};Dk(Te);function To(e){return{method:e.method??"GET",localURLsOnly:e.localURLsOnly??!1,unsafeRequest:e.unsafeRequest??!1,body:e.body??null,client:e.client??null,reservedClient:e.reservedClient??null,replacesClientId:e.replacesClientId??"",window:e.window??"client",keepalive:e.keepalive??!1,serviceWorkers:e.serviceWorkers??"all",initiator:e.initiator??"",destination:e.destination??"",priority:e.priority??null,origin:e.origin??"client",policyContainer:e.policyContainer??"client",referrer:e.referrer??"client",referrerPolicy:e.referrerPolicy??"",mode:e.mode??"no-cors",useCORSPreflightFlag:e.useCORSPreflightFlag??!1,credentials:e.credentials??"same-origin",useCredentials:e.useCredentials??!1,cache:e.cache??"default",redirect:e.redirect??"follow",integrity:e.integrity??"",cryptoGraphicsNonceMetadata:e.cryptoGraphicsNonceMetadata??"",parserMetadata:e.parserMetadata??"",reloadNavigation:e.reloadNavigation??!1,historyNavigation:e.historyNavigation??!1,userActivation:e.userActivation??!1,taintedOrigin:e.taintedOrigin??!1,redirectCount:e.redirectCount??0,responseTainting:e.responseTainting??"basic",preventNoCacheCacheControlHeaderModification:e.preventNoCacheCacheControlHeaderModification??!1,done:e.done??!1,timingAllowFailed:e.timingAllowFailed??!1,urlList:e.urlList,url:e.urlList[0],headersList:e.headersList?new Uo(e.headersList):new Uo}}function rC(e){let A=To({...e,body:null});return e.body!=null&&(A.body=mk(A,e.body)),A}function nC(e,A,t){let r=new Te(Mo);return r[z]=e,r[So]=A,r[RA]=new AC(Mo),eC(r[RA],e.headersList),sg(r[RA],t),r}Object.defineProperties(Te.prototype,{method:rA,url:rA,headers:rA,redirect:rA,clone:rA,signal:rA,duplex:rA,destination:rA,body:rA,bodyUsed:rA,isHistoryNavigation:rA,isReloadNavigation:rA,keepalive:rA,integrity:rA,cache:rA,credentials:rA,attribute:rA,referrerPolicy:rA,referrer:rA,mode:rA,[Symbol.toStringTag]:{value:"Request",configurable:!0}});N.converters.Request=N.interfaceConverter(Te);N.converters.RequestInfo=function(e,A,t){return typeof e=="string"?N.converters.USVString(e,A,t):e instanceof Te?N.converters.Request(e,A,t):N.converters.USVString(e,A,t)};N.converters.AbortSignal=N.interfaceConverter(AbortSignal);N.converters.RequestInit=N.dictionaryConverter([{key:"method",converter:N.converters.ByteString},{key:"headers",converter:N.converters.HeadersInit},{key:"body",converter:N.nullableConverter(N.converters.BodyInit)},{key:"referrer",converter:N.converters.USVString},{key:"referrerPolicy",converter:N.converters.DOMString,allowedValues:Uk},{key:"mode",converter:N.converters.DOMString,allowedValues:Lk},{key:"credentials",converter:N.converters.DOMString,allowedValues:Tk},{key:"cache",converter:N.converters.DOMString,allowedValues:Yk},{key:"redirect",converter:N.converters.DOMString,allowedValues:Mk},{key:"integrity",converter:N.converters.DOMString},{key:"keepalive",converter:N.converters.boolean},{key:"signal",converter:N.nullableConverter(e=>N.converters.AbortSignal(e,"RequestInit","signal",{strict:!1}))},{key:"window",converter:N.converters.any},{key:"duplex",converter:N.converters.DOMString,allowedValues:Gk},{key:"dispatcher",converter:N.converters.any}]);oC.exports={Request:Te,makeRequest:To,fromInnerRequest:nC,cloneRequest:rC}});var _r=f((_U,fC)=>{"use strict";var{makeNetworkError:W,makeAppropriateNetworkError:Yo,filterResponse:ig,makeResponse:Go,fromInnerResponse:Wk}=Or(),{HeadersList:sC}=rt(),{Request:Ok,cloneRequest:Pk}=Xt(),Ye=h("node:zlib"),{bytesMatch:_k,makePolicyContainer:zk,clonePolicyContainer:Zk,requestBadPort:Kk,TAOCheck:Xk,appendRequestOriginHeader:jk,responseLocationURL:$k,requestCurrentURL:ie,setRequestReferrerPolicyOnRedirect:AF,tryUpgradeRequestToAPotentiallyTrustworthyURL:eF,createOpaqueTimingInfo:Qg,appendFetchMetadata:tF,corsCheck:rF,crossOriginResourcePolicyCheck:nF,determineRequestsReferrer:oF,coarsenedSharedCurrentTime:Pr,createDeferredPromise:sF,isBlobLike:iF,sameOrigin:lg,isCancelled:ot,isAborted:iC,isErrorLike:aF,fullyReadBody:gF,readableStreamClose:cF,isomorphicEncode:Jo,urlIsLocal:lF,urlIsHttpHttpsScheme:Eg,urlHasHttpsScheme:QF,clampAndCoarsenConnectionTimingInfo:EF,simpleRangeHeaderValue:BF,buildContentRange:IF,createInflate:CF,extractMimeType:uF}=pA(),{kState:lC,kDispatcher:hF}=pe(),st=h("node:assert"),{safelyExtractBody:Bg,extractBody:aC}=bt(),{redirectStatusSet:QC,nullBodyStatus:EC,safeMethodsSet:dF,requestBodyHeader:fF,subresourceSet:yF}=Br(),wF=h("node:events"),{Readable:pF,pipeline:DF,finished:mF}=h("node:stream"),{addAbortListener:kF,isErrored:FF,isReadable:xo,bufferToLowerCasedHeaderName:gC}=G(),{dataURLProcessor:RF,serializeAMimeType:bF,minimizeSupportedMimeType:NF}=uA(),{getGlobalDispatcher:SF}=wo(),{webidl:UF}=gA(),{STATUS_CODES:MF}=h("node:http"),LF=["GET","HEAD"],TF=typeof __UNDICI_IS_NODE__<"u"||typeof esbuildDetection<"u"?"node":"undici",ag,vo=class extends wF{constructor(A){super(),this.dispatcher=A,this.connection=null,this.dump=!1,this.state="ongoing"}terminate(A){this.state==="ongoing"&&(this.state="terminated",this.connection?.destroy(A),this.emit("terminated",A))}abort(A){this.state==="ongoing"&&(this.state="aborted",A||(A=new DOMException("The operation was aborted.","AbortError")),this.serializedAbortReason=A,this.connection?.destroy(A),this.emit("terminated",A))}};function YF(e){BC(e,"fetch")}function GF(e,A=void 0){UF.argumentLengthCheck(arguments,1,"globalThis.fetch");let t=sF(),r;try{r=new Ok(e,A)}catch(c){return t.reject(c),t.promise}let n=r[lC];if(r.signal.aborted)return gg(t,n,null,r.signal.reason),t.promise;n.client.globalObject?.constructor?.name==="ServiceWorkerGlobalScope"&&(n.serviceWorkers="none");let s=null,i=!1,a=null;return kF(r.signal,()=>{i=!0,st(a!=null),a.abort(r.signal.reason);let c=s?.deref();gg(t,n,c,r.signal.reason)}),a=CC({request:n,processResponseEndOfBody:YF,processResponse:c=>{if(!i){if(c.aborted){gg(t,n,s,a.serializedAbortReason);return}if(c.type==="error"){t.reject(new TypeError("fetch failed",{cause:c.error}));return}s=new WeakRef(Wk(c,"immutable")),t.resolve(s.deref()),t=null}},dispatcher:r[hF]}),t.promise}function BC(e,A="other"){if(e.type==="error"&&e.aborted||!e.urlList?.length)return;let t=e.urlList[0],r=e.timingInfo,n=e.cacheState;Eg(t)&&r!==null&&(e.timingAllowPassed||(r=Qg({startTime:r.startTime}),n=""),r.endTime=Pr(),e.timingInfo=r,IC(r,t.href,A,globalThis,n))}var IC=performance.markResourceTiming;function gg(e,A,t,r){if(e&&e.reject(r),A.body!=null&&xo(A.body?.stream)&&A.body.stream.cancel(r).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o}),t==null)return;let n=t[lC];n.body!=null&&xo(n.body?.stream)&&n.body.stream.cancel(r).catch(o=>{if(o.code!=="ERR_INVALID_STATE")throw o})}function CC({request:e,processRequestBodyChunkLength:A,processRequestEndOfBody:t,processResponse:r,processResponseEndOfBody:n,processResponseConsumeBody:o,useParallelQueue:s=!1,dispatcher:i=SF()}){st(i);let a=null,g=!1;e.client!=null&&(a=e.client.globalObject,g=e.client.crossOriginIsolatedCapability);let c=Pr(g),l=Qg({startTime:c}),Q={controller:new vo(i),request:e,timingInfo:l,processRequestBodyChunkLength:A,processRequestEndOfBody:t,processResponse:r,processResponseConsumeBody:o,processResponseEndOfBody:n,taskDestination:a,crossOriginIsolatedCapability:g};return st(!e.body||e.body.stream),e.window==="client"&&(e.window=e.client?.globalObject?.constructor?.name==="Window"?e.client:"no-window"),e.origin==="client"&&(e.origin=e.client.origin),e.policyContainer==="client"&&(e.client!=null?e.policyContainer=Zk(e.client.policyContainer):e.policyContainer=zk()),e.headersList.contains("accept",!0)||e.headersList.append("accept","*/*",!0),e.headersList.contains("accept-language",!0)||e.headersList.append("accept-language","*",!0),e.priority,yF.has(e.destination),uC(Q).catch(E=>{Q.controller.terminate(E)}),Q.controller}async function uC(e,A=!1){let t=e.request,r=null;if(t.localURLsOnly&&!lF(ie(t))&&(r=W("local URLs only")),eF(t),Kk(t)==="blocked"&&(r=W("bad port")),t.referrerPolicy===""&&(t.referrerPolicy=t.policyContainer.referrerPolicy),t.referrer!=="no-referrer"&&(t.referrer=oF(t)),r===null&&(r=await(async()=>{let o=ie(t);return lg(o,t.url)&&t.responseTainting==="basic"||o.protocol==="data:"||t.mode==="navigate"||t.mode==="websocket"?(t.responseTainting="basic",await cC(e)):t.mode==="same-origin"?W('request mode cannot be "same-origin"'):t.mode==="no-cors"?t.redirect!=="follow"?W('redirect mode cannot be "follow" for "no-cors" request'):(t.responseTainting="opaque",await cC(e)):Eg(ie(t))?(t.responseTainting="cors",await hC(e)):W("URL scheme must be a HTTP(S) scheme")})()),A)return r;r.status!==0&&!r.internalResponse&&(t.responseTainting,t.responseTainting==="basic"?r=ig(r,"basic"):t.responseTainting==="cors"?r=ig(r,"cors"):t.responseTainting==="opaque"?r=ig(r,"opaque"):st(!1));let n=r.status===0?r:r.internalResponse;if(n.urlList.length===0&&n.urlList.push(...t.urlList),t.timingAllowFailed||(r.timingAllowPassed=!0),r.type==="opaque"&&n.status===206&&n.rangeRequested&&!t.headers.contains("range",!0)&&(r=n=W()),r.status!==0&&(t.method==="HEAD"||t.method==="CONNECT"||EC.includes(n.status))&&(n.body=null,e.controller.dump=!0),t.integrity){let o=i=>cg(e,W(i));if(t.responseTainting==="opaque"||r.body==null){o(r.error);return}let s=i=>{if(!_k(i,t.integrity)){o("integrity mismatch");return}r.body=Bg(i)[0],cg(e,r)};await gF(r.body,s,o)}else cg(e,r)}function cC(e){if(ot(e)&&e.request.redirectCount===0)return Promise.resolve(Yo(e));let{request:A}=e,{protocol:t}=ie(A);switch(t){case"about:":return Promise.resolve(W("about scheme is not supported"));case"blob:":{ag||(ag=h("node:buffer").resolveObjectURL);let r=ie(A);if(r.search.length!==0)return Promise.resolve(W("NetworkError when attempting to fetch resource."));let n=ag(r.toString());if(A.method!=="GET"||!iF(n))return Promise.resolve(W("invalid method"));let o=Go(),s=n.size,i=Jo(`${s}`),a=n.type;if(A.headersList.contains("range",!0)){o.rangeRequested=!0;let g=A.headersList.get("range",!0),c=BF(g,!0);if(c==="failure")return Promise.resolve(W("failed to fetch the data URL"));let{rangeStartValue:l,rangeEndValue:Q}=c;if(l===null)l=s-Q,Q=l+Q-1;else{if(l>=s)return Promise.resolve(W("Range start is greater than the blob's size."));(Q===null||Q>=s)&&(Q=s-1)}let E=n.slice(l,Q,a),B=aC(E);o.body=B[0];let C=Jo(`${E.size}`),d=IF(l,Q,s);o.status=206,o.statusText="Partial Content",o.headersList.set("content-length",C,!0),o.headersList.set("content-type",a,!0),o.headersList.set("content-range",d,!0)}else{let g=aC(n);o.statusText="OK",o.body=g[0],o.headersList.set("content-length",i,!0),o.headersList.set("content-type",a,!0)}return Promise.resolve(o)}case"data:":{let r=ie(A),n=RF(r);if(n==="failure")return Promise.resolve(W("failed to fetch the data URL"));let o=bF(n.mimeType);return Promise.resolve(Go({statusText:"OK",headersList:[["content-type",{name:"Content-Type",value:o}]],body:Bg(n.body)[0]}))}case"file:":return Promise.resolve(W("not implemented... yet..."));case"http:":case"https:":return hC(e).catch(r=>W(r));default:return Promise.resolve(W("unknown scheme"))}}function JF(e,A){e.request.done=!0,e.processResponseDone!=null&&queueMicrotask(()=>e.processResponseDone(A))}function cg(e,A){let t=e.timingInfo,r=()=>{let o=Date.now();e.request.destination==="document"&&(e.controller.fullTimingInfo=t),e.controller.reportTimingSteps=()=>{if(e.request.url.protocol!=="https:")return;t.endTime=o;let i=A.cacheState,a=A.bodyInfo;A.timingAllowPassed||(t=Qg(t),i="");let g=0;if(e.request.mode!=="navigator"||!A.hasCrossOriginRedirects){g=A.status;let c=uF(A.headersList);c!=="failure"&&(a.contentType=NF(c))}e.request.initiatorType!=null&&IC(t,e.request.url.href,e.request.initiatorType,globalThis,i,a,g)};let s=()=>{e.request.done=!0,e.processResponseEndOfBody!=null&&queueMicrotask(()=>e.processResponseEndOfBody(A)),e.request.initiatorType!=null&&e.controller.reportTimingSteps()};queueMicrotask(()=>s())};e.processResponse!=null&&queueMicrotask(()=>{e.processResponse(A),e.processResponse=null});let n=A.type==="error"?A:A.internalResponse??A;n.body==null?r():mF(n.body.stream,()=>{r()})}async function hC(e){let A=e.request,t=null,r=null,n=e.timingInfo;if(A.serviceWorkers,t===null){if(A.redirect==="follow"&&(A.serviceWorkers="none"),r=t=await dC(e),A.responseTainting==="cors"&&rF(A,t)==="failure")return W("cors failure");Xk(A,t)==="failure"&&(A.timingAllowFailed=!0)}return(A.responseTainting==="opaque"||t.type==="opaque")&&nF(A.origin,A.client,A.destination,r)==="blocked"?W("blocked"):(QC.has(r.status)&&(A.redirect!=="manual"&&e.controller.connection.destroy(void 0,!1),A.redirect==="error"?t=W("unexpected redirect"):A.redirect==="manual"?t=r:A.redirect==="follow"?t=await xF(e,t):st(!1)),t.timingInfo=n,t)}function xF(e,A){let t=e.request,r=A.internalResponse?A.internalResponse:A,n;try{if(n=$k(r,ie(t).hash),n==null)return A}catch(s){return Promise.resolve(W(s))}if(!Eg(n))return Promise.resolve(W("URL scheme must be a HTTP(S) scheme"));if(t.redirectCount===20)return Promise.resolve(W("redirect count exceeded"));if(t.redirectCount+=1,t.mode==="cors"&&(n.username||n.password)&&!lg(t,n))return Promise.resolve(W('cross origin not allowed for request mode "cors"'));if(t.responseTainting==="cors"&&(n.username||n.password))return Promise.resolve(W('URL cannot contain credentials for request mode "cors"'));if(r.status!==303&&t.body!=null&&t.body.source==null)return Promise.resolve(W());if([301,302].includes(r.status)&&t.method==="POST"||r.status===303&&!LF.includes(t.method)){t.method="GET",t.body=null;for(let s of fF)t.headersList.delete(s)}lg(ie(t),n)||(t.headersList.delete("authorization",!0),t.headersList.delete("proxy-authorization",!0),t.headersList.delete("cookie",!0),t.headersList.delete("host",!0)),t.body!=null&&(st(t.body.source!=null),t.body=Bg(t.body.source)[0]);let o=e.timingInfo;return o.redirectEndTime=o.postRedirectStartTime=Pr(e.crossOriginIsolatedCapability),o.redirectStartTime===0&&(o.redirectStartTime=o.startTime),t.urlList.push(n),AF(t,r),uC(e,!0)}async function dC(e,A=!1,t=!1){let r=e.request,n=null,o=null,s=null,i=null,a=!1;r.window==="no-window"&&r.redirect==="error"?(n=e,o=r):(o=Pk(r),n={...e},n.request=o);let g=r.credentials==="include"||r.credentials==="same-origin"&&r.responseTainting==="basic",c=o.body?o.body.length:null,l=null;if(o.body==null&&["POST","PUT"].includes(o.method)&&(l="0"),c!=null&&(l=Jo(`${c}`)),l!=null&&o.headersList.append("content-length",l,!0),c!=null&&o.keepalive,o.referrer instanceof URL&&o.headersList.append("referer",Jo(o.referrer.href),!0),jk(o),tF(o),o.headersList.contains("user-agent",!0)||o.headersList.append("user-agent",TF),o.cache==="default"&&(o.headersList.contains("if-modified-since",!0)||o.headersList.contains("if-none-match",!0)||o.headersList.contains("if-unmodified-since",!0)||o.headersList.contains("if-match",!0)||o.headersList.contains("if-range",!0))&&(o.cache="no-store"),o.cache==="no-cache"&&!o.preventNoCacheCacheControlHeaderModification&&!o.headersList.contains("cache-control",!0)&&o.headersList.append("cache-control","max-age=0",!0),(o.cache==="no-store"||o.cache==="reload")&&(o.headersList.contains("pragma",!0)||o.headersList.append("pragma","no-cache",!0),o.headersList.contains("cache-control",!0)||o.headersList.append("cache-control","no-cache",!0)),o.headersList.contains("range",!0)&&o.headersList.append("accept-encoding","identity",!0),o.headersList.contains("accept-encoding",!0)||(QF(ie(o))?o.headersList.append("accept-encoding","br, gzip, deflate",!0):o.headersList.append("accept-encoding","gzip, deflate",!0)),o.headersList.delete("host",!0),i==null&&(o.cache="no-store"),o.cache!=="no-store"&&o.cache,s==null){if(o.cache==="only-if-cached")return W("only if cached");let Q=await vF(n,g,t);!dF.has(o.method)&&Q.status>=200&&Q.status<=399,a&&Q.status,s==null&&(s=Q)}if(s.urlList=[...o.urlList],o.headersList.contains("range",!0)&&(s.rangeRequested=!0),s.requestIncludesCredentials=g,s.status===407)return r.window==="no-window"?W():ot(e)?Yo(e):W("proxy authentication required");if(s.status===421&&!t&&(r.body==null||r.body.source!=null)){if(ot(e))return Yo(e);e.controller.connection.destroy(),s=await dC(e,A,!0)}return s}async function vF(e,A=!1,t=!1){st(!e.controller.connection||e.controller.connection.destroyed),e.controller.connection={abort:null,destroyed:!1,destroy(B,C=!0){this.destroyed||(this.destroyed=!0,C&&this.abort?.(B??new DOMException("The operation was aborted.","AbortError")))}};let r=e.request,n=null,o=e.timingInfo;null==null&&(r.cache="no-store");let i=t?"yes":"no";r.mode;let a=null;if(r.body==null&&e.processRequestEndOfBody)queueMicrotask(()=>e.processRequestEndOfBody());else if(r.body!=null){let B=async function*(I){ot(e)||(yield I,e.processRequestBodyChunkLength?.(I.byteLength))},C=()=>{ot(e)||e.processRequestEndOfBody&&e.processRequestEndOfBody()},d=I=>{ot(e)||(I.name==="AbortError"?e.controller.abort():e.controller.terminate(I))};a=(async function*(){try{for await(let I of r.body.stream)yield*B(I);C()}catch(I){d(I)}})()}try{let{body:B,status:C,statusText:d,headersList:I,socket:u}=await E({body:a});if(u)n=Go({status:C,statusText:d,headersList:I,socket:u});else{let D=B[Symbol.asyncIterator]();e.controller.next=()=>D.next(),n=Go({status:C,statusText:d,headersList:I})}}catch(B){return B.name==="AbortError"?(e.controller.connection.destroy(),Yo(e,B)):W(B)}let g=async()=>{await e.controller.resume()},c=B=>{ot(e)||e.controller.abort(B)},l=new ReadableStream({async start(B){e.controller.controller=B},async pull(B){await g(B)},async cancel(B){await c(B)},type:"bytes"});n.body={stream:l,source:null,length:null},e.controller.onAborted=Q,e.controller.on("terminated",Q),e.controller.resume=async()=>{for(;;){let B,C;try{let{done:I,value:u}=await e.controller.next();if(iC(e))break;B=I?void 0:u}catch(I){e.controller.ended&&!o.encodedBodySize?B=void 0:(B=I,C=!0)}if(B===void 0){cF(e.controller.controller),JF(e,n);return}if(o.decodedBodySize+=B?.byteLength??0,C){e.controller.terminate(B);return}let d=new Uint8Array(B);if(d.byteLength&&e.controller.controller.enqueue(d),FF(l)){e.controller.terminate();return}if(e.controller.controller.desiredSize<=0)return}};function Q(B){iC(e)?(n.aborted=!0,xo(l)&&e.controller.controller.error(e.controller.serializedAbortReason)):xo(l)&&e.controller.controller.error(new TypeError("terminated",{cause:aF(B)?B:void 0})),e.controller.connection.destroy()}return n;function E({body:B}){let C=ie(r),d=e.controller.dispatcher;return new Promise((I,u)=>d.dispatch({path:C.pathname+C.search,origin:C.origin,method:r.method,body:d.isMockActive?r.body&&(r.body.source||r.body.stream):B,headers:r.headersList.entries,maxRedirections:0,upgrade:r.mode==="websocket"?"websocket":void 0},{body:null,abort:null,onConnect(D){let{connection:p}=e.controller;o.finalConnectionTimingInfo=EF(void 0,o.postRedirectStartTime,e.crossOriginIsolatedCapability),p.destroyed?D(new DOMException("The operation was aborted.","AbortError")):(e.controller.on("terminated",D),this.abort=p.abort=D),o.finalNetworkRequestStartTime=Pr(e.crossOriginIsolatedCapability)},onResponseStarted(){o.finalNetworkResponseStartTime=Pr(e.crossOriginIsolatedCapability)},onHeaders(D,p,F,L){if(D<200)return;let Y="",$=new sC;for(let CA=0;CA<p.length;CA+=2)$.append(gC(p[CA]),p[CA+1].toString("latin1"),!0);Y=$.get("location",!0),this.body=new pF({read:F});let sA=[],Qt=Y&&r.redirect==="follow"&&QC.has(D);if(r.method!=="HEAD"&&r.method!=="CONNECT"&&!EC.includes(D)&&!Qt){let CA=$.get("content-encoding",!0),Et=CA?CA.toLowerCase().split(","):[],Bt=5;if(Et.length>Bt)return u(new Error(`too many content-encodings in response: ${Et.length}, maximum allowed is ${Bt}`)),!0;for(let Bs=Et.length-1;Bs>=0;--Bs){let Qn=Et[Bs].trim();if(Qn==="x-gzip"||Qn==="gzip")sA.push(Ye.createGunzip({flush:Ye.constants.Z_SYNC_FLUSH,finishFlush:Ye.constants.Z_SYNC_FLUSH}));else if(Qn==="deflate")sA.push(CF({flush:Ye.constants.Z_SYNC_FLUSH,finishFlush:Ye.constants.Z_SYNC_FLUSH}));else if(Qn==="br")sA.push(Ye.createBrotliDecompress({flush:Ye.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ye.constants.BROTLI_OPERATION_FLUSH}));else{sA.length=0;break}}}let ye=this.onError.bind(this);return I({status:D,statusText:L,headersList:$,body:sA.length?DF(this.body,...sA,CA=>{CA&&this.onError(CA)}).on("error",ye):this.body.on("error",ye)}),!0},onData(D){if(e.controller.dump)return;let p=D;return o.encodedBodySize+=p.byteLength,this.body.push(p)},onComplete(){this.abort&&e.controller.off("terminated",this.abort),e.controller.onAborted&&e.controller.off("terminated",e.controller.onAborted),e.controller.ended=!0,this.body.push(null)},onError(D){this.abort&&e.controller.off("terminated",this.abort),this.body?.destroy(D),e.controller.terminate(D),u(D)},onUpgrade(D,p,F){if(D!==101)return;let L=new sC;for(let Y=0;Y<p.length;Y+=2)L.append(gC(p[Y]),p[Y+1].toString("latin1"),!0);return I({status:D,statusText:MF[D],headersList:L,socket:F}),!0}}))}}fC.exports={fetch:GF,Fetch:vo,fetching:CC,finalizeAndReportTiming:BC}});var Ig=f((zU,yC)=>{"use strict";yC.exports={kState:Symbol("FileReader state"),kResult:Symbol("FileReader result"),kError:Symbol("FileReader error"),kLastProgressEventFired:Symbol("FileReader last progress event fired timestamp"),kEvents:Symbol("FileReader events"),kAborted:Symbol("FileReader aborted")}});var pC=f((ZU,wC)=>{"use strict";var{webidl:bA}=gA(),Ho=Symbol("ProgressEvent state"),Cg=class e extends Event{constructor(A,t={}){A=bA.converters.DOMString(A,"ProgressEvent constructor","type"),t=bA.converters.ProgressEventInit(t??{}),super(A,t),this[Ho]={lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total}}get lengthComputable(){return bA.brandCheck(this,e),this[Ho].lengthComputable}get loaded(){return bA.brandCheck(this,e),this[Ho].loaded}get total(){return bA.brandCheck(this,e),this[Ho].total}};bA.converters.ProgressEventInit=bA.dictionaryConverter([{key:"lengthComputable",converter:bA.converters.boolean,defaultValue:()=>!1},{key:"loaded",converter:bA.converters["unsigned long long"],defaultValue:()=>0},{key:"total",converter:bA.converters["unsigned long long"],defaultValue:()=>0},{key:"bubbles",converter:bA.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:bA.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:bA.converters.boolean,defaultValue:()=>!1}]);wC.exports={ProgressEvent:Cg}});var mC=f((KU,DC)=>{"use strict";function HF(e){if(!e)return"failure";switch(e.trim().toLowerCase()){case"unicode-1-1-utf-8":case"unicode11utf8":case"unicode20utf8":case"utf-8":case"utf8":case"x-unicode20utf8":return"UTF-8";case"866":case"cp866":case"csibm866":case"ibm866":return"IBM866";case"csisolatin2":case"iso-8859-2":case"iso-ir-101":case"iso8859-2":case"iso88592":case"iso_8859-2":case"iso_8859-2:1987":case"l2":case"latin2":return"ISO-8859-2";case"csisolatin3":case"iso-8859-3":case"iso-ir-109":case"iso8859-3":case"iso88593":case"iso_8859-3":case"iso_8859-3:1988":case"l3":case"latin3":return"ISO-8859-3";case"csisolatin4":case"iso-8859-4":case"iso-ir-110":case"iso8859-4":case"iso88594":case"iso_8859-4":case"iso_8859-4:1988":case"l4":case"latin4":return"ISO-8859-4";case"csisolatincyrillic":case"cyrillic":case"iso-8859-5":case"iso-ir-144":case"iso8859-5":case"iso88595":case"iso_8859-5":case"iso_8859-5:1988":return"ISO-8859-5";case"arabic":case"asmo-708":case"csiso88596e":case"csiso88596i":case"csisolatinarabic":case"ecma-114":case"iso-8859-6":case"iso-8859-6-e":case"iso-8859-6-i":case"iso-ir-127":case"iso8859-6":case"iso88596":case"iso_8859-6":case"iso_8859-6:1987":return"ISO-8859-6";case"csisolatingreek":case"ecma-118":case"elot_928":case"greek":case"greek8":case"iso-8859-7":case"iso-ir-126":case"iso8859-7":case"iso88597":case"iso_8859-7":case"iso_8859-7:1987":case"sun_eu_greek":return"ISO-8859-7";case"csiso88598e":case"csisolatinhebrew":case"hebrew":case"iso-8859-8":case"iso-8859-8-e":case"iso-ir-138":case"iso8859-8":case"iso88598":case"iso_8859-8":case"iso_8859-8:1988":case"visual":return"ISO-8859-8";case"csiso88598i":case"iso-8859-8-i":case"logical":return"ISO-8859-8-I";case"csisolatin6":case"iso-8859-10":case"iso-ir-157":case"iso8859-10":case"iso885910":case"l6":case"latin6":return"ISO-8859-10";case"iso-8859-13":case"iso8859-13":case"iso885913":return"ISO-8859-13";case"iso-8859-14":case"iso8859-14":case"iso885914":return"ISO-8859-14";case"csisolatin9":case"iso-8859-15":case"iso8859-15":case"iso885915":case"iso_8859-15":case"l9":return"ISO-8859-15";case"iso-8859-16":return"ISO-8859-16";case"cskoi8r":case"koi":case"koi8":case"koi8-r":case"koi8_r":return"KOI8-R";case"koi8-ru":case"koi8-u":return"KOI8-U";case"csmacintosh":case"mac":case"macintosh":case"x-mac-roman":return"macintosh";case"iso-8859-11":case"iso8859-11":case"iso885911":case"tis-620":case"windows-874":return"windows-874";case"cp1250":case"windows-1250":case"x-cp1250":return"windows-1250";case"cp1251":case"windows-1251":case"x-cp1251":return"windows-1251";case"ansi_x3.4-1968":case"ascii":case"cp1252":case"cp819":case"csisolatin1":case"ibm819":case"iso-8859-1":case"iso-ir-100":case"iso8859-1":case"iso88591":case"iso_8859-1":case"iso_8859-1:1987":case"l1":case"latin1":case"us-ascii":case"windows-1252":case"x-cp1252":return"windows-1252";case"cp1253":case"windows-1253":case"x-cp1253":return"windows-1253";case"cp1254":case"csisolatin5":case"iso-8859-9":case"iso-ir-148":case"iso8859-9":case"iso88599":case"iso_8859-9":case"iso_8859-9:1989":case"l5":case"latin5":case"windows-1254":case"x-cp1254":return"windows-1254";case"cp1255":case"windows-1255":case"x-cp1255":return"windows-1255";case"cp1256":case"windows-1256":case"x-cp1256":return"windows-1256";case"cp1257":case"windows-1257":case"x-cp1257":return"windows-1257";case"cp1258":case"windows-1258":case"x-cp1258":return"windows-1258";case"x-mac-cyrillic":case"x-mac-ukrainian":return"x-mac-cyrillic";case"chinese":case"csgb2312":case"csiso58gb231280":case"gb2312":case"gb_2312":case"gb_2312-80":case"gbk":case"iso-ir-58":case"x-gbk":return"GBK";case"gb18030":return"gb18030";case"big5":case"big5-hkscs":case"cn-big5":case"csbig5":case"x-x-big5":return"Big5";case"cseucpkdfmtjapanese":case"euc-jp":case"x-euc-jp":return"EUC-JP";case"csiso2022jp":case"iso-2022-jp":return"ISO-2022-JP";case"csshiftjis":case"ms932":case"ms_kanji":case"shift-jis":case"shift_jis":case"sjis":case"windows-31j":case"x-sjis":return"Shift_JIS";case"cseuckr":case"csksc56011987":case"euc-kr":case"iso-ir-149":case"korean":case"ks_c_5601-1987":case"ks_c_5601-1989":case"ksc5601":case"ksc_5601":case"windows-949":return"EUC-KR";case"csiso2022kr":case"hz-gb-2312":case"iso-2022-cn":case"iso-2022-cn-ext":case"iso-2022-kr":case"replacement":return"replacement";case"unicodefffe":case"utf-16be":return"UTF-16BE";case"csunicode":case"iso-10646-ucs-2":case"ucs-2":case"unicode":case"unicodefeff":case"utf-16":case"utf-16le":return"UTF-16LE";case"x-user-defined":return"x-user-defined";default:return"failure"}}DC.exports={getEncoding:HF}});var MC=f((XU,UC)=>{"use strict";var{kState:jt,kError:ug,kResult:kC,kAborted:zr,kLastProgressEventFired:hg}=Ig(),{ProgressEvent:VF}=pC(),{getEncoding:FC}=mC(),{serializeAMimeType:qF,parseMIMEType:RC}=uA(),{types:WF}=h("node:util"),{StringDecoder:bC}=h("string_decoder"),{btoa:NC}=h("node:buffer"),OF={enumerable:!0,writable:!1,configurable:!1};function PF(e,A,t,r){if(e[jt]==="loading")throw new DOMException("Invalid state","InvalidStateError");e[jt]="loading",e[kC]=null,e[ug]=null;let o=A.stream().getReader(),s=[],i=o.read(),a=!0;(async()=>{for(;!e[zr];)try{let{done:g,value:c}=await i;if(a&&!e[zr]&&queueMicrotask(()=>{Ge("loadstart",e)}),a=!1,!g&&WF.isUint8Array(c))s.push(c),(e[hg]===void 0||Date.now()-e[hg]>=50)&&!e[zr]&&(e[hg]=Date.now(),queueMicrotask(()=>{Ge("progress",e)})),i=o.read();else if(g){queueMicrotask(()=>{e[jt]="done";try{let l=_F(s,t,A.type,r);if(e[zr])return;e[kC]=l,Ge("load",e)}catch(l){e[ug]=l,Ge("error",e)}e[jt]!=="loading"&&Ge("loadend",e)});break}}catch(g){if(e[zr])return;queueMicrotask(()=>{e[jt]="done",e[ug]=g,Ge("error",e),e[jt]!=="loading"&&Ge("loadend",e)});break}})()}function Ge(e,A){let t=new VF(e,{bubbles:!1,cancelable:!1});A.dispatchEvent(t)}function _F(e,A,t,r){switch(A){case"DataURL":{let n="data:",o=RC(t||"application/octet-stream");o!=="failure"&&(n+=qF(o)),n+=";base64,";let s=new bC("latin1");for(let i of e)n+=NC(s.write(i));return n+=NC(s.end()),n}case"Text":{let n="failure";if(r&&(n=FC(r)),n==="failure"&&t){let o=RC(t);o!=="failure"&&(n=FC(o.parameters.get("charset")))}return n==="failure"&&(n="UTF-8"),zF(e,n)}case"ArrayBuffer":return SC(e).buffer;case"BinaryString":{let n="",o=new bC("latin1");for(let s of e)n+=o.write(s);return n+=o.end(),n}}}function zF(e,A){let t=SC(e),r=ZF(t),n=0;r!==null&&(A=r,n=r==="UTF-8"?3:2);let o=t.slice(n);return new TextDecoder(A).decode(o)}function ZF(e){let[A,t,r]=e;return A===239&&t===187&&r===191?"UTF-8":A===254&&t===255?"UTF-16BE":A===255&&t===254?"UTF-16LE":null}function SC(e){let A=e.reduce((r,n)=>r+n.byteLength,0),t=0;return e.reduce((r,n)=>(r.set(n,t),t+=n.byteLength,r),new Uint8Array(A))}UC.exports={staticPropertyDescriptors:OF,readOperation:PF,fireAProgressEvent:Ge}});var GC=f((jU,YC)=>{"use strict";var{staticPropertyDescriptors:$t,readOperation:Vo,fireAProgressEvent:LC}=MC(),{kState:it,kError:TC,kResult:qo,kEvents:V,kAborted:KF}=Ig(),{webidl:O}=gA(),{kEnumerableProperty:fA}=G(),zA=class e extends EventTarget{constructor(){super(),this[it]="empty",this[qo]=null,this[TC]=null,this[V]={loadend:null,error:null,abort:null,load:null,progress:null,loadstart:null}}readAsArrayBuffer(A){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsArrayBuffer"),A=O.converters.Blob(A,{strict:!1}),Vo(this,A,"ArrayBuffer")}readAsBinaryString(A){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsBinaryString"),A=O.converters.Blob(A,{strict:!1}),Vo(this,A,"BinaryString")}readAsText(A,t=void 0){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsText"),A=O.converters.Blob(A,{strict:!1}),t!==void 0&&(t=O.converters.DOMString(t,"FileReader.readAsText","encoding")),Vo(this,A,"Text",t)}readAsDataURL(A){O.brandCheck(this,e),O.argumentLengthCheck(arguments,1,"FileReader.readAsDataURL"),A=O.converters.Blob(A,{strict:!1}),Vo(this,A,"DataURL")}abort(){if(this[it]==="empty"||this[it]==="done"){this[qo]=null;return}this[it]==="loading"&&(this[it]="done",this[qo]=null),this[KF]=!0,LC("abort",this),this[it]!=="loading"&&LC("loadend",this)}get readyState(){switch(O.brandCheck(this,e),this[it]){case"empty":return this.EMPTY;case"loading":return this.LOADING;case"done":return this.DONE}}get result(){return O.brandCheck(this,e),this[qo]}get error(){return O.brandCheck(this,e),this[TC]}get onloadend(){return O.brandCheck(this,e),this[V].loadend}set onloadend(A){O.brandCheck(this,e),this[V].loadend&&this.removeEventListener("loadend",this[V].loadend),typeof A=="function"?(this[V].loadend=A,this.addEventListener("loadend",A)):this[V].loadend=null}get onerror(){return O.brandCheck(this,e),this[V].error}set onerror(A){O.brandCheck(this,e),this[V].error&&this.removeEventListener("error",this[V].error),typeof A=="function"?(this[V].error=A,this.addEventListener("error",A)):this[V].error=null}get onloadstart(){return O.brandCheck(this,e),this[V].loadstart}set onloadstart(A){O.brandCheck(this,e),this[V].loadstart&&this.removeEventListener("loadstart",this[V].loadstart),typeof A=="function"?(this[V].loadstart=A,this.addEventListener("loadstart",A)):this[V].loadstart=null}get onprogress(){return O.brandCheck(this,e),this[V].progress}set onprogress(A){O.brandCheck(this,e),this[V].progress&&this.removeEventListener("progress",this[V].progress),typeof A=="function"?(this[V].progress=A,this.addEventListener("progress",A)):this[V].progress=null}get onload(){return O.brandCheck(this,e),this[V].load}set onload(A){O.brandCheck(this,e),this[V].load&&this.removeEventListener("load",this[V].load),typeof A=="function"?(this[V].load=A,this.addEventListener("load",A)):this[V].load=null}get onabort(){return O.brandCheck(this,e),this[V].abort}set onabort(A){O.brandCheck(this,e),this[V].abort&&this.removeEventListener("abort",this[V].abort),typeof A=="function"?(this[V].abort=A,this.addEventListener("abort",A)):this[V].abort=null}};zA.EMPTY=zA.prototype.EMPTY=0;zA.LOADING=zA.prototype.LOADING=1;zA.DONE=zA.prototype.DONE=2;Object.defineProperties(zA.prototype,{EMPTY:$t,LOADING:$t,DONE:$t,readAsArrayBuffer:fA,readAsBinaryString:fA,readAsText:fA,readAsDataURL:fA,abort:fA,readyState:fA,result:fA,error:fA,onloadstart:fA,onprogress:fA,onload:fA,onabort:fA,onerror:fA,onloadend:fA,[Symbol.toStringTag]:{value:"FileReader",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(zA,{EMPTY:$t,LOADING:$t,DONE:$t});YC.exports={FileReader:zA}});var Wo=f(($U,JC)=>{"use strict";JC.exports={kConstruct:Z().kConstruct}});var HC=f((AM,vC)=>{"use strict";var XF=h("node:assert"),{URLSerializer:xC}=uA(),{isValidHeaderName:jF}=pA();function $F(e,A,t=!1){let r=xC(e,t),n=xC(A,t);return r===n}function AR(e){XF(e!==null);let A=[];for(let t of e.split(","))t=t.trim(),jF(t)&&A.push(t);return A}vC.exports={urlEquals:$F,getFieldValues:AR}});var WC=f((eM,qC)=>{"use strict";var{kConstruct:eR}=Wo(),{urlEquals:tR,getFieldValues:dg}=HC(),{kEnumerableProperty:at,isDisturbed:rR}=G(),{webidl:k}=gA(),{Response:nR,cloneResponse:oR,fromInnerResponse:sR}=Or(),{Request:he,fromInnerRequest:iR}=Xt(),{kState:ZA}=pe(),{fetching:aR}=_r(),{urlIsHttpHttpsScheme:Oo,createDeferredPromise:Ar,readAllBytes:gR}=pA(),fg=h("node:assert"),Po=class e{#A;constructor(){arguments[0]!==eR&&k.illegalConstructor(),k.util.markAsUncloneable(this),this.#A=arguments[1]}async match(A,t={}){k.brandCheck(this,e);let r="Cache.match";k.argumentLengthCheck(arguments,1,r),A=k.converters.RequestInfo(A,r,"request"),t=k.converters.CacheQueryOptions(t,r,"options");let n=this.#n(A,t,1);if(n.length!==0)return n[0]}async matchAll(A=void 0,t={}){k.brandCheck(this,e);let r="Cache.matchAll";return A!==void 0&&(A=k.converters.RequestInfo(A,r,"request")),t=k.converters.CacheQueryOptions(t,r,"options"),this.#n(A,t)}async add(A){k.brandCheck(this,e);let t="Cache.add";k.argumentLengthCheck(arguments,1,t),A=k.converters.RequestInfo(A,t,"request");let r=[A];return await this.addAll(r)}async addAll(A){k.brandCheck(this,e);let t="Cache.addAll";k.argumentLengthCheck(arguments,1,t);let r=[],n=[];for(let Q of A){if(Q===void 0)throw k.errors.conversionFailed({prefix:t,argument:"Argument 1",types:["undefined is not allowed"]});if(Q=k.converters.RequestInfo(Q),typeof Q=="string")continue;let E=Q[ZA];if(!Oo(E.url)||E.method!=="GET")throw k.errors.exception({header:t,message:"Expected http/s scheme when method is not GET."})}let o=[];for(let Q of A){let E=new he(Q)[ZA];if(!Oo(E.url))throw k.errors.exception({header:t,message:"Expected http/s scheme."});E.initiator="fetch",E.destination="subresource",n.push(E);let B=Ar();o.push(aR({request:E,processResponse(C){if(C.type==="error"||C.status===206||C.status<200||C.status>299)B.reject(k.errors.exception({header:"Cache.addAll",message:"Received an invalid status code or the request failed."}));else if(C.headersList.contains("vary")){let d=dg(C.headersList.get("vary"));for(let I of d)if(I==="*"){B.reject(k.errors.exception({header:"Cache.addAll",message:"invalid vary field value"}));for(let u of o)u.abort();return}}},processResponseEndOfBody(C){if(C.aborted){B.reject(new DOMException("aborted","AbortError"));return}B.resolve(C)}})),r.push(B.promise)}let i=await Promise.all(r),a=[],g=0;for(let Q of i){let E={type:"put",request:n[g],response:Q};a.push(E),g++}let c=Ar(),l=null;try{this.#e(a)}catch(Q){l=Q}return queueMicrotask(()=>{l===null?c.resolve(void 0):c.reject(l)}),c.promise}async put(A,t){k.brandCheck(this,e);let r="Cache.put";k.argumentLengthCheck(arguments,2,r),A=k.converters.RequestInfo(A,r,"request"),t=k.converters.Response(t,r,"response");let n=null;if(A instanceof he?n=A[ZA]:n=new he(A)[ZA],!Oo(n.url)||n.method!=="GET")throw k.errors.exception({header:r,message:"Expected an http/s scheme when method is not GET"});let o=t[ZA];if(o.status===206)throw k.errors.exception({header:r,message:"Got 206 status"});if(o.headersList.contains("vary")){let E=dg(o.headersList.get("vary"));for(let B of E)if(B==="*")throw k.errors.exception({header:r,message:"Got * vary field value"})}if(o.body&&(rR(o.body.stream)||o.body.stream.locked))throw k.errors.exception({header:r,message:"Response body is locked or disturbed"});let s=oR(o),i=Ar();if(o.body!=null){let B=o.body.stream.getReader();gR(B).then(i.resolve,i.reject)}else i.resolve(void 0);let a=[],g={type:"put",request:n,response:s};a.push(g);let c=await i.promise;s.body!=null&&(s.body.source=c);let l=Ar(),Q=null;try{this.#e(a)}catch(E){Q=E}return queueMicrotask(()=>{Q===null?l.resolve():l.reject(Q)}),l.promise}async delete(A,t={}){k.brandCheck(this,e);let r="Cache.delete";k.argumentLengthCheck(arguments,1,r),A=k.converters.RequestInfo(A,r,"request"),t=k.converters.CacheQueryOptions(t,r,"options");let n=null;if(A instanceof he){if(n=A[ZA],n.method!=="GET"&&!t.ignoreMethod)return!1}else fg(typeof A=="string"),n=new he(A)[ZA];let o=[],s={type:"delete",request:n,options:t};o.push(s);let i=Ar(),a=null,g;try{g=this.#e(o)}catch(c){a=c}return queueMicrotask(()=>{a===null?i.resolve(!!g?.length):i.reject(a)}),i.promise}async keys(A=void 0,t={}){k.brandCheck(this,e);let r="Cache.keys";A!==void 0&&(A=k.converters.RequestInfo(A,r,"request")),t=k.converters.CacheQueryOptions(t,r,"options");let n=null;if(A!==void 0)if(A instanceof he){if(n=A[ZA],n.method!=="GET"&&!t.ignoreMethod)return[]}else typeof A=="string"&&(n=new he(A)[ZA]);let o=Ar(),s=[];if(A===void 0)for(let i of this.#A)s.push(i[0]);else{let i=this.#t(n,t);for(let a of i)s.push(a[0])}return queueMicrotask(()=>{let i=[];for(let a of s){let g=iR(a,new AbortController().signal,"immutable");i.push(g)}o.resolve(Object.freeze(i))}),o.promise}#e(A){let t=this.#A,r=[...t],n=[],o=[];try{for(let s of A){if(s.type!=="delete"&&s.type!=="put")throw k.errors.exception({header:"Cache.#batchCacheOperations",message:'operation type does not match "delete" or "put"'});if(s.type==="delete"&&s.response!=null)throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"delete operation should not have an associated response"});if(this.#t(s.request,s.options,n).length)throw new DOMException("???","InvalidStateError");let i;if(s.type==="delete"){if(i=this.#t(s.request,s.options),i.length===0)return[];for(let a of i){let g=t.indexOf(a);fg(g!==-1),t.splice(g,1)}}else if(s.type==="put"){if(s.response==null)throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"put operation should have an associated response"});let a=s.request;if(!Oo(a.url))throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"expected http or https scheme"});if(a.method!=="GET")throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"not get method"});if(s.options!=null)throw k.errors.exception({header:"Cache.#batchCacheOperations",message:"options must not be defined"});i=this.#t(s.request);for(let g of i){let c=t.indexOf(g);fg(c!==-1),t.splice(c,1)}t.push([s.request,s.response]),n.push([s.request,s.response])}o.push([s.request,s.response])}return o}catch(s){throw this.#A.length=0,this.#A=r,s}}#t(A,t,r){let n=[],o=r??this.#A;for(let s of o){let[i,a]=s;this.#o(A,i,a,t)&&n.push(s)}return n}#o(A,t,r=null,n){let o=new URL(A.url),s=new URL(t.url);if(n?.ignoreSearch&&(s.search="",o.search=""),!tR(o,s,!0))return!1;if(r==null||n?.ignoreVary||!r.headersList.contains("vary"))return!0;let i=dg(r.headersList.get("vary"));for(let a of i){if(a==="*")return!1;let g=t.headersList.get(a),c=A.headersList.get(a);if(g!==c)return!1}return!0}#n(A,t,r=1/0){let n=null;if(A!==void 0)if(A instanceof he){if(n=A[ZA],n.method!=="GET"&&!t.ignoreMethod)return[]}else typeof A=="string"&&(n=new he(A)[ZA]);let o=[];if(A===void 0)for(let i of this.#A)o.push(i[1]);else{let i=this.#t(n,t);for(let a of i)o.push(a[1])}let s=[];for(let i of o){let a=sR(i,"immutable");if(s.push(a.clone()),s.length>=r)break}return Object.freeze(s)}};Object.defineProperties(Po.prototype,{[Symbol.toStringTag]:{value:"Cache",configurable:!0},match:at,matchAll:at,add:at,addAll:at,put:at,delete:at,keys:at});var VC=[{key:"ignoreSearch",converter:k.converters.boolean,defaultValue:()=>!1},{key:"ignoreMethod",converter:k.converters.boolean,defaultValue:()=>!1},{key:"ignoreVary",converter:k.converters.boolean,defaultValue:()=>!1}];k.converters.CacheQueryOptions=k.dictionaryConverter(VC);k.converters.MultiCacheQueryOptions=k.dictionaryConverter([...VC,{key:"cacheName",converter:k.converters.DOMString}]);k.converters.Response=k.interfaceConverter(nR);k.converters["sequence<RequestInfo>"]=k.sequenceConverter(k.converters.RequestInfo);qC.exports={Cache:Po}});var PC=f((tM,OC)=>{"use strict";var{kConstruct:Zr}=Wo(),{Cache:_o}=WC(),{webidl:QA}=gA(),{kEnumerableProperty:Kr}=G(),zo=class e{#A=new Map;constructor(){arguments[0]!==Zr&&QA.illegalConstructor(),QA.util.markAsUncloneable(this)}async match(A,t={}){if(QA.brandCheck(this,e),QA.argumentLengthCheck(arguments,1,"CacheStorage.match"),A=QA.converters.RequestInfo(A),t=QA.converters.MultiCacheQueryOptions(t),t.cacheName!=null){if(this.#A.has(t.cacheName)){let r=this.#A.get(t.cacheName);return await new _o(Zr,r).match(A,t)}}else for(let r of this.#A.values()){let o=await new _o(Zr,r).match(A,t);if(o!==void 0)return o}}async has(A){QA.brandCheck(this,e);let t="CacheStorage.has";return QA.argumentLengthCheck(arguments,1,t),A=QA.converters.DOMString(A,t,"cacheName"),this.#A.has(A)}async open(A){QA.brandCheck(this,e);let t="CacheStorage.open";if(QA.argumentLengthCheck(arguments,1,t),A=QA.converters.DOMString(A,t,"cacheName"),this.#A.has(A)){let n=this.#A.get(A);return new _o(Zr,n)}let r=[];return this.#A.set(A,r),new _o(Zr,r)}async delete(A){QA.brandCheck(this,e);let t="CacheStorage.delete";return QA.argumentLengthCheck(arguments,1,t),A=QA.converters.DOMString(A,t,"cacheName"),this.#A.delete(A)}async keys(){return QA.brandCheck(this,e),[...this.#A.keys()]}};Object.defineProperties(zo.prototype,{[Symbol.toStringTag]:{value:"CacheStorage",configurable:!0},match:Kr,has:Kr,open:Kr,delete:Kr,keys:Kr});OC.exports={CacheStorage:zo}});var zC=f((rM,_C)=>{"use strict";_C.exports={maxAttributeValueSize:1024,maxNameValuePairSize:4096}});var yg=f((nM,$C)=>{"use strict";function cR(e){for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t>=0&&t<=8||t>=10&&t<=31||t===127)return!0}return!1}function ZC(e){for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t<33||t>126||t===34||t===40||t===41||t===60||t===62||t===64||t===44||t===59||t===58||t===92||t===47||t===91||t===93||t===63||t===61||t===123||t===125)throw new Error("Invalid cookie name")}}function KC(e){let A=e.length,t=0;if(e[0]==='"'){if(A===1||e[A-1]!=='"')throw new Error("Invalid cookie value");--A,++t}for(;t<A;){let r=e.charCodeAt(t++);if(r<33||r>126||r===34||r===44||r===59||r===92)throw new Error("Invalid cookie value")}}function XC(e){for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t<32||t===127||t===59)throw new Error("Invalid cookie path")}}function lR(e){if(e.startsWith("-")||e.endsWith(".")||e.endsWith("-"))throw new Error("Invalid cookie domain")}var QR=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ER=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Zo=Array(61).fill(0).map((e,A)=>A.toString().padStart(2,"0"));function jC(e){return typeof e=="number"&&(e=new Date(e)),`${QR[e.getUTCDay()]}, ${Zo[e.getUTCDate()]} ${ER[e.getUTCMonth()]} ${e.getUTCFullYear()} ${Zo[e.getUTCHours()]}:${Zo[e.getUTCMinutes()]}:${Zo[e.getUTCSeconds()]} GMT`}function BR(e){if(e<0)throw new Error("Invalid cookie max-age")}function IR(e){if(e.name.length===0)return null;ZC(e.name),KC(e.value);let A=[`${e.name}=${e.value}`];e.name.startsWith("__Secure-")&&(e.secure=!0),e.name.startsWith("__Host-")&&(e.secure=!0,e.domain=null,e.path="/"),e.secure&&A.push("Secure"),e.httpOnly&&A.push("HttpOnly"),typeof e.maxAge=="number"&&(BR(e.maxAge),A.push(`Max-Age=${e.maxAge}`)),e.domain&&(lR(e.domain),A.push(`Domain=${e.domain}`)),e.path&&(XC(e.path),A.push(`Path=${e.path}`)),e.expires&&e.expires.toString()!=="Invalid Date"&&A.push(`Expires=${jC(e.expires)}`),e.sameSite&&A.push(`SameSite=${e.sameSite}`);for(let t of e.unparsed){if(!t.includes("="))throw new Error("Invalid unparsed");let[r,...n]=t.split("=");A.push(`${r.trim()}=${n.join("=")}`)}return A.join("; ")}$C.exports={isCTLExcludingHtab:cR,validateCookieName:ZC,validateCookiePath:XC,validateCookieValue:KC,toIMFDate:jC,stringify:IR}});var eu=f((oM,Au)=>{"use strict";var{maxNameValuePairSize:CR,maxAttributeValueSize:uR}=zC(),{isCTLExcludingHtab:hR}=yg(),{collectASequenceOfCodePointsFast:Ko}=uA(),dR=h("node:assert");function fR(e){if(hR(e))return null;let A="",t="",r="",n="";if(e.includes(";")){let o={position:0};A=Ko(";",e,o),t=e.slice(o.position)}else A=e;if(!A.includes("="))n=A;else{let o={position:0};r=Ko("=",A,o),n=A.slice(o.position+1)}return r=r.trim(),n=n.trim(),r.length+n.length>CR?null:{name:r,value:n,...er(t)}}function er(e,A={}){if(e.length===0)return A;dR(e[0]===";"),e=e.slice(1);let t="";e.includes(";")?(t=Ko(";",e,{position:0}),e=e.slice(t.length)):(t=e,e="");let r="",n="";if(t.includes("=")){let s={position:0};r=Ko("=",t,s),n=t.slice(s.position+1)}else r=t;if(r=r.trim(),n=n.trim(),n.length>uR)return er(e,A);let o=r.toLowerCase();if(o==="expires"){let s=new Date(n);A.expires=s}else if(o==="max-age"){let s=n.charCodeAt(0);if((s<48||s>57)&&n[0]!=="-"||!/^\d+$/.test(n))return er(e,A);let i=Number(n);A.maxAge=i}else if(o==="domain"){let s=n;s[0]==="."&&(s=s.slice(1)),s=s.toLowerCase(),A.domain=s}else if(o==="path"){let s="";n.length===0||n[0]!=="/"?s="/":s=n,A.path=s}else if(o==="secure")A.secure=!0;else if(o==="httponly")A.httpOnly=!0;else if(o==="samesite"){let s="Default",i=n.toLowerCase();i.includes("none")&&(s="None"),i.includes("strict")&&(s="Strict"),i.includes("lax")&&(s="Lax"),A.sameSite=s}else A.unparsed??=[],A.unparsed.push(`${r}=${n}`);return er(e,A)}Au.exports={parseSetCookie:fR,parseUnparsedAttributes:er}});var nu=f((sM,ru)=>{"use strict";var{parseSetCookie:yR}=eu(),{stringify:wR}=yg(),{webidl:x}=gA(),{Headers:Xo}=rt();function pR(e){x.argumentLengthCheck(arguments,1,"getCookies"),x.brandCheck(e,Xo,{strict:!1});let A=e.get("cookie"),t={};if(!A)return t;for(let r of A.split(";")){let[n,...o]=r.split("=");t[n.trim()]=o.join("=")}return t}function DR(e,A,t){x.brandCheck(e,Xo,{strict:!1});let r="deleteCookie";x.argumentLengthCheck(arguments,2,r),A=x.converters.DOMString(A,r,"name"),t=x.converters.DeleteCookieAttributes(t),tu(e,{name:A,value:"",expires:new Date(0),...t})}function mR(e){x.argumentLengthCheck(arguments,1,"getSetCookies"),x.brandCheck(e,Xo,{strict:!1});let A=e.getSetCookie();return A?A.map(t=>yR(t)):[]}function tu(e,A){x.argumentLengthCheck(arguments,2,"setCookie"),x.brandCheck(e,Xo,{strict:!1}),A=x.converters.Cookie(A);let t=wR(A);t&&e.append("Set-Cookie",t)}x.converters.DeleteCookieAttributes=x.dictionaryConverter([{converter:x.nullableConverter(x.converters.DOMString),key:"path",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.DOMString),key:"domain",defaultValue:()=>null}]);x.converters.Cookie=x.dictionaryConverter([{converter:x.converters.DOMString,key:"name"},{converter:x.converters.DOMString,key:"value"},{converter:x.nullableConverter(e=>typeof e=="number"?x.converters["unsigned long long"](e):new Date(e)),key:"expires",defaultValue:()=>null},{converter:x.nullableConverter(x.converters["long long"]),key:"maxAge",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.DOMString),key:"domain",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.DOMString),key:"path",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.boolean),key:"secure",defaultValue:()=>null},{converter:x.nullableConverter(x.converters.boolean),key:"httpOnly",defaultValue:()=>null},{converter:x.converters.USVString,key:"sameSite",allowedValues:["Strict","Lax","None"]},{converter:x.sequenceConverter(x.converters.DOMString),key:"unparsed",defaultValue:()=>new Array(0)}]);ru.exports={getCookies:pR,deleteCookie:DR,getSetCookies:mR,setCookie:tu}});var rr=f((iM,su)=>{"use strict";var{webidl:m}=gA(),{kEnumerableProperty:yA}=G(),{kConstruct:ou}=Z(),{MessagePort:kR}=h("node:worker_threads"),tr=class e extends Event{#A;constructor(A,t={}){if(A===ou){super(arguments[1],arguments[2]),m.util.markAsUncloneable(this);return}let r="MessageEvent constructor";m.argumentLengthCheck(arguments,1,r),A=m.converters.DOMString(A,r,"type"),t=m.converters.MessageEventInit(t,r,"eventInitDict"),super(A,t),this.#A=t,m.util.markAsUncloneable(this)}get data(){return m.brandCheck(this,e),this.#A.data}get origin(){return m.brandCheck(this,e),this.#A.origin}get lastEventId(){return m.brandCheck(this,e),this.#A.lastEventId}get source(){return m.brandCheck(this,e),this.#A.source}get ports(){return m.brandCheck(this,e),Object.isFrozen(this.#A.ports)||Object.freeze(this.#A.ports),this.#A.ports}initMessageEvent(A,t=!1,r=!1,n=null,o="",s="",i=null,a=[]){return m.brandCheck(this,e),m.argumentLengthCheck(arguments,1,"MessageEvent.initMessageEvent"),new e(A,{bubbles:t,cancelable:r,data:n,origin:o,lastEventId:s,source:i,ports:a})}static createFastMessageEvent(A,t){let r=new e(ou,A,t);return r.#A=t,r.#A.data??=null,r.#A.origin??="",r.#A.lastEventId??="",r.#A.source??=null,r.#A.ports??=[],r}},{createFastMessageEvent:FR}=tr;delete tr.createFastMessageEvent;var jo=class e extends Event{#A;constructor(A,t={}){let r="CloseEvent constructor";m.argumentLengthCheck(arguments,1,r),A=m.converters.DOMString(A,r,"type"),t=m.converters.CloseEventInit(t),super(A,t),this.#A=t,m.util.markAsUncloneable(this)}get wasClean(){return m.brandCheck(this,e),this.#A.wasClean}get code(){return m.brandCheck(this,e),this.#A.code}get reason(){return m.brandCheck(this,e),this.#A.reason}},$o=class e extends Event{#A;constructor(A,t){let r="ErrorEvent constructor";m.argumentLengthCheck(arguments,1,r),super(A,t),m.util.markAsUncloneable(this),A=m.converters.DOMString(A,r,"type"),t=m.converters.ErrorEventInit(t??{}),this.#A=t}get message(){return m.brandCheck(this,e),this.#A.message}get filename(){return m.brandCheck(this,e),this.#A.filename}get lineno(){return m.brandCheck(this,e),this.#A.lineno}get colno(){return m.brandCheck(this,e),this.#A.colno}get error(){return m.brandCheck(this,e),this.#A.error}};Object.defineProperties(tr.prototype,{[Symbol.toStringTag]:{value:"MessageEvent",configurable:!0},data:yA,origin:yA,lastEventId:yA,source:yA,ports:yA,initMessageEvent:yA});Object.defineProperties(jo.prototype,{[Symbol.toStringTag]:{value:"CloseEvent",configurable:!0},reason:yA,code:yA,wasClean:yA});Object.defineProperties($o.prototype,{[Symbol.toStringTag]:{value:"ErrorEvent",configurable:!0},message:yA,filename:yA,lineno:yA,colno:yA,error:yA});m.converters.MessagePort=m.interfaceConverter(kR);m.converters["sequence<MessagePort>"]=m.sequenceConverter(m.converters.MessagePort);var wg=[{key:"bubbles",converter:m.converters.boolean,defaultValue:()=>!1},{key:"cancelable",converter:m.converters.boolean,defaultValue:()=>!1},{key:"composed",converter:m.converters.boolean,defaultValue:()=>!1}];m.converters.MessageEventInit=m.dictionaryConverter([...wg,{key:"data",converter:m.converters.any,defaultValue:()=>null},{key:"origin",converter:m.converters.USVString,defaultValue:()=>""},{key:"lastEventId",converter:m.converters.DOMString,defaultValue:()=>""},{key:"source",converter:m.nullableConverter(m.converters.MessagePort),defaultValue:()=>null},{key:"ports",converter:m.converters["sequence<MessagePort>"],defaultValue:()=>new Array(0)}]);m.converters.CloseEventInit=m.dictionaryConverter([...wg,{key:"wasClean",converter:m.converters.boolean,defaultValue:()=>!1},{key:"code",converter:m.converters["unsigned short"],defaultValue:()=>0},{key:"reason",converter:m.converters.USVString,defaultValue:()=>""}]);m.converters.ErrorEventInit=m.dictionaryConverter([...wg,{key:"message",converter:m.converters.DOMString,defaultValue:()=>""},{key:"filename",converter:m.converters.USVString,defaultValue:()=>""},{key:"lineno",converter:m.converters["unsigned long"],defaultValue:()=>0},{key:"colno",converter:m.converters["unsigned long"],defaultValue:()=>0},{key:"error",converter:m.converters.any}]);su.exports={MessageEvent:tr,CloseEvent:jo,ErrorEvent:$o,createFastMessageEvent:FR}});var gt=f((aM,iu)=>{"use strict";var RR="258EAFA5-E914-47DA-95CA-C5AB0DC85B11",bR={enumerable:!0,writable:!1,configurable:!1},NR={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3},SR={NOT_SENT:0,PROCESSING:1,SENT:2},UR={CONTINUATION:0,TEXT:1,BINARY:2,CLOSE:8,PING:9,PONG:10},MR=2**16-1,LR={INFO:0,PAYLOADLENGTH_16:2,PAYLOADLENGTH_64:3,READ_DATA:4},TR=Buffer.allocUnsafe(0),YR={string:1,typedArray:2,arrayBuffer:3,blob:4};iu.exports={uid:RR,sentCloseFrameState:SR,staticPropertyDescriptors:bR,states:NR,opcodes:UR,maxUnsigned16Bit:MR,parserStates:LR,emptyBuffer:TR,sendHints:YR}});var Xr=f((gM,au)=>{"use strict";au.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}});var An=f((cM,uu)=>{"use strict";var{kReadyState:jr,kController:GR,kResponse:JR,kBinaryType:xR,kWebSocketURL:vR}=Xr(),{states:$r,opcodes:Je}=gt(),{ErrorEvent:HR,createFastMessageEvent:VR}=rr(),{isUtf8:qR}=h("node:buffer"),{collectASequenceOfCodePointsFast:WR,removeHTTPWhitespace:gu}=uA();function OR(e){return e[jr]===$r.CONNECTING}function PR(e){return e[jr]===$r.OPEN}function _R(e){return e[jr]===$r.CLOSING}function zR(e){return e[jr]===$r.CLOSED}function pg(e,A,t=(n,o)=>new Event(n,o),r={}){let n=t(e,r);A.dispatchEvent(n)}function ZR(e,A,t){if(e[jr]!==$r.OPEN)return;let r;if(A===Je.TEXT)try{r=Cu(t)}catch{lu(e,"Received invalid UTF-8 in text frame.");return}else A===Je.BINARY&&(e[xR]==="blob"?r=new Blob([t]):r=KR(t));pg("message",e,VR,{origin:e[vR].origin,data:r})}function KR(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function XR(e){if(e.length===0)return!1;for(let A=0;A<e.length;++A){let t=e.charCodeAt(A);if(t<33||t>126||t===34||t===40||t===41||t===44||t===47||t===58||t===59||t===60||t===61||t===62||t===63||t===64||t===91||t===92||t===93||t===123||t===125)return!1}return!0}function jR(e){return e>=1e3&&e<1015?e!==1004&&e!==1005&&e!==1006:e>=3e3&&e<=4999}function lu(e,A){let{[GR]:t,[JR]:r}=e;t.abort(),r?.socket&&!r.socket.destroyed&&r.socket.destroy(),A&&pg("error",e,(n,o)=>new HR(n,o),{error:new Error(A),message:A})}function Qu(e){return e===Je.CLOSE||e===Je.PING||e===Je.PONG}function Eu(e){return e===Je.CONTINUATION}function Bu(e){return e===Je.TEXT||e===Je.BINARY}function $R(e){return Bu(e)||Eu(e)||Qu(e)}function Ab(e){let A={position:0},t=new Map;for(;A.position<e.length;){let r=WR(";",e,A),[n,o=""]=r.split("=");t.set(gu(n,!0,!1),gu(o,!1,!0)),A.position++}return t}function eb(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<48||r>57)return!1}let A=Number.parseInt(e,10);return A>=8&&A<=15}var Iu=typeof process.versions.icu=="string",cu=Iu?new TextDecoder("utf-8",{fatal:!0}):void 0,Cu=Iu?cu.decode.bind(cu):function(e){if(qR(e))return e.toString("utf-8");throw new TypeError("Invalid utf-8 received.")};uu.exports={isConnecting:OR,isEstablished:PR,isClosing:_R,isClosed:zR,fireEvent:pg,isValidSubprotocol:XR,isValidStatusCode:jR,failWebsocketConnection:lu,websocketMessageReceived:ZR,utf8Decode:Cu,isControlFrame:Qu,isContinuationFrame:Eu,isTextBinaryFrame:Bu,isValidOpcode:$R,parseExtensions:Ab,isValidClientWindowBits:eb}});var es=f((lM,hu)=>{"use strict";var{maxUnsigned16Bit:tb}=gt(),As=16386,Dg,en=null,nr=As;try{Dg=h("node:crypto")}catch{Dg={randomFillSync:function(A,t,r){for(let n=0;n<A.length;++n)A[n]=Math.random()*255|0;return A}}}function rb(){return nr===As&&(nr=0,Dg.randomFillSync(en??=Buffer.allocUnsafe(As),0,As)),[en[nr++],en[nr++],en[nr++],en[nr++]]}var mg=class{constructor(A){this.frameData=A}createFrame(A){let t=this.frameData,r=rb(),n=t?.byteLength??0,o=n,s=6;n>tb?(s+=8,o=127):n>125&&(s+=2,o=126);let i=Buffer.allocUnsafe(n+s);i[0]=i[1]=0,i[0]|=128,i[0]=(i[0]&240)+A;i[s-4]=r[0],i[s-3]=r[1],i[s-2]=r[2],i[s-1]=r[3],i[1]=o,o===126?i.writeUInt16BE(n,2):o===127&&(i[2]=i[3]=0,i.writeUIntBE(n,4,6)),i[1]|=128;for(let a=0;a<n;++a)i[s+a]=t[a]^r[a&3];return i}};hu.exports={WebsocketFrameSend:mg}});var Fg=f((QM,mu)=>{"use strict";var{uid:nb,states:tn,sentCloseFrameState:ts,emptyBuffer:ob,opcodes:sb}=gt(),{kReadyState:rn,kSentClose:rs,kByteParser:fu,kReceivedClose:du,kResponse:yu}=Xr(),{fireEvent:ib,failWebsocketConnection:xe,isClosing:ab,isClosed:gb,isEstablished:cb,parseExtensions:lb}=An(),{channels:or}=Ct(),{CloseEvent:Qb}=rr(),{makeRequest:Eb}=Xt(),{fetching:Bb}=_r(),{Headers:Ib,getHeadersList:Cb}=rt(),{getDecodeSplit:ub}=pA(),{WebsocketFrameSend:hb}=es(),kg;try{kg=h("node:crypto")}catch{}function db(e,A,t,r,n,o){let s=e;s.protocol=e.protocol==="ws:"?"http:":"https:";let i=Eb({urlList:[s],client:t,serviceWorkers:"none",referrer:"no-referrer",mode:"websocket",credentials:"include",cache:"no-store",redirect:"error"});if(o.headers){let l=Cb(new Ib(o.headers));i.headersList=l}let a=kg.randomBytes(16).toString("base64");i.headersList.append("sec-websocket-key",a),i.headersList.append("sec-websocket-version","13");for(let l of A)i.headersList.append("sec-websocket-protocol",l);return i.headersList.append("sec-websocket-extensions","permessage-deflate; client_max_window_bits"),Bb({request:i,useParallelQueue:!0,dispatcher:o.dispatcher,processResponse(l){if(l.type==="error"||l.status!==101){xe(r,"Received network error or non-101 status code.");return}if(A.length!==0&&!l.headersList.get("Sec-WebSocket-Protocol")){xe(r,"Server did not respond with sent protocols.");return}if(l.headersList.get("Upgrade")?.toLowerCase()!=="websocket"){xe(r,'Server did not set Upgrade header to "websocket".');return}if(l.headersList.get("Connection")?.toLowerCase()!=="upgrade"){xe(r,'Server did not set Connection header to "upgrade".');return}let Q=l.headersList.get("Sec-WebSocket-Accept"),E=kg.createHash("sha1").update(a+nb).digest("base64");if(Q!==E){xe(r,"Incorrect hash received in Sec-WebSocket-Accept header.");return}let B=l.headersList.get("Sec-WebSocket-Extensions"),C;if(B!==null&&(C=lb(B),!C.has("permessage-deflate"))){xe(r,"Sec-WebSocket-Extensions header does not match.");return}let d=l.headersList.get("Sec-WebSocket-Protocol");if(d!==null&&!ub("sec-websocket-protocol",i.headersList).includes(d)){xe(r,"Protocol was not set in the opening handshake.");return}l.socket.on("data",wu),l.socket.on("close",pu),l.socket.on("error",Du),or.open.hasSubscribers&&or.open.publish({address:l.socket.address(),protocol:d,extensions:B}),n(l,C)}})}function fb(e,A,t,r){if(!(ab(e)||gb(e)))if(!cb(e))xe(e,"Connection was closed before it was established."),e[rn]=tn.CLOSING;else if(e[rs]===ts.NOT_SENT){e[rs]=ts.PROCESSING;let n=new hb;A!==void 0&&t===void 0?(n.frameData=Buffer.allocUnsafe(2),n.frameData.writeUInt16BE(A,0)):A!==void 0&&t!==void 0?(n.frameData=Buffer.allocUnsafe(2+r),n.frameData.writeUInt16BE(A,0),n.frameData.write(t,2,"utf-8")):n.frameData=ob,e[yu].socket.write(n.createFrame(sb.CLOSE)),e[rs]=ts.SENT,e[rn]=tn.CLOSING}else e[rn]=tn.CLOSING}function wu(e){this.ws[fu].write(e)||this.pause()}function pu(){let{ws:e}=this,{[yu]:A}=e;A.socket.off("data",wu),A.socket.off("close",pu),A.socket.off("error",Du);let t=e[rs]===ts.SENT&&e[du],r=1005,n="",o=e[fu].closingInfo;o&&!o.error?(r=o.code??1005,n=o.reason):e[du]||(r=1006),e[rn]=tn.CLOSED,ib("close",e,(s,i)=>new Qb(s,i),{wasClean:t,code:r,reason:n}),or.close.hasSubscribers&&or.close.publish({websocket:e,code:r,reason:n})}function Du(e){let{ws:A}=this;A[rn]=tn.CLOSING,or.socketError.hasSubscribers&&or.socketError.publish(e),this.destroy()}mu.exports={establishWebSocketConnection:db,closeWebSocketConnection:fb}});var Fu=f((EM,ku)=>{"use strict";var{createInflateRaw:yb,Z_DEFAULT_WINDOWBITS:wb}=h("node:zlib"),{isValidClientWindowBits:pb}=An(),{MessageSizeExceededError:Db}=H(),mb=Buffer.from([0,0,255,255]),ns=Symbol("kBuffer"),nn=Symbol("kLength"),Rg=class{#A;#e={};#t=0;constructor(A,t){this.#e.serverNoContextTakeover=A.has("server_no_context_takeover"),this.#e.serverMaxWindowBits=A.get("server_max_window_bits"),this.#t=t.maxPayloadSize}decompress(A,t,r){if(!this.#A){let n=wb;if(this.#e.serverMaxWindowBits){if(!pb(this.#e.serverMaxWindowBits)){r(new Error("Invalid server_max_window_bits"));return}n=Number.parseInt(this.#e.serverMaxWindowBits)}try{this.#A=yb({windowBits:n})}catch(o){r(o);return}this.#A[ns]=[],this.#A[nn]=0,this.#A.on("data",o=>{if(this.#A[nn]+=o.length,this.#t>0&&this.#A[nn]>this.#t){r(new Db),this.#A.removeAllListeners(),this.#A=null;return}this.#A[ns].push(o)}),this.#A.on("error",o=>{this.#A=null,r(o)})}this.#A.write(A),t&&this.#A.write(mb),this.#A.flush(()=>{if(!this.#A)return;let n=Buffer.concat(this.#A[ns],this.#A[nn]);this.#A[ns].length=0,this.#A[nn]=0,r(null,n)})}};ku.exports={PerMessageDeflate:Rg}});var Gu=f((BM,Yu)=>{"use strict";var{Writable:kb}=h("node:stream"),Fb=h("node:assert"),{parserStates:wA,opcodes:sr,states:Rb,emptyBuffer:Ru,sentCloseFrameState:bu}=gt(),{kReadyState:bb,kSentClose:Nu,kResponse:Su,kReceivedClose:Uu}=Xr(),{channels:os}=Ct(),{isValidStatusCode:Nb,isValidOpcode:Sb,failWebsocketConnection:EA,websocketMessageReceived:Mu,utf8Decode:Ub,isControlFrame:bg,isTextBinaryFrame:Ng,isContinuationFrame:Mb}=An(),{WebsocketFrameSend:Lu}=es(),{closeWebSocketConnection:Lb}=Fg(),{PerMessageDeflate:Tb}=Fu(),{MessageSizeExceededError:Tu}=H(),Sg=class extends kb{#A=[];#e=0;#t=0;#o=!1;#n=wA.INFO;#r={};#s=[];#i;#a;constructor(A,t,r={}){super(),this.ws=A,this.#i=t??new Map,this.#a=r.maxPayloadSize??0,this.#i.has("permessage-deflate")&&this.#i.set("permessage-deflate",new Tb(t,r))}_write(A,t,r){this.#A.push(A),this.#t+=A.length,this.#o=!0,this.run(r)}#g(){return this.#a>0&&!bg(this.#r.opcode)&&this.#r.payloadLength>this.#a?(EA(this.ws,"Payload size exceeds maximum allowed size"),!1):!0}run(A){for(;this.#o;)if(this.#n===wA.INFO){if(this.#t<2)return A();let t=this.consume(2),r=(t[0]&128)!==0,n=t[0]&15,o=(t[1]&128)===128,s=!r&&n!==sr.CONTINUATION,i=t[1]&127,a=t[0]&64,g=t[0]&32,c=t[0]&16;if(!Sb(n))return EA(this.ws,"Invalid opcode received"),A();if(o)return EA(this.ws,"Frame cannot be masked"),A();if(a!==0&&!this.#i.has("permessage-deflate")){EA(this.ws,"Expected RSV1 to be clear.");return}if(g!==0||c!==0){EA(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(s&&!Ng(n)){EA(this.ws,"Invalid frame type was fragmented.");return}if(Ng(n)&&this.#s.length>0){EA(this.ws,"Expected continuation frame");return}if(this.#r.fragmented&&s){EA(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((i>125||s)&&bg(n)){EA(this.ws,"Control frame either too large or fragmented");return}if(Mb(n)&&this.#s.length===0&&!this.#r.compressed){EA(this.ws,"Unexpected continuation frame");return}if(i<=125){if(this.#r.payloadLength=i,this.#n=wA.READ_DATA,!this.#g())return}else i===126?this.#n=wA.PAYLOADLENGTH_16:i===127&&(this.#n=wA.PAYLOADLENGTH_64);Ng(n)&&(this.#r.binaryType=n,this.#r.compressed=a!==0),this.#r.opcode=n,this.#r.masked=o,this.#r.fin=r,this.#r.fragmented=s}else if(this.#n===wA.PAYLOADLENGTH_16){if(this.#t<2)return A();let t=this.consume(2);if(this.#r.payloadLength=t.readUInt16BE(0),this.#n=wA.READ_DATA,!this.#g())return}else if(this.#n===wA.PAYLOADLENGTH_64){if(this.#t<8)return A();let t=this.consume(8),r=t.readUInt32BE(0),n=t.readUInt32BE(4);if(r!==0||n>2**31-1){EA(this.ws,"Received payload length > 2^31 bytes.");return}if(this.#r.payloadLength=n,this.#n=wA.READ_DATA,!this.#g())return}else if(this.#n===wA.READ_DATA){if(this.#t<this.#r.payloadLength)return A();let t=this.consume(this.#r.payloadLength);if(bg(this.#r.opcode))this.#o=this.parseControlFrame(t),this.#n=wA.INFO;else if(this.#r.compressed){this.#i.get("permessage-deflate").decompress(t,this.#r.fin,(r,n)=>{if(r){EA(this.ws,r.message);return}if(this.writeFragments(n),this.#a>0&&this.#e>this.#a){EA(this.ws,new Tu().message);return}if(!this.#r.fin){this.#n=wA.INFO,this.#o=!0,this.run(A);return}Mu(this.ws,this.#r.binaryType,this.consumeFragments()),this.#o=!0,this.#n=wA.INFO,this.run(A)}),this.#o=!1;break}else{if(this.writeFragments(t),this.#a>0&&this.#e>this.#a){EA(this.ws,new Tu().message);return}!this.#r.fragmented&&this.#r.fin&&Mu(this.ws,this.#r.binaryType,this.consumeFragments()),this.#n=wA.INFO}}}consume(A){if(A>this.#t)throw new Error("Called consume() before buffers satiated.");if(A===0)return Ru;if(this.#A[0].length===A)return this.#t-=this.#A[0].length,this.#A.shift();let t=Buffer.allocUnsafe(A),r=0;for(;r!==A;){let n=this.#A[0],{length:o}=n;if(o+r===A){t.set(this.#A.shift(),r);break}else if(o+r>A){t.set(n.subarray(0,A-r),r),this.#A[0]=n.subarray(A-r);break}else t.set(this.#A.shift(),r),r+=n.length}return this.#t-=A,t}writeFragments(A){this.#e+=A.length,this.#s.push(A)}consumeFragments(){let A=this.#s;if(A.length===1)return this.#e=0,A.shift();let t=Buffer.concat(A,this.#e);return this.#s=[],this.#e=0,t}parseCloseBody(A){Fb(A.length!==1);let t;if(A.length>=2&&(t=A.readUInt16BE(0)),t!==void 0&&!Nb(t))return{code:1002,reason:"Invalid status code",error:!0};let r=A.subarray(2);r[0]===239&&r[1]===187&&r[2]===191&&(r=r.subarray(3));try{r=Ub(r)}catch{return{code:1007,reason:"Invalid UTF-8",error:!0}}return{code:t,reason:r,error:!1}}parseControlFrame(A){let{opcode:t,payloadLength:r}=this.#r;if(t===sr.CLOSE){if(r===1)return EA(this.ws,"Received close frame with a 1-byte body."),!1;if(this.#r.closeInfo=this.parseCloseBody(A),this.#r.closeInfo.error){let{code:n,reason:o}=this.#r.closeInfo;return Lb(this.ws,n,o,o.length),EA(this.ws,o),!1}if(this.ws[Nu]!==bu.SENT){let n=Ru;this.#r.closeInfo.code&&(n=Buffer.allocUnsafe(2),n.writeUInt16BE(this.#r.closeInfo.code,0));let o=new Lu(n);this.ws[Su].socket.write(o.createFrame(sr.CLOSE),s=>{s||(this.ws[Nu]=bu.SENT)})}return this.ws[bb]=Rb.CLOSING,this.ws[Uu]=!0,!1}else if(t===sr.PING){if(!this.ws[Uu]){let n=new Lu(A);this.ws[Su].socket.write(n.createFrame(sr.PONG)),os.ping.hasSubscribers&&os.ping.publish({payload:A})}}else t===sr.PONG&&os.pong.hasSubscribers&&os.pong.publish({payload:A});return!0}get closingInfo(){return this.#r.closeInfo}};Yu.exports={ByteParser:Sg}});var Vu=f((IM,Hu)=>{"use strict";var{WebsocketFrameSend:Yb}=es(),{opcodes:Ju,sendHints:ir}=gt(),Gb=vi(),xu=Buffer[Symbol.species],Ug=class{#A=new Gb;#e=!1;#t;constructor(A){this.#t=A}add(A,t,r){if(r!==ir.blob){let o=vu(A,r);if(!this.#e)this.#t.write(o,t);else{let s={promise:null,callback:t,frame:o};this.#A.push(s)}return}let n={promise:A.arrayBuffer().then(o=>{n.promise=null,n.frame=vu(o,r)}),callback:t,frame:null};this.#A.push(n),this.#e||this.#o()}async#o(){this.#e=!0;let A=this.#A;for(;!A.isEmpty();){let t=A.shift();t.promise!==null&&await t.promise,this.#t.write(t.frame,t.callback),t.callback=t.frame=null}this.#e=!1}};function vu(e,A){return new Yb(Jb(e,A)).createFrame(A===ir.string?Ju.TEXT:Ju.BINARY)}function Jb(e,A){switch(A){case ir.string:return Buffer.from(e);case ir.arrayBuffer:case ir.blob:return new xu(e);case ir.typedArray:return new xu(e.buffer,e.byteOffset,e.byteLength)}}Hu.exports={SendQueue:Ug}});var ju=f((CM,Xu)=>{"use strict";var{webidl:U}=gA(),{URLSerializer:xb}=uA(),{environmentSettingsObject:qu}=pA(),{staticPropertyDescriptors:ve,states:on,sentCloseFrameState:vb,sendHints:ss}=gt(),{kWebSocketURL:Wu,kReadyState:Mg,kController:Ou,kBinaryType:is,kResponse:Pu,kSentClose:Hb,kByteParser:Vb}=Xr(),{isConnecting:qb,isEstablished:Wb,isClosing:Ob,isValidSubprotocol:Pb,fireEvent:_u}=An(),{establishWebSocketConnection:_b,closeWebSocketConnection:zu}=Fg(),{ByteParser:zb}=Gu(),{kEnumerableProperty:JA,isBlobLike:Zu}=G(),{getGlobalDispatcher:Zb}=wo(),{types:Ku}=h("node:util"),{ErrorEvent:Kb,CloseEvent:Xb}=rr(),{SendQueue:jb}=Vu(),NA=class e extends EventTarget{#A={open:null,error:null,close:null,message:null};#e=0;#t="";#o="";#n;constructor(A,t=[]){super(),U.util.markAsUncloneable(this);let r="WebSocket constructor";U.argumentLengthCheck(arguments,1,r);let n=U.converters["DOMString or sequence<DOMString> or WebSocketInit"](t,r,"options");A=U.converters.USVString(A,r,"url"),t=n.protocols;let o=qu.settingsObject.baseUrl,s;try{s=new URL(A,o)}catch(a){throw new DOMException(a,"SyntaxError")}if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new DOMException(`Expected a ws: or wss: protocol, got ${s.protocol}`,"SyntaxError");if(s.hash||s.href.endsWith("#"))throw new DOMException("Got fragment","SyntaxError");if(typeof t=="string"&&(t=[t]),t.length!==new Set(t.map(a=>a.toLowerCase())).size)throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");if(t.length>0&&!t.every(a=>Pb(a)))throw new DOMException("Invalid Sec-WebSocket-Protocol value","SyntaxError");this[Wu]=new URL(s.href);let i=qu.settingsObject;this[Ou]=_b(s,t,i,this,(a,g)=>this.#r(a,g),n),this[Mg]=e.CONNECTING,this[Hb]=vb.NOT_SENT,this[is]="blob"}close(A=void 0,t=void 0){U.brandCheck(this,e);let r="WebSocket.close";if(A!==void 0&&(A=U.converters["unsigned short"](A,r,"code",{clamp:!0})),t!==void 0&&(t=U.converters.USVString(t,r,"reason")),A!==void 0&&A!==1e3&&(A<3e3||A>4999))throw new DOMException("invalid code","InvalidAccessError");let n=0;if(t!==void 0&&(n=Buffer.byteLength(t),n>123))throw new DOMException(`Reason must be less than 123 bytes; received ${n}`,"SyntaxError");zu(this,A,t,n)}send(A){U.brandCheck(this,e);let t="WebSocket.send";if(U.argumentLengthCheck(arguments,1,t),A=U.converters.WebSocketSendData(A,t,"data"),qb(this))throw new DOMException("Sent before connected.","InvalidStateError");if(!(!Wb(this)||Ob(this)))if(typeof A=="string"){let r=Buffer.byteLength(A);this.#e+=r,this.#n.add(A,()=>{this.#e-=r},ss.string)}else Ku.isArrayBuffer(A)?(this.#e+=A.byteLength,this.#n.add(A,()=>{this.#e-=A.byteLength},ss.arrayBuffer)):ArrayBuffer.isView(A)?(this.#e+=A.byteLength,this.#n.add(A,()=>{this.#e-=A.byteLength},ss.typedArray)):Zu(A)&&(this.#e+=A.size,this.#n.add(A,()=>{this.#e-=A.size},ss.blob))}get readyState(){return U.brandCheck(this,e),this[Mg]}get bufferedAmount(){return U.brandCheck(this,e),this.#e}get url(){return U.brandCheck(this,e),xb(this[Wu])}get extensions(){return U.brandCheck(this,e),this.#o}get protocol(){return U.brandCheck(this,e),this.#t}get onopen(){return U.brandCheck(this,e),this.#A.open}set onopen(A){U.brandCheck(this,e),this.#A.open&&this.removeEventListener("open",this.#A.open),typeof A=="function"?(this.#A.open=A,this.addEventListener("open",A)):this.#A.open=null}get onerror(){return U.brandCheck(this,e),this.#A.error}set onerror(A){U.brandCheck(this,e),this.#A.error&&this.removeEventListener("error",this.#A.error),typeof A=="function"?(this.#A.error=A,this.addEventListener("error",A)):this.#A.error=null}get onclose(){return U.brandCheck(this,e),this.#A.close}set onclose(A){U.brandCheck(this,e),this.#A.close&&this.removeEventListener("close",this.#A.close),typeof A=="function"?(this.#A.close=A,this.addEventListener("close",A)):this.#A.close=null}get onmessage(){return U.brandCheck(this,e),this.#A.message}set onmessage(A){U.brandCheck(this,e),this.#A.message&&this.removeEventListener("message",this.#A.message),typeof A=="function"?(this.#A.message=A,this.addEventListener("message",A)):this.#A.message=null}get binaryType(){return U.brandCheck(this,e),this[is]}set binaryType(A){U.brandCheck(this,e),A!=="blob"&&A!=="arraybuffer"?this[is]="blob":this[is]=A}#r(A,t){this[Pu]=A;let r=this[Ou]?.dispatcher?.webSocketOptions?.maxPayloadSize,n=new zb(this,t,{maxPayloadSize:r});n.on("drain",$b),n.on("error",AN.bind(this)),A.socket.ws=this,this[Vb]=n,this.#n=new jb(A.socket),this[Mg]=on.OPEN;let o=A.headersList.get("sec-websocket-extensions");o!==null&&(this.#o=o);let s=A.headersList.get("sec-websocket-protocol");s!==null&&(this.#t=s),_u("open",this)}};NA.CONNECTING=NA.prototype.CONNECTING=on.CONNECTING;NA.OPEN=NA.prototype.OPEN=on.OPEN;NA.CLOSING=NA.prototype.CLOSING=on.CLOSING;NA.CLOSED=NA.prototype.CLOSED=on.CLOSED;Object.defineProperties(NA.prototype,{CONNECTING:ve,OPEN:ve,CLOSING:ve,CLOSED:ve,url:JA,readyState:JA,bufferedAmount:JA,onopen:JA,onerror:JA,onclose:JA,close:JA,onmessage:JA,binaryType:JA,send:JA,extensions:JA,protocol:JA,[Symbol.toStringTag]:{value:"WebSocket",writable:!1,enumerable:!1,configurable:!0}});Object.defineProperties(NA,{CONNECTING:ve,OPEN:ve,CLOSING:ve,CLOSED:ve});U.converters["sequence<DOMString>"]=U.sequenceConverter(U.converters.DOMString);U.converters["DOMString or sequence<DOMString>"]=function(e,A,t){return U.util.Type(e)==="Object"&&Symbol.iterator in e?U.converters["sequence<DOMString>"](e):U.converters.DOMString(e,A,t)};U.converters.WebSocketInit=U.dictionaryConverter([{key:"protocols",converter:U.converters["DOMString or sequence<DOMString>"],defaultValue:()=>new Array(0)},{key:"dispatcher",converter:U.converters.any,defaultValue:()=>Zb()},{key:"headers",converter:U.nullableConverter(U.converters.HeadersInit)}]);U.converters["DOMString or sequence<DOMString> or WebSocketInit"]=function(e){return U.util.Type(e)==="Object"&&!(Symbol.iterator in e)?U.converters.WebSocketInit(e):{protocols:U.converters["DOMString or sequence<DOMString>"](e)}};U.converters.WebSocketSendData=function(e){if(U.util.Type(e)==="Object"){if(Zu(e))return U.converters.Blob(e,{strict:!1});if(ArrayBuffer.isView(e)||Ku.isArrayBuffer(e))return U.converters.BufferSource(e)}return U.converters.USVString(e)};function $b(){this.ws[Pu].socket.resume()}function AN(e){let A,t;e instanceof Xb?(A=e.reason,t=e.code):A=e.message,_u("error",this,()=>new Kb("error",{error:e,message:A})),zu(this,t)}Xu.exports={WebSocket:NA}});var Lg=f((uM,$u)=>{"use strict";function eN(e){return e.indexOf("\0")===-1}function tN(e){if(e.length===0)return!1;for(let A=0;A<e.length;A++)if(e.charCodeAt(A)<48||e.charCodeAt(A)>57)return!1;return!0}function rN(e){return new Promise(A=>{setTimeout(A,e).unref()})}$u.exports={isValidLastEventId:eN,isASCIINumber:tN,delay:rN}});var rh=f((hM,th)=>{"use strict";var{Transform:nN}=h("node:stream"),{isASCIINumber:Ah,isValidLastEventId:eh}=Lg(),de=[239,187,191],Tg=10,as=13,oN=58,sN=32,Yg=class extends nN{state=null;checkBOM=!0;crlfCheck=!1;eventEndCheck=!1;buffer=null;pos=0;event={data:void 0,event:void 0,id:void 0,retry:void 0};constructor(A={}){A.readableObjectMode=!0,super(A),this.state=A.eventSourceSettings||{},A.push&&(this.push=A.push)}_transform(A,t,r){if(A.length===0){r();return}if(this.buffer?this.buffer=Buffer.concat([this.buffer,A]):this.buffer=A,this.checkBOM)switch(this.buffer.length){case 1:if(this.buffer[0]===de[0]){r();return}this.checkBOM=!1,r();return;case 2:if(this.buffer[0]===de[0]&&this.buffer[1]===de[1]){r();return}this.checkBOM=!1;break;case 3:if(this.buffer[0]===de[0]&&this.buffer[1]===de[1]&&this.buffer[2]===de[2]){this.buffer=Buffer.alloc(0),this.checkBOM=!1,r();return}this.checkBOM=!1;break;default:this.buffer[0]===de[0]&&this.buffer[1]===de[1]&&this.buffer[2]===de[2]&&(this.buffer=this.buffer.subarray(3)),this.checkBOM=!1;break}for(;this.pos<this.buffer.length;){if(this.eventEndCheck){if(this.crlfCheck){if(this.buffer[this.pos]===Tg){this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.crlfCheck=!1;continue}this.crlfCheck=!1}if(this.buffer[this.pos]===Tg||this.buffer[this.pos]===as){this.buffer[this.pos]===as&&(this.crlfCheck=!0),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,(this.event.data!==void 0||this.event.event||this.event.id||this.event.retry)&&this.processEvent(this.event),this.clearEvent();continue}this.eventEndCheck=!1;continue}if(this.buffer[this.pos]===Tg||this.buffer[this.pos]===as){this.buffer[this.pos]===as&&(this.crlfCheck=!0),this.parseLine(this.buffer.subarray(0,this.pos),this.event),this.buffer=this.buffer.subarray(this.pos+1),this.pos=0,this.eventEndCheck=!0;continue}this.pos++}r()}parseLine(A,t){if(A.length===0)return;let r=A.indexOf(oN);if(r===0)return;let n="",o="";if(r!==-1){n=A.subarray(0,r).toString("utf8");let s=r+1;A[s]===sN&&++s,o=A.subarray(s).toString("utf8")}else n=A.toString("utf8"),o="";switch(n){case"data":t[n]===void 0?t[n]=o:t[n]+=`
|
|
47
47
|
${o}`;break;case"retry":Ah(o)&&(t[n]=o);break;case"id":eh(o)&&(t[n]=o);break;case"event":o.length>0&&(t[n]=o);break}}processEvent(A){A.retry&&Ah(A.retry)&&(this.state.reconnectionTime=parseInt(A.retry,10)),A.id&&eh(A.id)&&(this.state.lastEventId=A.id),A.data!==void 0&&this.push({type:A.event||"message",options:{data:A.data,lastEventId:this.state.lastEventId,origin:this.state.origin}})}clearEvent(){this.event={data:void 0,event:void 0,id:void 0,retry:void 0}}};th.exports={EventSourceStream:Yg}});var lh=f((dM,ch)=>{"use strict";var{pipeline:iN}=h("node:stream"),{fetching:aN}=_r(),{makeRequest:gN}=Xt(),{webidl:fe}=gA(),{EventSourceStream:cN}=rh(),{parseMIMEType:lN}=uA(),{createFastMessageEvent:QN}=rr(),{isNetworkError:nh}=Or(),{delay:EN}=Lg(),{kEnumerableProperty:ct}=G(),{environmentSettingsObject:oh}=pA(),sh=!1,ih=3e3,sn=0,ah=1,an=2,BN="anonymous",IN="use-credentials",ar=class e extends EventTarget{#A={open:null,error:null,message:null};#e=null;#t=!1;#o=sn;#n=null;#r=null;#s;#i;constructor(A,t={}){super(),fe.util.markAsUncloneable(this);let r="EventSource constructor";fe.argumentLengthCheck(arguments,1,r),sh||(sh=!0,process.emitWarning("EventSource is experimental, expect them to change at any time.",{code:"UNDICI-ES"})),A=fe.converters.USVString(A,r,"url"),t=fe.converters.EventSourceInitDict(t,r,"eventSourceInitDict"),this.#s=t.dispatcher,this.#i={lastEventId:"",reconnectionTime:ih};let n=oh,o;try{o=new URL(A,n.settingsObject.baseUrl),this.#i.origin=o.origin}catch(a){throw new DOMException(a,"SyntaxError")}this.#e=o.href;let s=BN;t.withCredentials&&(s=IN,this.#t=!0);let i={redirect:"follow",keepalive:!0,mode:"cors",credentials:s==="anonymous"?"same-origin":"omit",referrer:"no-referrer"};i.client=oh.settingsObject,i.headersList=[["accept",{name:"accept",value:"text/event-stream"}]],i.cache="no-store",i.initiator="other",i.urlList=[new URL(this.#e)],this.#n=gN(i),this.#a()}get readyState(){return this.#o}get url(){return this.#e}get withCredentials(){return this.#t}#a(){if(this.#o===an)return;this.#o=sn;let A={request:this.#n,dispatcher:this.#s},t=r=>{nh(r)&&(this.dispatchEvent(new Event("error")),this.close()),this.#g()};A.processResponseEndOfBody=t,A.processResponse=r=>{if(nh(r))if(r.aborted){this.close(),this.dispatchEvent(new Event("error"));return}else{this.#g();return}let n=r.headersList.get("content-type",!0),o=n!==null?lN(n):"failure",s=o!=="failure"&&o.essence==="text/event-stream";if(r.status!==200||s===!1){this.close(),this.dispatchEvent(new Event("error"));return}this.#o=ah,this.dispatchEvent(new Event("open")),this.#i.origin=r.urlList[r.urlList.length-1].origin;let i=new cN({eventSourceSettings:this.#i,push:a=>{this.dispatchEvent(QN(a.type,a.options))}});iN(r.body.stream,i,a=>{a?.aborted===!1&&(this.close(),this.dispatchEvent(new Event("error")))})},this.#r=aN(A)}async#g(){this.#o!==an&&(this.#o=sn,this.dispatchEvent(new Event("error")),await EN(this.#i.reconnectionTime),this.#o===sn&&(this.#i.lastEventId.length&&this.#n.headersList.set("last-event-id",this.#i.lastEventId,!0),this.#a()))}close(){fe.brandCheck(this,e),this.#o!==an&&(this.#o=an,this.#r.abort(),this.#n=null)}get onopen(){return this.#A.open}set onopen(A){this.#A.open&&this.removeEventListener("open",this.#A.open),typeof A=="function"?(this.#A.open=A,this.addEventListener("open",A)):this.#A.open=null}get onmessage(){return this.#A.message}set onmessage(A){this.#A.message&&this.removeEventListener("message",this.#A.message),typeof A=="function"?(this.#A.message=A,this.addEventListener("message",A)):this.#A.message=null}get onerror(){return this.#A.error}set onerror(A){this.#A.error&&this.removeEventListener("error",this.#A.error),typeof A=="function"?(this.#A.error=A,this.addEventListener("error",A)):this.#A.error=null}},gh={CONNECTING:{__proto__:null,configurable:!1,enumerable:!0,value:sn,writable:!1},OPEN:{__proto__:null,configurable:!1,enumerable:!0,value:ah,writable:!1},CLOSED:{__proto__:null,configurable:!1,enumerable:!0,value:an,writable:!1}};Object.defineProperties(ar,gh);Object.defineProperties(ar.prototype,gh);Object.defineProperties(ar.prototype,{close:ct,onerror:ct,onmessage:ct,onopen:ct,readyState:ct,url:ct,withCredentials:ct});fe.converters.EventSourceInitDict=fe.dictionaryConverter([{key:"withCredentials",converter:fe.converters.boolean,defaultValue:()=>!1},{key:"dispatcher",converter:fe.converters.any}]);ch.exports={EventSource:ar,defaultReconnectionTime:ih}});var Ih=f((fM,S)=>{"use strict";var CN=Yt(),Qh=lr(),uN=Gt(),hN=gE(),dN=Jt(),fN=sa(),yN=ME(),wN=xE(),Eh=H(),cs=G(),{InvalidArgumentError:gs}=Eh,gr=mB(),pN=Er(),DN=Ha(),mN=iI(),kN=Wa(),FN=Ra(),RN=lo(),{getGlobalDispatcher:Bh,setGlobalDispatcher:bN}=wo(),NN=po(),SN=Ao(),UN=eo();Object.assign(Qh.prototype,gr);S.exports.Dispatcher=Qh;S.exports.Client=CN;S.exports.Pool=uN;S.exports.BalancedPool=hN;S.exports.Agent=dN;S.exports.ProxyAgent=fN;S.exports.EnvHttpProxyAgent=yN;S.exports.RetryAgent=wN;S.exports.RetryHandler=RN;S.exports.DecoratorHandler=NN;S.exports.RedirectHandler=SN;S.exports.createRedirectInterceptor=UN;S.exports.interceptors={redirect:BI(),retry:CI(),dump:hI(),dns:yI()};S.exports.buildConnector=pN;S.exports.errors=Eh;S.exports.util={parseHeaders:cs.parseHeaders,headerNameToString:cs.headerNameToString};function gn(e){return(A,t,r)=>{if(typeof t=="function"&&(r=t,t=null),!A||typeof A!="string"&&typeof A!="object"&&!(A instanceof URL))throw new gs("invalid url");if(t!=null&&typeof t!="object")throw new gs("invalid opts");if(t&&t.path!=null){if(typeof t.path!="string")throw new gs("invalid opts.path");let s=t.path;t.path.startsWith("/")||(s=`/${s}`),A=new URL(cs.parseOrigin(A).origin+s)}else t||(t=typeof A=="object"?A:{}),A=cs.parseURL(A);let{agent:n,dispatcher:o=Bh()}=t;if(n)throw new gs("unsupported opts.agent. Did you mean opts.client?");return e.call(o,{...t,origin:A.origin,path:A.search?`${A.pathname}${A.search}`:A.pathname,method:t.method||(t.body?"PUT":"GET")},r)}}S.exports.setGlobalDispatcher=bN;S.exports.getGlobalDispatcher=Bh;var MN=_r().fetch;S.exports.fetch=async function(A,t=void 0){try{return await MN(A,t)}catch(r){throw r&&typeof r=="object"&&Error.captureStackTrace(r),r}};S.exports.Headers=rt().Headers;S.exports.Response=Or().Response;S.exports.Request=Xt().Request;S.exports.FormData=fr().FormData;S.exports.File=globalThis.File??h("node:buffer").File;S.exports.FileReader=GC().FileReader;var{setGlobalOrigin:LN,getGlobalOrigin:TN}=ii();S.exports.setGlobalOrigin=LN;S.exports.getGlobalOrigin=TN;var{CacheStorage:YN}=PC(),{kConstruct:GN}=Wo();S.exports.caches=new YN(GN);var{deleteCookie:JN,getCookies:xN,getSetCookies:vN,setCookie:HN}=nu();S.exports.deleteCookie=JN;S.exports.getCookies=xN;S.exports.getSetCookies=vN;S.exports.setCookie=HN;var{parseMIMEType:VN,serializeAMimeType:qN}=uA();S.exports.parseMIMEType=VN;S.exports.serializeAMimeType=qN;var{CloseEvent:WN,ErrorEvent:ON,MessageEvent:PN}=rr();S.exports.WebSocket=ju().WebSocket;S.exports.CloseEvent=WN;S.exports.ErrorEvent=ON;S.exports.MessageEvent=PN;S.exports.request=gn(gr.request);S.exports.stream=gn(gr.stream);S.exports.pipeline=gn(gr.pipeline);S.exports.connect=gn(gr.connect);S.exports.upgrade=gn(gr.upgrade);S.exports.MockClient=DN;S.exports.MockPool=kN;S.exports.MockAgent=mN;S.exports.mockErrors=FN;var{EventSource:_N}=lh();S.exports.EventSource=_N});import*as yh from"ws";import*as oA from"node:fs";import*as Es from"node:os";import*as wh from"node:net";import*as lt from"node:path";function we(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function vg(e){if(e!=null)return we(e)}function KA(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let A=e.BS_PRIVATE_NESTED_SOME_NONE;if(A!==0)return{BS_PRIVATE_NESTED_SOME_NONE:A-1|0}}function Hg(e,A){let t=e.findIndex(A);if(t!==-1)return t}function qg(e,A){let t=A!==void 0?parseInt(e,A):parseInt(e);if(!(Number.isNaN(t)||t>2147483647||t<-2147483648))return t|0}import*as Gg from"node:crypto";function Bn(e){if(e.RE_EXN_ID==="JsExn")return we(e._1)}var In=(e=>A=>A&&typeof A[e]=="string"?A[e]:void 0),wS=In("stack"),Wg=In("message"),pS=In("name"),DS=In("fileName");function Og(e,A){if(e!==void 0)return A(KA(e))}function SA(e,A){return e!==void 0?KA(e):A}function Yh(e){return e==null?!1:typeof e.RE_EXN_ID=="string"}function xA(e){return Yh(e)?e:{RE_EXN_ID:"JsExn",_1:e}}function Is(e,A){return e.catch(t=>A(xA(t)))}var hh=Nh(Ih(),1);import{existsSync as Ch,readFileSync as uh}from"node:fs";import pM from"ws";function ls(){let e=process.env.KANDAN_TLS_CA_FILE;if(e===void 0||e.trim()==="")return;let A=e.trim();if(!Ch(A))throw new Error(`KANDAN_TLS_CA_FILE does not exist: ${A}`);return uh(A,"utf8")}function zN(){return ZN(process.env.KANDAN_TLS_CA_FILE)}function ZN(e){if(e===void 0||e.trim()==="")return;let A=e.trim();if(!Ch(A))throw new Error(`KANDAN_TLS_CA_FILE does not exist: ${A}`);let t=uh(A,"utf8");return{caFile:A,ca:t,dispatcher:new hh.Agent({connect:{ca:t}})}}function KN(e){return e===void 0?fetch:((A,t)=>{let r={...t??{},dispatcher:e.dispatcher};return fetch(A,r)})}function cn(){return KN(zN())}var FM=64*1024*1024,RM=32*1024;function NM(e){return ls()}function SM(e){return cn()}var jN="wss://linzumi.link",$N="https://serve.linzumi.com";function UM(e){return new Error(e)}function ln(e){let A=Bn(e);return A!==void 0?SA(Wg(KA(A)),"unknown error"):"unknown error"}function Qs(e,A){let t=e.trim();if(t==="")throw new Error(A+" must not be empty");return t}function MM(e){return e%256}function AS(e,A){let t=new Error("tunnel refused "+e.toString()+": "+A);return t.name="TunnelRefusalError",t.code=e,t.reason=A,t.exitCode=e%256,t}function eS(e,A,t){let r=new Error(A);return r.name="TunnelListenerError",r.code=e,r.exitCode=t,r}function tS(e,A){let t=new URL(e),r=t.protocol,n;switch(r){case"https:":case"wss:":n="wss:";break;default:n="ws:"}return t.protocol=n,t.pathname="/tunnel/connect",t.search="",t.searchParams.set("forward_id",A),t.hash="",t.toString()}function rS(e){switch(e){case 4001:return"authentication invalid, expired, or timed out";case 4002:return"share revoked or unpublished";case 4003:return"preview origin unavailable";case 4004:return"target is not a registered approved forward";case 4005:return"runner offline or runner-side connection failed";case 4006:return"protocol error";case 4007:return"idle timeout";case 4008:return"concurrency cap reached";default:return"connection closed"}}function nS(e){let A;try{A=JSON.parse(e)}catch{A=void 0}if(A===void 0||typeof A!="object"||A===null||Array.isArray(A))return"Invalid";let t=A.ok,r=A.tunnel_id;if(t===!0&&typeof r=="string"?r.trim()!=="":!1)return"Ready";let o=A.error,s=A.reason;return o!==void 0&&typeof o=="number"&&s!==void 0&&typeof s=="string"&&o>=4001&&o<=4008&&s.trim()!==""?{NAME:"Refusal",VAL:[o|0,s]}:"Invalid"}async function ph(e,A,t,r,n){let o=n!==void 0?n:I=>{},s=A.kind,i;switch(s){case"share-token":i="Bearer share_token:"+A.token;break;case"user-session":i="Bearer user_session:"+A.token;break;default:throw new Error("unknown tunnel credential kind: "+s)}let a=Object.fromEntries([["authorization",i]]),g=r!==void 0?t(e,{headers:a,ca:r}):t(e,{headers:a});o(g);let c={contents:!1},l={contents:void 0},Q={contents:[]},E={contents:void 0},B={contents:void 0},C=new Promise((I,u)=>{B.contents=I});return await new Promise((I,u)=>{g.on("message",(D,p)=>{if(p){let Y=c.contents,$=D.byteLength<=65536;if(Y&&$){let sA=l.contents;if(sA!==void 0)return sA(D,g);Q.contents.push(D);return}return g.close(4006,"protocol error"),c.contents?void 0:u(new Error("tunnel sent binary data before authentication"))}let F=nS(D.toString("utf8"));if(typeof F!="object")return F==="Invalid"?(g.close(4006,"unexpected text frame"),c.contents?void 0:u(new Error("tunnel returned an invalid authentication frame"))):(c.contents=!0,I());let L=F.VAL;E.contents=[L[0],L[1]]}),g.once("error",D=>{if(!c.contents)return u(xA(D))}),g.once("close",(D,p)=>{let F=E.contents,L;if(F!==void 0)L=F[1];else{let sA=p.toString("utf8").trim();L=sA===""?rS(D):sA}let Y=B.contents;if(Y!==void 0&&Y({code:D,reason:L}),c.contents)return;let $=E.contents;return u($!==void 0?AS($[0],$[1]):new Error("tunnel closed before authentication ("+D.toString()+": "+L+")"))})}),{websocket:g,closed:C,attachBinary:I=>{if(l.contents!==void 0)throw new Error("tunnel binary pipe is already attached");l.contents=I,Q.contents.forEach(D=>I(D,g)),Q.contents=[]},close:async()=>{let I=g.readyState;return I!==3&&I!==2&&g.close(1e3,"local stream closed"),await C.then(u=>Promise.resolve())},terminate:async()=>(g.readyState!==3&&g.terminate(),await C.then(u=>Promise.resolve()))}}function oS(e,A){return new Promise((t,r)=>{if(e.readyState!==1)return r(new Error("tunnel WebSocket is not open"));e.send(A,{binary:!0},o=>o==null?t():r(xA(o)))})}function sS(e){return e.destroyed?Promise.resolve():new Promise((A,t)=>{let r={contents:!1},n={contents:void 0},o=()=>{if(r.contents)return;r.contents=!0;let s=n.contents;s!==void 0&&clearTimeout(s),A()};e.once("close",o),e.end(()=>{if(e.destroyed)return o();n.contents=setTimeout(()=>{e.destroyed||e.destroy(),o()},2e3)})})}function iS(e){e.socket.destroyed||e.socket.destroy();let A=e.tunnel,t=A!==void 0?we(A.websocket):e.websocket;if(t===void 0)return;let r=KA(t);if(r.readyState!==3){r.terminate();return}}function aS(e,A,t){let r={contents:void 0},n={contents:!1};return o=>{let s=r.contents;if(s!==void 0){let c=n.contents;return o==="ListenerShutdown"&&(c||(n.contents=!0,iS(e))),s}let i={contents:void 0},a=new Promise((c,l)=>{i.contents=c});return r.contents=a,Is((async()=>{if(o==="RelayFailure"){let l=e.tunnel;if(l!==void 0){let Q=l.websocket.readyState,E=0;Q>=2?Q>=4&&(E=1):Q>=0?l.websocket.terminate():E=1,E===1&&A("linzumi connect: stream "+e.id+" relay-failure teardown saw unknown WebSocket state "+Q.toString()+`
|
|
48
48
|
`),await l.closed.then(B=>Promise.resolve())}else A("linzumi connect: stream "+e.id+` relay-failure teardown had no active tunnel to abort
|
|
49
49
|
`)}switch(o){case"LocalFirst":break;case"RemoteFirst":case"RelayFailure":await sS(e.socket);break;case"ListenerShutdown":e.socket.destroy();break}let c=0;switch(o){case"LocalFirst":case"RemoteFirst":c=1;break;case"RelayFailure":break;case"ListenerShutdown":let l=e.tunnel;if(l!==void 0)await l.terminate();else{let Q=e.websocket;if(Q!==void 0){let E=KA(Q);E.readyState!==3&&E.terminate()}else A("linzumi connect: stream "+e.id+` teardown had no WebSocket to close
|