/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/ssh2shell@2.0.9/lib/ssh2shell.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
(function(){var s,t,e=function(s,t){return function(){return s.apply(t,arguments)}},h={}.hasOwnProperty;t=Array.isArray||function(s){return"[object Array]"==={}.toString.call(s)},s=function(s){function i(s){var h;this._connect=e(this._connect,this),this.connect=e(this.connect,this),this._loadDefaults=e(this._loadDefaults,this),this._initiate=e(this._initiate,this),this._removeListeners=e(this._removeListeners,this),this.close=e(this.close,this),this._runExit=e(this._runExit,this),this._sshConnect=e(this._sshConnect,this),this._nextPrimaryHost=e(this._nextPrimaryHost,this),this._nextHost=e(this._nextHost,this),this._previousHost=e(this._previousHost,this),this._runCommand=e(this._runCommand,this),this._checkCommand=e(this._checkCommand,this),this._nextCommand=e(this._nextCommand,this),this._commandComplete=e(this._commandComplete,this),this._processNotifications=e(this._processNotifications,this),this._processSSHPrompt=e(this._processSSHPrompt,this),this._resetFromSudoError=e(this._resetFromSudoError,this),this._processPasswordPrompt=e(this._processPasswordPrompt,this),this._sanitizeResponse=e(this._sanitizeResponse,this),this._onData=e(this._onData,this),this.onEnd=e(this.onEnd,this),this.onCommandTimeout=e(this.onCommandTimeout,this),this.onCommandComplete=e(this.onCommandComplete,this),this.onCommandProcessing=e(this.onCommandProcessing,this),this._callback=e(this._callback,this),i.__super__.constructor.call(this,s),t(s)&&s.length>0?this._hosts=s:this._hosts=[s],this.ssh2Client=require("ssh2").Client,this.on("msg",(function(s){return console.log(s)})),this.on("newPrimmaryHost",this._nextPrimaryHost),this.on("data",(h=this,function(s){return h._onData(s)})),this.on("stderrData",(function(s){return console.error(s)})),this.on("error",function(s){return function(t,e,h,i){if(null==h&&(h=!1),s.sshObj.debug&&s.emit("msg","Class.error: "+t+", "+e),t instanceof Error?s.emit("msg","Error: "+t.message+", Level: "+t.level):s.emit("msg",e+" error: "+t),h)return s._stream.close()}}(this)),this._hosts[0].server.tryKeyboard&&this.on("keyboard-interactive",function(s){return function(t,e,h,i,o){var r;if(s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Class.keyboard-interactive"),s.sshObj.verbose)return s.emit("msg","name: "+t),s.emit("msg","instructions: "+e),r=JSON.stringify(i,null,4),s.emit("msg","Prompts object: "+r)}}(this)),this._allSessions=""}return function(s,t){for(var e in t)h.call(t,e)&&(s[e]=t[e]);function i(){this.constructor=s}i.prototype=t.prototype,s.prototype=new i,s.__super__=t.prototype}(i,s),i.prototype.sshObj={},i.prototype.command="",i.prototype._hosts=[],i.prototype._sshToNextHost=!1,i.prototype._primaryhostSessionText="",i.prototype._allSessions="",i.prototype._connections=[],i.prototype._stream={},i.prototype._buffer="",i.prototype.idleTime=5e3,i.prototype.asciiFilter="",i.prototype.textColorFilter="",i.prototype.passwordPrompt="",i.prototype.passphrasePrompt="",i.prototype.standardPrompt="",i.prototype._callback=function(){},i.prototype.onCommandProcessing=function(){},i.prototype.onCommandComplete=function(){},i.prototype.onCommandTimeout=function(){},i.prototype.onEnd=function(){},i.prototype._onData=function(s){var t;return this._buffer+=s,this.command.length>0&&!this.standardPrompt.test(this._sanitizeResponse())?(this.emit("commandProcessing",this.command,this._buffer,this.sshObj,this._stream),this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout((t=this,function(){return t.emit("commandTimeout",t.command,t._buffer,t._stream,t.connection)}),this.idleTime)):this.command.length<1&&!this.standardPrompt.test(this._buffer)&&this.emit("commandProcessing",this.command,this._buffer,this.sshObj,this._stream),this.dataReceivedTimer&&clearTimeout(this.dataReceivedTimer),this.dataReceivedTimer=setTimeout(function(s){return function(){switch(s.idleTimer&&clearTimeout(s.idleTimer),s.sshObj.disableColorFilter||(s._buffer=s._buffer.replace(s.textColorFilter,"")),s.sshObj.disableASCIIFilter||(s._buffer=s._buffer.replace(s.asciiFilter,"")),!0){case s.command.length>0&&-1!==s.command.indexOf("sudo "):return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Sudo command data"),s._processPasswordPrompt();case s.sshObj.sshToNextHost&&s.command.length>0&&0===s.command.indexOf("ssh "):return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": SSH command data"),s._processSSHPrompt();case s.command.length>0&&s.standardPrompt.test(s._sanitizeResponse()):return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Normal prompt detected"),s.sshObj.pwSent=!1,s._commandComplete();case s.command.length<1&&s.standardPrompt.test(s._buffer):return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": First prompt detected"),s.sshObj.showBanner&&(s.sshObj.sessionText+=s._buffer),s._nextCommand();default:return s.sshObj.debug&&s.emit("msg","Data processing: data received timeout"),s.idleTimer=setTimeout((function(){return s.emit("commandTimeout",s.command,s._buffer,s._stream,s.connection)}),s.idleTime)}}}(this),this.dataIdleTime)},i.prototype._sanitizeResponse=function(){return this._buffer.replace(this.command.substr(0,this._buffer.length),"")},i.prototype._processPasswordPrompt=function(){var s,t,e,h;switch(t=this._sanitizeResponse().trim(),s=this.passwordPrompt.test(t),e=this.standardPrompt.test(t),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo Password prompt detected: "+s),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo Password prompt: Password sent: "+this.sshObj.pwSent),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo Password: "+this.sshObj.server.password),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Sudo Response: "+t),!0){case s&&!this.sshObj.server.password:return this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo password prompt no password set"),this._resetFromSudoError();case s&&!this.sshObj.pwSent:return this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Sudo password prompt: Buffer: "+t),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo password prompt: Send password "),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Sudo sent password: "+this.sshObj.server.password),this.sshObj.pwSent=!0,this._runCommand(""+this.sshObj.server.password);case s&&this.sshObj.pwSent:return this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Sudo password faied: response: "+t),this.sshObj.debug&&this.emit("error",this.sshObj.server.host+": Sudo password was incorrect for "+this.sshObj.server.userName+", Sudo authentication"),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo failed password prompt: Password: ["+this.sshObj.server.password+"]"),this.sshObj.pwSent=!1,this._resetFromSudoError();case e:return this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Sudo password accepted"),this.sshObj.pwSent=!1,this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Sudo Standard Response: "+t),this._commandComplete();default:return this.idleTimer=setTimeout((h=this,function(){return h.emit("commandTimeout",h.command,t,h._stream,h._connection)}),this.idleTime)}},i.prototype._resetFromSudoError=function(){return this.sshObj.pwSent=!1,this.sshObj.sessionText+=""+this._buffer,this._buffer="",this.command="",this._stream.write("")},i.prototype._processSSHPrompt=function(){var s,t,e,h,i;return e=this._sanitizeResponse().trim(),this.idleTimer&&clearTimeout(this.idleTimer),t=this.passwordPrompt.test(e)&&!this.sshObj.server.hasOwnProperty("passPhrase"),s=this.passphrasePrompt.test(e)&&this.sshObj.server.hasOwnProperty("passPhrase"),h=this.standardPrompt.test(e),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": SSH: Password previously sent: "+this.sshObj.sshAuth),this.sshObj.sshAuth?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH post authentication prompt detection"),h?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH complete: normal prompt"),this.sshObj.showBanner&&(this.sshObj.sessionText+="\n "+e),this.sshObj.exitCommands.push("exit"),this.emit("msg",""+this.sshObj.connectedMessage),this.emit("msg",""+this.sshObj.readyMessage),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH complete: next command"),this.sshObj.sshToNextHost=!1,this._nextCommand()):t||s?(this.emit("msg",this.sshObj.server.host+": SSH authentication failed"),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH auth failed"),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": SSH: failed response: "+e),this.sshObj.sshAuth=!1,i=function(){switch(!1){case!t:return"SSH password: "+this.sshObj.server.password;case!s:return"SSH passphrase: "+this.sshObj.server.passPhrase}}.call(this),this.emit("error",this.sshObj.server.host+": SSH authentication failed for "+this.sshObj.server.userName+"@"+this.sshObj.server.host,"Nested host authentication"),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH auth failed: Using "+i),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": SSH response: "+e),this._connections.length>0?this._previousHost():this._runExit()):void 0):(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": First SSH prompt detection"),t?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH send password"),this.sshObj.sshAuth=!0,this._buffer="",this._runCommand(""+this.sshObj.server.password)):s?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH send passphrase"),this.sshObj.sshAuth=!0,this._buffer="",this._runCommand(""+this.sshObj.server.passPhrase)):h?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH standard prompt: connection failed"),this.emit("msg",this.sshObj.server.host+": SSH connection failed"),this.emit("msg",this.sshObj.server.host+": SSH failed response: "+e),this.sshObj.sessionText+=this.sshObj.server.host+": SSH failed: response: "+e,this._runExit()):(this.emit("msg",this.sshObj.server.host+": SSH no prompt was not detected"),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": SSH response: "+e),this.sshObj.verbose&&!this.sshObj.server.hasOwnProperty("password")&&this.emit("msg",this.sshObj.server.host+": SSH password prompt: "+this.sshObj.passwordPrompt),this.sshObj.verbose&&this.sshObj.server.hasOwnProperty("passPhrase")&&this.emit("msg",this.sshObj.server.host+": SSH passphrase prompt: "+this.sshObj.passphrasePrompt),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": SSH standard prompt: "+this.sshObj.standardPrompt),this._runExit()))},i.prototype._processNotifications=function(){var s,t;if(this.command)return(t=this.command.match(/^`(.*)`$/))?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Notifications: sessionText output"),this._connections.length>0?this.sshObj.sessionText+=this.sshObj.server.host+": Note: "+t[1]+this.sshObj.enter:this.sshObj.sessionText+="Note: "+t[1]+this.sshObj.enter,this.sshObj.verbose&&this.emit("msg",t[1]),this._nextCommand()):(s=this.command.match(/^msg:(.*)$/))?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Notifications: msg to output"),this.emit("msg",this.sshObj.server.host+": Note: "+s[1]),this._nextCommand()):(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Notifications: Normal Command to run"),this._checkCommand())},i.prototype._commandComplete=function(){var s;return s=this._buffer.trim(),""!==this.command&&"exit"!==this.command&&!0!==this.sshObj.sshToNextHost&&(this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Command complete:\nCommand:\n "+this.command+"\nResponse: "+s),this.sshObj.sessionText+=s,this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Raising commandComplete event"),this.emit("commandComplete",this.command,this._buffer,this.sshObj)),this._nextCommand()},i.prototype._nextCommand=function(){return this._buffer="",this.sshObj.commands.length>0?(this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Host.commands: "+this.sshObj.commands),this.command=this.sshObj.commands.shift(),this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Next command from host.commands: "+this.command),this._processNotifications()):(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": No commands so exit"),this._runExit())},i.prototype._checkCommand=function(){return""!==this.command?this._runCommand(this.command):(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": No command so exit"),this._runExit())},i.prototype._runCommand=function(s){return this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": sending: "+s),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": run command"),this._stream.write(""+s+this.sshObj.enter)},i.prototype._previousHost=function(){return this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Load previous host config"),this.emit("end",this.sshObj.server.host+": \n"+this.sshObj.sessionText,this.sshObj),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Previous hosts: "+this._connections.length),this._connections.length>0?(this.sshObj=this._connections.pop(),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Reload previous host"),this._runExit()):this._runExit()},i.prototype._nextHost=function(){var s;return s=this.sshObj.hosts.shift(),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH to "+s.server.host),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Clearing previous event handlers"),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Remove previous event handlers"),this._removeListeners(),this._connections.push(this.sshObj),this.sshObj=s,this._initiate(this._sshConnect)},i.prototype._nextPrimaryHost=function(s){return this._hosts.length>0?(this.sshObj.server&&(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Current primary host"),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Remove previous event handlers"),this.emit("end",this._primaryhostSessionText,this.sshObj),this._removeListeners()),this.sshObj=this._hosts.shift(),this._primaryhostSessionText=this.sshObj.server.host+": ",this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Next primary host"),this._initiate(s)):(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": No more primary hosts"),this._runExit)},i.prototype._sshConnect=function(){var s,t,e,h;if(e="-x",h="",this.sshObj.server.ssh)for(s in this.sshObj.server.ssh.forceProtocolVersion&&(e+=this.sshObj.server.ssh.forceProtocolVersion),this.sshObj.server.ssh.forceAddressType&&(e+=this.sshObj.server.ssh.forceAddressType),this.sshObj.server.ssh.disablePseudoTTY&&(e+="T"),this.sshObj.server.ssh.forcePseudoTTY&&(e+="t"),this.sshObj.server.ssh.verbose&&(e+="v"),this.sshObj.server.ssh.cipherSpec&&(h+=" -c "+this.sshObj.server.ssh.cipherSpec),this.sshObj.server.ssh.escape&&(h+=" -e "+this.sshObj.server.ssh.escape),this.sshObj.server.ssh.logFile&&(h+=" -E "+this.sshObj.server.ssh.logFile),this.sshObj.server.ssh.configFile&&(h+=" -F "+this.sshObj.server.ssh.configFile),this.sshObj.server.ssh.identityFile&&(h+=" -i "+this.sshObj.server.ssh.identityFile),this.sshObj.server.ssh.loginName&&(h+=" -l "+this.sshObj.server.ssh.loginName),this.sshObj.server.ssh.macSpec&&(h+=" -m "+this.sshObj.server.ssh.macSpec),t=this.sshObj.server.ssh.Options)t[s],h+=' -o "#{option}={#value}"';return h+=' -o "StrictHostKeyChecking=no"',h+=" -p "+this.sshObj.server.port,this.sshObj.sshAuth=!1,this.sshObj.sshToNextHost=!0,this.command="ssh "+e+" "+h+" "+this.sshObj.server.userName+"@"+this.sshObj.server.host,this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": SSH command: connect"),this._runCommand(this.command)},i.prototype._runExit=function(){return this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Process an exit"),this.sshObj.exitCommands&&this.sshObj.exitCommands.length>0?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Queued exit commands: "+this.sshObj.exitCommands.length),this.command=this.sshObj.exitCommands.pop(),this._connections&&this._connections.length>0&&(this.sshObj.verbose&&this.emit("msg",this.sshObj.server.host+": Primary host: "+this._connections[0].server.host),this._connections[0].sessionText+="\n"+this.sshObj.server.host+": "+this.sshObj.sessionText),this._runCommand(this.command)):this.sshObj.hosts&&this.sshObj.hosts.length>0?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Next host from this host"),this._nextHost()):this._connections&&this._connections.length>0?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": load previous host"),this.emit("msg",this.sshObj.server.host+": "+this.sshObj.closedMessage),this._previousHost()):"exit"===this.command?(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Manual exit command"),this._runCommand("exit")):this.close()},i.prototype.close=function(){return this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Exit command: Stream: close"),this._stream.close()},i.prototype._removeListeners=function(){if("function"==typeof this.sshObj.onKeyboardInteractive&&this.removeListener("keyboard-interactive",this.sshObj.onKeyboardInteractive),"function"==typeof this.sshObj.onStderrData&&this.removeListener("stderrData",this.sshObj.onStderrData),"function"==typeof this.sshObj.onData&&this.removeListener("data",this.sshObj.onData),"function"==typeof this.sshObj.onError&&this.removeListener("error",this.sshObj.onError),"function"==typeof this.sshObj.onStderrData&&this.removeListener("stderrData",this.sshObj.onStderrData),"function"==typeof this.sshObj.onEnd&&this.removeListener("end",this.sshObj.onEnd),"function"==typeof this.sshObj.onCommandProcessing&&this.removeListener("commandProcessing",this.sshObj.onCommandProcessing),"function"==typeof this.sshObj.onCommandComplete&&this.removeListener("commandComplete",this.sshObj.onCommandComplete),"function"==typeof this.sshObj.onCommandTimeout&&this.removeListener("commandTimeout",this.sshObj.onCommandTimeout),"function"==typeof this.sshObj.msg&&this.removeListener("msg",this.sshObj.msg),this.idleTimer&&clearTimeout(this.idleTimer),this.dataReceivedTimer)return clearTimeout(this.dataReceivedTimer)},i.prototype._initiate=function(s){if(this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": initiate"),this._loadDefaults(),"function"==typeof s)return s()},i.prototype._loadDefaults=function(){var s,t,e,h,i,o,r,n;if(this.sshObj.msg&&this.sshObj.msg.send&&"function"==typeof this.sshObj.msg.send&&(this.sshObj.msg=this.sshObj.msg.send),this.listenerCount("msg")>0&&this.removeAllListeners("msg"),"function"==typeof this.sshObj.msg?this.on("msg",this.sshObj.msg):this.on("msg",(function(s){return console.log(s)})),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Load Defaults"),this.command="",this._buffer="",this.sshObj.sshToNextHost=!1,this.sshObj.connectedMessage||(this.sshObj.connectedMessage="Connected"),this.sshObj.readyMessage||(this.sshObj.readyMessage="Ready"),this.sshObj.closedMessage||(this.sshObj.closedMessage="Closed"),this.sshObj.showBanner||(this.sshObj.showBanner=!1),this.sshObj.verbose||(this.sshObj.verbose=!1),this.sshObj.debug||(this.sshObj.debug=!1),this.sshObj.hosts||(this.sshObj.hosts=[]),this.sshObj.commands||(this.sshObj.commands=[]),this.sshObj.standardPrompt||(this.sshObj.standardPrompt=">$%#"),this.sshObj.passwordPrompt||(this.sshObj.passwordPrompt=this.sshObj.passwordPromt),this.sshObj.passphrasePrompt||(this.sshObj.passphrasePrompt=this.sshObj.passphrasePromt),this.sshObj.passwordPrompt||(this.sshObj.passwordPrompt=":"),this.sshObj.passphrasePrompt||(this.sshObj.passphrasePrompt=":"),this.sshObj.passPromptText||(this.sshObj.passPromptText="Password"),this.sshObj.enter||(this.sshObj.enter="\n"),this.sshObj.asciiFilter||(this.sshObj.asciiFilter="[^\r\n -~]"),!0!==this.sshObj.disableColorFilter&&(this.sshObj.disableColorFilter=!1),!0!==this.sshObj.disableASCIIFilter&&(this.sshObj.disableASCIIFilter=!1),this.sshObj.textColorFilter||(this.sshObj.textColorFilter="([{1}[0-9;]+m{1})"),this.sshObj.exitCommands||(this.sshObj.exitCommands=[]),this.sshObj.pwSent=!1,this.sshObj.sshAuth=!1,this.sshObj.server.hashKey=null!=(s=this.sshObj.server.hashKey)?s:"",this.sshObj.sessionText||(this.sshObj.sessionText=""),this.sshObj.streamEncoding=null!=(t=this.sshObj.streamEncoding)?t:"utf8",this.sshObj.window||(this.sshObj.window=!0),this.sshObj.pty||(this.sshObj.pty=!0),this.idleTime=null!=(e=this.sshObj.idleTimeOut)?e:5e3,this.dataIdleTime=null!=(h=this.sshObj.dataIdleTime)?h:500,this.asciiFilter||(this.asciiFilter=new RegExp(this.sshObj.asciiFilter,"g")),this.textColorFilter||(this.textColorFilter=new RegExp(this.sshObj.textColorFilter,"g")),this.passwordPrompt||(this.passwordPrompt=new RegExp(this.sshObj.passPromptText+".*"+this.sshObj.passwordPrompt+"\\s?$","i")),this.passphrasePrompt||(this.passphrasePrompt=new RegExp(this.sshObj.passPromptText+".*"+this.sshObj.passphrasePrompt+"\\s?$","i")),this.standardPrompt||(this.standardPrompt=new RegExp("["+this.sshObj.standardPrompt+"]\\s?$")),this.sshObj.onCommandProcessing=null!=(i=this.sshObj.onCommandProcessing)?i:function(s,t,e,h){},this.sshObj.onCommandComplete=null!=(o=this.sshObj.onCommandComplete)?o:(n=this,function(s,t,e){if(n.sshObj.debug)return n.emit("msg",n.sshObj.server.host+": Class.commandComplete")}),this.sshObj.onCommandTimeout=null!=(r=this.sshObj.onCommandTimeout)?r:function(s){return function(t,e,h,i){return e=e.replace(s.command,""),s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Class.commandTimeout"),s.sshObj.verbose&&s.emit("msg",s.sshObj.server.host+": Timeout command: "+t+" response: "+e),s.emit("error",s.sshObj.server.host+": Command timed out after "+s.idleTime/1e3+" seconds","Timeout",!0,(function(s,t){})),s.sshObj.sessionText+=s._buffer}}(this),"function"==typeof this.sshObj.onKeyboardInteractive&&this.on("keyboard-interactive",this.sshObj.onKeyboardInteractive),"function"==typeof this.sshObj.onError&&this.on("error",this.sshObj.onError),"function"==typeof this.sshObj.onData&&this.on("data",this.sshObj.onData),"function"==typeof this.sshObj.onStderrData&&this.on("stderrData",this.sshObj.onStderrData),this.on("commandProcessing",this.sshObj.onCommandProcessing),this.on("commandComplete",this.sshObj.onCommandComplete),this.on("commandTimeout",this.sshObj.onCommandTimeout),"function"==typeof this.sshObj.onEnd&&this.on("end",this.sshObj.onEnd),this.sshObj.debug&&this.emit("msg",this.sshObj.server.host+": Host loaded"),this.sshObj.verbose)return this.emit("msg",this.sshObj)},i.prototype.connect=function(s){return"function"==typeof s&&(this._callback=s),this.emit("newPrimaryHost",this._nextPrimaryHost(this._connect))},i.prototype._connect=function(){var s,t;if(this.connection=new this.ssh2Client,this.connection.on("keyboard-interactive",(t=this,function(s,e,h,i,o){return t.sshObj.debug&&t.emit("msg",t.sshObj.server.host+": Connection.keyboard-interactive"),t.emit("keyboard-interactive",s,e,h,i,o)})),this.connection.on("connect",function(s){return function(){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Connection.connect"),s.emit("msg",s.sshObj.connectedMessage)}}(this)),this.connection.on("ready",function(s){return function(){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Connection.ready"),s.emit("msg",s.sshObj.readyMessage),s.connection.shell(s.sshObj.window,{pty:s.sshObj.pty},(function(t,e){if(s._stream=e,!(t instanceof Error))return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Connection.shell"),s._stream.setEncoding(s.sshObj.streamEncoding),s._stream.on("error",(function(t){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Stream.error"),s.emit("error",t,"Stream")})),s._stream.stderr.on("data",(function(t){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Stream.stderr.data"),s.emit("stderrData",t)})),s._stream.on("data",(function(e){var h;try{return s.emit("data",e)}catch(e){return h=e,(t=new Error(h+" "+h.stack)).level="Data handling",s.emit("error",t,"Stream.read",!0)}})),s._stream.on("finish",(function(){if(s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Stream.finish"),s._primaryhostSessionText+=s.sshObj.sessionText+"\n",s._allSessions+=s._primaryhostSessionText,0===s._hosts.length)return s.emit("end",s._allSessions,s.sshObj)})),s._stream.on("close",(function(t,e){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Stream.close"),s.connection.end()}));s.emit("error",t,"Shell",!0)}))}}(this)),this.connection.on("error",function(s){return function(t){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Connection.error"),s.emit("error",t,"Connection")}}(this)),this.connection.on("close",function(s){return function(t){return s.sshObj.debug&&s.emit("msg",s.sshObj.server.host+": Connection.close"),s.idleTimer&&clearTimeout(s.idleTimer),s.dataReceivedTimer&&clearTimeout(s.dataReceivedTimer),t?s.emit("error",t,"Connection close"):s.emit("msg",s.sshObj.closedMessage),0!==s._hosts.length?s.emit("newPrimaryHost",s._nextPrimaryHost(s._connect)):"function"==typeof s._callback?(s._callback(s._allSessions),s._removeListeners(),s._allSessions):void 0}}(this)),this.sshObj.server&&this.sshObj.commands)try{this.sshObj.server.username||(this.sshObj.server.username=this.sshObj.server.userName),this.sshObj.server.hostHash||(this.sshObj.server.hostHash=this.sshObj.server.hashMethod),this.sshObj.server.passphrase||(this.sshObj.server.passphrase=this.sshObj.server.passPhrase),this.connection.connect(this.sshObj.server)}catch(t){s=t,this.emit("error",s+" "+s.stack,"Connection.connect",!0)}else this.emit("error","Missing connection parameters","Parameters",!1,(function(s,t,e){return this.emit("msg",this.sshObj.server),this.emit("msg",this.sshObj.commands)}));return this._stream},i}(require("stream")),module.exports=s}).call(this);
//# sourceMappingURL=/sm/260d5c474309d0a10c258a9671f1d1af8a923726c873fb17a78e98d990a98078.map