w-ftp
Version:
A tool for FTP(FTP, SFTP).
6 lines • 55.2 kB
JavaScript
/*!
* w-ftp v1.0.16
* (c) 2018-2021 yuda-lyu(semisphere)
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("fs"),require("net"),require("events"),require("util"),require("stream"),require("stream-combiner"),require("ftp-response-parser"),require("parse-listing"),require("once"),require("unorm"),require("debug"),require("ssh2-sftp-client")):"function"==typeof define&&define.amd?define(["path","fs","net","events","util","stream","stream-combiner","ftp-response-parser","parse-listing","once","unorm","debug","ssh2-sftp-client"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-ftp"]=e(t.path,t.fs,t.net,t.events,t.util,t.stream,t["stream-combiner"],t["ftp-response-parser"],t["parse-listing"],t.once,t.unorm,t.debug,t["ssh2-sftp-client"])}(this,(function(t,e,r,n,i,o,u,s,a,c,f,l,p){"use strict";var h=Array.isArray,d="object"==typeof global&&global&&global.Object===Object&&global,y="object"==typeof self&&self&&self.Object===Object&&self,v=d||y||Function("return this")(),m=v.Symbol,g=Object.prototype,b=g.hasOwnProperty,j=g.toString,w=m?m.toStringTag:void 0;var _=Object.prototype.toString;var O="[object Null]",$="[object Undefined]",S=m?m.toStringTag:void 0;function k(t){return null==t?void 0===t?$:O:S&&S in Object(t)?function(t){var e=b.call(t,w),r=t[w];try{t[w]=void 0;var n=!0}catch(t){}var i=j.call(t);return n&&(e?t[w]=r:delete t[w]),i}(t):function(t){return _.call(t)}(t)}function P(t){return null!=t&&"object"==typeof t}var T="[object Symbol]";function x(t){return"symbol"==typeof t||P(t)&&k(t)==T}var D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,M=/^\w*$/;function F(t,e){if(h(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!x(t))||(M.test(t)||!D.test(t)||null!=e&&t in Object(e))}function z(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var L="[object AsyncFunction]",E="[object Function]",A="[object GeneratorFunction]",R="[object Proxy]";function Y(t){if(!z(t))return!1;var e=k(t);return e==E||e==A||e==L||e==R}var C,I=v["__core-js_shared__"],H=(C=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var U=Function.prototype.toString;function q(t){if(null!=t){try{return U.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var N=/^\[object .+?Constructor\]$/,W=Function.prototype,B=Object.prototype,Q=W.toString,V=B.hasOwnProperty,Z=RegExp("^"+Q.call(V).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function G(t){return!(!z(t)||(e=t,H&&H in e))&&(Y(t)?Z:N).test(q(t));var e}function J(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return G(r)?r:void 0}var K=J(Object,"create");var X=Object.prototype.hasOwnProperty;var tt=Object.prototype.hasOwnProperty;function et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t,e){return t===e||t!=t&&e!=e}function nt(t,e){for(var r=t.length;r--;)if(rt(t[r][0],e))return r;return-1}et.prototype.clear=function(){this.__data__=K?K(null):{},this.size=0},et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},et.prototype.get=function(t){var e=this.__data__;if(K){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return X.call(e,t)?e[t]:void 0},et.prototype.has=function(t){var e=this.__data__;return K?void 0!==e[t]:tt.call(e,t)},et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=K&&void 0===e?"__lodash_hash_undefined__":e,this};var it=Array.prototype.splice;function ot(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ot.prototype.clear=function(){this.__data__=[],this.size=0},ot.prototype.delete=function(t){var e=this.__data__,r=nt(e,t);return!(r<0)&&(r==e.length-1?e.pop():it.call(e,r,1),--this.size,!0)},ot.prototype.get=function(t){var e=this.__data__,r=nt(e,t);return r<0?void 0:e[r][1]},ot.prototype.has=function(t){return nt(this.__data__,t)>-1},ot.prototype.set=function(t,e){var r=this.__data__,n=nt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var ut=J(v,"Map");function st(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function at(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}at.prototype.clear=function(){this.size=0,this.__data__={hash:new et,map:new(ut||ot),string:new et}},at.prototype.delete=function(t){var e=st(this,t).delete(t);return this.size-=e?1:0,e},at.prototype.get=function(t){return st(this,t).get(t)},at.prototype.has=function(t){return st(this,t).has(t)},at.prototype.set=function(t,e){var r=st(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};var ct="Expected a function";function ft(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError(ct);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var u=t.apply(this,n);return r.cache=o.set(i,u)||o,u};return r.cache=new(ft.Cache||at),r}ft.Cache=at;var lt,pt,ht,dt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yt=/\\(\\)?/g,vt=(lt=function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(dt,(function(t,r,n,i){e.push(n?i.replace(yt,"$1"):r||t)})),e},pt=ft(lt,(function(t){return 500===ht.size&&ht.clear(),t})),ht=pt.cache,pt),mt=vt;function gt(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}var bt=1/0,jt=m?m.prototype:void 0,wt=jt?jt.toString:void 0;function _t(t){if("string"==typeof t)return t;if(h(t))return gt(t,_t)+"";if(x(t))return wt?wt.call(t):"";var e=t+"";return"0"==e&&1/t==-bt?"-0":e}function Ot(t){return null==t?"":_t(t)}function $t(t,e){return h(t)?t:F(t,e)?[t]:mt(Ot(t))}var St=1/0;function kt(t){if("string"==typeof t||x(t))return t;var e=t+"";return"0"==e&&1/t==-St?"-0":e}function Pt(t,e){for(var r=0,n=(e=$t(e,t)).length;null!=t&&r<n;)t=t[kt(e[r++])];return r&&r==n?t:void 0}function Tt(t,e,r){var n=null==t?void 0:Pt(t,e);return void 0===n?r:n}function xt(t){return xt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt(t)}function Dt(t){var e=function(t,e){if("object"!==xt(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==xt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===xt(e)?e:String(e)}function Mt(t,e,r){return(e=Dt(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ft(t){var e=this.__data__=new ot(t);this.size=e.size}Ft.prototype.clear=function(){this.__data__=new ot,this.size=0},Ft.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Ft.prototype.get=function(t){return this.__data__.get(t)},Ft.prototype.has=function(t){return this.__data__.has(t)},Ft.prototype.set=function(t,e){var r=this.__data__;if(r instanceof ot){var n=r.__data__;if(!ut||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new at(n)}return r.set(t,e),this.size=r.size,this};function zt(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new at;++e<r;)this.add(t[e])}function Lt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function Et(t,e){return t.has(e)}zt.prototype.add=zt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},zt.prototype.has=function(t){return this.__data__.has(t)};var At=1,Rt=2;function Yt(t,e,r,n,i,o){var u=r&At,s=t.length,a=e.length;if(s!=a&&!(u&&a>s))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,p=!0,h=r&Rt?new zt:void 0;for(o.set(t,e),o.set(e,t);++l<s;){var d=t[l],y=e[l];if(n)var v=u?n(y,d,l,e,t,o):n(d,y,l,t,e,o);if(void 0!==v){if(v)continue;p=!1;break}if(h){if(!Lt(e,(function(t,e){if(!Et(h,e)&&(d===t||i(d,t,r,n,o)))return h.push(e)}))){p=!1;break}}else if(d!==y&&!i(d,y,r,n,o)){p=!1;break}}return o.delete(t),o.delete(e),p}var Ct=v.Uint8Array;function It(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function Ht(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var Ut=1,qt=2,Nt="[object Boolean]",Wt="[object Date]",Bt="[object Error]",Qt="[object Map]",Vt="[object Number]",Zt="[object RegExp]",Gt="[object Set]",Jt="[object String]",Kt="[object Symbol]",Xt="[object ArrayBuffer]",te="[object DataView]",ee=m?m.prototype:void 0,re=ee?ee.valueOf:void 0;function ne(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var u=t[r];e(u,r,t)&&(o[i++]=u)}return o}var ie=Object.prototype.propertyIsEnumerable,oe=Object.getOwnPropertySymbols,ue=oe?function(t){return null==t?[]:(t=Object(t),ne(oe(t),(function(e){return ie.call(t,e)})))}:function(){return[]};function se(t){return P(t)&&"[object Arguments]"==k(t)}var ae=Object.prototype,ce=ae.hasOwnProperty,fe=ae.propertyIsEnumerable,le=se(function(){return arguments}())?se:function(t){return P(t)&&ce.call(t,"callee")&&!fe.call(t,"callee")},pe=le;var he="object"==typeof exports&&exports&&!exports.nodeType&&exports,de=he&&"object"==typeof module&&module&&!module.nodeType&&module,ye=de&&de.exports===he?v.Buffer:void 0,ve=(ye?ye.isBuffer:void 0)||function(){return!1},me=9007199254740991,ge=/^(?:0|[1-9]\d*)$/;function be(t,e){var r=typeof t;return!!(e=null==e?me:e)&&("number"==r||"symbol"!=r&&ge.test(t))&&t>-1&&t%1==0&&t<e}var je=9007199254740991;function we(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=je}var _e={};_e["[object Float32Array]"]=_e["[object Float64Array]"]=_e["[object Int8Array]"]=_e["[object Int16Array]"]=_e["[object Int32Array]"]=_e["[object Uint8Array]"]=_e["[object Uint8ClampedArray]"]=_e["[object Uint16Array]"]=_e["[object Uint32Array]"]=!0,_e["[object Arguments]"]=_e["[object Array]"]=_e["[object ArrayBuffer]"]=_e["[object Boolean]"]=_e["[object DataView]"]=_e["[object Date]"]=_e["[object Error]"]=_e["[object Function]"]=_e["[object Map]"]=_e["[object Number]"]=_e["[object Object]"]=_e["[object RegExp]"]=_e["[object Set]"]=_e["[object String]"]=_e["[object WeakMap]"]=!1;var Oe="object"==typeof exports&&exports&&!exports.nodeType&&exports,$e=Oe&&"object"==typeof module&&module&&!module.nodeType&&module,Se=$e&&$e.exports===Oe&&d.process,ke=function(){try{var t=$e&&$e.require&&$e.require("util").types;return t||Se&&Se.binding&&Se.binding("util")}catch(t){}}(),Pe=ke&&ke.isTypedArray,Te=Pe?function(t){return function(e){return t(e)}}(Pe):function(t){return P(t)&&we(t.length)&&!!_e[k(t)]},xe=Te,De=Object.prototype.hasOwnProperty;function Me(t,e){var r=h(t),n=!r&&pe(t),i=!r&&!n&&ve(t),o=!r&&!n&&!i&&xe(t),u=r||n||i||o,s=u?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],a=s.length;for(var c in t)!e&&!De.call(t,c)||u&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||be(c,a))||s.push(c);return s}var Fe=Object.prototype;var ze=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Le=ze,Ee=Object.prototype.hasOwnProperty;function Ae(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||Fe))return Le(t);var e,r,n=[];for(var i in Object(t))Ee.call(t,i)&&"constructor"!=i&&n.push(i);return n}function Re(t){return null!=t&&we(t.length)&&!Y(t)}function Ye(t){return Re(t)?Me(t):Ae(t)}function Ce(t){return function(t,e,r){var n=e(t);return h(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Ye,ue)}var Ie=1,He=Object.prototype.hasOwnProperty;var Ue=J(v,"DataView"),qe=J(v,"Promise"),Ne=J(v,"Set"),We=J(v,"WeakMap"),Be="[object Map]",Qe="[object Promise]",Ve="[object Set]",Ze="[object WeakMap]",Ge="[object DataView]",Je=q(Ue),Ke=q(ut),Xe=q(qe),tr=q(Ne),er=q(We),rr=k;(Ue&&rr(new Ue(new ArrayBuffer(1)))!=Ge||ut&&rr(new ut)!=Be||qe&&rr(qe.resolve())!=Qe||Ne&&rr(new Ne)!=Ve||We&&rr(new We)!=Ze)&&(rr=function(t){var e=k(t),r="[object Object]"==e?t.constructor:void 0,n=r?q(r):"";if(n)switch(n){case Je:return Ge;case Ke:return Be;case Xe:return Qe;case tr:return Ve;case er:return Ze}return e});var nr=rr,ir=1,or="[object Arguments]",ur="[object Array]",sr="[object Object]",ar=Object.prototype.hasOwnProperty;function cr(t,e,r,n,i,o){var u=h(t),s=h(e),a=u?ur:nr(t),c=s?ur:nr(e),f=(a=a==or?sr:a)==sr,l=(c=c==or?sr:c)==sr,p=a==c;if(p&&ve(t)){if(!ve(e))return!1;u=!0,f=!1}if(p&&!f)return o||(o=new Ft),u||xe(t)?Yt(t,e,r,n,i,o):function(t,e,r,n,i,o,u){switch(r){case te:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Xt:return!(t.byteLength!=e.byteLength||!o(new Ct(t),new Ct(e)));case Nt:case Wt:case Vt:return rt(+t,+e);case Bt:return t.name==e.name&&t.message==e.message;case Zt:case Jt:return t==e+"";case Qt:var s=It;case Gt:var a=n&Ut;if(s||(s=Ht),t.size!=e.size&&!a)return!1;var c=u.get(t);if(c)return c==e;n|=qt,u.set(t,e);var f=Yt(s(t),s(e),n,i,o,u);return u.delete(t),f;case Kt:if(re)return re.call(t)==re.call(e)}return!1}(t,e,a,r,n,i,o);if(!(r&ir)){var d=f&&ar.call(t,"__wrapped__"),y=l&&ar.call(e,"__wrapped__");if(d||y){var v=d?t.value():t,m=y?e.value():e;return o||(o=new Ft),i(v,m,r,n,o)}}return!!p&&(o||(o=new Ft),function(t,e,r,n,i,o){var u=r&Ie,s=Ce(t),a=s.length;if(a!=Ce(e).length&&!u)return!1;for(var c=a;c--;){var f=s[c];if(!(u?f in e:He.call(e,f)))return!1}var l=o.get(t),p=o.get(e);if(l&&p)return l==e&&p==t;var h=!0;o.set(t,e),o.set(e,t);for(var d=u;++c<a;){var y=t[f=s[c]],v=e[f];if(n)var m=u?n(v,y,f,e,t,o):n(y,v,f,t,e,o);if(!(void 0===m?y===v||i(y,v,r,n,o):m)){h=!1;break}d||(d="constructor"==f)}if(h&&!d){var g=t.constructor,b=e.constructor;g==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof b&&b instanceof b||(h=!1)}return o.delete(t),o.delete(e),h}(t,e,r,n,i,o))}function fr(t,e,r,n,i){return t===e||(null==t||null==e||!P(t)&&!P(e)?t!=t&&e!=e:cr(t,e,r,n,fr,i))}var lr=1,pr=2;function hr(t){return t==t&&!z(t)}function dr(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}function yr(t){var e=function(t){for(var e=Ye(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,hr(i)]}return e}(t);return 1==e.length&&e[0][2]?dr(e[0][0],e[0][1]):function(r){return r===t||function(t,e,r,n){var i=r.length,o=i,u=!n;if(null==t)return!o;for(t=Object(t);i--;){var s=r[i];if(u&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){var a=(s=r[i])[0],c=t[a],f=s[1];if(u&&s[2]){if(void 0===c&&!(a in t))return!1}else{var l=new Ft;if(n)var p=n(c,f,a,t,e,l);if(!(void 0===p?fr(f,c,lr|pr,n,l):p))return!1}}return!0}(r,t,e)}}function vr(t,e){return null!=t&&e in Object(t)}function mr(t,e){return null!=t&&function(t,e,r){for(var n=-1,i=(e=$t(e,t)).length,o=!1;++n<i;){var u=kt(e[n]);if(!(o=null!=t&&r(t,u)))break;t=t[u]}return o||++n!=i?o:!!(i=null==t?0:t.length)&&we(i)&&be(u,i)&&(h(t)||pe(t))}(t,e,vr)}var gr=1,br=2;function jr(t){return t}function wr(t){return function(e){return null==e?void 0:e[t]}}function _r(t){return F(t)?wr(kt(t)):function(t){return function(e){return Pt(e,t)}}(t)}function Or(t){return"function"==typeof t?t:null==t?jr:"object"==typeof t?h(t)?function(t,e){return F(t)&&hr(e)?dr(kt(t),e):function(r){var n=Tt(r,t);return void 0===n&&n===e?mr(r,t):fr(e,n,gr|br)}}(t[0],t[1]):yr(t):_r(t)}var $r,Sr=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),u=o.length;u--;){var s=o[$r?u:++n];if(!1===e(i[s],s,i))break}return t};var kr=function(t,e){return function(r,n){if(null==r)return r;if(!Re(r))return t(r,n);for(var i=r.length,o=e?i:-1,u=Object(r);(e?o--:++o<i)&&!1!==n(u[o],o,u););return r}}((function(t,e){return t&&Sr(t,e,Ye)})),Pr=kr;function Tr(t,e){var r=-1,n=Re(t)?Array(t.length):[];return Pr(t,(function(t,i,o){n[++r]=e(t,i,o)})),n}function xr(t,e){return(h(t)?gt:Tr)(t,Or(e))}function Dr(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function Mr(t,e){var r;return(h(t)?Dr:Pr)(t,"function"==typeof(r=e)?r:jr)}var Fr="[object String]";var zr=wr("length"),Lr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function Er(t){return Lr.test(t)}var Ar="\\ud800-\\udfff",Rr="["+Ar+"]",Yr="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Cr="\\ud83c[\\udffb-\\udfff]",Ir="[^"+Ar+"]",Hr="(?:\\ud83c[\\udde6-\\uddff]){2}",Ur="[\\ud800-\\udbff][\\udc00-\\udfff]",qr="(?:"+Yr+"|"+Cr+")"+"?",Nr="[\\ufe0e\\ufe0f]?",Wr=Nr+qr+("(?:\\u200d(?:"+[Ir,Hr,Ur].join("|")+")"+Nr+qr+")*"),Br="(?:"+[Ir+Yr+"?",Yr,Hr,Ur,Rr].join("|")+")",Qr=RegExp(Cr+"(?="+Cr+")|"+Br+Wr,"g");function Vr(t){return Er(t)?function(t){for(var e=Qr.lastIndex=0;Qr.test(t);)++e;return e}(t):zr(t)}var Zr="[object Map]",Gr="[object Set]";function Jr(t){if(null==t)return 0;if(Re(t))return"string"==typeof(e=t)||!h(e)&&P(e)&&k(e)==Fr?Vr(t):t.length;var e,r=nr(t);return r==Zr||r==Gr?t.size:Ae(t).length}function Kr(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}function Xr(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var tn=/\s/;var en=/^\s+/;function rn(t){return t?t.slice(0,function(t){for(var e=t.length;e--&&tn.test(t.charAt(e)););return e}(t)+1).replace(en,""):t}var nn=NaN,on=/^[-+]0x[0-9a-f]+$/i,un=/^0b[01]+$/i,sn=/^0o[0-7]+$/i,an=parseInt;function cn(t){if("number"==typeof t)return t;if(x(t))return nn;if(z(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=z(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=rn(t);var r=un.test(t);return r||sn.test(t)?an(t.slice(2),r?2:8):on.test(t)?nn:+t}var fn=1/0,ln=17976931348623157e292;function pn(t){return t?(t=cn(t))===fn||t===-fn?(t<0?-1:1)*ln:t==t?t:0:0===t?t:0}function hn(t){var e=pn(t),r=e%1;return e==e?r?e-r:e:0}var dn=v.isFinite,yn=Math.min;var vn=function(t){var e=Math[t];return function(t,r){if(t=cn(t),(r=null==r?0:yn(hn(r),292))&&dn(t)){var n=(Ot(t)+"e").split("e");return+((n=(Ot(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round"),mn=vn;function gn(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function bn(t){let e=!1;if(gn(t))e=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(function(t){return t!=t}(t))return!1;e=!0}return e}function jn(t){if(!bn(t))return 0;return pn(t)}function wn(t){if(!bn(t))return 0;t=jn(t);let e=mn(t);return"0"===String(e)?0:e}function _n(t){return!!bn(t)&&(t=jn(t),"number"==typeof(e=t)&&e==hn(e));var e}function On(t){if(!_n(t))return!1;return wn(t)>0}function $n(t){return"[object Object]"===Object.prototype.toString.call(t)}function Sn(t){if($n(t)){for(let e in t)return!0;return!1}return!1}function kn(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Pn(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o}function Tn(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function xn(t){return t!=t}function Dn(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):Tn(t,xn,r)}var Mn="\\ud800-\\udfff",Fn="["+Mn+"]",zn="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ln="\\ud83c[\\udffb-\\udfff]",En="[^"+Mn+"]",An="(?:\\ud83c[\\udde6-\\uddff]){2}",Rn="[\\ud800-\\udbff][\\udc00-\\udfff]",Yn="(?:"+zn+"|"+Ln+")"+"?",Cn="[\\ufe0e\\ufe0f]?",In=Cn+Yn+("(?:\\u200d(?:"+[En,An,Rn].join("|")+")"+Cn+Yn+")*"),Hn="(?:"+[En+zn+"?",zn,An,Rn,Fn].join("|")+")",Un=RegExp(Ln+"(?="+Ln+")|"+Hn+In,"g");function qn(t){return Er(t)?function(t){return t.match(Un)||[]}(t):function(t){return t.split("")}(t)}function Nn(t,e,r){if((t=Ot(t))&&(r||void 0===e))return rn(t);if(!t||!(e=_t(e)))return t;var n=qn(t),i=qn(e),o=function(t,e){for(var r=-1,n=t.length;++r<n&&Dn(e,t[r],0)>-1;);return r}(n,i),u=function(t,e){for(var r=t.length;r--&&Dn(e,t[r],0)>-1;);return r}(n,i)+1;return function(t,e,r){var n=t.length;return r=void 0===r?n:r,!e&&r>=n?t:Pn(t,e,r)}(n,o,u).join("")}function Wn(t,e){if(!gn(t))return[];if(!gn(e))return[];let r=function(t,e){return gn(t)&&gn(e)?t.split(e):[]}(t,e);r=xr(r,Nn);let n=[];return Mr(r,(function(t){gn(t)&&n.push(t)})),n}function Bn(t){if(!_n(t))return!1;return wn(t)>=0}function Qn(t,e){return gn(t)&&Bn(e)?0===(e=wn(e))?"":t.substring(0,e):""}function Vn(t,e){let r=Xr();if(n=t,"[object Array]"!==Object.prototype.toString.call(n)&&!$n(t))return r.reject("rs is not an array or object"),r;var n;let i=!1;if($n(t)){i=!0;let e=[];Mr(t,((t,r)=>{e.push({k:r,v:t})})),t=e}kn(e)||(e=function(t){return t});let o=-1,u=[];return t.reduce((function(t,r){return t.then((function(t){u.push(t),o+=1;let n=o,s=r;return i&&(n=r.k,s=r.v),kn(e)?e(s,n):s}))}),Promise.resolve()).then((function(t){var e,n,i,o;u.push(t),o=null==(e=u)?0:e.length,u=o?Pn(e,(n=i||void 0===n?1:hn(n))<0?0:n,o):[],r.resolve(u)})).catch((function(t){r.reject(t)})),r}function Zn(t,e){if(!gn(t))return"";if(!Bn(e))return"";if(0===(e=wn(e)))return"";let r=t.length-e;return r<0&&(r=0),t.substring(r,r+e)}function Gn(t,e){return gn(t)&&Bn(e)?0===(e=wn(e))?t:Qn(t,t.length-e):""}function Jn(t){if(!gn(t))return"";let e=function(t){if(!gn(t))return{path:"",isRoot:!1};for(;t.indexOf("\\\\")>=0;)t=t.replace("\\\\","\\");for(;t.indexOf("//")>=0;)t=t.replace("//","/");if(":"===Zn(t,1))return{path:`${t}\\`,isRoot:!0};if("\\"===Zn(t,1)){let e=Gn(t,1);return":"===Zn(e,1)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}if("/"===Zn(t,1)){let e=Gn(t,1);return 0===e.length?{path:t,isRoot:!0}:{path:e,isRoot:!1}}return{path:t,isRoot:!1}}(t);if(e.isRoot)return e.path;let r=e.path;try{r=r.split("\\").pop().split("/").pop()}catch(t){}return r}function Kn(t){let e=Tt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");if(!e.existsSync(t))return!1;let r=e.lstatSync(t);return!r.isFile()&&!r.isSymbolicLink()}function Xn(t){return Kn(t,{fs:e})}function ti(t){return function(t){let e=Tt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");return!!e.existsSync(t)&&!e.lstatSync(t).isDirectory()&&!e.lstatSync(t).isSymbolicLink()}(t,{fs:e})}function ei(t){return function(t){let e=Tt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"fs");if(Kn(t,{fs:e}))return{success:"input folder is already exists: "+t};if(e.existsSync(t))return{error:"input path already exists: "+t};try{e.mkdirSync(t,{recursive:!0})}catch(t){return{error:t}}return{success:"done: "+t}}(t,{fs:e})}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ri(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ni={};!function(t,e){t.exports=function(){var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",o="minute",u="hour",s="day",a="week",c="month",f="quarter",l="year",p="date",h="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],r=t%100;return"["+t+(e[(r-20)%10]||e[r]||e[0])+"]"}},m=function(t,e,r){var n=String(t);return!n||n.length>=e?t:""+Array(e+1-n.length).join(r)+t},g={s:m,z:function(t){var e=-t.utcOffset(),r=Math.abs(e),n=Math.floor(r/60),i=r%60;return(e<=0?"+":"-")+m(n,2,"0")+":"+m(i,2,"0")},m:function t(e,r){if(e.date()<r.date())return-t(r,e);var n=12*(r.year()-e.year())+(r.month()-e.month()),i=e.clone().add(n,c),o=r-i<0,u=e.clone().add(n+(o?-1:1),c);return+(-(n+(r-i)/(o?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:l,w:a,d:s,D:p,h:u,m:o,s:i,ms:n,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},b="en",j={};j[b]=v;var w="$isDayjsObject",_=function(t){return t instanceof k||!(!t||!t[w])},O=function t(e,r,n){var i;if(!e)return b;if("string"==typeof e){var o=e.toLowerCase();j[o]&&(i=o),r&&(j[o]=r,i=o);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var s=e.name;j[s]=e,i=s}return!n&&i&&(b=i),i||!n&&b},$=function(t,e){if(_(t))return t.clone();var r="object"==typeof e?e:{};return r.date=t,r.args=arguments,new k(r)},S=g;S.l=O,S.i=_,S.w=function(t,e){return $(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var k=function(){function v(t){this.$L=O(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[w]=!0}var m=v.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,r=t.utc;if(null===e)return new Date(NaN);if(S.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var n=e.match(d);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return S},m.isValid=function(){return!(this.$d.toString()===h)},m.isSame=function(t,e){var r=$(t);return this.startOf(e)<=r&&r<=this.endOf(e)},m.isAfter=function(t,e){return $(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<$(t)},m.$g=function(t,e,r){return S.u(t)?this[e]:this.set(r,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var r=this,n=!!S.u(e)||e,f=S.p(t),h=function(t,e){var i=S.w(r.$u?Date.UTC(r.$y,e,t):new Date(r.$y,e,t),r);return n?i:i.endOf(s)},d=function(t,e){return S.w(r.toDate()[t].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(e)),r)},y=this.$W,v=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(f){case l:return n?h(1,0):h(31,11);case c:return n?h(1,v):h(0,v+1);case a:var b=this.$locale().weekStart||0,j=(y<b?y+7:y)-b;return h(n?m-j:m+(6-j),v);case s:case p:return d(g+"Hours",0);case u:return d(g+"Minutes",1);case o:return d(g+"Seconds",2);case i:return d(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var r,a=S.p(t),f="set"+(this.$u?"UTC":""),h=(r={},r[s]=f+"Date",r[p]=f+"Date",r[c]=f+"Month",r[l]=f+"FullYear",r[u]=f+"Hours",r[o]=f+"Minutes",r[i]=f+"Seconds",r[n]=f+"Milliseconds",r)[a],d=a===s?this.$D+(e-this.$W):e;if(a===c||a===l){var y=this.clone().set(p,1);y.$d[h](d),y.init(),this.$d=y.set(p,Math.min(this.$D,y.daysInMonth())).$d}else h&&this.$d[h](d);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[S.p(t)]()},m.add=function(n,f){var p,h=this;n=Number(n);var d=S.p(f),y=function(t){var e=$(h);return S.w(e.date(e.date()+Math.round(t*n)),h)};if(d===c)return this.set(c,this.$M+n);if(d===l)return this.set(l,this.$y+n);if(d===s)return y(1);if(d===a)return y(7);var v=(p={},p[o]=e,p[u]=r,p[i]=t,p)[d]||1,m=this.$d.getTime()+n*v;return S.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,r=this.$locale();if(!this.isValid())return r.invalidDate||h;var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=S.z(this),o=this.$H,u=this.$m,s=this.$M,a=r.weekdays,c=r.months,f=r.meridiem,l=function(t,r,i,o){return t&&(t[r]||t(e,n))||i[r].slice(0,o)},p=function(t){return S.s(o%12||12,t,"0")},d=f||function(t,e,r){var n=t<12?"AM":"PM";return r?n.toLowerCase():n};return n.replace(y,(function(t,n){return n||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return S.s(e.$y,4,"0");case"M":return s+1;case"MM":return S.s(s+1,2,"0");case"MMM":return l(r.monthsShort,s,c,3);case"MMMM":return l(c,s);case"D":return e.$D;case"DD":return S.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(r.weekdaysMin,e.$W,a,2);case"ddd":return l(r.weekdaysShort,e.$W,a,3);case"dddd":return a[e.$W];case"H":return String(o);case"HH":return S.s(o,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return d(o,u,!0);case"A":return d(o,u,!1);case"m":return String(u);case"mm":return S.s(u,2,"0");case"s":return String(e.$s);case"ss":return S.s(e.$s,2,"0");case"SSS":return S.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(n,p,h){var d,y=this,v=S.p(p),m=$(n),g=(m.utcOffset()-this.utcOffset())*e,b=this-m,j=function(){return S.m(y,m)};switch(v){case l:d=j()/12;break;case c:d=j();break;case f:d=j()/3;break;case a:d=(b-g)/6048e5;break;case s:d=(b-g)/864e5;break;case u:d=b/r;break;case o:d=b/e;break;case i:d=b/t;break;default:d=b}return h?d:S.a(d)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return j[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var r=this.clone(),n=O(t,e,!0);return n&&(r.$L=n),r},m.clone=function(){return S.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},v}(),P=k.prototype;return $.prototype=P,[["$ms",n],["$s",i],["$m",o],["$H",u],["$W",s],["$M",c],["$y",l],["$D",p]].forEach((function(t){P[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),$.extend=function(t,e){return t.$i||(t(e,k,$),t.$i=!0),$},$.locale=O,$.isDayjs=_,$.unix=function(t){return $(1e3*t)},$.en=j[b],$.Ls=j,$.p={},$}()}({get exports(){return ni},set exports(t){ni=t}});var ii=ni,oi={},ui={get exports(){return oi},set exports(t){oi=t}};const si=r.createConnection,ai=n.EventEmitter,ci=i.inherits,fi=o,li=e,pi=u,hi=s,di=a,yi=c,vi=f.nfc,mi=l("jsftp:general"),gi=l("jsftp:command"),bi=l("jsftp:response"),ji=function(){},wi={marks:[125,150],ignore:226},_i=/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/,Oi=/\r\n|\n/;function $i(t){let e=ji,r=t+" ";for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];"function"==typeof i[i.length-1]&&(e=i.pop()),r+=i.join(" "),this.execute(r.trim(),e)}function Si(t){this.host=t.host||"localhost",this.port=t.port||21,this.user=t.user||"anonymous",this.pass=t.pass||"@anonymous",this.createSocket=t.createSocket,this.useList=t.useList||!1,this.commandQueue=[],ai.call(this),this.on("data",bi),this._createSocket(this.port,this.host)}ci(Si,ai),Si.prototype.raw=function(){$i.apply(this,arguments)},Si.prototype.reemit=function(t){return e=>{this.emit(t,e),mi(`event:${t}`,e||{})}},Si.prototype._createSocket=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ji;this.socket&&this.socket.destroy&&this.socket.destroy(),this.resParser&&this.resParser.end(),this.resParser=new hi,this.authenticated=!1,this.socket=this.createSocket?this.createSocket({port:t,host:e},r):si(t,e,r),this.socket.on("connect",this.reemit("connect")),this.socket.on("timeout",this.reemit("timeout")),this.pipeline=pi(this.socket,this.resParser),this.pipeline.on("data",(t=>{this.emit("data",t),bi(t.text),this.parseResponse(t)})),this.pipeline.on("error",this.reemit("error"))},Si.prototype.parseResponse=function(t){if(0===this.commandQueue.length)return;if([220].indexOf(t.code)>-1)return;const e=this.commandQueue[0].callback;if(t.isMark){if(!e.expectsMark||-1===e.expectsMark.marks.indexOf(t.code))return;e.expectsMark.ignore&&(this.ignoreCmdCode=e.expectsMark.ignore)}this.ignoreCmdCode!==t.code?this.parse(t,this.commandQueue.shift()):this.ignoreCmdCode=null},Si.prototype.send=function(t){t&&(gi(t),this.pipeline.write(t+"\r\n"),gi(t))},Si.prototype.nextCmd=function(){const t=this.commandQueue[0];!this.inProgress&&t&&(this.send(t.action),this.inProgress=!0)},Si.prototype.execute=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ji;if(this.socket&&this.socket.writable)return this.runCommand({action:t,callback:e});this.authenticated=!1,this._createSocket(this.port,this.host,(()=>{this.runCommand({action:t,callback:e})}))},Si.prototype.runCommand=function(t){if(this.authenticated||/^(feat|syst|user|pass)/.test(t.action))return this.commandQueue.push(t),void this.nextCmd();this.getFeatures((()=>{this.auth(this.user,this.pass,(()=>{this.commandQueue.push(t),this.nextCmd()}))}))},Si.prototype.parse=function(t,e){let r=null;t.isError&&(r=new Error(t.text||"Unknown FTP error."),r.code=t.code),this.inProgress=!1,e.callback(r,t),this.nextCmd()},Si.prototype.getPasvPort=function(t){const e=_i.exec(t);if(!e)return null;let r=e[1].replace(/,/g,".");return"127.0.0.1"===r&&(r=this.host),{host:r,port:256*(255&parseInt(e[2],10))+(255&parseInt(e[3],10))}},Si.prototype.hasFeat=function(t){return!!t&&this.features.indexOf(t.toLowerCase())>-1},Si.prototype._parseFeats=function(t){return t.split(Oi).slice(1,-1).map((t=>t.trim().toLowerCase())).filter((t=>!!t))},Si.prototype.getFeatures=function(t){if(this.features)return t(null,this.features);this.raw("feat",((e,r)=>{this.features=e?[]:this._parseFeats(r.text),this.raw("syst",((e,r)=>{e||215!==r.code||(this.system=r.text.toLowerCase()),t(null,this.features)}))}))},Si.prototype.auth=function(t,e,r){if(!0===this.authenticating)return r(new Error("This client is already authenticating"));t||(t="anonymous"),e||(e="@anonymous"),this.authenticating=!0,this.raw("user",t,((n,i)=>{if(n||-1===[230,331,332].indexOf(i.code))return this.authenticating=!1,void r(n);this.raw("pass",e,((n,i)=>{this.authenticating=!1,n?r(n):[230,202].indexOf(i.code)>-1?(this.authenticated=!0,this.user=t,this.pass=e,this.raw("type","I",(()=>{r(void 0,i)}))):332===i.code&&this.raw("acct","")}))}))},Si.prototype.setType=function(t,e){if(t=t.toUpperCase(),this.type===t)return e();this.raw("type",t,((r,n)=>{r||(this.type=t),e(r,n)}))},Si.prototype.list=function(t,e){1===arguments.length&&(e=arguments[0],t="");let r="";e=yi(e),this.getPasvSocket(((n,i)=>{if(n)return e(n);function o(t,r){if(t)return e(t);wi.marks.some((t=>t===r.code))||e(new Error(`Expected marks ${wi.toString()} instead of: ${r.text}`))}i.setEncoding("utf8"),i.on("data",(t=>{r+=t})),this.pasvTimeout(i,e),i.once("close",(n=>n?e(n):r?void e(null,r):e({code:451,text:`Could not retrieve a file listing for ${t}.`,isMark:!1,isError:!0}))),i.once("error",e),o.expectsMark=wi,this.execute(`list ${t||""}`,o)}))},Si.prototype.emitProgress=function(t){this.emit("progress",{filename:t.filename,action:t.action,total:t.totalSize||0,transferred:t.socket["get"===t.action?"bytesRead":"bytesWritten"]})},Si.prototype.get=function(t,e){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ji;const i=typeof e;"function"===i?r=e:"string"===i&&(n=yi(n),r=(r,i)=>{if(r)return n(r);const o=li.createWriteStream(e);o.on("error",n),i.on("readable",(()=>{this.emitProgress({filename:t,action:"get",socket:i})})),i.on("error",n),i.on("end",n),i.on("close",n),i.pipe(o)}),this.getGetSocket(t,yi(r))},Si.prototype.getGetSocket=function(t,e){e=yi(e),this.getPasvSocket(((r,n)=>{if(r)return i(r);function i(t,r){return t?(n&&n.destroy(),e(t)):n?125===r.code||150===r.code?e(null,n):(n.destroy(),e(new Error("Unexpected command "+r.text))):e(new Error("Error when retrieving PASV socket"))}n.on("error",(t=>{"ECONNREFUSED"===t.code&&(t.msg="Probably trying a PASV operation while one is in progress"),i(t)})),this.pasvTimeout(n,i),n.pause(),i.expectsMark=wi,this.execute("retr "+t,i)}))},Si.prototype.put=function(t,e,r){const n=(t,e,n)=>{t.on("readable",(()=>{this.emitProgress({filename:e,action:"put",socket:t,totalSize:n})})),this.getPutSocket(t,e,r)};t instanceof Buffer?this.getPutSocket(t,e,r):"string"==typeof t?li.stat(t,((i,o)=>{if(i&&"ENOENT"===i.code)return r(new Error("Local file doesn't exist."));if(o.isDirectory())return r(new Error("Local path cannot be a directory"));const u=i?0:o.size;n(li.createReadStream(t),e,u)})):t instanceof fi.Readable?n(t,e,0):r(new Error("Expected `from` parameter to be a Buffer, Stream, or a String"))},Si.prototype.getPutSocket=function(t,e,r){r=yi(r||ji),this.getPasvSocket(((n,i)=>{if(n)return i&&i.destroy(),r(n);i.on("close",r),i.on("error",r);const o=yi(((e,n)=>e?(i&&i.destroy(),r(e)):125!==n.code&&150!==n.code?(i&&i.destroy(),r(new Error("Unexpected command "+n.text))):(this.pasvTimeout(i,r),void(t instanceof Buffer?i.end(t):t instanceof fi.Readable&&t.pipe(i)))));o.expectsMark=wi,this.execute(`stor ${e}`,o)}))},Si.prototype.pasvTimeout=function(t,e){t.once("timeout",(()=>{mi("PASV socket timeout"),this.emit("timeout"),t.end(),e(new Error("Passive socket timeout"))}))},Si.prototype.getPasvSocket=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ji;t=yi(t),this.execute("pasv",((e,r)=>{if(e)return t(e);const n=this.getPasvPort(r.text);if(!n)return t(new Error("Bad passive host/port combination"));const i=this._pasvSocket=this.createSocket?this.createSocket(n):si(n);i.setTimeout(this.timeout||6e5),i.once("close",(()=>{this._pasvSocket=void 0})),t(null,i)}))},Si.prototype.ls=function(t,e){function r(t,r){if(t)return e(t);di.parseFtpEntries(r.text||r,((t,r)=>{if(t)return e(t);r.forEach((t=>{t.name=vi(t.name)})),e(null,r)}))}this.useList?this.list(t,r):this.raw("stat",t,((e,n)=>{const i=e&&(502===e.code||500===e.code),o=this.system&&this.system.indexOf("hummingbird")>-1;i||o?(this.useList=!0,this.list(t,r)):r(e,n)}))},Si.prototype.rename=function(t,e,r){this.raw("rnfr",t,(t=>{if(t)return r(t);this.raw("rnto",e,r)}))},Si.prototype.keepAlive=function(t){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this._keepAliveInterval=setInterval(this.raw.bind(this,"noop"),t||3e4)},Si.prototype.destroy=function(){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this.socket&&this.socket.writable&&this.socket.end(),this._pasvSocket&&this._pasvSocket.writable&&this._pasvSocket.end(),this.resParser.end(),this.socket=void 0,this._pasvSocket=void 0,this.features=null,this.authenticated=!1};var ki=Si;!function(t){t.exports=ki}(ui);var Pi=ri(oi);function Ti(t,e){return gn(t)&&Bn(e)?0===(e=wn(e))?t:Zn(t,t.length-e):""}function xi(t){"."===Qn(t,1)&&(t=Ti(t,1));let e=Wn(t,"/");var r,n,i,o;e=(o=null==(r=e)?0:r.length)?Pn(r,0,(n=o-(n=i||void 0===n?1:hn(n)))<0?0:n):[];let u=[],s=".";return Mr(e,(t=>{s+="/"+t,u.push(s)})),u}var Di=Math.max;var Mi,Fi=(Mi=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:hn(r);return i<0&&(i=Di(n+i,0)),Tn(t,Or(e),i)},function(t,e,r){var n=Object(t);if(!Re(t)){var i=Or(e);t=Ye(t),e=function(t){return i(n[t],t,n)}}var o=Mi(t,e,r);return o>-1?n[i?t[o]:o]:void 0}),zi="[object Boolean]";function Li(t){return!0===(e=t)||!1===e||P(e)&&k(e)==zi;var e}function Ei(t,e){var r=[];return Pr(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function Ai(t,e){return(h(t)?ne:Ei)(t,Or(e))}var Ri=Array.prototype.join;function Yi(r){return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=1,i=Tt(r,"path"),o=Tt(r,"fs");if(!Kn(t,{fs:o}))throw new Error(`fd[${t}] is not a folder`);return function t(r){let u=[];return Kn(r,{fs:o})?(Mr(o.readdirSync(r),(function(s){let a=i.resolve(r,s),c=null;try{c=o.statSync(a)}catch(t){}c&&c.isDirectory()?(u.push({isFolder:!0,level:n,path:a,name:i.basename(a)}),n+=1,(n<=e||null===e)&&(u=u.concat(t(a))),n-=1):u.push({isFolder:!1,level:n,path:a,name:i.basename(a)})})),u):u}(t)}(r,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{path:t,fs:e})}function Ci(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ii(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ci(Object(r),!0).forEach((function(e){Mt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ci(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}async function Hi(r,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!Xn(n))return Promise.reject(`fdLocal[${n}] is not a folder`);let o=Tt(i,"ftpLs");if(!kn(o))return Promise.reject("opt.ftpLs is not a function");let u=Tt(i,"levelLimit");On(u)||(u=null),n=t.resolve(n);let s=e=>{let i=(e=t.resolve(e)).replace(n,""),o=new RegExp("\\\\","g");i=String(i).replace(o,"/");let u=r;var s,a;return"."===Qn(r,1)&&(u=Ti(r,1)),i=[...Wn(u,"/"),...Wn(i,"/")],a="/",i=null==(s=i)?"":Ri.call(s,a),i=`./${i}`,i},a=Yi(n,u);a=Ai(a,(t=>!t.isFolder)),a=xr(a,(t=>{let r=e.statSync(t.path);return t.size=Tt(r,"size",0),t.rpath=s(t.path),t}));let c=await function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=1;if(!kn(e))return Promise.reject("ftpLs is not a function");let i=Tt(r,"levelLimit");On(i)||(i=null);let o=async t=>{let r=[],u=await e(t);return await Vn(u,(async e=>{let u=`${t}/${e.name}`;if(e.isFolder){if(r.push(Ii(Ii({},e),{},{isFolder:!0,level:n,rpath:u,name:Jn(u)})),n+=1,n<=i||null===i){let t=await o(u);r=r.concat(t)}n-=1}else r.push(Ii(Ii({},e),{},{isFolder:!1,level:n,rpath:u,name:Jn(u)}))})),r};return o(t)}(r,o,{levelLimit:u});return c=Ai(c,(t=>!t.isFolder)),c=xr(c,(e=>{var i;return e.lpath=(i=e.rpath,"."!==r&&(i=i.replace(r,"")),"."===Qn(i,1)&&(i=Ti(i,1)),"/"===Qn(i,1)&&(i=Ti(i,1)),t.resolve(n,i)),e})),{fsRemote:c,fsLocal:a}}async function Ui(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=Tt(n,"ftpLs");if(!kn(i))return Promise.reject("opt.ftpLs is not a function");let o=Tt(n,"ftpDownload");if(!kn(o))return Promise.reject("opt.ftpDownload is not a function");let u=Tt(n,"forceOverwriteWhenSync");Li(u)||(u=!1);let s=Tt(n,"levelLimit");On(s)||(s=null),Xn(e)||ei(e);let a=await Hi(t,e,{ftpLs:i,levelLimit:s}),c=a.fsRemote,f=a.fsLocal,l=0,p=[];return await Vn(c,(async t=>{let e=Tt(t,"lpath",""),n=Fi(f,{path:e}),i=Tt(t,"rpath",""),s=Tt(t,"lpath",""),a=t=>{kn(r)&&r(t)};Sn(n)?(u||t.size!==n.size)&&(await o(i,s,a),l++,p.push({path:t.rpath,reason:`size[${n.size}] of local file != size[${t.size}] of remote file`})):(await o(i,s,a),l++,p.push({path:t.rpath,reason:"no local file"}))})),{num:l,files:p}}async function qi(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=Tt(n,"ftpLs");if(!kn(i))return Promise.reject("opt.ftpLs is not a function");let o=Tt(n,"ftpUpload");if(!kn(o))return Promise.reject("opt.ftpUpload is not a function");let u=Tt(n,"forceOverwriteWhenSync");Li(u)||(u=!1);let s=Tt(n,"levelLimit");On(s)||(s=null);let a=await Hi(e,t,{ftpLs:i,levelLimit:s}),c=a.fsRemote,f=a.fsLocal,l=0,p=[];return await Vn(f,(async t=>{let e=Tt(t,"rpath",""),n=Fi(c,{rpath:e}),i=Tt(t,"rpath",""),s=Tt(t,"path",""),a=t=>{kn(r)&&r(t)};Sn(n)?(u||t.size!==n.size)&&(await o(s,i,a),l++,p.push({name:t.rpath,reason:`size[${n.size}] of remote file != size[${t.size}] of local file`})):(await o(s,i,a),l++,p.push({name:t.rpath,reason:"no Remote file"}))})),{num:l,files:p}}function Ni(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Wi(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ni(Object(r),!0).forEach((function(e){Mt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ni(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Bi(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null,i=Tt(r,"hostname");if(!gn(i))throw new Error(`hostname[${i}] is not an effective string`);let o=Tt(r,"port");On(o)||(o=21),o=wn(o);let u=Tt(r,"username");if(!gn(u))throw new Error(`username[${u}] is not an effective string`);let s=Tt(r,"password");if(!gn(s))throw new Error(`password[${s}] is not an effective string`);let a=Tt(r,"timeLimit");function c(t){let e="";if(!bn(t)&&!gn(t))return e;try{let r=ii(t),n=r.format("YYYY-MM-DDTHH:mm:ss");n=`${n}+00:00`,r=ii(n),e=r.format("YYYY-MM-DDTHH:mm:ssZ")}catch(t){}return e}async function f(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",e=Xr();if(null===n)return e.reject("FTP has not been initialized. please use 'conn' to construct FTP"),e;let r=setTimeout((()=>{e.reject(`ftpLs timeout[${a}]`)}),a);return n.ls(t,((t,n)=>{clearTimeout(r),t?451===Tt(t,"code")?e.resolve([]):e.reject(t):(n=xr(n,(t=>(t.mtime=c(t.time),t.size=wn(t.size),t.isFolder=y(t),t))),e.resolve(n))})),e}async function l(t,e){let r=Xr();if(null===n)return r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r;let i=setTimeout((()=>{r.reject(`ftpRaw[${t}] timeout[${a}]`)}),a);return n.raw(t,e,((t,e)=>{clearTimeout(i),t?r.reject(t):r.resolve(e)})),r}async function p(t){let e=xi(t);return Jr(e)>=1&&await Vn(e,(async t=>{await v(t)||await async function(t){return l("mkd",t)}(t)})),"ok"}async function h(t){return l("cwd",t)}async function d(t){if(null===n)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let e={},r=null;if(await async function(t){return l("mlst",t)}(t).then((t=>{r=t})).catch((t=>{r={err:t.toString()}})),!Sn(r))return Promise.reject("invalid result from ftpMlst");{let t=Tt(r,"text",""),n=t.indexOf("type=dir;")>=0,i=t.indexOf("type=file;")>=0,o=(t=>{let e=Wn(t,";"),r="";return Mr(e,(t=>{if("modify="===Qn(t,7)){let e=Wn(t,"=");r=Tt(e,1,"")}})),r})(t),u=c(o);e=Wi(Wi({},e),{},{rmlst:r,mtime:u,isFolder:n,isFile:i})}let i=null;if(await async function(t){return l("size",t)}(t).then((t=>{i=t})).catch((t=>{i={err:t.toString()}})),!Sn(i))return Promise.reject("invalid result from ftpSize");{let t=Tt(i,"code",""),r=Tt(i,"text","").replace(`${t} `,"");r=wn(r),e=Wi(Wi({},e),{},{rsize:i,size:r})}return e}function y(t){if(!Sn(t))return!1;let e;return e=Tt(t,"isFolder",!1),e||(e=1===Tt(t,"type",-1),e||e)}async function v(t){return y(await d(t))}function m(t){if(!Sn(t))return!1;let e;return e=Tt(t,"isFile",!1),e||(e=0===Tt(t,"type",-1),e||e)}async function g(r,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,u=Xr();if(null===n)return u.reject("FTP has not been initialized. please use 'conn' to construct FTP"),u;if(!gn(r))return u.reject(`fpRemote[${r}] is not an effective string`),u;if(!gn(i))return u.reject(`fpLocal[${i}] is not an effective string`),u;let s=t.dirname(i);ti(i)&&e.unlinkSync(i),Xn(s)||ei(s);let c=await d(r);if(!m(c))return u.reject(`fpRemote[${r}] is not a file`),u;if(!Sn(c)||(l="err",$n(f=c)&&(gn(l)||bn(l))&&l in f))return u.reject(`fpRemote[${r}] does not have information`),u;var f,l;let p=Tt(c,"size","");if(!bn(p))return u.reject(`can not get the size of file[${r}]`),u;p=wn(p);let h=setTimeout((()=>{u.reject(`ftpDownload timeout[${a}]`)}),a);return n.get(r,((t,n)=>{if(t)return clearTimeout(h),void u.reject(t);let s=e.createWriteStream(i),a=0;n.on("data",(t=>{if(kn(o)){let e=Jr(t);a+=e,o({progress:a/p*100,name:Jn(i),fpRemote:r,fpLocal:i})}s.write(t)})),n.on("close",(()=>{s.end()})),s.on("finish",(()=>{clearTimeout(h),t?u.reject(t):u.resolve("ok")})),s.on("error",(t=>{console.log("writer error",t)})),n.resume()})),u}async function b(t,r,i){let o=null;if(null===n)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");if(!gn(r))return Promise.reject(`fpRemote[${r}] is not an effective string`);let u=xi(r),s=r;if(Jr(u)>=1){await p(r);let t=Kr(u);await h(t),s="."+r.replace(t,"")}let c=await async function(t,r,i){let o=Xr();if(null===n)return o.reject("FTP has not been initialized. please use 'conn' to construct FTP"),o;if(!gn(r))return o.reject(`fpRemote[${r}] is not an effective string`),o;if(!gn(t))return o.reject(`fpLocal[${t}] is not an effective string`),o;if(!ti(t))return o.reject(`fpLocal[${t}] is not a file`),o;let u=Tt(e.statSync(t),"size",0);if(!bn(u))return o.reject(`can not get the size of file[${t}]`),o;u=wn(u);let s=e.readFileSync(t),c=setTimeout((()=>{o.reject(`ftpUploadCore timeout[${a}]`)}),a),f=0;return n.put(s,r,((e,n)=>{if(e)return clearTimeout(c),void o.reject(e);if(0===Jr(n))return clearTimeout(c),void o.resolve("ok");if(kn(i)){let e=Jr(n);f+=e,i({progress:f/u*100,name:Jn(t),fpRemote:r,fpLocal:t})}})),o}(t,s,i).catch((t=>{o=t}));return Jr(u)>=1&&await h("/"),null!==o?Promise.reject(o):c}return bn(a)||(a=6e4),a=wn(a),{conn:async function(){let t=Xr();try{n=new Pi({host:i,port:o,user:u,pass:s}),t.resolve("ok")}catch(e){t.reject(e)}return t},quit:async function(){let t=Xr();if(null===n)return t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t;let e=setTimeout((()=>{n.destroy(),n=null,t.reject(`ftpQuit timeout[${a}]`)}),a);return n.raw("quit",((r,i)=>{clearTimeout(e),n.destroy(),n=null,r?t.reject(r):t.resolve(i)})),t},ls:f,isFile:async function(t){return m(await d(t))},isFolder:v,download:g,upload:b,syncToLocal:async function(t,e,r){return Ui(t,e,r,Wi(Wi({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},{ftpLs:f,ftpDownload:g}))},syncToRemote:async function(t,e,r){return qi(t,e,r,Wi(Wi({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},{ftpLs:f,ftpUpload:b}))},stat:d,mkdir:p,cwd:h,pwd:async function(){return l("pwd")}}}function Qi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Vi(t){for(var e=1;e<arguments.length;e++){va