Repository navigation
Description
Describe the bug
This is what I got when copilot editing content
`
✗ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
q3(t[D0e]===0);return}if(t[eM]&&!t[_0e]){t[eM](),t[eM]=null;return}if(t[ig]
&&t[ig].resume(),t[Jmt])t[tM]=2;else if(t[tM]===2){e?(t[tM]=1,queueMicrotask(
()=>ZIn(t))):ZIn(t);continue}if(t[D0e]===0||t[U0e]>=(WIn(t)||1))return;let
n=t[ZH][t[EH]];if(t[lx].protocol==="https:"&&t[rM]!==n.servername){if(t[U0e]>
0)return;t[rM]=n.servername,t[ig]?.destroy(new cso("servername
changed"),()=>{t[ig]=null,_mt(t)})}if(t[hse])return;if(!t[ig]){wIn(t);return}
if(t[ig].destroyed||t[ig].busy(n))return;!n.aborted&&t[ig].write(n)?t[EH]++:t
[ZH].splice(t[EH],1)}}vIn.exports=Tmt});var Omt=S((wAi,CIn)=>{"use
strict";var VSe=class{bottom=0;top=0;list=new Array(2048).fill(void
0);next=null;isEmpty(){return
this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e)
{this.list[this.top]=e,this.top=this.top+1&2047}shift(){let
e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void
0,this.bottom=this.bottom+1&2047,e)}};CIn.exports=class{constructor(){this.he
ad=this.tail=new VSe}isEmpty(){return
this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new
VSe),this.head.push(e)}shift(){let e=this.tail,n=e.shift();return
e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),n}}});var
jmt=S((vAi,SIn)=>{"use strict";var{PoolStats:Xso}=jut(),kso=HK(),xso=Omt(),{k
Connected:Mmt,kSize:YIn,kRunning:VIn,kPending:FIn,kQueued:z0e,kBusy:Sso,kFree
:Lso,kUrl:Jso,kClose:Bso,kDestroy:Tso,kDispatch:_so}=Ym(),bA=Symbol("clients"
),HW=Symbol("needDrain"),P0e=Symbol("queue"),Umt=Symbol("closed
resolve"),Dmt=Symbol("onDrain"),QIn=Symbol("onConnect"),HIn=Symbol("onDisconn
ect"),XIn=Symbol("onConnectionError"),zmt=Symbol("get
dispatcher"),kIn=Symbol("add client"),xIn=Symbol("remove client"),Pmt=class
extends kso{[P0e]=new xso;[z0e]=0;[bA]=[];[HW]=!1;Dmt{let
o=this[P0e],s=!1;for(;!s;){let l=o.shift();if(!l)break;this[z0e]--,s=!e.dispa
tch(l.opts,l.handler)}if(e[HW]=s,!s&&this[HW]&&(this[HW]=!1,this.emit("drain"
,n,[this,...r])),this[Umt]&&o.isEmpty()){let l=new
Array(this[bA].length);for(let a=0;a<this[bA].length;a++)l[a]=this[bA][a].clo
se();Promise.all(l).then(this[Umt])}}[QIn]=(e,n)=>{this.emit("connect",e,[thi
s,...n])};[HIn]=(e,n,r)=>{this.emit("disconnect",e,[this,...n],r)};[XIn]=(e,n
,r)=>{this.emit("connectionError",e,[this,...n],r)};getSso{return
this[HW]}getMmt{let e=0;for(let{[Mmt]:n}of this[bA])e+=n;return
e}getLso{let e=0;for(let{[Mmt]:n,[HW]:r}of this[bA])e+=n&&!r;return
e}getFIn{let e=this[z0e];for(let{[FIn]:n}of this[bA])e+=n;return
e}getVIn{let e=0;for(let{[VIn]:n}of this[bA])e+=n;return e}getYIn{let
e=this[z0e];for(let{[YIn]:n}of this[bA])e+=n;return e}get stats(){return new
Xso(this)}Bso{if(this[P0e].isEmpty()){let e=new
Array(this[bA].length);for(let
n=0;n<this[bA].length;n++)e[n]=this[bA][n].close();return Promise.all(e)}else
return new Promise(e=>{this[Umt]=e})}Tso{for(;;){let
r=this[P0e].shift();if(!r)break;r.handler.onError(e)}let n=new
Array(this[bA].length);for(let
r=0;r<this[bA].length;r++)n[r]=this[bA][r].destroy(e);return
Promise.all(n)}_so{let r=thiszmt;return
r?r.dispatch(e,n)||(r[HW]=!0,this[HW]=!thiszmt):(this[HW]=!0,this[P0e].pu
sh({opts:e,handler:n}),this[z0e]++),!this[HW]}kIn{return e.on("drain",th
is[Dmt].bind(this,e)).on("connect",this[QIn]).on("disconnect",this[HIn]).on("
connectionError",this[XIn]),this[bA].push(e),this[HW]&&queueMicrotask(()=>{th
is[HW]&&thisDmt}),this}xIn{e.close(()=>{let n=this[
bA].indexOf(e);n!==-1&&this[bA].splice(n,1)}),this[HW]=this[bA].some(n=>!n[HW
]&&n.closed!==!0&&n.destroyed!==!0)}};SIn.exports={PoolBase:Pmt,kClients:bA,k
NeedDrain:HW,kAddClient:kIn,kRemoveClient:xIn,kGetDispatcher:zmt}});var
bse=S((CAi,TIn)=>{"use strict";var{PoolBase:Oso,kClients:FSe,kNeedDrain:Mso,k
AddClient:Uso,kGetDispatcher:Dso,kRemoveClient:zso}=jmt(),Pso=_K(),{InvalidAr
gumentError:Kmt}=Ma(),LIn=sa(),{kUrl:JIn}=Ym(),jso=V0e(),QSe=Symbol("options"
),qmt=Symbol("connections"),BIn=Symbol("factory");function Kso(t,e){return
new Pso(t,e)}var $mt=class extends Oso{constructor(e,{connections:n,factory:r
=Kso,connect:o,connectTimeout:s,tls:l,maxCachedSessions:a,socketPath:c,autoSe
lectFamily:I,autoSelectFamilyAttemptTimeout:d,allowH2:u,clientTtl:m,...p}={})
{if(n!=null&&(!Number.isFinite(n)||n<0))throw new Kmt("invalid
connections");if(typeof r!="function")throw new Kmt("factory must be a
function.");if(o!=null&&typeof o!="function"&&typeof o!="object")throw new
Kmt("connect must be a function or an object");typeof o!="function"&&(o=jso({
...l,maxCachedSessions:a,allowH2:u,socketPath:c,timeout:s,...typeof
I=="boolean"?{autoSelectFamily:I,autoSelectFamilyAttemptTimeout:d}:void
0,...o})),super(),this[qmt]=n||null,this[JIn]=LIn.parseOrigin(e),this[QSe]={.
..LIn.deepClone(p),connect:o,allowH2:u,clientTtl:m},this[QSe].interceptors=p.
interceptors?{...p.interceptors}:void
0,this[BIn]=r,this.on("connect",(h,G)=>{if(m!=null&&m>0)for(let g of G)Object
.assign(g,{ttl:Date.now()})}),this.on("connectionError",(h,G,g)=>{for(let f
of G){let N=this[FSe].indexOf(f);N!==-1&&this[FSe].splice(N,1)}})}Dso{let
e=this[QSe].clientTtl;for(let n of
this[FSe])if(e!=null&&e>0&&n.ttl&&Date.now()-n.ttl>e)thiszso;else
if(!n[Mso])return n;if(!this[qmt]||this[FSe].length<this[qmt]){let
n=thisBIn;return
thisUso,n}}};TIn.exports=$mt});var DIn=S((YAi,UIn)=>{"use
strict";var{BalancedPoolMissingUpstreamError:qso,InvalidArgumentError:$so}=Ma
(),{PoolBase:eio,kClients:SZ,kNeedDrain:j0e,kAddClient:tio,kRemoveClient:nio,
kGetDispatcher:rio}=jmt(),oio=bse(),{kUrl:ept}=Ym(),{parseOrigin:_In}=sa(),OI
n=Symbol("factory"),HSe=Symbol("options"),MIn=Symbol("kGreatestCommonDivisor"
),OK=Symbol("kCurrentWeight"),MK=Symbol("kIndex"),rV=Symbol("kWeight"),XSe=Sy
mbol("kMaxWeightPerServer"),kSe=Symbol("kErrorPenalty");function
sio(t,e){if(t===0)return e;for(;e!==0;){let n=e;e=t%e,t=n}return t}function
iio(t,e){return new oio(t,e)}var tpt=class extends
eio{constructor(e=[],{factory:n=iio,...r}={}){if(typeof n!="function")throw
new $so("factory must be a function.");super(),this[HSe]=r,this[MK]=-1,this[O
K]=0,this[XSe]=this[HSe].maxWeightPerServer||100,this[kSe]=this[HSe].errorPen
alty||15,Array.isArray(e)||(e=[e]),this[OIn]=n;for(let o of
e)this.addUpstream(o);this._updateBalancedPoolStats()}addUpstream(e){let
n=_In(e).origin;if(this[SZ].find(o=>o[ept].origin===n&&o.closed!==!0&&o.destr
oyed!==!0))return this;let r=thisOIn;thisti
o,r.on("connect",()=>{r[rV]=Math.min(this[XSe],r[rV]+this[kSe])}),r.on("c
onnectionError",()=>{r[rV]=Math.max(1,r[rV]-this[kSe]),this._updateBalancedPo
olStats()}),r.on("disconnect",(...o)=>{let
s=o[2];s&&s.code==="UND_ERR_SOCKET"&&(r[rV]=Math.max(1,r[rV]-this[kSe]),this.
_updateBalancedPoolStats())});for(let o of this[SZ])o[rV]=this[XSe];return
this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let
e=0;for(let n=0;n<this[SZ].length;n++)e=sio(this[SZ][n][rV],e);this[MIn]=e}re
moveUpstream(e){let n=_In(e).origin,r=this[SZ].find(o=>o[ept].origin===n&&o.c
losed!==!0&&o.destroyed!==!0);return r&&thisnio,this}get
upstreams(){return this[SZ].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=
e[ept].origin)}rio{if(this[SZ].length===0)throw new
qso;if(!this[SZ].find(s=>!s[j0e]&&s.closed!==!0&&s.destroyed!==!0)||this[SZ].
map(s=>s[j0e]).reduce((s,l)=>s&&l,!0))return;let r=0,o=this[SZ].findIndex(s=>
!s[j0e]);for(;r++<this[SZ].length;){this[MK]=(this[MK]+1)%this[SZ].length;let
s=this[SZ][this[MK]];if(s[rV]>this[SZ][o][rV]&&!s[j0e]&&(o=this[MK]),this[MK
]===0&&(this[OK]=this[OK]-this[MIn],this[OK]<=0&&(this[OK]=this[XSe])),s[rV]>
=this[OK]&&!s[j0e])return s}return
this[OK]=this[SZ][o][rV],this[MK]=o,this[SZ][o]}};UIn.exports=tpt});var
UK=S((VAi,edn)=>{"use
strict";var{InvalidArgumentError:xSe,MaxOriginsReachedError:lio}=Ma(),{kClien
ts:oV,kRunning:zIn,kClose:aio,kDestroy:cio,kDispatch:Iio,kUrl:dio}=Ym(),uio=H
K(),mio=bse(),pio=_K(),hio=sa(),PIn=Symbol("onConnect"),jIn=Symbol("onDisconn
ect"),KIn=Symbol("onConnectionError"),qIn=Symbol("onDrain"),$In=Symbol("facto
ry"),npt=Symbol("options"),K0e=Symbol("origins");function bio(t,e){return
e&&e.connections===1?new pio(t,e):new mio(t,e)}var rpt=class extends
uio{constructor({factory:e=bio,maxOrigins:n=1/0,connect:r,...o}={}){if(typeof
e!="function")throw new xSe("factory must be a
function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new
xSe("connect must be a function or an object");if(typeof
n!="number"||Number.isNaN(n)||n<=0)throw new xSe("maxOrigins must be a number
greater than 0");super(),r&&typeof r!="function"&&(r={...r}),this[npt]={...h
io.deepClone(o),maxOrigins:n,connect:r},this[$In]=e,this[oV]=new
Map,this[K0e]=new Set,this[qIn]=(s,l)=>{this.emit("drain",s,[this,...l])},thi
s[PIn]=(s,l)=>{this.emit("connect",s,[this,...l])},this[jIn]=(s,l,a)=>{this.e
mit("disconnect",s,[this,...l],a)},this[KIn]=(s,l,a)=>{this.emit("connectionE
rror",s,[this,...l],a)}}getzIn{let e=0;for(let{dispatcher:n}of
this[oV].values())e+=n[zIn];return e}Iio{let r;if(e.origin&&(typeof
e.origin=="string"||e.origin instanceof URL))r=String(e.origin);else throw
new xSe("opts.origin must be a non-empty string or
URL.");if(this[K0e].size>=this[npt].maxOrigins&&!this[K0e].has(r))throw new
lio;let o=this[oV].get(r),s=o&&o.dispatcher;if(!s){let l=a=>{let
c=this[oV].get(r);c&&(a&&(c.count-=1),c.count<=0&&(this[oV].delete(r),c.dispa
tcher.close()),this[K0e].delete(r))};s=this$In.on("drai
n",this[qIn]).on("connect",(a,c)=>{let
I=this[oV].get(r);I&&(I.count+=1),thisPIn}).on("disconnect",(a,c,I)=>{
l(!0),thisjIn}).on("connectionError",(a,c,I)=>{l(!1),thisKIn}),this[oV].set(r,{count:0,dispatcher:s}),this[K0e].add(r)}return
s.dispatch(e,n)}aio{let e=[];for(let{dispatcher:n}of
this[oV].values())e.push(n.close());return
this[oV].clear(),Promise.all(e)}cio{let n=[];for(let{dispatcher:r}of
this[oV].values())n.push(r.destroy(e));return
this[oV].clear(),Promise.all(n)}get stats(){let e={};for(let{dispatcher:n}of
this[oV].values())n.stats&&(e[n[dio].origin]=n.stats);return
e}};edn.exports=rpt});var apt=S((FAi,ddn)=>{"use
strict";var{kProxy:opt,kClose:idn,kDestroy:ldn,kDispatch:tdn}=Ym(),Gio=UK(),a
dn=bse(),cdn=HK(),{InvalidArgumentError:Gse,RequestAbortedError:gio,SecurePro
xyConnectionError:Aio}=Ma(),ndn=V0e(),Idn=_K(),SSe=Symbol("proxy
agent"),LSe=Symbol("proxy client"),oM=Symbol("proxy
headers"),spt=Symbol("request tls settings"),rdn=Symbol("proxy tls
settings"),odn=Symbol("connect endpoint function"),sdn=Symbol("tunnel
proxy");function fio(t){return t==="https:"?443:80}function yio(t,e){return
new adn(t,e)}var Nio=()=>{};function Zio(t,e){return e.connections===1?new
Idn(t,e):new adn(t,e)}var ipt=class extends
cdn{#e;constructor(e,{headers:n={},connect:r,factory:o}){if(!e)throw new
Gse("Proxy URL is
mandatory");super(),this[oM]=n,o?this.#e=o(e,{connect:r}):this.#e=new
Idn(e,{connect:r})}tdn{let
r=n.onHeaders;n.onHeaders=function(a,c,I){if(a===407){typeof
n.onError=="function"&&n.onError(new Gse("Proxy Authentication Required
(407)"));return}r&&r.call(this,a,c,I)};let{origin:o,path:s="/",headers:l={}}=
e;if(e.path=o+s,!("host"in l)&&!("Host"in l)){let{host:a}=new
URL(o);l.host=a}return
e.headers={...this[oM],...l},this.#etdn}idn{return
this.#e.close()}ldn{return this.#e.destroy(e)}},lpt=class extends
cdn{constructor(e){if(!e||typeof e=="object"&&!(e instanceof
URL)&&!e.uri)throw new Gse("Proxy uri is
mandatory");let{clientFactory:n=yio}=e;if(typeof n!="function")throw new
Gse("Proxy opts.clientFactory must be a
function.");let{proxyTunnel:r=!0}=e;super();let
o=this.#e(e),{href:s,origin:l,port:a,protocol:c,username:I,password:d,hostnam
e:u}=o;if(this[opt]={uri:s,protocol:c},this[spt]=e.requestTls,this[rdn]=e.pro
xyTls,this[oM]=e.headers||{},this[sdn]=r,e.auth&&e.token)throw new
Gse("opts.auth cannot be used in combination with
opts.token");e.auth?this[oM]["proxy-authorization"]=Basic ${e.auth}:e.token?this[oM]["proxy-authorization"]=e.token:I&&d&&(this[oM]["p
roxy-authorization"]=Basic ${Buffer.from(${decodeURIComponent(I)}:${decodeURIComponent(d)}`)
✗ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
q3(t[D0e]===0);return}if(t[eM]&&!t[_0e]){t[eM](),t[eM]=null;return}if(t[ig]
&&t[ig].resume(),t[Jmt])t[tM]=2;else if(t[tM]===2){e?(t[tM]=1,queueMicrotask(
()=>ZIn(t))):ZIn(t);continue}if(t[D0e]===0||t[U0e]>=(WIn(t)||1))return;let
n=t[ZH][t[EH]];if(t[lx].protocol==="https:"&&t[rM]!==n.servername){if(t[U0e]>
0)return;t[rM]=n.servername,t[ig]?.destroy(new cso("servername
changed"),()=>{t[ig]=null,_mt(t)})}if(t[hse])return;if(!t[ig]){wIn(t);return}
if(t[ig].destroyed||t[ig].busy(n))return;!n.aborted&&t[ig].write(n)?t[EH]++:t
[ZH].splice(t[EH],1)}}vIn.exports=Tmt});var Omt=S((wAi,CIn)=>{"use
strict";var VSe=class{bottom=0;top=0;list=new Array(2048).fill(void
0);next=null;isEmpty(){return
this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e)
{this.list[this.top]=e,this.top=this.top+1&2047}shift(){let
e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void
0,this.bottom=this.bottom+1&2047,e)}};CIn.exports=class{constructor(){this.he
ad=this.tail=new VSe}isEmpty(){return
this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new
VSe),this.head.push(e)}shift(){let e=this.tail,n=e.shift();return
e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),n}}});var
jmt=S((vAi,SIn)=>{"use strict";var{PoolStats:Xso}=jut(),kso=HK(),xso=Omt(),{k
Connected:Mmt,kSize:YIn,kRunning:VIn,kPending:FIn,kQueued:z0e,kBusy:Sso,kFree
:Lso,kUrl:Jso,kClose:Bso,kDestroy:Tso,kDispatch:_so}=Ym(),bA=Symbol("clients"
),HW=Symbol("needDrain"),P0e=Symbol("queue"),Umt=Symbol("closed
resolve"),Dmt=Symbol("onDrain"),QIn=Symbol("onConnect"),HIn=Symbol("onDisconn
ect"),XIn=Symbol("onConnectionError"),zmt=Symbol("get
dispatcher"),kIn=Symbol("add client"),xIn=Symbol("remove client"),Pmt=class
extends kso{[P0e]=new xso;[z0e]=0;[bA]=[];[HW]=!1;Dmt{let
o=this[P0e],s=!1;for(;!s;){let l=o.shift();if(!l)break;this[z0e]--,s=!e.dispa
tch(l.opts,l.handler)}if(e[HW]=s,!s&&this[HW]&&(this[HW]=!1,this.emit("drain"
,n,[this,...r])),this[Umt]&&o.isEmpty()){let l=new
Array(this[bA].length);for(let a=0;a<this[bA].length;a++)l[a]=this[bA][a].clo
se();Promise.all(l).then(this[Umt])}}[QIn]=(e,n)=>{this.emit("connect",e,[thi
s,...n])};[HIn]=(e,n,r)=>{this.emit("disconnect",e,[this,...n],r)};[XIn]=(e,n
,r)=>{this.emit("connectionError",e,[this,...n],r)};getSso{return
this[HW]}getMmt{let e=0;for(let{[Mmt]:n}of this[bA])e+=n;return
e}getLso{let e=0;for(let{[Mmt]:n,[HW]:r}of this[bA])e+=n&&!r;return
e}getFIn{let e=this[z0e];for(let{[FIn]:n}of this[bA])e+=n;return
e}getVIn{let e=0;for(let{[VIn]:n}of this[bA])e+=n;return e}getYIn{let
e=this[z0e];for(let{[YIn]:n}of this[bA])e+=n;return e}get stats(){return new
Xso(this)}Bso{if(this[P0e].isEmpty()){let e=new
Array(this[bA].length);for(let
n=0;n<this[bA].length;n++)e[n]=this[bA][n].close();return Promise.all(e)}else
return new Promise(e=>{this[Umt]=e})}Tso{for(;;){let
r=this[P0e].shift();if(!r)break;r.handler.onError(e)}let n=new
Array(this[bA].length);for(let
r=0;r<this[bA].length;r++)n[r]=this[bA][r].destroy(e);return
Promise.all(n)}_so{let r=thiszmt;return
r?r.dispatch(e,n)||(r[HW]=!0,this[HW]=!thiszmt):(this[HW]=!0,this[P0e].pu
sh({opts:e,handler:n}),this[z0e]++),!this[HW]}kIn{return e.on("drain",th
is[Dmt].bind(this,e)).on("connect",this[QIn]).on("disconnect",this[HIn]).on("
connectionError",this[XIn]),this[bA].push(e),this[HW]&&queueMicrotask(()=>{th
is[HW]&&thisDmt}),this}xIn{e.close(()=>{let n=this[
bA].indexOf(e);n!==-1&&this[bA].splice(n,1)}),this[HW]=this[bA].some(n=>!n[HW
]&&n.closed!==!0&&n.destroyed!==!0)}};SIn.exports={PoolBase:Pmt,kClients:bA,k
NeedDrain:HW,kAddClient:kIn,kRemoveClient:xIn,kGetDispatcher:zmt}});var
bse=S((CAi,TIn)=>{"use strict";var{PoolBase:Oso,kClients:FSe,kNeedDrain:Mso,k
AddClient:Uso,kGetDispatcher:Dso,kRemoveClient:zso}=jmt(),Pso=_K(),{InvalidAr
gumentError:Kmt}=Ma(),LIn=sa(),{kUrl:JIn}=Ym(),jso=V0e(),QSe=Symbol("options"
),qmt=Symbol("connections"),BIn=Symbol("factory");function Kso(t,e){return
new Pso(t,e)}var $mt=class extends Oso{constructor(e,{connections:n,factory:r
=Kso,connect:o,connectTimeout:s,tls:l,maxCachedSessions:a,socketPath:c,autoSe
lectFamily:I,autoSelectFamilyAttemptTimeout:d,allowH2:u,clientTtl:m,...p}={})
{if(n!=null&&(!Number.isFinite(n)||n<0))throw new Kmt("invalid
connections");if(typeof r!="function")throw new Kmt("factory must be a
function.");if(o!=null&&typeof o!="function"&&typeof o!="object")throw new
Kmt("connect must be a function or an object");typeof o!="function"&&(o=jso({
...l,maxCachedSessions:a,allowH2:u,socketPath:c,timeout:s,...typeof
I=="boolean"?{autoSelectFamily:I,autoSelectFamilyAttemptTimeout:d}:void
0,...o})),super(),this[qmt]=n||null,this[JIn]=LIn.parseOrigin(e),this[QSe]={.
..LIn.deepClone(p),connect:o,allowH2:u,clientTtl:m},this[QSe].interceptors=p.
interceptors?{...p.interceptors}:void
0,this[BIn]=r,this.on("connect",(h,G)=>{if(m!=null&&m>0)for(let g of G)Object
.assign(g,{ttl:Date.now()})}),this.on("connectionError",(h,G,g)=>{for(let f
of G){let N=this[FSe].indexOf(f);N!==-1&&this[FSe].splice(N,1)}})}Dso{let
e=this[QSe].clientTtl;for(let n of
this[FSe])if(e!=null&&e>0&&n.ttl&&Date.now()-n.ttl>e)thiszso;else
if(!n[Mso])return n;if(!this[qmt]||this[FSe].length<this[qmt]){let
n=thisBIn;return
thisUso,n}}};TIn.exports=$mt});var DIn=S((YAi,UIn)=>{"use
strict";var{BalancedPoolMissingUpstreamError:qso,InvalidArgumentError:$so}=Ma
(),{PoolBase:eio,kClients:SZ,kNeedDrain:j0e,kAddClient:tio,kRemoveClient:nio,
kGetDispatcher:rio}=jmt(),oio=bse(),{kUrl:ept}=Ym(),{parseOrigin:_In}=sa(),OI
n=Symbol("factory"),HSe=Symbol("options"),MIn=Symbol("kGreatestCommonDivisor"
),OK=Symbol("kCurrentWeight"),MK=Symbol("kIndex"),rV=Symbol("kWeight"),XSe=Sy
mbol("kMaxWeightPerServer"),kSe=Symbol("kErrorPenalty");function
sio(t,e){if(t===0)return e;for(;e!==0;){let n=e;e=t%e,t=n}return t}function
iio(t,e){return new oio(t,e)}var tpt=class extends
eio{constructor(e=[],{factory:n=iio,...r}={}){if(typeof n!="function")throw
new $so("factory must be a function.");super(),this[HSe]=r,this[MK]=-1,this[O
K]=0,this[XSe]=this[HSe].maxWeightPerServer||100,this[kSe]=this[HSe].errorPen
alty||15,Array.isArray(e)||(e=[e]),this[OIn]=n;for(let o of
e)this.addUpstream(o);this._updateBalancedPoolStats()}addUpstream(e){let
n=_In(e).origin;if(this[SZ].find(o=>o[ept].origin===n&&o.closed!==!0&&o.destr
oyed!==!0))return this;let r=thisOIn;thisti
o,r.on("connect",()=>{r[rV]=Math.min(this[XSe],r[rV]+this[kSe])}),r.on("c
onnectionError",()=>{r[rV]=Math.max(1,r[rV]-this[kSe]),this._updateBalancedPo
olStats()}),r.on("disconnect",(...o)=>{let
s=o[2];s&&s.code==="UND_ERR_SOCKET"&&(r[rV]=Math.max(1,r[rV]-this[kSe]),this.
_updateBalancedPoolStats())});for(let o of this[SZ])o[rV]=this[XSe];return
this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let
e=0;for(let n=0;n<this[SZ].length;n++)e=sio(this[SZ][n][rV],e);this[MIn]=e}re
moveUpstream(e){let n=_In(e).origin,r=this[SZ].find(o=>o[ept].origin===n&&o.c
losed!==!0&&o.destroyed!==!0);return r&&thisnio,this}get
upstreams(){return this[SZ].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=
e[ept].origin)}rio{if(this[SZ].length===0)throw new
qso;if(!this[SZ].find(s=>!s[j0e]&&s.closed!==!0&&s.destroyed!==!0)||this[SZ].
map(s=>s[j0e]).reduce((s,l)=>s&&l,!0))return;let r=0,o=this[SZ].findIndex(s=>
!s[j0e]);for(;r++<this[SZ].length;){this[MK]=(this[MK]+1)%this[SZ].length;let
s=this[SZ][this[MK]];if(s[rV]>this[SZ][o][rV]&&!s[j0e]&&(o=this[MK]),this[MK
]===0&&(this[OK]=this[OK]-this[MIn],this[OK]<=0&&(this[OK]=this[XSe])),s[rV]>
=this[OK]&&!s[j0e])return s}return
this[OK]=this[SZ][o][rV],this[MK]=o,this[SZ][o]}};UIn.exports=tpt});var
UK=S((VAi,edn)=>{"use
strict";var{InvalidArgumentError:xSe,MaxOriginsReachedError:lio}=Ma(),{kClien
ts:oV,kRunning:zIn,kClose:aio,kDestroy:cio,kDispatch:Iio,kUrl:dio}=Ym(),uio=H
K(),mio=bse(),pio=_K(),hio=sa(),PIn=Symbol("onConnect"),jIn=Symbol("onDisconn
ect"),KIn=Symbol("onConnectionError"),qIn=Symbol("onDrain"),$In=Symbol("facto
ry"),npt=Symbol("options"),K0e=Symbol("origins");function bio(t,e){return
e&&e.connections===1?new pio(t,e):new mio(t,e)}var rpt=class extends
uio{constructor({factory:e=bio,maxOrigins:n=1/0,connect:r,...o}={}){if(typeof
e!="function")throw new xSe("factory must be a
function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new
xSe("connect must be a function or an object");if(typeof
n!="number"||Number.isNaN(n)||n<=0)throw new xSe("maxOrigins must be a number
greater than 0");super(),r&&typeof r!="function"&&(r={...r}),this[npt]={...h
io.deepClone(o),maxOrigins:n,connect:r},this[$In]=e,this[oV]=new
Map,this[K0e]=new Set,this[qIn]=(s,l)=>{this.emit("drain",s,[this,...l])},thi
s[PIn]=(s,l)=>{this.emit("connect",s,[this,...l])},this[jIn]=(s,l,a)=>{this.e
mit("disconnect",s,[this,...l],a)},this[KIn]=(s,l,a)=>{this.emit("connectionE
rror",s,[this,...l],a)}}getzIn{let e=0;for(let{dispatcher:n}of
this[oV].values())e+=n[zIn];return e}Iio{let r;if(e.origin&&(typeof
e.origin=="string"||e.origin instanceof URL))r=String(e.origin);else throw
new xSe("opts.origin must be a non-empty string or
URL.");if(this[K0e].size>=this[npt].maxOrigins&&!this[K0e].has(r))throw new
lio;let o=this[oV].get(r),s=o&&o.dispatcher;if(!s){let l=a=>{let
c=this[oV].get(r);c&&(a&&(c.count-=1),c.count<=0&&(this[oV].delete(r),c.dispa
tcher.close()),this[K0e].delete(r))};s=this$In.on("drai
n",this[qIn]).on("connect",(a,c)=>{let
I=this[oV].get(r);I&&(I.count+=1),thisPIn}).on("disconnect",(a,c,I)=>{
l(!0),thisjIn}).on("connectionError",(a,c,I)=>{l(!1),thisKIn}),this[oV].set(r,{count:0,dispatcher:s}),this[K0e].add(r)}return
s.dispatch(e,n)}aio{let e=[];for(let{dispatcher:n}of
this[oV].values())e.push(n.close());return
this[oV].clear(),Promise.all(e)}cio{let n=[];for(let{dispatcher:r}of
this[oV].values())n.push(r.destroy(e));return
this[oV].clear(),Promise.all(n)}get stats(){let e={};for(let{dispatcher:n}of
this[oV].values())n.stats&&(e[n[dio].origin]=n.stats);return
e}};edn.exports=rpt});var apt=S((FAi,ddn)=>{"use
strict";var{kProxy:opt,kClose:idn,kDestroy:ldn,kDispatch:tdn}=Ym(),Gio=UK(),a
dn=bse(),cdn=HK(),{InvalidArgumentError:Gse,RequestAbortedError:gio,SecurePro
xyConnectionError:Aio}=Ma(),ndn=V0e(),Idn=_K(),SSe=Symbol("proxy
agent"),LSe=Symbol("proxy client"),oM=Symbol("proxy
headers"),spt=Symbol("request tls settings"),rdn=Symbol("proxy tls
settings"),odn=Symbol("connect endpoint function"),sdn=Symbol("tunnel
proxy");function fio(t){return t==="https:"?443:80}function yio(t,e){return
new adn(t,e)}var Nio=()=>{};function Zio(t,e){return e.connections===1?new
Idn(t,e):new adn(t,e)}var ipt=class extends
cdn{#e;constructor(e,{headers:n={},connect:r,factory:o}){if(!e)throw new
Gse("Proxy URL is
mandatory");super(),this[oM]=n,o?this.#e=o(e,{connect:r}):this.#e=new
Idn(e,{connect:r})}tdn{let
r=n.onHeaders;n.onHeaders=function(a,c,I){if(a===407){typeof
n.onError=="function"&&n.onError(new Gse("Proxy Authentication Required
(407)"));return}r&&r.call(this,a,c,I)};let{origin:o,path:s="/",headers:l={}}=
e;if(e.path=o+s,!("host"in l)&&!("Host"in l)){let{host:a}=new
URL(o);l.host=a}return
e.headers={...this[oM],...l},this.#etdn}idn{return
this.#e.close()}ldn{return this.#e.destroy(e)}},lpt=class extends
cdn{constructor(e){if(!e||typeof e=="object"&&!(e instanceof
URL)&&!e.uri)throw new Gse("Proxy uri is
mandatory");let{clientFactory:n=yio}=e;if(typeof n!="function")throw new
Gse("Proxy opts.clientFactory must be a
function.");let{proxyTunnel:r=!0}=e;super();let
o=this.#e(e),{href:s,origin:l,port:a,protocol:c,username:I,password:d,hostnam
e:u}=o;if(this[opt]={uri:s,protocol:c},this[spt]=e.requestTls,this[rdn]=e.pro
xyTls,this[oM]=e.headers||{},this[sdn]=r,e.auth&&e.token)throw new
Gse("opts.auth cannot be used in combination with
opts.token");e.auth?this[oM]["proxy-authorization"]=Basic ${e.auth}:e.token?this[oM]["proxy-authorization"]=e.token:I&&d&&(this[oM]["p
roxy-authorization"]=Basic ${Buffer.from(${decodeURIComponent(I)}:${decodeURIComponent(d)}`)
✗ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
q3(t[D0e]===0);return}if(t[eM]&&!t[_0e]){t[eM](),t[eM]=null;return}if(t[ig]
&&t[ig].resume(),t[Jmt])t[tM]=2;else if(t[tM]===2){e?(t[tM]=1,queueMicrotask(
()=>ZIn(t))):ZIn(t);continue}if(t[D0e]===0||t[U0e]>=(WIn(t)||1))return;let
n=t[ZH][t[EH]];if(t[lx].protocol==="https:"&&t[rM]!==n.servername){if(t[U0e]>
0)return;t[rM]=n.servername,t[ig]?.destroy(new cso("servername
changed"),()=>{t[ig]=null,_mt(t)})}if(t[hse])return;if(!t[ig]){wIn(t);return}
if(t[ig].destroyed||t[ig].busy(n))return;!n.aborted&&t[ig].write(n)?t[EH]++:t
[ZH].splice(t[EH],1)}}vIn.exports=Tmt});var Omt=S((wAi,CIn)=>{"use
strict";var VSe=class{bottom=0;top=0;list=new Array(2048).fill(void
0);next=null;isEmpty(){return
this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e)
{this.list[this.top]=e,this.top=this.top+1&2047}shift(){let
e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void
0,this.bottom=this.bottom+1&2047,e)}};CIn.exports=class{constructor(){this.he
ad=this.tail=new VSe}isEmpty(){return
this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new
VSe),this.head.push(e)}shift(){let e=this.tail,n=e.shift();return
e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),n}}});var
jmt=S((vAi,SIn)=>{"use strict";var{PoolStats:Xso}=jut(),kso=HK(),xso=Omt(),{k
Connected:Mmt,kSize:YIn,kRunning:VIn,kPending:FIn,kQueued:z0e,kBusy:Sso,kFree
:Lso,kUrl:Jso,kClose:Bso,kDestroy:Tso,kDispatch:_so}=Ym(),bA=Symbol("clients"
),HW=Symbol("needDrain"),P0e=Symbol("queue"),Umt=Symbol("closed
resolve"),Dmt=Symbol("onDrain"),QIn=Symbol("onConnect"),HIn=Symbol("onDisconn
ect"),XIn=Symbol("onConnectionError"),zmt=Symbol("get
dispatcher"),kIn=Symbol("add client"),xIn=Symbol("remove client"),Pmt=class
extends kso{[P0e]=new xso;[z0e]=0;[bA]=[];[HW]=!1;Dmt{let
o=this[P0e],s=!1;for(;!s;){let l=o.shift();if(!l)break;this[z0e]--,s=!e.dispa
tch(l.opts,l.handler)}if(e[HW]=s,!s&&this[HW]&&(this[HW]=!1,this.emit("drain"
,n,[this,...r])),this[Umt]&&o.isEmpty()){let l=new
Array(this[bA].length);for(let a=0;a<this[bA].length;a++)l[a]=this[bA][a].clo
se();Promise.all(l).then(this[Umt])}}[QIn]=(e,n)=>{this.emit("connect",e,[thi
s,...n])};[HIn]=(e,n,r)=>{this.emit("disconnect",e,[this,...n],r)};[XIn]=(e,n
,r)=>{this.emit("connectionError",e,[this,...n],r)};getSso{return
this[HW]}getMmt{let e=0;for(let{[Mmt]:n}of this[bA])e+=n;return
e}getLso{let e=0;for(let{[Mmt]:n,[HW]:r}of this[bA])e+=n&&!r;return
e}getFIn{let e=this[z0e];for(let{[FIn]:n}of this[bA])e+=n;return
e}getVIn{let e=0;for(let{[VIn]:n}of this[bA])e+=n;return e}getYIn{let
e=this[z0e];for(let{[YIn]:n}of this[bA])e+=n;return e}get stats(){return new
Xso(this)}Bso{if(this[P0e].isEmpty()){let e=new
Array(this[bA].length);for(let
n=0;n<this[bA].length;n++)e[n]=this[bA][n].close();return Promise.all(e)}else
return new Promise(e=>{this[Umt]=e})}Tso{for(;;){let
r=this[P0e].shift();if(!r)break;r.handler.onError(e)}let n=new
Array(this[bA].length);for(let
r=0;r<this[bA].length;r++)n[r]=this[bA][r].destroy(e);return
Promise.all(n)}_so{let r=thiszmt;return
r?r.dispatch(e,n)||(r[HW]=!0,this[HW]=!thiszmt):(this[HW]=!0,this[P0e].pu
sh({opts:e,handler:n}),this[z0e]++),!this[HW]}kIn{return e.on("drain",th
is[Dmt].bind(this,e)).on("connect",this[QIn]).on("disconnect",this[HIn]).on("
connectionError",this[XIn]),this[bA].push(e),this[HW]&&queueMicrotask(()=>{th
is[HW]&&thisDmt}),this}xIn{e.close(()=>{let n=this[
bA].indexOf(e);n!==-1&&this[bA].splice(n,1)}),this[HW]=this[bA].some(n=>!n[HW
]&&n.closed!==!0&&n.destroyed!==!0)}};SIn.exports={PoolBase:Pmt,kClients:bA,k
NeedDrain:HW,kAddClient:kIn,kRemoveClient:xIn,kGetDispatcher:zmt}});var
bse=S((CAi,TIn)=>{"use strict";var{PoolBase:Oso,kClients:FSe,kNeedDrain:Mso,k
AddClient:Uso,kGetDispatcher:Dso,kRemoveClient:zso}=jmt(),Pso=_K(),{InvalidAr
gumentError:Kmt}=Ma(),LIn=sa(),{kUrl:JIn}=Ym(),jso=V0e(),QSe=Symbol("options"
),qmt=Symbol("connections"),BIn=Symbol("factory");function Kso(t,e){return
new Pso(t,e)}var $mt=class extends Oso{constructor(e,{connections:n,factory:r
=Kso,connect:o,connectTimeout:s,tls:l,maxCachedSessions:a,socketPath:c,autoSe
lectFamily:I,autoSelectFamilyAttemptTimeout:d,allowH2:u,clientTtl:m,...p}={})
{if(n!=null&&(!Number.isFinite(n)||n<0))throw new Kmt("invalid
connections");if(typeof r!="function")throw new Kmt("factory must be a
function.");if(o!=null&&typeof o!="function"&&typeof o!="object")throw new
Kmt("connect must be a function or an object");typeof o!="function"&&(o=jso({
...l,maxCachedSessions:a,allowH2:u,socketPath:c,timeout:s,...typeof
I=="boolean"?{autoSelectFamily:I,autoSelectFamilyAttemptTimeout:d}:void
0,...o})),super(),this[qmt]=n||null,this[JIn]=LIn.parseOrigin(e),this[QSe]={.
..LIn.deepClone(p),connect:o,allowH2:u,clientTtl:m},this[QSe].interceptors=p.
interceptors?{...p.interceptors}:void
0,this[BIn]=r,this.on("connect",(h,G)=>{if(m!=null&&m>0)for(let g of G)Object
.assign(g,{ttl:Date.now()})}),this.on("connectionError",(h,G,g)=>{for(let f
of G){let N=this[FSe].indexOf(f);N!==-1&&this[FSe].splice(N,1)}})}Dso{let
e=this[QSe].clientTtl;for(let n of
this[FSe])if(e!=null&&e>0&&n.ttl&&Date.now()-n.ttl>e)thiszso;else
if(!n[Mso])return n;if(!this[qmt]||this[FSe].length<this[qmt]){let
n=thisBIn;return
thisUso,n}}};TIn.exports=$mt});var DIn=S((YAi,UIn)=>{"use
strict";var{BalancedPoolMissingUpstreamError:qso,InvalidArgumentError:$so}=Ma
(),{PoolBase:eio,kClients:SZ,kNeedDrain:j0e,kAddClient:tio,kRemoveClient:nio,
kGetDispatcher:rio}=jmt(),oio=bse(),{kUrl:ept}=Ym(),{parseOrigin:_In}=sa(),OI
n=Symbol("factory"),HSe=Symbol("options"),MIn=Symbol("kGreatestCommonDivisor"
),OK=Symbol("kCurrentWeight"),MK=Symbol("kIndex"),rV=Symbol("kWeight"),XSe=Sy
mbol("kMaxWeightPerServer"),kSe=Symbol("kErrorPenalty");function
sio(t,e){if(t===0)return e;for(;e!==0;){let n=e;e=t%e,t=n}return t}function
iio(t,e){return new oio(t,e)}var tpt=class extends
eio{constructor(e=[],{factory:n=iio,...r}={}){if(typeof n!="function")throw
new $so("factory must be a function.");super(),this[HSe]=r,this[MK]=-1,this[O
K]=0,this[XSe]=this[HSe].maxWeightPerServer||100,this[kSe]=this[HSe].errorPen
alty||15,Array.isArray(e)||(e=[e]),this[OIn]=n;for(let o of
e)this.addUpstream(o);this._updateBalancedPoolStats()}addUpstream(e){let
n=_In(e).origin;if(this[SZ].find(o=>o[ept].origin===n&&o.closed!==!0&&o.destr
oyed!==!0))return this;let r=thisOIn;thisti
o,r.on("connect",()=>{r[rV]=Math.min(this[XSe],r[rV]+this[kSe])}),r.on("c
onnectionError",()=>{r[rV]=Math.max(1,r[rV]-this[kSe]),this._updateBalancedPo
olStats()}),r.on("disconnect",(...o)=>{let
s=o[2];s&&s.code==="UND_ERR_SOCKET"&&(r[rV]=Math.max(1,r[rV]-this[kSe]),this.
_updateBalancedPoolStats())});for(let o of this[SZ])o[rV]=this[XSe];return
this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let
e=0;for(let n=0;n<this[SZ].length;n++)e=sio(this[SZ][n][rV],e);this[MIn]=e}re
moveUpstream(e){let n=_In(e).origin,r=this[SZ].find(o=>o[ept].origin===n&&o.c
losed!==!0&&o.destroyed!==!0);return r&&thisnio,this}get
upstreams(){return this[SZ].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=
e[ept].origin)}rio{if(this[SZ].length===0)throw new
qso;if(!this[SZ].find(s=>!s[j0e]&&s.closed!==!0&&s.destroyed!==!0)||this[SZ].
map(s=>s[j0e]).reduce((s,l)=>s&&l,!0))return;let r=0,o=this[SZ].findIndex(s=>
!s[j0e]);for(;r++<this[SZ].length;){this[MK]=(this[MK]+1)%this[SZ].length;let
s=this[SZ][this[MK]];if(s[rV]>this[SZ][o][rV]&&!s[j0e]&&(o=this[MK]),this[MK
]===0&&(this[OK]=this[OK]-this[MIn],this[OK]<=0&&(this[OK]=this[XSe])),s[rV]>
=this[OK]&&!s[j0e])return s}return
this[OK]=this[SZ][o][rV],this[MK]=o,this[SZ][o]}};UIn.exports=tpt});var
UK=S((VAi,edn)=>{"use
strict";var{InvalidArgumentError:xSe,MaxOriginsReachedError:lio}=Ma(),{kClien
ts:oV,kRunning:zIn,kClose:aio,kDestroy:cio,kDispatch:Iio,kUrl:dio}=Ym(),uio=H
K(),mio=bse(),pio=_K(),hio=sa(),PIn=Symbol("onConnect"),jIn=Symbol("onDisconn
ect"),KIn=Symbol("onConnectionError"),qIn=Symbol("onDrain"),$In=Symbol("facto
ry"),npt=Symbol("options"),K0e=Symbol("origins");function bio(t,e){return
e&&e.connections===1?new pio(t,e):new mio(t,e)}var rpt=class extends
uio{constructor({factory:e=bio,maxOrigins:n=1/0,connect:r,...o}={}){if(typeof
e!="function")throw new xSe("factory must be a
function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new
xSe("connect must be a function or an object");if(typeof
n!="number"||Number.isNaN(n)||n<=0)throw new xSe("maxOrigins must be a number
greater than 0");super(),r&&typeof r!="function"&&(r={...r}),this[npt]={...h
io.deepClone(o),maxOrigins:n,connect:r},this[$In]=e,this[oV]=new
Map,this[K0e]=new Set,this[qIn]=(s,l)=>{this.emit("drain",s,[this,...l])},thi
s[PIn]=(s,l)=>{this.emit("connect",s,[this,...l])},this[jIn]=(s,l,a)=>{this.e
mit("disconnect",s,[this,...l],a)},this[KIn]=(s,l,a)=>{this.emit("connectionE
rror",s,[this,...l],a)}}getzIn{let e=0;for(let{dispatcher:n}of
this[oV].values())e+=n[zIn];return e}Iio{let r;if(e.origin&&(typeof
e.origin=="string"||e.origin instanceof URL))r=String(e.origin);else throw
new xSe("opts.origin must be a non-empty string or
URL.");if(this[K0e].size>=this[npt].maxOrigins&&!this[K0e].has(r))throw new
lio;let o=this[oV].get(r),s=o&&o.dispatcher;if(!s){let l=a=>{let
c=this[oV].get(r);c&&(a&&(c.count-=1),c.count<=0&&(this[oV].delete(r),c.dispa
tcher.close()),this[K0e].delete(r))};s=this$In.on("drai
n",this[qIn]).on("connect",(a,c)=>{let
I=this[oV].get(r);I&&(I.count+=1),thisPIn}).on("disconnect",(a,c,I)=>{
l(!0),thisjIn}).on("connectionError",(a,c,I)=>{l(!1),thisKIn}),this[oV].set(r,{count:0,dispatcher:s}),this[K0e].add(r)}return
s.dispatch(e,n)}aio{let e=[];for(let{dispatcher:n}of
this[oV].values())e.push(n.close());return
this[oV].clear(),Promise.all(e)}cio{let n=[];for(let{dispatcher:r}of
this[oV].values())n.push(r.destroy(e));return
this[oV].clear(),Promise.all(n)}get stats(){let e={};for(let{dispatcher:n}of
this[oV].values())n.stats&&(e[n[dio].origin]=n.stats);return
e}};edn.exports=rpt});var apt=S((FAi,ddn)=>{"use
strict";var{kProxy:opt,kClose:idn,kDestroy:ldn,kDispatch:tdn}=Ym(),Gio=UK(),a
dn=bse(),cdn=HK(),{InvalidArgumentError:Gse,RequestAbortedError:gio,SecurePro
xyConnectionError:Aio}=Ma(),ndn=V0e(),Idn=_K(),SSe=Symbol("proxy
agent"),LSe=Symbol("proxy client"),oM=Symbol("proxy
headers"),spt=Symbol("request tls settings"),rdn=Symbol("proxy tls
settings"),odn=Symbol("connect endpoint function"),sdn=Symbol("tunnel
proxy");function fio(t){return t==="https:"?443:80}function yio(t,e){return
new adn(t,e)}var Nio=()=>{};function Zio(t,e){return e.connections===1?new
Idn(t,e):new adn(t,e)}var ipt=class extends
cdn{#e;constructor(e,{headers:n={},connect:r,factory:o}){if(!e)throw new
Gse("Proxy URL is
mandatory");super(),this[oM]=n,o?this.#e=o(e,{connect:r}):this.#e=new
Idn(e,{connect:r})}tdn{let
r=n.onHeaders;n.onHeaders=function(a,c,I){if(a===407){typeof
n.onError=="function"&&n.onError(new Gse("Proxy Authentication Required
(407)"));return}r&&r.call(this,a,c,I)};let{origin:o,path:s="/",headers:l={}}=
e;if(e.path=o+s,!("host"in l)&&!("Host"in l)){let{host:a}=new
URL(o);l.host=a}return
e.headers={...this[oM],...l},this.#etdn}idn{return
this.#e.close()}ldn{return this.#e.destroy(e)}},lpt=class extends
cdn{constructor(e){if(!e||typeof e=="object"&&!(e instanceof
URL)&&!e.uri)throw new Gse("Proxy uri is
mandatory");let{clientFactory:n=yio}=e;if(typeof n!="function")throw new
Gse("Proxy opts.clientFactory must be a
function.");let{proxyTunnel:r=!0}=e;super();let
o=this.#e(e),{href:s,origin:l,port:a,protocol:c,username:I,password:d,hostnam
e:u}=o;if(this[opt]={uri:s,protocol:c},this[spt]=e.requestTls,this[rdn]=e.pro
xyTls,this[oM]=e.headers||{},this[sdn]=r,e.auth&&e.token)throw new
Gse("opts.auth cannot be used in combination with
opts.token");e.auth?this[oM]["proxy-authorization"]=Basic ${e.auth}:e.token?this[oM]["proxy-authorization"]=e.token:I&&d&&(this[oM]["p
roxy-authorization"]=Basic ${Buffer.from(${decodeURIComponent(I)}:${decodeURIComponent(d)}`)
✗ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
q3(t[D0e]===0);return}if(t[eM]&&!t[_0e]){t[eM](),t[eM]=null;return}if(t[ig]
&&t[ig].resume(),t[Jmt])t[tM]=2;else if(t[tM]===2){e?(t[tM]=1,queueMicrotask(
()=>ZIn(t))):ZIn(t);continue}if(t[D0e]===0||t[U0e]>=(WIn(t)||1))return;let
n=t[ZH][t[EH]];if(t[lx].protocol==="https:"&&t[rM]!==n.servername){if(t[U0e]>
0)return;t[rM]=n.servername,t[ig]?.destroy(new cso("servername
changed"),()=>{t[ig]=null,_mt(t)})}if(t[hse])return;if(!t[ig]){wIn(t);return}
if(t[ig].destroyed||t[ig].busy(n))return;!n.aborted&&t[ig].write(n)?t[EH]++:t
[ZH].splice(t[EH],1)}}vIn.exports=Tmt});var Omt=S((wAi,CIn)=>{"use
strict";var VSe=class{bottom=0;top=0;list=new Array(2048).fill(void
0);next=null;isEmpty(){return
this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e)
{this.list[this.top]=e,this.top=this.top+1&2047}shift(){let
e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void
0,this.bottom=this.bottom+1&2047,e)}};CIn.exports=class{constructor(){this.he
ad=this.tail=new VSe}isEmpty(){return
this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new
VSe),this.head.push(e)}shift(){let e=this.tail,n=e.shift();return
e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),n}}});var
jmt=S((vAi,SIn)=>{"use strict";var{PoolStats:Xso}=jut(),kso=HK(),xso=Omt(),{k
Connected:Mmt,kSize:YIn,kRunning:VIn,kPending:FIn,kQueued:z0e,kBusy:Sso,kFree
:Lso,kUrl:Jso,kClose:Bso,kDestroy:Tso,kDispatch:_so}=Ym(),bA=Symbol("clients"
),HW=Symbol("needDrain"),P0e=Symbol("queue"),Umt=Symbol("closed
resolve"),Dmt=Symbol("onDrain"),QIn=Symbol("onConnect"),HIn=Symbol("onDisconn
ect"),XIn=Symbol("onConnectionError"),zmt=Symbol("get
dispatcher"),kIn=Symbol("add client"),xIn=Symbol("remove client"),Pmt=class
extends kso{[P0e]=new xso;[z0e]=0;[bA]=[];[HW]=!1;Dmt{let
o=this[P0e],s=!1;for(;!s;){let l=o.shift();if(!l)break;this[z0e]--,s=!e.dispa
tch(l.opts,l.handler)}if(e[HW]=s,!s&&this[HW]&&(this[HW]=!1,this.emit("drain"
,n,[this,...r])),this[Umt]&&o.isEmpty()){let l=new
Array(this[bA].length);for(let a=0;a<this[bA].length;a++)l[a]=this[bA][a].clo
se();Promise.all(l).then(this[Umt])}}[QIn]=(e,n)=>{this.emit("connect",e,[thi
s,...n])};[HIn]=(e,n,r)=>{this.emit("disconnect",e,[this,...n],r)};[XIn]=(e,n
,r)=>{this.emit("connectionError",e,[this,...n],r)};getSso{return
this[HW]}getMmt{let e=0;for(let{[Mmt]:n}of this[bA])e+=n;return
e}getLso{let e=0;for(let{[Mmt]:n,[HW]:r}of this[bA])e+=n&&!r;return
e}getFIn{let e=this[z0e];for(let{[FIn]:n}of this[bA])e+=n;return
e}getVIn{let e=0;for(let{[VIn]:n}of this[bA])e+=n;return e}getYIn{let
e=this[z0e];for(let{[YIn]:n}of this[bA])e+=n;return e}get stats(){return new
Xso(this)}Bso{if(this[P0e].isEmpty()){let e=new
Array(this[bA].length);for(let
n=0;n<this[bA].length;n++)e[n]=this[bA][n].close();return Promise.all(e)}else
return new Promise(e=>{this[Umt]=e})}Tso{for(;;){let
r=this[P0e].shift();if(!r)break;r.handler.onError(e)}let n=new
Array(this[bA].length);for(let
r=0;r<this[bA].length;r++)n[r]=this[bA][r].destroy(e);return
Promise.all(n)}_so{let r=thiszmt;return
r?r.dispatch(e,n)||(r[HW]=!0,this[HW]=!thiszmt):(this[HW]=!0,this[P0e].pu
sh({opts:e,handler:n}),this[z0e]++),!this[HW]}kIn{return e.on("drain",th
is[Dmt].bind(this,e)).on("connect",this[QIn]).on("disconnect",this[HIn]).on("
connectionError",this[XIn]),this[bA].push(e),this[HW]&&queueMicrotask(()=>{th
is[HW]&&thisDmt}),this}xIn{e.close(()=>{let n=this[
bA].indexOf(e);n!==-1&&this[bA].splice(n,1)}),this[HW]=this[bA].some(n=>!n[HW
]&&n.closed!==!0&&n.destroyed!==!0)}};SIn.exports={PoolBase:Pmt,kClients:bA,k
NeedDrain:HW,kAddClient:kIn,kRemoveClient:xIn,kGetDispatcher:zmt}});var
bse=S((CAi,TIn)=>{"use strict";var{PoolBase:Oso,kClients:FSe,kNeedDrain:Mso,k
AddClient:Uso,kGetDispatcher:Dso,kRemoveClient:zso}=jmt(),Pso=_K(),{InvalidAr
gumentError:Kmt}=Ma(),LIn=sa(),{kUrl:JIn}=Ym(),jso=V0e(),QSe=Symbol("options"
),qmt=Symbol("connections"),BIn=Symbol("factory");function Kso(t,e){return
new Pso(t,e)}var $mt=class extends Oso{constructor(e,{connections:n,factory:r
=Kso,connect:o,connectTimeout:s,tls:l,maxCachedSessions:a,socketPath:c,autoSe
lectFamily:I,autoSelectFamilyAttemptTimeout:d,allowH2:u,clientTtl:m,...p}={})
{if(n!=null&&(!Number.isFinite(n)||n<0))throw new Kmt("invalid
connections");if(typeof r!="function")throw new Kmt("factory must be a
function.");if(o!=null&&typeof o!="function"&&typeof o!="object")throw new
Kmt("connect must be a function or an object");typeof o!="function"&&(o=jso({
...l,maxCachedSessions:a,allowH2:u,socketPath:c,timeout:s,...typeof
I=="boolean"?{autoSelectFamily:I,autoSelectFamilyAttemptTimeout:d}:void
0,...o})),super(),this[qmt]=n||null,this[JIn]=LIn.parseOrigin(e),this[QSe]={.
..LIn.deepClone(p),connect:o,allowH2:u,clientTtl:m},this[QSe].interceptors=p.
interceptors?{...p.interceptors}:void
0,this[BIn]=r,this.on("connect",(h,G)=>{if(m!=null&&m>0)for(let g of G)Object
.assign(g,{ttl:Date.now()})}),this.on("connectionError",(h,G,g)=>{for(let f
of G){let N=this[FSe].indexOf(f);N!==-1&&this[FSe].splice(N,1)}})}Dso{let
e=this[QSe].clientTtl;for(let n of
this[FSe])if(e!=null&&e>0&&n.ttl&&Date.now()-n.ttl>e)thiszso;else
if(!n[Mso])return n;if(!this[qmt]||this[FSe].length<this[qmt]){let
n=thisBIn;return
thisUso,n}}};TIn.exports=$mt});var DIn=S((YAi,UIn)=>{"use
strict";var{BalancedPoolMissingUpstreamError:qso,InvalidArgumentError:$so}=Ma
(),{PoolBase:eio,kClients:SZ,kNeedDrain:j0e,kAddClient:tio,kRemoveClient:nio,
kGetDispatcher:rio}=jmt(),oio=bse(),{kUrl:ept}=Ym(),{parseOrigin:_In}=sa(),OI
n=Symbol("factory"),HSe=Symbol("options"),MIn=Symbol("kGreatestCommonDivisor"
),OK=Symbol("kCurrentWeight"),MK=Symbol("kIndex"),rV=Symbol("kWeight"),XSe=Sy
mbol("kMaxWeightPerServer"),kSe=Symbol("kErrorPenalty");function
sio(t,e){if(t===0)return e;for(;e!==0;){let n=e;e=t%e,t=n}return t}function
iio(t,e){return new oio(t,e)}var tpt=class extends
eio{constructor(e=[],{factory:n=iio,...r}={}){if(typeof n!="function")throw
new $so("factory must be a function.");super(),this[HSe]=r,this[MK]=-1,this[O
K]=0,this[XSe]=this[HSe].maxWeightPerServer||100,this[kSe]=this[HSe].errorPen
alty||15,Array.isArray(e)||(e=[e]),this[OIn]=n;for(let o of
e)this.addUpstream(o);this._updateBalancedPoolStats()}addUpstream(e){let
n=_In(e).origin;if(this[SZ].find(o=>o[ept].origin===n&&o.closed!==!0&&o.destr
oyed!==!0))return this;let r=thisOIn;thisti
o,r.on("connect",()=>{r[rV]=Math.min(this[XSe],r[rV]+this[kSe])}),r.on("c
onnectionError",()=>{r[rV]=Math.max(1,r[rV]-this[kSe]),this._updateBalancedPo
olStats()}),r.on("disconnect",(...o)=>{let
s=o[2];s&&s.code==="UND_ERR_SOCKET"&&(r[rV]=Math.max(1,r[rV]-this[kSe]),this.
_updateBalancedPoolStats())});for(let o of this[SZ])o[rV]=this[XSe];return
this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let
e=0;for(let n=0;n<this[SZ].length;n++)e=sio(this[SZ][n][rV],e);this[MIn]=e}re
moveUpstream(e){let n=_In(e).origin,r=this[SZ].find(o=>o[ept].origin===n&&o.c
losed!==!0&&o.destroyed!==!0);return r&&thisnio,this}get
upstreams(){return this[SZ].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=
e[ept].origin)}rio{if(this[SZ].length===0)throw new
qso;if(!this[SZ].find(s=>!s[j0e]&&s.closed!==!0&&s.destroyed!==!0)||this[SZ].
map(s=>s[j0e]).reduce((s,l)=>s&&l,!0))return;let r=0,o=this[SZ].findIndex(s=>
!s[j0e]);for(;r++<this[SZ].length;){this[MK]=(this[MK]+1)%this[SZ].length;let
s=this[SZ][this[MK]];if(s[rV]>this[SZ][o][rV]&&!s[j0e]&&(o=this[MK]),this[MK
]===0&&(this[OK]=this[OK]-this[MIn],this[OK]<=0&&(this[OK]=this[XSe])),s[rV]>
=this[OK]&&!s[j0e])return s}return
this[OK]=this[SZ][o][rV],this[MK]=o,this[SZ][o]}};UIn.exports=tpt});var
UK=S((VAi,edn)=>{"use
strict";var{InvalidArgumentError:xSe,MaxOriginsReachedError:lio}=Ma(),{kClien
ts:oV,kRunning:zIn,kClose:aio,kDestroy:cio,kDispatch:Iio,kUrl:dio}=Ym(),uio=H
K(),mio=bse(),pio=_K(),hio=sa(),PIn=Symbol("onConnect"),jIn=Symbol("onDisconn
ect"),KIn=Symbol("onConnectionError"),qIn=Symbol("onDrain"),$In=Symbol("facto
ry"),npt=Symbol("options"),K0e=Symbol("origins");function bio(t,e){return
e&&e.connections===1?new pio(t,e):new mio(t,e)}var rpt=class extends
uio{constructor({factory:e=bio,maxOrigins:n=1/0,connect:r,...o}={}){if(typeof
e!="function")throw new xSe("factory must be a
function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new
xSe("connect must be a function or an object");if(typeof
n!="number"||Number.isNaN(n)||n<=0)throw new xSe("maxOrigins must be a number
greater than 0");super(),r&&typeof r!="function"&&(r={...r}),this[npt]={...h
io.deepClone(o),maxOrigins:n,connect:r},this[$In]=e,this[oV]=new
Map,this[K0e]=new Set,this[qIn]=(s,l)=>{this.emit("drain",s,[this,...l])},thi
s[PIn]=(s,l)=>{this.emit("connect",s,[this,...l])},this[jIn]=(s,l,a)=>{this.e
mit("disconnect",s,[this,...l],a)},this[KIn]=(s,l,a)=>{this.emit("connectionE
rror",s,[this,...l],a)}}getzIn{let e=0;for(let{dispatcher:n}of
this[oV].values())e+=n[zIn];return e}Iio{let r;if(e.origin&&(typeof
e.origin=="string"||e.origin instanceof URL))r=String(e.origin);else throw
new xSe("opts.origin must be a non-empty string or
URL.");if(this[K0e].size>=this[npt].maxOrigins&&!this[K0e].has(r))throw new
lio;let o=this[oV].get(r),s=o&&o.dispatcher;if(!s){let l=a=>{let
c=this[oV].get(r);c&&(a&&(c.count-=1),c.count<=0&&(this[oV].delete(r),c.dispa
tcher.close()),this[K0e].delete(r))};s=this$In.on("drai
n",this[qIn]).on("connect",(a,c)=>{let
I=this[oV].get(r);I&&(I.count+=1),thisPIn}).on("disconnect",(a,c,I)=>{
l(!0),thisjIn}).on("connectionError",(a,c,I)=>{l(!1),thisKIn}),this[oV].set(r,{count:0,dispatcher:s}),this[K0e].add(r)}return
s.dispatch(e,n)}aio{let e=[];for(let{dispatcher:n}of
this[oV].values())e.push(n.close());return
this[oV].clear(),Promise.all(e)}cio{let n=[];for(let{dispatcher:r}of
this[oV].values())n.push(r.destroy(e));return
this[oV].clear(),Promise.all(n)}get stats(){let e={};for(let{dispatcher:n}of
this[oV].values())n.stats&&(e[n[dio].origin]=n.stats);return
e}};edn.exports=rpt});var apt=S((FAi,ddn)=>{"use
strict";var{kProxy:opt,kClose:idn,kDestroy:ldn,kDispatch:tdn}=Ym(),Gio=UK(),a
dn=bse(),cdn=HK(),{InvalidArgumentError:Gse,RequestAbortedError:gio,SecurePro
xyConnectionError:Aio}=Ma(),ndn=V0e(),Idn=_K(),SSe=Symbol("proxy
agent"),LSe=Symbol("proxy client"),oM=Symbol("proxy
headers"),spt=Symbol("request tls settings"),rdn=Symbol("proxy tls
settings"),odn=Symbol("connect endpoint function"),sdn=Symbol("tunnel
proxy");function fio(t){return t==="https:"?443:80}function yio(t,e){return
new adn(t,e)}var Nio=()=>{};function Zio(t,e){return e.connections===1?new
Idn(t,e):new adn(t,e)}var ipt=class extends
cdn{#e;constructor(e,{headers:n={},connect:r,factory:o}){if(!e)throw new
Gse("Proxy URL is
mandatory");super(),this[oM]=n,o?this.#e=o(e,{connect:r}):this.#e=new
Idn(e,{connect:r})}tdn{let
r=n.onHeaders;n.onHeaders=function(a,c,I){if(a===407){typeof
n.onError=="function"&&n.onError(new Gse("Proxy Authentication Required
(407)"));return}r&&r.call(this,a,c,I)};let{origin:o,path:s="/",headers:l={}}=
e;if(e.path=o+s,!("host"in l)&&!("Host"in l)){let{host:a}=new
URL(o);l.host=a}return
e.headers={...this[oM],...l},this.#etdn}idn{return
this.#e.close()}ldn{return this.#e.destroy(e)}},lpt=class extends
cdn{constructor(e){if(!e||typeof e=="object"&&!(e instanceof
URL)&&!e.uri)throw new Gse("Proxy uri is
mandatory");let{clientFactory:n=yio}=e;if(typeof n!="function")throw new
Gse("Proxy opts.clientFactory must be a
function.");let{proxyTunnel:r=!0}=e;super();let
o=this.#e(e),{href:s,origin:l,port:a,protocol:c,username:I,password:d,hostnam
e:u}=o;if(this[opt]={uri:s,protocol:c},this[spt]=e.requestTls,this[rdn]=e.pro
xyTls,this[oM]=e.headers||{},this[sdn]=r,e.auth&&e.token)throw new
Gse("opts.auth cannot be used in combination with
opts.token");e.auth?this[oM]["proxy-authorization"]=Basic ${e.auth}:e.token?this[oM]["proxy-authorization"]=e.token:I&&d&&(this[oM]["p
roxy-authorization"]=Basic ${Buffer.from(${decodeURIComponent(I)}:${decodeURIComponent(d)}`)
✗ AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
q3(t[D0e]===0);return}if(t[eM]&&!t[_0e]){t[eM](),t[eM]=null;return}if(t[ig]
&&t[ig].resume(),t[Jmt])t[tM]=2;else if(t[tM]===2){e?(t[tM]=1,queueMicrotask(
()=>ZIn(t))):ZIn(t);continue}if(t[D0e]===0||t[U0e]>=(WIn(t)||1))return;let
n=t[ZH][t[EH]];if(t[lx].protocol==="https:"&&t[rM]!==n.servername){if(t[U0e]>
0)return;t[rM]=n.servername,t[ig]?.destroy(new cso("servername
changed"),()=>{t[ig]=null,_mt(t)})}if(t[hse])return;if(!t[ig]){wIn(t);return}
if(t[ig].destroyed||t[ig].busy(n))return;!n.aborted&&t[ig].write(n)?t[EH]++:t
[ZH].splice(t[EH],1)}}vIn.exports=Tmt});var Omt=S((wAi,CIn)=>{"use
strict";var VSe=class{bottom=0;top=0;list=new Array(2048).fill(void
0);next=null;isEmpty(){return
this.top===this.bottom}isFull(){return(this.top+1&2047)===this.bottom}push(e)
{this.list[this.top]=e,this.top=this.top+1&2047}shift(){let
e=this.list[this.bottom];return e===void 0?null:(this.list[this.bottom]=void
0,this.bottom=this.bottom+1&2047,e)}};CIn.exports=class{constructor(){this.he
ad=this.tail=new VSe}isEmpty(){return
this.head.isEmpty()}push(e){this.head.isFull()&&(this.head=this.head.next=new
VSe),this.head.push(e)}shift(){let e=this.tail,n=e.shift();return
e.isEmpty()&&e.next!==null&&(this.tail=e.next,e.next=null),n}}});var
jmt=S((vAi,SIn)=>{"use strict";var{PoolStats:Xso}=jut(),kso=HK(),xso=Omt(),{k
Connected:Mmt,kSize:YIn,kRunning:VIn,kPending:FIn,kQueued:z0e,kBusy:Sso,kFree
:Lso,kUrl:Jso,kClose:Bso,kDestroy:Tso,kDispatch:_so}=Ym(),bA=Symbol("clients"
),HW=Symbol("needDrain"),P0e=Symbol("queue"),Umt=Symbol("closed
resolve"),Dmt=Symbol("onDrain"),QIn=Symbol("onConnect"),HIn=Symbol("onDisconn
ect"),XIn=Symbol("onConnectionError"),zmt=Symbol("get
dispatcher"),kIn=Symbol("add client"),xIn=Symbol("remove client"),Pmt=class
extends kso{[P0e]=new xso;[z0e]=0;[bA]=[];[HW]=!1;Dmt{let
o=this[P0e],s=!1;for(;!s;){let l=o.shift();if(!l)break;this[z0e]--,s=!e.dispa
tch(l.opts,l.handler)}if(e[HW]=s,!s&&this[HW]&&(this[HW]=!1,this.emit("drain"
,n,[this,...r])),this[Umt]&&o.isEmpty()){let l=new
Array(this[bA].length);for(let a=0;a<this[bA].length;a++)l[a]=this[bA][a].clo
se();Promise.all(l).then(this[Umt])}}[QIn]=(e,n)=>{this.emit("connect",e,[thi
s,...n])};[HIn]=(e,n,r)=>{this.emit("disconnect",e,[this,...n],r)};[XIn]=(e,n
,r)=>{this.emit("connectionError",e,[this,...n],r)};getSso{return
this[HW]}getMmt{let e=0;for(let{[Mmt]:n}of this[bA])e+=n;return
e}getLso{let e=0;for(let{[Mmt]:n,[HW]:r}of this[bA])e+=n&&!r;return
e}getFIn{let e=this[z0e];for(let{[FIn]:n}of this[bA])e+=n;return
e}getVIn{let e=0;for(let{[VIn]:n}of this[bA])e+=n;return e}getYIn{let
e=this[z0e];for(let{[YIn]:n}of this[bA])e+=n;return e}get stats(){return new
Xso(this)}Bso{if(this[P0e].isEmpty()){let e=new
Array(this[bA].length);for(let
n=0;n<this[bA].length;n++)e[n]=this[bA][n].close();return Promise.all(e)}else
return new Promise(e=>{this[Umt]=e})}Tso{for(;;){let
r=this[P0e].shift();if(!r)break;r.handler.onError(e)}let n=new
Array(this[bA].length);for(let
r=0;r<this[bA].length;r++)n[r]=this[bA][r].destroy(e);return
Promise.all(n)}_so{let r=thiszmt;return
r?r.dispatch(e,n)||(r[HW]=!0,this[HW]=!thiszmt):(this[HW]=!0,this[P0e].pu
sh({opts:e,handler:n}),this[z0e]++),!this[HW]}kIn{return e.on("drain",th
is[Dmt].bind(this,e)).on("connect",this[QIn]).on("disconnect",this[HIn]).on("
connectionError",this[XIn]),this[bA].push(e),this[HW]&&queueMicrotask(()=>{th
is[HW]&&thisDmt}),this}xIn{e.close(()=>{let n=this[
bA].indexOf(e);n!==-1&&this[bA].splice(n,1)}),this[HW]=this[bA].some(n=>!n[HW
]&&n.closed!==!0&&n.destroyed!==!0)}};SIn.exports={PoolBase:Pmt,kClients:bA,k
NeedDrain:HW,kAddClient:kIn,kRemoveClient:xIn,kGetDispatcher:zmt}});var
bse=S((CAi,TIn)=>{"use strict";var{PoolBase:Oso,kClients:FSe,kNeedDrain:Mso,k
AddClient:Uso,kGetDispatcher:Dso,kRemoveClient:zso}=jmt(),Pso=_K(),{InvalidAr
gumentError:Kmt}=Ma(),LIn=sa(),{kUrl:JIn}=Ym(),jso=V0e(),QSe=Symbol("options"
),qmt=Symbol("connections"),BIn=Symbol("factory");function Kso(t,e){return
new Pso(t,e)}var $mt=class extends Oso{constructor(e,{connections:n,factory:r
=Kso,connect:o,connectTimeout:s,tls:l,maxCachedSessions:a,socketPath:c,autoSe
lectFamily:I,autoSelectFamilyAttemptTimeout:d,allowH2:u,clientTtl:m,...p}={})
{if(n!=null&&(!Number.isFinite(n)||n<0))throw new Kmt("invalid
connections");if(typeof r!="function")throw new Kmt("factory must be a
function.");if(o!=null&&typeof o!="function"&&typeof o!="object")throw new
Kmt("connect must be a function or an object");typeof o!="function"&&(o=jso({
...l,maxCachedSessions:a,allowH2:u,socketPath:c,timeout:s,...typeof
I=="boolean"?{autoSelectFamily:I,autoSelectFamilyAttemptTimeout:d}:void
0,...o})),super(),this[qmt]=n||null,this[JIn]=LIn.parseOrigin(e),this[QSe]={.
..LIn.deepClone(p),connect:o,allowH2:u,clientTtl:m},this[QSe].interceptors=p.
interceptors?{...p.interceptors}:void
0,this[BIn]=r,this.on("connect",(h,G)=>{if(m!=null&&m>0)for(let g of G)Object
.assign(g,{ttl:Date.now()})}),this.on("connectionError",(h,G,g)=>{for(let f
of G){let N=this[FSe].indexOf(f);N!==-1&&this[FSe].splice(N,1)}})}Dso{let
e=this[QSe].clientTtl;for(let n of
this[FSe])if(e!=null&&e>0&&n.ttl&&Date.now()-n.ttl>e)thiszso;else
if(!n[Mso])return n;if(!this[qmt]||this[FSe].length<this[qmt]){let
n=thisBIn;return
thisUso,n}}};TIn.exports=$mt});var DIn=S((YAi,UIn)=>{"use
strict";var{BalancedPoolMissingUpstreamError:qso,InvalidArgumentError:$so}=Ma
(),{PoolBase:eio,kClients:SZ,kNeedDrain:j0e,kAddClient:tio,kRemoveClient:nio,
kGetDispatcher:rio}=jmt(),oio=bse(),{kUrl:ept}=Ym(),{parseOrigin:_In}=sa(),OI
n=Symbol("factory"),HSe=Symbol("options"),MIn=Symbol("kGreatestCommonDivisor"
),OK=Symbol("kCurrentWeight"),MK=Symbol("kIndex"),rV=Symbol("kWeight"),XSe=Sy
mbol("kMaxWeightPerServer"),kSe=Symbol("kErrorPenalty");function
sio(t,e){if(t===0)return e;for(;e!==0;){let n=e;e=t%e,t=n}return t}function
iio(t,e){return new oio(t,e)}var tpt=class extends
eio{constructor(e=[],{factory:n=iio,...r}={}){if(typeof n!="function")throw
new $so("factory must be a function.");super(),this[HSe]=r,this[MK]=-1,this[O
K]=0,this[XSe]=this[HSe].maxWeightPerServer||100,this[kSe]=this[HSe].errorPen
alty||15,Array.isArray(e)||(e=[e]),this[OIn]=n;for(let o of
e)this.addUpstream(o);this._updateBalancedPoolStats()}addUpstream(e){let
n=_In(e).origin;if(this[SZ].find(o=>o[ept].origin===n&&o.closed!==!0&&o.destr
oyed!==!0))return this;let r=thisOIn;thisti
o,r.on("connect",()=>{r[rV]=Math.min(this[XSe],r[rV]+this[kSe])}),r.on("c
onnectionError",()=>{r[rV]=Math.max(1,r[rV]-this[kSe]),this._updateBalancedPo
olStats()}),r.on("disconnect",(...o)=>{let
s=o[2];s&&s.code==="UND_ERR_SOCKET"&&(r[rV]=Math.max(1,r[rV]-this[kSe]),this.
_updateBalancedPoolStats())});for(let o of this[SZ])o[rV]=this[XSe];return
this._updateBalancedPoolStats(),this}_updateBalancedPoolStats(){let
e=0;for(let n=0;n<this[SZ].length;n++)e=sio(this[SZ][n][rV],e);this[MIn]=e}re
moveUpstream(e){let n=_In(e).origin,r=this[SZ].find(o=>o[ept].origin===n&&o.c
losed!==!0&&o.destroyed!==!0);return r&&thisnio,this}get
upstreams(){return this[SZ].filter(e=>e.closed!==!0&&e.destroyed!==!0).map(e=
e[ept].origin)}rio{if(this[SZ].length===0)throw new
qso;if(!this[SZ].find(s=>!s[j0e]&&s.closed!==!0&&s.destroyed!==!0)||this[SZ].
map(s=>s[j0e]).reduce((s,l)=>s&&l,!0))return;let r=0,o=this[SZ].findIndex(s=>
!s[j0e]);for(;r++<this[SZ].length;){this[MK]=(this[MK]+1)%this[SZ].length;let
s=this[SZ][this[MK]];if(s[rV]>this[SZ][o][rV]&&!s[j0e]&&(o=this[MK]),this[MK
]===0&&(this[OK]=this[OK]-this[MIn],this[OK]<=0&&(this[OK]=this[XSe])),s[rV]>
=this[OK]&&!s[j0e])return s}return
this[OK]=this[SZ][o][rV],this[MK]=o,this[SZ][o]}};UIn.exports=tpt});var
UK=S((VAi,edn)=>{"use
strict";var{InvalidArgumentError:xSe,MaxOriginsReachedError:lio}=Ma(),{kClien
ts:oV,kRunning:zIn,kClose:aio,kDestroy:cio,kDispatch:Iio,kUrl:dio}=Ym(),uio=H
K(),mio=bse(),pio=_K(),hio=sa(),PIn=Symbol("onConnect"),jIn=Symbol("onDisconn
ect"),KIn=Symbol("onConnectionError"),qIn=Symbol("onDrain"),$In=Symbol("facto
ry"),npt=Symbol("options"),K0e=Symbol("origins");function bio(t,e){return
e&&e.connections===1?new pio(t,e):new mio(t,e)}var rpt=class extends
uio{constructor({factory:e=bio,maxOrigins:n=1/0,connect:r,...o}={}){if(typeof
e!="function")throw new xSe("factory must be a
function.");if(r!=null&&typeof r!="function"&&typeof r!="object")throw new
xSe("connect must be a function or an object");if(typeof
n!="number"||Number.isNaN(n)||n<=0)throw new xSe("maxOrigins must be a number
greater than 0");super(),r&&typeof r!="function"&&(r={...r}),this[npt]={...h
io.deepClone(o),maxOrigins:n,connect:r},this[$In]=e,this[oV]=new
Map,this[K0e]=new Set,this[qIn]=(s,l)=>{this.emit("drain",s,[this,...l])},thi
s[PIn]=(s,l)=>{this.emit("connect",s,[this,...l])},this[jIn]=(s,l,a)=>{this.e
mit("disconnect",s,[this,...l],a)},this[KIn]=(s,l,a)=>{this.emit("connectionE
rror",s,[this,...l],a)}}getzIn{let e=0;for(let{dispatcher:n}of
this[oV].values())e+=n[zIn];return e}Iio{let r;if(e.origin&&(typeof
e.origin=="string"||e.origin instanceof URL))r=String(e.origin);else throw
new xSe("opts.origin must be a non-empty string or
URL.");if(this[K0e].size>=this[npt].maxOrigins&&!this[K0e].has(r))throw new
lio;let o=this[oV].get(r),s=o&&o.dispatcher;if(!s){let l=a=>{let
c=this[oV].get(r);c&&(a&&(c.count-=1),c.count<=0&&(this[oV].delete(r),c.dispa
tcher.close()),this[K0e].delete(r))};s=this$In.on("drai
n",this[qIn]).on("connect",(a,c)=>{let
I=this[oV].get(r);I&&(I.count+=1),thisPIn}).on("disconnect",(a,c,I)=>{
l(!0),thisjIn}).on("connectionError",(a,c,I)=>{l(!1),thisKIn}),this[oV].set(r,{count:0,dispatcher:s}),this[K0e].add(r)}return
s.dispatch(e,n)}aio{let e=[];for(let{dispatcher:n}of
this[oV].values())e.push(n.close());return
this[oV].clear(),Promise.all(e)}cio{let n=[];for(let{dispatcher:r}of
this[oV].values())n.push(r.destroy(e));return
this[oV].clear(),Promise.all(n)}get stats(){let e={};for(let{dispatcher:n}of
this[oV].values())n.stats&&(e[n[dio].origin]=n.stats);return
e}};edn.exports=rpt});var apt=S((FAi,ddn)=>{"use
strict";var{kProxy:opt,kClose:idn,kDestroy:ldn,kDispatch:tdn}=Ym(),Gio=UK(),a
dn=bse(),cdn=HK(),{InvalidArgumentError:Gse,RequestAbortedError:gio,SecurePro
xyConnectionError:Aio}=Ma(),ndn=V0e(),Idn=_K(),SSe=Symbol("proxy
agent"),LSe=Symbol("proxy client"),oM=Symbol("proxy
headers"),spt=Symbol("request tls settings"),rdn=Symbol("proxy tls
settings"),odn=Symbol("connect endpoint function"),sdn=Symbol("tunnel
proxy");function fio(t){return t==="https:"?443:80}function yio(t,e){return
new adn(t,e)}var Nio=()=>{};function Zio(t,e){return e.connections===1?new
Idn(t,e):new adn(t,e)}var ipt=class extends
cdn{#e;constructor(e,{headers:n={},connect:r,factory:o}){if(!e)throw new
Gse("Proxy URL is
mandatory");super(),this[oM]=n,o?this.#e=o(e,{connect:r}):this.#e=new
Idn(e,{connect:r})}tdn{let
r=n.onHeaders;n.onHeaders=function(a,c,I){if(a===407){typeof
n.onError=="function"&&n.onError(new Gse("Proxy Authentication Required
(407)"));return}r&&r.call(this,a,c,I)};let{origin:o,path:s="/",headers:l={}}=
e;if(e.path=o+s,!("host"in l)&&!("Host"in l)){let{host:a}=new
URL(o);l.host=a}return
e.headers={...this[oM],...l},this.#etdn}idn{return
this.#e.close()}ldn{return this.#e.destroy(e)}},lpt=class extends
cdn{constructor(e){if(!e||typeof e=="object"&&!(e instanceof
URL)&&!e.uri)throw new Gse("Proxy uri is
mandatory");let{clientFactory:n=yio}=e;if(typeof n!="function")throw new
Gse("Proxy opts.clientFactory must be a
function.");let{proxyTunnel:r=!0}=e;super();let
o=this.#e(e),{href:s,origin:l,port:a,protocol:c,username:I,password:d,hostnam
e:u}=o;if(this[opt]={uri:s,protocol:c},this[spt]=e.requestTls,this[rdn]=e.pro
xyTls,this[oM]=e.headers||{},this[sdn]=r,e.auth&&e.token)throw new
Gse("opts.auth cannot be used in combination with
opts.token");e.auth?this[oM]["proxy-authorization"]=Basic ${e.auth}:e.token?this[oM]["proxy-authorization"]=e.token:I&&d&&(this[oM]["p
roxy-authorization"]=Basic ${Buffer.from(${decodeURIComponent(I)}:${decodeURIComponent(d)}`)
✗ Execution failed: Error: Failed to get response from the AI model; retried 5
times (total retry wait time: 86.21232620177737 seconds) Last error:
CAPIError: 503 {"error":{"message":"HTTP/2 GOAWAY connection
terminated","type":"connection_error"}}
`
Affected version
1.0.2
Steps to reproduce the behavior
When copilot using plans to finish their editing
Expected behavior
It should be no problem
Additional context
No response
Activity
XJTLUmedia commentedon Mar 10, 2026
please continue what you have left
● Compacting conversation history...
✗ Execution failed: CAPIError: 400 The requested model is not supported.
● Continuing autonomously (1 premium request)
✗ Execution failed: CAPIError: 400 The requested model is not supported.
● Continuing autonomously (1 premium request)
✗ Execution failed: CAPIError: 400 The requested model is not supported.
● Continuing autonomously (1 premium request)
✗ Execution failed: CAPIError: 400 The requested model is not supported.
● Continuing autonomously (1 premium request)
✗ Execution failed: CAPIError: 400 The requested model is not supported.
and this one is draining my premium request like crazy. please carefully review and fix this problem
XJTLUmedia commentedon Mar 10, 2026
● Now I have a comprehensive understanding of the entire codebase. Let me create the plan:Now I have a thorough understanding of the entire codebase.
Let me create the comprehensive plan:Now I have a thorough understanding of the codebase. Let me create the comprehensive plan:
● Request failed due to a transient API error. Retrying...
● Request failed due to a transient API error. Retrying...
● Request failed due to a transient API error. Retrying...
● Read q.txt lines 400-550
└ 151 lines read
● I now have comprehensive understanding of all methods. Let me create the plan:
● Request failed due to a transient API error. Retrying...
● Read q.txt lines 550-700
└ 150 lines read
● Now I have a comprehensive understanding of the codebase. Let me create the structured plan:
● Request failed due to a transient API error. Retrying...
● Request failed due to a transient API error. Retrying...
● Request failed due to a transient API error. Retrying...
● Request failed due to a transient API error. Retrying...
● Request failed due to a transient API error. Retrying...
✗ Execution failed: Error: Failed to get response from the AI model; retried 5 times (total retry wait time: 99.42493409340081 seconds) Last error:
CAPIError: 503 {"error":{"message":"HTTP/2 GOAWAY connection terminated","type":"connection_error"}}
so he can't even finish the plan. I don't understand why it suddenly happens and all request failed
IlyasYOY commentedon Mar 10, 2026
Check out this issue: #1754
Seems like it is the same problem.
dereklegenzoff commentedon Mar 16, 2026
We shipped a fix in v1.0.6 so you should no longer run into the AssertionErrors causing crashes. Closing this issue but please open a new one if you have more issues.