stacktape 1.0.0-alpha.81 → 1.0.0-alpha.82

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/cli.js CHANGED
@@ -78,7 +78,7 @@ ${r}`}},"ERR_INTERNAL_ASSERTION");var U3s=Math.pow(2,32),her=function(){try{retu
78
78
  `)),typeof e.banner=="string"&&e.banner.length&&(e.banner.slice(-2)===`\r
79
79
  `?this.banner=e.banner:this.banner=e.banner+`\r
80
80
  `)),this.debug("DEBUG: Local ident: "+Der(this.config.ident)),this.push(this.config.ident+`\r
81
- `),this._state.incoming.expectedPacket="KEXINIT"}o(Un,"SSH2Stream");s$s(Un,xee);Un.prototype.__read=xee.prototype._read;Un.prototype._read=function(e){return this._needContinue&&(this._needContinue=!1,this.emit("continue")),this.__read(e)};Un.prototype.__push=xee.prototype.push;Un.prototype.push=function(e,t){var r=this.__push(e,t);return this._needContinue=r===!1,r};Un.prototype._cleanup=function(e){this.reset(),this.debug("DEBUG: Parser: Malformed packet"),e&&e(new Error("Malformed packet"))};Un.prototype._transform=function(e,t,r,n){var i=!1,s=!1,a=this._state,c=a.incoming,l=a.outgoing,d=c.expect,m=c.decrypt,f=c.decompress,g=e.length,y=0,w=this.debug,v=this,b=0,S=b,P,q,k,j;for(this.bytesReceived+=g;;){if(d.type!==void 0){if(b>=g)break;if(d.type===Ax){y=g-b;var ee=d.buf.length-d.ptr;ee<=y?(e.copy(d.buf,d.ptr,b,b+ee),b+=ee,q=d.buf,d.buf=void 0,d.ptr=0,d.type=void 0):(e.copy(d.buf,d.ptr,b),d.ptr+=y,b+=y);continue}else if(d.type===Uer){if(b+=c.search.push(e),d.type!==void 0)continue}else if(d.type===$er){if(++d.ptr+4>255)return this.reset(),w("DEBUG: Parser: Identification string exceeded 255 characters"),r(new Error("Max identification string size exceeded"));if(e[b]===10)d.type=void 0,S<b&&(d.buf===void 0?d.buf=e.toString("ascii",S,b):d.buf+=e.toString("ascii",S,b)),q=d.buf,d.buf=void 0,++b;else{++b===g&&S<b&&(d.buf===void 0?d.buf=e.toString("ascii",S,b):d.buf+=e.toString("ascii",S,b));continue}}}if(c.status===Ex){if(!this.readable)return r();if(this.server)if(!q)w("DEBUG: Parser: IN_INIT (waiting for identification begin)"),cC(this,Ax,4);else if(q[0]===83&&q[1]===83&&q[2]===72&&q[3]===45)c.status=f6e,w("DEBUG: Parser: IN_INIT (waiting for rest of identification)");else return this.reset(),w("DEBUG: Parser: Bad identification start"),r(new Error("Bad identification start"));else{w("DEBUG: Parser: IN_INIT");var K=c.search=new a$s(w$s);K.on("info",o(function $e(kr,O,Y,he){O&&(c.greeting===void 0?c.greeting=O.toString("binary",Y,he):c.greeting+=O.toString("binary",Y,he)),kr&&(d.type=void 0,c.search.removeListener("info",$e))},"onInfo")),K.maxMatches=1,cC(this,Uer),c.status=f6e}}else if(c.status===f6e)w("DEBUG: Parser: IN_GREETING"),c.search=void 0,S=b,cC(this,$er),c.status=jer;else if(c.status===jer){w("DEBUG: Parser: IN_HEADER"),q.charCodeAt(q.length-1)===13&&(q=q.slice(0,-1));var V=q.indexOf("-"),oe=q.indexOf(" "),de={greeting:c.greeting,identRaw:"SSH-"+q,versions:{protocol:q.substr(0,V),software:oe===-1?q.substring(V+1):q.substring(V+1,oe)},comments:oe>-1?q.substring(oe+1):void 0};if(c.greeting=void 0,de.versions.protocol!=="1.99"&&de.versions.protocol!=="2.0")return this.reset(),w("DEBUG: Parser: protocol version not supported: "+de.versions.protocol),r(new Error("Protocol version not supported"));if(this.emit("header",de),c.status===Ex)return;var N=de.identRaw,se=de.versions.software;this.debug("DEBUG: Remote ident: "+Der(N));for(var ne=0,xe;ne<f$s;++ne)xe=Fer[ne],typeof xe[0]=="string"?se===xe[0]&&(this.remoteBugs|=xe[1]):xe[0].test(se)&&(this.remoteBugs|=xe[1]);c.identRaw=N,this.bytesReceived-=g-b,C6e(this,function(){b===g?r():v._transform(e.slice(b),t,r)}),c.status=kee;return}else if(c.status===kee)P=m.instance?m.info.blockLen:8,w("DEBUG: Parser: IN_PACKETBEFORE (expecting "+P+")"),cC(this,Ax,P,m.buf),c.status=p6e;else if(c.status===p6e){if(w("DEBUG: Parser: IN_PACKET"),m.instance?(s=m.info.authLen>0,s||(q=Wer(this,q)),P=m.info.blockLen):(s=!1,P=8),j=ws(q,0,this,r),j===!1)return;var U=c.hmac.info,te;U?te=U.actualLen:te=0;var He=j+4+te,Qe=this.maxPacketSize;if(f.instance&&(Qe+=(this.maxPacketSize/16384+1)*5+6),j>Qe||He<16+te||(j+(s?0:4))%P!=0)return this.disconnect(za.PROTOCOL_ERROR),w("DEBUG: Parser: Bad packet length ("+He+")"),r(new Error("Bad packet length"));c.pktLen=j;var it=c.pktLen+4-P;if(s?(m.instance.setAAD(q.slice(0,4)),w("DEBUG: Parser: pktLen:"+c.pktLen+",remainLen:"+it)):(c.padLen=q[4],w("DEBUG: Parser: pktLen:"+c.pktLen+",padLen:"+c.padLen+",remainLen:"+it)),it>0)s?c.pktExtra=q.slice(4):c.pktExtra=q.slice(5),cC(this,Ax,it),c.status=g6e;else if(it<0)c.status=kee;else{i=!0,c.status=g6e;continue}}else if(c.status===g6e){w("DEBUG: Parser: IN_PACKETDATA"),m.instance?(s=m.info.authLen>0,i?i=!1:s||(q=Wer(this,q))):(s=!1,i=!1);var qt=c.pktLen-c.padLen-1;if(c.pktExtra?(k=Buffer.allocUnsafe(c.pktExtra.length+q.length),c.pktExtra.copy(k),q.copy(k,c.pktExtra.length),c.payload=k.slice(0,qt)):(s?k=q.slice(4):k=q.slice(5),c.payload=q.slice(5,5+qt)),c.hmac.info!==void 0){var Dt=m.info.authLen||c.hmac.info.actualLen;w("DEBUG: Parser: HMAC size:"+Dt),cC(this,Ax,Dt,c.hmac.buf),c.status=Ber,c.packet=k}else c.status=h6e;c.pktExtra=void 0,k=void 0}else if(c.status===Ber)if(w("DEBUG: Parser: IN_PACKETDATAVERIFY"),D$s(this,q))w("DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)"),c.status=h6e,c.packet=void 0;else return this.reset(),w("DEBUG: Parser: IN_PACKETDATAVERIFY (Invalid HMAC)"),r(new Error("Invalid HMAC"));else if(c.status===h6e){if(f.instance)if(n)n=!1;else{w("DEBUG: Parser: Decompressing"),f.instance.write(c.payload);var tr=[],lt=0;f.instance.on("readable",function(){for(var $e;$e=this.read();)tr.push($e),lt+=$e.length}).flush(v6e,function(){f.instance.removeAllListeners("readable"),tr.length===1?c.payload=tr[0]:c.payload=Buffer.concat(tr,lt),tr=null;var $e;b===g?$e=_6e:$e=e.slice(b),v._transform($e,t,r,!0)});return}this.emit("packet");var pt=c.payload[0];if(w!==Ger){var mr="DEBUG: Parser: IN_PACKETDATAAFTER, packet: ",gt=a.authsQueue[0],ar=null;if(l.status===t0&&!(pt<=4||pt>=20&&pt<=49)&&(mr+="(enqueued) "),pt===sr.KEXDH_INIT)switch(a.kex.type){case"group":ar="KEXDH_INIT";break;case"groupex":ar="KEXDH_GEX_REQUEST";break;default:ar="KEXECDH_INIT"}else if(pt===sr.KEXDH_REPLY)switch(a.kex.type){case"group":ar="KEXDH_REPLY";break;case"groupex":ar="KEXDH_GEX_GROUP";break;default:ar="KEXECDH_REPLY"}else pt===sr.KEXDH_GEX_GROUP?ar="KEXDH_GEX_GROUP":pt===sr.KEXDH_GEX_REPLY?ar="KEXDH_GEX_REPLY":pt===60?gt==="password"?ar="USERAUTH_PASSWD_CHANGEREQ":gt==="keyboard-interactive"?ar="USERAUTH_INFO_REQUEST":gt==="publickey"?ar="USERAUTH_PK_OK":ar="UNKNOWN PACKET 60":pt===61&&(gt==="keyboard-interactive"?ar="USERAUTH_INFO_RESPONSE":ar="UNKNOWN PACKET 61");ar===null&&(ar=sr[pt]),pt!==sr.CHANNEL_OPEN&&pt!==sr.CHANNEL_REQUEST&&pt!==sr.CHANNEL_SUCCESS&&pt!==sr.CHANNEL_FAILURE&&pt!==sr.CHANNEL_EOF&&pt!==sr.CHANNEL_CLOSE&&pt!==sr.CHANNEL_DATA&&pt!==sr.CHANNEL_EXTENDED_DATA&&pt!==sr.CHANNEL_WINDOW_ADJUST&&pt!==sr.DISCONNECT&&pt!==sr.USERAUTH_REQUEST&&pt!==sr.GLOBAL_REQUEST&&w(mr+ar)}if(l.status===e0||pt<=4||pt>=20&&pt<=49){if(Xer(this,r)===!1||c.status===Ex)return}else if(l.status===t0){if(c.rekeyQueue.length===h$s)return w("DEBUG: Parser: Max incoming re-key queue length reached"),this.disconnect(za.PROTOCOL_ERROR),r(new Error("Incoming re-key queue length limit reached"));var Lr=c.seqno;++c.seqno>w6e&&(c.seqno=0),c.rekeyQueue.push([Lr,c.payload])}c.status=kee,c.payload=void 0}q!==void 0&&(q=void 0)}r()};Un.prototype.reset=function(e){if(this._state){var t=this._state;t.incoming.status=Ex,t.outgoing.status=y6e}else this._state={authsQueue:[],hostkeyFormat:void 0,kex:void 0,incoming:{status:Ex,expectedPacket:void 0,search:void 0,greeting:void 0,seqno:0,pktLen:void 0,padLen:void 0,pktExtra:void 0,payload:void 0,packet:void 0,kexinit:void 0,identRaw:void 0,rekeyQueue:[],ignoreNext:!1,expect:{amount:void 0,type:void 0,ptr:0,buf:void 0},decrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,buf:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},decompress:{instance:!1,type:!1}},outgoing:{status:y6e,seqno:0,bufSeqno:Buffer.allocUnsafe(4),rekeyQueue:[],kexinit:void 0,kexsecret:void 0,pubkey:void 0,exchangeHash:void 0,sessionId:void 0,sentNEWKEYS:!1,encrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},compress:{instance:!1,type:!1,queue:null}}};e||this.readable&&this.push(null)};Un.prototype.disconnect=function(e){var t=Buffer.alloc(1+4+4+4);return t[0]=sr.DISCONNECT,za[e]===void 0&&(e=za.BY_APPLICATION),Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing DISCONNECT ("+za[e]+")"),Dn(this,t),this.reset(),!1};Un.prototype.ping=function(){return this.debug("DEBUG: Outgoing: Writing ping (GLOBAL_REQUEST: keepalive@openssh.com)"),Dn(this,v$s)};Un.prototype.rekey=function(){var e=this._state.outgoing.status;if(e===t0)throw new Error("A re-key is already in progress");if(e!==e0)throw new Error("Cannot re-key yet");return this.debug("DEBUG: Outgoing: Starting re-key"),C6e(this)};Un.prototype.requestSuccess=function(e){var t;return Buffer.isBuffer(e)?(t=Buffer.allocUnsafe(1+e.length),t[0]=sr.REQUEST_SUCCESS,e.copy(t,1)):t=b$s,this.debug("DEBUG: Outgoing: Writing REQUEST_SUCCESS"),Dn(this,t)};Un.prototype.requestFailure=function(){return this.debug("DEBUG: Outgoing: Writing REQUEST_FAILURE"),Dn(this,S$s)};Un.prototype.channelSuccess=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_SUCCESS,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_SUCCESS ("+e+")"),Dn(this,t)};Un.prototype.channelFailure=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_FAILURE,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_FAILURE ("+e+")"),Dn(this,t)};Un.prototype.channelEOF=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_EOF,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_EOF ("+e+")"),Dn(this,t)};Un.prototype.channelClose=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_CLOSE,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_CLOSE ("+e+")"),Dn(this,t)};Un.prototype.channelWindowAdjust=function(e,t){var r=Buffer.allocUnsafe(1+4+4);return r[0]=sr.CHANNEL_WINDOW_ADJUST,Ze(r,e,1),Ze(r,t,5),this.debug("DEBUG: Outgoing: Writing CHANNEL_WINDOW_ADJUST ("+e+", "+t+")"),Dn(this,r)};Un.prototype.channelData=function(e,t){var r=Buffer.isBuffer(t),n=r?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+n);return i[0]=sr.CHANNEL_DATA,Ze(i,e,1),Ze(i,n,5),r?t.copy(i,9):i.write(t,9,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_DATA ("+e+")"),Dn(this,i)};Un.prototype.channelExtData=function(e,t,r){var n=Buffer.isBuffer(t),i=n?t.length:Buffer.byteLength(t),s=Buffer.allocUnsafe(1+4+4+4+i);return s[0]=sr.CHANNEL_EXTENDED_DATA,Ze(s,e,1),Ze(s,r,5),Ze(s,i,9),n?t.copy(s,13):s.write(t,13,i,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_EXTENDED_DATA ("+e+")"),Dn(this,s)};Un.prototype.channelOpenConfirm=function(e,t,r,n){var i=Buffer.allocUnsafe(1+4+4+4+4);return i[0]=sr.CHANNEL_OPEN_CONFIRMATION,Ze(i,e,1),Ze(i,t,5),Ze(i,r,9),Ze(i,n,13),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_CONFIRMATION (r:"+e+", l:"+t+")"),Dn(this,i)};Un.prototype.channelOpenFail=function(e,t,r,n){typeof r!="string"&&(r=""),typeof n!="string"&&(n="");var i=Buffer.byteLength(r),s=Buffer.byteLength(n),a=9,c=Buffer.allocUnsafe(1+4+4+4+i+4+s);return c[0]=sr.CHANNEL_OPEN_FAILURE,Ze(c,e,1),Ze(c,t,5),Ze(c,i,a),a+=4,i&&(c.write(r,a,i,"utf8"),a+=i),Ze(c,s,a),s&&c.write(n,a+=4,s,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_FAILURE ("+e+")"),Dn(this,c)};Un.prototype.service=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=Buffer.allocUnsafe(1+4+t);return r[0]=sr.SERVICE_REQUEST,Ze(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_REQUEST ("+e+")"),Dn(this,r)};Un.prototype.tcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+13+1+4+n+4);return i[0]=sr.GLOBAL_REQUEST,Ze(i,13,1),i.write("tcpip-forward",5,13,"ascii"),i[18]=r===void 0||r===!0?1:0,Ze(i,n,19),i.write(e,23,n,"ascii"),Ze(i,t,23+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (tcpip-forward)"),Dn(this,i)};Un.prototype.cancelTcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+20+1+4+n+4);return i[0]=sr.GLOBAL_REQUEST,Ze(i,20,1),i.write("cancel-tcpip-forward",5,20,"ascii"),i[25]=r===void 0||r===!0?1:0,Ze(i,n,26),i.write(e,30,n,"ascii"),Ze(i,t,30+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-tcpip-forward)"),Dn(this,i)};Un.prototype.openssh_streamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+31+1+4+r);return n[0]=sr.GLOBAL_REQUEST,Ze(n,31,1),n.write("streamlocal-forward@openssh.com",5,31,"ascii"),n[36]=t===void 0||t===!0?1:0,Ze(n,r,37),n.write(e,41,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),Dn(this,n)};Un.prototype.openssh_cancelStreamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+38+1+4+r);return n[0]=sr.GLOBAL_REQUEST,Ze(n,38,1),n.write("cancel-streamlocal-forward@openssh.com",5,38,"ascii"),n[43]=t===void 0||t===!0?1:0,Ze(n,r,44),n.write(e,48,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),Dn(this,n)};Un.prototype.directTcpip=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.srcIP),s=Buffer.byteLength(n.dstIP),a=29,c=Buffer.allocUnsafe(1+4+12+4+4+4+4+i+4+4+s+4);return c[0]=sr.CHANNEL_OPEN,Ze(c,12,1),c.write("direct-tcpip",5,12,"ascii"),Ze(c,e,17),Ze(c,t,21),Ze(c,r,25),Ze(c,s,a),c.write(n.dstIP,a+=4,s,"ascii"),Ze(c,n.dstPort,a+=s),Ze(c,i,a+=4),c.write(n.srcIP,a+=4,i,"ascii"),Ze(c,n.srcPort,a+=i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-tcpip)"),Dn(this,c)};Un.prototype.openssh_directStreamLocal=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.socketPath),s=47,a=Buffer.allocUnsafe(1+4+30+4+4+4+4+i+4+4);return a[0]=sr.CHANNEL_OPEN,Ze(a,30,1),a.write("direct-streamlocal@openssh.com",5,30,"ascii"),Ze(a,e,35),Ze(a,t,39),Ze(a,r,43),Ze(a,i,s),a.write(n.socketPath,s+=4,i,"utf8"),a.fill(0,a.length-8),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-streamlocal@openssh.com)"),Dn(this,a)};Un.prototype.openssh_noMoreSessions=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.allocUnsafe(1+4+28+1);return t[0]=sr.GLOBAL_REQUEST,Ze(t,28,1),t.write("no-more-sessions@openssh.com",5,28,"ascii"),t[33]=e===void 0||e===!0?1:0,this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (no-more-sessions@openssh.com)"),Dn(this,t)};Un.prototype.session=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.allocUnsafe(1+4+7+4+4+4);return n[0]=sr.CHANNEL_OPEN,Ze(n,7,1),n.write("session",5,7,"ascii"),Ze(n,e,12),Ze(n,t,16),Ze(n,r,20),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", session)"),Dn(this,n)};Un.prototype.windowChange=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=Buffer.allocUnsafe(1+4+4+13+1+4+4+4+4);return s[0]=sr.CHANNEL_REQUEST,Ze(s,e,1),Ze(s,13,5),s.write("window-change",9,13,"ascii"),s[22]=0,Ze(s,r,23),Ze(s,t,27),Ze(s,i,31),Ze(s,n,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", window-change)"),Dn(this,s)};Un.prototype.pty=function(e,t,r,n,i,s,a,c){if(this.server)throw new Error("Client-only method called in server mode");(!s||!s.length)&&(s="vt100"),a&&!Buffer.isBuffer(a)&&!Array.isArray(a)&&typeof a=="object"&&(a=L$s(a)),(!a||!a.length)&&(a=C$s);var l=s.length,d=a.length,m=21,f=Buffer.allocUnsafe(1+4+4+7+1+4+l+4+4+4+4+4+d);if(f[0]=sr.CHANNEL_REQUEST,Ze(f,e,1),Ze(f,7,5),f.write("pty-req",9,7,"ascii"),f[16]=c===void 0||c===!0?1:0,Ze(f,l,17),f.write(s,21,l,"utf8"),Ze(f,r,m+=l),Ze(f,t,m+=4),Ze(f,i,m+=4),Ze(f,n,m+=4),Ze(f,d,m+=4),m+=4,Array.isArray(a))for(var g=0;g<d;++g)f[m++]=a[g];else Buffer.isBuffer(a)&&a.copy(f,m);return this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", pty-req)"),Dn(this,f)};Un.prototype.shell=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+5+1);return r[0]=sr.CHANNEL_REQUEST,Ze(r,e,1),Ze(r,5,5),r.write("shell",9,5,"ascii"),r[14]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", shell)"),Dn(this,r)};Un.prototype.exec=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.isBuffer(t)?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+4+1+4+n);return i[0]=sr.CHANNEL_REQUEST,Ze(i,e,1),Ze(i,4,5),i.write("exec",9,4,"ascii"),i[13]=r===void 0||r===!0?1:0,Ze(i,n,14),Buffer.isBuffer(t)?t.copy(i,18):i.write(t,18,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exec)"),Dn(this,i)};Un.prototype.signal=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");if(t=t.toUpperCase(),t.slice(0,3)==="SIG"&&(t=t.substring(3)),u$s.indexOf(t)===-1)throw new Error("Invalid signal: "+t);var r=t.length,n=Buffer.allocUnsafe(1+4+4+6+1+4+r);return n[0]=sr.CHANNEL_REQUEST,Ze(n,e,1),Ze(n,6,5),n.write("signal",9,6,"ascii"),n[15]=0,Ze(n,r,16),n.write(t,20,r,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", signal)"),Dn(this,n)};Un.prototype.env=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(t),s=Buffer.isBuffer(r)?r.length:Buffer.byteLength(r),a=Buffer.allocUnsafe(1+4+4+3+1+4+i+4+s);return a[0]=sr.CHANNEL_REQUEST,Ze(a,e,1),Ze(a,3,5),a.write("env",9,3,"ascii"),a[12]=n===void 0||n===!0?1:0,Ze(a,i,13),a.write(t,17,i,"ascii"),Ze(a,s,17+i),Buffer.isBuffer(r)?r.copy(a,17+i+4):a.write(r,17+i+4,s,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", env)"),Dn(this,a)};Un.prototype.x11Forward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t.protocol),i=Buffer.byteLength(t.cookie),s=Buffer.allocUnsafe(1+4+4+7+1+1+4+n+4+i+4);s[0]=sr.CHANNEL_REQUEST,Ze(s,e,1),Ze(s,7,5),s.write("x11-req",9,7,"ascii"),s[16]=r===void 0||r===!0?1:0,s[17]=t.single?1:0,Ze(s,n,18);var a=22;return Buffer.isBuffer(t.protocol)?t.protocol.copy(s,a):s.write(t.protocol,a,n,"utf8"),a+=n,Ze(s,i,a),a+=4,Buffer.isBuffer(t.cookie)?t.cookie.copy(s,a):s.write(t.cookie,a,i,"binary"),a+=i,Ze(s,t.screen||0,a),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", x11-req)"),Dn(this,s)};Un.prototype.subsystem=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+9+1+4+n);return i[0]=sr.CHANNEL_REQUEST,Ze(i,e,1),Ze(i,9,5),i.write("subsystem",9,9,"ascii"),i[18]=r===void 0||r===!0?1:0,Ze(i,n,19),i.write(t,23,n,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", subsystem: "+t+")"),Dn(this,i)};Un.prototype.openssh_agentForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+26+1);return r[0]=sr.CHANNEL_REQUEST,Ze(r,e,1),Ze(r,26,5),r.write("auth-agent-req@openssh.com",9,26,"ascii"),r[35]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", auth-agent-req@openssh.com)"),Dn(this,r)};Un.prototype.authPassword=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.byteLength(t),i=0,s=Buffer.allocUnsafe(1+4+r+4+14+4+8+1+4+n);return s[i]=sr.USERAUTH_REQUEST,Ze(s,r,++i),s.write(e,i+=4,r,"utf8"),Ze(s,14,i+=r),s.write("ssh-connection",i+=4,14,"ascii"),Ze(s,8,i+=14),s.write("password",i+=4,8,"ascii"),s[i+=8]=0,Ze(s,n,++i),s.write(t,i+=4,n,"utf8"),this._state.authsQueue.push("password"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)"),Dn(this,s)};Un.prototype.authPK=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=this,i=this._state.outgoing,s;typeof t.getPublicSSH=="function"?(s=t.type,t=t.getPublicSSH()):s=t.toString("ascii",4,4+m6e(t,0));var a=Buffer.byteLength(e),c=Buffer.byteLength(s),l=t.length,d=i.sessionId.length,m=0,f=Buffer.allocUnsafe((r?4+d:0)+1+4+a+4+14+4+9+1+4+c+4+l);return r?(Ze(f,d,m),i.sessionId.copy(f,m+=4),f[m+=d]=sr.USERAUTH_REQUEST):f[m]=sr.USERAUTH_REQUEST,Ze(f,a,++m),f.write(e,m+=4,a,"utf8"),Ze(f,14,m+=a),f.write("ssh-connection",m+=4,14,"ascii"),Ze(f,9,m+=14),f.write("publickey",m+=4,9,"ascii"),f[m+=9]=r?1:0,Ze(f,c,++m),f.write(s,m+=4,c,"ascii"),Ze(f,l,m+=c),t.copy(f,m+=4),r?(r(f,function(g){if(g=E6e(g,s),g===!1)throw new Error("Error while converting handshake signature");var y=g.length,w=Buffer.allocUnsafe(1+4+a+4+14+4+9+1+4+c+4+l+4+4+c+4+y);return m=0,w[m]=sr.USERAUTH_REQUEST,Ze(w,a,++m),w.write(e,m+=4,a,"utf8"),Ze(w,14,m+=a),w.write("ssh-connection",m+=4,14,"ascii"),Ze(w,9,m+=14),w.write("publickey",m+=4,9,"ascii"),w[m+=9]=1,Ze(w,c,++m),w.write(s,m+=4,c,"ascii"),Ze(w,l,m+=c),t.copy(w,m+=4),Ze(w,4+c+4+y,m+=l),Ze(w,c,m+=4),w.write(s,m+=4,c,"ascii"),Ze(w,y,m+=c),g.copy(w,m+=4),n._state.authsQueue.push("publickey"),n.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey)"),Dn(n,w)}),!0):(this._state.authsQueue.push("publickey"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)"),Dn(this,f))};Un.prototype.authHostbased=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=this,a=this._state.outgoing,c;typeof t.getPublicSSH=="function"?(c=t.type,t=t.getPublicSSH()):c=t.toString("ascii",4,4+m6e(t,0));var l=Buffer.byteLength(e),d=Buffer.byteLength(c),m=t.length,f=a.sessionId.length,g=Buffer.byteLength(r),y=Buffer.byteLength(n),w=0,v=Buffer.allocUnsafe(4+f+1+4+l+4+14+4+9+4+d+4+m+4+g+4+y);return Ze(v,f,w),a.sessionId.copy(v,w+=4),v[w+=f]=sr.USERAUTH_REQUEST,Ze(v,l,++w),v.write(e,w+=4,l,"utf8"),Ze(v,14,w+=l),v.write("ssh-connection",w+=4,14,"ascii"),Ze(v,9,w+=14),v.write("hostbased",w+=4,9,"ascii"),Ze(v,d,w+=9),v.write(c,w+=4,d,"ascii"),Ze(v,m,w+=d),t.copy(v,w+=4),Ze(v,g,w+=m),v.write(r,w+=4,g,"ascii"),Ze(v,y,w+=g),v.write(n,w+=4,y,"utf8"),i(v,function(b){if(b=E6e(b,c),b===!1)throw new Error("Error while converting handshake signature");var S=b.length,P=Buffer.allocUnsafe(v.length-f+S);return v.copy(P,0,4+f),Ze(P,S,P.length-S-4),b.copy(P,P.length-S),s._state.authsQueue.push("hostbased"),s.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (hostbased)"),Dn(s,P)}),!0};Un.prototype.authKeyboard=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+20+4+4);return n[r]=sr.USERAUTH_REQUEST,Ze(n,t,++r),n.write(e,r+=4,t,"utf8"),Ze(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),Ze(n,20,r+=14),n.write("keyboard-interactive",r+=4,20,"ascii"),Ze(n,0,r+=20),Ze(n,0,r+=4),this._state.authsQueue.push("keyboard-interactive"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)"),Dn(this,n)};Un.prototype.authNone=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+4);return n[r]=sr.USERAUTH_REQUEST,Ze(n,t,++r),n.write(e,r+=4,t,"utf8"),Ze(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),Ze(n,4,r+=14),n.write("none",r+=4,4,"ascii"),this._state.authsQueue.push("none"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)"),Dn(this,n)};Un.prototype.authInfoRes=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=0,r=0,n,i,s;if(e)for(s=0,i=e.length;s<i;++s)t+=4+Buffer.byteLength(e[s]);var a=Buffer.allocUnsafe(1+4+t);if(a[r++]=sr.USERAUTH_INFO_RESPONSE,Ze(a,e?e.length:0,r),e)for(r+=4,s=0,i=e.length;s<i;++s)n=Buffer.byteLength(e[s]),Ze(a,n,r),r+=4,n&&(a.write(e[s],r,n,"utf8"),r+=n);return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_RESPONSE"),Dn(this,a)};Un.prototype.serviceAccept=function(e){if(!this.server)throw new Error("Server-only method called in client mode");var t=e.length,r=Buffer.allocUnsafe(1+4+t);if(r[0]=sr.SERVICE_ACCEPT,Ze(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_ACCEPT ("+e+")"),Dn(this,r),this.server&&this.banner&&e==="ssh-userauth"){var n=Buffer.byteLength(this.banner),i=1+4+n+4,s=Buffer.allocUnsafe(i);s[0]=sr.USERAUTH_BANNER,Ze(s,n,1),s.write(this.banner,5,n,"utf8"),s.fill(0,i-4),this.debug("DEBUG: Outgoing: Writing USERAUTH_BANNER"),Dn(this,s),this.banner=void 0}};Un.prototype.forwardedTcpip=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.boundAddr),s=Buffer.byteLength(n.remoteAddr),a=36+i,c=Buffer.allocUnsafe(1+4+15+4+4+4+4+i+4+4+s+4);return c[0]=sr.CHANNEL_OPEN,Ze(c,15,1),c.write("forwarded-tcpip",5,15,"ascii"),Ze(c,e,20),Ze(c,t,24),Ze(c,r,28),Ze(c,i,32),c.write(n.boundAddr,36,i,"ascii"),Ze(c,n.boundPort,a),Ze(c,s,a+=4),c.write(n.remoteAddr,a+=4,s,"ascii"),Ze(c,n.remotePort,a+=s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-tcpip)"),Dn(this,c)};Un.prototype.x11=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.originAddr),s=24+i,a=Buffer.allocUnsafe(1+4+3+4+4+4+4+i+4);return a[0]=sr.CHANNEL_OPEN,Ze(a,3,1),a.write("x11",5,3,"ascii"),Ze(a,e,8),Ze(a,t,12),Ze(a,r,16),Ze(a,i,20),a.write(n.originAddr,24,i,"ascii"),Ze(a,n.originPort,s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", x11)"),Dn(this,a)};Un.prototype.openssh_authAgent=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=Buffer.allocUnsafe(1+4+22+4+4+4);return n[0]=sr.CHANNEL_OPEN,Ze(n,22,1),n.write("auth-agent@openssh.com",5,22,"ascii"),Ze(n,e,27),Ze(n,t,31),Ze(n,r,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", auth-agent@openssh.com)"),Dn(this,n)};Un.prototype.openssh_forwardedStreamLocal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.socketPath),s=Buffer.allocUnsafe(1+4+33+4+4+4+4+i+4);return s[0]=sr.CHANNEL_OPEN,Ze(s,33,1),s.write("forwarded-streamlocal@openssh.com",5,33,"ascii"),Ze(s,e,38),Ze(s,t,42),Ze(s,r,46),Ze(s,i,50),s.write(n.socketPath,54,i,"utf8"),Ze(s,0,54+i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-streamlocal@openssh.com)"),Dn(this,s)};Un.prototype.exitStatus=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.allocUnsafe(1+4+4+11+1+4);return r[0]=sr.CHANNEL_REQUEST,Ze(r,e,1),Ze(r,11,5),r.write("exit-status",9,11,"ascii"),r[20]=0,Ze(r,t,21),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-status)"),Dn(this,r)};Un.prototype.exitSignal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(t),s=n?Buffer.byteLength(n):0,a=25+i,c=Buffer.allocUnsafe(1+4+4+11+1+4+i+1+4+s+4);return c[0]=sr.CHANNEL_REQUEST,Ze(c,e,1),Ze(c,11,5),c.write("exit-signal",9,11,"ascii"),c[20]=0,Ze(c,i,21),c.write(t,25,i,"utf8"),c[a++]=r?1:0,Ze(c,s,a),a+=4,s&&(c.write(n,a,s,"utf8"),a+=s),Ze(c,0,a),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-signal)"),Dn(this,c)};Un.prototype.authFailure=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length)throw new Error("No auth in progress");var n;if(typeof e=="boolean"&&(t=e,e=void 0),e){n=[];for(var i=0,s=e.length;i<s;++i)e[i].toLowerCase()!=="none"&&n.push(e[i]);n=n.join(",")}else n="";var a=n.length,c=Buffer.allocUnsafe(1+4+a+1);return c[0]=sr.USERAUTH_FAILURE,Ze(c,a,1),c.write(n,5,a,"ascii"),c[5+a]=t===!0?1:0,this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_FAILURE"),Dn(this,c)};Un.prototype.authSuccess=function(){if(!this.server)throw new Error("Server-only method called in client mode");var e=this._state.authsQueue;if(!e.length)throw new Error("No auth in progress");var t=this._state,r=t.outgoing,n=t.incoming;t.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_SUCCESS");var i=Dn(this,_$s);return r.compress.type==="zlib@openssh.com"&&(r.compress.instance=oC.createDeflate(Px),r.compress.queue=[]),n.decompress.type==="zlib@openssh.com"&&(n.decompress.instance=oC.createInflate(Px)),i};Un.prototype.authPKOK=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length||r[0]!=="publickey")throw new Error('"publickey" auth not in progress');var n=e.length,i=t.length,s=Buffer.allocUnsafe(1+4+n+4+i);return s[0]=sr.USERAUTH_PK_OK,Ze(s,n,1),s.write(e,5,n,"ascii"),Ze(s,i,5+n),t.copy(s,5+n+4),this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_PK_OK"),Dn(this,s)};Un.prototype.authPasswdChg=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.byteLength(e),n=t?t.length:0,i=0,s=Buffer.allocUnsafe(1+4+r+4+n);return s[i]=sr.USERAUTH_PASSWD_CHANGEREQ,Ze(s,r,++i),s.write(e,i+=4,r,"utf8"),Ze(s,n,i+=r),n&&s.write(t,i+=4,n,"ascii"),this.debug("DEBUG: Outgoing: Writing USERAUTH_PASSWD_CHANGEREQ"),Dn(this,s)};Un.prototype.authInfoReq=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=0,i=e?Buffer.byteLength(e):0,s=t?Buffer.byteLength(t):0,a=0,c,l,d,m;for(m=0,d=r.length;m<d;++m)n+=4+Buffer.byteLength(r[m].prompt)+1;var f=Buffer.allocUnsafe(1+4+i+4+s+4+4+n);for(f[a++]=sr.USERAUTH_INFO_REQUEST,Ze(f,i,a),a+=4,e&&(f.write(e,a,i,"utf8"),a+=i),Ze(f,s,a),a+=4,t&&(f.write(t,a,s,"utf8"),a+=s),Ze(f,0,a),a+=4,Ze(f,r.length,a),a+=4,m=0,d=r.length;m<d;++m)l=r[m],c=Buffer.byteLength(l.prompt),Ze(f,c,a),a+=4,c&&(f.write(l.prompt,a,c,"utf8"),a+=c),f[a++]=l.echo?1:0;return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_REQUEST"),Dn(this,f)};function E$s(e,t,r,n,i){if(r!==za.BY_APPLICATION){var s=new Error(n||t);s.code=r,e.emit("error",s)}e.reset()}o(E$s,"onDISCONNECT");function A$s(e,t,r){var n=e._state,i=n.outgoing;i.status===e0?(e.debug("DEBUG: Received re-key request"),i.status=t0,i.kexinit=void 0,C6e(e,s)):s();function s(){P$s(e,t,r)===!0&&(e.server?n.incoming.expectedPacket=n.kex.pktInit:n.kex.type==="groupex"?z$s(e):Qer(e))}o(s,"check")}o(A$s,"onKEXINIT");function P$s(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,a=e.debug,c,l,d,m,f;a("DEBUG: Comparing KEXINITs ...");var g=e.config.algorithms,y=g.kex;if(e.remoteBugs&Ree.BAD_DHGEX)for(var w=!1,v=y.length-1;v>=0;--v)y[v].indexOf("group-exchange")!==-1&&(w||(y=y.slice(),w=!0),y.splice(v,1));for(a("DEBUG: (local) KEX algorithms: "+y),a("DEBUG: (remote) KEX algorithms: "+t.algorithms.kex),e.server?(c=y,l=t.algorithms.kex):(c=t.algorithms.kex,l=y),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching key exchange algorithm");var b=new Error("Handshake failed: no matching key exchange algorithm");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}var S=l[f];for(a("DEBUG: KEX algorithm: "+S),r&&(!t.algorithms.kex.length||S!==t.algorithms.kex[0])&&(i.ignoreNext=!0),a("DEBUG: (local) Host key formats: "+g.serverHostKey),a("DEBUG: (remote) Host key formats: "+t.algorithms.srvHostKey),e.server?(c=g.serverHostKey,l=t.algorithms.srvHostKey):(c=t.algorithms.srvHostKey,l=g.serverHostKey),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching host key format");var b=new Error("Handshake failed: no matching host key format");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(n.hostkeyFormat=l[f],a("DEBUG: Host key format: "+n.hostkeyFormat),a("DEBUG: (local) Client->Server ciphers: "+g.cipher),a("DEBUG: (remote) Client->Server ciphers: "+t.algorithms.cs.encrypt),e.server?(c=g.cipher,l=t.algorithms.cs.encrypt):(c=t.algorithms.cs.encrypt,l=g.cipher),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Client->Server cipher");var b=new Error("Handshake failed: no matching client->server cipher");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decrypt.type=l[f]:d=s.encrypt.type=l[f],a("DEBUG: Client->Server Cipher: "+d),a("DEBUG: (local) Server->Client ciphers: "+g.cipher),a("DEBUG: (remote) Server->Client ciphers: "+t.algorithms.sc.encrypt),e.server?(c=g.cipher,l=t.algorithms.sc.encrypt):(c=t.algorithms.sc.encrypt,l=g.cipher),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Server->Client cipher");var b=new Error("Handshake failed: no matching server->client cipher");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.encrypt.type=l[f]:d=i.decrypt.type=l[f],a("DEBUG: Server->Client Cipher: "+d),a("DEBUG: (local) Client->Server HMAC algorithms: "+g.hmac),a("DEBUG: (remote) Client->Server HMAC algorithms: "+t.algorithms.cs.mac),e.server?(c=g.hmac,l=t.algorithms.cs.mac):(c=t.algorithms.cs.mac,l=g.hmac),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Client->Server HMAC algorithm");var b=new Error("Handshake failed: no matching client->server HMAC");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.hmac.type=l[f]:d=s.hmac.type=l[f],a("DEBUG: Client->Server HMAC algorithm: "+d),a("DEBUG: (local) Server->Client HMAC algorithms: "+g.hmac),a("DEBUG: (remote) Server->Client HMAC algorithms: "+t.algorithms.sc.mac),e.server?(c=g.hmac,l=t.algorithms.sc.mac):(c=t.algorithms.sc.mac,l=g.hmac),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Server->Client HMAC algorithm");var b=new Error("Handshake failed: no matching server->client HMAC");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.hmac.type=l[f]:d=i.hmac.type=l[f],a("DEBUG: Server->Client HMAC algorithm: "+d),a("DEBUG: (local) Client->Server compression algorithms: "+g.compress),a("DEBUG: (remote) Client->Server compression algorithms: "+t.algorithms.cs.compress),e.server?(c=g.compress,l=t.algorithms.cs.compress):(c=t.algorithms.cs.compress,l=g.compress),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Client->Server compression algorithm");var b=new Error("Handshake failed: no matching client->server compression algorithm");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decompress.type=l[f]:d=s.compress.type=l[f],a("DEBUG: Client->Server compression algorithm: "+d),a("DEBUG: (local) Server->Client compression algorithms: "+g.compress),a("DEBUG: (remote) Server->Client compression algorithms: "+t.algorithms.sc.compress),e.server?(c=g.compress,l=t.algorithms.sc.compress):(c=t.algorithms.sc.compress,l=g.compress),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Server->Client compression algorithm");var b=new Error("Handshake failed: no matching server->client compression algorithm");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}return e.server?d=s.compress.type=l[f]:d=i.decompress.type=l[f],a("DEBUG: Server->Client compression algorithm: "+d),n.kex=new lC(S),n.kex.generateKeys(),s.pubkey=n.kex.getPublicKey(),!0}o(P$s,"check_KEXINIT");function x$s(e,t,r){var n=e._state,i=n.outgoing;n.kex.setDHParams(t,r),n.kex.generateKeys(),i.pubkey=n.kex.getPublicKey(),Qer(e)}o(x$s,"onKEXDH_GEX_GROUP");function R$s(e,t){M$s(e,t)}o(R$s,"onKEXDH_INIT");function Her(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,a=e.debug,c,l;if(r===void 0){i.expectedPacket="NEWKEYS",s.sentNEWKEYS=!1,a("DEBUG: Checking host key format");var d=xn(t.hostkey,0,"ascii",e);if(d===!1)return!1;if(t.hostkey_format!==n.hostkeyFormat||t.hostkey_format!==d){a("DEBUG: Host key format mismatch"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host key format mismatch");return m.level="handshake",e.emit("error",m),!1}a("DEBUG: Checking signature format");var f=xn(t.sig,0,"ascii",e);if(f===!1)return!1;if(t.sig_format!==f){a("DEBUG: Signature format mismatch"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature format mismatch");return m.level="handshake",e.emit("error",m),!1}}if(s.status===y6e){if(r===void 0){a("DEBUG: Verifying host fingerprint");var g=!0,y=e.emit("fingerprint",t.hostkey,function(He){r===void 0&&(r=!!He,g||Her(e,t,r))});if(g=!1,y&&r===void 0)return}if(r===void 0)a("DEBUG: Host accepted by default (no verification)");else if(r===!0)a("DEBUG: Host accepted (verified)");else{a("DEBUG: Host denied via fingerprint verification"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host fingerprint verification failed");return m.level="handshake",e.emit("error",m),!1}}if(t.pubkey=n.kex.convertPublicKey(t.pubkey),t.secret=n.kex.computeSecret(t.pubkey),t.secret instanceof Error)return t.secret.message="Error while computing DH secret ("+n.kex.type+"): "+t.secret.message,t.secret.level="handshake",e.emit("error",t.secret),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;var w=Hs.createHash(n.kex.hash),v=Buffer.byteLength(e.config.ident),b=Buffer.byteLength(i.identRaw),S=s.kexinit.length,P=i.kexinit.length,q=t.hostkey.length,k=s.pubkey.length,j=t.pubkey.length,ee=t.secret.length,K=v+b+S+P+q+k+j+ee+4*8,V,oe,de,N,se=n.kex.getDHParams();se&&(de=se.prime,N=se.generator,V=de.length,oe=N.length,K+=4*3,K+=4*2,K+=V,K+=oe);var ne=0,xe=Buffer.allocUnsafe(K);Ze(xe,v,ne),ne+=4,xe.write(e.config.ident,ne,"utf8"),ne+=v,Ze(xe,b,ne),ne+=4,xe.write(i.identRaw,ne,"utf8"),ne+=b,Ze(xe,S,ne),ne+=4,s.kexinit.copy(xe,ne),ne+=S,s.kexinit=void 0,Ze(xe,P,ne),ne+=4,i.kexinit.copy(xe,ne),ne+=P,i.kexinit=void 0,Ze(xe,q,ne),ne+=4,t.hostkey.copy(xe,ne),ne+=q,se&&(S6e.slice(1).copy(xe,ne),ne+=4*3,Ze(xe,V,ne),ne+=4,de.copy(xe,ne),ne+=V,Ze(xe,oe,ne),ne+=4,N.copy(xe,ne),ne+=oe),Ze(xe,k,ne),ne+=4,s.pubkey.copy(xe,ne),ne+=k,Ze(xe,j,ne),ne+=4,t.pubkey.copy(xe,ne),ne+=j,Ze(xe,ee,ne),ne+=4,t.secret.copy(xe,ne),s.exchangeHash=w.update(xe).digest();var U=xn(t.sig,t.sig._pos,e);if(U===!1||!(U=Mer(U,t.sig_format,e)))return!1;var te=l$s(t.hostkey,t.sig_format);if(te instanceof Error)return!1;if(a("DEBUG: Verifying signature"),te.verify(s.exchangeHash,U)!==!0){a("DEBUG: Signature verification failed"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature verification failed");return m.level="handshake",e.emit("error",m),!1}s.sessionId===void 0&&(s.sessionId=s.exchangeHash),s.kexsecret=t.secret,a("DEBUG: Outgoing: Writing NEWKEYS"),s.status===t0?Dn(e,b6e,void 0,!0):Dn(e,b6e),s.sentNEWKEYS=!0,r!==void 0&&i.expectedPacket===void 0&&Ver(e)}o(Her,"onKEXDH_REPLY");function Ver(e){var t=e._state,r=t.outgoing,n=t.incoming;if(n.expectedPacket=void 0,!!r.sentNEWKEYS){var i=r.kexsecret.length,s=r.encrypt.info=zer[r.encrypt.type],a=0,c=t.kex.hash,l=Buffer.allocUnsafe(4+i),d,m;if(t.authsQueue=[],Ze(l,i,a),a+=4,r.kexsecret.copy(l,a),r.kexsecret=void 0,s.stream)d=_6e;else{for(d=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"B":"A","ascii").update(r.sessionId).digest();d.length<s.ivLen;)d=Buffer.concat([d,Hs.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>s.ivLen&&(d=d.slice(0,s.ivLen))}for(m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"D":"C","ascii").update(r.sessionId).digest();m.length<s.keyLen;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);if(m.length>s.keyLen&&(m=m.slice(0,s.keyLen)),s.authLen>0)r.encrypt.iv=d,r.encrypt.key=m,r.encrypt.instance=!0;else{var f=Sx[r.encrypt.type];r.encrypt.instance=Hs.createCipheriv(f,m,d),r.encrypt.instance.setAutoPadding(!1)}var g=n.decrypt.info=zer[n.decrypt.type];if(g.stream)d=_6e;else{for(d=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"A":"B","ascii").update(r.sessionId).digest();d.length<g.ivLen;)d=Buffer.concat([d,Hs.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>g.ivLen&&(d=d.slice(0,g.ivLen))}for(n.decrypt.buf=Buffer.allocUnsafe(g.blockLen),m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"C":"D","ascii").update(r.sessionId).digest();m.length<g.keyLen;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);m.length>g.keyLen&&(m=m.slice(0,g.keyLen));var y=Sx[n.decrypt.type];n.decrypt.instance=Hs.createDecipheriv(y,m,d),n.decrypt.instance.setAutoPadding(!1),n.decrypt.iv=d,n.decrypt.key=m;var w;s.discardLen>0&&(w=Buffer.alloc(s.discardLen),r.encrypt.instance.update(w)),g.discardLen>0&&((!w||w.length!==g.discardLen)&&(w=Buffer.alloc(s.discardLen)),n.decrypt.instance.update(w));var v=r.hmac.info=Oer[r.hmac.type],b=n.hmac.info=Oer[n.hmac.type];if(s.authLen===0){for(m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"F":"E","ascii").update(r.sessionId).digest();m.length<v.len;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);m.length>v.len&&(m=m.slice(0,v.len)),r.hmac.key=m}else r.hmac.key=void 0;if(g.authLen===0){for(m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"E":"F","ascii").update(r.sessionId).digest();m.length<b.len;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);m.length>b.len&&(m=m.slice(0,b.len)),n.hmac.key=m}else n.hmac.key=void 0;var S=g.authLen||n.hmac.info.actualLen;if((!n.hmac.buf||n.hmac.buf.length!==S)&&(n.hmac.buf=Buffer.allocUnsafe(S)),r.exchangeHash=void 0,r.compress.type==="zlib"?(r.compress.instance=oC.createDeflate(Px),r.compress.queue=[]):r.compress.type==="none"&&(r.compress.instance=!1,r.compress.queue=null),n.decompress.type==="zlib"?n.decompress.instance=oC.createInflate(Px):n.decompress.type==="none"&&(n.decompress.instance=!1),e.bytesSent=e.bytesReceived=0,r.status===t0){r.status=e0;var P=r.rekeyQueue,q=P.length,k=0;for(r.rekeyQueue=[];k<q;++k)Buffer.isBuffer(P[k])?Dn(e,P[k]):Dn(e,P[k][0],P[k][1]);P=n.rekeyQueue,q=P.length,k=0,n.rekeyQueue=[];for(var j=n.seqno;k<q;++k)if(n.seqno=P[k][0],n.payload=P[k][1],Xer(e)===!1||n.status===Ex)return;n.seqno=j}else r.status=e0,n.status===p6e&&(e.debug("DEBUG: Parser: IN_PACKETBEFORE (update) (expecting "+g.blockLen+")"),cC(e,Ax,g.blockLen,n.decrypt.buf)),e.emit("ready")}}o(Ver,"onNEWKEYS");function Iee(e,t){var r=e._state.kex;if(r)switch(t){case 30:return r.pktInit;case 31:switch(r.type){case"group":return"KEXDH_REPLY";case"groupex":return"KEXDH_GEX_GROUP";default:return"KEXECDH_REPLY"}break;case 33:if(r.type==="groupex")return"KEXDH_GEX_REPLY"}return sr[t]}o(Iee,"getPacketType");function Xer(e,t){var r=e._state.incoming,n=e._state.outgoing,i=r.payload,s=r.seqno,a,c,l,d,m,f,g,y,w,v,b,S,P,q;if(++r.seqno>w6e&&(r.seqno=0),r.ignoreNext){e.debug("DEBUG: Parser: Packet ignored"),r.ignoreNext=!1;return}var k=i[0];if(k===void 0)return!1;if(n.status!==e0&&Iee(e,k)!==r.expectedPacket&&k<1&&k>4){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+r.expectedPacket+" but got: "+Iee(e,k)),e.disconnect(za.PROTOCOL_ERROR);var j=new Error("Received unexpected packet");return j.level="protocol",e.emit("error",j),!1}if(k===sr.CHANNEL_DATA){if(m=ws(i,1,e,t),m===!1||(f=xn(i,5,e,t,32768),f===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA ("+m+")"),e.emit("CHANNEL_DATA:"+m,f)}else if(k===sr.CHANNEL_EXTENDED_DATA){if(m=ws(i,1,e,t),m===!1)return!1;var ee=ws(i,5,e,t);if(ee===!1||(f=xn(i,9,e,t),f===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EXTENDED_DATA ("+m+")"),e.emit("CHANNEL_EXTENDED_DATA:"+m,ee,f)}else if(k===sr.CHANNEL_WINDOW_ADJUST){if(m=ws(i,1,e,t),m===!1)return!1;var K=ws(i,5,e,t);if(K===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_WINDOW_ADJUST ("+m+", "+K+")"),e.emit("CHANNEL_WINDOW_ADJUST:"+m,K)}else if(k===sr.CHANNEL_SUCCESS){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_SUCCESS ("+m+")"),e.emit("CHANNEL_SUCCESS:"+m)}else if(k===sr.CHANNEL_FAILURE){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE ("+m+")"),e.emit("CHANNEL_FAILURE:"+m)}else if(k===sr.CHANNEL_EOF){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EOF ("+m+")"),e.emit("CHANNEL_EOF:"+m)}else if(k===sr.CHANNEL_OPEN){var V=xn(i,1,"ascii",e,t);if(V===!1||(w=ws(i,i._pos,e,t),w===!1)||(v=ws(i,i._pos+=4,e,t),v===!1)||(b=ws(i,i._pos+=4,e,t),b===!1))return!1;var oe;if(e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN ("+w+", "+V+")"),V==="forwarded-tcpip"||V==="direct-tcpip"){var de=xn(i,i._pos+=4,"ascii",e,t);if(de===!1)return!1;var N=ws(i,i._pos,e,t);if(N===!1||(g=xn(i,i._pos+=4,"ascii",e,t),g===!1)||(y=ws(i,i._pos,e,t),y===!1))return!1;oe={type:V,sender:w,window:v,packetSize:b,data:{destIP:de,destPort:N,srcIP:g,srcPort:y}}}else if(V==="forwarded-streamlocal@openssh.com"||V==="direct-streamlocal@openssh.com"){if(q=xn(i,i._pos+=4,"utf8",e,t),q===!1)return!1;oe={type:V,sender:w,window:v,packetSize:b,data:{socketPath:q}}}else if(V==="x11"){if(g=xn(i,i._pos+=4,"ascii",e,t),g===!1||(y=ws(i,i._pos,e,t),y===!1))return!1;oe={type:V,sender:w,window:v,packetSize:b,data:{srcIP:g,srcPort:y}}}else oe={type:V,sender:w,window:v,packetSize:b,data:{}};e.emit("CHANNEL_OPEN",oe)}else if(k===sr.CHANNEL_OPEN_CONFIRMATION){if(S=ws(i,1,e,t),S===!1||(w=ws(i,5,e,t),w===!1)||(v=ws(i,9,e,t),v===!1)||(b=ws(i,13,e,t),b===!1))return!1;d={recipient:S,sender:w,window:v,packetSize:b},i.length>17&&(d.data=i.slice(17)),e.emit("CHANNEL_OPEN_CONFIRMATION:"+d.recipient,d)}else if(k===sr.CHANNEL_OPEN_FAILURE){if(S=ws(i,1,e,t),S===!1)return!1;var se=ws(i,5,e,t);if(se===!1||(P=xn(i,9,"utf8",e,t),P===!1)||(c=xn(i,i._pos,"utf8",e,t),c===!1))return!1;i._pos=9,d={recipient:S,reasonCode:se,reason:d$s[se],description:P,lang:c},e.emit("CHANNEL_OPEN_FAILURE:"+d.recipient,d)}else if(k===sr.CHANNEL_CLOSE){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_CLOSE ("+m+")"),e.emit("CHANNEL_CLOSE:"+m)}else if(k!==sr.IGNORE){if(k===sr.DISCONNECT){var ne=ws(i,1,e,t);if(ne===!1)return!1;var xe=za[ne];if(P=xn(i,5,"utf8",e,t),P===!1)return!1;i._pos<i.length&&(c=xn(i,i._pos,"ascii",e,t)),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: DISCONNECT ("+xe+")"),e.emit("DISCONNECT",xe,ne,P,c)}else if(k===sr.DEBUG){if(l=xn(i,2,"utf8",e,t),l===!1||(c=xn(i,i._pos,"ascii",e,t),c===!1))return!1;e.emit("DEBUG",l,c)}else if(k===sr.NEWKEYS)e.emit("NEWKEYS");else if(k===sr.SERVICE_REQUEST){if(a=xn(i,1,"ascii",e,t),a===!1)return!1;e.emit("SERVICE_REQUEST",a)}else if(k===sr.SERVICE_ACCEPT){if(a=xn(i,1,"ascii",e,t),a===!1)return!1;e.emit("SERVICE_ACCEPT",a)}else if(k===sr.USERAUTH_REQUEST){var U=xn(i,1,"utf8",e,t);if(U===!1)return!1;var te=xn(i,i._pos,"ascii",e,t);if(te===!1)return!1;var He=xn(i,i._pos,"ascii",e,t);if(He===!1)return!1;var Qe,it;if(He==="password"){if(Qe=xn(i,i._pos+1,"utf8",e,t),Qe===!1)return!1}else if(He==="publickey"||He==="hostbased"){var qt,Dt,tr,lt,pt,mr,gt;if(He==="publickey"){if(qt=i[i._pos++],qt===void 0)return!1;qt=qt!==0}if(Dt=xn(i,i._pos,"ascii",e,t),Dt===!1||(tr=xn(i,i._pos,e,t),tr===!1))return!1;if(qt||He==="hostbased"){if(He==="hostbased"&&(mr=xn(i,i._pos,"ascii",e,t),mr===!1||(gt=xn(i,i._pos,"utf8",e,t),gt===!1)))return!1;var ar=i._pos;if(lt=xn(i,ar,e,t),lt===!1||(lt.length>4+Dt.length+4&&lt.toString("ascii",4,4+Dt.length)===Dt&&(lt=lt.slice(4+Dt.length+4)),lt=Mer(lt,Dt,e,t),lt===!1))return!1;pt=Buffer.allocUnsafe(4+n.sessionId.length+ar),Ze(pt,n.sessionId.length,0),n.sessionId.copy(pt,4),i.copy(pt,4+n.sessionId.length,0,ar)}else it="publickey -- check";Qe={keyAlgo:Dt,key:tr,signature:lt,blob:pt,localHostname:mr,localUsername:gt}}else if(He==="keyboard-interactive"){var Lr=ws(i,i._pos,e,t);if(Lr===!1||(Qe=xn(i,i._pos+4+Lr,"utf8",e,t),Qe===!1))return!1}else He!=="none"&&(Qe=i.slice(i._pos));it===void 0&&(it=He),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_REQUEST ("+it+")"),e._state.authsQueue.push(He),e.emit("USERAUTH_REQUEST",U,te,He,Qe)}else if(k===sr.USERAUTH_SUCCESS)n.compress.type==="zlib@openssh.com"&&(n.compress.instance=oC.createDeflate(Px),n.compress.queue=[]),r.decompress.type==="zlib@openssh.com"&&(r.decompress.instance=oC.createInflate(Px)),e._state.authsQueue.shift(),e.emit("USERAUTH_SUCCESS");else if(k===sr.USERAUTH_FAILURE){var $e=xn(i,1,"ascii",e,t);if($e===!1)return!1;var kr=i[i._pos];if(kr===void 0)return!1;kr=kr!==0,$e=$e.split(","),e._state.authsQueue.shift(),e.emit("USERAUTH_FAILURE",$e,kr)}else if(k===sr.USERAUTH_BANNER){if(l=xn(i,1,"utf8",e,t),l===!1||(c=xn(i,i._pos,"utf8",e,t),c===!1))return!1;e.emit("USERAUTH_BANNER",l,c)}else if(k===sr.GLOBAL_REQUEST){var O=xn(i,1,"ascii",e,t);if(O===!1)return e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST"),!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST ("+O+")");var Y=i[i._pos++];if(Y===void 0)return!1;Y=Y!==0;var he;if(O==="tcpip-forward"||O==="cancel-tcpip-forward"){var Re=xn(i,i._pos,"ascii",e,t);if(Re===!1)return!1;var Be=ws(i,i._pos,e,t);if(Be===!1)return!1;he={bindAddr:Re,bindPort:Be}}else if(O==="streamlocal-forward@openssh.com"||O==="cancel-streamlocal-forward@openssh.com"){if(q=xn(i,i._pos,"utf8",e,t),q===!1)return!1;he={socketPath:q}}else O==="no-more-sessions@openssh.com"||(he=i.slice(i._pos));e.emit("GLOBAL_REQUEST",O,Y,he)}else if(k===sr.REQUEST_SUCCESS)i.length>1?e.emit("REQUEST_SUCCESS",i.slice(1)):e.emit("REQUEST_SUCCESS");else if(k===sr.REQUEST_FAILURE)e.emit("REQUEST_FAILURE");else if(k!==sr.UNIMPLEMENTED){if(k===sr.KEXINIT)return k$s(e,t);if(k===sr.CHANNEL_REQUEST)return q$s(e,t);if(k>=30&&k<=49)return T$s(e,k,t);if(k>=60&&k<=70)return I$s(e,k,t);var Bt=Buffer.allocUnsafe(1+4);Bt[0]=sr.UNIMPLEMENTED,Ze(Bt,s,1),Dn(e,Bt)}}}o(Xer,"parsePacket");function k$s(e,t){var r=e._state.incoming,n=r.payload,i={algorithms:{kex:void 0,srvHostKey:void 0,cs:{encrypt:void 0,mac:void 0,compress:void 0},sc:{encrypt:void 0,mac:void 0,compress:void 0}},languages:{cs:void 0,sc:void 0}},s;if(s=sh(n,17,e,t),s===!1||(i.algorithms.kex=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.srvHostKey=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.cs.encrypt=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.sc.encrypt=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.cs.mac=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.sc.mac=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.cs.compress=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.sc.compress=s,s=sh(n,n._pos,e,t),s===!1)||(i.languages.cs=s,s=sh(n,n._pos,e,t),s===!1))return!1;i.languages.sc=s;var a=n._pos<n.length&&n[n._pos]===1;r.kexinit=n,e.emit("KEXINIT",i,a)}o(k$s,"parse_KEXINIT");function T$s(e,t,r){var n=e._state,i=n.incoming,s=i.payload;if(n.outgoing.status===e0||Iee(e,t)!==i.expectedPacket){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+i.expectedPacket+" but got: "+Iee(e,t)),e.disconnect(za.PROTOCOL_ERROR);var a=new Error("Received unexpected packet");return a.level="protocol",e.emit("error",a),!1}if(n.kex.type==="groupex"){if(e.server){e.disconnect(za.PROTOCOL_ERROR);var a=new Error("DH group exchange not supported by server");return a.level="handshake",e.emit("error",a),!1}else if(t===sr.KEXDH_GEX_GROUP){var c=xn(s,1,e,r);if(c===!1)return!1;var l=xn(s,s._pos,e,r);if(l===!1)return!1;e.emit("KEXDH_GEX_GROUP",c,l)}else if(t===sr.KEXDH_GEX_REPLY)return Ker(e,r)}else if(t===sr.KEXDH_INIT){var d=xn(s,1,e,r);if(d===!1)return!1;e.emit("KEXDH_INIT",d)}else if(t===sr.KEXDH_REPLY)return Ker(e,r)}o(T$s,"parse_KEX");function Ker(e,t){var r=e._state.incoming.payload,n=xn(r,1,e,t);if(n===!1)return!1;var i=xn(r,r._pos,e,t);if(i===!1)return!1;var s=xn(r,r._pos,e,t);if(s===!1)return!1;var a={hostkey:n,hostkey_format:void 0,pubkey:i,sig:s,sig_format:void 0},c=xn(n,0,"ascii",e,t);if(c===!1)return!1;a.hostkey_format=c;var l=xn(s,0,"ascii",e,t);if(l===!1)return!1;a.sig_format=l,e.emit("KEXDH_REPLY",a)}o(Ker,"parse_KEXDH_REPLY");function I$s(e,t,r){var n=e._state,i=n.authsQueue[0],s=n.incoming.payload,a,c,l;if(i==="password"){if(t===sr.USERAUTH_PASSWD_CHANGEREQ){if(a=xn(s,1,"utf8",e,r),a===!1||(c=xn(s,s._pos,"utf8",e,r),c===!1))return!1;e.emit("USERAUTH_PASSWD_CHANGEREQ",a,c)}}else if(i==="keyboard-interactive"){if(t===sr.USERAUTH_INFO_REQUEST){var d,m,f;if(d=xn(s,1,"utf8",e,r),d===!1||(m=xn(s,s._pos,"utf8",e,r),m===!1)||(c=xn(s,s._pos,"utf8",e,r),c===!1)||(f=ws(s,s._pos,e,r),f===!1))return!1;s._pos+=4;for(var g=[],y=0;y<f;++y){if(l=xn(s,s._pos,"utf8",e,r),l===!1)return!1;var w=s[s._pos++];if(w===void 0)return!1;w=w!==0,g.push({prompt:l,echo:w})}e.emit("USERAUTH_INFO_REQUEST",d,m,c,g)}else if(t===sr.USERAUTH_INFO_RESPONSE){var v=ws(s,1,e,r);if(v===!1)return!1;s._pos=5;for(var b=[],S=0;S<v;++S){if(l=xn(s,s._pos,"utf8",e,r),l===!1)return!1;b.push(l)}e.emit("USERAUTH_INFO_RESPONSE",b)}}else if(i==="publickey"){if(t===sr.USERAUTH_PK_OK){var P=e._state.authsQueue;if(!P.length||P[0]!=="publickey")return;P.shift(),e.emit("USERAUTH_PK_OK")}}else if(i!==void 0){e.disconnect(za.PROTOCOL_ERROR);var q=new Error("Invalid authentication method: "+i);q.level="protocol",e.emit("error",q)}}o(I$s,"parse_USERAUTH");function q$s(e,t){var r=e._state.incoming.payload,n,i,s,a,c,l,d,m=ws(r,1,e,t);if(m===!1)return!1;var f=xn(r,5,"ascii",e,t);if(f===!1)return!1;if(f==="exit-status"){var g=ws(r,++r._pos,e,t);if(g===!1)return!1;n={recipient:m,request:f,wantReply:!1,code:g}}else if(f==="exit-signal"){var y;if(e.remoteBugs&Ree.OLD_EXIT){if(d=ws(r,++r._pos,e,t),d===!1)return!1;switch(d){case 1:d="HUP";break;case 2:d="INT";break;case 3:d="QUIT";break;case 6:d="ABRT";break;case 9:d="KILL";break;case 14:d="ALRM";break;case 15:d="TERM";break;default:d="UNKNOWN ("+d+")"}y=!1}else{if(d=xn(r,++r._pos,"ascii",e,t),d===!1||(y=r[r._pos++],y===void 0))return!1;y=y!==0}var w=xn(r,r._pos,"utf8",e,t);if(w===!1)return!1;var v=xn(r,r._pos,"utf8",e,t);if(v===!1)return!1;n={recipient:m,request:f,wantReply:!1,signal:d,coredump:y,description:w,lang:v}}else if(f==="pty-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var b=xn(r,r._pos,"ascii",e,t);if(b===!1||(i=ws(r,r._pos,e,t),i===!1)||(s=ws(r,r._pos+=4,e,t),s===!1)||(a=ws(r,r._pos+=4,e,t),a===!1)||(c=ws(r,r._pos+=4,e,t),c===!1))return!1;var S=xn(r,r._pos+=4,e,t);if(S===!1)return!1;S=N$s(S),n={recipient:m,request:f,wantReply:l,term:b,cols:i,rows:s,width:a,height:c,modes:S}}else if(f==="window-change"){if(i=ws(r,++r._pos,e,t),i===!1||(s=ws(r,r._pos+=4,e,t),s===!1)||(a=ws(r,r._pos+=4,e,t),a===!1)||(c=ws(r,r._pos+=4,e,t),c===!1))return!1;n={recipient:m,request:f,wantReply:!1,cols:i,rows:s,width:a,height:c}}else if(f==="x11-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var P=r[r._pos++];if(P===void 0)return!1;P=P!==0;var q=xn(r,r._pos,"ascii",e,t);if(q===!1)return!1;var k=xn(r,r._pos,"binary",e,t);if(k===!1)return!1;var j=ws(r,r._pos,e,t);if(j===!1)return!1;n={recipient:m,request:f,wantReply:l,single:P,protocol:q,cookie:k,screen:j}}else if(f==="env"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var ee=xn(r,r._pos,"utf8",e,t);if(ee===!1)return!1;var K=xn(r,r._pos,"utf8",e,t);if(K===!1)return!1;n={recipient:m,request:f,wantReply:l,key:ee,val:K}}else if(f==="shell"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:m,request:f,wantReply:l}}else if(f==="exec"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var V=xn(r,r._pos,"utf8",e,t);if(V===!1)return!1;n={recipient:m,request:f,wantReply:l,command:V}}else if(f==="subsystem"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var oe=xn(r,r._pos,"utf8",e,t);if(oe===!1)return!1;n={recipient:m,request:f,wantReply:l,subsystem:oe}}else if(f==="signal"){if(d=xn(r,++r._pos,"ascii",e,t),d===!1)return!1;n={recipient:m,request:f,wantReply:!1,signal:"SIG"+d}}else if(f==="xon-xoff"){var de=r[++r._pos];if(de===void 0)return!1;de=de!==0,n={recipient:m,request:f,wantReply:!1,clientControl:de}}else if(f==="auth-agent-req@openssh.com"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:m,request:f,wantReply:l}}else{if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:m,request:f,wantReply:l}}e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST ("+m+", "+f+")"),e.emit("CHANNEL_REQUEST:"+m,n)}o(q$s,"parse_CHANNEL_REQUEST");function D$s(e,t){var r=e._state.incoming,n=r.hmac;if(e.debug("DEBUG: Parser: Verifying MAC"),r.decrypt.info.authLen>0){var i=r.decrypt,s=i.instance;s.setAuthTag(t);var a=s.update(r.packet);return r.payload=a.slice(1,r.packet.length-a[0]),Ler(i.iv),i.instance=Hs.createDecipheriv(Sx[i.type],i.key,i.iv),i.instance.setAutoPadding(!1),!0}else{var c=Hs.createHmac(Sx[n.type],n.key);Ze(Tee,r.seqno,0),Ze(Tee,r.pktLen,4),Tee[8]=r.padLen,c.update(Tee),c.update(r.packet);var l=c.digest();return l.length>r.hmac.info.actualLen&&(l=l.slice(0,r.hmac.info.actualLen)),B$s(l,t)}}o(D$s,"hmacVerify");function Wer(e,t){var r=e._state.incoming.decrypt.instance;return e.debug("DEBUG: Parser: Decrypting"),r.update(t)}o(Wer,"decryptData");function cC(e,t,r,n){var i=e._state.incoming.expect;i.amount=r,i.type=t,i.ptr=0,n?i.buf=n:r&&(i.buf=Buffer.allocUnsafe(r))}o(cC,"expectData");function sh(e,t,r,n){var i=xn(e,t,"ascii",r,n);return i!==!1?i.length?i.split(","):[]:!1}o(sh,"readList");function N$s(e){for(var t={},r=0,n=e.length,i;r<n&&(i=e[r],!(i===Cx.TTY_OP_END||Cx[i]===void 0||r+5>n));r+=5)t[Cx[i]]=m6e(e,r+1);return t}o(N$s,"bytesToModes");function L$s(e){for(var t=/^\d+$/,r=Object.keys(e),n=0,i=[],s=0,a=r.length,c,l,d;s<a;++s)c=r[s],l=Cx[c],l&&!t.test(c)&&typeof e[c]=="number"&&c!=="TTY_OP_END"&&(d=e[c],i[n++]=l,i[n++]=d>>>24&255,i[n++]=d>>>16&255,i[n++]=d>>>8&255,i[n++]=d&255);return i[n]=Cx.TTY_OP_END,i}o(L$s,"modesToBytes");function C6e(e,t){return j$s(16,function(r){var n=e.config.algorithms,i=n.kexBuf;if(e.remoteBugs&Ree.BAD_DHGEX){for(var s=!1,a=n.kex,c=a.length-1;c>=0;--c)a[c].indexOf("group-exchange")!==-1&&(s||(a=a.slice(),s=!0),a.splice(c,1));s&&(i=Buffer.from(a.join(",")))}var l=n.serverHostKeyBuf,d=1+16+4+i.length+4+l.length+2*(4+n.cipherBuf.length)+2*(4+n.hmacBuf.length)+2*(4+n.compressBuf.length)+2*4+1+4,m=Buffer.allocUnsafe(d),f=17;m[0]=sr.KEXINIT,r!==!1&&r.copy(m,1),Ze(m,i.length,f),f+=4,i.copy(m,f),f+=i.length,Ze(m,l.length,f),f+=4,l.copy(m,f),f+=l.length,Ze(m,n.cipherBuf.length,f),f+=4,n.cipherBuf.copy(m,f),f+=n.cipherBuf.length,Ze(m,n.cipherBuf.length,f),f+=4,n.cipherBuf.copy(m,f),f+=n.cipherBuf.length,Ze(m,n.hmacBuf.length,f),f+=4,n.hmacBuf.copy(m,f),f+=n.hmacBuf.length,Ze(m,n.hmacBuf.length,f),f+=4,n.hmacBuf.copy(m,f),f+=n.hmacBuf.length,Ze(m,n.compressBuf.length,f),f+=4,n.compressBuf.copy(m,f),f+=n.compressBuf.length,Ze(m,n.compressBuf.length,f),f+=4,n.compressBuf.copy(m,f),f+=n.compressBuf.length,m.fill(0,m.length-13),e.debug("DEBUG: Outgoing: Writing KEXINIT"),e._state.incoming.expectedPacket="KEXINIT";var g=e._state.outgoing;g.kexinit=m,g.status===e0&&(g.status=t0),Dn(e,m,t,!0)}),!0}o(C6e,"KEXINIT");function Qer(e){var t=e._state,r=t.outgoing,n=Buffer.allocUnsafe(1+4+r.pubkey.length);return t.incoming.expectedPacket=t.kex.pktReply,t.kex.type==="groupex"?(n[0]=sr.KEXDH_GEX_INIT,e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_INIT")):(n[0]=sr.KEXDH_INIT,t.kex.type==="group"?e.debug("DEBUG: Outgoing: Writing KEXDH_INIT"):e.debug("DEBUG: Outgoing: Writing KEXECDH_INIT")),Ze(n,r.pubkey.length,1),r.pubkey.copy(n,5),Dn(e,n,void 0,!0)}o(Qer,"KEXDH_INIT");function M$s(e,t){var r=e._state,n=r.outgoing,i=r.incoming,s=e.config.hostKeys[r.hostkeyFormat];Array.isArray(s)&&(s=s[0]);var a=s.getPublicSSH(),c=s.type;t=r.kex.convertPublicKey(t);var l=r.kex.computeSecret(t);if(l instanceof Error)return l.message="Error while computing DH secret ("+r.kex.type+"): "+l.message,l.level="handshake",e.emit("error",l),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;var d=Hs.createHash(r.kex.hash),m=Buffer.byteLength(i.identRaw),f=Buffer.byteLength(e.config.ident),g=i.kexinit.length,y=n.kexinit.length,w=a.length,v=t.length,b=n.pubkey.length,S=l.length,P=m+f+g+y+w+v+b+S+4*8,q,k,j,ee,K=r.kex.getDHParams();K&&(j=K.prime,ee=K.generator,q=j.length,k=ee.length,P+=4*3,P+=4*2,P+=q,P+=k);var V=0,oe=Buffer.allocUnsafe(P);Ze(oe,m,V),V+=4,oe.write(i.identRaw,V,"utf8"),V+=m,Ze(oe,f,V),V+=4,oe.write(e.config.ident,V,"utf8"),V+=f,Ze(oe,g,V),V+=4,i.kexinit.copy(oe,V),V+=g,i.kexinit=void 0,Ze(oe,y,V),V+=4,n.kexinit.copy(oe,V),V+=y,n.kexinit=void 0,Ze(oe,w,V),V+=4,a.copy(oe,V),V+=w,K&&(S6e.slice(1).copy(oe,V),V+=4*3,Ze(oe,q,V),V+=4,j.copy(oe,V),V+=q,Ze(oe,k,V),V+=4,ee.copy(oe,V),V+=k),Ze(oe,v,V),V+=4,t.copy(oe,V),V+=v,Ze(oe,b,V),V+=4,n.pubkey.copy(oe,V),V+=b,Ze(oe,S,V),V+=4,l.copy(oe,V),n.exchangeHash=d.update(oe).digest(),n.sessionId===void 0&&(n.sessionId=n.exchangeHash),n.kexsecret=l;var de=s.sign(n.exchangeHash);if(de instanceof Error)return de.message="Error while signing data with host key ("+c+"): "+de.message,de.level="handshake",e.emit("error",de),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;if(de=E6e(de,c),de===!1)return de.message="Error while converting handshake signature",de.level="handshake",e.emit("error",de),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;var N=4+c.length+4+de.length,se=Buffer.allocUnsafe(1+4+w+4+b+4+N);return V=0,se[V]=sr[r.kex.pktReply],++V,Ze(se,w,V),V+=4,a.copy(se,V),V+=w,Ze(se,b,V),V+=4,n.pubkey.copy(se,V),V+=b,Ze(se,N,V),V+=4,Ze(se,c.length,V),V+=4,se.write(c,V,c.length,"ascii"),V+=c.length,Ze(se,de.length,V),V+=4,de.copy(se,V),r.incoming.expectedPacket="NEWKEYS",e.debug("DEBUG: Outgoing: Writing "+r.kex.pktReply),Dn(e,se,void 0,!0),n.sentNEWKEYS=!0,e.debug("DEBUG: Outgoing: Writing NEWKEYS"),Dn(e,b6e,void 0,!0)}o(M$s,"KEXDH_REPLY");function z$s(e){return e._state.incoming.expectedPacket="KEXDH_GEX_GROUP",e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST"),Dn(e,S6e,void 0,!0)}o(z$s,"KEXDH_GEX_REQ");function Yer(e,t,r){var n=e._state.outgoing.compress.instance;n.write(t),n.flush(v6e,O$s.bind(e,r))}o(Yer,"compressPayload");function O$s(e){if(!(this._readableState.ended||this._writableState.ended)){Zer(this,this._state.outgoing.compress.instance.read(),e);var t=this._state.outgoing.compress.queue;t.shift(),t.length>0&&Yer(this,t[0][0],t[0][1])}}o(O$s,"compressFlushCb");function Dn(e,t,r,n){var i=e._state;if(!i)return!1;var s=i.outgoing;if(s.status===t0&&!n)return typeof r=="function"?s.rekeyQueue.push([t,r]):s.rekeyQueue.push(t),!1;if(e._readableState.ended||e._writableState.ended)return!1;if(s.compress.instance){var a=s.compress.queue;return a.push([t,r]),a.length===1&&Yer(e,a[0][0],a[0][1]),!0}else return Zer(e,t,r)}o(Dn,"send");function Zer(e,t,r){var n=e._state,i=n.outgoing,s=i.encrypt,a=i.hmac,c,l,d,m,f;if(c=t.length+9,s.instance!==!1)if(s.info.authLen>0){for(var g=1+t.length+4;g%s.info.blockLen!=0;)++g;l=g-1-t.length,c=4+g}else{var y=s.info.blockLen;c+=(y-1)*c%y,l=c-t.length-5}else c+=7*c%8,l=c-t.length-5;d=Buffer.allocUnsafe(c),Ze(d,c-4,0),d[4]=l,t.copy(d,5),F$s(d,5+t.length,l),a.type!==!1&&a.key&&(m=Hs.createHmac(Sx[a.type],a.key),Ze(i.bufSeqno,i.seqno,0),m.update(i.bufSeqno),m.update(d),m=m.digest(),m.length>a.info.actualLen&&(m=m.slice(0,a.info.actualLen)));var w=0,v;if(s.instance!==!1)if(s.info.authLen>0){var b=Hs.createCipheriv(Sx[s.type],s.key,s.iv);b.setAutoPadding(!1);var S=d.slice(0,4);b.setAAD(S),e.push(S),w+=S,v=b.update(d.slice(4)),e.push(v),w+=v.length;var P=b.final();P.length&&(e.push(P),w+=P.length);var q=b.getAuthTag();f=e.push(q),w+=q.length,Ler(s.iv)}else v=s.instance.update(d),e.push(v),w+=v.length,f=e.push(m),w+=m.length;else f=e.push(d),w=d.length;return e.bytesSent+=w,++i.seqno>w6e&&(i.seqno=0),r&&r(),f}o(Zer,"send_");var F$s=function(){return typeof Hs.randomFillSync=="function"?Hs.randomFillSync:o(function(t,r,n){var i=Hs.randomBytes(n);i.copy(t,r)},"copyRandPadBytes")}();function j$s(e,t){Hs.randomBytes(e,o(function r(n,i){if(n)return Hs.randomBytes(e,r);t&&t(i)},"retry"))}o(j$s,"randBytes");function E6e(e,t){switch(t){case"ssh-dss":return o$s(e);case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return c$s(e)}return e}o(E6e,"convertSignature");var B$s=function(){return typeof Hs.timingSafeEqual=="function"?o(function(t,r){return t.length!==r.length?(Hs.timingSafeEqual(t,t),!1):Hs.timingSafeEqual(t,r)},"timingSafeEquals"):o(function(t,r){var n;t.length===r.length?n=0:(n=1,r=t);for(var i=0,s=t.length;i<s;++i)n|=t[i]^r[i];return n===0},"timingSafeEquals")}();function lC(e,t){switch(e){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!m$s)break;this.type="25519",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp256":this.type="ecdh",this.name="prime256v1",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp384":this.type="ecdh",this.name="secp384r1",this.hash="sha384",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp521":this.type="ecdh",this.name="secp521r1",this.hash="sha512",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"diffie-hellman-group1-sha1":this.type="group",this.name="modp2",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha1":this.type="group",this.name="modp14",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha256":this.type="group",this.name="modp14",this.hash="sha256",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group16-sha512":this.type="group",this.name="modp16",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group18-sha512":this.type="group",this.name="modp18",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group-exchange-sha1":this.type="groupex",this.hash="sha1",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return;case"diffie-hellman-group-exchange-sha256":this.type="groupex",this.hash="sha256",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return}throw new Error("Unsupported key exchange algorithm: "+e)}o(lC,"KeyExchange");lC.prototype.setDHParams=function(e,t){if(this.type==="groupex"){if(!Buffer.isBuffer(e))throw new Error("Invalid prime value");if(!Buffer.isBuffer(t))throw new Error("Invalid generator value");this._prime=e,this._generator=t}};lC.prototype.getDHParams=function(){if(this.type==="groupex"&&this._kex)return{prime:qee(this._kex.getPrime()),generator:qee(this._kex.getGenerator())}};lC.prototype.generateKeys=function(){switch(this.type){case"25519":this._keys||(this._keys=Hs.generateKeyPairSync("x25519"));break;case"ecdh":this._kex||(this._kex=Hs.createECDH(this.name),this._public=this._kex.generateKeys());break;case"group":case"groupex":this._kex||(this.name?this._kex=Hs.createDiffieHellmanGroup(this.name):this._prime&&this._generator&&(this._kex=Hs.createDiffieHellman(this._prime,this._generator)),this._kex&&(this._public=this._kex.generateKeys()));break}};lC.prototype.getPublicKey=function(){this.generateKeys();var e;switch(this.type){case"25519":return e=this._keys.publicKey.export({type:"spki",format:"der"}),e.slice(-32);case"ecdh":case"group":case"groupex":e=this._public;break}if(e)return this.convertPublicKey(e)};lC.prototype.convertPublicKey=function(e){for(var t,r=0,n=e.length;e[r]===0;)++r,--n;switch(this.type){case"25519":if(e.length===32)return e;break;default:if(e[r]&128)return t=Buffer.allocUnsafe(1+n),t[0]=0,e.copy(t,1,r),t}return n!==e.length&&(t=Buffer.allocUnsafe(n),e.copy(t,0,r),e=t),e};lC.prototype.computeSecret=function(e){switch(this.generateKeys(),this.type){case"25519":try{var t=new Ner.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.110"),t.endSequence(),t.startSequence(Ner.BitString),t.writeByte(0),t._ensure(e.length),e.copy(t._buf,t._offset,0,e.length),t._offset+=e.length,t.endSequence(),t.endSequence(),qee(Hs.diffieHellman({privateKey:this._keys.privateKey,publicKey:Hs.createPublicKey({key:t.buffer,type:"spki",format:"der"})}))}catch(r){return r}break;case"ecdh":case"group":case"groupex":try{return qee(this._kex.computeSecret(e))}catch(r){return r}}};function qee(e){for(var t=0,r=e.length;e[t]===0;)++t,--r;var n;return e[t]&128?(n=Buffer.allocUnsafe(1+r),n[0]=0,e.copy(n,1,t),e=n):r!==e.length&&(n=Buffer.allocUnsafe(r),e.copy(n,0,t),e=n),e}o(qee,"convertToMpint");A6e.exports=Un;A6e.exports._send=Dn});var Dee=h((D2o,etr)=>{etr.exports={SFTPStream:Rer(),SSH2Stream:Jer(),utils:th(),constants:mee()}});var ntr=h(rtr=>{var ttr=require("http").Agent,U$s=require("https").Agent,$$s=require("util").inherits,P6e;[ttr,U$s].forEach(e=>{function t(r,n){if(!(this instanceof t))return new t(r,n);e.call(this,n),this._connectCfg=r,this._defaultSrcIP=n&&n.srcIP||"localhost"}o(t,"SSHAgent"),$$s(t,e),t.prototype.createConnection=G$s,rtr[e===ttr?"SSHTTPAgent":"SSHTTPSAgent"]=t});function G$s(e,t){var r=e&&e.localAddress||this._defaultSrcIP,n=e&&e.localPort||0,i=e.host,s=e.port;P6e===void 0&&(P6e=x6e().Client);var a=new P6e,c=!1;a.on("ready",()=>{a.forwardOut(r,n,i,s,(l,d)=>{if(c=!0,l)return a.end(),t(l);d.once("close",()=>{a.end()}),t(null,H$s(d))})}).on("error",t).on("close",()=>{c||t(new Error("Unexpected connection loss"))}).connect(this._connectCfg)}o(G$s,"createConnection");function tL(){}o(tL,"noop");function H$s(e){return e.setKeepAlive=tL,e.setNoDelay=tL,e.setTimeout=tL,e.ref=tL,e.unref=tL,e.destroySoon=e.destroy,e}o(H$s,"decorateStream")});var k6e=h((L2o,ctr)=>{var itr=require("util").inherits,str=require("stream").Duplex,V$s=require("stream").Readable,atr=require("stream").Writable,X$s=Dee().constants.CHANNEL_EXTENDED_DATATYPE.STDERR,K$s=32*1024,rL=2*1024*1024,Nee=rL/2,otr=["CHANNEL_EOF","CHANNEL_CLOSE","CHANNEL_DATA","CHANNEL_EXTENDED_DATA","CHANNEL_WINDOW_ADJUST","CHANNEL_SUCCESS","CHANNEL_FAILURE","CHANNEL_REQUEST"],W$s=otr.length;function Df(e,t,r){var n={highWaterMark:rL,allowHalfOpen:!r||r&&r.allowHalfOpen!==!1};this.allowHalfOpen=n.allowHalfOpen,str.call(this,n);var i=this,s=r&&r.server;this.server=s,this.type=e.type,this.subtype=void 0;var a=this.incoming=e.incoming,c=a.id,l=this.outgoing=e.outgoing,d=this._callbacks=[],m,f,g,y,w;this._client=t,this._hasX11=!1;var v=t._channels,b=t._sshstream;function S(){i._waitClientDrain&&(i._waitClientDrain=!1,i._waitWindow||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}o(S,"ondrain"),t._sock.on("drain",S),b.once("CHANNEL_EOF:"+c,function(){a.state==="open"&&(a.state="eof",i.readable&&i.push(null),!s&&i.stderr.readable&&i.stderr.push(null))}).once("CHANNEL_CLOSE:"+c,function(){if(a.state!=="closed"){a.state="closed",i.readable&&i.push(null),s&&i.stderr.writable?i.stderr.end():!s&&i.stderr.readable&&i.stderr.push(null),(l.state==="open"||l.state==="eof")&&i.close(),l.state==="closing"&&(l.state="closed"),delete v[c];var k=i._writableState;t._sock.removeListener("drain",S),!k.ending&&!k.finished&&i.end(),i._callbacks=[];for(var j=0;j<d.length;++j)d[j](!0);d=i._callbacks,s?i.readable?i.once("end",function(){i.emit("close")}):i.emit("close"):(i.readable?i.once("end",function(){m===null?i.emit("close",m,f,g,y,w):i.emit("close",m)}):m===null?i.emit("close",m,f,g,y,w):i.emit("close",m),i.stderr.readable?i.stderr.once("end",function(){i.stderr.emit("close")}):i.stderr.emit("close"));for(var j=0;j<W$s;++j)b.removeAllListeners(otr[j]+":"+c)}}).on("CHANNEL_DATA:"+c,function(k){if(a.window!==0){if(a.window-=k.length,!i.push(k)){i._waitChanDrain=!0;return}a.window<=Nee&&Lee(i)}}).on("CHANNEL_WINDOW_ADJUST:"+c,function(k){l.window+=k,i._waitWindow&&(i._waitWindow=!1,i._waitClientDrain||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}).on("CHANNEL_SUCCESS:"+c,function(){s?(b._kalast=Date.now(),b._kacnt=0):t._resetKA(),d.length&&d.shift()(!1)}).on("CHANNEL_FAILURE:"+c,function(){s?(b._kalast=Date.now(),b._kacnt=0):t._resetKA(),d.length&&d.shift()(!0)}).on("CHANNEL_REQUEST:"+c,function(k){if(!s){if(k.request==="exit-status"){i.emit("exit",m=k.code);return}else if(k.request==="exit-signal"){i.emit("exit",m=null,f="SIG"+k.signal,g=k.coredump,y=k.description,w=k.lang);return}}k.wantReply&&b.channelFailure(l.id)}),this.stdin=this.stdout=this,s?this.stderr=new R6e(this):(this.stderr=new V$s(n),this.stderr._read=function(k){i._waitChanDrain&&(i._waitChanDrain=!1,a.window<=Nee&&Lee(i))},b.on("CHANNEL_EXTENDED_DATA:"+c,function(k,j){if(a.window!==0){if(a.window-=j.length,!i.stderr.push(j)){i._waitChanDrain=!0;return}a.window<=Nee&&Lee(i)}})),this._waitClientDrain=!1,this._waitWindow=!1,this._waitChanDrain=!1,this._chunk=void 0,this._chunkcb=void 0,this._chunkErr=void 0,this._chunkcbErr=void 0;function P(){i.eof(),(s||!s&&!i.allowHalfOpen)&&i.close(),i.writable=!1}o(P,"onFinish"),this.on("finish",P).on("prefinish",P);function q(){i.readable=!1}o(q,"onEnd"),this.on("end",q).on("close",q)}o(Df,"Channel");itr(Df,str);Df.prototype.eof=function(){var e=!0,t=this.outgoing;return t.state==="open"&&(t.state="eof",e=this._client._sshstream.channelEOF(t.id)),e};Df.prototype.close=function(){var e=!0,t=this.outgoing;return(t.state==="open"||t.state==="eof")&&(t.state="closing",e=this._client._sshstream.channelClose(t.id)),e};Df.prototype._read=function(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=Nee&&Lee(this))};Df.prototype._write=function(e,t,r){var n=this._client._sshstream,i=this.outgoing,s=i.packetSize,a=i.id,c=i.window,l=e.length,d=0,m,f,g;if(i.state==="open"){for(;l-d>0&&c>0;)if(g=l-d,g>c&&(g=c),g>s&&(g=s),m=n.channelData(a,e.slice(d,d+g)),d+=g,c-=g,!m){this._waitClientDrain=!0,this._chunk=void 0,this._chunkcb=r;break}if(i.window=c,l-d>0){c===0&&(this._waitWindow=!0),d>0?(f=Buffer.allocUnsafe(l-d),e.copy(f,0,d),this._chunk=f):this._chunk=e,this._chunkcb=r;return}this._waitClientDrain||r()}};Df.prototype.destroy=function(){this.end()};Df.prototype.setWindow=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&(this.subtype==="shell"||this.subtype==="exec")&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.windowChange(this.outgoing.id,e,t,r,n):!0};Df.prototype.signal=function(e){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.signal(this.outgoing.id,e):!0};Df.prototype.exit=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?typeof e=="number"?this._client._sshstream.exitStatus(this.outgoing.id,e):this._client._sshstream.exitSignal(this.outgoing.id,e,t,r):!0};Df.MAX_WINDOW=rL;Df.PACKET_SIZE=K$s;function Lee(e){if(e.outgoing.state==="closed")return!0;var t=rL-e.incoming.window;return t<=0?!0:(e.incoming.window+=t,e._client._sshstream.channelWindowAdjust(e.outgoing.id,t))}o(Lee,"windowAdjust");function R6e(e){atr.call(this,{highWaterMark:rL}),this._channel=e}o(R6e,"ServerStderr");itr(R6e,atr);R6e.prototype._write=function(e,t,r){var n=this._channel,i=n._client._sshstream,s=n.outgoing,a=s.packetSize,c=s.id,l=s.window,d=e.length,m=0,f,g,y;if(n.outgoing.state==="open"){for(;d-m>0&&l>0;)if(y=d-m,y>l&&(y=l),y>a&&(y=a),f=i.channelExtData(c,e.slice(m,m+y),X$s),m+=y,l-=y,!f){n._waitClientDrain=!0,n._chunkErr=void 0,n._chunkcbErr=r;break}if(s.window=l,d-m>0){l===0&&(n._waitWindow=!0),m>0?(g=Buffer.allocUnsafe(d-m),e.copy(g,0,m),n._chunkErr=g):n._chunkErr=e,n._chunkcbErr=r;return}n._waitClientDrain||r()}};ctr.exports=Df});var xx=h((M2o,ltr)=>{ltr.exports={readUInt32BE:o(function(t,r){return t[r++]*16777216+t[r++]*65536+t[r++]*256+t[r]},"readUInt32BE"),writeUInt32BE:o(function(t,r,n){return t[n++]=r>>>24,t[n++]=r>>>16,t[n++]=r>>>8,t[n++]=r,n},"writeUInt32BE"),writeUInt32LE:o(function(t,r,n){return t[n++]=r,t[n++]=r>>>8,t[n++]=r>>>16,t[n++]=r>>>24,n},"writeUInt32LE")}});var Ctr=h((z2o,Str)=>{var dtr=require("net").Socket,Q$s=require("events").EventEmitter,Y$s=require("util").inherits,Z$s=require("path"),utr=require("fs"),mtr=require("child_process"),ftr=xx().readUInt32BE,Mee=xx().writeUInt32BE,ptr=xx().writeUInt32LE,J$s=11,eGs=12,tGs=13,rGs=14,nGs=5,iGs=/^\!<socket >(\d+) s ([A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8})/,sGs=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;Str.exports=function(e,t,r,n,i){var s,a,c,l,d=0,m=Buffer.isBuffer(t),f,g=0,y=0,w=0,v,b=0,S=!1,P,q;typeof t=="function"&&typeof r=="function"?(P=t,q=r):m?(d=t.length,l=n.length):(i=t,t=void 0);function k(){var de;if(m){var N=9;de=Buffer.allocUnsafe(4+1+4+d+4+l+4),Mee(de,de.length-4,0),de[4]=tGs,Mee(de,d,5),t.copy(de,N),Mee(de,l,N+=d),n.copy(de,N+=4),Mee(de,0,N+=l),s.write(de)}else s.write(Buffer.from([0,0,0,1,J$s]))}o(k,"onconnect");function j(de){for(var N=0,se=de.length;N<se;++N)if(f===void 0)++g==5&&(f=de[N],g=0);else if(f===rGs){if(!c)y<<=8,y+=de[N],++g==4&&(c=Buffer.allocUnsafe(y),g=0);else if(c[g]=de[N],++g===y)return s.removeAllListeners("data"),s.destroy()}else if(f===eGs)if(v===void 0){if(w<<=8,w+=de[N],++g==4&&(v=new Array(w),g=0,w===0))return s.removeAllListeners("data"),s.destroy()}else if(!t)d<<=8,d+=de[N],++g==4&&(t=Buffer.allocUnsafe(d),g=0);else if(S===!1){if(t[g]=de[N],++g===d&&(v[w-1]=t,d=0,g=0,S=!0,--w==0))return t=void 0,s.removeAllListeners("data"),s.destroy()}else S===!0?(b<<=8,b+=de[N],++g==4&&(g=0,b>0?S=b:(t=void 0,S=!1),b=0)):++g===S&&(S=!1,g=0,t=void 0);else if(f===nGs)return m?a=new Error("Agent unable to sign data"):a=new Error("Unable to retrieve list of keys from agent"),s.removeAllListeners("data"),s.destroy()}o(j,"ondata");function ee(de){a=de}o(ee,"onerror");function K(){a?i(a):m&&!c||!m&&!v?i(new Error("Unexpected disconnection from agent")):m&&c?i(void 0,c):!m&&v&&i(void 0,v)}if(o(K,"onclose"),process.platform==="win32"&&!sGs.test(e))if(e==="pageant")s=new aGs;else{var V=!1;utr.readFile(e,o(function de(N,se){if(N){if(V)return i(new Error("Invalid cygwin unix socket path"));mtr.exec('cygpath -w "'+e+'"',function(Lr,$e,kr){if(Lr||$e.length===0)return i(new Error("Invalid cygwin unix socket path"));V=!0,e=$e.toString().replace(/[\r\n]/g,""),utr.readFile(e,de)});return}var ne;if(ne=iGs.exec(se.toString("ascii"))){let Lr=function(){Qe=0,He="secret",s.write(te)},$e=function(Y){Qe+=Y.length,He==="secret"?Qe===16&&(Qe=0,He="creds",s.write(Dt)):He==="creds"&&(it||qt.push(Y),Qe===12&&(s.removeListener("connect",Lr),s.removeListener("data",$e),s.removeListener("close",kr),it?(oe(),s.emit("connect")):(it=!0,Dt=Buffer.concat(qt),ptr(Dt,process.pid,0),s.destroy(),O())))},kr=function(){i(new Error("Problem negotiating cygwin unix socket security"))},O=function(){s=new dtr,s.once("connect",Lr),s.on("data",$e),s.once("close",kr),s.connect(xe)};var pt=Lr,mr=$e,gt=kr,ar=O;o(Lr,"_onconnect"),o($e,"_ondata"),o(kr,"_onclose"),o(O,"tryConnect");var xe,U,te,He,Qe=0,it=!1,qt=[],Dt=Buffer.allocUnsafe(12),tr,lt;for(Dt.fill(0),xe=parseInt(ne[1],10),U=ne[2].replace(/\-/g,""),te=Buffer.allocUnsafe(16),tr=0,lt=0;lt<32;++tr,lt+=2)te[tr]=parseInt(U.substring(lt,lt+2),16);for(tr=0;tr<16;tr+=4)ptr(te,ftr(te,tr),tr);O()}else i(new Error("Malformed cygwin unix socket file"))},"readCygsocket"));return}else s=new dtr;function oe(){if(!P&&!q)s.once("connect",k),s.on("data",j),s.once("error",ee),s.once("close",K);else{var de;s.once("connect",function(){de=P();var N=!1;function se(){N||(s.destroy(),N=!0)}o(se,"onDone"),de.once("end",se).once("close",se).on("data",function(ne){s.write(ne)}),s.on("data",function(ne){de.write(ne)})}),s.once("close",function(){de||q()})}}o(oe,"addSockListeners"),oe(),s.connect(e)};if(process.platform==="win32"){let e=function(){this.proc=void 0,this.buffer=null};aGs=e,o(e,"PageantSock"),gtr=10,htr=11,ytr=12,wtr=13,vtr=14,_tr=15,xw={},btr=Z$s.resolve(__dirname,"..","util/pagent.exe"),xw[gtr]=new Error("Invalid pagent.exe arguments"),xw[htr]=new Error("Pageant is not running"),xw[ytr]=new Error("pagent.exe could not create an mmap"),xw[wtr]=new Error("pagent.exe could not set mode for stdin"),xw[vtr]=new Error("pagent.exe could not set mode for stdout"),xw[_tr]=new Error("pagent.exe did not get expected input payload"),Y$s(e,Q$s),e.prototype.write=function(t){if(this.buffer===null?this.buffer=t:this.buffer=Buffer.concat([this.buffer,t],this.buffer.length+t.length),!(this.buffer.length<4)){var r=ftr(this.buffer,0);if(!(this.buffer.length-4<r)){t=this.buffer.slice(0,4+r),this.buffer.length>4+r?this.buffer=this.buffer.slice(4+r):this.buffer=null;var n=this,i,s=!1;i=this.proc=mtr.spawn(btr,[t.length]),i.stdout.on("data",function(a){n.emit("data",a)}),i.once("error",function(a){s||(s=!0,n.emit("error",a))}),i.once("close",function(a){n.proc=void 0,xw[a]&&!s&&(s=!0,n.emit("error",xw[a])),n.emit("close",s)}),i.stdin.end(t)}}},e.prototype.end=e.prototype.destroy=function(){this.buffer=null,this.proc&&(this.proc.kill(),this.proc=void 0)},e.prototype.connect=function(){this.emit("connect")}}var gtr,htr,ytr,wtr,vtr,_tr,xw,btr,aGs});var Ptr=h((O2o,Atr)=>{var oGs=require("util").inherits,Etr=require("events").EventEmitter;function os(e){var t=this;Etr.call(this),this._stream=e,e.on("error",function(r){t.emit("error",r)}).on("end",function(){t.emit("end")}).on("close",function(){t.emit("close")}).on("continue",function(){t.emit("continue")})}o(os,"SFTPWrapper");oGs(os,Etr);os.prototype.end=function(){return this._stream.end()};os.prototype.createReadStream=function(e,t){return this._stream.createReadStream(e,t)};os.prototype.createWriteStream=function(e,t){return this._stream.createWriteStream(e,t)};os.prototype.open=function(e,t,r,n){return this._stream.open(e,t,r,n)};os.prototype.close=function(e,t){return this._stream.close(e,t)};os.prototype.read=function(e,t,r,n,i,s){return this._stream.readData(e,t,r,n,i,s)};os.prototype.write=function(e,t,r,n,i,s){return this._stream.writeData(e,t,r,n,i,s)};os.prototype.fastGet=function(e,t,r,n){return this._stream.fastGet(e,t,r,n)};os.prototype.fastPut=function(e,t,r,n){return this._stream.fastPut(e,t,r,n)};os.prototype.readFile=function(e,t,r){return this._stream.readFile(e,t,r)};os.prototype.writeFile=function(e,t,r,n){return this._stream.writeFile(e,t,r,n)};os.prototype.appendFile=function(e,t,r,n){return this._stream.appendFile(e,t,r,n)};os.prototype.exists=function(e,t){return this._stream.exists(e,t)};os.prototype.unlink=function(e,t){return this._stream.unlink(e,t)};os.prototype.rename=function(e,t,r){return this._stream.rename(e,t,r)};os.prototype.mkdir=function(e,t,r){return this._stream.mkdir(e,t,r)};os.prototype.rmdir=function(e,t){return this._stream.rmdir(e,t)};os.prototype.readdir=function(e,t,r){return this._stream.readdir(e,t,r)};os.prototype.fstat=function(e,t){return this._stream.fstat(e,t)};os.prototype.stat=function(e,t){return this._stream.stat(e,t)};os.prototype.lstat=function(e,t){return this._stream.lstat(e,t)};os.prototype.opendir=function(e,t){return this._stream.opendir(e,t)};os.prototype.setstat=function(e,t,r){return this._stream.setstat(e,t,r)};os.prototype.fsetstat=function(e,t,r){return this._stream.fsetstat(e,t,r)};os.prototype.futimes=function(e,t,r,n){return this._stream.futimes(e,t,r,n)};os.prototype.utimes=function(e,t,r,n){return this._stream.utimes(e,t,r,n)};os.prototype.fchown=function(e,t,r,n){return this._stream.fchown(e,t,r,n)};os.prototype.chown=function(e,t,r,n){return this._stream.chown(e,t,r,n)};os.prototype.fchmod=function(e,t,r){return this._stream.fchmod(e,t,r)};os.prototype.chmod=function(e,t,r){return this._stream.chmod(e,t,r)};os.prototype.readlink=function(e,t){return this._stream.readlink(e,t)};os.prototype.symlink=function(e,t,r){return this._stream.symlink(e,t,r)};os.prototype.realpath=function(e,t){return this._stream.realpath(e,t)};os.prototype.ext_openssh_rename=function(e,t,r){return this._stream.ext_openssh_rename(e,t,r)};os.prototype.ext_openssh_statvfs=function(e,t){return this._stream.ext_openssh_statvfs(e,t)};os.prototype.ext_openssh_fstatvfs=function(e,t){return this._stream.ext_openssh_fstatvfs(e,t)};os.prototype.ext_openssh_hardlink=function(e,t,r){return this._stream.ext_openssh_hardlink(e,t,r)};os.prototype.ext_openssh_fsync=function(e,t){return this._stream.ext_openssh_fsync(e,t)};Atr.exports=os});var ktr=h((F2o,Rtr)=>{function xtr(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}o(xtr,"spliceOne");function nL(e,t,r){var n=this._streams=[];this._timer=void 0,this._timerInterval=e,this._timerfn=function(){for(var i=Date.now(),s=0,a=n.length,c,l;s<a;++s)if(c=n[s],l=c._kalast,l&&i-l>=t)if(++c._kacnt>r){var d=new Error("Keepalive timeout");d.level="client-timeout",c.emit("error",d),c.disconnect(),xtr(n,s),--s,a=n.length}else c._kalast=i,c.ping()}}o(nL,"Manager");nL.prototype.start=function(){this._timer&&this.stop(),this._timer=setInterval(this._timerfn,this._timerInterval)};nL.prototype.stop=function(){this._timer&&(clearInterval(this._timer),this._timer=void 0)};nL.prototype.add=function(e){var t=this._streams,r=this;e.once("end",function(){r.remove(e)}).on("packet",n),t[t.length]=e,n(),this._timer||this.start();function n(){e._kalast=Date.now(),e._kacnt=0}o(n,"resetKA")};nL.prototype.remove=function(e){var t=this._streams,r=t.indexOf(e);r>-1&&xtr(t,r),t.length||this.stop()};Rtr.exports=nL});var Mtr=h((j2o,N6e)=>{var cGs=require("net"),r0=require("events").EventEmitter,Rl=r0.listenerCount,n0=require("util").inherits,zee=Dee(),Ttr=zee.utils.parseKey,lGs=zee.SSH2Stream,dGs=zee.SFTPStream,T6e=zee.constants,iL=T6e.DISCONNECT_REASON,I6e=T6e.CHANNEL_OPEN_FAILURE,sL=T6e.ALGORITHMS,wc=k6e(),uGs=ktr(),mGs=xx().writeUInt32BE,Itr=Math.pow(2,32)-1,fGs=10,Oee;function Zo(e,t){if(!(this instanceof Zo))return new Zo(e,t);var r={"ssh-rsa":null,"ssh-dss":null,"ssh-ed25519":null,"ecdsa-sha2-nistp256":null,"ecdsa-sha2-nistp384":null,"ecdsa-sha2-nistp521":null},n=e.hostKeys;if(!Array.isArray(n))throw new Error("hostKeys must be an array");var i;for(i=0;i<n.length;++i){var s;if(Buffer.isBuffer(n[i])||typeof n[i]=="string"?s=Ttr(n[i]):s=Ttr(n[i].key,n[i].passphrase),s instanceof Error)throw new Error("Cannot parse privateKey: "+s.message);if(Array.isArray(s)&&(s=s[0]),s.getPrivatePEM()===null)throw new Error("privateKey value contains an invalid private key");r[s.type]||(r[s.type]=s)}var a={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0};if(typeof e.algorithms=="object"&&e.algorithms!==null){var c,l;if(l=e.algorithms.kex,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_KEX,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported key exchange algorithm: "+l[i]);a.kex=l}if(l=e.algorithms.cipher,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_CIPHER,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported cipher algorithm: "+l[i]);a.cipher=l}l=e.algorithms.serverHostKey;var d=!1;if(Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_SERVER_HOST_KEY,i=l.length-1;i>=0;--i){if(c.indexOf(l[i])===-1)throw new Error("Unsupported server host key algorithm: "+l[i]);r[l[i]]||(d||(l=l.slice(),d=!0),l.splice(i,1))}l.length>0&&(a.serverHostKey=l)}if(l=e.algorithms.hmac,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_HMAC,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported HMAC algorithm: "+l[i]);a.hmac=l}if(l=e.algorithms.compress,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_COMPRESS,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported compression algorithm: "+l[i]);a.compress=l}}if(a.serverHostKey===void 0){var m=Object.keys(r);for(i=m.length-1;i>=0;--i)r[m[i]]||m.splice(i,1);a.serverHostKey=m}!Oee&&Zo.KEEPALIVE_INTERVAL>0&&Zo.KEEPALIVE_CLIENT_INTERVAL>0&&Zo.KEEPALIVE_CLIENT_COUNT_MAX>=0&&(Oee=new uGs(Zo.KEEPALIVE_INTERVAL,Zo.KEEPALIVE_CLIENT_INTERVAL,Zo.KEEPALIVE_CLIENT_COUNT_MAX));var f=this;r0.call(this),typeof t=="function"&&f.on("connection",t);var g={algorithms:a,hostKeys:r,server:!0},y,w;for(i=0,y=Object.keys(e),w=y.length;i<w;++i){var v=y[i];v==="privateKey"||v==="publicKey"||v==="passphrase"||v==="algorithms"||v==="hostKeys"||v==="server"||(g[v]=e[v])}if(typeof g.debug=="function")var b=g.debug,S=Object.keys(g);this._srv=new cGs.Server(function(P){if(f._connections>=f.maxConnections){P.destroy();return}++f._connections,P.once("close",function(de){--f._connections,K.read()}).on("error",function(de){K.reset(),K.emit("error",de)});var q=g;if(b){q={};for(var k=0,j;k<S.length;++k)j=S[k],q[j]=g[j];var ee="["+process.hrtime().join(".")+"] ";q.debug=function(de){b(ee+de)}}var K=new lGs(q),V=new i0(K,P);P.pipe(K).pipe(P);function oe(de){}o(oe,"onClientPreHeaderError"),V.on("error",oe),K.once("header",function(de){if(!K._readableState.ended){if(!Rl(f,"connection"))return K.disconnect(iL.BY_APPLICATION);V.removeListener("error",oe),f.emit("connection",V,{ip:P.remoteAddress,family:P.remoteFamily,port:P.remotePort,header:de})}})}).on("error",function(P){f.emit("error",P)}).on("listening",function(){f.emit("listening")}).on("close",function(){f.emit("close")}),this._connections=0,this.maxConnections=1/0}o(Zo,"Server");n0(Zo,r0);Zo.prototype.listen=function(){return this._srv.listen.apply(this._srv,arguments),this};Zo.prototype.address=function(){return this._srv.address()};Zo.prototype.getConnections=function(e){this._srv.getConnections(e)};Zo.prototype.close=function(e){return this._srv.close(e),this};Zo.prototype.ref=function(){this._srv.ref()};Zo.prototype.unref=function(){this._srv.unref()};function i0(e,t){r0.call(this);var r=this;this._sshstream=e;var n=this._channels={};this._curChan=-1,this._sock=t,this.noMoreSessions=!1,this.authenticated=!1,e.on("end",function(){t.resume(),r.emit("end")}).on("close",function(g){r.emit("close",g)}).on("error",function(g){r.emit("error",g)}).on("drain",function(){r.emit("drain")}).on("continue",function(){r.emit("continue")});var i=0,s=!1,a=[],c;e.on("SERVICE_REQUEST",function(g){if(i===0||s||r.authenticated||g!=="ssh-userauth")return e.disconnect(iL.SERVICE_NOT_AVAILABLE);s=!0,e.serviceAccept(g)}).on("USERAUTH_REQUEST",l);function l(g,y,w,v){if(i===0||c&&(c.username!==g||c.service!==y)||w!=="password"&&w!=="publickey"&&w!=="hostbased"&&w!=="keyboard-interactive"&&w!=="none"||a.length===fGs)return e.disconnect(iL.PROTOCOL_ERROR);if(y!=="ssh-connection")return e.disconnect(iL.SERVICE_NOT_AVAILABLE);e._state.authMethod=w;var b;if(w==="keyboard-interactive"?b=new Fee(e,g,y,w,v,d):w==="publickey"?b=new q6e(e,g,y,w,v,d):w==="hostbased"?b=new Dtr(e,g,y,w,v,d):w==="password"?b=new Ntr(e,g,y,w,v,d):w==="none"&&(b=new pm(e,g,y,w,d)),c)if(c._initialResponse)c._multistep&&!this._finalResponse&&(c._cleanup&&c._cleanup(),c.emit("abort"));else return a.push(b);c=b,Rl(r,"authentication")?r.emit("authentication",c):c.reject()}o(l,"onUSERAUTH_REQUEST");function d(g,y,w,v){c===g&&!r.authenticated&&(y?(e.removeListener("USERAUTH_REQUEST",l),c=void 0,r.authenticated=!0,e.authSuccess(),a=[],r.emit("ready")):(e.authFailure(w,v),a.length&&(c=a.pop(),Rl(r,"authentication")?r.emit("authentication",c):c.reject())))}o(d,"onAuthDecide");var m=[];function f(){for(var g;m.length>0&&m[0].type;)g=m.shift(),g.type==="SUCCESS"&&e.requestSuccess(g.buf),g.type==="FAILURE"&&e.requestFailure()}o(f,"sendReplies"),e.on("GLOBAL_REQUEST",function(g,y,w){var v={type:null,buf:null};function b(k,j){v.type=k,v.buf=j,f()}if(o(b,"setReply"),y&&m.push(v),(g==="tcpip-forward"||g==="cancel-tcpip-forward"||g==="no-more-sessions@openssh.com"||g==="streamlocal-forward@openssh.com"||g==="cancel-streamlocal-forward@openssh.com")&&Rl(r,"request")&&r.authenticated){var S,P;if(y){var q=!1;S=o(function(k){if(!q){q=!0;var j;g==="tcpip-forward"&&w.bindPort===0&&typeof k=="number"&&(j=Buffer.allocUnsafe(4),mGs(j,k,0)),b("SUCCESS",j)}},"accept"),P=o(function(){q||(q=!0,b("FAILURE"))},"reject")}if(g==="no-more-sessions@openssh.com"){r.noMoreSessions=!0,S&&S();return}r.emit("request",S,P,g,w)}else y&&b("FAILURE")}),e.on("CHANNEL_OPEN",function(g){if(g.type==="session"&&r.noMoreSessions||!r.authenticated){var y=I6e.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(g.sender,y)}var w=Ltr(r),v,b,S=!1;if(w===!1)return e.channelOpenFail(g.sender,I6e.RESOURCE_SHORTAGE);switch(n[w]=!0,b=o(function(){if(!S){S=!0,delete n[w];var P=I6e.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(g.sender,P)}},"reject"),g.type){case"session":Rl(r,"session")?(v=o(function(){if(!S)return S=!0,e.channelOpenConfirm(g.sender,w,wc.MAX_WINDOW,wc.PACKET_SIZE),new qtr(r,g,w)},"accept"),r.emit("session",v,b)):b();break;case"direct-tcpip":Rl(r,"tcpip")?(v=o(function(){if(!S){S=!0,e.channelOpenConfirm(g.sender,w,wc.MAX_WINDOW,wc.PACKET_SIZE);var P={type:void 0,incoming:{id:w,window:wc.MAX_WINDOW,packetSize:wc.PACKET_SIZE,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}};return new wc(P,r)}},"accept"),r.emit("tcpip",v,b,g.data)):b();break;case"direct-streamlocal@openssh.com":Rl(r,"openssh.streamlocal")?(v=o(function(){if(!S){S=!0,e.channelOpenConfirm(g.sender,w,wc.MAX_WINDOW,wc.PACKET_SIZE);var P={type:void 0,incoming:{id:w,window:wc.MAX_WINDOW,packetSize:wc.PACKET_SIZE,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}};return new wc(P,r)}},"accept"),r.emit("openssh.streamlocal",v,b,g.data)):b();break;default:b()}}),e.on("NEWKEYS",function(){++i>1&&r.emit("rekey")}),Oee&&this.once("ready",function(){Oee.add(e)})}o(i0,"Client");n0(i0,r0);i0.prototype.end=function(){return this._sshstream.disconnect(iL.BY_APPLICATION)};i0.prototype.x11=function(e,t,r){var n={originAddr:e,originPort:t};return D6e(this,"x11",n,r)};i0.prototype.forwardOut=function(e,t,r,n,i){var s={boundAddr:e,boundPort:t,remoteAddr:r,remotePort:n};return D6e(this,"forwarded-tcpip",s,i)};i0.prototype.openssh_forwardOutStreamLocal=function(e,t){var r={socketPath:e};return D6e(this,"forwarded-streamlocal@openssh.com",r,t)};i0.prototype.rekey=function(e){var t=this._sshstream,r=!0,n;try{r=t.rekey()}catch(i){n=i}return typeof e=="function"&&(n?process.nextTick(function(){e(n)}):this.once("rekey",e)),r};function qtr(e,t,r){this.subtype=void 0;var n=!1,i=this,s=t.sender,a,c={type:"session",incoming:{id:r,window:wc.MAX_WINDOW,packetSize:wc.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}};function l(f){var g=!1,y,w;if(f.wantReply&&(f.request!=="shell"&&f.request!=="exec"&&f.request!=="subsystem"&&(y=o(function(){if(!(g||n||a))return g=!0,e._sshstream.channelSuccess(s)},"accept")),w=o(function(){if(!(g||n||a))return g=!0,e._sshstream.channelFailure(s)},"reject")),n){w&&w();return}switch(f.request){case"env":Rl(i,"env")?i.emit("env",y,w,{key:f.key,val:f.val}):w&&w();break;case"pty-req":Rl(i,"pty")?i.emit("pty",y,w,{cols:f.cols,rows:f.rows,width:f.width,height:f.height,term:f.term,modes:f.modes}):w&&w();break;case"window-change":Rl(i,"window-change")?i.emit("window-change",y,w,{cols:f.cols,rows:f.rows,width:f.width,height:f.height}):w&&w();break;case"x11-req":Rl(i,"x11")?i.emit("x11",y,w,{single:f.single,protocol:f.protocol,cookie:f.cookie,screen:f.screen}):w&&w();break;case"signal":Rl(i,"signal")?i.emit("signal",y,w,{name:f.signal}):w&&w();break;case"auth-agent-req@openssh.com":Rl(i,"auth-agent")?i.emit("auth-agent",y,w):w&&w();break;case"shell":Rl(i,"shell")?(y=o(function(){if(!(g||n||a))return g=!0,f.wantReply&&e._sshstream.channelSuccess(s),a=new wc(c,e,{server:!0}),a.subtype=i.subtype=f.request,a},"accept"),i.emit("shell",y,w)):w&&w();break;case"exec":Rl(i,"exec")?(y=o(function(){if(!(g||n||a))return g=!0,f.wantReply&&e._sshstream.channelSuccess(s),a=new wc(c,e,{server:!0}),a.subtype=i.subtype=f.request,a},"accept"),i.emit("exec",y,w,{command:f.command})):w&&w();break;case"subsystem":y=o(function(){if(!(g||n||a))if(g=!0,f.wantReply&&e._sshstream.channelSuccess(s),a=new wc(c,e,{server:!0}),a.subtype=i.subtype=f.request+":"+f.subsystem,f.subsystem==="sftp"){var v=new dGs({server:!0,debug:e._sshstream.debug});return a.pipe(v).pipe(a),v}else return a},"accept"),f.subsystem==="sftp"&&Rl(i,"sftp")?i.emit("sftp",y,w):f.subsystem!=="sftp"&&Rl(i,"subsystem")?i.emit("subsystem",y,w,{name:f.subsystem}):w&&w();break;default:w&&w()}}o(l,"onREQUEST");function d(){n=!0,i.emit("eof"),i.emit("end")}o(d,"onEOF");function m(){n=!0,i.emit("close")}o(m,"onCLOSE"),e._sshstream.on("CHANNEL_REQUEST:"+r,l).once("CHANNEL_EOF:"+r,d).once("CHANNEL_CLOSE:"+r,m)}o(qtr,"Session");n0(qtr,r0);function pm(e,t,r,n,i){r0.call(this);var s=this;this.username=this.user=t,this.service=r,this.method=n,this._initialResponse=!1,this._finalResponse=!1,this._multistep=!1,this._cbfinal=function(a,c,l){s._finalResponse||(s._finalResponse=!0,i(s,a,c,l))},this._stream=e}o(pm,"AuthContext");n0(pm,r0);pm.prototype.accept=function(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)};pm.prototype.reject=function(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)};var pGs=/[ \t\r\n]*,[ \t\r\n]*/g;function Fee(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this._multistep=!0;var a=this;this._cb=void 0,this._onInfoResponse=function(c){if(a._cb){var l=a._cb;a._cb=void 0,l(c)}},this.submethods=i.split(pGs),this.on("abort",function(){a._cb&&a._cb(new Error("Authentication request aborted"))})}o(Fee,"KeyboardAuthContext");n0(Fee,pm);Fee.prototype._cleanup=function(){this._stream.removeListener("USERAUTH_INFO_RESPONSE",this._onInfoResponse)};Fee.prototype.prompt=function(e,t,r,n){Array.isArray(e)||(e=[e]),typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0);for(var i=0;i<e.length;++i)typeof e[i]=="string"&&(e[i]={prompt:e[i],echo:!0});return this._cb=n,this._initialResponse=!0,this._stream.once("USERAUTH_INFO_RESPONSE",this._onInfoResponse),this._stream.authInfoReq(t,r,e)};function q6e(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var a;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":a="sha1";break;case"ssh-ed25519":a=null;break;case"ecdsa-sha2-nistp256":a="sha256";break;case"ecdsa-sha2-nistp384":a="sha384";break;case"ecdsa-sha2-nistp521":a="sha512";break}this.sigAlgo=a,this.blob=i.blob}o(q6e,"PKAuthContext");n0(q6e,pm);q6e.prototype.accept=function(){this.signature?pm.prototype.accept.call(this):(this._initialResponse=!0,this._stream.authPKOK(this.key.algo,this.key.data))};function Dtr(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var a;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":a="sha1";break;case"ssh-ed25519":a=null;break;case"ecdsa-sha2-nistp256":a="sha256";break;case"ecdsa-sha2-nistp384":a="sha384";break;case"ecdsa-sha2-nistp521":a="sha512";break}this.sigAlgo=a,this.blob=i.blob,this.localHostname=i.localHostname,this.localUsername=i.localUsername}o(Dtr,"HostbasedAuthContext");n0(Dtr,pm);function Ntr(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this.password=i}o(Ntr,"PwdAuthContext");n0(Ntr,pm);function D6e(e,t,r,n){var i=Ltr(e),s=wc.MAX_WINDOW,a=wc.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=!0;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_FAILURE:"+i);var m={type:t,incoming:{id:i,window:s,packetSize:a,state:"open"},outgoing:{id:d.sender,window:d.window,packetSize:d.packetSize,state:"open"}};n(void 0,new wc(m,e,{server:!0}))}).once("CHANNEL_OPEN_FAILURE:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_CONFIRMATION:"+i),delete e._channels[i];var m=new Error("(SSH) Channel open failure: "+d.description);m.reason=d.reason,m.lang=d.lang,n(m)}),t==="forwarded-tcpip"?c=l.forwardedTcpip(i,s,a,r):t==="x11"?c=l.x11(i,s,a,r):t==="forwarded-streamlocal@openssh.com"&&(c=l.openssh_forwardedStreamLocal(i,s,a,r)),c}o(D6e,"openChannel");function Ltr(e){if(e._curChan<Itr)return++e._curChan;for(var t=0,r=e._channels;t<Itr;++t)if(!r[t])return t;return!1}o(Ltr,"nextChannel");Zo.createServer=function(e,t){return new Zo(e,t)};Zo.KEEPALIVE_INTERVAL=1e3;Zo.KEEPALIVE_CLIENT_INTERVAL=15e3;Zo.KEEPALIVE_CLIENT_COUNT_MAX=3;N6e.exports=Zo;N6e.exports.IncomingClient=i0});var x6e=h((B2o,Xtr)=>{var aL=require("crypto"),gGs=require("net").Socket,hGs=require("dns").lookup,ztr=require("events").EventEmitter,yGs=require("util").inherits,wGs=aL.getHashes(),oL=Dee(),vGs=oL.SSH2Stream,L6e=oL.SFTPStream,dC=oL.constants,_Gs=dC.BUGS,cL=dC.ALGORITHMS,bGs=dC.EDDSA_SUPPORTED,SGs=oL.utils.parseKey,Otr=ntr(),s0=k6e(),M6e=Ctr(),CGs=Ptr(),z6e=xx().readUInt32BE,Ftr=Math.pow(2,32)-1,jee=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,jtr=o(function(e){},"DEBUG_NOOP");function $a(){if(!(this instanceof $a))return new $a;ztr.call(this),this.config={host:void 0,port:void 0,localAddress:void 0,localPort:void 0,forceIPv4:void 0,forceIPv6:void 0,keepaliveCountMax:void 0,keepaliveInterval:void 0,readyTimeout:void 0,username:void 0,password:void 0,privateKey:void 0,tryKeyboard:void 0,agent:void 0,allowAgentFwd:void 0,authHandler:void 0,hostHashAlgo:void 0,hostHashCb:void 0,strictVendor:void 0,debug:void 0},this._readyTimeout=void 0,this._channels=void 0,this._callbacks=void 0,this._forwarding=void 0,this._forwardingUnix=void 0,this._acceptX11=void 0,this._agentFwdEnabled=void 0,this._curChan=void 0,this._remoteVer=void 0,this._sshstream=void 0,this._sock=void 0,this._resetKA=void 0}o($a,"Client");yGs($a,ztr);$a.prototype.connect=function(e){var t=this;if(this._sock&&this._sock.writable){this.once("close",function(){t.connect(e)}),this.end();return}this.config.host=e.hostname||e.host||"localhost",this.config.port=e.port||22,this.config.localAddress=typeof e.localAddress=="string"?e.localAddress:void 0,this.config.localPort=typeof e.localPort=="string"||typeof e.localPort=="number"?e.localPort:void 0,this.config.forceIPv4=e.forceIPv4||!1,this.config.forceIPv6=e.forceIPv6||!1,this.config.keepaliveCountMax=typeof e.keepaliveCountMax=="number"&&e.keepaliveCountMax>=0?e.keepaliveCountMax:3,this.config.keepaliveInterval=typeof e.keepaliveInterval=="number"&&e.keepaliveInterval>0?e.keepaliveInterval:0,this.config.readyTimeout=typeof e.readyTimeout=="number"&&e.readyTimeout>=0?e.readyTimeout:2e4;var r={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0},n;if(typeof e.algorithms=="object"&&e.algorithms!==null){var i,s;if(s=e.algorithms.kex,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_KEX,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported key exchange algorithm: "+s[n]);r.kex=s}if(s=e.algorithms.cipher,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_CIPHER,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported cipher algorithm: "+s[n]);r.cipher=s}if(s=e.algorithms.serverHostKey,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_SERVER_HOST_KEY,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported server host key algorithm: "+s[n]);r.serverHostKey=s}if(s=e.algorithms.hmac,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_HMAC,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported HMAC algorithm: "+s[n]);r.hmac=s}if(s=e.algorithms.compress,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_COMPRESS,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported compression algorithm: "+s[n]);r.compress=s}}if(r.compress===void 0&&(e.compress?(r.compress=["zlib@openssh.com","zlib"],e.compress!=="force"&&r.compress.push("none")):e.compress===!1&&(r.compress=["none"])),typeof e.username=="string")this.config.username=e.username;else if(typeof e.user=="string")this.config.username=e.user;else throw new Error("Invalid username");this.config.password=typeof e.password=="string"?e.password:void 0,this.config.privateKey=typeof e.privateKey=="string"||Buffer.isBuffer(e.privateKey)?e.privateKey:void 0,this.config.localHostname=typeof e.localHostname=="string"&&e.localHostname.length?e.localHostname:void 0,this.config.localUsername=typeof e.localUsername=="string"&&e.localUsername.length?e.localUsername:void 0,this.config.tryKeyboard=e.tryKeyboard===!0,this.config.agent=typeof e.agent=="string"&&e.agent.length?e.agent:void 0,this.config.allowAgentFwd=e.agentForward===!0&&this.config.agent!==void 0;var a=this.config.authHandler=typeof e.authHandler=="function"?e.authHandler:void 0;this.config.strictVendor=typeof e.strictVendor=="boolean"?e.strictVendor:!0;var c=this.config.debug=typeof e.debug=="function"?e.debug:jtr;if(e.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");var l=this._callbacks=[];this._channels={},this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._curChan=-1,this._remoteVer=void 0;var d;if(this.config.privateKey){if(d=SGs(this.config.privateKey,e.passphrase),d instanceof Error)throw new Error("Cannot parse privateKey: "+d.message);if(Array.isArray(d)&&(d=d[0]),d.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}var m=this._sshstream=new vGs({algorithms:r,debug:c===jtr?void 0:c}),f=this._sock=e.sock||new gGs;this._sock.stderr&&typeof this._sock.stderr.resume=="function"&&this._sock.stderr.resume();var g=this.config.keepaliveInterval,y=this.config.keepaliveCountMax,w=0,v;function b(){if(++w>y){if(clearInterval(v),f.readable){var lt=new Error("Keepalive timeout");lt.level="client-timeout",t.emit("error",lt),f.destroy()}return}f.writable?(l.push(S),m.ping()):clearInterval(v)}o(b,"sendKA");function S(){g>0&&(w=0,clearInterval(v),f.writable&&(v=setInterval(b,g)))}if(o(S,"resetKA"),this._resetKA=S,m.on("USERAUTH_BANNER",function(lt){t.emit("banner",lt)}),f.on("connect",function(){c("DEBUG: Client: Connected"),t.emit("connect"),e.sock||m.pipe(f).pipe(m)}).on("timeout",function(){t.emit("timeout")}).on("error",function(lt){clearTimeout(t._readyTimeout),lt.level="client-socket",t.emit("error",lt)}).on("end",function(){m.unpipe(f),clearTimeout(t._readyTimeout),clearInterval(v),t.emit("end")}).on("close",function(){m.unpipe(f),clearTimeout(t._readyTimeout),clearInterval(v),t.emit("close");var lt=l,pt=new Error("No response from server");for(l=t._callbacks=[],n=0;n<lt.length;++n)lt[n](pt);var mr=t._channels,gt=Object.keys(mr);for(t._channels={},n=0;n<gt.length;++n){var ar=m.emit("CHANNEL_OPEN_FAILURE:"+gt[n],pt),Lr=m.emit("CHANNEL_CLOSE:"+gt[n]),$e;!ar&&!Lr&&($e=mr[gt[n]])&&typeof $e=="function"&&$e(pt)}}),m.on("drain",function(){t.emit("drain")}).once("header",function(lt){t._remoteVer=lt.versions.software,lt.greeting&&t.emit("greeting",lt.greeting)}).on("continue",function(){t.emit("continue")}).on("error",function(lt){lt.level===void 0?lt.level="protocol":lt.level==="handshake"&&clearTimeout(t._readyTimeout),t.emit("error",lt)}).on("end",function(){f.resume()}),typeof e.hostVerifier=="function"){if(wGs.indexOf(e.hostHash)===-1)throw new Error("Invalid host hash algorithm: "+e.hostHash);var P=e.hostVerifier,q=aL.createHash(e.hostHash);m.once("fingerprint",function(lt,pt){q.update(lt);var mr=P(q.digest("hex"),pt);mr!==void 0&&pt(mr)})}var k,j=null,ee=null,K,V=0,oe=["none"];if(this.config.password!==void 0&&oe.push("password"),d!==void 0&&oe.push("publickey"),this.config.agent!==void 0&&oe.push("agent"),this.config.tryKeyboard&&oe.push("keyboard-interactive"),d!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0&&oe.push("hostbased"),a===void 0){var de=0;a=o(function(pt,mr,gt){return de===oe.length?!1:oe[de++]},"authHandler")}var N=!1;function se(lt){if(N=!0,lt===!1){m.removeListener("USERAUTH_FAILURE",He),m.removeListener("USERAUTH_PK_OK",te);var pt=new Error("All configured authentication methods failed");pt.level="client-authentication",t.emit("error",pt),m.writable&&t.end();return}if(oe.indexOf(lt)===-1)throw new Error("Authentication method not allowed: "+lt);switch(k=lt,k){case"password":m.authPassword(t.config.username,t.config.password);break;case"publickey":m.authPK(t.config.username,d),m.once("USERAUTH_PK_OK",te);break;case"hostbased":let gt=function(ar,Lr){var $e=d.sign(ar);if($e instanceof Error)return $e.message="Error while signing data with privateKey: "+$e.message,$e.level="client-authentication",t.emit("error",$e),ne();Lr($e)};var mr=gt;o(gt,"hostbasedCb"),m.authHostbased(t.config.username,d,t.config.localHostname,t.config.localUsername,gt);break;case"agent":M6e(t.config.agent,function(ar,Lr){if(ar)return ar.level="agent",t.emit("error",ar),K=void 0,ne();if(Lr.length===0)return c("DEBUG: Agent: No keys stored in agent"),K=void 0,ne();K=Lr,V=0,m.authPK(t.config.username,Lr[0]),m.once("USERAUTH_PK_OK",te)});break;case"keyboard-interactive":m.authKeyboard(t.config.username),m.on("USERAUTH_INFO_REQUEST",U);break;case"none":m.authNone(t.config.username);break}}o(se,"doNextAuth");function ne(){N=!1;var lt=a(ee,j,se);N||lt===void 0||se(lt)}o(ne,"tryNextAuth");function xe(){if(k==="agent"){if(V>=K.length)return;++V>=K.length?(c("DEBUG: Agent: No more keys left to try"),c("DEBUG: Client: agent auth failed"),K=void 0,ne()):(c("DEBUG: Agent: Trying key #"+(V+1)),m.authPK(t.config.username,K[V]),m.once("USERAUTH_PK_OK",te))}}o(xe,"tryNextAgentKey");function U(lt,pt,mr,gt){var ar=Array.isArray(gt)?gt.length:0;if(ar===0)return c("DEBUG: Client: Sending automatic USERAUTH_INFO_RESPONSE"),m.authInfoRes();t.emit("keyboard-interactive",lt,pt,mr,gt,function(Lr){m.authInfoRes(Lr)})}o(U,"onUSERAUTH_INFO_REQUEST");function te(){if(k==="agent"){var lt=K[V],pt=z6e(lt,0),mr=lt.toString("ascii",4,4+pt),gt=mr.slice(4);switch(mr){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":break;default:if(bGs&&mr==="ssh-ed25519")break;return c("DEBUG: Agent: Skipping unsupported key type: "+mr),xe()}m.authPK(t.config.username,lt,function(ar,Lr){M6e(t.config.agent,lt,gt,ar,function($e,kr){if($e)$e.level="agent",t.emit("error",$e);else{var O=z6e(kr,0);if(4+O+4<kr.length){var Y=kr.toString("ascii",4,4+O);if(Y!==mr)$e=new Error("Agent key/signature type mismatch"),$e.level="agent",t.emit("error",$e);else return Lr(kr.slice(4+O+4))}}xe()})})}else k==="publickey"&&m.authPK(t.config.username,d,function(ar,Lr){var $e=d.sign(ar);if($e instanceof Error)return $e.message="Error while signing data with privateKey: "+$e.message,$e.level="client-authentication",t.emit("error",$e),ne();Lr($e)})}o(te,"onUSERAUTH_PK_OK");function He(lt,pt){if(m.removeListener("USERAUTH_PK_OK",te),m.removeListener("USERAUTH_INFO_REQUEST",U),k==="agent")return c("DEBUG: Client: Agent key #"+(V+1)+" failed"),xe();c("DEBUG: Client: "+k+" auth failed"),j=pt,ee=lt,ne()}if(o(He,"onUSERAUTH_FAILURE"),m.once("USERAUTH_SUCCESS",function(){m.removeListener("USERAUTH_FAILURE",He),m.removeListener("USERAUTH_INFO_REQUEST",U),S(),clearTimeout(t._readyTimeout),t.emit("ready")}).on("USERAUTH_FAILURE",He),m.once("ready",function(){m.service("ssh-userauth"),m.once("SERVICE_ACCEPT",function(lt){lt==="ssh-userauth"&&ne()})}),m.on("CHANNEL_OPEN",function(lt){PGs(t,lt)}),m.on("REQUEST_SUCCESS",function(lt){l.length&&l.shift()(!1,lt)}).on("REQUEST_FAILURE",function(){l.length&&l.shift()(!0)}),m.on("GLOBAL_REQUEST",function(lt,pt,mr){pt&&m.requestFailure()}),e.sock)Dt(),m.pipe(f).pipe(m);else{let lt=function(){Dt(),t._sock.connect({host:Qe,port:t.config.port,localAddress:t.config.localAddress,localPort:t.config.localPort}),t._sock.setNoDelay(!0),t._sock.setMaxListeners(0),t._sock.setTimeout(typeof e.timeout=="number"?e.timeout:0)};var tr=lt;o(lt,"doConnect");var Qe=this.config.host,it=this.config.forceIPv4,qt=this.config.forceIPv6;c("DEBUG: Client: Trying "+Qe+" on port "+this.config.port+" ..."),!it&&!qt||it&&qt?lt():hGs(Qe,it?4:6,function(pt,mr,gt){if(pt){var ar=new Error("Error while looking up "+(it?"IPv4":"IPv6")+" address for host "+Qe+": "+pt);clearTimeout(t._readyTimeout),ar.level="client-dns",t.emit("error",ar),t.emit("close");return}Qe=mr,lt()})}function Dt(){t.config.readyTimeout>0&&(t._readyTimeout=setTimeout(function(){var lt=new Error("Timed out while waiting for handshake");lt.level="client-timeout",t.emit("error",lt),f.destroy()},t.config.readyTimeout))}o(Dt,"startTimeout")};$a.prototype.end=function(){return this._sock&&this._sock.writable&&this._sshstream&&this._sshstream.writable?this._sshstream.disconnect():!1};$a.prototype.destroy=function(){this._sock&&this._sock.destroy()};$a.prototype.exec=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");typeof t=="function"&&(r=t,t={});var n=this,i={allowHalfOpen:t.allowHalfOpen!==!1};return Rx(this,"session",i,function(s,a){if(s)return r(s);var c=[];function l(d){if(d)return a.close(),r(d);c.length&&c.shift()()}o(l,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&c.push(function(){Gtr(a,l)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&Htr(a,t.env),(typeof t.pty=="object"&&t.pty!==null||t.pty===!0)&&c.push(function(){$tr(a,t.pty,l)}),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&c.push(function(){Utr(a,t.x11,l)})),c.push(function(){AGs(a,e,t,r)}),c.shift()()})};$a.prototype.shell=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this;return typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),e&&(e.x11!==void 0||e.env!==void 0)&&(t=e,e=void 0),Rx(this,"session",function(i,s){if(i)return r(i);var a=[];function c(l){if(l)return s.close(),r(l);a.length&&a.shift()()}o(c,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&a.push(function(){Gtr(s,c)}),e!==!1&&a.push(function(){$tr(s,e,c)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&Htr(s,t.env),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&a.push(function(){Utr(s,t.x11,c)})),a.push(function(){EGs(s,r)}),a.shift()()})};$a.prototype.subsys=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");return Rx(this,"session",function(r,n){if(r)return t(r);Vtr(n,e,function(i,s){if(i)return t(i);t(void 0,s)})})};$a.prototype.sftp=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=this;return Rx(this,"session",function(r,n){if(r)return e(r);Vtr(n,"sftp",function(i,s){if(i)return e(i);var a=t._sshstream._state.incoming.identRaw,c={debug:t.config.debug},l=new L6e(c,a);function d(g){l.removeListener("ready",m),s.removeListener("exit",f),e(g)}o(d,"onError");function m(){l.removeListener("error",d),s.removeListener("exit",f),e(void 0,new CGs(l))}o(m,"onReady");function f(g,y){l.removeListener("ready",m),l.removeListener("error",d);var w;typeof g=="number"?w="Received exit code "+g+" while establishing SFTP session":w="Received signal "+y+" while establishing SFTP session";var v=new Error(w);v.code=g,v.signal=y,e(v)}o(f,"onExit"),l.once("error",d).once("ready",m).once("close",function(){s.end()}),s.once("exit",f),l.pipe(s).pipe(l)})})};$a.prototype.forwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s,a){if(s)return r(s!==!0?s:new Error("Unable to bind to "+e+":"+t));var c=t;t===0&&a&&a.length>=4&&(c=z6e(a,0),n._sshstream.remoteBugs&_Gs.DYN_RPORT_BUG||(t=c)),n._forwarding[e+":"+t]=c,r(void 0,c)}),this._sshstream.tcpipForward(e,t,i)};$a.prototype.unforwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to unbind from "+e+":"+t));delete n._forwarding[e+":"+t],r()}),this._sshstream.cancelTcpipForward(e,t,i)};$a.prototype.forwardOut=function(e,t,r,n,i){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var s={srcIP:e,srcPort:t,dstIP:r,dstPort:n};return Rx(this,"direct-tcpip",s,i)};$a.prototype.openssh_noMoreSessions=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=typeof e=="function";return!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)?(t&&this._callbacks.push(function(r){if(r)return e(r!==!0?r:new Error("Unable to disable future sessions"));e()}),this._sshstream.openssh_noMoreSessions(t)):(t&&process.nextTick(function(){e(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};$a.prototype.openssh_forwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to bind to "+e));n._forwardingUnix[e]=!0,t()}),this._sshstream.openssh_streamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};$a.prototype.openssh_unforwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to unbind on "+e));delete n._forwardingUnix[e],t()}),this._sshstream.openssh_cancelStreamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};$a.prototype.openssh_forwardOutStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");if(!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)){var r={socketPath:e};return Rx(this,"direct-streamlocal@openssh.com",r,t)}else process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))});return!0};function Rx(e,t,r,n){var i=Btr(e),s=s0.MAX_WINDOW,a=s0.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=n;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,d).once("CHANNEL_OPEN_FAILURE:"+i,m).once("CHANNEL_CLOSE:"+i,m),t==="session"?c=l.session(i,s,a):t==="direct-tcpip"?c=l.directTcpip(i,s,a,r):t==="direct-streamlocal@openssh.com"&&(c=l.openssh_directStreamLocal(i,s,a,r)),c;function d(f){l.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),l.removeListener("CHANNEL_CLOSE:"+i,m);var g={type:t,incoming:{id:i,window:s,packetSize:a,state:"open"},outgoing:{id:f.sender,window:f.window,packetSize:f.packetSize,state:"open"}};n(void 0,new s0(g,e))}o(d,"onSuccess");function m(f){l.removeListener("CHANNEL_OPEN_CONFIRMATION:"+i,d),l.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),l.removeListener("CHANNEL_CLOSE:"+i,m),delete e._channels[i];var g;f instanceof Error?g=f:typeof f=="object"&&f!==null?(g=new Error("(SSH) Channel open failure: "+f.description),g.reason=f.reason,g.lang=f.lang):(g=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),g.reason=g.lang=""),n(g)}o(m,"onFailure")}o(Rx,"openChannel");function Btr(e){if(e._curChan<Ftr)return++e._curChan;for(var t=0,r=e._channels;t<Ftr;++t)if(!r[t])return t;return!1}o(Btr,"nextChannel");function Utr(e,t,r){var n={single:!1,protocol:"MIT-MAGIC-COOKIE-1",cookie:void 0,screen:0};typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.single=="boolean"&&(n.single=t.single),typeof t.screen=="number"&&(n.screen=t.screen),typeof t.protocol=="string"&&(n.protocol=t.protocol),typeof t.cookie=="string"?n.cookie=t.cookie:Buffer.isBuffer(t.cookie)&&(n.cookie=t.cookie.toString("hex"))),n.cookie===void 0&&(n.cookie=xGs());var i=typeof r=="function";return e.outgoing.state!=="open"?(i&&r(new Error("Channel is not open")),!0):(i&&e._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to request X11"));e._hasX11=!0,++e._client._acceptX11,e.once("close",function(){e._client._acceptX11&&--e._client._acceptX11}),r()}),e._client._sshstream.x11Forward(e.outgoing.id,n,i))}o(Utr,"reqX11");function $tr(e,t,r){var n=24,i=80,s=640,a=480,c="vt100",l=null;typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.rows=="number"&&(n=t.rows),typeof t.cols=="number"&&(i=t.cols),typeof t.width=="number"&&(s=t.width),typeof t.height=="number"&&(a=t.height),typeof t.term=="string"&&(c=t.term),typeof t.modes=="object"&&(l=t.modes));var d=typeof r=="function";return e.outgoing.state!=="open"?(d&&r(new Error("Channel is not open")),!0):(d&&e._callbacks.push(function(m){if(m)return r(m!==!0?m:new Error("Unable to request a pseudo-terminal"));r()}),e._client._sshstream.pty(e.outgoing.id,n,i,a,s,c,l,d))}o($tr,"reqPty");function Gtr(e,t){var r=typeof t=="function";return e.outgoing.state!=="open"?(r&&t(new Error("Channel is not open")),!0):e._client._agentFwdEnabled?(r&&t(!1),!0):(e._client._agentFwdEnabled=!0,e._callbacks.push(function(n){if(n){e._client._agentFwdEnabled=!1,r&&t(n!==!0?n:new Error("Unable to request agent forwarding"));return}r&&t()}),e._client._sshstream.openssh_agentForward(e.outgoing.id,!0))}o(Gtr,"reqAgentFwd");function EGs(e,t){return e.outgoing.state!=="open"?(t(new Error("Channel is not open")),!0):(e._callbacks.push(function(r){if(r)return t(r!==!0?r:new Error("Unable to open shell"));e.subtype="shell",t(void 0,e)}),e._client._sshstream.shell(e.outgoing.id,!0))}o(EGs,"reqShell");function AGs(e,t,r,n){return e.outgoing.state!=="open"?(n(new Error("Channel is not open")),!0):(e._callbacks.push(function(i){if(i)return n(i!==!0?i:new Error("Unable to exec"));e.subtype="exec",e.allowHalfOpen=r.allowHalfOpen!==!1,n(void 0,e)}),e._client._sshstream.exec(e.outgoing.id,t,!0))}o(AGs,"reqExec");function Htr(e,t){if(e.outgoing.state!=="open")return!0;for(var r=!0,n=Object.keys(t||{}),i,s,a=0,c=n.length;a<c;++a)i=n[a],s=t[i],r=e._client._sshstream.env(e.outgoing.id,i,s,!1);return r}o(Htr,"reqEnv");function Vtr(e,t,r){return e.outgoing.state!=="open"?(r(new Error("Channel is not open")),!0):(e._callbacks.push(function(n){if(n)return r(n!==!0?n:new Error("Unable to start subsystem: "+t));e.subtype="subsystem",r(void 0,e)}),e._client._sshstream.subsystem(e.outgoing.id,t,!0))}o(Vtr,"reqSubsystem");function PGs(e,t){var r=!1,n;function i(){var c={type:t.type,incoming:{id:r,window:s0.MAX_WINDOW,packetSize:s0.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},l=new s0(c,e);return e._sshstream.channelOpenConfirm(t.sender,r,s0.MAX_WINDOW,s0.PACKET_SIZE),l}o(i,"accept");function s(){n===void 0&&(r===!1?n=dC.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE:n=dC.CHANNEL_OPEN_FAILURE.CONNECT_FAILED),e._sshstream.channelOpenFail(t.sender,n,"","")}if(o(s,"reject"),t.type==="forwarded-tcpip"||t.type==="x11"||t.type==="auth-agent@openssh.com"||t.type==="forwarded-streamlocal@openssh.com"){var a=t.type==="forwarded-tcpip"&&e._forwarding[t.data.destIP+":"+t.data.destPort]===void 0||t.type==="forwarded-streamlocal@openssh.com"&&e._forwardingUnix[t.data.socketPath]===void 0||t.type==="x11"&&e._acceptX11===0||t.type==="auth-agent@openssh.com"&&!e._agentFwdEnabled;a?(n=dC.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: "+t.type)):(r=Btr(e),r===!1?(e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: no channels available"),a=!0):e._channels[r]=!0),a&&s(),r!==!1&&(t.type==="forwarded-tcpip"?(t.data.destPort===0&&(t.data.destPort=e._forwarding[t.data.destIP+":"+t.data.destPort]),e.emit("tcp connection",t.data,i,s)):t.type==="x11"?e.emit("x11",t.data,i,s):t.type==="forwarded-streamlocal@openssh.com"?e.emit("unix connection",t.data,i,s):M6e(e.config.agent,i,s))}else e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: "+t.type),n=dC.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE,s()}o(PGs,"onCHANNEL_OPEN");var xGs=function(){if(typeof aL.randomFillSync=="function"){var e=Buffer.alloc(16);return o(function(){return aL.randomFillSync(e,0,16),e.toString("hex")},"randomCookie")}else return o(function(){return aL.randomBytes(16).toString("hex")},"randomCookie")}();$a.Client=$a;$a.Server=Mtr();$a.utils=oL.utils;$a.SFTP_STATUS_CODE=L6e.STATUS_CODE;$a.SFTP_OPEN_MODE=L6e.OPEN_MODE;$a.HTTPAgent=Otr.SSHTTPAgent;$a.HTTPSAgent=Otr.SSHTTPSAgent;Xtr.exports=$a});var Wtr=h((U2o,Ktr)=>{var RGs=x6e().Client,kGs=require("http");Ktr.exports=function(e){var t=new RGs,r=new kGs.Agent;return r.createConnection=function(n,i){t.once("ready",function(){t.exec("docker system dial-stdio",function(s,a){if(s){t.end(),r.destroy();return}i(null,a),a.once("close",()=>{t.end(),r.destroy()})})}).connect(e),t.once("end",()=>r.destroy())},r}});var O6e=h(($2o,Qtr)=>{Qtr.exports=require("stream")});var err=h((G2o,Jtr)=>{"use strict";function Ytr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}o(Ytr,"ownKeys");function TGs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ytr(Object(r),!0).forEach(function(n){IGs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ytr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}o(TGs,"_objectSpread");function IGs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(IGs,"_defineProperty");function qGs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}o(qGs,"_classCallCheck");function Ztr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o(Ztr,"_defineProperties");function DGs(e,t,r){return t&&Ztr(e.prototype,t),r&&Ztr(e,r),e}o(DGs,"_createClass");var NGs=require("buffer"),Bee=NGs.Buffer,LGs=require("util"),F6e=LGs.inspect,MGs=F6e&&F6e.custom||"inspect";function zGs(e,t,r){Bee.prototype.copy.call(e,t,r)}o(zGs,"copyBuffer");Jtr.exports=function(){function e(){qGs(this,e),this.head=null,this.tail=null,this.length=0}return o(e,"BufferList"),DGs(e,[{key:"push",value:o(function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},"push")},{key:"unshift",value:o(function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},"unshift")},{key:"shift",value:o(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:o(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:o(function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},"join")},{key:"concat",value:o(function(r){if(this.length===0)return Bee.alloc(0);for(var n=Bee.allocUnsafe(r>>>0),i=this.head,s=0;i;)zGs(i.data,n,s),s+=i.data.length,i=i.next;return n},"concat")},{key:"consume",value:o(function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i},"consume")},{key:"first",value:o(function(){return this.head.data},"first")},{key:"_getString",value:o(function(r){var n=this.head,i=1,s=n.data;for(r-=s.length;n=n.next;){var a=n.data,c=r>a.length?a.length:r;if(c===a.length?s+=a:s+=a.slice(0,r),r-=c,r===0){c===a.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(c));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:o(function(r){var n=Bee.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var a=i.data,c=r>a.length?a.length:r;if(a.copy(n,n.length-r,0,c),r-=c,r===0){c===a.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(c));break}++s}return this.length-=s,n},"_getBuffer")},{key:MGs,value:o(function(r,n){return F6e(this,TGs({},n,{depth:0,customInspect:!1}))},"value")}]),e}()});var B6e=h((H2o,rrr)=>{"use strict";function OGs(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(j6e,this,e)):process.nextTick(j6e,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Uee,r):(r._writableState.errorEmitted=!0,process.nextTick(trr,r,s)):process.nextTick(trr,r,s):t?(process.nextTick(Uee,r),t(s)):process.nextTick(Uee,r)}),this)}o(OGs,"destroy");function trr(e,t){j6e(e,t),Uee(e)}o(trr,"emitErrorAndCloseNT");function Uee(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}o(Uee,"emitCloseNT");function FGs(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}o(FGs,"undestroy");function j6e(e,t){e.emit("error",t)}o(j6e,"emitErrorNT");function jGs(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}o(jGs,"errorOrDestroy");rrr.exports={destroy:OGs,undestroy:FGs,errorOrDestroy:jGs}});var a0=h((V2o,srr)=>{"use strict";var nrr={};function Nf(e,t,r){r||(r=Error);function n(s,a,c){return typeof t=="string"?t:t(s,a,c)}o(n,"getMessage");class i extends r{constructor(a,c,l){super(n(a,c,l))}}o(i,"NodeError"),i.prototype.name=r.name,i.prototype.code=e,nrr[e]=i}o(Nf,"createErrorType");function irr(e,t){if(Array.isArray(e)){let r=e.length;return e=e.map(n=>String(n)),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:r===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}o(irr,"oneOf");function BGs(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}o(BGs,"startsWith");function UGs(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}o(UGs,"endsWith");function $Gs(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}o($Gs,"includes");Nf("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Nf("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&BGs(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(UGs(e," argument"))i=`The ${e} ${n} ${irr(t,"type")}`;else{let s=$Gs(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${irr(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);Nf("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Nf("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Nf("ERR_STREAM_PREMATURE_CLOSE","Premature close");Nf("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Nf("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Nf("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Nf("ERR_STREAM_WRITE_AFTER_END","write after end");Nf("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Nf("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Nf("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");srr.exports.codes=nrr});var U6e=h((X2o,arr)=>{"use strict";var GGs=a0().codes.ERR_INVALID_OPT_VALUE;function HGs(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}o(HGs,"highWaterMarkFrom");function VGs(e,t,r,n){var i=HGs(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new GGs(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}o(VGs,"getHighWaterMark");arr.exports={getHighWaterMark:VGs}});var $ee=h((K2o,orr)=>{orr.exports=require("util").deprecate});var H6e=h((W2o,frr)=>{"use strict";frr.exports=No;function crr(e){var t=this;this.next=null,this.entry=null,this.finish=function(){v6s(t,e)}}o(crr,"CorkedRequest");var kx;No.WritableState=lL;var XGs={deprecate:$ee()},lrr=O6e(),Gee=require("buffer").Buffer,KGs=global.Uint8Array||function(){};function WGs(e){return Gee.from(e)}o(WGs,"_uint8ArrayToBuffer");function QGs(e){return Gee.isBuffer(e)||e instanceof KGs}o(QGs,"_isUint8Array");var $6e=B6e(),YGs=U6e(),ZGs=YGs.getHighWaterMark,o0=a0().codes,JGs=o0.ERR_INVALID_ARG_TYPE,e6s=o0.ERR_METHOD_NOT_IMPLEMENTED,t6s=o0.ERR_MULTIPLE_CALLBACK,r6s=o0.ERR_STREAM_CANNOT_PIPE,n6s=o0.ERR_STREAM_DESTROYED,i6s=o0.ERR_STREAM_NULL_VALUES,s6s=o0.ERR_STREAM_WRITE_AFTER_END,a6s=o0.ERR_UNKNOWN_ENCODING,Tx=$6e.errorOrDestroy;dc()(No,lrr);function o6s(){}o(o6s,"nop");function lL(e,t,r){kx=kx||uC(),e=e||{},typeof r!="boolean"&&(r=t instanceof kx),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=ZGs(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=e.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){p6s(t,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new crr(this)}o(lL,"WritableState");lL.prototype.getBuffer=o(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(lL.prototype,"buffer",{get:XGs.deprecate(o(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var Hee;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Hee=Function.prototype[Symbol.hasInstance],Object.defineProperty(No,Symbol.hasInstance,{value:o(function(t){return Hee.call(this,t)?!0:this!==No?!1:t&&t._writableState instanceof lL},"value")})):Hee=o(function(t){return t instanceof this},"realHasInstance");function No(e){kx=kx||uC();var t=this instanceof kx;if(!t&&!Hee.call(No,this))return new No(e);this._writableState=new lL(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),lrr.call(this)}o(No,"Writable");No.prototype.pipe=function(){Tx(this,new r6s)};function c6s(e,t){var r=new s6s;Tx(e,r),process.nextTick(t,r)}o(c6s,"writeAfterEnd");function l6s(e,t,r,n){var i;return r===null?i=new i6s:typeof r!="string"&&!t.objectMode&&(i=new JGs("chunk",["string","Buffer"],r)),i?(Tx(e,i),process.nextTick(n,i),!1):!0}o(l6s,"validChunk");No.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&QGs(e);return s&&!Gee.isBuffer(e)&&(e=WGs(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=o6s),n.ending?c6s(this,r):(s||l6s(this,n,e,r))&&(n.pendingcb++,i=u6s(this,n,s,e,t,r)),i};No.prototype.cork=function(){this._writableState.corked++};No.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&urr(this,e))};No.prototype.setDefaultEncoding=o(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new a6s(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty(No.prototype,"writableBuffer",{enumerable:!1,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function d6s(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Gee.from(t,r)),t}o(d6s,"decodeChunk");Object.defineProperty(No.prototype,"writableHighWaterMark",{enumerable:!1,get:o(function(){return this._writableState.highWaterMark},"get")});function u6s(e,t,r,n,i,s){if(!r){var a=d6s(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var c=t.objectMode?1:n.length;t.length+=c;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else G6e(e,t,!1,c,n,i,s);return l}o(u6s,"writeOrBuffer");function G6e(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new n6s("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}o(G6e,"doWrite");function m6s(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(dL,e,t),e._writableState.errorEmitted=!0,Tx(e,n)):(i(n),e._writableState.errorEmitted=!0,Tx(e,n),dL(e,t))}o(m6s,"onwriteError");function f6s(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}o(f6s,"onwriteStateUpdate");function p6s(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new t6s;if(f6s(r),t)m6s(e,r,n,t,i);else{var s=mrr(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&urr(e,r),n?process.nextTick(drr,e,r,s,i):drr(e,r,s,i)}}o(p6s,"onwrite");function drr(e,t,r,n){r||g6s(e,t),t.pendingcb--,n(),dL(e,t)}o(drr,"afterWrite");function g6s(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}o(g6s,"onwriteDrain");function urr(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,G6e(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new crr(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,d=r.encoding,m=r.callback,f=t.objectMode?1:l.length;if(G6e(e,t,!1,f,l,d,m),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}o(urr,"clearBuffer");No.prototype._write=function(e,t,r){r(new e6s("_write()"))};No.prototype._writev=null;No.prototype.end=function(e,t,r){var n=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||w6s(this,n,r),this};Object.defineProperty(No.prototype,"writableLength",{enumerable:!1,get:o(function(){return this._writableState.length},"get")});function mrr(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}o(mrr,"needFinish");function h6s(e,t){e._final(function(r){t.pendingcb--,r&&Tx(e,r),t.prefinished=!0,e.emit("prefinish"),dL(e,t)})}o(h6s,"callFinal");function y6s(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(h6s,e,t)):(t.prefinished=!0,e.emit("prefinish")))}o(y6s,"prefinish");function dL(e,t){var r=mrr(t);if(r&&(y6s(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}o(dL,"finishMaybe");function w6s(e,t,r){t.ending=!0,dL(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}o(w6s,"endWritable");function v6s(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}o(v6s,"onCorkedFinish");Object.defineProperty(No.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:o(function(t){!this._writableState||(this._writableState.destroyed=t)},"set")});No.prototype.destroy=$6e.destroy;No.prototype._undestroy=$6e.undestroy;No.prototype._destroy=function(e,t){t(e)}});var uC=h((Q2o,grr)=>{"use strict";var _6s=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};grr.exports=ah;var prr=K6e(),V6e=H6e();dc()(ah,prr);for(X6e=_6s(V6e.prototype),Vee=0;Vee<X6e.length;Vee++)Xee=X6e[Vee],ah.prototype[Xee]||(ah.prototype[Xee]=V6e.prototype[Xee]);var X6e,Xee,Vee;function ah(e){if(!(this instanceof ah))return new ah(e);prr.call(this,e),V6e.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",b6s)))}o(ah,"Duplex");Object.defineProperty(ah.prototype,"writableHighWaterMark",{enumerable:!1,get:o(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ah.prototype,"writableBuffer",{enumerable:!1,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ah.prototype,"writableLength",{enumerable:!1,get:o(function(){return this._writableState.length},"get")});function b6s(){this._writableState.ended||process.nextTick(S6s,this)}o(b6s,"onend");function S6s(e){e.end()}o(S6s,"onEndNT");Object.defineProperty(ah.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:o(function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")})});var Kee=h((Y2o,wrr)=>{"use strict";var hrr=a0().codes.ERR_STREAM_PREMATURE_CLOSE;function C6s(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}o(C6s,"once");function E6s(){}o(E6s,"noop");function A6s(e){return e.setHeader&&typeof e.abort=="function"}o(A6s,"isRequest");function yrr(e,t,r){if(typeof t=="function")return yrr(e,null,t);t||(t={}),r=C6s(r||E6s);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=o(function(){e.writable||c()},"onlegacyfinish"),a=e._writableState&&e._writableState.finished,c=o(function(){i=!1,a=!0,n||r.call(e)},"onfinish"),l=e._readableState&&e._readableState.endEmitted,d=o(function(){n=!1,l=!0,i||r.call(e)},"onend"),m=o(function(w){r.call(e,w)},"onerror"),f=o(function(){var w;if(n&&!l)return(!e._readableState||!e._readableState.ended)&&(w=new hrr),r.call(e,w);if(i&&!a)return(!e._writableState||!e._writableState.ended)&&(w=new hrr),r.call(e,w)},"onclose"),g=o(function(){e.req.on("finish",c)},"onrequest");return A6s(e)?(e.on("complete",c),e.on("abort",f),e.req?g():e.on("request",g)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",d),e.on("finish",c),t.error!==!1&&e.on("error",m),e.on("close",f),function(){e.removeListener("complete",c),e.removeListener("abort",f),e.removeListener("request",g),e.req&&e.req.removeListener("finish",c),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",c),e.removeListener("end",d),e.removeListener("error",m),e.removeListener("close",f)}}o(yrr,"eos");wrr.exports=yrr});var _rr=h((Z2o,vrr)=>{"use strict";var Wee;function c0(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(c0,"_defineProperty");var P6s=Kee(),l0=Symbol("lastResolve"),mC=Symbol("lastReject"),uL=Symbol("error"),Qee=Symbol("ended"),fC=Symbol("lastPromise"),W6e=Symbol("handlePromise"),pC=Symbol("stream");function d0(e,t){return{value:e,done:t}}o(d0,"createIterResult");function x6s(e){var t=e[l0];if(t!==null){var r=e[pC].read();r!==null&&(e[fC]=null,e[l0]=null,e[mC]=null,t(d0(r,!1)))}}o(x6s,"readAndResolve");function R6s(e){process.nextTick(x6s,e)}o(R6s,"onReadable");function k6s(e,t){return function(r,n){e.then(function(){if(t[Qee]){r(d0(void 0,!0));return}t[W6e](r,n)},n)}}o(k6s,"wrapForNext");var T6s=Object.getPrototypeOf(function(){}),I6s=Object.setPrototypeOf((Wee={get stream(){return this[pC]},next:o(function(){var t=this,r=this[uL];if(r!==null)return Promise.reject(r);if(this[Qee])return Promise.resolve(d0(void 0,!0));if(this[pC].destroyed)return new Promise(function(a,c){process.nextTick(function(){t[uL]?c(t[uL]):a(d0(void 0,!0))})});var n=this[fC],i;if(n)i=new Promise(k6s(n,this));else{var s=this[pC].read();if(s!==null)return Promise.resolve(d0(s,!1));i=new Promise(this[W6e])}return this[fC]=i,i},"next")},c0(Wee,Symbol.asyncIterator,function(){return this}),c0(Wee,"return",o(function(){var t=this;return new Promise(function(r,n){t[pC].destroy(null,function(i){if(i){n(i);return}r(d0(void 0,!0))})})},"_return")),Wee),T6s),q6s=o(function(t){var r,n=Object.create(I6s,(r={},c0(r,pC,{value:t,writable:!0}),c0(r,l0,{value:null,writable:!0}),c0(r,mC,{value:null,writable:!0}),c0(r,uL,{value:null,writable:!0}),c0(r,Qee,{value:t._readableState.endEmitted,writable:!0}),c0(r,W6e,{value:o(function(s,a){var c=n[pC].read();c?(n[fC]=null,n[l0]=null,n[mC]=null,s(d0(c,!1))):(n[l0]=s,n[mC]=a)},"value"),writable:!0}),r));return n[fC]=null,P6s(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[mC];s!==null&&(n[fC]=null,n[l0]=null,n[mC]=null,s(i)),n[uL]=i;return}var a=n[l0];a!==null&&(n[fC]=null,n[l0]=null,n[mC]=null,a(d0(void 0,!0))),n[Qee]=!0}),t.on("readable",R6s.bind(null,n)),n},"createReadableStreamAsyncIterator");vrr.exports=q6s});var Err=h((J2o,Crr)=>{"use strict";function brr(e,t,r,n,i,s,a){try{var c=e[s](a),l=c.value}catch(d){r(d);return}c.done?t(l):Promise.resolve(l).then(n,i)}o(brr,"asyncGeneratorStep");function D6s(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function a(l){brr(s,n,i,a,c,"next",l)}o(a,"_next");function c(l){brr(s,n,i,a,c,"throw",l)}o(c,"_throw"),a(void 0)})}}o(D6s,"_asyncToGenerator");function Srr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}o(Srr,"ownKeys");function N6s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Srr(Object(r),!0).forEach(function(n){L6s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Srr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}o(N6s,"_objectSpread");function L6s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(L6s,"_defineProperty");var M6s=a0().codes.ERR_INVALID_ARG_TYPE;function z6s(e,t,r){var n;if(t&&typeof t.next=="function")n=t;else if(t&&t[Symbol.asyncIterator])n=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])n=t[Symbol.iterator]();else throw new M6s("iterable",["Iterable"],t);var i=new e(N6s({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,a())};function a(){return c.apply(this,arguments)}o(a,"next");function c(){return c=D6s(function*(){try{var l=yield n.next(),d=l.value,m=l.done;m?i.push(null):i.push(yield d)?a():s=!1}catch(f){i.destroy(f)}}),c.apply(this,arguments)}return o(c,"_next2"),i}o(z6s,"from");Crr.exports=z6s});var K6e=h((tjo,Nrr)=>{"use strict";Nrr.exports=Ws;var Ix;Ws.ReadableState=Prr;var ejo=require("events").EventEmitter,Arr=o(function(t,r){return t.listeners(r).length},"EElistenerCount"),mL=O6e(),Yee=require("buffer").Buffer,O6s=global.Uint8Array||function(){};function F6s(e){return Yee.from(e)}o(F6s,"_uint8ArrayToBuffer");function j6s(e){return Yee.isBuffer(e)||e instanceof O6s}o(j6s,"_isUint8Array");var Q6e=require("util"),bs;Q6e&&Q6e.debuglog?bs=Q6e.debuglog("stream"):bs=o(function(){},"debug");var B6s=err(),Y6e=B6e(),U6s=U6e(),$6s=U6s.getHighWaterMark,Zee=a0().codes,G6s=Zee.ERR_INVALID_ARG_TYPE,H6s=Zee.ERR_STREAM_PUSH_AFTER_EOF,V6s=Zee.ERR_METHOD_NOT_IMPLEMENTED,X6s=Zee.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,qx,Z6e,J6e;dc()(Ws,mL);var fL=Y6e.errorOrDestroy,e4e=["error","close","destroy","pause","resume"];function K6s(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}o(K6s,"prependListener");function Prr(e,t,r){Ix=Ix||uC(),e=e||{},typeof r!="boolean"&&(r=t instanceof Ix),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=$6s(this,e,"readableHighWaterMark",r),this.buffer=new B6s,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(qx||(qx=require("string_decoder/").StringDecoder),this.decoder=new qx(e.encoding),this.encoding=e.encoding)}o(Prr,"ReadableState");function Ws(e){if(Ix=Ix||uC(),!(this instanceof Ws))return new Ws(e);var t=this instanceof Ix;this._readableState=new Prr(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),mL.call(this)}o(Ws,"Readable");Object.defineProperty(Ws.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:o(function(t){!this._readableState||(this._readableState.destroyed=t)},"set")});Ws.prototype.destroy=Y6e.destroy;Ws.prototype._undestroy=Y6e.undestroy;Ws.prototype._destroy=function(e,t){t(e)};Ws.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=Yee.from(e,t),t=""),n=!0),xrr(this,e,t,!1,n)};Ws.prototype.unshift=function(e){return xrr(this,e,null,!0,!1)};function xrr(e,t,r,n,i){bs("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,Y6s(e,s);else{var a;if(i||(a=W6s(s,t)),a)fL(e,a);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==Yee.prototype&&(t=F6s(t)),n)s.endEmitted?fL(e,new X6s):t4e(e,s,t,!0);else if(s.ended)fL(e,new H6s);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?t4e(e,s,t,!1):r4e(e,s)):t4e(e,s,t,!1)}else n||(s.reading=!1,r4e(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}o(xrr,"readableAddChunk");function t4e(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Jee(e)),r4e(e,t)}o(t4e,"addChunk");function W6s(e,t){var r;return!j6s(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new G6s("chunk",["string","Buffer","Uint8Array"],t)),r}o(W6s,"chunkInvalid");Ws.prototype.isPaused=function(){return this._readableState.flowing===!1};Ws.prototype.setEncoding=function(e){qx||(qx=require("string_decoder/").StringDecoder);var t=new qx(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var Rrr=1073741824;function Q6s(e){return e>=Rrr?e=Rrr:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}o(Q6s,"computeNewHighWaterMark");function krr(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=Q6s(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}o(krr,"howMuchToRead");Ws.prototype.read=function(e){bs("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return bs("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?i4e(this):Jee(this),null;if(e=krr(e,t),e===0&&t.ended)return t.length===0&&i4e(this),null;var n=t.needReadable;bs("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,bs("length less than watermark",n)),t.ended||t.reading?(n=!1,bs("reading or ended",n)):n&&(bs("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=krr(r,t)));var i;return e>0?i=qrr(e,t):i=null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&i4e(this)),i!==null&&this.emit("data",i),i};function Y6s(e,t){if(bs("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Jee(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,Trr(e)))}}o(Y6s,"onEofChunk");function Jee(e){var t=e._readableState;bs("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(bs("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(Trr,e))}o(Jee,"emitReadable");function Trr(e){var t=e._readableState;bs("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,n4e(e)}o(Trr,"emitReadable_");function r4e(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(Z6s,e,t))}o(r4e,"maybeReadMore");function Z6s(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(bs("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}o(Z6s,"maybeReadMore_");Ws.prototype._read=function(e){fL(this,new V6s("_read()"))};Ws.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,bs("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?c:v;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);function a(b,S){bs("onunpipe"),b===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,m())}o(a,"onunpipe");function c(){bs("onend"),e.end()}o(c,"onend");var l=J6s(r);e.on("drain",l);var d=!1;function m(){bs("cleanup"),e.removeListener("close",y),e.removeListener("finish",w),e.removeListener("drain",l),e.removeListener("error",g),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",v),r.removeListener("data",f),d=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}o(m,"cleanup"),r.on("data",f);function f(b){bs("ondata");var S=e.write(b);bs("dest.write",S),S===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&Drr(n.pipes,e)!==-1)&&!d&&(bs("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}o(f,"ondata");function g(b){bs("onerror",b),v(),e.removeListener("error",g),Arr(e,"error")===0&&fL(e,b)}o(g,"onerror"),K6s(e,"error",g);function y(){e.removeListener("finish",w),v()}o(y,"onclose"),e.once("close",y);function w(){bs("onfinish"),e.removeListener("close",y),v()}o(w,"onfinish"),e.once("finish",w);function v(){bs("unpipe"),r.unpipe(e)}return o(v,"unpipe"),e.emit("pipe",r),n.flowing||(bs("pipe resume"),r.resume()),e};function J6s(e){return o(function(){var r=e._readableState;bs("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Arr(e,"data")&&(r.flowing=!0,n4e(e))},"pipeOnDrainFunctionResult")}o(J6s,"pipeOnDrain");Ws.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=Drr(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};Ws.prototype.on=function(e,t){var r=mL.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,bs("on readable",n.length,n.reading),n.length?Jee(this):n.reading||process.nextTick(e4s,this)),r};Ws.prototype.addListener=Ws.prototype.on;Ws.prototype.removeListener=function(e,t){var r=mL.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(Irr,this),r};Ws.prototype.removeAllListeners=function(e){var t=mL.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(Irr,this),t};function Irr(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}o(Irr,"updateReadableListening");function e4s(e){bs("readable nexttick read 0"),e.read(0)}o(e4s,"nReadingNextTick");Ws.prototype.resume=function(){var e=this._readableState;return e.flowing||(bs("resume"),e.flowing=!e.readableListening,t4s(this,e)),e.paused=!1,this};function t4s(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(r4s,e,t))}o(t4s,"resume");function r4s(e,t){bs("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),n4e(e),t.flowing&&!t.reading&&e.read(0)}o(r4s,"resume_");Ws.prototype.pause=function(){return bs("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(bs("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function n4e(e){var t=e._readableState;for(bs("flow",t.flowing);t.flowing&&e.read()!==null;);}o(n4e,"flow");Ws.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(bs("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&t.push(a)}t.push(null)}),e.on("data",function(a){if(bs("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var c=t.push(a);c||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=o(function(c){return o(function(){return e[c].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<e4e.length;s++)e.on(e4e[s],this.emit.bind(this,e4e[s]));return this._read=function(a){bs("wrapped _read",a),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(Ws.prototype[Symbol.asyncIterator]=function(){return Z6e===void 0&&(Z6e=_rr()),Z6e(this)});Object.defineProperty(Ws.prototype,"readableHighWaterMark",{enumerable:!1,get:o(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(Ws.prototype,"readableBuffer",{enumerable:!1,get:o(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(Ws.prototype,"readableFlowing",{enumerable:!1,get:o(function(){return this._readableState.flowing},"get"),set:o(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});Ws._fromList=qrr;Object.defineProperty(Ws.prototype,"readableLength",{enumerable:!1,get:o(function(){return this._readableState.length},"get")});function qrr(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}o(qrr,"fromList");function i4e(e){var t=e._readableState;bs("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(n4s,t,e))}o(i4e,"endReadable");function n4s(e,t){if(bs("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}o(n4s,"endReadableNT");typeof Symbol=="function"&&(Ws.from=function(e,t){return J6e===void 0&&(J6e=Err()),J6e(Ws,e,t)});function Drr(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}o(Drr,"indexOf")});var s4e=h((rjo,Mrr)=>{"use strict";Mrr.exports=Rw;var ete=a0().codes,i4s=ete.ERR_METHOD_NOT_IMPLEMENTED,s4s=ete.ERR_MULTIPLE_CALLBACK,a4s=ete.ERR_TRANSFORM_ALREADY_TRANSFORMING,o4s=ete.ERR_TRANSFORM_WITH_LENGTH_0,tte=uC();dc()(Rw,tte);function c4s(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new s4s);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}o(c4s,"afterTransform");function Rw(e){if(!(this instanceof Rw))return new Rw(e);tte.call(this,e),this._transformState={afterTransform:c4s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",l4s)}o(Rw,"Transform");function l4s(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Lrr(e,t,r)}):Lrr(this,null,null)}o(l4s,"prefinish");Rw.prototype.push=function(e,t){return this._transformState.needTransform=!1,tte.prototype.push.call(this,e,t)};Rw.prototype._transform=function(e,t,r){r(new i4s("_transform()"))};Rw.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Rw.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Rw.prototype._destroy=function(e,t){tte.prototype._destroy.call(this,e,function(r){t(r)})};function Lrr(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new o4s;if(e._transformState.transforming)throw new a4s;return e.push(null)}o(Lrr,"done")});var Frr=h((njo,Orr)=>{"use strict";Orr.exports=pL;var zrr=s4e();dc()(pL,zrr);function pL(e){if(!(this instanceof pL))return new pL(e);zrr.call(this,e)}o(pL,"PassThrough");pL.prototype._transform=function(e,t,r){r(null,e)}});var Grr=h((ijo,$rr)=>{"use strict";var a4e;function d4s(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}o(d4s,"once");var jrr=a0().codes,u4s=jrr.ERR_MISSING_ARGS,m4s=jrr.ERR_STREAM_DESTROYED;function Brr(e){if(e)throw e}o(Brr,"noop");function f4s(e){return e.setHeader&&typeof e.abort=="function"}o(f4s,"isRequest");function p4s(e,t,r,n){n=d4s(n);var i=!1;e.on("close",function(){i=!0}),a4e===void 0&&(a4e=Kee()),a4e(e,{readable:t,writable:r},function(a){if(a)return n(a);i=!0,n()});var s=!1;return function(a){if(!i&&!s){if(s=!0,f4s(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(a||new m4s("pipe"))}}}o(p4s,"destroyer");function Urr(e){e()}o(Urr,"call");function g4s(e,t){return e.pipe(t)}o(g4s,"pipe");function h4s(e){return!e.length||typeof e[e.length-1]!="function"?Brr:e.pop()}o(h4s,"popCallback");function y4s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=h4s(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new u4s("streams");var i,s=t.map(function(a,c){var l=c<t.length-1,d=c>0;return p4s(a,l,d,function(m){i||(i=m),m&&s.forEach(Urr),!l&&(s.forEach(Urr),n(i))})});return t.reduce(g4s)}o(y4s,"pipeline");$rr.exports=y4s});var Mf=h((Lf,hL)=>{var gL=require("stream");process.env.READABLE_STREAM==="disable"&&gL?(hL.exports=gL.Readable,Object.assign(hL.exports,gL),hL.exports.Stream=gL):(Lf=hL.exports=K6e(),Lf.Stream=gL||Lf,Lf.Readable=Lf,Lf.Writable=H6e(),Lf.Duplex=uC(),Lf.Transform=s4e(),Lf.PassThrough=Frr(),Lf.finished=Kee(),Lf.pipeline=Grr())});var Xrr=h((sjo,Vrr)=>{Vrr.exports=kw;var w4s=require("util"),Hrr=Mf();w4s.inherits(kw,Hrr.Duplex);function kw(e,t,r){var n=this;if(!(n instanceof kw))return new kw(e,t,r);Hrr.Duplex.call(n,r),n._output=null,n.connect(e,t)}o(kw,"HttpDuplex");kw.prototype.connect=function(e,t){var r=this;r.req=e,r._output=t,r.emit("response",t),t.on("data",function(n){r.push(n)||r._output.pause()}),t.on("end",function(){r.push(null)})};kw.prototype._read=function(e){this._output&&this._output.resume()};kw.prototype._write=function(e,t,r){this.req.write(e,t),r()};kw.prototype.end=function(e,t,r){return this._output.socket.destroy(),this.req.end(e,t,r)};kw.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()}});var Wrr=h((ajo,Krr)=>{var Dx=1e3,Nx=Dx*60,Lx=Nx*60,gC=Lx*24,v4s=gC*7,_4s=gC*365.25;Krr.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return b4s(e);if(r==="number"&&isFinite(e))return t.long?C4s(e):S4s(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function b4s(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*_4s;case"weeks":case"week":case"w":return r*v4s;case"days":case"day":case"d":return r*gC;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Lx;case"minutes":case"minute":case"mins":case"min":case"m":return r*Nx;case"seconds":case"second":case"secs":case"sec":case"s":return r*Dx;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}o(b4s,"parse");function S4s(e){var t=Math.abs(e);return t>=gC?Math.round(e/gC)+"d":t>=Lx?Math.round(e/Lx)+"h":t>=Nx?Math.round(e/Nx)+"m":t>=Dx?Math.round(e/Dx)+"s":e+"ms"}o(S4s,"fmtShort");function C4s(e){var t=Math.abs(e);return t>=gC?rte(e,t,gC,"day"):t>=Lx?rte(e,t,Lx,"hour"):t>=Nx?rte(e,t,Nx,"minute"):t>=Dx?rte(e,t,Dx,"second"):e+" ms"}o(C4s,"fmtLong");function rte(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}o(rte,"plural")});var o4e=h((ojo,Qrr)=>{function E4s(e){r.debug=r,r.default=r,r.coerce=d,r.disable=a,r.enable=s,r.enabled=c,r.humanize=Wrr(),Object.keys(e).forEach(m=>{r[m]=e[m]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(m){let f=0;for(let g=0;g<m.length;g++)f=(f<<5)-f+m.charCodeAt(g),f|=0;return r.colors[Math.abs(f)%r.colors.length]}o(t,"selectColor"),r.selectColor=t;function r(m){let f;function g(...y){if(!g.enabled)return;let w=g,v=Number(new Date),b=v-(f||v);w.diff=b,w.prev=f,w.curr=v,f=v,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let S=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(q,k)=>{if(q==="%%")return q;S++;let j=r.formatters[k];if(typeof j=="function"){let ee=y[S];q=j.call(w,ee),y.splice(S,1),S--}return q}),r.formatArgs.call(w,y),(w.log||r.log).apply(w,y)}return o(g,"debug"),g.namespace=m,g.enabled=r.enabled(m),g.useColors=r.useColors(),g.color=t(m),g.destroy=n,g.extend=i,typeof r.init=="function"&&r.init(g),r.instances.push(g),g}o(r,"createDebug");function n(){let m=r.instances.indexOf(this);return m!==-1?(r.instances.splice(m,1),!0):!1}o(n,"destroy");function i(m,f){let g=r(this.namespace+(typeof f=="undefined"?":":f)+m);return g.log=this.log,g}o(i,"extend");function s(m){r.save(m),r.names=[],r.skips=[];let f,g=(typeof m=="string"?m:"").split(/[\s,]+/),y=g.length;for(f=0;f<y;f++)!g[f]||(m=g[f].replace(/\*/g,".*?"),m[0]==="-"?r.skips.push(new RegExp("^"+m.substr(1)+"$")):r.names.push(new RegExp("^"+m+"$")));for(f=0;f<r.instances.length;f++){let w=r.instances[f];w.enabled=r.enabled(w.namespace)}}o(s,"enable");function a(){let m=[...r.names.map(l),...r.skips.map(l).map(f=>"-"+f)].join(",");return r.enable(""),m}o(a,"disable");function c(m){if(m[m.length-1]==="*")return!0;let f,g;for(f=0,g=r.skips.length;f<g;f++)if(r.skips[f].test(m))return!1;for(f=0,g=r.names.length;f<g;f++)if(r.names[f].test(m))return!0;return!1}o(c,"enabled");function l(m){return m.toString().substring(2,m.toString().length-2).replace(/\.\*\?$/,"*")}o(l,"toNamespace");function d(m){return m instanceof Error?m.stack||m.message:m}return o(d,"coerce"),r.enable(r.load()),r}o(E4s,"setup");Qrr.exports=E4s});var Yrr=h((zf,nte)=>{zf.log=x4s;zf.formatArgs=P4s;zf.save=R4s;zf.load=k4s;zf.useColors=A4s;zf.storage=T4s();zf.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function A4s(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}o(A4s,"useColors");function P4s(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+nte.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}o(P4s,"formatArgs");function x4s(...e){return typeof console=="object"&&console.log&&console.log(...e)}o(x4s,"log");function R4s(e){try{e?zf.storage.setItem("debug",e):zf.storage.removeItem("debug")}catch(t){}}o(R4s,"save");function k4s(){let e;try{e=zf.storage.getItem("debug")}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}o(k4s,"load");function T4s(){try{return localStorage}catch(e){}}o(T4s,"localstorage");nte.exports=o4e()(zf);var{formatters:I4s}=nte.exports;I4s.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Jrr=h((od,ite)=>{var q4s=require("tty"),c4e=require("util");od.init=F4s;od.log=M4s;od.formatArgs=N4s;od.save=z4s;od.load=O4s;od.useColors=D4s;od.colors=[6,2,3,4,5,1];try{let e=ax();e&&(e.stderr||e).level>=2&&(od.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}od.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function D4s(){return"colors"in od.inspectOpts?Boolean(od.inspectOpts.colors):q4s.isatty(process.stderr.fd)}o(D4s,"useColors");function N4s(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} `;e[0]=s+e[0].split(`
81
+ `),this._state.incoming.expectedPacket="KEXINIT"}o(Un,"SSH2Stream");s$s(Un,xee);Un.prototype.__read=xee.prototype._read;Un.prototype._read=function(e){return this._needContinue&&(this._needContinue=!1,this.emit("continue")),this.__read(e)};Un.prototype.__push=xee.prototype.push;Un.prototype.push=function(e,t){var r=this.__push(e,t);return this._needContinue=r===!1,r};Un.prototype._cleanup=function(e){this.reset(),this.debug("DEBUG: Parser: Malformed packet"),e&&e(new Error("Malformed packet"))};Un.prototype._transform=function(e,t,r,n){var i=!1,s=!1,a=this._state,c=a.incoming,l=a.outgoing,d=c.expect,m=c.decrypt,f=c.decompress,g=e.length,y=0,w=this.debug,v=this,b=0,S=b,P,q,k,j;for(this.bytesReceived+=g;;){if(d.type!==void 0){if(b>=g)break;if(d.type===Ax){y=g-b;var ee=d.buf.length-d.ptr;ee<=y?(e.copy(d.buf,d.ptr,b,b+ee),b+=ee,q=d.buf,d.buf=void 0,d.ptr=0,d.type=void 0):(e.copy(d.buf,d.ptr,b),d.ptr+=y,b+=y);continue}else if(d.type===Uer){if(b+=c.search.push(e),d.type!==void 0)continue}else if(d.type===$er){if(++d.ptr+4>255)return this.reset(),w("DEBUG: Parser: Identification string exceeded 255 characters"),r(new Error("Max identification string size exceeded"));if(e[b]===10)d.type=void 0,S<b&&(d.buf===void 0?d.buf=e.toString("ascii",S,b):d.buf+=e.toString("ascii",S,b)),q=d.buf,d.buf=void 0,++b;else{++b===g&&S<b&&(d.buf===void 0?d.buf=e.toString("ascii",S,b):d.buf+=e.toString("ascii",S,b));continue}}}if(c.status===Ex){if(!this.readable)return r();if(this.server)if(!q)w("DEBUG: Parser: IN_INIT (waiting for identification begin)"),cC(this,Ax,4);else if(q[0]===83&&q[1]===83&&q[2]===72&&q[3]===45)c.status=f6e,w("DEBUG: Parser: IN_INIT (waiting for rest of identification)");else return this.reset(),w("DEBUG: Parser: Bad identification start"),r(new Error("Bad identification start"));else{w("DEBUG: Parser: IN_INIT");var K=c.search=new a$s(w$s);K.on("info",o(function $e(kr,O,Y,he){O&&(c.greeting===void 0?c.greeting=O.toString("binary",Y,he):c.greeting+=O.toString("binary",Y,he)),kr&&(d.type=void 0,c.search.removeListener("info",$e))},"onInfo")),K.maxMatches=1,cC(this,Uer),c.status=f6e}}else if(c.status===f6e)w("DEBUG: Parser: IN_GREETING"),c.search=void 0,S=b,cC(this,$er),c.status=jer;else if(c.status===jer){w("DEBUG: Parser: IN_HEADER"),q.charCodeAt(q.length-1)===13&&(q=q.slice(0,-1));var V=q.indexOf("-"),oe=q.indexOf(" "),de={greeting:c.greeting,identRaw:"SSH-"+q,versions:{protocol:q.substr(0,V),software:oe===-1?q.substring(V+1):q.substring(V+1,oe)},comments:oe>-1?q.substring(oe+1):void 0};if(c.greeting=void 0,de.versions.protocol!=="1.99"&&de.versions.protocol!=="2.0")return this.reset(),w("DEBUG: Parser: protocol version not supported: "+de.versions.protocol),r(new Error("Protocol version not supported"));if(this.emit("header",de),c.status===Ex)return;var N=de.identRaw,se=de.versions.software;this.debug("DEBUG: Remote ident: "+Der(N));for(var ne=0,xe;ne<f$s;++ne)xe=Fer[ne],typeof xe[0]=="string"?se===xe[0]&&(this.remoteBugs|=xe[1]):xe[0].test(se)&&(this.remoteBugs|=xe[1]);c.identRaw=N,this.bytesReceived-=g-b,C6e(this,function(){b===g?r():v._transform(e.slice(b),t,r)}),c.status=kee;return}else if(c.status===kee)P=m.instance?m.info.blockLen:8,w("DEBUG: Parser: IN_PACKETBEFORE (expecting "+P+")"),cC(this,Ax,P,m.buf),c.status=p6e;else if(c.status===p6e){if(w("DEBUG: Parser: IN_PACKET"),m.instance?(s=m.info.authLen>0,s||(q=Wer(this,q)),P=m.info.blockLen):(s=!1,P=8),j=ws(q,0,this,r),j===!1)return;var U=c.hmac.info,te;U?te=U.actualLen:te=0;var He=j+4+te,Qe=this.maxPacketSize;if(f.instance&&(Qe+=(this.maxPacketSize/16384+1)*5+6),j>Qe||He<16+te||(j+(s?0:4))%P!=0)return this.disconnect(za.PROTOCOL_ERROR),w("DEBUG: Parser: Bad packet length ("+He+")"),r(new Error("Bad packet length"));c.pktLen=j;var it=c.pktLen+4-P;if(s?(m.instance.setAAD(q.slice(0,4)),w("DEBUG: Parser: pktLen:"+c.pktLen+",remainLen:"+it)):(c.padLen=q[4],w("DEBUG: Parser: pktLen:"+c.pktLen+",padLen:"+c.padLen+",remainLen:"+it)),it>0)s?c.pktExtra=q.slice(4):c.pktExtra=q.slice(5),cC(this,Ax,it),c.status=g6e;else if(it<0)c.status=kee;else{i=!0,c.status=g6e;continue}}else if(c.status===g6e){w("DEBUG: Parser: IN_PACKETDATA"),m.instance?(s=m.info.authLen>0,i?i=!1:s||(q=Wer(this,q))):(s=!1,i=!1);var qt=c.pktLen-c.padLen-1;if(c.pktExtra?(k=Buffer.allocUnsafe(c.pktExtra.length+q.length),c.pktExtra.copy(k),q.copy(k,c.pktExtra.length),c.payload=k.slice(0,qt)):(s?k=q.slice(4):k=q.slice(5),c.payload=q.slice(5,5+qt)),c.hmac.info!==void 0){var Dt=m.info.authLen||c.hmac.info.actualLen;w("DEBUG: Parser: HMAC size:"+Dt),cC(this,Ax,Dt,c.hmac.buf),c.status=Ber,c.packet=k}else c.status=h6e;c.pktExtra=void 0,k=void 0}else if(c.status===Ber)if(w("DEBUG: Parser: IN_PACKETDATAVERIFY"),D$s(this,q))w("DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)"),c.status=h6e,c.packet=void 0;else return this.reset(),w("DEBUG: Parser: IN_PACKETDATAVERIFY (Invalid HMAC)"),r(new Error("Invalid HMAC"));else if(c.status===h6e){if(f.instance)if(n)n=!1;else{w("DEBUG: Parser: Decompressing"),f.instance.write(c.payload);var tr=[],lt=0;f.instance.on("readable",function(){for(var $e;$e=this.read();)tr.push($e),lt+=$e.length}).flush(v6e,function(){f.instance.removeAllListeners("readable"),tr.length===1?c.payload=tr[0]:c.payload=Buffer.concat(tr,lt),tr=null;var $e;b===g?$e=_6e:$e=e.slice(b),v._transform($e,t,r,!0)});return}this.emit("packet");var pt=c.payload[0];if(w!==Ger){var mr="DEBUG: Parser: IN_PACKETDATAAFTER, packet: ",gt=a.authsQueue[0],ar=null;if(l.status===t0&&!(pt<=4||pt>=20&&pt<=49)&&(mr+="(enqueued) "),pt===sr.KEXDH_INIT)switch(a.kex.type){case"group":ar="KEXDH_INIT";break;case"groupex":ar="KEXDH_GEX_REQUEST";break;default:ar="KEXECDH_INIT"}else if(pt===sr.KEXDH_REPLY)switch(a.kex.type){case"group":ar="KEXDH_REPLY";break;case"groupex":ar="KEXDH_GEX_GROUP";break;default:ar="KEXECDH_REPLY"}else pt===sr.KEXDH_GEX_GROUP?ar="KEXDH_GEX_GROUP":pt===sr.KEXDH_GEX_REPLY?ar="KEXDH_GEX_REPLY":pt===60?gt==="password"?ar="USERAUTH_PASSWD_CHANGEREQ":gt==="keyboard-interactive"?ar="USERAUTH_INFO_REQUEST":gt==="publickey"?ar="USERAUTH_PK_OK":ar="UNKNOWN PACKET 60":pt===61&&(gt==="keyboard-interactive"?ar="USERAUTH_INFO_RESPONSE":ar="UNKNOWN PACKET 61");ar===null&&(ar=sr[pt]),pt!==sr.CHANNEL_OPEN&&pt!==sr.CHANNEL_REQUEST&&pt!==sr.CHANNEL_SUCCESS&&pt!==sr.CHANNEL_FAILURE&&pt!==sr.CHANNEL_EOF&&pt!==sr.CHANNEL_CLOSE&&pt!==sr.CHANNEL_DATA&&pt!==sr.CHANNEL_EXTENDED_DATA&&pt!==sr.CHANNEL_WINDOW_ADJUST&&pt!==sr.DISCONNECT&&pt!==sr.USERAUTH_REQUEST&&pt!==sr.GLOBAL_REQUEST&&w(mr+ar)}if(l.status===e0||pt<=4||pt>=20&&pt<=49){if(Xer(this,r)===!1||c.status===Ex)return}else if(l.status===t0){if(c.rekeyQueue.length===h$s)return w("DEBUG: Parser: Max incoming re-key queue length reached"),this.disconnect(za.PROTOCOL_ERROR),r(new Error("Incoming re-key queue length limit reached"));var Lr=c.seqno;++c.seqno>w6e&&(c.seqno=0),c.rekeyQueue.push([Lr,c.payload])}c.status=kee,c.payload=void 0}q!==void 0&&(q=void 0)}r()};Un.prototype.reset=function(e){if(this._state){var t=this._state;t.incoming.status=Ex,t.outgoing.status=y6e}else this._state={authsQueue:[],hostkeyFormat:void 0,kex:void 0,incoming:{status:Ex,expectedPacket:void 0,search:void 0,greeting:void 0,seqno:0,pktLen:void 0,padLen:void 0,pktExtra:void 0,payload:void 0,packet:void 0,kexinit:void 0,identRaw:void 0,rekeyQueue:[],ignoreNext:!1,expect:{amount:void 0,type:void 0,ptr:0,buf:void 0},decrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,buf:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},decompress:{instance:!1,type:!1}},outgoing:{status:y6e,seqno:0,bufSeqno:Buffer.allocUnsafe(4),rekeyQueue:[],kexinit:void 0,kexsecret:void 0,pubkey:void 0,exchangeHash:void 0,sessionId:void 0,sentNEWKEYS:!1,encrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},compress:{instance:!1,type:!1,queue:null}}};e||this.readable&&this.push(null)};Un.prototype.disconnect=function(e){var t=Buffer.alloc(1+4+4+4);return t[0]=sr.DISCONNECT,za[e]===void 0&&(e=za.BY_APPLICATION),Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing DISCONNECT ("+za[e]+")"),Dn(this,t),this.reset(),!1};Un.prototype.ping=function(){return this.debug("DEBUG: Outgoing: Writing ping (GLOBAL_REQUEST: keepalive@openssh.com)"),Dn(this,v$s)};Un.prototype.rekey=function(){var e=this._state.outgoing.status;if(e===t0)throw new Error("A re-key is already in progress");if(e!==e0)throw new Error("Cannot re-key yet");return this.debug("DEBUG: Outgoing: Starting re-key"),C6e(this)};Un.prototype.requestSuccess=function(e){var t;return Buffer.isBuffer(e)?(t=Buffer.allocUnsafe(1+e.length),t[0]=sr.REQUEST_SUCCESS,e.copy(t,1)):t=b$s,this.debug("DEBUG: Outgoing: Writing REQUEST_SUCCESS"),Dn(this,t)};Un.prototype.requestFailure=function(){return this.debug("DEBUG: Outgoing: Writing REQUEST_FAILURE"),Dn(this,S$s)};Un.prototype.channelSuccess=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_SUCCESS,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_SUCCESS ("+e+")"),Dn(this,t)};Un.prototype.channelFailure=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_FAILURE,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_FAILURE ("+e+")"),Dn(this,t)};Un.prototype.channelEOF=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_EOF,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_EOF ("+e+")"),Dn(this,t)};Un.prototype.channelClose=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=sr.CHANNEL_CLOSE,Ze(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_CLOSE ("+e+")"),Dn(this,t)};Un.prototype.channelWindowAdjust=function(e,t){var r=Buffer.allocUnsafe(1+4+4);return r[0]=sr.CHANNEL_WINDOW_ADJUST,Ze(r,e,1),Ze(r,t,5),this.debug("DEBUG: Outgoing: Writing CHANNEL_WINDOW_ADJUST ("+e+", "+t+")"),Dn(this,r)};Un.prototype.channelData=function(e,t){var r=Buffer.isBuffer(t),n=r?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+n);return i[0]=sr.CHANNEL_DATA,Ze(i,e,1),Ze(i,n,5),r?t.copy(i,9):i.write(t,9,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_DATA ("+e+")"),Dn(this,i)};Un.prototype.channelExtData=function(e,t,r){var n=Buffer.isBuffer(t),i=n?t.length:Buffer.byteLength(t),s=Buffer.allocUnsafe(1+4+4+4+i);return s[0]=sr.CHANNEL_EXTENDED_DATA,Ze(s,e,1),Ze(s,r,5),Ze(s,i,9),n?t.copy(s,13):s.write(t,13,i,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_EXTENDED_DATA ("+e+")"),Dn(this,s)};Un.prototype.channelOpenConfirm=function(e,t,r,n){var i=Buffer.allocUnsafe(1+4+4+4+4);return i[0]=sr.CHANNEL_OPEN_CONFIRMATION,Ze(i,e,1),Ze(i,t,5),Ze(i,r,9),Ze(i,n,13),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_CONFIRMATION (r:"+e+", l:"+t+")"),Dn(this,i)};Un.prototype.channelOpenFail=function(e,t,r,n){typeof r!="string"&&(r=""),typeof n!="string"&&(n="");var i=Buffer.byteLength(r),s=Buffer.byteLength(n),a=9,c=Buffer.allocUnsafe(1+4+4+4+i+4+s);return c[0]=sr.CHANNEL_OPEN_FAILURE,Ze(c,e,1),Ze(c,t,5),Ze(c,i,a),a+=4,i&&(c.write(r,a,i,"utf8"),a+=i),Ze(c,s,a),s&&c.write(n,a+=4,s,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_FAILURE ("+e+")"),Dn(this,c)};Un.prototype.service=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=Buffer.allocUnsafe(1+4+t);return r[0]=sr.SERVICE_REQUEST,Ze(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_REQUEST ("+e+")"),Dn(this,r)};Un.prototype.tcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+13+1+4+n+4);return i[0]=sr.GLOBAL_REQUEST,Ze(i,13,1),i.write("tcpip-forward",5,13,"ascii"),i[18]=r===void 0||r===!0?1:0,Ze(i,n,19),i.write(e,23,n,"ascii"),Ze(i,t,23+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (tcpip-forward)"),Dn(this,i)};Un.prototype.cancelTcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+20+1+4+n+4);return i[0]=sr.GLOBAL_REQUEST,Ze(i,20,1),i.write("cancel-tcpip-forward",5,20,"ascii"),i[25]=r===void 0||r===!0?1:0,Ze(i,n,26),i.write(e,30,n,"ascii"),Ze(i,t,30+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-tcpip-forward)"),Dn(this,i)};Un.prototype.openssh_streamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+31+1+4+r);return n[0]=sr.GLOBAL_REQUEST,Ze(n,31,1),n.write("streamlocal-forward@openssh.com",5,31,"ascii"),n[36]=t===void 0||t===!0?1:0,Ze(n,r,37),n.write(e,41,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),Dn(this,n)};Un.prototype.openssh_cancelStreamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+38+1+4+r);return n[0]=sr.GLOBAL_REQUEST,Ze(n,38,1),n.write("cancel-streamlocal-forward@openssh.com",5,38,"ascii"),n[43]=t===void 0||t===!0?1:0,Ze(n,r,44),n.write(e,48,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),Dn(this,n)};Un.prototype.directTcpip=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.srcIP),s=Buffer.byteLength(n.dstIP),a=29,c=Buffer.allocUnsafe(1+4+12+4+4+4+4+i+4+4+s+4);return c[0]=sr.CHANNEL_OPEN,Ze(c,12,1),c.write("direct-tcpip",5,12,"ascii"),Ze(c,e,17),Ze(c,t,21),Ze(c,r,25),Ze(c,s,a),c.write(n.dstIP,a+=4,s,"ascii"),Ze(c,n.dstPort,a+=s),Ze(c,i,a+=4),c.write(n.srcIP,a+=4,i,"ascii"),Ze(c,n.srcPort,a+=i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-tcpip)"),Dn(this,c)};Un.prototype.openssh_directStreamLocal=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.socketPath),s=47,a=Buffer.allocUnsafe(1+4+30+4+4+4+4+i+4+4);return a[0]=sr.CHANNEL_OPEN,Ze(a,30,1),a.write("direct-streamlocal@openssh.com",5,30,"ascii"),Ze(a,e,35),Ze(a,t,39),Ze(a,r,43),Ze(a,i,s),a.write(n.socketPath,s+=4,i,"utf8"),a.fill(0,a.length-8),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-streamlocal@openssh.com)"),Dn(this,a)};Un.prototype.openssh_noMoreSessions=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.allocUnsafe(1+4+28+1);return t[0]=sr.GLOBAL_REQUEST,Ze(t,28,1),t.write("no-more-sessions@openssh.com",5,28,"ascii"),t[33]=e===void 0||e===!0?1:0,this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (no-more-sessions@openssh.com)"),Dn(this,t)};Un.prototype.session=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.allocUnsafe(1+4+7+4+4+4);return n[0]=sr.CHANNEL_OPEN,Ze(n,7,1),n.write("session",5,7,"ascii"),Ze(n,e,12),Ze(n,t,16),Ze(n,r,20),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", session)"),Dn(this,n)};Un.prototype.windowChange=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=Buffer.allocUnsafe(1+4+4+13+1+4+4+4+4);return s[0]=sr.CHANNEL_REQUEST,Ze(s,e,1),Ze(s,13,5),s.write("window-change",9,13,"ascii"),s[22]=0,Ze(s,r,23),Ze(s,t,27),Ze(s,i,31),Ze(s,n,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", window-change)"),Dn(this,s)};Un.prototype.pty=function(e,t,r,n,i,s,a,c){if(this.server)throw new Error("Client-only method called in server mode");(!s||!s.length)&&(s="vt100"),a&&!Buffer.isBuffer(a)&&!Array.isArray(a)&&typeof a=="object"&&(a=L$s(a)),(!a||!a.length)&&(a=C$s);var l=s.length,d=a.length,m=21,f=Buffer.allocUnsafe(1+4+4+7+1+4+l+4+4+4+4+4+d);if(f[0]=sr.CHANNEL_REQUEST,Ze(f,e,1),Ze(f,7,5),f.write("pty-req",9,7,"ascii"),f[16]=c===void 0||c===!0?1:0,Ze(f,l,17),f.write(s,21,l,"utf8"),Ze(f,r,m+=l),Ze(f,t,m+=4),Ze(f,i,m+=4),Ze(f,n,m+=4),Ze(f,d,m+=4),m+=4,Array.isArray(a))for(var g=0;g<d;++g)f[m++]=a[g];else Buffer.isBuffer(a)&&a.copy(f,m);return this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", pty-req)"),Dn(this,f)};Un.prototype.shell=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+5+1);return r[0]=sr.CHANNEL_REQUEST,Ze(r,e,1),Ze(r,5,5),r.write("shell",9,5,"ascii"),r[14]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", shell)"),Dn(this,r)};Un.prototype.exec=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.isBuffer(t)?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+4+1+4+n);return i[0]=sr.CHANNEL_REQUEST,Ze(i,e,1),Ze(i,4,5),i.write("exec",9,4,"ascii"),i[13]=r===void 0||r===!0?1:0,Ze(i,n,14),Buffer.isBuffer(t)?t.copy(i,18):i.write(t,18,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exec)"),Dn(this,i)};Un.prototype.signal=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");if(t=t.toUpperCase(),t.slice(0,3)==="SIG"&&(t=t.substring(3)),u$s.indexOf(t)===-1)throw new Error("Invalid signal: "+t);var r=t.length,n=Buffer.allocUnsafe(1+4+4+6+1+4+r);return n[0]=sr.CHANNEL_REQUEST,Ze(n,e,1),Ze(n,6,5),n.write("signal",9,6,"ascii"),n[15]=0,Ze(n,r,16),n.write(t,20,r,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", signal)"),Dn(this,n)};Un.prototype.env=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(t),s=Buffer.isBuffer(r)?r.length:Buffer.byteLength(r),a=Buffer.allocUnsafe(1+4+4+3+1+4+i+4+s);return a[0]=sr.CHANNEL_REQUEST,Ze(a,e,1),Ze(a,3,5),a.write("env",9,3,"ascii"),a[12]=n===void 0||n===!0?1:0,Ze(a,i,13),a.write(t,17,i,"ascii"),Ze(a,s,17+i),Buffer.isBuffer(r)?r.copy(a,17+i+4):a.write(r,17+i+4,s,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", env)"),Dn(this,a)};Un.prototype.x11Forward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t.protocol),i=Buffer.byteLength(t.cookie),s=Buffer.allocUnsafe(1+4+4+7+1+1+4+n+4+i+4);s[0]=sr.CHANNEL_REQUEST,Ze(s,e,1),Ze(s,7,5),s.write("x11-req",9,7,"ascii"),s[16]=r===void 0||r===!0?1:0,s[17]=t.single?1:0,Ze(s,n,18);var a=22;return Buffer.isBuffer(t.protocol)?t.protocol.copy(s,a):s.write(t.protocol,a,n,"utf8"),a+=n,Ze(s,i,a),a+=4,Buffer.isBuffer(t.cookie)?t.cookie.copy(s,a):s.write(t.cookie,a,i,"binary"),a+=i,Ze(s,t.screen||0,a),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", x11-req)"),Dn(this,s)};Un.prototype.subsystem=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+9+1+4+n);return i[0]=sr.CHANNEL_REQUEST,Ze(i,e,1),Ze(i,9,5),i.write("subsystem",9,9,"ascii"),i[18]=r===void 0||r===!0?1:0,Ze(i,n,19),i.write(t,23,n,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", subsystem: "+t+")"),Dn(this,i)};Un.prototype.openssh_agentForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+26+1);return r[0]=sr.CHANNEL_REQUEST,Ze(r,e,1),Ze(r,26,5),r.write("auth-agent-req@openssh.com",9,26,"ascii"),r[35]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", auth-agent-req@openssh.com)"),Dn(this,r)};Un.prototype.authPassword=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.byteLength(t),i=0,s=Buffer.allocUnsafe(1+4+r+4+14+4+8+1+4+n);return s[i]=sr.USERAUTH_REQUEST,Ze(s,r,++i),s.write(e,i+=4,r,"utf8"),Ze(s,14,i+=r),s.write("ssh-connection",i+=4,14,"ascii"),Ze(s,8,i+=14),s.write("password",i+=4,8,"ascii"),s[i+=8]=0,Ze(s,n,++i),s.write(t,i+=4,n,"utf8"),this._state.authsQueue.push("password"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)"),Dn(this,s)};Un.prototype.authPK=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=this,i=this._state.outgoing,s;typeof t.getPublicSSH=="function"?(s=t.type,t=t.getPublicSSH()):s=t.toString("ascii",4,4+m6e(t,0));var a=Buffer.byteLength(e),c=Buffer.byteLength(s),l=t.length,d=i.sessionId.length,m=0,f=Buffer.allocUnsafe((r?4+d:0)+1+4+a+4+14+4+9+1+4+c+4+l);return r?(Ze(f,d,m),i.sessionId.copy(f,m+=4),f[m+=d]=sr.USERAUTH_REQUEST):f[m]=sr.USERAUTH_REQUEST,Ze(f,a,++m),f.write(e,m+=4,a,"utf8"),Ze(f,14,m+=a),f.write("ssh-connection",m+=4,14,"ascii"),Ze(f,9,m+=14),f.write("publickey",m+=4,9,"ascii"),f[m+=9]=r?1:0,Ze(f,c,++m),f.write(s,m+=4,c,"ascii"),Ze(f,l,m+=c),t.copy(f,m+=4),r?(r(f,function(g){if(g=E6e(g,s),g===!1)throw new Error("Error while converting handshake signature");var y=g.length,w=Buffer.allocUnsafe(1+4+a+4+14+4+9+1+4+c+4+l+4+4+c+4+y);return m=0,w[m]=sr.USERAUTH_REQUEST,Ze(w,a,++m),w.write(e,m+=4,a,"utf8"),Ze(w,14,m+=a),w.write("ssh-connection",m+=4,14,"ascii"),Ze(w,9,m+=14),w.write("publickey",m+=4,9,"ascii"),w[m+=9]=1,Ze(w,c,++m),w.write(s,m+=4,c,"ascii"),Ze(w,l,m+=c),t.copy(w,m+=4),Ze(w,4+c+4+y,m+=l),Ze(w,c,m+=4),w.write(s,m+=4,c,"ascii"),Ze(w,y,m+=c),g.copy(w,m+=4),n._state.authsQueue.push("publickey"),n.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey)"),Dn(n,w)}),!0):(this._state.authsQueue.push("publickey"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)"),Dn(this,f))};Un.prototype.authHostbased=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=this,a=this._state.outgoing,c;typeof t.getPublicSSH=="function"?(c=t.type,t=t.getPublicSSH()):c=t.toString("ascii",4,4+m6e(t,0));var l=Buffer.byteLength(e),d=Buffer.byteLength(c),m=t.length,f=a.sessionId.length,g=Buffer.byteLength(r),y=Buffer.byteLength(n),w=0,v=Buffer.allocUnsafe(4+f+1+4+l+4+14+4+9+4+d+4+m+4+g+4+y);return Ze(v,f,w),a.sessionId.copy(v,w+=4),v[w+=f]=sr.USERAUTH_REQUEST,Ze(v,l,++w),v.write(e,w+=4,l,"utf8"),Ze(v,14,w+=l),v.write("ssh-connection",w+=4,14,"ascii"),Ze(v,9,w+=14),v.write("hostbased",w+=4,9,"ascii"),Ze(v,d,w+=9),v.write(c,w+=4,d,"ascii"),Ze(v,m,w+=d),t.copy(v,w+=4),Ze(v,g,w+=m),v.write(r,w+=4,g,"ascii"),Ze(v,y,w+=g),v.write(n,w+=4,y,"utf8"),i(v,function(b){if(b=E6e(b,c),b===!1)throw new Error("Error while converting handshake signature");var S=b.length,P=Buffer.allocUnsafe(v.length-f+S);return v.copy(P,0,4+f),Ze(P,S,P.length-S-4),b.copy(P,P.length-S),s._state.authsQueue.push("hostbased"),s.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (hostbased)"),Dn(s,P)}),!0};Un.prototype.authKeyboard=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+20+4+4);return n[r]=sr.USERAUTH_REQUEST,Ze(n,t,++r),n.write(e,r+=4,t,"utf8"),Ze(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),Ze(n,20,r+=14),n.write("keyboard-interactive",r+=4,20,"ascii"),Ze(n,0,r+=20),Ze(n,0,r+=4),this._state.authsQueue.push("keyboard-interactive"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)"),Dn(this,n)};Un.prototype.authNone=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+4);return n[r]=sr.USERAUTH_REQUEST,Ze(n,t,++r),n.write(e,r+=4,t,"utf8"),Ze(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),Ze(n,4,r+=14),n.write("none",r+=4,4,"ascii"),this._state.authsQueue.push("none"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)"),Dn(this,n)};Un.prototype.authInfoRes=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=0,r=0,n,i,s;if(e)for(s=0,i=e.length;s<i;++s)t+=4+Buffer.byteLength(e[s]);var a=Buffer.allocUnsafe(1+4+t);if(a[r++]=sr.USERAUTH_INFO_RESPONSE,Ze(a,e?e.length:0,r),e)for(r+=4,s=0,i=e.length;s<i;++s)n=Buffer.byteLength(e[s]),Ze(a,n,r),r+=4,n&&(a.write(e[s],r,n,"utf8"),r+=n);return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_RESPONSE"),Dn(this,a)};Un.prototype.serviceAccept=function(e){if(!this.server)throw new Error("Server-only method called in client mode");var t=e.length,r=Buffer.allocUnsafe(1+4+t);if(r[0]=sr.SERVICE_ACCEPT,Ze(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_ACCEPT ("+e+")"),Dn(this,r),this.server&&this.banner&&e==="ssh-userauth"){var n=Buffer.byteLength(this.banner),i=1+4+n+4,s=Buffer.allocUnsafe(i);s[0]=sr.USERAUTH_BANNER,Ze(s,n,1),s.write(this.banner,5,n,"utf8"),s.fill(0,i-4),this.debug("DEBUG: Outgoing: Writing USERAUTH_BANNER"),Dn(this,s),this.banner=void 0}};Un.prototype.forwardedTcpip=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.boundAddr),s=Buffer.byteLength(n.remoteAddr),a=36+i,c=Buffer.allocUnsafe(1+4+15+4+4+4+4+i+4+4+s+4);return c[0]=sr.CHANNEL_OPEN,Ze(c,15,1),c.write("forwarded-tcpip",5,15,"ascii"),Ze(c,e,20),Ze(c,t,24),Ze(c,r,28),Ze(c,i,32),c.write(n.boundAddr,36,i,"ascii"),Ze(c,n.boundPort,a),Ze(c,s,a+=4),c.write(n.remoteAddr,a+=4,s,"ascii"),Ze(c,n.remotePort,a+=s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-tcpip)"),Dn(this,c)};Un.prototype.x11=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.originAddr),s=24+i,a=Buffer.allocUnsafe(1+4+3+4+4+4+4+i+4);return a[0]=sr.CHANNEL_OPEN,Ze(a,3,1),a.write("x11",5,3,"ascii"),Ze(a,e,8),Ze(a,t,12),Ze(a,r,16),Ze(a,i,20),a.write(n.originAddr,24,i,"ascii"),Ze(a,n.originPort,s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", x11)"),Dn(this,a)};Un.prototype.openssh_authAgent=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=Buffer.allocUnsafe(1+4+22+4+4+4);return n[0]=sr.CHANNEL_OPEN,Ze(n,22,1),n.write("auth-agent@openssh.com",5,22,"ascii"),Ze(n,e,27),Ze(n,t,31),Ze(n,r,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", auth-agent@openssh.com)"),Dn(this,n)};Un.prototype.openssh_forwardedStreamLocal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.socketPath),s=Buffer.allocUnsafe(1+4+33+4+4+4+4+i+4);return s[0]=sr.CHANNEL_OPEN,Ze(s,33,1),s.write("forwarded-streamlocal@openssh.com",5,33,"ascii"),Ze(s,e,38),Ze(s,t,42),Ze(s,r,46),Ze(s,i,50),s.write(n.socketPath,54,i,"utf8"),Ze(s,0,54+i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-streamlocal@openssh.com)"),Dn(this,s)};Un.prototype.exitStatus=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.allocUnsafe(1+4+4+11+1+4);return r[0]=sr.CHANNEL_REQUEST,Ze(r,e,1),Ze(r,11,5),r.write("exit-status",9,11,"ascii"),r[20]=0,Ze(r,t,21),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-status)"),Dn(this,r)};Un.prototype.exitSignal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(t),s=n?Buffer.byteLength(n):0,a=25+i,c=Buffer.allocUnsafe(1+4+4+11+1+4+i+1+4+s+4);return c[0]=sr.CHANNEL_REQUEST,Ze(c,e,1),Ze(c,11,5),c.write("exit-signal",9,11,"ascii"),c[20]=0,Ze(c,i,21),c.write(t,25,i,"utf8"),c[a++]=r?1:0,Ze(c,s,a),a+=4,s&&(c.write(n,a,s,"utf8"),a+=s),Ze(c,0,a),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-signal)"),Dn(this,c)};Un.prototype.authFailure=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length)throw new Error("No auth in progress");var n;if(typeof e=="boolean"&&(t=e,e=void 0),e){n=[];for(var i=0,s=e.length;i<s;++i)e[i].toLowerCase()!=="none"&&n.push(e[i]);n=n.join(",")}else n="";var a=n.length,c=Buffer.allocUnsafe(1+4+a+1);return c[0]=sr.USERAUTH_FAILURE,Ze(c,a,1),c.write(n,5,a,"ascii"),c[5+a]=t===!0?1:0,this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_FAILURE"),Dn(this,c)};Un.prototype.authSuccess=function(){if(!this.server)throw new Error("Server-only method called in client mode");var e=this._state.authsQueue;if(!e.length)throw new Error("No auth in progress");var t=this._state,r=t.outgoing,n=t.incoming;t.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_SUCCESS");var i=Dn(this,_$s);return r.compress.type==="zlib@openssh.com"&&(r.compress.instance=oC.createDeflate(Px),r.compress.queue=[]),n.decompress.type==="zlib@openssh.com"&&(n.decompress.instance=oC.createInflate(Px)),i};Un.prototype.authPKOK=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length||r[0]!=="publickey")throw new Error('"publickey" auth not in progress');var n=e.length,i=t.length,s=Buffer.allocUnsafe(1+4+n+4+i);return s[0]=sr.USERAUTH_PK_OK,Ze(s,n,1),s.write(e,5,n,"ascii"),Ze(s,i,5+n),t.copy(s,5+n+4),this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_PK_OK"),Dn(this,s)};Un.prototype.authPasswdChg=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.byteLength(e),n=t?t.length:0,i=0,s=Buffer.allocUnsafe(1+4+r+4+n);return s[i]=sr.USERAUTH_PASSWD_CHANGEREQ,Ze(s,r,++i),s.write(e,i+=4,r,"utf8"),Ze(s,n,i+=r),n&&s.write(t,i+=4,n,"ascii"),this.debug("DEBUG: Outgoing: Writing USERAUTH_PASSWD_CHANGEREQ"),Dn(this,s)};Un.prototype.authInfoReq=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=0,i=e?Buffer.byteLength(e):0,s=t?Buffer.byteLength(t):0,a=0,c,l,d,m;for(m=0,d=r.length;m<d;++m)n+=4+Buffer.byteLength(r[m].prompt)+1;var f=Buffer.allocUnsafe(1+4+i+4+s+4+4+n);for(f[a++]=sr.USERAUTH_INFO_REQUEST,Ze(f,i,a),a+=4,e&&(f.write(e,a,i,"utf8"),a+=i),Ze(f,s,a),a+=4,t&&(f.write(t,a,s,"utf8"),a+=s),Ze(f,0,a),a+=4,Ze(f,r.length,a),a+=4,m=0,d=r.length;m<d;++m)l=r[m],c=Buffer.byteLength(l.prompt),Ze(f,c,a),a+=4,c&&(f.write(l.prompt,a,c,"utf8"),a+=c),f[a++]=l.echo?1:0;return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_REQUEST"),Dn(this,f)};function E$s(e,t,r,n,i){if(r!==za.BY_APPLICATION){var s=new Error(n||t);s.code=r,e.emit("error",s)}e.reset()}o(E$s,"onDISCONNECT");function A$s(e,t,r){var n=e._state,i=n.outgoing;i.status===e0?(e.debug("DEBUG: Received re-key request"),i.status=t0,i.kexinit=void 0,C6e(e,s)):s();function s(){P$s(e,t,r)===!0&&(e.server?n.incoming.expectedPacket=n.kex.pktInit:n.kex.type==="groupex"?z$s(e):Qer(e))}o(s,"check")}o(A$s,"onKEXINIT");function P$s(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,a=e.debug,c,l,d,m,f;a("DEBUG: Comparing KEXINITs ...");var g=e.config.algorithms,y=g.kex;if(e.remoteBugs&Ree.BAD_DHGEX)for(var w=!1,v=y.length-1;v>=0;--v)y[v].indexOf("group-exchange")!==-1&&(w||(y=y.slice(),w=!0),y.splice(v,1));for(a("DEBUG: (local) KEX algorithms: "+y),a("DEBUG: (remote) KEX algorithms: "+t.algorithms.kex),e.server?(c=y,l=t.algorithms.kex):(c=t.algorithms.kex,l=y),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching key exchange algorithm");var b=new Error("Handshake failed: no matching key exchange algorithm");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}var S=l[f];for(a("DEBUG: KEX algorithm: "+S),r&&(!t.algorithms.kex.length||S!==t.algorithms.kex[0])&&(i.ignoreNext=!0),a("DEBUG: (local) Host key formats: "+g.serverHostKey),a("DEBUG: (remote) Host key formats: "+t.algorithms.srvHostKey),e.server?(c=g.serverHostKey,l=t.algorithms.srvHostKey):(c=t.algorithms.srvHostKey,l=g.serverHostKey),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching host key format");var b=new Error("Handshake failed: no matching host key format");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(n.hostkeyFormat=l[f],a("DEBUG: Host key format: "+n.hostkeyFormat),a("DEBUG: (local) Client->Server ciphers: "+g.cipher),a("DEBUG: (remote) Client->Server ciphers: "+t.algorithms.cs.encrypt),e.server?(c=g.cipher,l=t.algorithms.cs.encrypt):(c=t.algorithms.cs.encrypt,l=g.cipher),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Client->Server cipher");var b=new Error("Handshake failed: no matching client->server cipher");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decrypt.type=l[f]:d=s.encrypt.type=l[f],a("DEBUG: Client->Server Cipher: "+d),a("DEBUG: (local) Server->Client ciphers: "+g.cipher),a("DEBUG: (remote) Server->Client ciphers: "+t.algorithms.sc.encrypt),e.server?(c=g.cipher,l=t.algorithms.sc.encrypt):(c=t.algorithms.sc.encrypt,l=g.cipher),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Server->Client cipher");var b=new Error("Handshake failed: no matching server->client cipher");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.encrypt.type=l[f]:d=i.decrypt.type=l[f],a("DEBUG: Server->Client Cipher: "+d),a("DEBUG: (local) Client->Server HMAC algorithms: "+g.hmac),a("DEBUG: (remote) Client->Server HMAC algorithms: "+t.algorithms.cs.mac),e.server?(c=g.hmac,l=t.algorithms.cs.mac):(c=t.algorithms.cs.mac,l=g.hmac),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Client->Server HMAC algorithm");var b=new Error("Handshake failed: no matching client->server HMAC");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.hmac.type=l[f]:d=s.hmac.type=l[f],a("DEBUG: Client->Server HMAC algorithm: "+d),a("DEBUG: (local) Server->Client HMAC algorithms: "+g.hmac),a("DEBUG: (remote) Server->Client HMAC algorithms: "+t.algorithms.sc.mac),e.server?(c=g.hmac,l=t.algorithms.sc.mac):(c=t.algorithms.sc.mac,l=g.hmac),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Server->Client HMAC algorithm");var b=new Error("Handshake failed: no matching server->client HMAC");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.hmac.type=l[f]:d=i.hmac.type=l[f],a("DEBUG: Server->Client HMAC algorithm: "+d),a("DEBUG: (local) Client->Server compression algorithms: "+g.compress),a("DEBUG: (remote) Client->Server compression algorithms: "+t.algorithms.cs.compress),e.server?(c=g.compress,l=t.algorithms.cs.compress):(c=t.algorithms.cs.compress,l=g.compress),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Client->Server compression algorithm");var b=new Error("Handshake failed: no matching client->server compression algorithm");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decompress.type=l[f]:d=s.compress.type=l[f],a("DEBUG: Client->Server compression algorithm: "+d),a("DEBUG: (local) Server->Client compression algorithms: "+g.compress),a("DEBUG: (remote) Server->Client compression algorithms: "+t.algorithms.sc.compress),e.server?(c=g.compress,l=t.algorithms.sc.compress):(c=t.algorithms.sc.compress,l=g.compress),f=0,m=l.length;f<m&&c.indexOf(l[f])===-1;++f);if(f===m){a("DEBUG: No matching Server->Client compression algorithm");var b=new Error("Handshake failed: no matching server->client compression algorithm");return b.level="handshake",e.emit("error",b),e.disconnect(za.KEY_EXCHANGE_FAILED),!1}return e.server?d=s.compress.type=l[f]:d=i.decompress.type=l[f],a("DEBUG: Server->Client compression algorithm: "+d),n.kex=new lC(S),n.kex.generateKeys(),s.pubkey=n.kex.getPublicKey(),!0}o(P$s,"check_KEXINIT");function x$s(e,t,r){var n=e._state,i=n.outgoing;n.kex.setDHParams(t,r),n.kex.generateKeys(),i.pubkey=n.kex.getPublicKey(),Qer(e)}o(x$s,"onKEXDH_GEX_GROUP");function R$s(e,t){M$s(e,t)}o(R$s,"onKEXDH_INIT");function Her(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,a=e.debug,c,l;if(r===void 0){i.expectedPacket="NEWKEYS",s.sentNEWKEYS=!1,a("DEBUG: Checking host key format");var d=xn(t.hostkey,0,"ascii",e);if(d===!1)return!1;if(t.hostkey_format!==n.hostkeyFormat||t.hostkey_format!==d){a("DEBUG: Host key format mismatch"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host key format mismatch");return m.level="handshake",e.emit("error",m),!1}a("DEBUG: Checking signature format");var f=xn(t.sig,0,"ascii",e);if(f===!1)return!1;if(t.sig_format!==f){a("DEBUG: Signature format mismatch"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature format mismatch");return m.level="handshake",e.emit("error",m),!1}}if(s.status===y6e){if(r===void 0){a("DEBUG: Verifying host fingerprint");var g=!0,y=e.emit("fingerprint",t.hostkey,function(He){r===void 0&&(r=!!He,g||Her(e,t,r))});if(g=!1,y&&r===void 0)return}if(r===void 0)a("DEBUG: Host accepted by default (no verification)");else if(r===!0)a("DEBUG: Host accepted (verified)");else{a("DEBUG: Host denied via fingerprint verification"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host fingerprint verification failed");return m.level="handshake",e.emit("error",m),!1}}if(t.pubkey=n.kex.convertPublicKey(t.pubkey),t.secret=n.kex.computeSecret(t.pubkey),t.secret instanceof Error)return t.secret.message="Error while computing DH secret ("+n.kex.type+"): "+t.secret.message,t.secret.level="handshake",e.emit("error",t.secret),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;var w=Hs.createHash(n.kex.hash),v=Buffer.byteLength(e.config.ident),b=Buffer.byteLength(i.identRaw),S=s.kexinit.length,P=i.kexinit.length,q=t.hostkey.length,k=s.pubkey.length,j=t.pubkey.length,ee=t.secret.length,K=v+b+S+P+q+k+j+ee+4*8,V,oe,de,N,se=n.kex.getDHParams();se&&(de=se.prime,N=se.generator,V=de.length,oe=N.length,K+=4*3,K+=4*2,K+=V,K+=oe);var ne=0,xe=Buffer.allocUnsafe(K);Ze(xe,v,ne),ne+=4,xe.write(e.config.ident,ne,"utf8"),ne+=v,Ze(xe,b,ne),ne+=4,xe.write(i.identRaw,ne,"utf8"),ne+=b,Ze(xe,S,ne),ne+=4,s.kexinit.copy(xe,ne),ne+=S,s.kexinit=void 0,Ze(xe,P,ne),ne+=4,i.kexinit.copy(xe,ne),ne+=P,i.kexinit=void 0,Ze(xe,q,ne),ne+=4,t.hostkey.copy(xe,ne),ne+=q,se&&(S6e.slice(1).copy(xe,ne),ne+=4*3,Ze(xe,V,ne),ne+=4,de.copy(xe,ne),ne+=V,Ze(xe,oe,ne),ne+=4,N.copy(xe,ne),ne+=oe),Ze(xe,k,ne),ne+=4,s.pubkey.copy(xe,ne),ne+=k,Ze(xe,j,ne),ne+=4,t.pubkey.copy(xe,ne),ne+=j,Ze(xe,ee,ne),ne+=4,t.secret.copy(xe,ne),s.exchangeHash=w.update(xe).digest();var U=xn(t.sig,t.sig._pos,e);if(U===!1||!(U=Mer(U,t.sig_format,e)))return!1;var te=l$s(t.hostkey,t.sig_format);if(te instanceof Error)return!1;if(a("DEBUG: Verifying signature"),te.verify(s.exchangeHash,U)!==!0){a("DEBUG: Signature verification failed"),e.disconnect(za.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature verification failed");return m.level="handshake",e.emit("error",m),!1}s.sessionId===void 0&&(s.sessionId=s.exchangeHash),s.kexsecret=t.secret,a("DEBUG: Outgoing: Writing NEWKEYS"),s.status===t0?Dn(e,b6e,void 0,!0):Dn(e,b6e),s.sentNEWKEYS=!0,r!==void 0&&i.expectedPacket===void 0&&Ver(e)}o(Her,"onKEXDH_REPLY");function Ver(e){var t=e._state,r=t.outgoing,n=t.incoming;if(n.expectedPacket=void 0,!!r.sentNEWKEYS){var i=r.kexsecret.length,s=r.encrypt.info=zer[r.encrypt.type],a=0,c=t.kex.hash,l=Buffer.allocUnsafe(4+i),d,m;if(t.authsQueue=[],Ze(l,i,a),a+=4,r.kexsecret.copy(l,a),r.kexsecret=void 0,s.stream)d=_6e;else{for(d=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"B":"A","ascii").update(r.sessionId).digest();d.length<s.ivLen;)d=Buffer.concat([d,Hs.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>s.ivLen&&(d=d.slice(0,s.ivLen))}for(m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"D":"C","ascii").update(r.sessionId).digest();m.length<s.keyLen;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);if(m.length>s.keyLen&&(m=m.slice(0,s.keyLen)),s.authLen>0)r.encrypt.iv=d,r.encrypt.key=m,r.encrypt.instance=!0;else{var f=Sx[r.encrypt.type];r.encrypt.instance=Hs.createCipheriv(f,m,d),r.encrypt.instance.setAutoPadding(!1)}var g=n.decrypt.info=zer[n.decrypt.type];if(g.stream)d=_6e;else{for(d=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"A":"B","ascii").update(r.sessionId).digest();d.length<g.ivLen;)d=Buffer.concat([d,Hs.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>g.ivLen&&(d=d.slice(0,g.ivLen))}for(n.decrypt.buf=Buffer.allocUnsafe(g.blockLen),m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"C":"D","ascii").update(r.sessionId).digest();m.length<g.keyLen;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);m.length>g.keyLen&&(m=m.slice(0,g.keyLen));var y=Sx[n.decrypt.type];n.decrypt.instance=Hs.createDecipheriv(y,m,d),n.decrypt.instance.setAutoPadding(!1),n.decrypt.iv=d,n.decrypt.key=m;var w;s.discardLen>0&&(w=Buffer.alloc(s.discardLen),r.encrypt.instance.update(w)),g.discardLen>0&&((!w||w.length!==g.discardLen)&&(w=Buffer.alloc(s.discardLen)),n.decrypt.instance.update(w));var v=r.hmac.info=Oer[r.hmac.type],b=n.hmac.info=Oer[n.hmac.type];if(s.authLen===0){for(m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"F":"E","ascii").update(r.sessionId).digest();m.length<v.len;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);m.length>v.len&&(m=m.slice(0,v.len)),r.hmac.key=m}else r.hmac.key=void 0;if(g.authLen===0){for(m=Hs.createHash(c).update(l).update(r.exchangeHash).update(e.server?"E":"F","ascii").update(r.sessionId).digest();m.length<b.len;)m=Buffer.concat([m,Hs.createHash(c).update(l).update(r.exchangeHash).update(m).digest()]);m.length>b.len&&(m=m.slice(0,b.len)),n.hmac.key=m}else n.hmac.key=void 0;var S=g.authLen||n.hmac.info.actualLen;if((!n.hmac.buf||n.hmac.buf.length!==S)&&(n.hmac.buf=Buffer.allocUnsafe(S)),r.exchangeHash=void 0,r.compress.type==="zlib"?(r.compress.instance=oC.createDeflate(Px),r.compress.queue=[]):r.compress.type==="none"&&(r.compress.instance=!1,r.compress.queue=null),n.decompress.type==="zlib"?n.decompress.instance=oC.createInflate(Px):n.decompress.type==="none"&&(n.decompress.instance=!1),e.bytesSent=e.bytesReceived=0,r.status===t0){r.status=e0;var P=r.rekeyQueue,q=P.length,k=0;for(r.rekeyQueue=[];k<q;++k)Buffer.isBuffer(P[k])?Dn(e,P[k]):Dn(e,P[k][0],P[k][1]);P=n.rekeyQueue,q=P.length,k=0,n.rekeyQueue=[];for(var j=n.seqno;k<q;++k)if(n.seqno=P[k][0],n.payload=P[k][1],Xer(e)===!1||n.status===Ex)return;n.seqno=j}else r.status=e0,n.status===p6e&&(e.debug("DEBUG: Parser: IN_PACKETBEFORE (update) (expecting "+g.blockLen+")"),cC(e,Ax,g.blockLen,n.decrypt.buf)),e.emit("ready")}}o(Ver,"onNEWKEYS");function Iee(e,t){var r=e._state.kex;if(r)switch(t){case 30:return r.pktInit;case 31:switch(r.type){case"group":return"KEXDH_REPLY";case"groupex":return"KEXDH_GEX_GROUP";default:return"KEXECDH_REPLY"}break;case 33:if(r.type==="groupex")return"KEXDH_GEX_REPLY"}return sr[t]}o(Iee,"getPacketType");function Xer(e,t){var r=e._state.incoming,n=e._state.outgoing,i=r.payload,s=r.seqno,a,c,l,d,m,f,g,y,w,v,b,S,P,q;if(++r.seqno>w6e&&(r.seqno=0),r.ignoreNext){e.debug("DEBUG: Parser: Packet ignored"),r.ignoreNext=!1;return}var k=i[0];if(k===void 0)return!1;if(n.status!==e0&&Iee(e,k)!==r.expectedPacket&&k<1&&k>4){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+r.expectedPacket+" but got: "+Iee(e,k)),e.disconnect(za.PROTOCOL_ERROR);var j=new Error("Received unexpected packet");return j.level="protocol",e.emit("error",j),!1}if(k===sr.CHANNEL_DATA){if(m=ws(i,1,e,t),m===!1||(f=xn(i,5,e,t,32768),f===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA ("+m+")"),e.emit("CHANNEL_DATA:"+m,f)}else if(k===sr.CHANNEL_EXTENDED_DATA){if(m=ws(i,1,e,t),m===!1)return!1;var ee=ws(i,5,e,t);if(ee===!1||(f=xn(i,9,e,t),f===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EXTENDED_DATA ("+m+")"),e.emit("CHANNEL_EXTENDED_DATA:"+m,ee,f)}else if(k===sr.CHANNEL_WINDOW_ADJUST){if(m=ws(i,1,e,t),m===!1)return!1;var K=ws(i,5,e,t);if(K===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_WINDOW_ADJUST ("+m+", "+K+")"),e.emit("CHANNEL_WINDOW_ADJUST:"+m,K)}else if(k===sr.CHANNEL_SUCCESS){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_SUCCESS ("+m+")"),e.emit("CHANNEL_SUCCESS:"+m)}else if(k===sr.CHANNEL_FAILURE){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE ("+m+")"),e.emit("CHANNEL_FAILURE:"+m)}else if(k===sr.CHANNEL_EOF){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EOF ("+m+")"),e.emit("CHANNEL_EOF:"+m)}else if(k===sr.CHANNEL_OPEN){var V=xn(i,1,"ascii",e,t);if(V===!1||(w=ws(i,i._pos,e,t),w===!1)||(v=ws(i,i._pos+=4,e,t),v===!1)||(b=ws(i,i._pos+=4,e,t),b===!1))return!1;var oe;if(e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN ("+w+", "+V+")"),V==="forwarded-tcpip"||V==="direct-tcpip"){var de=xn(i,i._pos+=4,"ascii",e,t);if(de===!1)return!1;var N=ws(i,i._pos,e,t);if(N===!1||(g=xn(i,i._pos+=4,"ascii",e,t),g===!1)||(y=ws(i,i._pos,e,t),y===!1))return!1;oe={type:V,sender:w,window:v,packetSize:b,data:{destIP:de,destPort:N,srcIP:g,srcPort:y}}}else if(V==="forwarded-streamlocal@openssh.com"||V==="direct-streamlocal@openssh.com"){if(q=xn(i,i._pos+=4,"utf8",e,t),q===!1)return!1;oe={type:V,sender:w,window:v,packetSize:b,data:{socketPath:q}}}else if(V==="x11"){if(g=xn(i,i._pos+=4,"ascii",e,t),g===!1||(y=ws(i,i._pos,e,t),y===!1))return!1;oe={type:V,sender:w,window:v,packetSize:b,data:{srcIP:g,srcPort:y}}}else oe={type:V,sender:w,window:v,packetSize:b,data:{}};e.emit("CHANNEL_OPEN",oe)}else if(k===sr.CHANNEL_OPEN_CONFIRMATION){if(S=ws(i,1,e,t),S===!1||(w=ws(i,5,e,t),w===!1)||(v=ws(i,9,e,t),v===!1)||(b=ws(i,13,e,t),b===!1))return!1;d={recipient:S,sender:w,window:v,packetSize:b},i.length>17&&(d.data=i.slice(17)),e.emit("CHANNEL_OPEN_CONFIRMATION:"+d.recipient,d)}else if(k===sr.CHANNEL_OPEN_FAILURE){if(S=ws(i,1,e,t),S===!1)return!1;var se=ws(i,5,e,t);if(se===!1||(P=xn(i,9,"utf8",e,t),P===!1)||(c=xn(i,i._pos,"utf8",e,t),c===!1))return!1;i._pos=9,d={recipient:S,reasonCode:se,reason:d$s[se],description:P,lang:c},e.emit("CHANNEL_OPEN_FAILURE:"+d.recipient,d)}else if(k===sr.CHANNEL_CLOSE){if(m=ws(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_CLOSE ("+m+")"),e.emit("CHANNEL_CLOSE:"+m)}else if(k!==sr.IGNORE){if(k===sr.DISCONNECT){var ne=ws(i,1,e,t);if(ne===!1)return!1;var xe=za[ne];if(P=xn(i,5,"utf8",e,t),P===!1)return!1;i._pos<i.length&&(c=xn(i,i._pos,"ascii",e,t)),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: DISCONNECT ("+xe+")"),e.emit("DISCONNECT",xe,ne,P,c)}else if(k===sr.DEBUG){if(l=xn(i,2,"utf8",e,t),l===!1||(c=xn(i,i._pos,"ascii",e,t),c===!1))return!1;e.emit("DEBUG",l,c)}else if(k===sr.NEWKEYS)e.emit("NEWKEYS");else if(k===sr.SERVICE_REQUEST){if(a=xn(i,1,"ascii",e,t),a===!1)return!1;e.emit("SERVICE_REQUEST",a)}else if(k===sr.SERVICE_ACCEPT){if(a=xn(i,1,"ascii",e,t),a===!1)return!1;e.emit("SERVICE_ACCEPT",a)}else if(k===sr.USERAUTH_REQUEST){var U=xn(i,1,"utf8",e,t);if(U===!1)return!1;var te=xn(i,i._pos,"ascii",e,t);if(te===!1)return!1;var He=xn(i,i._pos,"ascii",e,t);if(He===!1)return!1;var Qe,it;if(He==="password"){if(Qe=xn(i,i._pos+1,"utf8",e,t),Qe===!1)return!1}else if(He==="publickey"||He==="hostbased"){var qt,Dt,tr,lt,pt,mr,gt;if(He==="publickey"){if(qt=i[i._pos++],qt===void 0)return!1;qt=qt!==0}if(Dt=xn(i,i._pos,"ascii",e,t),Dt===!1||(tr=xn(i,i._pos,e,t),tr===!1))return!1;if(qt||He==="hostbased"){if(He==="hostbased"&&(mr=xn(i,i._pos,"ascii",e,t),mr===!1||(gt=xn(i,i._pos,"utf8",e,t),gt===!1)))return!1;var ar=i._pos;if(lt=xn(i,ar,e,t),lt===!1||(lt.length>4+Dt.length+4&&lt.toString("ascii",4,4+Dt.length)===Dt&&(lt=lt.slice(4+Dt.length+4)),lt=Mer(lt,Dt,e,t),lt===!1))return!1;pt=Buffer.allocUnsafe(4+n.sessionId.length+ar),Ze(pt,n.sessionId.length,0),n.sessionId.copy(pt,4),i.copy(pt,4+n.sessionId.length,0,ar)}else it="publickey -- check";Qe={keyAlgo:Dt,key:tr,signature:lt,blob:pt,localHostname:mr,localUsername:gt}}else if(He==="keyboard-interactive"){var Lr=ws(i,i._pos,e,t);if(Lr===!1||(Qe=xn(i,i._pos+4+Lr,"utf8",e,t),Qe===!1))return!1}else He!=="none"&&(Qe=i.slice(i._pos));it===void 0&&(it=He),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_REQUEST ("+it+")"),e._state.authsQueue.push(He),e.emit("USERAUTH_REQUEST",U,te,He,Qe)}else if(k===sr.USERAUTH_SUCCESS)n.compress.type==="zlib@openssh.com"&&(n.compress.instance=oC.createDeflate(Px),n.compress.queue=[]),r.decompress.type==="zlib@openssh.com"&&(r.decompress.instance=oC.createInflate(Px)),e._state.authsQueue.shift(),e.emit("USERAUTH_SUCCESS");else if(k===sr.USERAUTH_FAILURE){var $e=xn(i,1,"ascii",e,t);if($e===!1)return!1;var kr=i[i._pos];if(kr===void 0)return!1;kr=kr!==0,$e=$e.split(","),e._state.authsQueue.shift(),e.emit("USERAUTH_FAILURE",$e,kr)}else if(k===sr.USERAUTH_BANNER){if(l=xn(i,1,"utf8",e,t),l===!1||(c=xn(i,i._pos,"utf8",e,t),c===!1))return!1;e.emit("USERAUTH_BANNER",l,c)}else if(k===sr.GLOBAL_REQUEST){var O=xn(i,1,"ascii",e,t);if(O===!1)return e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST"),!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST ("+O+")");var Y=i[i._pos++];if(Y===void 0)return!1;Y=Y!==0;var he;if(O==="tcpip-forward"||O==="cancel-tcpip-forward"){var Re=xn(i,i._pos,"ascii",e,t);if(Re===!1)return!1;var Be=ws(i,i._pos,e,t);if(Be===!1)return!1;he={bindAddr:Re,bindPort:Be}}else if(O==="streamlocal-forward@openssh.com"||O==="cancel-streamlocal-forward@openssh.com"){if(q=xn(i,i._pos,"utf8",e,t),q===!1)return!1;he={socketPath:q}}else O==="no-more-sessions@openssh.com"||(he=i.slice(i._pos));e.emit("GLOBAL_REQUEST",O,Y,he)}else if(k===sr.REQUEST_SUCCESS)i.length>1?e.emit("REQUEST_SUCCESS",i.slice(1)):e.emit("REQUEST_SUCCESS");else if(k===sr.REQUEST_FAILURE)e.emit("REQUEST_FAILURE");else if(k!==sr.UNIMPLEMENTED){if(k===sr.KEXINIT)return k$s(e,t);if(k===sr.CHANNEL_REQUEST)return q$s(e,t);if(k>=30&&k<=49)return T$s(e,k,t);if(k>=60&&k<=70)return I$s(e,k,t);var Bt=Buffer.allocUnsafe(1+4);Bt[0]=sr.UNIMPLEMENTED,Ze(Bt,s,1),Dn(e,Bt)}}}o(Xer,"parsePacket");function k$s(e,t){var r=e._state.incoming,n=r.payload,i={algorithms:{kex:void 0,srvHostKey:void 0,cs:{encrypt:void 0,mac:void 0,compress:void 0},sc:{encrypt:void 0,mac:void 0,compress:void 0}},languages:{cs:void 0,sc:void 0}},s;if(s=sh(n,17,e,t),s===!1||(i.algorithms.kex=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.srvHostKey=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.cs.encrypt=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.sc.encrypt=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.cs.mac=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.sc.mac=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.cs.compress=s,s=sh(n,n._pos,e,t),s===!1)||(i.algorithms.sc.compress=s,s=sh(n,n._pos,e,t),s===!1)||(i.languages.cs=s,s=sh(n,n._pos,e,t),s===!1))return!1;i.languages.sc=s;var a=n._pos<n.length&&n[n._pos]===1;r.kexinit=n,e.emit("KEXINIT",i,a)}o(k$s,"parse_KEXINIT");function T$s(e,t,r){var n=e._state,i=n.incoming,s=i.payload;if(n.outgoing.status===e0||Iee(e,t)!==i.expectedPacket){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+i.expectedPacket+" but got: "+Iee(e,t)),e.disconnect(za.PROTOCOL_ERROR);var a=new Error("Received unexpected packet");return a.level="protocol",e.emit("error",a),!1}if(n.kex.type==="groupex"){if(e.server){e.disconnect(za.PROTOCOL_ERROR);var a=new Error("DH group exchange not supported by server");return a.level="handshake",e.emit("error",a),!1}else if(t===sr.KEXDH_GEX_GROUP){var c=xn(s,1,e,r);if(c===!1)return!1;var l=xn(s,s._pos,e,r);if(l===!1)return!1;e.emit("KEXDH_GEX_GROUP",c,l)}else if(t===sr.KEXDH_GEX_REPLY)return Ker(e,r)}else if(t===sr.KEXDH_INIT){var d=xn(s,1,e,r);if(d===!1)return!1;e.emit("KEXDH_INIT",d)}else if(t===sr.KEXDH_REPLY)return Ker(e,r)}o(T$s,"parse_KEX");function Ker(e,t){var r=e._state.incoming.payload,n=xn(r,1,e,t);if(n===!1)return!1;var i=xn(r,r._pos,e,t);if(i===!1)return!1;var s=xn(r,r._pos,e,t);if(s===!1)return!1;var a={hostkey:n,hostkey_format:void 0,pubkey:i,sig:s,sig_format:void 0},c=xn(n,0,"ascii",e,t);if(c===!1)return!1;a.hostkey_format=c;var l=xn(s,0,"ascii",e,t);if(l===!1)return!1;a.sig_format=l,e.emit("KEXDH_REPLY",a)}o(Ker,"parse_KEXDH_REPLY");function I$s(e,t,r){var n=e._state,i=n.authsQueue[0],s=n.incoming.payload,a,c,l;if(i==="password"){if(t===sr.USERAUTH_PASSWD_CHANGEREQ){if(a=xn(s,1,"utf8",e,r),a===!1||(c=xn(s,s._pos,"utf8",e,r),c===!1))return!1;e.emit("USERAUTH_PASSWD_CHANGEREQ",a,c)}}else if(i==="keyboard-interactive"){if(t===sr.USERAUTH_INFO_REQUEST){var d,m,f;if(d=xn(s,1,"utf8",e,r),d===!1||(m=xn(s,s._pos,"utf8",e,r),m===!1)||(c=xn(s,s._pos,"utf8",e,r),c===!1)||(f=ws(s,s._pos,e,r),f===!1))return!1;s._pos+=4;for(var g=[],y=0;y<f;++y){if(l=xn(s,s._pos,"utf8",e,r),l===!1)return!1;var w=s[s._pos++];if(w===void 0)return!1;w=w!==0,g.push({prompt:l,echo:w})}e.emit("USERAUTH_INFO_REQUEST",d,m,c,g)}else if(t===sr.USERAUTH_INFO_RESPONSE){var v=ws(s,1,e,r);if(v===!1)return!1;s._pos=5;for(var b=[],S=0;S<v;++S){if(l=xn(s,s._pos,"utf8",e,r),l===!1)return!1;b.push(l)}e.emit("USERAUTH_INFO_RESPONSE",b)}}else if(i==="publickey"){if(t===sr.USERAUTH_PK_OK){var P=e._state.authsQueue;if(!P.length||P[0]!=="publickey")return;P.shift(),e.emit("USERAUTH_PK_OK")}}else if(i!==void 0){e.disconnect(za.PROTOCOL_ERROR);var q=new Error("Invalid authentication method: "+i);q.level="protocol",e.emit("error",q)}}o(I$s,"parse_USERAUTH");function q$s(e,t){var r=e._state.incoming.payload,n,i,s,a,c,l,d,m=ws(r,1,e,t);if(m===!1)return!1;var f=xn(r,5,"ascii",e,t);if(f===!1)return!1;if(f==="exit-status"){var g=ws(r,++r._pos,e,t);if(g===!1)return!1;n={recipient:m,request:f,wantReply:!1,code:g}}else if(f==="exit-signal"){var y;if(e.remoteBugs&Ree.OLD_EXIT){if(d=ws(r,++r._pos,e,t),d===!1)return!1;switch(d){case 1:d="HUP";break;case 2:d="INT";break;case 3:d="QUIT";break;case 6:d="ABRT";break;case 9:d="KILL";break;case 14:d="ALRM";break;case 15:d="TERM";break;default:d="UNKNOWN ("+d+")"}y=!1}else{if(d=xn(r,++r._pos,"ascii",e,t),d===!1||(y=r[r._pos++],y===void 0))return!1;y=y!==0}var w=xn(r,r._pos,"utf8",e,t);if(w===!1)return!1;var v=xn(r,r._pos,"utf8",e,t);if(v===!1)return!1;n={recipient:m,request:f,wantReply:!1,signal:d,coredump:y,description:w,lang:v}}else if(f==="pty-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var b=xn(r,r._pos,"ascii",e,t);if(b===!1||(i=ws(r,r._pos,e,t),i===!1)||(s=ws(r,r._pos+=4,e,t),s===!1)||(a=ws(r,r._pos+=4,e,t),a===!1)||(c=ws(r,r._pos+=4,e,t),c===!1))return!1;var S=xn(r,r._pos+=4,e,t);if(S===!1)return!1;S=N$s(S),n={recipient:m,request:f,wantReply:l,term:b,cols:i,rows:s,width:a,height:c,modes:S}}else if(f==="window-change"){if(i=ws(r,++r._pos,e,t),i===!1||(s=ws(r,r._pos+=4,e,t),s===!1)||(a=ws(r,r._pos+=4,e,t),a===!1)||(c=ws(r,r._pos+=4,e,t),c===!1))return!1;n={recipient:m,request:f,wantReply:!1,cols:i,rows:s,width:a,height:c}}else if(f==="x11-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var P=r[r._pos++];if(P===void 0)return!1;P=P!==0;var q=xn(r,r._pos,"ascii",e,t);if(q===!1)return!1;var k=xn(r,r._pos,"binary",e,t);if(k===!1)return!1;var j=ws(r,r._pos,e,t);if(j===!1)return!1;n={recipient:m,request:f,wantReply:l,single:P,protocol:q,cookie:k,screen:j}}else if(f==="env"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var ee=xn(r,r._pos,"utf8",e,t);if(ee===!1)return!1;var K=xn(r,r._pos,"utf8",e,t);if(K===!1)return!1;n={recipient:m,request:f,wantReply:l,key:ee,val:K}}else if(f==="shell"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:m,request:f,wantReply:l}}else if(f==="exec"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var V=xn(r,r._pos,"utf8",e,t);if(V===!1)return!1;n={recipient:m,request:f,wantReply:l,command:V}}else if(f==="subsystem"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var oe=xn(r,r._pos,"utf8",e,t);if(oe===!1)return!1;n={recipient:m,request:f,wantReply:l,subsystem:oe}}else if(f==="signal"){if(d=xn(r,++r._pos,"ascii",e,t),d===!1)return!1;n={recipient:m,request:f,wantReply:!1,signal:"SIG"+d}}else if(f==="xon-xoff"){var de=r[++r._pos];if(de===void 0)return!1;de=de!==0,n={recipient:m,request:f,wantReply:!1,clientControl:de}}else if(f==="auth-agent-req@openssh.com"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:m,request:f,wantReply:l}}else{if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:m,request:f,wantReply:l}}e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST ("+m+", "+f+")"),e.emit("CHANNEL_REQUEST:"+m,n)}o(q$s,"parse_CHANNEL_REQUEST");function D$s(e,t){var r=e._state.incoming,n=r.hmac;if(e.debug("DEBUG: Parser: Verifying MAC"),r.decrypt.info.authLen>0){var i=r.decrypt,s=i.instance;s.setAuthTag(t);var a=s.update(r.packet);return r.payload=a.slice(1,r.packet.length-a[0]),Ler(i.iv),i.instance=Hs.createDecipheriv(Sx[i.type],i.key,i.iv),i.instance.setAutoPadding(!1),!0}else{var c=Hs.createHmac(Sx[n.type],n.key);Ze(Tee,r.seqno,0),Ze(Tee,r.pktLen,4),Tee[8]=r.padLen,c.update(Tee),c.update(r.packet);var l=c.digest();return l.length>r.hmac.info.actualLen&&(l=l.slice(0,r.hmac.info.actualLen)),B$s(l,t)}}o(D$s,"hmacVerify");function Wer(e,t){var r=e._state.incoming.decrypt.instance;return e.debug("DEBUG: Parser: Decrypting"),r.update(t)}o(Wer,"decryptData");function cC(e,t,r,n){var i=e._state.incoming.expect;i.amount=r,i.type=t,i.ptr=0,n?i.buf=n:r&&(i.buf=Buffer.allocUnsafe(r))}o(cC,"expectData");function sh(e,t,r,n){var i=xn(e,t,"ascii",r,n);return i!==!1?i.length?i.split(","):[]:!1}o(sh,"readList");function N$s(e){for(var t={},r=0,n=e.length,i;r<n&&(i=e[r],!(i===Cx.TTY_OP_END||Cx[i]===void 0||r+5>n));r+=5)t[Cx[i]]=m6e(e,r+1);return t}o(N$s,"bytesToModes");function L$s(e){for(var t=/^\d+$/,r=Object.keys(e),n=0,i=[],s=0,a=r.length,c,l,d;s<a;++s)c=r[s],l=Cx[c],l&&!t.test(c)&&typeof e[c]=="number"&&c!=="TTY_OP_END"&&(d=e[c],i[n++]=l,i[n++]=d>>>24&255,i[n++]=d>>>16&255,i[n++]=d>>>8&255,i[n++]=d&255);return i[n]=Cx.TTY_OP_END,i}o(L$s,"modesToBytes");function C6e(e,t){return j$s(16,function(r){var n=e.config.algorithms,i=n.kexBuf;if(e.remoteBugs&Ree.BAD_DHGEX){for(var s=!1,a=n.kex,c=a.length-1;c>=0;--c)a[c].indexOf("group-exchange")!==-1&&(s||(a=a.slice(),s=!0),a.splice(c,1));s&&(i=Buffer.from(a.join(",")))}var l=n.serverHostKeyBuf,d=1+16+4+i.length+4+l.length+2*(4+n.cipherBuf.length)+2*(4+n.hmacBuf.length)+2*(4+n.compressBuf.length)+2*4+1+4,m=Buffer.allocUnsafe(d),f=17;m[0]=sr.KEXINIT,r!==!1&&r.copy(m,1),Ze(m,i.length,f),f+=4,i.copy(m,f),f+=i.length,Ze(m,l.length,f),f+=4,l.copy(m,f),f+=l.length,Ze(m,n.cipherBuf.length,f),f+=4,n.cipherBuf.copy(m,f),f+=n.cipherBuf.length,Ze(m,n.cipherBuf.length,f),f+=4,n.cipherBuf.copy(m,f),f+=n.cipherBuf.length,Ze(m,n.hmacBuf.length,f),f+=4,n.hmacBuf.copy(m,f),f+=n.hmacBuf.length,Ze(m,n.hmacBuf.length,f),f+=4,n.hmacBuf.copy(m,f),f+=n.hmacBuf.length,Ze(m,n.compressBuf.length,f),f+=4,n.compressBuf.copy(m,f),f+=n.compressBuf.length,Ze(m,n.compressBuf.length,f),f+=4,n.compressBuf.copy(m,f),f+=n.compressBuf.length,m.fill(0,m.length-13),e.debug("DEBUG: Outgoing: Writing KEXINIT"),e._state.incoming.expectedPacket="KEXINIT";var g=e._state.outgoing;g.kexinit=m,g.status===e0&&(g.status=t0),Dn(e,m,t,!0)}),!0}o(C6e,"KEXINIT");function Qer(e){var t=e._state,r=t.outgoing,n=Buffer.allocUnsafe(1+4+r.pubkey.length);return t.incoming.expectedPacket=t.kex.pktReply,t.kex.type==="groupex"?(n[0]=sr.KEXDH_GEX_INIT,e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_INIT")):(n[0]=sr.KEXDH_INIT,t.kex.type==="group"?e.debug("DEBUG: Outgoing: Writing KEXDH_INIT"):e.debug("DEBUG: Outgoing: Writing KEXECDH_INIT")),Ze(n,r.pubkey.length,1),r.pubkey.copy(n,5),Dn(e,n,void 0,!0)}o(Qer,"KEXDH_INIT");function M$s(e,t){var r=e._state,n=r.outgoing,i=r.incoming,s=e.config.hostKeys[r.hostkeyFormat];Array.isArray(s)&&(s=s[0]);var a=s.getPublicSSH(),c=s.type;t=r.kex.convertPublicKey(t);var l=r.kex.computeSecret(t);if(l instanceof Error)return l.message="Error while computing DH secret ("+r.kex.type+"): "+l.message,l.level="handshake",e.emit("error",l),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;var d=Hs.createHash(r.kex.hash),m=Buffer.byteLength(i.identRaw),f=Buffer.byteLength(e.config.ident),g=i.kexinit.length,y=n.kexinit.length,w=a.length,v=t.length,b=n.pubkey.length,S=l.length,P=m+f+g+y+w+v+b+S+4*8,q,k,j,ee,K=r.kex.getDHParams();K&&(j=K.prime,ee=K.generator,q=j.length,k=ee.length,P+=4*3,P+=4*2,P+=q,P+=k);var V=0,oe=Buffer.allocUnsafe(P);Ze(oe,m,V),V+=4,oe.write(i.identRaw,V,"utf8"),V+=m,Ze(oe,f,V),V+=4,oe.write(e.config.ident,V,"utf8"),V+=f,Ze(oe,g,V),V+=4,i.kexinit.copy(oe,V),V+=g,i.kexinit=void 0,Ze(oe,y,V),V+=4,n.kexinit.copy(oe,V),V+=y,n.kexinit=void 0,Ze(oe,w,V),V+=4,a.copy(oe,V),V+=w,K&&(S6e.slice(1).copy(oe,V),V+=4*3,Ze(oe,q,V),V+=4,j.copy(oe,V),V+=q,Ze(oe,k,V),V+=4,ee.copy(oe,V),V+=k),Ze(oe,v,V),V+=4,t.copy(oe,V),V+=v,Ze(oe,b,V),V+=4,n.pubkey.copy(oe,V),V+=b,Ze(oe,S,V),V+=4,l.copy(oe,V),n.exchangeHash=d.update(oe).digest(),n.sessionId===void 0&&(n.sessionId=n.exchangeHash),n.kexsecret=l;var de=s.sign(n.exchangeHash);if(de instanceof Error)return de.message="Error while signing data with host key ("+c+"): "+de.message,de.level="handshake",e.emit("error",de),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;if(de=E6e(de,c),de===!1)return de.message="Error while converting handshake signature",de.level="handshake",e.emit("error",de),e.disconnect(za.KEY_EXCHANGE_FAILED),!1;var N=4+c.length+4+de.length,se=Buffer.allocUnsafe(1+4+w+4+b+4+N);return V=0,se[V]=sr[r.kex.pktReply],++V,Ze(se,w,V),V+=4,a.copy(se,V),V+=w,Ze(se,b,V),V+=4,n.pubkey.copy(se,V),V+=b,Ze(se,N,V),V+=4,Ze(se,c.length,V),V+=4,se.write(c,V,c.length,"ascii"),V+=c.length,Ze(se,de.length,V),V+=4,de.copy(se,V),r.incoming.expectedPacket="NEWKEYS",e.debug("DEBUG: Outgoing: Writing "+r.kex.pktReply),Dn(e,se,void 0,!0),n.sentNEWKEYS=!0,e.debug("DEBUG: Outgoing: Writing NEWKEYS"),Dn(e,b6e,void 0,!0)}o(M$s,"KEXDH_REPLY");function z$s(e){return e._state.incoming.expectedPacket="KEXDH_GEX_GROUP",e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST"),Dn(e,S6e,void 0,!0)}o(z$s,"KEXDH_GEX_REQ");function Yer(e,t,r){var n=e._state.outgoing.compress.instance;n.write(t),n.flush(v6e,O$s.bind(e,r))}o(Yer,"compressPayload");function O$s(e){if(!(this._readableState.ended||this._writableState.ended)){Zer(this,this._state.outgoing.compress.instance.read(),e);var t=this._state.outgoing.compress.queue;t.shift(),t.length>0&&Yer(this,t[0][0],t[0][1])}}o(O$s,"compressFlushCb");function Dn(e,t,r,n){var i=e._state;if(!i)return!1;var s=i.outgoing;if(s.status===t0&&!n)return typeof r=="function"?s.rekeyQueue.push([t,r]):s.rekeyQueue.push(t),!1;if(e._readableState.ended||e._writableState.ended)return!1;if(s.compress.instance){var a=s.compress.queue;return a.push([t,r]),a.length===1&&Yer(e,a[0][0],a[0][1]),!0}else return Zer(e,t,r)}o(Dn,"send");function Zer(e,t,r){var n=e._state,i=n.outgoing,s=i.encrypt,a=i.hmac,c,l,d,m,f;if(c=t.length+9,s.instance!==!1)if(s.info.authLen>0){for(var g=1+t.length+4;g%s.info.blockLen!=0;)++g;l=g-1-t.length,c=4+g}else{var y=s.info.blockLen;c+=(y-1)*c%y,l=c-t.length-5}else c+=7*c%8,l=c-t.length-5;d=Buffer.allocUnsafe(c),Ze(d,c-4,0),d[4]=l,t.copy(d,5),F$s(d,5+t.length,l),a.type!==!1&&a.key&&(m=Hs.createHmac(Sx[a.type],a.key),Ze(i.bufSeqno,i.seqno,0),m.update(i.bufSeqno),m.update(d),m=m.digest(),m.length>a.info.actualLen&&(m=m.slice(0,a.info.actualLen)));var w=0,v;if(s.instance!==!1)if(s.info.authLen>0){var b=Hs.createCipheriv(Sx[s.type],s.key,s.iv);b.setAutoPadding(!1);var S=d.slice(0,4);b.setAAD(S),e.push(S),w+=S,v=b.update(d.slice(4)),e.push(v),w+=v.length;var P=b.final();P.length&&(e.push(P),w+=P.length);var q=b.getAuthTag();f=e.push(q),w+=q.length,Ler(s.iv)}else v=s.instance.update(d),e.push(v),w+=v.length,f=e.push(m),w+=m.length;else f=e.push(d),w=d.length;return e.bytesSent+=w,++i.seqno>w6e&&(i.seqno=0),r&&r(),f}o(Zer,"send_");var F$s=function(){return typeof Hs.randomFillSync=="function"?Hs.randomFillSync:o(function(t,r,n){var i=Hs.randomBytes(n);i.copy(t,r)},"copyRandPadBytes")}();function j$s(e,t){Hs.randomBytes(e,o(function r(n,i){if(n)return Hs.randomBytes(e,r);t&&t(i)},"retry"))}o(j$s,"randBytes");function E6e(e,t){switch(t){case"ssh-dss":return o$s(e);case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return c$s(e)}return e}o(E6e,"convertSignature");var B$s=function(){return typeof Hs.timingSafeEqual=="function"?o(function(t,r){return t.length!==r.length?(Hs.timingSafeEqual(t,t),!1):Hs.timingSafeEqual(t,r)},"timingSafeEquals"):o(function(t,r){var n;t.length===r.length?n=0:(n=1,r=t);for(var i=0,s=t.length;i<s;++i)n|=t[i]^r[i];return n===0},"timingSafeEquals")}();function lC(e,t){switch(e){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!m$s)break;this.type="25519",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp256":this.type="ecdh",this.name="prime256v1",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp384":this.type="ecdh",this.name="secp384r1",this.hash="sha384",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp521":this.type="ecdh",this.name="secp521r1",this.hash="sha512",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"diffie-hellman-group1-sha1":this.type="group",this.name="modp2",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha1":this.type="group",this.name="modp14",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha256":this.type="group",this.name="modp14",this.hash="sha256",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group16-sha512":this.type="group",this.name="modp16",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group18-sha512":this.type="group",this.name="modp18",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group-exchange-sha1":this.type="groupex",this.hash="sha1",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return;case"diffie-hellman-group-exchange-sha256":this.type="groupex",this.hash="sha256",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return}throw new Error("Unsupported key exchange algorithm: "+e)}o(lC,"KeyExchange");lC.prototype.setDHParams=function(e,t){if(this.type==="groupex"){if(!Buffer.isBuffer(e))throw new Error("Invalid prime value");if(!Buffer.isBuffer(t))throw new Error("Invalid generator value");this._prime=e,this._generator=t}};lC.prototype.getDHParams=function(){if(this.type==="groupex"&&this._kex)return{prime:qee(this._kex.getPrime()),generator:qee(this._kex.getGenerator())}};lC.prototype.generateKeys=function(){switch(this.type){case"25519":this._keys||(this._keys=Hs.generateKeyPairSync("x25519"));break;case"ecdh":this._kex||(this._kex=Hs.createECDH(this.name),this._public=this._kex.generateKeys());break;case"group":case"groupex":this._kex||(this.name?this._kex=Hs.createDiffieHellmanGroup(this.name):this._prime&&this._generator&&(this._kex=Hs.createDiffieHellman(this._prime,this._generator)),this._kex&&(this._public=this._kex.generateKeys()));break}};lC.prototype.getPublicKey=function(){this.generateKeys();var e;switch(this.type){case"25519":return e=this._keys.publicKey.export({type:"spki",format:"der"}),e.slice(-32);case"ecdh":case"group":case"groupex":e=this._public;break}if(e)return this.convertPublicKey(e)};lC.prototype.convertPublicKey=function(e){for(var t,r=0,n=e.length;e[r]===0;)++r,--n;switch(this.type){case"25519":if(e.length===32)return e;break;default:if(e[r]&128)return t=Buffer.allocUnsafe(1+n),t[0]=0,e.copy(t,1,r),t}return n!==e.length&&(t=Buffer.allocUnsafe(n),e.copy(t,0,r),e=t),e};lC.prototype.computeSecret=function(e){switch(this.generateKeys(),this.type){case"25519":try{var t=new Ner.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.110"),t.endSequence(),t.startSequence(Ner.BitString),t.writeByte(0),t._ensure(e.length),e.copy(t._buf,t._offset,0,e.length),t._offset+=e.length,t.endSequence(),t.endSequence(),qee(Hs.diffieHellman({privateKey:this._keys.privateKey,publicKey:Hs.createPublicKey({key:t.buffer,type:"spki",format:"der"})}))}catch(r){return r}break;case"ecdh":case"group":case"groupex":try{return qee(this._kex.computeSecret(e))}catch(r){return r}}};function qee(e){for(var t=0,r=e.length;e[t]===0;)++t,--r;var n;return e[t]&128?(n=Buffer.allocUnsafe(1+r),n[0]=0,e.copy(n,1,t),e=n):r!==e.length&&(n=Buffer.allocUnsafe(r),e.copy(n,0,t),e=n),e}o(qee,"convertToMpint");A6e.exports=Un;A6e.exports._send=Dn});var Dee=h((D2o,etr)=>{etr.exports={SFTPStream:Rer(),SSH2Stream:Jer(),utils:th(),constants:mee()}});var ntr=h(rtr=>{var ttr=require("http").Agent,U$s=require("https").Agent,$$s=require("util").inherits,P6e;[ttr,U$s].forEach(e=>{function t(r,n){if(!(this instanceof t))return new t(r,n);e.call(this,n),this._connectCfg=r,this._defaultSrcIP=n&&n.srcIP||"localhost"}o(t,"SSHAgent"),$$s(t,e),t.prototype.createConnection=G$s,rtr[e===ttr?"SSHTTPAgent":"SSHTTPSAgent"]=t});function G$s(e,t){var r=e&&e.localAddress||this._defaultSrcIP,n=e&&e.localPort||0,i=e.host,s=e.port;P6e===void 0&&(P6e=x6e().Client);var a=new P6e,c=!1;a.on("ready",()=>{a.forwardOut(r,n,i,s,(l,d)=>{if(c=!0,l)return a.end(),t(l);d.once("close",()=>{a.end()}),t(null,H$s(d))})}).on("error",t).on("close",()=>{c||t(new Error("Unexpected connection loss"))}).connect(this._connectCfg)}o(G$s,"createConnection");function tL(){}o(tL,"noop");function H$s(e){return e.setKeepAlive=tL,e.setNoDelay=tL,e.setTimeout=tL,e.ref=tL,e.unref=tL,e.destroySoon=e.destroy,e}o(H$s,"decorateStream")});var k6e=h((L2o,ctr)=>{var itr=require("util").inherits,str=require("stream").Duplex,V$s=require("stream").Readable,atr=require("stream").Writable,X$s=Dee().constants.CHANNEL_EXTENDED_DATATYPE.STDERR,K$s=32*1024,rL=2*1024*1024,Nee=rL/2,otr=["CHANNEL_EOF","CHANNEL_CLOSE","CHANNEL_DATA","CHANNEL_EXTENDED_DATA","CHANNEL_WINDOW_ADJUST","CHANNEL_SUCCESS","CHANNEL_FAILURE","CHANNEL_REQUEST"],W$s=otr.length;function Df(e,t,r){var n={highWaterMark:rL,allowHalfOpen:!r||r&&r.allowHalfOpen!==!1};this.allowHalfOpen=n.allowHalfOpen,str.call(this,n);var i=this,s=r&&r.server;this.server=s,this.type=e.type,this.subtype=void 0;var a=this.incoming=e.incoming,c=a.id,l=this.outgoing=e.outgoing,d=this._callbacks=[],m,f,g,y,w;this._client=t,this._hasX11=!1;var v=t._channels,b=t._sshstream;function S(){i._waitClientDrain&&(i._waitClientDrain=!1,i._waitWindow||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}o(S,"ondrain"),t._sock.on("drain",S),b.once("CHANNEL_EOF:"+c,function(){a.state==="open"&&(a.state="eof",i.readable&&i.push(null),!s&&i.stderr.readable&&i.stderr.push(null))}).once("CHANNEL_CLOSE:"+c,function(){if(a.state!=="closed"){a.state="closed",i.readable&&i.push(null),s&&i.stderr.writable?i.stderr.end():!s&&i.stderr.readable&&i.stderr.push(null),(l.state==="open"||l.state==="eof")&&i.close(),l.state==="closing"&&(l.state="closed"),delete v[c];var k=i._writableState;t._sock.removeListener("drain",S),!k.ending&&!k.finished&&i.end(),i._callbacks=[];for(var j=0;j<d.length;++j)d[j](!0);d=i._callbacks,s?i.readable?i.once("end",function(){i.emit("close")}):i.emit("close"):(i.readable?i.once("end",function(){m===null?i.emit("close",m,f,g,y,w):i.emit("close",m)}):m===null?i.emit("close",m,f,g,y,w):i.emit("close",m),i.stderr.readable?i.stderr.once("end",function(){i.stderr.emit("close")}):i.stderr.emit("close"));for(var j=0;j<W$s;++j)b.removeAllListeners(otr[j]+":"+c)}}).on("CHANNEL_DATA:"+c,function(k){if(a.window!==0){if(a.window-=k.length,!i.push(k)){i._waitChanDrain=!0;return}a.window<=Nee&&Lee(i)}}).on("CHANNEL_WINDOW_ADJUST:"+c,function(k){l.window+=k,i._waitWindow&&(i._waitWindow=!1,i._waitClientDrain||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}).on("CHANNEL_SUCCESS:"+c,function(){s?(b._kalast=Date.now(),b._kacnt=0):t._resetKA(),d.length&&d.shift()(!1)}).on("CHANNEL_FAILURE:"+c,function(){s?(b._kalast=Date.now(),b._kacnt=0):t._resetKA(),d.length&&d.shift()(!0)}).on("CHANNEL_REQUEST:"+c,function(k){if(!s){if(k.request==="exit-status"){i.emit("exit",m=k.code);return}else if(k.request==="exit-signal"){i.emit("exit",m=null,f="SIG"+k.signal,g=k.coredump,y=k.description,w=k.lang);return}}k.wantReply&&b.channelFailure(l.id)}),this.stdin=this.stdout=this,s?this.stderr=new R6e(this):(this.stderr=new V$s(n),this.stderr._read=function(k){i._waitChanDrain&&(i._waitChanDrain=!1,a.window<=Nee&&Lee(i))},b.on("CHANNEL_EXTENDED_DATA:"+c,function(k,j){if(a.window!==0){if(a.window-=j.length,!i.stderr.push(j)){i._waitChanDrain=!0;return}a.window<=Nee&&Lee(i)}})),this._waitClientDrain=!1,this._waitWindow=!1,this._waitChanDrain=!1,this._chunk=void 0,this._chunkcb=void 0,this._chunkErr=void 0,this._chunkcbErr=void 0;function P(){i.eof(),(s||!s&&!i.allowHalfOpen)&&i.close(),i.writable=!1}o(P,"onFinish"),this.on("finish",P).on("prefinish",P);function q(){i.readable=!1}o(q,"onEnd"),this.on("end",q).on("close",q)}o(Df,"Channel");itr(Df,str);Df.prototype.eof=function(){var e=!0,t=this.outgoing;return t.state==="open"&&(t.state="eof",e=this._client._sshstream.channelEOF(t.id)),e};Df.prototype.close=function(){var e=!0,t=this.outgoing;return(t.state==="open"||t.state==="eof")&&(t.state="closing",e=this._client._sshstream.channelClose(t.id)),e};Df.prototype._read=function(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=Nee&&Lee(this))};Df.prototype._write=function(e,t,r){var n=this._client._sshstream,i=this.outgoing,s=i.packetSize,a=i.id,c=i.window,l=e.length,d=0,m,f,g;if(i.state==="open"){for(;l-d>0&&c>0;)if(g=l-d,g>c&&(g=c),g>s&&(g=s),m=n.channelData(a,e.slice(d,d+g)),d+=g,c-=g,!m){this._waitClientDrain=!0,this._chunk=void 0,this._chunkcb=r;break}if(i.window=c,l-d>0){c===0&&(this._waitWindow=!0),d>0?(f=Buffer.allocUnsafe(l-d),e.copy(f,0,d),this._chunk=f):this._chunk=e,this._chunkcb=r;return}this._waitClientDrain||r()}};Df.prototype.destroy=function(){this.end()};Df.prototype.setWindow=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&(this.subtype==="shell"||this.subtype==="exec")&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.windowChange(this.outgoing.id,e,t,r,n):!0};Df.prototype.signal=function(e){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.signal(this.outgoing.id,e):!0};Df.prototype.exit=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?typeof e=="number"?this._client._sshstream.exitStatus(this.outgoing.id,e):this._client._sshstream.exitSignal(this.outgoing.id,e,t,r):!0};Df.MAX_WINDOW=rL;Df.PACKET_SIZE=K$s;function Lee(e){if(e.outgoing.state==="closed")return!0;var t=rL-e.incoming.window;return t<=0?!0:(e.incoming.window+=t,e._client._sshstream.channelWindowAdjust(e.outgoing.id,t))}o(Lee,"windowAdjust");function R6e(e){atr.call(this,{highWaterMark:rL}),this._channel=e}o(R6e,"ServerStderr");itr(R6e,atr);R6e.prototype._write=function(e,t,r){var n=this._channel,i=n._client._sshstream,s=n.outgoing,a=s.packetSize,c=s.id,l=s.window,d=e.length,m=0,f,g,y;if(n.outgoing.state==="open"){for(;d-m>0&&l>0;)if(y=d-m,y>l&&(y=l),y>a&&(y=a),f=i.channelExtData(c,e.slice(m,m+y),X$s),m+=y,l-=y,!f){n._waitClientDrain=!0,n._chunkErr=void 0,n._chunkcbErr=r;break}if(s.window=l,d-m>0){l===0&&(n._waitWindow=!0),m>0?(g=Buffer.allocUnsafe(d-m),e.copy(g,0,m),n._chunkErr=g):n._chunkErr=e,n._chunkcbErr=r;return}n._waitClientDrain||r()}};ctr.exports=Df});var xx=h((M2o,ltr)=>{ltr.exports={readUInt32BE:o(function(t,r){return t[r++]*16777216+t[r++]*65536+t[r++]*256+t[r]},"readUInt32BE"),writeUInt32BE:o(function(t,r,n){return t[n++]=r>>>24,t[n++]=r>>>16,t[n++]=r>>>8,t[n++]=r,n},"writeUInt32BE"),writeUInt32LE:o(function(t,r,n){return t[n++]=r,t[n++]=r>>>8,t[n++]=r>>>16,t[n++]=r>>>24,n},"writeUInt32LE")}});var Ctr=h((z2o,Str)=>{var dtr=require("net").Socket,Q$s=require("events").EventEmitter,Y$s=require("util").inherits,Z$s=require("path"),utr=require("fs"),mtr=require("child_process"),ftr=xx().readUInt32BE,Mee=xx().writeUInt32BE,ptr=xx().writeUInt32LE,J$s=11,eGs=12,tGs=13,rGs=14,nGs=5,iGs=/^\!<socket >(\d+) s ([A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8})/,sGs=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;Str.exports=function(e,t,r,n,i){var s,a,c,l,d=0,m=Buffer.isBuffer(t),f,g=0,y=0,w=0,v,b=0,S=!1,P,q;typeof t=="function"&&typeof r=="function"?(P=t,q=r):m?(d=t.length,l=n.length):(i=t,t=void 0);function k(){var de;if(m){var N=9;de=Buffer.allocUnsafe(4+1+4+d+4+l+4),Mee(de,de.length-4,0),de[4]=tGs,Mee(de,d,5),t.copy(de,N),Mee(de,l,N+=d),n.copy(de,N+=4),Mee(de,0,N+=l),s.write(de)}else s.write(Buffer.from([0,0,0,1,J$s]))}o(k,"onconnect");function j(de){for(var N=0,se=de.length;N<se;++N)if(f===void 0)++g==5&&(f=de[N],g=0);else if(f===rGs){if(!c)y<<=8,y+=de[N],++g==4&&(c=Buffer.allocUnsafe(y),g=0);else if(c[g]=de[N],++g===y)return s.removeAllListeners("data"),s.destroy()}else if(f===eGs)if(v===void 0){if(w<<=8,w+=de[N],++g==4&&(v=new Array(w),g=0,w===0))return s.removeAllListeners("data"),s.destroy()}else if(!t)d<<=8,d+=de[N],++g==4&&(t=Buffer.allocUnsafe(d),g=0);else if(S===!1){if(t[g]=de[N],++g===d&&(v[w-1]=t,d=0,g=0,S=!0,--w==0))return t=void 0,s.removeAllListeners("data"),s.destroy()}else S===!0?(b<<=8,b+=de[N],++g==4&&(g=0,b>0?S=b:(t=void 0,S=!1),b=0)):++g===S&&(S=!1,g=0,t=void 0);else if(f===nGs)return m?a=new Error("Agent unable to sign data"):a=new Error("Unable to retrieve list of keys from agent"),s.removeAllListeners("data"),s.destroy()}o(j,"ondata");function ee(de){a=de}o(ee,"onerror");function K(){a?i(a):m&&!c||!m&&!v?i(new Error("Unexpected disconnection from agent")):m&&c?i(void 0,c):!m&&v&&i(void 0,v)}if(o(K,"onclose"),process.platform==="win32"&&!sGs.test(e))if(e==="pageant")s=new aGs;else{var V=!1;utr.readFile(e,o(function de(N,se){if(N){if(V)return i(new Error("Invalid cygwin unix socket path"));mtr.exec('cygpath -w "'+e+'"',function(Lr,$e,kr){if(Lr||$e.length===0)return i(new Error("Invalid cygwin unix socket path"));V=!0,e=$e.toString().replace(/[\r\n]/g,""),utr.readFile(e,de)});return}var ne;if(ne=iGs.exec(se.toString("ascii"))){let Lr=function(){Qe=0,He="secret",s.write(te)},$e=function(Y){Qe+=Y.length,He==="secret"?Qe===16&&(Qe=0,He="creds",s.write(Dt)):He==="creds"&&(it||qt.push(Y),Qe===12&&(s.removeListener("connect",Lr),s.removeListener("data",$e),s.removeListener("close",kr),it?(oe(),s.emit("connect")):(it=!0,Dt=Buffer.concat(qt),ptr(Dt,process.pid,0),s.destroy(),O())))},kr=function(){i(new Error("Problem negotiating cygwin unix socket security"))},O=function(){s=new dtr,s.once("connect",Lr),s.on("data",$e),s.once("close",kr),s.connect(xe)};var gt=Lr,pt=$e,mr=kr,ar=O;o(Lr,"_onconnect"),o($e,"_ondata"),o(kr,"_onclose"),o(O,"tryConnect");var xe,U,te,He,Qe=0,it=!1,qt=[],Dt=Buffer.allocUnsafe(12),tr,lt;for(Dt.fill(0),xe=parseInt(ne[1],10),U=ne[2].replace(/\-/g,""),te=Buffer.allocUnsafe(16),tr=0,lt=0;lt<32;++tr,lt+=2)te[tr]=parseInt(U.substring(lt,lt+2),16);for(tr=0;tr<16;tr+=4)ptr(te,ftr(te,tr),tr);O()}else i(new Error("Malformed cygwin unix socket file"))},"readCygsocket"));return}else s=new dtr;function oe(){if(!P&&!q)s.once("connect",k),s.on("data",j),s.once("error",ee),s.once("close",K);else{var de;s.once("connect",function(){de=P();var N=!1;function se(){N||(s.destroy(),N=!0)}o(se,"onDone"),de.once("end",se).once("close",se).on("data",function(ne){s.write(ne)}),s.on("data",function(ne){de.write(ne)})}),s.once("close",function(){de||q()})}}o(oe,"addSockListeners"),oe(),s.connect(e)};if(process.platform==="win32"){let e=function(){this.proc=void 0,this.buffer=null};aGs=e,o(e,"PageantSock"),gtr=10,htr=11,ytr=12,wtr=13,vtr=14,_tr=15,xw={},btr=Z$s.resolve(__dirname,"..","util/pagent.exe"),xw[gtr]=new Error("Invalid pagent.exe arguments"),xw[htr]=new Error("Pageant is not running"),xw[ytr]=new Error("pagent.exe could not create an mmap"),xw[wtr]=new Error("pagent.exe could not set mode for stdin"),xw[vtr]=new Error("pagent.exe could not set mode for stdout"),xw[_tr]=new Error("pagent.exe did not get expected input payload"),Y$s(e,Q$s),e.prototype.write=function(t){if(this.buffer===null?this.buffer=t:this.buffer=Buffer.concat([this.buffer,t],this.buffer.length+t.length),!(this.buffer.length<4)){var r=ftr(this.buffer,0);if(!(this.buffer.length-4<r)){t=this.buffer.slice(0,4+r),this.buffer.length>4+r?this.buffer=this.buffer.slice(4+r):this.buffer=null;var n=this,i,s=!1;i=this.proc=mtr.spawn(btr,[t.length]),i.stdout.on("data",function(a){n.emit("data",a)}),i.once("error",function(a){s||(s=!0,n.emit("error",a))}),i.once("close",function(a){n.proc=void 0,xw[a]&&!s&&(s=!0,n.emit("error",xw[a])),n.emit("close",s)}),i.stdin.end(t)}}},e.prototype.end=e.prototype.destroy=function(){this.buffer=null,this.proc&&(this.proc.kill(),this.proc=void 0)},e.prototype.connect=function(){this.emit("connect")}}var gtr,htr,ytr,wtr,vtr,_tr,xw,btr,aGs});var Ptr=h((O2o,Atr)=>{var oGs=require("util").inherits,Etr=require("events").EventEmitter;function os(e){var t=this;Etr.call(this),this._stream=e,e.on("error",function(r){t.emit("error",r)}).on("end",function(){t.emit("end")}).on("close",function(){t.emit("close")}).on("continue",function(){t.emit("continue")})}o(os,"SFTPWrapper");oGs(os,Etr);os.prototype.end=function(){return this._stream.end()};os.prototype.createReadStream=function(e,t){return this._stream.createReadStream(e,t)};os.prototype.createWriteStream=function(e,t){return this._stream.createWriteStream(e,t)};os.prototype.open=function(e,t,r,n){return this._stream.open(e,t,r,n)};os.prototype.close=function(e,t){return this._stream.close(e,t)};os.prototype.read=function(e,t,r,n,i,s){return this._stream.readData(e,t,r,n,i,s)};os.prototype.write=function(e,t,r,n,i,s){return this._stream.writeData(e,t,r,n,i,s)};os.prototype.fastGet=function(e,t,r,n){return this._stream.fastGet(e,t,r,n)};os.prototype.fastPut=function(e,t,r,n){return this._stream.fastPut(e,t,r,n)};os.prototype.readFile=function(e,t,r){return this._stream.readFile(e,t,r)};os.prototype.writeFile=function(e,t,r,n){return this._stream.writeFile(e,t,r,n)};os.prototype.appendFile=function(e,t,r,n){return this._stream.appendFile(e,t,r,n)};os.prototype.exists=function(e,t){return this._stream.exists(e,t)};os.prototype.unlink=function(e,t){return this._stream.unlink(e,t)};os.prototype.rename=function(e,t,r){return this._stream.rename(e,t,r)};os.prototype.mkdir=function(e,t,r){return this._stream.mkdir(e,t,r)};os.prototype.rmdir=function(e,t){return this._stream.rmdir(e,t)};os.prototype.readdir=function(e,t,r){return this._stream.readdir(e,t,r)};os.prototype.fstat=function(e,t){return this._stream.fstat(e,t)};os.prototype.stat=function(e,t){return this._stream.stat(e,t)};os.prototype.lstat=function(e,t){return this._stream.lstat(e,t)};os.prototype.opendir=function(e,t){return this._stream.opendir(e,t)};os.prototype.setstat=function(e,t,r){return this._stream.setstat(e,t,r)};os.prototype.fsetstat=function(e,t,r){return this._stream.fsetstat(e,t,r)};os.prototype.futimes=function(e,t,r,n){return this._stream.futimes(e,t,r,n)};os.prototype.utimes=function(e,t,r,n){return this._stream.utimes(e,t,r,n)};os.prototype.fchown=function(e,t,r,n){return this._stream.fchown(e,t,r,n)};os.prototype.chown=function(e,t,r,n){return this._stream.chown(e,t,r,n)};os.prototype.fchmod=function(e,t,r){return this._stream.fchmod(e,t,r)};os.prototype.chmod=function(e,t,r){return this._stream.chmod(e,t,r)};os.prototype.readlink=function(e,t){return this._stream.readlink(e,t)};os.prototype.symlink=function(e,t,r){return this._stream.symlink(e,t,r)};os.prototype.realpath=function(e,t){return this._stream.realpath(e,t)};os.prototype.ext_openssh_rename=function(e,t,r){return this._stream.ext_openssh_rename(e,t,r)};os.prototype.ext_openssh_statvfs=function(e,t){return this._stream.ext_openssh_statvfs(e,t)};os.prototype.ext_openssh_fstatvfs=function(e,t){return this._stream.ext_openssh_fstatvfs(e,t)};os.prototype.ext_openssh_hardlink=function(e,t,r){return this._stream.ext_openssh_hardlink(e,t,r)};os.prototype.ext_openssh_fsync=function(e,t){return this._stream.ext_openssh_fsync(e,t)};Atr.exports=os});var ktr=h((F2o,Rtr)=>{function xtr(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}o(xtr,"spliceOne");function nL(e,t,r){var n=this._streams=[];this._timer=void 0,this._timerInterval=e,this._timerfn=function(){for(var i=Date.now(),s=0,a=n.length,c,l;s<a;++s)if(c=n[s],l=c._kalast,l&&i-l>=t)if(++c._kacnt>r){var d=new Error("Keepalive timeout");d.level="client-timeout",c.emit("error",d),c.disconnect(),xtr(n,s),--s,a=n.length}else c._kalast=i,c.ping()}}o(nL,"Manager");nL.prototype.start=function(){this._timer&&this.stop(),this._timer=setInterval(this._timerfn,this._timerInterval)};nL.prototype.stop=function(){this._timer&&(clearInterval(this._timer),this._timer=void 0)};nL.prototype.add=function(e){var t=this._streams,r=this;e.once("end",function(){r.remove(e)}).on("packet",n),t[t.length]=e,n(),this._timer||this.start();function n(){e._kalast=Date.now(),e._kacnt=0}o(n,"resetKA")};nL.prototype.remove=function(e){var t=this._streams,r=t.indexOf(e);r>-1&&xtr(t,r),t.length||this.stop()};Rtr.exports=nL});var Mtr=h((j2o,N6e)=>{var cGs=require("net"),r0=require("events").EventEmitter,Rl=r0.listenerCount,n0=require("util").inherits,zee=Dee(),Ttr=zee.utils.parseKey,lGs=zee.SSH2Stream,dGs=zee.SFTPStream,T6e=zee.constants,iL=T6e.DISCONNECT_REASON,I6e=T6e.CHANNEL_OPEN_FAILURE,sL=T6e.ALGORITHMS,wc=k6e(),uGs=ktr(),mGs=xx().writeUInt32BE,Itr=Math.pow(2,32)-1,fGs=10,Oee;function Zo(e,t){if(!(this instanceof Zo))return new Zo(e,t);var r={"ssh-rsa":null,"ssh-dss":null,"ssh-ed25519":null,"ecdsa-sha2-nistp256":null,"ecdsa-sha2-nistp384":null,"ecdsa-sha2-nistp521":null},n=e.hostKeys;if(!Array.isArray(n))throw new Error("hostKeys must be an array");var i;for(i=0;i<n.length;++i){var s;if(Buffer.isBuffer(n[i])||typeof n[i]=="string"?s=Ttr(n[i]):s=Ttr(n[i].key,n[i].passphrase),s instanceof Error)throw new Error("Cannot parse privateKey: "+s.message);if(Array.isArray(s)&&(s=s[0]),s.getPrivatePEM()===null)throw new Error("privateKey value contains an invalid private key");r[s.type]||(r[s.type]=s)}var a={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0};if(typeof e.algorithms=="object"&&e.algorithms!==null){var c,l;if(l=e.algorithms.kex,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_KEX,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported key exchange algorithm: "+l[i]);a.kex=l}if(l=e.algorithms.cipher,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_CIPHER,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported cipher algorithm: "+l[i]);a.cipher=l}l=e.algorithms.serverHostKey;var d=!1;if(Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_SERVER_HOST_KEY,i=l.length-1;i>=0;--i){if(c.indexOf(l[i])===-1)throw new Error("Unsupported server host key algorithm: "+l[i]);r[l[i]]||(d||(l=l.slice(),d=!0),l.splice(i,1))}l.length>0&&(a.serverHostKey=l)}if(l=e.algorithms.hmac,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_HMAC,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported HMAC algorithm: "+l[i]);a.hmac=l}if(l=e.algorithms.compress,Array.isArray(l)&&l.length>0){for(c=sL.SUPPORTED_COMPRESS,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported compression algorithm: "+l[i]);a.compress=l}}if(a.serverHostKey===void 0){var m=Object.keys(r);for(i=m.length-1;i>=0;--i)r[m[i]]||m.splice(i,1);a.serverHostKey=m}!Oee&&Zo.KEEPALIVE_INTERVAL>0&&Zo.KEEPALIVE_CLIENT_INTERVAL>0&&Zo.KEEPALIVE_CLIENT_COUNT_MAX>=0&&(Oee=new uGs(Zo.KEEPALIVE_INTERVAL,Zo.KEEPALIVE_CLIENT_INTERVAL,Zo.KEEPALIVE_CLIENT_COUNT_MAX));var f=this;r0.call(this),typeof t=="function"&&f.on("connection",t);var g={algorithms:a,hostKeys:r,server:!0},y,w;for(i=0,y=Object.keys(e),w=y.length;i<w;++i){var v=y[i];v==="privateKey"||v==="publicKey"||v==="passphrase"||v==="algorithms"||v==="hostKeys"||v==="server"||(g[v]=e[v])}if(typeof g.debug=="function")var b=g.debug,S=Object.keys(g);this._srv=new cGs.Server(function(P){if(f._connections>=f.maxConnections){P.destroy();return}++f._connections,P.once("close",function(de){--f._connections,K.read()}).on("error",function(de){K.reset(),K.emit("error",de)});var q=g;if(b){q={};for(var k=0,j;k<S.length;++k)j=S[k],q[j]=g[j];var ee="["+process.hrtime().join(".")+"] ";q.debug=function(de){b(ee+de)}}var K=new lGs(q),V=new i0(K,P);P.pipe(K).pipe(P);function oe(de){}o(oe,"onClientPreHeaderError"),V.on("error",oe),K.once("header",function(de){if(!K._readableState.ended){if(!Rl(f,"connection"))return K.disconnect(iL.BY_APPLICATION);V.removeListener("error",oe),f.emit("connection",V,{ip:P.remoteAddress,family:P.remoteFamily,port:P.remotePort,header:de})}})}).on("error",function(P){f.emit("error",P)}).on("listening",function(){f.emit("listening")}).on("close",function(){f.emit("close")}),this._connections=0,this.maxConnections=1/0}o(Zo,"Server");n0(Zo,r0);Zo.prototype.listen=function(){return this._srv.listen.apply(this._srv,arguments),this};Zo.prototype.address=function(){return this._srv.address()};Zo.prototype.getConnections=function(e){this._srv.getConnections(e)};Zo.prototype.close=function(e){return this._srv.close(e),this};Zo.prototype.ref=function(){this._srv.ref()};Zo.prototype.unref=function(){this._srv.unref()};function i0(e,t){r0.call(this);var r=this;this._sshstream=e;var n=this._channels={};this._curChan=-1,this._sock=t,this.noMoreSessions=!1,this.authenticated=!1,e.on("end",function(){t.resume(),r.emit("end")}).on("close",function(g){r.emit("close",g)}).on("error",function(g){r.emit("error",g)}).on("drain",function(){r.emit("drain")}).on("continue",function(){r.emit("continue")});var i=0,s=!1,a=[],c;e.on("SERVICE_REQUEST",function(g){if(i===0||s||r.authenticated||g!=="ssh-userauth")return e.disconnect(iL.SERVICE_NOT_AVAILABLE);s=!0,e.serviceAccept(g)}).on("USERAUTH_REQUEST",l);function l(g,y,w,v){if(i===0||c&&(c.username!==g||c.service!==y)||w!=="password"&&w!=="publickey"&&w!=="hostbased"&&w!=="keyboard-interactive"&&w!=="none"||a.length===fGs)return e.disconnect(iL.PROTOCOL_ERROR);if(y!=="ssh-connection")return e.disconnect(iL.SERVICE_NOT_AVAILABLE);e._state.authMethod=w;var b;if(w==="keyboard-interactive"?b=new Fee(e,g,y,w,v,d):w==="publickey"?b=new q6e(e,g,y,w,v,d):w==="hostbased"?b=new Dtr(e,g,y,w,v,d):w==="password"?b=new Ntr(e,g,y,w,v,d):w==="none"&&(b=new pm(e,g,y,w,d)),c)if(c._initialResponse)c._multistep&&!this._finalResponse&&(c._cleanup&&c._cleanup(),c.emit("abort"));else return a.push(b);c=b,Rl(r,"authentication")?r.emit("authentication",c):c.reject()}o(l,"onUSERAUTH_REQUEST");function d(g,y,w,v){c===g&&!r.authenticated&&(y?(e.removeListener("USERAUTH_REQUEST",l),c=void 0,r.authenticated=!0,e.authSuccess(),a=[],r.emit("ready")):(e.authFailure(w,v),a.length&&(c=a.pop(),Rl(r,"authentication")?r.emit("authentication",c):c.reject())))}o(d,"onAuthDecide");var m=[];function f(){for(var g;m.length>0&&m[0].type;)g=m.shift(),g.type==="SUCCESS"&&e.requestSuccess(g.buf),g.type==="FAILURE"&&e.requestFailure()}o(f,"sendReplies"),e.on("GLOBAL_REQUEST",function(g,y,w){var v={type:null,buf:null};function b(k,j){v.type=k,v.buf=j,f()}if(o(b,"setReply"),y&&m.push(v),(g==="tcpip-forward"||g==="cancel-tcpip-forward"||g==="no-more-sessions@openssh.com"||g==="streamlocal-forward@openssh.com"||g==="cancel-streamlocal-forward@openssh.com")&&Rl(r,"request")&&r.authenticated){var S,P;if(y){var q=!1;S=o(function(k){if(!q){q=!0;var j;g==="tcpip-forward"&&w.bindPort===0&&typeof k=="number"&&(j=Buffer.allocUnsafe(4),mGs(j,k,0)),b("SUCCESS",j)}},"accept"),P=o(function(){q||(q=!0,b("FAILURE"))},"reject")}if(g==="no-more-sessions@openssh.com"){r.noMoreSessions=!0,S&&S();return}r.emit("request",S,P,g,w)}else y&&b("FAILURE")}),e.on("CHANNEL_OPEN",function(g){if(g.type==="session"&&r.noMoreSessions||!r.authenticated){var y=I6e.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(g.sender,y)}var w=Ltr(r),v,b,S=!1;if(w===!1)return e.channelOpenFail(g.sender,I6e.RESOURCE_SHORTAGE);switch(n[w]=!0,b=o(function(){if(!S){S=!0,delete n[w];var P=I6e.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(g.sender,P)}},"reject"),g.type){case"session":Rl(r,"session")?(v=o(function(){if(!S)return S=!0,e.channelOpenConfirm(g.sender,w,wc.MAX_WINDOW,wc.PACKET_SIZE),new qtr(r,g,w)},"accept"),r.emit("session",v,b)):b();break;case"direct-tcpip":Rl(r,"tcpip")?(v=o(function(){if(!S){S=!0,e.channelOpenConfirm(g.sender,w,wc.MAX_WINDOW,wc.PACKET_SIZE);var P={type:void 0,incoming:{id:w,window:wc.MAX_WINDOW,packetSize:wc.PACKET_SIZE,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}};return new wc(P,r)}},"accept"),r.emit("tcpip",v,b,g.data)):b();break;case"direct-streamlocal@openssh.com":Rl(r,"openssh.streamlocal")?(v=o(function(){if(!S){S=!0,e.channelOpenConfirm(g.sender,w,wc.MAX_WINDOW,wc.PACKET_SIZE);var P={type:void 0,incoming:{id:w,window:wc.MAX_WINDOW,packetSize:wc.PACKET_SIZE,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}};return new wc(P,r)}},"accept"),r.emit("openssh.streamlocal",v,b,g.data)):b();break;default:b()}}),e.on("NEWKEYS",function(){++i>1&&r.emit("rekey")}),Oee&&this.once("ready",function(){Oee.add(e)})}o(i0,"Client");n0(i0,r0);i0.prototype.end=function(){return this._sshstream.disconnect(iL.BY_APPLICATION)};i0.prototype.x11=function(e,t,r){var n={originAddr:e,originPort:t};return D6e(this,"x11",n,r)};i0.prototype.forwardOut=function(e,t,r,n,i){var s={boundAddr:e,boundPort:t,remoteAddr:r,remotePort:n};return D6e(this,"forwarded-tcpip",s,i)};i0.prototype.openssh_forwardOutStreamLocal=function(e,t){var r={socketPath:e};return D6e(this,"forwarded-streamlocal@openssh.com",r,t)};i0.prototype.rekey=function(e){var t=this._sshstream,r=!0,n;try{r=t.rekey()}catch(i){n=i}return typeof e=="function"&&(n?process.nextTick(function(){e(n)}):this.once("rekey",e)),r};function qtr(e,t,r){this.subtype=void 0;var n=!1,i=this,s=t.sender,a,c={type:"session",incoming:{id:r,window:wc.MAX_WINDOW,packetSize:wc.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}};function l(f){var g=!1,y,w;if(f.wantReply&&(f.request!=="shell"&&f.request!=="exec"&&f.request!=="subsystem"&&(y=o(function(){if(!(g||n||a))return g=!0,e._sshstream.channelSuccess(s)},"accept")),w=o(function(){if(!(g||n||a))return g=!0,e._sshstream.channelFailure(s)},"reject")),n){w&&w();return}switch(f.request){case"env":Rl(i,"env")?i.emit("env",y,w,{key:f.key,val:f.val}):w&&w();break;case"pty-req":Rl(i,"pty")?i.emit("pty",y,w,{cols:f.cols,rows:f.rows,width:f.width,height:f.height,term:f.term,modes:f.modes}):w&&w();break;case"window-change":Rl(i,"window-change")?i.emit("window-change",y,w,{cols:f.cols,rows:f.rows,width:f.width,height:f.height}):w&&w();break;case"x11-req":Rl(i,"x11")?i.emit("x11",y,w,{single:f.single,protocol:f.protocol,cookie:f.cookie,screen:f.screen}):w&&w();break;case"signal":Rl(i,"signal")?i.emit("signal",y,w,{name:f.signal}):w&&w();break;case"auth-agent-req@openssh.com":Rl(i,"auth-agent")?i.emit("auth-agent",y,w):w&&w();break;case"shell":Rl(i,"shell")?(y=o(function(){if(!(g||n||a))return g=!0,f.wantReply&&e._sshstream.channelSuccess(s),a=new wc(c,e,{server:!0}),a.subtype=i.subtype=f.request,a},"accept"),i.emit("shell",y,w)):w&&w();break;case"exec":Rl(i,"exec")?(y=o(function(){if(!(g||n||a))return g=!0,f.wantReply&&e._sshstream.channelSuccess(s),a=new wc(c,e,{server:!0}),a.subtype=i.subtype=f.request,a},"accept"),i.emit("exec",y,w,{command:f.command})):w&&w();break;case"subsystem":y=o(function(){if(!(g||n||a))if(g=!0,f.wantReply&&e._sshstream.channelSuccess(s),a=new wc(c,e,{server:!0}),a.subtype=i.subtype=f.request+":"+f.subsystem,f.subsystem==="sftp"){var v=new dGs({server:!0,debug:e._sshstream.debug});return a.pipe(v).pipe(a),v}else return a},"accept"),f.subsystem==="sftp"&&Rl(i,"sftp")?i.emit("sftp",y,w):f.subsystem!=="sftp"&&Rl(i,"subsystem")?i.emit("subsystem",y,w,{name:f.subsystem}):w&&w();break;default:w&&w()}}o(l,"onREQUEST");function d(){n=!0,i.emit("eof"),i.emit("end")}o(d,"onEOF");function m(){n=!0,i.emit("close")}o(m,"onCLOSE"),e._sshstream.on("CHANNEL_REQUEST:"+r,l).once("CHANNEL_EOF:"+r,d).once("CHANNEL_CLOSE:"+r,m)}o(qtr,"Session");n0(qtr,r0);function pm(e,t,r,n,i){r0.call(this);var s=this;this.username=this.user=t,this.service=r,this.method=n,this._initialResponse=!1,this._finalResponse=!1,this._multistep=!1,this._cbfinal=function(a,c,l){s._finalResponse||(s._finalResponse=!0,i(s,a,c,l))},this._stream=e}o(pm,"AuthContext");n0(pm,r0);pm.prototype.accept=function(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)};pm.prototype.reject=function(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)};var pGs=/[ \t\r\n]*,[ \t\r\n]*/g;function Fee(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this._multistep=!0;var a=this;this._cb=void 0,this._onInfoResponse=function(c){if(a._cb){var l=a._cb;a._cb=void 0,l(c)}},this.submethods=i.split(pGs),this.on("abort",function(){a._cb&&a._cb(new Error("Authentication request aborted"))})}o(Fee,"KeyboardAuthContext");n0(Fee,pm);Fee.prototype._cleanup=function(){this._stream.removeListener("USERAUTH_INFO_RESPONSE",this._onInfoResponse)};Fee.prototype.prompt=function(e,t,r,n){Array.isArray(e)||(e=[e]),typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0);for(var i=0;i<e.length;++i)typeof e[i]=="string"&&(e[i]={prompt:e[i],echo:!0});return this._cb=n,this._initialResponse=!0,this._stream.once("USERAUTH_INFO_RESPONSE",this._onInfoResponse),this._stream.authInfoReq(t,r,e)};function q6e(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var a;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":a="sha1";break;case"ssh-ed25519":a=null;break;case"ecdsa-sha2-nistp256":a="sha256";break;case"ecdsa-sha2-nistp384":a="sha384";break;case"ecdsa-sha2-nistp521":a="sha512";break}this.sigAlgo=a,this.blob=i.blob}o(q6e,"PKAuthContext");n0(q6e,pm);q6e.prototype.accept=function(){this.signature?pm.prototype.accept.call(this):(this._initialResponse=!0,this._stream.authPKOK(this.key.algo,this.key.data))};function Dtr(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var a;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":a="sha1";break;case"ssh-ed25519":a=null;break;case"ecdsa-sha2-nistp256":a="sha256";break;case"ecdsa-sha2-nistp384":a="sha384";break;case"ecdsa-sha2-nistp521":a="sha512";break}this.sigAlgo=a,this.blob=i.blob,this.localHostname=i.localHostname,this.localUsername=i.localUsername}o(Dtr,"HostbasedAuthContext");n0(Dtr,pm);function Ntr(e,t,r,n,i,s){pm.call(this,e,t,r,n,s),this.password=i}o(Ntr,"PwdAuthContext");n0(Ntr,pm);function D6e(e,t,r,n){var i=Ltr(e),s=wc.MAX_WINDOW,a=wc.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=!0;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_FAILURE:"+i);var m={type:t,incoming:{id:i,window:s,packetSize:a,state:"open"},outgoing:{id:d.sender,window:d.window,packetSize:d.packetSize,state:"open"}};n(void 0,new wc(m,e,{server:!0}))}).once("CHANNEL_OPEN_FAILURE:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_CONFIRMATION:"+i),delete e._channels[i];var m=new Error("(SSH) Channel open failure: "+d.description);m.reason=d.reason,m.lang=d.lang,n(m)}),t==="forwarded-tcpip"?c=l.forwardedTcpip(i,s,a,r):t==="x11"?c=l.x11(i,s,a,r):t==="forwarded-streamlocal@openssh.com"&&(c=l.openssh_forwardedStreamLocal(i,s,a,r)),c}o(D6e,"openChannel");function Ltr(e){if(e._curChan<Itr)return++e._curChan;for(var t=0,r=e._channels;t<Itr;++t)if(!r[t])return t;return!1}o(Ltr,"nextChannel");Zo.createServer=function(e,t){return new Zo(e,t)};Zo.KEEPALIVE_INTERVAL=1e3;Zo.KEEPALIVE_CLIENT_INTERVAL=15e3;Zo.KEEPALIVE_CLIENT_COUNT_MAX=3;N6e.exports=Zo;N6e.exports.IncomingClient=i0});var x6e=h((B2o,Xtr)=>{var aL=require("crypto"),gGs=require("net").Socket,hGs=require("dns").lookup,ztr=require("events").EventEmitter,yGs=require("util").inherits,wGs=aL.getHashes(),oL=Dee(),vGs=oL.SSH2Stream,L6e=oL.SFTPStream,dC=oL.constants,_Gs=dC.BUGS,cL=dC.ALGORITHMS,bGs=dC.EDDSA_SUPPORTED,SGs=oL.utils.parseKey,Otr=ntr(),s0=k6e(),M6e=Ctr(),CGs=Ptr(),z6e=xx().readUInt32BE,Ftr=Math.pow(2,32)-1,jee=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,jtr=o(function(e){},"DEBUG_NOOP");function $a(){if(!(this instanceof $a))return new $a;ztr.call(this),this.config={host:void 0,port:void 0,localAddress:void 0,localPort:void 0,forceIPv4:void 0,forceIPv6:void 0,keepaliveCountMax:void 0,keepaliveInterval:void 0,readyTimeout:void 0,username:void 0,password:void 0,privateKey:void 0,tryKeyboard:void 0,agent:void 0,allowAgentFwd:void 0,authHandler:void 0,hostHashAlgo:void 0,hostHashCb:void 0,strictVendor:void 0,debug:void 0},this._readyTimeout=void 0,this._channels=void 0,this._callbacks=void 0,this._forwarding=void 0,this._forwardingUnix=void 0,this._acceptX11=void 0,this._agentFwdEnabled=void 0,this._curChan=void 0,this._remoteVer=void 0,this._sshstream=void 0,this._sock=void 0,this._resetKA=void 0}o($a,"Client");yGs($a,ztr);$a.prototype.connect=function(e){var t=this;if(this._sock&&this._sock.writable){this.once("close",function(){t.connect(e)}),this.end();return}this.config.host=e.hostname||e.host||"localhost",this.config.port=e.port||22,this.config.localAddress=typeof e.localAddress=="string"?e.localAddress:void 0,this.config.localPort=typeof e.localPort=="string"||typeof e.localPort=="number"?e.localPort:void 0,this.config.forceIPv4=e.forceIPv4||!1,this.config.forceIPv6=e.forceIPv6||!1,this.config.keepaliveCountMax=typeof e.keepaliveCountMax=="number"&&e.keepaliveCountMax>=0?e.keepaliveCountMax:3,this.config.keepaliveInterval=typeof e.keepaliveInterval=="number"&&e.keepaliveInterval>0?e.keepaliveInterval:0,this.config.readyTimeout=typeof e.readyTimeout=="number"&&e.readyTimeout>=0?e.readyTimeout:2e4;var r={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0},n;if(typeof e.algorithms=="object"&&e.algorithms!==null){var i,s;if(s=e.algorithms.kex,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_KEX,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported key exchange algorithm: "+s[n]);r.kex=s}if(s=e.algorithms.cipher,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_CIPHER,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported cipher algorithm: "+s[n]);r.cipher=s}if(s=e.algorithms.serverHostKey,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_SERVER_HOST_KEY,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported server host key algorithm: "+s[n]);r.serverHostKey=s}if(s=e.algorithms.hmac,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_HMAC,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported HMAC algorithm: "+s[n]);r.hmac=s}if(s=e.algorithms.compress,Array.isArray(s)&&s.length>0){for(i=cL.SUPPORTED_COMPRESS,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported compression algorithm: "+s[n]);r.compress=s}}if(r.compress===void 0&&(e.compress?(r.compress=["zlib@openssh.com","zlib"],e.compress!=="force"&&r.compress.push("none")):e.compress===!1&&(r.compress=["none"])),typeof e.username=="string")this.config.username=e.username;else if(typeof e.user=="string")this.config.username=e.user;else throw new Error("Invalid username");this.config.password=typeof e.password=="string"?e.password:void 0,this.config.privateKey=typeof e.privateKey=="string"||Buffer.isBuffer(e.privateKey)?e.privateKey:void 0,this.config.localHostname=typeof e.localHostname=="string"&&e.localHostname.length?e.localHostname:void 0,this.config.localUsername=typeof e.localUsername=="string"&&e.localUsername.length?e.localUsername:void 0,this.config.tryKeyboard=e.tryKeyboard===!0,this.config.agent=typeof e.agent=="string"&&e.agent.length?e.agent:void 0,this.config.allowAgentFwd=e.agentForward===!0&&this.config.agent!==void 0;var a=this.config.authHandler=typeof e.authHandler=="function"?e.authHandler:void 0;this.config.strictVendor=typeof e.strictVendor=="boolean"?e.strictVendor:!0;var c=this.config.debug=typeof e.debug=="function"?e.debug:jtr;if(e.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");var l=this._callbacks=[];this._channels={},this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._curChan=-1,this._remoteVer=void 0;var d;if(this.config.privateKey){if(d=SGs(this.config.privateKey,e.passphrase),d instanceof Error)throw new Error("Cannot parse privateKey: "+d.message);if(Array.isArray(d)&&(d=d[0]),d.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}var m=this._sshstream=new vGs({algorithms:r,debug:c===jtr?void 0:c}),f=this._sock=e.sock||new gGs;this._sock.stderr&&typeof this._sock.stderr.resume=="function"&&this._sock.stderr.resume();var g=this.config.keepaliveInterval,y=this.config.keepaliveCountMax,w=0,v;function b(){if(++w>y){if(clearInterval(v),f.readable){var lt=new Error("Keepalive timeout");lt.level="client-timeout",t.emit("error",lt),f.destroy()}return}f.writable?(l.push(S),m.ping()):clearInterval(v)}o(b,"sendKA");function S(){g>0&&(w=0,clearInterval(v),f.writable&&(v=setInterval(b,g)))}if(o(S,"resetKA"),this._resetKA=S,m.on("USERAUTH_BANNER",function(lt){t.emit("banner",lt)}),f.on("connect",function(){c("DEBUG: Client: Connected"),t.emit("connect"),e.sock||m.pipe(f).pipe(m)}).on("timeout",function(){t.emit("timeout")}).on("error",function(lt){clearTimeout(t._readyTimeout),lt.level="client-socket",t.emit("error",lt)}).on("end",function(){m.unpipe(f),clearTimeout(t._readyTimeout),clearInterval(v),t.emit("end")}).on("close",function(){m.unpipe(f),clearTimeout(t._readyTimeout),clearInterval(v),t.emit("close");var lt=l,pt=new Error("No response from server");for(l=t._callbacks=[],n=0;n<lt.length;++n)lt[n](pt);var mr=t._channels,gt=Object.keys(mr);for(t._channels={},n=0;n<gt.length;++n){var ar=m.emit("CHANNEL_OPEN_FAILURE:"+gt[n],pt),Lr=m.emit("CHANNEL_CLOSE:"+gt[n]),$e;!ar&&!Lr&&($e=mr[gt[n]])&&typeof $e=="function"&&$e(pt)}}),m.on("drain",function(){t.emit("drain")}).once("header",function(lt){t._remoteVer=lt.versions.software,lt.greeting&&t.emit("greeting",lt.greeting)}).on("continue",function(){t.emit("continue")}).on("error",function(lt){lt.level===void 0?lt.level="protocol":lt.level==="handshake"&&clearTimeout(t._readyTimeout),t.emit("error",lt)}).on("end",function(){f.resume()}),typeof e.hostVerifier=="function"){if(wGs.indexOf(e.hostHash)===-1)throw new Error("Invalid host hash algorithm: "+e.hostHash);var P=e.hostVerifier,q=aL.createHash(e.hostHash);m.once("fingerprint",function(lt,pt){q.update(lt);var mr=P(q.digest("hex"),pt);mr!==void 0&&pt(mr)})}var k,j=null,ee=null,K,V=0,oe=["none"];if(this.config.password!==void 0&&oe.push("password"),d!==void 0&&oe.push("publickey"),this.config.agent!==void 0&&oe.push("agent"),this.config.tryKeyboard&&oe.push("keyboard-interactive"),d!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0&&oe.push("hostbased"),a===void 0){var de=0;a=o(function(pt,mr,gt){return de===oe.length?!1:oe[de++]},"authHandler")}var N=!1;function se(lt){if(N=!0,lt===!1){m.removeListener("USERAUTH_FAILURE",He),m.removeListener("USERAUTH_PK_OK",te);var pt=new Error("All configured authentication methods failed");pt.level="client-authentication",t.emit("error",pt),m.writable&&t.end();return}if(oe.indexOf(lt)===-1)throw new Error("Authentication method not allowed: "+lt);switch(k=lt,k){case"password":m.authPassword(t.config.username,t.config.password);break;case"publickey":m.authPK(t.config.username,d),m.once("USERAUTH_PK_OK",te);break;case"hostbased":let gt=function(ar,Lr){var $e=d.sign(ar);if($e instanceof Error)return $e.message="Error while signing data with privateKey: "+$e.message,$e.level="client-authentication",t.emit("error",$e),ne();Lr($e)};var mr=gt;o(gt,"hostbasedCb"),m.authHostbased(t.config.username,d,t.config.localHostname,t.config.localUsername,gt);break;case"agent":M6e(t.config.agent,function(ar,Lr){if(ar)return ar.level="agent",t.emit("error",ar),K=void 0,ne();if(Lr.length===0)return c("DEBUG: Agent: No keys stored in agent"),K=void 0,ne();K=Lr,V=0,m.authPK(t.config.username,Lr[0]),m.once("USERAUTH_PK_OK",te)});break;case"keyboard-interactive":m.authKeyboard(t.config.username),m.on("USERAUTH_INFO_REQUEST",U);break;case"none":m.authNone(t.config.username);break}}o(se,"doNextAuth");function ne(){N=!1;var lt=a(ee,j,se);N||lt===void 0||se(lt)}o(ne,"tryNextAuth");function xe(){if(k==="agent"){if(V>=K.length)return;++V>=K.length?(c("DEBUG: Agent: No more keys left to try"),c("DEBUG: Client: agent auth failed"),K=void 0,ne()):(c("DEBUG: Agent: Trying key #"+(V+1)),m.authPK(t.config.username,K[V]),m.once("USERAUTH_PK_OK",te))}}o(xe,"tryNextAgentKey");function U(lt,pt,mr,gt){var ar=Array.isArray(gt)?gt.length:0;if(ar===0)return c("DEBUG: Client: Sending automatic USERAUTH_INFO_RESPONSE"),m.authInfoRes();t.emit("keyboard-interactive",lt,pt,mr,gt,function(Lr){m.authInfoRes(Lr)})}o(U,"onUSERAUTH_INFO_REQUEST");function te(){if(k==="agent"){var lt=K[V],pt=z6e(lt,0),mr=lt.toString("ascii",4,4+pt),gt=mr.slice(4);switch(mr){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":break;default:if(bGs&&mr==="ssh-ed25519")break;return c("DEBUG: Agent: Skipping unsupported key type: "+mr),xe()}m.authPK(t.config.username,lt,function(ar,Lr){M6e(t.config.agent,lt,gt,ar,function($e,kr){if($e)$e.level="agent",t.emit("error",$e);else{var O=z6e(kr,0);if(4+O+4<kr.length){var Y=kr.toString("ascii",4,4+O);if(Y!==mr)$e=new Error("Agent key/signature type mismatch"),$e.level="agent",t.emit("error",$e);else return Lr(kr.slice(4+O+4))}}xe()})})}else k==="publickey"&&m.authPK(t.config.username,d,function(ar,Lr){var $e=d.sign(ar);if($e instanceof Error)return $e.message="Error while signing data with privateKey: "+$e.message,$e.level="client-authentication",t.emit("error",$e),ne();Lr($e)})}o(te,"onUSERAUTH_PK_OK");function He(lt,pt){if(m.removeListener("USERAUTH_PK_OK",te),m.removeListener("USERAUTH_INFO_REQUEST",U),k==="agent")return c("DEBUG: Client: Agent key #"+(V+1)+" failed"),xe();c("DEBUG: Client: "+k+" auth failed"),j=pt,ee=lt,ne()}if(o(He,"onUSERAUTH_FAILURE"),m.once("USERAUTH_SUCCESS",function(){m.removeListener("USERAUTH_FAILURE",He),m.removeListener("USERAUTH_INFO_REQUEST",U),S(),clearTimeout(t._readyTimeout),t.emit("ready")}).on("USERAUTH_FAILURE",He),m.once("ready",function(){m.service("ssh-userauth"),m.once("SERVICE_ACCEPT",function(lt){lt==="ssh-userauth"&&ne()})}),m.on("CHANNEL_OPEN",function(lt){PGs(t,lt)}),m.on("REQUEST_SUCCESS",function(lt){l.length&&l.shift()(!1,lt)}).on("REQUEST_FAILURE",function(){l.length&&l.shift()(!0)}),m.on("GLOBAL_REQUEST",function(lt,pt,mr){pt&&m.requestFailure()}),e.sock)Dt(),m.pipe(f).pipe(m);else{let lt=function(){Dt(),t._sock.connect({host:Qe,port:t.config.port,localAddress:t.config.localAddress,localPort:t.config.localPort}),t._sock.setNoDelay(!0),t._sock.setMaxListeners(0),t._sock.setTimeout(typeof e.timeout=="number"?e.timeout:0)};var tr=lt;o(lt,"doConnect");var Qe=this.config.host,it=this.config.forceIPv4,qt=this.config.forceIPv6;c("DEBUG: Client: Trying "+Qe+" on port "+this.config.port+" ..."),!it&&!qt||it&&qt?lt():hGs(Qe,it?4:6,function(pt,mr,gt){if(pt){var ar=new Error("Error while looking up "+(it?"IPv4":"IPv6")+" address for host "+Qe+": "+pt);clearTimeout(t._readyTimeout),ar.level="client-dns",t.emit("error",ar),t.emit("close");return}Qe=mr,lt()})}function Dt(){t.config.readyTimeout>0&&(t._readyTimeout=setTimeout(function(){var lt=new Error("Timed out while waiting for handshake");lt.level="client-timeout",t.emit("error",lt),f.destroy()},t.config.readyTimeout))}o(Dt,"startTimeout")};$a.prototype.end=function(){return this._sock&&this._sock.writable&&this._sshstream&&this._sshstream.writable?this._sshstream.disconnect():!1};$a.prototype.destroy=function(){this._sock&&this._sock.destroy()};$a.prototype.exec=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");typeof t=="function"&&(r=t,t={});var n=this,i={allowHalfOpen:t.allowHalfOpen!==!1};return Rx(this,"session",i,function(s,a){if(s)return r(s);var c=[];function l(d){if(d)return a.close(),r(d);c.length&&c.shift()()}o(l,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&c.push(function(){Gtr(a,l)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&Htr(a,t.env),(typeof t.pty=="object"&&t.pty!==null||t.pty===!0)&&c.push(function(){$tr(a,t.pty,l)}),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&c.push(function(){Utr(a,t.x11,l)})),c.push(function(){AGs(a,e,t,r)}),c.shift()()})};$a.prototype.shell=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this;return typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),e&&(e.x11!==void 0||e.env!==void 0)&&(t=e,e=void 0),Rx(this,"session",function(i,s){if(i)return r(i);var a=[];function c(l){if(l)return s.close(),r(l);a.length&&a.shift()()}o(c,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&a.push(function(){Gtr(s,c)}),e!==!1&&a.push(function(){$tr(s,e,c)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&Htr(s,t.env),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&a.push(function(){Utr(s,t.x11,c)})),a.push(function(){EGs(s,r)}),a.shift()()})};$a.prototype.subsys=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");return Rx(this,"session",function(r,n){if(r)return t(r);Vtr(n,e,function(i,s){if(i)return t(i);t(void 0,s)})})};$a.prototype.sftp=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=this;return Rx(this,"session",function(r,n){if(r)return e(r);Vtr(n,"sftp",function(i,s){if(i)return e(i);var a=t._sshstream._state.incoming.identRaw,c={debug:t.config.debug},l=new L6e(c,a);function d(g){l.removeListener("ready",m),s.removeListener("exit",f),e(g)}o(d,"onError");function m(){l.removeListener("error",d),s.removeListener("exit",f),e(void 0,new CGs(l))}o(m,"onReady");function f(g,y){l.removeListener("ready",m),l.removeListener("error",d);var w;typeof g=="number"?w="Received exit code "+g+" while establishing SFTP session":w="Received signal "+y+" while establishing SFTP session";var v=new Error(w);v.code=g,v.signal=y,e(v)}o(f,"onExit"),l.once("error",d).once("ready",m).once("close",function(){s.end()}),s.once("exit",f),l.pipe(s).pipe(l)})})};$a.prototype.forwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s,a){if(s)return r(s!==!0?s:new Error("Unable to bind to "+e+":"+t));var c=t;t===0&&a&&a.length>=4&&(c=z6e(a,0),n._sshstream.remoteBugs&_Gs.DYN_RPORT_BUG||(t=c)),n._forwarding[e+":"+t]=c,r(void 0,c)}),this._sshstream.tcpipForward(e,t,i)};$a.prototype.unforwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to unbind from "+e+":"+t));delete n._forwarding[e+":"+t],r()}),this._sshstream.cancelTcpipForward(e,t,i)};$a.prototype.forwardOut=function(e,t,r,n,i){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var s={srcIP:e,srcPort:t,dstIP:r,dstPort:n};return Rx(this,"direct-tcpip",s,i)};$a.prototype.openssh_noMoreSessions=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=typeof e=="function";return!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)?(t&&this._callbacks.push(function(r){if(r)return e(r!==!0?r:new Error("Unable to disable future sessions"));e()}),this._sshstream.openssh_noMoreSessions(t)):(t&&process.nextTick(function(){e(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};$a.prototype.openssh_forwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to bind to "+e));n._forwardingUnix[e]=!0,t()}),this._sshstream.openssh_streamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};$a.prototype.openssh_unforwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to unbind on "+e));delete n._forwardingUnix[e],t()}),this._sshstream.openssh_cancelStreamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};$a.prototype.openssh_forwardOutStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");if(!this.config.strictVendor||this.config.strictVendor&&jee.test(this._remoteVer)){var r={socketPath:e};return Rx(this,"direct-streamlocal@openssh.com",r,t)}else process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))});return!0};function Rx(e,t,r,n){var i=Btr(e),s=s0.MAX_WINDOW,a=s0.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=n;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,d).once("CHANNEL_OPEN_FAILURE:"+i,m).once("CHANNEL_CLOSE:"+i,m),t==="session"?c=l.session(i,s,a):t==="direct-tcpip"?c=l.directTcpip(i,s,a,r):t==="direct-streamlocal@openssh.com"&&(c=l.openssh_directStreamLocal(i,s,a,r)),c;function d(f){l.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),l.removeListener("CHANNEL_CLOSE:"+i,m);var g={type:t,incoming:{id:i,window:s,packetSize:a,state:"open"},outgoing:{id:f.sender,window:f.window,packetSize:f.packetSize,state:"open"}};n(void 0,new s0(g,e))}o(d,"onSuccess");function m(f){l.removeListener("CHANNEL_OPEN_CONFIRMATION:"+i,d),l.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),l.removeListener("CHANNEL_CLOSE:"+i,m),delete e._channels[i];var g;f instanceof Error?g=f:typeof f=="object"&&f!==null?(g=new Error("(SSH) Channel open failure: "+f.description),g.reason=f.reason,g.lang=f.lang):(g=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),g.reason=g.lang=""),n(g)}o(m,"onFailure")}o(Rx,"openChannel");function Btr(e){if(e._curChan<Ftr)return++e._curChan;for(var t=0,r=e._channels;t<Ftr;++t)if(!r[t])return t;return!1}o(Btr,"nextChannel");function Utr(e,t,r){var n={single:!1,protocol:"MIT-MAGIC-COOKIE-1",cookie:void 0,screen:0};typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.single=="boolean"&&(n.single=t.single),typeof t.screen=="number"&&(n.screen=t.screen),typeof t.protocol=="string"&&(n.protocol=t.protocol),typeof t.cookie=="string"?n.cookie=t.cookie:Buffer.isBuffer(t.cookie)&&(n.cookie=t.cookie.toString("hex"))),n.cookie===void 0&&(n.cookie=xGs());var i=typeof r=="function";return e.outgoing.state!=="open"?(i&&r(new Error("Channel is not open")),!0):(i&&e._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to request X11"));e._hasX11=!0,++e._client._acceptX11,e.once("close",function(){e._client._acceptX11&&--e._client._acceptX11}),r()}),e._client._sshstream.x11Forward(e.outgoing.id,n,i))}o(Utr,"reqX11");function $tr(e,t,r){var n=24,i=80,s=640,a=480,c="vt100",l=null;typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.rows=="number"&&(n=t.rows),typeof t.cols=="number"&&(i=t.cols),typeof t.width=="number"&&(s=t.width),typeof t.height=="number"&&(a=t.height),typeof t.term=="string"&&(c=t.term),typeof t.modes=="object"&&(l=t.modes));var d=typeof r=="function";return e.outgoing.state!=="open"?(d&&r(new Error("Channel is not open")),!0):(d&&e._callbacks.push(function(m){if(m)return r(m!==!0?m:new Error("Unable to request a pseudo-terminal"));r()}),e._client._sshstream.pty(e.outgoing.id,n,i,a,s,c,l,d))}o($tr,"reqPty");function Gtr(e,t){var r=typeof t=="function";return e.outgoing.state!=="open"?(r&&t(new Error("Channel is not open")),!0):e._client._agentFwdEnabled?(r&&t(!1),!0):(e._client._agentFwdEnabled=!0,e._callbacks.push(function(n){if(n){e._client._agentFwdEnabled=!1,r&&t(n!==!0?n:new Error("Unable to request agent forwarding"));return}r&&t()}),e._client._sshstream.openssh_agentForward(e.outgoing.id,!0))}o(Gtr,"reqAgentFwd");function EGs(e,t){return e.outgoing.state!=="open"?(t(new Error("Channel is not open")),!0):(e._callbacks.push(function(r){if(r)return t(r!==!0?r:new Error("Unable to open shell"));e.subtype="shell",t(void 0,e)}),e._client._sshstream.shell(e.outgoing.id,!0))}o(EGs,"reqShell");function AGs(e,t,r,n){return e.outgoing.state!=="open"?(n(new Error("Channel is not open")),!0):(e._callbacks.push(function(i){if(i)return n(i!==!0?i:new Error("Unable to exec"));e.subtype="exec",e.allowHalfOpen=r.allowHalfOpen!==!1,n(void 0,e)}),e._client._sshstream.exec(e.outgoing.id,t,!0))}o(AGs,"reqExec");function Htr(e,t){if(e.outgoing.state!=="open")return!0;for(var r=!0,n=Object.keys(t||{}),i,s,a=0,c=n.length;a<c;++a)i=n[a],s=t[i],r=e._client._sshstream.env(e.outgoing.id,i,s,!1);return r}o(Htr,"reqEnv");function Vtr(e,t,r){return e.outgoing.state!=="open"?(r(new Error("Channel is not open")),!0):(e._callbacks.push(function(n){if(n)return r(n!==!0?n:new Error("Unable to start subsystem: "+t));e.subtype="subsystem",r(void 0,e)}),e._client._sshstream.subsystem(e.outgoing.id,t,!0))}o(Vtr,"reqSubsystem");function PGs(e,t){var r=!1,n;function i(){var c={type:t.type,incoming:{id:r,window:s0.MAX_WINDOW,packetSize:s0.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},l=new s0(c,e);return e._sshstream.channelOpenConfirm(t.sender,r,s0.MAX_WINDOW,s0.PACKET_SIZE),l}o(i,"accept");function s(){n===void 0&&(r===!1?n=dC.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE:n=dC.CHANNEL_OPEN_FAILURE.CONNECT_FAILED),e._sshstream.channelOpenFail(t.sender,n,"","")}if(o(s,"reject"),t.type==="forwarded-tcpip"||t.type==="x11"||t.type==="auth-agent@openssh.com"||t.type==="forwarded-streamlocal@openssh.com"){var a=t.type==="forwarded-tcpip"&&e._forwarding[t.data.destIP+":"+t.data.destPort]===void 0||t.type==="forwarded-streamlocal@openssh.com"&&e._forwardingUnix[t.data.socketPath]===void 0||t.type==="x11"&&e._acceptX11===0||t.type==="auth-agent@openssh.com"&&!e._agentFwdEnabled;a?(n=dC.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: "+t.type)):(r=Btr(e),r===!1?(e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: no channels available"),a=!0):e._channels[r]=!0),a&&s(),r!==!1&&(t.type==="forwarded-tcpip"?(t.data.destPort===0&&(t.data.destPort=e._forwarding[t.data.destIP+":"+t.data.destPort]),e.emit("tcp connection",t.data,i,s)):t.type==="x11"?e.emit("x11",t.data,i,s):t.type==="forwarded-streamlocal@openssh.com"?e.emit("unix connection",t.data,i,s):M6e(e.config.agent,i,s))}else e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: "+t.type),n=dC.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE,s()}o(PGs,"onCHANNEL_OPEN");var xGs=function(){if(typeof aL.randomFillSync=="function"){var e=Buffer.alloc(16);return o(function(){return aL.randomFillSync(e,0,16),e.toString("hex")},"randomCookie")}else return o(function(){return aL.randomBytes(16).toString("hex")},"randomCookie")}();$a.Client=$a;$a.Server=Mtr();$a.utils=oL.utils;$a.SFTP_STATUS_CODE=L6e.STATUS_CODE;$a.SFTP_OPEN_MODE=L6e.OPEN_MODE;$a.HTTPAgent=Otr.SSHTTPAgent;$a.HTTPSAgent=Otr.SSHTTPSAgent;Xtr.exports=$a});var Wtr=h((U2o,Ktr)=>{var RGs=x6e().Client,kGs=require("http");Ktr.exports=function(e){var t=new RGs,r=new kGs.Agent;return r.createConnection=function(n,i){t.once("ready",function(){t.exec("docker system dial-stdio",function(s,a){if(s){t.end(),r.destroy();return}i(null,a),a.once("close",()=>{t.end(),r.destroy()})})}).connect(e),t.once("end",()=>r.destroy())},r}});var O6e=h(($2o,Qtr)=>{Qtr.exports=require("stream")});var err=h((G2o,Jtr)=>{"use strict";function Ytr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}o(Ytr,"ownKeys");function TGs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ytr(Object(r),!0).forEach(function(n){IGs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ytr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}o(TGs,"_objectSpread");function IGs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(IGs,"_defineProperty");function qGs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}o(qGs,"_classCallCheck");function Ztr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o(Ztr,"_defineProperties");function DGs(e,t,r){return t&&Ztr(e.prototype,t),r&&Ztr(e,r),e}o(DGs,"_createClass");var NGs=require("buffer"),Bee=NGs.Buffer,LGs=require("util"),F6e=LGs.inspect,MGs=F6e&&F6e.custom||"inspect";function zGs(e,t,r){Bee.prototype.copy.call(e,t,r)}o(zGs,"copyBuffer");Jtr.exports=function(){function e(){qGs(this,e),this.head=null,this.tail=null,this.length=0}return o(e,"BufferList"),DGs(e,[{key:"push",value:o(function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},"push")},{key:"unshift",value:o(function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},"unshift")},{key:"shift",value:o(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:o(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:o(function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},"join")},{key:"concat",value:o(function(r){if(this.length===0)return Bee.alloc(0);for(var n=Bee.allocUnsafe(r>>>0),i=this.head,s=0;i;)zGs(i.data,n,s),s+=i.data.length,i=i.next;return n},"concat")},{key:"consume",value:o(function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i},"consume")},{key:"first",value:o(function(){return this.head.data},"first")},{key:"_getString",value:o(function(r){var n=this.head,i=1,s=n.data;for(r-=s.length;n=n.next;){var a=n.data,c=r>a.length?a.length:r;if(c===a.length?s+=a:s+=a.slice(0,r),r-=c,r===0){c===a.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=a.slice(c));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:o(function(r){var n=Bee.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var a=i.data,c=r>a.length?a.length:r;if(a.copy(n,n.length-r,0,c),r-=c,r===0){c===a.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=a.slice(c));break}++s}return this.length-=s,n},"_getBuffer")},{key:MGs,value:o(function(r,n){return F6e(this,TGs({},n,{depth:0,customInspect:!1}))},"value")}]),e}()});var B6e=h((H2o,rrr)=>{"use strict";function OGs(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(j6e,this,e)):process.nextTick(j6e,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Uee,r):(r._writableState.errorEmitted=!0,process.nextTick(trr,r,s)):process.nextTick(trr,r,s):t?(process.nextTick(Uee,r),t(s)):process.nextTick(Uee,r)}),this)}o(OGs,"destroy");function trr(e,t){j6e(e,t),Uee(e)}o(trr,"emitErrorAndCloseNT");function Uee(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}o(Uee,"emitCloseNT");function FGs(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}o(FGs,"undestroy");function j6e(e,t){e.emit("error",t)}o(j6e,"emitErrorNT");function jGs(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}o(jGs,"errorOrDestroy");rrr.exports={destroy:OGs,undestroy:FGs,errorOrDestroy:jGs}});var a0=h((V2o,srr)=>{"use strict";var nrr={};function Nf(e,t,r){r||(r=Error);function n(s,a,c){return typeof t=="string"?t:t(s,a,c)}o(n,"getMessage");class i extends r{constructor(a,c,l){super(n(a,c,l))}}o(i,"NodeError"),i.prototype.name=r.name,i.prototype.code=e,nrr[e]=i}o(Nf,"createErrorType");function irr(e,t){if(Array.isArray(e)){let r=e.length;return e=e.map(n=>String(n)),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:r===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}o(irr,"oneOf");function BGs(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}o(BGs,"startsWith");function UGs(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}o(UGs,"endsWith");function $Gs(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}o($Gs,"includes");Nf("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Nf("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&BGs(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(UGs(e," argument"))i=`The ${e} ${n} ${irr(t,"type")}`;else{let s=$Gs(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${irr(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);Nf("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Nf("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Nf("ERR_STREAM_PREMATURE_CLOSE","Premature close");Nf("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Nf("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Nf("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Nf("ERR_STREAM_WRITE_AFTER_END","write after end");Nf("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Nf("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Nf("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");srr.exports.codes=nrr});var U6e=h((X2o,arr)=>{"use strict";var GGs=a0().codes.ERR_INVALID_OPT_VALUE;function HGs(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}o(HGs,"highWaterMarkFrom");function VGs(e,t,r,n){var i=HGs(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new GGs(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}o(VGs,"getHighWaterMark");arr.exports={getHighWaterMark:VGs}});var $ee=h((K2o,orr)=>{orr.exports=require("util").deprecate});var H6e=h((W2o,frr)=>{"use strict";frr.exports=No;function crr(e){var t=this;this.next=null,this.entry=null,this.finish=function(){v6s(t,e)}}o(crr,"CorkedRequest");var kx;No.WritableState=lL;var XGs={deprecate:$ee()},lrr=O6e(),Gee=require("buffer").Buffer,KGs=global.Uint8Array||function(){};function WGs(e){return Gee.from(e)}o(WGs,"_uint8ArrayToBuffer");function QGs(e){return Gee.isBuffer(e)||e instanceof KGs}o(QGs,"_isUint8Array");var $6e=B6e(),YGs=U6e(),ZGs=YGs.getHighWaterMark,o0=a0().codes,JGs=o0.ERR_INVALID_ARG_TYPE,e6s=o0.ERR_METHOD_NOT_IMPLEMENTED,t6s=o0.ERR_MULTIPLE_CALLBACK,r6s=o0.ERR_STREAM_CANNOT_PIPE,n6s=o0.ERR_STREAM_DESTROYED,i6s=o0.ERR_STREAM_NULL_VALUES,s6s=o0.ERR_STREAM_WRITE_AFTER_END,a6s=o0.ERR_UNKNOWN_ENCODING,Tx=$6e.errorOrDestroy;dc()(No,lrr);function o6s(){}o(o6s,"nop");function lL(e,t,r){kx=kx||uC(),e=e||{},typeof r!="boolean"&&(r=t instanceof kx),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=ZGs(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=e.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){p6s(t,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new crr(this)}o(lL,"WritableState");lL.prototype.getBuffer=o(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(lL.prototype,"buffer",{get:XGs.deprecate(o(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var Hee;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Hee=Function.prototype[Symbol.hasInstance],Object.defineProperty(No,Symbol.hasInstance,{value:o(function(t){return Hee.call(this,t)?!0:this!==No?!1:t&&t._writableState instanceof lL},"value")})):Hee=o(function(t){return t instanceof this},"realHasInstance");function No(e){kx=kx||uC();var t=this instanceof kx;if(!t&&!Hee.call(No,this))return new No(e);this._writableState=new lL(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),lrr.call(this)}o(No,"Writable");No.prototype.pipe=function(){Tx(this,new r6s)};function c6s(e,t){var r=new s6s;Tx(e,r),process.nextTick(t,r)}o(c6s,"writeAfterEnd");function l6s(e,t,r,n){var i;return r===null?i=new i6s:typeof r!="string"&&!t.objectMode&&(i=new JGs("chunk",["string","Buffer"],r)),i?(Tx(e,i),process.nextTick(n,i),!1):!0}o(l6s,"validChunk");No.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&QGs(e);return s&&!Gee.isBuffer(e)&&(e=WGs(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=o6s),n.ending?c6s(this,r):(s||l6s(this,n,e,r))&&(n.pendingcb++,i=u6s(this,n,s,e,t,r)),i};No.prototype.cork=function(){this._writableState.corked++};No.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&urr(this,e))};No.prototype.setDefaultEncoding=o(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new a6s(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty(No.prototype,"writableBuffer",{enumerable:!1,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function d6s(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Gee.from(t,r)),t}o(d6s,"decodeChunk");Object.defineProperty(No.prototype,"writableHighWaterMark",{enumerable:!1,get:o(function(){return this._writableState.highWaterMark},"get")});function u6s(e,t,r,n,i,s){if(!r){var a=d6s(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var c=t.objectMode?1:n.length;t.length+=c;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else G6e(e,t,!1,c,n,i,s);return l}o(u6s,"writeOrBuffer");function G6e(e,t,r,n,i,s,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new n6s("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}o(G6e,"doWrite");function m6s(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(dL,e,t),e._writableState.errorEmitted=!0,Tx(e,n)):(i(n),e._writableState.errorEmitted=!0,Tx(e,n),dL(e,t))}o(m6s,"onwriteError");function f6s(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}o(f6s,"onwriteStateUpdate");function p6s(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new t6s;if(f6s(r),t)m6s(e,r,n,t,i);else{var s=mrr(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&urr(e,r),n?process.nextTick(drr,e,r,s,i):drr(e,r,s,i)}}o(p6s,"onwrite");function drr(e,t,r,n){r||g6s(e,t),t.pendingcb--,n(),dL(e,t)}o(drr,"afterWrite");function g6s(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}o(g6s,"onwriteDrain");function urr(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)i[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;i.allBuffers=c,G6e(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new crr(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,d=r.encoding,m=r.callback,f=t.objectMode?1:l.length;if(G6e(e,t,!1,f,l,d,m),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}o(urr,"clearBuffer");No.prototype._write=function(e,t,r){r(new e6s("_write()"))};No.prototype._writev=null;No.prototype.end=function(e,t,r){var n=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||w6s(this,n,r),this};Object.defineProperty(No.prototype,"writableLength",{enumerable:!1,get:o(function(){return this._writableState.length},"get")});function mrr(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}o(mrr,"needFinish");function h6s(e,t){e._final(function(r){t.pendingcb--,r&&Tx(e,r),t.prefinished=!0,e.emit("prefinish"),dL(e,t)})}o(h6s,"callFinal");function y6s(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(h6s,e,t)):(t.prefinished=!0,e.emit("prefinish")))}o(y6s,"prefinish");function dL(e,t){var r=mrr(t);if(r&&(y6s(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}o(dL,"finishMaybe");function w6s(e,t,r){t.ending=!0,dL(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}o(w6s,"endWritable");function v6s(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}o(v6s,"onCorkedFinish");Object.defineProperty(No.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:o(function(t){!this._writableState||(this._writableState.destroyed=t)},"set")});No.prototype.destroy=$6e.destroy;No.prototype._undestroy=$6e.undestroy;No.prototype._destroy=function(e,t){t(e)}});var uC=h((Q2o,grr)=>{"use strict";var _6s=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};grr.exports=ah;var prr=K6e(),V6e=H6e();dc()(ah,prr);for(X6e=_6s(V6e.prototype),Vee=0;Vee<X6e.length;Vee++)Xee=X6e[Vee],ah.prototype[Xee]||(ah.prototype[Xee]=V6e.prototype[Xee]);var X6e,Xee,Vee;function ah(e){if(!(this instanceof ah))return new ah(e);prr.call(this,e),V6e.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",b6s)))}o(ah,"Duplex");Object.defineProperty(ah.prototype,"writableHighWaterMark",{enumerable:!1,get:o(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ah.prototype,"writableBuffer",{enumerable:!1,get:o(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ah.prototype,"writableLength",{enumerable:!1,get:o(function(){return this._writableState.length},"get")});function b6s(){this._writableState.ended||process.nextTick(S6s,this)}o(b6s,"onend");function S6s(e){e.end()}o(S6s,"onEndNT");Object.defineProperty(ah.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:o(function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")})});var Kee=h((Y2o,wrr)=>{"use strict";var hrr=a0().codes.ERR_STREAM_PREMATURE_CLOSE;function C6s(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}o(C6s,"once");function E6s(){}o(E6s,"noop");function A6s(e){return e.setHeader&&typeof e.abort=="function"}o(A6s,"isRequest");function yrr(e,t,r){if(typeof t=="function")return yrr(e,null,t);t||(t={}),r=C6s(r||E6s);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=o(function(){e.writable||c()},"onlegacyfinish"),a=e._writableState&&e._writableState.finished,c=o(function(){i=!1,a=!0,n||r.call(e)},"onfinish"),l=e._readableState&&e._readableState.endEmitted,d=o(function(){n=!1,l=!0,i||r.call(e)},"onend"),m=o(function(w){r.call(e,w)},"onerror"),f=o(function(){var w;if(n&&!l)return(!e._readableState||!e._readableState.ended)&&(w=new hrr),r.call(e,w);if(i&&!a)return(!e._writableState||!e._writableState.ended)&&(w=new hrr),r.call(e,w)},"onclose"),g=o(function(){e.req.on("finish",c)},"onrequest");return A6s(e)?(e.on("complete",c),e.on("abort",f),e.req?g():e.on("request",g)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",d),e.on("finish",c),t.error!==!1&&e.on("error",m),e.on("close",f),function(){e.removeListener("complete",c),e.removeListener("abort",f),e.removeListener("request",g),e.req&&e.req.removeListener("finish",c),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",c),e.removeListener("end",d),e.removeListener("error",m),e.removeListener("close",f)}}o(yrr,"eos");wrr.exports=yrr});var _rr=h((Z2o,vrr)=>{"use strict";var Wee;function c0(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(c0,"_defineProperty");var P6s=Kee(),l0=Symbol("lastResolve"),mC=Symbol("lastReject"),uL=Symbol("error"),Qee=Symbol("ended"),fC=Symbol("lastPromise"),W6e=Symbol("handlePromise"),pC=Symbol("stream");function d0(e,t){return{value:e,done:t}}o(d0,"createIterResult");function x6s(e){var t=e[l0];if(t!==null){var r=e[pC].read();r!==null&&(e[fC]=null,e[l0]=null,e[mC]=null,t(d0(r,!1)))}}o(x6s,"readAndResolve");function R6s(e){process.nextTick(x6s,e)}o(R6s,"onReadable");function k6s(e,t){return function(r,n){e.then(function(){if(t[Qee]){r(d0(void 0,!0));return}t[W6e](r,n)},n)}}o(k6s,"wrapForNext");var T6s=Object.getPrototypeOf(function(){}),I6s=Object.setPrototypeOf((Wee={get stream(){return this[pC]},next:o(function(){var t=this,r=this[uL];if(r!==null)return Promise.reject(r);if(this[Qee])return Promise.resolve(d0(void 0,!0));if(this[pC].destroyed)return new Promise(function(a,c){process.nextTick(function(){t[uL]?c(t[uL]):a(d0(void 0,!0))})});var n=this[fC],i;if(n)i=new Promise(k6s(n,this));else{var s=this[pC].read();if(s!==null)return Promise.resolve(d0(s,!1));i=new Promise(this[W6e])}return this[fC]=i,i},"next")},c0(Wee,Symbol.asyncIterator,function(){return this}),c0(Wee,"return",o(function(){var t=this;return new Promise(function(r,n){t[pC].destroy(null,function(i){if(i){n(i);return}r(d0(void 0,!0))})})},"_return")),Wee),T6s),q6s=o(function(t){var r,n=Object.create(I6s,(r={},c0(r,pC,{value:t,writable:!0}),c0(r,l0,{value:null,writable:!0}),c0(r,mC,{value:null,writable:!0}),c0(r,uL,{value:null,writable:!0}),c0(r,Qee,{value:t._readableState.endEmitted,writable:!0}),c0(r,W6e,{value:o(function(s,a){var c=n[pC].read();c?(n[fC]=null,n[l0]=null,n[mC]=null,s(d0(c,!1))):(n[l0]=s,n[mC]=a)},"value"),writable:!0}),r));return n[fC]=null,P6s(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[mC];s!==null&&(n[fC]=null,n[l0]=null,n[mC]=null,s(i)),n[uL]=i;return}var a=n[l0];a!==null&&(n[fC]=null,n[l0]=null,n[mC]=null,a(d0(void 0,!0))),n[Qee]=!0}),t.on("readable",R6s.bind(null,n)),n},"createReadableStreamAsyncIterator");vrr.exports=q6s});var Err=h((J2o,Crr)=>{"use strict";function brr(e,t,r,n,i,s,a){try{var c=e[s](a),l=c.value}catch(d){r(d);return}c.done?t(l):Promise.resolve(l).then(n,i)}o(brr,"asyncGeneratorStep");function D6s(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function a(l){brr(s,n,i,a,c,"next",l)}o(a,"_next");function c(l){brr(s,n,i,a,c,"throw",l)}o(c,"_throw"),a(void 0)})}}o(D6s,"_asyncToGenerator");function Srr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}o(Srr,"ownKeys");function N6s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Srr(Object(r),!0).forEach(function(n){L6s(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Srr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}o(N6s,"_objectSpread");function L6s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(L6s,"_defineProperty");var M6s=a0().codes.ERR_INVALID_ARG_TYPE;function z6s(e,t,r){var n;if(t&&typeof t.next=="function")n=t;else if(t&&t[Symbol.asyncIterator])n=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])n=t[Symbol.iterator]();else throw new M6s("iterable",["Iterable"],t);var i=new e(N6s({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,a())};function a(){return c.apply(this,arguments)}o(a,"next");function c(){return c=D6s(function*(){try{var l=yield n.next(),d=l.value,m=l.done;m?i.push(null):i.push(yield d)?a():s=!1}catch(f){i.destroy(f)}}),c.apply(this,arguments)}return o(c,"_next2"),i}o(z6s,"from");Crr.exports=z6s});var K6e=h((tjo,Nrr)=>{"use strict";Nrr.exports=Ws;var Ix;Ws.ReadableState=Prr;var ejo=require("events").EventEmitter,Arr=o(function(t,r){return t.listeners(r).length},"EElistenerCount"),mL=O6e(),Yee=require("buffer").Buffer,O6s=global.Uint8Array||function(){};function F6s(e){return Yee.from(e)}o(F6s,"_uint8ArrayToBuffer");function j6s(e){return Yee.isBuffer(e)||e instanceof O6s}o(j6s,"_isUint8Array");var Q6e=require("util"),bs;Q6e&&Q6e.debuglog?bs=Q6e.debuglog("stream"):bs=o(function(){},"debug");var B6s=err(),Y6e=B6e(),U6s=U6e(),$6s=U6s.getHighWaterMark,Zee=a0().codes,G6s=Zee.ERR_INVALID_ARG_TYPE,H6s=Zee.ERR_STREAM_PUSH_AFTER_EOF,V6s=Zee.ERR_METHOD_NOT_IMPLEMENTED,X6s=Zee.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,qx,Z6e,J6e;dc()(Ws,mL);var fL=Y6e.errorOrDestroy,e4e=["error","close","destroy","pause","resume"];function K6s(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}o(K6s,"prependListener");function Prr(e,t,r){Ix=Ix||uC(),e=e||{},typeof r!="boolean"&&(r=t instanceof Ix),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=$6s(this,e,"readableHighWaterMark",r),this.buffer=new B6s,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(qx||(qx=require("string_decoder/").StringDecoder),this.decoder=new qx(e.encoding),this.encoding=e.encoding)}o(Prr,"ReadableState");function Ws(e){if(Ix=Ix||uC(),!(this instanceof Ws))return new Ws(e);var t=this instanceof Ix;this._readableState=new Prr(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),mL.call(this)}o(Ws,"Readable");Object.defineProperty(Ws.prototype,"destroyed",{enumerable:!1,get:o(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:o(function(t){!this._readableState||(this._readableState.destroyed=t)},"set")});Ws.prototype.destroy=Y6e.destroy;Ws.prototype._undestroy=Y6e.undestroy;Ws.prototype._destroy=function(e,t){t(e)};Ws.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=Yee.from(e,t),t=""),n=!0),xrr(this,e,t,!1,n)};Ws.prototype.unshift=function(e){return xrr(this,e,null,!0,!1)};function xrr(e,t,r,n,i){bs("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,Y6s(e,s);else{var a;if(i||(a=W6s(s,t)),a)fL(e,a);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==Yee.prototype&&(t=F6s(t)),n)s.endEmitted?fL(e,new X6s):t4e(e,s,t,!0);else if(s.ended)fL(e,new H6s);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?t4e(e,s,t,!1):r4e(e,s)):t4e(e,s,t,!1)}else n||(s.reading=!1,r4e(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}o(xrr,"readableAddChunk");function t4e(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Jee(e)),r4e(e,t)}o(t4e,"addChunk");function W6s(e,t){var r;return!j6s(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new G6s("chunk",["string","Buffer","Uint8Array"],t)),r}o(W6s,"chunkInvalid");Ws.prototype.isPaused=function(){return this._readableState.flowing===!1};Ws.prototype.setEncoding=function(e){qx||(qx=require("string_decoder/").StringDecoder);var t=new qx(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var Rrr=1073741824;function Q6s(e){return e>=Rrr?e=Rrr:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}o(Q6s,"computeNewHighWaterMark");function krr(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=Q6s(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}o(krr,"howMuchToRead");Ws.prototype.read=function(e){bs("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return bs("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?i4e(this):Jee(this),null;if(e=krr(e,t),e===0&&t.ended)return t.length===0&&i4e(this),null;var n=t.needReadable;bs("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,bs("length less than watermark",n)),t.ended||t.reading?(n=!1,bs("reading or ended",n)):n&&(bs("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=krr(r,t)));var i;return e>0?i=qrr(e,t):i=null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&i4e(this)),i!==null&&this.emit("data",i),i};function Y6s(e,t){if(bs("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Jee(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,Trr(e)))}}o(Y6s,"onEofChunk");function Jee(e){var t=e._readableState;bs("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(bs("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(Trr,e))}o(Jee,"emitReadable");function Trr(e){var t=e._readableState;bs("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,n4e(e)}o(Trr,"emitReadable_");function r4e(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(Z6s,e,t))}o(r4e,"maybeReadMore");function Z6s(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(bs("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}o(Z6s,"maybeReadMore_");Ws.prototype._read=function(e){fL(this,new V6s("_read()"))};Ws.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,bs("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?c:v;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",a);function a(b,S){bs("onunpipe"),b===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,m())}o(a,"onunpipe");function c(){bs("onend"),e.end()}o(c,"onend");var l=J6s(r);e.on("drain",l);var d=!1;function m(){bs("cleanup"),e.removeListener("close",y),e.removeListener("finish",w),e.removeListener("drain",l),e.removeListener("error",g),e.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",v),r.removeListener("data",f),d=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}o(m,"cleanup"),r.on("data",f);function f(b){bs("ondata");var S=e.write(b);bs("dest.write",S),S===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&Drr(n.pipes,e)!==-1)&&!d&&(bs("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}o(f,"ondata");function g(b){bs("onerror",b),v(),e.removeListener("error",g),Arr(e,"error")===0&&fL(e,b)}o(g,"onerror"),K6s(e,"error",g);function y(){e.removeListener("finish",w),v()}o(y,"onclose"),e.once("close",y);function w(){bs("onfinish"),e.removeListener("close",y),v()}o(w,"onfinish"),e.once("finish",w);function v(){bs("unpipe"),r.unpipe(e)}return o(v,"unpipe"),e.emit("pipe",r),n.flowing||(bs("pipe resume"),r.resume()),e};function J6s(e){return o(function(){var r=e._readableState;bs("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Arr(e,"data")&&(r.flowing=!0,n4e(e))},"pipeOnDrainFunctionResult")}o(J6s,"pipeOnDrain");Ws.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=Drr(t.pipes,e);return a===-1?this:(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};Ws.prototype.on=function(e,t){var r=mL.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,bs("on readable",n.length,n.reading),n.length?Jee(this):n.reading||process.nextTick(e4s,this)),r};Ws.prototype.addListener=Ws.prototype.on;Ws.prototype.removeListener=function(e,t){var r=mL.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(Irr,this),r};Ws.prototype.removeAllListeners=function(e){var t=mL.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(Irr,this),t};function Irr(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}o(Irr,"updateReadableListening");function e4s(e){bs("readable nexttick read 0"),e.read(0)}o(e4s,"nReadingNextTick");Ws.prototype.resume=function(){var e=this._readableState;return e.flowing||(bs("resume"),e.flowing=!e.readableListening,t4s(this,e)),e.paused=!1,this};function t4s(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(r4s,e,t))}o(t4s,"resume");function r4s(e,t){bs("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),n4e(e),t.flowing&&!t.reading&&e.read(0)}o(r4s,"resume_");Ws.prototype.pause=function(){return bs("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(bs("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function n4e(e){var t=e._readableState;for(bs("flow",t.flowing);t.flowing&&e.read()!==null;);}o(n4e,"flow");Ws.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(bs("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();a&&a.length&&t.push(a)}t.push(null)}),e.on("data",function(a){if(bs("wrapped data"),r.decoder&&(a=r.decoder.write(a)),!(r.objectMode&&a==null)&&!(!r.objectMode&&(!a||!a.length))){var c=t.push(a);c||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=o(function(c){return o(function(){return e[c].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<e4e.length;s++)e.on(e4e[s],this.emit.bind(this,e4e[s]));return this._read=function(a){bs("wrapped _read",a),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(Ws.prototype[Symbol.asyncIterator]=function(){return Z6e===void 0&&(Z6e=_rr()),Z6e(this)});Object.defineProperty(Ws.prototype,"readableHighWaterMark",{enumerable:!1,get:o(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(Ws.prototype,"readableBuffer",{enumerable:!1,get:o(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(Ws.prototype,"readableFlowing",{enumerable:!1,get:o(function(){return this._readableState.flowing},"get"),set:o(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});Ws._fromList=qrr;Object.defineProperty(Ws.prototype,"readableLength",{enumerable:!1,get:o(function(){return this._readableState.length},"get")});function qrr(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}o(qrr,"fromList");function i4e(e){var t=e._readableState;bs("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(n4s,t,e))}o(i4e,"endReadable");function n4s(e,t){if(bs("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}o(n4s,"endReadableNT");typeof Symbol=="function"&&(Ws.from=function(e,t){return J6e===void 0&&(J6e=Err()),J6e(Ws,e,t)});function Drr(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}o(Drr,"indexOf")});var s4e=h((rjo,Mrr)=>{"use strict";Mrr.exports=Rw;var ete=a0().codes,i4s=ete.ERR_METHOD_NOT_IMPLEMENTED,s4s=ete.ERR_MULTIPLE_CALLBACK,a4s=ete.ERR_TRANSFORM_ALREADY_TRANSFORMING,o4s=ete.ERR_TRANSFORM_WITH_LENGTH_0,tte=uC();dc()(Rw,tte);function c4s(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new s4s);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}o(c4s,"afterTransform");function Rw(e){if(!(this instanceof Rw))return new Rw(e);tte.call(this,e),this._transformState={afterTransform:c4s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",l4s)}o(Rw,"Transform");function l4s(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Lrr(e,t,r)}):Lrr(this,null,null)}o(l4s,"prefinish");Rw.prototype.push=function(e,t){return this._transformState.needTransform=!1,tte.prototype.push.call(this,e,t)};Rw.prototype._transform=function(e,t,r){r(new i4s("_transform()"))};Rw.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Rw.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Rw.prototype._destroy=function(e,t){tte.prototype._destroy.call(this,e,function(r){t(r)})};function Lrr(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new o4s;if(e._transformState.transforming)throw new a4s;return e.push(null)}o(Lrr,"done")});var Frr=h((njo,Orr)=>{"use strict";Orr.exports=pL;var zrr=s4e();dc()(pL,zrr);function pL(e){if(!(this instanceof pL))return new pL(e);zrr.call(this,e)}o(pL,"PassThrough");pL.prototype._transform=function(e,t,r){r(null,e)}});var Grr=h((ijo,$rr)=>{"use strict";var a4e;function d4s(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}o(d4s,"once");var jrr=a0().codes,u4s=jrr.ERR_MISSING_ARGS,m4s=jrr.ERR_STREAM_DESTROYED;function Brr(e){if(e)throw e}o(Brr,"noop");function f4s(e){return e.setHeader&&typeof e.abort=="function"}o(f4s,"isRequest");function p4s(e,t,r,n){n=d4s(n);var i=!1;e.on("close",function(){i=!0}),a4e===void 0&&(a4e=Kee()),a4e(e,{readable:t,writable:r},function(a){if(a)return n(a);i=!0,n()});var s=!1;return function(a){if(!i&&!s){if(s=!0,f4s(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(a||new m4s("pipe"))}}}o(p4s,"destroyer");function Urr(e){e()}o(Urr,"call");function g4s(e,t){return e.pipe(t)}o(g4s,"pipe");function h4s(e){return!e.length||typeof e[e.length-1]!="function"?Brr:e.pop()}o(h4s,"popCallback");function y4s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=h4s(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new u4s("streams");var i,s=t.map(function(a,c){var l=c<t.length-1,d=c>0;return p4s(a,l,d,function(m){i||(i=m),m&&s.forEach(Urr),!l&&(s.forEach(Urr),n(i))})});return t.reduce(g4s)}o(y4s,"pipeline");$rr.exports=y4s});var Mf=h((Lf,hL)=>{var gL=require("stream");process.env.READABLE_STREAM==="disable"&&gL?(hL.exports=gL.Readable,Object.assign(hL.exports,gL),hL.exports.Stream=gL):(Lf=hL.exports=K6e(),Lf.Stream=gL||Lf,Lf.Readable=Lf,Lf.Writable=H6e(),Lf.Duplex=uC(),Lf.Transform=s4e(),Lf.PassThrough=Frr(),Lf.finished=Kee(),Lf.pipeline=Grr())});var Xrr=h((sjo,Vrr)=>{Vrr.exports=kw;var w4s=require("util"),Hrr=Mf();w4s.inherits(kw,Hrr.Duplex);function kw(e,t,r){var n=this;if(!(n instanceof kw))return new kw(e,t,r);Hrr.Duplex.call(n,r),n._output=null,n.connect(e,t)}o(kw,"HttpDuplex");kw.prototype.connect=function(e,t){var r=this;r.req=e,r._output=t,r.emit("response",t),t.on("data",function(n){r.push(n)||r._output.pause()}),t.on("end",function(){r.push(null)})};kw.prototype._read=function(e){this._output&&this._output.resume()};kw.prototype._write=function(e,t,r){this.req.write(e,t),r()};kw.prototype.end=function(e,t,r){return this._output.socket.destroy(),this.req.end(e,t,r)};kw.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()}});var Wrr=h((ajo,Krr)=>{var Dx=1e3,Nx=Dx*60,Lx=Nx*60,gC=Lx*24,v4s=gC*7,_4s=gC*365.25;Krr.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return b4s(e);if(r==="number"&&isFinite(e))return t.long?C4s(e):S4s(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function b4s(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*_4s;case"weeks":case"week":case"w":return r*v4s;case"days":case"day":case"d":return r*gC;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Lx;case"minutes":case"minute":case"mins":case"min":case"m":return r*Nx;case"seconds":case"second":case"secs":case"sec":case"s":return r*Dx;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}o(b4s,"parse");function S4s(e){var t=Math.abs(e);return t>=gC?Math.round(e/gC)+"d":t>=Lx?Math.round(e/Lx)+"h":t>=Nx?Math.round(e/Nx)+"m":t>=Dx?Math.round(e/Dx)+"s":e+"ms"}o(S4s,"fmtShort");function C4s(e){var t=Math.abs(e);return t>=gC?rte(e,t,gC,"day"):t>=Lx?rte(e,t,Lx,"hour"):t>=Nx?rte(e,t,Nx,"minute"):t>=Dx?rte(e,t,Dx,"second"):e+" ms"}o(C4s,"fmtLong");function rte(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}o(rte,"plural")});var o4e=h((ojo,Qrr)=>{function E4s(e){r.debug=r,r.default=r,r.coerce=d,r.disable=a,r.enable=s,r.enabled=c,r.humanize=Wrr(),Object.keys(e).forEach(m=>{r[m]=e[m]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(m){let f=0;for(let g=0;g<m.length;g++)f=(f<<5)-f+m.charCodeAt(g),f|=0;return r.colors[Math.abs(f)%r.colors.length]}o(t,"selectColor"),r.selectColor=t;function r(m){let f;function g(...y){if(!g.enabled)return;let w=g,v=Number(new Date),b=v-(f||v);w.diff=b,w.prev=f,w.curr=v,f=v,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let S=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(q,k)=>{if(q==="%%")return q;S++;let j=r.formatters[k];if(typeof j=="function"){let ee=y[S];q=j.call(w,ee),y.splice(S,1),S--}return q}),r.formatArgs.call(w,y),(w.log||r.log).apply(w,y)}return o(g,"debug"),g.namespace=m,g.enabled=r.enabled(m),g.useColors=r.useColors(),g.color=t(m),g.destroy=n,g.extend=i,typeof r.init=="function"&&r.init(g),r.instances.push(g),g}o(r,"createDebug");function n(){let m=r.instances.indexOf(this);return m!==-1?(r.instances.splice(m,1),!0):!1}o(n,"destroy");function i(m,f){let g=r(this.namespace+(typeof f=="undefined"?":":f)+m);return g.log=this.log,g}o(i,"extend");function s(m){r.save(m),r.names=[],r.skips=[];let f,g=(typeof m=="string"?m:"").split(/[\s,]+/),y=g.length;for(f=0;f<y;f++)!g[f]||(m=g[f].replace(/\*/g,".*?"),m[0]==="-"?r.skips.push(new RegExp("^"+m.substr(1)+"$")):r.names.push(new RegExp("^"+m+"$")));for(f=0;f<r.instances.length;f++){let w=r.instances[f];w.enabled=r.enabled(w.namespace)}}o(s,"enable");function a(){let m=[...r.names.map(l),...r.skips.map(l).map(f=>"-"+f)].join(",");return r.enable(""),m}o(a,"disable");function c(m){if(m[m.length-1]==="*")return!0;let f,g;for(f=0,g=r.skips.length;f<g;f++)if(r.skips[f].test(m))return!1;for(f=0,g=r.names.length;f<g;f++)if(r.names[f].test(m))return!0;return!1}o(c,"enabled");function l(m){return m.toString().substring(2,m.toString().length-2).replace(/\.\*\?$/,"*")}o(l,"toNamespace");function d(m){return m instanceof Error?m.stack||m.message:m}return o(d,"coerce"),r.enable(r.load()),r}o(E4s,"setup");Qrr.exports=E4s});var Yrr=h((zf,nte)=>{zf.log=x4s;zf.formatArgs=P4s;zf.save=R4s;zf.load=k4s;zf.useColors=A4s;zf.storage=T4s();zf.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function A4s(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}o(A4s,"useColors");function P4s(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+nte.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}o(P4s,"formatArgs");function x4s(...e){return typeof console=="object"&&console.log&&console.log(...e)}o(x4s,"log");function R4s(e){try{e?zf.storage.setItem("debug",e):zf.storage.removeItem("debug")}catch(t){}}o(R4s,"save");function k4s(){let e;try{e=zf.storage.getItem("debug")}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}o(k4s,"load");function T4s(){try{return localStorage}catch(e){}}o(T4s,"localstorage");nte.exports=o4e()(zf);var{formatters:I4s}=nte.exports;I4s.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var Jrr=h((od,ite)=>{var q4s=require("tty"),c4e=require("util");od.init=F4s;od.log=M4s;od.formatArgs=N4s;od.save=z4s;od.load=O4s;od.useColors=D4s;od.colors=[6,2,3,4,5,1];try{let e=ax();e&&(e.stderr||e).level>=2&&(od.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}od.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function D4s(){return"colors"in od.inspectOpts?Boolean(od.inspectOpts.colors):q4s.isatty(process.stderr.fd)}o(D4s,"useColors");function N4s(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} `;e[0]=s+e[0].split(`
82
82
  `).join(`
83
83
  `+s),e.push(i+"m+"+ite.exports.humanize(this.diff)+"")}else e[0]=L4s()+t+" "+e[0]}o(N4s,"formatArgs");function L4s(){return od.inspectOpts.hideDate?"":new Date().toISOString()+" "}o(L4s,"getDate");function M4s(...e){return process.stderr.write(c4e.format(...e)+`
84
84
  `)}o(M4s,"log");function z4s(e){e?process.env.DEBUG=e:delete process.env.DEBUG}o(z4s,"save");function O4s(){return process.env.DEBUG}o(O4s,"load");function F4s(e){e.inspectOpts={};let t=Object.keys(od.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=od.inspectOpts[t[r]]}o(F4s,"init");ite.exports=o4e()(od);var{formatters:Zrr}=ite.exports;Zrr.o=function(e){return this.inspectOpts.colors=this.useColors,c4e.inspect(e,this.inspectOpts).replace(/\s*\n\s*/g," ")};Zrr.O=function(e){return this.inspectOpts.colors=this.useColors,c4e.inspect(e,this.inspectOpts)}});var yL=h((cjo,l4e)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?l4e.exports=Yrr():l4e.exports=Jrr()});var tnr=h((ljo,enr)=>{var j4s=require("fs");enr.exports=function(e,t,r){t=typeof t!="undefined"?t:`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stacktape",
3
- "version": "1.0.0-alpha.81",
3
+ "version": "1.0.0-alpha.82",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Stacktape - cloud native framework for AWS",
6
6
  "author": "Stacktape team <info@stacktape.com> (https://stacktape.com)",