securityos/public/System/BrowserFS/browserfs.min.js.old

9 lines
171 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

!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 <https://feross.org>
* @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<e;r+=1)n[r]=255&t[r];return n}function l(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function d(t){if(t>=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;o<a;o++)if(u(t,o)===u(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(u(t,o+r)!==u(e,r)){n=!1;break}if(n)return o}return-1}function _(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(e.substr(2*s,2),16);if($(r))return s;t[n+s]=r}return s}function E(t,e,n,r){return X(Y(e,t.length-n),t,n,r)}function v(t,e,n,r){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n,r){return X(W(e),t,n,r)}function S(t,e,n,r){return X(function(t,e){let n,r,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>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(;i<n;){const e=t[i];let o=null,s=e>239?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(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=O));return n}(r)}e.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return u(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return f(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(q(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),q(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=c.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(q(e,Uint8Array))i+e.length>r.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;e<t;e+=2)g(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):function(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.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+=" ... "),"<Buffer "+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<a;++t)if(u[t]!==f[t]){o=u[t],s=f[t];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=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;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function T(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function F(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=J[t[r]];return i}function L(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function x(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)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||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.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<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=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)<<BigInt(32))}),c.prototype.readBigUInt64BE=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*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)<<BigInt(32))+BigInt(i)}),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||x(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(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)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),c.prototype.readBigInt64BE=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<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)}),c.prototype.readFloatLE=function(t,e){return t>>>=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<n&&(i*=256);)this[e+o]=t/i&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=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=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<n&&(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.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<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const o=c.isBuffer(t)?t:c.from(t,r),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=o[i%s]}return this};const C={};function M(t,e,n){C[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function z(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=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||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?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;s<r;++s){if((n=t.charCodeAt(s))>55295&&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<r&&!(i+n>=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=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function y(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new d(t,e)),1!==u.length||f||a(l)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";(function(t,r,i){Object.defineProperty(e,"__esModule",{value:!0});var o,s=n(8),a=n(1);!function(t){t[t.EPERM=1]="EPERM",t[t.ENOENT=2]="ENOENT",t[t.EIO=5]="EIO",t[t.EBADF=9]="EBADF",t[t.EACCES=13]="EACCES",t[t.EBUSY=16]="EBUSY",t[t.EEXIST=17]="EEXIST",t[t.ENOTDIR=20]="ENOTDIR",t[t.EISDIR=21]="EISDIR",t[t.EINVAL=22]="EINVAL",t[t.EFBIG=27]="EFBIG",t[t.ENOSPC=28]="ENOSPC",t[t.EROFS=30]="EROFS",t[t.ENOTEMPTY=39]="ENOTEMPTY",t[t.ENOTSUP=95]="ENOTSUP"}(o||(o={}));var c={};c[o.EPERM]="Operation not permitted.",c[o.ENOENT]="No such file or directory.",c[o.EIO]="Input/output error.",c[o.EBADF]="Bad file descriptor.",c[o.EACCES]="Permission denied.",c[o.EBUSY]="Resource busy or locked.",c[o.EEXIST]="File exists.",c[o.ENOTDIR]="File is not a directory.",c[o.EISDIR]="File is a directory.",c[o.EINVAL]="Invalid argument.",c[o.EFBIG]="File is too big.",c[o.ENOSPC]="No space left on disk.",c[o.EROFS]="Cannot modify a read-only file system.",c[o.ENOTEMPTY]="Directory is not empty.",c[o.ENOTSUP]="Operation is not supported.";var u,f=function(e){function n(t,n,r){void 0===n&&(n=c[t]),e.call(this,n),this.syscall="",this.errno=t,this.code=o[t],this.path=r,this.stack=(new e).stack,this.message="Error: "+this.code+": "+n+(this.path?", '"+this.path+"'":"")}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.fromJSON=function(t){var e=new n(0);return e.errno=t.errno,e.code=t.code,e.path=t.path,e.stack=t.stack,e.message=t.message,e},n.fromBuffer=function(t,e){return void 0===e&&(e=0),n.fromJSON(JSON.parse(t.toString("utf8",e+4,e+4+t.readUInt32LE(e))))},n.FileError=function(t,e){return new n(t,c[t],e)},n.ENOENT=function(t){return this.FileError(o.ENOENT,t)},n.EEXIST=function(t){return this.FileError(o.EEXIST,t)},n.EISDIR=function(t){return this.FileError(o.EISDIR,t)},n.ENOTDIR=function(t){return this.FileError(o.ENOTDIR,t)},n.EPERM=function(t){return this.FileError(o.EPERM,t)},n.ENOTEMPTY=function(t){return this.FileError(o.ENOTEMPTY,t)},n.prototype.toString=function(){return this.message},n.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},n.prototype.writeToBuffer=function(e,n){void 0===e&&(e=t.alloc(this.bufferSize())),void 0===n&&(n=0);var r=e.write(JSON.stringify(this.toJSON()),n+4);return e.writeUInt32LE(r,n),e},n.prototype.bufferSize=function(){return 4+t.byteLength(JSON.stringify(this.toJSON()))},n}(Error),h=Object.freeze({get ErrorCode(){return o},ErrorStrings:c,ApiError:f});!function(t){t[t.NOP=0]="NOP",t[t.THROW_EXCEPTION=1]="THROW_EXCEPTION",t[t.TRUNCATE_FILE=2]="TRUNCATE_FILE",t[t.CREATE_FILE=3]="CREATE_FILE"}(u||(u={}));var p,l=function t(e){if(this.flagStr=e,t.validFlagStrs.indexOf(e)<0)throw new f(o.EINVAL,"Invalid flag: "+e)};l.getFileFlag=function(t){return l.flagCache.hasOwnProperty(t)?l.flagCache[t]:l.flagCache[t]=new l(t)},l.prototype.getFlagString=function(){return this.flagStr},l.prototype.isReadable=function(){return-1!==this.flagStr.indexOf("r")||-1!==this.flagStr.indexOf("+")},l.prototype.isWriteable=function(){return-1!==this.flagStr.indexOf("w")||-1!==this.flagStr.indexOf("a")||-1!==this.flagStr.indexOf("+")},l.prototype.isTruncating=function(){return-1!==this.flagStr.indexOf("w")},l.prototype.isAppendable=function(){return-1!==this.flagStr.indexOf("a")},l.prototype.isSynchronous=function(){return-1!==this.flagStr.indexOf("s")},l.prototype.isExclusive=function(){return-1!==this.flagStr.indexOf("x")},l.prototype.pathExistsAction=function(){return this.isExclusive()?u.THROW_EXCEPTION:this.isTruncating()?u.TRUNCATE_FILE:u.NOP},l.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&"r+"!==this.flagStr?u.CREATE_FILE:u.THROW_EXCEPTION},l.flagCache={},l.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"],function(t){t[t.FILE=32768]="FILE",t[t.DIRECTORY=16384]="DIRECTORY",t[t.SYMLINK=40960]="SYMLINK"}(p||(p={}));var d=function(t,e,n,r,i,o,s){this.dev=0,this.ino=0,this.rdev=0,this.nlink=1,this.blksize=4096,this.uid=0,this.gid=0,this.fileData=null,this.size=e;var a=0;if("number"!=typeof r&&(r=a=Date.now()),"number"!=typeof i&&(a||(a=Date.now()),i=a),"number"!=typeof o&&(a||(a=Date.now()),o=a),"number"!=typeof s&&(a||(a=Date.now()),s=a),this.atimeMs=r,this.ctimeMs=o,this.mtimeMs=i,this.birthtimeMs=s,n)this.mode=n;else switch(t){case p.FILE:this.mode=420;break;case p.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(e/512),this.mode<4096&&(this.mode|=t)},y={atime:{configurable:!0},mtime:{configurable:!0},ctime:{configurable:!0},birthtime:{configurable:!0}};d.fromBuffer=function(t){var e=t.readUInt32LE(0),n=t.readUInt32LE(4),r=t.readDoubleLE(8),i=t.readDoubleLE(16),o=t.readDoubleLE(24);return new d(61440&n,e,4095&n,r,i,o)},d.clone=function(t){return new d(61440&t.mode,t.size,4095&t.mode,t.atimeMs,t.mtimeMs,t.ctimeMs,t.birthtimeMs)},y.atime.get=function(){return new Date(this.atimeMs)},y.mtime.get=function(){return new Date(this.mtimeMs)},y.ctime.get=function(){return new Date(this.ctimeMs)},y.birthtime.get=function(){return new Date(this.birthtimeMs)},d.prototype.toBuffer=function(){var e=t.alloc(32);return e.writeUInt32LE(this.size,0),e.writeUInt32LE(this.mode,4),e.writeDoubleLE(this.atime.getTime(),8),e.writeDoubleLE(this.mtime.getTime(),16),e.writeDoubleLE(this.ctime.getTime(),24),e},d.prototype.isFile=function(){return(61440&this.mode)===p.FILE},d.prototype.isDirectory=function(){return(61440&this.mode)===p.DIRECTORY},d.prototype.isSymbolicLink=function(){return(61440&this.mode)===p.SYMLINK},d.prototype.chmod=function(t){this.mode=61440&this.mode|t},d.prototype.isSocket=function(){return!1},d.prototype.isBlockDevice=function(){return!1},d.prototype.isCharacterDevice=function(){return!1},d.prototype.isFIFO=function(){return!1},Object.defineProperties(d.prototype,y);var g,m="undefined"!=typeof window?window:"undefined"!=typeof self?self:r;if("undefined"!=typeof setImmediate)g=setImmediate;else{var w=m,_=[];if(function(){if(void 0!==w.importScripts||!w.postMessage)return!1;var t=!0,e=w.onmessage;return w.onmessage=function(){t=!1},w.postMessage("","*"),w.onmessage=e,t}()){g=function(t){_.push(t),w.postMessage("zero-timeout-message","*")};var E=function(t){if(t.source===self&&"zero-timeout-message"===t.data&&(t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,_.length>0))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;i<r.length;i++){var o=r.slice(0,i+1);r[i]=s.join.apply(null,o)}else this.exists(t,function(e){e?n(null,t):n(f.ENOENT(t))})},X.prototype.realpathSync=function(t,e){if(this.supportsLinks()){for(var n=t.split(s.sep),r=0;r<n.length;r++){var i=n.slice(0,r+1);n[r]=s.join.apply(s,i)}return n.join(s.sep)}if(this.existsSync(t))return t;throw f.ENOENT(t)},X.prototype.truncate=function(t,e,n){this.open(t,l.getFileFlag("r+"),420,function(t,r){if(t)return n(t);r.truncate(e,function(t){r.close(function(e){n(t||e)})})})},X.prototype.truncateSync=function(t,e){var n=this.openSync(t,l.getFileFlag("r+"),420);try{n.truncateSync(e)}catch(t){throw t}finally{n.closeSync()}},X.prototype.readFile=function(e,n,r,i){var o=i;this.open(e,r,420,function(e,r){if(e)return i(e);i=function(t,e){r.close(function(n){return t||(t=n),o(t,e)})},r.stat(function(e,o){if(e)return i(e);var s=t.alloc(o.size);r.read(s,0,o.size,0,function(t){if(t)return i(t);if(null===n)return i(t,s);try{i(null,s.toString(n))}catch(t){i(t)}})})})},X.prototype.readFileSync=function(e,n,r){var i=this.openSync(e,r,420);try{var o=i.statSync(),s=t.alloc(o.size);return i.readSync(s,0,o.size,0),i.closeSync(),null===n?s:s.toString(n)}finally{i.closeSync()}},X.prototype.writeFile=function(e,n,r,i,o,s){var a=s;this.open(e,i,420,function(e,i){if(e)return s(e);s=function(t){i.close(function(e){a(t||e)})};try{"string"==typeof n&&(n=t.from(n,r))}catch(t){return s(t)}i.write(n,0,n.length,0,s)})},X.prototype.writeFileSync=function(e,n,r,i,o){var s=this.openSync(e,i,o);try{"string"==typeof n&&(n=t.from(n,r)),s.writeSync(n,0,n.length,0)}finally{s.closeSync()}},X.prototype.appendFile=function(e,n,r,i,o,s){var a=s;this.open(e,i,o,function(e,i){if(e)return s(e);s=function(t){i.close(function(e){a(t||e)})},"string"==typeof n&&(n=t.from(n,r)),i.write(n,0,n.length,null,s)})},X.prototype.appendFileSync=function(e,n,r,i,o){var s=this.openSync(e,i,o);try{"string"==typeof n&&(n=t.from(n,r)),s.writeSync(n,0,n.length,null)}finally{s.closeSync()}},X.prototype.chmod=function(t,e,n,r){r(new f(o.ENOTSUP))},X.prototype.chmodSync=function(t,e,n){throw new f(o.ENOTSUP)},X.prototype.chown=function(t,e,n,r,i){i(new f(o.ENOTSUP))},X.prototype.chownSync=function(t,e,n,r){throw new f(o.ENOTSUP)},X.prototype.utimes=function(t,e,n,r){r(new f(o.ENOTSUP))},X.prototype.utimesSync=function(t,e,n){throw new f(o.ENOTSUP)},X.prototype.link=function(t,e,n){n(new f(o.ENOTSUP))},X.prototype.linkSync=function(t,e){throw new f(o.ENOTSUP)},X.prototype.symlink=function(t,e,n,r){r(new f(o.ENOTSUP))},X.prototype.symlinkSync=function(t,e,n){throw new f(o.ENOTSUP)},X.prototype.readlink=function(t,e){e(new f(o.ENOTSUP))},X.prototype.readlinkSync=function(t){throw new f(o.ENOTSUP)};var q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.supportsSynch=function(){return!0},e.prototype.rename=function(t,e,n){try{this.renameSync(t,e),n()}catch(t){n(t)}},e.prototype.stat=function(t,e,n){try{n(null,this.statSync(t,e))}catch(t){n(t)}},e.prototype.open=function(t,e,n,r){try{r(null,this.openSync(t,e,n))}catch(t){r(t)}},e.prototype.unlink=function(t,e){try{this.unlinkSync(t),e()}catch(t){e(t)}},e.prototype.rmdir=function(t,e){try{this.rmdirSync(t),e()}catch(t){e(t)}},e.prototype.mkdir=function(t,e,n){try{this.mkdirSync(t,e),n()}catch(t){n(t)}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(t){e(t)}},e.prototype.chmod=function(t,e,n,r){try{this.chmodSync(t,e,n),r()}catch(t){r(t)}},e.prototype.chown=function(t,e,n,r,i){try{this.chownSync(t,e,n,r),i()}catch(t){i(t)}},e.prototype.utimes=function(t,e,n,r){try{this.utimesSync(t,e,n),r()}catch(t){r(t)}},e.prototype.link=function(t,e,n){try{this.linkSync(t,e),n()}catch(t){n(t)}},e.prototype.symlink=function(t,e,n,r){try{this.symlinkSync(t,e,n),r()}catch(t){r(t)}},e.prototype.readlink=function(t,e){try{e(null,this.readlinkSync(t))}catch(t){e(t)}},e}(X),$=function(){};$.prototype.sync=function(t){t(new f(o.ENOTSUP))},$.prototype.syncSync=function(){throw new f(o.ENOTSUP)},$.prototype.datasync=function(t){this.sync(t)},$.prototype.datasyncSync=function(){return this.syncSync()},$.prototype.chown=function(t,e,n){n(new f(o.ENOTSUP))},$.prototype.chownSync=function(t,e){throw new f(o.ENOTSUP)},$.prototype.chmod=function(t,e){e(new f(o.ENOTSUP))},$.prototype.chmodSync=function(t){throw new f(o.ENOTSUP)},$.prototype.utimes=function(t,e,n){n(new f(o.ENOTSUP))},$.prototype.utimesSync=function(t,e){throw new f(o.ENOTSUP)};var J=function(e){function n(t,n,r,i,o){if(e.call(this),this._pos=0,this._dirty=!1,this._fs=t,this._path=n,this._flag=r,this._stat=i,this._buffer=o||V(),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.getBuffer=function(){return this._buffer},n.prototype.getStats=function(){return this._stat},n.prototype.getFlag=function(){return this._flag},n.prototype.getPath=function(){return this._path},n.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},n.prototype.advancePos=function(t){return this._pos+=t},n.prototype.setPos=function(t){return this._pos=t},n.prototype.sync=function(t){try{this.syncSync(),t()}catch(e){t(e)}},n.prototype.syncSync=function(){throw new f(o.ENOTSUP)},n.prototype.close=function(t){try{this.closeSync(),t()}catch(e){t(e)}},n.prototype.closeSync=function(){throw new f(o.ENOTSUP)},n.prototype.stat=function(t){try{t(null,d.clone(this._stat))}catch(e){t(e)}},n.prototype.statSync=function(){return d.clone(this._stat)},n.prototype.truncate=function(t,e){try{this.truncateSync(t),this._flag.isSynchronous()&&!R.getRootFS().supportsSynch()&&this.sync(e),e()}catch(t){return e(t)}},n.prototype.truncateSync=function(e){if(this._dirty=!0,!this._flag.isWriteable())throw new f(o.EPERM,"File not opened with a writeable mode.");if(this._stat.mtimeMs=Date.now(),e>this._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;t<e.length;t+=1){var n=e[t],r=this.originalData[n];r?this.store.put(n,r,!0):this.store.del(n)}},ct.prototype.stashOldValue=function(t,e){this.originalData.hasOwnProperty(t)||(this.originalData[t]=e)},ct.prototype.markModified=function(t){-1===this.modifiedKeys.indexOf(t)&&(this.modifiedKeys.push(t),this.originalData.hasOwnProperty(t)||(this.originalData[t]=this.store.get(t)))};var ut=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.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(J),ft=function(e){function n(t){e.call(this),this.store=t.store,this.makeRootDirectory()}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.isAvailable=function(){return!0},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!0},n.prototype.empty=function(){this.store.clear(),this.makeRootDirectory()},n.prototype.renameSync=function(e,n){var r=this.store.beginTransaction("readwrite"),i=s.dirname(e),a=s.basename(e),c=s.dirname(n),u=s.basename(n),h=this.findINode(r,i),p=this.getDirListing(r,i,h);if(!p[a])throw f.ENOENT(e);var l,d,y=p[a];if(delete p[a],0===(c+"/").indexOf(e+"/"))throw new f(o.EBUSY,i);if(c===i?(l=h,d=p):(l=this.findINode(r,c),d=this.getDirListing(r,c,l)),d[u]){var g=this.getINode(r,n,d[u]);if(!g.isFile())throw f.EPERM(n);try{r.del(g.id),r.del(d[u])}catch(t){throw r.abort(),t}}d[u]=y;try{r.put(h.id,t.from(JSON.stringify(p)),!0),r.put(l.id,t.from(JSON.stringify(d)),!0)}catch(t){throw r.abort(),t}r.commit()},n.prototype.statSync=function(t,e){return this.findINode(this.store.beginTransaction("readonly"),t).toStats()},n.prototype.createFileSync=function(t,e,n){var r=this.store.beginTransaction("readwrite"),i=V(),o=this.commitNewFile(r,t,p.FILE,n,i);return new ut(this,t,e,o.toStats(),i)},n.prototype.openFileSync=function(t,e){var n=this.store.beginTransaction("readonly"),r=this.findINode(n,t),i=n.get(r.id);if(void 0===i)throw f.ENOENT(t);return new ut(this,t,e,r.toStats(),i)},n.prototype.unlinkSync=function(t){this.removeEntry(t,!1)},n.prototype.rmdirSync=function(t){if(this.readdirSync(t).length>0)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;r<n;r++){var i=e[r];if(i.length<=t.length&&0===t.indexOf(i))return""===(t=t.substr(i.length>1?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<n;r++){var i=e[r];if(i.length>=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<It.length;kt++)for(var Ot=0,Nt=It[kt];Ot<Nt.length;Ot+=1){var Tt=Nt[Ot];bt.prototype[Tt]=St(Tt,!1),bt.prototype[Tt+"Sync"]=St(Tt+"Sync",!0)}var Ft=function(){this._locked=!1,this._waiters=[]};Ft.prototype.lock=function(t){this._locked?this._waiters.push(t):(this._locked=!0,t())},Ft.prototype.unlock=function(){if(!this._locked)throw new Error("unlock of a non-locked mutex");var t=this._waiters.shift();t?b(t):this._locked=!1},Ft.prototype.tryLock=function(){return!this._locked&&(this._locked=!0,!0)},Ft.prototype.isLocked=function(){return this._locked};var Lt=function(t){this._fs=t,this._mu=new Ft};Lt.prototype.getName=function(){return"LockedFS<"+this._fs.getName()+">"},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;c<a.length;c++)i[c]=a.charCodeAt(c);return;case"json":return void(i=JSON.parse(r.responseText))}}},r.send(),s)throw s;return i};function Mt(t){var e=-1;return function(t,e,n){var r=new XMLHttpRequest;r.open("HEAD",e,t),r.onreadystatechange=function(t){if(4===r.readyState){if(200!==r.status)return n(new f(o.EIO,"XHR HEAD error: response returned code "+r.status));try{var e=r.getResponseHeader("Content-Length");return n(null,e?parseInt(e,10):-1)}catch(t){return n(new f(o.EIO,"XHR HEAD error: Could not read content-length."))}}},r.send()}(!1,t,function(t,n){if(t)throw t;e=n}),e}var zt={cache:"no-cache",keepalive:!1,mode:"cors",priority:"high",referrerPolicy:"no-referrer",window:null},jt={cache:"no-cache",keepalive:!1,method:"HEAD",mode:"no-cors",priority:"high",referrerPolicy:"no-referrer",window:null};function Ht(e,n,r){var i;try{i=window.fetch(e,zt)}catch(t){return r(new f(o.EINVAL,t.message))}i.then(function(e){if(!e.ok)return r(new f(o.EIO,"fetch error: response returned code "+e.status));switch(n){case"buffer":e.arrayBuffer().then(function(e){return r(null,t.from(e))}).catch(function(t){return r(new f(o.EIO,t.message))});break;case"json":e.json().then(function(t){return r(null,t)}).catch(function(t){return r(new f(o.EIO,t.message))});break;default:r(new f(o.EINVAL,"Invalid download type: "+n))}}).catch(function(t){return r(new f(o.EIO,t.message))})}function Zt(t,e){window.fetch(t,jt).then(function(t){if(t.ok){var n=t.headers.get("Content-Length");return e(null,n?parseInt(n,10):-1)}return e(new f(o.EIO,"fetch HEAD error: response returned code "+t.status))}).catch(function(t){return e(new f(o.EIO,t.message))})}var Vt=function(){this._index={},this.addPath("/",new Wt)};Vt.fromListing=function(t){var e=new Vt,n=new Wt;e._index["/"]=n;for(var r=[["",t,n]];r.length>0;){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();r<i.length;r+=1){var o=i[r],s=n.getItem(o);Xt(s)&&t(s.getData())}},Vt.prototype.addPath=function(t,e){if(!e)throw new Error("Inode must be specified");if("/"!==t[0])throw new Error("Path must be absolute, got: "+t);if(this._index.hasOwnProperty(t))return this._index[t]===e;var n=this._split_path(t),r=n[0],i=n[1],o=this._index[r];return!(void 0===o&&"/"!==t&&(o=new Wt,!this.addPath(r,o)))&&(!("/"!==t&&!o.addItem(i,e))&&(qt(e)&&(this._index[t]=e),!0))},Vt.prototype.addPathFast=function(t,e){var n=t.lastIndexOf("/"),r=0===n?"/":t.substring(0,n),i=t.substring(n+1),o=this._index[r];return void 0===o&&(o=new Wt,this.addPathFast(r,o)),!!o.addItem(i,e)&&(e.isDir()&&(this._index[t]=e),!0)},Vt.prototype.removePath=function(t){var e=this._split_path(t),n=e[0],r=e[1],i=this._index[n];if(void 0===i)return null;var o=i.remItem(r);if(null===o)return null;if(qt(o)){for(var s=0,a=o.getListing();s<a.length;s+=1){var c=a[s];this.removePath(t+"/"+c)}"/"!==t&&delete this._index[t]}return o},Vt.prototype.ls=function(t){var e=this._index[t];return void 0===e?null:e.getListing()},Vt.prototype.getInode=function(t){var e=this._split_path(t),n=e[0],r=e[1],i=this._index[n];return void 0===i?null:n===t?i:i.getItem(r)},Vt.prototype._split_path=function(t){var e=s.dirname(t);return[e,t.substr(e.length+("/"===e?0:1))]};var Yt=function(t){this.data=t};Yt.prototype.isFile=function(){return!0},Yt.prototype.isDir=function(){return!1},Yt.prototype.getData=function(){return this.data},Yt.prototype.setData=function(t){this.data=t};var Wt=function(t){void 0===t&&(t=null),this.data=t,this._ls={}};function Xt(t){return!!t&&t.isFile()}function qt(t){return!!t&&t.isDir()}Wt.prototype.isFile=function(){return!1},Wt.prototype.isDir=function(){return!0},Wt.prototype.getData=function(){return this.data},Wt.prototype.getStats=function(){return new d(p.DIRECTORY,4096,365)},Wt.prototype.getListing=function(){return Object.keys(this._ls)},Wt.prototype.getItem=function(t){var e=this._ls[t];return e||null},Wt.prototype.addItem=function(t,e){return!(t in this._ls)&&(this._ls[t]=e,!0)},Wt.prototype.remItem=function(t){var e=this._ls[t];return void 0===e?null:(delete this._ls[t],e)};var $t=function(t){function e(e,n){void 0===n&&(n=""),t.call(this),n.length>0&&"/"!==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;r<n;r++){var i=t.charCodeAt(r);if(i>127){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;n<t.length;n++){var r=t[n];e[n]=r>127?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<e;n++)if(101010256===t.readUInt32LE(t.length-n))return new oe(t.slice(t.length-n));throw new f(o.EINVAL,"Invalid ZIP file: Could not locate End of Central Directory signature.")},e._addToIndex=function(t,e){var n=t.fileName();if("/"===n.charAt(0))throw new f(o.EPERM,"Unexpectedly encountered an absolute path in a zip file. Please file a bug.");"/"===n.charAt(n.length-1)&&(n=n.substr(0,n.length-1)),t.isDirectory()?e.addPathFast("/"+n,new Wt(t)):e.addPathFast("/"+n,new Yt(t))},e._computeIndex=function(t,n){try{var r=new Vt,i=e._getEOCD(t);if(i.diskNumber()!==i.cdDiskNumber())return n(new f(o.EINVAL,"ZipFS does not support spanned zip files."));var s=i.cdOffset();if(4294967295===s)return n(new f(o.EINVAL,"ZipFS does not support Zip64."));var a=s+i.cdSize();e._computeIndexResponsive(t,r,s,a,n,[],i)}catch(t){n(t)}},e._computeIndexResponsiveTrampoline=function(t,n,r,i,o,s,a){try{e._computeIndexResponsive(t,n,r,i,o,s,a)}catch(t){o(t)}},e._computeIndexResponsive=function(t,n,r,i,o,s,a){if(r<i){for(var c=0;c++<200&&r<i;){var u=new ie(t,t.slice(r));e._addToIndex(u,n),r+=u.totalSize(),s.push(u)}b(function(){e._computeIndexResponsiveTrampoline(t,n,r,i,o,s,a)})}else o(null,new function(t,e,n,r){this.index=t,this.directoryEntries=e,this.eocd=n,this.data=r}(n,s,a,t))},e.prototype.getName=function(){return e.Name+(""!==this.name?" "+this.name:"")},e.prototype.getCentralDirectoryEntry=function(t){var e=this._index.getInode(t);if(null===e)throw f.ENOENT(t);if(Xt(e))return e.getData();if(qt(e))return e.getData();throw f.EPERM("Invalid inode: "+e)},e.prototype.getCentralDirectoryEntryAt=function(t){var e=this._directoryEntries[t];if(!e)throw new RangeError("Invalid directory index: "+t+".");return e},e.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},e.prototype.getEndOfCentralDirectory=function(){return this._eocd},e.prototype.diskSpace=function(t,e){e(this.data.length,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.statSync=function(t,e){var n,r=this._index.getInode(t);if(null===r)throw f.ENOENT(t);if(Xt(r))n=r.getData().getStats();else{if(!qt(r))throw new f(o.EINVAL,"Invalid inode.");n=r.getStats()}return n},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new f(o.EPERM,t);var r=this._index.getInode(t);if(!r)throw f.ENOENT(t);if(!Xt(r))throw f.EISDIR(t);var i=r.getData(),s=i.getStats();switch(e.pathExistsAction()){case u.THROW_EXCEPTION:case u.TRUNCATE_FILE:throw f.EEXIST(t);case u.NOP:return new K(this,t,e,s,i.getData());default:throw new f(o.EINVAL,"Invalid FileMode object.")}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(e){if(qt(e))return e.getListing();throw f.ENOTDIR(t)}throw f.ENOENT(t)},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}(q);se.Name="ZipFS",se.Options={zipData:{type:"object",description:"The zip file as a Buffer object.",validator:Y},name:{type:"string",optional:!0,description:"The name of the zip file (optional)."}},se.CompressionMethod=Kt,se.RegisterDecompressionMethod(Kt.DEFLATE,function(t,e,n){return M(Gt(t.slice(0,e),{chunkSize:n}))}),se.RegisterDecompressionMethod(Kt.STORED,function(t,e,n){return H(t,0,n)});function ae(t,e,n){return t.toString("ascii",e,e+n).trim()}function ce(t,e,n){if(1===n)return String.fromCharCode(t[e]);for(var r=Math.floor(n/2),i=new Array(r),o=0;o<r;o++){var s=e+(o<<1);i[o]=String.fromCharCode(t[s+1]|t[s]<<8)}return i.join("")}function ue(t,e){var n=parseInt(ae(t,e,4),10),r=parseInt(ae(t,e+4,2),10),i=parseInt(ae(t,e+6,2),10),o=parseInt(ae(t,e+8,2),10),s=parseInt(ae(t,e+10,2),10),a=parseInt(ae(t,e+12,2),10),c=parseInt(ae(t,e+14,2),10);return new Date(n,r,i,o,s,a,100*c)}function fe(t,e){var n=t[e],r=t[e+1],i=t[e+2],o=t[e+3],s=t[e+4],a=t[e+5];return new Date(n,r-1,i,o,s,a)}function he(t,e){var n=t.slice(e),r=new Ee(n);switch(r.signatureWord()){case 17221:return new ve(n);case 20548:return new be(n);case 21328:return new Se(n);case 21332:return new Ie(n);case 17746:return new ke(n);case 17747:return new Oe(n);case 20568:return new Te(n);case 20558:return new Fe(n);case 21324:return new Le(n);case 20045:return new De(n);case 17228:return new Re(n);case 20556:return new Ae(n);case 21061:return new Ue(n);case 21574:return new Pe(n);case 21318:return new Be(n);case 21074:return new Ne(n);default:return r}}function pe(t,e,n,r){n-=4;for(var i=new Array;e<n;){var o=he(t,e),s=o.length();if(0===s)return i;if(e+=s,o instanceof Ie)break;o instanceof ve?i=i.concat(o.getEntries(r)):i.push(o)}return i}var le=function(t){this._data=t};le.prototype.type=function(){return this._data[0]},le.prototype.standardIdentifier=function(){return ae(this._data,1,5)},le.prototype.version=function(){return this._data[6]},le.prototype.data=function(){return this._data.slice(7,2048)};var de=function(t){function e(e){t.call(this,e),this._root=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.systemIdentifier=function(){return this._getString32(8)},e.prototype.volumeIdentifier=function(){return this._getString32(40)},e.prototype.volumeSpaceSize=function(){return this._data.readUInt32LE(80)},e.prototype.volumeSetSize=function(){return this._data.readUInt16LE(120)},e.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(124)},e.prototype.logicalBlockSize=function(){return this._data.readUInt16LE(128)},e.prototype.pathTableSize=function(){return this._data.readUInt32LE(132)},e.prototype.locationOfTypeLPathTable=function(){return this._data.readUInt32LE(140)},e.prototype.locationOfOptionalTypeLPathTable=function(){return this._data.readUInt32LE(144)},e.prototype.locationOfTypeMPathTable=function(){return this._data.readUInt32BE(148)},e.prototype.locationOfOptionalTypeMPathTable=function(){return this._data.readUInt32BE(152)},e.prototype.rootDirectoryEntry=function(t){return null===this._root&&(this._root=this._constructRootDirectoryRecord(this._data.slice(156)),this._root.rootCheckForRockRidge(t)),this._root},e.prototype.volumeSetIdentifier=function(){return this._getString(190,128)},e.prototype.publisherIdentifier=function(){return this._getString(318,128)},e.prototype.dataPreparerIdentifier=function(){return this._getString(446,128)},e.prototype.applicationIdentifier=function(){return this._getString(574,128)},e.prototype.copyrightFileIdentifier=function(){return this._getString(702,38)},e.prototype.abstractFileIdentifier=function(){return this._getString(740,36)},e.prototype.bibliographicFileIdentifier=function(){return this._getString(776,37)},e.prototype.volumeCreationDate=function(){return ue(this._data,813)},e.prototype.volumeModificationDate=function(){return ue(this._data,830)},e.prototype.volumeExpirationDate=function(){return ue(this._data,847)},e.prototype.volumeEffectiveDate=function(){return ue(this._data,864)},e.prototype.fileStructureVersion=function(){return this._data[881]},e.prototype.applicationUsed=function(){return this._data.slice(883,1395)},e.prototype.reserved=function(){return this._data.slice(1395,2048)},e.prototype._getString32=function(t){return this._getString(t,32)},e}(le),ye=function(t){function e(e){if(t.call(this,e),1!==this.type())throw new f(o.EIO,"Invalid primary volume descriptor.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.name=function(){return"ISO9660"},e.prototype._constructRootDirectoryRecord=function(t){return new we(t,-1)},e.prototype._getString=function(t,e){return this._getString(t,e)},e}(de),ge=function(t){function e(e){if(t.call(this,e),2!==this.type())throw new f(o.EIO,"Invalid supplementary volume descriptor.");var n=this.escapeSequence(),r=n[2];if(37!==n[0]||47!==n[1]||64!==r&&67!==r&&69!==r)throw new f(o.EIO,"Unrecognized escape sequence for SupplementaryVolumeDescriptor: "+n.toString())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.name=function(){return"Joliet"},e.prototype.escapeSequence=function(){return this._data.slice(88,120)},e.prototype._constructRootDirectoryRecord=function(t){return new _e(t,-1)},e.prototype._getString=function(t,e){return ce(this._data,t,e)},e}(de),me=function(t,e){this._suEntries=null,this._fileOrDir=null,this._data=t,this._rockRidgeOffset=e};me.prototype.hasRockRidge=function(){return this._rockRidgeOffset>-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;i<o.length;i+=1){var s=o[i];if(s instanceof Le){for(var a=0,c=s.componentRecords();a<c.length;a+=1){var u=c[a],f=u.flags();2&f?e+="./":4&f?e+="../":8&f?e+="/":(e+=u.content(r),1&f||(e+="/"))}if(!s.continueFlag())break}}return e.length>1&&"/"===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;i<o.length;i+=1){var s=o[i];if(n+=s.name(r),!(1&s.flags()))break}return n},me.prototype._constructSUEntries=function(t){var e=33+this._data[32];e%2==1&&e++,e+=this._rockRidgeOffset,this._suEntries=pe(this._data,e,this.length(),t)},me.prototype._getRockRidgeOffset=function(t){this._rockRidgeOffset=0;var e=this.getSUEntries(t);if(e.length>0){var n=e[0];if(n instanceof Se&&n.checkBytesPass())for(var r=1;r<e.length;r++){var i=e[r];if(i instanceof Ne||i instanceof ke&&"IEEE_P1282"===i.extensionIdentifier())return n.bytesSkipped()}}return this._rockRidgeOffset=-1,-1};var we=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._getString=function(t,e){return ae(this._data,t,e)},e.prototype._constructDirectory=function(t){return new Me(this,t)},e.prototype._getGetString=function(){return ae},e}(me),_e=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._getString=function(t,e){return ce(this._data,t,e)},e.prototype._constructDirectory=function(t){return new ze(this,t)},e.prototype._getGetString=function(){return ce},e}(me),Ee=function(t){this._data=t};Ee.prototype.signatureWord=function(){return this._data.readUInt16BE(0)},Ee.prototype.signatureWordString=function(){return ae(this._data,0,2)},Ee.prototype.length=function(){return this._data[2]},Ee.prototype.suVersion=function(){return this._data[3]};var ve=function(t){function e(e){t.call(this,e),this._entries=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.continuationLba=function(){return this._data.readUInt32LE(4)},e.prototype.continuationLbaOffset=function(){return this._data.readUInt32LE(12)},e.prototype.continuationLength=function(){return this._data.readUInt32LE(20)},e.prototype.getEntries=function(t){if(!this._entries){var e=2048*this.continuationLba()+this.continuationLbaOffset();this._entries=pe(t,e,this.continuationLength(),t)}return this._entries},e}(Ee),be=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}(Ee),Se=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.prototype.checkBytesPass=function(){return 190===this._data[4]&&239===this._data[5]},e.prototype.bytesSkipped=function(){return this._data[6]},e}(Ee),Ie=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}(Ee),ke=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.prototype.identifierLength=function(){return this._data[4]},e.prototype.descriptorLength=function(){return this._data[5]},e.prototype.sourceLength=function(){return this._data[6]},e.prototype.extensionVersion=function(){return this._data[7]},e.prototype.extensionIdentifier=function(){return ae(this._data,8,this.identifierLength())},e.prototype.extensionDescriptor=function(){return ae(this._data,8+this.identifierLength(),this.descriptorLength())},e.prototype.extensionSource=function(){return ae(this._data,8+this.identifierLength()+this.descriptorLength(),this.sourceLength())},e}(Ee),Oe=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.prototype.extensionSequence=function(){return this._data[4]},e}(Ee),Ne=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}(Ee),Te=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.prototype.mode=function(){return this._data.readUInt32LE(4)},e.prototype.fileLinks=function(){return this._data.readUInt32LE(12)},e.prototype.uid=function(){return this._data.readUInt32LE(20)},e.prototype.gid=function(){return this._data.readUInt32LE(28)},e.prototype.inode=function(){return this._data.readUInt32LE(36)},e}(Ee),Fe=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.prototype.devTHigh=function(){return this._data.readUInt32LE(4)},e.prototype.devTLow=function(){return this._data.readUInt32LE(12)},e}(Ee),Le=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.prototype.flags=function(){return this._data[4]},e.prototype.continueFlag=function(){return 1&this.flags()},e.prototype.componentRecords=function(){for(var t=new Array,e=5;e<this.length();){var n=new xe(this._data.slice(e));t.push(n),e+=n.length()}return t},e}(Ee),xe=function(t){this._data=t};xe.prototype.flags=function(){return this._data[0]},xe.prototype.length=function(){return 2+this.componentLength()},xe.prototype.componentLength=function(){return this._data[1]},xe.prototype.content=function(t){return t(this._data,2,this.componentLength())};var De=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.prototype.flags=function(){return this._data[4]},e.prototype.name=function(t){return t(this._data,5,this.length()-5)},e}(Ee),Re=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.prototype.childDirectoryLba=function(){return this._data.readUInt32LE(4)},e}(Ee),Ae=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.prototype.parentDirectoryLba=function(){return this._data.readUInt32LE(4)},e}(Ee),Ue=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}(Ee),Pe=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.prototype.flags=function(){return this._data[4]},e.prototype.creation=function(){return 1&this.flags()?this._longFormDates()?ue(this._data,5):fe(this._data,5):null},e.prototype.modify=function(){if(2&this.flags()){var t=1&this.flags()?1:0;return this._longFormDates()?ue(this._data,5+17*t):fe(this._data,5+7*t)}return null},e.prototype.access=function(){if(4&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,this._longFormDates()?ue(this._data,5+17*t):fe(this._data,5+7*t)}return null},e.prototype.backup=function(){if(16&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,t+=4&this.flags()?1:0,this._longFormDates()?ue(this._data,5+17*t):fe(this._data,5+7*t)}return null},e.prototype.expiration=function(){if(32&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,t+=4&this.flags()?1:0,t+=16&this.flags()?1:0,this._longFormDates()?ue(this._data,5+17*t):fe(this._data,5+7*t)}return null},e.prototype.effective=function(){if(64&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,t+=4&this.flags()?1:0,t+=16&this.flags()?1:0,t+=32&this.flags()?1:0,this._longFormDates()?ue(this._data,5+17*t):fe(this._data,5+7*t)}return null},e.prototype._longFormDates=function(){return!!this.flags()},e}(Ee),Be=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.prototype.virtualSizeHigh=function(){return this._data.readUInt32LE(4)},e.prototype.virtualSizeLow=function(){return this._data.readUInt32LE(12)},e.prototype.tableDepth=function(){return this._data[20]},e}(Ee),Ce=function(t,e){this._fileList=[],this._fileMap={},this._record=t;var n=t.lba(),r=n+t.dataLength();2&t.fileFlags()||(n=2048*t.getSUEntries(e).filter(function(t){return t instanceof Re})[0].childDirectoryLba(),r=1/0);for(;n<r;){if(0!==e[n]){var i=this._constructDirectoryRecord(e.slice(n)),o=i.fileName(e);"\0"!==o&&""!==o?i.hasRockRidge()&&0!==i.getSUEntries(e).filter(function(t){return t instanceof Ue}).length||(this._fileMap[o]=i,this._fileList.push(o)):r===1/0&&(r=n+i.dataLength()),n+=i.length()}else n++}};Ce.prototype.getRecord=function(t){return this._fileMap[t]},Ce.prototype.getFileList=function(){return this._fileList},Ce.prototype.getDotEntry=function(t){return this._constructDirectoryRecord(t.slice(this._record.lba()))};var Me=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._constructDirectoryRecord=function(t){return new we(t,this._record.getRockRidgeOffset())},e}(Ce),ze=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._constructDirectoryRecord=function(t){return new _e(t,this._record.getRockRidgeOffset())},e}(Ce),je=function(t){function e(e,n){var r=this;void 0===n&&(n=""),t.call(this),this._data=e;for(var i=!1,s=32768,a=new Array;!i;){var c=e.slice(s);switch(new le(c).type()){case 1:a.push(new ye(c));break;case 2:a.push(new ge(c));break;case 255:i=!0}s+=2048}if(0===a.length)throw new f(o.EIO,"Unable to find a suitable volume descriptor.");a.forEach(function(t){r._pvd&&2===r._pvd.type()||(r._pvd=t)}),this._root=this._pvd.rootDirectoryEntry(e),this._name=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){try{n(null,new e(t.data,t.name))}catch(t){n(t)}},e.isAvailable=function(){return!0},e.prototype.getName=function(){var t="IsoFS"+this._name+(this._pvd?"-"+this._pvd.name():"");return this._root&&this._root.hasRockRidge()&&(t+="-RockRidge"),t},e.prototype.diskSpace=function(t,e){e(this._data.length,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.statSync=function(t,e){var n=this._getDirectoryRecord(t);if(null===n)throw f.ENOENT(t);return this._getStats(t,n)},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new f(o.EPERM,t);var r=this._getDirectoryRecord(t);if(!r)throw f.ENOENT(t);if(r.isSymlink(this._data))return this.openSync(s.resolve(t,r.getSymlinkPath(this._data)),e,n);if(r.isDirectory(this._data))throw f.EISDIR(t);var i=r.getFile(this._data),a=this._getStats(t,r);switch(e.pathExistsAction()){case u.THROW_EXCEPTION:case u.TRUNCATE_FILE:throw f.EEXIST(t);case u.NOP:return new K(this,t,e,a,i);default:throw new f(o.EINVAL,"Invalid FileMode object.")}},e.prototype.readdirSync=function(t){var e=this._getDirectoryRecord(t);if(e){if(e.isDirectory(this._data))return e.getDirectory(this._data).getFileList().slice(0);throw f.ENOTDIR(t)}throw f.ENOENT(t)},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._getDirectoryRecord=function(t){if("/"===t)return this._root;for(var e=t.split("/").slice(1),n=this._root,r=0,i=e;r<i.length;r+=1){var o=i[r];if(!n.isDirectory(this._data))return null;if(!(n=n.getDirectory(this._data).getRecord(o)))return null}return n},e.prototype._getStats=function(t,e){if(e.isSymlink(this._data)){var n=s.resolve(t,e.getSymlinkPath(this._data)),r=this._getDirectoryRecord(n);return r?this._getStats(n,r):null}var i=e.dataLength(),o=365,a=e.recordingDate().getTime(),c=a,u=a,f=a;if(e.hasRockRidge())for(var h=0,l=e.getSUEntries(this._data);h<l.length;h+=1){var y=l[h];if(y instanceof Te)o=y.mode();else if(y instanceof Pe){var g=y.flags();4&g&&(c=y.access().getTime()),2&g&&(u=y.modify().getTime()),1&g&&(f=y.creation().getTime())}}return o&=365,new d(e.isDirectory(this._data)?p.DIRECTORY:p.FILE,i,o,c,u,f)},e}(q);je.Name="IsoFS",je.Options={data:{type:"object",description:"The ISO file in a buffer",validator:Y}};var He={FileSystemAccess:tt,InMemory:dt,IndexedDB:vt,IsoFS:je,MountableFileSystem:bt,OverlayFS:Pt,HTTPRequest:$t,ZipFS:se};function Ze(t){switch(t){case"fs":return R;case"path":return s;case"buffer":return a;case"process":return i;case"bfs_utils":return W;default:return He[t]}}function Ve(t){return R.initialize(t)}function Ye(t,e){var n=t.fs;if(!n)return e(new f(o.EPERM,'Missing "fs" property on configuration object.'));var r=t.options,i=0,s=!1;function a(){if(!s){s=!0;var t=He[n];t?t.Create(r,e):e(new f(o.EPERM,"File system "+n+" is not available in BrowserFS."))}}if(null!==r&&"object"==typeof r){var c=!1;Object.keys(r).filter(function(t){return"fs"!==t}).forEach(function(t){var n=r[t];null!==n&&"object"==typeof n&&n.fs&&(i++,Ye(n,function(n,o){if(i--,n){if(s)return;s=!0,e(n)}else r[t]=o,0===i&&c&&a()}))}),c=!0}0===i&&a()}i.initializeTTYs&&i.initializeTTYs(),e.install=function(e){e.Buffer=t,e.process=i;var n=e.require?e.require:null;e.require=function(t){var e=Ze(t);return e||n.apply(null,Array.prototype.slice.call(arguments,0))}},e.registerFileSystem=function(t,e){He[t]=e},e.BFSRequire=Ze,e.initialize=Ve,e.configure=function(t,e){Ye(t,function(t,n){n?(Ve(n),e()):e(t)})},e.getFileSystem=Ye,e.FileSystem=He,e.Errors=h}).call(this,n(4),n(7),n(2))},function(t,e,n){t.exports=n(1).Buffer},function(t,e,n){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=u(t),s=r[0],a=r[1],c=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),f=0,h=a>0?s-4:s;for(n=0;n<h;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],c[f++]=e>>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;s<a;s+=16383)o.push(h(t,s,s+16383>a?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;a<c;++a)r[a]=s[a],i[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)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<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(f(r));return i.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>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<<u)-1,h=f>>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<<i|a,u+=i;u>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<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}e.resolve=function(){for(var e="",r=!1,i=arguments.length-1;i>=-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<t.length&&""===t[e];e++);for(var n=t.length-1;n>=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<s;c++)if(i[c]!==o[c]){a=c;break}var u=[];for(c=a;c<i.length;c++)u.push("..");return(u=u.concat(o.slice(a))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=i(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},e.basename=function(t,e){var n=i(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){return i(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,n(2))},function(t,e,n){"use strict";const r=n(10),i=n(15),o=n(16),s=n(17),a=n(18),c=n(19),u=Object.prototype.toString,{Z_NO_FLUSH:f,Z_FINISH:h,Z_OK:p,Z_STREAM_END:l,Z_NEED_DICT:d,Z_STREAM_ERROR:y,Z_DATA_ERROR:g,Z_MEM_ERROR:m}=n(0);function w(t){this.options=i.assign({chunkSize:65536,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=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.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),r>=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.whave<o.wsize&&(o.whave+=i))),0};t.exports.inflateReset=b,t.exports.inflateReset2=S,t.exports.inflateResetKeep=v,t.exports.inflateInit=(t=>I(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++]<<L,L+=8}if(2&n.wrap&&35615===N){0===n.wbits&&(n.wbits=15),n.check=0,Y[0]=255&N,Y[1]=N>>>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<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=512&N?16189:16191,N=0,L=0;break;case 16181:for(;L<16;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(n.flags=N,(255&n.flags)!==m){t.msg="unknown compression method",n.mode=w;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=w;break}n.head&&(n.head.text=N>>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++]<<L,L+=8}n.head&&(n.head.time=N),512&n.flags&&4&n.wrap&&(Y[0]=255&N,Y[1]=N>>>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++]<<L,L+=8}n.head&&(n.head.xflags=255&N,n.head.os=N>>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++]<<L,L+=8}n.length=N,n.head&&(n.head.extra_len=N),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}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<k);if(512&n.flags&&4&n.wrap&&(n.check=i(n.check,v,R,S)),k-=R,S+=R,H)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===k)break t;R=0;do{H=v[S+R++],n.head&&H&&n.length<65536&&(n.head.comment+=String.fromCharCode(H))}while(H&&R<k);if(512&n.flags&&4&n.wrap&&(n.check=i(n.check,v,R,S)),k-=R,S+=R,H)break t}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;L<16;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(4&n.wrap&&N!==(65535&n.check)){t.msg="header crc mismatch",n.mode=w;break}N=0,L=0}n.head&&(n.head.hcrc=n.flags>>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++]<<L,L+=8}t.adler=n.check=_(N),N=0,L=0,n.mode=16190;case 16190:if(0===n.havedict)return t.next_out=I,t.avail_out=O,t.next_in=S,t.avail_in=k,n.hold=N,n.bits=L,p;t.adler=n.check=1,n.mode=16191;case 16191:if(e===c||e===u)break t;case 16192:if(n.last){N>>>=7&L,L-=7&L,n.mode=16206;break}for(;L<3;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}switch(n.last=1&N,L-=1,3&(N>>>=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++]<<L,L+=8}if((65535&N)!=(N>>>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++]<<L,L+=8}if(n.nlen=257+(31&N),N>>>=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<n.ncode;){for(;L<3;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}n.lens[q[n.have++]]=7&N,N>>>=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<n.nlen+n.ndist;){for(;B=(V=n.lencode[N&(1<<n.lenbits)-1])>>>16&255,C=65535&V,!((P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(C<16)N>>>=P,L-=P,n.lens[n.have++]=C;else{if(16===C){for(X=P+2;L<X;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(N>>>=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<X;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}L-=P,H=0,R=3+(7&(N>>>=P)),N>>>=3,L-=3}else{for(X=P+7;L<X;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}L-=P,H=0,R=11+(127&(N>>>=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<<n.lenbits)-1])>>>16&255,C=65535&V,!((P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(B&&0==(240&B)){for(M=P,z=B,j=C;B=(V=n.lencode[j+((N&(1<<M+z)-1)>>M)])>>>16&255,C=65535&V,!(M+(P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}N>>>=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<X;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}n.length+=N&(1<<n.extra)-1,N>>>=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<<n.distbits)-1])>>>16&255,C=65535&V,!((P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(0==(240&B)){for(M=P,z=B,j=C;B=(V=n.distcode[j+((N&(1<<M+z)-1)>>M)])>>>16&255,C=65535&V,!(M+(P=V>>>24)<=L);){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}N>>>=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<X;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}n.offset+=N&(1<<n.extra)-1,N>>>=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++]<<L,L+=8}if(D-=O,t.total_out+=D,n.total+=D,4&n.wrap&&D&&(t.adler=n.check=n.flags?i(n.check,b,D,I-D):r(n.check,b,D,I-D)),D=O,4&n.wrap&&(n.flags?N:_(N))!==n.check){t.msg="incorrect data check",n.mode=w;break}N=0,L=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;L<32;){if(0===k)break t;k--,N+=v[S++]<<L,L+=8}if(4&n.wrap&&N!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=w;break}N=0,L=0}n.mode=16208;case 16208:Z=h;break t;case w:Z=d;break t;case 16210:return y;case 16211:default:return l}return t.next_out=I,t.avail_out=O,t.next_in=S,t.avail_in=k,n.hold=N,n.bits=L,(n.wsize||D!==t.avail_out&&n.mode<w&&(n.mode<16206||e!==a))&&F(t,t.output,t.next_out,D-t.avail_out)?(n.mode=16210,y):(x-=t.avail_in,D-=t.avail_out,t.total_in+=x,t.total_out+=D,n.total+=D,4&n.wrap&&D&&(t.adler=n.check=n.flags?i(n.check,b,D,t.next_out-D):r(n.check,b,D,t.next_out-D)),t.data_type=n.bits+(n.last?64:0)+(16191===n.mode?128:0)+(16199===n.mode||16194===n.mode?256:0),(0===x&&0===D||e===a)&&Z===f&&(Z=g),Z)}),t.exports.inflateEnd=(t=>{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<s;n++)t=t>>>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<<O.lenbits)-1,m=(1<<O.distbits)-1;t:do{l<15&&(p+=I[n++]<<l,l+=8,p+=I[n++]<<l,l+=8),w=d[p&g];e:for(;;){if(p>>>=_=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+=8),E+=p&(1<<_)-1,p>>>=_,l-=_),l<15&&(p+=I[n++]<<l,l+=8,p+=I[n++]<<l,l+=8),w=y[p&m];n:for(;;){if(p>>>=_=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++]<<l,(l+=8)<_&&(p+=I[n++]<<l,l+=8)),(v+=p&(1<<_)-1)>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-_,_<E){E-=_;do{k[i++]=h[b++]}while(--_);b=i-v,S=k}}else if(f<_){if(b+=c+f-_,(_-=f)<E){E-=_;do{k[i++]=h[b++]}while(--_);if(b=0,f<E){E-=_=f;do{k[i++]=h[b++]}while(--_);b=i-v,S=k}}}else if(b+=f-_,_<E){E-=_;do{k[i++]=h[b++]}while(--_);b=i-v,S=k}for(;E>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<r&&i<s);n-=E=l>>3,p&=(1<<(l-=E<<3))-1,t.next_in=n,t.next_out=i,t.avail_in=n<r?r-n+5:5-(n-r),t.avail_out=i<s?s-i+257:257-(i-s),O.hold=p,O.bits=l}},function(t,e,n){"use strict";const r=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),i=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),o=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),s=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);t.exports=((t,e,n,a,c,u,f,h)=>{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<a;E++)L[e[n+E]]++;for(S=p,b=15;b>=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;v<b&&0===L[v];v++);for(S<v&&(S=v),O=1,_=1;_<=15;_++)if(O<<=1,(O-=L[_])<0)return-1;if(O>0&&(0===t||1!==b))return-1;for(x[1]=0,_=1;_<15;_++)x[_+1]=x[_]+L[_];for(E=0;E<a;E++)0!==e[n+E]&&(f[x[e[n+E]]++]=E);if(0===t?(F=U=f,w=20):1===t?(F=r,U=i,w=257):(F=o,U=s,w=0),T=0,E=0,_=v,m=u,I=S,k=0,y=-1,g=(N=1<<S)-1,1===t&&N>852||2===t&&N>592)return 1;for(;;){D=_-k,f[E]+1<w?(R=0,A=f[E]):f[E]>=w?(R=U[f[E]-w],A=F[f[E]-w]):(R=96,A=0),l=1<<_-k,v=d=1<<I;do{c[m+(T>>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+k<b&&!((O-=L[I+k])<=0);)I++,O<<=1;if(N+=1<<I,1===t&&N>852||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<r;n++)e+=t[n].length;const n=new Uint8Array(e);for(let e=0,r=0,i=t.length;e<i;e++){let i=t[e];n.set(i,r),r+=i.length}return n})},function(t,e,n){"use strict";let r=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){r=!1}const i=new Uint8Array(256);for(let t=0;t<256;t++)i[t]=t>=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<s;i++)55296==(64512&(n=t.charCodeAt(i)))&&i+1<s&&56320==(64512&(r=t.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(r-56320),i++),a+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(a),o=0,i=0;o<a;i++)55296==(64512&(n=t.charCodeAt(i)))&&i+1<s&&56320==(64512&(r=t.charCodeAt(i+1)))&&(n=65536+(n-55296<<10)+(r-56320),i++),n<128?e[o++]=n:n<2048?(e[o++]=192|n>>>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;o<n;){let e=t[o++];if(e<128){a[s++]=e;continue}let r=i[e];if(r>4)a[s++]=65533,o+=r-1;else{for(e&=2===r?31:3===r?15:7;r>1&&o<n;)e=e<<6|63&t[o++],r--;r>1?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;r++)n+=String.fromCharCode(t[r]);return n})(a,s)}),t.exports.utf8border=((t,e)=>{(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}}])});