!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BrowserFS=e():t.BrowserFS=e()}(this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,n){"use strict"; /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */const r=n(5),i=n(6),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return u(t,e,n)}function u(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|y(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(q(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(q(t,ArrayBuffer)||t&&q(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(q(t,SharedArrayBuffer)||t&&q(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|d(t.length),n=a(e);return 0===n.length?n:(t.copy(n,0,0,e),n)}if(void 0!==t.length)return"number"!=typeof t.length||$(t.length)?a(0):p(t);if("Buffer"===t.type&&Array.isArray(t.data))return p(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return f(t),a(t<0?0:0|d(t))}function p(t){const e=t.length<0?0:0|d(t.length),n=a(e);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(t).length;default:if(i)return r?-1:Y(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),$(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function I(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:128==(192&(n=t[i+1]))&&(c=(31&e)<<6|63&n)>127&&(o=c);break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r)>2047&&(c<55296||c>57343)&&(o=c);break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a)>65535&&c<1114112&&(o=c)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;ethis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return F(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return N(this,e,n);case"latin1":case"binary":return T(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(q(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;let o=i-r,s=n-e;const a=Math.min(o,s),u=this.slice(r,i),f=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return v(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function N(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r,i){j(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function A(t,e,n,r,i){j(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function U(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,o){return e=+e,n>>>=0,o||U(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,o){return e=+e,n>>>=0,o||U(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||x(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||x(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=K(function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Z(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Z(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||x(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||x(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||x(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=K(function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Z(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||Z(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||x(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){D(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,!r){D(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=K(function(t,e=0){return R(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=K(function(t,e=0){return A(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);D(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);D(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=K(function(t,e=0){return R(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=K(function(t,e=0){return A(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function j(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** `+`${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new C.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||Z(e,t.length-(n+1))}(r,i,o)}function H(t,e){if("number"!=typeof t)throw new C.ERR_INVALID_ARG_TYPE(e,"number",t)}function Z(t,e,n){if(Math.floor(t)!==t)throw H(t,n),new C.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new C.ERR_BUFFER_OUT_OF_BOUNDS;throw new C.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}M("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),M("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),M("ERR_OUT_OF_RANGE",function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=z(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),r+=` It must be ${e}. Received ${i}`},RangeError);const V=/[^+/0-9A-Za-z-_]/g;function Y(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function W(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function $(t){return t!=t}const J=function(){const t=new Array(256);for(let e=0;e<16;++e){const n=16*e;for(let r=0;r<16;++r)t[n+r]="0123456789abcdef"[e]+"0123456789abcdef"[r]}return t}();function K(t){return"undefined"==typeof BigInt?G:t}function G(){throw new Error("BigInt not supported")}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var c,u=[],f=!1,h=-1;function p(){f&&c&&(f=!1,c.length?u=c.concat(u):h=-1,u.length&&l())}function l(){if(!f){var t=a(p);f=!0;for(var e=u.length;e;){for(c=u,u=[];++h1)for(var n=1;n0))return _.shift()()};w.addEventListener?w.addEventListener("message",E,!0):w.attachEvent("onmessage",E)}else if(w.MessageChannel){var v=new w.MessageChannel;v.port1.onmessage=function(t){if(_.length>0)return _.shift()()},g=function(t){_.push(t),v.port2.postMessage("")}}else g=function(t){return setTimeout(t,0)}}var b=g,S=function(t,e){return t};function I(t,e){if("function"!=typeof t)throw new Error("Callback must be a function.");var n=S(t,e);switch(e){case 1:return function(t){b(function(){return n(t)})};case 2:return function(t,e){b(function(){return n(t,e)})};case 3:return function(t,e,r){b(function(){return n(t,e,r)})};default:throw new Error("Invalid invocation of wrapCb.")}}function k(t){if(t)return t;throw new f(o.EIO,"Initialize BrowserFS with a file system using BrowserFS.initialize(filesystem)")}function O(t,e){switch(typeof t){case"number":return t;case"string":var n=parseInt(t,8);return isNaN(n)?e:n;default:return e}}function N(t){if(t instanceof Date)return t;if("number"==typeof t)return new Date(1e3*t);throw new f(o.EINVAL,"Invalid time.")}function T(t){if(t.indexOf("\0")>=0)throw new f(o.EINVAL,"Path must be a string without null bytes.");if(""===t)throw new f(o.EINVAL,"Path must not be empty.");return s.resolve(t)}function F(t,e,n,r){switch(null===t?"null":typeof t){case"object":return{encoding:void 0!==t.encoding?t.encoding:e,flag:void 0!==t.flag?t.flag:n,mode:O(t.mode,r)};case"string":return{encoding:t,flag:n,mode:r};case"null":case"undefined":case"function":return{encoding:e,flag:n,mode:r};default:throw new TypeError('"options" must be a string or an object, got '+typeof t+" instead.")}}function L(){}var x=function(){this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1,this.root=null,this.fdMap={},this.nextFd=100};x.prototype.initialize=function(t){if(!t.constructor.isAvailable())throw new f(o.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=t},x.prototype._toUnixTimestamp=function(t){if("number"==typeof t)return t;if(t instanceof Date)return t.getTime()/1e3;throw new Error("Cannot parse time: "+t)},x.prototype.getRootFS=function(){return this.root?this.root:null},x.prototype.rename=function(t,e,n){void 0===n&&(n=L);var r=I(n,1);try{k(this.root).rename(T(t),T(e),r)}catch(t){r(t)}},x.prototype.renameSync=function(t,e){k(this.root).renameSync(T(t),T(e))},x.prototype.exists=function(t,e){void 0===e&&(e=L);var n=I(e,1);try{return k(this.root).exists(T(t),n)}catch(t){return n(!1)}},x.prototype.existsSync=function(t){try{return k(this.root).existsSync(T(t))}catch(t){return!1}},x.prototype.stat=function(t,e){void 0===e&&(e=L);var n=I(e,2);try{return k(this.root).stat(T(t),!1,n)}catch(t){return n(t)}},x.prototype.statSync=function(t){return k(this.root).statSync(T(t),!1)},x.prototype.lstat=function(t,e){void 0===e&&(e=L);var n=I(e,2);try{return k(this.root).stat(T(t),!0,n)}catch(t){return n(t)}},x.prototype.lstatSync=function(t){return k(this.root).statSync(T(t),!0)},x.prototype.truncate=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=L);var r=0;"function"==typeof e?n=e:"number"==typeof e&&(r=e);var i=I(n,1);try{if(r<0)throw new f(o.EINVAL);return k(this.root).truncate(T(t),r,i)}catch(t){return i(t)}},x.prototype.truncateSync=function(t,e){if(void 0===e&&(e=0),e<0)throw new f(o.EINVAL);return k(this.root).truncateSync(T(t),e)},x.prototype.unlink=function(t,e){void 0===e&&(e=L);var n=I(e,1);try{return k(this.root).unlink(T(t),n)}catch(t){return n(t)}},x.prototype.unlinkSync=function(t){return k(this.root).unlinkSync(T(t))},x.prototype.open=function(t,e,n,r){var i=this;void 0===r&&(r=L);var o=O(n,420),s=I(r="function"==typeof n?n:r,2);try{k(this.root).open(T(t),l.getFileFlag(e),o,function(t,e){e?s(t,i.getFdForFile(e)):s(t)})}catch(t){s(t)}},x.prototype.openSync=function(t,e,n){return void 0===n&&(n=420),this.getFdForFile(k(this.root).openSync(T(t),l.getFileFlag(e),O(n,420)))},x.prototype.readFile=function(t,e,n){void 0===e&&(e={}),void 0===n&&(n=L);var r=F(e,null,"r",null),i=I(n="function"==typeof e?e:n,2);try{var s=l.getFileFlag(r.flag);return s.isReadable()?k(this.root).readFile(T(t),r.encoding,s,i):i(new f(o.EINVAL,"Flag passed to readFile must allow for reading."))}catch(t){return i(t)}},x.prototype.readFileSync=function(t,e){void 0===e&&(e={});var n=F(e,null,"r",null),r=l.getFileFlag(n.flag);if(!r.isReadable())throw new f(o.EINVAL,"Flag passed to readFile must allow for reading.");return k(this.root).readFileSync(T(t),n.encoding,r)},x.prototype.writeFile=function(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r=L);var i=F(n,"utf8","w",420),s=I(r="function"==typeof n?n:r,1);try{var a=l.getFileFlag(i.flag);return a.isWriteable()?k(this.root).writeFile(T(t),e,i.encoding,a,i.mode,s):s(new f(o.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(t){return s(t)}},x.prototype.writeFileSync=function(t,e,n){var r=F(n,"utf8","w",420),i=l.getFileFlag(r.flag);if(!i.isWriteable())throw new f(o.EINVAL,"Flag passed to writeFile must allow for writing.");return k(this.root).writeFileSync(T(t),e,r.encoding,i,r.mode)},x.prototype.appendFile=function(t,e,n,r){void 0===r&&(r=L);var i=F(n,"utf8","a",420),s=I(r="function"==typeof n?n:r,1);try{var a=l.getFileFlag(i.flag);if(!a.isAppendable())return s(new f(o.EINVAL,"Flag passed to appendFile must allow for appending."));k(this.root).appendFile(T(t),e,i.encoding,a,i.mode,s)}catch(t){s(t)}},x.prototype.appendFileSync=function(t,e,n){var r=F(n,"utf8","a",420),i=l.getFileFlag(r.flag);if(!i.isAppendable())throw new f(o.EINVAL,"Flag passed to appendFile must allow for appending.");return k(this.root).appendFileSync(T(t),e,r.encoding,i,r.mode)},x.prototype.fstat=function(t,e){void 0===e&&(e=L);var n=I(e,2);try{this.fd2file(t).stat(n)}catch(t){n(t)}},x.prototype.fstatSync=function(t){return this.fd2file(t).statSync()},x.prototype.close=function(t,e){var n=this;void 0===e&&(e=L);var r=I(e,1);try{this.fd2file(t).close(function(e){e||n.closeFd(t),r(e)})}catch(t){r(t)}},x.prototype.closeSync=function(t){this.fd2file(t).closeSync(),this.closeFd(t)},x.prototype.ftruncate=function(t,e,n){void 0===n&&(n=L);var r="number"==typeof e?e:0,i=I(n="function"==typeof e?e:n,1);try{var s=this.fd2file(t);if(r<0)throw new f(o.EINVAL);s.truncate(r,i)}catch(t){i(t)}},x.prototype.ftruncateSync=function(t,e){void 0===e&&(e=0);var n=this.fd2file(t);if(e<0)throw new f(o.EINVAL);n.truncateSync(e)},x.prototype.fsync=function(t,e){void 0===e&&(e=L);var n=I(e,1);try{this.fd2file(t).sync(n)}catch(t){n(t)}},x.prototype.fsyncSync=function(t){this.fd2file(t).syncSync()},x.prototype.fdatasync=function(t,e){void 0===e&&(e=L);var n=I(e,1);try{this.fd2file(t).datasync(n)}catch(t){n(t)}},x.prototype.fdatasyncSync=function(t){this.fd2file(t).datasyncSync()},x.prototype.write=function(e,n,r,i,s,a){void 0===a&&(a=L);var c,u,h,p=null;if("string"==typeof n){var l="utf8";switch(typeof r){case"function":a=r;break;case"number":p=r,l="string"==typeof i?i:"utf8",a="function"==typeof s?s:a;break;default:return(a="function"==typeof i?i:"function"==typeof s?s:a)(new f(o.EINVAL,"Invalid arguments."))}u=0,h=(c=t.from(n,l)).length}else c=n,u=r,h=i,p="number"==typeof s?s:null,a="function"==typeof s?s:a;var d=I(a,3);try{var y=this.fd2file(e);void 0!==p&&null!==p||(p=y.getPos()),y.write(c,u,h,p,d)}catch(t){d(t)}},x.prototype.writeSync=function(e,n,r,i,o){var s,a,c,u=0;if("string"==typeof n){c="number"==typeof r?r:null;var f="string"==typeof i?i:"utf8";u=0,a=(s=t.from(n,f)).length}else s=n,u=r,a=i,c="number"==typeof o?o:null;var h=this.fd2file(e);return void 0!==c&&null!==c||(c=h.getPos()),h.writeSync(s,u,a,c)},x.prototype.read=function(e,n,r,i,o,s){var a,c,u,f,h;if(void 0===s&&(s=L),"number"==typeof n){u=n,a=r;var p=i;s="function"==typeof o?o:s,c=0,f=t.alloc(u),h=I(function(t,e,n){if(t)return s(t);s(t,n.toString(p),e)},3)}else f=n,c=r,u=i,a=o,h=I(s,3);try{var l=this.fd2file(e);void 0!==a&&null!==a||(a=l.getPos()),l.read(f,c,u,a,h)}catch(t){h(t)}},x.prototype.readSync=function(e,n,r,i,o){var s,a,c,u,f=!1,h="utf8";"number"==typeof n?(c=n,u=r,h=i,a=0,s=t.alloc(c),f=!0):(s=n,a=r,c=i,u=o);var p=this.fd2file(e);void 0!==u&&null!==u||(u=p.getPos());var l=p.readSync(s,a,c,u);return f?[s.toString(h),l]:l},x.prototype.fchown=function(t,e,n,r){void 0===r&&(r=L);var i=I(r,1);try{this.fd2file(t).chown(e,n,i)}catch(t){i(t)}},x.prototype.fchownSync=function(t,e,n){this.fd2file(t).chownSync(e,n)},x.prototype.fchmod=function(t,e,n){var r=I(n,1);try{var i="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmod(i,r)}catch(t){r(t)}},x.prototype.fchmodSync=function(t,e){var n="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmodSync(n)},x.prototype.futimes=function(t,e,n,r){void 0===r&&(r=L);var i=I(r,1);try{var o=this.fd2file(t);"number"==typeof e&&(e=new Date(1e3*e)),"number"==typeof n&&(n=new Date(1e3*n)),o.utimes(e,n,i)}catch(t){i(t)}},x.prototype.futimesSync=function(t,e,n){this.fd2file(t).utimesSync(N(e),N(n))},x.prototype.rmdir=function(t,e){void 0===e&&(e=L);var n=I(e,1);try{t=T(t),k(this.root).rmdir(t,n)}catch(t){n(t)}},x.prototype.rmdirSync=function(t){return t=T(t),k(this.root).rmdirSync(t)},x.prototype.mkdir=function(t,e,n){void 0===n&&(n=L),"function"==typeof e&&(n=e,e=511);var r=I(n,1);try{t=T(t),k(this.root).mkdir(t,e,r)}catch(t){r(t)}},x.prototype.mkdirSync=function(t,e){k(this.root).mkdirSync(T(t),O(e,511))},x.prototype.readdir=function(t,e){void 0===e&&(e=L);var n=I(e,2);try{t=T(t),k(this.root).readdir(t,n)}catch(t){n(t)}},x.prototype.readdirSync=function(t){return t=T(t),k(this.root).readdirSync(t)},x.prototype.link=function(t,e,n){void 0===n&&(n=L);var r=I(n,1);try{t=T(t),e=T(e),k(this.root).link(t,e,r)}catch(t){r(t)}},x.prototype.linkSync=function(t,e){return t=T(t),e=T(e),k(this.root).linkSync(t,e)},x.prototype.symlink=function(t,e,n,r){void 0===r&&(r=L);var i="string"==typeof n?n:"file",s=I(r="function"==typeof n?n:r,1);try{if("file"!==i&&"dir"!==i)return s(new f(o.EINVAL,"Invalid type: "+i));t=T(t),e=T(e),k(this.root).symlink(t,e,i,s)}catch(t){s(t)}},x.prototype.symlinkSync=function(t,e,n){if(n){if("file"!==n&&"dir"!==n)throw new f(o.EINVAL,"Invalid type: "+n)}else n="file";return t=T(t),e=T(e),k(this.root).symlinkSync(t,e,n)},x.prototype.readlink=function(t,e){void 0===e&&(e=L);var n=I(e,2);try{t=T(t),k(this.root).readlink(t,n)}catch(t){n(t)}},x.prototype.readlinkSync=function(t){return t=T(t),k(this.root).readlinkSync(t)},x.prototype.chown=function(t,e,n,r){void 0===r&&(r=L);var i=I(r,1);try{t=T(t),k(this.root).chown(t,!1,e,n,i)}catch(t){i(t)}},x.prototype.chownSync=function(t,e,n){t=T(t),k(this.root).chownSync(t,!1,e,n)},x.prototype.lchown=function(t,e,n,r){void 0===r&&(r=L);var i=I(r,1);try{t=T(t),k(this.root).chown(t,!0,e,n,i)}catch(t){i(t)}},x.prototype.lchownSync=function(t,e,n){t=T(t),k(this.root).chownSync(t,!0,e,n)},x.prototype.chmod=function(t,e,n){void 0===n&&(n=L);var r=I(n,1);try{var i=O(e,-1);if(i<0)throw new f(o.EINVAL,"Invalid mode.");k(this.root).chmod(T(t),!1,i,r)}catch(t){r(t)}},x.prototype.chmodSync=function(t,e){var n=O(e,-1);if(n<0)throw new f(o.EINVAL,"Invalid mode.");t=T(t),k(this.root).chmodSync(t,!1,n)},x.prototype.lchmod=function(t,e,n){void 0===n&&(n=L);var r=I(n,1);try{var i=O(e,-1);if(i<0)throw new f(o.EINVAL,"Invalid mode.");k(this.root).chmod(T(t),!0,i,r)}catch(t){r(t)}},x.prototype.lchmodSync=function(t,e){var n=O(e,-1);if(n<1)throw new f(o.EINVAL,"Invalid mode.");k(this.root).chmodSync(T(t),!0,n)},x.prototype.utimes=function(t,e,n,r){void 0===r&&(r=L);var i=I(r,1);try{k(this.root).utimes(T(t),N(e),N(n),i)}catch(t){i(t)}},x.prototype.utimesSync=function(t,e,n){k(this.root).utimesSync(T(t),N(e),N(n))},x.prototype.realpath=function(t,e,n){void 0===n&&(n=L);var r="object"==typeof e?e:{},i=I(n="function"==typeof e?e:L,2);try{t=T(t),k(this.root).realpath(t,r,i)}catch(t){i(t)}},x.prototype.realpathSync=function(t,e){return void 0===e&&(e={}),t=T(t),k(this.root).realpathSync(t,e)},x.prototype.watchFile=function(t,e,n){throw void 0===n&&(n=L),new f(o.ENOTSUP)},x.prototype.unwatchFile=function(t,e){throw void 0===e&&(e=L),new f(o.ENOTSUP)},x.prototype.watch=function(t,e,n){throw void 0===n&&(n=L),new f(o.ENOTSUP)},x.prototype.access=function(t,e,n){throw void 0===n&&(n=L),new f(o.ENOTSUP)},x.prototype.accessSync=function(t,e){throw new f(o.ENOTSUP)},x.prototype.createReadStream=function(t,e){throw new f(o.ENOTSUP)},x.prototype.createWriteStream=function(t,e){throw new f(o.ENOTSUP)},x.prototype.wrapCallbacks=function(t){S=t},x.prototype.getFdForFile=function(t){var e=this.nextFd++;return this.fdMap[e]=t,e},x.prototype.fd2file=function(t){var e=this.fdMap[t];if(e)return e;throw new f(o.EBADF,"Invalid file descriptor.")},x.prototype.closeFd=function(t){delete this.fdMap[t]},x.Stats=d;var D=new x,R={},A=x.prototype;function U(){throw new Error("BFS has reached an impossible code path; please file a bug.")}function P(t,e,n){n.existsSync(t)||(P(s.dirname(t),e,n),n.mkdirSync(t,e))}function B(t){var e=C(t),n=e.byteOffset,r=e.byteLength;return 0===n&&r===e.buffer.byteLength?e.buffer:e.buffer.slice(n,n+r)}function C(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function M(e){return e instanceof t?e:e instanceof Uint8Array?z(e):t.from(e)}function z(e){return e instanceof t?e:0===e.byteOffset&&e.byteLength===e.buffer.byteLength?j(e.buffer):t.from(e.buffer,e.byteOffset,e.byteLength)}function j(e){return t.from(e)}function H(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=t.length),e<0||n<0||n>t.length||e>n)throw new TypeError("Invalid slice bounds on buffer of length "+t.length+": ["+e+", "+n+"]");if(0===t.length)return V();var r=C(t),i=t[0],o=(i+1)%255;return t[0]=o,r[0]===o?(r[0]=i,z(r.slice(e,n))):(t[0]=i,z(r.subarray(e,n)))}Object.keys(A).forEach(function(t){"function"==typeof D[t]?R[t]=function(){return D[t].apply(D,arguments)}:R[t]=D[t]}),R.changeFSModule=function(t){D=t},R.getFSModule=function(){return D},R.FS=x,R.Stats=x.Stats;var Z=null;function V(){return Z||(Z=t.alloc(0))}function Y(e,n){t.isBuffer(e)?n():n(new f(o.EINVAL,"option must be a Buffer."))}var W=Object.freeze({deprecationMessage:function(t,e,n){t&&console.warn("["+e+"] Direct file system constructor usage is deprecated for this file system, and will be removed in the next major version. Please use the '"+e+".Create("+JSON.stringify(n)+", callback)' method instead. See https://github.com/jvilk/BrowserFS/issues/176 for more details.")},fail:U,mkdirpSync:P,buffer2ArrayBuffer:B,buffer2Uint8array:C,arrayish2Buffer:M,uint8Array2Buffer:z,arrayBuffer2Buffer:j,copyingSlice:H,emptyBuffer:V,bufferValidator:Y}),X=function(){};X.prototype.supportsLinks=function(){return!1},X.prototype.diskSpace=function(t,e){e(0,0)},X.prototype.openFile=function(t,e,n){throw new f(o.ENOTSUP)},X.prototype.createFile=function(t,e,n,r){throw new f(o.ENOTSUP)},X.prototype.open=function(t,e,n,r){var i=this;this.stat(t,!1,function(a,c){if(a)switch(e.pathNotExistsAction()){case u.CREATE_FILE:return i.stat(s.dirname(t),!1,function(o,a){o?r(o):a&&!a.isDirectory()?r(f.ENOTDIR(s.dirname(t))):i.createFile(t,e,n,r)});case u.THROW_EXCEPTION:return r(f.ENOENT(t));default:return r(new f(o.EINVAL,"Invalid FileFlag object."))}else{if(c&&c.isDirectory())return r(f.EISDIR(t));switch(e.pathExistsAction()){case u.THROW_EXCEPTION:return r(f.EEXIST(t));case u.TRUNCATE_FILE:return i.openFile(t,e,function(t,e){t?r(t):e?e.truncate(0,function(){e.sync(function(){r(null,e)})}):U()});case u.NOP:return i.openFile(t,e,r);default:return r(new f(o.EINVAL,"Invalid FileFlag object."))}}})},X.prototype.rename=function(t,e,n){n(new f(o.ENOTSUP))},X.prototype.renameSync=function(t,e){throw new f(o.ENOTSUP)},X.prototype.stat=function(t,e,n){n(new f(o.ENOTSUP))},X.prototype.statSync=function(t,e){throw new f(o.ENOTSUP)},X.prototype.openFileSync=function(t,e,n){throw new f(o.ENOTSUP)},X.prototype.createFileSync=function(t,e,n){throw new f(o.ENOTSUP)},X.prototype.openSync=function(t,e,n){var r;try{r=this.statSync(t,!1)}catch(r){switch(e.pathNotExistsAction()){case u.CREATE_FILE:if(!this.statSync(s.dirname(t),!1).isDirectory())throw f.ENOTDIR(s.dirname(t));return this.createFileSync(t,e,n);case u.THROW_EXCEPTION:throw f.ENOENT(t);default:throw new f(o.EINVAL,"Invalid FileFlag object.")}}if(r.isDirectory())throw f.EISDIR(t);switch(e.pathExistsAction()){case u.THROW_EXCEPTION:throw f.EEXIST(t);case u.TRUNCATE_FILE:return this.unlinkSync(t),this.createFileSync(t,e,r.mode);case u.NOP:return this.openFileSync(t,e,n);default:throw new f(o.EINVAL,"Invalid FileFlag object.")}},X.prototype.unlink=function(t,e){e(new f(o.ENOTSUP))},X.prototype.unlinkSync=function(t){throw new f(o.ENOTSUP)},X.prototype.rmdir=function(t,e){e(new f(o.ENOTSUP))},X.prototype.rmdirSync=function(t){throw new f(o.ENOTSUP)},X.prototype.mkdir=function(t,e,n){n(new f(o.ENOTSUP))},X.prototype.mkdirSync=function(t,e){throw new f(o.ENOTSUP)},X.prototype.readdir=function(t,e){e(new f(o.ENOTSUP))},X.prototype.readdirSync=function(t){throw new f(o.ENOTSUP)},X.prototype.exists=function(t,e){this.stat(t,null,function(t){e(!t)})},X.prototype.existsSync=function(t){try{return this.statSync(t,!0),!0}catch(t){return!1}},X.prototype.realpath=function(t,e,n){if(this.supportsLinks())for(var r=t.split(s.sep),i=0;ithis._buffer.length){var n=t.alloc(e-this._buffer.length,0);return this.writeSync(n,0,n.length,this._buffer.length),void(this._flag.isSynchronous()&&R.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=e;var r=t.alloc(e);this._buffer.copy(r,0,0,e),this._buffer=r,this._flag.isSynchronous()&&R.getRootFS().supportsSynch()&&this.syncSync()},n.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(t){i(t)}},n.prototype.writeSync=function(e,n,r,i){if(this._dirty=!0,void 0!==i&&null!==i||(i=this.getPos()),!this._flag.isWriteable())throw new f(o.EPERM,"File not opened with a writeable mode.");var s=i+r;if(s>this._stat.size&&(this._stat.size=s,s>this._buffer.length)){var a=t.alloc(s);this._buffer.copy(a),this._buffer=a}var c=e.copy(this._buffer,i,n,n+r);return this._stat.mtimeMs=Date.now(),this._flag.isSynchronous()?(this.syncSync(),c):(this.setPos(i+c),c)},n.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(t){i(t)}},n.prototype.readSync=function(t,e,n,r){if(!this._flag.isReadable())throw new f(o.EPERM,"File not opened with a readable mode.");void 0!==r&&null!==r||(r=this.getPos()),r+n>this._stat.size&&(n=this._stat.size-r);var i=this._buffer.copy(t,e,r,r+n);return this._stat.atimeMs=Date.now(),this._pos=r+n,i},n.prototype.chmod=function(t,e){try{this.chmodSync(t),e()}catch(t){e(t)}},n.prototype.chmodSync=function(t){if(!this._fs.supportsProps())throw new f(o.ENOTSUP);this._dirty=!0,this._stat.chmod(t),this.syncSync()},n.prototype.isDirty=function(){return this._dirty},n.prototype.resetDirty=function(){this._dirty=!1},n}($),K=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.close=function(t){t()},e.prototype.closeSync=function(){},e}(J),G=function(t,e){return void 0===e&&(e=""),function(n){if("NotFoundError"===n.name)return t(f.ENOENT(e));t(n)}},Q=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(n){n||e.resetDirty(),t(n)}):t()},e.prototype.close=function(t){this.sync(t)},e}(J),tt=function(e){function n(t){e.call(this),this._handles={"/":t}}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.Create=function(t,e){e(null,new n(t.handle))},n.isAvailable=function(){return"function"==typeof FileSystemHandle},n.prototype.getName=function(){return n.Name},n.prototype.isReadOnly=function(){return!1},n.prototype.supportsSymlinks=function(){return!1},n.prototype.supportsProps=function(){return!1},n.prototype.supportsSynch=function(){return!1},n.prototype._sync=function(t,e,n,r){var i=this;this.stat(t,!1,function(o,s){n.mtime!==s.mtime?i.writeFile(t,e,null,l.getFileFlag("w"),s.mode,r):r(o)})},n.prototype.rename=function(t,e,n){var r=this;this.getHandle(t,function(i,o){if(i)return n(i);o instanceof FileSystemDirectoryHandle&&r.readdir(t,function(i,o){if(void 0===o&&(o=[]),i)return n(i);r.mkdir(e,"wx",function(i){if(i)return n(i);0===o.length?r.unlink(t,n):o.forEach(function(i){return r.rename(s.join(t,i),s.join(e,i),function(){return r.unlink(t,n)})})})}),o instanceof FileSystemFileHandle&&o.getFile().then(function(i){return r.getHandle(s.dirname(e),function(o,a){if(o)return n(o);a instanceof FileSystemDirectoryHandle&&a.getFileHandle(s.basename(e),{create:!0}).then(function(o){return o.createWritable().then(function(o){return i.arrayBuffer().then(function(i){return o.write(i).then(function(){o.close(),r.unlink(t,n)}).catch(G(n,e))}).catch(G(n,t))}).catch(G(n,e))}).catch(G(n,e))})}).catch(G(n,t))})},n.prototype.writeFile=function(t,e,n,r,i,o,a){var c=this;this.getHandle(s.dirname(t),function(n,i){if(n)return o(n);i instanceof FileSystemDirectoryHandle&&i.getFileHandle(s.basename(t),{create:!0}).then(function(n){return n.createWritable().then(function(n){return n.write(e).then(function(){n.close().catch(G(o,t)),o(null,a?c.newFile(t,r,e):void 0)}).catch(G(o,t))}).catch(G(o,t))}).catch(G(o,t))})},n.prototype.createFile=function(t,e,n,r){this.writeFile(t,V(),null,e,n,r,!0)},n.prototype.stat=function(t,e,n){this.getHandle(t,function(e,r){return e?n(e):r?r instanceof FileSystemDirectoryHandle?n(null,new d(p.DIRECTORY,4096)):void(r instanceof FileSystemFileHandle&&r.getFile().then(function(t){var e=t.lastModified,r=t.size;return n(null,new d(p.FILE,r,void 0,void 0,e))}).catch(G(n,t))):n(f.FileError(o.EINVAL,t))})},n.prototype.exists=function(t,e){this.getHandle(t,function(t){return e(null===t)})},n.prototype.openFile=function(t,e,n){var r=this;this.getHandle(t,function(i,o){if(i)return n(i);o instanceof FileSystemFileHandle&&o.getFile().then(function(i){return i.arrayBuffer().then(function(o){return n(null,r.newFile(t,e,o,i.size,i.lastModified))}).catch(G(n,t))}).catch(G(n,t))})},n.prototype.unlink=function(t,e){this.getHandle(s.dirname(t),function(n,r){if(n)return e(n);r instanceof FileSystemDirectoryHandle&&r.removeEntry(s.basename(t),{recursive:!0}).then(function(){return e(null)}).catch(G(e,t))})},n.prototype.rmdir=function(t,e){this.unlink(t,e)},n.prototype.mkdir=function(t,e,n){var r=this,i=e&&e.flag&&e.flag.includes("w")&&!e.flag.includes("x");this.getHandle(t,function(e,o){if(o&&!i)return n(f.EEXIST(t));r.getHandle(s.dirname(t),function(e,r){if(e)return n(e);r instanceof FileSystemDirectoryHandle&&r.getDirectoryHandle(s.basename(t),{create:!0}).then(function(){return n(null)}).catch(G(n,t))})})},n.prototype.readdir=function(t,e){this.getHandle(t,function(n,r){if(n)return e(n);r instanceof FileSystemDirectoryHandle&&function(t,e,n){var r=[],i=function(){t.next().then(function(t){var n=t.done,o=t.value;if(n)return e(null,r);r.push(o),i()}).catch(G(e,n))};i()}(r.keys(),e,t)})},n.prototype.newFile=function(e,n,r,i,o){return new Q(this,e,n,new d(p.FILE,i||0,void 0,void 0,o||(new Date).getTime()),t.from(r))},n.prototype.getHandle=function(t,e){var n=this;if("/"===t)return e(null,this._handles["/"]);var r="/",i=t.split("/").slice(1),a=function(i){var c=i[0],u=i.slice(1),h=s.join(r,c),p=function(i){if(r=h,n._handles[r]=i,0===u.length)return e(null,n._handles[t]);a(u)},l=n._handles[r];l.getDirectoryHandle(c).then(p).catch(function(t){"TypeMismatchError"===t.name?l.getFileHandle(c).then(p).catch(G(e,h)):"Name is not allowed."===t.message?e(new f(o.ENOENT,t.message,h)):G(e,h)(t)})};a(i)},n}(X);tt.Name="FileSystemAccess",tt.Options={};var et=function(t,e,n,r,i,o){this.id=t,this.size=e,this.mode=n,this.atime=r,this.mtime=i,this.ctime=o};et.fromBuffer=function(t){if(void 0===t)throw new Error("NO");return new et(t.toString("ascii",30),t.readUInt32LE(0),t.readUInt16LE(4),t.readDoubleLE(6),t.readDoubleLE(14),t.readDoubleLE(22))},et.prototype.toStats=function(){return new d((61440&this.mode)===p.DIRECTORY?p.DIRECTORY:p.FILE,this.size,this.mode,this.atime,this.mtime,this.ctime)},et.prototype.getSize=function(){return 30+this.id.length},et.prototype.toBuffer=function(e){return void 0===e&&(e=t.alloc(this.getSize())),e.writeUInt32LE(this.size,0),e.writeUInt16LE(this.mode,4),e.writeDoubleLE(this.atime,6),e.writeDoubleLE(this.mtime,14),e.writeDoubleLE(this.ctime,22),e.write(this.id,30,this.id.length,"ascii"),e},et.prototype.update=function(t){var e=!1;this.size!==t.size&&(this.size=t.size,e=!0),this.mode!==t.mode&&(this.mode=t.mode,e=!0);var n=t.atime.getTime();this.atime!==n&&(this.atime=n,e=!0);var r=t.mtime.getTime();this.mtime!==r&&(this.mtime=r,e=!0);var i=t.ctime.getTime();return this.ctime!==i&&(this.ctime=i,e=!0),e},et.prototype.isFile=function(){return(61440&this.mode)===p.FILE},et.prototype.isDirectory=function(){return(61440&this.mode)===p.DIRECTORY};var nt=null;function rt(){return nt||(nt=t.from("{}"))}function it(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function ot(t,e){return!t||(e(t),!1)}function st(t,e,n){return!t||(e.abort(function(){n(t)}),!1)}var at=function(t){this.limit=t,this.size=0,this.map=new Map,this.head=null,this.tail=null};at.prototype.set=function(t,e){var n=this.map.get(t);n?(n.value=e,this.remove(t,n)):this.size>=this.limit&&(this.map.delete(this.tail.key),this.size--,this.tail=this.tail.prev,this.tail.next=null),this.setHead(n||new function(t,e){this.key=t,this.value=e,this.prev=null,this.next=null}(t,e))},at.prototype.get=function(t){var e=this.map.get(t);return e?(this.remove(t,e),this.setHead(e),e.value):null},at.prototype.remove=function(t,e){var n=e||this.map.get(t);n&&(null!==n.prev?n.prev.next=n.next:this.head=n.next,null!==n.next?n.next.prev=n.prev:this.tail=n.prev,this.map.delete(t),this.size--)},at.prototype.removeAll=function(){this.size=0,this.map=new Map,this.head=null,this.tail=null},at.prototype.setHead=function(t){t.next=this.head,t.prev=null,null!==this.head&&(this.head.prev=t),this.head=t,null===this.tail&&(this.tail=t),this.size++,this.map.set(t.key,t)};var ct=function(t){this.store=t,this.originalData={},this.modifiedKeys=[]};ct.prototype.get=function(t){var e=this.store.get(t);return this.stashOldValue(t,e),e},ct.prototype.put=function(t,e,n){return this.markModified(t),this.store.put(t,e,n)},ct.prototype.del=function(t){this.markModified(t),this.store.del(t)},ct.prototype.commit=function(){},ct.prototype.abort=function(){for(var t=0,e=this.modifiedKeys;t0)throw f.ENOTEMPTY(t);this.removeEntry(t,!0)},n.prototype.mkdirSync=function(e,n){var r=this.store.beginTransaction("readwrite"),i=t.from("{}");this.commitNewFile(r,e,p.DIRECTORY,n,i)},n.prototype.readdirSync=function(t){var e=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(e,t,this.findINode(e,t)))},n.prototype._syncSync=function(t,e,n){var r=this.store.beginTransaction("readwrite"),i=this._findINode(r,s.dirname(t),s.basename(t)),o=this.getINode(r,t,i),a=o.update(n);try{r.put(o.id,e,!0),a&&r.put(i,o.toBuffer(),!0)}catch(t){throw r.abort(),t}r.commit()},n.prototype.makeRootDirectory=function(){var t=this.store.beginTransaction("readwrite");if(void 0===t.get("/")){var e=(new Date).getTime(),n=new et(it(),4096,511|p.DIRECTORY,e,e,e);t.put(n.id,rt(),!1),t.put("/",n.toBuffer(),!1),t.commit()}},n.prototype._findINode=function(t,e,n){var r=this,o=function(i){var o=r.getDirListing(t,e,i);if(o[n])return o[n];throw f.ENOENT(s.resolve(e,n))};return"."===e&&(e=i.cwd()),"/"===e?""===n?"/":o(this.getINode(t,e,"/")):o(this.getINode(t,e+s.sep+n,this._findINode(t,s.dirname(e),s.basename(e))))},n.prototype.findINode=function(t,e){return this.getINode(t,e,this._findINode(t,s.dirname(e),s.basename(e)))},n.prototype.getINode=function(t,e,n){var r=t.get(n);if(void 0===r)throw f.ENOENT(e);return et.fromBuffer(r)},n.prototype.getDirListing=function(t,e,n){if(!n.isDirectory())throw f.ENOTDIR(e);var r=t.get(n.id);if(void 0===r)throw f.ENOENT(e);return JSON.parse(r.toString())},n.prototype.addNewNode=function(t,e){for(var n;;)try{return n=it(),t.put(n,e,!1),n}catch(t){}throw new f(o.EIO,"Unable to commit data to key-value store.")},n.prototype.commitNewFile=function(e,n,r,i,o){var a,c=s.dirname(n),u=s.basename(n),h=this.findINode(e,c),p=this.getDirListing(e,c,h),l=(new Date).getTime();if("/"===n)throw f.EEXIST(n);if(p[u])throw f.EEXIST(n);try{var d=this.addNewNode(e,o);a=new et(d,o.length,i|r,l,l,l);var y=this.addNewNode(e,a.toBuffer());p[u]=y,e.put(h.id,t.from(JSON.stringify(p)),!0)}catch(t){throw e.abort(),t}return e.commit(),a},n.prototype.removeEntry=function(e,n){var r=this.store.beginTransaction("readwrite"),i=s.dirname(e),o=this.findINode(r,i),a=this.getDirListing(r,i,o),c=s.basename(e);if(!a[c])throw f.ENOENT(e);var u=a[c];delete a[c];var h=this.getINode(r,e,u);if(!n&&h.isDirectory())throw f.EISDIR(e);if(n&&!h.isDirectory())throw f.ENOTDIR(e);try{r.del(h.id),r.del(u),r.put(o.id,t.from(JSON.stringify(a)),!0)}catch(t){throw r.abort(),t}r.commit()},n}(q),ht=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(n){n||e.resetDirty(),t(n)}):t()},e.prototype.close=function(t){this.sync(t)},e}(J),pt=function(e){function n(t){e.call(this),this._cache=null,t>0&&(this._cache=new at(t))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.isAvailable=function(){return!0},n.prototype.init=function(t,e){this.store=t,this.makeRootDirectory(e)},n.prototype.getName=function(){return this.store.name()},n.prototype.isReadOnly=function(){return!1},n.prototype.supportsSymlinks=function(){return!1},n.prototype.supportsProps=function(){return!1},n.prototype.supportsSynch=function(){return!1},n.prototype.empty=function(t){var e=this;this._cache&&this._cache.removeAll(),this.store.clear(function(n){ot(n,t)&&e.makeRootDirectory(t)})},n.prototype.rename=function(e,n,r){var i=this;if(this._cache){var a=this._cache;this._cache=null,a.removeAll();var c=r;r=function(t){i._cache=a,c(t)}}var u=this.store.beginTransaction("readwrite"),h=s.dirname(e),p=s.basename(e),l=s.dirname(n),d=s.basename(n),y={},g={},m=!1;if(0===(l+"/").indexOf(e+"/"))return r(new f(o.EBUSY,h));var w=function(o){i.findINodeAndDirListing(u,o,function(s,a,c){s?m||(m=!0,u.abort(function(){r(s)})):(y[o]=a,g[o]=c,function(){if(!m&&g.hasOwnProperty(h)&&g.hasOwnProperty(l)){var o=g[h],s=y[h],a=g[l],c=y[l];if(o[p]){var w=o[p];delete o[p];var _=function(){a[d]=w,u.put(s.id,t.from(JSON.stringify(o)),!0,function(e){st(e,u,r)&&(h===l?u.commit(r):u.put(c.id,t.from(JSON.stringify(a)),!0,function(t){st(t,u,r)&&u.commit(r)}))})};a[d]?i.getINode(u,n,a[d],function(t,e){st(t,u,r)&&(e.isFile()?u.del(e.id,function(t){st(t,u,r)&&u.del(a[d],function(t){st(t,u,r)&&_()})}):u.abort(function(t){r(f.EPERM(n))}))}):_()}else r(f.ENOENT(e))}}())})};w(h),h!==l&&w(l)},n.prototype.stat=function(t,e,n){var r=this.store.beginTransaction("readonly");this.findINode(r,t,function(t,e){ot(t,n)&&n(null,e.toStats())})},n.prototype.createFile=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite"),s=V();this.commitNewFile(o,t,p.FILE,n,s,function(n,o){ot(n,r)&&r(null,new ht(i,t,e,o.toStats(),s))})},n.prototype.openFile=function(t,e,n){var r=this,i=this.store.beginTransaction("readonly");this.findINode(i,t,function(o,s){ot(o,n)&&i.get(s.id,function(i,o){ot(i,n)&&(void 0===o?n(f.ENOENT(t)):n(null,new ht(r,t,e,s.toStats(),o)))})})},n.prototype.unlink=function(t,e){this.removeEntry(t,!1,e)},n.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(f.ENOTEMPTY(t)):n.removeEntry(t,!0,e)})},n.prototype.mkdir=function(e,n,r){var i=this.store.beginTransaction("readwrite"),o=t.from("{}");this.commitNewFile(i,e,p.DIRECTORY,n,o,r)},n.prototype.readdir=function(t,e){var n=this,r=this.store.beginTransaction("readonly");this.findINode(r,t,function(i,o){ot(i,e)&&n.getDirListing(r,t,o,function(t,n){ot(t,e)&&e(null,Object.keys(n))})})},n.prototype._sync=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite");this._findINode(o,s.dirname(t),s.basename(t),function(s,a){st(s,o,r)&&i.getINode(o,t,a,function(t,i){if(st(t,o,r)){var s=i.update(n);o.put(i.id,e,!0,function(t){st(t,o,r)&&(s?o.put(a,i.toBuffer(),!0,function(t){st(t,o,r)&&o.commit(r)}):o.commit(r))})}})})},n.prototype.makeRootDirectory=function(t){var e=this.store.beginTransaction("readwrite");e.get("/",function(n,r){if(n||void 0===r){var i=(new Date).getTime(),o=new et(it(),4096,511|p.DIRECTORY,i,i,i);e.put(o.id,rt(),!1,function(n){st(n,e,t)&&e.put("/",o.toBuffer(),!1,function(n){n?e.abort(function(){t(n)}):e.commit(t)})})}else e.commit(t)})},n.prototype._findINode=function(t,e,n,r){var i=this;if(this._cache){var o=this._cache.get(s.join(e,n));if(o)return r(null,o)}var a=function(t,o,a){if(t)r(t);else if(a[n]){var c=a[n];i._cache&&i._cache.set(s.join(e,n),c),r(null,c)}else r(f.ENOENT(s.resolve(e,n)))};"/"===e?""===n?(this._cache&&this._cache.set(s.join(e,n),"/"),r(null,"/")):this.getINode(t,e,"/",function(n,o){ot(n,r)&&i.getDirListing(t,e,o,function(t,e){a(t,0,e)})}):this.findINodeAndDirListing(t,e,a)},n.prototype.findINode=function(t,e,n){var r=this;this._findINode(t,s.dirname(e),s.basename(e),function(i,o){ot(i,n)&&r.getINode(t,e,o,n)})},n.prototype.getINode=function(t,e,n,r){t.get(n,function(t,n){ot(t,r)&&(void 0===n?r(f.ENOENT(e)):r(null,et.fromBuffer(n)))})},n.prototype.getDirListing=function(t,e,n,r){n.isDirectory()?t.get(n.id,function(t,n){if(ot(t,r))try{r(null,JSON.parse(n.toString()))}catch(t){r(f.ENOENT(e))}}):r(f.ENOTDIR(e))},n.prototype.findINodeAndDirListing=function(t,e,n){var r=this;this.findINode(t,e,function(i,o){ot(i,n)&&r.getDirListing(t,e,o,function(t,e){ot(t,n)&&n(null,o,e)})})},n.prototype.addNewNode=function(t,e,n){var r,i=0,s=function(){5==++i?n(new f(o.EIO,"Unable to commit data to key-value store.")):(r=it(),t.put(r,e,!1,function(t,e){t||!e?s():n(null,r)}))};s()},n.prototype.commitNewFile=function(e,n,r,i,o,a){var c=this,u=s.dirname(n),h=s.basename(n),p=(new Date).getTime();if("/"===n)return a(f.EEXIST(n));this.findINodeAndDirListing(e,u,function(s,u,l){st(s,e,a)&&(l[h]?e.abort(function(){a(f.EEXIST(n))}):c.addNewNode(e,o,function(n,s){if(st(n,e,a)){var f=new et(s,o.length,i|r,p,p,p);c.addNewNode(e,f.toBuffer(),function(n,r){st(n,e,a)&&(l[h]=r,e.put(u.id,t.from(JSON.stringify(l)),!0,function(t){st(t,e,a)&&e.commit(function(t){st(t,e,a)&&a(null,f)})}))})}}))})},n.prototype.removeEntry=function(e,n,r){var i=this;this._cache&&this._cache.remove(e);var o=this.store.beginTransaction("readwrite"),a=s.dirname(e),c=s.basename(e);this.findINodeAndDirListing(o,a,function(s,a,u){if(st(s,o,r))if(u[c]){var h=u[c];delete u[c],i.getINode(o,e,h,function(i,s){st(i,o,r)&&(!n&&s.isDirectory()?o.abort(function(){r(f.EISDIR(e))}):n&&!s.isDirectory()?o.abort(function(){r(f.ENOTDIR(e))}):o.del(s.id,function(e){st(e,o,r)&&o.del(h,function(e){st(e,o,r)&&o.put(a.id,t.from(JSON.stringify(u)),!0,function(t){st(t,o,r)&&o.commit(r)})})}))})}else o.abort(function(){r(f.ENOENT(e))})})},n}(X),lt=function(){this.store={}};lt.prototype.name=function(){return dt.Name},lt.prototype.clear=function(){this.store={}},lt.prototype.beginTransaction=function(t){return new ct(this)},lt.prototype.get=function(t){return this.store[t]},lt.prototype.put=function(t,e,n){return!(!n&&this.store.hasOwnProperty(t))&&(this.store[t]=e,!0)},lt.prototype.del=function(t){delete this.store[t]};var dt=function(t){function e(){t.call(this,{store:new lt})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){n(null,new e)},e}(ft);dt.Name="InMemory",dt.Options={};var yt=function(){try{return m.indexedDB||m.mozIndexedDB||m.webkitIndexedDB||m.msIndexedDB}catch(t){return null}}();function gt(t,e){switch(void 0===e&&(e=t.toString()),t.name){case"NotFoundError":return new f(o.ENOENT,e);case"QuotaExceededError":return new f(o.ENOSPC,e);default:return new f(o.EIO,e)}}function mt(t,e,n){return void 0===e&&(e=o.EIO),void 0===n&&(n=null),function(r){r.preventDefault(),t(new f(e,null!==n?n:void 0))}}var wt=function(t,e){this.tx=t,this.store=e};wt.prototype.get=function(t,e){try{var n=this.store.get(t);n.onerror=mt(e),n.onsuccess=function(t){var n=t.target.result;e(null,void 0===n?n:j(n))}}catch(t){e(gt(t))}};var _t=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.put=function(t,e,n,r){try{var i,o=B(e);(i=n?this.store.put(o,t):this.store.add(o,t)).onerror=mt(r),i.onsuccess=function(t){r(null,!0)}}catch(t){r(gt(t))}},e.prototype.del=function(t,e){try{var n=this.store.delete(t);n.onerror=mt(e),n.onsuccess=function(t){e()}}catch(t){e(gt(t))}},e.prototype.commit=function(t){setTimeout(t,0)},e.prototype.abort=function(t){var e=null;try{this.tx.abort()}catch(t){e=gt(t)}finally{t(e)}},e}(wt),Et=function(t,e){this.db=t,this.storeName=e};Et.Create=function(t,e){var n=yt.open(t,1);n.onupgradeneeded=function(e){var n=e.target.result;n.objectStoreNames.contains(t)&&n.deleteObjectStore(t),n.createObjectStore(t)},n.onsuccess=function(n){e(null,new Et(n.target.result,t))},n.onerror=mt(e,o.EACCES)},Et.prototype.name=function(){return vt.Name+" - "+this.storeName},Et.prototype.clear=function(t){try{var e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();e.onsuccess=function(e){setTimeout(t,0)},e.onerror=mt(t)}catch(e){t(gt(e))}},Et.prototype.beginTransaction=function(t){void 0===t&&(t="readonly");var e=this.db.transaction(this.storeName,t),n=e.objectStore(this.storeName);if("readwrite"===t)return new _t(e,n);if("readonly"===t)return new wt(e,n);throw new f(o.EINVAL,"Invalid transaction type.")};var vt=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){void 0===t&&(t={}),Et.Create(t.storeName?t.storeName:"browserfs",function(r,i){if(i){var o=new e("number"==typeof t.cacheSize?t.cacheSize:100);o.init(i,function(t){t?n(t):n(null,o)})}else n(r)})},e.isAvailable=function(){try{return void 0!==yt&&null!==yt.open("__browserfs_test__")}catch(t){return!1}},e}(pt);vt.Name="IndexedDB",vt.Options={storeName:{type:"string",optional:!0,description:"The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name."},cacheSize:{type:"number",optional:!0,description:"The size of the inode cache. Defaults to 100. A size of 0 or below disables caching."}};var bt=function(t){function e(e){t.call(this),this.mountList=[],this.mntMap={},this.rootFs=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){dt.Create({},function(r,i){if(i){var o=new e(i);try{Object.keys(t).forEach(function(e){o.mount(e,t[e])})}catch(r){return n(r)}n(null,o)}else n(r)})},e.isAvailable=function(){return!0},e.prototype.mount=function(t,e){if("/"!==t[0]&&(t="/"+t),t=s.resolve(t),this.mntMap[t])throw new f(o.EINVAL,"Mount point "+t+" is already taken.");P(t,511,this.rootFs),this.mntMap[t]=e,this.mountList.push(t),this.mountList=this.mountList.sort(function(t,e){return e.length-t.length})},e.prototype.umount=function(t){if("/"!==t[0]&&(t="/"+t),t=s.resolve(t),!this.mntMap[t])throw new f(o.EINVAL,"Mount point "+t+" is already unmounted.");for(delete this.mntMap[t],this.mountList.splice(this.mountList.indexOf(t),1);"/"!==t&&0===this.rootFs.readdirSync(t).length;)this.rootFs.rmdirSync(t),t=s.dirname(t)},e.prototype._getFs=function(t){for(var e=this.mountList,n=e.length,r=0;r1?i.length:0))&&(t="/"),{fs:this.mntMap[i],path:t,mountPoint:i}}return{fs:this.rootFs,path:t,mountPoint:"/"}},e.prototype.getName=function(){return e.Name},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.standardizeError=function(t,e,n){var r=t.message.indexOf(e);return-1!==r&&(t.message=t.message.substr(0,r)+n+t.message.substr(r+e.length),t.path=n),t},e.prototype.rename=function(t,e,n){var r=this,i=this._getFs(t),o=this._getFs(e);return i.fs===o.fs?i.fs.rename(i.path,o.path,function(s){s&&r.standardizeError(r.standardizeError(s,i.path,t),o.path,e),n(s)}):R.readFile(t,function(r,i){if(r)return n(r);R.writeFile(e,i,function(e){if(e)return n(e);R.unlink(t,n)})})},e.prototype.renameSync=function(t,e){var n=this._getFs(t),r=this._getFs(e);if(n.fs===r.fs)try{return n.fs.renameSync(n.path,r.path)}catch(i){throw this.standardizeError(this.standardizeError(i,n.path,t),r.path,e),i}var i=R.readFileSync(t);return R.writeFileSync(e,i),R.unlinkSync(t)},e.prototype.readdirSync=function(t){var e=this._getFs(t),n=null;if(e.fs!==this.rootFs)try{n=this.rootFs.readdirSync(t)}catch(t){}try{var r=e.fs.readdirSync(e.path);return null===n?r:r.concat(n.filter(function(t){return-1===r.indexOf(t)}))}catch(r){if(null===n)throw this.standardizeError(r,e.path,t);return n}},e.prototype.readdir=function(t,e){var n=this,r=this._getFs(t);r.fs.readdir(r.path,function(i,o){if(r.fs!==n.rootFs)try{var s=n.rootFs.readdirSync(t);o=o?o.concat(s.filter(function(t){return-1===o.indexOf(t)})):s}catch(o){if(i)return e(n.standardizeError(i,r.path,t))}else if(i)return e(n.standardizeError(i,r.path,t));e(null,o)})},e.prototype.realpathSync=function(t,e){var n=this._getFs(t);try{var r=n.fs.realpathSync(n.path,{});return s.resolve(s.join(n.mountPoint,r))}catch(e){throw this.standardizeError(e,n.path,t)}},e.prototype.realpath=function(t,e,n){var r=this,i=this._getFs(t);i.fs.realpath(i.path,{},function(e,o){e?n(r.standardizeError(e,i.path,t)):n(null,s.resolve(s.join(i.mountPoint,o)))})},e.prototype.rmdirSync=function(t){var e=this._getFs(t);if(this._containsMountPt(t))throw f.ENOTEMPTY(t);try{e.fs.rmdirSync(e.path)}catch(n){throw this.standardizeError(n,e.path,t)}},e.prototype.rmdir=function(t,e){var n=this,r=this._getFs(t);this._containsMountPt(t)?e(f.ENOTEMPTY(t)):r.fs.rmdir(r.path,function(i){e(i?n.standardizeError(i,r.path,t):null)})},e.prototype._containsMountPt=function(t){for(var e=this.mountList,n=e.length,r=0;r=t.length&&i.slice(0,t.length)===t)return!0}return!1},e}(X);function St(t,e,n){return e?function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=e[0],i=this._getFs(r);e[0]=i.path;try{return i.fs[t].apply(i.fs,e)}catch(t){throw this.standardizeError(t,i.path,r),t}}:function(){for(var e=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];var i=n[0],o=this._getFs(i);if(n[0]=o.path,"function"==typeof n[n.length-1]){var s=n[n.length-1];n[n.length-1]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];t.length>0&&t[0]instanceof f&&e.standardizeError(t[0],o.path,i),s.apply(null,t)}}return o.fs[t].apply(o.fs,n)}}bt.Name="MountableFileSystem",bt.Options={};for(var It=[["exists","unlink","readlink"],["stat","mkdir","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],kt=0;kt"},Lt.prototype.getFSUnlocked=function(){return this._fs},Lt.prototype.diskSpace=function(t,e){this._fs.diskSpace(t,e)},Lt.prototype.isReadOnly=function(){return this._fs.isReadOnly()},Lt.prototype.supportsLinks=function(){return this._fs.supportsLinks()},Lt.prototype.supportsProps=function(){return this._fs.supportsProps()},Lt.prototype.supportsSynch=function(){return this._fs.supportsSynch()},Lt.prototype.rename=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.rename(t,e,function(t){r._mu.unlock(),n(t)})})},Lt.prototype.renameSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(t,e)},Lt.prototype.stat=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.stat(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},Lt.prototype.statSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(t,e)},Lt.prototype.open=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.open(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},Lt.prototype.openSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(t,e,n)},Lt.prototype.unlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.unlink(t,function(t){n._mu.unlock(),e(t)})})},Lt.prototype.unlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(t)},Lt.prototype.rmdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.rmdir(t,function(t){n._mu.unlock(),e(t)})})},Lt.prototype.rmdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(t)},Lt.prototype.mkdir=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.mkdir(t,e,function(t){r._mu.unlock(),n(t)})})},Lt.prototype.mkdirSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(t,e)},Lt.prototype.readdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.readdir(t,function(t,r){n._mu.unlock(),e(t,r)})})},Lt.prototype.readdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(t)},Lt.prototype.exists=function(t,e){var n=this;this._mu.lock(function(){n._fs.exists(t,function(t){n._mu.unlock(),e(t)})})},Lt.prototype.existsSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(t)},Lt.prototype.realpath=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.realpath(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},Lt.prototype.realpathSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(t,e)},Lt.prototype.truncate=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.truncate(t,e,function(t){r._mu.unlock(),n(t)})})},Lt.prototype.truncateSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.truncateSync(t,e)},Lt.prototype.readFile=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.readFile(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},Lt.prototype.readFileSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(t,e,n)},Lt.prototype.writeFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.writeFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},Lt.prototype.writeFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(t,e,n,r,i)},Lt.prototype.appendFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.appendFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},Lt.prototype.appendFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(t,e,n,r,i)},Lt.prototype.chmod=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.chmod(t,e,n,function(t){i._mu.unlock(),r(t)})})},Lt.prototype.chmodSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(t,e,n)},Lt.prototype.chown=function(t,e,n,r,i){var o=this;this._mu.lock(function(){o._fs.chown(t,e,n,r,function(t){o._mu.unlock(),i(t)})})},Lt.prototype.chownSync=function(t,e,n,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(t,e,n,r)},Lt.prototype.utimes=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.utimes(t,e,n,function(t){i._mu.unlock(),r(t)})})},Lt.prototype.utimesSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(t,e,n)},Lt.prototype.link=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.link(t,e,function(t){r._mu.unlock(),n(t)})})},Lt.prototype.linkSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(t,e)},Lt.prototype.symlink=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.symlink(t,e,n,function(t){i._mu.unlock(),r(t)})})},Lt.prototype.symlinkSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,n)},Lt.prototype.readlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.readlink(t,function(t,r){n._mu.unlock(),e(t,r)})})},Lt.prototype.readlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(t)};var xt="/.deletedFiles.log";function Dt(t){return 146|t}function Rt(t){return l.getFileFlag(t)}var At=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._syncAsync(this,function(n){e.resetDirty(),t(n)}):t(null)},e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.close=function(t){this.sync(t)},e.prototype.closeSync=function(){this.syncSync()},e}(J),Ut=function(t){function e(e,n){if(t.call(this),this._isInitialized=!1,this._initializeCallbacks=[],this._deletedFiles={},this._deleteLog="",this._deleteLogUpdatePending=!1,this._deleteLogUpdateNeeded=!1,this._deleteLogError=null,this._writable=e,this._readable=n,this._writable.isReadOnly())throw new f(o.EINVAL,"Writable file system must be writable.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getOverlayedFileSystems=function(){return{readable:this._readable,writable:this._writable}},e.prototype._syncAsync=function(t,e){var n=this;this.createParentDirectoriesAsync(t.getPath(),function(r){if(r)return e(r);n._writable.writeFile(t.getPath(),t.getBuffer(),null,Rt("w"),t.getStats().mode,e)})},e.prototype._syncSync=function(t){this.createParentDirectories(t.getPath()),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,Rt("w"),t.getStats().mode)},e.prototype.getName=function(){return Pt.Name},e.prototype._initialize=function(t){var e=this,n=this._initializeCallbacks,r=function(t){e._isInitialized=!t,e._initializeCallbacks=[],n.forEach(function(e){return e(t)})};if(this._isInitialized)return t();n.push(t),1===n.length&&this._writable.readFile(xt,"utf8",Rt("r"),function(t,n){if(t){if(t.errno!==o.ENOENT)return r(t)}else e._deleteLog=n;e._reparseDeletionLog(),r()})},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return this._readable.supportsSynch()&&this._writable.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},e.prototype.getDeletionLog=function(){return this._deleteLog},e.prototype.restoreDeletionLog=function(t){this._deleteLog=t,this._reparseDeletionLog(),this.updateLog("")},e.prototype.rename=function(t,e,n){var r=this;if(this.checkInitAsync(n)&&!this.checkPathAsync(t,n)&&!this.checkPathAsync(e,n))return t===xt||e===xt?n(f.EPERM("Cannot rename deletion log.")):t===e?n():void this.stat(t,!1,function(i,a){return i?n(i):r.stat(e,!1,function(i,c){var u=r;function h(r){var i=r.shift();if(!i)return n();var o=s.resolve(t,i),a=s.resolve(e,i);u.rename(o,a,function(t){if(t)return n(t);h(r)})}var p=511;if(a.isDirectory()){if(i)return i.errno!==o.ENOENT?n(i):r._writable.exists(t,function(i){if(i)return r.createParentDirectoriesAsync(e,function(i){return i?n(i):r._writable.rename(t,e,n)});r.createParentDirectoriesAsync(e,function(i){if(i)return n(i);r._writable.mkdir(e,p,function(e){if(e)return n(e);r.readdir(t,function(e,i){if(e)return n(e);h(i),r.deletePath(t)})})})});if(p=c.mode,!c.isDirectory())return n(f.ENOTDIR(e));r.readdir(e,function(i,o){if(o&&o.length)return n(f.ENOTEMPTY(e));r._readable.readdir(t,function(e,i){if(e)return n(e);h(i),r.deletePath(t)})})}if(c&&c.isDirectory())return n(f.EISDIR(e));r.readFile(t,null,Rt("r"),function(i,o){return i?n(i):r.writeFile(e,o,null,Rt("w"),a.mode,function(e){return e?n(e):r.unlink(t,n)})})})})},e.prototype.renameSync=function(t,e){var n=this;if(this.checkInitialized(),this.checkPath(t),this.checkPath(e),t===xt||e===xt)throw f.EPERM("Cannot rename deletion log.");var r=this.statSync(t,!1);if(r.isDirectory()){if(t===e)return;var i=511;if(this.existsSync(e)){var o=this.statSync(e,!1);if(i=o.mode,!o.isDirectory())throw f.ENOTDIR(e);if(this.readdirSync(e).length>0)throw f.ENOTEMPTY(e)}this._writable.existsSync(t)?this._writable.renameSync(t,e):this._writable.existsSync(e)||(this.createParentDirectories(e),this._writable.mkdirSync(e,i)),this._readable.existsSync(t)&&(this._readable.readdirSync(t).forEach(function(r){n.renameSync(s.resolve(t,r),s.resolve(e,r))}),this.deletePath(t))}else{if(this.existsSync(e)&&this.statSync(e,!1).isDirectory())throw f.EISDIR(e);this.writeFileSync(e,this.readFileSync(t,null,Rt("r")),null,Rt("w"),r.mode)}t!==e&&this.existsSync(t)&&this.unlinkSync(t)},e.prototype.stat=function(t,e,n){var r=this;this.checkInitAsync(n)&&this._writable.stat(t,e,function(i,s){if(i&&i.errno===o.ENOENT){if(r._deletedFiles[t])return n(f.ENOENT(t));r._readable.stat(t,e,function(t,e){e&&((e=d.clone(e)).mode=Dt(e.mode)),n(t,e)})}else n(i,s)})},e.prototype.statSync=function(t,e){this.checkInitialized();try{return this._writable.statSync(t,e)}catch(r){if(this._deletedFiles[t])throw f.ENOENT(t);var n=d.clone(this._readable.statSync(t,e));return n.mode=Dt(n.mode),n}},e.prototype.open=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&!this.checkPathAsync(t,r)&&this.stat(t,!0,function(o,s){if(s)switch(e.pathExistsAction()){case u.TRUNCATE_FILE:return i.createParentDirectoriesAsync(t,function(o){if(o)return r(o);i._writable.open(t,e,n,r)});case u.NOP:return i._writable.exists(t,function(o){o?i._writable.open(t,e,n,r):((s=d.clone(s)).mode=n,i._readable.readFile(t,null,Rt("r"),function(n,o){if(n)return r(n);-1===s.size&&(s.size=o.length);var a=new At(i,t,e,s,o);r(null,a)}))});default:return r(f.EEXIST(t))}else switch(e.pathNotExistsAction()){case u.CREATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):i._writable.open(t,e,n,r)});default:return r(f.ENOENT(t))}})},e.prototype.openSync=function(t,e,n){if(this.checkInitialized(),this.checkPath(t),t===xt)throw f.EPERM("Cannot open deletion log.");if(this.existsSync(t))switch(e.pathExistsAction()){case u.TRUNCATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);case u.NOP:if(this._writable.existsSync(t))return this._writable.openSync(t,e,n);var r=this._readable.readFileSync(t,null,Rt("r")),i=d.clone(this._readable.statSync(t,!1));return i.mode=n,new At(this,t,e,i,r);default:throw f.EEXIST(t)}else switch(e.pathNotExistsAction()){case u.CREATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);default:throw f.ENOENT(t)}},e.prototype.unlink=function(t,e){var n=this;this.checkInitAsync(e)&&!this.checkPathAsync(t,e)&&this.exists(t,function(r){if(!r)return e(f.ENOENT(t));n._writable.exists(t,function(r){if(r)return n._writable.unlink(t,function(r){if(r)return e(r);n.exists(t,function(r){r&&n.deletePath(t),e(null)})});n.deletePath(t),e(null)})})},e.prototype.unlinkSync=function(t){if(this.checkInitialized(),this.checkPath(t),!this.existsSync(t))throw f.ENOENT(t);this._writable.existsSync(t)&&this._writable.unlinkSync(t),this.existsSync(t)&&this.deletePath(t)},e.prototype.rmdir=function(t,e){var n=this;if(this.checkInitAsync(e)){var r=function(){n.readdir(t,function(r,i){return r?e(r):i.length?e(f.ENOTEMPTY(t)):(n.deletePath(t),void e(null))})};this.exists(t,function(i){if(!i)return e(f.ENOENT(t));n._writable.exists(t,function(i){i?n._writable.rmdir(t,function(i){if(i)return e(i);n._readable.exists(t,function(t){t?r():e()})}):r()})})}},e.prototype.rmdirSync=function(t){if(this.checkInitialized(),!this.existsSync(t))throw f.ENOENT(t);if(this._writable.existsSync(t)&&this._writable.rmdirSync(t),this.existsSync(t)){if(this.readdirSync(t).length>0)throw f.ENOTEMPTY(t);this.deletePath(t)}},e.prototype.mkdir=function(t,e,n){var r=this;this.checkInitAsync(n)&&this.exists(t,function(i){if(i)return n(f.EEXIST(t));r.createParentDirectoriesAsync(t,function(i){if(i)return n(i);r._writable.mkdir(t,e,n)})})},e.prototype.mkdirSync=function(t,e){if(this.checkInitialized(),this.existsSync(t))throw f.EEXIST(t);this.createParentDirectories(t),this._writable.mkdirSync(t,e)},e.prototype.readdir=function(t,e){var n=this;this.checkInitAsync(e)&&this.stat(t,!0,function(r,i){return r?e(r):i.isDirectory()?void n._writable.readdir(t,function(r,i){if(r&&"ENOENT"!==r.code)return e(r);!r&&i||(i=[]),n._readable.readdir(t,function(r,o){!r&&o||(o=[]);var s={},a=i.concat(o.filter(function(e){return!n._deletedFiles[t+("/"===t?"":"/")+e]})).filter(function(t){var e=!s[t];return s[t]=!0,e});e(null,a)})}):e(f.ENOTDIR(t))})},e.prototype.readdirSync=function(t){var e=this;if(this.checkInitialized(),!this.statSync(t,!1).isDirectory())throw f.ENOTDIR(t);var n=[];try{n=n.concat(this._writable.readdirSync(t))}catch(t){}try{n=n.concat(this._readable.readdirSync(t).filter(function(n){return!e._deletedFiles[t+("/"===t?"":"/")+n]}))}catch(t){}var r={};return n.filter(function(t){var e=!r[t];return r[t]=!0,e})},e.prototype.exists=function(t,e){var n=this;this.checkInitialized(),this._writable.exists(t,function(r){if(r)return e(!0);n._readable.exists(t,function(r){e(r&&!0!==n._deletedFiles[t])})})},e.prototype.existsSync=function(t){return this.checkInitialized(),this._writable.existsSync(t)||this._readable.existsSync(t)&&!0!==this._deletedFiles[t]},e.prototype.chmod=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){if(o)return r(o);i._writable.chmod(t,e,n,r)})},e.prototype.chmodSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.chmodSync(t,e,n)})},e.prototype.chown=function(t,e,n,r,i){var o=this;this.checkInitAsync(i)&&this.operateOnWritableAsync(t,function(s){if(s)return i(s);o._writable.chown(t,e,n,r,i)})},e.prototype.chownSync=function(t,e,n,r){var i=this;this.checkInitialized(),this.operateOnWritable(t,function(){i._writable.chownSync(t,e,n,r)})},e.prototype.utimes=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){if(o)return r(o);i._writable.utimes(t,e,n,r)})},e.prototype.utimesSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.utimesSync(t,e,n)})},e.prototype.deletePath=function(t){this._deletedFiles[t]=!0,this.updateLog("d"+t+"\n")},e.prototype.updateLog=function(t){var e=this;this._deleteLog+=t,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(xt,this._deleteLog,"utf8",l.getFileFlag("w"),420,function(t){e._deleteLogUpdatePending=!1,t?e._deleteLogError=t:e._deleteLogUpdateNeeded&&(e._deleteLogUpdateNeeded=!1,e.updateLog(""))}))},e.prototype._reparseDeletionLog=function(){var t=this;this._deletedFiles={},this._deleteLog.split("\n").forEach(function(e){t._deletedFiles[e.slice(1)]="d"===e.slice(0,1)})},e.prototype.checkInitialized=function(){if(!this._isInitialized)throw new f(o.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(null!==this._deleteLogError){var t=this._deleteLogError;throw this._deleteLogError=null,t}},e.prototype.checkInitAsync=function(t){if(!this._isInitialized)return t(new f(o.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")),!1;if(null!==this._deleteLogError){var e=this._deleteLogError;return this._deleteLogError=null,t(e),!1}return!0},e.prototype.checkPath=function(t){if(t===xt)throw f.EPERM(t)},e.prototype.checkPathAsync=function(t,e){return t===xt&&(e(f.EPERM(t)),!0)},e.prototype.createParentDirectoriesAsync=function(t,e){var n=s.dirname(t),r=[],i=this;this._writable.stat(n,!1,function t(a,c){a?"/"===n?e(new f(o.EBUSY,"Invariant failed: root does not exist!")):(r.push(n),n=s.dirname(n),i._writable.stat(n,!1,t)):function t(){if(!r.length)return e();var n=r.pop();i._readable.stat(n,!1,function(r,o){if(!o)return e();i._writable.mkdir(n,o.mode,function(n){if(n)return e(n);t()})})}()})},e.prototype.createParentDirectories=function(t){for(var e=this,n=s.dirname(t),r=[];!this._writable.existsSync(n);)r.push(n),n=s.dirname(n);(r=r.reverse()).forEach(function(t){e._writable.mkdirSync(t,e.statSync(t,!1).mode)})},e.prototype.operateOnWritable=function(t,e){if(!this.existsSync(t))throw f.ENOENT(t);this._writable.existsSync(t)||this.copyToWritable(t),e()},e.prototype.operateOnWritableAsync=function(t,e){var n=this;this.exists(t,function(r){if(!r)return e(f.ENOENT(t));n._writable.exists(t,function(r){if(!r)return n.copyToWritableAsync(t,e);e()})})},e.prototype.copyToWritable=function(t){var e=this.statSync(t,!1);e.isDirectory()?this._writable.mkdirSync(t,e.mode):this.writeFileSync(t,this._readable.readFileSync(t,null,Rt("r")),null,Rt("w"),this.statSync(t,!1).mode)},e.prototype.copyToWritableAsync=function(t,e){var n=this;this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?n._writable.mkdir(t,i.mode,e):void n._readable.readFile(t,null,Rt("r"),function(r,o){if(r)return e(r);n.writeFile(t,o,null,Rt("w"),i.mode,e)})})},e}(X),Pt=function(t){function e(e,n){t.call(this,new Ut(e,n))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){try{var r=new e(t.writable,t.readable);r._initialize(function(t){n(t,r)})}catch(t){n(t)}},e.isAvailable=function(){return Ut.isAvailable()},e.prototype.getOverlayedFileSystems=function(){return t.prototype.getFSUnlocked.call(this).getOverlayedFileSystems()},e.prototype.unwrap=function(){return t.prototype.getFSUnlocked.call(this)},e.prototype._initialize=function(e){t.prototype.getFSUnlocked.call(this)._initialize(e)},e}(Lt);Pt.Name="OverlayFS",Pt.Options={writable:{type:"object",description:"The file system to write modified files to."},readable:{type:"object",description:"The file system that initially populates this file system."}};var Bt=function(e,n,r){var i=new XMLHttpRequest;i.open("GET",e,!0);var s=!0;switch(n){case"buffer":i.responseType="arraybuffer";break;case"json":try{i.responseType="json",s="json"===i.responseType}catch(t){s=!1}break;default:return r(new f(o.EINVAL,"Invalid download type: "+n))}i.onreadystatechange=function(e){if(4===i.readyState){if(200!==i.status)return r(new f(o.EIO,"XHR error: response returned code "+i.status));switch(n){case"buffer":return r(null,i.response?t.from(i.response):V());case"json":return r(null,s?i.response:JSON.parse(i.responseText))}}},i.send()},Ct=function(e,n){var r=new XMLHttpRequest;r.open("GET",e,!1);var i=null,s=null;if(r.overrideMimeType("text/plain; charset=x-user-defined"),r.onreadystatechange=function(e){if(4===r.readyState){if(200!==r.status)return void(s=new f(o.EIO,"XHR error: response returned code "+r.status));switch(n){case"buffer":var a=r.responseText;i=t.alloc(a.length);for(var c=0;c0;){var i=void 0,o=r.pop(),s=o[0],a=o[1],c=o[2];for(var u in a)if(a.hasOwnProperty(u)){var f=a[u],h=s+"/"+u;f?(e._index[h]=i=new Wt,r.push([h,f,i])):i=new Yt(new d(p.FILE,-1,365)),c&&(c._ls[u]=i)}}return e},Vt.prototype.fileIterator=function(t){for(var e in this._index)if(this._index.hasOwnProperty(e))for(var n=this._index[e],r=0,i=n.getListing();r0&&"/"!==n.charAt(n.length-1)&&(n+="/"),this.prefixUrl=n,this._index=Vt.fromListing(e),this._requestFileAsyncInternal=Ht,this._requestFileSizeAsyncInternal=Zt,this._requestFileSyncInternal=Ct,this._requestFileSizeSyncInternal=Mt}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){void 0===t.index&&(t.index="index.json"),"string"==typeof t.index?Bt(t.index,"json",function(r,i){r?n(r):n(null,new e(i,t.baseUrl))}):n(null,new e(t.index,t.baseUrl))},e.isAvailable=function(){return!0},e.prototype.empty=function(){this._index.fileIterator(function(t){t.fileData=null})},e.prototype.getName=function(){return e.Name},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.preloadFile=function(t,e){var n=this._index.getInode(t);if(!Xt(n))throw f.EISDIR(t);if(null===n)throw f.ENOENT(t);var r=n.getData();r.size=e.length,r.fileData=e},e.prototype.stat=function(t,e,n){var r,i=this._index.getInode(t);if(null===i)return n(f.ENOENT(t));Xt(i)?(r=i.getData(),!e&&r.size<0?this._requestFileSizeAsync(t,function(t,e){if(t)return n(t);r.size=e,n(null,d.clone(r))}):n(null,d.clone(r))):qt(i)?(r=i.getStats(),n(null,r)):n(f.FileError(o.EINVAL,t))},e.prototype.statSync=function(t,e){var n,r=this._index.getInode(t);if(null===r)throw f.ENOENT(t);if(Xt(r))(n=r.getData()).size<0&&(n.size=this._requestFileSizeSync(t));else{if(!qt(r))throw f.FileError(o.EINVAL,t);n=r.getStats()}return n},e.prototype.open=function(t,e,n,r){if(e.isWriteable())return r(new f(o.EPERM,t));var i=this,s=this._index.getInode(t);if(null===s)return r(f.ENOENT(t));if(!Xt(s))return r(f.EISDIR(t));var a=s.getData();switch(e.pathExistsAction()){case u.THROW_EXCEPTION:case u.TRUNCATE_FILE:return r(f.EEXIST(t));case u.NOP:if(a.fileData)return r(null,new K(i,t,e,d.clone(a),a.fileData));this._requestFileAsync(t,"buffer",function(n,o){return n?r(n):(a.size=o.length,a.fileData=o,r(null,new K(i,t,e,d.clone(a),o)))});break;default:return r(new f(o.EINVAL,"Invalid FileMode object."))}},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new f(o.EPERM,t);var r=this._index.getInode(t);if(null===r)throw f.ENOENT(t);if(!Xt(r))throw f.EISDIR(t);var i=r.getData();switch(e.pathExistsAction()){case u.THROW_EXCEPTION:case u.TRUNCATE_FILE:throw f.EEXIST(t);case u.NOP:if(i.fileData)return new K(this,t,e,d.clone(i),i.fileData);var s=this._requestFileSync(t,"buffer");return i.size=s.length,i.fileData=s,new K(this,t,e,d.clone(i),s);default:throw new f(o.EINVAL,"Invalid FileMode object.")}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(t){e(t)}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(null===e)throw f.ENOENT(t);if(qt(e))return e.getListing();throw f.ENOTDIR(t)},e.prototype.readFile=function(t,e,n,r){var i=r;this.open(t,n,420,function(t,n){if(t)return r(t);r=function(t,e){n.close(function(n){return t||(t=n),i(t,e)})};var o=n.getBuffer();null===e?r(t,H(o)):function(t,e,n){try{n(null,t.toString(e))}catch(t){n(t)}}(o,e,r)})},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r.getBuffer();return null===e?H(i):i.toString(e)}finally{r.closeSync()}},e.prototype._getHTTPPath=function(t){return"/"===t.charAt(0)&&(t=t.slice(1)),this.prefixUrl+t},e.prototype._requestFileAsync=function(t,e,n){this._requestFileAsyncInternal(this._getHTTPPath(t),e,n)},e.prototype._requestFileSync=function(t,e){return this._requestFileSyncInternal(this._getHTTPPath(t),e)},e.prototype._requestFileSizeAsync=function(t,e){this._requestFileSizeAsyncInternal(this._getHTTPPath(t),e)},e.prototype._requestFileSizeSync=function(t){return this._requestFileSizeSyncInternal(this._getHTTPPath(t))},e}(X);$t.Name="HTTPRequest",$t.Options={index:{type:["string","object"],optional:!0,description:"URL to a file index as a JSON file or the file index object itself, generated with the make_http_index script. Defaults to `index.json`."},baseUrl:{type:"string",optional:!0,description:"Used as the URL prefix for fetched files. Default: Fetch files relative to the index."}};var Jt=function(){};Jt.str2byte=function(t,e){for(var n=t.length>e.length?e.length:t.length,r=0;r127){var o=Jt.extendedChars.indexOf(t.charAt(r));o>-1&&(i=o+128)}e[i]=r}return n},Jt.byte2str=function(t){for(var e=new Array(t.length),n=0;n127?Jt.extendedChars[r-128]:String.fromCharCode(r)}return e.join("")},Jt.byteLength=function(t){return t.length},Jt.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];var Kt,Gt=n(9).inflateRaw,Qt={};function te(t,e){return new Date(1980+(e>>9),(e>>5&15)-1,31&e,t>>11,t>>5&63,31&t)}function ee(t,e,n,r){return 0===r?"":e?t.toString("utf8",n,n+r):Jt.byte2str(t.slice(n,n+r))}!function(t){t[t.STORED=0]="STORED",t[t.SHRUNK=1]="SHRUNK",t[t.REDUCED_1=2]="REDUCED_1",t[t.REDUCED_2=3]="REDUCED_2",t[t.REDUCED_3=4]="REDUCED_3",t[t.REDUCED_4=5]="REDUCED_4",t[t.IMPLODE=6]="IMPLODE",t[t.DEFLATE=8]="DEFLATE",t[t.DEFLATE64=9]="DEFLATE64",t[t.TERSE_OLD=10]="TERSE_OLD",t[t.BZIP2=12]="BZIP2",t[t.LZMA=14]="LZMA",t[t.TERSE_NEW=18]="TERSE_NEW",t[t.LZ77=19]="LZ77",t[t.WAVPACK=97]="WAVPACK",t[t.PPMD=98]="PPMD"}(Kt||(Kt={}));var ne=function(t){if(this.data=t,67324752!==t.readUInt32LE(0))throw new f(o.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))};ne.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},ne.prototype.flags=function(){return this.data.readUInt16LE(6)},ne.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},ne.prototype.lastModFileTime=function(){return te(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},ne.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},ne.prototype.crc32=function(){return this.data.readUInt32LE(14)},ne.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},ne.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},ne.prototype.fileName=function(){return ee(this.data,this.useUTF8(),30,this.fileNameLength())},ne.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},ne.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},ne.prototype.useUTF8=function(){return 2048==(2048&this.flags())};var re=function(t,e,n){this.header=t,this.record=e,this.data=n};re.prototype.decompress=function(){var t=this.header.compressionMethod(),e=Qt[t];if(e)return e(this.data,this.record.compressedSize(),this.record.uncompressedSize(),this.record.flag());var n=Kt[t];throw n||(n="Unknown: "+t),new f(o.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+n)},re.prototype.getHeader=function(){return this.header},re.prototype.getRecord=function(){return this.record},re.prototype.getRawData=function(){return this.data};var ie=function(t,e){if(this.zipData=t,this.data=e,33639248!==this.data.readUInt32LE(0))throw new f(o.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()};ie.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},ie.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},ie.prototype.flag=function(){return this.data.readUInt16LE(8)},ie.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},ie.prototype.lastModFileTime=function(){return te(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},ie.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},ie.prototype.crc32=function(){return this.data.readUInt32LE(16)},ie.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},ie.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},ie.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},ie.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},ie.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},ie.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},ie.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},ie.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},ie.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},ie.prototype.produceFilename=function(){return ee(this.data,this.useUTF8(),46,this.fileNameLength()).replace(/\\/g,"/")},ie.prototype.fileName=function(){return this._filename},ie.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},ie.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},ie.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return ee(this.data,this.useUTF8(),t,this.fileCommentLength())},ie.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},ie.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},ie.prototype.isDirectory=function(){var t=this.fileName();return!!(16&this.externalAttributes())||"/"===t.charAt(t.length-1)},ie.prototype.isFile=function(){return!this.isDirectory()},ie.prototype.useUTF8=function(){return 2048==(2048&this.flag())},ie.prototype.isEncrypted=function(){return 1==(1&this.flag())},ie.prototype.getFileData=function(){var t=this.headerRelativeOffset(),e=new ne(this.zipData.slice(t));return new re(e,this,this.zipData.slice(t+e.totalSize()))},ie.prototype.getData=function(){return this.getFileData().decompress()},ie.prototype.getRawData=function(){return this.getFileData().getRawData()},ie.prototype.getStats=function(){return new d(p.FILE,this.uncompressedSize(),365,Date.now(),this.lastModFileTime().getTime())};var oe=function(t){if(this.data=t,101010256!==this.data.readUInt32LE(0))throw new f(o.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))};oe.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},oe.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},oe.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},oe.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},oe.prototype.cdSize=function(){return this.data.readUInt32LE(12)},oe.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},oe.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},oe.prototype.cdZipComment=function(){return ee(this.data,!0,22,this.cdZipCommentLength())},oe.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())};var se=function(t){function e(e,n){void 0===n&&(n=""),t.call(this),this.name=n,this._index=new Vt,this._directoryEntries=[],this._eocd=null,this._index=e.index,this._directoryEntries=e.directoryEntries,this._eocd=e.eocd,this.data=e.data}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){try{e._computeIndex(t.zipData,function(r,i){if(i){var o=new e(i,t.name);n(null,o)}else n(r)})}catch(t){n(t)}},e.isAvailable=function(){return!0},e.RegisterDecompressionMethod=function(t,e){Qt[t]=e},e._getEOCD=function(t){for(var e=Math.min(65557,t.length-1),n=22;n-1},me.prototype.getRockRidgeOffset=function(){return this._rockRidgeOffset},me.prototype.rootCheckForRockRidge=function(t){var e=this.getDirectory(t);this._rockRidgeOffset=e.getDotEntry(t)._getRockRidgeOffset(t),this._rockRidgeOffset>-1&&(this._fileOrDir=null)},me.prototype.length=function(){return this._data[0]},me.prototype.extendedAttributeRecordLength=function(){return this._data[1]},me.prototype.lba=function(){return 2048*this._data.readUInt32LE(2)},me.prototype.dataLength=function(){return this._data.readUInt32LE(10)},me.prototype.recordingDate=function(){return fe(this._data,18)},me.prototype.fileFlags=function(){return this._data[25]},me.prototype.fileUnitSize=function(){return this._data[26]},me.prototype.interleaveGapSize=function(){return this._data[27]},me.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(28)},me.prototype.identifier=function(){return this._getString(33,this._data[32])},me.prototype.fileName=function(t){if(this.hasRockRidge()){var e=this._rockRidgeFilename(t);if(null!==e)return e}var n=this.identifier();if(this.isDirectory(t))return n;var r=n.indexOf(";");return-1===r?n:"."===n[r-1]?n.slice(0,r-1):n.slice(0,r)},me.prototype.isDirectory=function(t){var e=!!(2&this.fileFlags());return!e&&this.hasRockRidge()&&(e=this.getSUEntries(t).filter(function(t){return t instanceof Re}).length>0),e},me.prototype.isSymlink=function(t){return this.hasRockRidge()&&this.getSUEntries(t).filter(function(t){return t instanceof Le}).length>0},me.prototype.getSymlinkPath=function(t){for(var e="",n=this.getSUEntries(t),r=this._getGetString(),i=0,o=n;i1&&"/"===e[e.length-1]?e.slice(0,e.length-1):e},me.prototype.getFile=function(t){if(this.isDirectory(t))throw new Error("Tried to get a File from a directory.");return null===this._fileOrDir&&(this._fileOrDir=t.slice(this.lba(),this.lba()+this.dataLength())),this._fileOrDir},me.prototype.getDirectory=function(t){if(!this.isDirectory(t))throw new Error("Tried to get a Directory from a file.");return null===this._fileOrDir&&(this._fileOrDir=this._constructDirectory(t)),this._fileOrDir},me.prototype.getSUEntries=function(t){return this._suEntries||this._constructSUEntries(t),this._suEntries},me.prototype._rockRidgeFilename=function(t){var e=this.getSUEntries(t).filter(function(t){return t instanceof De});if(0===e.length||6&e[0].flags())return null;for(var n="",r=this._getGetString(),i=0,o=e;i0){var n=e[0];if(n instanceof Se&&n.checkBytesPass())for(var r=1;r0?s-4:s;for(n=0;n>16&255,c[f++]=e>>8&255,c[f++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[f++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function h(t,e,n){for(var r,i=[],o=e;o */ e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<>1,f=-7,h=n?i-1:0,p=n?-1:1,l=t[e+h];for(h+=p,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=p,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+t[e+h],h+=p,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,r),o-=u}return(l?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?p/c:p*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+l]=255&a,l+=d,a/=256,i-=8);for(s=s<0;t[n+l]=255&s,l+=d,s/=256,u-=8);t[n+l-d]|=128*y}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(t){function n(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(t){return r.exec(t).slice(1)};function o(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!r;i--){var s=i>=0?arguments[i]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,r="/"===s.charAt(0))}return e=n(o(e.split("/"),function(t){return!!t}),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(t){var r=e.isAbsolute(t),i="/"===s(t,-1);return(t=n(o(t.split("/"),function(t){return!!t}),!r).join("/"))||r||(t="."),t&&i&&(t+="/"),(r?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(o(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var i=r(t.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,c=0;c=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;let n=r.inflateInit2(this.strm,e.windowBits);if(n!==p)throw new Error(s[n]);if(this.header=new c,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=r.inflateSetDictionary(this.strm,e.dictionary))!==p))throw new Error(s[n])}function _(t,e){const n=new w(e);if(n.push(t),n.err)throw n.msg||s[n.err];return n.result}w.prototype.push=function(t,e){const n=this.strm,i=this.options.chunkSize,s=this.options.dictionary;let a,c,w;if(this.ended)return!1;for(c=e===~~e?e:!0===e?h:f,"[object ArrayBuffer]"===u.call(t)?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(i),n.next_out=0,n.avail_out=i),(a=r.inflate(n,c))===d&&s&&((a=r.inflateSetDictionary(n,s))===p?a=r.inflate(n,c):a===g&&(a=d));n.avail_in>0&&a===l&&n.state.wrap>0&&0!==t[n.next_in];)r.inflateReset(n),a=r.inflate(n,c);switch(a){case y:case g:case d:case m:return this.onEnd(a),this.ended=!0,!1}if(w=n.avail_out,n.next_out&&(0===n.avail_out||a===l))if("string"===this.options.to){let t=o.utf8border(n.output,n.next_out),e=n.next_out-t,r=o.buf2string(n.output,t);n.next_out=e,n.avail_out=i-e,e&&n.output.set(n.output.subarray(t,t+e),0),this.onData(r)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(a!==p||0!==w){if(a===l)return a=r.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},w.prototype.onData=function(t){this.chunks.push(t)},w.prototype.onEnd=function(t){t===p&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},t.exports.Inflate=w,t.exports.inflate=_,t.exports.inflateRaw=function(t,e){return(e=e||{}).raw=!0,_(t,e)},t.exports.ungzip=_,t.exports.constants=n(0)},function(t,e,n){"use strict";const r=n(11),i=n(12),o=n(13),s=n(14),{Z_FINISH:a,Z_BLOCK:c,Z_TREES:u,Z_OK:f,Z_STREAM_END:h,Z_NEED_DICT:p,Z_STREAM_ERROR:l,Z_DATA_ERROR:d,Z_MEM_ERROR:y,Z_BUF_ERROR:g,Z_DEFLATED:m}=n(0),w=16209,_=t=>(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);const E=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<16180||e.mode>16211?1:0},v=t=>{if(E(t))return l;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=16180,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,f},b=t=>{if(E(t))return l;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,v(t)},S=(t,e)=>{let n;if(E(t))return l;const r=t.state;return e<0?(n=0,e=-e):(n=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?l:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,b(t))},I=(t,e)=>{if(!t)return l;const n=new function(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0};t.state=n,n.strm=t,n.window=null,n.mode=16180;const r=S(t,e);return r!==f&&(t.state=null),r};let k,O,N=!0;const T=t=>{if(N){k=new Int32Array(512),O=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,k,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,O,0,t.work,{bits:5}),N=!1}t.lencode=k,t.lenbits=9,t.distcode=O,t.distbits=5},F=(t,e,n,r)=>{let i;const o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(o.window.set(e.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>r&&(i=r),o.window.set(e.subarray(n-r,n-r+i),o.wnext),(r-=i)?(o.window.set(e.subarray(n-r,n),0),o.wnext=r,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whaveI(t,15)),t.exports.inflateInit2=I,t.exports.inflate=((t,e)=>{let n,v,b,S,I,k,O,N,L,x,D,R,A,U,P,B,C,M,z,j,H,Z,V=0;const Y=new Uint8Array(4);let W,X;const q=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(E(t)||!t.output||!t.input&&0!==t.avail_in)return l;16191===(n=t.state).mode&&(n.mode=16192),I=t.next_out,b=t.output,O=t.avail_out,S=t.next_in,v=t.input,k=t.avail_in,N=n.hold,L=n.bits,x=k,D=O,Z=f;t:for(;;)switch(n.mode){case 16180:if(0===n.wrap){n.mode=16192;break}for(;L<16;){if(0===k)break t;k--,N+=v[S++]<>>8&255,n.check=i(n.check,Y,2,0),N=0,L=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&N)<<8)+(N>>8))%31){t.msg="incorrect header check",n.mode=w;break}if((15&N)!==m){t.msg="unknown compression method",n.mode=w;break}if(L-=4,H=8+(15&(N>>>=4)),0===n.wbits&&(n.wbits=H),H>15||H>n.wbits){t.msg="invalid window size",n.mode=w;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(Y[0]=255&N,Y[1]=N>>>8&255,n.check=i(n.check,Y,2,0)),N=0,L=0,n.mode=16182;case 16182:for(;L<32;){if(0===k)break t;k--,N+=v[S++]<>>8&255,Y[2]=N>>>16&255,Y[3]=N>>>24&255,n.check=i(n.check,Y,4,0)),N=0,L=0,n.mode=16183;case 16183:for(;L<16;){if(0===k)break t;k--,N+=v[S++]<>8),512&n.flags&&4&n.wrap&&(Y[0]=255&N,Y[1]=N>>>8&255,n.check=i(n.check,Y,2,0)),N=0,L=0,n.mode=16184;case 16184:if(1024&n.flags){for(;L<16;){if(0===k)break t;k--,N+=v[S++]<>>8&255,n.check=i(n.check,Y,2,0)),N=0,L=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&((R=n.length)>k&&(R=k),R&&(n.head&&(H=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(v.subarray(S,S+R),H)),512&n.flags&&4&n.wrap&&(n.check=i(n.check,v,R,S)),k-=R,S+=R,n.length-=R),n.length))break t;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===k)break t;R=0;do{H=v[S+R++],n.head&&H&&n.length<65536&&(n.head.name+=String.fromCharCode(H))}while(H&&R>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=16191;break;case 16189:for(;L<32;){if(0===k)break t;k--,N+=v[S++]<>>=7&L,L-=7&L,n.mode=16206;break}for(;L<3;){if(0===k)break t;k--,N+=v[S++]<>>=1)){case 0:n.mode=16193;break;case 1:if(T(n),n.mode=16199,e===u){N>>>=2,L-=2;break t}break;case 2:n.mode=16196;break;case 3:t.msg="invalid block type",n.mode=w}N>>>=2,L-=2;break;case 16193:for(N>>>=7&L,L-=7&L;L<32;){if(0===k)break t;k--,N+=v[S++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=w;break}if(n.length=65535&N,N=0,L=0,n.mode=16194,e===u)break t;case 16194:n.mode=16195;case 16195:if(R=n.length){if(R>k&&(R=k),R>O&&(R=O),0===R)break t;b.set(v.subarray(S,S+R),I),k-=R,S+=R,O-=R,I+=R,n.length-=R;break}n.mode=16191;break;case 16196:for(;L<14;){if(0===k)break t;k--,N+=v[S++]<>>=5,L-=5,n.ndist=1+(31&N),N>>>=5,L-=5,n.ncode=4+(15&N),N>>>=4,L-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=w;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,L-=3}for(;n.have<19;)n.lens[q[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,W={bits:n.lenbits},Z=s(0,n.lens,0,19,n.lencode,0,n.work,W),n.lenbits=W.bits,Z){t.msg="invalid code lengths set",n.mode=w;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>16&255,C=65535&V,!((P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<>>=P,L-=P,n.lens[n.have++]=C;else{if(16===C){for(X=P+2;L>>=P,L-=P,0===n.have){t.msg="invalid bit length repeat",n.mode=w;break}H=n.lens[n.have-1],R=3+(3&N),N>>>=2,L-=2}else if(17===C){for(X=P+3;L>>=P)),N>>>=3,L-=3}else{for(X=P+7;L>>=P)),N>>>=7,L-=7}if(n.have+R>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=w;break}for(;R--;)n.lens[n.have++]=H}}if(n.mode===w)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=w;break}if(n.lenbits=9,W={bits:n.lenbits},Z=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,W),n.lenbits=W.bits,Z){t.msg="invalid literal/lengths set",n.mode=w;break}if(n.distbits=6,n.distcode=n.distdyn,W={bits:n.distbits},Z=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,W),n.distbits=W.bits,Z){t.msg="invalid distances set",n.mode=w;break}if(n.mode=16199,e===u)break t;case 16199:n.mode=16200;case 16200:if(k>=6&&O>=258){t.next_out=I,t.avail_out=O,t.next_in=S,t.avail_in=k,n.hold=N,n.bits=L,o(t,D),I=t.next_out,b=t.output,O=t.avail_out,S=t.next_in,v=t.input,k=t.avail_in,N=n.hold,L=n.bits,16191===n.mode&&(n.back=-1);break}for(n.back=0;B=(V=n.lencode[N&(1<>>16&255,C=65535&V,!((P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<>M)])>>>16&255,C=65535&V,!(M+(P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<>>=M,L-=M,n.back+=M}if(N>>>=P,L-=P,n.back+=P,n.length=C,0===B){n.mode=16205;break}if(32&B){n.back=-1,n.mode=16191;break}if(64&B){t.msg="invalid literal/length code",n.mode=w;break}n.extra=15&B,n.mode=16201;case 16201:if(n.extra){for(X=n.extra;L>>=n.extra,L-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;B=(V=n.distcode[N&(1<>>16&255,C=65535&V,!((P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<>M)])>>>16&255,C=65535&V,!(M+(P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<>>=M,L-=M,n.back+=M}if(N>>>=P,L-=P,n.back+=P,64&B){t.msg="invalid distance code",n.mode=w;break}n.offset=C,n.extra=15&B,n.mode=16203;case 16203:if(n.extra){for(X=n.extra;L>>=n.extra,L-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=w;break}n.mode=16204;case 16204:if(0===O)break t;if(R=D-O,n.offset>R){if((R=n.offset-R)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=w;break}R>n.wnext?(R-=n.wnext,A=n.wsize-R):A=n.wnext-R,R>n.length&&(R=n.length),U=n.window}else U=b,A=I-n.offset,R=n.length;R>O&&(R=O),O-=R,n.length-=R;do{b[I++]=U[A++]}while(--R);0===n.length&&(n.mode=16200);break;case 16205:if(0===O)break t;b[I++]=n.length,O--,n.mode=16200;break;case 16206:if(n.wrap){for(;L<32;){if(0===k)break t;k--,N|=v[S++]<{if(E(t))return l;let e=t.state;return e.window&&(e.window=null),t.state=null,f}),t.exports.inflateGetHeader=((t,e)=>{if(E(t))return l;const n=t.state;return 0==(2&n.wrap)?l:(n.head=e,e.done=!1,f)}),t.exports.inflateSetDictionary=((t,e)=>{const n=e.length;let i,o,s;return E(t)?l:0!==(i=t.state).wrap&&16190!==i.mode?l:16190===i.mode&&(o=r(o=1,e,n,0))!==i.check?d:(s=F(t,e,n,n))?(i.mode=16210,y):(i.havedict=1,f)}),t.exports.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,n){"use strict";t.exports=((t,e,n,r)=>{let i=65535&t|0,o=t>>>16&65535|0,s=0;for(;0!==n;){n-=s=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--s);i%=65521,o%=65521}return i|o<<16|0})},function(t,e,n){"use strict";const r=new Uint32Array((()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e})());t.exports=((t,e,n,i)=>{const o=r,s=i+n;t^=-1;for(let n=i;n>>8^o[255&(t^e[n])];return-1^t})},function(t,e,n){"use strict";t.exports=function(t,e){let n,r,i,o,s,a,c,u,f,h,p,l,d,y,g,m,w,_,E,v,b,S,I,k;const O=t.state;n=t.next_in,I=t.input,r=n+(t.avail_in-5),i=t.next_out,k=t.output,o=i-(e-t.avail_out),s=i+(t.avail_out-257),a=O.dmax,c=O.wsize,u=O.whave,f=O.wnext,h=O.window,p=O.hold,l=O.bits,d=O.lencode,y=O.distcode,g=(1<>>=_=w>>>24,l-=_,0===(_=w>>>16&255))k[i++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=d[(65535&w)+(p&(1<<_)-1)];continue e}if(32&_){O.mode=16191;break t}t.msg="invalid literal/length code",O.mode=16209;break t}E=65535&w,(_&=15)&&(l<_&&(p+=I[n++]<>>=_,l-=_),l<15&&(p+=I[n++]<>>=_=w>>>24,l-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=y[(65535&w)+(p&(1<<_)-1)];continue n}t.msg="invalid distance code",O.mode=16209;break t}if(v=65535&w,l<(_&=15)&&(p+=I[n++]<a){t.msg="invalid distance too far back",O.mode=16209;break t}if(p>>>=_,l-=_,v>(_=i-o)){if((_=v-_)>u&&O.sane){t.msg="invalid distance too far back",O.mode=16209;break t}if(b=0,S=h,0===f){if(b+=c-_,_2;)k[i++]=S[b++],k[i++]=S[b++],k[i++]=S[b++],E-=3;E&&(k[i++]=S[b++],E>1&&(k[i++]=S[b++]))}else{b=i-v;do{k[i++]=k[b++],k[i++]=k[b++],k[i++]=k[b++],E-=3}while(E>2);E&&(k[i++]=k[b++],E>1&&(k[i++]=k[b++]))}break}}break}}while(n>3,p&=(1<<(l-=E<<3))-1,t.next_in=n,t.next_out=i,t.avail_in=n{const p=h.bits;let l,d,y,g,m,w,_=0,E=0,v=0,b=0,S=0,I=0,k=0,O=0,N=0,T=0,F=null;const L=new Uint16Array(16),x=new Uint16Array(16);let D,R,A,U=null;for(_=0;_<=15;_++)L[_]=0;for(E=0;E=1&&0===L[b];b--);if(S>b&&(S=b),0===b)return c[u++]=20971520,c[u++]=20971520,h.bits=1,0;for(v=1;v0&&(0===t||1!==b))return-1;for(x[1]=0,_=1;_<15;_++)x[_+1]=x[_]+L[_];for(E=0;E852||2===t&&N>592)return 1;for(;;){D=_-k,f[E]+1=w?(R=U[f[E]-w],A=F[f[E]-w]):(R=96,A=0),l=1<<_-k,v=d=1<>k)+(d-=l)]=D<<24|R<<16|A|0}while(0!==d);for(l=1<<_-1;T&l;)l>>=1;if(0!==l?(T&=l-1,T+=l):T=0,E++,0==--L[_]){if(_===b)break;_=e[n+f[E]]}if(_>S&&(T&g)!==y){for(0===k&&(k=S),m+=v,O=1<<(I=_-k);I+k852||2===t&&N>592)return 1;c[y=T&g]=S<<24|I<<16|m-u|0}}return 0!==T&&(c[m+T]=_-k<<24|64<<16|0),h.bits=S,0})},function(t,e,n){"use strict";const r=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);t.exports.assign=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(const e in n)r(n,e)&&(t[e]=n[e])}}return t},t.exports.flattenChunks=(t=>{let e=0;for(let n=0,r=t.length;n=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;i[254]=i[254]=1,t.exports.string2buf=(t=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,n,r,i,o,s=t.length,a=0;for(i=0;i>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e});t.exports.buf2string=((t,e)=>{const n=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(t.subarray(0,e));let o,s;const a=new Array(2*n);for(s=0,o=0;o4)a[s++]=65533,o+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&o1?a[s++]=65533:e<65536?a[s++]=e:(e-=65536,a[s++]=55296|e>>10&1023,a[s++]=56320|1023&e)}}return((t,e)=>{if(e<65534&&t.subarray&&r)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r{(e=e||t.length)>t.length&&(e=t.length);let n=e-1;for(;n>=0&&128==(192&t[n]);)n--;return n<0?e:0===n?e:n+i[t[n]]>e?n:e})},function(t,e,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,n){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}}])});