/* eslint-disable */ module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]){return installedModules[moduleId].exports}var module=installedModules[moduleId]={i:moduleId,l:false,exports:{}};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.l=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.d=function(exports,name,getter){if(!__webpack_require__.o(exports,name)){Object.defineProperty(exports,name,{configurable:false,enumerable:true,get:getter})}};__webpack_require__.n=function(module){var getter=module&&module.__esModule?function getDefault(){return module["default"]}:function getModuleExports(){return module};__webpack_require__.d(getter,"a",getter);return getter};__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)};__webpack_require__.p="";return __webpack_require__(__webpack_require__.s=1)}([function(module,exports){module.exports=require("path")},function(module,exports,__webpack_require__){var net=__webpack_require__(2);var util=__webpack_require__(3);var events=__webpack_require__(4);var pathModule=__webpack_require__(0);var fsModule=__webpack_require__(5);var StatMode=__webpack_require__(6);var dateformat=__webpack_require__(7);var glob=__webpack_require__(8);var starttls=__webpack_require__(9);var LOG_ERROR=0;var LOG_WARN=1;var LOG_INFO=2;var LOG_DEBUG=3;var LOG_TRACE=4;exports.LOG_LEVELS={LOG_ERROR:LOG_ERROR,LOG_WARN:LOG_WARN,LOG_INFO:LOG_INFO,LOG_DEBUG:LOG_DEBUG,LOG_TRACE:LOG_TRACE};var EventEmitter=events.EventEmitter;function pathEscape(text){text=text.replace(/"/g,'""');return text}function withCwd(cwd,path){var firstChar=(path||"").charAt(0);cwd=cwd||pathModule.sep;path=path||"";if(firstChar==="/"||firstChar===pathModule.sep){cwd=pathModule.sep}path=pathModule.join(pathModule.sep,cwd,path);return path}function stripOptions(str){var IN_SPACE=0;var IN_DASH=1;var state=IN_SPACE;for(var i=0;ithis.debugging){return}var peerAddr=conn&&conn.socket&&conn.socket.remoteAddress;if(peerAddr){message="<"+peerAddr+"> "+message}if(verbosity===LOG_ERROR){message="ERROR: "+message}else if(verbosity===LOG_WARN){message="WARNING: "+message}console.log(message);var isError=verbosity===LOG_ERROR;if(isError&&this.debugging===LOG_TRACE){console.trace("Trace follows")}};function FtpConnection(properties){EventEmitter.call(this);var self=this;Object.keys(properties).forEach(function(key){self[key]=properties[key]})}util.inherits(FtpConnection,EventEmitter);FtpConnection.prototype.respond=function(message,callback){return this._writeText(this.socket,message+"\r\n",callback)};FtpConnection.prototype._logIf=function(verbosity,message){return this.server._logIf(verbosity,message,this)};FtpConnection.prototype._writeText=function(socket,data,callback){if(!socket.writable){this._logIf(LOG_DEBUG,"Attempted writing to a closed socket:\n>> "+data.trim());return}this._logIf(LOG_TRACE,">> "+data.trim());return socket.write(data,"utf8",callback)};FtpConnection.prototype._authenticated=function(){return!!this.username};FtpConnection.prototype._closeDataConnections=function(){if(this.dataSocket){this._closeSocket(this.dataSocket,true);this.dataSocket=null}if(this.pasv){this.pasv.close();this.pasv=null}};FtpConnection.prototype._createPassiveServer=function(){var self=this;return net.createServer(function(psocket){self._logIf(LOG_INFO,"Passive data event: connect");if(self.secure){self._logIf(LOG_INFO,"Upgrading passive connection to TLS");starttls.starttlsServer(psocket,self.server.options.tlsOptions,function(err,cleartext){if(err){self._logIf(LOG_ERROR,"Error upgrading passive connection to TLS:"+util.inspect(err));self._closeSocket(psocket,true);self.dataConfigured=false}else if(!cleartext.authorized){if(self.server.options.allowUnauthorizedTls){self._logIf(LOG_INFO,"Allowing unauthorized passive connection (allowUnauthorizedTls is on)");switchToSecure()}else{self._logIf(LOG_INFO,"Closing unauthorized passive connection (allowUnauthorizedTls is off)");self._closeSocket(self.socket,true);self.dataConfigured=false}}else{switchToSecure()}function switchToSecure(){self._logIf(LOG_INFO,"Secure passive connection started");self.dataSocket=cleartext;setupPassiveListener()}})}else{self.dataSocket=psocket;setupPassiveListener()}function setupPassiveListener(){if(self.dataListener){self.dataListener.emit("ready")}else{self._logIf(LOG_WARN,"Passive connection initiated, but no data listener")}self.dataSocket.on("close",allOver("close"));self.dataSocket.on("end",allOver("end"));function allOver(ename){return function(err){self._logIf(err?LOG_ERROR:LOG_DEBUG,"Passive data event: "+ename+(err?" due to error":""));self.dataSocket=null}}self.dataSocket.on("error",function(err){self._logIf(LOG_ERROR,"Passive data event: error: "+err);self.dataSocket=null;self.dataConfigured=false})}})};FtpConnection.prototype._whenDataReady=function(callback){var self=this;if(self.dataListener){if(self.dataSocket){self._logIf(LOG_DEBUG,"A data connection exists");callback(self.dataSocket)}else{self._logIf(LOG_DEBUG,"Currently no data connection; expecting client to connect to pasv server shortly...");self.dataListener.once("ready",function(){self._logIf(LOG_DEBUG,"...client has connected now");callback(self.dataSocket)})}}else{if(self.dataSocket){self._logIf(LOG_DEBUG,"Using existing non-passive dataSocket");callback(self.dataSocket)}else{self._initiateData(function(sock){callback(sock)})}}};FtpConnection.prototype._initiateData=function(callback){var self=this;if(self.dataSocket){return callback(self.dataSocket)}var sock=net.connect(self.dataPort,self.dataHost||self.socket.remoteAddress);sock.on("connect",function(){self.dataSocket=sock;callback(sock)});sock.on("end",allOver);sock.on("close",allOver);function allOver(err){self.dataSocket=null;self._logIf(err?LOG_ERROR:LOG_DEBUG,"Non-passive data connection ended"+(err?"due to error: "+util.inspect(err):""))}sock.on("error",function(err){self._closeSocket(sock,true);self._logIf(LOG_ERROR,"Data connection error: "+util.inspect(err));self.dataSocket=null;self.dataConfigured=false})};FtpConnection.prototype._onError=function(err){this._logIf(LOG_ERROR,"Client connection error: "+util.inspect(err));this._closeSocket(this.socket,true)};FtpConnection.prototype._onEnd=function(){this._logIf(LOG_DEBUG,"Client connection ended")};FtpConnection.prototype._onClose=function(hadError){if(this.dataSocket){this._closeSocket(this.dataSocket,hadError);this.dataSocket=null}if(this.socket){this._closeSocket(this.socket,hadError);this.socket=null}if(this.pasv){this.pasv.close();this.pasv=null}this._logIf(LOG_INFO,"Client connection closed")};var DOES_NOT_REQUIRE_AUTH={};["AUTH","FEAT","NOOP","PASS","PBSZ","PROT","QUIT","TYPE","SYST","USER"].forEach(function(c){DOES_NOT_REQUIRE_AUTH[c]=true});var REQUIRES_CONFIGURED_DATA={};["LIST","NLST","RETR","STOR"].forEach(function(c){REQUIRES_CONFIGURED_DATA[c]=true});FtpConnection.prototype._onData=function(data){var self=this;if(self.hasQuit){return}data=data.toString("utf-8").trim();self._logIf(LOG_TRACE,"<< "+data);self._logIf(LOG_INFO,"FTP command: "+data.replace(/^PASS [\s\S]*$/i,"PASS ***"));var command;var commandArg;var index=data.indexOf(" ");if(index!==-1){var parts=data.split(" ");command=parts.shift().toUpperCase();commandArg=parts.join(" ").trim()}else{command=data.toUpperCase();commandArg=""}var m="_command_"+command;if(self[m]){if(self.allowedCommands!=null&&self.allowedCommands[command]!==true){self.respond("502 "+command+" not implemented.")}else if(DOES_NOT_REQUIRE_AUTH[command]){self[m](commandArg,command)}else{if(!self.secure&&self.server.options.tlsOnly){self.respond("522 Protection level not sufficient; send AUTH TLS")}else if(self._authenticated()){checkData()}else{self.respond("530 Not logged in.")}}function checkData(){if(REQUIRES_CONFIGURED_DATA[command]&&!self.dataConfigured){self.respond("425 Data connection not configured; send PASV or PORT");return}self[m](commandArg,command)}}else{self.respond("502 Command not implemented.")}self.previousCommand=command};FtpConnection.prototype._command_ACCT=function(){this.respond("202 Command not implemented, superfluous at this site.");return this};FtpConnection.prototype._command_ALLO=function(){this.respond("202 Command not implemented, superfluous at this site.");return this};FtpConnection.prototype._command_AUTH=function(commandArg){var self=this;if(!self.server.options.tlsOptions||commandArg!=="TLS"){return self.respond("502 Command not implemented")}self.respond("234 Honored",function(){self._logIf(LOG_INFO,"Establishing secure connection...");starttls.starttlsServer(self.socket,self.server.options.tlsOptions,function(err,cleartext){if(err){self._logIf(LOG_ERROR,"Error upgrading connection to TLS: "+util.inspect(err));self._closeSocket(self.socket,true)}else if(!cleartext.authorized){self._logIf(LOG_INFO,"Secure socket not authorized: "+util.inspect(cleartext.authorizationError));if(self.server.options.allowUnauthorizedTls){self._logIf(LOG_INFO,"Allowing unauthorized connection (allowUnauthorizedTls is on)");switchToSecure()}else{self._logIf(LOG_INFO,"Closing unauthorized connection (allowUnauthorizedTls is off)");self._closeSocket(self.socket,true)}}else{switchToSecure()}function switchToSecure(){self._logIf(LOG_INFO,"Secure connection started");self.socket=cleartext;self.socket.on("data",function(data){self._onData(data)});self.secure=true}})})};FtpConnection.prototype._command_CDUP=function(){var pathServer=pathModule.dirname(this.cwd);var pathEscaped=pathEscape(pathServer);this.cwd=pathServer;this.respond('250 Directory changed to "'+pathEscaped+'"');return this};FtpConnection.prototype._command_CWD=function(pathRequest){var pathServer=withCwd(this.cwd,pathRequest);var pathFs=pathModule.join(this.root,pathServer);var pathEscaped=pathEscape(pathServer);this.fs.stat(pathFs,function(err,stats){if(err){this._logIf(LOG_ERROR,"CWD "+pathRequest+": "+err);this.respond("550 Directory not found.")}else if(!stats.isDirectory()){this._logIf(LOG_WARN,"Attempt to CWD to non-directory");this.respond("550 Not a directory")}else{this.cwd=pathServer;this.respond('250 CWD successful. "'+pathEscaped+'" is current directory')}}.bind(this));return this};FtpConnection.prototype._command_DELE=function(commandArg){var self=this;var filename=withCwd(self.cwd,commandArg);self.fs.unlink(pathModule.join(self.root,filename),function(err){if(err){self._logIf(LOG_ERROR,"Error deleting file: "+filename+", "+err);self.respond("550 Permission denied")}else{self.respond("250 File deleted")}})};FtpConnection.prototype._command_FEAT=function(){this.respond("211-Features\r\n"+" SIZE\r\n"+" UTF8\r\n"+" MDTM\r\n"+(!this.server.options.tlsOptions?"":" AUTH TLS\r\n"+" PBSZ\r\n"+" UTF8\r\n"+" PROT\r\n")+"211 end")};FtpConnection.prototype._command_OPTS=function(commandArg){if(commandArg.toUpperCase()==="UTF8 ON"){this.respond("200 OK")}else{this.respond("451 Not supported")}};FtpConnection.prototype._command_MDTM=function(file){file=withCwd(this.cwd,file);file=pathModule.join(this.root,file);this.fs.stat(file,function(err,stats){if(err){this.respond("550 File unavailable")}else{this.respond("213 "+dateformat(stats.mtime,"yyyymmddhhMMss"))}}.bind(this));return this};FtpConnection.prototype._command_LIST=function(commandArg){this._LIST(commandArg,true,"LIST")};FtpConnection.prototype._command_NLST=function(commandArg){this._LIST(commandArg,false,"NLST")};FtpConnection.prototype._command_STAT=function(commandArg){if(commandArg){this._LIST(commandArg,true,"STAT")}else{this.respond("211 FTP Server Status OK")}};FtpConnection.prototype._LIST=function(commandArg,detailed,cmd){var self=this;var dirname=stripOptions(commandArg);var dir=withCwd(self.cwd,dirname);glob.setMaxStatsAtOnce(self.server.options.maxStatsAtOnce);glob.glob(pathModule.join(self.root,dir),self.fs,function(err,files){if(err){self._logIf(LOG_ERROR,"Error sending file list, reading directory: "+err);self.respond("550 Not a directory");return}if(self.server.options.hideDotFiles){files=files.filter(function(file){if(file.name&&file.name[0]!=="."){return true}})}self._logIf(LOG_INFO,"Directory has "+files.length+" files");if(files.length===0){return self._listFiles([],detailed,cmd)}var fileInfos;if(!detailed){fileInfos=files;return finished()}fileInfos=[];var CONC=self.server.options.maxStatsAtOnce;var j=0;for(var i=0;i=files.length){return i===files.length+j?finished():null}self.server.getUsernameFromUid(files[ii].stats.uid,function(e1,uname){self.server.getGroupFromGid(files[ii].stats.gid,function(e2,gname){if(e1||e2){self._logIf(LOG_WARN,"Error getting user/group name for file: "+util.inspect(e1||e2));fileInfos.push({file:files[ii],uname:null,gname:null})}else{fileInfos.push({file:files[ii],uname:uname,gname:gname})}handleFile(++i)})})}function finished(){if(!self.server.options.dontSortFilenames){if(self.server.options.filenameSortMap!==false){var sm=self.server.options.filenameSortMap||function(x){return x.toUpperCase()};for(var i=0;i=3&&commandArg.charAt(0)==="|"&&commandArg.charAt(2)==="|"&&commandArg.charAt(1)==="2"){self.respond("522 Server cannot handle IPv6 EPRT commands, use (1)");return}m=commandArg.match(/^\|1\|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\|([0-9]{1,5})/);if(!m){self.respond("501 Bad Argument to EPRT");return}var r=parseInt(m[2],10);if(isNaN(r)){throw new Error("Impossible NaN in FtpConnection.prototype._PORT (2)")}if(r>65535||r<=0){self.respond("501 Bad argument to EPRT (invalid port number)");return}host=m[1];port=r}self.dataConfigured=true;self.dataHost=host;self.dataPort=port;self._logIf(LOG_DEBUG,"self.dataHost, self.dataPort set to "+self.dataHost+":"+self.dataPort);self.respond("200 OK")};FtpConnection.prototype._command_PASV=function(x,y){this._PASV(x,y)};FtpConnection.prototype._command_EPSV=function(x,y){this._PASV(x,y)};FtpConnection.prototype._PASV=function(commandArg,command){var self=this;self.dataConfigured=false;if(command==="EPSV"&&commandArg&&commandArg!=="1"){self.respond("202 Not supported");return}if(self.dataSocket){self._closeSocket(self.dataSocket,true)}if(self.dataListener){self._logIf(LOG_DEBUG,"Telling client that they can connect now");self._writePASVReady(command)}else{self._logIf(LOG_DEBUG,"Setting up listener for passive connections");self._setupNewPASV(commandArg,command)}self.dataConfigured=true};FtpConnection.prototype._writePASVReady=function(command){var self=this;var a=self.pasv.address();var host=self.server.host;var port=a.port;if(command==="PASV"){var i1=port/256|0;var i2=port%256;self.respond("227 Entering Passive Mode ("+host.split(".").join(",")+","+i1+","+i2+")")}else{self.respond("229 Entering Extended Passive Mode (|||"+port+"|)")}};FtpConnection.prototype._setupNewPASV=function(commandArg,command){var self=this;var pasv=self._createPassiveServer();var portRangeErrorHandler;function normalErrorHandler(e){self._logIf(LOG_WARN,"Error with passive data listener: "+util.inspect(e));self.respond("421 Server was unable to open passive connection listener");self.dataConfigured=false;self.dataListener=null;self.dataSocket=null;self.pasv=null}if(self.server.options.pasvPortRangeStart!=null&&self.server.options.pasvPortRangeEnd!=null){var i=self.server.options.pasvPortRangeStart;pasv.listen(i);portRangeErrorHandler=function(e){if(e.code==="EADDRINUSE"&&iself.server.options.uploadMaxSlurpSize){if(!self.fs.createWriteStream){if(self.dataSocket){self._closeSocket(self.dataSocket,true)}self.respond("552 Requested file action aborted; file too big");return}self._logIf(LOG_WARN,"uploadMaxSlurpSize exceeded; falling back to createWriteStream");self._STOR_usingCreateWriteStream(filename,[slurpBuf.slice(0,totalBytes),buf]);self.dataSocket.removeListener("data",dataHandler);self.dataSocket.removeListener("error",errorHandler);self.dataSocket.removeListener("close",closeHandler)}else{if(totalBytes+buf.length>slurpBuf.length){var newLength=slurpBuf.length*2;if(newLength99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:gmt?"GMT":utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10],W:W,N:N};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1)})}}();dateFormat.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"};dateFormat.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]};if(true){module.exports=dateFormat}},function(module,exports,__webpack_require__){var PathModule=__webpack_require__(0);var CONC=5;function setMaxStatsAtOnce(n){CONC=n}function statList(fsm,list,callback){if(list.length===0){return callback(null,[])}var stats=[];var total=list.length;for(var i=0;i=0;--i){if(path.charAt(i)==="/"){base=path.substr(0,i+1);break}}pattern=path.substr(i===0?0:i+1);for(i=0;i0){pattern=pattern.substr(i)}for(i=base.length-1;i>0&&base.charAt(i)==="/";--i){}if(i!==base.length-1){base=base.substr(0,i+1)}readTheDir(false);function readTheDir(listingSingleDir){fsm.readdir(base,function(err,contents){if(err){if(err.code==="ENOTDIR"||err.code==="ENOENT"){callback(null,[])}else{callback(err)}}else{var matches;if(!listingSingleDir){matches=contents.filter(function(n){return matchPattern(pattern,n)})}else{matches=contents}if(!listingSingleDir&&matches.length===1){var dir=PathModule.join(base,matches[0]);fsm.stat(dir,function(err,st){if(err){return callback(err)}if(!st.isDirectory()){doTheNormalThing()}else{base=dir;readTheDir(true)}})}else{doTheNormalThing()}function doTheNormalThing(){statList(fsm,matches.map(function(p){return PathModule.join(base,p)}),function(err,list){if(err){callback(err)}else{callback(null,list)}})}}})}}}exports.glob=glob;exports.matchPattern=matchPattern;exports.setMaxStatsAtOnce=setMaxStatsAtOnce},function(module,exports,__webpack_require__){var tls=__webpack_require__(10);var crypto=__webpack_require__(11);var RECOMMENDED_CIPHERS="ECDHE-RSA-AES256-SHA:AES256-SHA:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM";function starttlsServer(socket,options,callback){return starttls(socket,options,callback,true)}function starttlsClient(socket,options,callback){return starttls(socket,options,callback,false)}function starttls(socket,options,callback,isServer){var sslcontext;var opts={};Object.keys(options).forEach(function(key){opts[key]=options[key]});if(!opts.ciphers){opts.ciphers=RECOMMENDED_CIPHERS}socket.removeAllListeners("data");if(tls.createSecureContext){sslcontext=tls.createSecureContext(opts)}else{sslcontext=crypto.createCredentials(opts)}var pair=tls.createSecurePair(sslcontext,isServer);var cleartext=pipe(pair,socket);var erroredOut=false;pair.on("secure",function(){if(erroredOut){pair.end();return}var verifyError=(pair._ssl||pair.ssl).verifyError();if(verifyError){cleartext.authorized=false;cleartext.authorizationError=verifyError}else{cleartext.authorized=true}callback(null,cleartext)});pair.once("error",function(err){if(!erroredOut){erroredOut=true;callback(err)}});cleartext._controlReleased=true;pair}function forwardEvents(events,emitterSource,emitterDestination){var map=[];for(var i=0,len=events.length;i