@acuity/directus-extension-acuity-backup 2.0.6 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -1
- package/dist/api.js +5 -5
- package/dist/app.js +1 -1
- package/package.json +10 -4
package/dist/api.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{readFileSync as t,existsSync as e,writeFileSync as r,mkdirSync as n,createReadStream as i,createWriteStream as o}from"node:fs";import{readdir as s,unlink as a,stat as u,rename as c}from"node:fs/promises";import{join as l,basename as f}from"node:path";import{pipeline as h}from"node:stream/promises";import p from"fs";import d from"events";import y from"path";import m from"constants";import g from"stream";import b from"util";import v from"assert";import w from"buffer";import S from"zlib";import E from"async_hooks";import{randomUUID as k}from"node:crypto";var x,T,O,j,C,R,P,L,F,A,I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function M(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var r=function t(){var r=!1;try{r=this instanceof t}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}function N(){if(T)return x;T=1;const t="object"==typeof process&&process&&"win32"===process.platform;return x=t?{sep:"\\"}:{sep:"/"}}function B(){if(R)return C;R=1;var t=function(){if(j)return O;function t(t,n,i){t instanceof RegExp&&(t=e(t,i)),n instanceof RegExp&&(n=e(n,i));var o=r(t,n,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+t.length,o[1]),post:i.slice(o[1]+n.length)}}function e(t,e){var r=e.match(t);return r?r[0]:null}function r(t,e,r){var n,i,o,s,a,u=r.indexOf(t),c=r.indexOf(e,u+1),l=u;if(u>=0&&c>0){if(t===e)return[u,c];for(n=[],o=r.length;l>=0&&!a;)l==u?(n.push(l),u=r.indexOf(t,l+1)):1==n.length?a=[n.pop(),c]:((i=n.pop())<o&&(o=i,s=c),c=r.indexOf(e,l+1)),l=u<c&&u>=0?u:c;n.length&&(a=[o,s])}return a}return j=1,O=t,t.range=r,O}();C=function(t){if(!t)return[];"{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2));return p(function(t){return t.split("\\\\").join(e).split("\\{").join(r).split("\\}").join(n).split("\\,").join(i).split("\\.").join(o)}(t),!0).map(a)};var e="\0SLASH"+Math.random()+"\0",r="\0OPEN"+Math.random()+"\0",n="\0CLOSE"+Math.random()+"\0",i="\0COMMA"+Math.random()+"\0",o="\0PERIOD"+Math.random()+"\0";function s(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function a(t){return t.split(e).join("\\").split(r).join("{").split(n).join("}").split(i).join(",").split(o).join(".")}function u(e){if(!e)return[""];var r=[],n=t("{","}",e);if(!n)return e.split(",");var i=n.pre,o=n.body,s=n.post,a=i.split(",");a[a.length-1]+="{"+o+"}";var c=u(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),r.push.apply(r,a),r}function c(t){return"{"+t+"}"}function l(t){return/^-?0\d/.test(t)}function f(t,e){return t<=e}function h(t,e){return t>=e}function p(e,r){var i=[],o=t("{","}",e);if(!o)return[e];var a=o.pre,d=o.post.length?p(o.post,!1):[""];if(/\$$/.test(o.pre))for(var y=0;y<d.length;y++){var m=a+"{"+o.body+"}"+d[y];i.push(m)}else{var g,_,b=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),v=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),w=b||v,S=o.body.indexOf(",")>=0;if(!w&&!S)return o.post.match(/,(?!,).*\}/)?p(e=o.pre+"{"+o.body+n+o.post):[e];if(w)g=o.body.split(/\.\./);else if(1===(g=u(o.body)).length&&1===(g=p(g[0],!1).map(c)).length)return d.map(function(t){return o.pre+g[0]+t});if(w){var E=s(g[0]),k=s(g[1]),x=Math.max(g[0].length,g[1].length),T=3==g.length?Math.abs(s(g[2])):1,O=f;k<E&&(T*=-1,O=h);var j=g.some(l);_=[];for(var C=E;O(C,k);C+=T){var R;if(v)"\\"===(R=String.fromCharCode(C))&&(R="");else if(R=String(C),j){var P=x-R.length;if(P>0){var L=new Array(P+1).join("0");R=C<0?"-"+L+R.slice(1):L+R}}_.push(R)}}else{_=[];for(var F=0;F<g.length;F++)_.push.apply(_,p(g[F],!1))}for(F=0;F<_.length;F++)for(y=0;y<d.length;y++){m=a+_[F]+d[y];(!r||w||m)&&i.push(m)}}return i}return C}function U(){if(L)return P;L=1;const t=P=(t,e,r={})=>(p(e),!(!r.nocomment&&"#"===e.charAt(0))&&new g(e,r).match(t));P=t;const e=N();t.sep=e.sep;const r=Symbol("globstar **");t.GLOBSTAR=r;const n=B(),i={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},o="[^/]",s=o+"*?",a=t=>t.split("").reduce((t,e)=>(t[e]=!0,t),{}),u=a("().*{}+?[]^$\\!"),c=a("[.("),l=/\/+/;t.filter=(e,r={})=>(n,i,o)=>t(n,e,r);const f=(t,e={})=>{const r={};return Object.keys(t).forEach(e=>r[e]=t[e]),Object.keys(e).forEach(t=>r[t]=e[t]),r};t.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return t;const r=t,n=(t,n,i)=>r(t,n,f(e,i));return(n.Minimatch=class extends r.Minimatch{constructor(t,r){super(t,f(e,r))}}).defaults=t=>r.defaults(f(e,t)).Minimatch,n.filter=(t,n)=>r.filter(t,f(e,n)),n.defaults=t=>r.defaults(f(e,t)),n.makeRe=(t,n)=>r.makeRe(t,f(e,n)),n.braceExpand=(t,n)=>r.braceExpand(t,f(e,n)),n.match=(t,n,i)=>r.match(t,n,f(e,i)),n},t.braceExpand=(t,e)=>h(t,e);const h=(t,e={})=>(p(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:n(t)),p=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},d=Symbol("subparse");t.makeRe=(t,e)=>new g(t,e||{}).makeRe(),t.match=(t,e,r={})=>{const n=new g(e,r);return t=t.filter(t=>n.match(t)),n.options.nonull&&!t.length&&t.push(e),t};const y=t=>t.replace(/\\([^-\]])/g,"$1"),m=t=>t.replace(/[[\]\\]/g,"\\$&");class g{constructor(t,e){p(t),e||(e={}),this.options=e,this.maxGlobstarRecursion=void 0!==e.maxGlobstarRecursion?e.maxGlobstarRecursion:200,this.set=[],this.pattern=t,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}debug(){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate();let r=this.globSet=this.braceExpand();e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,r),r=this.globParts=r.map(t=>t.split(l)),this.debug(this.pattern,r),r=r.map((t,e,r)=>t.map(this.parse,this)),this.debug(this.pattern,r),r=r.filter(t=>-1===t.indexOf(!1)),this.debug(this.pattern,r),this.set=r}parseNegate(){if(this.options.nonegate)return;const t=this.pattern;let e=!1,r=0;for(let n=0;n<t.length&&"!"===t.charAt(n);n++)e=!e,r++;r&&(this.pattern=t.slice(r)),this.negate=e}matchOne(t,e,n){return-1!==e.indexOf(r)?this._matchGlobstar(t,e,n,0,0):this._matchOne(t,e,n,0,0)}_matchGlobstar(t,e,n,i,o){let s=-1;for(let t=o;t<e.length;t++)if(e[t]===r){s=t;break}let a=-1;for(let t=e.length-1;t>=0;t--)if(e[t]===r){a=t;break}const u=e.slice(o,s),c=e.slice(s+1,a),l=e.slice(a+1);if(u.length){const e=t.slice(i,i+u.length);if(!this._matchOne(e,u,n,0,0))return!1;i+=u.length}let f=0;if(l.length){if(l.length+i>t.length)return!1;const e=t.length-l.length;if(this._matchOne(t,l,n,e,0))f=l.length;else{if(""!==t[t.length-1]||i+l.length===t.length)return!1;if(!this._matchOne(t,l,n,e-1,0))return!1;f=l.length+1}}if(!c.length){let e=!!f;for(let r=i;r<t.length-f;r++){const n=String(t[r]);if(e=!0,"."===n||".."===n||!this.options.dot&&"."===n.charAt(0))return!1}return e}const h=[[[],0]];let p=h[0],d=0;const y=[0];for(const t of c)t===r?(y.push(d),p=[[],0],h.push(p)):(p[0].push(t),d++);let m=h.length-1;const g=t.length-f;for(const t of h)t[1]=g-(y[m--]+t[0].length);return!!this._matchGlobStarBodySections(t,h,i,0,n,0,!!f)}_matchGlobStarBodySections(t,e,r,n,i,o,s){const a=e[n];if(!a){for(let e=r;e<t.length;e++){s=!0;const r=t[e];if("."===r||".."===r||!this.options.dot&&"."===r.charAt(0))return!1}return s}const[u,c]=a;for(;r<=c;){if(this._matchOne(t.slice(0,r+u.length),u,i,r,0)&&o<this.maxGlobstarRecursion){const a=this._matchGlobStarBodySections(t,e,r+u.length,n+1,i,o+1,s);if(!1!==a)return a}const a=t[r];if("."===a||".."===a||!this.options.dot&&"."===a.charAt(0))return!1;r++}return null}_matchOne(t,e,n,i,o){let s,a,u,c;for(s=i,a=o,u=t.length,c=e.length;s<u&&a<c;s++,a++){this.debug("matchOne loop");const n=e[a],i=t[s];if(this.debug(e,n,i),!1===n||n===r)return!1;let o;if("string"==typeof n?(o=i===n,this.debug("string match",n,i,o)):(o=i.match(n),this.debug("pattern match",n,i,o)),!o)return!1}if(s===u&&a===c)return!0;if(s===u)return n;if(a===c)return s===u-1&&""===t[s];throw new Error("wtf?")}braceExpand(){return h(this.pattern,this.options)}parse(t,e){p(t);const n=this.options;if("**"===t){if(!n.noglobstar)return r;t="*"}if(""===t)return"";let a="",l=!1,f=!1;const h=[],g=[];let _,b,v,w,S=!1,E=-1,k=-1,x="."===t.charAt(0),T=n.dot||x;const O=t=>"."===t.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",j=()=>{if(_){switch(_){case"*":a+=s,l=!0;break;case"?":a+=o,l=!0;break;default:a+="\\"+_}this.debug("clearStateChar %j %j",_,a),_=!1}};for(let e,r=0;r<t.length&&(e=t.charAt(r));r++)if(this.debug("%s\t%s %s %j",t,r,a,e),f){if("/"===e)return!1;u[e]&&(a+="\\"),a+=e,f=!1}else switch(e){case"/":return!1;case"\\":if(S&&"-"===t.charAt(r+1)){a+=e;continue}j(),f=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",t,r,a,e),S){this.debug(" in class"),"!"===e&&r===k+1&&(e="^"),a+=e;continue}if("*"===e&&"*"===_)continue;this.debug("call clearStateChar %j",_),j(),_=e,n.noext&&j();continue;case"(":{if(S){a+="(";continue}if(!_){a+="\\(";continue}const e={type:_,start:r-1,reStart:a.length,open:i[_].open,close:i[_].close};this.debug(this.pattern,"\t",e),h.push(e),a+=e.open,0===e.start&&"!"!==e.type&&(x=!0,a+=O(t.slice(r+1))),this.debug("plType %j %j",_,a),_=!1;continue}case")":{const t=h[h.length-1];if(S||!t){a+="\\)";continue}h.pop(),j(),l=!0,v=t,a+=v.close,"!"===v.type&&g.push(Object.assign(v,{reEnd:a.length}));continue}case"|":{const e=h[h.length-1];if(S||!e){a+="\\|";continue}j(),a+="|",0===e.start&&"!"!==e.type&&(x=!0,a+=O(t.slice(r+1)));continue}case"[":if(j(),S){a+="\\"+e;continue}S=!0,k=r,E=a.length,a+=e;continue;case"]":if(r===k+1||!S){a+="\\"+e;continue}b=t.substring(k+1,r);try{RegExp("["+m(y(b))+"]"),a+=e}catch(t){a=a.substring(0,E)+"(?:$.)"}l=!0,S=!1;continue;default:j(),!u[e]||"^"===e&&S||(a+="\\"),a+=e}for(S&&(b=t.slice(k+1),w=this.parse(b,d),a=a.substring(0,E)+"\\["+w[0],l=l||w[1]),v=h.pop();v;v=h.pop()){let t;t=a.slice(v.reStart+v.open.length),this.debug("setting tail",a,v),t=t.replace(/((?:\\{2}){0,64})(\\?)\|/g,(t,e,r)=>(r||(r="\\"),e+e+r+"|")),this.debug("tail=%j\n %s",t,t,v,a);const e="*"===v.type?s:"?"===v.type?o:"\\"+v.type;l=!0,a=a.slice(0,v.reStart)+e+"\\("+t}j(),f&&(a+="\\\\");const C=c[a.charAt(0)];for(let t=g.length-1;t>-1;t--){const r=g[t],n=a.slice(0,r.reStart),i=a.slice(r.reStart,r.reEnd-8);let o=a.slice(r.reEnd);const s=a.slice(r.reEnd-8,r.reEnd)+o,u=n.split(")").length,c=n.split("(").length-u;let l=o;for(let t=0;t<c;t++)l=l.replace(/\)[+*?]?/,"");o=l;a=n+i+o+(""===o&&e!==d?"(?:$|\\/)":"")+s}if(""!==a&&l&&(a="(?=.)"+a),C&&(a=(x?"":T?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)")+a),e===d)return[a,l];if(n.nocase&&!l&&(l=t.toUpperCase()!==t.toLowerCase()),!l)return t.replace(/\\(.)/g,"$1");const R=n.nocase?"i":"";try{return Object.assign(new RegExp("^"+a+"$",R),{_glob:t,_src:a})}catch(t){return new RegExp("$.")}}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,n=e.noglobstar?s:e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=e.nocase?"i":"";let o=t.map(t=>(t=t.map(t=>"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===r?r:t._src).reduce((t,e)=>(t[t.length-1]===r&&e===r||t.push(e),t),[]),t.forEach((e,i)=>{e===r&&t[i-1]!==r&&(0===i?t.length>1?t[i+1]="(?:\\/|"+n+"\\/)?"+t[i+1]:t[i]=n:i===t.length-1?t[i-1]+="(?:\\/|"+n+")?":(t[i-1]+="(?:\\/|\\/"+n+"\\/)"+t[i+1],t[i+1]=r))}),t.filter(t=>t!==r).join("/"))).join("|");o="^(?:"+o+")$",this.negate&&(o="^(?!"+o+").*$");try{this.regexp=new RegExp(o,i)}catch(t){this.regexp=!1}return this.regexp}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&r)return!0;const n=this.options;"/"!==e.sep&&(t=t.split(e.sep).join("/")),t=t.split(l),this.debug(this.pattern,"split",t);const i=this.set;let o;this.debug(this.pattern,"set",i);for(let e=t.length-1;e>=0&&(o=t[e],!o);e--);for(let e=0;e<i.length;e++){const s=i[e];let a=t;n.matchBase&&1===s.length&&(a=[o]);if(this.matchOne(a,s,r))return!!n.flipNegate||!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return t.defaults(e).Minimatch}}return t.Minimatch=g,P}function z(){if(A)return F;A=1,F=a;const t=p,{EventEmitter:e}=d,{Minimatch:r}=U(),{resolve:n}=y;function i(e,r){return new Promise((n,o)=>{(r?t.stat:t.lstat)(e,(t,o)=>{if(t)if("ENOENT"===t.code)n(r?i(e,!1):null);else n(null);else n(o)})})}async function*o(e,r,n,s,a,u){let c=await function(e,r){return new Promise((n,i)=>{t.readdir(e,{withFileTypes:!0},(t,e)=>{if(t)switch(t.code){case"ENOTDIR":r?i(t):n([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":n([]);break;default:i(t)}else n(e)})})}(r+e,u);for(const t of c){let u=t.name;void 0===u&&(u=t,s=!0);const c=e+"/"+u,l=c.slice(1),f=r+"/"+l;let h=null;(s||n)&&(h=await i(f,n)),h||void 0===t.name||(h=t),null===h&&(h={isDirectory:()=>!1}),h.isDirectory()?a(l)||(yield{relative:l,absolute:f,stats:h},yield*o(c,r,n,s,a,!1)):yield{relative:l,absolute:f,stats:h}}}class s extends e{constructor(t,e,i){if(super(),"function"==typeof e&&(i=e,e=null),this.options=function(t){return{pattern:t.pattern,dot:!!t.dot,noglobstar:!!t.noglobstar,matchBase:!!t.matchBase,nocase:!!t.nocase,ignore:t.ignore,skip:t.skip,follow:!!t.follow,stat:!!t.stat,nodir:!!t.nodir,mark:!!t.mark,silent:!!t.silent,absolute:!!t.absolute}}(e||{}),this.matchers=[],this.options.pattern){const t=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=t.map(t=>new r(t,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){const t=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=t.map(t=>new r(t,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){const t=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=t.map(t=>new r(t,{dot:!0}))}this.iterator=async function*(t,e,r,n){yield*o("",t,e,r,n,!0)}(n(t||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,i&&(this._matches=[],this.on("match",t=>this._matches.push(this.options.absolute?t.absolute:t.relative)),this.on("error",t=>i(t)),this.on("end",()=>i(null,this._matches))),setTimeout(()=>this._next(),0)}_shouldSkipDirectory(t){return this.skipMatchers.some(e=>e.match(t))}_fileMatches(t,e){const r=t+(e?"/":"");return(0===this.matchers.length||this.matchers.some(t=>t.match(r)))&&!this.ignoreMatchers.some(t=>t.match(r))&&(!this.options.nodir||!e)}_next(){this.paused||this.aborted?this.inactive=!0:this.iterator.next().then(t=>{if(t.done)this.emit("end");else{const e=t.value.stats.isDirectory();if(this._fileMatches(t.value.relative,e)){let r=t.value.relative,n=t.value.absolute;this.options.mark&&e&&(r+="/",n+="/"),this.options.stat?this.emit("match",{relative:r,absolute:n,stat:t.value.stats}):this.emit("match",{relative:r,absolute:n})}this._next(this.iterator)}}).catch(t=>{this.abort(),this.emit("error",t),t.code||this.options.silent||console.error(t)})}abort(){this.aborted=!0}pause(){this.paused=!0}resume(){this.paused=!1,this.inactive&&(this.inactive=!1,this._next())}}function a(t,e,r){return new s(t,e,r)}return a.ReaddirGlob=s,F}function W(t,...e){return(...r)=>t(...e,...r)}function H(t){return function(...e){var r=e.pop();return t.call(this,e,r)}}var $="function"==typeof queueMicrotask&&queueMicrotask,q="function"==typeof setImmediate&&setImmediate,G="object"==typeof process&&"function"==typeof process.nextTick;function V(t){setTimeout(t,0)}function Q(t){return(e,...r)=>t(()=>e(...r))}var Z=Q($?queueMicrotask:q?setImmediate:G?process.nextTick:V);function K(t){return X(t)?function(...e){const r=e.pop();return J(t.apply(this,e),r)}:H(function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return J(n,r);r(null,n)})}function J(t,e){return t.then(t=>{Y(e,null,t)},t=>{Y(e,t&&(t instanceof Error||t.message)?t:new Error(t))})}function Y(t,e,r){try{t(e,r)}catch(t){Z(t=>{throw t},t)}}function X(t){return"AsyncFunction"===t[Symbol.toStringTag]}function tt(t){if("function"!=typeof t)throw new Error("expected a function");return X(t)?K(t):t}function et(t,e){if(e||(e=t.length),!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise((n,i)=>{r[e-1]=(t,...e)=>{if(t)return i(t);n(e.length>1?e:e[0])},t.apply(this,r)})}}function rt(t){return function(e,...r){return et(function(n){var i=this;return t(e,(t,e)=>{tt(t).apply(i,r.concat(e))},n)})}}function nt(t,e,r,n){e=e||[];var i=[],o=0,s=tt(r);return t(e,(t,e,r)=>{var n=o++;s(t,(t,e)=>{i[n]=e,r(t)})},t=>{n(t,i)})}function it(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}const ot={};function st(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e}function at(t){if(it(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e,r,n,i,o=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()}(t);return o?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(o):(r=(e=t)?Object.keys(e):[],n=-1,i=r.length,function t(){var o=r[++n];return"__proto__"===o?t():n<i?{value:e[o],key:o}:null})}function ut(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}}function ct(t,e,r,n){let i=!1,o=!1,s=!1,a=0,u=0;function c(){a>=e||s||i||(s=!0,t.next().then(({value:t,done:e})=>{if(!o&&!i){if(s=!1,e)return i=!0,void(a<=0&&n(null));a++,r(t,u,l),u++,c()}}).catch(f))}function l(t,e){if(a-=1,!o)return t?f(t):!1===t?(i=!0,void(o=!0)):e===ot||i&&a<=0?(i=!0,n(null)):void c()}function f(t){o||(s=!1,i=!0,n(t))}c()}var lt=t=>(e,r,n)=>{if(n=st(n),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return n(null);if("AsyncGenerator"===e[Symbol.toStringTag])return ct(e,t,r,n);if(function(t){return"function"==typeof t[Symbol.asyncIterator]}(e))return ct(e[Symbol.asyncIterator](),t,r,n);var i=at(e),o=!1,s=!1,a=0,u=!1;function c(t,e){if(!s)if(a-=1,t)o=!0,n(t);else if(!1===t)o=!0,s=!0;else{if(e===ot||o&&a<=0)return o=!0,n(null);u||l()}}function l(){for(u=!0;a<t&&!o;){var e=i();if(null===e)return o=!0,void(a<=0&&n(null));a+=1,r(e.value,e.key,ut(c))}u=!1}l()};var ft=et(function(t,e,r,n){return lt(e)(t,tt(r),n)},4);function ht(t,e,r){r=st(r);var n=0,i=0,{length:o}=t,s=!1;function a(t,e){!1===t&&(s=!0),!0!==s&&(t?r(t):++i!==o&&e!==ot||r(null))}for(0===o&&r(null);n<o;n++)e(t[n],n,ut(a))}function pt(t,e,r){return ft(t,1/0,e,r)}var dt=et(function(t,e,r){return(it(t)?ht:pt)(t,tt(e),r)},3);var yt=et(function(t,e,r){return nt(dt,t,e,r)},3),mt=rt(yt);var gt=et(function(t,e,r){return ft(t,1,e,r)},3);var _t=et(function(t,e,r){return nt(gt,t,e,r)},3),bt=rt(_t);const vt=Symbol("promiseCallback");function wt(){let t,e;function r(r,...n){if(r)return e(r);t(n.length>1?n:n[0])}return r[vt]=new Promise((r,n)=>{t=r,e=n}),r}function St(t,e,r){"number"!=typeof e&&(r=e,e=null),r=st(r||wt());var n=Object.keys(t).length;if(!n)return r(null);e||(e=n);var i={},o=0,s=!1,a=!1,u=Object.create(null),c=[],l=[],f={};function h(t,e){c.push(()=>function(t,e){if(a)return;var n=ut((e,...n)=>{if(o--,!1!==e)if(n.length<2&&([n]=n),e){var c={};if(Object.keys(i).forEach(t=>{c[t]=i[t]}),c[t]=n,a=!0,u=Object.create(null),s)return;r(e,c)}else i[t]=n,(u[t]||[]).forEach(t=>t()),p();else s=!0});o++;var c=tt(e[e.length-1]);e.length>1?c(i,n):c(n)}(t,e))}function p(){if(!s){if(0===c.length&&0===o)return r(null,i);for(;c.length&&o<e;){c.shift()()}}}function d(e){var r=[];return Object.keys(t).forEach(n=>{const i=t[n];Array.isArray(i)&&i.indexOf(e)>=0&&r.push(n)}),r}return Object.keys(t).forEach(e=>{var r=t[e];if(!Array.isArray(r))return h(e,[r]),void l.push(e);var n=r.slice(0,r.length-1),i=n.length;if(0===i)return h(e,r),void l.push(e);f[e]=i,n.forEach(o=>{if(!t[o])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+o+"` in "+n.join(", "));!function(t,e){var r=u[t];r||(r=u[t]=[]);r.push(e)}(o,()=>{0===--i&&h(e,r)})})}),function(){var t=0;for(;l.length;)t++,d(l.pop()).forEach(t=>{0===--f[t]&&l.push(t)});if(t!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p(),r[vt]}var Et=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,kt=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,xt=/,/,Tt=/(=.+)?(\s*)$/;function Ot(t,e){var r={};return Object.keys(t).forEach(e=>{var n,i=t[e],o=X(i),s=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))n=[...i],i=n.pop(),r[e]=n.concat(n.length>0?a:i);else if(s)r[e]=i;else{if(n=function(t){const e=function(t){let e="",r=0,n=t.indexOf("*/");for(;r<t.length;)if("/"===t[r]&&"/"===t[r+1]){let e=t.indexOf("\n",r);r=-1===e?t.length:e}else if(-1!==n&&"/"===t[r]&&"*"===t[r+1]){let i=t.indexOf("*/",r);-1!==i?(r=i+2,n=t.indexOf("*/",r)):(e+=t[r],r++)}else e+=t[r],r++;return e}(t.toString());let r=e.match(Et);if(r||(r=e.match(kt)),!r)throw new Error("could not parse args in autoInject\nSource:\n"+e);let[,n]=r;return n.replace(/\s/g,"").split(xt).map(t=>t.replace(Tt,"").trim())}(i),0===i.length&&!o&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");o||n.pop(),r[e]=n.concat(a)}function a(t,e){var r=n.map(e=>t[e]);r.push(e),tt(i)(...r)}}),St(r,e)}class jt{constructor(){this.head=this.tail=null,this.length=0}removeLink(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t}empty(){for(;this.head;)this.shift();return this}insertAfter(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1}insertBefore(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1}unshift(t){this.head?this.insertBefore(this.head,t):Ct(this,t)}push(t){this.tail?this.insertAfter(this.tail,t):Ct(this,t)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var t=this.head;t;)yield t.data,t=t.next}remove(t){for(var e=this.head;e;){var{next:r}=e;t(e)&&this.removeLink(e),e=r}return this}}function Ct(t,e){t.length=1,t.head=t.tail=e}function Rt(t,e,r){if(null==e)e=1;else if(0===e)throw new RangeError("Concurrency must not be zero");var n=tt(t),i=0,o=[];const s={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(t,e){return t?e?void(s[t]=s[t].filter(t=>t!==e)):s[t]=[]:Object.keys(s).forEach(t=>s[t]=[])}function u(t,...e){s[t].forEach(t=>t(...e))}var c=!1;function l(t,e,r,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");var i,o;function s(t,...e){return t?r?o(t):i():e.length<=1?i(e[0]):void i(e)}y.started=!0;var a=y._createTaskItem(t,r?s:n||s);if(e?y._tasks.unshift(a):y._tasks.push(a),c||(c=!0,Z(()=>{c=!1,y.process()})),r||!n)return new Promise((t,e)=>{i=t,o=e})}function f(t){return function(e,...r){i-=1;for(var n=0,s=t.length;n<s;n++){var a=t[n],c=o.indexOf(a);0===c?o.shift():c>0&&o.splice(c,1),a.callback(e,...r),null!=e&&u("error",e,a.data)}i<=y.concurrency-y.buffer&&u("unsaturated"),y.idle()&&u("drain"),y.process()}}function h(t){return!(0!==t.length||!y.idle())&&(Z(()=>u("drain")),!0)}const p=t=>e=>{if(!e)return new Promise((e,r)=>{!function(t,e){const r=(...n)=>{a(t,r),e(...n)};s[t].push(r)}(t,(t,n)=>{if(t)return r(t);e(n)})});a(t),function(t,e){s[t].push(e)}(t,e)};var d=!1,y={_tasks:new jt,_createTaskItem:(t,e)=>({data:t,callback:e}),*[Symbol.iterator](){yield*y._tasks[Symbol.iterator]()},concurrency:e,payload:r,buffer:e/4,started:!1,paused:!1,push(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!1,!1,e))}return l(t,!1,!1,e)},pushAsync(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!1,!0,e))}return l(t,!1,!0,e)},kill(){a(),y._tasks.empty()},unshift(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!0,!1,e))}return l(t,!0,!1,e)},unshiftAsync(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!0,!0,e))}return l(t,!0,!0,e)},remove(t){y._tasks.remove(t)},process(){if(!d){for(d=!0;!y.paused&&i<y.concurrency&&y._tasks.length;){var t=[],e=[],r=y._tasks.length;y.payload&&(r=Math.min(r,y.payload));for(var s=0;s<r;s++){var a=y._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===y._tasks.length&&u("empty"),i===y.concurrency&&u("saturated");var c=ut(f(t));n(e,c)}d=!1}},length:()=>y._tasks.length,running:()=>i,workersList:()=>o,idle:()=>y._tasks.length+i===0,pause(){y.paused=!0},resume(){!1!==y.paused&&(y.paused=!1,Z(y.process))}};return Object.defineProperties(y,{saturated:{writable:!1,value:p("saturated")},unsaturated:{writable:!1,value:p("unsaturated")},empty:{writable:!1,value:p("empty")},drain:{writable:!1,value:p("drain")},error:{writable:!1,value:p("error")}}),y}function Pt(t,e){return Rt(t,1,e)}function Lt(t,e,r){return Rt(t,e,r)}var Ft=et(function(t,e,r,n){n=st(n);var i=tt(r);return gt(t,(t,r,n)=>{i(e,t,(t,r)=>{e=r,n(t)})},t=>n(t,e))},4);function At(...t){var e=t.map(tt);return function(...t){var r=this,n=t[t.length-1];return"function"==typeof n?t.pop():n=wt(),Ft(e,t,(t,e,n)=>{e.apply(r,t.concat((t,...e)=>{n(t,e)}))},(t,e)=>n(t,...e)),n[vt]}}function It(...t){return At(...t.reverse())}var Dt=et(function(t,e,r,n){return nt(lt(e),t,r,n)},4);var Mt=et(function(t,e,r,n){var i=tt(r);return Dt(t,e,(t,e)=>{i(t,(t,...r)=>t?e(t):e(t,r))},(t,e)=>{for(var r=[],i=0;i<e.length;i++)e[i]&&(r=r.concat(...e[i]));return n(t,r)})},4);var Nt=et(function(t,e,r){return Mt(t,1/0,e,r)},3);var Bt=et(function(t,e,r){return Mt(t,1,e,r)},3);function Ut(...t){return function(...e){return e.pop()(null,...t)}}function zt(t,e){return(r,n,i,o)=>{var s,a=!1;const u=tt(i);r(n,(r,n,i)=>{u(r,(n,o)=>n||!1===n?i(n):t(o)&&!s?(a=!0,s=e(!0,r),i(null,ot)):void i())},t=>{if(t)return o(t);o(null,a?s:e(!1))})}}var Wt=et(function(t,e,r){return zt(t=>t,(t,e)=>e)(dt,t,e,r)},3);var Ht=et(function(t,e,r,n){return zt(t=>t,(t,e)=>e)(lt(e),t,r,n)},4);var $t=et(function(t,e,r){return zt(t=>t,(t,e)=>e)(lt(1),t,e,r)},3);function qt(t){return(e,...r)=>tt(e)(...r,(e,...r)=>{"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&r.forEach(e=>console[t](e)))})}var Gt=qt("dir");var Vt=et(function(t,e,r){r=ut(r);var n,i=tt(t),o=tt(e);function s(t,...e){if(t)return r(t);!1!==t&&(n=e,o(...e,a))}function a(t,e){return t?r(t):!1!==t?e?void i(s):r(null,...n):void 0}return a(null,!0)},3);function Qt(t,e,r){const n=tt(e);return Vt(t,(...t)=>{const e=t.pop();n(...t,(t,r)=>e(t,!r))},r)}function Zt(t){return(e,r,n)=>t(e,n)}var Kt=et(function(t,e,r){return dt(t,Zt(tt(e)),r)},3);var Jt=et(function(t,e,r,n){return lt(e)(t,Zt(tt(r)),n)},4);var Yt=et(function(t,e,r){return Jt(t,1,e,r)},3);function Xt(t){return X(t)?t:function(...e){var r=e.pop(),n=!0;e.push((...t)=>{n?Z(()=>r(...t)):r(...t)}),t.apply(this,e),n=!1}}var te=et(function(t,e,r){return zt(t=>!t,t=>!t)(dt,t,e,r)},3);var ee=et(function(t,e,r,n){return zt(t=>!t,t=>!t)(lt(e),t,r,n)},4);var re=et(function(t,e,r){return zt(t=>!t,t=>!t)(gt,t,e,r)},3);function ne(t,e,r,n){var i=new Array(e.length);t(e,(t,e,n)=>{r(t,(t,r)=>{i[e]=!!r,n(t)})},t=>{if(t)return n(t);for(var r=[],o=0;o<e.length;o++)i[o]&&r.push(e[o]);n(null,r)})}function ie(t,e,r,n){var i=[];t(e,(t,e,n)=>{r(t,(r,o)=>{if(r)return n(r);o&&i.push({index:e,value:t}),n(r)})},t=>{if(t)return n(t);n(null,i.sort((t,e)=>t.index-e.index).map(t=>t.value))})}function oe(t,e,r,n){return(it(e)?ne:ie)(t,e,tt(r),n)}var se=et(function(t,e,r){return oe(dt,t,e,r)},3);var ae=et(function(t,e,r,n){return oe(lt(e),t,r,n)},4);var ue=et(function(t,e,r){return oe(gt,t,e,r)},3);var ce=et(function(t,e){var r=ut(e),n=tt(Xt(t));return function t(e){if(e)return r(e);!1!==e&&n(t)}()},2);var le=et(function(t,e,r,n){var i=tt(r);return Dt(t,e,(t,e)=>{i(t,(r,n)=>r?e(r):e(r,{key:n,val:t}))},(t,e)=>{for(var r={},{hasOwnProperty:i}=Object.prototype,o=0;o<e.length;o++)if(e[o]){var{key:s}=e[o],{val:a}=e[o];i.call(r,s)?r[s].push(a):r[s]=[a]}return n(t,r)})},4);function fe(t,e,r){return le(t,1/0,e,r)}function he(t,e,r){return le(t,1,e,r)}var pe=qt("log");var de=et(function(t,e,r,n){n=st(n);var i={},o=tt(r);return lt(e)(t,(t,e,r)=>{o(t,e,(t,n)=>{if(t)return r(t);i[e]=n,r(t)})},t=>n(t,i))},4);function ye(t,e,r){return de(t,1/0,e,r)}function me(t,e,r){return de(t,1,e,r)}function ge(t,e=t=>t){var r=Object.create(null),n=Object.create(null),i=tt(t),o=H((t,o)=>{var s=e(...t);s in r?Z(()=>o(null,...r[s])):s in n?n[s].push(o):(n[s]=[o],i(...t,(t,...e)=>{t||(r[s]=e);var i=n[s];delete n[s];for(var o=0,a=i.length;o<a;o++)i[o](t,...e)}))});return o.memo=r,o.unmemoized=t,o}var _e=Q(G?process.nextTick:q?setImmediate:V),be=et((t,e,r)=>{var n=it(e)?[]:{};t(e,(t,e,r)=>{tt(t)((t,...i)=>{i.length<2&&([i]=i),n[e]=i,r(t)})},t=>r(t,n))},3);function ve(t,e){return be(dt,t,e)}function we(t,e,r){return be(lt(e),t,r)}function Se(t,e){var r=tt(t);return Rt((t,e)=>{r(t[0],e)},e,1)}class Ee{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(t){let e;for(;t>0&&Te(this.heap[t],this.heap[e=xe(t)]);){let r=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=r,t=e}}percDown(t){let e;for(;(e=ke(t))<this.heap.length&&(e+1<this.heap.length&&Te(this.heap[e+1],this.heap[e])&&(e+=1),!Te(this.heap[t],this.heap[e]));){let r=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=r,t=e}}push(t){t.pushCount=++this.pushCount,this.heap.push(t),this.percUp(this.heap.length-1)}unshift(t){return this.heap.push(t)}shift(){let[t]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),t}toArray(){return[...this]}*[Symbol.iterator](){for(let t=0;t<this.heap.length;t++)yield this.heap[t].data}remove(t){let e=0;for(let r=0;r<this.heap.length;r++)t(this.heap[r])||(this.heap[e]=this.heap[r],e++);this.heap.splice(e);for(let t=xe(this.heap.length-1);t>=0;t--)this.percDown(t);return this}}function ke(t){return 1+(t<<1)}function xe(t){return(t+1>>1)-1}function Te(t,e){return t.priority!==e.priority?t.priority<e.priority:t.pushCount<e.pushCount}function Oe(t,e){var r=Se(t,e),{push:n,pushAsync:i}=r;function o(t,e){return Array.isArray(t)?t.map(t=>({data:t,priority:e})):{data:t,priority:e}}return r._tasks=new Ee,r._createTaskItem=({data:t,priority:e},r)=>({data:t,priority:e,callback:r}),r.push=function(t,e=0,r){return n(o(t,e),r)},r.pushAsync=function(t,e=0,r){return i(o(t,e),r)},delete r.unshift,delete r.unshiftAsync,r}var je=et(function(t,e){if(e=st(e),!Array.isArray(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var r=0,n=t.length;r<n;r++)tt(t[r])(e)},2);function Ce(t,e,r,n){var i=[...t].reverse();return Ft(i,e,r,n)}function Re(t){var e=tt(t);return H(function(t,r){return t.push((t,...e)=>{let n={};if(t&&(n.error=t),e.length>0){var i=e;e.length<=1&&([i]=e),n.value=i}r(null,n)}),e.apply(this,t)})}function Pe(t){var e;return Array.isArray(t)?e=t.map(Re):(e={},Object.keys(t).forEach(r=>{e[r]=Re.call(this,t[r])})),e}function Le(t,e,r,n){const i=tt(r);return oe(t,e,(t,e)=>{i(t,(t,r)=>{e(t,!r)})},n)}var Fe=et(function(t,e,r){return Le(dt,t,e,r)},3);var Ae=et(function(t,e,r,n){return Le(lt(e),t,r,n)},4);var Ie=et(function(t,e,r){return Le(gt,t,e,r)},3);function De(t){return function(){return t}}function Me(t,e,r){var n={times:5,intervalFunc:De(0)};if(arguments.length<3&&"function"==typeof t?(r=e||wt(),e=t):(!function(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:De(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}(n,t),r=r||wt()),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var i=tt(e),o=1;return function t(){i((e,...i)=>{!1!==e&&(e&&o++<n.times&&("function"!=typeof n.errorFilter||n.errorFilter(e))?setTimeout(t,n.intervalFunc(o-1)):r(e,...i))})}(),r[vt]}function Ne(t,e){e||(e=t,t=null);let r=t&&t.arity||e.length;X(e)&&(r+=1);var n=tt(e);return H((e,i)=>{function o(t){n(...e,t)}return(e.length<r-1||null==i)&&(e.push(i),i=wt()),t?Me(t,o,i):Me(o,i),i[vt]})}function Be(t,e){return be(gt,t,e)}var Ue=et(function(t,e,r){return zt(Boolean,t=>t)(dt,t,e,r)},3);var ze=et(function(t,e,r,n){return zt(Boolean,t=>t)(lt(e),t,r,n)},4);var We=et(function(t,e,r){return zt(Boolean,t=>t)(gt,t,e,r)},3);var He=et(function(t,e,r){var n=tt(e);return yt(t,(t,e)=>{n(t,(r,n)=>{if(r)return e(r);e(r,{value:t,criteria:n})})},(t,e)=>{if(t)return r(t);r(null,e.sort(i).map(t=>t.value))});function i(t,e){var r=t.criteria,n=e.criteria;return r<n?-1:r>n?1:0}},3);function $e(t,e,r){var n=tt(t);return H((i,o)=>{var s,a=!1;i.push((...t)=>{a||(o(...t),clearTimeout(s))}),s=setTimeout(function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)},e),n(...i)})}function qe(t,e,r,n){var i=tt(r);return Dt(function(t){for(var e=Array(t);t--;)e[t]=t;return e}(t),e,i,n)}function Ge(t,e,r){return qe(t,1/0,e,r)}function Ve(t,e,r){return qe(t,1,e,r)}function Qe(t,e,r,n){arguments.length<=3&&"function"==typeof e&&(n=r,r=e,e=Array.isArray(t)?[]:{}),n=st(n||wt());var i=tt(r);return dt(t,(t,r,n)=>{i(e,t,r,n)},t=>n(t,e)),n[vt]}var Ze=et(function(t,e){var r,n=null;return Yt(t,(t,e)=>{tt(t)((t,...i)=>{if(!1===t)return e(t);i.length<2?[r]=i:r=i,n=t,e(t?null:{})})},()=>e(n,r))});function Ke(t){return(...e)=>(t.unmemoized||t)(...e)}var Je=et(function(t,e,r){r=ut(r);var n=tt(e),i=tt(t),o=[];function s(t,...e){if(t)return r(t);o=e,!1!==t&&i(a)}function a(t,e){return t?r(t):!1!==t?e?void n(s):r(null,...o):void 0}return i(a)},3);function Ye(t,e,r){const n=tt(t);return Je(t=>n((e,r)=>t(e,!r)),e,r)}var Xe,tr,er,rr,nr,ir,or,sr,ar=et(function(t,e){if(e=st(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function n(e){tt(t[r++])(...e,ut(i))}function i(i,...o){if(!1!==i)return i||r===t.length?e(i,...o):void n(o)}n([])}),ur={apply:W,applyEach:mt,applyEachSeries:bt,asyncify:K,auto:St,autoInject:Ot,cargo:Pt,cargoQueue:Lt,compose:It,concat:Nt,concatLimit:Mt,concatSeries:Bt,constant:Ut,detect:Wt,detectLimit:Ht,detectSeries:$t,dir:Gt,doUntil:Qt,doWhilst:Vt,each:Kt,eachLimit:Jt,eachOf:dt,eachOfLimit:ft,eachOfSeries:gt,eachSeries:Yt,ensureAsync:Xt,every:te,everyLimit:ee,everySeries:re,filter:se,filterLimit:ae,filterSeries:ue,forever:ce,groupBy:fe,groupByLimit:le,groupBySeries:he,log:pe,map:yt,mapLimit:Dt,mapSeries:_t,mapValues:ye,mapValuesLimit:de,mapValuesSeries:me,memoize:ge,nextTick:_e,parallel:ve,parallelLimit:we,priorityQueue:Oe,queue:Se,race:je,reduce:Ft,reduceRight:Ce,reflect:Re,reflectAll:Pe,reject:Fe,rejectLimit:Ae,rejectSeries:Ie,retry:Me,retryable:Ne,seq:At,series:Be,setImmediate:Z,some:Ue,someLimit:ze,someSeries:We,sortBy:He,timeout:$e,times:Ge,timesLimit:qe,timesSeries:Ve,transform:Qe,tryEach:Ze,unmemoize:Ke,until:Ye,waterfall:ar,whilst:Je,all:te,allLimit:ee,allSeries:re,any:Ue,anyLimit:ze,anySeries:We,find:Wt,findLimit:Ht,findSeries:$t,flatMap:Nt,flatMapLimit:Mt,flatMapSeries:Bt,forEach:Kt,forEachSeries:Yt,forEachLimit:Jt,forEachOf:dt,forEachOfSeries:gt,forEachOfLimit:ft,inject:Ft,foldl:Ft,foldr:Ce,select:se,selectLimit:ae,selectSeries:ue,wrapSync:K,during:Je,doDuring:Vt},cr=M(Object.freeze({__proto__:null,all:te,allLimit:ee,allSeries:re,any:Ue,anyLimit:ze,anySeries:We,apply:W,applyEach:mt,applyEachSeries:bt,asyncify:K,auto:St,autoInject:Ot,cargo:Pt,cargoQueue:Lt,compose:It,concat:Nt,concatLimit:Mt,concatSeries:Bt,constant:Ut,default:ur,detect:Wt,detectLimit:Ht,detectSeries:$t,dir:Gt,doDuring:Vt,doUntil:Qt,doWhilst:Vt,during:Je,each:Kt,eachLimit:Jt,eachOf:dt,eachOfLimit:ft,eachOfSeries:gt,eachSeries:Yt,ensureAsync:Xt,every:te,everyLimit:ee,everySeries:re,filter:se,filterLimit:ae,filterSeries:ue,find:Wt,findLimit:Ht,findSeries:$t,flatMap:Nt,flatMapLimit:Mt,flatMapSeries:Bt,foldl:Ft,foldr:Ce,forEach:Kt,forEachLimit:Jt,forEachOf:dt,forEachOfLimit:ft,forEachOfSeries:gt,forEachSeries:Yt,forever:ce,groupBy:fe,groupByLimit:le,groupBySeries:he,inject:Ft,log:pe,map:yt,mapLimit:Dt,mapSeries:_t,mapValues:ye,mapValuesLimit:de,mapValuesSeries:me,memoize:ge,nextTick:_e,parallel:ve,parallelLimit:we,priorityQueue:Oe,queue:Se,race:je,reduce:Ft,reduceRight:Ce,reflect:Re,reflectAll:Pe,reject:Fe,rejectLimit:Ae,rejectSeries:Ie,retry:Me,retryable:Ne,select:se,selectLimit:ae,selectSeries:ue,seq:At,series:Be,setImmediate:Z,some:Ue,someLimit:ze,someSeries:We,sortBy:He,timeout:$e,times:Ge,timesLimit:qe,timesSeries:Ve,transform:Qe,tryEach:Ze,unmemoize:Ke,until:Ye,waterfall:ar,whilst:Je,wrapSync:K})),lr={exports:{}};function fr(){if(tr)return Xe;tr=1;var t=m,e=process.cwd,r=null,n=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return r||(r=e.call(process)),r};try{process.cwd()}catch(t){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(t){r=null,i.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return Xe=function(e){t.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(r,n,i){e.open(r,t.O_WRONLY|t.O_SYMLINK,n,function(t,r){t?i&&i(t):e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(r,n){var i,o=e.openSync(r,t.O_WRONLY|t.O_SYMLINK,n),s=!0;try{i=e.fchmodSync(o,n),s=!1}finally{if(s)try{e.closeSync(o)}catch(t){}else e.closeSync(o)}return i}}(e);e.lutimes||function(e){t.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(r,n,i,o){e.open(r,t.O_SYMLINK,function(t,r){t?o&&o(t):e.futimes(r,n,i,function(t){e.close(r,function(e){o&&o(t||e)})})})},e.lutimesSync=function(r,n,i){var o,s=e.openSync(r,t.O_SYMLINK),a=!0;try{o=e.futimesSync(s,n,i),a=!1}finally{if(a)try{e.closeSync(s)}catch(t){}else e.closeSync(s)}return o}):e.futimes&&(e.lutimes=function(t,e,r,n){n&&process.nextTick(n)},e.lutimesSync=function(){})}(e);e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(t,e,r){r&&process.nextTick(r)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(t,e,r,n){n&&process.nextTick(n)},e.lchownSync=function(){});"win32"===n&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function r(r,n,i){var o=Date.now(),s=0;t(r,n,function a(u){if(u&&("EACCES"===u.code||"EPERM"===u.code||"EBUSY"===u.code)&&Date.now()-o<6e4)return setTimeout(function(){e.stat(n,function(e,o){e&&"ENOENT"===e.code?t(r,n,a):i(u)})},s),void(s<100&&(s+=10));i&&i(u)})}return Object.setPrototypeOf&&Object.setPrototypeOf(r,t),r}(e.rename));function r(t){return t?function(r,n,i){return t.call(e,r,n,function(t){c(t)&&(t=null),i&&i.apply(this,arguments)})}:t}function i(t){return t?function(r,n){try{return t.call(e,r,n)}catch(t){if(!c(t))throw t}}:t}function o(t){return t?function(r,n,i,o){return t.call(e,r,n,i,function(t){c(t)&&(t=null),o&&o.apply(this,arguments)})}:t}function s(t){return t?function(r,n,i){try{return t.call(e,r,n,i)}catch(t){if(!c(t))throw t}}:t}function a(t){return t?function(r,n,i){function o(t,e){e&&(e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof n&&(i=n,n=null),n?t.call(e,r,n,o):t.call(e,r,o)}:t}function u(t){return t?function(r,n){var i=n?t.call(e,r,n):t.call(e,r);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:t}function c(t){return!t||("ENOSYS"===t.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==t.code&&"EPERM"!==t.code))}e.read="function"!=typeof e.read?e.read:function(t){function r(r,n,i,o,s,a){var u;if(a&&"function"==typeof a){var c=0;u=function(l,f,h){if(l&&"EAGAIN"===l.code&&c<10)return c++,t.call(e,r,n,i,o,s,u);a.apply(this,arguments)}}return t.call(e,r,n,i,o,s,u)}return Object.setPrototypeOf&&Object.setPrototypeOf(r,t),r}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(l=e.readSync,function(t,r,n,i,o){for(var s=0;;)try{return l.call(e,t,r,n,i,o)}catch(t){if("EAGAIN"===t.code&&s<10){s++;continue}throw t}});var l},Xe}function hr(){if(sr)return or;sr=1;var t,e,r=p,n=fr(),i=function(){if(rr)return er;rr=1;var t=g.Stream;return er=function(e){return{ReadStream:function r(n,i){if(!(this instanceof r))return new r(n,i);t.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var s=Object.keys(i),a=0,u=s.length;a<u;a++){var c=s[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?e.open(this.path,this.flags,this.mode,function(t,e){if(t)return o.emit("error",t),void(o.readable=!1);o.fd=e,o.emit("open",e),o._read()}):process.nextTick(function(){o._read()})},WriteStream:function r(n,i){if(!(this instanceof r))return new r(n,i);t.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var u=o[s];this[u]=i[u]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},er}(),o=function(){if(ir)return nr;ir=1,nr=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var r={__proto__:t(e)};else r=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}),r};var t=Object.getPrototypeOf||function(t){return t.__proto__};return nr}(),s=b;function a(e,r){Object.defineProperty(e,t,{get:function(){return r}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(t=Symbol.for("graceful-fs.queue"),e=Symbol.for("graceful-fs.previous")):(t="___graceful-fs.queue",e="___graceful-fs.previous");var u,c=function(){};if(s.debuglog?c=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(c=function(){var t=s.format.apply(s,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: "),console.error(t)}),!r[t]){var l=I[t]||[];a(r,l),r.close=function(t){function n(e,n){return t.call(r,e,function(t){t||d(),"function"==typeof n&&n.apply(this,arguments)})}return Object.defineProperty(n,e,{value:t}),n}(r.close),r.closeSync=function(t){function n(e){t.apply(r,arguments),d()}return Object.defineProperty(n,e,{value:t}),n}(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){c(r[t]),v.equal(r[t].length,0)})}function f(t){n(t),t.gracefulify=f,t.createReadStream=function(e,r){return new t.ReadStream(e,r)},t.createWriteStream=function(e,r){return new t.WriteStream(e,r)};var e=t.readFile;t.readFile=function(t,r,n){"function"==typeof r&&(n=r,r=null);return function t(r,n,i,o){return e(r,n,function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof i&&i.apply(this,arguments):h([t,[r,n,i],e,o||Date.now(),Date.now()])})}(t,r,n)};var r=t.writeFile;t.writeFile=function(t,e,n,i){"function"==typeof n&&(i=n,n=null);return function t(e,n,i,o,s){return r(e,n,i,function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):h([t,[e,n,i,o],r,s||Date.now(),Date.now()])})}(t,e,n,i)};var o=t.appendFile;o&&(t.appendFile=function(t,e,r,n){"function"==typeof r&&(n=r,r=null);return function t(e,r,n,i,s){return o(e,r,n,function(o){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof i&&i.apply(this,arguments):h([t,[e,r,n,i],o,s||Date.now(),Date.now()])})}(t,e,r,n)});var s=t.copyFile;s&&(t.copyFile=function(t,e,r,n){"function"==typeof r&&(n=r,r=0);return function t(e,r,n,i,o){return s(e,r,n,function(s){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):h([t,[e,r,n,i],s,o||Date.now(),Date.now()])})}(t,e,r,n)});var a=t.readdir;t.readdir=function(t,e,r){"function"==typeof e&&(r=e,e=null);var n=u.test(process.version)?function(t,e,r,n){return a(t,i(t,e,r,n))}:function(t,e,r,n){return a(t,e,i(t,e,r,n))};return n(t,e,r);function i(t,e,r,i){return function(o,s){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(s&&s.sort&&s.sort(),"function"==typeof r&&r.call(this,o,s)):h([n,[t,e,r],o,i||Date.now(),Date.now()])}}};var u=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var c=i(t);m=c.ReadStream,g=c.WriteStream}var l=t.ReadStream;l&&(m.prototype=Object.create(l.prototype),m.prototype.open=function(){var t=this;b(t.path,t.flags,t.mode,function(e,r){e?(t.autoClose&&t.destroy(),t.emit("error",e)):(t.fd=r,t.emit("open",r),t.read())})});var p=t.WriteStream;p&&(g.prototype=Object.create(p.prototype),g.prototype.open=function(){var t=this;b(t.path,t.flags,t.mode,function(e,r){e?(t.destroy(),t.emit("error",e)):(t.fd=r,t.emit("open",r))})}),Object.defineProperty(t,"ReadStream",{get:function(){return m},set:function(t){m=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(t){g=t},enumerable:!0,configurable:!0});var d=m;Object.defineProperty(t,"FileReadStream",{get:function(){return d},set:function(t){d=t},enumerable:!0,configurable:!0});var y=g;function m(t,e){return this instanceof m?(l.apply(this,arguments),this):m.apply(Object.create(m.prototype),arguments)}function g(t,e){return this instanceof g?(p.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(t){y=t},enumerable:!0,configurable:!0});var _=t.open;function b(t,e,r,n){return"function"==typeof r&&(n=r,r=null),function t(e,r,n,i,o){return _(e,r,n,function(s,a){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):h([t,[e,r,n,i],s,o||Date.now(),Date.now()])})}(t,e,r,n)}return t.open=b,t}function h(e){c("ENQUEUE",e[0].name,e[1]),r[t].push(e),y()}function d(){for(var e=Date.now(),n=0;n<r[t].length;++n)r[t][n].length>2&&(r[t][n][3]=e,r[t][n][4]=e);y()}function y(){if(clearTimeout(u),u=void 0,0!==r[t].length){var e=r[t].shift(),n=e[0],i=e[1],o=e[2],s=e[3],a=e[4];if(void 0===s)c("RETRY",n.name,i),n.apply(null,i);else if(Date.now()-s>=6e4){c("TIMEOUT",n.name,i);var l=i.pop();"function"==typeof l&&l.call(null,o)}else{var f=Date.now()-a,h=Math.max(a-s,1);f>=Math.min(1.2*h,100)?(c("RETRY",n.name,i),n.apply(null,i.concat([s]))):r[t].push(e)}void 0===u&&(u=setTimeout(y,0))}}return I[t]||a(I,r[t]),or=f(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(or=f(r),r.__patched=!0),or}var pr,dr,yr,mr,gr,_r={exports:{}},br={exports:{}};function vr(){if(pr)return br.exports;return pr=1,"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?br.exports={nextTick:function(t,e,r,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,o,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(t);case 2:return process.nextTick(function(){t.call(null,e)});case 3:return process.nextTick(function(){t.call(null,e,r)});case 4:return process.nextTick(function(){t.call(null,e,r,n)});default:for(i=new Array(s-1),o=0;o<i.length;)i[o++]=arguments[o];return process.nextTick(function(){t.apply(null,i)})}}}:br.exports=process,br.exports}function wr(){if(yr)return dr;yr=1;var t={}.toString;return dr=Array.isArray||function(e){return"[object Array]"==t.call(e)}}function Sr(){return gr?mr:(gr=1,mr=g)}var Er,kr={exports:{}};function xr(){return Er||(Er=1,function(t,e){var r=w,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(kr,kr.exports)),kr.exports}var Tr,Or={};function jr(){if(Tr)return Or;function t(t){return Object.prototype.toString.call(t)}return Tr=1,Or.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},Or.isBoolean=function(t){return"boolean"==typeof t},Or.isNull=function(t){return null===t},Or.isNullOrUndefined=function(t){return null==t},Or.isNumber=function(t){return"number"==typeof t},Or.isString=function(t){return"string"==typeof t},Or.isSymbol=function(t){return"symbol"==typeof t},Or.isUndefined=function(t){return void 0===t},Or.isRegExp=function(e){return"[object RegExp]"===t(e)},Or.isObject=function(t){return"object"==typeof t&&null!==t},Or.isDate=function(e){return"[object Date]"===t(e)},Or.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},Or.isFunction=function(t){return"function"==typeof t},Or.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},Or.isBuffer=w.Buffer.isBuffer,Or}var Cr,Rr,Pr={exports:{}},Lr={exports:{}};function Fr(){if(Rr)return Pr.exports;Rr=1;try{var t=require("util");if("function"!=typeof t.inherits)throw"";Pr.exports=t.inherits}catch(t){Pr.exports=(Cr||(Cr=1,"function"==typeof Object.create?Lr.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Lr.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}),Lr.exports)}return Pr.exports}var Ar,Ir,Dr,Mr,Nr,Br,Ur,zr,Wr,Hr={exports:{}};function $r(){return Ar||(Ar=1,function(t){var e=xr().Buffer,r=b;function n(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),i=this.head,o=0;i;)n(i.data,r,o),o+=i.data.length,i=i.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(Hr)),Hr.exports}function qr(){if(Dr)return Ir;Dr=1;var t=vr();function e(t,e){t.emit("error",e)}return Ir={destroy:function(r,n){var i=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(n?n(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(e,this,r)):t.nextTick(e,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(r){!n&&r?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,t.nextTick(e,i,r)):t.nextTick(e,i,r):n&&n(r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}function Gr(){return Nr?Mr:(Nr=1,Mr=b.deprecate)}function Vr(){if(Ur)return Br;Ur=1;var t=vr();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}Br=p;var r,n=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=h;var i=Object.create(jr());i.inherits=Fr();var o={deprecate:Gr()},s=Sr(),a=xr().Buffer,u=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=qr();function f(){}function h(i,o){r=r||Qr(),i=i||{};var s=o instanceof r;this.objectMode=!!i.objectMode,s&&(this.objectMode=this.objectMode||!!i.writableObjectMode);var a=i.highWaterMark,u=i.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:s&&(u||0===u)?u:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===i.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=i.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var i=e._writableState,o=i.sync,s=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function(e,r,n,i,o){--r.pendingcb,n?(t.nextTick(o,i),t.nextTick(b,e,r),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),b(e,r))}(e,i,o,r,s);else{var a=g(i);a||i.corked||i.bufferProcessing||!i.bufferedRequest||m(e,i),o?n(y,e,i,a,s):y(e,i,a,s)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function p(t){if(r=r||Qr(),!(c.call(p,this)||this instanceof r))return new p(t);this._writableState=new h(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function d(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function y(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),b(t,e)}function m(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,d(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(d(t,r,!1,r.objectMode?1:c.length,c,l,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function g(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function _(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),b(t,e)})}function b(e,r){var n=g(r);return n&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(_,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),n}return i.inherits(p,s),h.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(h.prototype,"buffer",{get:o.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===p&&(t&&t._writableState instanceof h)}})):c=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,c=!o.objectMode&&(i=e,a.isBuffer(i)||i instanceof u);return c&&!a.isBuffer(e)&&(e=function(t){return a.from(t)}(e)),"function"==typeof r&&(n=r,r=null),c?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=f),o.ended?function(e,r){var n=new Error("write after end");e.emit("error",n),t.nextTick(r,n)}(this,n):(c||function(e,r,n,i){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||r.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),t.nextTick(i,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var u=e.objectMode?1:n.length;e.length+=u;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else d(t,e,!1,u,n,i,o);return c}(this,o,c,e,r,n)),s},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||m(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,b(e,r),n&&(r.finished?t.nextTick(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=l.destroy,p.prototype._undestroy=l.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},Br}function Qr(){if(Wr)return zr;Wr=1;var t=vr(),e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};zr=u;var r=Object.create(jr());r.inherits=Fr();var n=ki(),i=Vr();r.inherits(u,n);for(var o=e(i.prototype),s=0;s<o.length;s++){var a=o[s];u.prototype[a]||(u.prototype[a]=i.prototype[a])}function u(t){if(!(this instanceof u))return new u(t);n.call(this,t),i.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",c)}function c(){this.allowHalfOpen||this._writableState.ended||t.nextTick(l,this)}function l(t){t.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),u.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},zr}var Zr,Kr,Jr,Yr,Xr,tn,en,rn,nn,on,sn,an,un,cn,ln,fn,hn,pn,dn,yn,mn,gn,_n,bn,vn,wn,Sn,En,kn,xn,Tn,On,jn,Cn,Rn,Pn,Ln,Fn,An,In,Dn,Mn,Nn,Bn,Un,zn,Wn,Hn,$n,qn,Gn,Vn,Qn,Zn,Kn,Jn,Yn,Xn,ti,ei,ri,ni,ii,oi,si,ai,ui,ci,li,fi,hi,pi,di,yi,mi,gi,_i,bi,vi,wi,Si={};function Ei(){if(Zr)return Si;Zr=1;var t=xr().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}return Si.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},Si}function ki(){if(Jr)return Kr;Jr=1;var t=vr();Kr=m;var e,r=wr();m.ReadableState=y,d.EventEmitter;var n=function(t,e){return t.listeners(e).length},i=Sr(),o=xr().Buffer,s=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a=Object.create(jr());a.inherits=Fr();var u=b,c=void 0;c=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f=$r(),h=qr();a.inherits(m,i);var p=["error","close","destroy","pause","resume"];function y(t,r){t=t||{};var n=r instanceof(e=e||Qr());this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=Ei().StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function m(t){if(e=e||Qr(),!(this instanceof m))return new m(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),i.call(this)}function g(t,e,r,n,i){var a,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,u)):(i||(a=function(t,e){var r;n=e,o.isBuffer(n)||n instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(u,e)),a?t.emit("error",a):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),n?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):k(t,u)):_(t,u,e,!1))):n||(u.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function _(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&S(t)),k(t,e)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),m.prototype.destroy=h.destroy,m.prototype._undestroy=h.undestroy,m.prototype._destroy=function(t,e){this.push(null),e(t)},m.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=o.from(t,e),e=""),r=!0),g(this,t,e,!1,r)},m.prototype.unshift=function(t){return g(this,t,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(t){return l||(l=Ei().StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};var v=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=v?t=v:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(c("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(E,e):E(e))}function E(t){c("emit readable"),t.emit("readable"),j(t)}function k(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(x,e,r))}function x(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(c("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function T(t){c("readable nexttick read 0"),t.read(0)}function O(t,e){e.reading||(c("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function C(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=o.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function R(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(P,r,e))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return m.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):S(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&R(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(n=t>0?C(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==n&&this.emit("data",n),n},m.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,i){var o=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,c("pipe count=%d opts=%j",s.pipesCount,i);var a=(!i||!1!==i.end)&&e!==process.stdout&&e!==process.stderr?l:_;function u(t,r){c("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),o.removeListener("end",l),o.removeListener("end",_),o.removeListener("data",d),h=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){c("onend"),e.end()}s.endEmitted?t.nextTick(a):o.once("end",a),e.on("unpipe",u);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,j(t))}}(o);e.on("drain",f);var h=!1;var p=!1;function d(t){c("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==L(s.pipes,e))&&!h&&(c("false write response, pause",s.awaitDrain),s.awaitDrain++,p=!0),o.pause())}function y(t){c("onerror",t),_(),e.removeListener("error",y),0===n(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),_()}function g(){c("onfinish"),e.removeListener("close",m),_()}function _(){c("unpipe"),o.unpipe(e)}return o.on("data",d),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(e,"error",y),e.once("close",m),e.once("finish",g),e.emit("pipe",o),s.flowing||(c("pipe resume"),o.resume()),e},m.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=L(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},m.prototype.on=function(e,r){var n=i.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&S(this):t.nextTick(T,this))}return n},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(O,e,r))}(this,e)),this},m.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<p.length;o++)t.on(p[o],this.emit.bind(this,p[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=C,Kr}function xi(){if(Xr)return Yr;Xr=1,Yr=n;var t=Qr(),e=Object.create(jr());function r(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function n(e){if(!(this instanceof n))return new n(e);t.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",i)}function i(){var t=this;"function"==typeof this._flush?this._flush(function(e,r){o(t,e,r)}):o(this,null,null)}function o(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}return e.inherits=Fr(),e.inherits(n,t),n.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.prototype.push.call(this,e,r)},n.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},n.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},n.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},n.prototype._destroy=function(e,r){var n=this;t.prototype._destroy.call(this,e,function(t){r(t),n.emit("close")})},Yr}function Ti(){return rn||(rn=1,t=_r,e=_r.exports,r=g,"disable"===process.env.READABLE_STREAM&&r?(t.exports=r,(e=t.exports=r.Readable).Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.Stream=r):((e=t.exports=ki()).Stream=r||e,e.Readable=e,e.Writable=Vr(),e.Duplex=Qr(),e.Transform=xi(),e.PassThrough=function(){if(en)return tn;en=1,tn=r;var t=xi(),e=Object.create(jr());function r(e){if(!(this instanceof r))return new r(e);t.call(this,e)}return e.inherits=Fr(),e.inherits(r,t),r.prototype._transform=function(t,e,r){r(null,t)},tn}())),_r.exports;var t,e,r}function Oi(){if(an)return sn;an=1;var t=b,e=on?nn:(on=1,nn=Ti().PassThrough);function r(t,e,r){t[e]=function(){return delete t[e],r.apply(this,arguments),this[e].apply(this,arguments)}}function n(t,i){if(!(this instanceof n))return new n(t,i);e.call(this,i),r(this,"_read",function(){var e=t.call(this,i),r=this.emit.bind(this,"error");e.on("error",r),e.pipe(this)}),this.emit("readable")}function i(t,n){if(!(this instanceof i))return new i(t,n);e.call(this,n),r(this,"_write",function(){var e=t.call(this,n),r=this.emit.bind(this,"error");e.on("error",r),this.pipe(e)}),this.emit("writable")}return sn={Readable:n,Writable:i},t.inherits(n,e),t.inherits(i,e),sn}
|
|
1
|
+
import{readFileSync as t,existsSync as e,writeFileSync as r,mkdirSync as n,createReadStream as i,createWriteStream as o}from"node:fs";import{readdir as s,unlink as a,stat as u,rename as c}from"node:fs/promises";import{join as l,basename as f}from"node:path";import{pipeline as h}from"node:stream/promises";import p from"fs";import d from"events";import y from"path";import m from"constants";import g from"stream";import b from"util";import v from"assert";import w from"buffer";import S from"zlib";import E from"async_hooks";import{randomUUID as k}from"node:crypto";var x,O,T,j,C,R,P,L,F,A,I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function D(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function M(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var r=function t(){var r=!1;try{r=this instanceof t}catch{}return r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})}),r}function N(){if(O)return x;O=1;const t="object"==typeof process&&process&&"win32"===process.platform;return x=t?{sep:"\\"}:{sep:"/"}}function B(){if(R)return C;R=1;var t=function(){if(j)return T;function t(t,n,i){t instanceof RegExp&&(t=e(t,i)),n instanceof RegExp&&(n=e(n,i));var o=r(t,n,i);return o&&{start:o[0],end:o[1],pre:i.slice(0,o[0]),body:i.slice(o[0]+t.length,o[1]),post:i.slice(o[1]+n.length)}}function e(t,e){var r=e.match(t);return r?r[0]:null}function r(t,e,r){var n,i,o,s,a,u=r.indexOf(t),c=r.indexOf(e,u+1),l=u;if(u>=0&&c>0){if(t===e)return[u,c];for(n=[],o=r.length;l>=0&&!a;)l==u?(n.push(l),u=r.indexOf(t,l+1)):1==n.length?a=[n.pop(),c]:((i=n.pop())<o&&(o=i,s=c),c=r.indexOf(e,l+1)),l=u<c&&u>=0?u:c;n.length&&(a=[o,s])}return a}return j=1,T=t,t.range=r,T}();C=function(t){if(!t)return[];"{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2));return p(function(t){return t.split("\\\\").join(e).split("\\{").join(r).split("\\}").join(n).split("\\,").join(i).split("\\.").join(o)}(t),!0).map(a)};var e="\0SLASH"+Math.random()+"\0",r="\0OPEN"+Math.random()+"\0",n="\0CLOSE"+Math.random()+"\0",i="\0COMMA"+Math.random()+"\0",o="\0PERIOD"+Math.random()+"\0";function s(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function a(t){return t.split(e).join("\\").split(r).join("{").split(n).join("}").split(i).join(",").split(o).join(".")}function u(e){if(!e)return[""];var r=[],n=t("{","}",e);if(!n)return e.split(",");var i=n.pre,o=n.body,s=n.post,a=i.split(",");a[a.length-1]+="{"+o+"}";var c=u(s);return s.length&&(a[a.length-1]+=c.shift(),a.push.apply(a,c)),r.push.apply(r,a),r}function c(t){return"{"+t+"}"}function l(t){return/^-?0\d/.test(t)}function f(t,e){return t<=e}function h(t,e){return t>=e}function p(e,r){var i=[],o=t("{","}",e);if(!o)return[e];var a=o.pre,d=o.post.length?p(o.post,!1):[""];if(/\$$/.test(o.pre))for(var y=0;y<d.length;y++){var m=a+"{"+o.body+"}"+d[y];i.push(m)}else{var g,_,b=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),v=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),w=b||v,S=o.body.indexOf(",")>=0;if(!w&&!S)return o.post.match(/,(?!,).*\}/)?p(e=o.pre+"{"+o.body+n+o.post):[e];if(w)g=o.body.split(/\.\./);else if(1===(g=u(o.body)).length&&1===(g=p(g[0],!1).map(c)).length)return d.map(function(t){return o.pre+g[0]+t});if(w){var E=s(g[0]),k=s(g[1]),x=Math.max(g[0].length,g[1].length),O=3==g.length?Math.abs(s(g[2])):1,T=f;k<E&&(O*=-1,T=h);var j=g.some(l);_=[];for(var C=E;T(C,k);C+=O){var R;if(v)"\\"===(R=String.fromCharCode(C))&&(R="");else if(R=String(C),j){var P=x-R.length;if(P>0){var L=new Array(P+1).join("0");R=C<0?"-"+L+R.slice(1):L+R}}_.push(R)}}else{_=[];for(var F=0;F<g.length;F++)_.push.apply(_,p(g[F],!1))}for(F=0;F<_.length;F++)for(y=0;y<d.length;y++){m=a+_[F]+d[y];(!r||w||m)&&i.push(m)}}return i}return C}function U(){if(L)return P;L=1;const t=P=(t,e,r={})=>(p(e),!(!r.nocomment&&"#"===e.charAt(0))&&new g(e,r).match(t));P=t;const e=N();t.sep=e.sep;const r=Symbol("globstar **");t.GLOBSTAR=r;const n=B(),i={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},o="[^/]",s=o+"*?",a=t=>t.split("").reduce((t,e)=>(t[e]=!0,t),{}),u=a("().*{}+?[]^$\\!"),c=a("[.("),l=/\/+/;t.filter=(e,r={})=>(n,i,o)=>t(n,e,r);const f=(t,e={})=>{const r={};return Object.keys(t).forEach(e=>r[e]=t[e]),Object.keys(e).forEach(t=>r[t]=e[t]),r};t.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return t;const r=t,n=(t,n,i)=>r(t,n,f(e,i));return(n.Minimatch=class extends r.Minimatch{constructor(t,r){super(t,f(e,r))}}).defaults=t=>r.defaults(f(e,t)).Minimatch,n.filter=(t,n)=>r.filter(t,f(e,n)),n.defaults=t=>r.defaults(f(e,t)),n.makeRe=(t,n)=>r.makeRe(t,f(e,n)),n.braceExpand=(t,n)=>r.braceExpand(t,f(e,n)),n.match=(t,n,i)=>r.match(t,n,f(e,i)),n},t.braceExpand=(t,e)=>h(t,e);const h=(t,e={})=>(p(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:n(t)),p=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},d=Symbol("subparse");t.makeRe=(t,e)=>new g(t,e||{}).makeRe(),t.match=(t,e,r={})=>{const n=new g(e,r);return t=t.filter(t=>n.match(t)),n.options.nonull&&!t.length&&t.push(e),t};const y=t=>t.replace(/\\([^-\]])/g,"$1"),m=t=>t.replace(/[[\]\\]/g,"\\$&");class g{constructor(t,e){p(t),e||(e={}),this.options=e,this.maxGlobstarRecursion=void 0!==e.maxGlobstarRecursion?e.maxGlobstarRecursion:200,this.set=[],this.pattern=t,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}debug(){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate();let r=this.globSet=this.braceExpand();e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,r),r=this.globParts=r.map(t=>t.split(l)),this.debug(this.pattern,r),r=r.map((t,e,r)=>t.map(this.parse,this)),this.debug(this.pattern,r),r=r.filter(t=>-1===t.indexOf(!1)),this.debug(this.pattern,r),this.set=r}parseNegate(){if(this.options.nonegate)return;const t=this.pattern;let e=!1,r=0;for(let n=0;n<t.length&&"!"===t.charAt(n);n++)e=!e,r++;r&&(this.pattern=t.slice(r)),this.negate=e}matchOne(t,e,n){return-1!==e.indexOf(r)?this._matchGlobstar(t,e,n,0,0):this._matchOne(t,e,n,0,0)}_matchGlobstar(t,e,n,i,o){let s=-1;for(let t=o;t<e.length;t++)if(e[t]===r){s=t;break}let a=-1;for(let t=e.length-1;t>=0;t--)if(e[t]===r){a=t;break}const u=e.slice(o,s),c=e.slice(s+1,a),l=e.slice(a+1);if(u.length){const e=t.slice(i,i+u.length);if(!this._matchOne(e,u,n,0,0))return!1;i+=u.length}let f=0;if(l.length){if(l.length+i>t.length)return!1;const e=t.length-l.length;if(this._matchOne(t,l,n,e,0))f=l.length;else{if(""!==t[t.length-1]||i+l.length===t.length)return!1;if(!this._matchOne(t,l,n,e-1,0))return!1;f=l.length+1}}if(!c.length){let e=!!f;for(let r=i;r<t.length-f;r++){const n=String(t[r]);if(e=!0,"."===n||".."===n||!this.options.dot&&"."===n.charAt(0))return!1}return e}const h=[[[],0]];let p=h[0],d=0;const y=[0];for(const t of c)t===r?(y.push(d),p=[[],0],h.push(p)):(p[0].push(t),d++);let m=h.length-1;const g=t.length-f;for(const t of h)t[1]=g-(y[m--]+t[0].length);return!!this._matchGlobStarBodySections(t,h,i,0,n,0,!!f)}_matchGlobStarBodySections(t,e,r,n,i,o,s){const a=e[n];if(!a){for(let e=r;e<t.length;e++){s=!0;const r=t[e];if("."===r||".."===r||!this.options.dot&&"."===r.charAt(0))return!1}return s}const[u,c]=a;for(;r<=c;){if(this._matchOne(t.slice(0,r+u.length),u,i,r,0)&&o<this.maxGlobstarRecursion){const a=this._matchGlobStarBodySections(t,e,r+u.length,n+1,i,o+1,s);if(!1!==a)return a}const a=t[r];if("."===a||".."===a||!this.options.dot&&"."===a.charAt(0))return!1;r++}return null}_matchOne(t,e,n,i,o){let s,a,u,c;for(s=i,a=o,u=t.length,c=e.length;s<u&&a<c;s++,a++){this.debug("matchOne loop");const n=e[a],i=t[s];if(this.debug(e,n,i),!1===n||n===r)return!1;let o;if("string"==typeof n?(o=i===n,this.debug("string match",n,i,o)):(o=i.match(n),this.debug("pattern match",n,i,o)),!o)return!1}if(s===u&&a===c)return!0;if(s===u)return n;if(a===c)return s===u-1&&""===t[s];throw new Error("wtf?")}braceExpand(){return h(this.pattern,this.options)}parse(t,e){p(t);const n=this.options;if("**"===t){if(!n.noglobstar)return r;t="*"}if(""===t)return"";let a="",l=!1,f=!1;const h=[],g=[];let _,b,v,w,S=!1,E=-1,k=-1,x="."===t.charAt(0),O=n.dot||x;const T=t=>"."===t.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",j=()=>{if(_){switch(_){case"*":a+=s,l=!0;break;case"?":a+=o,l=!0;break;default:a+="\\"+_}this.debug("clearStateChar %j %j",_,a),_=!1}};for(let e,r=0;r<t.length&&(e=t.charAt(r));r++)if(this.debug("%s\t%s %s %j",t,r,a,e),f){if("/"===e)return!1;u[e]&&(a+="\\"),a+=e,f=!1}else switch(e){case"/":return!1;case"\\":if(S&&"-"===t.charAt(r+1)){a+=e;continue}j(),f=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",t,r,a,e),S){this.debug(" in class"),"!"===e&&r===k+1&&(e="^"),a+=e;continue}if("*"===e&&"*"===_)continue;this.debug("call clearStateChar %j",_),j(),_=e,n.noext&&j();continue;case"(":{if(S){a+="(";continue}if(!_){a+="\\(";continue}const e={type:_,start:r-1,reStart:a.length,open:i[_].open,close:i[_].close};this.debug(this.pattern,"\t",e),h.push(e),a+=e.open,0===e.start&&"!"!==e.type&&(x=!0,a+=T(t.slice(r+1))),this.debug("plType %j %j",_,a),_=!1;continue}case")":{const t=h[h.length-1];if(S||!t){a+="\\)";continue}h.pop(),j(),l=!0,v=t,a+=v.close,"!"===v.type&&g.push(Object.assign(v,{reEnd:a.length}));continue}case"|":{const e=h[h.length-1];if(S||!e){a+="\\|";continue}j(),a+="|",0===e.start&&"!"!==e.type&&(x=!0,a+=T(t.slice(r+1)));continue}case"[":if(j(),S){a+="\\"+e;continue}S=!0,k=r,E=a.length,a+=e;continue;case"]":if(r===k+1||!S){a+="\\"+e;continue}b=t.substring(k+1,r);try{RegExp("["+m(y(b))+"]"),a+=e}catch(t){a=a.substring(0,E)+"(?:$.)"}l=!0,S=!1;continue;default:j(),!u[e]||"^"===e&&S||(a+="\\"),a+=e}for(S&&(b=t.slice(k+1),w=this.parse(b,d),a=a.substring(0,E)+"\\["+w[0],l=l||w[1]),v=h.pop();v;v=h.pop()){let t;t=a.slice(v.reStart+v.open.length),this.debug("setting tail",a,v),t=t.replace(/((?:\\{2}){0,64})(\\?)\|/g,(t,e,r)=>(r||(r="\\"),e+e+r+"|")),this.debug("tail=%j\n %s",t,t,v,a);const e="*"===v.type?s:"?"===v.type?o:"\\"+v.type;l=!0,a=a.slice(0,v.reStart)+e+"\\("+t}j(),f&&(a+="\\\\");const C=c[a.charAt(0)];for(let t=g.length-1;t>-1;t--){const r=g[t],n=a.slice(0,r.reStart),i=a.slice(r.reStart,r.reEnd-8);let o=a.slice(r.reEnd);const s=a.slice(r.reEnd-8,r.reEnd)+o,u=n.split(")").length,c=n.split("(").length-u;let l=o;for(let t=0;t<c;t++)l=l.replace(/\)[+*?]?/,"");o=l;a=n+i+o+(""===o&&e!==d?"(?:$|\\/)":"")+s}if(""!==a&&l&&(a="(?=.)"+a),C&&(a=(x?"":O?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)")+a),e===d)return[a,l];if(n.nocase&&!l&&(l=t.toUpperCase()!==t.toLowerCase()),!l)return t.replace(/\\(.)/g,"$1");const R=n.nocase?"i":"";try{return Object.assign(new RegExp("^"+a+"$",R),{_glob:t,_src:a})}catch(t){return new RegExp("$.")}}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,n=e.noglobstar?s:e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=e.nocase?"i":"";let o=t.map(t=>(t=t.map(t=>"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===r?r:t._src).reduce((t,e)=>(t[t.length-1]===r&&e===r||t.push(e),t),[]),t.forEach((e,i)=>{e===r&&t[i-1]!==r&&(0===i?t.length>1?t[i+1]="(?:\\/|"+n+"\\/)?"+t[i+1]:t[i]=n:i===t.length-1?t[i-1]+="(?:\\/|"+n+")?":(t[i-1]+="(?:\\/|\\/"+n+"\\/)"+t[i+1],t[i+1]=r))}),t.filter(t=>t!==r).join("/"))).join("|");o="^(?:"+o+")$",this.negate&&(o="^(?!"+o+").*$");try{this.regexp=new RegExp(o,i)}catch(t){this.regexp=!1}return this.regexp}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&r)return!0;const n=this.options;"/"!==e.sep&&(t=t.split(e.sep).join("/")),t=t.split(l),this.debug(this.pattern,"split",t);const i=this.set;let o;this.debug(this.pattern,"set",i);for(let e=t.length-1;e>=0&&(o=t[e],!o);e--);for(let e=0;e<i.length;e++){const s=i[e];let a=t;n.matchBase&&1===s.length&&(a=[o]);if(this.matchOne(a,s,r))return!!n.flipNegate||!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return t.defaults(e).Minimatch}}return t.Minimatch=g,P}function z(){if(A)return F;A=1,F=a;const t=p,{EventEmitter:e}=d,{Minimatch:r}=U(),{resolve:n}=y;function i(e,r){return new Promise((n,o)=>{(r?t.stat:t.lstat)(e,(t,o)=>{if(t)if("ENOENT"===t.code)n(r?i(e,!1):null);else n(null);else n(o)})})}async function*o(e,r,n,s,a,u){let c=await function(e,r){return new Promise((n,i)=>{t.readdir(e,{withFileTypes:!0},(t,e)=>{if(t)switch(t.code){case"ENOTDIR":r?i(t):n([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":n([]);break;default:i(t)}else n(e)})})}(r+e,u);for(const t of c){let u=t.name;void 0===u&&(u=t,s=!0);const c=e+"/"+u,l=c.slice(1),f=r+"/"+l;let h=null;(s||n)&&(h=await i(f,n)),h||void 0===t.name||(h=t),null===h&&(h={isDirectory:()=>!1}),h.isDirectory()?a(l)||(yield{relative:l,absolute:f,stats:h},yield*o(c,r,n,s,a,!1)):yield{relative:l,absolute:f,stats:h}}}class s extends e{constructor(t,e,i){if(super(),"function"==typeof e&&(i=e,e=null),this.options=function(t){return{pattern:t.pattern,dot:!!t.dot,noglobstar:!!t.noglobstar,matchBase:!!t.matchBase,nocase:!!t.nocase,ignore:t.ignore,skip:t.skip,follow:!!t.follow,stat:!!t.stat,nodir:!!t.nodir,mark:!!t.mark,silent:!!t.silent,absolute:!!t.absolute}}(e||{}),this.matchers=[],this.options.pattern){const t=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=t.map(t=>new r(t,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){const t=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=t.map(t=>new r(t,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){const t=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=t.map(t=>new r(t,{dot:!0}))}this.iterator=async function*(t,e,r,n){yield*o("",t,e,r,n,!0)}(n(t||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,i&&(this._matches=[],this.on("match",t=>this._matches.push(this.options.absolute?t.absolute:t.relative)),this.on("error",t=>i(t)),this.on("end",()=>i(null,this._matches))),setTimeout(()=>this._next(),0)}_shouldSkipDirectory(t){return this.skipMatchers.some(e=>e.match(t))}_fileMatches(t,e){const r=t+(e?"/":"");return(0===this.matchers.length||this.matchers.some(t=>t.match(r)))&&!this.ignoreMatchers.some(t=>t.match(r))&&(!this.options.nodir||!e)}_next(){this.paused||this.aborted?this.inactive=!0:this.iterator.next().then(t=>{if(t.done)this.emit("end");else{const e=t.value.stats.isDirectory();if(this._fileMatches(t.value.relative,e)){let r=t.value.relative,n=t.value.absolute;this.options.mark&&e&&(r+="/",n+="/"),this.options.stat?this.emit("match",{relative:r,absolute:n,stat:t.value.stats}):this.emit("match",{relative:r,absolute:n})}this._next(this.iterator)}}).catch(t=>{this.abort(),this.emit("error",t),t.code||this.options.silent||console.error(t)})}abort(){this.aborted=!0}pause(){this.paused=!0}resume(){this.paused=!1,this.inactive&&(this.inactive=!1,this._next())}}function a(t,e,r){return new s(t,e,r)}return a.ReaddirGlob=s,F}function W(t,...e){return(...r)=>t(...e,...r)}function H(t){return function(...e){var r=e.pop();return t.call(this,e,r)}}var $="function"==typeof queueMicrotask&&queueMicrotask,q="function"==typeof setImmediate&&setImmediate,G="object"==typeof process&&"function"==typeof process.nextTick;function V(t){setTimeout(t,0)}function Q(t){return(e,...r)=>t(()=>e(...r))}var Z=Q($?queueMicrotask:q?setImmediate:G?process.nextTick:V);function K(t){return X(t)?function(...e){const r=e.pop();return J(t.apply(this,e),r)}:H(function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return J(n,r);r(null,n)})}function J(t,e){return t.then(t=>{Y(e,null,t)},t=>{Y(e,t&&(t instanceof Error||t.message)?t:new Error(t))})}function Y(t,e,r){try{t(e,r)}catch(t){Z(t=>{throw t},t)}}function X(t){return"AsyncFunction"===t[Symbol.toStringTag]}function tt(t){if("function"!=typeof t)throw new Error("expected a function");return X(t)?K(t):t}function et(t,e){if(e||(e=t.length),!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise((n,i)=>{r[e-1]=(t,...e)=>{if(t)return i(t);n(e.length>1?e:e[0])},t.apply(this,r)})}}function rt(t){return function(e,...r){return et(function(n){var i=this;return t(e,(t,e)=>{tt(t).apply(i,r.concat(e))},n)})}}function nt(t,e,r,n){e=e||[];var i=[],o=0,s=tt(r);return t(e,(t,e,r)=>{var n=o++;s(t,(t,e)=>{i[n]=e,r(t)})},t=>{n(t,i)})}function it(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}const ot={};function st(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e}function at(t){if(it(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e,r,n,i,o=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()}(t);return o?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(o):(r=(e=t)?Object.keys(e):[],n=-1,i=r.length,function t(){var o=r[++n];return"__proto__"===o?t():n<i?{value:e[o],key:o}:null})}function ut(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}}function ct(t,e,r,n){let i=!1,o=!1,s=!1,a=0,u=0;function c(){a>=e||s||i||(s=!0,t.next().then(({value:t,done:e})=>{if(!o&&!i){if(s=!1,e)return i=!0,void(a<=0&&n(null));a++,r(t,u,l),u++,c()}}).catch(f))}function l(t,e){if(a-=1,!o)return t?f(t):!1===t?(i=!0,void(o=!0)):e===ot||i&&a<=0?(i=!0,n(null)):void c()}function f(t){o||(s=!1,i=!0,n(t))}c()}var lt=t=>(e,r,n)=>{if(n=st(n),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return n(null);if("AsyncGenerator"===e[Symbol.toStringTag])return ct(e,t,r,n);if(function(t){return"function"==typeof t[Symbol.asyncIterator]}(e))return ct(e[Symbol.asyncIterator](),t,r,n);var i=at(e),o=!1,s=!1,a=0,u=!1;function c(t,e){if(!s)if(a-=1,t)o=!0,n(t);else if(!1===t)o=!0,s=!0;else{if(e===ot||o&&a<=0)return o=!0,n(null);u||l()}}function l(){for(u=!0;a<t&&!o;){var e=i();if(null===e)return o=!0,void(a<=0&&n(null));a+=1,r(e.value,e.key,ut(c))}u=!1}l()};var ft=et(function(t,e,r,n){return lt(e)(t,tt(r),n)},4);function ht(t,e,r){r=st(r);var n=0,i=0,{length:o}=t,s=!1;function a(t,e){!1===t&&(s=!0),!0!==s&&(t?r(t):++i!==o&&e!==ot||r(null))}for(0===o&&r(null);n<o;n++)e(t[n],n,ut(a))}function pt(t,e,r){return ft(t,1/0,e,r)}var dt=et(function(t,e,r){return(it(t)?ht:pt)(t,tt(e),r)},3);var yt=et(function(t,e,r){return nt(dt,t,e,r)},3),mt=rt(yt);var gt=et(function(t,e,r){return ft(t,1,e,r)},3);var _t=et(function(t,e,r){return nt(gt,t,e,r)},3),bt=rt(_t);const vt=Symbol("promiseCallback");function wt(){let t,e;function r(r,...n){if(r)return e(r);t(n.length>1?n:n[0])}return r[vt]=new Promise((r,n)=>{t=r,e=n}),r}function St(t,e,r){"number"!=typeof e&&(r=e,e=null),r=st(r||wt());var n=Object.keys(t).length;if(!n)return r(null);e||(e=n);var i={},o=0,s=!1,a=!1,u=Object.create(null),c=[],l=[],f={};function h(t,e){c.push(()=>function(t,e){if(a)return;var n=ut((e,...n)=>{if(o--,!1!==e)if(n.length<2&&([n]=n),e){var c={};if(Object.keys(i).forEach(t=>{c[t]=i[t]}),c[t]=n,a=!0,u=Object.create(null),s)return;r(e,c)}else i[t]=n,(u[t]||[]).forEach(t=>t()),p();else s=!0});o++;var c=tt(e[e.length-1]);e.length>1?c(i,n):c(n)}(t,e))}function p(){if(!s){if(0===c.length&&0===o)return r(null,i);for(;c.length&&o<e;){c.shift()()}}}function d(e){var r=[];return Object.keys(t).forEach(n=>{const i=t[n];Array.isArray(i)&&i.indexOf(e)>=0&&r.push(n)}),r}return Object.keys(t).forEach(e=>{var r=t[e];if(!Array.isArray(r))return h(e,[r]),void l.push(e);var n=r.slice(0,r.length-1),i=n.length;if(0===i)return h(e,r),void l.push(e);f[e]=i,n.forEach(o=>{if(!t[o])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+o+"` in "+n.join(", "));!function(t,e){var r=u[t];r||(r=u[t]=[]);r.push(e)}(o,()=>{0===--i&&h(e,r)})})}),function(){var t=0;for(;l.length;)t++,d(l.pop()).forEach(t=>{0===--f[t]&&l.push(t)});if(t!==n)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),p(),r[vt]}var Et=/^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/,kt=/^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/,xt=/,/,Ot=/(=.+)?(\s*)$/;function Tt(t,e){var r={};return Object.keys(t).forEach(e=>{var n,i=t[e],o=X(i),s=!o&&1===i.length||o&&0===i.length;if(Array.isArray(i))n=[...i],i=n.pop(),r[e]=n.concat(n.length>0?a:i);else if(s)r[e]=i;else{if(n=function(t){const e=function(t){let e="",r=0,n=t.indexOf("*/");for(;r<t.length;)if("/"===t[r]&&"/"===t[r+1]){let e=t.indexOf("\n",r);r=-1===e?t.length:e}else if(-1!==n&&"/"===t[r]&&"*"===t[r+1]){let i=t.indexOf("*/",r);-1!==i?(r=i+2,n=t.indexOf("*/",r)):(e+=t[r],r++)}else e+=t[r],r++;return e}(t.toString());let r=e.match(Et);if(r||(r=e.match(kt)),!r)throw new Error("could not parse args in autoInject\nSource:\n"+e);let[,n]=r;return n.replace(/\s/g,"").split(xt).map(t=>t.replace(Ot,"").trim())}(i),0===i.length&&!o&&0===n.length)throw new Error("autoInject task functions require explicit parameters.");o||n.pop(),r[e]=n.concat(a)}function a(t,e){var r=n.map(e=>t[e]);r.push(e),tt(i)(...r)}}),St(r,e)}class jt{constructor(){this.head=this.tail=null,this.length=0}removeLink(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t}empty(){for(;this.head;)this.shift();return this}insertAfter(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1}insertBefore(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1}unshift(t){this.head?this.insertBefore(this.head,t):Ct(this,t)}push(t){this.tail?this.insertAfter(this.tail,t):Ct(this,t)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var t=this.head;t;)yield t.data,t=t.next}remove(t){for(var e=this.head;e;){var{next:r}=e;t(e)&&this.removeLink(e),e=r}return this}}function Ct(t,e){t.length=1,t.head=t.tail=e}function Rt(t,e,r){if(null==e)e=1;else if(0===e)throw new RangeError("Concurrency must not be zero");var n=tt(t),i=0,o=[];const s={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(t,e){return t?e?void(s[t]=s[t].filter(t=>t!==e)):s[t]=[]:Object.keys(s).forEach(t=>s[t]=[])}function u(t,...e){s[t].forEach(t=>t(...e))}var c=!1;function l(t,e,r,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");var i,o;function s(t,...e){return t?r?o(t):i():e.length<=1?i(e[0]):void i(e)}y.started=!0;var a=y._createTaskItem(t,r?s:n||s);if(e?y._tasks.unshift(a):y._tasks.push(a),c||(c=!0,Z(()=>{c=!1,y.process()})),r||!n)return new Promise((t,e)=>{i=t,o=e})}function f(t){return function(e,...r){i-=1;for(var n=0,s=t.length;n<s;n++){var a=t[n],c=o.indexOf(a);0===c?o.shift():c>0&&o.splice(c,1),a.callback(e,...r),null!=e&&u("error",e,a.data)}i<=y.concurrency-y.buffer&&u("unsaturated"),y.idle()&&u("drain"),y.process()}}function h(t){return!(0!==t.length||!y.idle())&&(Z(()=>u("drain")),!0)}const p=t=>e=>{if(!e)return new Promise((e,r)=>{!function(t,e){const r=(...n)=>{a(t,r),e(...n)};s[t].push(r)}(t,(t,n)=>{if(t)return r(t);e(n)})});a(t),function(t,e){s[t].push(e)}(t,e)};var d=!1,y={_tasks:new jt,_createTaskItem:(t,e)=>({data:t,callback:e}),*[Symbol.iterator](){yield*y._tasks[Symbol.iterator]()},concurrency:e,payload:r,buffer:e/4,started:!1,paused:!1,push(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!1,!1,e))}return l(t,!1,!1,e)},pushAsync(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!1,!0,e))}return l(t,!1,!0,e)},kill(){a(),y._tasks.empty()},unshift(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!0,!1,e))}return l(t,!0,!1,e)},unshiftAsync(t,e){if(Array.isArray(t)){if(h(t))return;return t.map(t=>l(t,!0,!0,e))}return l(t,!0,!0,e)},remove(t){y._tasks.remove(t)},process(){if(!d){for(d=!0;!y.paused&&i<y.concurrency&&y._tasks.length;){var t=[],e=[],r=y._tasks.length;y.payload&&(r=Math.min(r,y.payload));for(var s=0;s<r;s++){var a=y._tasks.shift();t.push(a),o.push(a),e.push(a.data)}i+=1,0===y._tasks.length&&u("empty"),i===y.concurrency&&u("saturated");var c=ut(f(t));n(e,c)}d=!1}},length:()=>y._tasks.length,running:()=>i,workersList:()=>o,idle:()=>y._tasks.length+i===0,pause(){y.paused=!0},resume(){!1!==y.paused&&(y.paused=!1,Z(y.process))}};return Object.defineProperties(y,{saturated:{writable:!1,value:p("saturated")},unsaturated:{writable:!1,value:p("unsaturated")},empty:{writable:!1,value:p("empty")},drain:{writable:!1,value:p("drain")},error:{writable:!1,value:p("error")}}),y}function Pt(t,e){return Rt(t,1,e)}function Lt(t,e,r){return Rt(t,e,r)}var Ft=et(function(t,e,r,n){n=st(n);var i=tt(r);return gt(t,(t,r,n)=>{i(e,t,(t,r)=>{e=r,n(t)})},t=>n(t,e))},4);function At(...t){var e=t.map(tt);return function(...t){var r=this,n=t[t.length-1];return"function"==typeof n?t.pop():n=wt(),Ft(e,t,(t,e,n)=>{e.apply(r,t.concat((t,...e)=>{n(t,e)}))},(t,e)=>n(t,...e)),n[vt]}}function It(...t){return At(...t.reverse())}var Dt=et(function(t,e,r,n){return nt(lt(e),t,r,n)},4);var Mt=et(function(t,e,r,n){var i=tt(r);return Dt(t,e,(t,e)=>{i(t,(t,...r)=>t?e(t):e(t,r))},(t,e)=>{for(var r=[],i=0;i<e.length;i++)e[i]&&(r=r.concat(...e[i]));return n(t,r)})},4);var Nt=et(function(t,e,r){return Mt(t,1/0,e,r)},3);var Bt=et(function(t,e,r){return Mt(t,1,e,r)},3);function Ut(...t){return function(...e){return e.pop()(null,...t)}}function zt(t,e){return(r,n,i,o)=>{var s,a=!1;const u=tt(i);r(n,(r,n,i)=>{u(r,(n,o)=>n||!1===n?i(n):t(o)&&!s?(a=!0,s=e(!0,r),i(null,ot)):void i())},t=>{if(t)return o(t);o(null,a?s:e(!1))})}}var Wt=et(function(t,e,r){return zt(t=>t,(t,e)=>e)(dt,t,e,r)},3);var Ht=et(function(t,e,r,n){return zt(t=>t,(t,e)=>e)(lt(e),t,r,n)},4);var $t=et(function(t,e,r){return zt(t=>t,(t,e)=>e)(lt(1),t,e,r)},3);function qt(t){return(e,...r)=>tt(e)(...r,(e,...r)=>{"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&r.forEach(e=>console[t](e)))})}var Gt=qt("dir");var Vt=et(function(t,e,r){r=ut(r);var n,i=tt(t),o=tt(e);function s(t,...e){if(t)return r(t);!1!==t&&(n=e,o(...e,a))}function a(t,e){return t?r(t):!1!==t?e?void i(s):r(null,...n):void 0}return a(null,!0)},3);function Qt(t,e,r){const n=tt(e);return Vt(t,(...t)=>{const e=t.pop();n(...t,(t,r)=>e(t,!r))},r)}function Zt(t){return(e,r,n)=>t(e,n)}var Kt=et(function(t,e,r){return dt(t,Zt(tt(e)),r)},3);var Jt=et(function(t,e,r,n){return lt(e)(t,Zt(tt(r)),n)},4);var Yt=et(function(t,e,r){return Jt(t,1,e,r)},3);function Xt(t){return X(t)?t:function(...e){var r=e.pop(),n=!0;e.push((...t)=>{n?Z(()=>r(...t)):r(...t)}),t.apply(this,e),n=!1}}var te=et(function(t,e,r){return zt(t=>!t,t=>!t)(dt,t,e,r)},3);var ee=et(function(t,e,r,n){return zt(t=>!t,t=>!t)(lt(e),t,r,n)},4);var re=et(function(t,e,r){return zt(t=>!t,t=>!t)(gt,t,e,r)},3);function ne(t,e,r,n){var i=new Array(e.length);t(e,(t,e,n)=>{r(t,(t,r)=>{i[e]=!!r,n(t)})},t=>{if(t)return n(t);for(var r=[],o=0;o<e.length;o++)i[o]&&r.push(e[o]);n(null,r)})}function ie(t,e,r,n){var i=[];t(e,(t,e,n)=>{r(t,(r,o)=>{if(r)return n(r);o&&i.push({index:e,value:t}),n(r)})},t=>{if(t)return n(t);n(null,i.sort((t,e)=>t.index-e.index).map(t=>t.value))})}function oe(t,e,r,n){return(it(e)?ne:ie)(t,e,tt(r),n)}var se=et(function(t,e,r){return oe(dt,t,e,r)},3);var ae=et(function(t,e,r,n){return oe(lt(e),t,r,n)},4);var ue=et(function(t,e,r){return oe(gt,t,e,r)},3);var ce=et(function(t,e){var r=ut(e),n=tt(Xt(t));return function t(e){if(e)return r(e);!1!==e&&n(t)}()},2);var le=et(function(t,e,r,n){var i=tt(r);return Dt(t,e,(t,e)=>{i(t,(r,n)=>r?e(r):e(r,{key:n,val:t}))},(t,e)=>{for(var r={},{hasOwnProperty:i}=Object.prototype,o=0;o<e.length;o++)if(e[o]){var{key:s}=e[o],{val:a}=e[o];i.call(r,s)?r[s].push(a):r[s]=[a]}return n(t,r)})},4);function fe(t,e,r){return le(t,1/0,e,r)}function he(t,e,r){return le(t,1,e,r)}var pe=qt("log");var de=et(function(t,e,r,n){n=st(n);var i={},o=tt(r);return lt(e)(t,(t,e,r)=>{o(t,e,(t,n)=>{if(t)return r(t);i[e]=n,r(t)})},t=>n(t,i))},4);function ye(t,e,r){return de(t,1/0,e,r)}function me(t,e,r){return de(t,1,e,r)}function ge(t,e=t=>t){var r=Object.create(null),n=Object.create(null),i=tt(t),o=H((t,o)=>{var s=e(...t);s in r?Z(()=>o(null,...r[s])):s in n?n[s].push(o):(n[s]=[o],i(...t,(t,...e)=>{t||(r[s]=e);var i=n[s];delete n[s];for(var o=0,a=i.length;o<a;o++)i[o](t,...e)}))});return o.memo=r,o.unmemoized=t,o}var _e=Q(G?process.nextTick:q?setImmediate:V),be=et((t,e,r)=>{var n=it(e)?[]:{};t(e,(t,e,r)=>{tt(t)((t,...i)=>{i.length<2&&([i]=i),n[e]=i,r(t)})},t=>r(t,n))},3);function ve(t,e){return be(dt,t,e)}function we(t,e,r){return be(lt(e),t,r)}function Se(t,e){var r=tt(t);return Rt((t,e)=>{r(t[0],e)},e,1)}class Ee{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(t){let e;for(;t>0&&Oe(this.heap[t],this.heap[e=xe(t)]);){let r=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=r,t=e}}percDown(t){let e;for(;(e=ke(t))<this.heap.length&&(e+1<this.heap.length&&Oe(this.heap[e+1],this.heap[e])&&(e+=1),!Oe(this.heap[t],this.heap[e]));){let r=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=r,t=e}}push(t){t.pushCount=++this.pushCount,this.heap.push(t),this.percUp(this.heap.length-1)}unshift(t){return this.heap.push(t)}shift(){let[t]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),t}toArray(){return[...this]}*[Symbol.iterator](){for(let t=0;t<this.heap.length;t++)yield this.heap[t].data}remove(t){let e=0;for(let r=0;r<this.heap.length;r++)t(this.heap[r])||(this.heap[e]=this.heap[r],e++);this.heap.splice(e);for(let t=xe(this.heap.length-1);t>=0;t--)this.percDown(t);return this}}function ke(t){return 1+(t<<1)}function xe(t){return(t+1>>1)-1}function Oe(t,e){return t.priority!==e.priority?t.priority<e.priority:t.pushCount<e.pushCount}function Te(t,e){var r=Se(t,e),{push:n,pushAsync:i}=r;function o(t,e){return Array.isArray(t)?t.map(t=>({data:t,priority:e})):{data:t,priority:e}}return r._tasks=new Ee,r._createTaskItem=({data:t,priority:e},r)=>({data:t,priority:e,callback:r}),r.push=function(t,e=0,r){return n(o(t,e),r)},r.pushAsync=function(t,e=0,r){return i(o(t,e),r)},delete r.unshift,delete r.unshiftAsync,r}var je=et(function(t,e){if(e=st(e),!Array.isArray(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var r=0,n=t.length;r<n;r++)tt(t[r])(e)},2);function Ce(t,e,r,n){var i=[...t].reverse();return Ft(i,e,r,n)}function Re(t){var e=tt(t);return H(function(t,r){return t.push((t,...e)=>{let n={};if(t&&(n.error=t),e.length>0){var i=e;e.length<=1&&([i]=e),n.value=i}r(null,n)}),e.apply(this,t)})}function Pe(t){var e;return Array.isArray(t)?e=t.map(Re):(e={},Object.keys(t).forEach(r=>{e[r]=Re.call(this,t[r])})),e}function Le(t,e,r,n){const i=tt(r);return oe(t,e,(t,e)=>{i(t,(t,r)=>{e(t,!r)})},n)}var Fe=et(function(t,e,r){return Le(dt,t,e,r)},3);var Ae=et(function(t,e,r,n){return Le(lt(e),t,r,n)},4);var Ie=et(function(t,e,r){return Le(gt,t,e,r)},3);function De(t){return function(){return t}}function Me(t,e,r){var n={times:5,intervalFunc:De(0)};if(arguments.length<3&&"function"==typeof t?(r=e||wt(),e=t):(!function(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:De(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}(n,t),r=r||wt()),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var i=tt(e),o=1;return function t(){i((e,...i)=>{!1!==e&&(e&&o++<n.times&&("function"!=typeof n.errorFilter||n.errorFilter(e))?setTimeout(t,n.intervalFunc(o-1)):r(e,...i))})}(),r[vt]}function Ne(t,e){e||(e=t,t=null);let r=t&&t.arity||e.length;X(e)&&(r+=1);var n=tt(e);return H((e,i)=>{function o(t){n(...e,t)}return(e.length<r-1||null==i)&&(e.push(i),i=wt()),t?Me(t,o,i):Me(o,i),i[vt]})}function Be(t,e){return be(gt,t,e)}var Ue=et(function(t,e,r){return zt(Boolean,t=>t)(dt,t,e,r)},3);var ze=et(function(t,e,r,n){return zt(Boolean,t=>t)(lt(e),t,r,n)},4);var We=et(function(t,e,r){return zt(Boolean,t=>t)(gt,t,e,r)},3);var He=et(function(t,e,r){var n=tt(e);return yt(t,(t,e)=>{n(t,(r,n)=>{if(r)return e(r);e(r,{value:t,criteria:n})})},(t,e)=>{if(t)return r(t);r(null,e.sort(i).map(t=>t.value))});function i(t,e){var r=t.criteria,n=e.criteria;return r<n?-1:r>n?1:0}},3);function $e(t,e,r){var n=tt(t);return H((i,o)=>{var s,a=!1;i.push((...t)=>{a||(o(...t),clearTimeout(s))}),s=setTimeout(function(){var e=t.name||"anonymous",n=new Error('Callback function "'+e+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),a=!0,o(n)},e),n(...i)})}function qe(t,e,r,n){var i=tt(r);return Dt(function(t){for(var e=Array(t);t--;)e[t]=t;return e}(t),e,i,n)}function Ge(t,e,r){return qe(t,1/0,e,r)}function Ve(t,e,r){return qe(t,1,e,r)}function Qe(t,e,r,n){arguments.length<=3&&"function"==typeof e&&(n=r,r=e,e=Array.isArray(t)?[]:{}),n=st(n||wt());var i=tt(r);return dt(t,(t,r,n)=>{i(e,t,r,n)},t=>n(t,e)),n[vt]}var Ze=et(function(t,e){var r,n=null;return Yt(t,(t,e)=>{tt(t)((t,...i)=>{if(!1===t)return e(t);i.length<2?[r]=i:r=i,n=t,e(t?null:{})})},()=>e(n,r))});function Ke(t){return(...e)=>(t.unmemoized||t)(...e)}var Je=et(function(t,e,r){r=ut(r);var n=tt(e),i=tt(t),o=[];function s(t,...e){if(t)return r(t);o=e,!1!==t&&i(a)}function a(t,e){return t?r(t):!1!==t?e?void n(s):r(null,...o):void 0}return i(a)},3);function Ye(t,e,r){const n=tt(t);return Je(t=>n((e,r)=>t(e,!r)),e,r)}var Xe,tr,er,rr,nr,ir,or,sr,ar=et(function(t,e){if(e=st(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function n(e){tt(t[r++])(...e,ut(i))}function i(i,...o){if(!1!==i)return i||r===t.length?e(i,...o):void n(o)}n([])}),ur={apply:W,applyEach:mt,applyEachSeries:bt,asyncify:K,auto:St,autoInject:Tt,cargo:Pt,cargoQueue:Lt,compose:It,concat:Nt,concatLimit:Mt,concatSeries:Bt,constant:Ut,detect:Wt,detectLimit:Ht,detectSeries:$t,dir:Gt,doUntil:Qt,doWhilst:Vt,each:Kt,eachLimit:Jt,eachOf:dt,eachOfLimit:ft,eachOfSeries:gt,eachSeries:Yt,ensureAsync:Xt,every:te,everyLimit:ee,everySeries:re,filter:se,filterLimit:ae,filterSeries:ue,forever:ce,groupBy:fe,groupByLimit:le,groupBySeries:he,log:pe,map:yt,mapLimit:Dt,mapSeries:_t,mapValues:ye,mapValuesLimit:de,mapValuesSeries:me,memoize:ge,nextTick:_e,parallel:ve,parallelLimit:we,priorityQueue:Te,queue:Se,race:je,reduce:Ft,reduceRight:Ce,reflect:Re,reflectAll:Pe,reject:Fe,rejectLimit:Ae,rejectSeries:Ie,retry:Me,retryable:Ne,seq:At,series:Be,setImmediate:Z,some:Ue,someLimit:ze,someSeries:We,sortBy:He,timeout:$e,times:Ge,timesLimit:qe,timesSeries:Ve,transform:Qe,tryEach:Ze,unmemoize:Ke,until:Ye,waterfall:ar,whilst:Je,all:te,allLimit:ee,allSeries:re,any:Ue,anyLimit:ze,anySeries:We,find:Wt,findLimit:Ht,findSeries:$t,flatMap:Nt,flatMapLimit:Mt,flatMapSeries:Bt,forEach:Kt,forEachSeries:Yt,forEachLimit:Jt,forEachOf:dt,forEachOfSeries:gt,forEachOfLimit:ft,inject:Ft,foldl:Ft,foldr:Ce,select:se,selectLimit:ae,selectSeries:ue,wrapSync:K,during:Je,doDuring:Vt},cr=M(Object.freeze({__proto__:null,all:te,allLimit:ee,allSeries:re,any:Ue,anyLimit:ze,anySeries:We,apply:W,applyEach:mt,applyEachSeries:bt,asyncify:K,auto:St,autoInject:Tt,cargo:Pt,cargoQueue:Lt,compose:It,concat:Nt,concatLimit:Mt,concatSeries:Bt,constant:Ut,default:ur,detect:Wt,detectLimit:Ht,detectSeries:$t,dir:Gt,doDuring:Vt,doUntil:Qt,doWhilst:Vt,during:Je,each:Kt,eachLimit:Jt,eachOf:dt,eachOfLimit:ft,eachOfSeries:gt,eachSeries:Yt,ensureAsync:Xt,every:te,everyLimit:ee,everySeries:re,filter:se,filterLimit:ae,filterSeries:ue,find:Wt,findLimit:Ht,findSeries:$t,flatMap:Nt,flatMapLimit:Mt,flatMapSeries:Bt,foldl:Ft,foldr:Ce,forEach:Kt,forEachLimit:Jt,forEachOf:dt,forEachOfLimit:ft,forEachOfSeries:gt,forEachSeries:Yt,forever:ce,groupBy:fe,groupByLimit:le,groupBySeries:he,inject:Ft,log:pe,map:yt,mapLimit:Dt,mapSeries:_t,mapValues:ye,mapValuesLimit:de,mapValuesSeries:me,memoize:ge,nextTick:_e,parallel:ve,parallelLimit:we,priorityQueue:Te,queue:Se,race:je,reduce:Ft,reduceRight:Ce,reflect:Re,reflectAll:Pe,reject:Fe,rejectLimit:Ae,rejectSeries:Ie,retry:Me,retryable:Ne,select:se,selectLimit:ae,selectSeries:ue,seq:At,series:Be,setImmediate:Z,some:Ue,someLimit:ze,someSeries:We,sortBy:He,timeout:$e,times:Ge,timesLimit:qe,timesSeries:Ve,transform:Qe,tryEach:Ze,unmemoize:Ke,until:Ye,waterfall:ar,whilst:Je,wrapSync:K})),lr={exports:{}};function fr(){if(tr)return Xe;tr=1;var t=m,e=process.cwd,r=null,n=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return r||(r=e.call(process)),r};try{process.cwd()}catch(t){}if("function"==typeof process.chdir){var i=process.chdir;process.chdir=function(t){r=null,i.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,i)}return Xe=function(e){t.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(r,n,i){e.open(r,t.O_WRONLY|t.O_SYMLINK,n,function(t,r){t?i&&i(t):e.fchmod(r,n,function(t){e.close(r,function(e){i&&i(t||e)})})})},e.lchmodSync=function(r,n){var i,o=e.openSync(r,t.O_WRONLY|t.O_SYMLINK,n),s=!0;try{i=e.fchmodSync(o,n),s=!1}finally{if(s)try{e.closeSync(o)}catch(t){}else e.closeSync(o)}return i}}(e);e.lutimes||function(e){t.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(r,n,i,o){e.open(r,t.O_SYMLINK,function(t,r){t?o&&o(t):e.futimes(r,n,i,function(t){e.close(r,function(e){o&&o(t||e)})})})},e.lutimesSync=function(r,n,i){var o,s=e.openSync(r,t.O_SYMLINK),a=!0;try{o=e.futimesSync(s,n,i),a=!1}finally{if(a)try{e.closeSync(s)}catch(t){}else e.closeSync(s)}return o}):e.futimes&&(e.lutimes=function(t,e,r,n){n&&process.nextTick(n)},e.lutimesSync=function(){})}(e);e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=i(e.chmodSync),e.fchmodSync=i(e.fchmodSync),e.lchmodSync=i(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(t,e,r){r&&process.nextTick(r)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(t,e,r,n){n&&process.nextTick(n)},e.lchownSync=function(){});"win32"===n&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function r(r,n,i){var o=Date.now(),s=0;t(r,n,function a(u){if(u&&("EACCES"===u.code||"EPERM"===u.code||"EBUSY"===u.code)&&Date.now()-o<6e4)return setTimeout(function(){e.stat(n,function(e,o){e&&"ENOENT"===e.code?t(r,n,a):i(u)})},s),void(s<100&&(s+=10));i&&i(u)})}return Object.setPrototypeOf&&Object.setPrototypeOf(r,t),r}(e.rename));function r(t){return t?function(r,n,i){return t.call(e,r,n,function(t){c(t)&&(t=null),i&&i.apply(this,arguments)})}:t}function i(t){return t?function(r,n){try{return t.call(e,r,n)}catch(t){if(!c(t))throw t}}:t}function o(t){return t?function(r,n,i,o){return t.call(e,r,n,i,function(t){c(t)&&(t=null),o&&o.apply(this,arguments)})}:t}function s(t){return t?function(r,n,i){try{return t.call(e,r,n,i)}catch(t){if(!c(t))throw t}}:t}function a(t){return t?function(r,n,i){function o(t,e){e&&(e.uid<0&&(e.uid+=4294967296),e.gid<0&&(e.gid+=4294967296)),i&&i.apply(this,arguments)}return"function"==typeof n&&(i=n,n=null),n?t.call(e,r,n,o):t.call(e,r,o)}:t}function u(t){return t?function(r,n){var i=n?t.call(e,r,n):t.call(e,r);return i&&(i.uid<0&&(i.uid+=4294967296),i.gid<0&&(i.gid+=4294967296)),i}:t}function c(t){return!t||("ENOSYS"===t.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==t.code&&"EPERM"!==t.code))}e.read="function"!=typeof e.read?e.read:function(t){function r(r,n,i,o,s,a){var u;if(a&&"function"==typeof a){var c=0;u=function(l,f,h){if(l&&"EAGAIN"===l.code&&c<10)return c++,t.call(e,r,n,i,o,s,u);a.apply(this,arguments)}}return t.call(e,r,n,i,o,s,u)}return Object.setPrototypeOf&&Object.setPrototypeOf(r,t),r}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(l=e.readSync,function(t,r,n,i,o){for(var s=0;;)try{return l.call(e,t,r,n,i,o)}catch(t){if("EAGAIN"===t.code&&s<10){s++;continue}throw t}});var l},Xe}function hr(){if(sr)return or;sr=1;var t,e,r=p,n=fr(),i=function(){if(rr)return er;rr=1;var t=g.Stream;return er=function(e){return{ReadStream:function r(n,i){if(!(this instanceof r))return new r(n,i);t.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,i=i||{};for(var s=Object.keys(i),a=0,u=s.length;a<u;a++){var c=s[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(void 0===this.end)this.end=1/0;else if("number"!=typeof this.end)throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}null===this.fd?e.open(this.path,this.flags,this.mode,function(t,e){if(t)return o.emit("error",t),void(o.readable=!1);o.fd=e,o.emit("open",e),o._read()}):process.nextTick(function(){o._read()})},WriteStream:function r(n,i){if(!(this instanceof r))return new r(n,i);t.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var u=o[s];this[u]=i[u]}if(void 0!==this.start){if("number"!=typeof this.start)throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}},er}(),o=function(){if(ir)return nr;ir=1,nr=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var r={__proto__:t(e)};else r=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}),r};var t=Object.getPrototypeOf||function(t){return t.__proto__};return nr}(),s=b;function a(e,r){Object.defineProperty(e,t,{get:function(){return r}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(t=Symbol.for("graceful-fs.queue"),e=Symbol.for("graceful-fs.previous")):(t="___graceful-fs.queue",e="___graceful-fs.previous");var u,c=function(){};if(s.debuglog?c=s.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(c=function(){var t=s.format.apply(s,arguments);t="GFS4: "+t.split(/\n/).join("\nGFS4: "),console.error(t)}),!r[t]){var l=I[t]||[];a(r,l),r.close=function(t){function n(e,n){return t.call(r,e,function(t){t||d(),"function"==typeof n&&n.apply(this,arguments)})}return Object.defineProperty(n,e,{value:t}),n}(r.close),r.closeSync=function(t){function n(e){t.apply(r,arguments),d()}return Object.defineProperty(n,e,{value:t}),n}(r.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){c(r[t]),v.equal(r[t].length,0)})}function f(t){n(t),t.gracefulify=f,t.createReadStream=function(e,r){return new t.ReadStream(e,r)},t.createWriteStream=function(e,r){return new t.WriteStream(e,r)};var e=t.readFile;t.readFile=function(t,r,n){"function"==typeof r&&(n=r,r=null);return function t(r,n,i,o){return e(r,n,function(e){!e||"EMFILE"!==e.code&&"ENFILE"!==e.code?"function"==typeof i&&i.apply(this,arguments):h([t,[r,n,i],e,o||Date.now(),Date.now()])})}(t,r,n)};var r=t.writeFile;t.writeFile=function(t,e,n,i){"function"==typeof n&&(i=n,n=null);return function t(e,n,i,o,s){return r(e,n,i,function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):h([t,[e,n,i,o],r,s||Date.now(),Date.now()])})}(t,e,n,i)};var o=t.appendFile;o&&(t.appendFile=function(t,e,r,n){"function"==typeof r&&(n=r,r=null);return function t(e,r,n,i,s){return o(e,r,n,function(o){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?"function"==typeof i&&i.apply(this,arguments):h([t,[e,r,n,i],o,s||Date.now(),Date.now()])})}(t,e,r,n)});var s=t.copyFile;s&&(t.copyFile=function(t,e,r,n){"function"==typeof r&&(n=r,r=0);return function t(e,r,n,i,o){return s(e,r,n,function(s){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):h([t,[e,r,n,i],s,o||Date.now(),Date.now()])})}(t,e,r,n)});var a=t.readdir;t.readdir=function(t,e,r){"function"==typeof e&&(r=e,e=null);var n=u.test(process.version)?function(t,e,r,n){return a(t,i(t,e,r,n))}:function(t,e,r,n){return a(t,e,i(t,e,r,n))};return n(t,e,r);function i(t,e,r,i){return function(o,s){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(s&&s.sort&&s.sort(),"function"==typeof r&&r.call(this,o,s)):h([n,[t,e,r],o,i||Date.now(),Date.now()])}}};var u=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var c=i(t);m=c.ReadStream,g=c.WriteStream}var l=t.ReadStream;l&&(m.prototype=Object.create(l.prototype),m.prototype.open=function(){var t=this;b(t.path,t.flags,t.mode,function(e,r){e?(t.autoClose&&t.destroy(),t.emit("error",e)):(t.fd=r,t.emit("open",r),t.read())})});var p=t.WriteStream;p&&(g.prototype=Object.create(p.prototype),g.prototype.open=function(){var t=this;b(t.path,t.flags,t.mode,function(e,r){e?(t.destroy(),t.emit("error",e)):(t.fd=r,t.emit("open",r))})}),Object.defineProperty(t,"ReadStream",{get:function(){return m},set:function(t){m=t},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(t){g=t},enumerable:!0,configurable:!0});var d=m;Object.defineProperty(t,"FileReadStream",{get:function(){return d},set:function(t){d=t},enumerable:!0,configurable:!0});var y=g;function m(t,e){return this instanceof m?(l.apply(this,arguments),this):m.apply(Object.create(m.prototype),arguments)}function g(t,e){return this instanceof g?(p.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(t){y=t},enumerable:!0,configurable:!0});var _=t.open;function b(t,e,r,n){return"function"==typeof r&&(n=r,r=null),function t(e,r,n,i,o){return _(e,r,n,function(s,a){!s||"EMFILE"!==s.code&&"ENFILE"!==s.code?"function"==typeof i&&i.apply(this,arguments):h([t,[e,r,n,i],s,o||Date.now(),Date.now()])})}(t,e,r,n)}return t.open=b,t}function h(e){c("ENQUEUE",e[0].name,e[1]),r[t].push(e),y()}function d(){for(var e=Date.now(),n=0;n<r[t].length;++n)r[t][n].length>2&&(r[t][n][3]=e,r[t][n][4]=e);y()}function y(){if(clearTimeout(u),u=void 0,0!==r[t].length){var e=r[t].shift(),n=e[0],i=e[1],o=e[2],s=e[3],a=e[4];if(void 0===s)c("RETRY",n.name,i),n.apply(null,i);else if(Date.now()-s>=6e4){c("TIMEOUT",n.name,i);var l=i.pop();"function"==typeof l&&l.call(null,o)}else{var f=Date.now()-a,h=Math.max(a-s,1);f>=Math.min(1.2*h,100)?(c("RETRY",n.name,i),n.apply(null,i.concat([s]))):r[t].push(e)}void 0===u&&(u=setTimeout(y,0))}}return I[t]||a(I,r[t]),or=f(o(r)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!r.__patched&&(or=f(r),r.__patched=!0),or}var pr,dr,yr,mr,gr,_r={exports:{}},br={exports:{}};function vr(){if(pr)return br.exports;return pr=1,"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?br.exports={nextTick:function(t,e,r,n){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,o,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(t);case 2:return process.nextTick(function(){t.call(null,e)});case 3:return process.nextTick(function(){t.call(null,e,r)});case 4:return process.nextTick(function(){t.call(null,e,r,n)});default:for(i=new Array(s-1),o=0;o<i.length;)i[o++]=arguments[o];return process.nextTick(function(){t.apply(null,i)})}}}:br.exports=process,br.exports}function wr(){if(yr)return dr;yr=1;var t={}.toString;return dr=Array.isArray||function(e){return"[object Array]"==t.call(e)}}function Sr(){return gr?mr:(gr=1,mr=g)}var Er,kr={exports:{}};function xr(){return Er||(Er=1,function(t,e){var r=w,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(kr,kr.exports)),kr.exports}var Or,Tr={};function jr(){if(Or)return Tr;function t(t){return Object.prototype.toString.call(t)}return Or=1,Tr.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},Tr.isBoolean=function(t){return"boolean"==typeof t},Tr.isNull=function(t){return null===t},Tr.isNullOrUndefined=function(t){return null==t},Tr.isNumber=function(t){return"number"==typeof t},Tr.isString=function(t){return"string"==typeof t},Tr.isSymbol=function(t){return"symbol"==typeof t},Tr.isUndefined=function(t){return void 0===t},Tr.isRegExp=function(e){return"[object RegExp]"===t(e)},Tr.isObject=function(t){return"object"==typeof t&&null!==t},Tr.isDate=function(e){return"[object Date]"===t(e)},Tr.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},Tr.isFunction=function(t){return"function"==typeof t},Tr.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},Tr.isBuffer=w.Buffer.isBuffer,Tr}var Cr,Rr,Pr={exports:{}},Lr={exports:{}};function Fr(){if(Rr)return Pr.exports;Rr=1;try{var t=require("util");if("function"!=typeof t.inherits)throw"";Pr.exports=t.inherits}catch(t){Pr.exports=(Cr||(Cr=1,"function"==typeof Object.create?Lr.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Lr.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}),Lr.exports)}return Pr.exports}var Ar,Ir,Dr,Mr,Nr,Br,Ur,zr,Wr,Hr={exports:{}};function $r(){return Ar||(Ar=1,function(t){var e=xr().Buffer,r=b;function n(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),i=this.head,o=0;i;)n(i.data,r,o),o+=i.data.length,i=i.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(Hr)),Hr.exports}function qr(){if(Dr)return Ir;Dr=1;var t=vr();function e(t,e){t.emit("error",e)}return Ir={destroy:function(r,n){var i=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(n?n(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(e,this,r)):t.nextTick(e,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(r){!n&&r?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,t.nextTick(e,i,r)):t.nextTick(e,i,r):n&&n(r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}function Gr(){return Nr?Mr:(Nr=1,Mr=b.deprecate)}function Vr(){if(Ur)return Br;Ur=1;var t=vr();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}Br=p;var r,n=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=h;var i=Object.create(jr());i.inherits=Fr();var o={deprecate:Gr()},s=Sr(),a=xr().Buffer,u=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=qr();function f(){}function h(i,o){r=r||Qr(),i=i||{};var s=o instanceof r;this.objectMode=!!i.objectMode,s&&(this.objectMode=this.objectMode||!!i.writableObjectMode);var a=i.highWaterMark,u=i.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:s&&(u||0===u)?u:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===i.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=i.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var i=e._writableState,o=i.sync,s=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function(e,r,n,i,o){--r.pendingcb,n?(t.nextTick(o,i),t.nextTick(b,e,r),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),b(e,r))}(e,i,o,r,s);else{var a=g(i);a||i.corked||i.bufferProcessing||!i.bufferedRequest||m(e,i),o?n(y,e,i,a,s):y(e,i,a,s)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function p(t){if(r=r||Qr(),!(c.call(p,this)||this instanceof r))return new p(t);this._writableState=new h(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function d(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function y(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),b(t,e)}function m(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,d(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(d(t,r,!1,r.objectMode?1:c.length,c,l,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function g(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function _(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),b(t,e)})}function b(e,r){var n=g(r);return n&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(_,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),n}return i.inherits(p,s),h.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(h.prototype,"buffer",{get:o.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===p&&(t&&t._writableState instanceof h)}})):c=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,c=!o.objectMode&&(i=e,a.isBuffer(i)||i instanceof u);return c&&!a.isBuffer(e)&&(e=function(t){return a.from(t)}(e)),"function"==typeof r&&(n=r,r=null),c?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=f),o.ended?function(e,r){var n=new Error("write after end");e.emit("error",n),t.nextTick(r,n)}(this,n):(c||function(e,r,n,i){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||r.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),t.nextTick(i,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var u=e.objectMode?1:n.length;e.length+=u;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else d(t,e,!1,u,n,i,o);return c}(this,o,c,e,r,n)),s},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||m(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,b(e,r),n&&(r.finished?t.nextTick(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=l.destroy,p.prototype._undestroy=l.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},Br}function Qr(){if(Wr)return zr;Wr=1;var t=vr(),e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};zr=u;var r=Object.create(jr());r.inherits=Fr();var n=ki(),i=Vr();r.inherits(u,n);for(var o=e(i.prototype),s=0;s<o.length;s++){var a=o[s];u.prototype[a]||(u.prototype[a]=i.prototype[a])}function u(t){if(!(this instanceof u))return new u(t);n.call(this,t),i.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",c)}function c(){this.allowHalfOpen||this._writableState.ended||t.nextTick(l,this)}function l(t){t.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),u.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},zr}var Zr,Kr,Jr,Yr,Xr,tn,en,rn,nn,on,sn,an,un,cn,ln,fn,hn,pn,dn,yn,mn,gn,_n,bn,vn,wn,Sn,En,kn,xn,On,Tn,jn,Cn,Rn,Pn,Ln,Fn,An,In,Dn,Mn,Nn,Bn,Un,zn,Wn,Hn,$n,qn,Gn,Vn,Qn,Zn,Kn,Jn,Yn,Xn,ti,ei,ri,ni,ii,oi,si,ai,ui,ci,li,fi,hi,pi,di,yi,mi,gi,_i,bi,vi,wi,Si={};function Ei(){if(Zr)return Si;Zr=1;var t=xr().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}return Si.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},Si}function ki(){if(Jr)return Kr;Jr=1;var t=vr();Kr=m;var e,r=wr();m.ReadableState=y,d.EventEmitter;var n=function(t,e){return t.listeners(e).length},i=Sr(),o=xr().Buffer,s=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a=Object.create(jr());a.inherits=Fr();var u=b,c=void 0;c=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f=$r(),h=qr();a.inherits(m,i);var p=["error","close","destroy","pause","resume"];function y(t,r){t=t||{};var n=r instanceof(e=e||Qr());this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=Ei().StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function m(t){if(e=e||Qr(),!(this instanceof m))return new m(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),i.call(this)}function g(t,e,r,n,i){var a,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,u)):(i||(a=function(t,e){var r;n=e,o.isBuffer(n)||n instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(u,e)),a?t.emit("error",a):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),n?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):k(t,u)):_(t,u,e,!1))):n||(u.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function _(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&S(t)),k(t,e)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),m.prototype.destroy=h.destroy,m.prototype._undestroy=h.undestroy,m.prototype._destroy=function(t,e){this.push(null),e(t)},m.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=o.from(t,e),e=""),r=!0),g(this,t,e,!1,r)},m.prototype.unshift=function(t){return g(this,t,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(t){return l||(l=Ei().StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};var v=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=v?t=v:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(c("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(E,e):E(e))}function E(t){c("emit readable"),t.emit("readable"),j(t)}function k(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(x,e,r))}function x(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(c("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function O(t){c("readable nexttick read 0"),t.read(0)}function T(t,e){e.reading||(c("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function C(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=o.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function R(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(P,r,e))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return m.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):S(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&R(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(n=t>0?C(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==n&&this.emit("data",n),n},m.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,i){var o=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,c("pipe count=%d opts=%j",s.pipesCount,i);var a=(!i||!1!==i.end)&&e!==process.stdout&&e!==process.stderr?l:_;function u(t,r){c("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),o.removeListener("end",l),o.removeListener("end",_),o.removeListener("data",d),h=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){c("onend"),e.end()}s.endEmitted?t.nextTick(a):o.once("end",a),e.on("unpipe",u);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,j(t))}}(o);e.on("drain",f);var h=!1;var p=!1;function d(t){c("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==L(s.pipes,e))&&!h&&(c("false write response, pause",s.awaitDrain),s.awaitDrain++,p=!0),o.pause())}function y(t){c("onerror",t),_(),e.removeListener("error",y),0===n(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),_()}function g(){c("onfinish"),e.removeListener("close",m),_()}function _(){c("unpipe"),o.unpipe(e)}return o.on("data",d),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(e,"error",y),e.once("close",m),e.once("finish",g),e.emit("pipe",o),s.flowing||(c("pipe resume"),o.resume()),e},m.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=L(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},m.prototype.on=function(e,r){var n=i.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&S(this):t.nextTick(O,this))}return n},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(T,e,r))}(this,e)),this},m.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<p.length;o++)t.on(p[o],this.emit.bind(this,p[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=C,Kr}function xi(){if(Xr)return Yr;Xr=1,Yr=n;var t=Qr(),e=Object.create(jr());function r(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function n(e){if(!(this instanceof n))return new n(e);t.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",i)}function i(){var t=this;"function"==typeof this._flush?this._flush(function(e,r){o(t,e,r)}):o(this,null,null)}function o(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}return e.inherits=Fr(),e.inherits(n,t),n.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.prototype.push.call(this,e,r)},n.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},n.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},n.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},n.prototype._destroy=function(e,r){var n=this;t.prototype._destroy.call(this,e,function(t){r(t),n.emit("close")})},Yr}function Oi(){return rn||(rn=1,t=_r,e=_r.exports,r=g,"disable"===process.env.READABLE_STREAM&&r?(t.exports=r,(e=t.exports=r.Readable).Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.Stream=r):((e=t.exports=ki()).Stream=r||e,e.Readable=e,e.Writable=Vr(),e.Duplex=Qr(),e.Transform=xi(),e.PassThrough=function(){if(en)return tn;en=1,tn=r;var t=xi(),e=Object.create(jr());function r(e){if(!(this instanceof r))return new r(e);t.call(this,e)}return e.inherits=Fr(),e.inherits(r,t),r.prototype._transform=function(t,e,r){r(null,t)},tn}())),_r.exports;var t,e,r}function Ti(){if(an)return sn;an=1;var t=b,e=on?nn:(on=1,nn=Oi().PassThrough);function r(t,e,r){t[e]=function(){return delete t[e],r.apply(this,arguments),this[e].apply(this,arguments)}}function n(t,i){if(!(this instanceof n))return new n(t,i);e.call(this,i),r(this,"_read",function(){var e=t.call(this,i),r=this.emit.bind(this,"error");e.on("error",r),e.pipe(this)}),this.emit("readable")}function i(t,n){if(!(this instanceof i))return new i(t,n);e.call(this,n),r(this,"_write",function(){var e=t.call(this,n),r=this.emit.bind(this,"error");e.on("error",r),this.pipe(e)}),this.emit("writable")}return sn={Readable:n,Writable:i},t.inherits(n,e),t.inherits(i,e),sn}
|
|
2
2
|
/*!
|
|
3
3
|
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
6
6
|
* Released under the MIT License.
|
|
7
|
-
*/function ji(){return cn||(cn=1,un=function(t,e){if("string"!=typeof t)throw new TypeError("expected path to be a string");if("\\"===t||"/"===t)return"/";var r=t.length;if(r<=1)return t;var n="";if(r>4&&"\\"===t[3]){var i=t[2];"?"!==i&&"."!==i||"\\\\"!==t.slice(0,2)||(t=t.slice(2),n="//")}var o=t.split(/[/\\]+/);return!1!==e&&""===o[o.length-1]&&o.pop(),n+o.join("/")}),un}function Ci(){if(fn)return ln;return fn=1,ln=function(t){return t}}function Ri(){if(yn)return dn;yn=1;var t=pn?hn:(pn=1,hn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}),e=Math.max;return dn=function(r,n,i){return n=e(void 0===n?r.length-1:n,0),function(){for(var o=arguments,s=-1,a=e(o.length-n,0),u=Array(a);++s<a;)u[s]=o[n+s];s=-1;for(var c=Array(n+1);++s<n;)c[s]=o[s];return c[n]=i(u),t(r,this,c)}},dn}function Pi(){if(bn)return _n;bn=1;var t="object"==typeof I&&I&&I.Object===Object&&I;return _n=t}function Li(){if(wn)return vn;wn=1;var t=Pi(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return vn=r}function Fi(){if(En)return Sn;En=1;var t=Li().Symbol;return Sn=t}function Ai(){if(Cn)return jn;Cn=1;var t=Fi(),e=function(){if(xn)return kn;xn=1;var t=Fi(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;return kn=function(t){var e=r.call(t,i),o=t[i];try{t[i]=void 0;var s=!0}catch(t){}var a=n.call(t);return s&&(e?t[i]=o:delete t[i]),a}}(),r=function(){if(On)return Tn;On=1;var t=Object.prototype.toString;return Tn=function(e){return t.call(e)}}(),n=t?t.toStringTag:void 0;return jn=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function Ii(){if(Pn)return Rn;return Pn=1,Rn=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function Di(){if(Fn)return Ln;Fn=1;var t=Ai(),e=Ii();return Ln=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function Mi(){if(Mn)return Dn;Mn=1;var t,e=function(){if(In)return An;In=1;var t=Li()["__core-js_shared__"];return An=t}(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return Dn=function(t){return!!r&&r in t}}function Ni(){if(zn)return Un;zn=1;var t=Di(),e=Mi(),r=Ii(),n=function(){if(Bn)return Nn;Bn=1;var t=Function.prototype.toString;return Nn=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}(),i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,a=o.toString,u=s.hasOwnProperty,c=RegExp("^"+a.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Un=function(o){return!(!r(o)||e(o))&&(t(o)?c:i).test(n(o))}}function Bi(){if(qn)return $n;qn=1;var t=Ni(),e=Hn?Wn:(Hn=1,Wn=function(t,e){return null==t?void 0:t[e]});return $n=function(r,n){var i=e(r,n);return t(i)?i:void 0}}function Ui(){if(Zn)return Qn;Zn=1;var t=gn?mn:(gn=1,mn=function(t){return function(){return t}}),e=function(){if(Vn)return Gn;Vn=1;var t=Bi(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return Gn=e}(),r=Ci();return Qn=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:r}function zi(){if(Xn)return Yn;Xn=1;var t=Ui(),e=function(){if(Jn)return Kn;Jn=1;var t=Date.now;return Kn=function(e){var r=0,n=0;return function(){var i=t(),o=16-(i-n);if(n=i,o>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},Kn}(),r=e(t);return Yn=r}function Wi(){if(ei)return ti;ei=1;var t=Ci(),e=Ri(),r=zi();return ti=function(n,i){return r(e(n,i,t),n+"")}}function Hi(){if(ni)return ri;return ni=1,ri=function(t,e){return t===e||t!=t&&e!=e}}function $i(){if(oi)return ii;oi=1;return ii=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function qi(){if(ai)return si;ai=1;var t=Di(),e=$i();return si=function(r){return null!=r&&e(r.length)&&!t(r)}}function Gi(){if(ci)return ui;ci=1;var t=/^(?:0|[1-9]\d*)$/;return ui=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function Vi(){if(yi)return di;return yi=1,di=function(t){return null!=t&&"object"==typeof t}}function Qi(){if(bi)return _i;bi=1;var t=function(){if(gi)return mi;gi=1;var t=Ai(),e=Vi();return mi=function(r){return e(r)&&"[object Arguments]"==t(r)}}(),e=Vi(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,o=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!i.call(t,"callee")};return _i=o}function Zi(){if(wi)return vi;wi=1;var t=Array.isArray;return vi=t}var Ki,Ji,Yi,Xi,to,eo,ro,no={exports:{}};function io(){return Yi||(Yi=1,function(t,e){var r=Li(),n=Ji?Ki:(Ji=1,Ki=function(){return!1}),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}(no,no.exports)),no.exports}function oo(){if(ro)return eo;return ro=1,eo=function(t){return function(e){return t(e)}}}var so,ao,uo,co,lo,fo,ho,po,yo,mo,go,_o,bo,vo,wo,So={exports:{}};function Eo(){if(uo)return ao;uo=1;var t=function(){if(to)return Xi;to=1;var t=Ai(),e=$i(),r=Vi(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Xi=function(i){return r(i)&&e(i.length)&&!!n[t(i)]}}(),e=oo(),r=function(){return so||(so=1,t=So,e=So.exports,r=Pi(),n=e&&!e.nodeType&&e,i=n&&t&&!t.nodeType&&t,o=i&&i.exports===n&&r.process,s=function(){try{return i&&i.require&&i.require("util").types||o&&o.binding&&o.binding("util")}catch(t){}}(),t.exports=s),So.exports;var t,e,r,n,i,o,s}(),n=r&&r.isTypedArray,i=n?e(n):t;return ao=i}function ko(){if(lo)return co;lo=1;var t=(pi||(pi=1,hi=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}),hi),e=Qi(),r=Zi(),n=io(),i=Gi(),o=Eo(),s=Object.prototype.hasOwnProperty;return co=function(a,u){var c=r(a),l=!c&&e(a),f=!c&&!l&&n(a),h=!c&&!l&&!f&&o(a),p=c||l||f||h,d=p?t(a.length,String):[],y=d.length;for(var m in a)!u&&!s.call(a,m)||p&&("length"==m||f&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||i(m,y))||d.push(m);return d}}function xo(){if(go)return mo;go=1;var t=Ii(),e=function(){if(ho)return fo;ho=1;var t=Object.prototype;return fo=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}(),r=yo?po:(yo=1,po=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}),n=Object.prototype.hasOwnProperty;return mo=function(i){if(!t(i))return r(i);var o=e(i),s=[];for(var a in i)("constructor"!=a||!o&&n.call(i,a))&&s.push(a);return s}}function To(){if(wo)return vo;wo=1;var t=Wi(),e=Hi(),r=function(){if(fi)return li;fi=1;var t=Hi(),e=qi(),r=Gi(),n=Ii();return li=function(i,o,s){if(!n(s))return!1;var a=typeof o;return!!("number"==a?e(s)&&r(o,s.length):"string"==a&&o in s)&&t(s[o],i)},li}(),n=function(){if(bo)return _o;bo=1;var t=ko(),e=xo(),r=qi();return _o=function(n){return r(n)?t(n,!0):e(n)}}(),i=Object.prototype,o=i.hasOwnProperty,s=t(function(t,s){t=Object(t);var a=-1,u=s.length,c=u>2?s[2]:void 0;for(c&&r(s[0],s[1],c)&&(u=1);++a<u;)for(var l=s[a],f=n(l),h=-1,p=f.length;++h<p;){var d=f[h],y=t[d];(void 0===y||e(y,i[d])&&!o.call(t,d))&&(t[d]=l[d])}return t});return vo=s}var Oo,jo,Co,Ro,Po,Lo,Fo={exports:{}};function Ao(){return jo?Oo:(jo=1,Oo=g)}function Io(){if(Ro)return Co;function t(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 e(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach(function(t){r(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function r(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:String(e)}Ro=1;var o=w.Buffer,s=b.inspect,a=s&&s.custom||"inspect";function u(t,e,r){o.prototype.copy.call(t,e,r)}return Co=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return n(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e=o.allocUnsafe(t>>>0),r=this.head,n=0;r;)u(r.data,e,n),n+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0===(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0===(t-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,e}},{key:a,value:function(t,r){return s(this,e(e({},r),{},{depth:0,customInspect:!1}))}}]),t}(),Co}function Do(){if(Lo)return Po;function t(t,n){r(t,n),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(t,e){t.emit("error",e)}return Lo=1,Po={destroy:function(n,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(n):n&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,n)):process.nextTick(r,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,function(r){!i&&r?o._writableState?o._writableState.errorEmitted?process.nextTick(e,o):(o._writableState.errorEmitted=!0,process.nextTick(t,o,r)):process.nextTick(t,o,r):i?(process.nextTick(e,o),i(r)):process.nextTick(e,o)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}},Po}var Mo,No,Bo,Uo,zo,Wo,Ho,$o={};function qo(){if(Mo)return $o;Mo=1;const t={};function e(e,r,n){n||(n=Error);class i extends n{constructor(t,e,n){super(function(t,e,n){return"string"==typeof r?r:r(t,e,n)}(t,e,n))}}i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function r(t,e){if(Array.isArray(t)){const r=t.length;return t=t.map(t=>String(t)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}return`of ${e} ${String(t)}`}return e("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(t,e,n){let i;var o;let s;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s=`The ${t} ${i} ${r(e,"type")}`;else{const n=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s=`The "${t}" ${n} ${i} ${r(e,"type")}`}return s+=". Received type "+typeof n,s},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$o.codes=t,$o}function Go(){if(Bo)return No;Bo=1;var t=qo().codes.ERR_INVALID_OPT_VALUE;return No={getHighWaterMark:function(e,r,n,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(r,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new t(i?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}}function Vo(){if(zo)return Uo;function t(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var e;zo=1,Uo=S,S.WritableState=v;var r={deprecate:Gr()},n=Ao(),i=w.Buffer,o=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s,a=Do(),u=Go().getHighWaterMark,c=qo().codes,l=c.ERR_INVALID_ARG_TYPE,f=c.ERR_METHOD_NOT_IMPLEMENTED,h=c.ERR_MULTIPLE_CALLBACK,p=c.ERR_STREAM_CANNOT_PIPE,d=c.ERR_STREAM_DESTROYED,y=c.ERR_STREAM_NULL_VALUES,m=c.ERR_STREAM_WRITE_AFTER_END,g=c.ERR_UNKNOWN_ENCODING,_=a.errorOrDestroy;function b(){}function v(r,n,i){e=e||Qo(),r=r||{},"boolean"!=typeof i&&(i=n instanceof e),this.objectMode=!!r.objectMode,i&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=u(this,r,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new h;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(process.nextTick(i,n),process.nextTick(j,t,e),t._writableState.errorEmitted=!0,_(t,n)):(i(n),t._writableState.errorEmitted=!0,_(t,n),j(t,e))}(t,r,n,e,i);else{var o=T(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||x(t,r),n?process.nextTick(k,t,r,o,i):k(t,r,o,i)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function S(t){var r=this instanceof(e=e||Qo());if(!r&&!s.call(S,this))return new S(t);this._writableState=new v(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),n.call(this)}function E(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new d("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function k(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),j(t,e)}function x(e,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(e._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,E(e,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(E(e,r,!1,r.objectMode?1:c.length,c,l,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function O(t,e){t._final(function(r){e.pendingcb--,r&&_(t,r),e.prefinished=!0,t.emit("prefinish"),j(t,e)})}function j(t,e){var r=T(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(O,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}return Fr()(S,n),v.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(v.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&(t&&t._writableState instanceof v)}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){_(this,new p)},S.prototype.write=function(t,e,r){var n,s=this._writableState,a=!1,u=!s.objectMode&&(n=t,i.isBuffer(n)||n instanceof o);return u&&!i.isBuffer(t)&&(t=function(t){return i.from(t)}(t)),"function"==typeof e&&(r=e,e=null),u?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=b),s.ending?function(t,e){var r=new m;_(t,r),process.nextTick(e,r)}(this,r):(u||function(t,e,r,n){var i;return null===r?i=new y:"string"==typeof r||e.objectMode||(i=new l("chunk",["string","Buffer"],r)),!i||(_(t,i),process.nextTick(n,i),!1)}(this,s,t,r))&&(s.pendingcb++,a=function(t,e,r,n,o,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=i.from(e,r));return e}(e,n,o);n!==a&&(r=!0,o="buffer",n=a)}var u=e.objectMode?1:n.length;e.length+=u;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:o,isBuf:r,callback:s,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,u,n,o,s);return c}(this,s,u,t,e,r)),a},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||x(this,t))},S.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,r){r(new f("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,j(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=a.destroy,S.prototype._undestroy=a.undestroy,S.prototype._destroy=function(t,e){e(t)},Uo}function Qo(){if(Ho)return Wo;Ho=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Wo=s;var e=_s(),r=Vo();Fr()(s,e);for(var n=t(r.prototype),i=0;i<n.length;i++){var o=n[i];s.prototype[o]||(s.prototype[o]=r.prototype[o])}function s(t){if(!(this instanceof s))return new s(t);e.call(this,t),r.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(u,this)}function u(t){t.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Wo}var Zo,Ko,Jo,Yo,Xo,ts,es,rs,ns,is,os,ss,as,us,cs,ls,fs,hs={},ps={exports:{}};function ds(){if(Ko)return hs;Ko=1;var t=(Zo||(Zo=1,function(t,e){var r=w,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(ps,ps.exports)),ps.exports).Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}return hs.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},hs}function ys(){if(Yo)return Jo;Yo=1;var t=qo().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return Jo=function r(n,i,o){if("function"==typeof i)return r(n,null,i);i||(i={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||e);var s=i.readable||!1!==i.readable&&n.readable,a=i.writable||!1!==i.writable&&n.writable,u=function(){n.writable||l()},c=n._writableState&&n._writableState.finished,l=function(){a=!1,c=!0,s||o.call(n)},f=n._readableState&&n._readableState.endEmitted,h=function(){s=!1,f=!0,a||o.call(n)},p=function(t){o.call(n,t)},d=function(){var e;return s&&!f?(n._readableState&&n._readableState.ended||(e=new t),o.call(n,e)):a&&!c?(n._writableState&&n._writableState.ended||(e=new t),o.call(n,e)):void 0},y=function(){n.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(n)?a&&!n._writableState&&(n.on("end",u),n.on("close",u)):(n.on("complete",l),n.on("abort",d),n.req?y():n.on("request",y)),n.on("end",h),n.on("finish",l),!1!==i.error&&n.on("error",p),n.on("close",d),function(){n.removeListener("complete",l),n.removeListener("abort",d),n.removeListener("request",y),n.req&&n.req.removeListener("finish",l),n.removeListener("end",u),n.removeListener("close",u),n.removeListener("finish",l),n.removeListener("end",h),n.removeListener("error",p),n.removeListener("close",d)}},Jo}function ms(){if(ts)return Xo;var t;function e(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}ts=1;var r=ys(),n=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(t,e){return{value:t,done:e}}function f(t){var e=t[n];if(null!==e){var r=t[c].read();null!==r&&(t[a]=null,t[n]=null,t[i]=null,e(l(r,!1)))}}function h(t){process.nextTick(f,t)}var p=Object.getPrototypeOf(function(){}),d=Object.setPrototypeOf((t={get stream(){return this[c]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[s])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise(function(e,r){process.nextTick(function(){t[o]?r(t[o]):e(l(void 0,!0))})});var r,n=this[a];if(n)r=new Promise(function(t,e){return function(r,n){t.then(function(){e[s]?r(l(void 0,!0)):e[u](r,n)},n)}}(n,this));else{var i=this[c].read();if(null!==i)return Promise.resolve(l(i,!1));r=new Promise(this[u])}return this[a]=r,r}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var t=this;return new Promise(function(e,r){t[c].destroy(null,function(t){t?r(t):e(l(void 0,!0))})})}),t),p);return Xo=function(t){var f,p=Object.create(d,(e(f={},c,{value:t,writable:!0}),e(f,n,{value:null,writable:!0}),e(f,i,{value:null,writable:!0}),e(f,o,{value:null,writable:!0}),e(f,s,{value:t._readableState.endEmitted,writable:!0}),e(f,u,{value:function(t,e){var r=p[c].read();r?(p[a]=null,p[n]=null,p[i]=null,t(l(r,!1))):(p[n]=t,p[i]=e)},writable:!0}),f));return p[a]=null,r(t,function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=p[i];return null!==e&&(p[a]=null,p[n]=null,p[i]=null,e(t)),void(p[o]=t)}var r=p[n];null!==r&&(p[a]=null,p[n]=null,p[i]=null,r(l(void 0,!0))),p[s]=!0}),t.on("readable",h.bind(null,p)),p},Xo}function gs(){if(rs)return es;function t(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function e(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 r(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}rs=1;var n=qo().codes.ERR_INVALID_ARG_TYPE;return es=function(i,o,s){var a;if(o&&"function"==typeof o.next)a=o;else if(o&&o[Symbol.asyncIterator])a=o[Symbol.asyncIterator]();else{if(!o||!o[Symbol.iterator])throw new n("iterable",["Iterable"],o);a=o[Symbol.iterator]()}var u=new i(function(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({objectMode:!0},s)),c=!1;function l(){return f.apply(this,arguments)}function f(){var e;return e=function*(){try{var t=yield a.next(),e=t.value;t.done?u.push(null):u.push(yield e)?l():c=!1}catch(t){u.destroy(t)}},f=function(){var r=this,n=arguments;return new Promise(function(i,o){var s=e.apply(r,n);function a(e){t(s,i,o,a,u,"next",e)}function u(e){t(s,i,o,a,u,"throw",e)}a(void 0)})},f.apply(this,arguments)}return u._read=function(){c||(c=!0,l())},u},es}function _s(){if(is)return ns;var t;is=1,ns=k,k.ReadableState=E,d.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=Ao(),n=w.Buffer,i=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,s=b;o=s&&s.debuglog?s.debuglog("stream"):function(){};var a,u,c,l=Io(),f=Do(),h=Go().getHighWaterMark,p=qo().codes,y=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,g=p.ERR_METHOD_NOT_IMPLEMENTED,_=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Fr()(k,r);var v=f.errorOrDestroy,S=["error","close","destroy","pause","resume"];function E(e,r,n){t=t||Qo(),e=e||{},"boolean"!=typeof n&&(n=r instanceof t),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=h(this,e,"readableHighWaterMark",n),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(a||(a=ds().StringDecoder),this.decoder=new a(e.encoding),this.encoding=e.encoding)}function k(e){if(t=t||Qo(),!(this instanceof k))return new k(e);var n=this instanceof t;this._readableState=new E(e,this,n),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function x(t,e,r,s,a){o("readableAddChunk",e);var u,c=t._readableState;if(null===e)c.reading=!1,function(t,e){if(o("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?C(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,R(t)))}(t,c);else if(a||(u=function(t,e){var r;o=e,n.isBuffer(o)||o instanceof i||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var o;return r}(c,e)),u)v(t,u);else if(c.objectMode||e&&e.length>0)if("string"==typeof e||c.objectMode||Object.getPrototypeOf(e)===n.prototype||(e=function(t){return n.from(t)}(e)),s)c.endEmitted?v(t,new _):T(t,c,e,!0);else if(c.ended)v(t,new m);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(e=c.decoder.write(e),c.objectMode||0!==e.length?T(t,c,e,!1):P(t,c)):T(t,c,e,!1)}else s||(c.reading=!1,P(t,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function T(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&C(t)),P(t,e)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),k.prototype.destroy=f.destroy,k.prototype._undestroy=f.undestroy,k.prototype._destroy=function(t,e){e(t)},k.prototype.push=function(t,e){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof t&&((e=e||i.defaultEncoding)!==i.encoding&&(t=n.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},k.prototype.unshift=function(t){return x(this,t,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(t){a||(a=ds().StringDecoder);var e=new a(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var O=1073741824;function j(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=O?t=O:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function C(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(R,t))}function R(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,M(t)}function P(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(o("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function F(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function A(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),M(t),e.flowing&&!e.reading&&t.read(0)}function M(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function B(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function z(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return k.prototype.read=function(t){o("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):C(this),null;if(0===(t=j(t,e))&&e.ended)return 0===e.length&&B(this),null;var n,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&o("length less than watermark",i=!0),e.ended||e.reading?o("reading or ended",i=!1):i&&(o("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=j(r,e))),null===(n=t>0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==n&&this.emit("data",n),n},k.prototype._read=function(t){v(this,new g("_read()"))},k.prototype.pipe=function(t,r){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,r);var s=(!r||!1!==r.end)&&t!==process.stdout&&t!==process.stderr?u:y;function a(e,r){o("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,o("cleanup"),t.removeListener("close",p),t.removeListener("finish",d),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",f),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function u(){o("onend"),t.end()}i.endEmitted?process.nextTick(s):n.once("end",s),t.on("unpipe",a);var c=function(t){return function(){var r=t._readableState;o("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,M(t))}}(n);t.on("drain",c);var l=!1;function f(e){o("ondata");var r=t.write(e);o("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==z(i.pipes,t))&&!l&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function h(r){o("onerror",r),y(),t.removeListener("error",h),0===e(t,"error")&&v(t,r)}function p(){t.removeListener("finish",d),y()}function d(){o("onfinish"),t.removeListener("close",p),y()}function y(){o("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",p),t.once("finish",d),t.emit("pipe",n),i.flowing||(o("pipe resume"),n.resume()),t},k.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=z(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},k.prototype.on=function(t,e){var n=r.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?C(this):i.reading||process.nextTick(A,this))),n},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(t,e){var n=r.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(F,this),n},k.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(F,this),e},k.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(D,t,e))}(this,t)),t.paused=!1,this},k.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(o("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s<S.length;s++)t.on(S[s],this.emit.bind(this,S[s]));return this._read=function(e){o("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=ms()),u(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),k._fromList=N,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(t,e){return void 0===c&&(c=gs()),c(k,t,e)}),ns}function bs(){if(ss)return os;ss=1,os=a;var t=qo().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,o=Qo();function s(t,e){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(null===i)return this.emit("error",new r);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),i(t);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);o.call(this,t),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",u)}function u(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?c(this,null,null):this._flush(function(e,r){c(t,e,r)})}function c(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new i;if(t._transformState.transforming)throw new n;return t.push(null)}return Fr()(a,o),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,e)},a.prototype._transform=function(t,r,n){n(new e("_transform()"))},a.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(t,e){o.prototype._destroy.call(this,t,function(t){e(t)})},os}function vs(){if(ls)return cs;var t;ls=1;var e=qo().codes,r=e.ERR_MISSING_ARGS,n=e.ERR_STREAM_DESTROYED;function i(t){if(t)throw t}function o(t){t()}function s(t,e){return t.pipe(e)}return cs=function(){for(var e=arguments.length,a=new Array(e),u=0;u<e;u++)a[u]=arguments[u];var c,l=function(t){return t.length?"function"!=typeof t[t.length-1]?i:t.pop():i}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var f=a.map(function(e,r){var i=r<a.length-1;return function(e,r,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",function(){s=!0}),void 0===t&&(t=ys()),t(e,{readable:r,writable:i},function(t){if(t)return o(t);s=!0,o()});var a=!1;return function(t){if(!s&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new n("pipe"))}}(e,i,r>0,function(t){c||(c=t),t&&f.forEach(o),i||(f.forEach(o),l(c))})});return a.reduce(s)},cs}function ws(){return fs||(fs=1,t=Fo,e=Fo.exports,r=g,"disable"===process.env.READABLE_STREAM&&r?(t.exports=r.Readable,Object.assign(t.exports,r),t.exports.Stream=r):((e=t.exports=_s()).Stream=r||e,e.Readable=e,e.Writable=Vo(),e.Duplex=Qo(),e.Transform=bs(),e.PassThrough=function(){if(us)return as;us=1,as=e;var t=bs();function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return Fr()(e,t),e.prototype._transform=function(t,e,r){r(null,t)},as}(),e.finished=ys(),e.pipeline=vs())),Fo.exports;var t,e,r}var Ss,Es,ks,xs,Ts,Os,js,Cs,Rs,Ps,Ls,Fs,As,Is,Ds,Ms,Ns,Bs,Us,zs,Ws,Hs,$s,qs,Gs,Vs,Qs,Zs,Ks,Js,Ys,Xs,ta,ea,ra,na,ia,oa,sa,aa,ua,ca,la,fa,ha,pa,da,ya,ma,ga,_a,ba,va,wa,Sa,Ea,ka,xa,Ta,Oa,ja,Ca,Ra,Pa,La,Fa,Aa,Ia,Da,Ma,Na,Ba,Ua,za,Wa,Ha,$a,qa,Ga,Va,Qa,Za,Ka,Ja,Ya,Xa,tu,eu,ru,nu,iu,ou,su,au,uu,cu,lu,fu,hu,pu,du={exports:{}};function yu(){if(Os)return Ts;Os=1;var t=(Es||(Es=1,Ss=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}),Ss),e=function(){if(xs)return ks;xs=1;var t=Fi(),e=Qi(),r=Zi(),n=t?t.isConcatSpreadable:void 0;return ks=function(t){return r(t)||e(t)||!!(n&&t&&t[n])}}();return Ts=function r(n,i,o,s,a){var u=-1,c=n.length;for(o||(o=e),a||(a=[]);++u<c;){var l=n[u];i>0&&o(l)?i>1?r(l,i-1,o,s,a):t(a,l):s||(a[a.length]=l)}return a},Ts}function mu(){if(Ps)return Rs;Ps=1;var t=Bi()(Object,"create");return Rs=t}function gu(){if(Hs)return Ws;Hs=1;var t=function(){if(Fs)return Ls;Fs=1;var t=mu();return Ls=function(){this.__data__=t?t(null):{},this.size=0}}(),e=Is?As:(Is=1,As=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),r=function(){if(Ms)return Ds;Ms=1;var t=mu(),e=Object.prototype.hasOwnProperty;return Ds=function(r){var n=this.__data__;if(t){var i=n[r];return"__lodash_hash_undefined__"===i?void 0:i}return e.call(n,r)?n[r]:void 0}}(),n=function(){if(Bs)return Ns;Bs=1;var t=mu(),e=Object.prototype.hasOwnProperty;return Ns=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}(),i=function(){if(zs)return Us;zs=1;var t=mu();return Us=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}();function o(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])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=n,o.prototype.set=i,Ws=o}function _u(){if(Vs)return Gs;Vs=1;var t=Hi();return Gs=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function bu(){if(na)return ra;na=1;var t=qs?$s:(qs=1,$s=function(){this.__data__=[],this.size=0}),e=function(){if(Zs)return Qs;Zs=1;var t=_u(),e=Array.prototype.splice;return Qs=function(r){var n=this.__data__,i=t(n,r);return!(i<0||(i==n.length-1?n.pop():e.call(n,i,1),--this.size,0))},Qs}(),r=function(){if(Js)return Ks;Js=1;var t=_u();return Ks=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]},Ks}(),n=function(){if(Xs)return Ys;Xs=1;var t=_u();return Ys=function(e){return t(this.__data__,e)>-1}}(),i=function(){if(ea)return ta;ea=1;var t=_u();return ta=function(e,r){var n=this.__data__,i=t(n,e);return i<0?(++this.size,n.push([e,r])):n[i][1]=r,this},ta}();function o(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])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=n,o.prototype.set=i,ra=o}function vu(){if(aa)return sa;aa=1;var t=gu(),e=bu(),r=function(){if(oa)return ia;oa=1;var t=Bi()(Li(),"Map");return ia=t}();return sa=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}function wu(){if(fa)return la;fa=1;var t=ca?ua:(ca=1,ua=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return la=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map},la}function Su(){if(wa)return va;wa=1;var t=vu(),e=function(){if(pa)return ha;pa=1;var t=wu();return ha=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}(),r=function(){if(ya)return da;ya=1;var t=wu();return da=function(e){return t(this,e).get(e)}}(),n=function(){if(ga)return ma;ga=1;var t=wu();return ma=function(e){return t(this,e).has(e)}}(),i=function(){if(ba)return _a;ba=1;var t=wu();return _a=function(e,r){var n=t(this,e),i=n.size;return n.set(e,r),this.size+=n.size==i?0:1,this}}();function o(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])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=n,o.prototype.set=i,va=o}function Eu(){if(Oa)return Ta;Oa=1;var t=Su(),e=Ea?Sa:(Ea=1,Sa=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),r=xa?ka:(xa=1,ka=function(t){return this.__data__.has(t)});function n(e){var r=-1,n=null==e?0:e.length;for(this.__data__=new t;++r<n;)this.add(e[r])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,Ta=n}function ku(){if(Ia)return Aa;Ia=1;var t=(Ca||(Ca=1,ja=function(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}),ja),e=Pa?Ra:(Pa=1,Ra=function(t){return t!=t}),r=(Fa||(Fa=1,La=function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}),La);return Aa=function(n,i,o){return i==i?r(n,i,o):t(n,e,o)}}function xu(){if(Ma)return Da;Ma=1;var t=ku();return Da=function(e,r){return!!(null==e?0:e.length)&&t(e,r,0)>-1}}function Tu(){if(Ba)return Na;return Ba=1,Na=function(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1},Na}function Ou(){if(Ha)return Wa;return Ha=1,Wa=function(t,e){return t.has(e)}}function ju(){if(qa)return $a;qa=1;var t=Eu(),e=xu(),r=Tu(),n=(za||(za=1,Ua=function(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}),Ua),i=oo(),o=Ou();return $a=function(s,a,u,c){var l=-1,f=e,h=!0,p=s.length,d=[],y=a.length;if(!p)return d;u&&(a=n(a,i(u))),c?(f=r,h=!1):a.length>=200&&(f=o,h=!1,a=new t(a));t:for(;++l<p;){var m=s[l],g=null==u?m:u(m);if(m=c||0!==m?m:0,h&&g==g){for(var _=y;_--;)if(a[_]===g)continue t;d.push(m)}else f(a,g,c)||d.push(m)}return d},$a}function Cu(){if(Va)return Ga;Va=1;var t=qi(),e=Vi();return Ga=function(r){return e(r)&&t(r)}}function Ru(){if(eu)return tu;return eu=1,tu=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r},tu}function Pu(){if(nu)return ru;nu=1;var t=function(){if(Ja)return Ka;Ja=1;var t=Bi()(Li(),"Set");return Ka=t}(),e=Xa?Ya:(Xa=1,Ya=function(){}),r=Ru(),n=t&&1/r(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return ru=n}function Lu(){if(au)return su;au=1;var t=yu(),e=Wi(),r=function(){if(ou)return iu;ou=1;var t=Eu(),e=xu(),r=Tu(),n=Ou(),i=Pu(),o=Ru();return iu=function(s,a,u){var c=-1,l=e,f=s.length,h=!0,p=[],d=p;if(u)h=!1,l=r;else if(f>=200){var y=a?null:i(s);if(y)return o(y);h=!1,l=n,d=new t}else d=a?[]:p;t:for(;++c<f;){var m=s[c],g=a?a(m):m;if(m=u||0!==m?m:0,h&&g==g){for(var _=d.length;_--;)if(d[_]===g)continue t;a&&d.push(g),p.push(m)}else l(d,g,u)||(d!==p&&d.push(g),p.push(m))}return p},iu}(),n=Cu(),i=e(function(e){return r(t(e,1,n,!0))});return su=i}function Fu(){if(fu)return lu;fu=1;var t=(cu||(cu=1,uu=function(t,e){return function(r){return t(e(r))}}),uu),e=t(Object.getPrototypeOf,Object);return lu=e}var Au,Iu,Du,Mu={};function Nu(){if(Au)return Mu;Au=1;var t=y,e="win32"===process.platform,r=p,n=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function i(t){return"function"==typeof t?t:function(){var t;if(n){var e=new Error;t=function(t){t&&(e.message=t.message,r(t=e))}}else t=r;return t;function r(t){if(t){if(process.throwDeprecation)throw t;if(!process.noDeprecation){var e="fs: missing callback "+(t.stack||t.message);process.traceDeprecation?console.trace(e):console.error(e)}}}}()}if(t.normalize,e)var o=/(.*?)(?:[\/\\]+|$)/g;else o=/(.*?)(?:[\/]+|$)/g;if(e)var s=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else s=/^[\/]*/;return Mu.realpathSync=function(n,i){if(n=t.resolve(n),i&&Object.prototype.hasOwnProperty.call(i,n))return i[n];var a,u,c,l,f=n,h={},p={};function d(){var t=s.exec(n);a=t[0].length,u=t[0],c=t[0],l="",e&&!p[c]&&(r.lstatSync(c),p[c]=!0)}for(d();a<n.length;){o.lastIndex=a;var y=o.exec(n);if(l=u,u+=y[0],c=l+y[1],a=o.lastIndex,!(p[c]||i&&i[c]===c)){var m;if(i&&Object.prototype.hasOwnProperty.call(i,c))m=i[c];else{var g=r.lstatSync(c);if(!g.isSymbolicLink()){p[c]=!0,i&&(i[c]=c);continue}var _=null;if(!e){var b=g.dev.toString(32)+":"+g.ino.toString(32);h.hasOwnProperty(b)&&(_=h[b])}null===_&&(r.statSync(c),_=r.readlinkSync(c)),m=t.resolve(l,_),i&&(i[c]=m),e||(h[b]=_)}n=t.resolve(m,n.slice(a)),d()}}return i&&(i[f]=n),n},Mu.realpath=function(n,a,u){if("function"!=typeof u&&(u=i(a),a=null),n=t.resolve(n),a&&Object.prototype.hasOwnProperty.call(a,n))return process.nextTick(u.bind(null,null,a[n]));var c,l,f,h,p=n,d={},y={};function m(){var t=s.exec(n);c=t[0].length,l=t[0],f=t[0],h="",e&&!y[f]?r.lstat(f,function(t){if(t)return u(t);y[f]=!0,g()}):process.nextTick(g)}function g(){if(c>=n.length)return a&&(a[p]=n),u(null,n);o.lastIndex=c;var t=o.exec(n);return h=l,l+=t[0],f=h+t[1],c=o.lastIndex,y[f]||a&&a[f]===f?process.nextTick(g):a&&Object.prototype.hasOwnProperty.call(a,f)?v(a[f]):r.lstat(f,_)}function _(t,n){if(t)return u(t);if(!n.isSymbolicLink())return y[f]=!0,a&&(a[f]=f),process.nextTick(g);if(!e){var i=n.dev.toString(32)+":"+n.ino.toString(32);if(d.hasOwnProperty(i))return b(null,d[i],f)}r.stat(f,function(t){if(t)return u(t);r.readlink(f,function(t,r){e||(d[i]=r),b(t,r)})})}function b(e,r,n){if(e)return u(e);var i=t.resolve(h,r);a&&(a[n]=i),v(i)}function v(e){n=t.resolve(e,n.slice(c)),m()}m()},Mu}function Bu(){if(Du)return Iu;Du=1,Iu=a,a.realpath=a,a.sync=u,a.realpathSync=u,a.monkeypatch=function(){t.realpath=a,t.realpathSync=u},a.unmonkeypatch=function(){t.realpath=e,t.realpathSync=r};var t=p,e=t.realpath,r=t.realpathSync,n=process.version,i=/^v[0-5]\./.test(n),o=Nu();function s(t){return t&&"realpath"===t.syscall&&("ELOOP"===t.code||"ENOMEM"===t.code||"ENAMETOOLONG"===t.code)}function a(t,r,n){if(i)return e(t,r,n);"function"==typeof r&&(n=r,r=null),e(t,r,function(e,i){s(e)?o.realpath(t,r,n):n(e,i)})}function u(t,e){if(i)return r(t,e);try{return r(t,e)}catch(r){if(s(r))return o.realpathSync(t,e);throw r}}return Iu}var Uu,zu,Wu,Hu,$u,qu={};function Gu(){if(Uu)return qu;function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}Uu=1,qu.setopts=function(n,s,c){c||(c={});if(c.matchBase&&-1===s.indexOf("/")){if(c.noglobstar)throw new Error("base matching requires globstar");s="**/"+s}n.windowsPathsNoEscape=!!c.windowsPathsNoEscape||!1===c.allowWindowsEscape,n.windowsPathsNoEscape&&(s=s.replace(/\\/g,"/"));n.silent=!!c.silent,n.pattern=s,n.strict=!1!==c.strict,n.realpath=!!c.realpath,n.realpathCache=c.realpathCache||Object.create(null),n.follow=!!c.follow,n.dot=!!c.dot,n.mark=!!c.mark,n.nodir=!!c.nodir,n.nodir&&(n.mark=!0);n.sync=!!c.sync,n.nounique=!!c.nounique,n.nonull=!!c.nonull,n.nosort=!!c.nosort,n.nocase=!!c.nocase,n.stat=!!c.stat,n.noprocess=!!c.noprocess,n.absolute=!!c.absolute,n.fs=c.fs||e,n.maxLength=c.maxLength||1/0,n.cache=c.cache||Object.create(null),n.statCache=c.statCache||Object.create(null),n.symlinks=c.symlinks||Object.create(null),function(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]);t.ignore.length&&(t.ignore=t.ignore.map(a))}(n,c),n.changedCwd=!1;var l=process.cwd();t(c,"cwd")?(n.cwd=r.resolve(c.cwd),n.changedCwd=n.cwd!==l):n.cwd=r.resolve(l);n.root=c.root||r.resolve(n.cwd,"/"),n.root=r.resolve(n.root),n.cwdAbs=i(n.cwd)?n.cwd:u(n,n.cwd),n.nomount=!!c.nomount,"win32"===process.platform&&(n.root=n.root.replace(/\\/g,"/"),n.cwd=n.cwd.replace(/\\/g,"/"),n.cwdAbs=n.cwdAbs.replace(/\\/g,"/"));c.nonegate=!0,c.nocomment=!0,n.minimatch=new o(s,c),n.options=n.minimatch.options},qu.ownProp=t,qu.makeAbs=u,qu.finish=function(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;n<i;n++){var o=t.matches[n];if(o&&0!==Object.keys(o).length){var a=Object.keys(o);e?r.push.apply(r,a):a.forEach(function(t){r[t]=!0})}else if(t.nonull){var l=t.minimatch.globSet[n];e?r.push(l):r[l]=!0}}e||(r=Object.keys(r));t.nosort||(r=r.sort(s));if(t.mark){for(n=0;n<r.length;n++)r[n]=t._mark(r[n]);t.nodir&&(r=r.filter(function(e){var r=!/\/$/.test(e),n=t.cache[e]||t.cache[u(t,e)];return r&&n&&(r="DIR"!==n&&!Array.isArray(n)),r}))}t.ignore.length&&(r=r.filter(function(e){return!c(t,e)}));t.found=r},qu.mark=function(t,e){var r=u(t,e),n=t.cache[r],i=e;if(n){var o="DIR"===n||Array.isArray(n),s="/"===e.slice(-1);if(o&&!s?i+="/":!o&&s&&(i=i.slice(0,-1)),i!==e){var a=u(t,i);t.statCache[a]=t.statCache[r],t.cache[a]=t.cache[r]}}return i},qu.isIgnored=c,qu.childrenIgnored=function(t,e){return!!t.ignore.length&&t.ignore.some(function(t){return!(!t.gmatcher||!t.gmatcher.match(e))})};var e=p,r=y,n=U(),i=y.isAbsolute,o=n.Minimatch;function s(t,e){return t.localeCompare(e,"en")}function a(t){var e=null;if("/**"===t.slice(-3)){var r=t.replace(/(\/\*\*)+$/,"");e=new o(r,{dot:!0})}return{matcher:new o(t,{dot:!0}),gmatcher:e}}function u(t,e){var n=e;return n="/"===e.charAt(0)?r.join(t.root,e):i(e)||""===e?e:t.changedCwd?r.resolve(t.cwd,e):r.resolve(e),"win32"===process.platform&&(n=n.replace(/\\/g,"/")),n}function c(t,e){return!!t.ignore.length&&t.ignore.some(function(t){return t.matcher.match(e)||!(!t.gmatcher||!t.gmatcher.match(e))})}return qu}function Vu(){if($u)return Hu;return $u=1,Hu=function t(e,r){if(e&&r)return t(e)(r);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){n[t]=e[t]}),n;function n(){for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var n=e.apply(this,t),i=t[t.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach(function(t){n[t]=i[t]}),n}},Hu}var Qu,Zu,Ku,Ju,Yu,Xu,tc,ec={exports:{}};function rc(){if(Qu)return ec.exports;Qu=1;var t=Vu();function e(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function r(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}return ec.exports=t(e),ec.exports.strict=t(r),e.proto=e(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return e(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return r(this)},configurable:!0})}),ec.exports}function nc(){if(Ku)return Zu;Ku=1;var t=Vu(),e=Object.create(null),r=rc();return Zu=t(function(t,n){return e[t]?(e[t].push(n),null):(e[t]=[n],function(t){return r(function r(){var n=e[t],i=n.length,o=function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n]=t[n];return r}(arguments);try{for(var s=0;s<i;s++)n[s].apply(null,o)}finally{n.length>i?(n.splice(0,i),process.nextTick(function(){r.apply(null,o)})):delete e[t]}})}(t))}),Zu}function ic(){if(Yu)return Ju;Yu=1,Ju=g;var t=Bu(),e=U();e.Minimatch;var r=Fr(),n=d.EventEmitter,i=y,o=v,s=y.isAbsolute,a=function(){if(Wu)return zu;Wu=1,zu=l,l.GlobSync=f;var t=Bu(),e=U();e.Minimatch,ic().Glob;var r=y,n=v,i=y.isAbsolute,o=Gu(),s=o.setopts,a=o.ownProp,u=o.childrenIgnored,c=o.isIgnored;function l(t,e){if("function"==typeof e||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");return new f(t,e).found}function f(t,e){if(!t)throw new Error("must provide pattern");if("function"==typeof e||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof f))return new f(t,e);if(s(this,t,e),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}return f.prototype._finish=function(){if(n.ok(this instanceof f),this.realpath){var e=this;this.matches.forEach(function(r,n){var i=e.matches[n]=Object.create(null);for(var o in r)try{o=e._makeAbs(o),i[t.realpathSync(o,e.realpathCache)]=!0}catch(t){if("stat"!==t.syscall)throw t;i[e._makeAbs(o)]=!0}})}o.finish(this)},f.prototype._process=function(t,r,o){n.ok(this instanceof f);for(var s,a=0;"string"==typeof t[a];)a++;switch(a){case t.length:return void this._processSimple(t.join("/"),r);case 0:s=null;break;default:s=t.slice(0,a).join("/")}var c,l=t.slice(a);null===s?c=".":i(s)||i(t.map(function(t){return"string"==typeof t?t:"[*]"}).join("/"))?(s&&i(s)||(s="/"+s),c=s):c=s;var h=this._makeAbs(c);u(this,c)||(l[0]===e.GLOBSTAR?this._processGlobStar(s,c,h,l,r,o):this._processReaddir(s,c,h,l,r,o))},f.prototype._processReaddir=function(t,e,n,i,o,s){var a=this._readdir(n,s);if(a){for(var u=i[0],c=!!this.minimatch.negate,l=u._glob,f=this.dot||"."===l.charAt(0),h=[],p=0;p<a.length;p++)("."!==(m=a[p]).charAt(0)||f)&&(c&&!t?!m.match(u):m.match(u))&&h.push(m);var d=h.length;if(0!==d)if(1!==i.length||this.mark||this.stat)for(i.shift(),p=0;p<d;p++){var y;m=h[p],y=t?[t,m]:[m],this._process(y.concat(i),o,s)}else{this.matches[o]||(this.matches[o]=Object.create(null));for(p=0;p<d;p++){var m=h[p];t&&(m="/"!==t.slice(-1)?t+"/"+m:t+m),"/"!==m.charAt(0)||this.nomount||(m=r.join(this.root,m)),this._emitMatch(o,m)}}}},f.prototype._emitMatch=function(t,e){if(!c(this,e)){var r=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=r),!this.matches[t][e]){if(this.nodir){var n=this.cache[r];if("DIR"===n||Array.isArray(n))return}this.matches[t][e]=!0,this.stat&&this._stat(e)}}},f.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var e,r;try{r=this.fs.lstatSync(t)}catch(t){if("ENOENT"===t.code)return null}var n=r&&r.isSymbolicLink();return this.symlinks[t]=n,n||!r||r.isDirectory()?e=this._readdir(t,!1):this.cache[t]="FILE",e},f.prototype._readdir=function(t,e){if(e&&!a(this.symlinks,t))return this._readdirInGlobStar(t);if(a(this.cache,t)){var r=this.cache[t];if(!r||"FILE"===r)return null;if(Array.isArray(r))return r}try{return this._readdirEntries(t,this.fs.readdirSync(t))}catch(e){return this._readdirError(t,e),null}},f.prototype._readdirEntries=function(t,e){if(!this.mark&&!this.stat)for(var r=0;r<e.length;r++){var n=e[r];n="/"===t?t+n:t+"/"+n,this.cache[n]=!0}return this.cache[t]=e,e},f.prototype._readdirError=function(t,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(t);if(this.cache[r]="FILE",r===this.cwdAbs){var n=new Error(e.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=e.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw e;this.silent||console.error("glob error",e)}},f.prototype._processGlobStar=function(t,e,r,n,i,o){var s=this._readdir(r,o);if(s){var a=n.slice(1),u=t?[t]:[],c=u.concat(a);this._process(c,i,!1);var l=s.length;if(!this.symlinks[r]||!o)for(var f=0;f<l;f++)if("."!==s[f].charAt(0)||this.dot){var h=u.concat(s[f],a);this._process(h,i,!0);var p=u.concat(s[f],n);this._process(p,i,!0)}}},f.prototype._processSimple=function(t,e){var n=this._stat(t);if(this.matches[e]||(this.matches[e]=Object.create(null)),n){if(t&&i(t)&&!this.nomount){var o=/[\/\\]$/.test(t);"/"===t.charAt(0)?t=r.join(this.root,t):(t=r.resolve(this.root,t),o&&(t+="/"))}"win32"===process.platform&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t)}},f.prototype._stat=function(t){var e=this._makeAbs(t),r="/"===t.slice(-1);if(t.length>this.maxLength)return!1;if(!this.stat&&a(this.cache,e)){var n=this.cache[e];if(Array.isArray(n)&&(n="DIR"),!r||"DIR"===n)return n;if(r&&"FILE"===n)return!1}var i=this.statCache[e];if(!i){var o;try{o=this.fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(o&&o.isSymbolicLink())try{i=this.fs.statSync(e)}catch(t){i=o}else i=o}return this.statCache[e]=i,n=!0,i&&(n=i.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||n,(!r||"FILE"!==n)&&n},f.prototype._mark=function(t){return o.mark(this,t)},f.prototype._makeAbs=function(t){return o.makeAbs(this,t)},zu}(),u=Gu(),c=u.setopts,l=u.ownProp,f=nc(),h=u.childrenIgnored,p=u.isIgnored,m=rc();function g(t,e,r){if("function"==typeof e&&(r=e,e={}),e||(e={}),e.sync){if(r)throw new TypeError("callback provided to sync glob");return a(t,e)}return new b(t,e,r)}g.sync=a;var _=g.GlobSync=a.GlobSync;function b(t,e,r){if("function"==typeof e&&(r=e,e=null),e&&e.sync){if(r)throw new TypeError("callback provided to sync glob");return new _(t,e)}if(!(this instanceof b))return new b(t,e,r);c(this,t,e),this._didRealPath=!1;var n=this.minimatch.set.length;this.matches=new Array(n),"function"==typeof r&&(r=m(r),this.on("error",r),this.on("end",function(t){r(null,t)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(0===n)return a();for(var o=!0,s=0;s<n;s++)this._process(this.minimatch.set[s],s,!1,a);function a(){--i._processing,i._processing<=0&&(o?process.nextTick(function(){i._finish()}):i._finish())}o=!1}return g.glob=g,g.hasMagic=function(t,e){var r=function(t,e){if(null===e||"object"!=typeof e)return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}({},e);r.noprocess=!0;var n=new b(t,r).minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var i=0;i<n[0].length;i++)if("string"!=typeof n[0][i])return!0;return!1},g.Glob=b,r(b,n),b.prototype._finish=function(){if(o(this instanceof b),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();u.finish(this),this.emit("end",this.found)}},b.prototype._realpath=function(){if(!this._didRealpath){this._didRealpath=!0;var t=this.matches.length;if(0===t)return this._finish();for(var e=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n)}function n(){0===--t&&e._finish()}},b.prototype._realpathSet=function(e,r){var n=this.matches[e];if(!n)return r();var i=Object.keys(n),o=this,s=i.length;if(0===s)return r();var a=this.matches[e]=Object.create(null);i.forEach(function(n,i){n=o._makeAbs(n),t.realpath(n,o.realpathCache,function(t,i){t?"stat"===t.syscall?a[n]=!0:o.emit("error",t):a[i]=!0,0===--s&&(o.matches[e]=a,r())})})},b.prototype._mark=function(t){return u.mark(this,t)},b.prototype._makeAbs=function(t){return u.makeAbs(this,t)},b.prototype.abort=function(){this.aborted=!0,this.emit("abort")},b.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))},b.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var e=0;e<t.length;e++){var r=t[e];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(e=0;e<n.length;e++){var i=n[e];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}},b.prototype._process=function(t,r,n,i){if(o(this instanceof b),o("function"==typeof i),!this.aborted)if(this._processing++,this.paused)this._processQueue.push([t,r,n,i]);else{for(var a,u=0;"string"==typeof t[u];)u++;switch(u){case t.length:return void this._processSimple(t.join("/"),r,i);case 0:a=null;break;default:a=t.slice(0,u).join("/")}var c,l=t.slice(u);null===a?c=".":s(a)||s(t.map(function(t){return"string"==typeof t?t:"[*]"}).join("/"))?(a&&s(a)||(a="/"+a),c=a):c=a;var f=this._makeAbs(c);if(h(this,c))return i();l[0]===e.GLOBSTAR?this._processGlobStar(a,c,f,l,r,n,i):this._processReaddir(a,c,f,l,r,n,i)}},b.prototype._processReaddir=function(t,e,r,n,i,o,s){var a=this;this._readdir(r,o,function(u,c){return a._processReaddir2(t,e,r,n,i,o,c,s)})},b.prototype._processReaddir2=function(t,e,r,n,o,s,a,u){if(!a)return u();for(var c=n[0],l=!!this.minimatch.negate,f=c._glob,h=this.dot||"."===f.charAt(0),p=[],d=0;d<a.length;d++){if("."!==(m=a[d]).charAt(0)||h)(l&&!t?!m.match(c):m.match(c))&&p.push(m)}var y=p.length;if(0===y)return u();if(1===n.length&&!this.mark&&!this.stat){this.matches[o]||(this.matches[o]=Object.create(null));for(d=0;d<y;d++){var m=p[d];t&&(m="/"!==t?t+"/"+m:t+m),"/"!==m.charAt(0)||this.nomount||(m=i.join(this.root,m)),this._emitMatch(o,m)}return u()}n.shift();for(d=0;d<y;d++){m=p[d];t&&(m="/"!==t?t+"/"+m:t+m),this._process([m].concat(n),o,s,u)}u()},b.prototype._emitMatch=function(t,e){if(!this.aborted&&!p(this,e))if(this.paused)this._emitQueue.push([t,e]);else{var r=s(e)?e:this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=r),!this.matches[t][e]){if(this.nodir){var n=this.cache[r];if("DIR"===n||Array.isArray(n))return}this.matches[t][e]=!0;var i=this.statCache[r];i&&this.emit("stat",e,i),this.emit("match",e)}}},b.prototype._readdirInGlobStar=function(t,e){if(!this.aborted){if(this.follow)return this._readdir(t,!1,e);var r=this,n=f("lstat\0"+t,function(n,i){if(n&&"ENOENT"===n.code)return e();var o=i&&i.isSymbolicLink();r.symlinks[t]=o,o||!i||i.isDirectory()?r._readdir(t,!1,e):(r.cache[t]="FILE",e())});n&&r.fs.lstat(t,n)}},b.prototype._readdir=function(t,e,r){if(!this.aborted&&(r=f("readdir\0"+t+"\0"+e,r))){if(e&&!l(this.symlinks,t))return this._readdirInGlobStar(t,r);if(l(this.cache,t)){var n=this.cache[t];if(!n||"FILE"===n)return r();if(Array.isArray(n))return r(null,n)}this.fs.readdir(t,function(t,e,r){return function(n,i){n?t._readdirError(e,n,r):t._readdirEntries(e,i,r)}}(this,t,r))}},b.prototype._readdirEntries=function(t,e,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<e.length;n++){var i=e[n];i="/"===t?t+i:t+"/"+i,this.cache[i]=!0}return this.cache[t]=e,r(null,e)}},b.prototype._readdirError=function(t,e,r){if(!this.aborted){switch(e.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(t);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(e.code+" invalid cwd "+this.cwd);i.path=this.cwd,i.code=e.code,this.emit("error",i),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",e),this.abort()),this.silent||console.error("glob error",e)}return r()}},b.prototype._processGlobStar=function(t,e,r,n,i,o,s){var a=this;this._readdir(r,o,function(u,c){a._processGlobStar2(t,e,r,n,i,o,c,s)})},b.prototype._processGlobStar2=function(t,e,r,n,i,o,s,a){if(!s)return a();var u=n.slice(1),c=t?[t]:[],l=c.concat(u);this._process(l,i,!1,a);var f=this.symlinks[r],h=s.length;if(f&&o)return a();for(var p=0;p<h;p++){if("."!==s[p].charAt(0)||this.dot){var d=c.concat(s[p],u);this._process(d,i,!0,a);var y=c.concat(s[p],n);this._process(y,i,!0,a)}}a()},b.prototype._processSimple=function(t,e,r){var n=this;this._stat(t,function(i,o){n._processSimple2(t,e,i,o,r)})},b.prototype._processSimple2=function(t,e,r,n,o){if(this.matches[e]||(this.matches[e]=Object.create(null)),!n)return o();if(t&&s(t)&&!this.nomount){var a=/[\/\\]$/.test(t);"/"===t.charAt(0)?t=i.join(this.root,t):(t=i.resolve(this.root,t),a&&(t+="/"))}"win32"===process.platform&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t),o()},b.prototype._stat=function(t,e){var r=this._makeAbs(t),n="/"===t.slice(-1);if(t.length>this.maxLength)return e();if(!this.stat&&l(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var o=this.statCache[r];if(void 0!==o){if(!1===o)return e(null,o);var s=o.isDirectory()?"DIR":"FILE";return n&&"FILE"===s?e():e(null,s,o)}var a=this,u=f("stat\0"+r,function(n,i){if(i&&i.isSymbolicLink())return a.fs.stat(r,function(n,o){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,o,e)});a._stat2(t,r,n,i,e)});u&&a.fs.lstat(r,u)},b.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var o="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&"FILE"===s?i():i(null,s,n)},Ju}function oc(){if(Xu)return du.exports;Xu=1;var t=hr(),e=y,r=function(){if(Cs)return js;Cs=1;var t=yu();return js=function(e){return null!=e&&e.length?t(e,1):[]}}(),n=function(){if(Za)return Qa;Za=1;var t=ju(),e=yu(),r=Wi(),n=Cu(),i=r(function(r,i){return n(r)?t(r,e(i,1,n,!0)):[]});return Qa=i}(),i=Lu(),o=function(){if(pu)return hu;pu=1;var t=Ai(),e=Fu(),r=Vi(),n=Function.prototype,i=Object.prototype,o=n.toString,s=i.hasOwnProperty,a=o.call(Object);return hu=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var i=e(n);if(null===i)return!0;var u=s.call(i,"constructor")&&i.constructor;return"function"==typeof u&&u instanceof u&&o.call(u)==a}}(),s=ic(),a=du.exports={},u=/[\/\\]/g;return a.exists=function(){var r=e.join.apply(e,arguments);return t.existsSync(r)},a.expand=function(...a){var u=o(a[0])?a.shift():{},c=Array.isArray(a[0])?a[0]:a;if(0===c.length)return[];var l=function(t,e){var o=[];return r(t).forEach(function(t){var r=0===t.indexOf("!");r&&(t=t.slice(1));var s=e(t);o=r?n(o,s):i(o,s)}),o}(c,function(t){return s.sync(t,u)});return u.filter&&(l=l.filter(function(r){r=e.join(u.cwd||"",r);try{return"function"==typeof u.filter?u.filter(r):t.statSync(r)[u.filter]()}catch(t){return!1}})),l},a.expandMapping=function(t,r,n){n=Object.assign({rename:function(t,r){return e.join(t||"",r)}},n);var i=[],o={};return a.expand(n,t).forEach(function(t){var s=t;n.flatten&&(s=e.basename(s)),n.ext&&(s=s.replace(/(\.[^\/]*)?$/,n.ext));var a=n.rename(r,s,n);n.cwd&&(t=e.join(n.cwd,t)),a=a.replace(u,"/"),t=t.replace(u,"/"),o[a]?o[a].src.push(t):(i.push({src:[t],dest:a}),o[a]=i[i.length-1])}),i},a.normalizeFilesArray=function(t){var e=[];return t.forEach(function(t){("src"in t||"dest"in t)&&e.push(t)}),0===e.length?[]:e=_(e).chain().forEach(function(t){"src"in t&&t.src&&(Array.isArray(t.src)?t.src=r(t.src):t.src=[t.src])}).map(function(t){var e=Object.assign({},t);if(delete e.src,delete e.dest,t.expand)return a.expandMapping(t.src,t.dest,e).map(function(e){var r=Object.assign({},t);return r.orig=Object.assign({},t),r.src=e.src,r.dest=e.dest,["expand","cwd","flatten","rename","ext"].forEach(function(t){delete r[t]}),r});var n=Object.assign({},t);return n.orig=Object.assign({},t),"src"in n&&Object.defineProperty(n,"src",{enumerable:!0,get:function n(){var i;return"result"in n||(i=t.src,i=Array.isArray(i)?r(i):[i],n.result=a.expand(e,i)),n.result}}),"dest"in n&&(n.dest=t.dest),n}).flatten().value()},du.exports}function sc(){if(tc)return lr.exports;tc=1;var t=hr(),e=y,r=Oi(),n=ji(),i=To(),o=g.Stream,s=ws().PassThrough,a=lr.exports={};return a.file=oc(),a.collectStream=function(t,e){var r=[],n=0;t.on("error",e),t.on("data",function(t){r.push(t),n+=t.length}),t.on("end",function(){var t=Buffer.alloc(n),i=0;r.forEach(function(e){e.copy(t,i),i+=e.length}),e(null,t)})},a.dateify=function(t){return(t=t||new Date)instanceof Date||(t="string"==typeof t?new Date(t):new Date),t},a.defaults=function(t,e,r){var n=arguments;return n[0]=n[0]||{},i(...n)},a.isStream=function(t){return t instanceof o},a.lazyReadStream=function(e){return new r.Readable(function(){return t.createReadStream(e)})},a.normalizeInputSource=function(t){return null===t?Buffer.alloc(0):"string"==typeof t?Buffer.from(t):a.isStream(t)?t.pipe(new s):t},a.sanitizePath=function(t){return n(t,!1).replace(/^\w+:/,"").replace(/^(\.\.\/|\/)+/,"")},a.trailingSlashIt=function(t){return"/"!==t.slice(-1)?t+"/":t},a.unixifyPath=function(t){return n(t,!1).replace(/^\w+:/,"")},a.walkdir=function(r,n,i){var o=[];"function"==typeof n&&(i=n,n=r),t.readdir(r,function(s,u){var c,l,f=0;if(s)return i(s);!function s(){if(!(c=u[f++]))return i(null,o);l=e.join(r,c),t.stat(l,function(t,r){o.push({path:l,relative:e.relative(n,l).replace(/\\/g,"/"),stats:r}),r&&r.isDirectory()?a.walkdir(l,n,function(t,e){if(t)return i(t);e.forEach(function(t){o.push(t)}),s()}):s()})}()})},lr.exports}var ac,uc,cc,lc={exports:{}};
|
|
7
|
+
*/function ji(){return cn||(cn=1,un=function(t,e){if("string"!=typeof t)throw new TypeError("expected path to be a string");if("\\"===t||"/"===t)return"/";var r=t.length;if(r<=1)return t;var n="";if(r>4&&"\\"===t[3]){var i=t[2];"?"!==i&&"."!==i||"\\\\"!==t.slice(0,2)||(t=t.slice(2),n="//")}var o=t.split(/[/\\]+/);return!1!==e&&""===o[o.length-1]&&o.pop(),n+o.join("/")}),un}function Ci(){if(fn)return ln;return fn=1,ln=function(t){return t}}function Ri(){if(yn)return dn;yn=1;var t=pn?hn:(pn=1,hn=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}),e=Math.max;return dn=function(r,n,i){return n=e(void 0===n?r.length-1:n,0),function(){for(var o=arguments,s=-1,a=e(o.length-n,0),u=Array(a);++s<a;)u[s]=o[n+s];s=-1;for(var c=Array(n+1);++s<n;)c[s]=o[s];return c[n]=i(u),t(r,this,c)}},dn}function Pi(){if(bn)return _n;bn=1;var t="object"==typeof I&&I&&I.Object===Object&&I;return _n=t}function Li(){if(wn)return vn;wn=1;var t=Pi(),e="object"==typeof self&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return vn=r}function Fi(){if(En)return Sn;En=1;var t=Li().Symbol;return Sn=t}function Ai(){if(Cn)return jn;Cn=1;var t=Fi(),e=function(){if(xn)return kn;xn=1;var t=Fi(),e=Object.prototype,r=e.hasOwnProperty,n=e.toString,i=t?t.toStringTag:void 0;return kn=function(t){var e=r.call(t,i),o=t[i];try{t[i]=void 0;var s=!0}catch(t){}var a=n.call(t);return s&&(e?t[i]=o:delete t[i]),a}}(),r=function(){if(Tn)return On;Tn=1;var t=Object.prototype.toString;return On=function(e){return t.call(e)}}(),n=t?t.toStringTag:void 0;return jn=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?e(t):r(t)}}function Ii(){if(Pn)return Rn;return Pn=1,Rn=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function Di(){if(Fn)return Ln;Fn=1;var t=Ai(),e=Ii();return Ln=function(r){if(!e(r))return!1;var n=t(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function Mi(){if(Mn)return Dn;Mn=1;var t,e=function(){if(In)return An;In=1;var t=Li()["__core-js_shared__"];return An=t}(),r=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return Dn=function(t){return!!r&&r in t}}function Ni(){if(zn)return Un;zn=1;var t=Di(),e=Mi(),r=Ii(),n=function(){if(Bn)return Nn;Bn=1;var t=Function.prototype.toString;return Nn=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}(),i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,a=o.toString,u=s.hasOwnProperty,c=RegExp("^"+a.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Un=function(o){return!(!r(o)||e(o))&&(t(o)?c:i).test(n(o))}}function Bi(){if(qn)return $n;qn=1;var t=Ni(),e=Hn?Wn:(Hn=1,Wn=function(t,e){return null==t?void 0:t[e]});return $n=function(r,n){var i=e(r,n);return t(i)?i:void 0}}function Ui(){if(Zn)return Qn;Zn=1;var t=gn?mn:(gn=1,mn=function(t){return function(){return t}}),e=function(){if(Vn)return Gn;Vn=1;var t=Bi(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return Gn=e}(),r=Ci();return Qn=e?function(r,n){return e(r,"toString",{configurable:!0,enumerable:!1,value:t(n),writable:!0})}:r}function zi(){if(Xn)return Yn;Xn=1;var t=Ui(),e=function(){if(Jn)return Kn;Jn=1;var t=Date.now;return Kn=function(e){var r=0,n=0;return function(){var i=t(),o=16-(i-n);if(n=i,o>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}},Kn}(),r=e(t);return Yn=r}function Wi(){if(ei)return ti;ei=1;var t=Ci(),e=Ri(),r=zi();return ti=function(n,i){return r(e(n,i,t),n+"")}}function Hi(){if(ni)return ri;return ni=1,ri=function(t,e){return t===e||t!=t&&e!=e}}function $i(){if(oi)return ii;oi=1;return ii=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function qi(){if(ai)return si;ai=1;var t=Di(),e=$i();return si=function(r){return null!=r&&e(r.length)&&!t(r)}}function Gi(){if(ci)return ui;ci=1;var t=/^(?:0|[1-9]\d*)$/;return ui=function(e,r){var n=typeof e;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&t.test(e))&&e>-1&&e%1==0&&e<r}}function Vi(){if(yi)return di;return yi=1,di=function(t){return null!=t&&"object"==typeof t}}function Qi(){if(bi)return _i;bi=1;var t=function(){if(gi)return mi;gi=1;var t=Ai(),e=Vi();return mi=function(r){return e(r)&&"[object Arguments]"==t(r)}}(),e=Vi(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,o=t(function(){return arguments}())?t:function(t){return e(t)&&n.call(t,"callee")&&!i.call(t,"callee")};return _i=o}function Zi(){if(wi)return vi;wi=1;var t=Array.isArray;return vi=t}var Ki,Ji,Yi,Xi,to,eo,ro,no={exports:{}};function io(){return Yi||(Yi=1,function(t,e){var r=Li(),n=Ji?Ki:(Ji=1,Ki=function(){return!1}),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,s=o&&o.exports===i?r.Buffer:void 0,a=(s?s.isBuffer:void 0)||n;t.exports=a}(no,no.exports)),no.exports}function oo(){if(ro)return eo;return ro=1,eo=function(t){return function(e){return t(e)}}}var so,ao,uo,co,lo,fo,ho,po,yo,mo,go,_o,bo,vo,wo,So={exports:{}};function Eo(){if(uo)return ao;uo=1;var t=function(){if(to)return Xi;to=1;var t=Ai(),e=$i(),r=Vi(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Xi=function(i){return r(i)&&e(i.length)&&!!n[t(i)]}}(),e=oo(),r=function(){return so||(so=1,t=So,e=So.exports,r=Pi(),n=e&&!e.nodeType&&e,i=n&&t&&!t.nodeType&&t,o=i&&i.exports===n&&r.process,s=function(){try{return i&&i.require&&i.require("util").types||o&&o.binding&&o.binding("util")}catch(t){}}(),t.exports=s),So.exports;var t,e,r,n,i,o,s}(),n=r&&r.isTypedArray,i=n?e(n):t;return ao=i}function ko(){if(lo)return co;lo=1;var t=(pi||(pi=1,hi=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}),hi),e=Qi(),r=Zi(),n=io(),i=Gi(),o=Eo(),s=Object.prototype.hasOwnProperty;return co=function(a,u){var c=r(a),l=!c&&e(a),f=!c&&!l&&n(a),h=!c&&!l&&!f&&o(a),p=c||l||f||h,d=p?t(a.length,String):[],y=d.length;for(var m in a)!u&&!s.call(a,m)||p&&("length"==m||f&&("offset"==m||"parent"==m)||h&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||i(m,y))||d.push(m);return d}}function xo(){if(go)return mo;go=1;var t=Ii(),e=function(){if(ho)return fo;ho=1;var t=Object.prototype;return fo=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||t)}}(),r=yo?po:(yo=1,po=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}),n=Object.prototype.hasOwnProperty;return mo=function(i){if(!t(i))return r(i);var o=e(i),s=[];for(var a in i)("constructor"!=a||!o&&n.call(i,a))&&s.push(a);return s}}function Oo(){if(wo)return vo;wo=1;var t=Wi(),e=Hi(),r=function(){if(fi)return li;fi=1;var t=Hi(),e=qi(),r=Gi(),n=Ii();return li=function(i,o,s){if(!n(s))return!1;var a=typeof o;return!!("number"==a?e(s)&&r(o,s.length):"string"==a&&o in s)&&t(s[o],i)},li}(),n=function(){if(bo)return _o;bo=1;var t=ko(),e=xo(),r=qi();return _o=function(n){return r(n)?t(n,!0):e(n)}}(),i=Object.prototype,o=i.hasOwnProperty,s=t(function(t,s){t=Object(t);var a=-1,u=s.length,c=u>2?s[2]:void 0;for(c&&r(s[0],s[1],c)&&(u=1);++a<u;)for(var l=s[a],f=n(l),h=-1,p=f.length;++h<p;){var d=f[h],y=t[d];(void 0===y||e(y,i[d])&&!o.call(t,d))&&(t[d]=l[d])}return t});return vo=s}var To,jo,Co,Ro,Po,Lo,Fo={exports:{}};function Ao(){return jo?To:(jo=1,To=g)}function Io(){if(Ro)return Co;function t(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 e(e){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?t(Object(i),!0).forEach(function(t){r(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function r(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:String(e)}Ro=1;var o=w.Buffer,s=b.inspect,a=s&&s.custom||"inspect";function u(t,e,r){o.prototype.copy.call(t,e,r)}return Co=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return n(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e=o.allocUnsafe(t>>>0),r=this.head,n=0;r;)u(r.data,e,n),n+=r.data.length,r=r.next;return e}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0===(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0===(t-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,e}},{key:a,value:function(t,r){return s(this,e(e({},r),{},{depth:0,customInspect:!1}))}}]),t}(),Co}function Do(){if(Lo)return Po;function t(t,n){r(t,n),e(t)}function e(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(t,e){t.emit("error",e)}return Lo=1,Po={destroy:function(n,i){var o=this,s=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return s||a?(i?i(n):n&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,n)):process.nextTick(r,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,function(r){!i&&r?o._writableState?o._writableState.errorEmitted?process.nextTick(e,o):(o._writableState.errorEmitted=!0,process.nextTick(t,o,r)):process.nextTick(t,o,r):i?(process.nextTick(e,o),i(r)):process.nextTick(e,o)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}},Po}var Mo,No,Bo,Uo,zo,Wo,Ho,$o={};function qo(){if(Mo)return $o;Mo=1;const t={};function e(e,r,n){n||(n=Error);class i extends n{constructor(t,e,n){super(function(t,e,n){return"string"==typeof r?r:r(t,e,n)}(t,e,n))}}i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function r(t,e){if(Array.isArray(t)){const r=t.length;return t=t.map(t=>String(t)),r>2?`one of ${e} ${t.slice(0,r-1).join(", ")}, or `+t[r-1]:2===r?`one of ${e} ${t[0]} or ${t[1]}`:`of ${e} ${t[0]}`}return`of ${e} ${String(t)}`}return e("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError),e("ERR_INVALID_ARG_TYPE",function(t,e,n){let i;var o;let s;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))s=`The ${t} ${i} ${r(e,"type")}`;else{const n=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";s=`The "${t}" ${n} ${i} ${r(e,"type")}`}return s+=". Received type "+typeof n,s},TypeError),e("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),e("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),e("ERR_STREAM_PREMATURE_CLOSE","Premature close"),e("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),e("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),e("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),e("ERR_STREAM_WRITE_AFTER_END","write after end"),e("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),e("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),e("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),$o.codes=t,$o}function Go(){if(Bo)return No;Bo=1;var t=qo().codes.ERR_INVALID_OPT_VALUE;return No={getHighWaterMark:function(e,r,n,i){var o=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(r,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new t(i?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}}function Vo(){if(zo)return Uo;function t(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}var e;zo=1,Uo=S,S.WritableState=v;var r={deprecate:Gr()},n=Ao(),i=w.Buffer,o=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var s,a=Do(),u=Go().getHighWaterMark,c=qo().codes,l=c.ERR_INVALID_ARG_TYPE,f=c.ERR_METHOD_NOT_IMPLEMENTED,h=c.ERR_MULTIPLE_CALLBACK,p=c.ERR_STREAM_CANNOT_PIPE,d=c.ERR_STREAM_DESTROYED,y=c.ERR_STREAM_NULL_VALUES,m=c.ERR_STREAM_WRITE_AFTER_END,g=c.ERR_UNKNOWN_ENCODING,_=a.errorOrDestroy;function b(){}function v(r,n,i){e=e||Qo(),r=r||{},"boolean"!=typeof i&&(i=n instanceof e),this.objectMode=!!r.objectMode,i&&(this.objectMode=this.objectMode||!!r.writableObjectMode),this.highWaterMark=u(this,r,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===r.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=r.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if("function"!=typeof i)throw new h;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(process.nextTick(i,n),process.nextTick(j,t,e),t._writableState.errorEmitted=!0,_(t,n)):(i(n),t._writableState.errorEmitted=!0,_(t,n),j(t,e))}(t,r,n,e,i);else{var o=O(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||x(t,r),n?process.nextTick(k,t,r,o,i):k(t,r,o,i)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==r.emitClose,this.autoDestroy=!!r.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}function S(t){var r=this instanceof(e=e||Qo());if(!r&&!s.call(S,this))return new S(t);this._writableState=new v(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),n.call(this)}function E(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new d("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function k(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),j(t,e)}function x(e,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(e._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,E(e,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new t(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(E(e,r,!1,r.objectMode?1:c.length,c,l,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function O(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function T(t,e){t._final(function(r){e.pendingcb--,r&&_(t,r),e.prefinished=!0,t.emit("prefinish"),j(t,e)})}function j(t,e){var r=O(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(T,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var n=t._readableState;(!n||n.autoDestroy&&n.endEmitted)&&t.destroy()}return r}return Fr()(S,n),v.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(v.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===S&&(t&&t._writableState instanceof v)}})):s=function(t){return t instanceof this},S.prototype.pipe=function(){_(this,new p)},S.prototype.write=function(t,e,r){var n,s=this._writableState,a=!1,u=!s.objectMode&&(n=t,i.isBuffer(n)||n instanceof o);return u&&!i.isBuffer(t)&&(t=function(t){return i.from(t)}(t)),"function"==typeof e&&(r=e,e=null),u?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=b),s.ending?function(t,e){var r=new m;_(t,r),process.nextTick(e,r)}(this,r):(u||function(t,e,r,n){var i;return null===r?i=new y:"string"==typeof r||e.objectMode||(i=new l("chunk",["string","Buffer"],r)),!i||(_(t,i),process.nextTick(n,i),!1)}(this,s,t,r))&&(s.pendingcb++,a=function(t,e,r,n,o,s){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=i.from(e,r));return e}(e,n,o);n!==a&&(r=!0,o="buffer",n=a)}var u=e.objectMode?1:n.length;e.length+=u;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:o,isBuf:r,callback:s,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else E(t,e,!1,u,n,o,s);return c}(this,s,u,t,e,r)),a},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||x(this,t))},S.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new g(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,r){r(new f("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,r){var n=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,r){e.ending=!0,j(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=a.destroy,S.prototype._undestroy=a.undestroy,S.prototype._destroy=function(t,e){e(t)},Uo}function Qo(){if(Ho)return Wo;Ho=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Wo=s;var e=_s(),r=Vo();Fr()(s,e);for(var n=t(r.prototype),i=0;i<n.length;i++){var o=n[i];s.prototype[o]||(s.prototype[o]=r.prototype[o])}function s(t){if(!(this instanceof s))return new s(t);e.call(this,t),r.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",a)))}function a(){this._writableState.ended||process.nextTick(u,this)}function u(t){t.end()}return Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Wo}var Zo,Ko,Jo,Yo,Xo,ts,es,rs,ns,is,os,ss,as,us,cs,ls,fs,hs={},ps={exports:{}};function ds(){if(Ko)return hs;Ko=1;var t=(Zo||(Zo=1,function(t,e){var r=w,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),o.prototype=Object.create(n.prototype),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(ps,ps.exports)),ps.exports).Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}return hs.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},hs}function ys(){if(Yo)return Jo;Yo=1;var t=qo().codes.ERR_STREAM_PREMATURE_CLOSE;function e(){}return Jo=function r(n,i,o){if("function"==typeof i)return r(n,null,i);i||(i={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||e);var s=i.readable||!1!==i.readable&&n.readable,a=i.writable||!1!==i.writable&&n.writable,u=function(){n.writable||l()},c=n._writableState&&n._writableState.finished,l=function(){a=!1,c=!0,s||o.call(n)},f=n._readableState&&n._readableState.endEmitted,h=function(){s=!1,f=!0,a||o.call(n)},p=function(t){o.call(n,t)},d=function(){var e;return s&&!f?(n._readableState&&n._readableState.ended||(e=new t),o.call(n,e)):a&&!c?(n._writableState&&n._writableState.ended||(e=new t),o.call(n,e)):void 0},y=function(){n.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(n)?a&&!n._writableState&&(n.on("end",u),n.on("close",u)):(n.on("complete",l),n.on("abort",d),n.req?y():n.on("request",y)),n.on("end",h),n.on("finish",l),!1!==i.error&&n.on("error",p),n.on("close",d),function(){n.removeListener("complete",l),n.removeListener("abort",d),n.removeListener("request",y),n.req&&n.req.removeListener("finish",l),n.removeListener("end",u),n.removeListener("close",u),n.removeListener("finish",l),n.removeListener("end",h),n.removeListener("error",p),n.removeListener("close",d)}},Jo}function ms(){if(ts)return Xo;var t;function e(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}ts=1;var r=ys(),n=Symbol("lastResolve"),i=Symbol("lastReject"),o=Symbol("error"),s=Symbol("ended"),a=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function l(t,e){return{value:t,done:e}}function f(t){var e=t[n];if(null!==e){var r=t[c].read();null!==r&&(t[a]=null,t[n]=null,t[i]=null,e(l(r,!1)))}}function h(t){process.nextTick(f,t)}var p=Object.getPrototypeOf(function(){}),d=Object.setPrototypeOf((t={get stream(){return this[c]},next:function(){var t=this,e=this[o];if(null!==e)return Promise.reject(e);if(this[s])return Promise.resolve(l(void 0,!0));if(this[c].destroyed)return new Promise(function(e,r){process.nextTick(function(){t[o]?r(t[o]):e(l(void 0,!0))})});var r,n=this[a];if(n)r=new Promise(function(t,e){return function(r,n){t.then(function(){e[s]?r(l(void 0,!0)):e[u](r,n)},n)}}(n,this));else{var i=this[c].read();if(null!==i)return Promise.resolve(l(i,!1));r=new Promise(this[u])}return this[a]=r,r}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var t=this;return new Promise(function(e,r){t[c].destroy(null,function(t){t?r(t):e(l(void 0,!0))})})}),t),p);return Xo=function(t){var f,p=Object.create(d,(e(f={},c,{value:t,writable:!0}),e(f,n,{value:null,writable:!0}),e(f,i,{value:null,writable:!0}),e(f,o,{value:null,writable:!0}),e(f,s,{value:t._readableState.endEmitted,writable:!0}),e(f,u,{value:function(t,e){var r=p[c].read();r?(p[a]=null,p[n]=null,p[i]=null,t(l(r,!1))):(p[n]=t,p[i]=e)},writable:!0}),f));return p[a]=null,r(t,function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=p[i];return null!==e&&(p[a]=null,p[n]=null,p[i]=null,e(t)),void(p[o]=t)}var r=p[n];null!==r&&(p[a]=null,p[n]=null,p[i]=null,r(l(void 0,!0))),p[s]=!0}),t.on("readable",h.bind(null,p)),p},Xo}function gs(){if(rs)return es;function t(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function e(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 r(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}rs=1;var n=qo().codes.ERR_INVALID_ARG_TYPE;return es=function(i,o,s){var a;if(o&&"function"==typeof o.next)a=o;else if(o&&o[Symbol.asyncIterator])a=o[Symbol.asyncIterator]();else{if(!o||!o[Symbol.iterator])throw new n("iterable",["Iterable"],o);a=o[Symbol.iterator]()}var u=new i(function(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),!0).forEach(function(e){r(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}({objectMode:!0},s)),c=!1;function l(){return f.apply(this,arguments)}function f(){var e;return e=function*(){try{var t=yield a.next(),e=t.value;t.done?u.push(null):u.push(yield e)?l():c=!1}catch(t){u.destroy(t)}},f=function(){var r=this,n=arguments;return new Promise(function(i,o){var s=e.apply(r,n);function a(e){t(s,i,o,a,u,"next",e)}function u(e){t(s,i,o,a,u,"throw",e)}a(void 0)})},f.apply(this,arguments)}return u._read=function(){c||(c=!0,l())},u},es}function _s(){if(is)return ns;var t;is=1,ns=k,k.ReadableState=E,d.EventEmitter;var e=function(t,e){return t.listeners(e).length},r=Ao(),n=w.Buffer,i=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,s=b;o=s&&s.debuglog?s.debuglog("stream"):function(){};var a,u,c,l=Io(),f=Do(),h=Go().getHighWaterMark,p=qo().codes,y=p.ERR_INVALID_ARG_TYPE,m=p.ERR_STREAM_PUSH_AFTER_EOF,g=p.ERR_METHOD_NOT_IMPLEMENTED,_=p.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;Fr()(k,r);var v=f.errorOrDestroy,S=["error","close","destroy","pause","resume"];function E(e,r,n){t=t||Qo(),e=e||{},"boolean"!=typeof n&&(n=r instanceof t),this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=h(this,e,"readableHighWaterMark",n),this.buffer=new l,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(a||(a=ds().StringDecoder),this.decoder=new a(e.encoding),this.encoding=e.encoding)}function k(e){if(t=t||Qo(),!(this instanceof k))return new k(e);var n=this instanceof t;this._readableState=new E(e,this,n),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),r.call(this)}function x(t,e,r,s,a){o("readableAddChunk",e);var u,c=t._readableState;if(null===e)c.reading=!1,function(t,e){if(o("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?C(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,R(t)))}(t,c);else if(a||(u=function(t,e){var r;o=e,n.isBuffer(o)||o instanceof i||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var o;return r}(c,e)),u)v(t,u);else if(c.objectMode||e&&e.length>0)if("string"==typeof e||c.objectMode||Object.getPrototypeOf(e)===n.prototype||(e=function(t){return n.from(t)}(e)),s)c.endEmitted?v(t,new _):O(t,c,e,!0);else if(c.ended)v(t,new m);else{if(c.destroyed)return!1;c.reading=!1,c.decoder&&!r?(e=c.decoder.write(e),c.objectMode||0!==e.length?O(t,c,e,!1):P(t,c)):O(t,c,e,!1)}else s||(c.reading=!1,P(t,c));return!c.ended&&(c.length<c.highWaterMark||0===c.length)}function O(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&C(t)),P(t,e)}Object.defineProperty(k.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),k.prototype.destroy=f.destroy,k.prototype._undestroy=f.undestroy,k.prototype._destroy=function(t,e){e(t)},k.prototype.push=function(t,e){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof t&&((e=e||i.defaultEncoding)!==i.encoding&&(t=n.from(t,e),e=""),r=!0),x(this,t,e,!1,r)},k.prototype.unshift=function(t){return x(this,t,null,!0,!1)},k.prototype.isPaused=function(){return!1===this._readableState.flowing},k.prototype.setEncoding=function(t){a||(a=ds().StringDecoder);var e=new a(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";null!==r;)n+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==n&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var T=1073741824;function j(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=T?t=T:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function C(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(R,t))}function R(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,M(t)}function P(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var r=e.length;if(o("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}function F(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function A(t){o("readable nexttick read 0"),t.read(0)}function D(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),M(t),e.flowing&&!e.reading&&t.read(0)}function M(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function B(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick(U,e,t))}function U(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function z(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return k.prototype.read=function(t){o("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?B(this):C(this),null;if(0===(t=j(t,e))&&e.ended)return 0===e.length&&B(this),null;var n,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&o("length less than watermark",i=!0),e.ended||e.reading?o("reading or ended",i=!1):i&&(o("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=j(r,e))),null===(n=t>0?N(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&B(this)),null!==n&&this.emit("data",n),n},k.prototype._read=function(t){v(this,new g("_read()"))},k.prototype.pipe=function(t,r){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,r);var s=(!r||!1!==r.end)&&t!==process.stdout&&t!==process.stderr?u:y;function a(e,r){o("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,o("cleanup"),t.removeListener("close",p),t.removeListener("finish",d),t.removeListener("drain",c),t.removeListener("error",h),t.removeListener("unpipe",a),n.removeListener("end",u),n.removeListener("end",y),n.removeListener("data",f),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}function u(){o("onend"),t.end()}i.endEmitted?process.nextTick(s):n.once("end",s),t.on("unpipe",a);var c=function(t){return function(){var r=t._readableState;o("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,0===r.awaitDrain&&e(t,"data")&&(r.flowing=!0,M(t))}}(n);t.on("drain",c);var l=!1;function f(e){o("ondata");var r=t.write(e);o("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==z(i.pipes,t))&&!l&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function h(r){o("onerror",r),y(),t.removeListener("error",h),0===e(t,"error")&&v(t,r)}function p(){t.removeListener("finish",d),y()}function d(){o("onfinish"),t.removeListener("close",p),y()}function y(){o("unpipe"),n.unpipe(t)}return n.on("data",f),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",h),t.once("close",p),t.once("finish",d),t.emit("pipe",n),i.flowing||(o("pipe resume"),n.resume()),t},k.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=z(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},k.prototype.on=function(t,e){var n=r.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?C(this):i.reading||process.nextTick(A,this))),n},k.prototype.addListener=k.prototype.on,k.prototype.removeListener=function(t,e){var n=r.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(F,this),n},k.prototype.removeAllListeners=function(t){var e=r.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(F,this),e},k.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(D,t,e))}(this,t)),t.paused=!1,this},k.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},k.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(o("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s<S.length;s++)t.on(S[s],this.emit.bind(this,S[s]));return this._read=function(e){o("wrapped _read",e),n&&(n=!1,t.resume())},this},"function"==typeof Symbol&&(k.prototype[Symbol.asyncIterator]=function(){return void 0===u&&(u=ms()),u(this)}),Object.defineProperty(k.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(k.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(k.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),k._fromList=N,Object.defineProperty(k.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(k.from=function(t,e){return void 0===c&&(c=gs()),c(k,t,e)}),ns}function bs(){if(ss)return os;ss=1,os=a;var t=qo().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,o=Qo();function s(t,e){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(null===i)return this.emit("error",new r);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),i(t);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);o.call(this,t),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",u)}function u(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?c(this,null,null):this._flush(function(e,r){c(t,e,r)})}function c(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new i;if(t._transformState.transforming)throw new n;return t.push(null)}return Fr()(a,o),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,o.prototype.push.call(this,t,e)},a.prototype._transform=function(t,r,n){n(new e("_transform()"))},a.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},a.prototype._destroy=function(t,e){o.prototype._destroy.call(this,t,function(t){e(t)})},os}function vs(){if(ls)return cs;var t;ls=1;var e=qo().codes,r=e.ERR_MISSING_ARGS,n=e.ERR_STREAM_DESTROYED;function i(t){if(t)throw t}function o(t){t()}function s(t,e){return t.pipe(e)}return cs=function(){for(var e=arguments.length,a=new Array(e),u=0;u<e;u++)a[u]=arguments[u];var c,l=function(t){return t.length?"function"!=typeof t[t.length-1]?i:t.pop():i}(a);if(Array.isArray(a[0])&&(a=a[0]),a.length<2)throw new r("streams");var f=a.map(function(e,r){var i=r<a.length-1;return function(e,r,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;e.on("close",function(){s=!0}),void 0===t&&(t=ys()),t(e,{readable:r,writable:i},function(t){if(t)return o(t);s=!0,o()});var a=!1;return function(t){if(!s&&!a)return a=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new n("pipe"))}}(e,i,r>0,function(t){c||(c=t),t&&f.forEach(o),i||(f.forEach(o),l(c))})});return a.reduce(s)},cs}function ws(){return fs||(fs=1,t=Fo,e=Fo.exports,r=g,"disable"===process.env.READABLE_STREAM&&r?(t.exports=r.Readable,Object.assign(t.exports,r),t.exports.Stream=r):((e=t.exports=_s()).Stream=r||e,e.Readable=e,e.Writable=Vo(),e.Duplex=Qo(),e.Transform=bs(),e.PassThrough=function(){if(us)return as;us=1,as=e;var t=bs();function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return Fr()(e,t),e.prototype._transform=function(t,e,r){r(null,t)},as}(),e.finished=ys(),e.pipeline=vs())),Fo.exports;var t,e,r}var Ss,Es,ks,xs,Os,Ts,js,Cs,Rs,Ps,Ls,Fs,As,Is,Ds,Ms,Ns,Bs,Us,zs,Ws,Hs,$s,qs,Gs,Vs,Qs,Zs,Ks,Js,Ys,Xs,ta,ea,ra,na,ia,oa,sa,aa,ua,ca,la,fa,ha,pa,da,ya,ma,ga,_a,ba,va,wa,Sa,Ea,ka,xa,Oa,Ta,ja,Ca,Ra,Pa,La,Fa,Aa,Ia,Da,Ma,Na,Ba,Ua,za,Wa,Ha,$a,qa,Ga,Va,Qa,Za,Ka,Ja,Ya,Xa,tu,eu,ru,nu,iu,ou,su,au,uu,cu,lu,fu,hu,pu,du={exports:{}};function yu(){if(Ts)return Os;Ts=1;var t=(Es||(Es=1,Ss=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}),Ss),e=function(){if(xs)return ks;xs=1;var t=Fi(),e=Qi(),r=Zi(),n=t?t.isConcatSpreadable:void 0;return ks=function(t){return r(t)||e(t)||!!(n&&t&&t[n])}}();return Os=function r(n,i,o,s,a){var u=-1,c=n.length;for(o||(o=e),a||(a=[]);++u<c;){var l=n[u];i>0&&o(l)?i>1?r(l,i-1,o,s,a):t(a,l):s||(a[a.length]=l)}return a},Os}function mu(){if(Ps)return Rs;Ps=1;var t=Bi()(Object,"create");return Rs=t}function gu(){if(Hs)return Ws;Hs=1;var t=function(){if(Fs)return Ls;Fs=1;var t=mu();return Ls=function(){this.__data__=t?t(null):{},this.size=0}}(),e=Is?As:(Is=1,As=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),r=function(){if(Ms)return Ds;Ms=1;var t=mu(),e=Object.prototype.hasOwnProperty;return Ds=function(r){var n=this.__data__;if(t){var i=n[r];return"__lodash_hash_undefined__"===i?void 0:i}return e.call(n,r)?n[r]:void 0}}(),n=function(){if(Bs)return Ns;Bs=1;var t=mu(),e=Object.prototype.hasOwnProperty;return Ns=function(r){var n=this.__data__;return t?void 0!==n[r]:e.call(n,r)}}(),i=function(){if(zs)return Us;zs=1;var t=mu();return Us=function(e,r){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=t&&void 0===r?"__lodash_hash_undefined__":r,this}}();function o(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])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=n,o.prototype.set=i,Ws=o}function _u(){if(Vs)return Gs;Vs=1;var t=Hi();return Gs=function(e,r){for(var n=e.length;n--;)if(t(e[n][0],r))return n;return-1}}function bu(){if(na)return ra;na=1;var t=qs?$s:(qs=1,$s=function(){this.__data__=[],this.size=0}),e=function(){if(Zs)return Qs;Zs=1;var t=_u(),e=Array.prototype.splice;return Qs=function(r){var n=this.__data__,i=t(n,r);return!(i<0||(i==n.length-1?n.pop():e.call(n,i,1),--this.size,0))},Qs}(),r=function(){if(Js)return Ks;Js=1;var t=_u();return Ks=function(e){var r=this.__data__,n=t(r,e);return n<0?void 0:r[n][1]},Ks}(),n=function(){if(Xs)return Ys;Xs=1;var t=_u();return Ys=function(e){return t(this.__data__,e)>-1}}(),i=function(){if(ea)return ta;ea=1;var t=_u();return ta=function(e,r){var n=this.__data__,i=t(n,e);return i<0?(++this.size,n.push([e,r])):n[i][1]=r,this},ta}();function o(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])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=n,o.prototype.set=i,ra=o}function vu(){if(aa)return sa;aa=1;var t=gu(),e=bu(),r=function(){if(oa)return ia;oa=1;var t=Bi()(Li(),"Map");return ia=t}();return sa=function(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}}function wu(){if(fa)return la;fa=1;var t=ca?ua:(ca=1,ua=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return la=function(e,r){var n=e.__data__;return t(r)?n["string"==typeof r?"string":"hash"]:n.map},la}function Su(){if(wa)return va;wa=1;var t=vu(),e=function(){if(pa)return ha;pa=1;var t=wu();return ha=function(e){var r=t(this,e).delete(e);return this.size-=r?1:0,r}}(),r=function(){if(ya)return da;ya=1;var t=wu();return da=function(e){return t(this,e).get(e)}}(),n=function(){if(ga)return ma;ga=1;var t=wu();return ma=function(e){return t(this,e).has(e)}}(),i=function(){if(ba)return _a;ba=1;var t=wu();return _a=function(e,r){var n=t(this,e),i=n.size;return n.set(e,r),this.size+=n.size==i?0:1,this}}();function o(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])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=n,o.prototype.set=i,va=o}function Eu(){if(Ta)return Oa;Ta=1;var t=Su(),e=Ea?Sa:(Ea=1,Sa=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),r=xa?ka:(xa=1,ka=function(t){return this.__data__.has(t)});function n(e){var r=-1,n=null==e?0:e.length;for(this.__data__=new t;++r<n;)this.add(e[r])}return n.prototype.add=n.prototype.push=e,n.prototype.has=r,Oa=n}function ku(){if(Ia)return Aa;Ia=1;var t=(Ca||(Ca=1,ja=function(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}),ja),e=Pa?Ra:(Pa=1,Ra=function(t){return t!=t}),r=(Fa||(Fa=1,La=function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}),La);return Aa=function(n,i,o){return i==i?r(n,i,o):t(n,e,o)}}function xu(){if(Ma)return Da;Ma=1;var t=ku();return Da=function(e,r){return!!(null==e?0:e.length)&&t(e,r,0)>-1}}function Ou(){if(Ba)return Na;return Ba=1,Na=function(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1},Na}function Tu(){if(Ha)return Wa;return Ha=1,Wa=function(t,e){return t.has(e)}}function ju(){if(qa)return $a;qa=1;var t=Eu(),e=xu(),r=Ou(),n=(za||(za=1,Ua=function(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}),Ua),i=oo(),o=Tu();return $a=function(s,a,u,c){var l=-1,f=e,h=!0,p=s.length,d=[],y=a.length;if(!p)return d;u&&(a=n(a,i(u))),c?(f=r,h=!1):a.length>=200&&(f=o,h=!1,a=new t(a));t:for(;++l<p;){var m=s[l],g=null==u?m:u(m);if(m=c||0!==m?m:0,h&&g==g){for(var _=y;_--;)if(a[_]===g)continue t;d.push(m)}else f(a,g,c)||d.push(m)}return d},$a}function Cu(){if(Va)return Ga;Va=1;var t=qi(),e=Vi();return Ga=function(r){return e(r)&&t(r)}}function Ru(){if(eu)return tu;return eu=1,tu=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r},tu}function Pu(){if(nu)return ru;nu=1;var t=function(){if(Ja)return Ka;Ja=1;var t=Bi()(Li(),"Set");return Ka=t}(),e=Xa?Ya:(Xa=1,Ya=function(){}),r=Ru(),n=t&&1/r(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return ru=n}function Lu(){if(au)return su;au=1;var t=yu(),e=Wi(),r=function(){if(ou)return iu;ou=1;var t=Eu(),e=xu(),r=Ou(),n=Tu(),i=Pu(),o=Ru();return iu=function(s,a,u){var c=-1,l=e,f=s.length,h=!0,p=[],d=p;if(u)h=!1,l=r;else if(f>=200){var y=a?null:i(s);if(y)return o(y);h=!1,l=n,d=new t}else d=a?[]:p;t:for(;++c<f;){var m=s[c],g=a?a(m):m;if(m=u||0!==m?m:0,h&&g==g){for(var _=d.length;_--;)if(d[_]===g)continue t;a&&d.push(g),p.push(m)}else l(d,g,u)||(d!==p&&d.push(g),p.push(m))}return p},iu}(),n=Cu(),i=e(function(e){return r(t(e,1,n,!0))});return su=i}function Fu(){if(fu)return lu;fu=1;var t=(cu||(cu=1,uu=function(t,e){return function(r){return t(e(r))}}),uu),e=t(Object.getPrototypeOf,Object);return lu=e}var Au,Iu,Du,Mu={};function Nu(){if(Au)return Mu;Au=1;var t=y,e="win32"===process.platform,r=p,n=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function i(t){return"function"==typeof t?t:function(){var t;if(n){var e=new Error;t=function(t){t&&(e.message=t.message,r(t=e))}}else t=r;return t;function r(t){if(t){if(process.throwDeprecation)throw t;if(!process.noDeprecation){var e="fs: missing callback "+(t.stack||t.message);process.traceDeprecation?console.trace(e):console.error(e)}}}}()}if(t.normalize,e)var o=/(.*?)(?:[\/\\]+|$)/g;else o=/(.*?)(?:[\/]+|$)/g;if(e)var s=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else s=/^[\/]*/;return Mu.realpathSync=function(n,i){if(n=t.resolve(n),i&&Object.prototype.hasOwnProperty.call(i,n))return i[n];var a,u,c,l,f=n,h={},p={};function d(){var t=s.exec(n);a=t[0].length,u=t[0],c=t[0],l="",e&&!p[c]&&(r.lstatSync(c),p[c]=!0)}for(d();a<n.length;){o.lastIndex=a;var y=o.exec(n);if(l=u,u+=y[0],c=l+y[1],a=o.lastIndex,!(p[c]||i&&i[c]===c)){var m;if(i&&Object.prototype.hasOwnProperty.call(i,c))m=i[c];else{var g=r.lstatSync(c);if(!g.isSymbolicLink()){p[c]=!0,i&&(i[c]=c);continue}var _=null;if(!e){var b=g.dev.toString(32)+":"+g.ino.toString(32);h.hasOwnProperty(b)&&(_=h[b])}null===_&&(r.statSync(c),_=r.readlinkSync(c)),m=t.resolve(l,_),i&&(i[c]=m),e||(h[b]=_)}n=t.resolve(m,n.slice(a)),d()}}return i&&(i[f]=n),n},Mu.realpath=function(n,a,u){if("function"!=typeof u&&(u=i(a),a=null),n=t.resolve(n),a&&Object.prototype.hasOwnProperty.call(a,n))return process.nextTick(u.bind(null,null,a[n]));var c,l,f,h,p=n,d={},y={};function m(){var t=s.exec(n);c=t[0].length,l=t[0],f=t[0],h="",e&&!y[f]?r.lstat(f,function(t){if(t)return u(t);y[f]=!0,g()}):process.nextTick(g)}function g(){if(c>=n.length)return a&&(a[p]=n),u(null,n);o.lastIndex=c;var t=o.exec(n);return h=l,l+=t[0],f=h+t[1],c=o.lastIndex,y[f]||a&&a[f]===f?process.nextTick(g):a&&Object.prototype.hasOwnProperty.call(a,f)?v(a[f]):r.lstat(f,_)}function _(t,n){if(t)return u(t);if(!n.isSymbolicLink())return y[f]=!0,a&&(a[f]=f),process.nextTick(g);if(!e){var i=n.dev.toString(32)+":"+n.ino.toString(32);if(d.hasOwnProperty(i))return b(null,d[i],f)}r.stat(f,function(t){if(t)return u(t);r.readlink(f,function(t,r){e||(d[i]=r),b(t,r)})})}function b(e,r,n){if(e)return u(e);var i=t.resolve(h,r);a&&(a[n]=i),v(i)}function v(e){n=t.resolve(e,n.slice(c)),m()}m()},Mu}function Bu(){if(Du)return Iu;Du=1,Iu=a,a.realpath=a,a.sync=u,a.realpathSync=u,a.monkeypatch=function(){t.realpath=a,t.realpathSync=u},a.unmonkeypatch=function(){t.realpath=e,t.realpathSync=r};var t=p,e=t.realpath,r=t.realpathSync,n=process.version,i=/^v[0-5]\./.test(n),o=Nu();function s(t){return t&&"realpath"===t.syscall&&("ELOOP"===t.code||"ENOMEM"===t.code||"ENAMETOOLONG"===t.code)}function a(t,r,n){if(i)return e(t,r,n);"function"==typeof r&&(n=r,r=null),e(t,r,function(e,i){s(e)?o.realpath(t,r,n):n(e,i)})}function u(t,e){if(i)return r(t,e);try{return r(t,e)}catch(r){if(s(r))return o.realpathSync(t,e);throw r}}return Iu}var Uu,zu,Wu,Hu,$u,qu={};function Gu(){if(Uu)return qu;function t(t,e){return Object.prototype.hasOwnProperty.call(t,e)}Uu=1,qu.setopts=function(n,s,c){c||(c={});if(c.matchBase&&-1===s.indexOf("/")){if(c.noglobstar)throw new Error("base matching requires globstar");s="**/"+s}n.windowsPathsNoEscape=!!c.windowsPathsNoEscape||!1===c.allowWindowsEscape,n.windowsPathsNoEscape&&(s=s.replace(/\\/g,"/"));n.silent=!!c.silent,n.pattern=s,n.strict=!1!==c.strict,n.realpath=!!c.realpath,n.realpathCache=c.realpathCache||Object.create(null),n.follow=!!c.follow,n.dot=!!c.dot,n.mark=!!c.mark,n.nodir=!!c.nodir,n.nodir&&(n.mark=!0);n.sync=!!c.sync,n.nounique=!!c.nounique,n.nonull=!!c.nonull,n.nosort=!!c.nosort,n.nocase=!!c.nocase,n.stat=!!c.stat,n.noprocess=!!c.noprocess,n.absolute=!!c.absolute,n.fs=c.fs||e,n.maxLength=c.maxLength||1/0,n.cache=c.cache||Object.create(null),n.statCache=c.statCache||Object.create(null),n.symlinks=c.symlinks||Object.create(null),function(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]);t.ignore.length&&(t.ignore=t.ignore.map(a))}(n,c),n.changedCwd=!1;var l=process.cwd();t(c,"cwd")?(n.cwd=r.resolve(c.cwd),n.changedCwd=n.cwd!==l):n.cwd=r.resolve(l);n.root=c.root||r.resolve(n.cwd,"/"),n.root=r.resolve(n.root),n.cwdAbs=i(n.cwd)?n.cwd:u(n,n.cwd),n.nomount=!!c.nomount,"win32"===process.platform&&(n.root=n.root.replace(/\\/g,"/"),n.cwd=n.cwd.replace(/\\/g,"/"),n.cwdAbs=n.cwdAbs.replace(/\\/g,"/"));c.nonegate=!0,c.nocomment=!0,n.minimatch=new o(s,c),n.options=n.minimatch.options},qu.ownProp=t,qu.makeAbs=u,qu.finish=function(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;n<i;n++){var o=t.matches[n];if(o&&0!==Object.keys(o).length){var a=Object.keys(o);e?r.push.apply(r,a):a.forEach(function(t){r[t]=!0})}else if(t.nonull){var l=t.minimatch.globSet[n];e?r.push(l):r[l]=!0}}e||(r=Object.keys(r));t.nosort||(r=r.sort(s));if(t.mark){for(n=0;n<r.length;n++)r[n]=t._mark(r[n]);t.nodir&&(r=r.filter(function(e){var r=!/\/$/.test(e),n=t.cache[e]||t.cache[u(t,e)];return r&&n&&(r="DIR"!==n&&!Array.isArray(n)),r}))}t.ignore.length&&(r=r.filter(function(e){return!c(t,e)}));t.found=r},qu.mark=function(t,e){var r=u(t,e),n=t.cache[r],i=e;if(n){var o="DIR"===n||Array.isArray(n),s="/"===e.slice(-1);if(o&&!s?i+="/":!o&&s&&(i=i.slice(0,-1)),i!==e){var a=u(t,i);t.statCache[a]=t.statCache[r],t.cache[a]=t.cache[r]}}return i},qu.isIgnored=c,qu.childrenIgnored=function(t,e){return!!t.ignore.length&&t.ignore.some(function(t){return!(!t.gmatcher||!t.gmatcher.match(e))})};var e=p,r=y,n=U(),i=y.isAbsolute,o=n.Minimatch;function s(t,e){return t.localeCompare(e,"en")}function a(t){var e=null;if("/**"===t.slice(-3)){var r=t.replace(/(\/\*\*)+$/,"");e=new o(r,{dot:!0})}return{matcher:new o(t,{dot:!0}),gmatcher:e}}function u(t,e){var n=e;return n="/"===e.charAt(0)?r.join(t.root,e):i(e)||""===e?e:t.changedCwd?r.resolve(t.cwd,e):r.resolve(e),"win32"===process.platform&&(n=n.replace(/\\/g,"/")),n}function c(t,e){return!!t.ignore.length&&t.ignore.some(function(t){return t.matcher.match(e)||!(!t.gmatcher||!t.gmatcher.match(e))})}return qu}function Vu(){if($u)return Hu;return $u=1,Hu=function t(e,r){if(e&&r)return t(e)(r);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){n[t]=e[t]}),n;function n(){for(var t=new Array(arguments.length),r=0;r<t.length;r++)t[r]=arguments[r];var n=e.apply(this,t),i=t[t.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach(function(t){n[t]=i[t]}),n}},Hu}var Qu,Zu,Ku,Ju,Yu,Xu,tc,ec={exports:{}};function rc(){if(Qu)return ec.exports;Qu=1;var t=Vu();function e(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function r(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},r=t.name||"Function wrapped with `once`";return e.onceError=r+" shouldn't be called more than once",e.called=!1,e}return ec.exports=t(e),ec.exports.strict=t(r),e.proto=e(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return e(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return r(this)},configurable:!0})}),ec.exports}function nc(){if(Ku)return Zu;Ku=1;var t=Vu(),e=Object.create(null),r=rc();return Zu=t(function(t,n){return e[t]?(e[t].push(n),null):(e[t]=[n],function(t){return r(function r(){var n=e[t],i=n.length,o=function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n]=t[n];return r}(arguments);try{for(var s=0;s<i;s++)n[s].apply(null,o)}finally{n.length>i?(n.splice(0,i),process.nextTick(function(){r.apply(null,o)})):delete e[t]}})}(t))}),Zu}function ic(){if(Yu)return Ju;Yu=1,Ju=g;var t=Bu(),e=U();e.Minimatch;var r=Fr(),n=d.EventEmitter,i=y,o=v,s=y.isAbsolute,a=function(){if(Wu)return zu;Wu=1,zu=l,l.GlobSync=f;var t=Bu(),e=U();e.Minimatch,ic().Glob;var r=y,n=v,i=y.isAbsolute,o=Gu(),s=o.setopts,a=o.ownProp,u=o.childrenIgnored,c=o.isIgnored;function l(t,e){if("function"==typeof e||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");return new f(t,e).found}function f(t,e){if(!t)throw new Error("must provide pattern");if("function"==typeof e||3===arguments.length)throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof f))return new f(t,e);if(s(this,t,e),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}return f.prototype._finish=function(){if(n.ok(this instanceof f),this.realpath){var e=this;this.matches.forEach(function(r,n){var i=e.matches[n]=Object.create(null);for(var o in r)try{o=e._makeAbs(o),i[t.realpathSync(o,e.realpathCache)]=!0}catch(t){if("stat"!==t.syscall)throw t;i[e._makeAbs(o)]=!0}})}o.finish(this)},f.prototype._process=function(t,r,o){n.ok(this instanceof f);for(var s,a=0;"string"==typeof t[a];)a++;switch(a){case t.length:return void this._processSimple(t.join("/"),r);case 0:s=null;break;default:s=t.slice(0,a).join("/")}var c,l=t.slice(a);null===s?c=".":i(s)||i(t.map(function(t){return"string"==typeof t?t:"[*]"}).join("/"))?(s&&i(s)||(s="/"+s),c=s):c=s;var h=this._makeAbs(c);u(this,c)||(l[0]===e.GLOBSTAR?this._processGlobStar(s,c,h,l,r,o):this._processReaddir(s,c,h,l,r,o))},f.prototype._processReaddir=function(t,e,n,i,o,s){var a=this._readdir(n,s);if(a){for(var u=i[0],c=!!this.minimatch.negate,l=u._glob,f=this.dot||"."===l.charAt(0),h=[],p=0;p<a.length;p++)("."!==(m=a[p]).charAt(0)||f)&&(c&&!t?!m.match(u):m.match(u))&&h.push(m);var d=h.length;if(0!==d)if(1!==i.length||this.mark||this.stat)for(i.shift(),p=0;p<d;p++){var y;m=h[p],y=t?[t,m]:[m],this._process(y.concat(i),o,s)}else{this.matches[o]||(this.matches[o]=Object.create(null));for(p=0;p<d;p++){var m=h[p];t&&(m="/"!==t.slice(-1)?t+"/"+m:t+m),"/"!==m.charAt(0)||this.nomount||(m=r.join(this.root,m)),this._emitMatch(o,m)}}}},f.prototype._emitMatch=function(t,e){if(!c(this,e)){var r=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=r),!this.matches[t][e]){if(this.nodir){var n=this.cache[r];if("DIR"===n||Array.isArray(n))return}this.matches[t][e]=!0,this.stat&&this._stat(e)}}},f.prototype._readdirInGlobStar=function(t){if(this.follow)return this._readdir(t,!1);var e,r;try{r=this.fs.lstatSync(t)}catch(t){if("ENOENT"===t.code)return null}var n=r&&r.isSymbolicLink();return this.symlinks[t]=n,n||!r||r.isDirectory()?e=this._readdir(t,!1):this.cache[t]="FILE",e},f.prototype._readdir=function(t,e){if(e&&!a(this.symlinks,t))return this._readdirInGlobStar(t);if(a(this.cache,t)){var r=this.cache[t];if(!r||"FILE"===r)return null;if(Array.isArray(r))return r}try{return this._readdirEntries(t,this.fs.readdirSync(t))}catch(e){return this._readdirError(t,e),null}},f.prototype._readdirEntries=function(t,e){if(!this.mark&&!this.stat)for(var r=0;r<e.length;r++){var n=e[r];n="/"===t?t+n:t+"/"+n,this.cache[n]=!0}return this.cache[t]=e,e},f.prototype._readdirError=function(t,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(t);if(this.cache[r]="FILE",r===this.cwdAbs){var n=new Error(e.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=e.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:if(this.cache[this._makeAbs(t)]=!1,this.strict)throw e;this.silent||console.error("glob error",e)}},f.prototype._processGlobStar=function(t,e,r,n,i,o){var s=this._readdir(r,o);if(s){var a=n.slice(1),u=t?[t]:[],c=u.concat(a);this._process(c,i,!1);var l=s.length;if(!this.symlinks[r]||!o)for(var f=0;f<l;f++)if("."!==s[f].charAt(0)||this.dot){var h=u.concat(s[f],a);this._process(h,i,!0);var p=u.concat(s[f],n);this._process(p,i,!0)}}},f.prototype._processSimple=function(t,e){var n=this._stat(t);if(this.matches[e]||(this.matches[e]=Object.create(null)),n){if(t&&i(t)&&!this.nomount){var o=/[\/\\]$/.test(t);"/"===t.charAt(0)?t=r.join(this.root,t):(t=r.resolve(this.root,t),o&&(t+="/"))}"win32"===process.platform&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t)}},f.prototype._stat=function(t){var e=this._makeAbs(t),r="/"===t.slice(-1);if(t.length>this.maxLength)return!1;if(!this.stat&&a(this.cache,e)){var n=this.cache[e];if(Array.isArray(n)&&(n="DIR"),!r||"DIR"===n)return n;if(r&&"FILE"===n)return!1}var i=this.statCache[e];if(!i){var o;try{o=this.fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(o&&o.isSymbolicLink())try{i=this.fs.statSync(e)}catch(t){i=o}else i=o}return this.statCache[e]=i,n=!0,i&&(n=i.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||n,(!r||"FILE"!==n)&&n},f.prototype._mark=function(t){return o.mark(this,t)},f.prototype._makeAbs=function(t){return o.makeAbs(this,t)},zu}(),u=Gu(),c=u.setopts,l=u.ownProp,f=nc(),h=u.childrenIgnored,p=u.isIgnored,m=rc();function g(t,e,r){if("function"==typeof e&&(r=e,e={}),e||(e={}),e.sync){if(r)throw new TypeError("callback provided to sync glob");return a(t,e)}return new b(t,e,r)}g.sync=a;var _=g.GlobSync=a.GlobSync;function b(t,e,r){if("function"==typeof e&&(r=e,e=null),e&&e.sync){if(r)throw new TypeError("callback provided to sync glob");return new _(t,e)}if(!(this instanceof b))return new b(t,e,r);c(this,t,e),this._didRealPath=!1;var n=this.minimatch.set.length;this.matches=new Array(n),"function"==typeof r&&(r=m(r),this.on("error",r),this.on("end",function(t){r(null,t)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(0===n)return a();for(var o=!0,s=0;s<n;s++)this._process(this.minimatch.set[s],s,!1,a);function a(){--i._processing,i._processing<=0&&(o?process.nextTick(function(){i._finish()}):i._finish())}o=!1}return g.glob=g,g.hasMagic=function(t,e){var r=function(t,e){if(null===e||"object"!=typeof e)return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}({},e);r.noprocess=!0;var n=new b(t,r).minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var i=0;i<n[0].length;i++)if("string"!=typeof n[0][i])return!0;return!1},g.Glob=b,r(b,n),b.prototype._finish=function(){if(o(this instanceof b),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();u.finish(this),this.emit("end",this.found)}},b.prototype._realpath=function(){if(!this._didRealpath){this._didRealpath=!0;var t=this.matches.length;if(0===t)return this._finish();for(var e=this,r=0;r<this.matches.length;r++)this._realpathSet(r,n)}function n(){0===--t&&e._finish()}},b.prototype._realpathSet=function(e,r){var n=this.matches[e];if(!n)return r();var i=Object.keys(n),o=this,s=i.length;if(0===s)return r();var a=this.matches[e]=Object.create(null);i.forEach(function(n,i){n=o._makeAbs(n),t.realpath(n,o.realpathCache,function(t,i){t?"stat"===t.syscall?a[n]=!0:o.emit("error",t):a[i]=!0,0===--s&&(o.matches[e]=a,r())})})},b.prototype._mark=function(t){return u.mark(this,t)},b.prototype._makeAbs=function(t){return u.makeAbs(this,t)},b.prototype.abort=function(){this.aborted=!0,this.emit("abort")},b.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))},b.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var t=this._emitQueue.slice(0);this._emitQueue.length=0;for(var e=0;e<t.length;e++){var r=t[e];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(e=0;e<n.length;e++){var i=n[e];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}},b.prototype._process=function(t,r,n,i){if(o(this instanceof b),o("function"==typeof i),!this.aborted)if(this._processing++,this.paused)this._processQueue.push([t,r,n,i]);else{for(var a,u=0;"string"==typeof t[u];)u++;switch(u){case t.length:return void this._processSimple(t.join("/"),r,i);case 0:a=null;break;default:a=t.slice(0,u).join("/")}var c,l=t.slice(u);null===a?c=".":s(a)||s(t.map(function(t){return"string"==typeof t?t:"[*]"}).join("/"))?(a&&s(a)||(a="/"+a),c=a):c=a;var f=this._makeAbs(c);if(h(this,c))return i();l[0]===e.GLOBSTAR?this._processGlobStar(a,c,f,l,r,n,i):this._processReaddir(a,c,f,l,r,n,i)}},b.prototype._processReaddir=function(t,e,r,n,i,o,s){var a=this;this._readdir(r,o,function(u,c){return a._processReaddir2(t,e,r,n,i,o,c,s)})},b.prototype._processReaddir2=function(t,e,r,n,o,s,a,u){if(!a)return u();for(var c=n[0],l=!!this.minimatch.negate,f=c._glob,h=this.dot||"."===f.charAt(0),p=[],d=0;d<a.length;d++){if("."!==(m=a[d]).charAt(0)||h)(l&&!t?!m.match(c):m.match(c))&&p.push(m)}var y=p.length;if(0===y)return u();if(1===n.length&&!this.mark&&!this.stat){this.matches[o]||(this.matches[o]=Object.create(null));for(d=0;d<y;d++){var m=p[d];t&&(m="/"!==t?t+"/"+m:t+m),"/"!==m.charAt(0)||this.nomount||(m=i.join(this.root,m)),this._emitMatch(o,m)}return u()}n.shift();for(d=0;d<y;d++){m=p[d];t&&(m="/"!==t?t+"/"+m:t+m),this._process([m].concat(n),o,s,u)}u()},b.prototype._emitMatch=function(t,e){if(!this.aborted&&!p(this,e))if(this.paused)this._emitQueue.push([t,e]);else{var r=s(e)?e:this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=r),!this.matches[t][e]){if(this.nodir){var n=this.cache[r];if("DIR"===n||Array.isArray(n))return}this.matches[t][e]=!0;var i=this.statCache[r];i&&this.emit("stat",e,i),this.emit("match",e)}}},b.prototype._readdirInGlobStar=function(t,e){if(!this.aborted){if(this.follow)return this._readdir(t,!1,e);var r=this,n=f("lstat\0"+t,function(n,i){if(n&&"ENOENT"===n.code)return e();var o=i&&i.isSymbolicLink();r.symlinks[t]=o,o||!i||i.isDirectory()?r._readdir(t,!1,e):(r.cache[t]="FILE",e())});n&&r.fs.lstat(t,n)}},b.prototype._readdir=function(t,e,r){if(!this.aborted&&(r=f("readdir\0"+t+"\0"+e,r))){if(e&&!l(this.symlinks,t))return this._readdirInGlobStar(t,r);if(l(this.cache,t)){var n=this.cache[t];if(!n||"FILE"===n)return r();if(Array.isArray(n))return r(null,n)}this.fs.readdir(t,function(t,e,r){return function(n,i){n?t._readdirError(e,n,r):t._readdirEntries(e,i,r)}}(this,t,r))}},b.prototype._readdirEntries=function(t,e,r){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<e.length;n++){var i=e[n];i="/"===t?t+i:t+"/"+i,this.cache[i]=!0}return this.cache[t]=e,r(null,e)}},b.prototype._readdirError=function(t,e,r){if(!this.aborted){switch(e.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(t);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(e.code+" invalid cwd "+this.cwd);i.path=this.cwd,i.code=e.code,this.emit("error",i),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(t)]=!1;break;default:this.cache[this._makeAbs(t)]=!1,this.strict&&(this.emit("error",e),this.abort()),this.silent||console.error("glob error",e)}return r()}},b.prototype._processGlobStar=function(t,e,r,n,i,o,s){var a=this;this._readdir(r,o,function(u,c){a._processGlobStar2(t,e,r,n,i,o,c,s)})},b.prototype._processGlobStar2=function(t,e,r,n,i,o,s,a){if(!s)return a();var u=n.slice(1),c=t?[t]:[],l=c.concat(u);this._process(l,i,!1,a);var f=this.symlinks[r],h=s.length;if(f&&o)return a();for(var p=0;p<h;p++){if("."!==s[p].charAt(0)||this.dot){var d=c.concat(s[p],u);this._process(d,i,!0,a);var y=c.concat(s[p],n);this._process(y,i,!0,a)}}a()},b.prototype._processSimple=function(t,e,r){var n=this;this._stat(t,function(i,o){n._processSimple2(t,e,i,o,r)})},b.prototype._processSimple2=function(t,e,r,n,o){if(this.matches[e]||(this.matches[e]=Object.create(null)),!n)return o();if(t&&s(t)&&!this.nomount){var a=/[\/\\]$/.test(t);"/"===t.charAt(0)?t=i.join(this.root,t):(t=i.resolve(this.root,t),a&&(t+="/"))}"win32"===process.platform&&(t=t.replace(/\\/g,"/")),this._emitMatch(e,t),o()},b.prototype._stat=function(t,e){var r=this._makeAbs(t),n="/"===t.slice(-1);if(t.length>this.maxLength)return e();if(!this.stat&&l(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var o=this.statCache[r];if(void 0!==o){if(!1===o)return e(null,o);var s=o.isDirectory()?"DIR":"FILE";return n&&"FILE"===s?e():e(null,s,o)}var a=this,u=f("stat\0"+r,function(n,i){if(i&&i.isSymbolicLink())return a.fs.stat(r,function(n,o){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,o,e)});a._stat2(t,r,n,i,e)});u&&a.fs.lstat(r,u)},b.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var o="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&"FILE"===s?i():i(null,s,n)},Ju}function oc(){if(Xu)return du.exports;Xu=1;var t=hr(),e=y,r=function(){if(Cs)return js;Cs=1;var t=yu();return js=function(e){return null!=e&&e.length?t(e,1):[]}}(),n=function(){if(Za)return Qa;Za=1;var t=ju(),e=yu(),r=Wi(),n=Cu(),i=r(function(r,i){return n(r)?t(r,e(i,1,n,!0)):[]});return Qa=i}(),i=Lu(),o=function(){if(pu)return hu;pu=1;var t=Ai(),e=Fu(),r=Vi(),n=Function.prototype,i=Object.prototype,o=n.toString,s=i.hasOwnProperty,a=o.call(Object);return hu=function(n){if(!r(n)||"[object Object]"!=t(n))return!1;var i=e(n);if(null===i)return!0;var u=s.call(i,"constructor")&&i.constructor;return"function"==typeof u&&u instanceof u&&o.call(u)==a}}(),s=ic(),a=du.exports={},u=/[\/\\]/g;return a.exists=function(){var r=e.join.apply(e,arguments);return t.existsSync(r)},a.expand=function(...a){var u=o(a[0])?a.shift():{},c=Array.isArray(a[0])?a[0]:a;if(0===c.length)return[];var l=function(t,e){var o=[];return r(t).forEach(function(t){var r=0===t.indexOf("!");r&&(t=t.slice(1));var s=e(t);o=r?n(o,s):i(o,s)}),o}(c,function(t){return s.sync(t,u)});return u.filter&&(l=l.filter(function(r){r=e.join(u.cwd||"",r);try{return"function"==typeof u.filter?u.filter(r):t.statSync(r)[u.filter]()}catch(t){return!1}})),l},a.expandMapping=function(t,r,n){n=Object.assign({rename:function(t,r){return e.join(t||"",r)}},n);var i=[],o={};return a.expand(n,t).forEach(function(t){var s=t;n.flatten&&(s=e.basename(s)),n.ext&&(s=s.replace(/(\.[^\/]*)?$/,n.ext));var a=n.rename(r,s,n);n.cwd&&(t=e.join(n.cwd,t)),a=a.replace(u,"/"),t=t.replace(u,"/"),o[a]?o[a].src.push(t):(i.push({src:[t],dest:a}),o[a]=i[i.length-1])}),i},a.normalizeFilesArray=function(t){var e=[];return t.forEach(function(t){("src"in t||"dest"in t)&&e.push(t)}),0===e.length?[]:e=_(e).chain().forEach(function(t){"src"in t&&t.src&&(Array.isArray(t.src)?t.src=r(t.src):t.src=[t.src])}).map(function(t){var e=Object.assign({},t);if(delete e.src,delete e.dest,t.expand)return a.expandMapping(t.src,t.dest,e).map(function(e){var r=Object.assign({},t);return r.orig=Object.assign({},t),r.src=e.src,r.dest=e.dest,["expand","cwd","flatten","rename","ext"].forEach(function(t){delete r[t]}),r});var n=Object.assign({},t);return n.orig=Object.assign({},t),"src"in n&&Object.defineProperty(n,"src",{enumerable:!0,get:function n(){var i;return"result"in n||(i=t.src,i=Array.isArray(i)?r(i):[i],n.result=a.expand(e,i)),n.result}}),"dest"in n&&(n.dest=t.dest),n}).flatten().value()},du.exports}function sc(){if(tc)return lr.exports;tc=1;var t=hr(),e=y,r=Ti(),n=ji(),i=Oo(),o=g.Stream,s=ws().PassThrough,a=lr.exports={};return a.file=oc(),a.collectStream=function(t,e){var r=[],n=0;t.on("error",e),t.on("data",function(t){r.push(t),n+=t.length}),t.on("end",function(){var t=Buffer.alloc(n),i=0;r.forEach(function(e){e.copy(t,i),i+=e.length}),e(null,t)})},a.dateify=function(t){return(t=t||new Date)instanceof Date||(t="string"==typeof t?new Date(t):new Date),t},a.defaults=function(t,e,r){var n=arguments;return n[0]=n[0]||{},i(...n)},a.isStream=function(t){return t instanceof o},a.lazyReadStream=function(e){return new r.Readable(function(){return t.createReadStream(e)})},a.normalizeInputSource=function(t){return null===t?Buffer.alloc(0):"string"==typeof t?Buffer.from(t):a.isStream(t)?t.pipe(new s):t},a.sanitizePath=function(t){return n(t,!1).replace(/^\w+:/,"").replace(/^(\.\.\/|\/)+/,"")},a.trailingSlashIt=function(t){return"/"!==t.slice(-1)?t+"/":t},a.unixifyPath=function(t){return n(t,!1).replace(/^\w+:/,"")},a.walkdir=function(r,n,i){var o=[];"function"==typeof n&&(i=n,n=r),t.readdir(r,function(s,u){var c,l,f=0;if(s)return i(s);!function s(){if(!(c=u[f++]))return i(null,o);l=e.join(r,c),t.stat(l,function(t,r){o.push({path:l,relative:e.relative(n,l).replace(/\\/g,"/"),stats:r}),r&&r.isDirectory()?a.walkdir(l,n,function(t,e){if(t)return i(t);e.forEach(function(t){o.push(t)}),s()}):s()})}()})},lr.exports}var ac,uc,cc,lc={exports:{}};
|
|
8
8
|
/**
|
|
9
9
|
* Archiver Core
|
|
10
10
|
*
|
|
11
11
|
* @ignore
|
|
12
12
|
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
|
|
13
13
|
* @copyright (c) 2012-2014 Chris Talkington, contributors.
|
|
14
|
-
*/function fc(){if(cc)return uc;cc=1;var t=p,e=z(),r=cr,n=y,i=sc(),o=b.inherits,s=(ac||(ac=1,function(t){const e={ABORTED:"archive was aborted",DIRECTORYDIRPATHREQUIRED:"diretory dirpath argument must be a non-empty string value",DIRECTORYFUNCTIONINVALIDDATA:"invalid data returned by directory custom data function",ENTRYNAMEREQUIRED:"entry name must be a non-empty string value",FILEFILEPATHREQUIRED:"file filepath argument must be a non-empty string value",FINALIZING:"archive already finalizing",QUEUECLOSED:"queue closed",NOENDMETHOD:"no suitable finalize/end method defined by module",DIRECTORYNOTSUPPORTED:"support for directory entries not defined by module",FORMATSET:"archive format already set",INPUTSTEAMBUFFERREQUIRED:"input source must be valid Stream or Buffer instance",MODULESET:"module already set",SYMLINKNOTSUPPORTED:"support for symlink entries not defined by module",SYMLINKFILEPATHREQUIRED:"symlink filepath argument must be a non-empty string value",SYMLINKTARGETREQUIRED:"symlink target argument must be a non-empty string value",ENTRYNOTSUPPORTED:"entry not supported"};function r(t,r){Error.captureStackTrace(this,this.constructor),this.message=e[t]||t,this.code=t,this.data=r}b.inherits(r,Error),t.exports=r}(lc)),lc.exports),a=ws().Transform,u="win32"===process.platform,c=function(t,e){if(!(this instanceof c))return new c(t,e);"string"!=typeof t&&(e=t,t="zip"),e=this.options=i.defaults(e,{highWaterMark:1048576,statConcurrency:4}),a.call(this,e),this._format=!1,this._module=!1,this._pending=0,this._pointer=0,this._entriesCount=0,this._entriesProcessedCount=0,this._fsEntriesTotalBytes=0,this._fsEntriesProcessedBytes=0,this._queue=r.queue(this._onQueueTask.bind(this),1),this._queue.drain(this._onQueueDrain.bind(this)),this._statQueue=r.queue(this._onStatQueueTask.bind(this),e.statConcurrency),this._statQueue.drain(this._onQueueDrain.bind(this)),this._state={aborted:!1,finalize:!1,finalizing:!1,finalized:!1,modulePiped:!1},this._streams=[]};return o(c,a),c.prototype._abort=function(){this._state.aborted=!0,this._queue.kill(),this._statQueue.kill(),this._queue.idle()&&this._shutdown()},c.prototype._append=function(e,r){var n={source:null,filepath:e};(r=r||{}).name||(r.name=e),r.sourcePath=e,n.data=r,this._entriesCount++,r.stats&&r.stats instanceof t.Stats?(n=this._updateQueueTaskWithStats(n,r.stats))&&(r.stats.size&&(this._fsEntriesTotalBytes+=r.stats.size),this._queue.push(n)):this._statQueue.push(n)},c.prototype._finalize=function(){this._state.finalizing||this._state.finalized||this._state.aborted||(this._state.finalizing=!0,this._moduleFinalize(),this._state.finalizing=!1,this._state.finalized=!0)},c.prototype._maybeFinalize=function(){return!(this._state.finalizing||this._state.finalized||this._state.aborted)&&(!!(this._state.finalize&&0===this._pending&&this._queue.idle()&&this._statQueue.idle())&&(this._finalize(),!0))},c.prototype._moduleAppend=function(t,e,r){this._state.aborted?r():this._module.append(t,e,function(t){if(this._task=null,this._state.aborted)this._shutdown();else{if(t)return this.emit("error",t),void setImmediate(r);this.emit("entry",e),this._entriesProcessedCount++,e.stats&&e.stats.size&&(this._fsEntriesProcessedBytes+=e.stats.size),this.emit("progress",{entries:{total:this._entriesCount,processed:this._entriesProcessedCount},fs:{totalBytes:this._fsEntriesTotalBytes,processedBytes:this._fsEntriesProcessedBytes}}),setImmediate(r)}}.bind(this))},c.prototype._moduleFinalize=function(){"function"==typeof this._module.finalize?this._module.finalize():"function"==typeof this._module.end?this._module.end():this.emit("error",new s("NOENDMETHOD"))},c.prototype._modulePipe=function(){this._module.on("error",this._onModuleError.bind(this)),this._module.pipe(this),this._state.modulePiped=!0},c.prototype._moduleSupports=function(t){return!(!this._module.supports||!this._module.supports[t])&&this._module.supports[t]},c.prototype._moduleUnpipe=function(){this._module.unpipe(this),this._state.modulePiped=!1},c.prototype._normalizeEntryData=function(t,e){t=i.defaults(t,{type:"file",name:null,date:null,mode:null,prefix:null,sourcePath:null,stats:!1}),e&&!1===t.stats&&(t.stats=e);var r="directory"===t.type;return t.name&&("string"==typeof t.prefix&&""!==t.prefix&&(t.name=t.prefix+"/"+t.name,t.prefix=null),t.name=i.sanitizePath(t.name),"symlink"!==t.type&&"/"===t.name.slice(-1)?(r=!0,t.type="directory"):r&&(t.name+="/")),"number"==typeof t.mode?t.mode&=u?511:4095:t.stats&&null===t.mode?(t.mode=u?511&t.stats.mode:4095&t.stats.mode,u&&r&&(t.mode=493)):null===t.mode&&(t.mode=r?493:420),t.stats&&null===t.date?t.date=t.stats.mtime:t.date=i.dateify(t.date),t},c.prototype._onModuleError=function(t){this.emit("error",t)},c.prototype._onQueueDrain=function(){this._state.finalizing||this._state.finalized||this._state.aborted||this._state.finalize&&0===this._pending&&this._queue.idle()&&this._statQueue.idle()&&this._finalize()},c.prototype._onQueueTask=function(t,e){var r=()=>{t.data.callback&&t.data.callback(),e()};this._state.finalizing||this._state.finalized||this._state.aborted?r():(this._task=t,this._moduleAppend(t.source,t.data,r))},c.prototype._onStatQueueTask=function(e,r){this._state.finalizing||this._state.finalized||this._state.aborted?r():t.lstat(e.filepath,function(t,n){if(this._state.aborted)setImmediate(r);else{if(t)return this._entriesCount--,this.emit("warning",t),void setImmediate(r);(e=this._updateQueueTaskWithStats(e,n))&&(n.size&&(this._fsEntriesTotalBytes+=n.size),this._queue.push(e)),setImmediate(r)}}.bind(this))},c.prototype._shutdown=function(){this._moduleUnpipe(),this.end()},c.prototype._transform=function(t,e,r){t&&(this._pointer+=t.length),r(null,t)},c.prototype._updateQueueTaskWithStats=function(e,r){if(r.isFile())e.data.type="file",e.data.sourceType="stream",e.source=i.lazyReadStream(e.filepath);else if(r.isDirectory()&&this._moduleSupports("directory"))e.data.name=i.trailingSlashIt(e.data.name),e.data.type="directory",e.data.sourcePath=i.trailingSlashIt(e.filepath),e.data.sourceType="buffer",e.source=Buffer.concat([]);else{if(!r.isSymbolicLink()||!this._moduleSupports("symlink"))return r.isDirectory()?this.emit("warning",new s("DIRECTORYNOTSUPPORTED",e.data)):r.isSymbolicLink()?this.emit("warning",new s("SYMLINKNOTSUPPORTED",e.data)):this.emit("warning",new s("ENTRYNOTSUPPORTED",e.data)),null;var o=t.readlinkSync(e.filepath),a=n.dirname(e.filepath);e.data.type="symlink",e.data.linkname=n.relative(a,n.resolve(a,o)),e.data.sourceType="buffer",e.source=Buffer.concat([])}return e.data=this._normalizeEntryData(e.data,r),e},c.prototype.abort=function(){return this._state.aborted||this._state.finalized||this._abort(),this},c.prototype.append=function(t,e){if(this._state.finalize||this._state.aborted)return this.emit("error",new s("QUEUECLOSED")),this;if("string"!=typeof(e=this._normalizeEntryData(e)).name||0===e.name.length)return this.emit("error",new s("ENTRYNAMEREQUIRED")),this;if("directory"===e.type&&!this._moduleSupports("directory"))return this.emit("error",new s("DIRECTORYNOTSUPPORTED",{name:e.name})),this;if(t=i.normalizeInputSource(t),Buffer.isBuffer(t))e.sourceType="buffer";else{if(!i.isStream(t))return this.emit("error",new s("INPUTSTEAMBUFFERREQUIRED",{name:e.name})),this;e.sourceType="stream"}return this._entriesCount++,this._queue.push({data:e,source:t}),this},c.prototype.directory=function(t,r,n){if(this._state.finalize||this._state.aborted)return this.emit("error",new s("QUEUECLOSED")),this;if("string"!=typeof t||0===t.length)return this.emit("error",new s("DIRECTORYDIRPATHREQUIRED")),this;this._pending++,!1===r?r="":"string"!=typeof r&&(r=t);var i=!1;"function"==typeof n?(i=n,n={}):"object"!=typeof n&&(n={});var o=e(t,{stat:!0,dot:!0});return o.on("error",function(t){this.emit("error",t)}.bind(this)),o.on("match",function(e){o.pause();var a=!1,u=Object.assign({},n);u.name=e.relative,u.prefix=r,u.stats=e.stat,u.callback=o.resume.bind(o);try{if(i)if(!1===(u=i(u)))a=!0;else if("object"!=typeof u)throw new s("DIRECTORYFUNCTIONINVALIDDATA",{dirpath:t})}catch(t){return void this.emit("error",t)}a?o.resume():this._append(e.absolute,u)}.bind(this)),o.on("end",function(){this._pending--,this._maybeFinalize()}.bind(this)),this},c.prototype.file=function(t,e){return this._state.finalize||this._state.aborted?(this.emit("error",new s("QUEUECLOSED")),this):"string"!=typeof t||0===t.length?(this.emit("error",new s("FILEFILEPATHREQUIRED")),this):(this._append(t,e),this)},c.prototype.glob=function(t,r,n){this._pending++,r=i.defaults(r,{stat:!0,pattern:t});var o=e(r.cwd||".",r);return o.on("error",function(t){this.emit("error",t)}.bind(this)),o.on("match",function(t){o.pause();var e=Object.assign({},n);e.callback=o.resume.bind(o),e.stats=t.stat,e.name=t.relative,this._append(t.absolute,e)}.bind(this)),o.on("end",function(){this._pending--,this._maybeFinalize()}.bind(this)),this},c.prototype.finalize=function(){if(this._state.aborted){var t=new s("ABORTED");return this.emit("error",t),Promise.reject(t)}if(this._state.finalize){var e=new s("FINALIZING");return this.emit("error",e),Promise.reject(e)}this._state.finalize=!0,0===this._pending&&this._queue.idle()&&this._statQueue.idle()&&this._finalize();var r=this;return new Promise(function(t,e){var n;r._module.on("end",function(){n||t()}),r._module.on("error",function(t){n=!0,e(t)})})},c.prototype.setFormat=function(t){return this._format?(this.emit("error",new s("FORMATSET")),this):(this._format=t,this)},c.prototype.setModule=function(t){return this._state.aborted?(this.emit("error",new s("ABORTED")),this):this._state.module?(this.emit("error",new s("MODULESET")),this):(this._module=t,this._modulePipe(),this)},c.prototype.symlink=function(t,e,r){if(this._state.finalize||this._state.aborted)return this.emit("error",new s("QUEUECLOSED")),this;if("string"!=typeof t||0===t.length)return this.emit("error",new s("SYMLINKFILEPATHREQUIRED")),this;if("string"!=typeof e||0===e.length)return this.emit("error",new s("SYMLINKTARGETREQUIRED",{filepath:t})),this;if(!this._moduleSupports("symlink"))return this.emit("error",new s("SYMLINKNOTSUPPORTED",{filepath:t})),this;var n={type:"symlink"};return n.name=t.replace(/\\/g,"/"),n.linkname=e.replace(/\\/g,"/"),n.sourceType="buffer","number"==typeof r&&(n.mode=r),this._entriesCount++,this._queue.push({data:n,source:Buffer.concat([])}),this},c.prototype.pointer=function(){return this._pointer},c.prototype.use=function(t){return this._streams.push(t),this},uc=c}var hc,pc={exports:{}},dc={exports:{}};function yc(){if(hc)return dc.exports;hc=1;var t=dc.exports=function(){};return t.prototype.getName=function(){},t.prototype.getSize=function(){},t.prototype.getLastModifiedDate=function(){},t.prototype.isDirectory=function(){},dc.exports}var mc,gc,_c,bc,vc,wc,Sc,Ec={exports:{}},kc={exports:{}},xc={exports:{}};function Tc(){if(mc)return xc.exports;mc=1;var t=xc.exports={};return t.dateToDos=function(t,e){var r=(e=e||!1)?t.getFullYear():t.getUTCFullYear();return r<1980?2162688:r>=2044?2141175677:r-1980<<25|(e?t.getMonth():t.getUTCMonth())+1<<21|(e?t.getDate():t.getUTCDate())<<16|(e?t.getHours():t.getUTCHours())<<11|(e?t.getMinutes():t.getUTCMinutes())<<5|(e?t.getSeconds():t.getUTCSeconds())/2},t.dosToDate=function(t){return new Date(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1)},t.fromDosTime=function(e){return t.dosToDate(e.readUInt32LE(0))},t.getEightBytes=function(t){var e=Buffer.alloc(8);return e.writeUInt32LE(t%4294967296,0),e.writeUInt32LE(t/4294967296|0,4),e},t.getShortBytes=function(t){var e=Buffer.alloc(2);return e.writeUInt16LE((65535&t)>>>0,0),e},t.getShortBytesValue=function(t,e){return t.readUInt16LE(e)},t.getLongBytes=function(t){var e=Buffer.alloc(4);return e.writeUInt32LE((4294967295&t)>>>0,0),e},t.getLongBytesValue=function(t,e){return t.readUInt32LE(e)},t.toDosTime=function(e){return t.getLongBytes(t.dateToDos(e))},xc.exports}function Oc(){if(gc)return kc.exports;gc=1;var t=Tc(),e=kc.exports=function(){return this instanceof e?(this.descriptor=!1,this.encryption=!1,this.utf8=!1,this.numberOfShannonFanoTrees=0,this.strongEncryption=!1,this.slidingDictionarySize=0,this):new e};return e.prototype.encode=function(){return t.getShortBytes((this.descriptor?8:0)|(this.utf8?2048:0)|(this.encryption?1:0)|(this.strongEncryption?64:0))},e.prototype.parse=function(r,n){var i=t.getShortBytesValue(r,n),o=new e;return o.useDataDescriptor(!!(8&i)),o.useUTF8ForNames(!!(2048&i)),o.useStrongEncryption(!!(64&i)),o.useEncryption(!!(1&i)),o.setSlidingDictionarySize(2&i?8192:4096),o.setNumberOfShannonFanoTrees(4&i?3:2),o},e.prototype.setNumberOfShannonFanoTrees=function(t){this.numberOfShannonFanoTrees=t},e.prototype.getNumberOfShannonFanoTrees=function(){return this.numberOfShannonFanoTrees},e.prototype.setSlidingDictionarySize=function(t){this.slidingDictionarySize=t},e.prototype.getSlidingDictionarySize=function(){return this.slidingDictionarySize},e.prototype.useDataDescriptor=function(t){this.descriptor=t},e.prototype.usesDataDescriptor=function(){return this.descriptor},e.prototype.useEncryption=function(t){this.encryption=t},e.prototype.usesEncryption=function(){return this.encryption},e.prototype.useStrongEncryption=function(t){this.strongEncryption=t},e.prototype.usesStrongEncryption=function(){return this.strongEncryption},e.prototype.useUTF8ForNames=function(t){this.utf8=t},e.prototype.usesUTF8ForNames=function(){return this.utf8},kc.exports}function jc(){return wc?vc:(wc=1,vc={WORD:4,DWORD:8,EMPTY:Buffer.alloc(0),SHORT:2,SHORT_MASK:65535,SHORT_SHIFT:16,SHORT_ZERO:Buffer.from(Array(2)),LONG:4,LONG_ZERO:Buffer.from(Array(4)),MIN_VERSION_INITIAL:10,MIN_VERSION_DATA_DESCRIPTOR:20,MIN_VERSION_ZIP64:45,VERSION_MADEBY:45,METHOD_STORED:0,METHOD_DEFLATED:8,PLATFORM_UNIX:3,PLATFORM_FAT:0,SIG_LFH:67324752,SIG_DD:134695760,SIG_CFH:33639248,SIG_EOCD:101010256,SIG_ZIP64_EOCD:101075792,SIG_ZIP64_EOCD_LOC:117853008,ZIP64_MAGIC_SHORT:65535,ZIP64_MAGIC:4294967295,ZIP64_EXTRA_ID:1,ZLIB_NO_COMPRESSION:0,ZLIB_BEST_SPEED:1,ZLIB_BEST_COMPRESSION:9,ZLIB_DEFAULT_COMPRESSION:-1,MODE_MASK:4095,DEFAULT_FILE_MODE:33188,DEFAULT_DIR_MODE:16877,EXT_FILE_ATTR_DIR:1106051088,EXT_FILE_ATTR_FILE:2175008800,S_IFMT:61440,S_IFIFO:4096,S_IFCHR:8192,S_IFDIR:16384,S_IFBLK:24576,S_IFREG:32768,S_IFLNK:40960,S_IFSOCK:49152,S_DOS_A:32,S_DOS_D:16,S_DOS_V:8,S_DOS_S:4,S_DOS_H:2,S_DOS_R:1})}function Cc(){if(Sc)return Ec.exports;Sc=1;var t=b.inherits,e=ji(),r=yc(),n=Oc(),i=bc?_c:(bc=1,_c={PERM_MASK:4095,FILE_TYPE_FLAG:61440,LINK_FLAG:40960,FILE_FLAG:32768,DIR_FLAG:16384,DEFAULT_LINK_PERM:511,DEFAULT_DIR_PERM:493,DEFAULT_FILE_PERM:420}),o=jc(),s=Tc(),a=Ec.exports=function(t){if(!(this instanceof a))return new a(t);r.call(this),this.platform=o.PLATFORM_FAT,this.method=-1,this.name=null,this.size=0,this.csize=0,this.gpb=new n,this.crc=0,this.time=-1,this.minver=o.MIN_VERSION_INITIAL,this.mode=-1,this.extra=null,this.exattr=0,this.inattr=0,this.comment=null,t&&this.setName(t)};return t(a,r),a.prototype.getCentralDirectoryExtra=function(){return this.getExtra()},a.prototype.getComment=function(){return null!==this.comment?this.comment:""},a.prototype.getCompressedSize=function(){return this.csize},a.prototype.getCrc=function(){return this.crc},a.prototype.getExternalAttributes=function(){return this.exattr},a.prototype.getExtra=function(){return null!==this.extra?this.extra:o.EMPTY},a.prototype.getGeneralPurposeBit=function(){return this.gpb},a.prototype.getInternalAttributes=function(){return this.inattr},a.prototype.getLastModifiedDate=function(){return this.getTime()},a.prototype.getLocalFileDataExtra=function(){return this.getExtra()},a.prototype.getMethod=function(){return this.method},a.prototype.getName=function(){return this.name},a.prototype.getPlatform=function(){return this.platform},a.prototype.getSize=function(){return this.size},a.prototype.getTime=function(){return-1!==this.time?s.dosToDate(this.time):-1},a.prototype.getTimeDos=function(){return-1!==this.time?this.time:0},a.prototype.getUnixMode=function(){return this.platform!==o.PLATFORM_UNIX?0:this.getExternalAttributes()>>o.SHORT_SHIFT&o.SHORT_MASK},a.prototype.getVersionNeededToExtract=function(){return this.minver},a.prototype.setComment=function(t){Buffer.byteLength(t)!==t.length&&this.getGeneralPurposeBit().useUTF8ForNames(!0),this.comment=t},a.prototype.setCompressedSize=function(t){if(t<0)throw new Error("invalid entry compressed size");this.csize=t},a.prototype.setCrc=function(t){if(t<0)throw new Error("invalid entry crc32");this.crc=t},a.prototype.setExternalAttributes=function(t){this.exattr=t>>>0},a.prototype.setExtra=function(t){this.extra=t},a.prototype.setGeneralPurposeBit=function(t){if(!(t instanceof n))throw new Error("invalid entry GeneralPurposeBit");this.gpb=t},a.prototype.setInternalAttributes=function(t){this.inattr=t},a.prototype.setMethod=function(t){if(t<0)throw new Error("invalid entry compression method");this.method=t},a.prototype.setName=function(t,r=!1){t=e(t,!1).replace(/^\w+:/,"").replace(/^(\.\.\/|\/)+/,""),r&&(t=`/${t}`),Buffer.byteLength(t)!==t.length&&this.getGeneralPurposeBit().useUTF8ForNames(!0),this.name=t},a.prototype.setPlatform=function(t){this.platform=t},a.prototype.setSize=function(t){if(t<0)throw new Error("invalid entry size");this.size=t},a.prototype.setTime=function(t,e){if(!(t instanceof Date))throw new Error("invalid entry time");this.time=s.dateToDos(t,e)},a.prototype.setUnixMode=function(t){var e=0;e|=(t|=this.isDirectory()?o.S_IFDIR:o.S_IFREG)<<o.SHORT_SHIFT|(this.isDirectory()?o.S_DOS_D:o.S_DOS_A),this.setExternalAttributes(e),this.mode=t&o.MODE_MASK,this.platform=o.PLATFORM_UNIX},a.prototype.setVersionNeededToExtract=function(t){this.minver=t},a.prototype.isDirectory=function(){return"/"===this.getName().slice(-1)},a.prototype.isUnixSymlink=function(){return(this.getUnixMode()&i.FILE_TYPE_FLAG)===i.LINK_FLAG},a.prototype.isZip64=function(){return this.csize>o.ZIP64_MAGIC||this.size>o.ZIP64_MAGIC},Ec.exports}var Rc,Pc,Lc={exports:{}},Fc={exports:{}};function Ac(){if(Rc)return Fc.exports;Rc=1;var t=g.Stream,e=ws().PassThrough,r=Fc.exports={};return r.isStream=function(e){return e instanceof t},r.normalizeInputSource=function(t){if(null===t)return Buffer.alloc(0);if("string"==typeof t)return Buffer.from(t);if(r.isStream(t)&&!t._readableState){var n=new e;return t.pipe(n),n}return t},Fc.exports}function Ic(){if(Pc)return Lc.exports;Pc=1;var t=b.inherits,e=ws().Transform,r=yc(),n=Ac(),i=Lc.exports=function(t){if(!(this instanceof i))return new i(t);e.call(this,t),this.offset=0,this._archive={finish:!1,finished:!1,processing:!1}};return t(i,e),i.prototype._appendBuffer=function(t,e,r){},i.prototype._appendStream=function(t,e,r){},i.prototype._emitErrorCallback=function(t){t&&this.emit("error",t)},i.prototype._finish=function(t){},i.prototype._normalizeEntry=function(t){},i.prototype._transform=function(t,e,r){r(null,t)},i.prototype.entry=function(t,e,i){if(e=e||null,"function"!=typeof i&&(i=this._emitErrorCallback.bind(this)),t instanceof r)if(this._archive.finish||this._archive.finished)i(new Error("unacceptable entry after finish"));else{if(!this._archive.processing){if(this._archive.processing=!0,this._normalizeEntry(t),this._entry=t,e=n.normalizeInputSource(e),Buffer.isBuffer(e))this._appendBuffer(t,e,i);else{if(!n.isStream(e))return this._archive.processing=!1,void i(new Error("input source must be valid Stream or Buffer instance"));this._appendStream(t,e,i)}return this}i(new Error("already processing an entry"))}else i(new Error("not a valid instance of ArchiveEntry"))},i.prototype.finish=function(){this._archive.processing?this._archive.finish=!0:this._finish()},i.prototype.getBytesWritten=function(){return this.offset},i.prototype.write=function(t,r){return t&&(this.offset+=t.length),e.prototype.write.call(this,t,r)},Lc.exports}var Dc,Mc,Nc,Bc,Uc,zc,Wc,Hc,$c,qc,Gc,Vc,Qc,Zc={exports:{}},Kc={};function Jc(){return Dc||(Dc=1,t=function(t){t.version="1.2.2";var e=function(){for(var t=0,e=new Array(256),r=0;256!=r;++r)t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=r)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1,e[r]=t;return"undefined"!=typeof Int32Array?new Int32Array(e):e}(),r=function(t){var e=0,r=0,n=0,i="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(n=0;256!=n;++n)i[n]=t[n];for(n=0;256!=n;++n)for(r=t[n],e=256+n;e<4096;e+=256)r=i[e]=r>>>8^t[255&r];var o=[];for(n=1;16!=n;++n)o[n-1]="undefined"!=typeof Int32Array?i.subarray(256*n,256*n+256):i.slice(256*n,256*n+256);return o}(e),n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],y=r[12],m=r[13],g=r[14];t.table=e,t.bstr=function(t,r){for(var n=-1^r,i=0,o=t.length;i<o;)n=n>>>8^e[255&(n^t.charCodeAt(i++))];return~n},t.buf=function(t,r){for(var _=-1^r,b=t.length-15,v=0;v<b;)_=g[t[v++]^255&_]^m[t[v++]^_>>8&255]^y[t[v++]^_>>16&255]^d[t[v++]^_>>>24]^p[t[v++]]^h[t[v++]]^f[t[v++]]^l[t[v++]]^c[t[v++]]^u[t[v++]]^a[t[v++]]^s[t[v++]]^o[t[v++]]^i[t[v++]]^n[t[v++]]^e[t[v++]];for(b+=15;v<b;)_=_>>>8^e[255&(_^t[v++])];return~_},t.str=function(t,r){for(var n=-1^r,i=0,o=t.length,s=0,a=0;i<o;)(s=t.charCodeAt(i++))<128?n=n>>>8^e[255&(n^s)]:s<2048?n=(n=n>>>8^e[255&(n^(192|s>>6&31))])>>>8^e[255&(n^(128|63&s))]:s>=55296&&s<57344?(s=64+(1023&s),a=1023&t.charCodeAt(i++),n=(n=(n=(n=n>>>8^e[255&(n^(240|s>>8&7))])>>>8^e[255&(n^(128|s>>2&63))])>>>8^e[255&(n^(128|a>>6&15|(3&s)<<4))])>>>8^e[255&(n^(128|63&a))]):n=(n=(n=n>>>8^e[255&(n^(224|s>>12&15))])>>>8^e[255&(n^(128|s>>6&63))])>>>8^e[255&(n^(128|63&s))];return~n}},"undefined"==typeof DO_NOT_EXPORT_CRC?t(Kc):t({})),Kc;var t}function Yc(){if(Nc)return Mc;Nc=1;const{Transform:t}=ws(),e=Jc();return Mc=class extends t{constructor(t){super(t),this.checksum=Buffer.allocUnsafe(4),this.checksum.writeInt32BE(0,0),this.rawSize=0}_transform(t,r,n){t&&(this.checksum=e.buf(t,this.checksum)>>>0,this.rawSize+=t.length),n(null,t)}digest(t){const e=Buffer.allocUnsafe(4);return e.writeUInt32BE(this.checksum>>>0,0),t?e.toString(t):e}hex(){return this.digest("hex").toUpperCase()}size(){return this.rawSize}}}function Xc(){if(Uc)return Bc;Uc=1;const{DeflateRaw:t}=S,e=Jc();return Bc=class extends t{constructor(t){super(t),this.checksum=Buffer.allocUnsafe(4),this.checksum.writeInt32BE(0,0),this.rawSize=0,this.compressedSize=0}push(t,e){return t&&(this.compressedSize+=t.length),super.push(t,e)}_transform(t,r,n){t&&(this.checksum=e.buf(t,this.checksum)>>>0,this.rawSize+=t.length),super._transform(t,r,n)}digest(t){const e=Buffer.allocUnsafe(4);return e.writeUInt32BE(this.checksum>>>0,0),t?e.toString(t):e}hex(){return this.digest("hex").toUpperCase()}size(t=!1){return t?this.compressedSize:this.rawSize}}}function tl(){return Wc?zc:(Wc=1,zc={CRC32Stream:Yc(),DeflateCRC32Stream:Xc()})}function el(){if(Hc)return Zc.exports;Hc=1;var t=b.inherits,e=Jc(),{CRC32Stream:r}=tl(),{DeflateCRC32Stream:n}=tl(),i=Ic();Cc(),Oc();var o=jc();Ac();var s=Tc(),a=Zc.exports=function(t){if(!(this instanceof a))return new a(t);t=this.options=this._defaults(t),i.call(this,t),this._entry=null,this._entries=[],this._archive={centralLength:0,centralOffset:0,comment:"",finish:!1,finished:!1,processing:!1,forceZip64:t.forceZip64,forceLocalTime:t.forceLocalTime}};return t(a,i),a.prototype._afterAppend=function(t){this._entries.push(t),t.getGeneralPurposeBit().usesDataDescriptor()&&this._writeDataDescriptor(t),this._archive.processing=!1,this._entry=null,this._archive.finish&&!this._archive.finished&&this._finish()},a.prototype._appendBuffer=function(t,r,n){0===r.length&&t.setMethod(o.METHOD_STORED);var i=t.getMethod();return i===o.METHOD_STORED&&(t.setSize(r.length),t.setCompressedSize(r.length),t.setCrc(e.buf(r)>>>0)),this._writeLocalFileHeader(t),i===o.METHOD_STORED?(this.write(r),this._afterAppend(t),void n(null,t)):i===o.METHOD_DEFLATED?void this._smartStream(t,n).end(r):void n(new Error("compression method "+i+" not implemented"))},a.prototype._appendStream=function(t,e,r){t.getGeneralPurposeBit().useDataDescriptor(!0),t.setVersionNeededToExtract(o.MIN_VERSION_DATA_DESCRIPTOR),this._writeLocalFileHeader(t);var n=this._smartStream(t,r);e.once("error",function(t){n.emit("error",t),n.end()}),e.pipe(n)},a.prototype._defaults=function(t){return"object"!=typeof t&&(t={}),"object"!=typeof t.zlib&&(t.zlib={}),"number"!=typeof t.zlib.level&&(t.zlib.level=o.ZLIB_BEST_SPEED),t.forceZip64=!!t.forceZip64,t.forceLocalTime=!!t.forceLocalTime,t},a.prototype._finish=function(){this._archive.centralOffset=this.offset,this._entries.forEach(function(t){this._writeCentralFileHeader(t)}.bind(this)),this._archive.centralLength=this.offset-this._archive.centralOffset,this.isZip64()&&this._writeCentralDirectoryZip64(),this._writeCentralDirectoryEnd(),this._archive.processing=!1,this._archive.finish=!0,this._archive.finished=!0,this.end()},a.prototype._normalizeEntry=function(t){-1===t.getMethod()&&t.setMethod(o.METHOD_DEFLATED),t.getMethod()===o.METHOD_DEFLATED&&(t.getGeneralPurposeBit().useDataDescriptor(!0),t.setVersionNeededToExtract(o.MIN_VERSION_DATA_DESCRIPTOR)),-1===t.getTime()&&t.setTime(new Date,this._archive.forceLocalTime),t._offsets={file:0,data:0,contents:0}},a.prototype._smartStream=function(t,e){var i=t.getMethod()===o.METHOD_DEFLATED?new n(this.options.zlib):new r,s=null;return i.once("end",function(){var r=i.digest().readUInt32BE(0);t.setCrc(r),t.setSize(i.size()),t.setCompressedSize(i.size(!0)),this._afterAppend(t),e(s,t)}.bind(this)),i.once("error",function(t){s=t}),i.pipe(this,{end:!1}),i},a.prototype._writeCentralDirectoryEnd=function(){var t=this._entries.length,e=this._archive.centralLength,r=this._archive.centralOffset;this.isZip64()&&(t=o.ZIP64_MAGIC_SHORT,e=o.ZIP64_MAGIC,r=o.ZIP64_MAGIC),this.write(s.getLongBytes(o.SIG_EOCD)),this.write(o.SHORT_ZERO),this.write(o.SHORT_ZERO),this.write(s.getShortBytes(t)),this.write(s.getShortBytes(t)),this.write(s.getLongBytes(e)),this.write(s.getLongBytes(r));var n=this.getComment(),i=Buffer.byteLength(n);this.write(s.getShortBytes(i)),this.write(n)},a.prototype._writeCentralDirectoryZip64=function(){this.write(s.getLongBytes(o.SIG_ZIP64_EOCD)),this.write(s.getEightBytes(44)),this.write(s.getShortBytes(o.MIN_VERSION_ZIP64)),this.write(s.getShortBytes(o.MIN_VERSION_ZIP64)),this.write(o.LONG_ZERO),this.write(o.LONG_ZERO),this.write(s.getEightBytes(this._entries.length)),this.write(s.getEightBytes(this._entries.length)),this.write(s.getEightBytes(this._archive.centralLength)),this.write(s.getEightBytes(this._archive.centralOffset)),this.write(s.getLongBytes(o.SIG_ZIP64_EOCD_LOC)),this.write(o.LONG_ZERO),this.write(s.getEightBytes(this._archive.centralOffset+this._archive.centralLength)),this.write(s.getLongBytes(1))},a.prototype._writeCentralFileHeader=function(t){var e=t.getGeneralPurposeBit(),r=t.getMethod(),n=t._offsets.file,i=t.getSize(),a=t.getCompressedSize();if(t.isZip64()||n>o.ZIP64_MAGIC){i=o.ZIP64_MAGIC,a=o.ZIP64_MAGIC,n=o.ZIP64_MAGIC,t.setVersionNeededToExtract(o.MIN_VERSION_ZIP64);var u=Buffer.concat([s.getShortBytes(o.ZIP64_EXTRA_ID),s.getShortBytes(24),s.getEightBytes(t.getSize()),s.getEightBytes(t.getCompressedSize()),s.getEightBytes(t._offsets.file)],28);t.setExtra(u)}this.write(s.getLongBytes(o.SIG_CFH)),this.write(s.getShortBytes(t.getPlatform()<<8|o.VERSION_MADEBY)),this.write(s.getShortBytes(t.getVersionNeededToExtract())),this.write(e.encode()),this.write(s.getShortBytes(r)),this.write(s.getLongBytes(t.getTimeDos())),this.write(s.getLongBytes(t.getCrc())),this.write(s.getLongBytes(a)),this.write(s.getLongBytes(i));var c=t.getName(),l=t.getComment(),f=t.getCentralDirectoryExtra();e.usesUTF8ForNames()&&(c=Buffer.from(c),l=Buffer.from(l)),this.write(s.getShortBytes(c.length)),this.write(s.getShortBytes(f.length)),this.write(s.getShortBytes(l.length)),this.write(o.SHORT_ZERO),this.write(s.getShortBytes(t.getInternalAttributes())),this.write(s.getLongBytes(t.getExternalAttributes())),this.write(s.getLongBytes(n)),this.write(c),this.write(f),this.write(l)},a.prototype._writeDataDescriptor=function(t){this.write(s.getLongBytes(o.SIG_DD)),this.write(s.getLongBytes(t.getCrc())),t.isZip64()?(this.write(s.getEightBytes(t.getCompressedSize())),this.write(s.getEightBytes(t.getSize()))):(this.write(s.getLongBytes(t.getCompressedSize())),this.write(s.getLongBytes(t.getSize())))},a.prototype._writeLocalFileHeader=function(t){var e=t.getGeneralPurposeBit(),r=t.getMethod(),n=t.getName(),i=t.getLocalFileDataExtra();t.isZip64()&&(e.useDataDescriptor(!0),t.setVersionNeededToExtract(o.MIN_VERSION_ZIP64)),e.usesUTF8ForNames()&&(n=Buffer.from(n)),t._offsets.file=this.offset,this.write(s.getLongBytes(o.SIG_LFH)),this.write(s.getShortBytes(t.getVersionNeededToExtract())),this.write(e.encode()),this.write(s.getShortBytes(r)),this.write(s.getLongBytes(t.getTimeDos())),t._offsets.data=this.offset,e.usesDataDescriptor()?(this.write(o.LONG_ZERO),this.write(o.LONG_ZERO),this.write(o.LONG_ZERO)):(this.write(s.getLongBytes(t.getCrc())),this.write(s.getLongBytes(t.getCompressedSize())),this.write(s.getLongBytes(t.getSize()))),this.write(s.getShortBytes(n.length)),this.write(s.getShortBytes(i.length)),this.write(n),this.write(i),t._offsets.contents=this.offset},a.prototype.getComment=function(t){return null!==this._archive.comment?this._archive.comment:""},a.prototype.isZip64=function(){return this._archive.forceZip64||this._entries.length>o.ZIP64_MAGIC_SHORT||this._archive.centralLength>o.ZIP64_MAGIC||this._archive.centralOffset>o.ZIP64_MAGIC},a.prototype.setComment=function(t){this._archive.comment=t},Zc.exports}function rl(){return qc?$c:(qc=1,$c={ArchiveEntry:yc(),ZipArchiveEntry:Cc(),ArchiveOutputStream:Ic(),ZipArchiveOutputStream:el()})}
|
|
14
|
+
*/function fc(){if(cc)return uc;cc=1;var t=p,e=z(),r=cr,n=y,i=sc(),o=b.inherits,s=(ac||(ac=1,function(t){const e={ABORTED:"archive was aborted",DIRECTORYDIRPATHREQUIRED:"diretory dirpath argument must be a non-empty string value",DIRECTORYFUNCTIONINVALIDDATA:"invalid data returned by directory custom data function",ENTRYNAMEREQUIRED:"entry name must be a non-empty string value",FILEFILEPATHREQUIRED:"file filepath argument must be a non-empty string value",FINALIZING:"archive already finalizing",QUEUECLOSED:"queue closed",NOENDMETHOD:"no suitable finalize/end method defined by module",DIRECTORYNOTSUPPORTED:"support for directory entries not defined by module",FORMATSET:"archive format already set",INPUTSTEAMBUFFERREQUIRED:"input source must be valid Stream or Buffer instance",MODULESET:"module already set",SYMLINKNOTSUPPORTED:"support for symlink entries not defined by module",SYMLINKFILEPATHREQUIRED:"symlink filepath argument must be a non-empty string value",SYMLINKTARGETREQUIRED:"symlink target argument must be a non-empty string value",ENTRYNOTSUPPORTED:"entry not supported"};function r(t,r){Error.captureStackTrace(this,this.constructor),this.message=e[t]||t,this.code=t,this.data=r}b.inherits(r,Error),t.exports=r}(lc)),lc.exports),a=ws().Transform,u="win32"===process.platform,c=function(t,e){if(!(this instanceof c))return new c(t,e);"string"!=typeof t&&(e=t,t="zip"),e=this.options=i.defaults(e,{highWaterMark:1048576,statConcurrency:4}),a.call(this,e),this._format=!1,this._module=!1,this._pending=0,this._pointer=0,this._entriesCount=0,this._entriesProcessedCount=0,this._fsEntriesTotalBytes=0,this._fsEntriesProcessedBytes=0,this._queue=r.queue(this._onQueueTask.bind(this),1),this._queue.drain(this._onQueueDrain.bind(this)),this._statQueue=r.queue(this._onStatQueueTask.bind(this),e.statConcurrency),this._statQueue.drain(this._onQueueDrain.bind(this)),this._state={aborted:!1,finalize:!1,finalizing:!1,finalized:!1,modulePiped:!1},this._streams=[]};return o(c,a),c.prototype._abort=function(){this._state.aborted=!0,this._queue.kill(),this._statQueue.kill(),this._queue.idle()&&this._shutdown()},c.prototype._append=function(e,r){var n={source:null,filepath:e};(r=r||{}).name||(r.name=e),r.sourcePath=e,n.data=r,this._entriesCount++,r.stats&&r.stats instanceof t.Stats?(n=this._updateQueueTaskWithStats(n,r.stats))&&(r.stats.size&&(this._fsEntriesTotalBytes+=r.stats.size),this._queue.push(n)):this._statQueue.push(n)},c.prototype._finalize=function(){this._state.finalizing||this._state.finalized||this._state.aborted||(this._state.finalizing=!0,this._moduleFinalize(),this._state.finalizing=!1,this._state.finalized=!0)},c.prototype._maybeFinalize=function(){return!(this._state.finalizing||this._state.finalized||this._state.aborted)&&(!!(this._state.finalize&&0===this._pending&&this._queue.idle()&&this._statQueue.idle())&&(this._finalize(),!0))},c.prototype._moduleAppend=function(t,e,r){this._state.aborted?r():this._module.append(t,e,function(t){if(this._task=null,this._state.aborted)this._shutdown();else{if(t)return this.emit("error",t),void setImmediate(r);this.emit("entry",e),this._entriesProcessedCount++,e.stats&&e.stats.size&&(this._fsEntriesProcessedBytes+=e.stats.size),this.emit("progress",{entries:{total:this._entriesCount,processed:this._entriesProcessedCount},fs:{totalBytes:this._fsEntriesTotalBytes,processedBytes:this._fsEntriesProcessedBytes}}),setImmediate(r)}}.bind(this))},c.prototype._moduleFinalize=function(){"function"==typeof this._module.finalize?this._module.finalize():"function"==typeof this._module.end?this._module.end():this.emit("error",new s("NOENDMETHOD"))},c.prototype._modulePipe=function(){this._module.on("error",this._onModuleError.bind(this)),this._module.pipe(this),this._state.modulePiped=!0},c.prototype._moduleSupports=function(t){return!(!this._module.supports||!this._module.supports[t])&&this._module.supports[t]},c.prototype._moduleUnpipe=function(){this._module.unpipe(this),this._state.modulePiped=!1},c.prototype._normalizeEntryData=function(t,e){t=i.defaults(t,{type:"file",name:null,date:null,mode:null,prefix:null,sourcePath:null,stats:!1}),e&&!1===t.stats&&(t.stats=e);var r="directory"===t.type;return t.name&&("string"==typeof t.prefix&&""!==t.prefix&&(t.name=t.prefix+"/"+t.name,t.prefix=null),t.name=i.sanitizePath(t.name),"symlink"!==t.type&&"/"===t.name.slice(-1)?(r=!0,t.type="directory"):r&&(t.name+="/")),"number"==typeof t.mode?t.mode&=u?511:4095:t.stats&&null===t.mode?(t.mode=u?511&t.stats.mode:4095&t.stats.mode,u&&r&&(t.mode=493)):null===t.mode&&(t.mode=r?493:420),t.stats&&null===t.date?t.date=t.stats.mtime:t.date=i.dateify(t.date),t},c.prototype._onModuleError=function(t){this.emit("error",t)},c.prototype._onQueueDrain=function(){this._state.finalizing||this._state.finalized||this._state.aborted||this._state.finalize&&0===this._pending&&this._queue.idle()&&this._statQueue.idle()&&this._finalize()},c.prototype._onQueueTask=function(t,e){var r=()=>{t.data.callback&&t.data.callback(),e()};this._state.finalizing||this._state.finalized||this._state.aborted?r():(this._task=t,this._moduleAppend(t.source,t.data,r))},c.prototype._onStatQueueTask=function(e,r){this._state.finalizing||this._state.finalized||this._state.aborted?r():t.lstat(e.filepath,function(t,n){if(this._state.aborted)setImmediate(r);else{if(t)return this._entriesCount--,this.emit("warning",t),void setImmediate(r);(e=this._updateQueueTaskWithStats(e,n))&&(n.size&&(this._fsEntriesTotalBytes+=n.size),this._queue.push(e)),setImmediate(r)}}.bind(this))},c.prototype._shutdown=function(){this._moduleUnpipe(),this.end()},c.prototype._transform=function(t,e,r){t&&(this._pointer+=t.length),r(null,t)},c.prototype._updateQueueTaskWithStats=function(e,r){if(r.isFile())e.data.type="file",e.data.sourceType="stream",e.source=i.lazyReadStream(e.filepath);else if(r.isDirectory()&&this._moduleSupports("directory"))e.data.name=i.trailingSlashIt(e.data.name),e.data.type="directory",e.data.sourcePath=i.trailingSlashIt(e.filepath),e.data.sourceType="buffer",e.source=Buffer.concat([]);else{if(!r.isSymbolicLink()||!this._moduleSupports("symlink"))return r.isDirectory()?this.emit("warning",new s("DIRECTORYNOTSUPPORTED",e.data)):r.isSymbolicLink()?this.emit("warning",new s("SYMLINKNOTSUPPORTED",e.data)):this.emit("warning",new s("ENTRYNOTSUPPORTED",e.data)),null;var o=t.readlinkSync(e.filepath),a=n.dirname(e.filepath);e.data.type="symlink",e.data.linkname=n.relative(a,n.resolve(a,o)),e.data.sourceType="buffer",e.source=Buffer.concat([])}return e.data=this._normalizeEntryData(e.data,r),e},c.prototype.abort=function(){return this._state.aborted||this._state.finalized||this._abort(),this},c.prototype.append=function(t,e){if(this._state.finalize||this._state.aborted)return this.emit("error",new s("QUEUECLOSED")),this;if("string"!=typeof(e=this._normalizeEntryData(e)).name||0===e.name.length)return this.emit("error",new s("ENTRYNAMEREQUIRED")),this;if("directory"===e.type&&!this._moduleSupports("directory"))return this.emit("error",new s("DIRECTORYNOTSUPPORTED",{name:e.name})),this;if(t=i.normalizeInputSource(t),Buffer.isBuffer(t))e.sourceType="buffer";else{if(!i.isStream(t))return this.emit("error",new s("INPUTSTEAMBUFFERREQUIRED",{name:e.name})),this;e.sourceType="stream"}return this._entriesCount++,this._queue.push({data:e,source:t}),this},c.prototype.directory=function(t,r,n){if(this._state.finalize||this._state.aborted)return this.emit("error",new s("QUEUECLOSED")),this;if("string"!=typeof t||0===t.length)return this.emit("error",new s("DIRECTORYDIRPATHREQUIRED")),this;this._pending++,!1===r?r="":"string"!=typeof r&&(r=t);var i=!1;"function"==typeof n?(i=n,n={}):"object"!=typeof n&&(n={});var o=e(t,{stat:!0,dot:!0});return o.on("error",function(t){this.emit("error",t)}.bind(this)),o.on("match",function(e){o.pause();var a=!1,u=Object.assign({},n);u.name=e.relative,u.prefix=r,u.stats=e.stat,u.callback=o.resume.bind(o);try{if(i)if(!1===(u=i(u)))a=!0;else if("object"!=typeof u)throw new s("DIRECTORYFUNCTIONINVALIDDATA",{dirpath:t})}catch(t){return void this.emit("error",t)}a?o.resume():this._append(e.absolute,u)}.bind(this)),o.on("end",function(){this._pending--,this._maybeFinalize()}.bind(this)),this},c.prototype.file=function(t,e){return this._state.finalize||this._state.aborted?(this.emit("error",new s("QUEUECLOSED")),this):"string"!=typeof t||0===t.length?(this.emit("error",new s("FILEFILEPATHREQUIRED")),this):(this._append(t,e),this)},c.prototype.glob=function(t,r,n){this._pending++,r=i.defaults(r,{stat:!0,pattern:t});var o=e(r.cwd||".",r);return o.on("error",function(t){this.emit("error",t)}.bind(this)),o.on("match",function(t){o.pause();var e=Object.assign({},n);e.callback=o.resume.bind(o),e.stats=t.stat,e.name=t.relative,this._append(t.absolute,e)}.bind(this)),o.on("end",function(){this._pending--,this._maybeFinalize()}.bind(this)),this},c.prototype.finalize=function(){if(this._state.aborted){var t=new s("ABORTED");return this.emit("error",t),Promise.reject(t)}if(this._state.finalize){var e=new s("FINALIZING");return this.emit("error",e),Promise.reject(e)}this._state.finalize=!0,0===this._pending&&this._queue.idle()&&this._statQueue.idle()&&this._finalize();var r=this;return new Promise(function(t,e){var n;r._module.on("end",function(){n||t()}),r._module.on("error",function(t){n=!0,e(t)})})},c.prototype.setFormat=function(t){return this._format?(this.emit("error",new s("FORMATSET")),this):(this._format=t,this)},c.prototype.setModule=function(t){return this._state.aborted?(this.emit("error",new s("ABORTED")),this):this._state.module?(this.emit("error",new s("MODULESET")),this):(this._module=t,this._modulePipe(),this)},c.prototype.symlink=function(t,e,r){if(this._state.finalize||this._state.aborted)return this.emit("error",new s("QUEUECLOSED")),this;if("string"!=typeof t||0===t.length)return this.emit("error",new s("SYMLINKFILEPATHREQUIRED")),this;if("string"!=typeof e||0===e.length)return this.emit("error",new s("SYMLINKTARGETREQUIRED",{filepath:t})),this;if(!this._moduleSupports("symlink"))return this.emit("error",new s("SYMLINKNOTSUPPORTED",{filepath:t})),this;var n={type:"symlink"};return n.name=t.replace(/\\/g,"/"),n.linkname=e.replace(/\\/g,"/"),n.sourceType="buffer","number"==typeof r&&(n.mode=r),this._entriesCount++,this._queue.push({data:n,source:Buffer.concat([])}),this},c.prototype.pointer=function(){return this._pointer},c.prototype.use=function(t){return this._streams.push(t),this},uc=c}var hc,pc={exports:{}},dc={exports:{}};function yc(){if(hc)return dc.exports;hc=1;var t=dc.exports=function(){};return t.prototype.getName=function(){},t.prototype.getSize=function(){},t.prototype.getLastModifiedDate=function(){},t.prototype.isDirectory=function(){},dc.exports}var mc,gc,_c,bc,vc,wc,Sc,Ec={exports:{}},kc={exports:{}},xc={exports:{}};function Oc(){if(mc)return xc.exports;mc=1;var t=xc.exports={};return t.dateToDos=function(t,e){var r=(e=e||!1)?t.getFullYear():t.getUTCFullYear();return r<1980?2162688:r>=2044?2141175677:r-1980<<25|(e?t.getMonth():t.getUTCMonth())+1<<21|(e?t.getDate():t.getUTCDate())<<16|(e?t.getHours():t.getUTCHours())<<11|(e?t.getMinutes():t.getUTCMinutes())<<5|(e?t.getSeconds():t.getUTCSeconds())/2},t.dosToDate=function(t){return new Date(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1)},t.fromDosTime=function(e){return t.dosToDate(e.readUInt32LE(0))},t.getEightBytes=function(t){var e=Buffer.alloc(8);return e.writeUInt32LE(t%4294967296,0),e.writeUInt32LE(t/4294967296|0,4),e},t.getShortBytes=function(t){var e=Buffer.alloc(2);return e.writeUInt16LE((65535&t)>>>0,0),e},t.getShortBytesValue=function(t,e){return t.readUInt16LE(e)},t.getLongBytes=function(t){var e=Buffer.alloc(4);return e.writeUInt32LE((4294967295&t)>>>0,0),e},t.getLongBytesValue=function(t,e){return t.readUInt32LE(e)},t.toDosTime=function(e){return t.getLongBytes(t.dateToDos(e))},xc.exports}function Tc(){if(gc)return kc.exports;gc=1;var t=Oc(),e=kc.exports=function(){return this instanceof e?(this.descriptor=!1,this.encryption=!1,this.utf8=!1,this.numberOfShannonFanoTrees=0,this.strongEncryption=!1,this.slidingDictionarySize=0,this):new e};return e.prototype.encode=function(){return t.getShortBytes((this.descriptor?8:0)|(this.utf8?2048:0)|(this.encryption?1:0)|(this.strongEncryption?64:0))},e.prototype.parse=function(r,n){var i=t.getShortBytesValue(r,n),o=new e;return o.useDataDescriptor(!!(8&i)),o.useUTF8ForNames(!!(2048&i)),o.useStrongEncryption(!!(64&i)),o.useEncryption(!!(1&i)),o.setSlidingDictionarySize(2&i?8192:4096),o.setNumberOfShannonFanoTrees(4&i?3:2),o},e.prototype.setNumberOfShannonFanoTrees=function(t){this.numberOfShannonFanoTrees=t},e.prototype.getNumberOfShannonFanoTrees=function(){return this.numberOfShannonFanoTrees},e.prototype.setSlidingDictionarySize=function(t){this.slidingDictionarySize=t},e.prototype.getSlidingDictionarySize=function(){return this.slidingDictionarySize},e.prototype.useDataDescriptor=function(t){this.descriptor=t},e.prototype.usesDataDescriptor=function(){return this.descriptor},e.prototype.useEncryption=function(t){this.encryption=t},e.prototype.usesEncryption=function(){return this.encryption},e.prototype.useStrongEncryption=function(t){this.strongEncryption=t},e.prototype.usesStrongEncryption=function(){return this.strongEncryption},e.prototype.useUTF8ForNames=function(t){this.utf8=t},e.prototype.usesUTF8ForNames=function(){return this.utf8},kc.exports}function jc(){return wc?vc:(wc=1,vc={WORD:4,DWORD:8,EMPTY:Buffer.alloc(0),SHORT:2,SHORT_MASK:65535,SHORT_SHIFT:16,SHORT_ZERO:Buffer.from(Array(2)),LONG:4,LONG_ZERO:Buffer.from(Array(4)),MIN_VERSION_INITIAL:10,MIN_VERSION_DATA_DESCRIPTOR:20,MIN_VERSION_ZIP64:45,VERSION_MADEBY:45,METHOD_STORED:0,METHOD_DEFLATED:8,PLATFORM_UNIX:3,PLATFORM_FAT:0,SIG_LFH:67324752,SIG_DD:134695760,SIG_CFH:33639248,SIG_EOCD:101010256,SIG_ZIP64_EOCD:101075792,SIG_ZIP64_EOCD_LOC:117853008,ZIP64_MAGIC_SHORT:65535,ZIP64_MAGIC:4294967295,ZIP64_EXTRA_ID:1,ZLIB_NO_COMPRESSION:0,ZLIB_BEST_SPEED:1,ZLIB_BEST_COMPRESSION:9,ZLIB_DEFAULT_COMPRESSION:-1,MODE_MASK:4095,DEFAULT_FILE_MODE:33188,DEFAULT_DIR_MODE:16877,EXT_FILE_ATTR_DIR:1106051088,EXT_FILE_ATTR_FILE:2175008800,S_IFMT:61440,S_IFIFO:4096,S_IFCHR:8192,S_IFDIR:16384,S_IFBLK:24576,S_IFREG:32768,S_IFLNK:40960,S_IFSOCK:49152,S_DOS_A:32,S_DOS_D:16,S_DOS_V:8,S_DOS_S:4,S_DOS_H:2,S_DOS_R:1})}function Cc(){if(Sc)return Ec.exports;Sc=1;var t=b.inherits,e=ji(),r=yc(),n=Tc(),i=bc?_c:(bc=1,_c={PERM_MASK:4095,FILE_TYPE_FLAG:61440,LINK_FLAG:40960,FILE_FLAG:32768,DIR_FLAG:16384,DEFAULT_LINK_PERM:511,DEFAULT_DIR_PERM:493,DEFAULT_FILE_PERM:420}),o=jc(),s=Oc(),a=Ec.exports=function(t){if(!(this instanceof a))return new a(t);r.call(this),this.platform=o.PLATFORM_FAT,this.method=-1,this.name=null,this.size=0,this.csize=0,this.gpb=new n,this.crc=0,this.time=-1,this.minver=o.MIN_VERSION_INITIAL,this.mode=-1,this.extra=null,this.exattr=0,this.inattr=0,this.comment=null,t&&this.setName(t)};return t(a,r),a.prototype.getCentralDirectoryExtra=function(){return this.getExtra()},a.prototype.getComment=function(){return null!==this.comment?this.comment:""},a.prototype.getCompressedSize=function(){return this.csize},a.prototype.getCrc=function(){return this.crc},a.prototype.getExternalAttributes=function(){return this.exattr},a.prototype.getExtra=function(){return null!==this.extra?this.extra:o.EMPTY},a.prototype.getGeneralPurposeBit=function(){return this.gpb},a.prototype.getInternalAttributes=function(){return this.inattr},a.prototype.getLastModifiedDate=function(){return this.getTime()},a.prototype.getLocalFileDataExtra=function(){return this.getExtra()},a.prototype.getMethod=function(){return this.method},a.prototype.getName=function(){return this.name},a.prototype.getPlatform=function(){return this.platform},a.prototype.getSize=function(){return this.size},a.prototype.getTime=function(){return-1!==this.time?s.dosToDate(this.time):-1},a.prototype.getTimeDos=function(){return-1!==this.time?this.time:0},a.prototype.getUnixMode=function(){return this.platform!==o.PLATFORM_UNIX?0:this.getExternalAttributes()>>o.SHORT_SHIFT&o.SHORT_MASK},a.prototype.getVersionNeededToExtract=function(){return this.minver},a.prototype.setComment=function(t){Buffer.byteLength(t)!==t.length&&this.getGeneralPurposeBit().useUTF8ForNames(!0),this.comment=t},a.prototype.setCompressedSize=function(t){if(t<0)throw new Error("invalid entry compressed size");this.csize=t},a.prototype.setCrc=function(t){if(t<0)throw new Error("invalid entry crc32");this.crc=t},a.prototype.setExternalAttributes=function(t){this.exattr=t>>>0},a.prototype.setExtra=function(t){this.extra=t},a.prototype.setGeneralPurposeBit=function(t){if(!(t instanceof n))throw new Error("invalid entry GeneralPurposeBit");this.gpb=t},a.prototype.setInternalAttributes=function(t){this.inattr=t},a.prototype.setMethod=function(t){if(t<0)throw new Error("invalid entry compression method");this.method=t},a.prototype.setName=function(t,r=!1){t=e(t,!1).replace(/^\w+:/,"").replace(/^(\.\.\/|\/)+/,""),r&&(t=`/${t}`),Buffer.byteLength(t)!==t.length&&this.getGeneralPurposeBit().useUTF8ForNames(!0),this.name=t},a.prototype.setPlatform=function(t){this.platform=t},a.prototype.setSize=function(t){if(t<0)throw new Error("invalid entry size");this.size=t},a.prototype.setTime=function(t,e){if(!(t instanceof Date))throw new Error("invalid entry time");this.time=s.dateToDos(t,e)},a.prototype.setUnixMode=function(t){var e=0;e|=(t|=this.isDirectory()?o.S_IFDIR:o.S_IFREG)<<o.SHORT_SHIFT|(this.isDirectory()?o.S_DOS_D:o.S_DOS_A),this.setExternalAttributes(e),this.mode=t&o.MODE_MASK,this.platform=o.PLATFORM_UNIX},a.prototype.setVersionNeededToExtract=function(t){this.minver=t},a.prototype.isDirectory=function(){return"/"===this.getName().slice(-1)},a.prototype.isUnixSymlink=function(){return(this.getUnixMode()&i.FILE_TYPE_FLAG)===i.LINK_FLAG},a.prototype.isZip64=function(){return this.csize>o.ZIP64_MAGIC||this.size>o.ZIP64_MAGIC},Ec.exports}var Rc,Pc,Lc={exports:{}},Fc={exports:{}};function Ac(){if(Rc)return Fc.exports;Rc=1;var t=g.Stream,e=ws().PassThrough,r=Fc.exports={};return r.isStream=function(e){return e instanceof t},r.normalizeInputSource=function(t){if(null===t)return Buffer.alloc(0);if("string"==typeof t)return Buffer.from(t);if(r.isStream(t)&&!t._readableState){var n=new e;return t.pipe(n),n}return t},Fc.exports}function Ic(){if(Pc)return Lc.exports;Pc=1;var t=b.inherits,e=ws().Transform,r=yc(),n=Ac(),i=Lc.exports=function(t){if(!(this instanceof i))return new i(t);e.call(this,t),this.offset=0,this._archive={finish:!1,finished:!1,processing:!1}};return t(i,e),i.prototype._appendBuffer=function(t,e,r){},i.prototype._appendStream=function(t,e,r){},i.prototype._emitErrorCallback=function(t){t&&this.emit("error",t)},i.prototype._finish=function(t){},i.prototype._normalizeEntry=function(t){},i.prototype._transform=function(t,e,r){r(null,t)},i.prototype.entry=function(t,e,i){if(e=e||null,"function"!=typeof i&&(i=this._emitErrorCallback.bind(this)),t instanceof r)if(this._archive.finish||this._archive.finished)i(new Error("unacceptable entry after finish"));else{if(!this._archive.processing){if(this._archive.processing=!0,this._normalizeEntry(t),this._entry=t,e=n.normalizeInputSource(e),Buffer.isBuffer(e))this._appendBuffer(t,e,i);else{if(!n.isStream(e))return this._archive.processing=!1,void i(new Error("input source must be valid Stream or Buffer instance"));this._appendStream(t,e,i)}return this}i(new Error("already processing an entry"))}else i(new Error("not a valid instance of ArchiveEntry"))},i.prototype.finish=function(){this._archive.processing?this._archive.finish=!0:this._finish()},i.prototype.getBytesWritten=function(){return this.offset},i.prototype.write=function(t,r){return t&&(this.offset+=t.length),e.prototype.write.call(this,t,r)},Lc.exports}var Dc,Mc,Nc,Bc,Uc,zc,Wc,Hc,$c,qc,Gc,Vc,Qc,Zc={exports:{}},Kc={};function Jc(){return Dc||(Dc=1,t=function(t){t.version="1.2.2";var e=function(){for(var t=0,e=new Array(256),r=0;256!=r;++r)t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=r)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1,e[r]=t;return"undefined"!=typeof Int32Array?new Int32Array(e):e}(),r=function(t){var e=0,r=0,n=0,i="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(n=0;256!=n;++n)i[n]=t[n];for(n=0;256!=n;++n)for(r=t[n],e=256+n;e<4096;e+=256)r=i[e]=r>>>8^t[255&r];var o=[];for(n=1;16!=n;++n)o[n-1]="undefined"!=typeof Int32Array?i.subarray(256*n,256*n+256):i.slice(256*n,256*n+256);return o}(e),n=r[0],i=r[1],o=r[2],s=r[3],a=r[4],u=r[5],c=r[6],l=r[7],f=r[8],h=r[9],p=r[10],d=r[11],y=r[12],m=r[13],g=r[14];t.table=e,t.bstr=function(t,r){for(var n=-1^r,i=0,o=t.length;i<o;)n=n>>>8^e[255&(n^t.charCodeAt(i++))];return~n},t.buf=function(t,r){for(var _=-1^r,b=t.length-15,v=0;v<b;)_=g[t[v++]^255&_]^m[t[v++]^_>>8&255]^y[t[v++]^_>>16&255]^d[t[v++]^_>>>24]^p[t[v++]]^h[t[v++]]^f[t[v++]]^l[t[v++]]^c[t[v++]]^u[t[v++]]^a[t[v++]]^s[t[v++]]^o[t[v++]]^i[t[v++]]^n[t[v++]]^e[t[v++]];for(b+=15;v<b;)_=_>>>8^e[255&(_^t[v++])];return~_},t.str=function(t,r){for(var n=-1^r,i=0,o=t.length,s=0,a=0;i<o;)(s=t.charCodeAt(i++))<128?n=n>>>8^e[255&(n^s)]:s<2048?n=(n=n>>>8^e[255&(n^(192|s>>6&31))])>>>8^e[255&(n^(128|63&s))]:s>=55296&&s<57344?(s=64+(1023&s),a=1023&t.charCodeAt(i++),n=(n=(n=(n=n>>>8^e[255&(n^(240|s>>8&7))])>>>8^e[255&(n^(128|s>>2&63))])>>>8^e[255&(n^(128|a>>6&15|(3&s)<<4))])>>>8^e[255&(n^(128|63&a))]):n=(n=(n=n>>>8^e[255&(n^(224|s>>12&15))])>>>8^e[255&(n^(128|s>>6&63))])>>>8^e[255&(n^(128|63&s))];return~n}},"undefined"==typeof DO_NOT_EXPORT_CRC?t(Kc):t({})),Kc;var t}function Yc(){if(Nc)return Mc;Nc=1;const{Transform:t}=ws(),e=Jc();return Mc=class extends t{constructor(t){super(t),this.checksum=Buffer.allocUnsafe(4),this.checksum.writeInt32BE(0,0),this.rawSize=0}_transform(t,r,n){t&&(this.checksum=e.buf(t,this.checksum)>>>0,this.rawSize+=t.length),n(null,t)}digest(t){const e=Buffer.allocUnsafe(4);return e.writeUInt32BE(this.checksum>>>0,0),t?e.toString(t):e}hex(){return this.digest("hex").toUpperCase()}size(){return this.rawSize}}}function Xc(){if(Uc)return Bc;Uc=1;const{DeflateRaw:t}=S,e=Jc();return Bc=class extends t{constructor(t){super(t),this.checksum=Buffer.allocUnsafe(4),this.checksum.writeInt32BE(0,0),this.rawSize=0,this.compressedSize=0}push(t,e){return t&&(this.compressedSize+=t.length),super.push(t,e)}_transform(t,r,n){t&&(this.checksum=e.buf(t,this.checksum)>>>0,this.rawSize+=t.length),super._transform(t,r,n)}digest(t){const e=Buffer.allocUnsafe(4);return e.writeUInt32BE(this.checksum>>>0,0),t?e.toString(t):e}hex(){return this.digest("hex").toUpperCase()}size(t=!1){return t?this.compressedSize:this.rawSize}}}function tl(){return Wc?zc:(Wc=1,zc={CRC32Stream:Yc(),DeflateCRC32Stream:Xc()})}function el(){if(Hc)return Zc.exports;Hc=1;var t=b.inherits,e=Jc(),{CRC32Stream:r}=tl(),{DeflateCRC32Stream:n}=tl(),i=Ic();Cc(),Tc();var o=jc();Ac();var s=Oc(),a=Zc.exports=function(t){if(!(this instanceof a))return new a(t);t=this.options=this._defaults(t),i.call(this,t),this._entry=null,this._entries=[],this._archive={centralLength:0,centralOffset:0,comment:"",finish:!1,finished:!1,processing:!1,forceZip64:t.forceZip64,forceLocalTime:t.forceLocalTime}};return t(a,i),a.prototype._afterAppend=function(t){this._entries.push(t),t.getGeneralPurposeBit().usesDataDescriptor()&&this._writeDataDescriptor(t),this._archive.processing=!1,this._entry=null,this._archive.finish&&!this._archive.finished&&this._finish()},a.prototype._appendBuffer=function(t,r,n){0===r.length&&t.setMethod(o.METHOD_STORED);var i=t.getMethod();return i===o.METHOD_STORED&&(t.setSize(r.length),t.setCompressedSize(r.length),t.setCrc(e.buf(r)>>>0)),this._writeLocalFileHeader(t),i===o.METHOD_STORED?(this.write(r),this._afterAppend(t),void n(null,t)):i===o.METHOD_DEFLATED?void this._smartStream(t,n).end(r):void n(new Error("compression method "+i+" not implemented"))},a.prototype._appendStream=function(t,e,r){t.getGeneralPurposeBit().useDataDescriptor(!0),t.setVersionNeededToExtract(o.MIN_VERSION_DATA_DESCRIPTOR),this._writeLocalFileHeader(t);var n=this._smartStream(t,r);e.once("error",function(t){n.emit("error",t),n.end()}),e.pipe(n)},a.prototype._defaults=function(t){return"object"!=typeof t&&(t={}),"object"!=typeof t.zlib&&(t.zlib={}),"number"!=typeof t.zlib.level&&(t.zlib.level=o.ZLIB_BEST_SPEED),t.forceZip64=!!t.forceZip64,t.forceLocalTime=!!t.forceLocalTime,t},a.prototype._finish=function(){this._archive.centralOffset=this.offset,this._entries.forEach(function(t){this._writeCentralFileHeader(t)}.bind(this)),this._archive.centralLength=this.offset-this._archive.centralOffset,this.isZip64()&&this._writeCentralDirectoryZip64(),this._writeCentralDirectoryEnd(),this._archive.processing=!1,this._archive.finish=!0,this._archive.finished=!0,this.end()},a.prototype._normalizeEntry=function(t){-1===t.getMethod()&&t.setMethod(o.METHOD_DEFLATED),t.getMethod()===o.METHOD_DEFLATED&&(t.getGeneralPurposeBit().useDataDescriptor(!0),t.setVersionNeededToExtract(o.MIN_VERSION_DATA_DESCRIPTOR)),-1===t.getTime()&&t.setTime(new Date,this._archive.forceLocalTime),t._offsets={file:0,data:0,contents:0}},a.prototype._smartStream=function(t,e){var i=t.getMethod()===o.METHOD_DEFLATED?new n(this.options.zlib):new r,s=null;return i.once("end",function(){var r=i.digest().readUInt32BE(0);t.setCrc(r),t.setSize(i.size()),t.setCompressedSize(i.size(!0)),this._afterAppend(t),e(s,t)}.bind(this)),i.once("error",function(t){s=t}),i.pipe(this,{end:!1}),i},a.prototype._writeCentralDirectoryEnd=function(){var t=this._entries.length,e=this._archive.centralLength,r=this._archive.centralOffset;this.isZip64()&&(t=o.ZIP64_MAGIC_SHORT,e=o.ZIP64_MAGIC,r=o.ZIP64_MAGIC),this.write(s.getLongBytes(o.SIG_EOCD)),this.write(o.SHORT_ZERO),this.write(o.SHORT_ZERO),this.write(s.getShortBytes(t)),this.write(s.getShortBytes(t)),this.write(s.getLongBytes(e)),this.write(s.getLongBytes(r));var n=this.getComment(),i=Buffer.byteLength(n);this.write(s.getShortBytes(i)),this.write(n)},a.prototype._writeCentralDirectoryZip64=function(){this.write(s.getLongBytes(o.SIG_ZIP64_EOCD)),this.write(s.getEightBytes(44)),this.write(s.getShortBytes(o.MIN_VERSION_ZIP64)),this.write(s.getShortBytes(o.MIN_VERSION_ZIP64)),this.write(o.LONG_ZERO),this.write(o.LONG_ZERO),this.write(s.getEightBytes(this._entries.length)),this.write(s.getEightBytes(this._entries.length)),this.write(s.getEightBytes(this._archive.centralLength)),this.write(s.getEightBytes(this._archive.centralOffset)),this.write(s.getLongBytes(o.SIG_ZIP64_EOCD_LOC)),this.write(o.LONG_ZERO),this.write(s.getEightBytes(this._archive.centralOffset+this._archive.centralLength)),this.write(s.getLongBytes(1))},a.prototype._writeCentralFileHeader=function(t){var e=t.getGeneralPurposeBit(),r=t.getMethod(),n=t._offsets.file,i=t.getSize(),a=t.getCompressedSize();if(t.isZip64()||n>o.ZIP64_MAGIC){i=o.ZIP64_MAGIC,a=o.ZIP64_MAGIC,n=o.ZIP64_MAGIC,t.setVersionNeededToExtract(o.MIN_VERSION_ZIP64);var u=Buffer.concat([s.getShortBytes(o.ZIP64_EXTRA_ID),s.getShortBytes(24),s.getEightBytes(t.getSize()),s.getEightBytes(t.getCompressedSize()),s.getEightBytes(t._offsets.file)],28);t.setExtra(u)}this.write(s.getLongBytes(o.SIG_CFH)),this.write(s.getShortBytes(t.getPlatform()<<8|o.VERSION_MADEBY)),this.write(s.getShortBytes(t.getVersionNeededToExtract())),this.write(e.encode()),this.write(s.getShortBytes(r)),this.write(s.getLongBytes(t.getTimeDos())),this.write(s.getLongBytes(t.getCrc())),this.write(s.getLongBytes(a)),this.write(s.getLongBytes(i));var c=t.getName(),l=t.getComment(),f=t.getCentralDirectoryExtra();e.usesUTF8ForNames()&&(c=Buffer.from(c),l=Buffer.from(l)),this.write(s.getShortBytes(c.length)),this.write(s.getShortBytes(f.length)),this.write(s.getShortBytes(l.length)),this.write(o.SHORT_ZERO),this.write(s.getShortBytes(t.getInternalAttributes())),this.write(s.getLongBytes(t.getExternalAttributes())),this.write(s.getLongBytes(n)),this.write(c),this.write(f),this.write(l)},a.prototype._writeDataDescriptor=function(t){this.write(s.getLongBytes(o.SIG_DD)),this.write(s.getLongBytes(t.getCrc())),t.isZip64()?(this.write(s.getEightBytes(t.getCompressedSize())),this.write(s.getEightBytes(t.getSize()))):(this.write(s.getLongBytes(t.getCompressedSize())),this.write(s.getLongBytes(t.getSize())))},a.prototype._writeLocalFileHeader=function(t){var e=t.getGeneralPurposeBit(),r=t.getMethod(),n=t.getName(),i=t.getLocalFileDataExtra();t.isZip64()&&(e.useDataDescriptor(!0),t.setVersionNeededToExtract(o.MIN_VERSION_ZIP64)),e.usesUTF8ForNames()&&(n=Buffer.from(n)),t._offsets.file=this.offset,this.write(s.getLongBytes(o.SIG_LFH)),this.write(s.getShortBytes(t.getVersionNeededToExtract())),this.write(e.encode()),this.write(s.getShortBytes(r)),this.write(s.getLongBytes(t.getTimeDos())),t._offsets.data=this.offset,e.usesDataDescriptor()?(this.write(o.LONG_ZERO),this.write(o.LONG_ZERO),this.write(o.LONG_ZERO)):(this.write(s.getLongBytes(t.getCrc())),this.write(s.getLongBytes(t.getCompressedSize())),this.write(s.getLongBytes(t.getSize()))),this.write(s.getShortBytes(n.length)),this.write(s.getShortBytes(i.length)),this.write(n),this.write(i),t._offsets.contents=this.offset},a.prototype.getComment=function(t){return null!==this._archive.comment?this._archive.comment:""},a.prototype.isZip64=function(){return this._archive.forceZip64||this._entries.length>o.ZIP64_MAGIC_SHORT||this._archive.centralLength>o.ZIP64_MAGIC||this._archive.centralOffset>o.ZIP64_MAGIC},a.prototype.setComment=function(t){this._archive.comment=t},Zc.exports}function rl(){return qc?$c:(qc=1,$c={ArchiveEntry:yc(),ZipArchiveEntry:Cc(),ArchiveOutputStream:Ic(),ZipArchiveOutputStream:el()})}
|
|
15
15
|
/**
|
|
16
16
|
* ZipStream
|
|
17
17
|
*
|
|
@@ -25,7 +25,7 @@ import{readFileSync as t,existsSync as e,writeFileSync as r,mkdirSync as n,creat
|
|
|
25
25
|
* @module plugins/zip
|
|
26
26
|
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
|
|
27
27
|
* @copyright (c) 2012-2014 Chris Talkington, contributors.
|
|
28
|
-
*/(),e=sc(),r=function(n){if(!(this instanceof r))return new r(n);n=this.options=e.defaults(n,{comment:"",forceUTC:!1,namePrependSlash:!1,store:!1}),this.supports={directory:!0,symlink:!0},this.engine=new t(n)};return r.prototype.append=function(t,e,r){this.engine.entry(t,e,r)},r.prototype.finalize=function(){this.engine.finalize()},r.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)},r.prototype.pipe=function(){return this.engine.pipe.apply(this.engine,arguments)},r.prototype.unpipe=function(){return this.engine.unpipe.apply(this.engine,arguments)},Vc=r}var il,ol,sl,al,ul,cl,ll,fl,hl,pl,dl,yl,ml,gl,_l,bl,vl={};function wl(){if(cl)return ul;cl=1;const t=al?sl:(al=1,sl=class{constructor(t){if(!(t>0)||t-1&t)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}});return ul=class{constructor(e){this.hwm=e||16,this.head=new t(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(e){if(this.length++,!this.head.push(e)){const r=this.head;this.head=r.next=new t(2*this.head.buffer.length),this.head.push(e)}}shift(){0!==this.length&&this.length--;const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}peek(){const t=this.tail.peek();return void 0===t&&this.tail.next?this.tail.next.peek():t}isEmpty(){return 0===this.length}}}function Sl(){if(fl)return ll;function t(t){return Buffer.isBuffer(t)?t:Buffer.from(t.buffer,t.byteOffset,t.byteLength)}return fl=1,ll={isBuffer:function(t){return Buffer.isBuffer(t)||t instanceof Uint8Array},isEncoding:function(t){return Buffer.isEncoding(t)},alloc:function(t,e,r){return Buffer.alloc(t,e,r)},allocUnsafe:function(t){return Buffer.allocUnsafe(t)},allocUnsafeSlow:function(t){return Buffer.allocUnsafeSlow(t)},byteLength:function(t,e){return Buffer.byteLength(t,e)},compare:function(t,e){return Buffer.compare(t,e)},concat:function(t,e){return Buffer.concat(t,e)},copy:function(e,r,n,i,o){return t(e).copy(r,n,i,o)},equals:function(e,r){return t(e).equals(r)},fill:function(e,r,n,i,o){return t(e).fill(r,n,i,o)},from:function(t,e,r){return Buffer.from(t,e,r)},includes:function(e,r,n,i){return t(e).includes(r,n,i)},indexOf:function(e,r,n,i){return t(e).indexOf(r,n,i)},lastIndexOf:function(e,r,n,i){return t(e).lastIndexOf(r,n,i)},swap16:function(e){return t(e).swap16()},swap32:function(e){return t(e).swap32()},swap64:function(e){return t(e).swap64()},toBuffer:t,toString:function(e,r,n,i){return t(e).toString(r,n,i)},write:function(e,r,n,i,o){return t(e).write(r,n,i,o)},readDoubleBE:function(e,r){return t(e).readDoubleBE(r)},readDoubleLE:function(e,r){return t(e).readDoubleLE(r)},readFloatBE:function(e,r){return t(e).readFloatBE(r)},readFloatLE:function(e,r){return t(e).readFloatLE(r)},readInt32BE:function(e,r){return t(e).readInt32BE(r)},readInt32LE:function(e,r){return t(e).readInt32LE(r)},readUInt32BE:function(e,r){return t(e).readUInt32BE(r)},readUInt32LE:function(e,r){return t(e).readUInt32LE(r)},writeDoubleBE:function(e,r,n){return t(e).writeDoubleBE(r,n)},writeDoubleLE:function(e,r,n){return t(e).writeDoubleLE(r,n)},writeFloatBE:function(e,r,n){return t(e).writeFloatBE(r,n)},writeFloatLE:function(e,r,n){return t(e).writeFloatLE(r,n)},writeInt32BE:function(e,r,n){return t(e).writeInt32BE(r,n)},writeInt32LE:function(e,r,n){return t(e).writeInt32LE(r,n)},writeUInt32BE:function(e,r,n){return t(e).writeUInt32BE(r,n)},writeUInt32LE:function(e,r,n){return t(e).writeUInt32LE(r,n)}},ll}function El(){if(yl)return dl;yl=1;const t=Sl();function e(t,e){const r=t.byteLength;if(r<=e)return 0;const n=Math.max(e,r-4);let i=r-1;for(;i>n&&128==(192&t[i]);)i--;if(i<e)return 0;const o=t[i];let s;if(o<=127)return 0;if(o>=194&&o<=223)s=2;else if(o>=224&&o<=239)s=3;else{if(!(o>=240&&o<=244))return 0;s=4}const a=r-i;return a<s?a:0}return dl=class{constructor(){this._reset()}get remaining(){return this.bytesSeen}decode(r){if(0===r.byteLength)return"";if(0===this.bytesNeeded&&0===e(r,0))return this.bytesSeen=function(t){const e=t.byteLength;if(0===e)return 0;const r=t[e-1];if(r<=127)return 0;if(128!=(192&r))return 1;const n=Math.max(0,e-4);let i=e-2;for(;i>=n&&128==(192&t[i]);)i--;if(i<0)return 1;const o=t[i];let s;if(o>=194&&o<=223)s=2;else if(o>=224&&o<=239)s=3;else{if(!(o>=240&&o<=244))return 1;s=4}if(e-i!==s)return 1;if(s>=3){const e=t[i+1];if(224===o&&e<160)return 1;if(237===o&&e>159)return 1;if(240===o&&e<144)return 1;if(244===o&&e>143)return 1}return 0}(r),t.toString(r,"utf8");let n="",i=0;if(this.bytesNeeded>0){for(;i<r.byteLength;){const t=r[i];if(t<this.lowerBoundary||t>this.upperBoundary){n+="�",this._reset();break}if(this.lowerBoundary=128,this.upperBoundary=191,this.codePoint=this.codePoint<<6|63&t,this.bytesSeen++,i++,this.bytesSeen===this.bytesNeeded){n+=String.fromCodePoint(this.codePoint),this._reset();break}}if(this.bytesNeeded>0)return n}const o=e(r,i),s=r.byteLength-o;s>i&&(n+=t.toString(r,"utf8",i,s));for(let t=s;t<r.byteLength;t++){const e=r[t];0!==this.bytesNeeded?e<this.lowerBoundary||e>this.upperBoundary?(n+="�",t--,this._reset()):(this.lowerBoundary=128,this.upperBoundary=191,this.codePoint=this.codePoint<<6|63&e,this.bytesSeen++,this.bytesSeen===this.bytesNeeded&&(n+=String.fromCodePoint(this.codePoint),this._reset())):e<=127?(this.bytesSeen=0,n+=String.fromCharCode(e)):e>=194&&e<=223?(this.bytesNeeded=2,this.bytesSeen=1,this.codePoint=31&e):e>=224&&e<=239?(224===e?this.lowerBoundary=160:237===e&&(this.upperBoundary=159),this.bytesNeeded=3,this.bytesSeen=1,this.codePoint=15&e):e>=240&&e<=244?(240===e?this.lowerBoundary=144:244===e&&(this.upperBoundary=143),this.bytesNeeded=4,this.bytesSeen=1,this.codePoint=7&e):(this.bytesSeen=1,n+="�")}return n}flush(){const t=this.bytesNeeded>0?"�":"";return this._reset(),t}_reset(){this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0,this.lowerBoundary=128,this.upperBoundary=191}}}function kl(){if(gl)return ml;gl=1;const t=function(){if(pl)return hl;pl=1;const t=Sl();return hl=class{constructor(t){this.encoding=t}get remaining(){return 0}decode(e){return t.toString(e,this.encoding)}flush(){return""}}}(),e=El();return ml=class{constructor(r="utf8"){switch(this.encoding=function(t){switch(t=t.toLowerCase()){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:throw new Error("Unknown encoding: "+t)}}(r),this.encoding){case"utf8":this.decoder=new e;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new t(this.encoding)}}get remaining(){return this.decoder.remaining}push(t){return"string"==typeof t?t:this.decoder.decode(t)}write(t){return this.push(t)}end(t){let e="";return t&&(e=this.push(t)),e+=this.decoder.flush(),e}}}function xl(){if(bl)return _l;bl=1;const{EventEmitter:t}=ol?il:(ol=1,il=d),e=new Error("Stream was destroyed"),r=new Error("Premature close"),n=wl(),i=kl(),o="undefined"==typeof queueMicrotask?t=>I.process.nextTick(t):queueMicrotask,s=536870911,a=1^s,u=2^s,c=32,l=64,f=128,h=256,p=1024,y=2048,m=4096,g=8192,_=16384,b=32768,v=131072,w=131328,S=16^s,E=536805375,k=768^s,x=536838143,T=536739839,O=1<<18,j=2<<18,C=4<<18,R=8<<18,P=16<<18,L=32<<18,F=64<<18,A=128<<18,D=256<<18,M=512<<18,N=1024<<18,B=535822335,U=503316479,z=268435455,W=262160,H=536608751,$=8404992,q=14,G=15,V=8405006,Q=33587200,Z=33587215,K=2359296,J=270794767,Y=Symbol.asyncIterator||Symbol("asyncIterator");class X{constructor(t,{highWaterMark:e=16384,map:r=null,mapWritable:i,byteLength:o,byteLengthWritable:s}={}){this.stream=t,this.queue=new n,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||o||Et,this.map=i||r,this.afterWrite=st.bind(this),this.afterUpdateNextTick=ct.bind(this)}get ended(){return 0!==(this.stream._duplexState&L)}push(t){return!(142606350&this.stream._duplexState)&&(null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),this.buffered<this.highWaterMark?(this.stream._duplexState|=R,!0):(this.stream._duplexState|=6291456,!1))}shift(){const t=this.queue.shift();return this.buffered-=this.byteLength(t),0===this.buffered&&(this.stream._duplexState&=534773759),t}end(t){"function"==typeof t?this.stream.once("finish",t):null!=t&&this.push(t),this.stream._duplexState=(this.stream._duplexState|M)&B}autoBatch(t,e){const r=[],n=this.stream;for(r.push(t);(n._duplexState&J)===K;)r.push(n._writableState.shift());if(0!==(n._duplexState&G))return e(null);n._writev(r,e)}update(){const t=this.stream;t._duplexState|=j;do{for(;(t._duplexState&J)===R;){const e=this.shift();t._duplexState|=67371008,t._write(e,this.afterWrite)}1310720&t._duplexState||this.updateNonPrimary()}while(!0===this.continueUpdate());t._duplexState&=536346623}updateNonPrimary(){const t=this.stream;if((144965647&t._duplexState)===M)return t._duplexState=t._duplexState|O,void t._final(it.bind(this));4!==(t._duplexState&q)?1===(t._duplexState&Z)&&(t._duplexState=(t._duplexState|W)&a,t._open(lt.bind(this))):0===(t._duplexState&Q)&&(t._duplexState|=W,t._destroy(ot.bind(this)))}continueUpdate(){return 0!==(this.stream._duplexState&A)&&(this.stream._duplexState&=U,!0)}updateCallback(){(35127311&this.stream._duplexState)===C?this.update():this.updateNextTick()}updateNextTick(){0===(this.stream._duplexState&A)&&(this.stream._duplexState|=A,0===(this.stream._duplexState&j)&&o(this.afterUpdateNextTick))}}class tt{constructor(t,{highWaterMark:e=16384,map:r=null,mapReadable:i,byteLength:o,byteLengthReadable:s}={}){this.stream=t,this.queue=new n,this.highWaterMark=0===e?1:e,this.buffered=0,this.readAhead=e>0,this.error=null,this.pipeline=null,this.byteLength=s||o||Et,this.map=i||r,this.pipeTo=null,this.afterRead=at.bind(this),this.afterUpdateNextTick=ut.bind(this)}get ended(){return 0!==(this.stream._duplexState&_)}pipe(t,e){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if("function"!=typeof e&&(e=null),this.stream._duplexState|=512,this.pipeTo=t,this.pipeline=new rt(this.stream,t,e),e&&this.stream.on("error",kt),St(t))t._writableState.pipeline=this.pipeline,e&&t.on("error",kt),t.on("finish",this.pipeline.finished.bind(this.pipeline));else{const e=this.pipeline.done.bind(this.pipeline,t),r=this.pipeline.done.bind(this.pipeline,t,null);t.on("error",e),t.on("close",r),t.on("finish",this.pipeline.finished.bind(this.pipeline))}t.on("drain",nt.bind(this)),this.stream.emit("piping",t),t.emit("pipe",this.stream)}push(t){const e=this.stream;return null===t?(this.highWaterMark=0,e._duplexState=536805311&e._duplexState|1024,!1):null!==this.map&&null===(t=this.map(t))?(e._duplexState&=E,this.buffered<this.highWaterMark):(this.buffered+=this.byteLength(t),this.queue.push(t),e._duplexState=(e._duplexState|f)&E,this.buffered<this.highWaterMark)}shift(){const t=this.queue.shift();return this.buffered-=this.byteLength(t),0===this.buffered&&(this.stream._duplexState&=536862591),t}unshift(t){const e=[null!==this.map?this.map(t):t];for(;this.buffered>0;)e.push(this.shift());for(let t=0;t<e.length-1;t++){const r=e[t];this.buffered+=this.byteLength(r),this.queue.push(r)}this.push(e[e.length-1])}read(){const t=this.stream;if((16527&t._duplexState)===f){const e=this.shift();return null!==this.pipeTo&&!1===this.pipeTo.write(e)&&(t._duplexState&=k),0!==(t._duplexState&y)&&t.emit("data",e),e}return!1===this.readAhead&&(t._duplexState|=v,this.updateNextTick()),null}drain(){const t=this.stream;for(;(16527&t._duplexState)===f&&768&t._duplexState;){const e=this.shift();null!==this.pipeTo&&!1===this.pipeTo.write(e)&&(t._duplexState&=k),0!==(t._duplexState&y)&&t.emit("data",e)}}update(){const t=this.stream;t._duplexState|=c;do{for(this.drain();this.buffered<this.highWaterMark&&(214047&t._duplexState)===v;)t._duplexState|=65552,t._read(this.afterRead),this.drain();4224==(12431&t._duplexState)&&(t._duplexState|=g,t.emit("readable")),80&t._duplexState||this.updateNonPrimary()}while(!0===this.continueUpdate());t._duplexState&=536870879}updateNonPrimary(){const t=this.stream;(1167&t._duplexState)===p&&(t._duplexState=536869887&t._duplexState|16384,t.emit("end"),(t._duplexState&V)===$&&(t._duplexState|=4),null!==this.pipeTo&&this.pipeTo.end()),4!==(t._duplexState&q)?1===(t._duplexState&Z)&&(t._duplexState=(t._duplexState|W)&a,t._open(lt.bind(this))):0===(t._duplexState&Q)&&(t._duplexState|=W,t._destroy(ot.bind(this)))}continueUpdate(){return 0!==(this.stream._duplexState&b)&&(this.stream._duplexState&=x,!0)}updateCallback(){(32879&this.stream._duplexState)===l?this.update():this.updateNextTick()}updateNextTickIfOpen(){32769&this.stream._duplexState||(this.stream._duplexState|=b,0===(this.stream._duplexState&c)&&o(this.afterUpdateNextTick))}updateNextTick(){0===(this.stream._duplexState&b)&&(this.stream._duplexState|=b,0===(this.stream._duplexState&c)&&o(this.afterUpdateNextTick))}}class et{constructor(t){this.data=null,this.afterTransform=ft.bind(t),this.afterFinal=null}}class rt{constructor(t,e,r){this.from=t,this.to=e,this.afterPipe=r,this.error=null,this.pipeToFinished=!1}finished(){this.pipeToFinished=!0}done(t,e){e&&(this.error=e),t!==this.to||(this.to=null,null===this.from)?t!==this.from||(this.from=null,null===this.to)?(null!==this.afterPipe&&this.afterPipe(this.error),this.to=this.from=this.afterPipe=null):0===(t._duplexState&_)&&this.to.destroy(this.error||new Error("Readable stream closed before ending")):0!==(this.from._duplexState&_)&&this.pipeToFinished||this.from.destroy(this.error||new Error("Writable stream closed prematurely"))}}function nt(){this.stream._duplexState|=512,this.updateCallback()}function it(t){const e=this.stream;t&&e.destroy(t),0===(e._duplexState&q)&&(e._duplexState|=L,e.emit("finish")),(e._duplexState&V)===$&&(e._duplexState|=4),e._duplexState&=402391039,0===(e._duplexState&j)?this.update():this.updateNextTick()}function ot(t){const r=this.stream;t||this.error===e||(t=this.error),t&&r.emit("error",t),r._duplexState|=8,r.emit("close");const n=r._readableState,i=r._writableState;if(null!==n&&null!==n.pipeline&&n.pipeline.done(r,t),null!==i){for(;null!==i.drains&&i.drains.length>0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(r,t)}}function st(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=469499903,null!==this.drains&&function(t){for(let e=0;e<t.length;e++)0===--t[e].writes&&(t.shift().resolve(!0),e--)}(this.drains),(6553615&e._duplexState)===P&&(e._duplexState&=532676607,(e._duplexState&F)===F&&e.emit("drain")),this.updateCallback()}function at(t){t&&this.stream.destroy(t),this.stream._duplexState&=S,!1===this.readAhead&&0===(this.stream._duplexState&h)&&(this.stream._duplexState&=T),this.updateCallback()}function ut(){0===(this.stream._duplexState&c)&&(this.stream._duplexState&=x,this.update())}function ct(){0===(this.stream._duplexState&j)&&(this.stream._duplexState&=U,this.update())}function lt(t){const e=this.stream;t&&e.destroy(t),4&e._duplexState||(17423&e._duplexState||(e._duplexState|=l),142606351&e._duplexState||(e._duplexState|=C),e.emit("open")),e._duplexState&=H,null!==e._writableState&&e._writableState.updateCallback(),null!==e._readableState&&e._readableState.updateCallback()}function ft(t,e){null!=e&&this.push(e),this._writableState.afterWrite(t)}function ht(t){null!==this._readableState&&("data"===t&&(this._duplexState|=133376,this._readableState.updateNextTick()),"readable"===t&&(this._duplexState|=m,this._readableState.updateNextTick())),null!==this._writableState&&"drain"===t&&(this._duplexState|=F,this._writableState.updateNextTick())}class pt extends t{constructor(t){super(),this._duplexState=0,this._readableState=null,this._writableState=null,t&&(t.open&&(this._open=t.open),t.destroy&&(this._destroy=t.destroy),t.predestroy&&(this._predestroy=t.predestroy),t.signal&&t.signal.addEventListener("abort",xt.bind(this))),this.on("newListener",ht)}_open(t){t(null)}_destroy(t){t(null)}_predestroy(){}get readable(){return null!==this._readableState||void 0}get writable(){return null!==this._writableState||void 0}get destroyed(){return!!(8&this._duplexState)}get destroying(){return 0!==(this._duplexState&q)}destroy(t){0===(this._duplexState&q)&&(t||(t=e),this._duplexState=535822271&this._duplexState|4,null!==this._readableState&&(this._readableState.highWaterMark=0,this._readableState.error=t),null!==this._writableState&&(this._writableState.highWaterMark=0,this._writableState.error=t),this._duplexState|=2,this._predestroy(),this._duplexState&=u,null!==this._readableState&&this._readableState.updateNextTick(),null!==this._writableState&&this._writableState.updateNextTick())}}class dt extends pt{constructor(t){super(t),this._duplexState|=8519681,this._readableState=new tt(this,t),t&&(!1===this._readableState.readAhead&&(this._duplexState&=T),t.read&&(this._read=t.read),t.eagerOpen&&this._readableState.updateNextTick(),t.encoding&&this.setEncoding(t.encoding))}setEncoding(t){const e=new i(t),r=this._readableState.map||vt;return this._readableState.map=function(t){const n=e.push(t);return""===n&&(0!==t.byteLength||e.remaining>0)?null:r(n)},this}_read(t){t(null)}pipe(t,e){return this._readableState.updateNextTick(),this._readableState.pipe(t,e),t}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(t){return this._readableState.updateNextTickIfOpen(),this._readableState.push(t)}unshift(t){return this._readableState.updateNextTickIfOpen(),this._readableState.unshift(t)}resume(){return this._duplexState|=w,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(t,e){let r;const n=new dt({...e,read(e){t.next().then(i).then(e.bind(null,null)).catch(e)},predestroy(){r=t.return()},destroy(t){if(!r)return t(null);r.then(t.bind(null,null)).catch(t)}});return n;function i(t){t.done?n.push(null):n.push(t.value)}}static from(t,e){if(function(t){return St(t)&&t.readable}(t))return t;if(t[Y])return this._fromAsyncIterator(t[Y](),e);Array.isArray(t)||(t=void 0===t?[]:[t]);let r=0;return new dt({...e,read(e){this.push(r===t.length?null:t[r++]),e(null)}})}static isBackpressured(t){return!!(17422&t._duplexState)||t._readableState.buffered>=t._readableState.highWaterMark}static isPaused(t){return 0===(t._duplexState&h)}[Y](){const t=this;let r=null,n=null,i=null;return this.on("error",t=>{r=t}),this.on("readable",function(){null!==n&&o(t.read())}),this.on("close",function(){null!==n&&o(null)}),{[Y](){return this},next:()=>new Promise(function(e,r){n=e,i=r;const s=t.read();null!==s?o(s):8&t._duplexState&&o(null)}),return:()=>s(null),throw:t=>s(t)};function o(o){null!==i&&(r?i(r):null===o&&0===(t._duplexState&_)?i(e):n({value:o,done:null===o}),i=n=null)}function s(e){return t.destroy(e),new Promise((r,n)=>{if(8&t._duplexState)return r({value:void 0,done:!0});t.once("close",function(){e?n(e):r({value:void 0,done:!0})})})}}}class yt extends pt{constructor(t){super(t),this._duplexState|=16385,this._writableState=new X(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final),t.eagerOpen&&this._writableState.updateNextTick())}cork(){this._duplexState|=N}uncork(){this._duplexState&=z,this._writableState.updateNextTick()}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}static isBackpressured(t){return!!(146800654&t._duplexState)}static drained(t){if(t.destroyed)return Promise.resolve(!1);const e=t._writableState;var r;const n=((r=t)._writev!==yt.prototype._writev&&r._writev!==mt.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(t._duplexState&D?1:0);return 0===n?Promise.resolve(!0):(null===e.drains&&(e.drains=[]),new Promise(t=>{e.drains.push({writes:n,resolve:t})}))}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class mt extends dt{constructor(t){super(t),this._duplexState=1|this._duplexState&v,this._writableState=new X(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final))}cork(){this._duplexState|=N}uncork(){this._duplexState&=z,this._writableState.updateNextTick()}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class gt extends mt{constructor(t){super(t),this._transformState=new et(this),t&&(t.transform&&(this._transform=t.transform),t.flush&&(this._flush=t.flush))}_write(t,e){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=t:this._transform(t,this._transformState.afterTransform)}_read(t){if(null!==this._transformState.data){const e=this._transformState.data;this._transformState.data=null,t(null),this._transform(e,this._transformState.afterTransform)}else t(null)}destroy(t){super.destroy(t),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(t,e){e(null,t)}_flush(t){t(null)}_final(t){this._transformState.afterFinal=t,this._flush(_t.bind(this))}}function _t(t,e){const r=this._transformState.afterFinal;if(t)return r(t);null!=e&&this.push(e),this.push(null),r(null)}function bt(t,...e){const n=Array.isArray(t)?[...t,...e]:[t,...e],i=n.length&&"function"==typeof n[n.length-1]?n.pop():null;if(n.length<2)throw new Error("Pipeline requires at least 2 streams");let o=n[0],s=null,a=null;for(let t=1;t<n.length;t++)s=n[t],St(o)?o.pipe(s,c):(u(o,!0,t>1,c),o.pipe(s)),o=s;if(i){let t=!1;const e=St(s)||!(!s._writableState||!s._writableState.autoDestroy);s.on("error",t=>{null===a&&(a=t)}),s.on("finish",()=>{t=!0,e||i(a)}),e&&s.on("close",()=>i(a||(t?null:r)))}return s;function u(t,e,n,i){t.on("error",i),t.on("close",function(){if(t._readableState&&!t._readableState.ended)return i(r);if(n&&t._writableState&&!t._writableState.ended)return i(r)})}function c(t){if(t&&!a){a=t;for(const e of n)e.destroy(t)}}}function vt(t){return t}function wt(t){return!!t._readableState||!!t._writableState}function St(t){return"number"==typeof t._duplexState&&wt(t)}function Et(t){return function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.byteLength}(t)?t.byteLength:1024}function kt(){}function xt(){this.destroy(new Error("Stream aborted."))}return _l={pipeline:bt,pipelinePromise:function(...t){return new Promise((e,r)=>bt(...t,t=>{if(t)return r(t);e()}))},isStream:wt,isStreamx:St,isEnded:function(t){return!!t._readableState&&t._readableState.ended},isFinished:function(t){return!!t._writableState&&t._writableState.ended},isDisturbed:function(t){return!!(1&~t._duplexState)||0!==(t._duplexState&Q)},getStreamError:function(t,r={}){const n=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return r.all||n!==e?n:null},Stream:pt,Writable:yt,Readable:dt,Duplex:mt,Transform:gt,PassThrough:class extends gt{}},_l}var Tl,Ol,jl,Cl={};function Rl(){if(Tl)return Cl;Tl=1;const t=Sl(),e="0".charCodeAt(0),r=t.from([117,115,116,97,114,0]),n=t.from([e,e]),i=t.from([117,115,116,97,114,32]),o=t.from([32,0]),s=257,a=263;function u(t,e,r,n){for(;r<n;r++)if(t[r]===e)return r;return n}function c(t){let e=256;for(let r=0;r<148;r++)e+=t[r];for(let r=156;r<512;r++)e+=t[r];return e}function l(t,e){return(t=t.toString(8)).length>e?"7777777777777777777".slice(0,e)+" ":"0000000000000000000".slice(0,e-t.length)+t+" "}function f(e,r,n){if(128&(e=e.subarray(r,r+n))[r=0])return function(t){let e;if(128===t[0])e=!0;else{if(255!==t[0])return null;e=!1}const r=[];let n;for(n=t.length-1;n>0;n--){const i=t[n];e?r.push(i):r.push(255-i)}let i=0;const o=r.length;for(n=0;n<o;n++)i+=r[n]*Math.pow(256,n);return e?i:-1*i}(e);{for(;r<e.length&&32===e[r];)r++;const n=function(t,e,r){return"number"!=typeof t?r:(t=~~t)>=e?e:t>=0||(t+=e)>=0?t:0}(u(e,32,r,e.length),e.length,e.length);for(;r<n&&0===e[r];)r++;return n===r?0:parseInt(t.toString(e.subarray(r,n)),8)}}function h(e,r,n,i){return t.toString(e.subarray(r,u(e,0,r,r+n)),i)}function p(e){const r=t.byteLength(e);let n=Math.floor(Math.log(r)/Math.log(10))+1;return r+n>=Math.pow(10,n)&&n++,r+n+e}return Cl.decodeLongPath=function(t,e){return h(t,0,t.length,e)},Cl.encodePax=function(e){let r="";e.name&&(r+=p(" path="+e.name+"\n")),e.linkname&&(r+=p(" linkpath="+e.linkname+"\n"));const n=e.pax;if(n)for(const t in n)r+=p(" "+t+"="+n[t]+"\n");return t.from(r)},Cl.decodePax=function(e){const r={};for(;e.length;){let n=0;for(;n<e.length&&32!==e[n];)n++;const i=parseInt(t.toString(e.subarray(0,n)),10);if(!i)return r;const o=t.toString(e.subarray(n+1,i-1)),s=o.indexOf("=");if(-1===s)return r;r[o.slice(0,s)]=o.slice(s+1),e=e.subarray(i)}return r},Cl.encode=function(i){const o=t.alloc(512);let a=i.name,u="";if(5===i.typeflag&&"/"!==a[a.length-1]&&(a+="/"),t.byteLength(a)!==a.length)return null;for(;t.byteLength(a)>100;){const t=a.indexOf("/");if(-1===t)return null;u+=u?"/"+a.slice(0,t):a.slice(0,t),a=a.slice(t+1)}return t.byteLength(a)>100||t.byteLength(u)>155||i.linkname&&t.byteLength(i.linkname)>100?null:(t.write(o,a),t.write(o,l(4095&i.mode,6),100),t.write(o,l(i.uid,6),108),t.write(o,l(i.gid,6),116),function(e,r,n){e.toString(8).length>11?function(t,e,r){e[r]=128;for(let n=11;n>0;n--)e[r+n]=255&t,t=Math.floor(t/256)}(e,r,n):t.write(r,l(e,11),n)}(i.size,o,124),t.write(o,l(i.mtime.getTime()/1e3|0,11),136),o[156]=e+function(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(i.type),i.linkname&&t.write(o,i.linkname,157),t.copy(r,o,s),t.copy(n,o,263),i.uname&&t.write(o,i.uname,265),i.gname&&t.write(o,i.gname,297),t.write(o,l(i.devmajor||0,6),329),t.write(o,l(i.devminor||0,6),337),u&&t.write(o,u,345),t.write(o,l(c(o),6),148),o)},Cl.decode=function(n,u,l){let p=0===n[156]?0:n[156]-e,d=h(n,0,100,u);const y=f(n,100,8),m=f(n,108,8),g=f(n,116,8),_=f(n,124,12),b=f(n,136,12),v=function(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(p),w=0===n[157]?null:h(n,157,100,u),S=h(n,265,32),E=h(n,297,32),k=f(n,329,8),x=f(n,337,8),T=c(n);if(256===T)return null;if(T!==f(n,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(function(e){return t.equals(r,e.subarray(s,263))}(n))n[345]&&(d=h(n,345,155,u)+"/"+d);else if(function(e){return t.equals(i,e.subarray(s,263))&&t.equals(o,e.subarray(a,265))}(n));else if(!l)throw new Error("Invalid tar header: unknown format.");return 0===p&&d&&"/"===d[d.length-1]&&(p=5),{name:d,mode:y,uid:m,gid:g,size:_,mtime:new Date(1e3*b),type:v,linkname:w,uname:S,gname:E,devmajor:k,devminor:x,pax:null}},Cl}var Pl,Ll,Fl,Al,Il,Dl,Ml,Nl,Bl,Ul,zl,Wl,Hl={exports:{}};function $l(){if(Pl)return Hl.exports;Pl=1;const t={S_IFMT:61440,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960};try{Hl.exports=require("fs").constants||t}catch{Hl.exports=t}return Hl.exports}function ql(){if(Fl)return Ll;Fl=1;const{Readable:t,Writable:e,getStreamError:r}=xl(),n=Sl(),i=$l(),o=Rl(),s=n.alloc(1024);class a extends e{constructor(t,e,r){super({mapWritable:f,eagerOpen:!0}),this.written=0,this.header=e,this._callback=r,this._linkname=null,this._isLinkname="symlink"===e.type&&!e.linkname,this._isVoid="file"!==e.type&&"contiguous-file"!==e.type,this._finished=!1,this._pack=t,this._openCallback=null,null===this._pack._stream?this._pack._stream=this:this._pack._pending.push(this)}_open(t){this._openCallback=t,this._pack._stream===this&&this._continueOpen()}_continuePack(t){if(null===this._callback)return;const e=this._callback;this._callback=null,e(t)}_continueOpen(){null===this._pack._stream&&(this._pack._stream=this);const t=this._openCallback;if(this._openCallback=null,null!==t){if(this._pack.destroying)return t(new Error("pack stream destroyed"));if(this._pack._finalized)return t(new Error("pack stream is already finalized"));this._pack._stream=this,this._isLinkname||this._pack._encode(this.header),this._isVoid&&(this._finish(),this._continuePack(null)),t(null)}}_write(t,e){return this._isLinkname?(this._linkname=this._linkname?n.concat([this._linkname,t]):t,e(null)):this._isVoid?t.byteLength>0?e(new Error("No body allowed for this entry")):e():(this.written+=t.byteLength,this._pack.push(t)?e():void(this._pack._drain=e))}_finish(){this._finished||(this._finished=!0,this._isLinkname&&(this.header.linkname=this._linkname?n.toString(this._linkname,"utf-8"):"",this._pack._encode(this.header)),l(this._pack,this.header.size),this._pack._done(this))}_final(t){if(this.written!==this.header.size)return t(new Error("Size mismatch"));this._finish(),t(null)}_getError(){return r(this)||new Error("tar entry destroyed")}_predestroy(){this._pack.destroy(this._getError())}_destroy(t){this._pack._done(this),this._continuePack(this._finished?null:this._getError()),t()}}class u extends t{constructor(t){super(t),this._drain=c,this._finalized=!1,this._finalizing=!1,this._pending=[],this._stream=null}entry(t,e,r){if(this._finalized||this.destroying)throw new Error("already finalized or destroyed");"function"==typeof e&&(r=e,e=null),r||(r=c),t.size&&"symlink"!==t.type||(t.size=0),t.type||(t.type=function(t){switch(t&i.S_IFMT){case i.S_IFBLK:return"block-device";case i.S_IFCHR:return"character-device";case i.S_IFDIR:return"directory";case i.S_IFIFO:return"fifo";case i.S_IFLNK:return"symlink"}return"file"}(t.mode)),t.mode||(t.mode="directory"===t.type?493:420),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),"string"==typeof e&&(e=n.from(e));const o=new a(this,t,r);return n.isBuffer(e)?(t.size=e.byteLength,o.write(e),o.end(),o):(o._isVoid,o)}finalize(){this._stream||this._pending.length>0?this._finalizing=!0:this._finalized||(this._finalized=!0,this.push(s),this.push(null))}_done(t){t===this._stream&&(this._stream=null,this._finalizing&&this.finalize(),this._pending.length&&this._pending.shift()._continueOpen())}_encode(t){if(!t.pax){const e=o.encode(t);if(e)return void this.push(e)}this._encodePax(t)}_encodePax(t){const e=o.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:e.byteLength,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(o.encode(r)),this.push(e),l(this,e.byteLength),r.size=t.size,r.type=t.type,this.push(o.encode(r))}_doDrain(){const t=this._drain;this._drain=c,t()}_predestroy(){const t=r(this);for(this._stream&&this._stream.destroy(t);this._pending.length;){const e=this._pending.shift();e.destroy(t),e._continueOpen()}this._doDrain()}_read(t){this._doDrain(),t()}}function c(){}function l(t,e){(e&=511)&&t.push(s.subarray(0,512-e))}function f(t){return n.isBuffer(t)?t:n.from(t)}return Ll=function(t){return new u(t)}}function Gl(){return Al||(Al=1,vl.extract=function(){if(jl)return Ol;jl=1;const{Writable:t,Readable:e,getStreamError:r}=xl(),n=wl(),i=Sl(),o=Rl(),s=i.alloc(0);class a{constructor(){this.buffered=0,this.shifted=0,this.queue=new n,this._offset=0}push(t){this.buffered+=t.byteLength,this.queue.push(t)}shiftFirst(t){return 0===this._buffered?null:this._next(t)}shift(t){if(t>this.buffered)return null;if(0===t)return s;let e=this._next(t);if(t===e.byteLength)return e;const r=[e];for(;(t-=e.byteLength)>0;)e=this._next(t),r.push(e);return i.concat(r)}_next(t){const e=this.queue.peek(),r=e.byteLength-this._offset;if(t>=r){const t=this._offset?e.subarray(this._offset,e.byteLength):e;return this.queue.shift(),this._offset=0,this.buffered-=r,this.shifted+=r,t}return this.buffered-=t,this.shifted+=t,e.subarray(this._offset,this._offset+=t)}}class u extends e{constructor(t,e,r){super(),this.header=e,this.offset=r,this._parent=t}_read(t){0===this.header.size&&this.push(null),this._parent._stream===this&&this._parent._update(),t(null)}_predestroy(){this._parent.destroy(r(this))}_detach(){this._parent._stream===this&&(this._parent._stream=null,this._parent._missing=f(this.header.size),this._parent._update())}_destroy(t){this._detach(),t(null)}}class c extends t{constructor(t){super(t),t||(t={}),this._buffer=new a,this._offset=0,this._header=null,this._stream=null,this._missing=0,this._longHeader=!1,this._callback=l,this._locked=!1,this._finished=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null,this._filenameEncoding=t.filenameEncoding||"utf-8",this._allowUnknownFormat=!!t.allowUnknownFormat,this._unlockBound=this._unlock.bind(this)}_unlock(t){if(this._locked=!1,t)return this.destroy(t),void this._continueWrite(t);this._update()}_consumeHeader(){if(this._locked)return!1;this._offset=this._buffer.shifted;try{this._header=o.decode(this._buffer.shift(512),this._filenameEncoding,this._allowUnknownFormat)}catch(t){return this._continueWrite(t),!1}if(!this._header)return!0;switch(this._header.type){case"gnu-long-path":case"gnu-long-link-path":case"pax-global-header":case"pax-header":return this._longHeader=!0,this._missing=this._header.size,!0}return this._locked=!0,this._applyLongHeaders(),0===this._header.size||"directory"===this._header.type?(this.emit("entry",this._header,this._createStream(),this._unlockBound),!0):(this._stream=this._createStream(),this._missing=this._header.size,this.emit("entry",this._header,this._stream,this._unlockBound),!0)}_applyLongHeaders(){this._gnuLongPath&&(this._header.name=this._gnuLongPath,this._gnuLongPath=null),this._gnuLongLinkPath&&(this._header.linkname=this._gnuLongLinkPath,this._gnuLongLinkPath=null),this._pax&&(this._pax.path&&(this._header.name=this._pax.path),this._pax.linkpath&&(this._header.linkname=this._pax.linkpath),this._pax.size&&(this._header.size=parseInt(this._pax.size,10)),this._header.pax=this._pax,this._pax=null)}_decodeLongHeader(t){switch(this._header.type){case"gnu-long-path":this._gnuLongPath=o.decodeLongPath(t,this._filenameEncoding);break;case"gnu-long-link-path":this._gnuLongLinkPath=o.decodeLongPath(t,this._filenameEncoding);break;case"pax-global-header":this._paxGlobal=o.decodePax(t);break;case"pax-header":this._pax=null===this._paxGlobal?o.decodePax(t):Object.assign({},this._paxGlobal,o.decodePax(t))}}_consumeLongHeader(){this._longHeader=!1,this._missing=f(this._header.size);const t=this._buffer.shift(this._header.size);try{this._decodeLongHeader(t)}catch(t){return this._continueWrite(t),!1}return!0}_consumeStream(){const t=this._buffer.shiftFirst(this._missing);if(null===t)return!1;this._missing-=t.byteLength;const e=this._stream.push(t);return 0===this._missing?(this._stream.push(null),e&&this._stream._detach(),e&&!1===this._locked):e}_createStream(){return new u(this,this._header,this._offset)}_update(){for(;this._buffer.buffered>0&&!this.destroying;){if(this._missing>0){if(null!==this._stream){if(!1===this._consumeStream())return;continue}if(!0===this._longHeader){if(this._missing>this._buffer.buffered)break;if(!1===this._consumeLongHeader())return!1;continue}const t=this._buffer.shiftFirst(this._missing);null!==t&&(this._missing-=t.byteLength);continue}if(this._buffer.buffered<512)break;if(null!==this._stream||!1===this._consumeHeader())return}this._continueWrite(null)}_continueWrite(t){const e=this._callback;this._callback=l,e(t)}_write(t,e){this._callback=e,this._buffer.push(t),this._update()}_final(t){this._finished=0===this._missing&&0===this._buffer.buffered,t(this._finished?null:new Error("Unexpected end of data"))}_predestroy(){this._continueWrite(null)}_destroy(t){this._stream&&this._stream.destroy(r(this)),t(null)}[Symbol.asyncIterator](){let t=null,e=null,r=null,n=null,i=null;const o=this;return this.on("entry",function(t,o,s){i=s,o.on("error",l),e?(e({value:o,done:!1}),e=r=null):n=o}),this.on("error",e=>{t=e}),this.on("close",function(){s(t),e&&(t?r(t):e({value:void 0,done:!0}),e=r=null)}),{[Symbol.asyncIterator](){return this},next:()=>new Promise(a),return:()=>u(null),throw:t=>u(t)};function s(t){if(!i)return;const e=i;i=null,e(t)}function a(i,a){return t?a(t):n?(i({value:n,done:!1}),void(n=null)):(e=i,r=a,s(null),void(o._finished&&e&&(e({value:void 0,done:!0}),e=r=null)))}function u(t){return o.destroy(t),s(t),new Promise((e,r)=>{if(o.destroyed)return e({value:void 0,done:!0});o.once("close",function(){t?r(t):e({value:void 0,done:!0})})})}}}function l(){}function f(t){return(t&=511)&&512-t}return Ol=function(t){return new c(t)}}(),vl.pack=ql()),vl}
|
|
28
|
+
*/(),e=sc(),r=function(n){if(!(this instanceof r))return new r(n);n=this.options=e.defaults(n,{comment:"",forceUTC:!1,namePrependSlash:!1,store:!1}),this.supports={directory:!0,symlink:!0},this.engine=new t(n)};return r.prototype.append=function(t,e,r){this.engine.entry(t,e,r)},r.prototype.finalize=function(){this.engine.finalize()},r.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)},r.prototype.pipe=function(){return this.engine.pipe.apply(this.engine,arguments)},r.prototype.unpipe=function(){return this.engine.unpipe.apply(this.engine,arguments)},Vc=r}var il,ol,sl,al,ul,cl,ll,fl,hl,pl,dl,yl,ml,gl,_l,bl,vl={};function wl(){if(cl)return ul;cl=1;const t=al?sl:(al=1,sl=class{constructor(t){if(!(t>0)||t-1&t)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0)}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}});return ul=class{constructor(e){this.hwm=e||16,this.head=new t(this.hwm),this.tail=this.head,this.length=0}clear(){this.head=this.tail,this.head.clear(),this.length=0}push(e){if(this.length++,!this.head.push(e)){const r=this.head;this.head=r.next=new t(2*this.head.buffer.length),this.head.push(e)}}shift(){0!==this.length&&this.length--;const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}peek(){const t=this.tail.peek();return void 0===t&&this.tail.next?this.tail.next.peek():t}isEmpty(){return 0===this.length}}}function Sl(){if(fl)return ll;function t(t){return Buffer.isBuffer(t)?t:Buffer.from(t.buffer,t.byteOffset,t.byteLength)}return fl=1,ll={isBuffer:function(t){return Buffer.isBuffer(t)||t instanceof Uint8Array},isEncoding:function(t){return Buffer.isEncoding(t)},alloc:function(t,e,r){return Buffer.alloc(t,e,r)},allocUnsafe:function(t){return Buffer.allocUnsafe(t)},allocUnsafeSlow:function(t){return Buffer.allocUnsafeSlow(t)},byteLength:function(t,e){return Buffer.byteLength(t,e)},compare:function(t,e){return Buffer.compare(t,e)},concat:function(t,e){return Buffer.concat(t,e)},copy:function(e,r,n,i,o){return t(e).copy(r,n,i,o)},equals:function(e,r){return t(e).equals(r)},fill:function(e,r,n,i,o){return t(e).fill(r,n,i,o)},from:function(t,e,r){return Buffer.from(t,e,r)},includes:function(e,r,n,i){return t(e).includes(r,n,i)},indexOf:function(e,r,n,i){return t(e).indexOf(r,n,i)},lastIndexOf:function(e,r,n,i){return t(e).lastIndexOf(r,n,i)},swap16:function(e){return t(e).swap16()},swap32:function(e){return t(e).swap32()},swap64:function(e){return t(e).swap64()},toBuffer:t,toString:function(e,r,n,i){return t(e).toString(r,n,i)},write:function(e,r,n,i,o){return t(e).write(r,n,i,o)},readDoubleBE:function(e,r){return t(e).readDoubleBE(r)},readDoubleLE:function(e,r){return t(e).readDoubleLE(r)},readFloatBE:function(e,r){return t(e).readFloatBE(r)},readFloatLE:function(e,r){return t(e).readFloatLE(r)},readInt32BE:function(e,r){return t(e).readInt32BE(r)},readInt32LE:function(e,r){return t(e).readInt32LE(r)},readUInt32BE:function(e,r){return t(e).readUInt32BE(r)},readUInt32LE:function(e,r){return t(e).readUInt32LE(r)},writeDoubleBE:function(e,r,n){return t(e).writeDoubleBE(r,n)},writeDoubleLE:function(e,r,n){return t(e).writeDoubleLE(r,n)},writeFloatBE:function(e,r,n){return t(e).writeFloatBE(r,n)},writeFloatLE:function(e,r,n){return t(e).writeFloatLE(r,n)},writeInt32BE:function(e,r,n){return t(e).writeInt32BE(r,n)},writeInt32LE:function(e,r,n){return t(e).writeInt32LE(r,n)},writeUInt32BE:function(e,r,n){return t(e).writeUInt32BE(r,n)},writeUInt32LE:function(e,r,n){return t(e).writeUInt32LE(r,n)}},ll}function El(){if(yl)return dl;yl=1;const t=Sl();function e(t,e){const r=t.byteLength;if(r<=e)return 0;const n=Math.max(e,r-4);let i=r-1;for(;i>n&&128==(192&t[i]);)i--;if(i<e)return 0;const o=t[i];let s;if(o<=127)return 0;if(o>=194&&o<=223)s=2;else if(o>=224&&o<=239)s=3;else{if(!(o>=240&&o<=244))return 0;s=4}const a=r-i;return a<s?a:0}return dl=class{constructor(){this._reset()}get remaining(){return this.bytesSeen}decode(r){if(0===r.byteLength)return"";if(0===this.bytesNeeded&&0===e(r,0))return this.bytesSeen=function(t){const e=t.byteLength;if(0===e)return 0;const r=t[e-1];if(r<=127)return 0;if(128!=(192&r))return 1;const n=Math.max(0,e-4);let i=e-2;for(;i>=n&&128==(192&t[i]);)i--;if(i<0)return 1;const o=t[i];let s;if(o>=194&&o<=223)s=2;else if(o>=224&&o<=239)s=3;else{if(!(o>=240&&o<=244))return 1;s=4}if(e-i!==s)return 1;if(s>=3){const e=t[i+1];if(224===o&&e<160)return 1;if(237===o&&e>159)return 1;if(240===o&&e<144)return 1;if(244===o&&e>143)return 1}return 0}(r),t.toString(r,"utf8");let n="",i=0;if(this.bytesNeeded>0){for(;i<r.byteLength;){const t=r[i];if(t<this.lowerBoundary||t>this.upperBoundary){n+="�",this._reset();break}if(this.lowerBoundary=128,this.upperBoundary=191,this.codePoint=this.codePoint<<6|63&t,this.bytesSeen++,i++,this.bytesSeen===this.bytesNeeded){n+=String.fromCodePoint(this.codePoint),this._reset();break}}if(this.bytesNeeded>0)return n}const o=e(r,i),s=r.byteLength-o;s>i&&(n+=t.toString(r,"utf8",i,s));for(let t=s;t<r.byteLength;t++){const e=r[t];0!==this.bytesNeeded?e<this.lowerBoundary||e>this.upperBoundary?(n+="�",t--,this._reset()):(this.lowerBoundary=128,this.upperBoundary=191,this.codePoint=this.codePoint<<6|63&e,this.bytesSeen++,this.bytesSeen===this.bytesNeeded&&(n+=String.fromCodePoint(this.codePoint),this._reset())):e<=127?(this.bytesSeen=0,n+=String.fromCharCode(e)):e>=194&&e<=223?(this.bytesNeeded=2,this.bytesSeen=1,this.codePoint=31&e):e>=224&&e<=239?(224===e?this.lowerBoundary=160:237===e&&(this.upperBoundary=159),this.bytesNeeded=3,this.bytesSeen=1,this.codePoint=15&e):e>=240&&e<=244?(240===e?this.lowerBoundary=144:244===e&&(this.upperBoundary=143),this.bytesNeeded=4,this.bytesSeen=1,this.codePoint=7&e):(this.bytesSeen=1,n+="�")}return n}flush(){const t=this.bytesNeeded>0?"�":"";return this._reset(),t}_reset(){this.codePoint=0,this.bytesNeeded=0,this.bytesSeen=0,this.lowerBoundary=128,this.upperBoundary=191}}}function kl(){if(gl)return ml;gl=1;const t=function(){if(pl)return hl;pl=1;const t=Sl();return hl=class{constructor(t){this.encoding=t}get remaining(){return 0}decode(e){return t.toString(e,this.encoding)}flush(){return""}}}(),e=El();return ml=class{constructor(r="utf8"){switch(this.encoding=function(t){switch(t=t.toLowerCase()){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:throw new Error("Unknown encoding: "+t)}}(r),this.encoding){case"utf8":this.decoder=new e;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new t(this.encoding)}}get remaining(){return this.decoder.remaining}push(t){return"string"==typeof t?t:this.decoder.decode(t)}write(t){return this.push(t)}end(t){let e="";return t&&(e=this.push(t)),e+=this.decoder.flush(),e}}}function xl(){if(bl)return _l;bl=1;const{EventEmitter:t}=ol?il:(ol=1,il=d),e=new Error("Stream was destroyed"),r=new Error("Premature close"),n=wl(),i=kl(),o="undefined"==typeof queueMicrotask?t=>I.process.nextTick(t):queueMicrotask,s=536870911,a=1^s,u=2^s,c=32,l=64,f=128,h=256,p=1024,y=2048,m=4096,g=8192,_=16384,b=32768,v=131072,w=131328,S=16^s,E=536805375,k=768^s,x=536838143,O=536739839,T=1<<18,j=2<<18,C=4<<18,R=8<<18,P=16<<18,L=32<<18,F=64<<18,A=128<<18,D=256<<18,M=512<<18,N=1024<<18,B=535822335,U=503316479,z=268435455,W=262160,H=536608751,$=8404992,q=14,G=15,V=8405006,Q=33587200,Z=33587215,K=2359296,J=270794767,Y=Symbol.asyncIterator||Symbol("asyncIterator");class X{constructor(t,{highWaterMark:e=16384,map:r=null,mapWritable:i,byteLength:o,byteLengthWritable:s}={}){this.stream=t,this.queue=new n,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||o||Et,this.map=i||r,this.afterWrite=st.bind(this),this.afterUpdateNextTick=ct.bind(this)}get ended(){return 0!==(this.stream._duplexState&L)}push(t){return!(142606350&this.stream._duplexState)&&(null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),this.buffered<this.highWaterMark?(this.stream._duplexState|=R,!0):(this.stream._duplexState|=6291456,!1))}shift(){const t=this.queue.shift();return this.buffered-=this.byteLength(t),0===this.buffered&&(this.stream._duplexState&=534773759),t}end(t){"function"==typeof t?this.stream.once("finish",t):null!=t&&this.push(t),this.stream._duplexState=(this.stream._duplexState|M)&B}autoBatch(t,e){const r=[],n=this.stream;for(r.push(t);(n._duplexState&J)===K;)r.push(n._writableState.shift());if(0!==(n._duplexState&G))return e(null);n._writev(r,e)}update(){const t=this.stream;t._duplexState|=j;do{for(;(t._duplexState&J)===R;){const e=this.shift();t._duplexState|=67371008,t._write(e,this.afterWrite)}1310720&t._duplexState||this.updateNonPrimary()}while(!0===this.continueUpdate());t._duplexState&=536346623}updateNonPrimary(){const t=this.stream;if((144965647&t._duplexState)===M)return t._duplexState=t._duplexState|T,void t._final(it.bind(this));4!==(t._duplexState&q)?1===(t._duplexState&Z)&&(t._duplexState=(t._duplexState|W)&a,t._open(lt.bind(this))):0===(t._duplexState&Q)&&(t._duplexState|=W,t._destroy(ot.bind(this)))}continueUpdate(){return 0!==(this.stream._duplexState&A)&&(this.stream._duplexState&=U,!0)}updateCallback(){(35127311&this.stream._duplexState)===C?this.update():this.updateNextTick()}updateNextTick(){0===(this.stream._duplexState&A)&&(this.stream._duplexState|=A,0===(this.stream._duplexState&j)&&o(this.afterUpdateNextTick))}}class tt{constructor(t,{highWaterMark:e=16384,map:r=null,mapReadable:i,byteLength:o,byteLengthReadable:s}={}){this.stream=t,this.queue=new n,this.highWaterMark=0===e?1:e,this.buffered=0,this.readAhead=e>0,this.error=null,this.pipeline=null,this.byteLength=s||o||Et,this.map=i||r,this.pipeTo=null,this.afterRead=at.bind(this),this.afterUpdateNextTick=ut.bind(this)}get ended(){return 0!==(this.stream._duplexState&_)}pipe(t,e){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if("function"!=typeof e&&(e=null),this.stream._duplexState|=512,this.pipeTo=t,this.pipeline=new rt(this.stream,t,e),e&&this.stream.on("error",kt),St(t))t._writableState.pipeline=this.pipeline,e&&t.on("error",kt),t.on("finish",this.pipeline.finished.bind(this.pipeline));else{const e=this.pipeline.done.bind(this.pipeline,t),r=this.pipeline.done.bind(this.pipeline,t,null);t.on("error",e),t.on("close",r),t.on("finish",this.pipeline.finished.bind(this.pipeline))}t.on("drain",nt.bind(this)),this.stream.emit("piping",t),t.emit("pipe",this.stream)}push(t){const e=this.stream;return null===t?(this.highWaterMark=0,e._duplexState=536805311&e._duplexState|1024,!1):null!==this.map&&null===(t=this.map(t))?(e._duplexState&=E,this.buffered<this.highWaterMark):(this.buffered+=this.byteLength(t),this.queue.push(t),e._duplexState=(e._duplexState|f)&E,this.buffered<this.highWaterMark)}shift(){const t=this.queue.shift();return this.buffered-=this.byteLength(t),0===this.buffered&&(this.stream._duplexState&=536862591),t}unshift(t){const e=[null!==this.map?this.map(t):t];for(;this.buffered>0;)e.push(this.shift());for(let t=0;t<e.length-1;t++){const r=e[t];this.buffered+=this.byteLength(r),this.queue.push(r)}this.push(e[e.length-1])}read(){const t=this.stream;if((16527&t._duplexState)===f){const e=this.shift();return null!==this.pipeTo&&!1===this.pipeTo.write(e)&&(t._duplexState&=k),0!==(t._duplexState&y)&&t.emit("data",e),e}return!1===this.readAhead&&(t._duplexState|=v,this.updateNextTick()),null}drain(){const t=this.stream;for(;(16527&t._duplexState)===f&&768&t._duplexState;){const e=this.shift();null!==this.pipeTo&&!1===this.pipeTo.write(e)&&(t._duplexState&=k),0!==(t._duplexState&y)&&t.emit("data",e)}}update(){const t=this.stream;t._duplexState|=c;do{for(this.drain();this.buffered<this.highWaterMark&&(214047&t._duplexState)===v;)t._duplexState|=65552,t._read(this.afterRead),this.drain();4224==(12431&t._duplexState)&&(t._duplexState|=g,t.emit("readable")),80&t._duplexState||this.updateNonPrimary()}while(!0===this.continueUpdate());t._duplexState&=536870879}updateNonPrimary(){const t=this.stream;(1167&t._duplexState)===p&&(t._duplexState=536869887&t._duplexState|16384,t.emit("end"),(t._duplexState&V)===$&&(t._duplexState|=4),null!==this.pipeTo&&this.pipeTo.end()),4!==(t._duplexState&q)?1===(t._duplexState&Z)&&(t._duplexState=(t._duplexState|W)&a,t._open(lt.bind(this))):0===(t._duplexState&Q)&&(t._duplexState|=W,t._destroy(ot.bind(this)))}continueUpdate(){return 0!==(this.stream._duplexState&b)&&(this.stream._duplexState&=x,!0)}updateCallback(){(32879&this.stream._duplexState)===l?this.update():this.updateNextTick()}updateNextTickIfOpen(){32769&this.stream._duplexState||(this.stream._duplexState|=b,0===(this.stream._duplexState&c)&&o(this.afterUpdateNextTick))}updateNextTick(){0===(this.stream._duplexState&b)&&(this.stream._duplexState|=b,0===(this.stream._duplexState&c)&&o(this.afterUpdateNextTick))}}class et{constructor(t){this.data=null,this.afterTransform=ft.bind(t),this.afterFinal=null}}class rt{constructor(t,e,r){this.from=t,this.to=e,this.afterPipe=r,this.error=null,this.pipeToFinished=!1}finished(){this.pipeToFinished=!0}done(t,e){e&&(this.error=e),t!==this.to||(this.to=null,null===this.from)?t!==this.from||(this.from=null,null===this.to)?(null!==this.afterPipe&&this.afterPipe(this.error),this.to=this.from=this.afterPipe=null):0===(t._duplexState&_)&&this.to.destroy(this.error||new Error("Readable stream closed before ending")):0!==(this.from._duplexState&_)&&this.pipeToFinished||this.from.destroy(this.error||new Error("Writable stream closed prematurely"))}}function nt(){this.stream._duplexState|=512,this.updateCallback()}function it(t){const e=this.stream;t&&e.destroy(t),0===(e._duplexState&q)&&(e._duplexState|=L,e.emit("finish")),(e._duplexState&V)===$&&(e._duplexState|=4),e._duplexState&=402391039,0===(e._duplexState&j)?this.update():this.updateNextTick()}function ot(t){const r=this.stream;t||this.error===e||(t=this.error),t&&r.emit("error",t),r._duplexState|=8,r.emit("close");const n=r._readableState,i=r._writableState;if(null!==n&&null!==n.pipeline&&n.pipeline.done(r,t),null!==i){for(;null!==i.drains&&i.drains.length>0;)i.drains.shift().resolve(!1);null!==i.pipeline&&i.pipeline.done(r,t)}}function st(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=469499903,null!==this.drains&&function(t){for(let e=0;e<t.length;e++)0===--t[e].writes&&(t.shift().resolve(!0),e--)}(this.drains),(6553615&e._duplexState)===P&&(e._duplexState&=532676607,(e._duplexState&F)===F&&e.emit("drain")),this.updateCallback()}function at(t){t&&this.stream.destroy(t),this.stream._duplexState&=S,!1===this.readAhead&&0===(this.stream._duplexState&h)&&(this.stream._duplexState&=O),this.updateCallback()}function ut(){0===(this.stream._duplexState&c)&&(this.stream._duplexState&=x,this.update())}function ct(){0===(this.stream._duplexState&j)&&(this.stream._duplexState&=U,this.update())}function lt(t){const e=this.stream;t&&e.destroy(t),4&e._duplexState||(17423&e._duplexState||(e._duplexState|=l),142606351&e._duplexState||(e._duplexState|=C),e.emit("open")),e._duplexState&=H,null!==e._writableState&&e._writableState.updateCallback(),null!==e._readableState&&e._readableState.updateCallback()}function ft(t,e){null!=e&&this.push(e),this._writableState.afterWrite(t)}function ht(t){null!==this._readableState&&("data"===t&&(this._duplexState|=133376,this._readableState.updateNextTick()),"readable"===t&&(this._duplexState|=m,this._readableState.updateNextTick())),null!==this._writableState&&"drain"===t&&(this._duplexState|=F,this._writableState.updateNextTick())}class pt extends t{constructor(t){super(),this._duplexState=0,this._readableState=null,this._writableState=null,t&&(t.open&&(this._open=t.open),t.destroy&&(this._destroy=t.destroy),t.predestroy&&(this._predestroy=t.predestroy),t.signal&&t.signal.addEventListener("abort",xt.bind(this))),this.on("newListener",ht)}_open(t){t(null)}_destroy(t){t(null)}_predestroy(){}get readable(){return null!==this._readableState||void 0}get writable(){return null!==this._writableState||void 0}get destroyed(){return!!(8&this._duplexState)}get destroying(){return 0!==(this._duplexState&q)}destroy(t){0===(this._duplexState&q)&&(t||(t=e),this._duplexState=535822271&this._duplexState|4,null!==this._readableState&&(this._readableState.highWaterMark=0,this._readableState.error=t),null!==this._writableState&&(this._writableState.highWaterMark=0,this._writableState.error=t),this._duplexState|=2,this._predestroy(),this._duplexState&=u,null!==this._readableState&&this._readableState.updateNextTick(),null!==this._writableState&&this._writableState.updateNextTick())}}class dt extends pt{constructor(t){super(t),this._duplexState|=8519681,this._readableState=new tt(this,t),t&&(!1===this._readableState.readAhead&&(this._duplexState&=O),t.read&&(this._read=t.read),t.eagerOpen&&this._readableState.updateNextTick(),t.encoding&&this.setEncoding(t.encoding))}setEncoding(t){const e=new i(t),r=this._readableState.map||vt;return this._readableState.map=function(t){const n=e.push(t);return""===n&&(0!==t.byteLength||e.remaining>0)?null:r(n)},this}_read(t){t(null)}pipe(t,e){return this._readableState.updateNextTick(),this._readableState.pipe(t,e),t}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(t){return this._readableState.updateNextTickIfOpen(),this._readableState.push(t)}unshift(t){return this._readableState.updateNextTickIfOpen(),this._readableState.unshift(t)}resume(){return this._duplexState|=w,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(t,e){let r;const n=new dt({...e,read(e){t.next().then(i).then(e.bind(null,null)).catch(e)},predestroy(){r=t.return()},destroy(t){if(!r)return t(null);r.then(t.bind(null,null)).catch(t)}});return n;function i(t){t.done?n.push(null):n.push(t.value)}}static from(t,e){if(function(t){return St(t)&&t.readable}(t))return t;if(t[Y])return this._fromAsyncIterator(t[Y](),e);Array.isArray(t)||(t=void 0===t?[]:[t]);let r=0;return new dt({...e,read(e){this.push(r===t.length?null:t[r++]),e(null)}})}static isBackpressured(t){return!!(17422&t._duplexState)||t._readableState.buffered>=t._readableState.highWaterMark}static isPaused(t){return 0===(t._duplexState&h)}[Y](){const t=this;let r=null,n=null,i=null;return this.on("error",t=>{r=t}),this.on("readable",function(){null!==n&&o(t.read())}),this.on("close",function(){null!==n&&o(null)}),{[Y](){return this},next:()=>new Promise(function(e,r){n=e,i=r;const s=t.read();null!==s?o(s):8&t._duplexState&&o(null)}),return:()=>s(null),throw:t=>s(t)};function o(o){null!==i&&(r?i(r):null===o&&0===(t._duplexState&_)?i(e):n({value:o,done:null===o}),i=n=null)}function s(e){return t.destroy(e),new Promise((r,n)=>{if(8&t._duplexState)return r({value:void 0,done:!0});t.once("close",function(){e?n(e):r({value:void 0,done:!0})})})}}}class yt extends pt{constructor(t){super(t),this._duplexState|=16385,this._writableState=new X(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final),t.eagerOpen&&this._writableState.updateNextTick())}cork(){this._duplexState|=N}uncork(){this._duplexState&=z,this._writableState.updateNextTick()}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}static isBackpressured(t){return!!(146800654&t._duplexState)}static drained(t){if(t.destroyed)return Promise.resolve(!1);const e=t._writableState;var r;const n=((r=t)._writev!==yt.prototype._writev&&r._writev!==mt.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(t._duplexState&D?1:0);return 0===n?Promise.resolve(!0):(null===e.drains&&(e.drains=[]),new Promise(t=>{e.drains.push({writes:n,resolve:t})}))}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class mt extends dt{constructor(t){super(t),this._duplexState=1|this._duplexState&v,this._writableState=new X(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final))}cork(){this._duplexState|=N}uncork(){this._duplexState&=z,this._writableState.updateNextTick()}_writev(t,e){e(null)}_write(t,e){this._writableState.autoBatch(t,e)}_final(t){t(null)}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}}class gt extends mt{constructor(t){super(t),this._transformState=new et(this),t&&(t.transform&&(this._transform=t.transform),t.flush&&(this._flush=t.flush))}_write(t,e){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=t:this._transform(t,this._transformState.afterTransform)}_read(t){if(null!==this._transformState.data){const e=this._transformState.data;this._transformState.data=null,t(null),this._transform(e,this._transformState.afterTransform)}else t(null)}destroy(t){super.destroy(t),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform())}_transform(t,e){e(null,t)}_flush(t){t(null)}_final(t){this._transformState.afterFinal=t,this._flush(_t.bind(this))}}function _t(t,e){const r=this._transformState.afterFinal;if(t)return r(t);null!=e&&this.push(e),this.push(null),r(null)}function bt(t,...e){const n=Array.isArray(t)?[...t,...e]:[t,...e],i=n.length&&"function"==typeof n[n.length-1]?n.pop():null;if(n.length<2)throw new Error("Pipeline requires at least 2 streams");let o=n[0],s=null,a=null;for(let t=1;t<n.length;t++)s=n[t],St(o)?o.pipe(s,c):(u(o,!0,t>1,c),o.pipe(s)),o=s;if(i){let t=!1;const e=St(s)||!(!s._writableState||!s._writableState.autoDestroy);s.on("error",t=>{null===a&&(a=t)}),s.on("finish",()=>{t=!0,e||i(a)}),e&&s.on("close",()=>i(a||(t?null:r)))}return s;function u(t,e,n,i){t.on("error",i),t.on("close",function(){if(t._readableState&&!t._readableState.ended)return i(r);if(n&&t._writableState&&!t._writableState.ended)return i(r)})}function c(t){if(t&&!a){a=t;for(const e of n)e.destroy(t)}}}function vt(t){return t}function wt(t){return!!t._readableState||!!t._writableState}function St(t){return"number"==typeof t._duplexState&&wt(t)}function Et(t){return function(t){return"object"==typeof t&&null!==t&&"number"==typeof t.byteLength}(t)?t.byteLength:1024}function kt(){}function xt(){this.destroy(new Error("Stream aborted."))}return _l={pipeline:bt,pipelinePromise:function(...t){return new Promise((e,r)=>bt(...t,t=>{if(t)return r(t);e()}))},isStream:wt,isStreamx:St,isEnded:function(t){return!!t._readableState&&t._readableState.ended},isFinished:function(t){return!!t._writableState&&t._writableState.ended},isDisturbed:function(t){return!!(1&~t._duplexState)||0!==(t._duplexState&Q)},getStreamError:function(t,r={}){const n=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return r.all||n!==e?n:null},Stream:pt,Writable:yt,Readable:dt,Duplex:mt,Transform:gt,PassThrough:class extends gt{}},_l}var Ol,Tl,jl,Cl={};function Rl(){if(Ol)return Cl;Ol=1;const t=Sl(),e="0".charCodeAt(0),r=t.from([117,115,116,97,114,0]),n=t.from([e,e]),i=t.from([117,115,116,97,114,32]),o=t.from([32,0]),s=257,a=263;function u(t,e,r,n){for(;r<n;r++)if(t[r]===e)return r;return n}function c(t){let e=256;for(let r=0;r<148;r++)e+=t[r];for(let r=156;r<512;r++)e+=t[r];return e}function l(t,e){return(t=t.toString(8)).length>e?"7777777777777777777".slice(0,e)+" ":"0000000000000000000".slice(0,e-t.length)+t+" "}function f(e,r,n){if(128&(e=e.subarray(r,r+n))[r=0])return function(t){let e;if(128===t[0])e=!0;else{if(255!==t[0])return null;e=!1}const r=[];let n;for(n=t.length-1;n>0;n--){const i=t[n];e?r.push(i):r.push(255-i)}let i=0;const o=r.length;for(n=0;n<o;n++)i+=r[n]*Math.pow(256,n);return e?i:-1*i}(e);{for(;r<e.length&&32===e[r];)r++;const n=function(t,e,r){return"number"!=typeof t?r:(t=~~t)>=e?e:t>=0||(t+=e)>=0?t:0}(u(e,32,r,e.length),e.length,e.length);for(;r<n&&0===e[r];)r++;return n===r?0:parseInt(t.toString(e.subarray(r,n)),8)}}function h(e,r,n,i){return t.toString(e.subarray(r,u(e,0,r,r+n)),i)}function p(e){const r=t.byteLength(e);let n=Math.floor(Math.log(r)/Math.log(10))+1;return r+n>=Math.pow(10,n)&&n++,r+n+e}return Cl.decodeLongPath=function(t,e){return h(t,0,t.length,e)},Cl.encodePax=function(e){let r="";e.name&&(r+=p(" path="+e.name+"\n")),e.linkname&&(r+=p(" linkpath="+e.linkname+"\n"));const n=e.pax;if(n)for(const t in n)r+=p(" "+t+"="+n[t]+"\n");return t.from(r)},Cl.decodePax=function(e){const r={};for(;e.length;){let n=0;for(;n<e.length&&32!==e[n];)n++;const i=parseInt(t.toString(e.subarray(0,n)),10);if(!i)return r;const o=t.toString(e.subarray(n+1,i-1)),s=o.indexOf("=");if(-1===s)return r;r[o.slice(0,s)]=o.slice(s+1),e=e.subarray(i)}return r},Cl.encode=function(i){const o=t.alloc(512);let a=i.name,u="";if(5===i.typeflag&&"/"!==a[a.length-1]&&(a+="/"),t.byteLength(a)!==a.length)return null;for(;t.byteLength(a)>100;){const t=a.indexOf("/");if(-1===t)return null;u+=u?"/"+a.slice(0,t):a.slice(0,t),a=a.slice(t+1)}return t.byteLength(a)>100||t.byteLength(u)>155||i.linkname&&t.byteLength(i.linkname)>100?null:(t.write(o,a),t.write(o,l(4095&i.mode,6),100),t.write(o,l(i.uid,6),108),t.write(o,l(i.gid,6),116),function(e,r,n){e.toString(8).length>11?function(t,e,r){e[r]=128;for(let n=11;n>0;n--)e[r+n]=255&t,t=Math.floor(t/256)}(e,r,n):t.write(r,l(e,11),n)}(i.size,o,124),t.write(o,l(i.mtime.getTime()/1e3|0,11),136),o[156]=e+function(t){switch(t){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}(i.type),i.linkname&&t.write(o,i.linkname,157),t.copy(r,o,s),t.copy(n,o,263),i.uname&&t.write(o,i.uname,265),i.gname&&t.write(o,i.gname,297),t.write(o,l(i.devmajor||0,6),329),t.write(o,l(i.devminor||0,6),337),u&&t.write(o,u,345),t.write(o,l(c(o),6),148),o)},Cl.decode=function(n,u,l){let p=0===n[156]?0:n[156]-e,d=h(n,0,100,u);const y=f(n,100,8),m=f(n,108,8),g=f(n,116,8),_=f(n,124,12),b=f(n,136,12),v=function(t){switch(t){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}(p),w=0===n[157]?null:h(n,157,100,u),S=h(n,265,32),E=h(n,297,32),k=f(n,329,8),x=f(n,337,8),O=c(n);if(256===O)return null;if(O!==f(n,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(function(e){return t.equals(r,e.subarray(s,263))}(n))n[345]&&(d=h(n,345,155,u)+"/"+d);else if(function(e){return t.equals(i,e.subarray(s,263))&&t.equals(o,e.subarray(a,265))}(n));else if(!l)throw new Error("Invalid tar header: unknown format.");return 0===p&&d&&"/"===d[d.length-1]&&(p=5),{name:d,mode:y,uid:m,gid:g,size:_,mtime:new Date(1e3*b),type:v,linkname:w,uname:S,gname:E,devmajor:k,devminor:x,pax:null}},Cl}var Pl,Ll,Fl,Al,Il,Dl,Ml,Nl,Bl,Ul,zl,Wl,Hl={exports:{}};function $l(){if(Pl)return Hl.exports;Pl=1;const t={S_IFMT:61440,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960};try{Hl.exports=require("fs").constants||t}catch{Hl.exports=t}return Hl.exports}function ql(){if(Fl)return Ll;Fl=1;const{Readable:t,Writable:e,getStreamError:r}=xl(),n=Sl(),i=$l(),o=Rl(),s=n.alloc(1024);class a extends e{constructor(t,e,r){super({mapWritable:f,eagerOpen:!0}),this.written=0,this.header=e,this._callback=r,this._linkname=null,this._isLinkname="symlink"===e.type&&!e.linkname,this._isVoid="file"!==e.type&&"contiguous-file"!==e.type,this._finished=!1,this._pack=t,this._openCallback=null,null===this._pack._stream?this._pack._stream=this:this._pack._pending.push(this)}_open(t){this._openCallback=t,this._pack._stream===this&&this._continueOpen()}_continuePack(t){if(null===this._callback)return;const e=this._callback;this._callback=null,e(t)}_continueOpen(){null===this._pack._stream&&(this._pack._stream=this);const t=this._openCallback;if(this._openCallback=null,null!==t){if(this._pack.destroying)return t(new Error("pack stream destroyed"));if(this._pack._finalized)return t(new Error("pack stream is already finalized"));this._pack._stream=this,this._isLinkname||this._pack._encode(this.header),this._isVoid&&(this._finish(),this._continuePack(null)),t(null)}}_write(t,e){return this._isLinkname?(this._linkname=this._linkname?n.concat([this._linkname,t]):t,e(null)):this._isVoid?t.byteLength>0?e(new Error("No body allowed for this entry")):e():(this.written+=t.byteLength,this._pack.push(t)?e():void(this._pack._drain=e))}_finish(){this._finished||(this._finished=!0,this._isLinkname&&(this.header.linkname=this._linkname?n.toString(this._linkname,"utf-8"):"",this._pack._encode(this.header)),l(this._pack,this.header.size),this._pack._done(this))}_final(t){if(this.written!==this.header.size)return t(new Error("Size mismatch"));this._finish(),t(null)}_getError(){return r(this)||new Error("tar entry destroyed")}_predestroy(){this._pack.destroy(this._getError())}_destroy(t){this._pack._done(this),this._continuePack(this._finished?null:this._getError()),t()}}class u extends t{constructor(t){super(t),this._drain=c,this._finalized=!1,this._finalizing=!1,this._pending=[],this._stream=null}entry(t,e,r){if(this._finalized||this.destroying)throw new Error("already finalized or destroyed");"function"==typeof e&&(r=e,e=null),r||(r=c),t.size&&"symlink"!==t.type||(t.size=0),t.type||(t.type=function(t){switch(t&i.S_IFMT){case i.S_IFBLK:return"block-device";case i.S_IFCHR:return"character-device";case i.S_IFDIR:return"directory";case i.S_IFIFO:return"fifo";case i.S_IFLNK:return"symlink"}return"file"}(t.mode)),t.mode||(t.mode="directory"===t.type?493:420),t.uid||(t.uid=0),t.gid||(t.gid=0),t.mtime||(t.mtime=new Date),"string"==typeof e&&(e=n.from(e));const o=new a(this,t,r);return n.isBuffer(e)?(t.size=e.byteLength,o.write(e),o.end(),o):(o._isVoid,o)}finalize(){this._stream||this._pending.length>0?this._finalizing=!0:this._finalized||(this._finalized=!0,this.push(s),this.push(null))}_done(t){t===this._stream&&(this._stream=null,this._finalizing&&this.finalize(),this._pending.length&&this._pending.shift()._continueOpen())}_encode(t){if(!t.pax){const e=o.encode(t);if(e)return void this.push(e)}this._encodePax(t)}_encodePax(t){const e=o.encodePax({name:t.name,linkname:t.linkname,pax:t.pax}),r={name:"PaxHeader",mode:t.mode,uid:t.uid,gid:t.gid,size:e.byteLength,mtime:t.mtime,type:"pax-header",linkname:t.linkname&&"PaxHeader",uname:t.uname,gname:t.gname,devmajor:t.devmajor,devminor:t.devminor};this.push(o.encode(r)),this.push(e),l(this,e.byteLength),r.size=t.size,r.type=t.type,this.push(o.encode(r))}_doDrain(){const t=this._drain;this._drain=c,t()}_predestroy(){const t=r(this);for(this._stream&&this._stream.destroy(t);this._pending.length;){const e=this._pending.shift();e.destroy(t),e._continueOpen()}this._doDrain()}_read(t){this._doDrain(),t()}}function c(){}function l(t,e){(e&=511)&&t.push(s.subarray(0,512-e))}function f(t){return n.isBuffer(t)?t:n.from(t)}return Ll=function(t){return new u(t)}}function Gl(){return Al||(Al=1,vl.extract=function(){if(jl)return Tl;jl=1;const{Writable:t,Readable:e,getStreamError:r}=xl(),n=wl(),i=Sl(),o=Rl(),s=i.alloc(0);class a{constructor(){this.buffered=0,this.shifted=0,this.queue=new n,this._offset=0}push(t){this.buffered+=t.byteLength,this.queue.push(t)}shiftFirst(t){return 0===this._buffered?null:this._next(t)}shift(t){if(t>this.buffered)return null;if(0===t)return s;let e=this._next(t);if(t===e.byteLength)return e;const r=[e];for(;(t-=e.byteLength)>0;)e=this._next(t),r.push(e);return i.concat(r)}_next(t){const e=this.queue.peek(),r=e.byteLength-this._offset;if(t>=r){const t=this._offset?e.subarray(this._offset,e.byteLength):e;return this.queue.shift(),this._offset=0,this.buffered-=r,this.shifted+=r,t}return this.buffered-=t,this.shifted+=t,e.subarray(this._offset,this._offset+=t)}}class u extends e{constructor(t,e,r){super(),this.header=e,this.offset=r,this._parent=t}_read(t){0===this.header.size&&this.push(null),this._parent._stream===this&&this._parent._update(),t(null)}_predestroy(){this._parent.destroy(r(this))}_detach(){this._parent._stream===this&&(this._parent._stream=null,this._parent._missing=f(this.header.size),this._parent._update())}_destroy(t){this._detach(),t(null)}}class c extends t{constructor(t){super(t),t||(t={}),this._buffer=new a,this._offset=0,this._header=null,this._stream=null,this._missing=0,this._longHeader=!1,this._callback=l,this._locked=!1,this._finished=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null,this._filenameEncoding=t.filenameEncoding||"utf-8",this._allowUnknownFormat=!!t.allowUnknownFormat,this._unlockBound=this._unlock.bind(this)}_unlock(t){if(this._locked=!1,t)return this.destroy(t),void this._continueWrite(t);this._update()}_consumeHeader(){if(this._locked)return!1;this._offset=this._buffer.shifted;try{this._header=o.decode(this._buffer.shift(512),this._filenameEncoding,this._allowUnknownFormat)}catch(t){return this._continueWrite(t),!1}if(!this._header)return!0;switch(this._header.type){case"gnu-long-path":case"gnu-long-link-path":case"pax-global-header":case"pax-header":return this._longHeader=!0,this._missing=this._header.size,!0}return this._locked=!0,this._applyLongHeaders(),0===this._header.size||"directory"===this._header.type?(this.emit("entry",this._header,this._createStream(),this._unlockBound),!0):(this._stream=this._createStream(),this._missing=this._header.size,this.emit("entry",this._header,this._stream,this._unlockBound),!0)}_applyLongHeaders(){this._gnuLongPath&&(this._header.name=this._gnuLongPath,this._gnuLongPath=null),this._gnuLongLinkPath&&(this._header.linkname=this._gnuLongLinkPath,this._gnuLongLinkPath=null),this._pax&&(this._pax.path&&(this._header.name=this._pax.path),this._pax.linkpath&&(this._header.linkname=this._pax.linkpath),this._pax.size&&(this._header.size=parseInt(this._pax.size,10)),this._header.pax=this._pax,this._pax=null)}_decodeLongHeader(t){switch(this._header.type){case"gnu-long-path":this._gnuLongPath=o.decodeLongPath(t,this._filenameEncoding);break;case"gnu-long-link-path":this._gnuLongLinkPath=o.decodeLongPath(t,this._filenameEncoding);break;case"pax-global-header":this._paxGlobal=o.decodePax(t);break;case"pax-header":this._pax=null===this._paxGlobal?o.decodePax(t):Object.assign({},this._paxGlobal,o.decodePax(t))}}_consumeLongHeader(){this._longHeader=!1,this._missing=f(this._header.size);const t=this._buffer.shift(this._header.size);try{this._decodeLongHeader(t)}catch(t){return this._continueWrite(t),!1}return!0}_consumeStream(){const t=this._buffer.shiftFirst(this._missing);if(null===t)return!1;this._missing-=t.byteLength;const e=this._stream.push(t);return 0===this._missing?(this._stream.push(null),e&&this._stream._detach(),e&&!1===this._locked):e}_createStream(){return new u(this,this._header,this._offset)}_update(){for(;this._buffer.buffered>0&&!this.destroying;){if(this._missing>0){if(null!==this._stream){if(!1===this._consumeStream())return;continue}if(!0===this._longHeader){if(this._missing>this._buffer.buffered)break;if(!1===this._consumeLongHeader())return!1;continue}const t=this._buffer.shiftFirst(this._missing);null!==t&&(this._missing-=t.byteLength);continue}if(this._buffer.buffered<512)break;if(null!==this._stream||!1===this._consumeHeader())return}this._continueWrite(null)}_continueWrite(t){const e=this._callback;this._callback=l,e(t)}_write(t,e){this._callback=e,this._buffer.push(t),this._update()}_final(t){this._finished=0===this._missing&&0===this._buffer.buffered,t(this._finished?null:new Error("Unexpected end of data"))}_predestroy(){this._continueWrite(null)}_destroy(t){this._stream&&this._stream.destroy(r(this)),t(null)}[Symbol.asyncIterator](){let t=null,e=null,r=null,n=null,i=null;const o=this;return this.on("entry",function(t,o,s){i=s,o.on("error",l),e?(e({value:o,done:!1}),e=r=null):n=o}),this.on("error",e=>{t=e}),this.on("close",function(){s(t),e&&(t?r(t):e({value:void 0,done:!0}),e=r=null)}),{[Symbol.asyncIterator](){return this},next:()=>new Promise(a),return:()=>u(null),throw:t=>u(t)};function s(t){if(!i)return;const e=i;i=null,e(t)}function a(i,a){return t?a(t):n?(i({value:n,done:!1}),void(n=null)):(e=i,r=a,s(null),void(o._finished&&e&&(e({value:void 0,done:!0}),e=r=null)))}function u(t){return o.destroy(t),s(t),new Promise((e,r)=>{if(o.destroyed)return e({value:void 0,done:!0});o.once("close",function(){t?r(t):e({value:void 0,done:!0})})})}}}function l(){}function f(t){return(t&=511)&&512-t}return Tl=function(t){return new c(t)}}(),vl.pack=ql()),vl}
|
|
29
29
|
/**
|
|
30
30
|
* TAR Format Plugin
|
|
31
31
|
*
|
|
@@ -46,4 +46,4 @@ import{readFileSync as t,existsSync as e,writeFileSync as r,mkdirSync as n,creat
|
|
|
46
46
|
* @ignore
|
|
47
47
|
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
|
|
48
48
|
* @copyright (c) 2012-2014 Chris Talkington, contributors.
|
|
49
|
-
*/()),zl=r}(),lf=D(cf),ff={};function hf(){if(Zl)return Ql;Zl=1;const t=g;function e(){if(!(this instanceof e))return new e;t.Duplex.call(this,{decodeStrings:!1,objectMode:!0}),this.buffer=Buffer.from("");const r=this;r.on("finish",function(){r.finished=!0,r.emit("chunk",!1)})}return b.inherits(e,t.Duplex),e.prototype._write=function(t,e,r){this.buffer=Buffer.concat([this.buffer,t]),this.cb=r,this.emit("chunk")},e.prototype.stream=function(e,r){const n=t.PassThrough();let i;const o=this;function s(){if("function"==typeof o.cb){const t=o.cb;return o.cb=void 0,t()}}function a(){let t;if(o.buffer&&o.buffer.length){if("number"==typeof e)t=o.buffer.slice(0,e),o.buffer=o.buffer.slice(e),e-=t.length,i=i||!e;else{let n=o.buffer.indexOf(e);if(-1!==n)o.match=n,r&&(n+=e.length),t=o.buffer.slice(0,n),o.buffer=o.buffer.slice(n),i=!0;else{const r=o.buffer.length-e.length;r<=0?s():(t=o.buffer.slice(0,r),o.buffer=o.buffer.slice(r))}}t&&n.write(t,function(){(0===o.buffer.length||e.length&&o.buffer.length<=e.length)&&s()})}if(i)o.removeListener("chunk",a),n.end();else if(o.finished)return o.removeListener("chunk",a),void o.emit("error",new Error("FILE_ENDED"))}return o.on("chunk",a),a(),n},e.prototype.pull=function(e,r){if(0===e)return Promise.resolve("");if(!isNaN(e)&&this.buffer.length>e){const t=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),Promise.resolve(t)}let n=Buffer.from("");const i=this,o=new t.Transform;let s,a;return o._transform=function(t,e,r){n=Buffer.concat([n,t]),r()},new Promise(function(t,u){if(s=u,a=function(t){i.__emittedError=t,u(t)},i.finished)return u(new Error("FILE_ENDED"));i.once("error",a),i.stream(e,r).on("error",u).pipe(o).on("finish",function(){t(n)}).on("error",u)}).finally(function(){i.removeListener("error",s),i.removeListener("error",a)})},e.prototype._read=function(){},Ql=e}function pf(){if(Xl)return Yl;Xl=1;const t=g;return Yl=function(e){return new Promise(function(r,n){const i=[],o=t.Transform().on("finish",function(){r(Buffer.concat(i))}).on("error",n);o._transform=function(t,e,r){i.push(t),r()},e.on("error",n).pipe(o)})},Yl}function df(){if(ef)return tf;ef=1;const t=function(t,e,r){let n;switch(r){case 1:n=t.readUInt8(e);break;case 2:n=t.readUInt16LE(e);break;case 4:n=t.readUInt32LE(e);break;case 8:n=Number(t.readBigUInt64LE(e));break;default:throw new Error("Unsupported UInt LE size!")}return n};return tf={parse:function(e,r){const n={};let i=0;for(const[o,s]of r)e.length>=i+s?n[o]=t(e,i,s):n[o]=null,i+=s;return n}}}function yf(){if(nf)return rf;nf=1;const t=df();return rf=function(e,r){let n;for(;!n&&e&&e.length;){const i=t.parse(e,[["signature",2],["partSize",2]]);if(1===i.signature){const i=[];4294967295===r.uncompressedSize&&i.push(["uncompressedSize",8]),4294967295===r.compressedSize&&i.push(["compressedSize",8]),4294967295===r.offsetToLocalFileHeader&&i.push(["offsetToLocalFileHeader",8]),n=t.parse(e.slice(4),i)}else e=e.slice(i.partSize+4)}return n=n||{},4294967295===r.compressedSize&&(r.compressedSize=n.compressedSize),4294967295===r.uncompressedSize&&(r.uncompressedSize=n.uncompressedSize),4294967295===r.offsetToLocalFileHeader&&(r.offsetToLocalFileHeader=n.offsetToLocalFileHeader),n}}function mf(){return sf?of:(sf=1,of=function(t,e){const r=31&t,n=t>>5&15,i=1980+(t>>9&127),o=e?2*(31&e):0,s=e?e>>5&63:0,a=e?e>>11:0;return new Date(Date.UTC(i,n-1,r,a,s,o))})}function gf(){if(uf)return af;uf=1;const t=b,e=S,r=g,n=hf(),i=function(){if(Jl)return Kl;Jl=1;const t=g;function e(){if(!(this instanceof e))return new e;t.Transform.call(this)}return b.inherits(e,t.Transform),e.prototype._transform=function(t,e,r){r()},Kl=e}(),o=pf(),s=yf(),a=mf(),u=r.pipeline,c=df(),l=Buffer.alloc(4);function f(t){if(!(this instanceof f))return new f(t);const e=this;e._opts=t||{verbose:!1},n.call(e,e._opts),e.on("finish",function(){e.emit("end"),e.emit("close")}),e._readRecord().catch(function(t){e.__emittedError&&e.__emittedError===t||e.emit("error",t)})}return l.writeUInt32LE(101010256,0),t.inherits(f,n),f.prototype._readRecord=function(){const t=this;return t.pull(4).then(function(e){if(0===e.length)return;const r=e.readUInt32LE(0);if(875721283===r)return t._readCrxHeader();if(67324752===r)return t._readFile();if(33639248===r)return t.reachedCD=!0,t._readCentralDirectoryFileHeader();if(101010256===r)return t._readEndOfCentralDirectoryRecord();if(t.reachedCD){const e=!0;return t.pull(l,e).then(function(){return t._readEndOfCentralDirectoryRecord()})}t.emit("error",new Error("invalid signature: 0x"+r.toString(16)))}).then(function(e){if(e)return t._readRecord()})},f.prototype._readCrxHeader=function(){const t=this;return t.pull(12).then(function(e){return t.crxHeader=c.parse(e,[["version",4],["pubKeyLength",4],["signatureLength",4]]),t.pull(t.crxHeader.pubKeyLength+t.crxHeader.signatureLength)}).then(function(e){return t.crxHeader.publicKey=e.slice(0,t.crxHeader.pubKeyLength),t.crxHeader.signature=e.slice(t.crxHeader.pubKeyLength),t.emit("crx-header",t.crxHeader),!0})},f.prototype._readFile=function(){const t=this;return t.pull(26).then(function(n){const l=c.parse(n,[["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return l.lastModifiedDateTime=a(l.lastModifiedDate,l.lastModifiedTime),t.crxHeader&&(l.crxHeader=t.crxHeader),t.pull(l.fileNameLength).then(function(n){const a=n.toString("utf8"),c=r.PassThrough();let f=!1;return c.autodrain=function(){f=!0;const t=c.pipe(i());return t.promise=function(){return new Promise(function(e,r){t.on("finish",e),t.on("error",r)})},t},c.buffer=function(){return o(c)},c.path=a,c.props={},c.props.path=a,c.props.pathBuffer=n,c.props.flags={isUnicode:!!(2048&l.flags)},c.type=0===l.uncompressedSize&&/[/\\]$/.test(a)?"Directory":"File",t._opts.verbose&&("Directory"===c.type?console.log(" creating:",a):"File"===c.type&&(0===l.compressionMethod?console.log(" extracting:",a):console.log(" inflating:",a))),t.pull(l.extraFieldLength).then(function(n){const i=s(n,l);c.vars=l,c.extra=i,t._opts.forceStream?t.push(c):(t.emit("entry",c),(t._readableState.pipesCount||t._readableState.pipes&&t._readableState.pipes.length)&&t.push(c)),t._opts.verbose&&console.log({filename:a,vars:l,extra:i});const o=!(8&l.flags)||l.compressedSize>0;let h;c.__autodraining=f;const p=l.compressionMethod&&!f?e.createInflateRaw():r.PassThrough();return o?(c.size=l.uncompressedSize,h=l.compressedSize):(h=Buffer.alloc(4),h.writeUInt32LE(134695760,0)),new Promise(function(e,r){u(t.stream(h),p,c,function(n){return n?r(n):o?e(o):t._processDataDescriptor(c).then(e).catch(r)})})})})})},f.prototype._processDataDescriptor=function(t){return this.pull(16).then(function(e){const r=c.parse(e,[["dataDescriptorSignature",4],["crc32",4],["compressedSize",4],["uncompressedSize",4]]);return t.size=r.uncompressedSize,!0})},f.prototype._readCentralDirectoryFileHeader=function(){const t=this;return t.pull(42).then(function(e){const r=c.parse(e,[["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return t.pull(r.fileNameLength).then(function(e){return r.fileName=e.toString("utf8"),t.pull(r.extraFieldLength)}).then(function(){return t.pull(r.fileCommentLength)}).then(function(){return!0})})},f.prototype._readEndOfCentralDirectoryRecord=function(){const t=this;return t.pull(18).then(function(e){const r=c.parse(e,[["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]);return t.pull(r.commentLength).then(function(){t.end(),t.push(null)})})},f.prototype.promise=function(){const t=this;return new Promise(function(e,r){t.on("finish",e),t.on("error",r)})},af=f}var _f,bf,vf={exports:{}},wf={exports:{}};function Sf(){return bf?_f:(bf=1,_f=g)}var Ef,kf={exports:{}};function xf(){return Ef||(Ef=1,function(t,e){var r=w,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(kf,kf.exports)),kf.exports}var Tf,Of,jf,Cf,Rf,Pf,Lf,Ff={exports:{}};function Af(){return Tf||(Tf=1,function(t){var e=xf().Buffer,r=b;function n(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),i=this.head,o=0;i;)n(i.data,r,o),o+=i.data.length,i=i.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(Ff)),Ff.exports}function If(){if(jf)return Of;jf=1;var t=vr();function e(t,e){t.emit("error",e)}return Of={destroy:function(r,n){var i=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(n?n(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(e,this,r)):t.nextTick(e,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(r){!n&&r?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,t.nextTick(e,i,r)):t.nextTick(e,i,r):n&&n(r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}function Df(){if(Rf)return Cf;Rf=1;var t=vr();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}Cf=p;var r,n=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=h;var i=Object.create(jr());i.inherits=Fr();var o={deprecate:Gr()},s=Sf(),a=xf().Buffer,u=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=If();function f(){}function h(i,o){r=r||Mf(),i=i||{};var s=o instanceof r;this.objectMode=!!i.objectMode,s&&(this.objectMode=this.objectMode||!!i.writableObjectMode);var a=i.highWaterMark,u=i.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:s&&(u||0===u)?u:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===i.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=i.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var i=e._writableState,o=i.sync,s=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function(e,r,n,i,o){--r.pendingcb,n?(t.nextTick(o,i),t.nextTick(b,e,r),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),b(e,r))}(e,i,o,r,s);else{var a=g(i);a||i.corked||i.bufferProcessing||!i.bufferedRequest||m(e,i),o?n(y,e,i,a,s):y(e,i,a,s)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function p(t){if(r=r||Mf(),!(c.call(p,this)||this instanceof r))return new p(t);this._writableState=new h(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function d(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function y(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),b(t,e)}function m(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,d(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(d(t,r,!1,r.objectMode?1:c.length,c,l,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function g(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function _(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),b(t,e)})}function b(e,r){var n=g(r);return n&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(_,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),n}return i.inherits(p,s),h.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(h.prototype,"buffer",{get:o.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===p&&(t&&t._writableState instanceof h)}})):c=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,c=!o.objectMode&&(i=e,a.isBuffer(i)||i instanceof u);return c&&!a.isBuffer(e)&&(e=function(t){return a.from(t)}(e)),"function"==typeof r&&(n=r,r=null),c?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=f),o.ended?function(e,r){var n=new Error("write after end");e.emit("error",n),t.nextTick(r,n)}(this,n):(c||function(e,r,n,i){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||r.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),t.nextTick(i,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var u=e.objectMode?1:n.length;e.length+=u;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else d(t,e,!1,u,n,i,o);return c}(this,o,c,e,r,n)),s},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||m(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,b(e,r),n&&(r.finished?t.nextTick(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=l.destroy,p.prototype._undestroy=l.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},Cf}function Mf(){if(Lf)return Pf;Lf=1;var t=vr(),e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Pf=u;var r=Object.create(jr());r.inherits=Fr();var n=Jf(),i=Df();r.inherits(u,n);for(var o=e(i.prototype),s=0;s<o.length;s++){var a=o[s];u.prototype[a]||(u.prototype[a]=i.prototype[a])}function u(t){if(!(this instanceof u))return new u(t);n.call(this,t),i.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",c)}function c(){this.allowHalfOpen||this._writableState.ended||t.nextTick(l,this)}function l(t){t.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),u.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},Pf}var Nf,Bf,Uf,zf,Wf,Hf,$f,qf,Gf,Vf,Qf,Zf={};function Kf(){if(Nf)return Zf;Nf=1;var t=xf().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}return Zf.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},Zf}function Jf(){if(Uf)return Bf;Uf=1;var t=vr();Bf=m;var e,r=wr();m.ReadableState=y,d.EventEmitter;var n=function(t,e){return t.listeners(e).length},i=Sf(),o=xf().Buffer,s=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a=Object.create(jr());a.inherits=Fr();var u=b,c=void 0;c=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f=Af(),h=If();a.inherits(m,i);var p=["error","close","destroy","pause","resume"];function y(t,r){t=t||{};var n=r instanceof(e=e||Mf());this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=Kf().StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function m(t){if(e=e||Mf(),!(this instanceof m))return new m(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),i.call(this)}function g(t,e,r,n,i){var a,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,u)):(i||(a=function(t,e){var r;n=e,o.isBuffer(n)||n instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(u,e)),a?t.emit("error",a):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),n?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):k(t,u)):_(t,u,e,!1))):n||(u.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function _(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&S(t)),k(t,e)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),m.prototype.destroy=h.destroy,m.prototype._undestroy=h.undestroy,m.prototype._destroy=function(t,e){this.push(null),e(t)},m.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=o.from(t,e),e=""),r=!0),g(this,t,e,!1,r)},m.prototype.unshift=function(t){return g(this,t,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(t){return l||(l=Kf().StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};var v=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=v?t=v:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(c("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(E,e):E(e))}function E(t){c("emit readable"),t.emit("readable"),j(t)}function k(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(x,e,r))}function x(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(c("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function T(t){c("readable nexttick read 0"),t.read(0)}function O(t,e){e.reading||(c("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function C(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=o.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function R(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(P,r,e))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return m.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):S(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&R(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(n=t>0?C(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==n&&this.emit("data",n),n},m.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,i){var o=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,c("pipe count=%d opts=%j",s.pipesCount,i);var a=(!i||!1!==i.end)&&e!==process.stdout&&e!==process.stderr?l:_;function u(t,r){c("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),o.removeListener("end",l),o.removeListener("end",_),o.removeListener("data",d),h=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){c("onend"),e.end()}s.endEmitted?t.nextTick(a):o.once("end",a),e.on("unpipe",u);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,j(t))}}(o);e.on("drain",f);var h=!1;var p=!1;function d(t){c("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==L(s.pipes,e))&&!h&&(c("false write response, pause",s.awaitDrain),s.awaitDrain++,p=!0),o.pause())}function y(t){c("onerror",t),_(),e.removeListener("error",y),0===n(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),_()}function g(){c("onfinish"),e.removeListener("close",m),_()}function _(){c("unpipe"),o.unpipe(e)}return o.on("data",d),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(e,"error",y),e.once("close",m),e.once("finish",g),e.emit("pipe",o),s.flowing||(c("pipe resume"),o.resume()),e},m.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=L(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},m.prototype.on=function(e,r){var n=i.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&S(this):t.nextTick(T,this))}return n},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(O,e,r))}(this,e)),this},m.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<p.length;o++)t.on(p[o],this.emit.bind(this,p[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=C,Bf}function Yf(){if(Wf)return zf;Wf=1,zf=n;var t=Mf(),e=Object.create(jr());function r(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function n(e){if(!(this instanceof n))return new n(e);t.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",i)}function i(){var t=this;"function"==typeof this._flush?this._flush(function(e,r){o(t,e,r)}):o(this,null,null)}function o(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}return e.inherits=Fr(),e.inherits(n,t),n.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.prototype.push.call(this,e,r)},n.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},n.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},n.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},n.prototype._destroy=function(e,r){var n=this;t.prototype._destroy.call(this,e,function(t){r(t),n.emit("close")})},zf}function Xf(){return qf||(qf=1,t=wf,e=wf.exports,r=g,"disable"===process.env.READABLE_STREAM&&r?(t.exports=r,(e=t.exports=r.Readable).Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.Stream=r):((e=t.exports=Jf()).Stream=r||e,e.Readable=e,e.Writable=Df(),e.Duplex=Mf(),e.Transform=Yf(),e.PassThrough=function(){if($f)return Hf;$f=1,Hf=r;var t=Yf(),e=Object.create(jr());function r(e){if(!(this instanceof r))return new r(e);t.call(this,e)}return e.inherits=Fr(),e.inherits(r,t),r.prototype._transform=function(t,e,r){r(null,t)},Hf}())),wf.exports;var t,e,r}function th(){if(Gf)return vf.exports;Gf=1;var t=Xf();function e(e,r,n){void 0===n&&(n=r,r=e,e=null),t.Duplex.call(this,e),"function"!=typeof n.read&&(n=new t.Readable(e).wrap(n)),this._writable=r,this._readable=n,this._waiting=!1;var i=this;r.once("finish",function(){i.end()}),this.once("finish",function(){r.end()}),n.on("readable",function(){i._waiting&&(i._waiting=!1,i._read())}),n.once("end",function(){i.push(null)}),e&&void 0!==e.bubbleErrors&&!e.bubbleErrors||(r.on("error",function(t){i.emit("error",t)}),n.on("error",function(t){i.emit("error",t)}))}return e.prototype=Object.create(t.Duplex.prototype,{constructor:{value:e}}),e.prototype._write=function(t,e,r){this._writable.write(t,e,r)},e.prototype._read=function(){for(var t,e=0;null!==(t=this._readable.read());)this.push(t),e++;0===e&&(this._waiting=!0)},vf.exports=function(t,r,n){return new e(t,r,n)},vf.exports.DuplexWrapper=e,vf.exports}var eh,rh,nh={},ih={};function oh(){return eh||(eh=1,ih.fromCallback=function(t){return Object.defineProperty(function(...e){if("function"!=typeof e[e.length-1])return new Promise((r,n)=>{e.push((t,e)=>null!=t?n(t):r(e)),t.apply(this,e)});t.apply(this,e)},"name",{value:t.name})},ih.fromPromise=function(t){return Object.defineProperty(function(...e){const r=e[e.length-1];if("function"!=typeof r)return t.apply(this,e);e.pop(),t.apply(this,e).then(t=>r(null,t),r)},"name",{value:t.name})}),ih}function sh(){return rh||(rh=1,function(t){const e=oh().fromCallback,r=hr(),n=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>"function"==typeof r[t]);Object.assign(t,r),n.forEach(n=>{t[n]=e(r[n])}),t.exists=function(t,e){return"function"==typeof e?r.exists(t,e):new Promise(e=>r.exists(t,e))},t.read=function(t,e,n,i,o,s){return"function"==typeof s?r.read(t,e,n,i,o,s):new Promise((s,a)=>{r.read(t,e,n,i,o,(t,e,r)=>{if(t)return a(t);s({bytesRead:e,buffer:r})})})},t.write=function(t,e,...n){return"function"==typeof n[n.length-1]?r.write(t,e,...n):new Promise((i,o)=>{r.write(t,e,...n,(t,e,r)=>{if(t)return o(t);i({bytesWritten:e,buffer:r})})})},t.readv=function(t,e,...n){return"function"==typeof n[n.length-1]?r.readv(t,e,...n):new Promise((i,o)=>{r.readv(t,e,...n,(t,e,r)=>{if(t)return o(t);i({bytesRead:e,buffers:r})})})},t.writev=function(t,e,...n){return"function"==typeof n[n.length-1]?r.writev(t,e,...n):new Promise((i,o)=>{r.writev(t,e,...n,(t,e,r)=>{if(t)return o(t);i({bytesWritten:e,buffers:r})})})},"function"==typeof r.realpath.native?t.realpath.native=e(r.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(nh)),nh}var ah,uh,ch,lh,fh,hh,ph,dh,yh,mh,gh,_h,bh,vh,wh,Sh,Eh,kh,xh,Th,Oh,jh,Ch,Rh,Ph,Lh,Fh,Ah,Ih,Dh,Mh,Nh,Bh,Uh,zh,Wh,Hh,$h,qh,Gh,Vh,Qh,Zh,Kh,Jh,Yh,Xh,tp,ep,rp,np,ip,op,sp,ap,up,cp,lp,fp={},hp={};function pp(){if(uh)return fp;uh=1;const t=sh(),{checkPath:e}=function(){if(ah)return hp;ah=1;const t=y;return hp.checkPath=function(e){if("win32"===process.platform&&/[<>:"|?*]/.test(e.replace(t.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}},hp}(),r=t=>"number"==typeof t?t:{mode:511,...t}.mode;return fp.makeDir=async(n,i)=>(e(n),t.mkdir(n,{mode:r(i),recursive:!0})),fp.makeDirSync=(n,i)=>(e(n),t.mkdirSync(n,{mode:r(i),recursive:!0})),fp}function dp(){if(lh)return ch;lh=1;const t=oh().fromPromise,{makeDir:e,makeDirSync:r}=pp(),n=t(e);return ch={mkdirs:n,mkdirsSync:r,mkdirp:n,mkdirpSync:r,ensureDir:n,ensureDirSync:r}}function yp(){if(hh)return fh;hh=1;const t=oh().fromPromise,e=sh();return fh={pathExists:t(function(t){return e.access(t).then(()=>!0).catch(()=>!1)}),pathExistsSync:e.existsSync},fh}function mp(){if(dh)return ph;dh=1;const t=sh(),e=oh().fromPromise;return ph={utimesMillis:e(async function(e,r,n){const i=await t.open(e,"r+");let o=null;try{await t.futimes(i,r,n)}finally{try{await t.close(i)}catch(t){o=t}}if(o)throw o}),utimesMillisSync:function(e,r,n){const i=t.openSync(e,"r+");return t.futimesSync(i,r,n),t.closeSync(i)}},ph}function gp(){if(mh)return yh;mh=1;const t=sh(),e=y,r=oh().fromPromise;function n(t,e){return void 0!==e.ino&&void 0!==e.dev&&e.ino===t.ino&&e.dev===t.dev}function i(t,r){const n=e.resolve(t).split(e.sep).filter(t=>t),i=e.resolve(r).split(e.sep).filter(t=>t);return n.every((t,e)=>i[e]===t)}function o(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}return yh={checkPaths:r(async function(r,s,a,u){const{srcStat:c,destStat:l}=await function(e,r,n){const i=n.dereference?e=>t.stat(e,{bigint:!0}):e=>t.lstat(e,{bigint:!0});return Promise.all([i(e),i(r).catch(t=>{if("ENOENT"===t.code)return null;throw t})]).then(([t,e])=>({srcStat:t,destStat:e}))}(r,s,u);if(l){if(n(c,l)){const t=e.basename(r),n=e.basename(s);if("move"===a&&t!==n&&t.toLowerCase()===n.toLowerCase())return{srcStat:c,destStat:l,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(c.isDirectory()&&!l.isDirectory())throw new Error(`Cannot overwrite non-directory '${s}' with directory '${r}'.`);if(!c.isDirectory()&&l.isDirectory())throw new Error(`Cannot overwrite directory '${s}' with non-directory '${r}'.`)}if(c.isDirectory()&&i(r,s))throw new Error(o(r,s,a));return{srcStat:c,destStat:l}}),checkPathsSync:function(r,s,a,u){const{srcStat:c,destStat:l}=function(e,r,n){let i;const o=n.dereference?e=>t.statSync(e,{bigint:!0}):e=>t.lstatSync(e,{bigint:!0}),s=o(e);try{i=o(r)}catch(t){if("ENOENT"===t.code)return{srcStat:s,destStat:null};throw t}return{srcStat:s,destStat:i}}(r,s,u);if(l){if(n(c,l)){const t=e.basename(r),n=e.basename(s);if("move"===a&&t!==n&&t.toLowerCase()===n.toLowerCase())return{srcStat:c,destStat:l,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(c.isDirectory()&&!l.isDirectory())throw new Error(`Cannot overwrite non-directory '${s}' with directory '${r}'.`);if(!c.isDirectory()&&l.isDirectory())throw new Error(`Cannot overwrite directory '${s}' with non-directory '${r}'.`)}if(c.isDirectory()&&i(r,s))throw new Error(o(r,s,a));return{srcStat:c,destStat:l}},checkParentPaths:r(async function r(i,s,a,u){const c=e.resolve(e.dirname(i)),l=e.resolve(e.dirname(a));if(l===c||l===e.parse(l).root)return;let f;try{f=await t.stat(l,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(n(s,f))throw new Error(o(i,a,u));return r(i,s,l,u)}),checkParentPathsSync:function r(i,s,a,u){const c=e.resolve(e.dirname(i)),l=e.resolve(e.dirname(a));if(l===c||l===e.parse(l).root)return;let f;try{f=t.statSync(l,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(n(s,f))throw new Error(o(i,a,u));return r(i,s,l,u)},isSrcSubdir:i,areIdentical:n},yh}function _p(){if(vh)return bh;vh=1;const t=sh(),e=y,{mkdirs:r}=dp(),{pathExists:n}=yp(),{utimesMillis:i}=mp(),o=gp(),{asyncIteratorConcurrentProcess:s}=(_h||(_h=1,gh={asyncIteratorConcurrentProcess:async function(t,e){const r=[];for await(const n of t)r.push(e(n).then(()=>null,t=>t??new Error("unknown error")));await Promise.all(r.map(t=>t.then(t=>{if(null!==t)throw t})))}}),gh);async function a(t,e,r){return!r.filter||r.filter(t,e)}async function u(r,n,i,l){const f=l.dereference?t.stat:t.lstat,h=await f(n);if(h.isDirectory())return async function(r,n,i,c,l){n||await t.mkdir(c);await s(await t.opendir(i),async t=>{const r=e.join(i,t.name),n=e.join(c,t.name);if(await a(r,n,l)){const{destStat:t}=await o.checkPaths(r,n,"copy",l);await u(t,r,n,l)}}),n||await t.chmod(c,r.mode)}(h,r,n,i,l);if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())return async function(e,r,n,i,o){if(!r)return c(e,n,i,o);if(o.overwrite)return await t.unlink(i),c(e,n,i,o);if(o.errorOnExist)throw new Error(`'${i}' already exists`)}(h,r,n,i,l);if(h.isSymbolicLink())return async function(r,n,i,s){let a=await t.readlink(n);s.dereference&&(a=e.resolve(process.cwd(),a));if(!r)return t.symlink(a,i);let u=null;try{u=await t.readlink(i)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return t.symlink(a,i);throw e}s.dereference&&(u=e.resolve(process.cwd(),u));if(o.isSrcSubdir(a,u))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${u}'.`);if(o.isSrcSubdir(u,a))throw new Error(`Cannot overwrite '${u}' with '${a}'.`);return await t.unlink(i),t.symlink(a,i)}(r,n,i,l);if(h.isSocket())throw new Error(`Cannot copy a socket file: ${n}`);if(h.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${n}`);throw new Error(`Unknown file: ${n}`)}async function c(e,r,n,o){if(await t.copyFile(r,n),o.preserveTimestamps){128&e.mode||await function(e,r){return t.chmod(e,128|r)}(n,e.mode);const o=await t.stat(r);await i(n,o.atime,o.mtime)}return t.chmod(n,e.mode)}return bh=async function(t,i,s={}){"function"==typeof s&&(s={filter:s}),s.clobber=!("clobber"in s)||!!s.clobber,s.overwrite="overwrite"in s?!!s.overwrite:s.clobber,s.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001");const{srcStat:c,destStat:l}=await o.checkPaths(t,i,"copy",s);if(await o.checkParentPaths(t,c,i,"copy"),!await a(t,i,s))return;const f=e.dirname(i);await n(f)||await r(f),await u(l,t,i,s)}}function bp(){if(Sh)return wh;Sh=1;const t=hr(),e=y,r=dp().mkdirsSync,n=mp().utimesMillisSync,i=gp();function o(r,n,o,c){const l=(c.dereference?t.statSync:t.lstatSync)(n);if(l.isDirectory())return function(e,r,n,i,o){return r?u(n,i,o):function(e,r,n,i){return t.mkdirSync(n),u(r,n,i),a(n,e)}(e.mode,n,i,o)}(l,r,n,o,c);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return function(e,r,n,i,o){return r?function(e,r,n,i){if(i.overwrite)return t.unlinkSync(n),s(e,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,i,o):s(e,n,i,o)}(l,r,n,o,c);if(l.isSymbolicLink())return function(r,n,o,s){let a=t.readlinkSync(n);s.dereference&&(a=e.resolve(process.cwd(),a));if(r){let r;try{r=t.readlinkSync(o)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return t.symlinkSync(a,o);throw e}if(s.dereference&&(r=e.resolve(process.cwd(),r)),i.isSrcSubdir(a,r))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${r}'.`);if(i.isSrcSubdir(r,a))throw new Error(`Cannot overwrite '${r}' with '${a}'.`);return function(e,r){return t.unlinkSync(r),t.symlinkSync(e,r)}(a,o)}return t.symlinkSync(a,o)}(r,n,o,c);if(l.isSocket())throw new Error(`Cannot copy a socket file: ${n}`);if(l.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${n}`);throw new Error(`Unknown file: ${n}`)}function s(e,r,i,o){return t.copyFileSync(r,i),o.preserveTimestamps&&function(e,r,i){(function(t){return!(128&t)})(e)&&function(t,e){a(t,128|e)}(i,e);(function(e,r){const i=t.statSync(e);n(r,i.atime,i.mtime)})(r,i)}(e.mode,r,i),a(i,e.mode)}function a(e,r){return t.chmodSync(e,r)}function u(e,r,n){const i=t.opendirSync(e);try{let t;for(;null!==(t=i.readSync());)c(t.name,e,r,n)}finally{i.closeSync()}}function c(t,r,n,s){const a=e.join(r,t),u=e.join(n,t);if(s.filter&&!s.filter(a,u))return;const{destStat:c}=i.checkPathsSync(a,u,"copy",s);return o(c,a,u,s)}return wh=function(n,s,a){"function"==typeof a&&(a={filter:a}),(a=a||{}).clobber=!("clobber"in a)||!!a.clobber,a.overwrite="overwrite"in a?!!a.overwrite:a.clobber,a.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:u,destStat:c}=i.checkPathsSync(n,s,"copy",a);if(i.checkParentPathsSync(n,u,s,"copy"),a.filter&&!a.filter(n,s))return;const l=e.dirname(s);return t.existsSync(l)||r(l),o(c,n,s,a)}}function vp(){if(kh)return Eh;kh=1;const t=oh().fromPromise;return Eh={copy:t(_p()),copySync:bp()}}function wp(){if(Th)return xh;Th=1;const t=hr(),e=oh().fromCallback;return xh={remove:e(function(e,r){t.rm(e,{recursive:!0,force:!0},r)}),removeSync:function(e){t.rmSync(e,{recursive:!0,force:!0})}},xh}function Sp(){if(jh)return Oh;jh=1;const t=oh().fromPromise,e=sh(),r=y,n=dp(),i=wp(),o=t(async function(t){let o;try{o=await e.readdir(t)}catch{return n.mkdirs(t)}return Promise.all(o.map(e=>i.remove(r.join(t,e))))});function s(t){let o;try{o=e.readdirSync(t)}catch{return n.mkdirsSync(t)}o.forEach(e=>{e=r.join(t,e),i.removeSync(e)})}return Oh={emptyDirSync:s,emptydirSync:s,emptyDir:o,emptydir:o}}function Ep(){if(Nh)return Mh;Nh=1;const t=oh().fromPromise,e=y,r=sh(),{mkdirs:n,mkdirsSync:i}=dp(),{symlinkPaths:o,symlinkPathsSync:s}=function(){if(Ah)return Fh;Ah=1;const t=y,e=sh(),{pathExists:r}=yp(),n=oh().fromPromise;return Fh={symlinkPaths:n(async function(n,i){if(t.isAbsolute(n)){try{await e.lstat(n)}catch(t){throw t.message=t.message.replace("lstat","ensureSymlink"),t}return{toCwd:n,toDst:n}}const o=t.dirname(i),s=t.join(o,n);if(await r(s))return{toCwd:s,toDst:n};try{await e.lstat(n)}catch(t){throw t.message=t.message.replace("lstat","ensureSymlink"),t}return{toCwd:n,toDst:t.relative(o,n)}}),symlinkPathsSync:function(r,n){if(t.isAbsolute(r)){if(!e.existsSync(r))throw new Error("absolute srcpath does not exist");return{toCwd:r,toDst:r}}const i=t.dirname(n),o=t.join(i,r);if(e.existsSync(o))return{toCwd:o,toDst:r};if(!e.existsSync(r))throw new Error("relative srcpath does not exist");return{toCwd:r,toDst:t.relative(i,r)}}}}(),{symlinkType:a,symlinkTypeSync:u}=function(){if(Dh)return Ih;Dh=1;const t=sh(),e=oh().fromPromise;return Ih={symlinkType:e(async function(e,r){if(r)return r;let n;try{n=await t.lstat(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}),symlinkTypeSync:function(e,r){if(r)return r;let n;try{n=t.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}}}(),{pathExists:c}=yp(),{areIdentical:l}=gp();return Mh={createSymlink:t(async function(t,i,s){let u;try{u=await r.lstat(i)}catch{}if(u&&u.isSymbolicLink()){const[e,n]=await Promise.all([r.stat(t),r.stat(i)]);if(l(e,n))return}const f=await o(t,i);t=f.toDst;const h=await a(f.toCwd,s),p=e.dirname(i);return await c(p)||await n(p),r.symlink(t,i,h)}),createSymlinkSync:function(t,n,o){let a;try{a=r.lstatSync(n)}catch{}if(a&&a.isSymbolicLink()){const e=r.statSync(t),i=r.statSync(n);if(l(e,i))return}const c=s(t,n);t=c.toDst,o=u(c.toCwd,o);const f=e.dirname(n);return r.existsSync(f)||i(f),r.symlinkSync(t,n,o)}},Mh}function kp(){if(Uh)return Bh;Uh=1;const{createFile:t,createFileSync:e}=function(){if(Rh)return Ch;Rh=1;const t=oh().fromPromise,e=y,r=sh(),n=dp();return Ch={createFile:t(async function(t){let i;try{i=await r.stat(t)}catch{}if(i&&i.isFile())return;const o=e.dirname(t);let s=null;try{s=await r.stat(o)}catch(e){if("ENOENT"===e.code)return await n.mkdirs(o),void await r.writeFile(t,"");throw e}s.isDirectory()?await r.writeFile(t,""):await r.readdir(o)}),createFileSync:function(t){let i;try{i=r.statSync(t)}catch{}if(i&&i.isFile())return;const o=e.dirname(t);try{r.statSync(o).isDirectory()||r.readdirSync(o)}catch(t){if(!t||"ENOENT"!==t.code)throw t;n.mkdirsSync(o)}r.writeFileSync(t,"")}},Ch}(),{createLink:r,createLinkSync:n}=function(){if(Lh)return Ph;Lh=1;const t=oh().fromPromise,e=y,r=sh(),n=dp(),{pathExists:i}=yp(),{areIdentical:o}=gp();return Ph={createLink:t(async function(t,s){let a,u;try{a=await r.lstat(s)}catch{}try{u=await r.lstat(t)}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}if(a&&o(u,a))return;const c=e.dirname(s);await i(c)||await n.mkdirs(c),await r.link(t,s)}),createLinkSync:function(t,i){let s;try{s=r.lstatSync(i)}catch{}try{const e=r.lstatSync(t);if(s&&o(e,s))return}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}const a=e.dirname(i);return r.existsSync(a)||n.mkdirsSync(a),r.linkSync(t,i)}},Ph}(),{createSymlink:i,createSymlinkSync:o}=Ep();return Bh={createFile:t,createFileSync:e,ensureFile:t,ensureFileSync:e,createLink:r,createLinkSync:n,ensureLink:r,ensureLinkSync:n,createSymlink:i,createSymlinkSync:o,ensureSymlink:i,ensureSymlinkSync:o}}function xp(){if(Wh)return zh;return Wh=1,zh={stringify:function(t,{EOL:e="\n",finalEOL:r=!0,replacer:n=null,spaces:i}={}){const o=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+o},stripBom:function(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}}}function Tp(){if(Gh)return qh;Gh=1;const t=function(){if($h)return Hh;let t;$h=1;try{t=hr()}catch(e){t=p}const e=oh(),{stringify:r,stripBom:n}=xp(),i=e.fromPromise(async function(r,i={}){"string"==typeof i&&(i={encoding:i});const o=i.fs||t,s=!("throws"in i)||i.throws;let a,u=await e.fromCallback(o.readFile)(r,i);u=n(u);try{a=JSON.parse(u,i?i.reviver:null)}catch(t){if(s)throw t.message=`${r}: ${t.message}`,t;return null}return a}),o=e.fromPromise(async function(n,i,o={}){const s=o.fs||t,a=r(i,o);await e.fromCallback(s.writeFile)(n,a,o)});return Hh={readFile:i,readFileSync:function(e,r={}){"string"==typeof r&&(r={encoding:r});const i=r.fs||t,o=!("throws"in r)||r.throws;try{let t=i.readFileSync(e,r);return t=n(t),JSON.parse(t,r.reviver)}catch(t){if(o)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:o,writeFileSync:function(e,n,i={}){const o=i.fs||t,s=r(n,i);return o.writeFileSync(e,s,i)}},Hh}();return qh={readJson:t.readFile,readJsonSync:t.readFileSync,writeJson:t.writeFile,writeJsonSync:t.writeFileSync}}function Op(){if(Qh)return Vh;Qh=1;const t=oh().fromPromise,e=sh(),r=y,n=dp(),i=yp().pathExists;return Vh={outputFile:t(async function(t,o,s="utf-8"){const a=r.dirname(t);return await i(a)||await n.mkdirs(a),e.writeFile(t,o,s)}),outputFileSync:function(t,...i){const o=r.dirname(t);e.existsSync(o)||n.mkdirsSync(o),e.writeFileSync(t,...i)}},Vh}function jp(){if(tp)return Xh;tp=1;const t=oh().fromPromise,e=Tp();return e.outputJson=t(function(){if(Kh)return Zh;Kh=1;const{stringify:t}=xp(),{outputFile:e}=Op();return Zh=async function(r,n,i={}){const o=t(n,i);await e(r,o,i)},Zh}()),e.outputJsonSync=function(){if(Yh)return Jh;Yh=1;const{stringify:t}=xp(),{outputFileSync:e}=Op();return Jh=function(r,n,i){const o=t(n,i);e(r,o,i)},Jh}(),e.outputJSON=e.outputJson,e.outputJSONSync=e.outputJsonSync,e.writeJSON=e.writeJson,e.writeJSONSync=e.writeJsonSync,e.readJSON=e.readJson,e.readJSONSync=e.readJsonSync,Xh=e}function Cp(){if(rp)return ep;rp=1;const t=sh(),e=y,{copy:r}=vp(),{remove:n}=wp(),{mkdirp:i}=dp(),{pathExists:o}=yp(),s=gp();return ep=async function(a,u,c={}){const l=c.overwrite||c.clobber||!1,{srcStat:f,isChangingCase:h=!1}=await s.checkPaths(a,u,"move",c);await s.checkParentPaths(a,f,u,"move");const p=e.dirname(u);return e.parse(p).root!==p&&await i(p),async function(e,i,s,a){if(!a)if(s)await n(i);else if(await o(i))throw new Error("dest already exists.");try{await t.rename(e,i)}catch(t){if("EXDEV"!==t.code)throw t;await async function(t,e,i){const o={overwrite:i,errorOnExist:!0,preserveTimestamps:!0};return await r(t,e,o),n(t)}(e,i,s)}}(a,u,l,h)}}function Rp(){if(ip)return np;ip=1;const t=hr(),e=y,r=vp().copySync,n=wp().removeSync,i=dp().mkdirpSync,o=gp();function s(e,i,o){try{t.renameSync(e,i)}catch(t){if("EXDEV"!==t.code)throw t;return function(t,e,i){const o={overwrite:i,errorOnExist:!0,preserveTimestamps:!0};return r(t,e,o),n(t)}(e,i,o)}}return np=function(r,a,u){const c=(u=u||{}).overwrite||u.clobber||!1,{srcStat:l,isChangingCase:f=!1}=o.checkPathsSync(r,a,"move",u);return o.checkParentPathsSync(r,l,a,"move"),function(t){const r=e.dirname(t),n=e.parse(r);return n.root===r}(a)||i(e.dirname(a)),function(e,r,i,o){if(o)return s(e,r,i);if(i)return n(r),s(e,r,i);if(t.existsSync(r))throw new Error("dest already exists.");return s(e,r,i)}(r,a,c,f)},np}function Pp(){if(sp)return op;sp=1;const t=oh().fromPromise;return op={move:t(Cp()),moveSync:Rp()}}function Lp(){return up?ap:(up=1,ap={...sh(),...vp(),...Sp(),...kp(),...jp(),...dp(),...Pp(),...Op(),...yp(),...wp()})}var Fp,Ap,Ip,Dp,Mp,Np={exports:{}};function Bp(){if(Fp)return Np.exports;Fp=1;for(var t=4294967296,e=[],r=0;r<256;r++)e[r]=(r>15?"":"0")+r.toString(16);var n=Np.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):"[object Uint8Array]"==Object.prototype.toString.call(t)?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};return n.MAX_INT=Math.pow(2,53),n.MIN_INT=-Math.pow(2,53),n.prototype={constructor:n,_2scomp:function(){for(var t=this.buffer,e=this.offset,r=1,n=e+7;n>=e;n--){var i=(255^t[n])+r;t[n]=255&i,r=i>>8}},setValue:function(e,r){var n=!1;if(1==arguments.length)if("number"==typeof e){if(n=e<0,r=(e=Math.abs(e))%t,(e/=t)>t)throw new RangeError(e+" is outside Int64 range");e|=0}else{if("string"!=typeof e)throw new Error(e+" must be a Number or String");r=(e=(e+"").replace(/^0x/,"")).substr(-8),e=e.length>8?e.substr(0,e.length-8):"",e=parseInt(e,16),r=parseInt(r,16)}for(var i=this.buffer,o=this.offset,s=7;s>=0;s--)i[o+s]=255&r,r=4==s?e:r>>>8;n&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,r=this.offset,i=128&e[r],o=0,s=1,a=7,u=1;a>=0;a--,u*=256){var c=e[r+a];i&&(s=(c=(255^c)+s)>>8,c&=255),o+=c*u}return!t&&o>=n.MAX_INT?i?-1/0:1/0:i?-o:o},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var r=new Array(8),n=this.buffer,i=this.offset,o=0;o<8;o++)r[o]=e[n[i+o]];return r.join(t||"")},toBuffer:function(t){if(t&&0===this.offset)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((128&this.buffer[this.offset])!=(128&t.buffer[t.offset]))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return 0===this.compare(t)},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}},Np.exports}function Up(){if(Ip)return Ap;Ip=1;const t=Bp();let e,r=g;function n(t,r){e||function(){let t,r,n;for(e=[],r=0;r<256;r++){for(t=r,n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>=1;e[r]=t>>>0}}(),t.charCodeAt&&(t=t.charCodeAt(0));return(r.readUInt32BE()>>8&16777215^e[255&(r.readUInt32BE()^t>>>0)])>>>0}function i(t,e){const r=65535&t,n=65535&e;return(((t>>16&65535)*n+r*(e>>16&65535)&65535)<<16>>>0)+r*n}function o(){if(!(this instanceof o))return new o;this.key0=Buffer.allocUnsafe(4),this.key1=Buffer.allocUnsafe(4),this.key2=Buffer.allocUnsafe(4),this.key0.writeUInt32BE(305419896,0),this.key1.writeUInt32BE(591751049,0),this.key2.writeUInt32BE(878082192,0)}return r.Writable&&r.Writable.prototype.destroy||(r=ws()),o.prototype.update=function(e){this.key0.writeUInt32BE(n(e,this.key0)),this.key1.writeUInt32BE((255&this.key0.readUInt32BE())+this.key1.readUInt32BE()>>>0);const r=new t(i(this.key1.readUInt32BE(),134775813)+1&4294967295),o=Buffer.alloc(8);r.copy(o,0),o.copy(this.key1,0,4,8),this.key2.writeUInt32BE(n((this.key1.readUInt32BE()>>24&255)>>>0,this.key2))},o.prototype.decryptByte=function(t){const e=(2|this.key2.readUInt32BE())>>>0;return t^=i(e,1^e)>>8&255,this.update(t),t},o.prototype.stream=function(){const t=r.Transform(),e=this;return t._transform=function(t,r,n){for(let r=0;r<t.length;r++)t[r]=e.decryptByte(t[r]);this.push(t),n()},t},Ap=o}function zp(){if(Mp)return Dp;Mp=1;const t=Up(),e=hf(),r=g,n=S,i=yf(),o=mf(),s=df();return Dp=function(a,u,c,l,f){const h=e(),p=r.PassThrough(),d=a.stream(u,f);return d.pipe(h).on("error",function(t){p.emit("error",t)}),p.vars=h.pull(30).then(function(e){let r=s.parse(e,[["signature",4],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return r.lastModifiedDateTime=o(r.lastModifiedDate,r.lastModifiedTime),h.pull(r.fileNameLength).then(function(t){return r.fileName=t.toString("utf8"),h.pull(r.extraFieldLength)}).then(function(e){let n;return r.extra=i(e,r),l&&l.compressedSize&&(r=l),1&r.flags&&(n=h.pull(12).then(function(e){if(!c)throw new Error("MISSING_PASSWORD");const n=t();String(c).split("").forEach(function(t){n.update(t)});for(let t=0;t<e.length;t++)e[t]=n.decryptByte(e[t]);r.decrypt=n,r.compressedSize-=12;const i=8&r.flags?r.lastModifiedTime>>8&255:r.crc32>>24&255;if(e[11]!==i)throw new Error("BAD_PASSWORD");return r})),Promise.resolve(n).then(function(){return p.emit("vars",r),r})})}),p.vars.then(function(t){const e=!(8&t.flags)||t.compressedSize>0;let i;const o=t.compressionMethod?n.createInflateRaw():r.PassThrough();e?(p.size=t.uncompressedSize,i=t.compressedSize):(i=Buffer.alloc(4),i.writeUInt32LE(134695760,0));let s=h.stream(i);t.decrypt&&(s=s.pipe(t.decrypt.stream())),s.pipe(o).on("error",function(t){p.emit("error",t)}).pipe(p).on("finish",function(){d.destroy?d.destroy():d.abort?d.abort():d.close?d.close():d.push?d.push():console.log("warning - unable to close stream")})}).catch(function(t){p.emit("error",t)}),p},Dp}var Wp,Hp,$p,qp={exports:{}},Gp={exports:{}};function Vp(){if(Wp)return Gp.exports;Wp=1;var t=function(){return void 0===this}();if(t)Gp.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:t,propertyIsWritable:function(t,e){var r=Object.getOwnPropertyDescriptor(t,e);return!(r&&!r.writable&&!r.set)}};else{var e={}.hasOwnProperty,r={}.toString,n={}.constructor.prototype,i=function(t){var r=[];for(var n in t)e.call(t,n)&&r.push(n);return r};Gp.exports={isArray:function(t){try{return"[object Array]"===r.call(t)}catch(t){return!1}},keys:i,names:i,defineProperty:function(t,e,r){return t[e]=r.value,t},getDescriptor:function(t,e){return{value:t[e]}},freeze:function(t){return t},getPrototypeOf:function(t){try{return Object(t).constructor.prototype}catch(t){return n}},isES5:t,propertyIsWritable:function(){return!0}}}return Gp.exports}function Qp(){if($p)return Hp;$p=1;var t,e=Vp(),r="undefined"==typeof navigator,n={e:{}},i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==I?I:void 0!==Hp?Hp:null;function o(){try{var e=t;return t=null,e.apply(this,arguments)}catch(t){return n.e=t,n}}function s(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function a(t,r,n){if(s(t))return t;var i={value:n,configurable:!0,enumerable:!1,writable:!0};return e.defineProperty(t,r,i),t}var u=function(){var t=[Array.prototype,Object.prototype,Function.prototype],r=function(e){for(var r=0;r<t.length;++r)if(t[r]===e)return!0;return!1};if(e.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var i=[],o=Object.create(null);null!=t&&!r(t);){var s;try{s=n(t)}catch(t){return i}for(var a=0;a<s.length;++a){var u=s[a];if(!o[u]){o[u]=!0;var c=Object.getOwnPropertyDescriptor(t,u);null!=c&&null==c.get&&null==c.set&&i.push(u)}}t=e.getPrototypeOf(t)}return i}}var i={}.hasOwnProperty;return function(e){if(r(e))return[];var n=[];t:for(var o in e)if(i.call(e,o))n.push(o);else{for(var s=0;s<t.length;++s)if(i.call(t[s],o))continue t;n.push(o)}return n}}(),c=/this\s*\.\s*\S+\s*=/;var l=/^[a-z$_][a-z$_0-9]*$/i;function f(t){try{return t+""}catch(t){return"[no string representation]"}}function h(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function p(t){return h(t)&&e.propertyIsWritable(t,"stack")}var d="stack"in new Error?function(t){return p(t)?t:new Error(f(t))}:function(t){if(p(t))return t;try{throw new Error(f(t))}catch(t){return t}};function y(t){return{}.toString.call(t)}var m=function(t){return e.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var g="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,r=[],n=t[Symbol.iterator]();!(e=n.next()).done;)r.push(e.value);return r};m=function(t){return e.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?g(t):null}}var _,b="undefined"!=typeof process&&"[object process]"===y(process).toLowerCase(),v="undefined"!=typeof process&&void 0!==process.env;var w,S={setReflectHandler:function(t){_=t},isClass:function(t){try{if("function"==typeof t){var r=e.names(t.prototype),n=e.isES5&&r.length>1,i=r.length>0&&!(1===r.length&&"constructor"===r[0]),o=c.test(t+"")&&e.names(t).length>0;if(n||i||o)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return l.test(t)},inheritedDataKeys:u,getDataPropertyOrDefault:function(t,r,n){if(!e.isES5)return{}.hasOwnProperty.call(t,r)?t[r]:void 0;var i=Object.getOwnPropertyDescriptor(t,r);return null!=i?null==i.get&&null==i.set?i.value:n:void 0},thrower:function(t){throw t},isArray:e.isArray,asArray:m,notEnumerableProp:a,isPrimitive:s,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},isError:h,canEvaluate:r,errorObj:n,tryCatch:function(e){return t=e,o},inherits:function(t,e){var r={}.hasOwnProperty;function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r<n;++r)i[r]=t[r];return i[r]=e,i},maybeWrapAsError:function(t){return s(t)?new Error(f(t)):t},toFastProperties:function(t){function e(){}e.prototype=t;var r=new e;function n(){return typeof r.foo}return n(),n(),t},filledRange:function(t,e,r){for(var n=new Array(t),i=0;i<t;++i)n[i]=e+i+r;return n},toString:f,canAttachTrace:p,ensureErrorObject:d,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{a(t,"isOperational",!0)}catch(t){}},classString:y,copyDescriptors:function(t,r,n){for(var i=e.names(t),o=0;o<i.length;++o){var s=i[o];if(n(s))try{e.defineProperty(r,s,e.getDescriptor(t,s))}catch(t){}}},isNode:b,hasEnvVariables:v,env:function(t){return v?process.env[t]:void 0},global:i,getNativePromise:function(){if("function"==typeof Promise)try{if("[object Promise]"===y(new Promise(function(){})))return Promise}catch(t){}},contextBind:function(t,e){if(null===t||"function"!=typeof e||e===_)return e;null!==t.domain&&(e=t.domain.bind(e));var r=t.async;if(null!==r){var n=e;e=function(){for(var t=arguments.length+2,e=new Array(t),i=2;i<t;++i)e[i]=arguments[i-2];return e[0]=n,e[1]=this,r.runInAsyncScope.apply(r,e)}}return e}};S.isRecentNode=S.isNode&&(process.versions&&process.versions.node?w=process.versions.node.split(".").map(Number):process.version&&(w=process.version.split(".").map(Number)),0===w[0]&&w[1]>10||w[0]>0),S.nodeSupportsAsyncResource=S.isNode&&function(){var t=!1;try{t="function"==typeof require("async_hooks").AsyncResource.prototype.runInAsyncScope}catch(e){t=!1}return t}(),S.isNode&&S.toFastProperties(process);try{throw new Error}catch(t){S.lastLineError=t}return Hp=S}var Zp,Kp,Jp,Yp,Xp,td,ed,rd,nd,id,od,sd,ad,ud,cd,ld,fd,hd,pd,dd,yd,md,gd,_d,bd,vd,wd,Sd,Ed,kd,xd,Td,Od,jd,Cd,Rd,Pd,Ld,Fd,Ad,Id,Dd,Md,Nd,Bd,Ud,zd,Wd,Hd,$d,qd,Gd,Vd,Qd,Zd,Kd,Jd,Yd,Xd,ty,ey,ry,ny,iy,oy,sy,ay,uy,cy={exports:{}};function ly(){if(Kp)return Zp;Kp=1;var t,e=Qp(),r=e.getNativePromise();if(e.isNode&&"undefined"==typeof MutationObserver){var n=I.setImmediate,i=process.nextTick;t=e.isRecentNode?function(t){n.call(I,t)}:function(t){i.call(process,t)}}else if("function"==typeof r&&"function"==typeof r.resolve){var o=r.resolve();t=function(t){o.then(t)}}else t="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)||!("classList"in document.documentElement)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:function(){var t=document.createElement("div"),e={attributes:!0},r=!1,n=document.createElement("div");new MutationObserver(function(){t.classList.toggle("foo"),r=!1}).observe(n,e);return function(i){var o=new MutationObserver(function(){o.disconnect(),i()});o.observe(t,e),r||(r=!0,n.classList.toggle("foo"))}}();return Zp=t}function fy(){if(Xp)return cy.exports;var t;Xp=1;try{throw new Error}catch(e){t=e}var e=ly(),r=function(){if(Yp)return Jp;function t(t){this._capacity=t,this._length=0,this._front=0}return Yp=1,t.prototype._willBeOverCapacity=function(t){return this._capacity<t},t.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1),this[this._front+e&this._capacity-1]=t,this._length=e+1},t.prototype.push=function(t,e,r){var n=this.length()+3;if(this._willBeOverCapacity(n))return this._pushOne(t),this._pushOne(e),void this._pushOne(r);var i=this._front+n-3;this._checkCapacity(n);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=r,this._length=n},t.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},t.prototype.length=function(){return this._length},t.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},t.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t,function(t,e,r,n,i){for(var o=0;o<i;++o)r[o+n]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},Jp=t}();function n(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new r(16),this._normalQueue=new r(16),this._haveDrainedQueues=!1;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=e}function i(t){for(;t.length()>0;)o(t)}function o(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var r=t.shift(),n=t.shift();e.call(r,n)}}return n.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},n.prototype.hasCustomScheduler=function(){return this._customScheduler},n.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},n.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},n.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},n.prototype.invokeLater=function(t,e,r){this._lateQueue.push(t,e,r),this._queueTick()},n.prototype.invoke=function(t,e,r){this._normalQueue.push(t,e,r),this._queueTick()},n.prototype.settlePromises=function(t){this._normalQueue._pushOne(t),this._queueTick()},n.prototype._drainQueues=function(){i(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,i(this._lateQueue)},n.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},n.prototype._reset=function(){this._isTickUsed=!1},cy.exports=n,cy.exports.firstLineError=t,cy.exports}function hy(){if(ed)return td;ed=1;var t,e,r=Vp(),n=r.freeze,i=Qp(),o=i.inherits,s=i.notEnumerableProp;function a(t,e){function r(n){if(!(this instanceof r))return new r(n);s(this,"message","string"==typeof n?n:e),s(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return o(r,Error),r}var u=a("Warning","warning"),c=a("CancellationError","cancellation error"),l=a("TimeoutError","timeout error"),f=a("AggregateError","aggregate error");try{t=TypeError,e=RangeError}catch(r){t=a("TypeError","type error"),e=a("RangeError","range error")}for(var h="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),p=0;p<h.length;++p)"function"==typeof Array.prototype[h[p]]&&(f.prototype[h[p]]=Array.prototype[h[p]]);r.defineProperty(f.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),f.prototype.isOperational=!0;var d=0;function y(t){if(!(this instanceof y))return new y(t);s(this,"name","OperationalError"),s(this,"message",t),this.cause=t,this.isOperational=!0,t instanceof Error?(s(this,"message",t.message),s(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}f.prototype.toString=function(){var t=Array(4*d+1).join(" "),e="\n"+t+"AggregateError of:\n";d++,t=Array(4*d+1).join(" ");for(var r=0;r<this.length;++r){for(var n=this[r]===this?"[Circular AggregateError]":this[r]+"",i=n.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];e+=(n=i.join("\n"))+"\n"}return d--,e},o(y,Error);var m=Error.__BluebirdErrorTypes__;return m||(m=n({CancellationError:c,TimeoutError:l,OperationalError:y,RejectionError:y,AggregateError:f}),r.defineProperty(Error,"__BluebirdErrorTypes__",{value:m,writable:!1,enumerable:!1,configurable:!1})),td={Error:Error,TypeError:t,RangeError:e,CancellationError:m.CancellationError,OperationalError:m.OperationalError,TimeoutError:m.TimeoutError,AggregateError:m.AggregateError,Warning:u}}function py(){return nd||(nd=1,rd=function(t,e){var r=Qp(),n=r.errorObj,i=r.isObject;var o={}.hasOwnProperty;return function(s,a){if(i(s)){if(s instanceof t)return s;var u=function(t){try{return function(t){return t.then}(t)}catch(t){return n.e=t,n}}(s);if(u===n){a&&a._pushContext();var c=t.reject(u.e);return a&&a._popContext(),c}if("function"==typeof u){if(function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(s)){c=new t(e);return s._then(c._fulfill,c._reject,void 0,c,null),c}return function(i,o,s){var a=new t(e),u=a;s&&s._pushContext();a._captureStackTrace(),s&&s._popContext();var c=!0,l=r.tryCatch(o).call(i,f,h);c=!1,a&&l===n&&(a._rejectCallback(l.e,!0,!0),a=null);function f(t){a&&(a._resolveCallback(t),a=null)}function h(t){a&&(a._rejectCallback(t,c,!0),a=null)}return u}(s,u,a)}}return s}}),rd}function dy(){return od||(od=1,id=function(t,e,r,n,i){var o=Qp();function s(r){var n=this._promise=new t(e);r instanceof t&&(n._propagateFrom(r,3),r.suppressUnhandledRejections()),n._setOnCancel(this),this._values=r,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.isArray,o.inherits(s,i),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function e(i,s){var a=r(this._values,this._promise);if(a instanceof t){var u=(a=a._target())._bitField;if(this._values=a,!(50397184&u))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,s);if(!(33554432&u))return 16777216&u?this._reject(a._reason()):this._cancel();a=a._value()}if(null!==(a=o.asArray(a)))0!==a.length?this._iterate(a):-5===s?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(s));else{var c=n("expecting an array or an iterable object but got "+o.classString(a)).reason();this._promise._rejectCallback(c,!1)}},s.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;a<n;++a){var u=r(e[a],i);s=u instanceof t?(u=u._target())._bitField:null,o?null!==s&&u.suppressUnhandledRejections():null!==s?50397184&s?o=33554432&s?this._promiseFulfilled(u._value(),a):16777216&s?this._promiseRejected(u._reason(),a):this._promiseCancelled(a):(u._proxy(this,a),this._values[a]=u):o=this._promiseFulfilled(u,a)}o||i._setAsyncGuaranteed()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var r=0;r<e.length;++r)e[r]instanceof t&&e[r].cancel()}},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}),id}function yy(){return cd||(cd=1,ud=function(t,e,r,n){var i,o,s,a,u=t._async,c=hy().Warning,l=Qp(),f=Vp(),h=l.canAttachTrace,p=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,d=/\((?:timers\.js):\d+:\d+\)/,y=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,m=null,g=null,_=!1,b=!(0==l.env("BLUEBIRD_DEBUG")||!l.env("BLUEBIRD_DEBUG")&&"development"!==l.env("NODE_ENV")),v=!(0==l.env("BLUEBIRD_WARNINGS")||!b&&!l.env("BLUEBIRD_WARNINGS")),w=!(0==l.env("BLUEBIRD_LONG_STACK_TRACES")||!b&&!l.env("BLUEBIRD_LONG_STACK_TRACES")),S=0!=l.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(v||!!l.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){var e=[];function r(){for(var t=0;t<e.length;++t)e[t]._notifyUnhandledRejection();n()}function n(){e.length=0}a=function(t){e.push(t),setTimeout(r,1)},f.defineProperty(t,"_unhandledRejectionCheck",{value:r}),f.defineProperty(t,"_unhandledRejectionClear",{value:n})}(),t.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},t.prototype._ensurePossibleRejectionHandled=function(){524288&this._bitField||(this._setRejectionIsUnhandled(),a(this))},t.prototype._notifyUnhandledRejectionIsHandled=function(){G("rejectionHandled",i,void 0,this)},t.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},t.prototype._returnedNonUndefined=function(){return!!(268435456&this._bitField)},t.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),G("unhandledRejection",o,t,this)}},t.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},t.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},t.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},t.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},t.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},t.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},t.prototype._warn=function(t,e,r){return W(t,e,r||this)},t.onPossiblyUnhandledRejection=function(e){var r=t._getContext();o=l.contextBind(r,e)},t.onUnhandledRejectionHandled=function(e){var r=t._getContext();i=l.contextBind(r,e)};var E=function(){};t.longStackTraces=function(){if(u.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!tt.longStackTraces&&Q()){var r=t.prototype._captureStackTrace,n=t.prototype._attachExtraTrace,i=t.prototype._dereferenceTrace;tt.longStackTraces=!0,E=function(){if(u.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");t.prototype._captureStackTrace=r,t.prototype._attachExtraTrace=n,t.prototype._dereferenceTrace=i,e.deactivateLongStackTraces(),tt.longStackTraces=!1},t.prototype._captureStackTrace=B,t.prototype._attachExtraTrace=U,t.prototype._dereferenceTrace=z,e.activateLongStackTraces()}},t.hasLongStackTraces=function(){return tt.longStackTraces&&Q()};var k={unhandledrejection:{before:function(){var t=l.global.onunhandledrejection;return l.global.onunhandledrejection=null,t},after:function(t){l.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=l.global.onrejectionhandled;return l.global.onrejectionhandled=null,t},after:function(t){l.global.onrejectionhandled=t}}},x=function(){var t=function(t,e){if(!t)return!l.global.dispatchEvent(e);var r;try{return r=t.before(),!l.global.dispatchEvent(e)}finally{t.after(r)}};try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=new CustomEvent(e,{detail:r,cancelable:!0});return f.defineProperty(n,"promise",{value:r.promise}),f.defineProperty(n,"reason",{value:r.reason}),t(k[e],n)}}if("function"==typeof Event){e=new Event("CustomEvent");return l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=new Event(e,{cancelable:!0});return n.detail=r,f.defineProperty(n,"promise",{value:r.promise}),f.defineProperty(n,"reason",{value:r.reason}),t(k[e],n)}}return(e=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!0,r),t(k[e],n)}}catch(t){}return function(){return!1}}(),T=l.isNode?function(){return process.emit.apply(process,arguments)}:l.global?function(t){var e="on"+t.toLowerCase(),r=l.global[e];return!!r&&(r.apply(l.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function O(t,e){return{promise:e}}var j={promiseCreated:O,promiseFulfilled:O,promiseRejected:O,promiseResolved:O,promiseCancelled:O,promiseChained:function(t,e,r){return{promise:e,child:r}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,r){return{reason:e,promise:r}},rejectionHandled:O},C=function(t){var e=!1;try{e=T.apply(null,arguments)}catch(t){u.throwLater(t),e=!0}var r=!1;try{r=x(t,j[t].apply(null,arguments))}catch(t){u.throwLater(t),r=!0}return r||e};function R(){return!1}function P(t,e,r){var n=this;try{t(e,r,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+l.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function L(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?l.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function F(){return this._onCancelField}function A(t){this._onCancelField=t}function I(){this._cancellationParent=void 0,this._onCancelField=void 0}function D(t,e){if(1&e){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}2&e&&t._isBound()&&this._setBoundTo(t._boundTo)}t.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?t.longStackTraces():!e.longStackTraces&&t.hasLongStackTraces()&&E()),"warnings"in e){var i=e.warnings;tt.warnings=!!i,S=tt.warnings,l.isObject(i)&&"wForgottenReturn"in i&&(S=!!i.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!tt.cancellation){if(u.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");t.prototype._clearCancellationData=I,t.prototype._propagateFrom=D,t.prototype._onCancel=F,t.prototype._setOnCancel=A,t.prototype._attachCancellationCallback=L,t.prototype._execute=P,M=D,tt.cancellation=!0}if("monitoring"in e&&(e.monitoring&&!tt.monitoring?(tt.monitoring=!0,t.prototype._fireEvent=C):!e.monitoring&&tt.monitoring&&(tt.monitoring=!1,t.prototype._fireEvent=R)),"asyncHooks"in e&&l.nodeSupportsAsyncResource){var o=tt.asyncHooks,s=!!e.asyncHooks;o!==s&&(tt.asyncHooks=s,s?r():n())}return t},t.prototype._fireEvent=R,t.prototype._execute=function(t,e,r){try{t(e,r)}catch(t){return t}},t.prototype._onCancel=function(){},t.prototype._setOnCancel=function(t){},t.prototype._attachCancellationCallback=function(t){},t.prototype._captureStackTrace=function(){},t.prototype._attachExtraTrace=function(){},t.prototype._dereferenceTrace=function(){},t.prototype._clearCancellationData=function(){},t.prototype._propagateFrom=function(t,e){};var M=function(t,e){2&e&&t._isBound()&&this._setBoundTo(t._boundTo)};function N(){var e=this._boundTo;return void 0!==e&&e instanceof t?e.isFulfilled()?e.value():void 0:e}function B(){this._trace=new Y(this._peekContext())}function U(t,e){if(h(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=$(t);l.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),l.notEnumerableProp(t,"__stackCleaned__",!0)}}}function z(){this._trace=void 0}function W(e,r,n){if(tt.warnings){var i,o=new c(e);if(r)n._attachExtraTrace(o);else if(tt.longStackTraces&&(i=t._peekContext()))i.attachExtraTrace(o);else{var s=$(o);o.stack=s.message+"\n"+s.stack.join("\n")}C("warning",o)||q(o,"",!0)}}function H(t){for(var e=[],r=0;r<t.length;++r){var n=t[r],i=" (No stack trace)"===n||m.test(n),o=i&&Z(n);i&&!o&&(_&&" "!==n.charAt(0)&&(n=" "+n),e.push(n))}return e}function $(t){var e=t.stack,r=t.toString();return e="string"==typeof e&&e.length>0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),r=0;r<e.length;++r){var n=e[r];if(" (No stack trace)"===n||m.test(n))break}return r>0&&"SyntaxError"!=t.name&&(e=e.slice(r)),e}(t):[" (No stack trace)"],{message:r,stack:"SyntaxError"==t.name?e:H(e)}}function q(t,e,r){if("undefined"!=typeof console){var n;if(l.isObject(t)){var i=t.stack;n=e+g(i,t)}else n=e+String(t);"function"==typeof s?s(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function G(t,e,r,n){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(n):e(r,n))}catch(t){u.throwLater(t)}"unhandledRejection"===t?C(t,r,n)||i||q(r,"Unhandled rejection "):C(t,n)}function V(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():l.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){var e=41;if(t.length<e)return t;return t.substr(0,e-3)+"..."}(e)+">, no stack trace)"}function Q(){return"function"==typeof X}var Z=function(){return!1},K=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function J(t){var e=t.match(K);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function Y(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);X(this,Y),e>32&&this.uncycle()}l.inherits(Y,Error),e.CapturedTrace=Y,Y.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;for(n=(t=this._length=n)-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(n=0;n<t;++n){var s=r[e[n].stack];if(void 0!==s&&s!==n){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var a=n>0?e[n-1]:this;s<t-1?(a._parent=e[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var u=a._length+1,c=n-2;c>=0;--c)e[c]._length=u,u++;return}}}},Y.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=$(t),r=e.message,n=[e.stack],i=this;void 0!==i;)n.push(H(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],r=1;r<t.length;++r){for(var n=t[r],i=e.length-1,o=e[i],s=-1,a=n.length-1;a>=0;--a)if(n[a]===o){s=a;break}for(a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}(n),function(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}(n),l.notEnumerableProp(t,"stack",function(t,e){for(var r=0;r<e.length-1;++r)e[r].push("From previous event:"),e[r]=e[r].join("\n");return r<e.length&&(e[r]=e[r].join("\n")),t+"\n"+e.join("\n")}(r,n)),l.notEnumerableProp(t,"__stackCleaned__",!0)}};var X=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():V(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,m=t,g=e;var r=Error.captureStackTrace;return Z=function(t){return p.test(t)},function(t,e){Error.stackTraceLimit+=6,r(t,e),Error.stackTraceLimit-=6}}var n,i=new Error;if("string"==typeof i.stack&&i.stack.split("\n")[0].indexOf("stackDetection@")>=0)return m=/@/,g=e,_=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){n="stack"in t}return!("stack"in i)&&n&&"number"==typeof Error.stackTraceLimit?(m=t,g=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6}):(g=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?V(e):e.toString()},null)}();"undefined"!=typeof console&&void 0!==console.warn&&(s=function(t){console.warn(t)},l.isNode&&process.stderr.isTTY?s=function(t,e){var r=e?"[33m":"[31m";console.warn(r+t+"[0m\n")}:l.isNode||"string"!=typeof(new Error).stack||(s=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var tt={warnings:v,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return w&&t.longStackTraces(),{asyncHooks:function(){return tt.asyncHooks},longStackTraces:function(){return tt.longStackTraces},warnings:function(){return tt.warnings},cancellation:function(){return tt.cancellation},monitoring:function(){return tt.monitoring},propagateFromFunction:function(){return M},boundValueFunction:function(){return N},checkForgottenReturns:function(t,e,r,n,i){if(void 0===t&&null!==e&&S){if(void 0!==i&&i._returnedNonUndefined())return;if(!(65535&n._bitField))return;r&&(r+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),u=H(a),c=u.length-1;c>=0;--c){var l=u[c];if(!d.test(l)){var f=l.match(y);f&&(o="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0){var h=u[0];for(c=0;c<a.length;++c)if(a[c]===h){c>0&&(s="\n"+a[c-1]);break}}}var p="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;n._warn(p,!0,e)}},setBounds:function(t,e){if(Q()){for(var r,n,i=(t.stack||"").split("\n"),o=(e.stack||"").split("\n"),s=-1,a=-1,u=0;u<i.length;++u){if(c=J(i[u])){r=c.fileName,s=c.line;break}}for(u=0;u<o.length;++u){var c;if(c=J(o[u])){n=c.fileName,a=c.line;break}}s<0||a<0||!r||!n||r!==n||s>=a||(Z=function(t){if(p.test(t))return!0;var e=J(t);return!!(e&&e.fileName===r&&s<=e.line&&e.line<=a)})}},warn:W,deprecated:function(t,e){var r=t+" is deprecated and will be removed in a future version.";return e&&(r+=" Use "+e+" instead."),W(r)},CapturedTrace:Y,fireDomEvent:x,fireGlobalEvent:T}}),ud}function my(){return fd||(fd=1,ld=function(t){var e=Qp(),r=Vp().keys,n=e.tryCatch,i=e.errorObj;return function(o,s,a){return function(u){var c=a._boundValue();t:for(var l=0;l<o.length;++l){var f=o[l];if(f===Error||null!=f&&f.prototype instanceof Error){if(u instanceof f)return n(s).call(c,u)}else if("function"==typeof f){var h=n(f).call(c,u);if(h===i)return h;if(h)return n(s).call(c,u)}else if(e.isObject(u)){for(var p=r(f),d=0;d<p.length;++d){var y=p[d];if(f[y]!=u[y])continue t}return n(s).call(c,u)}}return t}}}),ld}function gy(){return pd||(pd=1,hd=function(t,e,r){var n=Qp(),i=t.CancellationError,o=n.errorObj,s=my()(r);function a(t,e,r){this.promise=t,this.type=e,this.handler=r,this.called=!1,this.cancelPromise=null}function u(t){this.finallyHandler=t}function c(t,e){return null!=t.cancelPromise&&(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function l(){return h.call(this,this.promise._target()._settledValue())}function f(t){if(!c(this,t))return o.e=t,o}function h(n){var s=this.promise,a=this.handler;if(!this.called){this.called=!0;var h=this.isFinallyHandler()?a.call(s._boundValue()):a.call(s._boundValue(),n);if(h===r)return h;if(void 0!==h){s._setReturnedNonUndefined();var p=e(h,s);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new i("late cancellation observer");return s._attachExtraTrace(d),o.e=d,o}p.isPending()&&p._attachCancellationCallback(new u(this))}return p._then(l,f,void 0,this,void 0)}}}return s.isRejected()?(c(this),o.e=n,o):(c(this),n)}return a.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){c(this.finallyHandler)},t.prototype._passThrough=function(t,e,r,n){return"function"!=typeof t?this.then():this._then(r,n,void 0,new a(this,e,t),void 0)},t.prototype.lastly=t.prototype.finally=function(t){return this._passThrough(t,0,h,h)},t.prototype.tap=function(t){return this._passThrough(t,1,h)},t.prototype.tapCatch=function(e){var r=arguments.length;if(1===r)return this._passThrough(e,1,void 0,h);var i,o=new Array(r-1),a=0;for(i=0;i<r-1;++i){var u=arguments[i];if(!n.isObject(u))return t.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+n.classString(u)));o[a++]=u}o.length=a;var c=arguments[i];return this._passThrough(s(o,c,this),1,void 0,h)},a}),hd}function _y(){if(yd)return dd;yd=1;var t=Qp(),e=t.maybeWrapAsError,r=hy().OperationalError,n=Vp();var i=/^(?:name|message|stack|cause)$/;function o(e){var o;if(function(t){return t instanceof Error&&n.getPrototypeOf(t)===Error.prototype}(e)){(o=new r(e)).name=e.name,o.message=e.message,o.stack=e.stack;for(var s=n.keys(e),a=0;a<s.length;++a){var u=s[a];i.test(u)||(o[u]=e[u])}return o}return t.markAsOriginatingFromRejection(e),e}return dd=function(t,r){return function(n,i){if(null!==t){if(n){var s=o(e(n));t._attachExtraTrace(s),t._reject(s)}else if(r){for(var a=arguments.length,u=new Array(Math.max(a-1,0)),c=1;c<a;++c)u[c-1]=arguments[c];t._fulfill(u)}else t._fulfill(i);t=null}}},dd}function by(){return xd||(xd=1,kd=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var r=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return!!(33554432&this._bitField)},o=e.prototype.isRejected=function(){return!!(16777216&this._bitField)},s=e.prototype.isPending=function(){return!(50397184&this._bitField)},a=e.prototype.isResolved=function(){return!!(50331648&this._bitField)};e.prototype.isCancelled=function(){return!!(8454144&this._bitField)},t.prototype.__isCancelled=function(){return!(65536&~this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return!!(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return r.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),n.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}),kd}function vy(){return Pd||(Pd=1,Rd=function(t,e,r,n,i,o){var s=hy().TypeError,a=Qp(),u=a.errorObj,c=a.tryCatch,l=[];function f(e,n,i,s){if(o.cancellation()){var a=new t(r),u=this._finallyPromise=new t(r);this._promise=a.lastly(function(){return u}),a._captureStackTrace(),a._setOnCancel(this)}else{(this._promise=new t(r))._captureStackTrace()}this._stack=s,this._generatorFunction=e,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(l):l,this._yieldedPromise=null,this._cancellationPhase=!1}a.inherits(f,i),f.prototype._isResolved=function(){return null===this._promise},f.prototype._cleanup=function(){this._promise=this._generator=null,o.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},f.prototype._promiseCancelled=function(){if(!this._isResolved()){var e;if(void 0!==this._generator.return)this._promise._pushContext(),e=c(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var r=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),e=c(this._generator.throw).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(e)}},f.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=c(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},f.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=c(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(e)},f.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null,e.cancel()}},f.prototype.promise=function(){return this._promise},f.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},f.prototype._continue=function(e){var r=this._promise;if(e===u)return this._cleanup(),this._cancellationPhase?r.cancel():r._rejectCallback(e.e,!1);var i=e.value;if(!0===e.done)return this._cleanup(),this._cancellationPhase?r.cancel():r._resolveCallback(i);var o=n(i,this._promise);if(o instanceof t||(o=function(e,r,i){for(var o=0;o<r.length;++o){i._pushContext();var s=c(r[o])(e);if(i._popContext(),s===u){i._pushContext();var a=t.reject(u.e);return i._popContext(),a}var l=n(s,i);if(l instanceof t)return l}return null}(o,this._yieldHandlers,this._promise),null!==o)){var a=(o=o._target())._bitField;50397184&a?33554432&a?t._async.invoke(this._promiseFulfilled,this,o._value()):16777216&a?t._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled():(this._yieldedPromise=o,o._proxy(this,null))}else this._promiseRejected(new s("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(i))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")))},t.coroutine=function(t,e){if("function"!=typeof t)throw new s("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=Object(e).yieldHandler,n=f,i=(new Error).stack;return function(){var e=t.apply(this,arguments),o=new n(void 0,void 0,r,i),s=o.promise();return o._generator=e,o._promiseFulfilled(void 0),s}},t.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new s("expecting a function but got "+a.classString(t));l.push(t)},t.spawn=function(r){if(o.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof r)return e("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=new f(r,this),i=n.promise();return n._run(t.spawn),i}}),Rd}function wy(){return Fd||(Fd=1,Ld=function(t,e,r,n,i,o){var s=Qp(),a=s.tryCatch,u=s.errorObj,c=t._async;function l(e,r,n,o){this.constructor$(e),this._promise._captureStackTrace();var a=t._getContext();if(this._callback=s.contextBind(a,r),this._preservedValues=o===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],c.invoke(this._asyncInit,this,void 0),s.isArray(e))for(var u=0;u<e.length;++u){var l=e[u];l instanceof t&&l.suppressUnhandledRejections()}}function f(e,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+s.classString(n));var a=0;if(void 0!==i){if("object"!=typeof i||null===i)return t.reject(new TypeError("options argument must be an object but it is "+s.classString(i)));if("number"!=typeof i.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+s.classString(i.concurrency)));a=i.concurrency}return new l(e,n,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,o).promise()}s.inherits(l,e),l.prototype._asyncInit=function(){this._init$(void 0,-2)},l.prototype._init=function(){},l.prototype._promiseFulfilled=function(e,r){var i=this._values,s=this.length(),c=this._preservedValues,l=this._limit;if(r<0){if(i[r=-1*r-1]=e,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return i[r]=e,this._queue.push(r),!1;null!==c&&(c[r]=e);var f=this._promise,h=this._callback,p=f._boundValue();f._pushContext();var d=a(h).call(p,e,r,s),y=f._popContext();if(o.checkForgottenReturns(d,y,null!==c?"Promise.filter":"Promise.map",f),d===u)return this._reject(d.e),!0;var m=n(d,this._promise);if(m instanceof t){var g=(m=m._target())._bitField;if(!(50397184&g))return l>=1&&this._inFlight++,i[r]=m,m._proxy(this,-1*(r+1)),!1;if(!(33554432&g))return 16777216&g?(this._reject(m._reason()),!0):(this._cancel(),!0);d=m._value()}i[r]=d}return++this._totalResolved>=s&&(null!==c?this._filter(i,c):this._resolve(i),!0)},l.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlight<e;){if(this._isResolved())return;var n=t.pop();this._promiseFulfilled(r[n],n)}},l.prototype._filter=function(t,e){for(var r=e.length,n=new Array(r),i=0,o=0;o<r;++o)t[o]&&(n[i++]=e[o]);n.length=i,this._resolve(n)},l.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(t,e){return f(this,t,e,null)},t.map=function(t,e,r,n){return f(t,e,r,n)}}),Ld}function Sy(){return Md||(Md=1,Dd=function(t,e){var r={},n=Qp(),i=_y(),o=n.withAppended,s=n.maybeWrapAsError,a=n.canEvaluate,u=hy().TypeError,c={__isPromisified__:!0},l=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),f=function(t){return n.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t};function h(t){return!l.test(t)}function p(t){try{return!0===t.__isPromisified__}catch(t){return!1}}function d(t,e,r){var i=n.getDataPropertyOrDefault(t,e+r,c);return!!i&&p(i)}function y(t,e,r,i){for(var o=n.inheritedDataKeys(t),s=[],a=0;a<o.length;++a){var c=o[a],l=t[c],h=i===f||f(c);"function"!=typeof l||p(l)||d(t,c,e)||!i(c,l,t,h)||s.push(c,l)}return function(t,e,r){for(var n=0;n<t.length;n+=2){var i=t[n];if(r.test(i))for(var o=i.replace(r,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new u("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",e))}}(s,e,r),s}var m;m=function(a,u,c,l,f,h){var p=Math.max(0,function(t){return"number"==typeof t.length?Math.max(Math.min(t.length,1024),0):0}(l)-1),d=function(t){for(var e=[t],r=Math.max(0,t-1-3),n=t-1;n>=r;--n)e.push(n);for(n=t+1;n<=3;++n)e.push(n);return e}(p),y="string"==typeof a||u===r;function m(t){var e,r=(e=t,n.filledRange(e,"_arg","")).join(", "),i=t>0?", ":"";return(y?"ret = callback.call(this, {{args}}, nodeback); break;\n":void 0===u?"ret = callback({{args}}, nodeback); break;\n":"ret = callback.call(receiver, {{args}}, nodeback); break;\n").replace("{{args}}",r).replace(", ",i)}var g="string"==typeof a?"this != null ? this['"+a+"'] : fn":"fn",_="'use strict'; \n\t var ret = function (Parameters) { \n\t 'use strict'; \n\t var len = arguments.length; \n\t var promise = new Promise(INTERNAL); \n\t promise._captureStackTrace(); \n\t var nodeback = nodebackForPromise(promise, "+h+"); \n\t var ret; \n\t var callback = tryCatch([GetFunctionCode]); \n\t switch(len) { \n\t [CodeForSwitchCase] \n\t } \n\t if (ret === errorObj) { \n\t promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\t } \n\t if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\t return promise; \n\t }; \n\t notEnumerableProp(ret, '__isPromisified__', true); \n\t return ret; \n\t ".replace("[CodeForSwitchCase]",function(){for(var t="",e=0;e<d.length;++e)t+="case "+d[e]+":"+m(d[e]);return t+=" \n\t default: \n\t var args = new Array(len + 1); \n\t var i = 0; \n\t for (var i = 0; i < len; ++i) { \n\t args[i] = arguments[i]; \n\t } \n\t args[i] = nodeback; \n\t [CodeForCall] \n\t break; \n\t ".replace("[CodeForCall]",y?"ret = callback.apply(this, args);\n":"ret = callback.apply(receiver, args);\n")}()).replace("[GetFunctionCode]",g);return _=_.replace("Parameters",function(t){return n.filledRange(Math.max(t,3),"_arg","")}(p)),new Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",_)(t,l,u,o,s,i,n.tryCatch,n.errorObj,n.notEnumerableProp,e)};var g=a?m:function(a,u,c,l,f,h){var p=function(){return this}(),d=a;function y(){var n=u;u===r&&(n=this);var c=new t(e);c._captureStackTrace();var l="string"==typeof d&&this!==p?this[d]:a,f=i(c,h);try{l.apply(n,o(arguments,f))}catch(t){c._rejectCallback(s(t),!0,!0)}return c._isFateSealed()||c._setAsyncGuaranteed(),c}return"string"==typeof d&&(a=l),n.notEnumerableProp(y,"__isPromisified__",!0),y};function _(t,e,i,o,s){for(var a=new RegExp(e.replace(/([$])/,"\\$")+"$"),u=y(t,e,a,i),c=0,l=u.length;c<l;c+=2){var f=u[c],h=u[c+1],p=f+e;if(o===g)t[p]=g(f,r,f,h,e,s);else{var d=o(h,function(){return g(f,r,f,h,e,s)});n.notEnumerableProp(d,"__isPromisified__",!0),t[p]=d}}return n.toFastProperties(t),t}t.promisify=function(t,e){if("function"!=typeof t)throw new u("expecting a function but got "+n.classString(t));if(p(t))return t;var i=function(t,e,r){return g(t,e,void 0,t,null,r)}(t,void 0===(e=Object(e)).context?r:e.context,!!e.multiArgs);return n.copyDescriptors(t,i,h),i},t.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new u("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var r=!!(e=Object(e)).multiArgs,i=e.suffix;"string"!=typeof i&&(i="Async");var o=e.filter;"function"!=typeof o&&(o=f);var s=e.promisifier;if("function"!=typeof s&&(s=g),!n.isIdentifier(i))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var a=n.inheritedDataKeys(t),c=0;c<a.length;++c){var l=t[a[c]];"constructor"!==a[c]&&n.isClass(l)&&(_(l.prototype,i,o,s,r),_(l,i,o,s,r))}return _(t,i,o,s,r)}}),Dd}function Ey(){return Bd||(Bd=1,Nd=function(t,e,r,n){var i,o=Qp(),s=o.isObject,a=Vp();"function"==typeof Map&&(i=Map);var u=function(){var t=0,e=0;function r(r,n){this[t]=r,this[t+e]=n,t++}return function(n){e=n.size,t=0;var i=new Array(2*n.size);return n.forEach(r,i),i}}();function c(t){var e,r=!1;if(void 0!==i&&t instanceof i)e=u(t),r=!0;else{var n=a.keys(t),o=n.length;e=new Array(2*o);for(var s=0;s<o;++s){var c=n[s];e[s]=t[c],e[s+o]=c}}this.constructor$(e),this._isMap=r,this._init$(void 0,r?-6:-3)}function l(e){var i,o=r(e);return s(o)?(i=o instanceof t?o._then(t.props,void 0,void 0,void 0,void 0):new c(o).promise(),o instanceof t&&i._propagateFrom(o,2),i):n("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}o.inherits(c,e),c.prototype._init=function(){},c.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){var r;if(this._isMap)r=function(t){for(var e=new i,r=t.length/2|0,n=0;n<r;++n){var o=t[r+n],s=t[n];e.set(o,s)}return e}(this._values);else{r={};for(var n=this.length(),o=0,s=this.length();o<s;++o)r[this._values[o+n]]=this._values[o]}return this._resolve(r),!0}return!1},c.prototype.shouldCopyValues=function(){return!1},c.prototype.getActualLength=function(t){return t>>1},t.prototype.props=function(){return l(this)},t.props=function(t){return l(t)}}),Nd}function ky(){return zd||(zd=1,Ud=function(t,e,r,n){var i=Qp();function o(s,a){var u=r(s);if(u instanceof t)return function(t){return t.then(function(e){return o(e,t)})}(u);if(null===(s=i.asArray(s)))return n("expecting an array or an iterable object but got "+i.classString(s));var c=new t(e);void 0!==a&&c._propagateFrom(a,3);for(var l=c._fulfill,f=c._reject,h=0,p=s.length;h<p;++h){var d=s[h];(void 0!==d||h in s)&&t.cast(d)._then(l,f,void 0,c,null)}return c}t.race=function(t){return o(t,void 0)},t.prototype.race=function(){return o(this,void 0)}}),Ud}function xy(){return Zd||(Zd=1,Qd=function(t,e,r){var n=Qp(),i=t.TimeoutError;function o(t){this.handle=t}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return a(+this).thenReturn(t)},a=t.delay=function(n,i){var a,u;return void 0!==i?(a=t.resolve(i)._then(s,null,null,n,void 0),r.cancellation()&&i instanceof t&&a._setOnCancel(i)):(a=new t(e),u=setTimeout(function(){a._fulfill()},+n),r.cancellation()&&a._setOnCancel(new o(u)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};t.prototype.delay=function(t){return a(t,this)};function u(t){return clearTimeout(this.handle),t}function c(t){throw clearTimeout(this.handle),t}t.prototype.timeout=function(t,e){var s,a;t=+t;var l=new o(setTimeout(function(){s.isPending()&&function(t,e,r){var o;o="string"!=typeof e?e instanceof Error?e:new i("operation timed out"):new i(e),n.markAsOriginatingFromRejection(o),t._attachExtraTrace(o),t._reject(o),null!=r&&r.cancel()}(s,e,a)},t));return r.cancellation()?(a=this.then(),(s=a._then(u,c,void 0,l,void 0))._setOnCancel(l)):s=this._then(u,c,void 0,l,void 0),s}}),Qd}function Ty(){return Jd||(Jd=1,Kd=function(t,e,r,n,i,o){var s=Qp(),a=hy().TypeError,u=Qp().inherits,c=s.errorObj,l=s.tryCatch,f={};function h(t){setTimeout(function(){throw t},0)}function p(e,n){var o=0,s=e.length,a=new t(i);return function i(){if(o>=s)return a._fulfill();var u=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(e[o++]);if(u instanceof t&&u._isDisposable()){try{u=r(u._getDisposer().tryDispose(n),e.promise)}catch(t){return h(t)}if(u instanceof t)return u._then(i,h,null,null,null)}i()}(),a}function d(t,e,r){this._data=t,this._promise=e,this._context=r}function y(t,e,r){this.constructor$(t,e,r)}function m(t){return d.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function g(t){this.length=t,this.promise=null,this[t-1]=null}d.prototype.data=function(){return this._data},d.prototype.promise=function(){return this._promise},d.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():f},d.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=e!==f?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},d.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},u(y,d),y.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},g.prototype._resultCancelled=function(){for(var e=this.length,r=0;r<e;++r){var n=this[r];n instanceof t&&n.cancel()}},t.using=function(){var n=arguments.length;if(n<2)return e("you must pass at least 2 arguments to Promise.using");var i,a=arguments[n-1];if("function"!=typeof a)return e("expecting a function but got "+s.classString(a));var u=!0;2===n&&Array.isArray(arguments[0])?(n=(i=arguments[0]).length,u=!1):(i=arguments,n--);for(var f=new g(n),h=0;h<n;++h){var y=i[h];if(d.isDisposer(y)){var _=y;(y=y.promise())._setDisposable(_)}else{var b=r(y);b instanceof t&&(y=b._then(m,null,null,{resources:f,index:h},void 0))}f[h]=y}var v=new Array(f.length);for(h=0;h<v.length;++h)v[h]=t.resolve(f[h]).reflect();var w=t.all(v).then(function(t){for(var e=0;e<t.length;++e){var r=t[e];if(r.isRejected())return c.e=r.error(),c;if(!r.isFulfilled())return void w.cancel();t[e]=r.value()}S._pushContext(),a=l(a);var n=u?a.apply(void 0,t):a(t),i=S._popContext();return o.checkForgottenReturns(n,i,"Promise.using",S),n}),S=w.lastly(function(){var e=new t.PromiseInspection(w);return p(f,e)});return f.promise=S,S._setOnCancel(f),S},t.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},t.prototype._isDisposable=function(){return(131072&this._bitField)>0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(t){if("function"==typeof t)return new y(t,this,n());throw new a}}),Kd}function Oy(){return iy||(iy=1,(t=qp).exports=function(){var e=function(){return new m("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},r=function(){return new L.PromiseInspection(this._target())},n=function(t){return L.reject(new m(t))};function i(){}var o={},s=Qp();s.setReflectHandler(r);var a=function(){var t=process.domain;return void 0===t?null:t},u=function(){return{domain:a(),async:null}},c=s.isNode&&s.nodeSupportsAsyncResource?E.AsyncResource:null,l=function(){return{domain:a(),async:new c("Bluebird::Promise")}},f=s.isNode?u:function(){return null};s.notEnumerableProp(L,"_getContext",f);var h=Vp(),p=fy(),d=new p;h.defineProperty(L,"_async",{value:d});var y=hy(),m=L.TypeError=y.TypeError;L.RangeError=y.RangeError;var g=L.CancellationError=y.CancellationError;L.TimeoutError=y.TimeoutError,L.OperationalError=y.OperationalError,L.RejectionError=y.OperationalError,L.AggregateError=y.AggregateError;var _=function(){},b={},v={},w=py()(L,_),S=dy()(L,_,w,n,i),k=(ad?sd:(ad=1,sd=function(t){var e=!1,r=[];function n(){this._trace=new n.CapturedTrace(i())}function i(){var t=r.length-1;if(t>=0)return r[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var t=r.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},n.CapturedTrace=null,n.create=function(){if(e)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,u=t.prototype._promiseCreated;n.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=u,e=!1},e=!0,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},n}))(L),x=k.create,T=yy()(L,k,function(){f=l,s.notEnumerableProp(L,"_getContext",l)},function(){f=u,s.notEnumerableProp(L,"_getContext",u)});T.CapturedTrace;var O=gy()(L,w,v),j=my()(v),C=_y(),R=s.errorObj,P=s.tryCatch;function L(t){t!==_&&function(t,e){if(null==t||t.constructor!==L)throw new m("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new m("expecting a function but got "+s.classString(e))}(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function F(t){this.promise._resolveCallback(t)}function A(t){this.promise._rejectCallback(t,!1)}function I(t){var e=new L(_);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}return L.prototype.toString=function(){return"[object Promise]"},L.prototype.caught=L.prototype.catch=function(t){var e=arguments.length;if(e>1){var r,i=new Array(e-1),o=0;for(r=0;r<e-1;++r){var a=arguments[r];if(!s.isObject(a))return n("Catch statement predicate: expecting an object but got "+s.classString(a));i[o++]=a}if(i.length=o,"function"!=typeof(t=arguments[r]))throw new m("The last argument to .catch() must be a function, got "+s.toString(t));return this.then(void 0,j(i,t,this))}return this.then(void 0,t)},L.prototype.reflect=function(){return this._then(r,r,void 0,this,void 0)},L.prototype.then=function(t,e){if(T.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var r=".then() only accepts functions but was passed: "+s.classString(t);arguments.length>1&&(r+=", "+s.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},L.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},L.prototype.spread=function(t){return"function"!=typeof t?n("expecting a function but got "+s.classString(t)):this.all()._then(t,void 0,void 0,b,void 0)},L.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},L.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new S(this).promise()},L.prototype.error=function(t){return this.caught(s.originatesFromRejection,t)},L.getNewLibraryCopy=t.exports,L.is=function(t){return t instanceof L},L.fromNode=L.fromCallback=function(t){var e=new L(_);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=P(t)(C(e,r));return n===R&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},L.all=function(t){return new S(t).promise()},L.cast=function(t){var e=w(t);return e instanceof L||((e=new L(_))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},L.resolve=L.fulfilled=L.cast,L.reject=L.rejected=function(t){var e=new L(_);return e._captureStackTrace(),e._rejectCallback(t,!0),e},L.setScheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+s.classString(t));return d.setScheduler(t)},L.prototype._then=function(t,e,r,n,i){var o=void 0!==i,a=o?i:new L(_),u=this._target(),c=u._bitField;o||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===n&&2097152&this._bitField&&(n=50397184&c?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var l=f();if(50397184&c){var h,p,y=u._settlePromiseCtx;33554432&c?(p=u._rejectionHandler0,h=t):16777216&c?(p=u._fulfillmentHandler0,h=e,u._unsetRejectionIsUnhandled()):(y=u._settlePromiseLateCancellationObserver,p=new g("late cancellation observer"),u._attachExtraTrace(p),h=e),d.invoke(y,u,{handler:s.contextBind(l,h),promise:a,receiver:n,value:p})}else u._addCallbacks(t,e,a,n,l);return a},L.prototype._length=function(){return 65535&this._bitField},L.prototype._isFateSealed=function(){return!!(117506048&this._bitField)},L.prototype._isFollowing=function(){return!(67108864&~this._bitField)},L.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},L.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},L.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},L.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},L.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},L.prototype._isFinal=function(){return(4194304&this._bitField)>0},L.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},L.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},L.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},L.prototype._setAsyncGuaranteed=function(){if(!d.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},L.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&this._bitField|536870912},L.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==o)return void 0===e&&this._isBound()?this._boundValue():e},L.prototype._promiseAt=function(t){return this[4*t-4+2]},L.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},L.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},L.prototype._boundValue=function(){},L.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=o),this._addCallbacks(e,r,n,i,null)},L.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),s=t._receiverAt(e);void 0===s&&(s=o),this._addCallbacks(r,n,i,s,null)},L.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof t&&(this._fulfillmentHandler0=s.contextBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=s.contextBind(i,e));else{var a=4*o-4;this[a+2]=r,this[a+3]=n,"function"==typeof t&&(this[a+0]=s.contextBind(i,t)),"function"==typeof e&&(this[a+1]=s.contextBind(i,e))}return this._setLength(o+1),o},L.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},L.prototype._resolveCallback=function(t,r){if(!(117506048&this._bitField)){if(t===this)return this._rejectCallback(e(),!1);var n=w(t,this);if(!(n instanceof L))return this._fulfill(t);r&&this._propagateFrom(n,2);var i=n._target();if(i!==this){var o=i._bitField;if(50397184&o)if(33554432&o)this._fulfill(i._value());else if(16777216&o)this._reject(i._reason());else{var s=new g("late cancellation observer");i._attachExtraTrace(s),this._reject(s)}else{var a=this._length();a>0&&i._migrateCallback0(this);for(var u=1;u<a;++u)i._migrateCallbackAt(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(n)}}else this._reject(e())}},L.prototype._rejectCallback=function(t,e,r){var n=s.ensureErrorObject(t),i=n===t;if(!i&&!r&&T.warnings()){var o="a promise was rejected with a non-error: "+s.classString(t);this._warn(o,!0)}this._attachExtraTrace(n,!!e&&i),this._reject(t)},L.prototype._resolveFromExecutor=function(t){if(t!==_){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,r)});r=!1,this._popContext(),void 0!==n&&e._rejectCallback(n,!0)}},L.prototype._settlePromiseFromHandler=function(t,e,r,n){var i=n._bitField;if(!(65536&i)){var o;n._pushContext(),e===b?r&&"number"==typeof r.length?o=P(t).apply(this._boundValue(),r):(o=R).e=new m("cannot .spread() a non-array: "+s.classString(r)):o=P(t).call(e,r);var a=n._popContext();65536&(i=n._bitField)||(o===v?n._reject(r):o===R?n._rejectCallback(o.e,!1):(T.checkForgottenReturns(o,a,"",n,this),n._resolveCallback(o)))}},L.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},L.prototype._followee=function(){return this._rejectionHandler0},L.prototype._setFollowee=function(t){this._rejectionHandler0=t},L.prototype._settlePromise=function(t,e,n,o){var s=t instanceof L,a=this._bitField,u=!!(134217728&a);65536&a?(s&&t._invokeInternalOnCancel(),n instanceof O&&n.isFinallyHandler()?(n.cancelPromise=t,P(e).call(n,o)===R&&t._reject(R.e)):e===r?t._fulfill(r.call(n)):n instanceof i?n._promiseCancelled(t):s||t instanceof S?t._cancel():n.cancel()):"function"==typeof e?s?(u&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,n,o,t)):e.call(n,o,t):n instanceof i?n._isResolved()||(33554432&a?n._promiseFulfilled(o,t):n._promiseRejected(o,t)):s&&(u&&t._setAsyncGuaranteed(),33554432&a?t._fulfill(o):t._reject(o))},L.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,r=t.promise,n=t.receiver,i=t.value;"function"==typeof e?r instanceof L?this._settlePromiseFromHandler(e,n,i,r):e.call(n,i,r):r instanceof L&&r._reject(i)},L.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},L.prototype._settlePromise0=function(t,e,r){var n=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(n,t,i,e)},L.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},L.prototype._fulfill=function(t){var r=this._bitField;if(!((117506048&r)>>>16)){if(t===this){var n=e();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&r)>0&&(134217728&r?this._settlePromises():d.settlePromises(this),this._dereferenceTrace())}},L.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return d.fatalError(t,s.isNode);(65535&e)>0?d.settlePromises(this):this._ensurePossibleRejectionHandled()}},L.prototype._fulfillPromises=function(t,e){for(var r=1;r<t;r++){var n=this._fulfillmentHandlerAt(r),i=this._promiseAt(r),o=this._receiverAt(r);this._clearCallbackDataAtIndex(r),this._settlePromise(i,n,o,e)}},L.prototype._rejectPromises=function(t,e){for(var r=1;r<t;r++){var n=this._rejectionHandlerAt(r),i=this._promiseAt(r),o=this._receiverAt(r);this._clearCallbackDataAtIndex(r),this._settlePromise(i,n,o,e)}},L.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(16842752&t){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},L.prototype._settledValue=function(){var t=this._bitField;return 33554432&t?this._rejectionHandler0:16777216&t?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&h.defineProperty(L.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),L.defer=L.pending=function(){return T.deprecated("Promise.defer","new Promise"),{promise:new L(_),resolve:F,reject:A}},s.notEnumerableProp(L,"_makeSelfResolutionError",e),(gd||(gd=1,md=function(t,e,r,n,i){var o=Qp(),s=o.tryCatch;t.method=function(r){if("function"!=typeof r)throw new t.TypeError("expecting a function but got "+o.classString(r));return function(){var n=new t(e);n._captureStackTrace(),n._pushContext();var o=s(r).apply(this,arguments),a=n._popContext();return i.checkForgottenReturns(o,a,"Promise.method",n),n._resolveFromSyncValue(o),n}},t.attempt=t.try=function(r){if("function"!=typeof r)return n("expecting a function but got "+o.classString(r));var a,u=new t(e);if(u._captureStackTrace(),u._pushContext(),arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],l=arguments[2];a=o.isArray(c)?s(r).apply(l,c):s(r).call(l,c)}else a=s(r)();var f=u._popContext();return i.checkForgottenReturns(a,f,"Promise.try",u),u._resolveFromSyncValue(a),u},t.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}),md)(L,_,w,n,T),(bd||(bd=1,_d=function(t,e,r,n){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){50397184&this._bitField||this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var c=r(o),l=new t(e);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(e,s,void 0,l,h),c._then(a,u,void 0,l,h),l._setOnCancel(c)}else l._resolveCallback(f);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return!(2097152&~this._bitField)},t.bind=function(e,r){return t.resolve(r).bind(e)}}),_d)(L,_,w,T),(wd||(wd=1,vd=function(t,e,r,n){var i=Qp(),o=i.tryCatch,s=i.errorObj,a=t._async;t.prototype.break=t.prototype.cancel=function(){if(!n.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var r=t._cancellationParent;if(null==r||!r._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=r}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),a.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(t,e){if(i.isArray(t))for(var r=0;r<t.length;++r)this._doInvokeOnCancel(t[r],e);else if(void 0!==t)if("function"==typeof t){if(!e){var n=o(t).call(this._boundValue());n===s&&(this._attachExtraTrace(n.e),a.throwLater(n.e))}}else t._resultCancelled(this)},t.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),a.invoke(this._doInvokeOnCancel,this,t)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}),vd)(L,S,n,T),(Ed||(Ed=1,Sd=function(t){function e(){return this.value}function r(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(r){return r instanceof t&&r.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:r},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(r,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof t&&r.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:r},void 0);var n=arguments[1];return n instanceof t&&n.suppressUnhandledRejections(),this.caught(r,function(){return n})}}),Sd)(L),by()(L),(Od||(Od=1,Td=function(t,e,r,n,i){var o,s=Qp(),a=s.canEvaluate,u=s.tryCatch,c=s.errorObj;if(a){for(var l=function(t){return new Function("value","holder"," \n\t 'use strict'; \n\t holder.pIndex = value; \n\t holder.checkFulfillment(this); \n\t ".replace(/Index/g,t))},f=function(t){return new Function("promise","holder"," \n\t 'use strict'; \n\t holder.pIndex = promise; \n\t ".replace(/Index/g,t))},h=function(e){for(var r=new Array(e),n=0;n<r.length;++n)r[n]="this.p"+(n+1);var o=r.join(" = ")+" = null;",s="var promise;\n"+r.map(function(t){return" \n\t promise = "+t+"; \n\t if (promise instanceof Promise) { \n\t promise.cancel(); \n\t } \n\t "}).join("\n"),a=r.join(", "),l="Holder$"+e,f="return function(tryCatch, errorObj, Promise, async) { \n\t 'use strict'; \n\t function [TheName](fn) { \n\t [TheProperties] \n\t this.fn = fn; \n\t this.asyncNeeded = true; \n\t this.now = 0; \n\t } \n\t \n\t [TheName].prototype._callFunction = function(promise) { \n\t promise._pushContext(); \n\t var ret = tryCatch(this.fn)([ThePassedArguments]); \n\t promise._popContext(); \n\t if (ret === errorObj) { \n\t promise._rejectCallback(ret.e, false); \n\t } else { \n\t promise._resolveCallback(ret); \n\t } \n\t }; \n\t \n\t [TheName].prototype.checkFulfillment = function(promise) { \n\t var now = ++this.now; \n\t if (now === [TheTotal]) { \n\t if (this.asyncNeeded) { \n\t async.invoke(this._callFunction, this, promise); \n\t } else { \n\t this._callFunction(promise); \n\t } \n\t \n\t } \n\t }; \n\t \n\t [TheName].prototype._resultCancelled = function() { \n\t [CancellationCode] \n\t }; \n\t \n\t return [TheName]; \n\t }(tryCatch, errorObj, Promise, async); \n\t ";return f=f.replace(/\[TheName\]/g,l).replace(/\[TheTotal\]/g,e).replace(/\[ThePassedArguments\]/g,a).replace(/\[TheProperties\]/g,o).replace(/\[CancellationCode\]/g,s),new Function("tryCatch","errorObj","Promise","async",f)(u,c,t,i)},p=[],d=[],y=[],m=0;m<8;++m)p.push(h(m+1)),d.push(l(m+1)),y.push(f(m+1));o=function(t){this._reject(t)}}t.join=function(){var i,u=arguments.length-1;if(u>0&&"function"==typeof arguments[u]&&(i=arguments[u],u<=8&&a)){(w=new t(n))._captureStackTrace();for(var c=new(0,p[u-1])(i),l=d,f=0;f<u;++f){var h=r(arguments[f],w);if(h instanceof t){var m=(h=h._target())._bitField;50397184&m?33554432&m?l[f].call(w,h._value(),c):16777216&m?w._reject(h._reason()):w._cancel():(h._then(l[f],o,void 0,w,c),y[f](h,c),c.asyncNeeded=!1)}else l[f].call(w,h,c)}if(!w._isFateSealed()){if(c.asyncNeeded){var g=t._getContext();c.fn=s.contextBind(g,c.fn)}w._setAsyncGuaranteed(),w._setOnCancel(c)}return w}for(var _=arguments.length,b=new Array(_),v=0;v<_;++v)b[v]=arguments[v];i&&b.pop();var w=new e(b).promise();return void 0!==i?w.spread(i):w}}),Td)(L,S,w,_,d),L.Promise=L,L.version="3.7.2",function(){if(Cd)return jd;Cd=1;var t=Object.create;if(t){var e=t(null),r=t(null);e[" size"]=r[" size"]=0}return jd=function(t){var n,i,o=Qp(),s=o.canEvaluate,a=o.isIdentifier,u=function(t){return new Function("ensureMethod"," \n\t return function(obj) { \n\t 'use strict' \n\t var len = this.length; \n\t ensureMethod(obj, 'methodName'); \n\t switch(len) { \n\t case 1: return obj.methodName(this[0]); \n\t case 2: return obj.methodName(this[0], this[1]); \n\t case 3: return obj.methodName(this[0], this[1], this[2]); \n\t case 0: return obj.methodName(); \n\t default: \n\t return obj.methodName.apply(obj, this); \n\t } \n\t }; \n\t ".replace(/methodName/g,t))(f)},c=function(t){return new Function("obj"," \n\t 'use strict'; \n\t return obj.propertyName; \n\t ".replace("propertyName",t))},l=function(t,e,r){var n=r[t];if("function"!=typeof n){if(!a(t))return null;if(n=e(t),r[t]=n,r[" size"]++,r[" size"]>512){for(var i=Object.keys(r),o=0;o<256;++o)delete r[i[o]];r[" size"]=i.length-256}}return n};function f(e,r){var n;if(null!=e&&(n=e[r]),"function"!=typeof n){var i="Object "+o.classString(e)+" has no method '"+o.toString(r)+"'";throw new t.TypeError(i)}return n}function h(t){return f(t,this.pop()).apply(t,this)}function p(t){return t[this]}function d(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}n=function(t){return l(t,u,e)},i=function(t){return l(t,c,r)},t.prototype.call=function(t){for(var e=arguments.length,r=new Array(Math.max(e-1,0)),i=1;i<e;++i)r[i-1]=arguments[i];if(s){var o=n(t);if(null!==o)return this._then(o,void 0,void 0,r,void 0)}return r.push(t),this._then(h,void 0,void 0,r,void 0)},t.prototype.get=function(t){var e;if("number"==typeof t)e=d;else if(s){var r=i(t);e=null!==r?r:p}else e=p;return this._then(e,void 0,void 0,t,void 0)}},jd}()(L),vy()(L,n,_,w,i,T),wy()(L,S,n,w,_,T),(Id||(Id=1,Ad=function(t){var e=Qp(),r=t._async,n=e.tryCatch,i=e.errorObj;function o(t,o){if(!e.isArray(t))return s.call(this,t,o);var a=n(o).apply(this._boundValue(),[null].concat(t));a===i&&r.throwLater(a.e)}function s(t,e){var o=this._boundValue(),s=void 0===t?n(e).call(o,null):n(e).call(o,null,t);s===i&&r.throwLater(s.e)}function a(t,e){if(!t){var o=new Error(t+"");o.cause=t,t=o}var s=n(e).call(this._boundValue(),t);s===i&&r.throwLater(s.e)}t.prototype.asCallback=t.prototype.nodeify=function(t,e){if("function"==typeof t){var r=s;void 0!==e&&Object(e).spread&&(r=o),this._then(r,a,void 0,this,t)}return this}}),Ad)(L),Sy()(L,_),Ey()(L,S,w,n),ky()(L,_,w,n),(Hd||(Hd=1,Wd=function(t,e,r,n,i,o){var s=Qp(),a=s.tryCatch;function u(e,r,n,o){this.constructor$(e);var a=t._getContext();this._fn=s.contextBind(a,r),void 0!==n&&(n=t.resolve(n))._attachCancellationCallback(this),this._initialValue=n,this._currentCancellable=null,this._eachValues=o===i?Array(this._length):0===o?null:void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){return"function"!=typeof e?r("expecting a function but got "+s.classString(e)):new u(t,e,n,i).promise()}function f(e){this.accum=e,this.array._gotAccum(e);var r=n(this.value,this.array._promise);return r instanceof t?(this.array._currentCancellable=r,r._then(h,void 0,void 0,this,void 0)):h.call(this,r)}function h(e){var r,n=this.array,i=n._promise,s=a(n._fn);i._pushContext(),(r=void 0!==n._eachValues?s.call(i._boundValue(),e,this.index,this.length):s.call(i._boundValue(),this.accum,e,this.index,this.length))instanceof t&&(n._currentCancellable=r);var u=i._popContext();return o.checkForgottenReturns(r,u,void 0!==n._eachValues?"Promise.each":"Promise.reduce",i),r}s.inherits(u,e),u.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==i&&this._eachValues.push(t)},u.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},u.prototype._init=function(){},u.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},u.prototype.shouldCopyValues=function(){return!1},u.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},u.prototype._resultCancelled=function(e){if(e===this._initialValue)return this._cancel();this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof t&&this._currentCancellable.cancel(),this._initialValue instanceof t&&this._initialValue.cancel())},u.prototype._iterate=function(e){var r,n;this._values=e;var i=e.length;void 0!==this._initialValue?(r=this._initialValue,n=0):(r=t.resolve(e[0]),n=1),this._currentCancellable=r;for(var o=n;o<i;++o){var s=e[o];s instanceof t&&s.suppressUnhandledRejections()}if(!r.isRejected())for(;n<i;++n){var a={accum:null,value:e[n],index:n,length:i,array:this};r=r._then(f,void 0,void 0,a,void 0),127&n||r._setNoAsyncGuarantee()}void 0!==this._eachValues&&(r=r._then(this._eachComplete,void 0,void 0,this,void 0)),r._then(c,c,void 0,r,this)},t.prototype.reduce=function(t,e){return l(this,t,e,null)},t.reduce=function(t,e,r,n){return l(t,e,r,n)}}),Wd)(L,S,n,w,_,T),(qd||(qd=1,$d=function(t,e,r){var n=t.PromiseInspection;function i(t){this.constructor$(t)}Qp().inherits(i,e),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},i.prototype._promiseFulfilled=function(t,e){var r=new n;return r._bitField=33554432,r._settledValueField=t,this._promiseResolved(e,r)},i.prototype._promiseRejected=function(t,e){var r=new n;return r._bitField=16777216,r._settledValueField=t,this._promiseResolved(e,r)},t.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},t.allSettled=function(t){return new i(t).promise()},t.prototype.settle=function(){return t.settle(this)}}),$d)(L,S,T),(Vd||(Vd=1,Gd=function(t,e,r){var n=Qp(),i=hy().RangeError,o=hy().AggregateError,s=n.isArray,a={};function u(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function c(t,e){if((0|e)!==e||e<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new u(t),i=n.promise();return n.setHowMany(e),n.init(),i}n.inherits(u,e),u.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(t){this._howMany=t},u.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},u.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(a),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e<this._values.length;++e)this._values[e]!==a&&t.push(this._values[e]);return t.length>0?this._reject(t):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(t){this._values.push(t)},u.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new i(e)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(t,e){return c(t,e)},t.prototype.some=function(t){return c(this,t)},t._SomePromiseArray=u}),Gd)(L,S,n),xy()(L,_,T),Ty()(L,n,w,x,_,T),(Xd||(Xd=1,Yd=function(t){var e=t._SomePromiseArray;function r(t){var r=new e(t),n=r.promise();return r.setHowMany(1),r.setUnwrap(),r.init(),n}t.any=function(t){return r(t)},t.prototype.any=function(){return r(this)}}),Yd)(L),(ey?ty:(ey=1,ty=function(t,e){var r=t.reduce,n=t.all;function i(){return n(this)}t.prototype.each=function(t){return r(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,e,e)},t.each=function(t,n){return r(t,n,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,n){return r(t,n,e,e)}}))(L,_),(ny?ry:(ny=1,ry=function(t,e){var r=t.map;t.prototype.filter=function(t,n){return r(this,t,n,e)},t.filter=function(t,n,i){return r(t,n,i,e)}}))(L,_),s.toFastProperties(L),s.toFastProperties(L.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new L(_)),T.setBounds(p.firstLineError,s.lastLineError),L}),qp.exports;var t}function jy(){if(uy)return ay;uy=1;const t=hf(),e=zp(),r=pf(),n=yf(),i=y,o=Lp(),s=mf(),a=df(),u=function(){if(sy)return oy;var t;sy=1,"undefined"!=typeof Promise&&(t=Promise);var e=Oy()();return e.noConflict=function(){try{Promise===e&&(Promise=t)}catch(t){}return e},oy=e}(),c=Buffer.alloc(4);return c.writeUInt32LE(101010256,0),ay=function(l,f){const h=t(),p=t(),d=f&&f.tailSize||80;let y,m,g,_;return f&&f.crx&&(m=function(e){const r=e.stream(0).pipe(t());return r.pull(4).then(function(t){if(875721283===t.readUInt32LE(0)){let t;return r.pull(12).then(function(e){t=a.parse(e,[["version",4],["pubKeyLength",4],["signatureLength",4]])}).then(function(){return r.pull(t.pubKeyLength+t.signatureLength)}).then(function(e){return t.publicKey=e.slice(0,t.pubKeyLength),t.signature=e.slice(t.pubKeyLength),t.size=16+t.pubKeyLength+t.signatureLength,t})}})}(l)),l.size().then(function(t){return y=t,l.stream(Math.max(0,t-d)).on("error",function(t){h.emit("error",t)}).pipe(h),h.pull(c)}).then(function(){return u.props({directory:h.pull(22),crxHeader:m})}).then(function(e){const r=e.directory;if(g=e.crxHeader&&e.crxHeader.size||0,_=a.parse(r,[["signature",4],["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]),65535==_.diskNumber||65535==_.numberOfRecords||4294967295==_.offsetToStartOfCentralDirectory){const e=20,r=y-(d-h.match+e),n=t();return l.stream(r).pipe(n),n.pull(e).then(function(e){return function(e,r){const n=a.parse(r,[["signature",4],["diskNumber",4],["offsetToStartOfCentralDirectory",8],["numberOfDisks",4]]);if(117853008!=n.signature)throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x"+n.signature.toString(16));const i=t();return e.stream(n.offsetToStartOfCentralDirectory).pipe(i),i.pull(56)}(l,e)}).then(function(t){_=function(t){const e=a.parse(t,[["signature",4],["sizeOfCentralDirectory",8],["version",2],["versionsNeededToExtract",2],["diskNumber",4],["diskStart",4],["numberOfRecordsOnDisk",8],["numberOfRecords",8],["sizeOfCentralDirectory",8],["offsetToStartOfCentralDirectory",8]]);if(101075792!=e.signature)throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0"+e.signature.toString(16));return e}(t)})}_.offsetToStartOfCentralDirectory+=g}).then(function(){if(_.commentLength)return h.pull(_.commentLength).then(function(t){_.comment=t.toString("utf8")})}).then(function(){return l.stream(_.offsetToStartOfCentralDirectory).pipe(p),_.extract=function(t){if(!t||!t.path)throw new Error("PATH_MISSING");return t.path=i.resolve(i.normalize(t.path)),_.files.then(function(e){return u.map(e,async function(e){const r=i.join(t.path,e.path);if(0!=r.indexOf(t.path))return;if("Directory"==e.type)return void await o.ensureDir(r);await o.ensureDir(i.dirname(r));const n=t.getWriter?t.getWriter({path:r}):o.createWriteStream(r);return new Promise(function(r,i){e.stream(t.password).on("error",i).pipe(n).on("close",r).on("error",i)})},{concurrency:t.concurrency>1?t.concurrency:1})})},_.files=u.mapSeries(Array(_.numberOfRecords),function(){return p.pull(46).then(function(t){const i=a.parse(t,[["signature",4],["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return i.offsetToLocalFileHeader+=g,i.lastModifiedDateTime=s(i.lastModifiedDate,i.lastModifiedTime),p.pull(i.fileNameLength).then(function(t){return i.pathBuffer=t,i.path=t.toString("utf8"),i.isUnicode=!!(2048&i.flags),p.pull(i.extraFieldLength)}).then(function(t){return i.extra=n(t,i),p.pull(i.fileCommentLength)}).then(function(t){i.comment=t,i.type=0===i.uncompressedSize&&/[/\\]$/.test(i.path)?"Directory":"File";const n=f&&f.padding||1e3;return i.stream=function(t){const r=30+n+(i.extraFieldLength||0)+(i.fileNameLength||0)+i.compressedSize;return e(l,i.offsetToLocalFileHeader,t,i,r)},i.buffer=function(t){return r(i.stream(t))},i})})}),u.props(_)})},ay}var Cy,Ry,Py,Ly=M(Object.freeze({__proto__:null,default:{}}));var Fy=(Py||(Py=1,ff.Parse=gf(),ff.ParseOne=function(){if(Qf)return Vf;Qf=1;const t=g,e=gf(),r=th(),n=pf();return Vf=function(i,o){const s=t.PassThrough({objectMode:!0}),a=t.PassThrough(),u=t.Transform({objectMode:!0}),c=i instanceof RegExp?i:i&&new RegExp(i);let l;u._transform=function(t,e,r){if(l||c&&!c.exec(t.path))return t.autodrain(),r();l=!0,f.emit("entry",t),t.on("error",function(t){a.emit("error",t)}),t.pipe(a).on("error",function(t){r(t)}).on("finish",function(t){r(null,t)})},s.pipe(e(o)).on("error",function(t){a.emit("error",t)}).pipe(u).on("error",Object).on("finish",function(){l?a.end():a.emit("error",new Error("PATTERN_NOT_FOUND"))});const f=r(s,a);return f.buffer=function(){return n(a)},f},Vf}(),ff.Extract=function(){if(lp)return cp;lp=1,cp=function(o){o.path=r.resolve(r.normalize(o.path));const s=new t(o),a=new n.Writable({objectMode:!0});a._write=async function(t,n,i){const s=r.join(o.path,t.path.replace(/\\/g,"/"));if(0!=s.indexOf(o.path))return i();if("Directory"==t.type)return await e.ensureDir(s),i();await e.ensureDir(r.dirname(s));const a=o.getWriter?o.getWriter({path:s}):e.createWriteStream(s);t.pipe(a).on("error",i).on("close",i)};const u=i(s,a);return s.once("crx-header",function(t){u.crxHeader=t}),s.pipe(a).on("finish",function(){u.emit("close")}),u.promise=function(){return new Promise(function(t,e){u.on("close",t),u.on("error",e)})},u};const t=gf(),e=Lp(),r=y,n=g,i=th();return cp}(),ff.Open=function(){if(Ry)return Cy;Ry=1;const t=hr(),e=jy(),r=g;return Cy={buffer:function(t,n){const i={stream:function(e,n){const i=r.PassThrough(),o=n?e+n:void 0;return i.end(t.slice(e,o)),i},size:function(){return Promise.resolve(t.length)}};return e(i,n)},file:function(r,n){const i={stream:function(e,n){const i=n?e+n:void 0;return t.createReadStream(r,{start:e,end:i})},size:function(){return new Promise(function(e,n){t.stat(r,function(t,r){t?n(t):e(r.size)})})}};return e(i,n)},url:function(t,r,n){if("string"==typeof r&&(r={url:r}),!r.url)throw"URL missing";r.headers=r.headers||{};const i={stream:function(e,n){const i=Object.create(r),o=n?e+n:"";return i.headers=Object.create(r.headers),i.headers.range="bytes="+e+"-"+o,t(i)},size:function(){return new Promise(function(e,n){const i=t(r);i.on("response",function(t){i.abort(),t.headers["content-length"]?e(t.headers["content-length"]):n(new Error("Missing content length header"))}).on("error",n)})}};return e(i,n)},s3:function(t,r,n){const i={size:function(){return new Promise(function(e,n){t.headObject(r,function(t,r){t?n(t):e(r.ContentLength)})})},stream:function(e,n){const i={};for(const t in r)i[t]=r[t];const o=n?e+n:"";return i.Range="bytes="+e+"-"+o,t.getObject(i).createReadStream()}};return e(i,n)},s3_v3:function(t,n,i){const{GetObjectCommand:o,HeadObjectCommand:s}=Ly,a={size:async()=>{const e=await t.send(new s({Bucket:n.Bucket,Key:n.Key}));return e.ContentLength?e.ContentLength:0},stream:(e,i)=>{const s=r.PassThrough(),a=i?e+i:"";return t.send(new o({Bucket:n.Bucket,Key:n.Key,Range:`bytes=${e}-${a}`})).then(t=>{t.Body.pipe(s)}).catch(t=>{s.emit("error",t)}),s}};return e(a,i)},custom:function(t,r){return e(t,r)}},Cy}()),ff),Ay=D(Fy);const Iy=new Map,Dy=new Map;function My(t,e){const r={sessionId:e,backupId:t,status:"pending",phase:"Initializing backup restore",progressPercentage:0,progressCurrent:0,progressTotal:0,startTime:(new Date).toISOString(),elapsedSeconds:0,errors:[]};Iy.set(e,r),function(t){const e=setInterval(()=>{const r=Iy.get(t);if(!r)return void clearInterval(e);const n=new Date(r.startTime).getTime(),i=Math.floor((Date.now()-n)/1e3);r.elapsedSeconds=i,"running"!==r.status&&clearInterval(e)},1e3)}(e)}function Ny(t,e){const r=Iy.get(t);if(!r)return;const n="completed"===r.status||"failed"===r.status;Object.assign(r,e),n||(r.status="running")}function By(t,e){const r=Iy.get(t);r&&r.errors.push({...e,timestamp:(new Date).toISOString()})}function Uy(t){return Iy.get(t)??null}function zy(t,e){const r=Iy.get(t);if(!r)return;r.status=e,r.phase="completed"===e?"Restore completed":"Restore failed",r.progressPercentage=100;const n=setTimeout(()=>{Iy.delete(t),Dy.delete(t)},6e4);Dy.set(t,n)}function Wy(){return l(process.env.BACKUP_PATH??"/directus/backups","restore-logs")}function Hy(){const t=Wy();e(t)||n(t,{recursive:!0})}const $y=new Set(["directus_access","directus_activity","directus_collections","directus_comments","directus_dashboards","directus_extensions","directus_fields","directus_files","directus_flows","directus_folders","directus_migrations","directus_notifications","directus_operations","directus_panels","directus_permissions","directus_policies","directus_presets","directus_relations","directus_revisions","directus_roles","directus_sessions","directus_settings","directus_shares","directus_translations","directus_users","directus_versions","directus_webhooks"]);function qy(){return process.env.BACKUP_PATH??"/directus/backups"}function Gy(){const t=qy();e(t)||n(t,{recursive:!0})}let Vy=null;function Qy(){return l(qy(),"schedule.json")}function Zy(){const r=Qy();if(!e(r))return{enabled:!1,cronExpression:"0 2 * * *"};try{const e=t(r,"utf-8");return JSON.parse(e)}catch{return{enabled:!1,cronExpression:"0 2 * * *"}}}function Ky(t){Gy(),r(Qy(),JSON.stringify(t,null,2),"utf-8")}function Jy(t){null!==Vy&&clearInterval(Vy),Vy=setInterval(async()=>{try{const e=Zy();if(!e.enabled)return;const r=new Date,n=new Date(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes());if(!function(t,e){const r=t.trim().split(/\s+/);if(5!==r.length)return!1;function n(t,e){if("*"===t)return!0;if(t.includes("/")){const[,r]=t.split("/"),n=parseInt(r??"1",10);return e%n===0}if(t.includes(","))return t.split(",").some(t=>parseInt(t,10)===e);if(t.includes("-")){const[r,n]=t.split("-"),i=parseInt(r??"0",10),o=parseInt(n??"0",10);return e>=i&&e<=o}return parseInt(t,10)===e}const[i,o,s,a,u]=r;return n(i,e.getMinutes())&&n(o,e.getHours())&&n(s,e.getDate())&&n(a,e.getMonth()+1)&&n(u,e.getDay())}(e.cronExpression,n))return;if(e.lastRun){const t=new Date(e.lastRun);if(new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes()).getTime()===n.getTime())return}t.logger.info("[acuity-backup] Scheduled backup triggered"),await tm(t,{type:"full",includeMedia:!0}),Ky({...e,lastRun:r.toISOString()})}catch(e){t.logger.error("[acuity-backup] Scheduled backup failed:",e)}},6e4)}async function Yy(t){const{CollectionsService:e}=t.services,r=new e({schema:await t.getSchema(),accountability:null});return(await r.readByQuery()).filter(t=>!$y.has(t.collection)&&!t.collection.startsWith("directus_")).map(t=>t.collection)}async function Xy(t,e){const{ItemsService:r}=t.services,n=new r(e,{schema:await t.getSchema(),accountability:null});return await n.readByQuery({limit:-1,fields:["*"]})}async function tm(n,s){const a=await async function(t,e){Gy();const n=(new Date).toISOString().replace(/[:.]/g,"-"),i=k(),s=`backup-${n}-${i}.zip`,a=l(qy(),s),c=await t.getSchema(),{RelationsService:f}=t.services,h="full"===e.type?await Yy(t):e.collections??[],p={};let d=0;for(const e of h)try{const r=await Xy(t,e);p[e]=r,d+=r.length}catch(r){t.logger.warn(`[acuity-backup] Failed to export collection "${e}":`,r),p[e]=[]}const y=new f({schema:c,accountability:null}),m=await y.readAll(),g=await async function(t,e){const r=await t.getSchema(),{ItemsService:n}=t.services;let i=[];try{const t=new n("directus_fields",{schema:r,accountability:null});i=(await t.readByQuery({limit:-1,filter:{collection:{_in:e}},fields:["collection","field","group"]})).filter(t=>null!==t.group&&void 0!==t.group).map(t=>({collection:t.collection,field:t.field,group:t.group}))}catch(e){t.logger.warn("[acuity-backup] Failed to export field groups:",e)}let o=[];try{const t=new n("directus_collections",{schema:r,accountability:null});o=(await t.readByQuery({limit:-1,filter:{collection:{_in:e}},fields:["*"]})).map(t=>{const{collection:e,...r}=t;return{collection:t.collection,display:null,display_template:t.display_template??null,sort_field:t.sort_field??null,hidden:t.hidden??!1,sort:t.sort??null,icon:t.icon??null,note:t.note??null,meta:r}})}catch(e){t.logger.warn("[acuity-backup] Failed to export collection views:",e)}return{schemaVersion:"1.0",fieldGroups:i,collectionViews:o}}(t,h);let _=[];try{const{ItemsService:e}=t.services,r=new e("directus_fields",{schema:c,accountability:null});_=await r.readByQuery({limit:-1,filter:{collection:{_in:h}},fields:["*"]})}catch(e){t.logger.warn("[acuity-backup] Failed to export field metadata:",e)}let b=[];try{const{ItemsService:e}=t.services,r=new e("directus_presets",{schema:c,accountability:null});b=await r.readByQuery({limit:-1,filter:{collection:{_in:h}},fields:["*"]})}catch(e){t.logger.warn("[acuity-backup] Failed to export collection presets:",e)}let v=[];if(e.includeMedia)try{const{ItemsService:e}=t.services,r=new e("directus_files",{schema:c,accountability:null});v=await r.readByQuery({limit:-1,fields:["*"]})}catch(e){t.logger.warn("[acuity-backup] Failed to list media files:",e)}const w={timestamp:(new Date).toISOString(),version:"1.2.0",type:e.type,collections:h,includeMedia:e.includeMedia,totalItems:d,fileSize:0,includesViewsAndGroups:!0};await new Promise((t,r)=>{const n=o(a),i=lf("zip",{zlib:{level:6}});n.on("close",t),i.on("error",r),i.pipe(n),i.append(JSON.stringify(c,null,2),{name:"schema.json"}),i.append(JSON.stringify(m,null,2),{name:"relations.json"}),i.append(JSON.stringify(g,null,2),{name:"views.json"}),i.append(JSON.stringify(_,null,2),{name:"fields-meta.json"}),i.append(JSON.stringify(b,null,2),{name:"presets.json"}),i.append(JSON.stringify(w,null,2),{name:"manifest.json"});for(const[t,e]of Object.entries(p))i.append(JSON.stringify(e,null,2),{name:`collections/${t}.json`});if(e.includeMedia&&v.length>0)for(const t of v)i.append(JSON.stringify(t,null,2),{name:`files/${t.id}.meta.json`});i.finalize()});try{const t=await u(a);w.fileSize=t.size;const e=a.replace(/\.zip$/,".meta.json"),n={id:i,filename:s,timestamp:w.timestamp,type:w.type,collections:w.collections,includeMedia:w.includeMedia,fileSize:w.fileSize};r(e,JSON.stringify(n,null,2),"utf-8")}catch{}return a}(n,s),c=f(a),h=a.replace(/\.zip$/,".meta.json");let p;p=e(h)?JSON.parse(t(h,"utf-8")):{id:k(),filename:c,timestamp:(new Date).toISOString(),type:s.type,collections:s.collections??[],includeMedia:s.includeMedia,fileSize:0};try{const{FilesService:t}=n.services,e=new t({schema:await n.getSchema(),accountability:null}),o=i(a),s=await e.uploadOne(o,{storage:process.env.STORAGE_DEFAULT??process.env.STORAGE_LOCATIONS?.split(",")[0]?.trim()??"local",filename_download:c,type:"application/zip",title:`Backup ${p.timestamp}`});p.directusFileId=String(s),r(h,JSON.stringify(p,null,2),"utf-8")}catch(t){n.logger.warn("[acuity-backup] Failed to upload backup to Directus Files:",t)}return p}async function em(){Gy();const e=qy();let r;try{r=await s(e)}catch{return[]}const n=r.filter(t=>t.endsWith(".meta.json")),i=[];for(const r of n)try{const n=t(l(e,r),"utf-8");i.push(JSON.parse(n))}catch{}return i.sort((t,e)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime())}async function rm(t,n,i){const o=qy(),{backupId:a,truncateCollections:u=!1,collections:c,adminUserId:f}=n;i&&(My(a,i),Ny(i,{phase:"Finding backup archive",progressPercentage:5}));let h,p=null;try{h=await s(o)}catch{throw new Error("Backup directory is not accessible")}for(const t of h)if(t.endsWith(".zip")&&t.includes(a)){p=l(o,t);break}if(!p||!e(p))throw new Error(`Backup with id "${a}" not found`);i&&Ny(i,{phase:"Extracting ZIP archive",progressPercentage:10}),t.logger.info("[acuity-backup] Opening ZIP: "+p);const{ItemsService:d}=t.services,y={},m={},g=await Ay.Open.file(p);for(const t of g.files){const e=t.path;if(e.startsWith("collections/")||"manifest.json"===e||"schema.json"===e||"relations.json"===e||"views.json"===e||"fields-meta.json"===e||"presets.json"===e||e.startsWith("files/")&&e.endsWith(".meta.json")){const r=await t.buffer();e.startsWith("collections/")?y[e]=r:m[e]=r}}t.logger.info(`[acuity-backup] ZIP extracted: ${Object.keys(y).length} collection files, ${Object.keys(m).length} meta files`),i&&Ny(i,{phase:"Extraction complete",progressPercentage:20});const _=m["manifest.json"];if(!_)throw new Error("Invalid backup archive: manifest.json not found");const b=JSON.parse(_.toString("utf-8"));let v={},w=[],S=null;const E=m["schema.json"];if(E)try{v=JSON.parse(E.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse schema.json:",e)}const k=m["relations.json"];if(k)try{w=JSON.parse(k.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse relations.json:",e)}const x=m["views.json"];if(x)try{S=JSON.parse(x.toString("utf-8"))}catch{}let T=[];const O=m["fields-meta.json"];if(O)try{T=JSON.parse(O.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse fields-meta.json:",e)}let j=[];const C=m["presets.json"];if(C)try{j=JSON.parse(C.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse presets.json:",e)}const R=new Map;for(const t of w){const e=t;"directus_files"===e.related_collection&&e.collection&&e.field&&(R.has(e.collection)||R.set(e.collection,new Set),R.get(e.collection).add(e.field))}for(const t of T){const e=t.special;if(e&&Array.isArray(e)&&e.includes("file")){const e=t.collection,r=t.field;R.has(e)||R.set(e,new Set),R.get(e).add(r)}}const P=new Map;for(const t of w){const e=t;e.collection&&e.field&&(P.has(e.collection)||P.set(e.collection,new Set),P.get(e.collection).add(e.field))}for(const t of T){const e=t.special;if(e&&Array.isArray(e)&&(e.includes("m2o")||e.includes("file")||e.includes("user-created")||e.includes("user-updated"))){const e=t.collection,r=t.field;P.has(e)||P.set(e,new Set),P.get(e).add(r)}}const L=new Map;for(const t of T){const e=t.special;if(e&&Array.isArray(e)&&(e.includes("user-created")||e.includes("user-updated"))){const e=t.collection,r=t.field;L.has(e)||L.set(e,new Set),L.get(e).add(r)}}for(const t of w){const e=t;"directus_users"===e.related_collection&&e.collection&&e.field&&(L.has(e.collection)||L.set(e.collection,new Set),L.get(e.collection).add(e.field))}L.size>0&&t.logger.info(`[acuity-backup] Will remap user references in ${L.size} collections to admin user ${f??"(null)"}`);const F=c??b.collections,A=[];let I=0,D=0,M=0;await async function(t,e,r,n,i,o){const s=await t.getSchema(),{CollectionsService:a,RelationsService:u}=t.services,c=[];let l=0;const f=e?.collections??{},h=new Map;for(const t of o){const e=`${t.collection}.${t.field}`;h.set(e,t)}const p=new a({schema:s,accountability:null});if(i){const e=[];for(const t of i.collectionViews){const r=t.collection;f[r]||n.includes(r)&&e.push(t)}const r=new Set(e.map(t=>t.collection)),o=[],s=new Set,a=t=>{if(s.has(t.collection))return;s.add(t.collection);const n=t.meta?.group;if(n&&r.has(n)){const t=e.find(t=>t.collection===n);t&&a(t)}o.push(t)};for(const t of e)a(t);for(const e of o){const r=e.collection,n=e.meta??{},{id:i,collection:o,...s}=n;s.icon=e.icon??s.icon??null,s.note=e.note??s.note??null,s.sort=e.sort??s.sort??null;try{await p.readOne(r);try{await p.updateOne(r,{meta:s}),t.logger.info(`[acuity-backup] Updated virtual folder "${r}" meta`)}catch{}continue}catch{}try{await p.createOne({collection:r,schema:null,meta:s}),c.push(r),t.logger.info(`[acuity-backup] Created virtual folder collection "${r}"`)}catch(e){t.logger.warn(`[acuity-backup] Failed to create virtual folder "${r}":`,e)}}}const d=n.filter(t=>!s.collections[t]&&!c.includes(t));if(0===d.length&&0===c.length&&0===r.length)return{createdCollections:c,createdRelations:l};d.length>0&&t.logger.info(`[acuity-backup] Need to create ${d.length} missing collection(s): ${d.join(", ")}`);for(const e of d){const r=f[e];if(!r){t.logger.warn(`[acuity-backup] Collection "${e}" not found in backup schema — cannot recreate`);continue}const n=[],o=r.fields??{};for(const[t,i]of Object.entries(o)){const o=t===r.primary,s=`${e}.${t}`,a=h.get(s);if(i.alias){const e={field:i.field??t,type:"alias",schema:null,meta:a?{interface:a.interface,special:a.special??i.special??["alias","no-data"],options:a.options??null,display:a.display??null,display_options:a.display_options??null,width:a.width??"full",sort:a.sort??null,note:a.note??null,group:a.group??null,hidden:a.hidden??!1,required:a.required??!1}:{special:i.special??["alias","no-data"]}};n.push(e);continue}const u={special:i.special??[],hidden:!!o||(a?.hidden??!1),readonly:!!o||(a?.readonly??!1)};a&&(u.interface=a.interface,u.display=a.display??null,u.display_options=a.display_options??null,u.options=a.options??null,u.width=a.width??"full",u.sort=a.sort??null,u.note=a.note??null,u.required=a.required??!1,u.group=a.group??null,a.special&&(u.special=a.special));const c={field:i.field??t,type:i.type,schema:{is_nullable:!o&&!1!==i.nullable,default_value:i.defaultValue??null,is_primary_key:o,has_auto_increment:o&&("integer"===i.type||!0===i.generated)},meta:u};i.maxLength&&(c.schema.max_length=i.maxLength),n.push(c)}let s={};if(i){const t=i.collectionViews.find(t=>t.collection===e);if(t?.meta){const{collection:e,id:r,group:n,...i}=t.meta;s=i}}try{await p.createOne({collection:e,schema:{name:e},meta:{...s,singleton:r.singleton??!1,sort_field:r.sortField??null},fields:n}),c.push(e),t.logger.info(`[acuity-backup] Created collection "${e}" with ${n.length} fields`)}catch(r){t.logger.error(`[acuity-backup] Failed to create collection "${e}":`,r)}}if(r.length>0&&c.length>0){const e=await t.getSchema(),n=new u({schema:e,accountability:null});for(const i of r){const r=i;if((!r.collection?.startsWith("directus_")||!r.related_collection?.startsWith("directus_"))&&(c.includes(r.collection)||null!=r.related_collection&&c.includes(r.related_collection)))if(!e.collections[r.collection]||r.related_collection&&!e.collections[r.related_collection])t.logger.warn(`[acuity-backup] Skipping relation ${r.collection}.${r.field}: one or both collections missing`);else try{const e={...r.meta??{}};delete e.id,await n.createOne({collection:r.collection,field:r.field,related_collection:r.related_collection,meta:e,schema:r.schema??null}),l++,t.logger.info(`[acuity-backup] Created relation: ${r.collection}.${r.field} → ${r.related_collection}`)}catch(e){t.logger.warn(`[acuity-backup] Failed to create relation ${r.collection}.${r.field}:`,e)}}}return{createdCollections:c,createdRelations:l}}(t,v,w,F,S,T);let N=await t.getSchema(),B=0;if(T.length>0){i&&Ny(i,{phase:"Restoring field metadata",progressPercentage:22});const{FieldsService:e}=t.services,r=new e({schema:N,accountability:null}),n=new Map;for(const t of T){const e=`${t.collection}.${t.field}`;n.set(e,t)}for(const e of T){const n=e.collection,i=e.field;if(!F.includes(n))continue;const{id:o,collection:s,field:a,...u}=e;try{await r.updateField(n,i,{meta:u}),B++}catch{const o=e.special;if(o&&Array.isArray(o)&&o.includes("alias"))try{await r.createField(n,{field:i,type:"alias",schema:null,meta:u}),B++}catch(e){t.logger.warn(`[acuity-backup] Failed to create alias field "${n}.${i}":`,e)}}}t.logger.info(`[acuity-backup] Restored metadata for ${B} fields`),N=await t.getSchema()}i&&Ny(i,{phase:"Restoring media files",progressPercentage:25});let U=0;const z={};if(b.includeMedia){const e=new d("directus_files",{schema:N,accountability:null});for(const[r,n]of Object.entries(m))if(r.startsWith("files/")&&r.endsWith(".meta.json"))try{const r=JSON.parse(n.toString("utf-8")),o=r.id;f&&r.uploaded_by?r.uploaded_by=f:r.uploaded_by&&(r.uploaded_by=null),f&&r.modified_by?r.modified_by=f:r.modified_by&&(r.modified_by=null);try{let t=null;try{t=await e.readOne(o)}catch{}if(t){const{id:t,...n}=r;await e.updateOne(o,n),z[o]=o}else{const t=await e.createOne(r);z[o]=String(t)}U++}catch(e){t.logger.warn(`[acuity-backup] Failed to restore file record "${o}":`,e),i&&By(i,{message:`Failed to restore file: ${o}`})}}catch{}}t.logger.info(`[acuity-backup] Restored ${U} media file records`),i&&Ny(i,{phase:"Media files restored",progressPercentage:35});const W=new Map,H=new Set(F);for(const t of w){const e=t;e.collection&&e.related_collection&&H.has(e.collection)&&H.has(e.related_collection)&&e.collection!==e.related_collection&&(W.has(e.collection)||W.set(e.collection,new Set),W.get(e.collection).add(e.related_collection))}const $=[],q=new Set,G=new Set,V=t=>{if(q.has(t))return;if(G.has(t))return;G.add(t);const e=W.get(t);if(e)for(const t of e)H.has(t)&&V(t);G.delete(t),q.add(t),$.push(t)};for(const t of F)V(t);t.logger.info(`[acuity-backup] Collection restore order: ${$.join(", ")}`);for(let e=0;e<$.length;e++){const r=$[e],n=`collections/${r}.json`,o=y[n];if(!o){t.logger.warn(`[acuity-backup] Collection file not found in archive: ${n}`),D++,i&&By(i,{collection:r,message:"Collection file not found in archive"});continue}let s;try{s=JSON.parse(o.toString("utf-8"))}catch{t.logger.warn(`[acuity-backup] Failed to parse collection JSON: ${n}`),D++,i&&By(i,{collection:r,message:"Failed to parse collection JSON"});continue}if(!Array.isArray(s)||0===s.length){if(A.push(r),I++,i){const t=35+30*(e+1)/$.length;Ny(i,{phase:`Restoring collections (${e+1}/${$.length})`,progressPercentage:Math.round(t),progressCurrent:e+1,progressTotal:$.length})}continue}const a=P.get(r);if(a)for(const t of s)for(const e of a){const r=t[e];if(null!==r&&"object"==typeof r&&!Array.isArray(r)){const n=r;void 0!==n.id&&(t[e]=n.id)}}const c=R.get(r);if(c&&Object.keys(z).length>0)for(const t of s)for(const e of c){const r=t[e];"string"==typeof r&&z[r]&&z[r]!==r&&(t[e]=z[r])}if(L.has(r)){const t=L.get(r);for(const e of s)for(const r of t)void 0!==e[r]&&null!==e[r]&&(e[r]=f??null)}const l=new d(r,{schema:N,accountability:null});try{if(u){const t=await l.readByQuery({limit:-1,fields:["id"]});if(t.length>0){const e=t.map(t=>t.id);await l.deleteMany(e)}}if(await l.upsertMany(s),A.push(r),I++,M+=s.length,i){const t=35+30*(e+1)/$.length;Ny(i,{phase:`Restoring collections (${e+1}/${$.length})`,progressPercentage:Math.round(t),progressCurrent:e+1,progressTotal:$.length})}}catch(e){t.logger.error(`[acuity-backup] Failed to restore collection "${r}":`,e),D++,i&&By(i,{collection:r,message:String(e)})}}let Q=0,Z=0;if(i&&Ny(i,{phase:"Restoring field groups and view settings",progressPercentage:75}),S&&!1!==b.includesViewsAndGroups){const{FieldsService:e,CollectionsService:r}=t.services,n=await t.getSchema();if(S.fieldGroups.length>0){const r=new e({schema:n,accountability:null});for(const e of S.fieldGroups)if(F.includes(e.collection))try{await r.updateField(e.collection,e.field,{group:e.group}),Q++}catch(r){t.logger.warn(`[acuity-backup] Failed to restore group for field "${e.collection}.${e.field}":`,r),i&&By(i,{message:`Failed to restore field group for ${e.collection}.${e.field}`})}}if(S.collectionViews.length>0){const e=new r({schema:n,accountability:null}),o=S.collectionViews.filter(t=>F.includes(t.collection)),s=new Set(o.map(t=>t.collection)),a=[],u=new Set,c=t=>{if(u.has(t.collection))return;u.add(t.collection);const e=t.meta?.group;if(e&&s.has(e)){const t=o.find(t=>t.collection===e);t&&c(t)}a.push(t)};for(const t of o)c(t);for(const r of a){const n=r.meta??{},{id:o,collection:s,...a}=n,u={...a,display:r.display,display_template:r.display_template,sort_field:r.sort_field,hidden:r.hidden,sort:r.sort,icon:r.icon,note:r.note};try{await e.updateOne(r.collection,{meta:u}),Z++}catch(e){t.logger.warn(`[acuity-backup] Failed to restore view settings for collection "${r.collection}":`,e),i&&By(i,{collection:r.collection,message:"Failed to restore view settings"})}}}}let K=0;if(i&&Ny(i,{phase:"Restoring collection layout presets",progressPercentage:85}),j.length>0){const{ItemsService:e}=t.services,r=new e("directus_presets",{schema:await t.getSchema(),accountability:null}),n=j.filter(t=>t.collection&&F.includes(t.collection));for(const e of n)try{const{id:t,user:n,...i}=e,o=await r.readByQuery({limit:1,filter:{collection:{_eq:i.collection},user:{_null:!0},...i.bookmark?{bookmark:{_eq:i.bookmark}}:{bookmark:{_null:!0}},...i.role?{role:{_eq:i.role}}:{role:{_null:!0}}},fields:["id"]});o.length>0?await r.updateOne(o[0].id,i):await r.createOne(i),K++}catch(r){t.logger.warn(`[acuity-backup] Failed to restore preset for collection "${e.collection}":`,r),i&&By(i,{collection:e.collection,message:"Failed to restore layout preset"})}}const J={restoredCollections:A,restoredFiles:U,restoredFieldGroups:Q,restoredCollectionViews:Z,restoredPresets:K,errors:[]};if(i){const t=Uy(i);if(t){const e=function(t,e){const r=new Date(t.startTime).getTime(),n=Date.now()-r;return{id:t.sessionId,sessionId:t.sessionId,backupId:t.backupId,timestamp:t.startTime,duration:n,status:"completed"===t.status?0===t.errors.length?"success":"partial":"failed",summary:e,errors:t.errors}}(t,{collectionsAttempted:F.length,collectionsSuccess:I,collectionsFailed:D,itemsRestored:M,mediaFilesRestored:U,fieldGroupsRestored:Q,collectionViewsRestored:Z,presetsRestored:K});!function(t){Hy();const e=l(Wy(),`${t.sessionId}.json`);r(e,JSON.stringify(t,null,2),"utf-8")}(e),zy(i,(t.errors.length,"completed"))}Ny(i,{phase:"Restore completed",progressPercentage:100})}return J}function nm(t,e,r){const n=t.accountability;n?.admin?r():e.status(403).json({errors:[{message:"Forbidden: admin access required",extensions:{code:"FORBIDDEN"}}]})}const im=[],om=[{name:"acuity-backup",config:(n,f)=>{Jy(f),n.get("/collections",nm,async(t,e)=>{try{const t=await Yy(f),{CollectionsService:r}=f.services,n=new r({schema:await f.getSchema(),accountability:null}),i=(await n.readByQuery()).filter(e=>t.includes(e.collection)).map(t=>({collection:t.collection,icon:t.meta?.icon??null,note:t.meta?.note??null,singleton:t.meta?.singleton??!1}));e.json({data:i})}catch(t){f.logger.error("[acuity-backup] GET /collections error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/list",nm,async(t,e)=>{try{const t=await em();e.json({data:t})}catch(t){f.logger.error("[acuity-backup] GET /list error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.post("/run",nm,async(t,e)=>{try{const r=t.body,n="selective"===r.type?"selective":"full",i=!1!==r.includeMedia,o="selective"===n?r.collections??[]:void 0;if("selective"===n&&(!o||0===o.length))return void e.status(400).json({errors:[{message:'Selective backup requires at least one collection in the "collections" array.'}]});const s=await tm(f,{type:n,collections:o,includeMedia:i});e.status(201).json({data:s})}catch(t){f.logger.error("[acuity-backup] POST /run error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/schedule",nm,(t,e)=>{try{const t=Zy();e.json({data:t})}catch(t){f.logger.error("[acuity-backup] GET /schedule error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.post("/schedule",nm,(t,e)=>{try{const r=t.body;if("boolean"!=typeof r.enabled)return void e.status(400).json({errors:[{message:'"enabled" must be a boolean'}]});if("string"!=typeof r.cronExpression||!r.cronExpression.trim())return void e.status(400).json({errors:[{message:'"cronExpression" must be a non-empty string'}]});if(5!==r.cronExpression.trim().split(/\s+/).length)return void e.status(400).json({errors:[{message:'"cronExpression" must be a valid 5-field cron expression (minute hour dom month dow)'}]});const n={...Zy(),enabled:r.enabled,cronExpression:r.cronExpression.trim()};Ky(n),e.json({data:n})}catch(t){f.logger.error("[acuity-backup] POST /schedule error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/restore/:id",nm,async(t,e)=>{try{const{id:r}=t.params,n=(await em()).find(t=>t.id===r);if(!n)return void e.status(404).json({errors:[{message:`Backup "${r}" not found`}]});e.json({data:n})}catch(t){f.logger.error("[acuity-backup] GET /restore/:id error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.post("/restore",nm,async(t,e)=>{try{const r=t.body;if(!r.backupId||"string"!=typeof r.backupId)return void e.status(400).json({errors:[{message:'"backupId" is required'}]});const n=t.accountability,i=n?.user??null,o=k(),s={backupId:r.backupId,truncateCollections:r.truncateCollections??!1,collections:r.collections,sessionId:o,adminUserId:i};e.json({data:{sessionId:o,message:"Restore started. Poll /acuity-backup/status/:sessionId for progress."}}),(async()=>{try{await rm(f,s,o)}catch(t){f.logger.error("[acuity-backup] Background restore error:",t);Uy(o)&&(By(o,{message:String(t)}),zy(o,"failed"))}})()}catch(t){f.logger.error("[acuity-backup] POST /restore error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.delete("/:id",nm,async(t,r)=>{try{const{id:n}=t.params,i=(await em()).find(t=>t.id===n);if(!i)return void r.status(404).json({errors:[{message:`Backup "${n}" not found`}]});const o=l(qy(),i.filename),s=o.replace(/\.zip$/,".meta.json"),u=[];e(o)&&u.push(a(o)),e(s)&&u.push(a(s)),await Promise.all(u),r.json({data:{success:!0,id:n}})}catch(t){f.logger.error("[acuity-backup] DELETE /:id error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.get("/status/:sessionId",nm,(t,e)=>{try{const{sessionId:r}=t.params,n=Uy(r);if(!n)return void e.status(404).json({errors:[{message:`Session "${r}" not found`}]});e.json({data:n})}catch(t){f.logger.error("[acuity-backup] GET /status/:sessionId error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/restore-logs",nm,async(e,r)=>{try{const e=await async function(){Hy();const e=Wy();try{const r=await s(e),n=[];for(const i of r){if(!i.endsWith(".json"))continue;const r=l(e,i);try{const e=t(r,"utf-8"),i=JSON.parse(e);n.push(i)}catch{}}return n.sort((t,e)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),n}catch{return[]}}();r.json({data:e})}catch(t){f.logger.error("[acuity-backup] GET /restore-logs error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.get("/restore-logs/:logId",nm,(r,n)=>{try{const{logId:i}=r.params,o=function(r){Hy();const n=l(Wy(),`${r}.json`);if(!e(n))return null;try{const e=t(n,"utf-8");return JSON.parse(e)}catch{return null}}(i);if(!o)return void n.status(404).json({errors:[{message:`Restore log "${i}" not found`}]});n.json({data:o})}catch(t){f.logger.error("[acuity-backup] GET /restore-logs/:logId error:",t),n.status(500).json({errors:[{message:String(t)}]})}}),n.delete("/restore-logs/:logId",nm,async(t,r)=>{try{const{logId:n}=t.params;await async function(t){const r=l(Wy(),`${t}.json`);e(r)&&await a(r)}(n),r.json({data:{success:!0,logId:n}})}catch(t){f.logger.error("[acuity-backup] DELETE /restore-logs/:logId error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.get("/download/:id",nm,async(t,r)=>{try{const{id:n}=t.params,o=(await em()).find(t=>t.id===n);if(!o)return void r.status(404).json({errors:[{message:`Backup "${n}" not found`}]});const s=l(qy(),o.filename);if(!e(s))return void r.status(404).json({errors:[{message:`Backup file "${o.filename}" not found on disk`}]});r.setHeader("Content-Type","application/zip"),r.setHeader("Content-Disposition",`attachment; filename="${o.filename}"`);i(s).pipe(r)}catch(t){f.logger.error("[acuity-backup] GET /download/:id error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.post("/upload",nm,async(t,n)=>{try{const{fileId:s}=t.body;if(!s||"string"!=typeof s)return void n.status(400).json({errors:[{message:'"fileId" is required. Upload the ZIP via POST /files first.'}]});const{ItemsService:p}=f.services,d=new p("directus_files",{schema:await f.getSchema(),accountability:null});let y;try{y=await d.readOne(s)}catch{return void n.status(404).json({errors:[{message:`File "${s}" not found in Directus.`}]})}const m=process.env.STORAGE_LOCAL_ROOT||"./uploads",g=y.filename_disk,_=l(m,g);if(!e(_))return void n.status(400).json({errors:[{message:"Uploaded file not found on disk. Only local storage is currently supported for backup uploads."}]});const b=await u(_);if(b.size>524288e3)return void n.status(413).json({errors:[{message:`Upload too large (${Math.round(b.size/1024/1024)} MB). Maximum is 500 MB.`}]});Gy();const v=qy(),w=k(),S=l(v,`upload-temp-${w}.zip`);let E;await h(i(_),o(S));try{const t=(await Ay.Open.file(S)).files.find(t=>"manifest.json"===t.path);if(!t)return await a(S),void n.status(400).json({errors:[{message:"Invalid backup: ZIP does not contain a manifest.json file."}]});const e=await t.buffer();E=JSON.parse(e.toString("utf-8"))}catch(t){return await a(S),void n.status(400).json({errors:[{message:"Invalid or corrupted ZIP file: "+String(t)}]})}const x=k(),T=E.timestamp||(new Date).toISOString(),O=`backup-${T.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}-${x}.zip`,j=l(v,O);await c(S,j);const C={id:x,filename:O,timestamp:T,type:E.type??"full",collections:E.collections??[],includeMedia:E.includeMedia??!1,fileSize:b.size},R=j.replace(/\.zip$/,".meta.json");r(R,JSON.stringify(C,null,2),"utf-8");try{await d.deleteOne(s)}catch{}f.logger.info(`[acuity-backup] Uploaded backup: ${O} (${Math.round(b.size/1024)} KB)`),n.json({data:C})}catch(t){f.logger.error("[acuity-backup] POST /upload error:",t),n.status(500).json({errors:[{message:String(t)}]})}}),async function(){Hy();const t=Wy(),e=Date.now()-7776e6;let r=0;try{const n=await s(t);for(const i of n){if(!i.endsWith(".json"))continue;const n=l(t,i);try{(await u(n)).mtime.getTime()<e&&(await a(n),r++)}catch{}}}catch{}return r}().then(t=>{t>0&&f.logger.info(`[acuity-backup] Cleaned up ${t} restore logs older than 90 days`)})}}],sm=[];export{om as endpoints,im as hooks,sm as operations};
|
|
49
|
+
*/()),zl=r}(),lf=D(cf),ff={};function hf(){if(Zl)return Ql;Zl=1;const t=g;function e(){if(!(this instanceof e))return new e;t.Duplex.call(this,{decodeStrings:!1,objectMode:!0}),this.buffer=Buffer.from("");const r=this;r.on("finish",function(){r.finished=!0,r.emit("chunk",!1)})}return b.inherits(e,t.Duplex),e.prototype._write=function(t,e,r){this.buffer=Buffer.concat([this.buffer,t]),this.cb=r,this.emit("chunk")},e.prototype.stream=function(e,r){const n=t.PassThrough();let i;const o=this;function s(){if("function"==typeof o.cb){const t=o.cb;return o.cb=void 0,t()}}function a(){let t;if(o.buffer&&o.buffer.length){if("number"==typeof e)t=o.buffer.slice(0,e),o.buffer=o.buffer.slice(e),e-=t.length,i=i||!e;else{let n=o.buffer.indexOf(e);if(-1!==n)o.match=n,r&&(n+=e.length),t=o.buffer.slice(0,n),o.buffer=o.buffer.slice(n),i=!0;else{const r=o.buffer.length-e.length;r<=0?s():(t=o.buffer.slice(0,r),o.buffer=o.buffer.slice(r))}}t&&n.write(t,function(){(0===o.buffer.length||e.length&&o.buffer.length<=e.length)&&s()})}if(i)o.removeListener("chunk",a),n.end();else if(o.finished)return o.removeListener("chunk",a),void o.emit("error",new Error("FILE_ENDED"))}return o.on("chunk",a),a(),n},e.prototype.pull=function(e,r){if(0===e)return Promise.resolve("");if(!isNaN(e)&&this.buffer.length>e){const t=this.buffer.slice(0,e);return this.buffer=this.buffer.slice(e),Promise.resolve(t)}let n=Buffer.from("");const i=this,o=new t.Transform;let s,a;return o._transform=function(t,e,r){n=Buffer.concat([n,t]),r()},new Promise(function(t,u){if(s=u,a=function(t){i.__emittedError=t,u(t)},i.finished)return u(new Error("FILE_ENDED"));i.once("error",a),i.stream(e,r).on("error",u).pipe(o).on("finish",function(){t(n)}).on("error",u)}).finally(function(){i.removeListener("error",s),i.removeListener("error",a)})},e.prototype._read=function(){},Ql=e}function pf(){if(Xl)return Yl;Xl=1;const t=g;return Yl=function(e){return new Promise(function(r,n){const i=[],o=t.Transform().on("finish",function(){r(Buffer.concat(i))}).on("error",n);o._transform=function(t,e,r){i.push(t),r()},e.on("error",n).pipe(o)})},Yl}function df(){if(ef)return tf;ef=1;const t=function(t,e,r){let n;switch(r){case 1:n=t.readUInt8(e);break;case 2:n=t.readUInt16LE(e);break;case 4:n=t.readUInt32LE(e);break;case 8:n=Number(t.readBigUInt64LE(e));break;default:throw new Error("Unsupported UInt LE size!")}return n};return tf={parse:function(e,r){const n={};let i=0;for(const[o,s]of r)e.length>=i+s?n[o]=t(e,i,s):n[o]=null,i+=s;return n}}}function yf(){if(nf)return rf;nf=1;const t=df();return rf=function(e,r){let n;for(;!n&&e&&e.length;){const i=t.parse(e,[["signature",2],["partSize",2]]);if(1===i.signature){const i=[];4294967295===r.uncompressedSize&&i.push(["uncompressedSize",8]),4294967295===r.compressedSize&&i.push(["compressedSize",8]),4294967295===r.offsetToLocalFileHeader&&i.push(["offsetToLocalFileHeader",8]),n=t.parse(e.slice(4),i)}else e=e.slice(i.partSize+4)}return n=n||{},4294967295===r.compressedSize&&(r.compressedSize=n.compressedSize),4294967295===r.uncompressedSize&&(r.uncompressedSize=n.uncompressedSize),4294967295===r.offsetToLocalFileHeader&&(r.offsetToLocalFileHeader=n.offsetToLocalFileHeader),n}}function mf(){return sf?of:(sf=1,of=function(t,e){const r=31&t,n=t>>5&15,i=1980+(t>>9&127),o=e?2*(31&e):0,s=e?e>>5&63:0,a=e?e>>11:0;return new Date(Date.UTC(i,n-1,r,a,s,o))})}function gf(){if(uf)return af;uf=1;const t=b,e=S,r=g,n=hf(),i=function(){if(Jl)return Kl;Jl=1;const t=g;function e(){if(!(this instanceof e))return new e;t.Transform.call(this)}return b.inherits(e,t.Transform),e.prototype._transform=function(t,e,r){r()},Kl=e}(),o=pf(),s=yf(),a=mf(),u=r.pipeline,c=df(),l=Buffer.alloc(4);function f(t){if(!(this instanceof f))return new f(t);const e=this;e._opts=t||{verbose:!1},n.call(e,e._opts),e.on("finish",function(){e.emit("end"),e.emit("close")}),e._readRecord().catch(function(t){e.__emittedError&&e.__emittedError===t||e.emit("error",t)})}return l.writeUInt32LE(101010256,0),t.inherits(f,n),f.prototype._readRecord=function(){const t=this;return t.pull(4).then(function(e){if(0===e.length)return;const r=e.readUInt32LE(0);if(875721283===r)return t._readCrxHeader();if(67324752===r)return t._readFile();if(33639248===r)return t.reachedCD=!0,t._readCentralDirectoryFileHeader();if(101010256===r)return t._readEndOfCentralDirectoryRecord();if(t.reachedCD){const e=!0;return t.pull(l,e).then(function(){return t._readEndOfCentralDirectoryRecord()})}t.emit("error",new Error("invalid signature: 0x"+r.toString(16)))}).then(function(e){if(e)return t._readRecord()})},f.prototype._readCrxHeader=function(){const t=this;return t.pull(12).then(function(e){return t.crxHeader=c.parse(e,[["version",4],["pubKeyLength",4],["signatureLength",4]]),t.pull(t.crxHeader.pubKeyLength+t.crxHeader.signatureLength)}).then(function(e){return t.crxHeader.publicKey=e.slice(0,t.crxHeader.pubKeyLength),t.crxHeader.signature=e.slice(t.crxHeader.pubKeyLength),t.emit("crx-header",t.crxHeader),!0})},f.prototype._readFile=function(){const t=this;return t.pull(26).then(function(n){const l=c.parse(n,[["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return l.lastModifiedDateTime=a(l.lastModifiedDate,l.lastModifiedTime),t.crxHeader&&(l.crxHeader=t.crxHeader),t.pull(l.fileNameLength).then(function(n){const a=n.toString("utf8"),c=r.PassThrough();let f=!1;return c.autodrain=function(){f=!0;const t=c.pipe(i());return t.promise=function(){return new Promise(function(e,r){t.on("finish",e),t.on("error",r)})},t},c.buffer=function(){return o(c)},c.path=a,c.props={},c.props.path=a,c.props.pathBuffer=n,c.props.flags={isUnicode:!!(2048&l.flags)},c.type=0===l.uncompressedSize&&/[/\\]$/.test(a)?"Directory":"File",t._opts.verbose&&("Directory"===c.type?console.log(" creating:",a):"File"===c.type&&(0===l.compressionMethod?console.log(" extracting:",a):console.log(" inflating:",a))),t.pull(l.extraFieldLength).then(function(n){const i=s(n,l);c.vars=l,c.extra=i,t._opts.forceStream?t.push(c):(t.emit("entry",c),(t._readableState.pipesCount||t._readableState.pipes&&t._readableState.pipes.length)&&t.push(c)),t._opts.verbose&&console.log({filename:a,vars:l,extra:i});const o=!(8&l.flags)||l.compressedSize>0;let h;c.__autodraining=f;const p=l.compressionMethod&&!f?e.createInflateRaw():r.PassThrough();return o?(c.size=l.uncompressedSize,h=l.compressedSize):(h=Buffer.alloc(4),h.writeUInt32LE(134695760,0)),new Promise(function(e,r){u(t.stream(h),p,c,function(n){return n?r(n):o?e(o):t._processDataDescriptor(c).then(e).catch(r)})})})})})},f.prototype._processDataDescriptor=function(t){return this.pull(16).then(function(e){const r=c.parse(e,[["dataDescriptorSignature",4],["crc32",4],["compressedSize",4],["uncompressedSize",4]]);return t.size=r.uncompressedSize,!0})},f.prototype._readCentralDirectoryFileHeader=function(){const t=this;return t.pull(42).then(function(e){const r=c.parse(e,[["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return t.pull(r.fileNameLength).then(function(e){return r.fileName=e.toString("utf8"),t.pull(r.extraFieldLength)}).then(function(){return t.pull(r.fileCommentLength)}).then(function(){return!0})})},f.prototype._readEndOfCentralDirectoryRecord=function(){const t=this;return t.pull(18).then(function(e){const r=c.parse(e,[["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]);return t.pull(r.commentLength).then(function(){t.end(),t.push(null)})})},f.prototype.promise=function(){const t=this;return new Promise(function(e,r){t.on("finish",e),t.on("error",r)})},af=f}var _f,bf,vf={exports:{}},wf={exports:{}};function Sf(){return bf?_f:(bf=1,_f=g)}var Ef,kf={exports:{}};function xf(){return Ef||(Ef=1,function(t,e){var r=w,n=r.Buffer;function i(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o),i(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}}(kf,kf.exports)),kf.exports}var Of,Tf,jf,Cf,Rf,Pf,Lf,Ff={exports:{}};function Af(){return Of||(Of=1,function(t){var e=xf().Buffer,r=b;function n(t,e,r){t.copy(e,r)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return e.alloc(0);for(var r=e.allocUnsafe(t>>>0),i=this.head,o=0;i;)n(i.data,r,o),o+=i.data.length,i=i.next;return r},t}(),r&&r.inspect&&r.inspect.custom&&(t.exports.prototype[r.inspect.custom]=function(){var t=r.inspect({length:this.length});return this.constructor.name+" "+t})}(Ff)),Ff.exports}function If(){if(jf)return Tf;jf=1;var t=vr();function e(t,e){t.emit("error",e)}return Tf={destroy:function(r,n){var i=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(n?n(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(e,this,r)):t.nextTick(e,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(r){!n&&r?i._writableState?i._writableState.errorEmitted||(i._writableState.errorEmitted=!0,t.nextTick(e,i,r)):t.nextTick(e,i,r):n&&n(r)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}}function Df(){if(Rf)return Cf;Rf=1;var t=vr();function e(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree.next=t}(e,t)}}Cf=p;var r,n=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t.nextTick;p.WritableState=h;var i=Object.create(jr());i.inherits=Fr();var o={deprecate:Gr()},s=Sf(),a=xf().Buffer,u=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var c,l=If();function f(){}function h(i,o){r=r||Mf(),i=i||{};var s=o instanceof r;this.objectMode=!!i.objectMode,s&&(this.objectMode=this.objectMode||!!i.writableObjectMode);var a=i.highWaterMark,u=i.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=a||0===a?a:s&&(u||0===u)?u:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===i.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=i.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,r){var i=e._writableState,o=i.sync,s=i.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(i),r)!function(e,r,n,i,o){--r.pendingcb,n?(t.nextTick(o,i),t.nextTick(b,e,r),e._writableState.errorEmitted=!0,e.emit("error",i)):(o(i),e._writableState.errorEmitted=!0,e.emit("error",i),b(e,r))}(e,i,o,r,s);else{var a=g(i);a||i.corked||i.bufferProcessing||!i.bufferedRequest||m(e,i),o?n(y,e,i,a,s):y(e,i,a,s)}}(o,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function p(t){if(r=r||Mf(),!(c.call(p,this)||this instanceof r))return new p(t);this._writableState=new h(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function d(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function y(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),b(t,e)}function m(t,r){r.bufferProcessing=!0;var n=r.bufferedRequest;if(t._writev&&n&&n.next){var i=r.bufferedRequestCount,o=new Array(i),s=r.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)o[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;o.allBuffers=u,d(t,r,!0,r.length,o,"",s.finish),r.pendingcb++,r.lastBufferedRequest=null,s.next?(r.corkedRequestsFree=s.next,s.next=null):r.corkedRequestsFree=new e(r),r.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(d(t,r,!1,r.objectMode?1:c.length,c,l,f),n=n.next,r.bufferedRequestCount--,r.writing)break}null===n&&(r.lastBufferedRequest=null)}r.bufferedRequest=n,r.bufferProcessing=!1}function g(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function _(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),b(t,e)})}function b(e,r){var n=g(r);return n&&(!function(e,r){r.prefinished||r.finalCalled||("function"==typeof e._final?(r.pendingcb++,r.finalCalled=!0,t.nextTick(_,e,r)):(r.prefinished=!0,e.emit("prefinish")))}(e,r),0===r.pendingcb&&(r.finished=!0,e.emit("finish"))),n}return i.inherits(p,s),h.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(h.prototype,"buffer",{get:o.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(c=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(t){return!!c.call(this,t)||this===p&&(t&&t._writableState instanceof h)}})):c=function(t){return t instanceof this},p.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},p.prototype.write=function(e,r,n){var i,o=this._writableState,s=!1,c=!o.objectMode&&(i=e,a.isBuffer(i)||i instanceof u);return c&&!a.isBuffer(e)&&(e=function(t){return a.from(t)}(e)),"function"==typeof r&&(n=r,r=null),c?r="buffer":r||(r=o.defaultEncoding),"function"!=typeof n&&(n=f),o.ended?function(e,r){var n=new Error("write after end");e.emit("error",n),t.nextTick(r,n)}(this,n):(c||function(e,r,n,i){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||r.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),t.nextTick(i,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=a.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var u=e.objectMode?1:n.length;e.length+=u;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else d(t,e,!1,u,n,i,o);return c}(this,o,c,e,r,n)),s},p.prototype.cork=function(){this._writableState.corked++},p.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||m(this,t))},p.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},p.prototype._writev=null,p.prototype.end=function(e,r,n){var i=this._writableState;"function"==typeof e?(n=e,e=null,r=null):"function"==typeof r&&(n=r,r=null),null!=e&&this.write(e,r),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,r,n){r.ending=!0,b(e,r),n&&(r.finished?t.nextTick(n):e.once("finish",n));r.ended=!0,e.writable=!1}(this,i,n)},Object.defineProperty(p.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),p.prototype.destroy=l.destroy,p.prototype._undestroy=l.undestroy,p.prototype._destroy=function(t,e){this.end(),e(t)},Cf}function Mf(){if(Lf)return Pf;Lf=1;var t=vr(),e=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};Pf=u;var r=Object.create(jr());r.inherits=Fr();var n=Jf(),i=Df();r.inherits(u,n);for(var o=e(i.prototype),s=0;s<o.length;s++){var a=o[s];u.prototype[a]||(u.prototype[a]=i.prototype[a])}function u(t){if(!(this instanceof u))return new u(t);n.call(this,t),i.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",c)}function c(){this.allowHalfOpen||this._writableState.ended||t.nextTick(l,this)}function l(t){t.end()}return Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),u.prototype._destroy=function(e,r){this.push(null),this.end(),t.nextTick(r,e)},Pf}var Nf,Bf,Uf,zf,Wf,Hf,$f,qf,Gf,Vf,Qf,Zf={};function Kf(){if(Nf)return Zf;Nf=1;var t=xf().Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var n;switch(this.encoding=function(r){var n=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof n&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return n||r}(r),this.encoding){case"utf16le":this.text=o,this.end=s,n=4;break;case"utf8":this.fillLast=i,n=4;break;case"base64":this.text=a,this.end=u,n=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}function n(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function i(t){var e=this.lastTotal-this.lastNeed,r=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function o(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function a(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}return Zf.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},r.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},r.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var o=n(e[i]);if(o>=0)return o>0&&(t.lastNeed=o-1),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(t.lastNeed=o-2),o;if(--i<r||-2===o)return 0;if(o=n(e[i]),o>=0)return o>0&&(2===o?o=0:t.lastNeed=o-3),o;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},Zf}function Jf(){if(Uf)return Bf;Uf=1;var t=vr();Bf=m;var e,r=wr();m.ReadableState=y,d.EventEmitter;var n=function(t,e){return t.listeners(e).length},i=Sf(),o=xf().Buffer,s=(void 0!==I?I:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a=Object.create(jr());a.inherits=Fr();var u=b,c=void 0;c=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f=Af(),h=If();a.inherits(m,i);var p=["error","close","destroy","pause","resume"];function y(t,r){t=t||{};var n=r instanceof(e=e||Mf());this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(o||0===o)?o:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=Kf().StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function m(t){if(e=e||Mf(),!(this instanceof m))return new m(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),i.call(this)}function g(t,e,r,n,i){var a,u=t._readableState;null===e?(u.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,S(t)}(t,u)):(i||(a=function(t,e){var r;n=e,o.isBuffer(n)||n instanceof s||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var n;return r}(u,e)),a?t.emit("error",a):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),n?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):k(t,u)):_(t,u,e,!1))):n||(u.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function _(t,e,r,n){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&S(t)),k(t,e)}Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),m.prototype.destroy=h.destroy,m.prototype._undestroy=h.undestroy,m.prototype._destroy=function(t,e){this.push(null),e(t)},m.prototype.push=function(t,e){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof t&&((e=e||n.defaultEncoding)!==n.encoding&&(t=o.from(t,e),e=""),r=!0),g(this,t,e,!1,r)},m.prototype.unshift=function(t){return g(this,t,null,!0,!1)},m.prototype.isPaused=function(){return!1===this._readableState.flowing},m.prototype.setEncoding=function(t){return l||(l=Kf().StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};var v=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=v?t=v:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function S(e){var r=e._readableState;r.needReadable=!1,r.emittedReadable||(c("emitReadable",r.flowing),r.emittedReadable=!0,r.sync?t.nextTick(E,e):E(e))}function E(t){c("emit readable"),t.emit("readable"),j(t)}function k(e,r){r.readingMore||(r.readingMore=!0,t.nextTick(x,e,r))}function x(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(c("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function O(t){c("readable nexttick read 0"),t.read(0)}function T(t,e){e.reading||(c("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),j(t),e.flowing&&!e.reading&&t.read(0)}function j(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function C(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;t<e.head.data.length?(n=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):n=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,n=1,i=r.data;t-=i.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=o.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var s=n.data,a=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,a),0===(t-=a)){a===s.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=s.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function R(e){var r=e._readableState;if(r.length>0)throw new Error('"endReadable()" called on non-empty stream');r.endEmitted||(r.ended=!0,t.nextTick(P,r,e))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}return m.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):S(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&R(this),null;var n,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(r,e))),null===(n=t>0?C(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&R(this)),null!==n&&this.emit("data",n),n},m.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,i){var o=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,c("pipe count=%d opts=%j",s.pipesCount,i);var a=(!i||!1!==i.end)&&e!==process.stdout&&e!==process.stderr?l:_;function u(t,r){c("onunpipe"),t===o&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),e.removeListener("close",m),e.removeListener("finish",g),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",u),o.removeListener("end",l),o.removeListener("end",_),o.removeListener("data",d),h=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){c("onend"),e.end()}s.endEmitted?t.nextTick(a):o.once("end",a),e.on("unpipe",u);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,j(t))}}(o);e.on("drain",f);var h=!1;var p=!1;function d(t){c("ondata"),p=!1,!1!==e.write(t)||p||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==L(s.pipes,e))&&!h&&(c("false write response, pause",s.awaitDrain),s.awaitDrain++,p=!0),o.pause())}function y(t){c("onerror",t),_(),e.removeListener("error",y),0===n(e,"error")&&e.emit("error",t)}function m(){e.removeListener("finish",g),_()}function g(){c("onfinish"),e.removeListener("close",m),_()}function _(){c("unpipe"),o.unpipe(e)}return o.on("data",d),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(e,"error",y),e.once("close",m),e.once("finish",g),e.emit("pipe",o),s.flowing||(c("pipe resume"),o.resume()),e},m.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=L(e.pipes,t);return-1===s||(e.pipes.splice(s,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},m.prototype.on=function(e,r){var n=i.prototype.on.call(this,e,r);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&S(this):t.nextTick(O,this))}return n},m.prototype.addListener=m.prototype.on,m.prototype.resume=function(){var e=this._readableState;return e.flowing||(c("resume"),e.flowing=!0,function(e,r){r.resumeScheduled||(r.resumeScheduled=!0,t.nextTick(T,e,r))}(this,e)),this},m.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this},m.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;for(var i in t.on("end",function(){if(c("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)}),t.on("data",function(i){(c("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i)||(r.objectMode||i&&i.length)&&(e.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<p.length;o++)t.on(p[o],this.emit.bind(this,p[o]));return this._read=function(e){c("wrapped _read",e),n&&(n=!1,t.resume())},this},Object.defineProperty(m.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),m._fromList=C,Bf}function Yf(){if(Wf)return zf;Wf=1,zf=n;var t=Mf(),e=Object.create(jr());function r(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function n(e){if(!(this instanceof n))return new n(e);t.call(this,e),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",i)}function i(){var t=this;"function"==typeof this._flush?this._flush(function(e,r){o(t,e,r)}):o(this,null,null)}function o(t,e,r){if(e)return t.emit("error",e);if(null!=r&&t.push(r),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}return e.inherits=Fr(),e.inherits(n,t),n.prototype.push=function(e,r){return this._transformState.needTransform=!1,t.prototype.push.call(this,e,r)},n.prototype._transform=function(t,e,r){throw new Error("_transform() is not implemented")},n.prototype._write=function(t,e,r){var n=this._transformState;if(n.writecb=r,n.writechunk=t,n.writeencoding=e,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},n.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},n.prototype._destroy=function(e,r){var n=this;t.prototype._destroy.call(this,e,function(t){r(t),n.emit("close")})},zf}function Xf(){return qf||(qf=1,t=wf,e=wf.exports,r=g,"disable"===process.env.READABLE_STREAM&&r?(t.exports=r,(e=t.exports=r.Readable).Readable=r.Readable,e.Writable=r.Writable,e.Duplex=r.Duplex,e.Transform=r.Transform,e.PassThrough=r.PassThrough,e.Stream=r):((e=t.exports=Jf()).Stream=r||e,e.Readable=e,e.Writable=Df(),e.Duplex=Mf(),e.Transform=Yf(),e.PassThrough=function(){if($f)return Hf;$f=1,Hf=r;var t=Yf(),e=Object.create(jr());function r(e){if(!(this instanceof r))return new r(e);t.call(this,e)}return e.inherits=Fr(),e.inherits(r,t),r.prototype._transform=function(t,e,r){r(null,t)},Hf}())),wf.exports;var t,e,r}function th(){if(Gf)return vf.exports;Gf=1;var t=Xf();function e(e,r,n){void 0===n&&(n=r,r=e,e=null),t.Duplex.call(this,e),"function"!=typeof n.read&&(n=new t.Readable(e).wrap(n)),this._writable=r,this._readable=n,this._waiting=!1;var i=this;r.once("finish",function(){i.end()}),this.once("finish",function(){r.end()}),n.on("readable",function(){i._waiting&&(i._waiting=!1,i._read())}),n.once("end",function(){i.push(null)}),e&&void 0!==e.bubbleErrors&&!e.bubbleErrors||(r.on("error",function(t){i.emit("error",t)}),n.on("error",function(t){i.emit("error",t)}))}return e.prototype=Object.create(t.Duplex.prototype,{constructor:{value:e}}),e.prototype._write=function(t,e,r){this._writable.write(t,e,r)},e.prototype._read=function(){for(var t,e=0;null!==(t=this._readable.read());)this.push(t),e++;0===e&&(this._waiting=!0)},vf.exports=function(t,r,n){return new e(t,r,n)},vf.exports.DuplexWrapper=e,vf.exports}var eh,rh,nh={},ih={};function oh(){return eh||(eh=1,ih.fromCallback=function(t){return Object.defineProperty(function(...e){if("function"!=typeof e[e.length-1])return new Promise((r,n)=>{e.push((t,e)=>null!=t?n(t):r(e)),t.apply(this,e)});t.apply(this,e)},"name",{value:t.name})},ih.fromPromise=function(t){return Object.defineProperty(function(...e){const r=e[e.length-1];if("function"!=typeof r)return t.apply(this,e);e.pop(),t.apply(this,e).then(t=>r(null,t),r)},"name",{value:t.name})}),ih}function sh(){return rh||(rh=1,function(t){const e=oh().fromCallback,r=hr(),n=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>"function"==typeof r[t]);Object.assign(t,r),n.forEach(n=>{t[n]=e(r[n])}),t.exists=function(t,e){return"function"==typeof e?r.exists(t,e):new Promise(e=>r.exists(t,e))},t.read=function(t,e,n,i,o,s){return"function"==typeof s?r.read(t,e,n,i,o,s):new Promise((s,a)=>{r.read(t,e,n,i,o,(t,e,r)=>{if(t)return a(t);s({bytesRead:e,buffer:r})})})},t.write=function(t,e,...n){return"function"==typeof n[n.length-1]?r.write(t,e,...n):new Promise((i,o)=>{r.write(t,e,...n,(t,e,r)=>{if(t)return o(t);i({bytesWritten:e,buffer:r})})})},t.readv=function(t,e,...n){return"function"==typeof n[n.length-1]?r.readv(t,e,...n):new Promise((i,o)=>{r.readv(t,e,...n,(t,e,r)=>{if(t)return o(t);i({bytesRead:e,buffers:r})})})},t.writev=function(t,e,...n){return"function"==typeof n[n.length-1]?r.writev(t,e,...n):new Promise((i,o)=>{r.writev(t,e,...n,(t,e,r)=>{if(t)return o(t);i({bytesWritten:e,buffers:r})})})},"function"==typeof r.realpath.native?t.realpath.native=e(r.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(nh)),nh}var ah,uh,ch,lh,fh,hh,ph,dh,yh,mh,gh,_h,bh,vh,wh,Sh,Eh,kh,xh,Oh,Th,jh,Ch,Rh,Ph,Lh,Fh,Ah,Ih,Dh,Mh,Nh,Bh,Uh,zh,Wh,Hh,$h,qh,Gh,Vh,Qh,Zh,Kh,Jh,Yh,Xh,tp,ep,rp,np,ip,op,sp,ap,up,cp,lp,fp={},hp={};function pp(){if(uh)return fp;uh=1;const t=sh(),{checkPath:e}=function(){if(ah)return hp;ah=1;const t=y;return hp.checkPath=function(e){if("win32"===process.platform&&/[<>:"|?*]/.test(e.replace(t.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}},hp}(),r=t=>"number"==typeof t?t:{mode:511,...t}.mode;return fp.makeDir=async(n,i)=>(e(n),t.mkdir(n,{mode:r(i),recursive:!0})),fp.makeDirSync=(n,i)=>(e(n),t.mkdirSync(n,{mode:r(i),recursive:!0})),fp}function dp(){if(lh)return ch;lh=1;const t=oh().fromPromise,{makeDir:e,makeDirSync:r}=pp(),n=t(e);return ch={mkdirs:n,mkdirsSync:r,mkdirp:n,mkdirpSync:r,ensureDir:n,ensureDirSync:r}}function yp(){if(hh)return fh;hh=1;const t=oh().fromPromise,e=sh();return fh={pathExists:t(function(t){return e.access(t).then(()=>!0).catch(()=>!1)}),pathExistsSync:e.existsSync},fh}function mp(){if(dh)return ph;dh=1;const t=sh(),e=oh().fromPromise;return ph={utimesMillis:e(async function(e,r,n){const i=await t.open(e,"r+");let o=null;try{await t.futimes(i,r,n)}finally{try{await t.close(i)}catch(t){o=t}}if(o)throw o}),utimesMillisSync:function(e,r,n){const i=t.openSync(e,"r+");return t.futimesSync(i,r,n),t.closeSync(i)}},ph}function gp(){if(mh)return yh;mh=1;const t=sh(),e=y,r=oh().fromPromise;function n(t,e){return void 0!==e.ino&&void 0!==e.dev&&e.ino===t.ino&&e.dev===t.dev}function i(t,r){const n=e.resolve(t).split(e.sep).filter(t=>t),i=e.resolve(r).split(e.sep).filter(t=>t);return n.every((t,e)=>i[e]===t)}function o(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}return yh={checkPaths:r(async function(r,s,a,u){const{srcStat:c,destStat:l}=await function(e,r,n){const i=n.dereference?e=>t.stat(e,{bigint:!0}):e=>t.lstat(e,{bigint:!0});return Promise.all([i(e),i(r).catch(t=>{if("ENOENT"===t.code)return null;throw t})]).then(([t,e])=>({srcStat:t,destStat:e}))}(r,s,u);if(l){if(n(c,l)){const t=e.basename(r),n=e.basename(s);if("move"===a&&t!==n&&t.toLowerCase()===n.toLowerCase())return{srcStat:c,destStat:l,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(c.isDirectory()&&!l.isDirectory())throw new Error(`Cannot overwrite non-directory '${s}' with directory '${r}'.`);if(!c.isDirectory()&&l.isDirectory())throw new Error(`Cannot overwrite directory '${s}' with non-directory '${r}'.`)}if(c.isDirectory()&&i(r,s))throw new Error(o(r,s,a));return{srcStat:c,destStat:l}}),checkPathsSync:function(r,s,a,u){const{srcStat:c,destStat:l}=function(e,r,n){let i;const o=n.dereference?e=>t.statSync(e,{bigint:!0}):e=>t.lstatSync(e,{bigint:!0}),s=o(e);try{i=o(r)}catch(t){if("ENOENT"===t.code)return{srcStat:s,destStat:null};throw t}return{srcStat:s,destStat:i}}(r,s,u);if(l){if(n(c,l)){const t=e.basename(r),n=e.basename(s);if("move"===a&&t!==n&&t.toLowerCase()===n.toLowerCase())return{srcStat:c,destStat:l,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(c.isDirectory()&&!l.isDirectory())throw new Error(`Cannot overwrite non-directory '${s}' with directory '${r}'.`);if(!c.isDirectory()&&l.isDirectory())throw new Error(`Cannot overwrite directory '${s}' with non-directory '${r}'.`)}if(c.isDirectory()&&i(r,s))throw new Error(o(r,s,a));return{srcStat:c,destStat:l}},checkParentPaths:r(async function r(i,s,a,u){const c=e.resolve(e.dirname(i)),l=e.resolve(e.dirname(a));if(l===c||l===e.parse(l).root)return;let f;try{f=await t.stat(l,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(n(s,f))throw new Error(o(i,a,u));return r(i,s,l,u)}),checkParentPathsSync:function r(i,s,a,u){const c=e.resolve(e.dirname(i)),l=e.resolve(e.dirname(a));if(l===c||l===e.parse(l).root)return;let f;try{f=t.statSync(l,{bigint:!0})}catch(t){if("ENOENT"===t.code)return;throw t}if(n(s,f))throw new Error(o(i,a,u));return r(i,s,l,u)},isSrcSubdir:i,areIdentical:n},yh}function _p(){if(vh)return bh;vh=1;const t=sh(),e=y,{mkdirs:r}=dp(),{pathExists:n}=yp(),{utimesMillis:i}=mp(),o=gp(),{asyncIteratorConcurrentProcess:s}=(_h||(_h=1,gh={asyncIteratorConcurrentProcess:async function(t,e){const r=[];for await(const n of t)r.push(e(n).then(()=>null,t=>t??new Error("unknown error")));await Promise.all(r.map(t=>t.then(t=>{if(null!==t)throw t})))}}),gh);async function a(t,e,r){return!r.filter||r.filter(t,e)}async function u(r,n,i,l){const f=l.dereference?t.stat:t.lstat,h=await f(n);if(h.isDirectory())return async function(r,n,i,c,l){n||await t.mkdir(c);await s(await t.opendir(i),async t=>{const r=e.join(i,t.name),n=e.join(c,t.name);if(await a(r,n,l)){const{destStat:t}=await o.checkPaths(r,n,"copy",l);await u(t,r,n,l)}}),n||await t.chmod(c,r.mode)}(h,r,n,i,l);if(h.isFile()||h.isCharacterDevice()||h.isBlockDevice())return async function(e,r,n,i,o){if(!r)return c(e,n,i,o);if(o.overwrite)return await t.unlink(i),c(e,n,i,o);if(o.errorOnExist)throw new Error(`'${i}' already exists`)}(h,r,n,i,l);if(h.isSymbolicLink())return async function(r,n,i,s){let a=await t.readlink(n);s.dereference&&(a=e.resolve(process.cwd(),a));if(!r)return t.symlink(a,i);let u=null;try{u=await t.readlink(i)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return t.symlink(a,i);throw e}s.dereference&&(u=e.resolve(process.cwd(),u));if(o.isSrcSubdir(a,u))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${u}'.`);if(o.isSrcSubdir(u,a))throw new Error(`Cannot overwrite '${u}' with '${a}'.`);return await t.unlink(i),t.symlink(a,i)}(r,n,i,l);if(h.isSocket())throw new Error(`Cannot copy a socket file: ${n}`);if(h.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${n}`);throw new Error(`Unknown file: ${n}`)}async function c(e,r,n,o){if(await t.copyFile(r,n),o.preserveTimestamps){128&e.mode||await function(e,r){return t.chmod(e,128|r)}(n,e.mode);const o=await t.stat(r);await i(n,o.atime,o.mtime)}return t.chmod(n,e.mode)}return bh=async function(t,i,s={}){"function"==typeof s&&(s={filter:s}),s.clobber=!("clobber"in s)||!!s.clobber,s.overwrite="overwrite"in s?!!s.overwrite:s.clobber,s.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0001");const{srcStat:c,destStat:l}=await o.checkPaths(t,i,"copy",s);if(await o.checkParentPaths(t,c,i,"copy"),!await a(t,i,s))return;const f=e.dirname(i);await n(f)||await r(f),await u(l,t,i,s)}}function bp(){if(Sh)return wh;Sh=1;const t=hr(),e=y,r=dp().mkdirsSync,n=mp().utimesMillisSync,i=gp();function o(r,n,o,c){const l=(c.dereference?t.statSync:t.lstatSync)(n);if(l.isDirectory())return function(e,r,n,i,o){return r?u(n,i,o):function(e,r,n,i){return t.mkdirSync(n),u(r,n,i),a(n,e)}(e.mode,n,i,o)}(l,r,n,o,c);if(l.isFile()||l.isCharacterDevice()||l.isBlockDevice())return function(e,r,n,i,o){return r?function(e,r,n,i){if(i.overwrite)return t.unlinkSync(n),s(e,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,i,o):s(e,n,i,o)}(l,r,n,o,c);if(l.isSymbolicLink())return function(r,n,o,s){let a=t.readlinkSync(n);s.dereference&&(a=e.resolve(process.cwd(),a));if(r){let r;try{r=t.readlinkSync(o)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return t.symlinkSync(a,o);throw e}if(s.dereference&&(r=e.resolve(process.cwd(),r)),i.isSrcSubdir(a,r))throw new Error(`Cannot copy '${a}' to a subdirectory of itself, '${r}'.`);if(i.isSrcSubdir(r,a))throw new Error(`Cannot overwrite '${r}' with '${a}'.`);return function(e,r){return t.unlinkSync(r),t.symlinkSync(e,r)}(a,o)}return t.symlinkSync(a,o)}(r,n,o,c);if(l.isSocket())throw new Error(`Cannot copy a socket file: ${n}`);if(l.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${n}`);throw new Error(`Unknown file: ${n}`)}function s(e,r,i,o){return t.copyFileSync(r,i),o.preserveTimestamps&&function(e,r,i){(function(t){return!(128&t)})(e)&&function(t,e){a(t,128|e)}(i,e);(function(e,r){const i=t.statSync(e);n(r,i.atime,i.mtime)})(r,i)}(e.mode,r,i),a(i,e.mode)}function a(e,r){return t.chmodSync(e,r)}function u(e,r,n){const i=t.opendirSync(e);try{let t;for(;null!==(t=i.readSync());)c(t.name,e,r,n)}finally{i.closeSync()}}function c(t,r,n,s){const a=e.join(r,t),u=e.join(n,t);if(s.filter&&!s.filter(a,u))return;const{destStat:c}=i.checkPathsSync(a,u,"copy",s);return o(c,a,u,s)}return wh=function(n,s,a){"function"==typeof a&&(a={filter:a}),(a=a||{}).clobber=!("clobber"in a)||!!a.clobber,a.overwrite="overwrite"in a?!!a.overwrite:a.clobber,a.preserveTimestamps&&"ia32"===process.arch&&process.emitWarning("Using the preserveTimestamps option in 32-bit node is not recommended;\n\n\tsee https://github.com/jprichardson/node-fs-extra/issues/269","Warning","fs-extra-WARN0002");const{srcStat:u,destStat:c}=i.checkPathsSync(n,s,"copy",a);if(i.checkParentPathsSync(n,u,s,"copy"),a.filter&&!a.filter(n,s))return;const l=e.dirname(s);return t.existsSync(l)||r(l),o(c,n,s,a)}}function vp(){if(kh)return Eh;kh=1;const t=oh().fromPromise;return Eh={copy:t(_p()),copySync:bp()}}function wp(){if(Oh)return xh;Oh=1;const t=hr(),e=oh().fromCallback;return xh={remove:e(function(e,r){t.rm(e,{recursive:!0,force:!0},r)}),removeSync:function(e){t.rmSync(e,{recursive:!0,force:!0})}},xh}function Sp(){if(jh)return Th;jh=1;const t=oh().fromPromise,e=sh(),r=y,n=dp(),i=wp(),o=t(async function(t){let o;try{o=await e.readdir(t)}catch{return n.mkdirs(t)}return Promise.all(o.map(e=>i.remove(r.join(t,e))))});function s(t){let o;try{o=e.readdirSync(t)}catch{return n.mkdirsSync(t)}o.forEach(e=>{e=r.join(t,e),i.removeSync(e)})}return Th={emptyDirSync:s,emptydirSync:s,emptyDir:o,emptydir:o}}function Ep(){if(Nh)return Mh;Nh=1;const t=oh().fromPromise,e=y,r=sh(),{mkdirs:n,mkdirsSync:i}=dp(),{symlinkPaths:o,symlinkPathsSync:s}=function(){if(Ah)return Fh;Ah=1;const t=y,e=sh(),{pathExists:r}=yp(),n=oh().fromPromise;return Fh={symlinkPaths:n(async function(n,i){if(t.isAbsolute(n)){try{await e.lstat(n)}catch(t){throw t.message=t.message.replace("lstat","ensureSymlink"),t}return{toCwd:n,toDst:n}}const o=t.dirname(i),s=t.join(o,n);if(await r(s))return{toCwd:s,toDst:n};try{await e.lstat(n)}catch(t){throw t.message=t.message.replace("lstat","ensureSymlink"),t}return{toCwd:n,toDst:t.relative(o,n)}}),symlinkPathsSync:function(r,n){if(t.isAbsolute(r)){if(!e.existsSync(r))throw new Error("absolute srcpath does not exist");return{toCwd:r,toDst:r}}const i=t.dirname(n),o=t.join(i,r);if(e.existsSync(o))return{toCwd:o,toDst:r};if(!e.existsSync(r))throw new Error("relative srcpath does not exist");return{toCwd:r,toDst:t.relative(i,r)}}}}(),{symlinkType:a,symlinkTypeSync:u}=function(){if(Dh)return Ih;Dh=1;const t=sh(),e=oh().fromPromise;return Ih={symlinkType:e(async function(e,r){if(r)return r;let n;try{n=await t.lstat(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}),symlinkTypeSync:function(e,r){if(r)return r;let n;try{n=t.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}}}(),{pathExists:c}=yp(),{areIdentical:l}=gp();return Mh={createSymlink:t(async function(t,i,s){let u;try{u=await r.lstat(i)}catch{}if(u&&u.isSymbolicLink()){const[e,n]=await Promise.all([r.stat(t),r.stat(i)]);if(l(e,n))return}const f=await o(t,i);t=f.toDst;const h=await a(f.toCwd,s),p=e.dirname(i);return await c(p)||await n(p),r.symlink(t,i,h)}),createSymlinkSync:function(t,n,o){let a;try{a=r.lstatSync(n)}catch{}if(a&&a.isSymbolicLink()){const e=r.statSync(t),i=r.statSync(n);if(l(e,i))return}const c=s(t,n);t=c.toDst,o=u(c.toCwd,o);const f=e.dirname(n);return r.existsSync(f)||i(f),r.symlinkSync(t,n,o)}},Mh}function kp(){if(Uh)return Bh;Uh=1;const{createFile:t,createFileSync:e}=function(){if(Rh)return Ch;Rh=1;const t=oh().fromPromise,e=y,r=sh(),n=dp();return Ch={createFile:t(async function(t){let i;try{i=await r.stat(t)}catch{}if(i&&i.isFile())return;const o=e.dirname(t);let s=null;try{s=await r.stat(o)}catch(e){if("ENOENT"===e.code)return await n.mkdirs(o),void await r.writeFile(t,"");throw e}s.isDirectory()?await r.writeFile(t,""):await r.readdir(o)}),createFileSync:function(t){let i;try{i=r.statSync(t)}catch{}if(i&&i.isFile())return;const o=e.dirname(t);try{r.statSync(o).isDirectory()||r.readdirSync(o)}catch(t){if(!t||"ENOENT"!==t.code)throw t;n.mkdirsSync(o)}r.writeFileSync(t,"")}},Ch}(),{createLink:r,createLinkSync:n}=function(){if(Lh)return Ph;Lh=1;const t=oh().fromPromise,e=y,r=sh(),n=dp(),{pathExists:i}=yp(),{areIdentical:o}=gp();return Ph={createLink:t(async function(t,s){let a,u;try{a=await r.lstat(s)}catch{}try{u=await r.lstat(t)}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}if(a&&o(u,a))return;const c=e.dirname(s);await i(c)||await n.mkdirs(c),await r.link(t,s)}),createLinkSync:function(t,i){let s;try{s=r.lstatSync(i)}catch{}try{const e=r.lstatSync(t);if(s&&o(e,s))return}catch(t){throw t.message=t.message.replace("lstat","ensureLink"),t}const a=e.dirname(i);return r.existsSync(a)||n.mkdirsSync(a),r.linkSync(t,i)}},Ph}(),{createSymlink:i,createSymlinkSync:o}=Ep();return Bh={createFile:t,createFileSync:e,ensureFile:t,ensureFileSync:e,createLink:r,createLinkSync:n,ensureLink:r,ensureLinkSync:n,createSymlink:i,createSymlinkSync:o,ensureSymlink:i,ensureSymlinkSync:o}}function xp(){if(Wh)return zh;return Wh=1,zh={stringify:function(t,{EOL:e="\n",finalEOL:r=!0,replacer:n=null,spaces:i}={}){const o=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+o},stripBom:function(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}}}function Op(){if(Gh)return qh;Gh=1;const t=function(){if($h)return Hh;let t;$h=1;try{t=hr()}catch(e){t=p}const e=oh(),{stringify:r,stripBom:n}=xp(),i=e.fromPromise(async function(r,i={}){"string"==typeof i&&(i={encoding:i});const o=i.fs||t,s=!("throws"in i)||i.throws;let a,u=await e.fromCallback(o.readFile)(r,i);u=n(u);try{a=JSON.parse(u,i?i.reviver:null)}catch(t){if(s)throw t.message=`${r}: ${t.message}`,t;return null}return a}),o=e.fromPromise(async function(n,i,o={}){const s=o.fs||t,a=r(i,o);await e.fromCallback(s.writeFile)(n,a,o)});return Hh={readFile:i,readFileSync:function(e,r={}){"string"==typeof r&&(r={encoding:r});const i=r.fs||t,o=!("throws"in r)||r.throws;try{let t=i.readFileSync(e,r);return t=n(t),JSON.parse(t,r.reviver)}catch(t){if(o)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:o,writeFileSync:function(e,n,i={}){const o=i.fs||t,s=r(n,i);return o.writeFileSync(e,s,i)}},Hh}();return qh={readJson:t.readFile,readJsonSync:t.readFileSync,writeJson:t.writeFile,writeJsonSync:t.writeFileSync}}function Tp(){if(Qh)return Vh;Qh=1;const t=oh().fromPromise,e=sh(),r=y,n=dp(),i=yp().pathExists;return Vh={outputFile:t(async function(t,o,s="utf-8"){const a=r.dirname(t);return await i(a)||await n.mkdirs(a),e.writeFile(t,o,s)}),outputFileSync:function(t,...i){const o=r.dirname(t);e.existsSync(o)||n.mkdirsSync(o),e.writeFileSync(t,...i)}},Vh}function jp(){if(tp)return Xh;tp=1;const t=oh().fromPromise,e=Op();return e.outputJson=t(function(){if(Kh)return Zh;Kh=1;const{stringify:t}=xp(),{outputFile:e}=Tp();return Zh=async function(r,n,i={}){const o=t(n,i);await e(r,o,i)},Zh}()),e.outputJsonSync=function(){if(Yh)return Jh;Yh=1;const{stringify:t}=xp(),{outputFileSync:e}=Tp();return Jh=function(r,n,i){const o=t(n,i);e(r,o,i)},Jh}(),e.outputJSON=e.outputJson,e.outputJSONSync=e.outputJsonSync,e.writeJSON=e.writeJson,e.writeJSONSync=e.writeJsonSync,e.readJSON=e.readJson,e.readJSONSync=e.readJsonSync,Xh=e}function Cp(){if(rp)return ep;rp=1;const t=sh(),e=y,{copy:r}=vp(),{remove:n}=wp(),{mkdirp:i}=dp(),{pathExists:o}=yp(),s=gp();return ep=async function(a,u,c={}){const l=c.overwrite||c.clobber||!1,{srcStat:f,isChangingCase:h=!1}=await s.checkPaths(a,u,"move",c);await s.checkParentPaths(a,f,u,"move");const p=e.dirname(u);return e.parse(p).root!==p&&await i(p),async function(e,i,s,a){if(!a)if(s)await n(i);else if(await o(i))throw new Error("dest already exists.");try{await t.rename(e,i)}catch(t){if("EXDEV"!==t.code)throw t;await async function(t,e,i){const o={overwrite:i,errorOnExist:!0,preserveTimestamps:!0};return await r(t,e,o),n(t)}(e,i,s)}}(a,u,l,h)}}function Rp(){if(ip)return np;ip=1;const t=hr(),e=y,r=vp().copySync,n=wp().removeSync,i=dp().mkdirpSync,o=gp();function s(e,i,o){try{t.renameSync(e,i)}catch(t){if("EXDEV"!==t.code)throw t;return function(t,e,i){const o={overwrite:i,errorOnExist:!0,preserveTimestamps:!0};return r(t,e,o),n(t)}(e,i,o)}}return np=function(r,a,u){const c=(u=u||{}).overwrite||u.clobber||!1,{srcStat:l,isChangingCase:f=!1}=o.checkPathsSync(r,a,"move",u);return o.checkParentPathsSync(r,l,a,"move"),function(t){const r=e.dirname(t),n=e.parse(r);return n.root===r}(a)||i(e.dirname(a)),function(e,r,i,o){if(o)return s(e,r,i);if(i)return n(r),s(e,r,i);if(t.existsSync(r))throw new Error("dest already exists.");return s(e,r,i)}(r,a,c,f)},np}function Pp(){if(sp)return op;sp=1;const t=oh().fromPromise;return op={move:t(Cp()),moveSync:Rp()}}function Lp(){return up?ap:(up=1,ap={...sh(),...vp(),...Sp(),...kp(),...jp(),...dp(),...Pp(),...Tp(),...yp(),...wp()})}var Fp,Ap,Ip,Dp,Mp,Np={exports:{}};function Bp(){if(Fp)return Np.exports;Fp=1;for(var t=4294967296,e=[],r=0;r<256;r++)e[r]=(r>15?"":"0")+r.toString(16);var n=Np.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):"[object Uint8Array]"==Object.prototype.toString.call(t)?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};return n.MAX_INT=Math.pow(2,53),n.MIN_INT=-Math.pow(2,53),n.prototype={constructor:n,_2scomp:function(){for(var t=this.buffer,e=this.offset,r=1,n=e+7;n>=e;n--){var i=(255^t[n])+r;t[n]=255&i,r=i>>8}},setValue:function(e,r){var n=!1;if(1==arguments.length)if("number"==typeof e){if(n=e<0,r=(e=Math.abs(e))%t,(e/=t)>t)throw new RangeError(e+" is outside Int64 range");e|=0}else{if("string"!=typeof e)throw new Error(e+" must be a Number or String");r=(e=(e+"").replace(/^0x/,"")).substr(-8),e=e.length>8?e.substr(0,e.length-8):"",e=parseInt(e,16),r=parseInt(r,16)}for(var i=this.buffer,o=this.offset,s=7;s>=0;s--)i[o+s]=255&r,r=4==s?e:r>>>8;n&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,r=this.offset,i=128&e[r],o=0,s=1,a=7,u=1;a>=0;a--,u*=256){var c=e[r+a];i&&(s=(c=(255^c)+s)>>8,c&=255),o+=c*u}return!t&&o>=n.MAX_INT?i?-1/0:1/0:i?-o:o},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var r=new Array(8),n=this.buffer,i=this.offset,o=0;o<8;o++)r[o]=e[n[i+o]];return r.join(t||"")},toBuffer:function(t){if(t&&0===this.offset)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((128&this.buffer[this.offset])!=(128&t.buffer[t.offset]))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return 0===this.compare(t)},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}},Np.exports}function Up(){if(Ip)return Ap;Ip=1;const t=Bp();let e,r=g;function n(t,r){e||function(){let t,r,n;for(e=[],r=0;r<256;r++){for(t=r,n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>=1;e[r]=t>>>0}}(),t.charCodeAt&&(t=t.charCodeAt(0));return(r.readUInt32BE()>>8&16777215^e[255&(r.readUInt32BE()^t>>>0)])>>>0}function i(t,e){const r=65535&t,n=65535&e;return(((t>>16&65535)*n+r*(e>>16&65535)&65535)<<16>>>0)+r*n}function o(){if(!(this instanceof o))return new o;this.key0=Buffer.allocUnsafe(4),this.key1=Buffer.allocUnsafe(4),this.key2=Buffer.allocUnsafe(4),this.key0.writeUInt32BE(305419896,0),this.key1.writeUInt32BE(591751049,0),this.key2.writeUInt32BE(878082192,0)}return r.Writable&&r.Writable.prototype.destroy||(r=ws()),o.prototype.update=function(e){this.key0.writeUInt32BE(n(e,this.key0)),this.key1.writeUInt32BE((255&this.key0.readUInt32BE())+this.key1.readUInt32BE()>>>0);const r=new t(i(this.key1.readUInt32BE(),134775813)+1&4294967295),o=Buffer.alloc(8);r.copy(o,0),o.copy(this.key1,0,4,8),this.key2.writeUInt32BE(n((this.key1.readUInt32BE()>>24&255)>>>0,this.key2))},o.prototype.decryptByte=function(t){const e=(2|this.key2.readUInt32BE())>>>0;return t^=i(e,1^e)>>8&255,this.update(t),t},o.prototype.stream=function(){const t=r.Transform(),e=this;return t._transform=function(t,r,n){for(let r=0;r<t.length;r++)t[r]=e.decryptByte(t[r]);this.push(t),n()},t},Ap=o}function zp(){if(Mp)return Dp;Mp=1;const t=Up(),e=hf(),r=g,n=S,i=yf(),o=mf(),s=df();return Dp=function(a,u,c,l,f){const h=e(),p=r.PassThrough(),d=a.stream(u,f);return d.pipe(h).on("error",function(t){p.emit("error",t)}),p.vars=h.pull(30).then(function(e){let r=s.parse(e,[["signature",4],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2]]);return r.lastModifiedDateTime=o(r.lastModifiedDate,r.lastModifiedTime),h.pull(r.fileNameLength).then(function(t){return r.fileName=t.toString("utf8"),h.pull(r.extraFieldLength)}).then(function(e){let n;return r.extra=i(e,r),l&&l.compressedSize&&(r=l),1&r.flags&&(n=h.pull(12).then(function(e){if(!c)throw new Error("MISSING_PASSWORD");const n=t();String(c).split("").forEach(function(t){n.update(t)});for(let t=0;t<e.length;t++)e[t]=n.decryptByte(e[t]);r.decrypt=n,r.compressedSize-=12;const i=8&r.flags?r.lastModifiedTime>>8&255:r.crc32>>24&255;if(e[11]!==i)throw new Error("BAD_PASSWORD");return r})),Promise.resolve(n).then(function(){return p.emit("vars",r),r})})}),p.vars.then(function(t){const e=!(8&t.flags)||t.compressedSize>0;let i;const o=t.compressionMethod?n.createInflateRaw():r.PassThrough();e?(p.size=t.uncompressedSize,i=t.compressedSize):(i=Buffer.alloc(4),i.writeUInt32LE(134695760,0));let s=h.stream(i);t.decrypt&&(s=s.pipe(t.decrypt.stream())),s.pipe(o).on("error",function(t){p.emit("error",t)}).pipe(p).on("finish",function(){d.destroy?d.destroy():d.abort?d.abort():d.close?d.close():d.push?d.push():console.log("warning - unable to close stream")})}).catch(function(t){p.emit("error",t)}),p},Dp}var Wp,Hp,$p,qp={exports:{}},Gp={exports:{}};function Vp(){if(Wp)return Gp.exports;Wp=1;var t=function(){return void 0===this}();if(t)Gp.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:t,propertyIsWritable:function(t,e){var r=Object.getOwnPropertyDescriptor(t,e);return!(r&&!r.writable&&!r.set)}};else{var e={}.hasOwnProperty,r={}.toString,n={}.constructor.prototype,i=function(t){var r=[];for(var n in t)e.call(t,n)&&r.push(n);return r};Gp.exports={isArray:function(t){try{return"[object Array]"===r.call(t)}catch(t){return!1}},keys:i,names:i,defineProperty:function(t,e,r){return t[e]=r.value,t},getDescriptor:function(t,e){return{value:t[e]}},freeze:function(t){return t},getPrototypeOf:function(t){try{return Object(t).constructor.prototype}catch(t){return n}},isES5:t,propertyIsWritable:function(){return!0}}}return Gp.exports}function Qp(){if($p)return Hp;$p=1;var t,e=Vp(),r="undefined"==typeof navigator,n={e:{}},i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==I?I:void 0!==Hp?Hp:null;function o(){try{var e=t;return t=null,e.apply(this,arguments)}catch(t){return n.e=t,n}}function s(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function a(t,r,n){if(s(t))return t;var i={value:n,configurable:!0,enumerable:!1,writable:!0};return e.defineProperty(t,r,i),t}var u=function(){var t=[Array.prototype,Object.prototype,Function.prototype],r=function(e){for(var r=0;r<t.length;++r)if(t[r]===e)return!0;return!1};if(e.isES5){var n=Object.getOwnPropertyNames;return function(t){for(var i=[],o=Object.create(null);null!=t&&!r(t);){var s;try{s=n(t)}catch(t){return i}for(var a=0;a<s.length;++a){var u=s[a];if(!o[u]){o[u]=!0;var c=Object.getOwnPropertyDescriptor(t,u);null!=c&&null==c.get&&null==c.set&&i.push(u)}}t=e.getPrototypeOf(t)}return i}}var i={}.hasOwnProperty;return function(e){if(r(e))return[];var n=[];t:for(var o in e)if(i.call(e,o))n.push(o);else{for(var s=0;s<t.length;++s)if(i.call(t[s],o))continue t;n.push(o)}return n}}(),c=/this\s*\.\s*\S+\s*=/;var l=/^[a-z$_][a-z$_0-9]*$/i;function f(t){try{return t+""}catch(t){return"[no string representation]"}}function h(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function p(t){return h(t)&&e.propertyIsWritable(t,"stack")}var d="stack"in new Error?function(t){return p(t)?t:new Error(f(t))}:function(t){if(p(t))return t;try{throw new Error(f(t))}catch(t){return t}};function y(t){return{}.toString.call(t)}var m=function(t){return e.isArray(t)?t:null};if("undefined"!=typeof Symbol&&Symbol.iterator){var g="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,r=[],n=t[Symbol.iterator]();!(e=n.next()).done;)r.push(e.value);return r};m=function(t){return e.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?g(t):null}}var _,b="undefined"!=typeof process&&"[object process]"===y(process).toLowerCase(),v="undefined"!=typeof process&&void 0!==process.env;var w,S={setReflectHandler:function(t){_=t},isClass:function(t){try{if("function"==typeof t){var r=e.names(t.prototype),n=e.isES5&&r.length>1,i=r.length>0&&!(1===r.length&&"constructor"===r[0]),o=c.test(t+"")&&e.names(t).length>0;if(n||i||o)return!0}return!1}catch(t){return!1}},isIdentifier:function(t){return l.test(t)},inheritedDataKeys:u,getDataPropertyOrDefault:function(t,r,n){if(!e.isES5)return{}.hasOwnProperty.call(t,r)?t[r]:void 0;var i=Object.getOwnPropertyDescriptor(t,r);return null!=i?null==i.get&&null==i.set?i.value:n:void 0},thrower:function(t){throw t},isArray:e.isArray,asArray:m,notEnumerableProp:a,isPrimitive:s,isObject:function(t){return"function"==typeof t||"object"==typeof t&&null!==t},isError:h,canEvaluate:r,errorObj:n,tryCatch:function(e){return t=e,o},inherits:function(t,e){var r={}.hasOwnProperty;function n(){for(var n in this.constructor=t,this.constructor$=e,e.prototype)r.call(e.prototype,n)&&"$"!==n.charAt(n.length-1)&&(this[n+"$"]=e.prototype[n])}return n.prototype=e.prototype,t.prototype=new n,t.prototype},withAppended:function(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;r<n;++r)i[r]=t[r];return i[r]=e,i},maybeWrapAsError:function(t){return s(t)?new Error(f(t)):t},toFastProperties:function(t){function e(){}e.prototype=t;var r=new e;function n(){return typeof r.foo}return n(),n(),t},filledRange:function(t,e,r){for(var n=new Array(t),i=0;i<t;++i)n[i]=e+i+r;return n},toString:f,canAttachTrace:p,ensureErrorObject:d,originatesFromRejection:function(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)},markAsOriginatingFromRejection:function(t){try{a(t,"isOperational",!0)}catch(t){}},classString:y,copyDescriptors:function(t,r,n){for(var i=e.names(t),o=0;o<i.length;++o){var s=i[o];if(n(s))try{e.defineProperty(r,s,e.getDescriptor(t,s))}catch(t){}}},isNode:b,hasEnvVariables:v,env:function(t){return v?process.env[t]:void 0},global:i,getNativePromise:function(){if("function"==typeof Promise)try{if("[object Promise]"===y(new Promise(function(){})))return Promise}catch(t){}},contextBind:function(t,e){if(null===t||"function"!=typeof e||e===_)return e;null!==t.domain&&(e=t.domain.bind(e));var r=t.async;if(null!==r){var n=e;e=function(){for(var t=arguments.length+2,e=new Array(t),i=2;i<t;++i)e[i]=arguments[i-2];return e[0]=n,e[1]=this,r.runInAsyncScope.apply(r,e)}}return e}};S.isRecentNode=S.isNode&&(process.versions&&process.versions.node?w=process.versions.node.split(".").map(Number):process.version&&(w=process.version.split(".").map(Number)),0===w[0]&&w[1]>10||w[0]>0),S.nodeSupportsAsyncResource=S.isNode&&function(){var t=!1;try{t="function"==typeof require("async_hooks").AsyncResource.prototype.runInAsyncScope}catch(e){t=!1}return t}(),S.isNode&&S.toFastProperties(process);try{throw new Error}catch(t){S.lastLineError=t}return Hp=S}var Zp,Kp,Jp,Yp,Xp,td,ed,rd,nd,id,od,sd,ad,ud,cd,ld,fd,hd,pd,dd,yd,md,gd,_d,bd,vd,wd,Sd,Ed,kd,xd,Od,Td,jd,Cd,Rd,Pd,Ld,Fd,Ad,Id,Dd,Md,Nd,Bd,Ud,zd,Wd,Hd,$d,qd,Gd,Vd,Qd,Zd,Kd,Jd,Yd,Xd,ty,ey,ry,ny,iy,oy,sy,ay,uy,cy={exports:{}};function ly(){if(Kp)return Zp;Kp=1;var t,e=Qp(),r=e.getNativePromise();if(e.isNode&&"undefined"==typeof MutationObserver){var n=I.setImmediate,i=process.nextTick;t=e.isRecentNode?function(t){n.call(I,t)}:function(t){i.call(process,t)}}else if("function"==typeof r&&"function"==typeof r.resolve){var o=r.resolve();t=function(t){o.then(t)}}else t="undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)||!("classList"in document.documentElement)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:function(){var t=document.createElement("div"),e={attributes:!0},r=!1,n=document.createElement("div");new MutationObserver(function(){t.classList.toggle("foo"),r=!1}).observe(n,e);return function(i){var o=new MutationObserver(function(){o.disconnect(),i()});o.observe(t,e),r||(r=!0,n.classList.toggle("foo"))}}();return Zp=t}function fy(){if(Xp)return cy.exports;var t;Xp=1;try{throw new Error}catch(e){t=e}var e=ly(),r=function(){if(Yp)return Jp;function t(t){this._capacity=t,this._length=0,this._front=0}return Yp=1,t.prototype._willBeOverCapacity=function(t){return this._capacity<t},t.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1),this[this._front+e&this._capacity-1]=t,this._length=e+1},t.prototype.push=function(t,e,r){var n=this.length()+3;if(this._willBeOverCapacity(n))return this._pushOne(t),this._pushOne(e),void this._pushOne(r);var i=this._front+n-3;this._checkCapacity(n);var o=this._capacity-1;this[i+0&o]=t,this[i+1&o]=e,this[i+2&o]=r,this._length=n},t.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},t.prototype.length=function(){return this._length},t.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},t.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t,function(t,e,r,n,i){for(var o=0;o<i;++o)r[o+n]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},Jp=t}();function n(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new r(16),this._normalQueue=new r(16),this._haveDrainedQueues=!1;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=e}function i(t){for(;t.length()>0;)o(t)}function o(t){var e=t.shift();if("function"!=typeof e)e._settlePromises();else{var r=t.shift(),n=t.shift();e.call(r,n)}}return n.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},n.prototype.hasCustomScheduler=function(){return this._customScheduler},n.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},n.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},n.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},n.prototype.invokeLater=function(t,e,r){this._lateQueue.push(t,e,r),this._queueTick()},n.prototype.invoke=function(t,e,r){this._normalQueue.push(t,e,r),this._queueTick()},n.prototype.settlePromises=function(t){this._normalQueue._pushOne(t),this._queueTick()},n.prototype._drainQueues=function(){i(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,i(this._lateQueue)},n.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},n.prototype._reset=function(){this._isTickUsed=!1},cy.exports=n,cy.exports.firstLineError=t,cy.exports}function hy(){if(ed)return td;ed=1;var t,e,r=Vp(),n=r.freeze,i=Qp(),o=i.inherits,s=i.notEnumerableProp;function a(t,e){function r(n){if(!(this instanceof r))return new r(n);s(this,"message","string"==typeof n?n:e),s(this,"name",t),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return o(r,Error),r}var u=a("Warning","warning"),c=a("CancellationError","cancellation error"),l=a("TimeoutError","timeout error"),f=a("AggregateError","aggregate error");try{t=TypeError,e=RangeError}catch(r){t=a("TypeError","type error"),e=a("RangeError","range error")}for(var h="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),p=0;p<h.length;++p)"function"==typeof Array.prototype[h[p]]&&(f.prototype[h[p]]=Array.prototype[h[p]]);r.defineProperty(f.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),f.prototype.isOperational=!0;var d=0;function y(t){if(!(this instanceof y))return new y(t);s(this,"name","OperationalError"),s(this,"message",t),this.cause=t,this.isOperational=!0,t instanceof Error?(s(this,"message",t.message),s(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}f.prototype.toString=function(){var t=Array(4*d+1).join(" "),e="\n"+t+"AggregateError of:\n";d++,t=Array(4*d+1).join(" ");for(var r=0;r<this.length;++r){for(var n=this[r]===this?"[Circular AggregateError]":this[r]+"",i=n.split("\n"),o=0;o<i.length;++o)i[o]=t+i[o];e+=(n=i.join("\n"))+"\n"}return d--,e},o(y,Error);var m=Error.__BluebirdErrorTypes__;return m||(m=n({CancellationError:c,TimeoutError:l,OperationalError:y,RejectionError:y,AggregateError:f}),r.defineProperty(Error,"__BluebirdErrorTypes__",{value:m,writable:!1,enumerable:!1,configurable:!1})),td={Error:Error,TypeError:t,RangeError:e,CancellationError:m.CancellationError,OperationalError:m.OperationalError,TimeoutError:m.TimeoutError,AggregateError:m.AggregateError,Warning:u}}function py(){return nd||(nd=1,rd=function(t,e){var r=Qp(),n=r.errorObj,i=r.isObject;var o={}.hasOwnProperty;return function(s,a){if(i(s)){if(s instanceof t)return s;var u=function(t){try{return function(t){return t.then}(t)}catch(t){return n.e=t,n}}(s);if(u===n){a&&a._pushContext();var c=t.reject(u.e);return a&&a._popContext(),c}if("function"==typeof u){if(function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(s)){c=new t(e);return s._then(c._fulfill,c._reject,void 0,c,null),c}return function(i,o,s){var a=new t(e),u=a;s&&s._pushContext();a._captureStackTrace(),s&&s._popContext();var c=!0,l=r.tryCatch(o).call(i,f,h);c=!1,a&&l===n&&(a._rejectCallback(l.e,!0,!0),a=null);function f(t){a&&(a._resolveCallback(t),a=null)}function h(t){a&&(a._rejectCallback(t,c,!0),a=null)}return u}(s,u,a)}}return s}}),rd}function dy(){return od||(od=1,id=function(t,e,r,n,i){var o=Qp();function s(r){var n=this._promise=new t(e);r instanceof t&&(n._propagateFrom(r,3),r.suppressUnhandledRejections()),n._setOnCancel(this),this._values=r,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return o.isArray,o.inherits(s,i),s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function e(i,s){var a=r(this._values,this._promise);if(a instanceof t){var u=(a=a._target())._bitField;if(this._values=a,!(50397184&u))return this._promise._setAsyncGuaranteed(),a._then(e,this._reject,void 0,this,s);if(!(33554432&u))return 16777216&u?this._reject(a._reason()):this._cancel();a=a._value()}if(null!==(a=o.asArray(a)))0!==a.length?this._iterate(a):-5===s?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(s));else{var c=n("expecting an array or an iterable object but got "+o.classString(a)).reason();this._promise._rejectCallback(c,!1)}},s.prototype._iterate=function(e){var n=this.getActualLength(e.length);this._length=n,this._values=this.shouldCopyValues()?new Array(n):this._values;for(var i=this._promise,o=!1,s=null,a=0;a<n;++a){var u=r(e[a],i);s=u instanceof t?(u=u._target())._bitField:null,o?null!==s&&u.suppressUnhandledRejections():null!==s?50397184&s?o=33554432&s?this._promiseFulfilled(u._value(),a):16777216&s?this._promiseRejected(u._reason(),a):this._promiseCancelled(a):(u._proxy(this,a),this._values[a]=u):o=this._promiseFulfilled(u,a)}o||i._setAsyncGuaranteed()},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},s.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},s.prototype._promiseCancelled=function(){return this._cancel(),!0},s.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},s.prototype._resultCancelled=function(){if(!this._isResolved()){var e=this._values;if(this._cancel(),e instanceof t)e.cancel();else for(var r=0;r<e.length;++r)e[r]instanceof t&&e[r].cancel()}},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}),id}function yy(){return cd||(cd=1,ud=function(t,e,r,n){var i,o,s,a,u=t._async,c=hy().Warning,l=Qp(),f=Vp(),h=l.canAttachTrace,p=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,d=/\((?:timers\.js):\d+:\d+\)/,y=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,m=null,g=null,_=!1,b=!(0==l.env("BLUEBIRD_DEBUG")||!l.env("BLUEBIRD_DEBUG")&&"development"!==l.env("NODE_ENV")),v=!(0==l.env("BLUEBIRD_WARNINGS")||!b&&!l.env("BLUEBIRD_WARNINGS")),w=!(0==l.env("BLUEBIRD_LONG_STACK_TRACES")||!b&&!l.env("BLUEBIRD_LONG_STACK_TRACES")),S=0!=l.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(v||!!l.env("BLUEBIRD_W_FORGOTTEN_RETURN"));!function(){var e=[];function r(){for(var t=0;t<e.length;++t)e[t]._notifyUnhandledRejection();n()}function n(){e.length=0}a=function(t){e.push(t),setTimeout(r,1)},f.defineProperty(t,"_unhandledRejectionCheck",{value:r}),f.defineProperty(t,"_unhandledRejectionClear",{value:n})}(),t.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},t.prototype._ensurePossibleRejectionHandled=function(){524288&this._bitField||(this._setRejectionIsUnhandled(),a(this))},t.prototype._notifyUnhandledRejectionIsHandled=function(){G("rejectionHandled",i,void 0,this)},t.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},t.prototype._returnedNonUndefined=function(){return!!(268435456&this._bitField)},t.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._settledValue();this._setUnhandledRejectionIsNotified(),G("unhandledRejection",o,t,this)}},t.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},t.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},t.prototype._isUnhandledRejectionNotified=function(){return(262144&this._bitField)>0},t.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},t.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},t.prototype._isRejectionUnhandled=function(){return(1048576&this._bitField)>0},t.prototype._warn=function(t,e,r){return W(t,e,r||this)},t.onPossiblyUnhandledRejection=function(e){var r=t._getContext();o=l.contextBind(r,e)},t.onUnhandledRejectionHandled=function(e){var r=t._getContext();i=l.contextBind(r,e)};var E=function(){};t.longStackTraces=function(){if(u.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");if(!tt.longStackTraces&&Q()){var r=t.prototype._captureStackTrace,n=t.prototype._attachExtraTrace,i=t.prototype._dereferenceTrace;tt.longStackTraces=!0,E=function(){if(u.haveItemsQueued()&&!tt.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");t.prototype._captureStackTrace=r,t.prototype._attachExtraTrace=n,t.prototype._dereferenceTrace=i,e.deactivateLongStackTraces(),tt.longStackTraces=!1},t.prototype._captureStackTrace=B,t.prototype._attachExtraTrace=U,t.prototype._dereferenceTrace=z,e.activateLongStackTraces()}},t.hasLongStackTraces=function(){return tt.longStackTraces&&Q()};var k={unhandledrejection:{before:function(){var t=l.global.onunhandledrejection;return l.global.onunhandledrejection=null,t},after:function(t){l.global.onunhandledrejection=t}},rejectionhandled:{before:function(){var t=l.global.onrejectionhandled;return l.global.onrejectionhandled=null,t},after:function(t){l.global.onrejectionhandled=t}}},x=function(){var t=function(t,e){if(!t)return!l.global.dispatchEvent(e);var r;try{return r=t.before(),!l.global.dispatchEvent(e)}finally{t.after(r)}};try{if("function"==typeof CustomEvent){var e=new CustomEvent("CustomEvent");return l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=new CustomEvent(e,{detail:r,cancelable:!0});return f.defineProperty(n,"promise",{value:r.promise}),f.defineProperty(n,"reason",{value:r.reason}),t(k[e],n)}}if("function"==typeof Event){e=new Event("CustomEvent");return l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=new Event(e,{cancelable:!0});return n.detail=r,f.defineProperty(n,"promise",{value:r.promise}),f.defineProperty(n,"reason",{value:r.reason}),t(k[e],n)}}return(e=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),l.global.dispatchEvent(e),function(e,r){e=e.toLowerCase();var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!0,r),t(k[e],n)}}catch(t){}return function(){return!1}}(),O=l.isNode?function(){return process.emit.apply(process,arguments)}:l.global?function(t){var e="on"+t.toLowerCase(),r=l.global[e];return!!r&&(r.apply(l.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function T(t,e){return{promise:e}}var j={promiseCreated:T,promiseFulfilled:T,promiseRejected:T,promiseResolved:T,promiseCancelled:T,promiseChained:function(t,e,r){return{promise:e,child:r}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,r){return{reason:e,promise:r}},rejectionHandled:T},C=function(t){var e=!1;try{e=O.apply(null,arguments)}catch(t){u.throwLater(t),e=!0}var r=!1;try{r=x(t,j[t].apply(null,arguments))}catch(t){u.throwLater(t),r=!0}return r||e};function R(){return!1}function P(t,e,r){var n=this;try{t(e,r,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+l.toString(t));n._attachCancellationCallback(t)})}catch(t){return t}}function L(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?l.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function F(){return this._onCancelField}function A(t){this._onCancelField=t}function I(){this._cancellationParent=void 0,this._onCancelField=void 0}function D(t,e){if(1&e){this._cancellationParent=t;var r=t._branchesRemainingToCancel;void 0===r&&(r=0),t._branchesRemainingToCancel=r+1}2&e&&t._isBound()&&this._setBoundTo(t._boundTo)}t.config=function(e){if("longStackTraces"in(e=Object(e))&&(e.longStackTraces?t.longStackTraces():!e.longStackTraces&&t.hasLongStackTraces()&&E()),"warnings"in e){var i=e.warnings;tt.warnings=!!i,S=tt.warnings,l.isObject(i)&&"wForgottenReturn"in i&&(S=!!i.wForgottenReturn)}if("cancellation"in e&&e.cancellation&&!tt.cancellation){if(u.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");t.prototype._clearCancellationData=I,t.prototype._propagateFrom=D,t.prototype._onCancel=F,t.prototype._setOnCancel=A,t.prototype._attachCancellationCallback=L,t.prototype._execute=P,M=D,tt.cancellation=!0}if("monitoring"in e&&(e.monitoring&&!tt.monitoring?(tt.monitoring=!0,t.prototype._fireEvent=C):!e.monitoring&&tt.monitoring&&(tt.monitoring=!1,t.prototype._fireEvent=R)),"asyncHooks"in e&&l.nodeSupportsAsyncResource){var o=tt.asyncHooks,s=!!e.asyncHooks;o!==s&&(tt.asyncHooks=s,s?r():n())}return t},t.prototype._fireEvent=R,t.prototype._execute=function(t,e,r){try{t(e,r)}catch(t){return t}},t.prototype._onCancel=function(){},t.prototype._setOnCancel=function(t){},t.prototype._attachCancellationCallback=function(t){},t.prototype._captureStackTrace=function(){},t.prototype._attachExtraTrace=function(){},t.prototype._dereferenceTrace=function(){},t.prototype._clearCancellationData=function(){},t.prototype._propagateFrom=function(t,e){};var M=function(t,e){2&e&&t._isBound()&&this._setBoundTo(t._boundTo)};function N(){var e=this._boundTo;return void 0!==e&&e instanceof t?e.isFulfilled()?e.value():void 0:e}function B(){this._trace=new Y(this._peekContext())}function U(t,e){if(h(t)){var r=this._trace;if(void 0!==r&&e&&(r=r._parent),void 0!==r)r.attachExtraTrace(t);else if(!t.__stackCleaned__){var n=$(t);l.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),l.notEnumerableProp(t,"__stackCleaned__",!0)}}}function z(){this._trace=void 0}function W(e,r,n){if(tt.warnings){var i,o=new c(e);if(r)n._attachExtraTrace(o);else if(tt.longStackTraces&&(i=t._peekContext()))i.attachExtraTrace(o);else{var s=$(o);o.stack=s.message+"\n"+s.stack.join("\n")}C("warning",o)||q(o,"",!0)}}function H(t){for(var e=[],r=0;r<t.length;++r){var n=t[r],i=" (No stack trace)"===n||m.test(n),o=i&&Z(n);i&&!o&&(_&&" "!==n.charAt(0)&&(n=" "+n),e.push(n))}return e}function $(t){var e=t.stack,r=t.toString();return e="string"==typeof e&&e.length>0?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),r=0;r<e.length;++r){var n=e[r];if(" (No stack trace)"===n||m.test(n))break}return r>0&&"SyntaxError"!=t.name&&(e=e.slice(r)),e}(t):[" (No stack trace)"],{message:r,stack:"SyntaxError"==t.name?e:H(e)}}function q(t,e,r){if("undefined"!=typeof console){var n;if(l.isObject(t)){var i=t.stack;n=e+g(i,t)}else n=e+String(t);"function"==typeof s?s(n,r):"function"!=typeof console.log&&"object"!=typeof console.log||console.log(n)}}function G(t,e,r,n){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(n):e(r,n))}catch(t){u.throwLater(t)}"unhandledRejection"===t?C(t,r,n)||i||q(r,"Unhandled rejection "):C(t,n)}function V(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():l.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){var e=41;if(t.length<e)return t;return t.substr(0,e-3)+"..."}(e)+">, no stack trace)"}function Q(){return"function"==typeof X}var Z=function(){return!1},K=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function J(t){var e=t.match(K);if(e)return{fileName:e[1],line:parseInt(e[2],10)}}function Y(t){this._parent=t,this._promisesCreated=0;var e=this._length=1+(void 0===t?0:t._length);X(this,Y),e>32&&this.uncycle()}l.inherits(Y,Error),e.CapturedTrace=Y,Y.prototype.uncycle=function(){var t=this._length;if(!(t<2)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;for(n=(t=this._length=n)-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(n=0;n<t;++n){var s=r[e[n].stack];if(void 0!==s&&s!==n){s>0&&(e[s-1]._parent=void 0,e[s-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var a=n>0?e[n-1]:this;s<t-1?(a._parent=e[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var u=a._length+1,c=n-2;c>=0;--c)e[c]._length=u,u++;return}}}},Y.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=$(t),r=e.message,n=[e.stack],i=this;void 0!==i;)n.push(H(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],r=1;r<t.length;++r){for(var n=t[r],i=e.length-1,o=e[i],s=-1,a=n.length-1;a>=0;--a)if(n[a]===o){s=a;break}for(a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}(n),function(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}(n),l.notEnumerableProp(t,"stack",function(t,e){for(var r=0;r<e.length-1;++r)e[r].push("From previous event:"),e[r]=e[r].join("\n");return r<e.length&&(e[r]=e[r].join("\n")),t+"\n"+e.join("\n")}(r,n)),l.notEnumerableProp(t,"__stackCleaned__",!0)}};var X=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():V(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,m=t,g=e;var r=Error.captureStackTrace;return Z=function(t){return p.test(t)},function(t,e){Error.stackTraceLimit+=6,r(t,e),Error.stackTraceLimit-=6}}var n,i=new Error;if("string"==typeof i.stack&&i.stack.split("\n")[0].indexOf("stackDetection@")>=0)return m=/@/,g=e,_=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){n="stack"in t}return!("stack"in i)&&n&&"number"==typeof Error.stackTraceLimit?(m=t,g=e,function(t){Error.stackTraceLimit+=6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit-=6}):(g=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?V(e):e.toString()},null)}();"undefined"!=typeof console&&void 0!==console.warn&&(s=function(t){console.warn(t)},l.isNode&&process.stderr.isTTY?s=function(t,e){var r=e?"[33m":"[31m";console.warn(r+t+"[0m\n")}:l.isNode||"string"!=typeof(new Error).stack||(s=function(t,e){console.warn("%c"+t,e?"color: darkorange":"color: red")}));var tt={warnings:v,longStackTraces:!1,cancellation:!1,monitoring:!1,asyncHooks:!1};return w&&t.longStackTraces(),{asyncHooks:function(){return tt.asyncHooks},longStackTraces:function(){return tt.longStackTraces},warnings:function(){return tt.warnings},cancellation:function(){return tt.cancellation},monitoring:function(){return tt.monitoring},propagateFromFunction:function(){return M},boundValueFunction:function(){return N},checkForgottenReturns:function(t,e,r,n,i){if(void 0===t&&null!==e&&S){if(void 0!==i&&i._returnedNonUndefined())return;if(!(65535&n._bitField))return;r&&(r+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),u=H(a),c=u.length-1;c>=0;--c){var l=u[c];if(!d.test(l)){var f=l.match(y);f&&(o="at "+f[1]+":"+f[2]+":"+f[3]+" ");break}}if(u.length>0){var h=u[0];for(c=0;c<a.length;++c)if(a[c]===h){c>0&&(s="\n"+a[c-1]);break}}}var p="a promise was created in a "+r+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s;n._warn(p,!0,e)}},setBounds:function(t,e){if(Q()){for(var r,n,i=(t.stack||"").split("\n"),o=(e.stack||"").split("\n"),s=-1,a=-1,u=0;u<i.length;++u){if(c=J(i[u])){r=c.fileName,s=c.line;break}}for(u=0;u<o.length;++u){var c;if(c=J(o[u])){n=c.fileName,a=c.line;break}}s<0||a<0||!r||!n||r!==n||s>=a||(Z=function(t){if(p.test(t))return!0;var e=J(t);return!!(e&&e.fileName===r&&s<=e.line&&e.line<=a)})}},warn:W,deprecated:function(t,e){var r=t+" is deprecated and will be removed in a future version.";return e&&(r+=" Use "+e+" instead."),W(r)},CapturedTrace:Y,fireDomEvent:x,fireGlobalEvent:O}}),ud}function my(){return fd||(fd=1,ld=function(t){var e=Qp(),r=Vp().keys,n=e.tryCatch,i=e.errorObj;return function(o,s,a){return function(u){var c=a._boundValue();t:for(var l=0;l<o.length;++l){var f=o[l];if(f===Error||null!=f&&f.prototype instanceof Error){if(u instanceof f)return n(s).call(c,u)}else if("function"==typeof f){var h=n(f).call(c,u);if(h===i)return h;if(h)return n(s).call(c,u)}else if(e.isObject(u)){for(var p=r(f),d=0;d<p.length;++d){var y=p[d];if(f[y]!=u[y])continue t}return n(s).call(c,u)}}return t}}}),ld}function gy(){return pd||(pd=1,hd=function(t,e,r){var n=Qp(),i=t.CancellationError,o=n.errorObj,s=my()(r);function a(t,e,r){this.promise=t,this.type=e,this.handler=r,this.called=!1,this.cancelPromise=null}function u(t){this.finallyHandler=t}function c(t,e){return null!=t.cancelPromise&&(arguments.length>1?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,!0)}function l(){return h.call(this,this.promise._target()._settledValue())}function f(t){if(!c(this,t))return o.e=t,o}function h(n){var s=this.promise,a=this.handler;if(!this.called){this.called=!0;var h=this.isFinallyHandler()?a.call(s._boundValue()):a.call(s._boundValue(),n);if(h===r)return h;if(void 0!==h){s._setReturnedNonUndefined();var p=e(h,s);if(p instanceof t){if(null!=this.cancelPromise){if(p._isCancelled()){var d=new i("late cancellation observer");return s._attachExtraTrace(d),o.e=d,o}p.isPending()&&p._attachCancellationCallback(new u(this))}return p._then(l,f,void 0,this,void 0)}}}return s.isRejected()?(c(this),o.e=n,o):(c(this),n)}return a.prototype.isFinallyHandler=function(){return 0===this.type},u.prototype._resultCancelled=function(){c(this.finallyHandler)},t.prototype._passThrough=function(t,e,r,n){return"function"!=typeof t?this.then():this._then(r,n,void 0,new a(this,e,t),void 0)},t.prototype.lastly=t.prototype.finally=function(t){return this._passThrough(t,0,h,h)},t.prototype.tap=function(t){return this._passThrough(t,1,h)},t.prototype.tapCatch=function(e){var r=arguments.length;if(1===r)return this._passThrough(e,1,void 0,h);var i,o=new Array(r-1),a=0;for(i=0;i<r-1;++i){var u=arguments[i];if(!n.isObject(u))return t.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+n.classString(u)));o[a++]=u}o.length=a;var c=arguments[i];return this._passThrough(s(o,c,this),1,void 0,h)},a}),hd}function _y(){if(yd)return dd;yd=1;var t=Qp(),e=t.maybeWrapAsError,r=hy().OperationalError,n=Vp();var i=/^(?:name|message|stack|cause)$/;function o(e){var o;if(function(t){return t instanceof Error&&n.getPrototypeOf(t)===Error.prototype}(e)){(o=new r(e)).name=e.name,o.message=e.message,o.stack=e.stack;for(var s=n.keys(e),a=0;a<s.length;++a){var u=s[a];i.test(u)||(o[u]=e[u])}return o}return t.markAsOriginatingFromRejection(e),e}return dd=function(t,r){return function(n,i){if(null!==t){if(n){var s=o(e(n));t._attachExtraTrace(s),t._reject(s)}else if(r){for(var a=arguments.length,u=new Array(Math.max(a-1,0)),c=1;c<a;++c)u[c-1]=arguments[c];t._fulfill(u)}else t._fulfill(i);t=null}}},dd}function by(){return xd||(xd=1,kd=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var r=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},n=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return!!(33554432&this._bitField)},o=e.prototype.isRejected=function(){return!!(16777216&this._bitField)},s=e.prototype.isPending=function(){return!(50397184&this._bitField)},a=e.prototype.isResolved=function(){return!!(50331648&this._bitField)};e.prototype.isCancelled=function(){return!!(8454144&this._bitField)},t.prototype.__isCancelled=function(){return!(65536&~this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return!!(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return r.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),n.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}),kd}function vy(){return Pd||(Pd=1,Rd=function(t,e,r,n,i,o){var s=hy().TypeError,a=Qp(),u=a.errorObj,c=a.tryCatch,l=[];function f(e,n,i,s){if(o.cancellation()){var a=new t(r),u=this._finallyPromise=new t(r);this._promise=a.lastly(function(){return u}),a._captureStackTrace(),a._setOnCancel(this)}else{(this._promise=new t(r))._captureStackTrace()}this._stack=s,this._generatorFunction=e,this._receiver=n,this._generator=void 0,this._yieldHandlers="function"==typeof i?[i].concat(l):l,this._yieldedPromise=null,this._cancellationPhase=!1}a.inherits(f,i),f.prototype._isResolved=function(){return null===this._promise},f.prototype._cleanup=function(){this._promise=this._generator=null,o.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},f.prototype._promiseCancelled=function(){if(!this._isResolved()){var e;if(void 0!==this._generator.return)this._promise._pushContext(),e=c(this._generator.return).call(this._generator,void 0),this._promise._popContext();else{var r=new t.CancellationError("generator .return() sentinel");t.coroutine.returnSentinel=r,this._promise._attachExtraTrace(r),this._promise._pushContext(),e=c(this._generator.throw).call(this._generator,r),this._promise._popContext()}this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(e)}},f.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();var e=c(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(e)},f.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();var e=c(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(e)},f.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof t){var e=this._yieldedPromise;this._yieldedPromise=null,e.cancel()}},f.prototype.promise=function(){return this._promise},f.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},f.prototype._continue=function(e){var r=this._promise;if(e===u)return this._cleanup(),this._cancellationPhase?r.cancel():r._rejectCallback(e.e,!1);var i=e.value;if(!0===e.done)return this._cleanup(),this._cancellationPhase?r.cancel():r._resolveCallback(i);var o=n(i,this._promise);if(o instanceof t||(o=function(e,r,i){for(var o=0;o<r.length;++o){i._pushContext();var s=c(r[o])(e);if(i._popContext(),s===u){i._pushContext();var a=t.reject(u.e);return i._popContext(),a}var l=n(s,i);if(l instanceof t)return l}return null}(o,this._yieldHandlers,this._promise),null!==o)){var a=(o=o._target())._bitField;50397184&a?33554432&a?t._async.invoke(this._promiseFulfilled,this,o._value()):16777216&a?t._async.invoke(this._promiseRejected,this,o._reason()):this._promiseCancelled():(this._yieldedPromise=o,o._proxy(this,null))}else this._promiseRejected(new s("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(i))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")))},t.coroutine=function(t,e){if("function"!=typeof t)throw new s("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var r=Object(e).yieldHandler,n=f,i=(new Error).stack;return function(){var e=t.apply(this,arguments),o=new n(void 0,void 0,r,i),s=o.promise();return o._generator=e,o._promiseFulfilled(void 0),s}},t.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new s("expecting a function but got "+a.classString(t));l.push(t)},t.spawn=function(r){if(o.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof r)return e("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var n=new f(r,this),i=n.promise();return n._run(t.spawn),i}}),Rd}function wy(){return Fd||(Fd=1,Ld=function(t,e,r,n,i,o){var s=Qp(),a=s.tryCatch,u=s.errorObj,c=t._async;function l(e,r,n,o){this.constructor$(e),this._promise._captureStackTrace();var a=t._getContext();if(this._callback=s.contextBind(a,r),this._preservedValues=o===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],c.invoke(this._asyncInit,this,void 0),s.isArray(e))for(var u=0;u<e.length;++u){var l=e[u];l instanceof t&&l.suppressUnhandledRejections()}}function f(e,n,i,o){if("function"!=typeof n)return r("expecting a function but got "+s.classString(n));var a=0;if(void 0!==i){if("object"!=typeof i||null===i)return t.reject(new TypeError("options argument must be an object but it is "+s.classString(i)));if("number"!=typeof i.concurrency)return t.reject(new TypeError("'concurrency' must be a number but it is "+s.classString(i.concurrency)));a=i.concurrency}return new l(e,n,a="number"==typeof a&&isFinite(a)&&a>=1?a:0,o).promise()}s.inherits(l,e),l.prototype._asyncInit=function(){this._init$(void 0,-2)},l.prototype._init=function(){},l.prototype._promiseFulfilled=function(e,r){var i=this._values,s=this.length(),c=this._preservedValues,l=this._limit;if(r<0){if(i[r=-1*r-1]=e,l>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(l>=1&&this._inFlight>=l)return i[r]=e,this._queue.push(r),!1;null!==c&&(c[r]=e);var f=this._promise,h=this._callback,p=f._boundValue();f._pushContext();var d=a(h).call(p,e,r,s),y=f._popContext();if(o.checkForgottenReturns(d,y,null!==c?"Promise.filter":"Promise.map",f),d===u)return this._reject(d.e),!0;var m=n(d,this._promise);if(m instanceof t){var g=(m=m._target())._bitField;if(!(50397184&g))return l>=1&&this._inFlight++,i[r]=m,m._proxy(this,-1*(r+1)),!1;if(!(33554432&g))return 16777216&g?(this._reject(m._reason()),!0):(this._cancel(),!0);d=m._value()}i[r]=d}return++this._totalResolved>=s&&(null!==c?this._filter(i,c):this._resolve(i),!0)},l.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlight<e;){if(this._isResolved())return;var n=t.pop();this._promiseFulfilled(r[n],n)}},l.prototype._filter=function(t,e){for(var r=e.length,n=new Array(r),i=0,o=0;o<r;++o)t[o]&&(n[i++]=e[o]);n.length=i,this._resolve(n)},l.prototype.preservedValues=function(){return this._preservedValues},t.prototype.map=function(t,e){return f(this,t,e,null)},t.map=function(t,e,r,n){return f(t,e,r,n)}}),Ld}function Sy(){return Md||(Md=1,Dd=function(t,e){var r={},n=Qp(),i=_y(),o=n.withAppended,s=n.maybeWrapAsError,a=n.canEvaluate,u=hy().TypeError,c={__isPromisified__:!0},l=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),f=function(t){return n.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t};function h(t){return!l.test(t)}function p(t){try{return!0===t.__isPromisified__}catch(t){return!1}}function d(t,e,r){var i=n.getDataPropertyOrDefault(t,e+r,c);return!!i&&p(i)}function y(t,e,r,i){for(var o=n.inheritedDataKeys(t),s=[],a=0;a<o.length;++a){var c=o[a],l=t[c],h=i===f||f(c);"function"!=typeof l||p(l)||d(t,c,e)||!i(c,l,t,h)||s.push(c,l)}return function(t,e,r){for(var n=0;n<t.length;n+=2){var i=t[n];if(r.test(i))for(var o=i.replace(r,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new u("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",e))}}(s,e,r),s}var m;m=function(a,u,c,l,f,h){var p=Math.max(0,function(t){return"number"==typeof t.length?Math.max(Math.min(t.length,1024),0):0}(l)-1),d=function(t){for(var e=[t],r=Math.max(0,t-1-3),n=t-1;n>=r;--n)e.push(n);for(n=t+1;n<=3;++n)e.push(n);return e}(p),y="string"==typeof a||u===r;function m(t){var e,r=(e=t,n.filledRange(e,"_arg","")).join(", "),i=t>0?", ":"";return(y?"ret = callback.call(this, {{args}}, nodeback); break;\n":void 0===u?"ret = callback({{args}}, nodeback); break;\n":"ret = callback.call(receiver, {{args}}, nodeback); break;\n").replace("{{args}}",r).replace(", ",i)}var g="string"==typeof a?"this != null ? this['"+a+"'] : fn":"fn",_="'use strict'; \n\t var ret = function (Parameters) { \n\t 'use strict'; \n\t var len = arguments.length; \n\t var promise = new Promise(INTERNAL); \n\t promise._captureStackTrace(); \n\t var nodeback = nodebackForPromise(promise, "+h+"); \n\t var ret; \n\t var callback = tryCatch([GetFunctionCode]); \n\t switch(len) { \n\t [CodeForSwitchCase] \n\t } \n\t if (ret === errorObj) { \n\t promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\t } \n\t if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\t return promise; \n\t }; \n\t notEnumerableProp(ret, '__isPromisified__', true); \n\t return ret; \n\t ".replace("[CodeForSwitchCase]",function(){for(var t="",e=0;e<d.length;++e)t+="case "+d[e]+":"+m(d[e]);return t+=" \n\t default: \n\t var args = new Array(len + 1); \n\t var i = 0; \n\t for (var i = 0; i < len; ++i) { \n\t args[i] = arguments[i]; \n\t } \n\t args[i] = nodeback; \n\t [CodeForCall] \n\t break; \n\t ".replace("[CodeForCall]",y?"ret = callback.apply(this, args);\n":"ret = callback.apply(receiver, args);\n")}()).replace("[GetFunctionCode]",g);return _=_.replace("Parameters",function(t){return n.filledRange(Math.max(t,3),"_arg","")}(p)),new Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",_)(t,l,u,o,s,i,n.tryCatch,n.errorObj,n.notEnumerableProp,e)};var g=a?m:function(a,u,c,l,f,h){var p=function(){return this}(),d=a;function y(){var n=u;u===r&&(n=this);var c=new t(e);c._captureStackTrace();var l="string"==typeof d&&this!==p?this[d]:a,f=i(c,h);try{l.apply(n,o(arguments,f))}catch(t){c._rejectCallback(s(t),!0,!0)}return c._isFateSealed()||c._setAsyncGuaranteed(),c}return"string"==typeof d&&(a=l),n.notEnumerableProp(y,"__isPromisified__",!0),y};function _(t,e,i,o,s){for(var a=new RegExp(e.replace(/([$])/,"\\$")+"$"),u=y(t,e,a,i),c=0,l=u.length;c<l;c+=2){var f=u[c],h=u[c+1],p=f+e;if(o===g)t[p]=g(f,r,f,h,e,s);else{var d=o(h,function(){return g(f,r,f,h,e,s)});n.notEnumerableProp(d,"__isPromisified__",!0),t[p]=d}}return n.toFastProperties(t),t}t.promisify=function(t,e){if("function"!=typeof t)throw new u("expecting a function but got "+n.classString(t));if(p(t))return t;var i=function(t,e,r){return g(t,e,void 0,t,null,r)}(t,void 0===(e=Object(e)).context?r:e.context,!!e.multiArgs);return n.copyDescriptors(t,i,h),i},t.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new u("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var r=!!(e=Object(e)).multiArgs,i=e.suffix;"string"!=typeof i&&(i="Async");var o=e.filter;"function"!=typeof o&&(o=f);var s=e.promisifier;if("function"!=typeof s&&(s=g),!n.isIdentifier(i))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var a=n.inheritedDataKeys(t),c=0;c<a.length;++c){var l=t[a[c]];"constructor"!==a[c]&&n.isClass(l)&&(_(l.prototype,i,o,s,r),_(l,i,o,s,r))}return _(t,i,o,s,r)}}),Dd}function Ey(){return Bd||(Bd=1,Nd=function(t,e,r,n){var i,o=Qp(),s=o.isObject,a=Vp();"function"==typeof Map&&(i=Map);var u=function(){var t=0,e=0;function r(r,n){this[t]=r,this[t+e]=n,t++}return function(n){e=n.size,t=0;var i=new Array(2*n.size);return n.forEach(r,i),i}}();function c(t){var e,r=!1;if(void 0!==i&&t instanceof i)e=u(t),r=!0;else{var n=a.keys(t),o=n.length;e=new Array(2*o);for(var s=0;s<o;++s){var c=n[s];e[s]=t[c],e[s+o]=c}}this.constructor$(e),this._isMap=r,this._init$(void 0,r?-6:-3)}function l(e){var i,o=r(e);return s(o)?(i=o instanceof t?o._then(t.props,void 0,void 0,void 0,void 0):new c(o).promise(),o instanceof t&&i._propagateFrom(o,2),i):n("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}o.inherits(c,e),c.prototype._init=function(){},c.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){var r;if(this._isMap)r=function(t){for(var e=new i,r=t.length/2|0,n=0;n<r;++n){var o=t[r+n],s=t[n];e.set(o,s)}return e}(this._values);else{r={};for(var n=this.length(),o=0,s=this.length();o<s;++o)r[this._values[o+n]]=this._values[o]}return this._resolve(r),!0}return!1},c.prototype.shouldCopyValues=function(){return!1},c.prototype.getActualLength=function(t){return t>>1},t.prototype.props=function(){return l(this)},t.props=function(t){return l(t)}}),Nd}function ky(){return zd||(zd=1,Ud=function(t,e,r,n){var i=Qp();function o(s,a){var u=r(s);if(u instanceof t)return function(t){return t.then(function(e){return o(e,t)})}(u);if(null===(s=i.asArray(s)))return n("expecting an array or an iterable object but got "+i.classString(s));var c=new t(e);void 0!==a&&c._propagateFrom(a,3);for(var l=c._fulfill,f=c._reject,h=0,p=s.length;h<p;++h){var d=s[h];(void 0!==d||h in s)&&t.cast(d)._then(l,f,void 0,c,null)}return c}t.race=function(t){return o(t,void 0)},t.prototype.race=function(){return o(this,void 0)}}),Ud}function xy(){return Zd||(Zd=1,Qd=function(t,e,r){var n=Qp(),i=t.TimeoutError;function o(t){this.handle=t}o.prototype._resultCancelled=function(){clearTimeout(this.handle)};var s=function(t){return a(+this).thenReturn(t)},a=t.delay=function(n,i){var a,u;return void 0!==i?(a=t.resolve(i)._then(s,null,null,n,void 0),r.cancellation()&&i instanceof t&&a._setOnCancel(i)):(a=new t(e),u=setTimeout(function(){a._fulfill()},+n),r.cancellation()&&a._setOnCancel(new o(u)),a._captureStackTrace()),a._setAsyncGuaranteed(),a};t.prototype.delay=function(t){return a(t,this)};function u(t){return clearTimeout(this.handle),t}function c(t){throw clearTimeout(this.handle),t}t.prototype.timeout=function(t,e){var s,a;t=+t;var l=new o(setTimeout(function(){s.isPending()&&function(t,e,r){var o;o="string"!=typeof e?e instanceof Error?e:new i("operation timed out"):new i(e),n.markAsOriginatingFromRejection(o),t._attachExtraTrace(o),t._reject(o),null!=r&&r.cancel()}(s,e,a)},t));return r.cancellation()?(a=this.then(),(s=a._then(u,c,void 0,l,void 0))._setOnCancel(l)):s=this._then(u,c,void 0,l,void 0),s}}),Qd}function Oy(){return Jd||(Jd=1,Kd=function(t,e,r,n,i,o){var s=Qp(),a=hy().TypeError,u=Qp().inherits,c=s.errorObj,l=s.tryCatch,f={};function h(t){setTimeout(function(){throw t},0)}function p(e,n){var o=0,s=e.length,a=new t(i);return function i(){if(o>=s)return a._fulfill();var u=function(t){var e=r(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}(e[o++]);if(u instanceof t&&u._isDisposable()){try{u=r(u._getDisposer().tryDispose(n),e.promise)}catch(t){return h(t)}if(u instanceof t)return u._then(i,h,null,null,null)}i()}(),a}function d(t,e,r){this._data=t,this._promise=e,this._context=r}function y(t,e,r){this.constructor$(t,e,r)}function m(t){return d.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function g(t){this.length=t,this.promise=null,this[t-1]=null}d.prototype.data=function(){return this._data},d.prototype.promise=function(){return this._promise},d.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():f},d.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=e!==f?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},d.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},u(y,d),y.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},g.prototype._resultCancelled=function(){for(var e=this.length,r=0;r<e;++r){var n=this[r];n instanceof t&&n.cancel()}},t.using=function(){var n=arguments.length;if(n<2)return e("you must pass at least 2 arguments to Promise.using");var i,a=arguments[n-1];if("function"!=typeof a)return e("expecting a function but got "+s.classString(a));var u=!0;2===n&&Array.isArray(arguments[0])?(n=(i=arguments[0]).length,u=!1):(i=arguments,n--);for(var f=new g(n),h=0;h<n;++h){var y=i[h];if(d.isDisposer(y)){var _=y;(y=y.promise())._setDisposable(_)}else{var b=r(y);b instanceof t&&(y=b._then(m,null,null,{resources:f,index:h},void 0))}f[h]=y}var v=new Array(f.length);for(h=0;h<v.length;++h)v[h]=t.resolve(f[h]).reflect();var w=t.all(v).then(function(t){for(var e=0;e<t.length;++e){var r=t[e];if(r.isRejected())return c.e=r.error(),c;if(!r.isFulfilled())return void w.cancel();t[e]=r.value()}S._pushContext(),a=l(a);var n=u?a.apply(void 0,t):a(t),i=S._popContext();return o.checkForgottenReturns(n,i,"Promise.using",S),n}),S=w.lastly(function(){var e=new t.PromiseInspection(w);return p(f,e)});return f.promise=S,S._setOnCancel(f),S},t.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},t.prototype._isDisposable=function(){return(131072&this._bitField)>0},t.prototype._getDisposer=function(){return this._disposer},t.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},t.prototype.disposer=function(t){if("function"==typeof t)return new y(t,this,n());throw new a}}),Kd}function Ty(){return iy||(iy=1,(t=qp).exports=function(){var e=function(){return new m("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")},r=function(){return new L.PromiseInspection(this._target())},n=function(t){return L.reject(new m(t))};function i(){}var o={},s=Qp();s.setReflectHandler(r);var a=function(){var t=process.domain;return void 0===t?null:t},u=function(){return{domain:a(),async:null}},c=s.isNode&&s.nodeSupportsAsyncResource?E.AsyncResource:null,l=function(){return{domain:a(),async:new c("Bluebird::Promise")}},f=s.isNode?u:function(){return null};s.notEnumerableProp(L,"_getContext",f);var h=Vp(),p=fy(),d=new p;h.defineProperty(L,"_async",{value:d});var y=hy(),m=L.TypeError=y.TypeError;L.RangeError=y.RangeError;var g=L.CancellationError=y.CancellationError;L.TimeoutError=y.TimeoutError,L.OperationalError=y.OperationalError,L.RejectionError=y.OperationalError,L.AggregateError=y.AggregateError;var _=function(){},b={},v={},w=py()(L,_),S=dy()(L,_,w,n,i),k=(ad?sd:(ad=1,sd=function(t){var e=!1,r=[];function n(){this._trace=new n.CapturedTrace(i())}function i(){var t=r.length-1;if(t>=0)return r[t]}return t.prototype._promiseCreated=function(){},t.prototype._pushContext=function(){},t.prototype._popContext=function(){return null},t._peekContext=t.prototype._peekContext=function(){},n.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,r.push(this._trace))},n.prototype._popContext=function(){if(void 0!==this._trace){var t=r.pop(),e=t._promiseCreated;return t._promiseCreated=null,e}return null},n.CapturedTrace=null,n.create=function(){if(e)return new n},n.deactivateLongStackTraces=function(){},n.activateLongStackTraces=function(){var r=t.prototype._pushContext,o=t.prototype._popContext,s=t._peekContext,a=t.prototype._peekContext,u=t.prototype._promiseCreated;n.deactivateLongStackTraces=function(){t.prototype._pushContext=r,t.prototype._popContext=o,t._peekContext=s,t.prototype._peekContext=a,t.prototype._promiseCreated=u,e=!1},e=!0,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,t._peekContext=t.prototype._peekContext=i,t.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},n}))(L),x=k.create,O=yy()(L,k,function(){f=l,s.notEnumerableProp(L,"_getContext",l)},function(){f=u,s.notEnumerableProp(L,"_getContext",u)});O.CapturedTrace;var T=gy()(L,w,v),j=my()(v),C=_y(),R=s.errorObj,P=s.tryCatch;function L(t){t!==_&&function(t,e){if(null==t||t.constructor!==L)throw new m("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new m("expecting a function but got "+s.classString(e))}(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function F(t){this.promise._resolveCallback(t)}function A(t){this.promise._rejectCallback(t,!1)}function I(t){var e=new L(_);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}return L.prototype.toString=function(){return"[object Promise]"},L.prototype.caught=L.prototype.catch=function(t){var e=arguments.length;if(e>1){var r,i=new Array(e-1),o=0;for(r=0;r<e-1;++r){var a=arguments[r];if(!s.isObject(a))return n("Catch statement predicate: expecting an object but got "+s.classString(a));i[o++]=a}if(i.length=o,"function"!=typeof(t=arguments[r]))throw new m("The last argument to .catch() must be a function, got "+s.toString(t));return this.then(void 0,j(i,t,this))}return this.then(void 0,t)},L.prototype.reflect=function(){return this._then(r,r,void 0,this,void 0)},L.prototype.then=function(t,e){if(O.warnings()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var r=".then() only accepts functions but was passed: "+s.classString(t);arguments.length>1&&(r+=", "+s.classString(e)),this._warn(r)}return this._then(t,e,void 0,void 0,void 0)},L.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},L.prototype.spread=function(t){return"function"!=typeof t?n("expecting a function but got "+s.classString(t)):this.all()._then(t,void 0,void 0,b,void 0)},L.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},L.prototype.all=function(){return arguments.length>0&&this._warn(".all() was passed arguments but it does not take any"),new S(this).promise()},L.prototype.error=function(t){return this.caught(s.originatesFromRejection,t)},L.getNewLibraryCopy=t.exports,L.is=function(t){return t instanceof L},L.fromNode=L.fromCallback=function(t){var e=new L(_);e._captureStackTrace();var r=arguments.length>1&&!!Object(arguments[1]).multiArgs,n=P(t)(C(e,r));return n===R&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},L.all=function(t){return new S(t).promise()},L.cast=function(t){var e=w(t);return e instanceof L||((e=new L(_))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},L.resolve=L.fulfilled=L.cast,L.reject=L.rejected=function(t){var e=new L(_);return e._captureStackTrace(),e._rejectCallback(t,!0),e},L.setScheduler=function(t){if("function"!=typeof t)throw new m("expecting a function but got "+s.classString(t));return d.setScheduler(t)},L.prototype._then=function(t,e,r,n,i){var o=void 0!==i,a=o?i:new L(_),u=this._target(),c=u._bitField;o||(a._propagateFrom(this,3),a._captureStackTrace(),void 0===n&&2097152&this._bitField&&(n=50397184&c?this._boundValue():u===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,a));var l=f();if(50397184&c){var h,p,y=u._settlePromiseCtx;33554432&c?(p=u._rejectionHandler0,h=t):16777216&c?(p=u._fulfillmentHandler0,h=e,u._unsetRejectionIsUnhandled()):(y=u._settlePromiseLateCancellationObserver,p=new g("late cancellation observer"),u._attachExtraTrace(p),h=e),d.invoke(y,u,{handler:s.contextBind(l,h),promise:a,receiver:n,value:p})}else u._addCallbacks(t,e,a,n,l);return a},L.prototype._length=function(){return 65535&this._bitField},L.prototype._isFateSealed=function(){return!!(117506048&this._bitField)},L.prototype._isFollowing=function(){return!(67108864&~this._bitField)},L.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},L.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},L.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},L.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},L.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},L.prototype._isFinal=function(){return(4194304&this._bitField)>0},L.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},L.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},L.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},L.prototype._setAsyncGuaranteed=function(){if(!d.hasCustomScheduler()){var t=this._bitField;this._bitField=t|(536870912&t)>>2^134217728}},L.prototype._setNoAsyncGuarantee=function(){this._bitField=-134217729&this._bitField|536870912},L.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[4*t-4+3];if(e!==o)return void 0===e&&this._isBound()?this._boundValue():e},L.prototype._promiseAt=function(t){return this[4*t-4+2]},L.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4+0]},L.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},L.prototype._boundValue=function(){},L.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,r=t._rejectionHandler0,n=t._promise0,i=t._receiverAt(0);void 0===i&&(i=o),this._addCallbacks(e,r,n,i,null)},L.prototype._migrateCallbackAt=function(t,e){var r=t._fulfillmentHandlerAt(e),n=t._rejectionHandlerAt(e),i=t._promiseAt(e),s=t._receiverAt(e);void 0===s&&(s=o),this._addCallbacks(r,n,i,s,null)},L.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=65531&&(o=0,this._setLength(0)),0===o)this._promise0=r,this._receiver0=n,"function"==typeof t&&(this._fulfillmentHandler0=s.contextBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=s.contextBind(i,e));else{var a=4*o-4;this[a+2]=r,this[a+3]=n,"function"==typeof t&&(this[a+0]=s.contextBind(i,t)),"function"==typeof e&&(this[a+1]=s.contextBind(i,e))}return this._setLength(o+1),o},L.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},L.prototype._resolveCallback=function(t,r){if(!(117506048&this._bitField)){if(t===this)return this._rejectCallback(e(),!1);var n=w(t,this);if(!(n instanceof L))return this._fulfill(t);r&&this._propagateFrom(n,2);var i=n._target();if(i!==this){var o=i._bitField;if(50397184&o)if(33554432&o)this._fulfill(i._value());else if(16777216&o)this._reject(i._reason());else{var s=new g("late cancellation observer");i._attachExtraTrace(s),this._reject(s)}else{var a=this._length();a>0&&i._migrateCallback0(this);for(var u=1;u<a;++u)i._migrateCallbackAt(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(n)}}else this._reject(e())}},L.prototype._rejectCallback=function(t,e,r){var n=s.ensureErrorObject(t),i=n===t;if(!i&&!r&&O.warnings()){var o="a promise was rejected with a non-error: "+s.classString(t);this._warn(o,!0)}this._attachExtraTrace(n,!!e&&i),this._reject(t)},L.prototype._resolveFromExecutor=function(t){if(t!==_){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,r)});r=!1,this._popContext(),void 0!==n&&e._rejectCallback(n,!0)}},L.prototype._settlePromiseFromHandler=function(t,e,r,n){var i=n._bitField;if(!(65536&i)){var o;n._pushContext(),e===b?r&&"number"==typeof r.length?o=P(t).apply(this._boundValue(),r):(o=R).e=new m("cannot .spread() a non-array: "+s.classString(r)):o=P(t).call(e,r);var a=n._popContext();65536&(i=n._bitField)||(o===v?n._reject(r):o===R?n._rejectCallback(o.e,!1):(O.checkForgottenReturns(o,a,"",n,this),n._resolveCallback(o)))}},L.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},L.prototype._followee=function(){return this._rejectionHandler0},L.prototype._setFollowee=function(t){this._rejectionHandler0=t},L.prototype._settlePromise=function(t,e,n,o){var s=t instanceof L,a=this._bitField,u=!!(134217728&a);65536&a?(s&&t._invokeInternalOnCancel(),n instanceof T&&n.isFinallyHandler()?(n.cancelPromise=t,P(e).call(n,o)===R&&t._reject(R.e)):e===r?t._fulfill(r.call(n)):n instanceof i?n._promiseCancelled(t):s||t instanceof S?t._cancel():n.cancel()):"function"==typeof e?s?(u&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,n,o,t)):e.call(n,o,t):n instanceof i?n._isResolved()||(33554432&a?n._promiseFulfilled(o,t):n._promiseRejected(o,t)):s&&(u&&t._setAsyncGuaranteed(),33554432&a?t._fulfill(o):t._reject(o))},L.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,r=t.promise,n=t.receiver,i=t.value;"function"==typeof e?r instanceof L?this._settlePromiseFromHandler(e,n,i,r):e.call(n,i,r):r instanceof L&&r._reject(i)},L.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},L.prototype._settlePromise0=function(t,e,r){var n=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(n,t,i,e)},L.prototype._clearCallbackDataAtIndex=function(t){var e=4*t-4;this[e+2]=this[e+3]=this[e+0]=this[e+1]=void 0},L.prototype._fulfill=function(t){var r=this._bitField;if(!((117506048&r)>>>16)){if(t===this){var n=e();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,(65535&r)>0&&(134217728&r?this._settlePromises():d.settlePromises(this),this._dereferenceTrace())}},L.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return d.fatalError(t,s.isNode);(65535&e)>0?d.settlePromises(this):this._ensurePossibleRejectionHandled()}},L.prototype._fulfillPromises=function(t,e){for(var r=1;r<t;r++){var n=this._fulfillmentHandlerAt(r),i=this._promiseAt(r),o=this._receiverAt(r);this._clearCallbackDataAtIndex(r),this._settlePromise(i,n,o,e)}},L.prototype._rejectPromises=function(t,e){for(var r=1;r<t;r++){var n=this._rejectionHandlerAt(r),i=this._promiseAt(r),o=this._receiverAt(r);this._clearCallbackDataAtIndex(r),this._settlePromise(i,n,o,e)}},L.prototype._settlePromises=function(){var t=this._bitField,e=65535&t;if(e>0){if(16842752&t){var r=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,r,t),this._rejectPromises(e,r)}else{var n=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,n,t),this._fulfillPromises(e,n)}this._setLength(0)}this._clearCancellationData()},L.prototype._settledValue=function(){var t=this._bitField;return 33554432&t?this._rejectionHandler0:16777216&t?this._fulfillmentHandler0:void 0},"undefined"!=typeof Symbol&&Symbol.toStringTag&&h.defineProperty(L.prototype,Symbol.toStringTag,{get:function(){return"Object"}}),L.defer=L.pending=function(){return O.deprecated("Promise.defer","new Promise"),{promise:new L(_),resolve:F,reject:A}},s.notEnumerableProp(L,"_makeSelfResolutionError",e),(gd||(gd=1,md=function(t,e,r,n,i){var o=Qp(),s=o.tryCatch;t.method=function(r){if("function"!=typeof r)throw new t.TypeError("expecting a function but got "+o.classString(r));return function(){var n=new t(e);n._captureStackTrace(),n._pushContext();var o=s(r).apply(this,arguments),a=n._popContext();return i.checkForgottenReturns(o,a,"Promise.method",n),n._resolveFromSyncValue(o),n}},t.attempt=t.try=function(r){if("function"!=typeof r)return n("expecting a function but got "+o.classString(r));var a,u=new t(e);if(u._captureStackTrace(),u._pushContext(),arguments.length>1){i.deprecated("calling Promise.try with more than 1 argument");var c=arguments[1],l=arguments[2];a=o.isArray(c)?s(r).apply(l,c):s(r).call(l,c)}else a=s(r)();var f=u._popContext();return i.checkForgottenReturns(a,f,"Promise.try",u),u._resolveFromSyncValue(a),u},t.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}),md)(L,_,w,n,O),(bd||(bd=1,_d=function(t,e,r,n){var i=!1,o=function(t,e){this._reject(e)},s=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(o,o,null,this,t)},a=function(t,e){50397184&this._bitField||this._resolveCallback(e.target)},u=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(o){i||(i=!0,t.prototype._propagateFrom=n.propagateFromFunction(),t.prototype._boundValue=n.boundValueFunction());var c=r(o),l=new t(e);l._propagateFrom(this,1);var f=this._target();if(l._setBoundTo(c),c instanceof t){var h={promiseRejectionQueued:!1,promise:l,target:f,bindingPromise:c};f._then(e,s,void 0,l,h),c._then(a,u,void 0,l,h),l._setOnCancel(c)}else l._resolveCallback(f);return l},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},t.prototype._isBound=function(){return!(2097152&~this._bitField)},t.bind=function(e,r){return t.resolve(r).bind(e)}}),_d)(L,_,w,O),(wd||(wd=1,vd=function(t,e,r,n){var i=Qp(),o=i.tryCatch,s=i.errorObj,a=t._async;t.prototype.break=t.prototype.cancel=function(){if(!n.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var r=t._cancellationParent;if(null==r||!r._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=r}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),a.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){this._length()>0&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(t,e){if(i.isArray(t))for(var r=0;r<t.length;++r)this._doInvokeOnCancel(t[r],e);else if(void 0!==t)if("function"==typeof t){if(!e){var n=o(t).call(this._boundValue());n===s&&(this._attachExtraTrace(n.e),a.throwLater(n.e))}}else t._resultCancelled(this)},t.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),a.invoke(this._doInvokeOnCancel,this,t)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}),vd)(L,S,n,O),(Ed||(Ed=1,Sd=function(t){function e(){return this.value}function r(){throw this.reason}t.prototype.return=t.prototype.thenReturn=function(r){return r instanceof t&&r.suppressUnhandledRejections(),this._then(e,void 0,void 0,{value:r},void 0)},t.prototype.throw=t.prototype.thenThrow=function(t){return this._then(r,void 0,void 0,{reason:t},void 0)},t.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,r,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},t.prototype.catchReturn=function(r){if(arguments.length<=1)return r instanceof t&&r.suppressUnhandledRejections(),this._then(void 0,e,void 0,{value:r},void 0);var n=arguments[1];return n instanceof t&&n.suppressUnhandledRejections(),this.caught(r,function(){return n})}}),Sd)(L),by()(L),(Td||(Td=1,Od=function(t,e,r,n,i){var o,s=Qp(),a=s.canEvaluate,u=s.tryCatch,c=s.errorObj;if(a){for(var l=function(t){return new Function("value","holder"," \n\t 'use strict'; \n\t holder.pIndex = value; \n\t holder.checkFulfillment(this); \n\t ".replace(/Index/g,t))},f=function(t){return new Function("promise","holder"," \n\t 'use strict'; \n\t holder.pIndex = promise; \n\t ".replace(/Index/g,t))},h=function(e){for(var r=new Array(e),n=0;n<r.length;++n)r[n]="this.p"+(n+1);var o=r.join(" = ")+" = null;",s="var promise;\n"+r.map(function(t){return" \n\t promise = "+t+"; \n\t if (promise instanceof Promise) { \n\t promise.cancel(); \n\t } \n\t "}).join("\n"),a=r.join(", "),l="Holder$"+e,f="return function(tryCatch, errorObj, Promise, async) { \n\t 'use strict'; \n\t function [TheName](fn) { \n\t [TheProperties] \n\t this.fn = fn; \n\t this.asyncNeeded = true; \n\t this.now = 0; \n\t } \n\t \n\t [TheName].prototype._callFunction = function(promise) { \n\t promise._pushContext(); \n\t var ret = tryCatch(this.fn)([ThePassedArguments]); \n\t promise._popContext(); \n\t if (ret === errorObj) { \n\t promise._rejectCallback(ret.e, false); \n\t } else { \n\t promise._resolveCallback(ret); \n\t } \n\t }; \n\t \n\t [TheName].prototype.checkFulfillment = function(promise) { \n\t var now = ++this.now; \n\t if (now === [TheTotal]) { \n\t if (this.asyncNeeded) { \n\t async.invoke(this._callFunction, this, promise); \n\t } else { \n\t this._callFunction(promise); \n\t } \n\t \n\t } \n\t }; \n\t \n\t [TheName].prototype._resultCancelled = function() { \n\t [CancellationCode] \n\t }; \n\t \n\t return [TheName]; \n\t }(tryCatch, errorObj, Promise, async); \n\t ";return f=f.replace(/\[TheName\]/g,l).replace(/\[TheTotal\]/g,e).replace(/\[ThePassedArguments\]/g,a).replace(/\[TheProperties\]/g,o).replace(/\[CancellationCode\]/g,s),new Function("tryCatch","errorObj","Promise","async",f)(u,c,t,i)},p=[],d=[],y=[],m=0;m<8;++m)p.push(h(m+1)),d.push(l(m+1)),y.push(f(m+1));o=function(t){this._reject(t)}}t.join=function(){var i,u=arguments.length-1;if(u>0&&"function"==typeof arguments[u]&&(i=arguments[u],u<=8&&a)){(w=new t(n))._captureStackTrace();for(var c=new(0,p[u-1])(i),l=d,f=0;f<u;++f){var h=r(arguments[f],w);if(h instanceof t){var m=(h=h._target())._bitField;50397184&m?33554432&m?l[f].call(w,h._value(),c):16777216&m?w._reject(h._reason()):w._cancel():(h._then(l[f],o,void 0,w,c),y[f](h,c),c.asyncNeeded=!1)}else l[f].call(w,h,c)}if(!w._isFateSealed()){if(c.asyncNeeded){var g=t._getContext();c.fn=s.contextBind(g,c.fn)}w._setAsyncGuaranteed(),w._setOnCancel(c)}return w}for(var _=arguments.length,b=new Array(_),v=0;v<_;++v)b[v]=arguments[v];i&&b.pop();var w=new e(b).promise();return void 0!==i?w.spread(i):w}}),Od)(L,S,w,_,d),L.Promise=L,L.version="3.7.2",function(){if(Cd)return jd;Cd=1;var t=Object.create;if(t){var e=t(null),r=t(null);e[" size"]=r[" size"]=0}return jd=function(t){var n,i,o=Qp(),s=o.canEvaluate,a=o.isIdentifier,u=function(t){return new Function("ensureMethod"," \n\t return function(obj) { \n\t 'use strict' \n\t var len = this.length; \n\t ensureMethod(obj, 'methodName'); \n\t switch(len) { \n\t case 1: return obj.methodName(this[0]); \n\t case 2: return obj.methodName(this[0], this[1]); \n\t case 3: return obj.methodName(this[0], this[1], this[2]); \n\t case 0: return obj.methodName(); \n\t default: \n\t return obj.methodName.apply(obj, this); \n\t } \n\t }; \n\t ".replace(/methodName/g,t))(f)},c=function(t){return new Function("obj"," \n\t 'use strict'; \n\t return obj.propertyName; \n\t ".replace("propertyName",t))},l=function(t,e,r){var n=r[t];if("function"!=typeof n){if(!a(t))return null;if(n=e(t),r[t]=n,r[" size"]++,r[" size"]>512){for(var i=Object.keys(r),o=0;o<256;++o)delete r[i[o]];r[" size"]=i.length-256}}return n};function f(e,r){var n;if(null!=e&&(n=e[r]),"function"!=typeof n){var i="Object "+o.classString(e)+" has no method '"+o.toString(r)+"'";throw new t.TypeError(i)}return n}function h(t){return f(t,this.pop()).apply(t,this)}function p(t){return t[this]}function d(t){var e=+this;return e<0&&(e=Math.max(0,e+t.length)),t[e]}n=function(t){return l(t,u,e)},i=function(t){return l(t,c,r)},t.prototype.call=function(t){for(var e=arguments.length,r=new Array(Math.max(e-1,0)),i=1;i<e;++i)r[i-1]=arguments[i];if(s){var o=n(t);if(null!==o)return this._then(o,void 0,void 0,r,void 0)}return r.push(t),this._then(h,void 0,void 0,r,void 0)},t.prototype.get=function(t){var e;if("number"==typeof t)e=d;else if(s){var r=i(t);e=null!==r?r:p}else e=p;return this._then(e,void 0,void 0,t,void 0)}},jd}()(L),vy()(L,n,_,w,i,O),wy()(L,S,n,w,_,O),(Id||(Id=1,Ad=function(t){var e=Qp(),r=t._async,n=e.tryCatch,i=e.errorObj;function o(t,o){if(!e.isArray(t))return s.call(this,t,o);var a=n(o).apply(this._boundValue(),[null].concat(t));a===i&&r.throwLater(a.e)}function s(t,e){var o=this._boundValue(),s=void 0===t?n(e).call(o,null):n(e).call(o,null,t);s===i&&r.throwLater(s.e)}function a(t,e){if(!t){var o=new Error(t+"");o.cause=t,t=o}var s=n(e).call(this._boundValue(),t);s===i&&r.throwLater(s.e)}t.prototype.asCallback=t.prototype.nodeify=function(t,e){if("function"==typeof t){var r=s;void 0!==e&&Object(e).spread&&(r=o),this._then(r,a,void 0,this,t)}return this}}),Ad)(L),Sy()(L,_),Ey()(L,S,w,n),ky()(L,_,w,n),(Hd||(Hd=1,Wd=function(t,e,r,n,i,o){var s=Qp(),a=s.tryCatch;function u(e,r,n,o){this.constructor$(e);var a=t._getContext();this._fn=s.contextBind(a,r),void 0!==n&&(n=t.resolve(n))._attachCancellationCallback(this),this._initialValue=n,this._currentCancellable=null,this._eachValues=o===i?Array(this._length):0===o?null:void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function c(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function l(t,e,n,i){return"function"!=typeof e?r("expecting a function but got "+s.classString(e)):new u(t,e,n,i).promise()}function f(e){this.accum=e,this.array._gotAccum(e);var r=n(this.value,this.array._promise);return r instanceof t?(this.array._currentCancellable=r,r._then(h,void 0,void 0,this,void 0)):h.call(this,r)}function h(e){var r,n=this.array,i=n._promise,s=a(n._fn);i._pushContext(),(r=void 0!==n._eachValues?s.call(i._boundValue(),e,this.index,this.length):s.call(i._boundValue(),this.accum,e,this.index,this.length))instanceof t&&(n._currentCancellable=r);var u=i._popContext();return o.checkForgottenReturns(r,u,void 0!==n._eachValues?"Promise.each":"Promise.reduce",i),r}s.inherits(u,e),u.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==i&&this._eachValues.push(t)},u.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},u.prototype._init=function(){},u.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},u.prototype.shouldCopyValues=function(){return!1},u.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},u.prototype._resultCancelled=function(e){if(e===this._initialValue)return this._cancel();this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof t&&this._currentCancellable.cancel(),this._initialValue instanceof t&&this._initialValue.cancel())},u.prototype._iterate=function(e){var r,n;this._values=e;var i=e.length;void 0!==this._initialValue?(r=this._initialValue,n=0):(r=t.resolve(e[0]),n=1),this._currentCancellable=r;for(var o=n;o<i;++o){var s=e[o];s instanceof t&&s.suppressUnhandledRejections()}if(!r.isRejected())for(;n<i;++n){var a={accum:null,value:e[n],index:n,length:i,array:this};r=r._then(f,void 0,void 0,a,void 0),127&n||r._setNoAsyncGuarantee()}void 0!==this._eachValues&&(r=r._then(this._eachComplete,void 0,void 0,this,void 0)),r._then(c,c,void 0,r,this)},t.prototype.reduce=function(t,e){return l(this,t,e,null)},t.reduce=function(t,e,r,n){return l(t,e,r,n)}}),Wd)(L,S,n,w,_,O),(qd||(qd=1,$d=function(t,e,r){var n=t.PromiseInspection;function i(t){this.constructor$(t)}Qp().inherits(i,e),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},i.prototype._promiseFulfilled=function(t,e){var r=new n;return r._bitField=33554432,r._settledValueField=t,this._promiseResolved(e,r)},i.prototype._promiseRejected=function(t,e){var r=new n;return r._bitField=16777216,r._settledValueField=t,this._promiseResolved(e,r)},t.settle=function(t){return r.deprecated(".settle()",".reflect()"),new i(t).promise()},t.allSettled=function(t){return new i(t).promise()},t.prototype.settle=function(){return t.settle(this)}}),$d)(L,S,O),(Vd||(Vd=1,Gd=function(t,e,r){var n=Qp(),i=hy().RangeError,o=hy().AggregateError,s=n.isArray,a={};function u(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function c(t,e){if((0|e)!==e||e<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new u(t),i=n.promise();return n.setHowMany(e),n.init(),i}n.inherits(u,e),u.prototype._init=function(){if(this._initialized)if(0!==this._howMany){this._init$(void 0,-5);var t=s(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}else this._resolve([])},u.prototype.init=function(){this._initialized=!0,this._init()},u.prototype.setUnwrap=function(){this._unwrap=!0},u.prototype.howMany=function(){return this._howMany},u.prototype.setHowMany=function(t){this._howMany=t},u.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},u.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},u.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(a),this._checkOutcome())},u.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e<this._values.length;++e)this._values[e]!==a&&t.push(this._values[e]);return t.length>0?this._reject(t):this._cancel(),!0}return!1},u.prototype._fulfilled=function(){return this._totalResolved},u.prototype._rejected=function(){return this._values.length-this.length()},u.prototype._addRejected=function(t){this._values.push(t)},u.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},u.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},u.prototype._getRangeError=function(t){var e="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new i(e)},u.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=function(t,e){return c(t,e)},t.prototype.some=function(t){return c(this,t)},t._SomePromiseArray=u}),Gd)(L,S,n),xy()(L,_,O),Oy()(L,n,w,x,_,O),(Xd||(Xd=1,Yd=function(t){var e=t._SomePromiseArray;function r(t){var r=new e(t),n=r.promise();return r.setHowMany(1),r.setUnwrap(),r.init(),n}t.any=function(t){return r(t)},t.prototype.any=function(){return r(this)}}),Yd)(L),(ey?ty:(ey=1,ty=function(t,e){var r=t.reduce,n=t.all;function i(){return n(this)}t.prototype.each=function(t){return r(this,t,e,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,e,e)},t.each=function(t,n){return r(t,n,e,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,n){return r(t,n,e,e)}}))(L,_),(ny?ry:(ny=1,ry=function(t,e){var r=t.map;t.prototype.filter=function(t,n){return r(this,t,n,e)},t.filter=function(t,n,i){return r(t,n,i,e)}}))(L,_),s.toFastProperties(L),s.toFastProperties(L.prototype),I({a:1}),I({b:2}),I({c:3}),I(1),I(function(){}),I(void 0),I(!1),I(new L(_)),O.setBounds(p.firstLineError,s.lastLineError),L}),qp.exports;var t}function jy(){if(uy)return ay;uy=1;const t=hf(),e=zp(),r=pf(),n=yf(),i=y,o=Lp(),s=mf(),a=df(),u=function(){if(sy)return oy;var t;sy=1,"undefined"!=typeof Promise&&(t=Promise);var e=Ty()();return e.noConflict=function(){try{Promise===e&&(Promise=t)}catch(t){}return e},oy=e}(),c=Buffer.alloc(4);return c.writeUInt32LE(101010256,0),ay=function(l,f){const h=t(),p=t(),d=f&&f.tailSize||80;let y,m,g,_;return f&&f.crx&&(m=function(e){const r=e.stream(0).pipe(t());return r.pull(4).then(function(t){if(875721283===t.readUInt32LE(0)){let t;return r.pull(12).then(function(e){t=a.parse(e,[["version",4],["pubKeyLength",4],["signatureLength",4]])}).then(function(){return r.pull(t.pubKeyLength+t.signatureLength)}).then(function(e){return t.publicKey=e.slice(0,t.pubKeyLength),t.signature=e.slice(t.pubKeyLength),t.size=16+t.pubKeyLength+t.signatureLength,t})}})}(l)),l.size().then(function(t){return y=t,l.stream(Math.max(0,t-d)).on("error",function(t){h.emit("error",t)}).pipe(h),h.pull(c)}).then(function(){return u.props({directory:h.pull(22),crxHeader:m})}).then(function(e){const r=e.directory;if(g=e.crxHeader&&e.crxHeader.size||0,_=a.parse(r,[["signature",4],["diskNumber",2],["diskStart",2],["numberOfRecordsOnDisk",2],["numberOfRecords",2],["sizeOfCentralDirectory",4],["offsetToStartOfCentralDirectory",4],["commentLength",2]]),65535==_.diskNumber||65535==_.numberOfRecords||4294967295==_.offsetToStartOfCentralDirectory){const e=20,r=y-(d-h.match+e),n=t();return l.stream(r).pipe(n),n.pull(e).then(function(e){return function(e,r){const n=a.parse(r,[["signature",4],["diskNumber",4],["offsetToStartOfCentralDirectory",8],["numberOfDisks",4]]);if(117853008!=n.signature)throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x"+n.signature.toString(16));const i=t();return e.stream(n.offsetToStartOfCentralDirectory).pipe(i),i.pull(56)}(l,e)}).then(function(t){_=function(t){const e=a.parse(t,[["signature",4],["sizeOfCentralDirectory",8],["version",2],["versionsNeededToExtract",2],["diskNumber",4],["diskStart",4],["numberOfRecordsOnDisk",8],["numberOfRecords",8],["sizeOfCentralDirectory",8],["offsetToStartOfCentralDirectory",8]]);if(101075792!=e.signature)throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0"+e.signature.toString(16));return e}(t)})}_.offsetToStartOfCentralDirectory+=g}).then(function(){if(_.commentLength)return h.pull(_.commentLength).then(function(t){_.comment=t.toString("utf8")})}).then(function(){return l.stream(_.offsetToStartOfCentralDirectory).pipe(p),_.extract=function(t){if(!t||!t.path)throw new Error("PATH_MISSING");return t.path=i.resolve(i.normalize(t.path)),_.files.then(function(e){return u.map(e,async function(e){const r=i.join(t.path,e.path);if(0!=r.indexOf(t.path))return;if("Directory"==e.type)return void await o.ensureDir(r);await o.ensureDir(i.dirname(r));const n=t.getWriter?t.getWriter({path:r}):o.createWriteStream(r);return new Promise(function(r,i){e.stream(t.password).on("error",i).pipe(n).on("close",r).on("error",i)})},{concurrency:t.concurrency>1?t.concurrency:1})})},_.files=u.mapSeries(Array(_.numberOfRecords),function(){return p.pull(46).then(function(t){const i=a.parse(t,[["signature",4],["versionMadeBy",2],["versionsNeededToExtract",2],["flags",2],["compressionMethod",2],["lastModifiedTime",2],["lastModifiedDate",2],["crc32",4],["compressedSize",4],["uncompressedSize",4],["fileNameLength",2],["extraFieldLength",2],["fileCommentLength",2],["diskNumber",2],["internalFileAttributes",2],["externalFileAttributes",4],["offsetToLocalFileHeader",4]]);return i.offsetToLocalFileHeader+=g,i.lastModifiedDateTime=s(i.lastModifiedDate,i.lastModifiedTime),p.pull(i.fileNameLength).then(function(t){return i.pathBuffer=t,i.path=t.toString("utf8"),i.isUnicode=!!(2048&i.flags),p.pull(i.extraFieldLength)}).then(function(t){return i.extra=n(t,i),p.pull(i.fileCommentLength)}).then(function(t){i.comment=t,i.type=0===i.uncompressedSize&&/[/\\]$/.test(i.path)?"Directory":"File";const n=f&&f.padding||1e3;return i.stream=function(t){const r=30+n+(i.extraFieldLength||0)+(i.fileNameLength||0)+i.compressedSize;return e(l,i.offsetToLocalFileHeader,t,i,r)},i.buffer=function(t){return r(i.stream(t))},i})})}),u.props(_)})},ay}var Cy,Ry,Py,Ly=M(Object.freeze({__proto__:null,default:{}}));var Fy=(Py||(Py=1,ff.Parse=gf(),ff.ParseOne=function(){if(Qf)return Vf;Qf=1;const t=g,e=gf(),r=th(),n=pf();return Vf=function(i,o){const s=t.PassThrough({objectMode:!0}),a=t.PassThrough(),u=t.Transform({objectMode:!0}),c=i instanceof RegExp?i:i&&new RegExp(i);let l;u._transform=function(t,e,r){if(l||c&&!c.exec(t.path))return t.autodrain(),r();l=!0,f.emit("entry",t),t.on("error",function(t){a.emit("error",t)}),t.pipe(a).on("error",function(t){r(t)}).on("finish",function(t){r(null,t)})},s.pipe(e(o)).on("error",function(t){a.emit("error",t)}).pipe(u).on("error",Object).on("finish",function(){l?a.end():a.emit("error",new Error("PATTERN_NOT_FOUND"))});const f=r(s,a);return f.buffer=function(){return n(a)},f},Vf}(),ff.Extract=function(){if(lp)return cp;lp=1,cp=function(o){o.path=r.resolve(r.normalize(o.path));const s=new t(o),a=new n.Writable({objectMode:!0});a._write=async function(t,n,i){const s=r.join(o.path,t.path.replace(/\\/g,"/"));if(0!=s.indexOf(o.path))return i();if("Directory"==t.type)return await e.ensureDir(s),i();await e.ensureDir(r.dirname(s));const a=o.getWriter?o.getWriter({path:s}):e.createWriteStream(s);t.pipe(a).on("error",i).on("close",i)};const u=i(s,a);return s.once("crx-header",function(t){u.crxHeader=t}),s.pipe(a).on("finish",function(){u.emit("close")}),u.promise=function(){return new Promise(function(t,e){u.on("close",t),u.on("error",e)})},u};const t=gf(),e=Lp(),r=y,n=g,i=th();return cp}(),ff.Open=function(){if(Ry)return Cy;Ry=1;const t=hr(),e=jy(),r=g;return Cy={buffer:function(t,n){const i={stream:function(e,n){const i=r.PassThrough(),o=n?e+n:void 0;return i.end(t.slice(e,o)),i},size:function(){return Promise.resolve(t.length)}};return e(i,n)},file:function(r,n){const i={stream:function(e,n){const i=n?e+n:void 0;return t.createReadStream(r,{start:e,end:i})},size:function(){return new Promise(function(e,n){t.stat(r,function(t,r){t?n(t):e(r.size)})})}};return e(i,n)},url:function(t,r,n){if("string"==typeof r&&(r={url:r}),!r.url)throw"URL missing";r.headers=r.headers||{};const i={stream:function(e,n){const i=Object.create(r),o=n?e+n:"";return i.headers=Object.create(r.headers),i.headers.range="bytes="+e+"-"+o,t(i)},size:function(){return new Promise(function(e,n){const i=t(r);i.on("response",function(t){i.abort(),t.headers["content-length"]?e(t.headers["content-length"]):n(new Error("Missing content length header"))}).on("error",n)})}};return e(i,n)},s3:function(t,r,n){const i={size:function(){return new Promise(function(e,n){t.headObject(r,function(t,r){t?n(t):e(r.ContentLength)})})},stream:function(e,n){const i={};for(const t in r)i[t]=r[t];const o=n?e+n:"";return i.Range="bytes="+e+"-"+o,t.getObject(i).createReadStream()}};return e(i,n)},s3_v3:function(t,n,i){const{GetObjectCommand:o,HeadObjectCommand:s}=Ly,a={size:async()=>{const e=await t.send(new s({Bucket:n.Bucket,Key:n.Key}));return e.ContentLength?e.ContentLength:0},stream:(e,i)=>{const s=r.PassThrough(),a=i?e+i:"";return t.send(new o({Bucket:n.Bucket,Key:n.Key,Range:`bytes=${e}-${a}`})).then(t=>{t.Body.pipe(s)}).catch(t=>{s.emit("error",t)}),s}};return e(a,i)},custom:function(t,r){return e(t,r)}},Cy}()),ff),Ay=D(Fy);const Iy=new Map,Dy=new Map;function My(t,e){const r={sessionId:e,backupId:t,status:"pending",phase:"Initializing backup restore",progressPercentage:0,progressCurrent:0,progressTotal:0,startTime:(new Date).toISOString(),elapsedSeconds:0,errors:[]};Iy.set(e,r),function(t){const e=setInterval(()=>{const r=Iy.get(t);if(!r)return void clearInterval(e);const n=new Date(r.startTime).getTime(),i=Math.floor((Date.now()-n)/1e3);r.elapsedSeconds=i,"running"!==r.status&&clearInterval(e)},1e3)}(e)}function Ny(t,e){const r=Iy.get(t);if(!r)return;const n="completed"===r.status||"failed"===r.status;Object.assign(r,e),n||(r.status="running")}function By(t,e){const r=Iy.get(t);r&&r.errors.push({...e,timestamp:(new Date).toISOString()})}function Uy(t){return Iy.get(t)??null}function zy(t,e){const r=Iy.get(t);if(!r)return;r.status=e,r.phase="completed"===e?"Restore completed":"Restore failed",r.progressPercentage=100;const n=setTimeout(()=>{Iy.delete(t),Dy.delete(t)},6e4);Dy.set(t,n)}function Wy(){return l(process.env.BACKUP_PATH??"/directus/backups","restore-logs")}function Hy(){const t=Wy();e(t)||n(t,{recursive:!0})}const $y=new Set(["directus_access","directus_activity","directus_collections","directus_comments","directus_dashboards","directus_extensions","directus_fields","directus_files","directus_flows","directus_folders","directus_migrations","directus_notifications","directus_operations","directus_panels","directus_permissions","directus_policies","directus_presets","directus_relations","directus_revisions","directus_roles","directus_sessions","directus_settings","directus_shares","directus_translations","directus_users","directus_versions","directus_webhooks"]);function qy(){return process.env.BACKUP_PATH??"/directus/backups"}function Gy(){const t=qy();e(t)||n(t,{recursive:!0})}let Vy=null;function Qy(){return l(qy(),"schedule.json")}function Zy(){const r=Qy();if(!e(r))return{enabled:!1,cronExpression:"0 2 * * *"};try{const e=t(r,"utf-8");return JSON.parse(e)}catch{return{enabled:!1,cronExpression:"0 2 * * *"}}}function Ky(t){Gy(),r(Qy(),JSON.stringify(t,null,2),"utf-8")}function Jy(t){null!==Vy&&clearInterval(Vy),Vy=setInterval(async()=>{try{const e=Zy();if(!e.enabled)return;const r=new Date,n=new Date(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes());if(!function(t,e){const r=t.trim().split(/\s+/);if(5!==r.length)return!1;function n(t,e){if("*"===t)return!0;if(t.includes("/")){const[,r]=t.split("/"),n=parseInt(r??"1",10);return e%n===0}if(t.includes(","))return t.split(",").some(t=>parseInt(t,10)===e);if(t.includes("-")){const[r,n]=t.split("-"),i=parseInt(r??"0",10),o=parseInt(n??"0",10);return e>=i&&e<=o}return parseInt(t,10)===e}const[i,o,s,a,u]=r;return n(i,e.getMinutes())&&n(o,e.getHours())&&n(s,e.getDate())&&n(a,e.getMonth()+1)&&n(u,e.getDay())}(e.cronExpression,n))return;if(e.lastRun){const t=new Date(e.lastRun);if(new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes()).getTime()===n.getTime())return}t.logger.info("[acuity-backup] Scheduled backup triggered"),await tm(t,{type:"full",includeMedia:!0}),Ky({...e,lastRun:r.toISOString()})}catch(e){t.logger.error("[acuity-backup] Scheduled backup failed:",e)}},6e4)}async function Yy(t){const{CollectionsService:e}=t.services,r=new e({schema:await t.getSchema(),accountability:null});return(await r.readByQuery()).filter(t=>!$y.has(t.collection)&&!t.collection.startsWith("directus_")).map(t=>t.collection)}async function Xy(t,e){const{ItemsService:r}=t.services,n=new r(e,{schema:await t.getSchema(),accountability:null});return await n.readByQuery({limit:-1,fields:["*"]})}async function tm(n,s){const a=await async function(t,n){Gy();const i=(new Date).toISOString().replace(/[:.]/g,"-"),s=k(),a=`backup-${i}-${s}.zip`,c=l(qy(),a),f=await t.getSchema(),{RelationsService:h}=t.services,p="full"===n.type?await Yy(t):n.collections??[],d={};let y=0;for(const e of p)try{const r=await Xy(t,e);d[e]=r,y+=r.length}catch(r){t.logger.warn(`[acuity-backup] Failed to export collection "${e}":`,r),d[e]=[]}const m=new h({schema:f,accountability:null}),g=await m.readAll(),_=await async function(t,e){const r=await t.getSchema(),{ItemsService:n}=t.services;let i=[];try{const t=new n("directus_fields",{schema:r,accountability:null});i=(await t.readByQuery({limit:-1,filter:{collection:{_in:e}},fields:["collection","field","group"]})).filter(t=>null!==t.group&&void 0!==t.group).map(t=>({collection:t.collection,field:t.field,group:t.group}))}catch(e){t.logger.warn("[acuity-backup] Failed to export field groups:",e)}let o=[];try{const t=new n("directus_collections",{schema:r,accountability:null});o=(await t.readByQuery({limit:-1,filter:{collection:{_in:e}},fields:["*"]})).map(t=>{const{collection:e,...r}=t;return{collection:t.collection,display:null,display_template:t.display_template??null,sort_field:t.sort_field??null,hidden:t.hidden??!1,sort:t.sort??null,icon:t.icon??null,note:t.note??null,meta:r}})}catch(e){t.logger.warn("[acuity-backup] Failed to export collection views:",e)}return{schemaVersion:"1.0",fieldGroups:i,collectionViews:o}}(t,p);let b=[];try{const{ItemsService:e}=t.services,r=new e("directus_fields",{schema:f,accountability:null});b=await r.readByQuery({limit:-1,filter:{collection:{_in:p}},fields:["*"]})}catch(e){t.logger.warn("[acuity-backup] Failed to export field metadata:",e)}let v=[];try{const{ItemsService:e}=t.services,r=new e("directus_presets",{schema:f,accountability:null});v=await r.readByQuery({limit:-1,filter:{collection:{_in:p}},fields:["*"]})}catch(e){t.logger.warn("[acuity-backup] Failed to export collection presets:",e)}let w=[];if(n.includeMedia)try{const{ItemsService:e}=t.services,r=new e("directus_files",{schema:f,accountability:null});w=await r.readByQuery({limit:-1,fields:["*"]})}catch(e){t.logger.warn("[acuity-backup] Failed to list media files:",e)}const S={timestamp:(new Date).toISOString(),version:"1.2.0",type:n.type,collections:p,includeMedia:n.includeMedia,totalItems:y,fileSize:0,includesViewsAndGroups:!0};await new Promise((r,i)=>{const s=o(c),a=lf("zip",{zlib:{level:6}});s.on("close",r),a.on("error",i),a.pipe(s),a.append(JSON.stringify(f,null,2),{name:"schema.json"}),a.append(JSON.stringify(g,null,2),{name:"relations.json"}),a.append(JSON.stringify(_,null,2),{name:"views.json"}),a.append(JSON.stringify(b,null,2),{name:"fields-meta.json"}),a.append(JSON.stringify(v,null,2),{name:"presets.json"}),a.append(JSON.stringify(S,null,2),{name:"manifest.json"});for(const[t,e]of Object.entries(d))a.append(JSON.stringify(e,null,2),{name:`collections/${t}.json`});if(n.includeMedia&&w.length>0){const r=process.env.STORAGE_LOCAL_ROOT||"./uploads";for(const n of w){a.append(JSON.stringify(n,null,2),{name:`files/${n.id}.meta.json`});const i=l(r,n.filename_disk);e(i)?a.file(i,{name:`files/${n.id}.bin`}):t.logger.warn(`[acuity-backup] Binary file not found on disk: ${i}`)}}a.finalize()});try{const t=await u(c);S.fileSize=t.size;const e=c.replace(/\.zip$/,".meta.json"),n={id:s,filename:a,timestamp:S.timestamp,type:S.type,collections:S.collections,includeMedia:S.includeMedia,fileSize:S.fileSize};r(e,JSON.stringify(n,null,2),"utf-8")}catch{}return c}(n,s),c=f(a),h=a.replace(/\.zip$/,".meta.json");let p;p=e(h)?JSON.parse(t(h,"utf-8")):{id:k(),filename:c,timestamp:(new Date).toISOString(),type:s.type,collections:s.collections??[],includeMedia:s.includeMedia,fileSize:0};try{const{FilesService:t}=n.services,e=new t({schema:await n.getSchema(),accountability:null}),o=i(a),s=await e.uploadOne(o,{storage:process.env.STORAGE_DEFAULT??process.env.STORAGE_LOCATIONS?.split(",")[0]?.trim()??"local",filename_download:c,type:"application/zip",title:`Backup ${p.timestamp}`});p.directusFileId=String(s),r(h,JSON.stringify(p,null,2),"utf-8")}catch(t){n.logger.warn("[acuity-backup] Failed to upload backup to Directus Files:",t)}return p}async function em(){Gy();const e=qy();let r;try{r=await s(e)}catch{return[]}const n=r.filter(t=>t.endsWith(".meta.json")),i=[];for(const r of n)try{const n=t(l(e,r),"utf-8");i.push(JSON.parse(n))}catch{}return i.sort((t,e)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime())}async function rm(t,n,i){const o=qy(),{backupId:a,truncateCollections:u=!1,collections:c,adminUserId:f}=n;i&&(My(a,i),Ny(i,{phase:"Finding backup archive",progressPercentage:5}));let h,p=null;try{h=await s(o)}catch{throw new Error("Backup directory is not accessible")}for(const t of h)if(t.endsWith(".zip")&&t.includes(a)){p=l(o,t);break}if(!p||!e(p))throw new Error(`Backup with id "${a}" not found`);i&&Ny(i,{phase:"Extracting ZIP archive",progressPercentage:10}),t.logger.info("[acuity-backup] Opening ZIP: "+p);const{ItemsService:d}=t.services,y={},m={},g={},_=await Ay.Open.file(p);for(const t of _.files){const e=t.path;if(e.startsWith("collections/")||"manifest.json"===e||"schema.json"===e||"relations.json"===e||"views.json"===e||"fields-meta.json"===e||"presets.json"===e||e.startsWith("files/")&&e.endsWith(".meta.json")||e.startsWith("files/")&&e.endsWith(".bin")){const r=await t.buffer();e.startsWith("collections/")?y[e]=r:e.endsWith(".bin")?g[e]=r:m[e]=r}}t.logger.info(`[acuity-backup] ZIP extracted: ${Object.keys(y).length} collection files, ${Object.keys(m).length} meta files, ${Object.keys(g).length} binary files`),i&&Ny(i,{phase:"Extraction complete",progressPercentage:20});const b=m["manifest.json"];if(!b)throw new Error("Invalid backup archive: manifest.json not found");const v=JSON.parse(b.toString("utf-8"));let w={},S=[],E=null;const k=m["schema.json"];if(k)try{w=JSON.parse(k.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse schema.json:",e)}const x=m["relations.json"];if(x)try{S=JSON.parse(x.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse relations.json:",e)}const O=m["views.json"];if(O)try{E=JSON.parse(O.toString("utf-8"))}catch{}let T=[];const j=m["fields-meta.json"];if(j)try{T=JSON.parse(j.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse fields-meta.json:",e)}let C=[];const R=m["presets.json"];if(R)try{C=JSON.parse(R.toString("utf-8"))}catch(e){t.logger.warn("[acuity-backup] Failed to parse presets.json:",e)}const P=new Map;for(const t of S){const e=t;"directus_files"===e.related_collection&&e.collection&&e.field&&(P.has(e.collection)||P.set(e.collection,new Set),P.get(e.collection).add(e.field))}for(const t of T){const e=t.special;if(e&&Array.isArray(e)&&e.includes("file")){const e=t.collection,r=t.field;P.has(e)||P.set(e,new Set),P.get(e).add(r)}}const L=new Map;for(const t of S){const e=t;e.collection&&e.field&&(L.has(e.collection)||L.set(e.collection,new Set),L.get(e.collection).add(e.field))}for(const t of T){const e=t.special;if(e&&Array.isArray(e)&&(e.includes("m2o")||e.includes("file")||e.includes("user-created")||e.includes("user-updated"))){const e=t.collection,r=t.field;L.has(e)||L.set(e,new Set),L.get(e).add(r)}}const F=new Map;for(const t of T){const e=t.special;if(e&&Array.isArray(e)&&(e.includes("user-created")||e.includes("user-updated"))){const e=t.collection,r=t.field;F.has(e)||F.set(e,new Set),F.get(e).add(r)}}for(const t of S){const e=t;"directus_users"===e.related_collection&&e.collection&&e.field&&(F.has(e.collection)||F.set(e.collection,new Set),F.get(e.collection).add(e.field))}F.size>0&&t.logger.info(`[acuity-backup] Will remap user references in ${F.size} collections to admin user ${f??"(null)"}`);const A=c??v.collections,I=[];let D=0,M=0,N=0;await async function(t,e,r,n,i,o){const s=await t.getSchema(),{CollectionsService:a,RelationsService:u}=t.services,c=[];let l=0;const f=e?.collections??{},h=new Map;for(const t of o){const e=`${t.collection}.${t.field}`;h.set(e,t)}const p=new a({schema:s,accountability:null});if(i){const e=[];for(const t of i.collectionViews){const r=t.collection;f[r]||n.includes(r)&&e.push(t)}const r=new Set(e.map(t=>t.collection)),o=[],s=new Set,a=t=>{if(s.has(t.collection))return;s.add(t.collection);const n=t.meta?.group;if(n&&r.has(n)){const t=e.find(t=>t.collection===n);t&&a(t)}o.push(t)};for(const t of e)a(t);for(const e of o){const r=e.collection,n=e.meta??{},{id:i,collection:o,...s}=n;s.icon=e.icon??s.icon??null,s.note=e.note??s.note??null,s.sort=e.sort??s.sort??null;try{await p.readOne(r);try{await p.updateOne(r,{meta:s}),t.logger.info(`[acuity-backup] Updated virtual folder "${r}" meta`)}catch{}continue}catch{}try{await p.createOne({collection:r,schema:null,meta:s}),c.push(r),t.logger.info(`[acuity-backup] Created virtual folder collection "${r}"`)}catch(e){t.logger.warn(`[acuity-backup] Failed to create virtual folder "${r}":`,e)}}}const d=n.filter(t=>!s.collections[t]&&!c.includes(t));if(0===d.length&&0===c.length&&0===r.length)return{createdCollections:c,createdRelations:l};d.length>0&&t.logger.info(`[acuity-backup] Need to create ${d.length} missing collection(s): ${d.join(", ")}`);for(const e of d){const r=f[e];if(!r){t.logger.warn(`[acuity-backup] Collection "${e}" not found in backup schema — cannot recreate`);continue}const n=[],o=r.fields??{};for(const[t,i]of Object.entries(o)){const o=t===r.primary,s=`${e}.${t}`,a=h.get(s);if(i.alias){const e={field:i.field??t,type:"alias",schema:null,meta:a?{interface:a.interface,special:a.special??i.special??["alias","no-data"],options:a.options??null,display:a.display??null,display_options:a.display_options??null,width:a.width??"full",sort:a.sort??null,note:a.note??null,group:a.group??null,hidden:a.hidden??!1,required:a.required??!1}:{special:i.special??["alias","no-data"]}};n.push(e);continue}const u={special:i.special??[],hidden:!!o||(a?.hidden??!1),readonly:!!o||(a?.readonly??!1)};a&&(u.interface=a.interface,u.display=a.display??null,u.display_options=a.display_options??null,u.options=a.options??null,u.width=a.width??"full",u.sort=a.sort??null,u.note=a.note??null,u.required=a.required??!1,u.group=a.group??null,a.special&&(u.special=a.special));const c={field:i.field??t,type:i.type,schema:{is_nullable:!o&&!1!==i.nullable,default_value:i.defaultValue??null,is_primary_key:o,has_auto_increment:o&&("integer"===i.type||!0===i.generated)},meta:u};i.maxLength&&(c.schema.max_length=i.maxLength),n.push(c)}let s={};if(i){const t=i.collectionViews.find(t=>t.collection===e);if(t?.meta){const{collection:e,id:r,group:n,...i}=t.meta;s=i}}try{await p.createOne({collection:e,schema:{name:e},meta:{...s,singleton:r.singleton??!1,sort_field:r.sortField??null},fields:n}),c.push(e),t.logger.info(`[acuity-backup] Created collection "${e}" with ${n.length} fields`)}catch(r){t.logger.error(`[acuity-backup] Failed to create collection "${e}":`,r)}}if(r.length>0&&c.length>0){const e=await t.getSchema(),n=new u({schema:e,accountability:null});for(const i of r){const r=i;if((!r.collection?.startsWith("directus_")||!r.related_collection?.startsWith("directus_"))&&(c.includes(r.collection)||null!=r.related_collection&&c.includes(r.related_collection)))if(!e.collections[r.collection]||r.related_collection&&!e.collections[r.related_collection])t.logger.warn(`[acuity-backup] Skipping relation ${r.collection}.${r.field}: one or both collections missing`);else try{const e={...r.meta??{}};delete e.id,await n.createOne({collection:r.collection,field:r.field,related_collection:r.related_collection,meta:e,schema:r.schema??null}),l++,t.logger.info(`[acuity-backup] Created relation: ${r.collection}.${r.field} → ${r.related_collection}`)}catch(e){t.logger.warn(`[acuity-backup] Failed to create relation ${r.collection}.${r.field}:`,e)}}}return{createdCollections:c,createdRelations:l}}(t,w,S,A,E,T);let B=await t.getSchema(),U=0;if(T.length>0){i&&Ny(i,{phase:"Restoring field metadata",progressPercentage:22});const{FieldsService:e}=t.services,r=new e({schema:B,accountability:null}),n=new Map;for(const t of T){const e=`${t.collection}.${t.field}`;n.set(e,t)}for(const e of T){const n=e.collection,i=e.field;if(!A.includes(n))continue;const{id:o,collection:s,field:a,...u}=e;try{await r.updateField(n,i,{meta:u}),U++}catch{const o=e.special;if(o&&Array.isArray(o)&&o.includes("alias"))try{await r.createField(n,{field:i,type:"alias",schema:null,meta:u}),U++}catch(e){t.logger.warn(`[acuity-backup] Failed to create alias field "${n}.${i}":`,e)}}}t.logger.info(`[acuity-backup] Restored metadata for ${U} fields`),B=await t.getSchema()}i&&Ny(i,{phase:"Restoring media files",progressPercentage:25});let z=0;const W={};if(v.includeMedia){const e=new d("directus_files",{schema:B,accountability:null});for(const[n,o]of Object.entries(m))if(n.startsWith("files/")&&n.endsWith(".meta.json"))try{const n=JSON.parse(o.toString("utf-8")),s=n.id;f&&n.uploaded_by?n.uploaded_by=f:n.uploaded_by&&(n.uploaded_by=null),f&&n.modified_by?n.modified_by=f:n.modified_by&&(n.modified_by=null);try{let t=null;try{t=await e.readOne(s)}catch{}if(t){const{id:t,...r}=n;await e.updateOne(s,r),W[s]=s}else{const t=await e.createOne(n);W[s]=String(t)}const i=`files/${s}.bin`;if(g[i]&&n.filename_disk){const t=process.env.STORAGE_LOCAL_ROOT||"./uploads",e=l(t,n.filename_disk);r(e,g[i])}z++}catch(e){t.logger.warn(`[acuity-backup] Failed to restore file record "${s}":`,e),i&&By(i,{message:`Failed to restore file: ${s}`})}}catch{}}t.logger.info(`[acuity-backup] Restored ${z} media file records`),i&&Ny(i,{phase:"Media files restored",progressPercentage:35});const H=new Map,$=new Set(A);for(const t of S){const e=t;e.collection&&e.related_collection&&$.has(e.collection)&&$.has(e.related_collection)&&e.collection!==e.related_collection&&(H.has(e.collection)||H.set(e.collection,new Set),H.get(e.collection).add(e.related_collection))}const q=[],G=new Set,V=new Set,Q=t=>{if(G.has(t))return;if(V.has(t))return;V.add(t);const e=H.get(t);if(e)for(const t of e)$.has(t)&&Q(t);V.delete(t),G.add(t),q.push(t)};for(const t of A)Q(t);t.logger.info(`[acuity-backup] Collection restore order: ${q.join(", ")}`);for(let e=0;e<q.length;e++){const r=q[e],n=`collections/${r}.json`,o=y[n];if(!o){t.logger.warn(`[acuity-backup] Collection file not found in archive: ${n}`),M++,i&&By(i,{collection:r,message:"Collection file not found in archive"});continue}let s;try{s=JSON.parse(o.toString("utf-8"))}catch{t.logger.warn(`[acuity-backup] Failed to parse collection JSON: ${n}`),M++,i&&By(i,{collection:r,message:"Failed to parse collection JSON"});continue}if(!Array.isArray(s)||0===s.length){if(I.push(r),D++,i){const t=35+30*(e+1)/q.length;Ny(i,{phase:`Restoring collections (${e+1}/${q.length})`,progressPercentage:Math.round(t),progressCurrent:e+1,progressTotal:q.length})}continue}const a=L.get(r);if(a)for(const t of s)for(const e of a){const r=t[e];if(null!==r&&"object"==typeof r&&!Array.isArray(r)){const n=r;void 0!==n.id&&(t[e]=n.id)}}const c=P.get(r);if(c&&Object.keys(W).length>0)for(const t of s)for(const e of c){const r=t[e];"string"==typeof r&&W[r]&&W[r]!==r&&(t[e]=W[r])}if(F.has(r)){const t=F.get(r);for(const e of s)for(const r of t)void 0!==e[r]&&null!==e[r]&&(e[r]=f??null)}const l=new d(r,{schema:B,accountability:null});try{if(u){const t=await l.readByQuery({limit:-1,fields:["id"]});if(t.length>0){const e=t.map(t=>t.id);await l.deleteMany(e)}}if(await l.upsertMany(s),I.push(r),D++,N+=s.length,i){const t=35+30*(e+1)/q.length;Ny(i,{phase:`Restoring collections (${e+1}/${q.length})`,progressPercentage:Math.round(t),progressCurrent:e+1,progressTotal:q.length})}}catch(e){t.logger.error(`[acuity-backup] Failed to restore collection "${r}":`,e),M++,i&&By(i,{collection:r,message:String(e)})}}let Z=0,K=0;if(i&&Ny(i,{phase:"Restoring field groups and view settings",progressPercentage:75}),E&&!1!==v.includesViewsAndGroups){const{FieldsService:e,CollectionsService:r}=t.services,n=await t.getSchema();if(E.fieldGroups.length>0){const r=new e({schema:n,accountability:null});for(const e of E.fieldGroups)if(A.includes(e.collection))try{await r.updateField(e.collection,e.field,{group:e.group}),Z++}catch(r){t.logger.warn(`[acuity-backup] Failed to restore group for field "${e.collection}.${e.field}":`,r),i&&By(i,{message:`Failed to restore field group for ${e.collection}.${e.field}`})}}if(E.collectionViews.length>0){const e=new r({schema:n,accountability:null}),o=E.collectionViews.filter(t=>A.includes(t.collection)),s=new Set(o.map(t=>t.collection)),a=[],u=new Set,c=t=>{if(u.has(t.collection))return;u.add(t.collection);const e=t.meta?.group;if(e&&s.has(e)){const t=o.find(t=>t.collection===e);t&&c(t)}a.push(t)};for(const t of o)c(t);for(const r of a){const n=r.meta??{},{id:o,collection:s,...a}=n,u={...a,display:r.display,display_template:r.display_template,sort_field:r.sort_field,hidden:r.hidden,sort:r.sort,icon:r.icon,note:r.note};try{await e.updateOne(r.collection,{meta:u}),K++}catch(e){t.logger.warn(`[acuity-backup] Failed to restore view settings for collection "${r.collection}":`,e),i&&By(i,{collection:r.collection,message:"Failed to restore view settings"})}}}}let J=0;if(i&&Ny(i,{phase:"Restoring collection layout presets",progressPercentage:85}),C.length>0){const{ItemsService:e}=t.services,r=new e("directus_presets",{schema:await t.getSchema(),accountability:null}),n=C.filter(t=>t.collection&&A.includes(t.collection));for(const e of n)try{const{id:t,user:n,...i}=e,o=await r.readByQuery({limit:1,filter:{collection:{_eq:i.collection},user:{_null:!0},...i.bookmark?{bookmark:{_eq:i.bookmark}}:{bookmark:{_null:!0}},...i.role?{role:{_eq:i.role}}:{role:{_null:!0}}},fields:["id"]});o.length>0?await r.updateOne(o[0].id,i):await r.createOne(i),J++}catch(r){t.logger.warn(`[acuity-backup] Failed to restore preset for collection "${e.collection}":`,r),i&&By(i,{collection:e.collection,message:"Failed to restore layout preset"})}}const Y={restoredCollections:I,restoredFiles:z,restoredFieldGroups:Z,restoredCollectionViews:K,restoredPresets:J,errors:[]};if(i){const t=Uy(i);if(t){const e=function(t,e){const r=new Date(t.startTime).getTime(),n=Date.now()-r;return{id:t.sessionId,sessionId:t.sessionId,backupId:t.backupId,timestamp:t.startTime,duration:n,status:"completed"===t.status?0===t.errors.length?"success":"partial":"failed",summary:e,errors:t.errors}}(t,{collectionsAttempted:A.length,collectionsSuccess:D,collectionsFailed:M,itemsRestored:N,mediaFilesRestored:z,fieldGroupsRestored:Z,collectionViewsRestored:K,presetsRestored:J});!function(t){Hy();const e=l(Wy(),`${t.sessionId}.json`);r(e,JSON.stringify(t,null,2),"utf-8")}(e),zy(i,(t.errors.length,"completed"))}Ny(i,{phase:"Restore completed",progressPercentage:100})}return Y}function nm(t,e,r){const n=t.accountability;n?.admin?r():e.status(403).json({errors:[{message:"Forbidden: admin access required",extensions:{code:"FORBIDDEN"}}]})}const im=[],om=[{name:"acuity-backup",config:(n,f)=>{Jy(f),n.get("/collections",nm,async(t,e)=>{try{const t=await Yy(f),{CollectionsService:r}=f.services,n=new r({schema:await f.getSchema(),accountability:null}),i=(await n.readByQuery()).filter(e=>t.includes(e.collection)).map(t=>({collection:t.collection,icon:t.meta?.icon??null,note:t.meta?.note??null,singleton:t.meta?.singleton??!1}));e.json({data:i})}catch(t){f.logger.error("[acuity-backup] GET /collections error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/list",nm,async(t,e)=>{try{const t=await em();e.json({data:t})}catch(t){f.logger.error("[acuity-backup] GET /list error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.post("/run",nm,async(t,e)=>{try{const r=t.body,n="selective"===r.type?"selective":"full",i=!1!==r.includeMedia,o="selective"===n?r.collections??[]:void 0;if("selective"===n&&(!o||0===o.length))return void e.status(400).json({errors:[{message:'Selective backup requires at least one collection in the "collections" array.'}]});const s=await tm(f,{type:n,collections:o,includeMedia:i});e.status(201).json({data:s})}catch(t){f.logger.error("[acuity-backup] POST /run error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/schedule",nm,(t,e)=>{try{const t=Zy();e.json({data:t})}catch(t){f.logger.error("[acuity-backup] GET /schedule error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.post("/schedule",nm,(t,e)=>{try{const r=t.body;if("boolean"!=typeof r.enabled)return void e.status(400).json({errors:[{message:'"enabled" must be a boolean'}]});if("string"!=typeof r.cronExpression||!r.cronExpression.trim())return void e.status(400).json({errors:[{message:'"cronExpression" must be a non-empty string'}]});if(5!==r.cronExpression.trim().split(/\s+/).length)return void e.status(400).json({errors:[{message:'"cronExpression" must be a valid 5-field cron expression (minute hour dom month dow)'}]});const n={...Zy(),enabled:r.enabled,cronExpression:r.cronExpression.trim()};Ky(n),e.json({data:n})}catch(t){f.logger.error("[acuity-backup] POST /schedule error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/restore/:id",nm,async(t,e)=>{try{const{id:r}=t.params,n=(await em()).find(t=>t.id===r);if(!n)return void e.status(404).json({errors:[{message:`Backup "${r}" not found`}]});e.json({data:n})}catch(t){f.logger.error("[acuity-backup] GET /restore/:id error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.post("/restore",nm,async(t,e)=>{try{const r=t.body;if(!r.backupId||"string"!=typeof r.backupId)return void e.status(400).json({errors:[{message:'"backupId" is required'}]});const n=t.accountability,i=n?.user??null,o=k(),s={backupId:r.backupId,truncateCollections:r.truncateCollections??!1,collections:r.collections,sessionId:o,adminUserId:i};e.json({data:{sessionId:o,message:"Restore started. Poll /acuity-backup/status/:sessionId for progress."}}),(async()=>{try{await rm(f,s,o)}catch(t){f.logger.error("[acuity-backup] Background restore error:",t);Uy(o)&&(By(o,{message:String(t)}),zy(o,"failed"))}})()}catch(t){f.logger.error("[acuity-backup] POST /restore error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.delete("/:id",nm,async(t,r)=>{try{const{id:n}=t.params,i=(await em()).find(t=>t.id===n);if(!i)return void r.status(404).json({errors:[{message:`Backup "${n}" not found`}]});const o=l(qy(),i.filename),s=o.replace(/\.zip$/,".meta.json"),u=[];e(o)&&u.push(a(o)),e(s)&&u.push(a(s)),await Promise.all(u),r.json({data:{success:!0,id:n}})}catch(t){f.logger.error("[acuity-backup] DELETE /:id error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.get("/status/:sessionId",nm,(t,e)=>{try{const{sessionId:r}=t.params,n=Uy(r);if(!n)return void e.status(404).json({errors:[{message:`Session "${r}" not found`}]});e.json({data:n})}catch(t){f.logger.error("[acuity-backup] GET /status/:sessionId error:",t),e.status(500).json({errors:[{message:String(t)}]})}}),n.get("/restore-logs",nm,async(e,r)=>{try{const e=await async function(){Hy();const e=Wy();try{const r=await s(e),n=[];for(const i of r){if(!i.endsWith(".json"))continue;const r=l(e,i);try{const e=t(r,"utf-8"),i=JSON.parse(e);n.push(i)}catch{}}return n.sort((t,e)=>new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime()),n}catch{return[]}}();r.json({data:e})}catch(t){f.logger.error("[acuity-backup] GET /restore-logs error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.get("/restore-logs/:logId",nm,(r,n)=>{try{const{logId:i}=r.params,o=function(r){Hy();const n=l(Wy(),`${r}.json`);if(!e(n))return null;try{const e=t(n,"utf-8");return JSON.parse(e)}catch{return null}}(i);if(!o)return void n.status(404).json({errors:[{message:`Restore log "${i}" not found`}]});n.json({data:o})}catch(t){f.logger.error("[acuity-backup] GET /restore-logs/:logId error:",t),n.status(500).json({errors:[{message:String(t)}]})}}),n.delete("/restore-logs/:logId",nm,async(t,r)=>{try{const{logId:n}=t.params;await async function(t){const r=l(Wy(),`${t}.json`);e(r)&&await a(r)}(n),r.json({data:{success:!0,logId:n}})}catch(t){f.logger.error("[acuity-backup] DELETE /restore-logs/:logId error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.get("/download/:id",nm,async(t,r)=>{try{const{id:n}=t.params,o=(await em()).find(t=>t.id===n);if(!o)return void r.status(404).json({errors:[{message:`Backup "${n}" not found`}]});const s=l(qy(),o.filename);if(!e(s))return void r.status(404).json({errors:[{message:`Backup file "${o.filename}" not found on disk`}]});r.setHeader("Content-Type","application/zip"),r.setHeader("Content-Disposition",`attachment; filename="${o.filename}"`);i(s).pipe(r)}catch(t){f.logger.error("[acuity-backup] GET /download/:id error:",t),r.status(500).json({errors:[{message:String(t)}]})}}),n.post("/upload",nm,async(t,n)=>{try{const{fileId:s}=t.body;if(!s||"string"!=typeof s)return void n.status(400).json({errors:[{message:'"fileId" is required. Upload the ZIP via POST /files first.'}]});const{ItemsService:p}=f.services,d=new p("directus_files",{schema:await f.getSchema(),accountability:null});let y;try{y=await d.readOne(s)}catch{return void n.status(404).json({errors:[{message:`File "${s}" not found in Directus.`}]})}const m=process.env.STORAGE_LOCAL_ROOT||"./uploads",g=y.filename_disk,_=l(m,g);if(!e(_))return void n.status(400).json({errors:[{message:"Uploaded file not found on disk. Only local storage is currently supported for backup uploads."}]});const b=await u(_);if(b.size>524288e3)return void n.status(413).json({errors:[{message:`Upload too large (${Math.round(b.size/1024/1024)} MB). Maximum is 500 MB.`}]});Gy();const v=qy(),w=k(),S=l(v,`upload-temp-${w}.zip`);let E;await h(i(_),o(S));try{const t=(await Ay.Open.file(S)).files.find(t=>"manifest.json"===t.path);if(!t)return await a(S),void n.status(400).json({errors:[{message:"Invalid backup: ZIP does not contain a manifest.json file."}]});const e=await t.buffer();E=JSON.parse(e.toString("utf-8"))}catch(t){return await a(S),void n.status(400).json({errors:[{message:"Invalid or corrupted ZIP file: "+String(t)}]})}const x=k(),O=E.timestamp||(new Date).toISOString(),T=`backup-${O.replace(/[:.]/g,"-").replace("T","_").slice(0,19)}-${x}.zip`,j=l(v,T);await c(S,j);const C={id:x,filename:T,timestamp:O,type:E.type??"full",collections:E.collections??[],includeMedia:E.includeMedia??!1,fileSize:b.size},R=j.replace(/\.zip$/,".meta.json");r(R,JSON.stringify(C,null,2),"utf-8");try{await d.deleteOne(s)}catch{}f.logger.info(`[acuity-backup] Uploaded backup: ${T} (${Math.round(b.size/1024)} KB)`),n.json({data:C})}catch(t){f.logger.error("[acuity-backup] POST /upload error:",t),n.status(500).json({errors:[{message:String(t)}]})}}),async function(){Hy();const t=Wy(),e=Date.now()-7776e6;let r=0;try{const n=await s(t);for(const i of n){if(!i.endsWith(".json"))continue;const n=l(t,i);try{(await u(n)).mtime.getTime()<e&&(await a(n),r++)}catch{}}}catch{}return r}().then(t=>{t>0&&f.logger.info(`[acuity-backup] Cleaned up ${t} restore logs older than 90 days`)})}}],sm=[];export{om as endpoints,im as hooks,sm as operations};
|