!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=19)}([function(t,e,n){"use strict";var r=n(6),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=h;var o=Object.create(n(3));o.inherits=n(1);var s=n(14),a=n(12);o.inherits(h,s);for(var c=i(a.prototype),u=0;u0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,function(t){console&&console.warn&&console.warn(t)}(a)}return t}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[t];if(void 0===c)return!1;if("function"==typeof c)o(c,this,e);else{var u=c.length,f=y(c,u);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s * @license MIT */var r=n(20),i=n(21);e.Buffer=a,e.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function s(t){if(t>o)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(t)}return c(t,e,n)}function c(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return B(t)||t&&B(t.buffer)?function(t,e,n){if(e<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function p(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(r)return M(t).length;e=(""+e).toLowerCase(),r=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(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),z(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=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:g(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):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var 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){var f=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){for(var h=!0,l=0;li&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function E(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);for(var r=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,h=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=h}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);var n="",r=0;for(;rthis.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 N(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return F(this,e,n);case"base64":return E(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},a.prototype.compare=function(t,e,n,r,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");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;for(var o=i-r,s=n-e,c=Math.min(o,s),u=this.slice(r,i),f=t.slice(e,n),h=0;h>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var 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");for(var o=!1;;)switch(r){case"hex":return _(this,t,e,n);case"utf8":case"utf-8":return m(this,t,e,n);case"ascii":return w(this,t,e,n);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}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;function I(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,n,r,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function x(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 D(t,e,n,r,o){return e=+e,n>>>=0,o||x(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function A(t,e,n,r,o){return e=+e,n>>>=0,o||x(t,0,n,8),i.write(t,e,n,r,52,8),n+8}a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o>>=0,e>>>=0,n||R(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},a.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||R(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},a.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||L(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r)||L(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},a.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||L(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},a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||L(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},a.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);L(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+n},a.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);L(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||L(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},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||L(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},a.prototype.writeFloatLE=function(t,e,n){return D(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return D(this,t,e,!1,n)},a.prototype.writeDoubleLE=function(t,e,n){return A(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return A(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,r){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,r),e);return i},a.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&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var i=t.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&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 U(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(P,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function j(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function B(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function z(t){return t!=t}},function(t,e,n){(e=t.exports=n(14)).Stream=e,e.Readable=e,e.Writable=n(12),e.Duplex=n(0),e.Transform=n(18),e.PassThrough=n(30)},function(t,e,n){"use strict";(function(e,r){var i=n(6);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=_;var s,a=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?setImmediate:i.nextTick;_.WritableState=g;var c=Object.create(n(3));c.inherits=n(1);var u={deprecate:n(29)},f=n(15),h=n(7).Buffer,l=r.Uint8Array||function(){};var p,d=n(16);function y(){}function g(t,e){s=s||n(0),t=t||{};var r=e instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var c=t.highWaterMark,u=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:r&&(u||0===u)?u:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(E,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(o(r),t._writableState.errorEmitted=!0,t.emit("error",r),E(t,e))}(t,n,r,e,o);else{var s=b(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||v(t,n),r?a(w,t,n,s,o):w(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(t){if(s=s||n(0),!(p.call(_,this)||this instanceof s))return new _(t);this._writableState=new g(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),f.call(this)}function m(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),E(t,e)}function v(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,m(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,f=n.encoding,h=n.callback;if(m(t,e,!1,e.objectMode?1:u.length,u,f,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function b(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final(function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),E(t,e)})}function E(t,e){var n=b(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,i.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(_,f),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:u.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===_&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(t,e,n){var r=this._writableState,o=!1,s=!r.objectMode&&function(t){return h.isBuffer(t)||t instanceof l}(t);return s&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=y),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),i.nextTick(e,n)}(this,n):(s||function(t,e,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),i.nextTick(r,s),o=!1),o}(this,r,t,n))&&(r.pendingcb++,o=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var c=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!==t&&void 0!==t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,E(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),_.prototype.destroy=d.destroy,_.prototype._undestroy=d.undestroy,_.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(2),n(4))},function(t,e,n){"use strict";(function(e){var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var r=function(){function t(){}return t.normalize=function(e){""===e&&(e=".");for(var n=e.charAt(0)===t.sep,r=(e=t._removeDuplicateSeps(e)).split(t.sep),i=[],o=0;o0&&".."!==i[0])?i.pop():i.push(s))}if(!n&&i.length<2)switch(i.length){case 1:""===i[0]&&i.unshift(".");break;default:i.push(".")}return e=i.join(t.sep),n&&e.charAt(0)!==t.sep&&(e=t.sep+e),e},t.join=function(){for(var e=[],n=0;n1&&a.charAt(a.length-1)===t.sep)return a.substr(0,a.length-1);if(a.charAt(0)!==t.sep){"."!==a.charAt(0)||1!==a.length&&a.charAt(1)!==t.sep||(a=1===a.length?"":a.substr(2));var c=e.cwd();a=""!==a?this.normalize(c+("/"!==c?t.sep:"")+a):c}return a},t.relative=function(e,n){var r;e=t.resolve(e),n=t.resolve(n);var i=e.split(t.sep),o=n.split(t.sep);o.shift(),i.shift();var s=0,a=[];for(r=0;ri.length&&(s=i.length);var c="";for(r=0;r1&&c.charAt(c.length-1)===t.sep&&(c=c.substr(0,c.length-1)),c},t.dirname=function(e){var n=(e=t._removeDuplicateSeps(e)).charAt(0)===t.sep,r=e.split(t.sep);return""===r.pop()&&r.length>0&&r.pop(),r.length>1||1===r.length&&!n?r.join(t.sep):n?t.sep:"."},t.basename=function(e,n){if(void 0===n&&(n=""),""===e)return e;var r=(e=t.normalize(e)).split(t.sep),i=r[r.length-1];if(""===i&&r.length>1)return r[r.length-2];if(n.length>0&&i.substr(i.length-n.length)===n)return i.substr(0,i.length-n.length);return i},t.extname=function(e){var n=(e=t.normalize(e)).split(t.sep);if(""===(e=n.pop())&&n.length>0&&(e=n.pop()),".."===e)return"";var r=e.lastIndexOf(".");return-1===r||0===r?"":e.substr(r)},t.isAbsolute=function(e){return e.length>0&&e.charAt(0)===t.sep},t._makeLong=function(t){return t},t.parse=function(t){var e=function(t){var e=n.exec(t);return e.shift(),e}(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}},t.format=function(e){if(null===e||"object"!=typeof e)throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof e);if("string"!=typeof(e.root||""))throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof e.root);return(e.dir?e.dir+t.sep:"")+(e.base||"")},t._removeDuplicateSeps=function(t){return t=t.replace(this._replaceRegex,this.sep)},t.sep="/",t._replaceRegex=new RegExp("//+","g"),t.delimiter=":",t.posix=t,t.win32=t,t}();t.exports=r}).call(this,n(2))},function(t,e,n){"use strict";(function(e,r){var i=n(6);t.exports=w;var o,s=n(25);w.ReadableState=m;n(5).EventEmitter;var a=function(t,e){return t.listeners(e).length},c=n(15),u=n(7).Buffer,f=e.Uint8Array||function(){};var h=Object.create(n(3));h.inherits=n(1);var l=n(26),p=void 0;p=l&&l.debuglog?l.debuglog("stream"):function(){};var d,y=n(27),g=n(16);h.inherits(w,c);var _=["error","close","destroy","pause","resume"];function m(t,e){o=o||n(0),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=n(17).StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function w(t){if(o=o||n(0),!(this instanceof w))return new w(t);this._readableState=new m(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),c.call(this)}function v(t,e,n,r,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,k(t)}(t,s)):(i||(o=function(t,e){var n;(function(t){return u.isBuffer(t)||t instanceof f})(e)||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===u.prototype||(e=function(t){return u.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):b(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?b(t,s,e,!1):I(t,s)):b(t,s,e,!1))):r||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=S?t=S:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function k(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(O,t):O(t))}function O(t){p("emit readable"),t.emit("readable"),R(t)}function I(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(F,t,e))}function F(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=u.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function x(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(D,e,t))}function D(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function A(t,e){for(var n=0,r=t.length;n=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?x(this):k(this),null;if(0===(t=E(t,e))&&e.ended)return 0===e.length&&x(this),null;var r,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t0?L(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&x(this)),null!==r&&this.emit("data",r),r},w.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},w.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,e);var c=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?f:w;function u(e,r){p("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),t.removeListener("close",_),t.removeListener("finish",m),t.removeListener("drain",h),t.removeListener("error",g),t.removeListener("unpipe",u),n.removeListener("end",f),n.removeListener("end",w),n.removeListener("data",y),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function f(){p("onend"),t.end()}o.endEmitted?i.nextTick(c):n.once("end",c),t.on("unpipe",u);var h=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,R(t))}}(n);t.on("drain",h);var l=!1;var d=!1;function y(e){p("ondata"),d=!1,!1!==t.write(e)||d||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==A(o.pipes,t))&&!l&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function g(e){p("onerror",e),w(),t.removeListener("error",g),0===a(t,"error")&&t.emit("error",e)}function _(){t.removeListener("finish",m),w()}function m(){p("onfinish"),t.removeListener("close",_),w()}function w(){p("unpipe"),n.unpipe(t)}return n.on("data",y),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",g),t.once("close",_),t.once("finish",m),t.emit("pipe",n),o.flowing||(p("pipe resume"),n.resume()),t},w.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n),this);if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function f(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(t.lastNeed=i-1),i;if(--r=0)return i>0&&(t.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=o;var r=n(0),i=Object.create(n(3));function o(t){if(!(this instanceof o))return new o(t);r.call(this,t),this._transformState={afterTransform:function(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length0))return v.shift()()};w.addEventListener?w.addEventListener("message",b,!0):w.attachEvent("onmessage",b)}else if(w.MessageChannel){var S=new w.MessageChannel;S.port1.onmessage=function(t){if(v.length>0)return v.shift()()},_=function(t){v.push(t),S.port2.postMessage("")}}else _=function(t){return setTimeout(t,0)}}var E=_,k=function(t,e){return t};function O(t,e){if("function"!=typeof t)throw new Error("Callback must be a function.");var n=k(t,e);switch(e){case 1:return function(t){E(function(){return n(t)})};case 2:return function(t,e){E(function(){return n(t,e)})};case 3:return function(t,e,r){E(function(){return n(t,e,r)})};default:throw new Error("Invalid invocation of wrapCb.")}}function I(t){if(t)return t;throw new h(s.EIO,"Initialize BrowserFS with a file system using BrowserFS.initialize(filesystem)")}function F(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 h(s.EINVAL,"Invalid time.")}function T(t){if(t.indexOf("\0")>=0)throw new h(s.EINVAL,"Path must be a string without null bytes.");if(""===t)throw new h(s.EINVAL,"Path must not be empty.");return a.resolve(t)}function R(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:F(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 h(s.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=O(n,1);try{I(this.root).rename(T(t),T(e),r)}catch(t){r(t)}},x.prototype.renameSync=function(t,e){I(this.root).renameSync(T(t),T(e))},x.prototype.exists=function(t,e){void 0===e&&(e=L);var n=O(e,1);try{return I(this.root).exists(T(t),n)}catch(t){return n(!1)}},x.prototype.existsSync=function(t){try{return I(this.root).existsSync(T(t))}catch(t){return!1}},x.prototype.stat=function(t,e){void 0===e&&(e=L);var n=O(e,2);try{return I(this.root).stat(T(t),!1,n)}catch(t){return n(t)}},x.prototype.statSync=function(t){return I(this.root).statSync(T(t),!1)},x.prototype.lstat=function(t,e){void 0===e&&(e=L);var n=O(e,2);try{return I(this.root).stat(T(t),!0,n)}catch(t){return n(t)}},x.prototype.lstatSync=function(t){return I(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=O(n,1);try{if(r<0)throw new h(s.EINVAL);return I(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 h(s.EINVAL);return I(this.root).truncateSync(T(t),e)},x.prototype.unlink=function(t,e){void 0===e&&(e=L);var n=O(e,1);try{return I(this.root).unlink(T(t),n)}catch(t){return n(t)}},x.prototype.unlinkSync=function(t){return I(this.root).unlinkSync(T(t))},x.prototype.open=function(t,e,n,r){var i=this;void 0===r&&(r=L);var o=F(n,420),s=O(r="function"==typeof n?n:r,2);try{I(this.root).open(T(t),d.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(I(this.root).openSync(T(t),d.getFileFlag(e),F(n,420)))},x.prototype.readFile=function(t,e,n){void 0===e&&(e={}),void 0===n&&(n=L);var r=R(e,null,"r",null),i=O(n="function"==typeof e?e:n,2);try{var o=d.getFileFlag(r.flag);return o.isReadable()?I(this.root).readFile(T(t),r.encoding,o,i):i(new h(s.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=R(e,null,"r",null),r=d.getFileFlag(n.flag);if(!r.isReadable())throw new h(s.EINVAL,"Flag passed to readFile must allow for reading.");return I(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=R(n,"utf8","w",420),o=O(r="function"==typeof n?n:r,1);try{var a=d.getFileFlag(i.flag);return a.isWriteable()?I(this.root).writeFile(T(t),e,i.encoding,a,i.mode,o):o(new h(s.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(t){return o(t)}},x.prototype.writeFileSync=function(t,e,n){var r=R(n,"utf8","w",420),i=d.getFileFlag(r.flag);if(!i.isWriteable())throw new h(s.EINVAL,"Flag passed to writeFile must allow for writing.");return I(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=R(n,"utf8","a",420),o=O(r="function"==typeof n?n:r,1);try{var a=d.getFileFlag(i.flag);if(!a.isAppendable())return o(new h(s.EINVAL,"Flag passed to appendFile must allow for appending."));I(this.root).appendFile(T(t),e,i.encoding,a,i.mode,o)}catch(t){o(t)}},x.prototype.appendFileSync=function(t,e,n){var r=R(n,"utf8","a",420),i=d.getFileFlag(r.flag);if(!i.isAppendable())throw new h(s.EINVAL,"Flag passed to appendFile must allow for appending.");return I(this.root).appendFileSync(T(t),e,r.encoding,i,r.mode)},x.prototype.fstat=function(t,e){void 0===e&&(e=L);var n=O(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=O(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=O(n="function"==typeof e?e:n,1);try{var o=this.fd2file(t);if(r<0)throw new h(s.EINVAL);o.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 h(s.EINVAL);n.truncateSync(e)},x.prototype.fsync=function(t,e){void 0===e&&(e=L);var n=O(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=O(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,o,a){void 0===a&&(a=L);var c,u,f,l=null;if("string"==typeof n){var p="utf8";switch(typeof r){case"function":a=r;break;case"number":l=r,p="string"==typeof i?i:"utf8",a="function"==typeof o?o:a;break;default:return(a="function"==typeof i?i:"function"==typeof o?o:a)(new h(s.EINVAL,"Invalid arguments."))}u=0,f=(c=t.from(n,p)).length}else c=n,u=r,f=i,l="number"==typeof o?o:null,a="function"==typeof o?o:a;var d=O(a,3);try{var y=this.fd2file(e);void 0!==l&&null!==l||(l=y.getPos()),y.write(c,u,f,l,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 l=i;s="function"==typeof o?o:s,c=0,f=t.alloc(u),h=O(function(t,e,n){if(t)return s(t);s(t,n.toString(l),e)},3)}else f=n,c=r,u=i,a=o,h=O(s,3);try{var p=this.fd2file(e);void 0!==a&&null!==a||(a=p.getPos()),p.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 l=this.fd2file(e);void 0!==u&&null!==u||(u=l.getPos());var p=l.readSync(s,a,c,u);return f?[s.toString(h),p]:p},x.prototype.fchown=function(t,e,n,r){void 0===r&&(r=L);var i=O(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=O(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=O(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=O(e,1);try{t=T(t),I(this.root).rmdir(t,n)}catch(t){n(t)}},x.prototype.rmdirSync=function(t){return t=T(t),I(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=O(n,1);try{t=T(t),I(this.root).mkdir(t,e,r)}catch(t){r(t)}},x.prototype.mkdirSync=function(t,e){I(this.root).mkdirSync(T(t),F(e,511))},x.prototype.readdir=function(t,e){void 0===e&&(e=L);var n=O(e,2);try{t=T(t),I(this.root).readdir(t,n)}catch(t){n(t)}},x.prototype.readdirSync=function(t){return t=T(t),I(this.root).readdirSync(t)},x.prototype.link=function(t,e,n){void 0===n&&(n=L);var r=O(n,1);try{t=T(t),e=T(e),I(this.root).link(t,e,r)}catch(t){r(t)}},x.prototype.linkSync=function(t,e){return t=T(t),e=T(e),I(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",o=O(r="function"==typeof n?n:r,1);try{if("file"!==i&&"dir"!==i)return o(new h(s.EINVAL,"Invalid type: "+i));t=T(t),e=T(e),I(this.root).symlink(t,e,i,o)}catch(t){o(t)}},x.prototype.symlinkSync=function(t,e,n){if(n){if("file"!==n&&"dir"!==n)throw new h(s.EINVAL,"Invalid type: "+n)}else n="file";return t=T(t),e=T(e),I(this.root).symlinkSync(t,e,n)},x.prototype.readlink=function(t,e){void 0===e&&(e=L);var n=O(e,2);try{t=T(t),I(this.root).readlink(t,n)}catch(t){n(t)}},x.prototype.readlinkSync=function(t){return t=T(t),I(this.root).readlinkSync(t)},x.prototype.chown=function(t,e,n,r){void 0===r&&(r=L);var i=O(r,1);try{t=T(t),I(this.root).chown(t,!1,e,n,i)}catch(t){i(t)}},x.prototype.chownSync=function(t,e,n){t=T(t),I(this.root).chownSync(t,!1,e,n)},x.prototype.lchown=function(t,e,n,r){void 0===r&&(r=L);var i=O(r,1);try{t=T(t),I(this.root).chown(t,!0,e,n,i)}catch(t){i(t)}},x.prototype.lchownSync=function(t,e,n){t=T(t),I(this.root).chownSync(t,!0,e,n)},x.prototype.chmod=function(t,e,n){void 0===n&&(n=L);var r=O(n,1);try{var i=F(e,-1);if(i<0)throw new h(s.EINVAL,"Invalid mode.");I(this.root).chmod(T(t),!1,i,r)}catch(t){r(t)}},x.prototype.chmodSync=function(t,e){var n=F(e,-1);if(n<0)throw new h(s.EINVAL,"Invalid mode.");t=T(t),I(this.root).chmodSync(t,!1,n)},x.prototype.lchmod=function(t,e,n){void 0===n&&(n=L);var r=O(n,1);try{var i=F(e,-1);if(i<0)throw new h(s.EINVAL,"Invalid mode.");I(this.root).chmod(T(t),!0,i,r)}catch(t){r(t)}},x.prototype.lchmodSync=function(t,e){var n=F(e,-1);if(n<1)throw new h(s.EINVAL,"Invalid mode.");I(this.root).chmodSync(T(t),!0,n)},x.prototype.utimes=function(t,e,n,r){void 0===r&&(r=L);var i=O(r,1);try{I(this.root).utimes(T(t),N(e),N(n),i)}catch(t){i(t)}},x.prototype.utimesSync=function(t,e,n){I(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=O(n="function"==typeof e?e:L,2);try{t=T(t),I(this.root).realpath(t,r,i)}catch(t){i(t)}},x.prototype.realpathSync=function(t,e){return void 0===e&&(e={}),t=T(t),I(this.root).realpathSync(t,e)},x.prototype.watchFile=function(t,e,n){throw void 0===n&&(n=L),new h(s.ENOTSUP)},x.prototype.unwatchFile=function(t,e){throw void 0===e&&(e=L),new h(s.ENOTSUP)},x.prototype.watch=function(t,e,n){throw void 0===n&&(n=L),new h(s.ENOTSUP)},x.prototype.access=function(t,e,n){throw void 0===n&&(n=L),new h(s.ENOTSUP)},x.prototype.accessSync=function(t,e){throw new h(s.ENOTSUP)},x.prototype.createReadStream=function(t,e){throw new h(s.ENOTSUP)},x.prototype.createWriteStream=function(t,e){throw new h(s.ENOTSUP)},x.prototype.wrapCallbacks=function(t){k=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 h(s.EBADF,"Invalid file descriptor.")},x.prototype.closeFd=function(t){delete this.fdMap[t]},x.Stats=y;var D=new x,A={},P=x.prototype;function C(t,e,n,r,i){return tn?n+1:t+1:r===i?e:e+1}Object.keys(P).forEach(function(t){"function"==typeof D[t]?A[t]=function(){return D[t].apply(D,arguments)}:A[t]=D[t]}),A.changeFSModule=function(t){D=t},A.getFSModule=function(){return D},A.FS=x,A.Stats=x.Stats;var M="undefined"!=typeof navigator&&!(!/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())&&-1===navigator.userAgent.indexOf("Trident")),U="undefined"==typeof window;function j(){throw new Error("BFS has reached an impossible code path; please file a bug.")}function B(t,e,n){n.existsSync(t)||(B(a.dirname(t),e,n),n.mkdirSync(t,e))}function z(t){var e=q(t),n=e.byteOffset,r=e.byteLength;return 0===n&&r===e.buffer.byteLength?e.buffer:e.buffer.slice(n,n+r)}function q(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function W(e){return e instanceof t?e:e instanceof Uint8Array?H(e):t.from(e)}function H(e){return e instanceof t?e:0===e.byteOffset&&e.byteLength===e.buffer.byteLength?V(e.buffer):t.from(e.buffer,e.byteOffset,e.byteLength)}function V(e){return t.from(e)}function Z(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 X();var r=q(t),i=t[0],o=(i+1)%255;return t[0]=o,r[0]===o?(r[0]=i,H(r.slice(e,n))):(t[0]=i,H(r.subarray(e,n)))}var Y=null;function X(){return Y||(Y=t.alloc(0))}function K(e,n){t.isBuffer(e)?n():n(new h(s.EINVAL,"option must be a Buffer."))}function J(t,e,n){var r=t.Options,i=t.Name,o=0,a=!1,c=!1;function u(t){a||(t&&(a=!0,n(t)),0===--o&&c&&n())}var f=function(t){if(r.hasOwnProperty(t)){var c=r[t],f=e[t];if(void 0===f||null===f){if(!c.optional){var l=Object.keys(e).filter(function(t){return!(t in r)}).map(function(e){return{str:e,distance:function(t,e){if(t===e)return 0;if(t.length>e.length){var n=t;t=e,e=n}for(var r=t.length,i=e.length;r>0&&t.charCodeAt(r-1)===e.charCodeAt(i-1);)r--,i--;for(var o=0;ob?b+1:k+1:S===h[r+E]?a:a+1,a=k}}return b}(t,e)}}).filter(function(t){return t.distance<5}).sort(function(t,e){return t.distance-e.distance});return a?{}:(a=!0,{v:n(new h(s.EINVAL,"["+i+"] Required option '"+t+"' not provided."+(l.length>0?" You provided unrecognized option '"+l[0].str+"'; perhaps you meant to type '"+t+"'.":"")+"\nOption description: "+c.description))})}}else{if(!(Array.isArray(c.type)?-1!==c.type.indexOf(typeof f):typeof f===c.type))return a?{}:(a=!0,{v:n(new h(s.EINVAL,"["+i+"] Value provided for option "+t+" is not the proper type. Expected "+(Array.isArray(c.type)?"one of {"+c.type.join(", ")+"}":c.type)+", but received "+typeof f+"\nOption description: "+c.description))});c.validator&&(o++,c.validator(f,u))}}};for(var l in r){var p=f(l);if(p)return p.v}c=!0,0!==o||a||n()}var G=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.")},isIE:M,isWebWorker:U,fail:j,mkdirpSync:B,buffer2ArrayBuffer:z,buffer2Uint8array:q,arrayish2Buffer:W,uint8Array2Buffer:H,arrayBuffer2Buffer:V,copyingSlice:Z,emptyBuffer:X,bufferValidator:K,checkOptions:J}),Q=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};Q.prototype.open=function(t){var e=this.fs.realPath(t.node),n=this.FS;try{n.isFile(t.node.mode)&&(t.nfd=this.nodefs.openSync(e,this.fs.flagsToPermissionString(t.flags)))}catch(t){if(!t.code)throw t;throw new n.ErrnoError(this.ERRNO_CODES[t.code])}},Q.prototype.close=function(t){var e=this.FS;try{e.isFile(t.node.mode)&&t.nfd&&this.nodefs.closeSync(t.nfd)}catch(t){if(!t.code)throw t;throw new e.ErrnoError(this.ERRNO_CODES[t.code])}},Q.prototype.read=function(t,e,n,r,i){try{return this.nodefs.readSync(t.nfd,H(e),n,r,i)}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},Q.prototype.write=function(t,e,n,r,i){try{return this.nodefs.writeSync(t.nfd,H(e),n,r,i)}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},Q.prototype.llseek=function(t,e,n){var r=e;if(1===n)r+=t.position;else if(2===n&&this.FS.isFile(t.node.mode))try{r+=this.nodefs.fstatSync(t.nfd).size}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}if(r<0)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return t.position=r,r};var $=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};$.prototype.getattr=function(t){var e,n=this.fs.realPath(t);try{e=this.nodefs.lstatSync(n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},$.prototype.setattr=function(t,e){var n=this.fs.realPath(t);try{if(void 0!==e.mode&&(this.nodefs.chmodSync(n,e.mode),t.mode=e.mode),void 0!==e.timestamp){var r=new Date(e.timestamp);this.nodefs.utimesSync(n,r,r)}}catch(t){if(!t.code)throw t;if("ENOTSUP"!==t.code)throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}if(void 0!==e.size)try{this.nodefs.truncateSync(n,e.size)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},$.prototype.lookup=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e),r=this.fs.getMode(n);return this.fs.createNode(t,e,r)},$.prototype.mknod=function(t,e,n,r){var i=this.fs.createNode(t,e,n,r),o=this.fs.realPath(i);try{this.FS.isDir(i.mode)?this.nodefs.mkdirSync(o,i.mode):this.nodefs.writeFileSync(o,"",{mode:i.mode})}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return i},$.prototype.rename=function(t,e,n){var r=this.fs.realPath(t),i=this.PATH.join2(this.fs.realPath(e),n);try{this.nodefs.renameSync(r,i),t.name=n,t.parent=e}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},$.prototype.unlink=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.unlinkSync(n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},$.prototype.rmdir=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.rmdirSync(n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},$.prototype.readdir=function(t){var e=this.fs.realPath(t);try{var n=this.nodefs.readdirSync(e);return n.push(".",".."),n}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},$.prototype.symlink=function(t,e,n){var r=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.symlinkSync(n,r)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},$.prototype.readlink=function(t){var e=this.fs.realPath(t);try{return this.nodefs.readlinkSync(e)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}};var tt=function(t,e,n,r){void 0===t&&(t=self.FS),void 0===e&&(e=self.PATH),void 0===n&&(n=self.ERRNO_CODES),void 0===r&&(r=A),this.flagsToPermissionStringMap={0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},this.nodefs=r,this.FS=t,this.PATH=e,this.ERRNO_CODES=n,this.node_ops=new $(this),this.stream_ops=new Q(this)};tt.prototype.mount=function(t){return this.createNode(null,"/",this.getMode(t.opts.root),0)},tt.prototype.createNode=function(t,e,n,r){var i=this.FS;if(!i.isDir(n)&&!i.isFile(n)&&!i.isLink(n))throw new i.ErrnoError(this.ERRNO_CODES.EINVAL);var o=i.createNode(t,e,n);return o.node_ops=this.node_ops,o.stream_ops=this.stream_ops,o},tt.prototype.getMode=function(t){var e;try{e=this.nodefs.lstatSync(t)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return e.mode},tt.prototype.realPath=function(t){for(var e=[];t.parent!==t;)e.push(t.name),t=t.parent;return e.push(t.mount.opts.root),e.reverse(),this.PATH.join.apply(null,e)},tt.prototype.flagsToPermissionString=function(t){var e="string"==typeof t?parseInt(t,10):t;return(e&=8191)in this.flagsToPermissionStringMap?this.flagsToPermissionStringMap[e]:t},tt.prototype.getNodeFS=function(){return this.nodefs},tt.prototype.getFS=function(){return this.FS},tt.prototype.getPATH=function(){return this.PATH},tt.prototype.getERRNO_CODES=function(){return this.ERRNO_CODES};var et=function(){};et.prototype.supportsLinks=function(){return!1},et.prototype.diskSpace=function(t,e){e(0,0)},et.prototype.openFile=function(t,e,n){throw new h(s.ENOTSUP)},et.prototype.createFile=function(t,e,n,r){throw new h(s.ENOTSUP)},et.prototype.open=function(t,e,n,r){var i=this;this.stat(t,!1,function(o,c){if(o)switch(e.pathNotExistsAction()){case f.CREATE_FILE:return i.stat(a.dirname(t),!1,function(o,s){o?r(o):s&&!s.isDirectory()?r(h.ENOTDIR(a.dirname(t))):i.createFile(t,e,n,r)});case f.THROW_EXCEPTION:return r(h.ENOENT(t));default:return r(new h(s.EINVAL,"Invalid FileFlag object."))}else{if(c&&c.isDirectory())return r(h.EISDIR(t));switch(e.pathExistsAction()){case f.THROW_EXCEPTION:return r(h.EEXIST(t));case f.TRUNCATE_FILE:return i.openFile(t,e,function(t,e){t?r(t):e?e.truncate(0,function(){e.sync(function(){r(null,e)})}):j()});case f.NOP:return i.openFile(t,e,r);default:return r(new h(s.EINVAL,"Invalid FileFlag object."))}}})},et.prototype.rename=function(t,e,n){n(new h(s.ENOTSUP))},et.prototype.renameSync=function(t,e){throw new h(s.ENOTSUP)},et.prototype.stat=function(t,e,n){n(new h(s.ENOTSUP))},et.prototype.statSync=function(t,e){throw new h(s.ENOTSUP)},et.prototype.openFileSync=function(t,e,n){throw new h(s.ENOTSUP)},et.prototype.createFileSync=function(t,e,n){throw new h(s.ENOTSUP)},et.prototype.openSync=function(t,e,n){var r;try{r=this.statSync(t,!1)}catch(r){switch(e.pathNotExistsAction()){case f.CREATE_FILE:if(!this.statSync(a.dirname(t),!1).isDirectory())throw h.ENOTDIR(a.dirname(t));return this.createFileSync(t,e,n);case f.THROW_EXCEPTION:throw h.ENOENT(t);default:throw new h(s.EINVAL,"Invalid FileFlag object.")}}if(r.isDirectory())throw h.EISDIR(t);switch(e.pathExistsAction()){case f.THROW_EXCEPTION:throw h.EEXIST(t);case f.TRUNCATE_FILE:return this.unlinkSync(t),this.createFileSync(t,e,r.mode);case f.NOP:return this.openFileSync(t,e,n);default:throw new h(s.EINVAL,"Invalid FileFlag object.")}},et.prototype.unlink=function(t,e){e(new h(s.ENOTSUP))},et.prototype.unlinkSync=function(t){throw new h(s.ENOTSUP)},et.prototype.rmdir=function(t,e){e(new h(s.ENOTSUP))},et.prototype.rmdirSync=function(t){throw new h(s.ENOTSUP)},et.prototype.mkdir=function(t,e,n){n(new h(s.ENOTSUP))},et.prototype.mkdirSync=function(t,e){throw new h(s.ENOTSUP)},et.prototype.readdir=function(t,e){e(new h(s.ENOTSUP))},et.prototype.readdirSync=function(t){throw new h(s.ENOTSUP)},et.prototype.exists=function(t,e){this.stat(t,null,function(t){e(!t)})},et.prototype.existsSync=function(t){try{return this.statSync(t,!0),!0}catch(t){return!1}},et.prototype.realpath=function(t,e,n){if(this.supportsLinks())for(var r=t.split(a.sep),i=0;ithis._buffer.length){var n=t.alloc(e-this._buffer.length,0);return this.writeSync(n,0,n.length,this._buffer.length),void(this._flag.isSynchronous()&&A.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()&&A.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 h(s.EPERM,"File not opened with a writeable mode.");var o=i+r;if(o>this._stat.size&&(this._stat.size=o,o>this._buffer.length)){var a=t.alloc(o);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 h(s.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 h(s.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}(rt),ot=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}(it),st=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),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(it),at=function(t){function e(e,n){t.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._initializeCallbacks=[],this._sync=e,this._async=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.sync,t.async);r._initialize(function(t){t?n(t):n(null,r)})}catch(t){n(t)}},e.isAvailable=function(){return!0},e.prototype.getName=function(){return e.Name},e.prototype._syncSync=function(t){this._sync.writeFileSync(t.getPath(),t.getBuffer(),null,d.getFileFlag("w"),t.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[t.getPath(),t.getBuffer(),null,t.getFlag(),t.getStats().mode]})},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._sync.supportsProps()&&this._async.supportsProps()},e.prototype.renameSync=function(t,e){this._sync.renameSync(t,e),this.enqueueOp({apiMethod:"rename",arguments:[t,e]})},e.prototype.statSync=function(t,e){return this._sync.statSync(t,e)},e.prototype.openSync=function(t,e,n){return this._sync.openSync(t,e,n).closeSync(),new st(this,t,e,this._sync.statSync(t,!1),this._sync.readFileSync(t,null,d.getFileFlag("r")))},e.prototype.unlinkSync=function(t){this._sync.unlinkSync(t),this.enqueueOp({apiMethod:"unlink",arguments:[t]})},e.prototype.rmdirSync=function(t){this._sync.rmdirSync(t),this.enqueueOp({apiMethod:"rmdir",arguments:[t]})},e.prototype.mkdirSync=function(t,e){this._sync.mkdirSync(t,e),this.enqueueOp({apiMethod:"mkdir",arguments:[t,e]})},e.prototype.readdirSync=function(t){return this._sync.readdirSync(t)},e.prototype.existsSync=function(t){return this._sync.existsSync(t)},e.prototype.chmodSync=function(t,e,n){this._sync.chmodSync(t,e,n),this.enqueueOp({apiMethod:"chmod",arguments:[t,e,n]})},e.prototype.chownSync=function(t,e,n,r){this._sync.chownSync(t,e,n,r),this.enqueueOp({apiMethod:"chown",arguments:[t,e,n,r]})},e.prototype.utimesSync=function(t,e,n){this._sync.utimesSync(t,e,n),this.enqueueOp({apiMethod:"utimes",arguments:[t,e,n]})},e.prototype._initialize=function(t){var e=this,n=this._initializeCallbacks;if(this._isInitialized)t();else if(1===n.push(t)){var r=function(t,n,r){"/"!==t&&e._sync.mkdirSync(t,n),e._async.readdir(t,function(e,n){var o=0;e?r(e):function e(s){s?r(s):o0){var r=e._queue.shift(),i=r.arguments;i.push(n),e._async[r.apiMethod].apply(e._async,i)}else e._queueRunning=!1};n()}},e}(nt);at.Name="AsyncMirror",at.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to.",validator:function(t,e){t&&"function"==typeof t.supportsSynch&&t.supportsSynch()?e():e(new h(s.EINVAL,"'sync' option must be a file system that supports synchronous operations"))}},async:{type:"object",description:"The asynchronous file system to mirror."}};var ct=m.Dropbox?m.Dropbox.Dropbox:void 0;function ut(t){return"/"===t?"":t}function ft(t){var e=t.error;if(e[".tag"])return e;if(e.error){var n=e.error;return n[".tag"]?n:n.reason&&n.reason[".tag"]?n.reason:n}if("string"==typeof e)try{var r=JSON.parse(e);if(r.error&&r.error.reason&&r.error.reason[".tag"])return r.error.reason}catch(t){}return e}function ht(t){if(t.user_message)return t.user_message.text;if(t.error_summary)return t.error_summary;if("string"==typeof t.error)return t.error;if("object"==typeof t.error)return ht(t.error);throw new Error("Dropbox's servers gave us a garbage error message: "+JSON.stringify(t))}function lt(t,e,n){switch(t[".tag"]){case"malformed_path":return new h(s.EBADF,n,e);case"not_found":return h.ENOENT(e);case"not_file":return h.EISDIR(e);case"not_folder":return h.ENOTDIR(e);case"restricted_content":return h.EPERM(e);case"other":default:return new h(s.EIO,n,e)}}function pt(t,e,n){switch(t[".tag"]){case"malformed_path":case"disallowed_name":return new h(s.EBADF,n,e);case"conflict":case"no_write_permission":case"team_folder":return h.EPERM(e);case"insufficient_space":return new h(s.ENOSPC,n);case"other":default:return new h(s.EIO,n,e)}}function dt(t,e,n){var r={path:ut(e)};t.filesDeleteV2(r).then(function(){n()}).catch(function(r){var i=ft(r);switch(i[".tag"]){case"path_lookup":n(lt(i.path_lookup,e,ht(r)));break;case"path_write":n(pt(i.path_write,e,ht(r)));break;case"too_many_write_operations":setTimeout(function(){return dt(t,e,n)},500+300*Math.random());break;case"other":default:n(new h(s.EIO,ht(r),e))}})}var yt=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){this._fs._syncFile(this.getPath(),this.getBuffer(),t)},e.prototype.close=function(t){this.sync(t)},e}(it),gt=function(e){function n(t){e.call(this),this._client=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.client))},n.isAvailable=function(){return void 0!==ct},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.empty=function(t){var e=this;this.readdir("/",function(n,r){if(r){var i=function(n){0===r.length?t():dt(e._client,r.shift(),i)};i()}else t(n)})},n.prototype.rename=function(t,e,n){var r=this;this.stat(e,!1,function(i,o){var a=function(){var i={from_path:ut(t),to_path:ut(e)};r._client.filesMoveV2(i).then(function(){return n()}).catch(function(r){var i=ft(r);switch(i[".tag"]){case"from_lookup":n(lt(i.from_lookup,t,ht(r)));break;case"from_write":n(pt(i.from_write,t,ht(r)));break;case"to":n(pt(i.to,e,ht(r)));break;case"cant_copy_shared_folder":case"cant_nest_shared_folder":n(new h(s.EPERM,ht(r),t));break;case"cant_move_folder_into_itself":case"duplicated_or_nested_paths":n(new h(s.EBADF,ht(r),t));break;case"too_many_files":n(new h(s.ENOSPC,ht(r),t));break;case"other":default:n(new h(s.EIO,ht(r),t))}})};i?a():t===e?i?n(h.ENOENT(e)):n():o&&o.isDirectory()?n(h.EISDIR(e)):r.unlink(e,function(t){t?n(t):a()})})},n.prototype.stat=function(t,e,n){if("/"!==t){var r={path:ut(t)};this._client.filesGetMetadata(r).then(function(e){switch(e[".tag"]){case"file":var r=e;n(null,new y(p.FILE,r.size));break;case"folder":n(null,new y(p.DIRECTORY,4096));break;case"deleted":n(h.ENOENT(t))}}).catch(function(e){var r=ft(e);switch(r[".tag"]){case"path":n(lt(r.path,t,ht(e)));break;default:n(new h(s.EIO,ht(e),t))}})}else E(function(){n(null,new y(p.DIRECTORY,4096))})},n.prototype.openFile=function(t,e,n){var r=this,i={path:ut(t)};this._client.filesDownload(i).then(function(i){var o=i.fileBlob,s=new FileReader;s.onload=function(){var i=s.result;n(null,new yt(r,t,e,new y(p.FILE,i.byteLength),V(i)))},s.readAsArrayBuffer(o)}).catch(function(e){var r=ft(e);switch(r[".tag"]){case"path":n(lt(r.path,t,ht(e)));break;case"other":default:n(new h(s.EIO,ht(e),t))}})},n.prototype.createFile=function(e,n,r,i){var o=this,a=t.alloc(0),c={contents:new Blob([z(a)],{type:"octet/stream"}),path:ut(e)};this._client.filesUpload(c).then(function(t){i(null,new yt(o,e,n,new y(p.FILE,0),a))}).catch(function(t){var a=ft(t);switch(a[".tag"]){case"path":i(pt(a.path.reason,e,ht(t)));break;case"too_many_write_operations":setTimeout(function(){return o.createFile(e,n,r,i)},500+300*Math.random());break;case"other":default:i(new h(s.EIO,ht(t),e))}})},n.prototype.unlink=function(t,e){var n=this;this.stat(t,!1,function(r,i){i?i.isDirectory()?e(h.EISDIR(t)):dt(n._client,t,e):e(r)})},n.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){i?i.length>0?e(h.ENOTEMPTY(t)):dt(n._client,t,e):e(r)})},n.prototype.mkdir=function(t,e,n){var r=this,i=a.dirname(t);this.stat(i,!1,function(o,s){if(o)n(o);else if(s&&!s.isDirectory())n(h.ENOTDIR(i));else{var a={path:ut(t)};r._client.filesCreateFolderV2(a).then(function(){return n()}).catch(function(i){"too_many_write_operations"===ft(i)[".tag"]?setTimeout(function(){return r.mkdir(t,e,n)},500+300*Math.random()):n(pt(ft(i).path,t,ht(i)))})}})},n.prototype.readdir=function(t,e){var n=this,r={path:ut(t)};this._client.filesListFolder(r).then(function(r){!function t(e,n,r,i,o){var s=r.entries.map(function(t){return t.path_display}).filter(function(t){return!!t});var a=i.concat(s);if(r.has_more){var c={cursor:r.cursor};e.filesListFolderContinue(c).then(function(r){t(e,n,r,a,o)}).catch(function(t){_t(t,n,o)})}else o(null,a)}(n._client,t,r,[],e)}).catch(function(n){_t(n,t,e)})},n.prototype._syncFile=function(t,e,n){var r=this,i={contents:new Blob([z(e)],{type:"octet/stream"}),path:ut(t),mode:{".tag":"overwrite"}};this._client.filesUpload(i).then(function(){n()}).catch(function(i){var o=ft(i);switch(o[".tag"]){case"path":n(pt(o.path.reason,t,ht(i)));break;case"too_many_write_operations":setTimeout(function(){return r._syncFile(t,e,n)},500+300*Math.random());break;case"other":default:n(new h(s.EIO,ht(i),t))}})},n}(et);function _t(t,e,n){var r=ft(t);switch(r[".tag"]){case"path":n(lt(r.path,e,ht(t)));break;case"other":default:n(new h(s.EIO,ht(t),e))}}function mt(t,e){void 0===e&&(e="");for(var n=t.errno,r=t.node,i=[];r&&(i.unshift(r.name),r!==r.parent);)r=r.parent;return new h(n,u[n],i.length>0?"/"+i.join("/"):e)}gt.Name="DropboxV2",gt.Options={client:{type:"object",description:"An *authenticated* Dropbox client. Must be from the 2.5.x JS SDK."}};var wt=function(t){function e(e,n,r,i){t.call(this),this._fs=e,this._FS=n,this._path=r,this._stream=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPos=function(){},e.prototype.close=function(t){var e=null;try{this.closeSync()}catch(t){e=t}finally{t(e)}},e.prototype.closeSync=function(){try{this._FS.close(this._stream)}catch(t){throw mt(t,this._path)}},e.prototype.stat=function(t){try{t(null,this.statSync())}catch(e){t(e)}},e.prototype.statSync=function(){try{return this._fs.statSync(this._path,!1)}catch(t){throw mt(t,this._path)}},e.prototype.truncate=function(t,e){var n=null;try{this.truncateSync(t)}catch(t){n=t}finally{e(n)}},e.prototype.truncateSync=function(t){try{this._FS.ftruncate(this._stream.fd,t)}catch(t){throw mt(t,this._path)}},e.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.writeSync=function(t,e,n,r){try{var i=q(t),o=null===r?void 0:r;return this._FS.write(this._stream,i,e,n,o)}catch(t){throw mt(t,this._path)}},e.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.readSync=function(t,e,n,r){try{var i=q(t),o=null===r?void 0:r;return this._FS.read(this._stream,i,e,n,o)}catch(t){throw mt(t,this._path)}},e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.chown=function(t,e,n){var r=null;try{this.chownSync(t,e)}catch(t){r=t}finally{n(r)}},e.prototype.chownSync=function(t,e){try{this._FS.fchown(this._stream.fd,t,e)}catch(t){throw mt(t,this._path)}},e.prototype.chmod=function(t,e){var n=null;try{this.chmodSync(t)}catch(t){n=t}finally{e(n)}},e.prototype.chmodSync=function(t){try{this._FS.fchmod(this._stream.fd,t)}catch(t){throw mt(t,this._path)}},e.prototype.utimes=function(t,e,n){var r=null;try{this.utimesSync(t,e)}catch(t){r=t}finally{n(r)}},e.prototype.utimesSync=function(t,e){this._fs.utimesSync(this._path,t,e)},e}(rt),vt=function(e){function n(t){e.call(this),this._FS=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.FS))},n.isAvailable=function(){return!0},n.prototype.getName=function(){return this._FS.DB_NAME()},n.prototype.isReadOnly=function(){return!1},n.prototype.supportsLinks=function(){return!0},n.prototype.supportsProps=function(){return!0},n.prototype.supportsSynch=function(){return!0},n.prototype.renameSync=function(t,e){try{this._FS.rename(t,e)}catch(n){throw n.errno===s.ENOENT?mt(n,this.existsSync(t)?e:t):mt(n)}},n.prototype.statSync=function(t,e){try{var n=e?this._FS.lstat(t):this._FS.stat(t),r=this.modeToFileType(n.mode);return new y(r,n.size,n.mode,n.atime.getTime(),n.mtime.getTime(),n.ctime.getTime())}catch(e){throw mt(e,t)}},n.prototype.openSync=function(t,e,n){try{var r=this._FS.open(t,e.getFlagString(),n);if(this._FS.isDir(r.node.mode))throw this._FS.close(r),h.EISDIR(t);return new wt(this,this._FS,t,r)}catch(e){throw mt(e,t)}},n.prototype.unlinkSync=function(t){try{this._FS.unlink(t)}catch(e){throw mt(e,t)}},n.prototype.rmdirSync=function(t){try{this._FS.rmdir(t)}catch(e){throw mt(e,t)}},n.prototype.mkdirSync=function(t,e){try{this._FS.mkdir(t,e)}catch(e){throw mt(e,t)}},n.prototype.readdirSync=function(t){try{return this._FS.readdir(t).filter(function(t){return"."!==t&&".."!==t})}catch(e){throw mt(e,t)}},n.prototype.truncateSync=function(t,e){try{this._FS.truncate(t,e)}catch(e){throw mt(e,t)}},n.prototype.readFileSync=function(t,e,n){try{var r=H(this._FS.readFile(t,{flags:n.getFlagString()}));return e?r.toString(e):r}catch(e){throw mt(e,t)}},n.prototype.writeFileSync=function(e,n,r,i,o){try{r&&(n=t.from(n,r));var s=q(n);this._FS.writeFile(e,s,{flags:i.getFlagString(),encoding:"binary"}),this._FS.chmod(e,o)}catch(t){throw mt(t,e)}},n.prototype.chmodSync=function(t,e,n){try{e?this._FS.lchmod(t,n):this._FS.chmod(t,n)}catch(e){throw mt(e,t)}},n.prototype.chownSync=function(t,e,n,r){try{e?this._FS.lchown(t,n,r):this._FS.chown(t,n,r)}catch(e){throw mt(e,t)}},n.prototype.symlinkSync=function(t,e,n){try{this._FS.symlink(t,e)}catch(t){throw mt(t)}},n.prototype.readlinkSync=function(t){try{return this._FS.readlink(t)}catch(e){throw mt(e,t)}},n.prototype.utimesSync=function(t,e,n){try{this._FS.utime(t,e.getTime(),n.getTime())}catch(e){throw mt(e,t)}},n.prototype.modeToFileType=function(t){if(this._FS.isDir(t))return p.DIRECTORY;if(this._FS.isFile(t))return p.FILE;if(this._FS.isLink(t))return p.SYMLINK;throw h.EPERM("Invalid mode: "+t)},n}(nt);vt.Name="EmscriptenFileSystem",vt.Options={FS:{type:"object",description:"The Emscripten file system to use (the `FS` variable)"}};var bt=function(t){function e(e,n){t.call(this),this._folder=e,this._wrapped=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){var r=new e(t.folder,t.wrapped);r._initialize(function(t){t?n(t):n(null,r)})},e.isAvailable=function(){return!0},e.prototype.getName=function(){return this._wrapped.getName()},e.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},e.prototype.supportsProps=function(){return this._wrapped.supportsProps()},e.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e.prototype._initialize=function(t){var e=this;this._wrapped.exists(this._folder,function(n){n?t():e._wrapped.isReadOnly()?t(h.ENOENT(e._folder)):e._wrapped.mkdir(e._folder,511,t)})},e}(et);function St(t,e){if(null!==e&&"object"==typeof e){var n=e,r=n.path;r&&(r="/"+a.relative(t,r),n.message=n.message.replace(n.path,r),n.path=r)}return e}function Et(t,e,n){return"Sync"!==t.slice(t.length-4)?function(){return arguments.length>0&&(e&&(arguments[0]=a.join(this._folder,arguments[0])),n&&(arguments[1]=a.join(this._folder,arguments[1])),arguments[arguments.length-1]=function(t,e){return"function"==typeof e?function(n){arguments.length>0&&(arguments[0]=St(t,n)),e.apply(null,arguments)}:e}(this._folder,arguments[arguments.length-1])),this._wrapped[t].apply(this._wrapped,arguments)}:function(){try{return e&&(arguments[0]=a.join(this._folder,arguments[0])),n&&(arguments[1]=a.join(this._folder,arguments[1])),this._wrapped[t].apply(this._wrapped,arguments)}catch(t){throw St(this._folder,t)}}}function kt(t,e){e|=0;for(var n=Math.max(t.length-e,0),r=Array(n),i=0;i-1&&t%1==0&&t<=Qt}function te(t){return null!=t&&$t(t.length)&&!function(t){if(!Ot(t))return!1;var e=Yt(t);return e==Kt||e==Jt||e==Xt||e==Gt}(t)}var ee={};function ne(){}function re(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var ie="function"==typeof Symbol&&Symbol.iterator;function oe(t){return null!=t&&"object"==typeof t}var se="[object Arguments]";function ae(t){return oe(t)&&Yt(t)==se}var ce=Object.prototype,ue=ce.hasOwnProperty,fe=ce.propertyIsEnumerable,he=ae(function(){return arguments}())?ae:function(t){return oe(t)&&ue.call(t,"callee")&&!fe.call(t,"callee")},le=Array.isArray;var pe="object"==typeof e&&e&&!e.nodeType&&e,de=pe&&"object"==typeof o&&o&&!o.nodeType&&o,ye=de&&de.exports===pe?Mt.Buffer:void 0,ge=(ye?ye.isBuffer:void 0)||function(){return!1},_e=9007199254740991,me=/^(?:0|[1-9]\d*)$/;function we(t,e){var n=typeof t;return!!(e=null==e?_e:e)&&("number"==n||"symbol"!=n&&me.test(t))&&t>-1&&t%1==0&&t0?e(h.ENOTEMPTY(t)):n._remove(t,e,!1)})},e.prototype.mkdir=function(t,e,n){this.fs.root.getDirectory(t,{create:!0,exclusive:!0},function(t){n()},function(e){n(ze(e,t,!0))})},e.prototype.readdir=function(t,e){this._readdir(t,function(t,n){if(!n)return e(t);for(var r=[],i=0,o=n;i=this.limit&&(delete this.map[this.tail.key],this.size--,this.tail=this.tail.prev,this.tail.next=null),this.setHead(n)},Ge.prototype.get=function(t){if(this.map[t]){var e=this.map[t].value,n=new Je(t,e);return this.remove(t),this.setHead(n),e}return null},Ge.prototype.remove=function(t){var e=this.map[t];e&&(null!==e.prev?e.prev.next=e.next:this.head=e.next,null!==e.next?e.next.prev=e.prev:this.tail=e.prev,delete this.map[t],this.size--)},Ge.prototype.removeAll=function(){this.size=0,this.map={},this.head=null,this.tail=null},Ge.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[t.key]=t};var Qe=function(t){this.store=t,this.originalData={},this.modifiedKeys=[]};Qe.prototype.get=function(t){var e=this.store.get(t);return this.stashOldValue(t,e),e},Qe.prototype.put=function(t,e,n){return this.markModified(t),this.store.put(t,e,n)},Qe.prototype.del=function(t){this.markModified(t),this.store.del(t)},Qe.prototype.commit=function(){},Qe.prototype.abort=function(){for(var t=0,e=this.modifiedKeys;t0)throw h.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,a.dirname(t),a.basename(t)),o=this.getINode(r,t,i),s=o.update(n);try{r.put(o.id,e,!0),s&&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 He(Ye(),4096,511|p.DIRECTORY,e,e,e);t.put(n.id,Ze(),!1),t.put("/",n.toBuffer(),!1),t.commit()}},n.prototype._findINode=function(t,e,n){var r=this,i=function(i){var o=r.getDirListing(t,e,i);if(o[n])return o[n];throw h.ENOENT(a.resolve(e,n))};return"/"===e?""===n?"/":i(this.getINode(t,e,"/")):i(this.getINode(t,e+a.sep+n,this._findINode(t,a.dirname(e),a.basename(e))))},n.prototype.findINode=function(t,e){return this.getINode(t,e,this._findINode(t,a.dirname(e),a.basename(e)))},n.prototype.getINode=function(t,e,n){var r=t.get(n);if(void 0===r)throw h.ENOENT(e);return He.fromBuffer(r)},n.prototype.getDirListing=function(t,e,n){if(!n.isDirectory())throw h.ENOTDIR(e);var r=t.get(n.id);if(void 0===r)throw h.ENOENT(e);return JSON.parse(r.toString())},n.prototype.addNewNode=function(t,e){for(var n;;)try{return n=Ye(),t.put(n,e,!1),n}catch(t){}throw new h(s.EIO,"Unable to commit data to key-value store.")},n.prototype.commitNewFile=function(e,n,r,i,o){var s,c=a.dirname(n),u=a.basename(n),f=this.findINode(e,c),l=this.getDirListing(e,c,f),p=(new Date).getTime();if("/"===n)throw h.EEXIST(n);if(l[u])throw h.EEXIST(n);try{var d=this.addNewNode(e,o);s=new He(d,o.length,i|r,p,p,p);var y=this.addNewNode(e,s.toBuffer());l[u]=y,e.put(f.id,t.from(JSON.stringify(l)),!0)}catch(t){throw e.abort(),t}return e.commit(),s},n.prototype.removeEntry=function(e,n){var r=this.store.beginTransaction("readwrite"),i=a.dirname(e),o=this.findINode(r,i),s=this.getDirListing(r,i,o),c=a.basename(e);if(!s[c])throw h.ENOENT(e);var u=s[c];delete s[c];var f=this.getINode(r,e,u);if(!n&&f.isDirectory())throw h.EISDIR(e);if(n&&!f.isDirectory())throw h.ENOTDIR(e);try{r.del(f.id),r.del(u),r.put(o.id,t.from(JSON.stringify(s)),!0)}catch(t){throw r.abort(),t}r.commit()},n}(nt),en=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}(it),nn=function(e){function n(t){e.call(this),this._cache=null,t>0&&(this._cache=new Ge(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){Xe(n,t)&&e.makeRootDirectory(t)})},n.prototype.rename=function(e,n,r){var i=this;if(this._cache){var o=this._cache;this._cache=null,o.removeAll();var c=r;r=function(t){i._cache=o,c(t)}}var u=this.store.beginTransaction("readwrite"),f=a.dirname(e),l=a.basename(e),p=a.dirname(n),d=a.basename(n),y={},g={},_=!1;if(0===(p+"/").indexOf(e+"/"))return r(new h(s.EBUSY,f));var m=function(o){i.findINodeAndDirListing(u,o,function(s,a,c){s?_||(_=!0,u.abort(function(){r(s)})):(y[o]=a,g[o]=c,function(){if(!_&&g.hasOwnProperty(f)&&g.hasOwnProperty(p)){var o=g[f],s=y[f],a=g[p],c=y[p];if(o[l]){var m=o[l];delete o[l];var w=function(){a[d]=m,u.put(s.id,t.from(JSON.stringify(o)),!0,function(e){Ke(e,u,r)&&(f===p?u.commit(r):u.put(c.id,t.from(JSON.stringify(a)),!0,function(t){Ke(t,u,r)&&u.commit(r)}))})};a[d]?i.getINode(u,n,a[d],function(t,e){Ke(t,u,r)&&(e.isFile()?u.del(e.id,function(t){Ke(t,u,r)&&u.del(a[d],function(t){Ke(t,u,r)&&w()})}):u.abort(function(t){r(h.EPERM(n))}))}):w()}else r(h.ENOENT(e))}}())})};m(f),f!==p&&m(p)},n.prototype.stat=function(t,e,n){var r=this.store.beginTransaction("readonly");this.findINode(r,t,function(t,e){Xe(t,n)&&n(null,e.toStats())})},n.prototype.createFile=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite"),s=X();this.commitNewFile(o,t,p.FILE,n,s,function(n,o){Xe(n,r)&&r(null,new en(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){Xe(o,n)&&i.get(s.id,function(i,o){Xe(i,n)&&(void 0===o?n(h.ENOENT(t)):n(null,new en(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(h.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){Xe(i,e)&&n.getDirListing(r,t,o,function(t,n){Xe(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,a.dirname(t),a.basename(t),function(s,a){Ke(s,o,r)&&i.getINode(o,t,a,function(t,i){if(Ke(t,o,r)){var s=i.update(n);o.put(i.id,e,!0,function(t){Ke(t,o,r)&&(s?o.put(a,i.toBuffer(),!0,function(t){Ke(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 He(Ye(),4096,511|p.DIRECTORY,i,i,i);e.put(o.id,Ze(),!1,function(n){Ke(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(a.join(e,n));if(o)return r(null,o)}var s=function(t,o,s){if(t)r(t);else if(s[n]){var c=s[n];i._cache&&i._cache.set(a.join(e,n),c),r(null,c)}else r(h.ENOENT(a.resolve(e,n)))};"/"===e?""===n?(this._cache&&this._cache.set(a.join(e,n),"/"),r(null,"/")):this.getINode(t,e,"/",function(n,o){Xe(n,r)&&i.getDirListing(t,e,o,function(t,e){s(t,0,e)})}):this.findINodeAndDirListing(t,e,s)},n.prototype.findINode=function(t,e,n){var r=this;this._findINode(t,a.dirname(e),a.basename(e),function(i,o){Xe(i,n)&&r.getINode(t,e,o,n)})},n.prototype.getINode=function(t,e,n,r){t.get(n,function(t,n){Xe(t,r)&&(void 0===n?r(h.ENOENT(e)):r(null,He.fromBuffer(n)))})},n.prototype.getDirListing=function(t,e,n,r){n.isDirectory()?t.get(n.id,function(t,n){if(Xe(t,r))try{r(null,JSON.parse(n.toString()))}catch(t){r(h.ENOENT(e))}}):r(h.ENOTDIR(e))},n.prototype.findINodeAndDirListing=function(t,e,n){var r=this;this.findINode(t,e,function(i,o){Xe(i,n)&&r.getDirListing(t,e,o,function(t,e){Xe(t,n)&&n(null,o,e)})})},n.prototype.addNewNode=function(t,e,n){var r,i=0,o=function(){5==++i?n(new h(s.EIO,"Unable to commit data to key-value store.")):(r=Ye(),t.put(r,e,!1,function(t,e){t||!e?o():n(null,r)}))};o()},n.prototype.commitNewFile=function(e,n,r,i,o,s){var c=this,u=a.dirname(n),f=a.basename(n),l=(new Date).getTime();if("/"===n)return s(h.EEXIST(n));this.findINodeAndDirListing(e,u,function(a,u,p){Ke(a,e,s)&&(p[f]?e.abort(function(){s(h.EEXIST(n))}):c.addNewNode(e,o,function(n,a){if(Ke(n,e,s)){var h=new He(a,o.length,i|r,l,l,l);c.addNewNode(e,h.toBuffer(),function(n,r){Ke(n,e,s)&&(p[f]=r,e.put(u.id,t.from(JSON.stringify(p)),!0,function(t){Ke(t,e,s)&&e.commit(function(t){Ke(t,e,s)&&s(null,h)})}))})}}))})},n.prototype.removeEntry=function(e,n,r){var i=this;this._cache&&this._cache.remove(e);var o=this.store.beginTransaction("readwrite"),s=a.dirname(e),c=a.basename(e);this.findINodeAndDirListing(o,s,function(s,a,u){if(Ke(s,o,r))if(u[c]){var f=u[c];delete u[c],i.getINode(o,e,f,function(i,s){Ke(i,o,r)&&(!n&&s.isDirectory()?o.abort(function(){r(h.EISDIR(e))}):n&&!s.isDirectory()?o.abort(function(){r(h.ENOTDIR(e))}):o.del(s.id,function(e){Ke(e,o,r)&&o.del(f,function(e){Ke(e,o,r)&&o.put(a.id,t.from(JSON.stringify(u)),!0,function(t){Ke(t,o,r)&&o.commit(r)})})}))})}else o.abort(function(){r(h.ENOENT(e))})})},n}(et),rn=function(){this.store={}};rn.prototype.name=function(){return on.Name},rn.prototype.clear=function(){this.store={}},rn.prototype.beginTransaction=function(t){return new Qe(this)},rn.prototype.get=function(t){return this.store[t]},rn.prototype.put=function(t,e,n){return!(!n&&this.store.hasOwnProperty(t))&&(this.store[t]=e,!0)},rn.prototype.del=function(t){delete this.store[t]};var on=function(t){function e(){t.call(this,{store:new rn})}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}(tn);on.Name="InMemory",on.Options={};var sn=function(){try{return m.indexedDB||m.mozIndexedDB||m.webkitIndexedDB||m.msIndexedDB}catch(t){return null}}();function an(t,e){switch(void 0===e&&(e=t.toString()),t.name){case"NotFoundError":return new h(s.ENOENT,e);case"QuotaExceededError":return new h(s.ENOSPC,e);default:return new h(s.EIO,e)}}function cn(t,e,n){return void 0===e&&(e=s.EIO),void 0===n&&(n=null),function(r){r.preventDefault(),t(new h(e,null!==n?n:void 0))}}var un=function(t,e){this.tx=t,this.store=e};un.prototype.get=function(t,e){try{var n=this.store.get(t);n.onerror=cn(e),n.onsuccess=function(t){var n=t.target.result;e(null,void 0===n?n:V(n))}}catch(t){e(an(t))}};var fn=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=z(e);(i=n?this.store.put(o,t):this.store.add(o,t)).onerror=cn(r),i.onsuccess=function(t){r(null,!0)}}catch(t){r(an(t))}},e.prototype.del=function(t,e){try{var n=this.store.delete(t);n.onerror=cn(e),n.onsuccess=function(t){e()}}catch(t){e(an(t))}},e.prototype.commit=function(t){setTimeout(t,0)},e.prototype.abort=function(t){var e=null;try{this.tx.abort()}catch(t){e=an(t)}finally{t(e)}},e}(un),hn=function(t,e){this.db=t,this.storeName=e};hn.Create=function(t,e){var n=sn.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 hn(n.target.result,t))},n.onerror=cn(e,s.EACCES)},hn.prototype.name=function(){return ln.Name+" - "+this.storeName},hn.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=cn(t)}catch(e){t(an(e))}},hn.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 fn(e,n);if("readonly"===t)return new un(e,n);throw new h(s.EINVAL,"Invalid transaction type.")};var ln=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={}),hn.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!==sn&&null!==sn.open("__browserfs_test__")}catch(t){return!1}},e}(nn);ln.Name="IndexedDB",ln.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 pn,dn=!1;try{m.localStorage.setItem("__test__",String.fromCharCode(55296)),dn=m.localStorage.getItem("__test__")===String.fromCharCode(55296)}catch(t){dn=!1}pn=dn?"binary_string":"binary_string_ie",t.isEncoding(pn)||(pn="base64");var yn=function(){};yn.prototype.name=function(){return gn.Name},yn.prototype.clear=function(){m.localStorage.clear()},yn.prototype.beginTransaction=function(t){return new Qe(this)},yn.prototype.get=function(e){try{var n=m.localStorage.getItem(e);if(null!==n)return t.from(n,pn)}catch(t){}},yn.prototype.put=function(t,e,n){try{return!(!n&&null!==m.localStorage.getItem(t))&&(m.localStorage.setItem(t,e.toString(pn)),!0)}catch(t){throw new h(s.ENOSPC,"LocalStorage is full.")}},yn.prototype.del=function(t){try{m.localStorage.removeItem(t)}catch(e){throw new h(s.EIO,"Unable to delete key "+t+": "+e)}};var gn=function(t){function e(){t.call(this,{store:new yn})}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.isAvailable=function(){return void 0!==m.localStorage},e}(tn);gn.Name="LocalStorage",gn.Options={};var _n=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){on.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=a.resolve(t),this.mntMap[t])throw new h(s.EINVAL,"Mount point "+t+" is already taken.");B(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=a.resolve(t),!this.mntMap[t])throw new h(s.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=a.dirname(t)},e.prototype._getFs=function(t){for(var e=this.mountList,n=e.length,r=0;r1?i.length:0))&&(t="/"),{fs:this.mntMap[i],path:t,mountPoint:i}}return{fs:this.rootFs,path:t,mountPoint:"/"}},e.prototype.getName=function(){return e.Name},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.standardizeError=function(t,e,n){var r=t.message.indexOf(e);return-1!==r&&(t.message=t.message.substr(0,r)+n+t.message.substr(r+e.length),t.path=n),t},e.prototype.rename=function(t,e,n){var r=this,i=this._getFs(t),o=this._getFs(e);return i.fs===o.fs?i.fs.rename(i.path,o.path,function(s){s&&r.standardizeError(r.standardizeError(s,i.path,t),o.path,e),n(s)}):A.readFile(t,function(r,i){if(r)return n(r);A.writeFile(e,i,function(e){if(e)return n(e);A.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=A.readFileSync(t);return A.writeFileSync(e,i),A.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 a.resolve(a.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,a.resolve(a.join(i.mountPoint,o)))})},e.prototype.rmdirSync=function(t){var e=this._getFs(t);if(this._containsMountPt(t))throw h.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(h.ENOTEMPTY(t)):r.fs.rmdir(r.path,function(i){e(i?n.standardizeError(i,r.path,t):null)})},e.prototype._containsMountPt=function(t){for(var e=this.mountList,n=e.length,r=0;r=t.length&&i.slice(0,t.length)===t)return!0}return!1},e}(et);function mn(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 h&&e.standardizeError(t[0],o.path,i),s.apply(null,t)}}return o.fs[t].apply(o.fs,n)}}_n.Name="MountableFileSystem",_n.Options={};for(var wn=[["exists","unlink","readlink"],["stat","mkdir","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],vn=0;vn"},On.prototype.getFSUnlocked=function(){return this._fs},On.prototype.diskSpace=function(t,e){this._fs.diskSpace(t,e)},On.prototype.isReadOnly=function(){return this._fs.isReadOnly()},On.prototype.supportsLinks=function(){return this._fs.supportsLinks()},On.prototype.supportsProps=function(){return this._fs.supportsProps()},On.prototype.supportsSynch=function(){return this._fs.supportsSynch()},On.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)})})},On.prototype.renameSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(t,e)},On.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)})})},On.prototype.statSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(t,e)},On.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)})})},On.prototype.openSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(t,e,n)},On.prototype.unlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.unlink(t,function(t){n._mu.unlock(),e(t)})})},On.prototype.unlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(t)},On.prototype.rmdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.rmdir(t,function(t){n._mu.unlock(),e(t)})})},On.prototype.rmdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(t)},On.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)})})},On.prototype.mkdirSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(t,e)},On.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)})})},On.prototype.readdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(t)},On.prototype.exists=function(t,e){var n=this;this._mu.lock(function(){n._fs.exists(t,function(t){n._mu.unlock(),e(t)})})},On.prototype.existsSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(t)},On.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)})})},On.prototype.realpathSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(t,e)},On.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)})})},On.prototype.truncateSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.truncateSync(t,e)},On.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)})})},On.prototype.readFileSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(t,e,n)},On.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)})})},On.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)},On.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)})})},On.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)},On.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)})})},On.prototype.chmodSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(t,e,n)},On.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)})})},On.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)},On.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)})})},On.prototype.utimesSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(t,e,n)},On.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)})})},On.prototype.linkSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(t,e)},On.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)})})},On.prototype.symlinkSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,n)},On.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)})})},On.prototype.readlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(t)};var In="/.deletedFiles.log";function Fn(t){return 146|t}function Nn(t){return d.getFileFlag(t)}var Tn,Rn=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}(it),Ln=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 h(s.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,Nn("w"),t.getStats().mode,e)})},e.prototype._syncSync=function(t){this.createParentDirectories(t.getPath()),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,Nn("w"),t.getStats().mode)},e.prototype.getName=function(){return xn.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(In,"utf8",Nn("r"),function(t,n){if(t){if(t.errno!==s.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===In||e===In?n(h.EPERM("Cannot rename deletion log.")):t===e?n():void this.stat(t,!1,function(i,o){return i?n(i):r.stat(e,!1,function(i,c){var u=r;function f(r){var i=r.shift();if(!i)return n();var o=a.resolve(t,i),s=a.resolve(e,i);u.rename(o,s,function(t){if(t)return n(t);f(r)})}var l=511;if(o.isDirectory()){if(i)return i.errno!==s.ENOENT?n(i):r._writable.exists(t,function(i){if(i)return r._writable.rename(t,e,n);r._writable.mkdir(e,l,function(e){if(e)return n(e);r._readable.readdir(t,function(t,e){if(t)return n();f(e)})})});if(l=c.mode,!c.isDirectory())return n(h.ENOTDIR(e));r.readdir(e,function(i,o){if(o&&o.length)return n(h.ENOTEMPTY(e));r._readable.readdir(t,function(t,e){if(t)return n();f(e)})})}if(c&&c.isDirectory())return n(h.EISDIR(e));r.readFile(t,null,Nn("r"),function(i,s){return i?n(i):r.writeFile(e,s,null,Nn("w"),o.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===In||e===In)throw h.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 h.ENOTDIR(e);if(this.readdirSync(e).length>0)throw h.ENOTEMPTY(e)}this._writable.existsSync(t)?this._writable.renameSync(t,e):this._writable.existsSync(e)||this._writable.mkdirSync(e,i),this._readable.existsSync(t)&&this._readable.readdirSync(t).forEach(function(r){n.renameSync(a.resolve(t,r),a.resolve(e,r))})}else{if(this.existsSync(e)&&this.statSync(e,!1).isDirectory())throw h.EISDIR(e);this.writeFileSync(e,this.readFileSync(t,null,Nn("r")),null,Nn("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,o){i&&i.errno===s.ENOENT?(r._deletedFiles[t]&&n(h.ENOENT(t)),r._readable.stat(t,e,function(t,e){e&&((e=y.clone(e)).mode=Fn(e.mode)),n(t,e)})):n(i,o)})},e.prototype.statSync=function(t,e){this.checkInitialized();try{return this._writable.statSync(t,e)}catch(r){if(this._deletedFiles[t])throw h.ENOENT(t);var n=y.clone(this._readable.statSync(t,e));return n.mode=Fn(n.mode),n}},e.prototype.open=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&!this.checkPathAsync(t,r)&&this.stat(t,!1,function(o,s){if(s)switch(e.pathExistsAction()){case f.TRUNCATE_FILE:return i.createParentDirectoriesAsync(t,function(o){if(o)return r(o);i._writable.open(t,e,n,r)});case f.NOP:return i._writable.exists(t,function(o){o?i._writable.open(t,e,n,r):((s=y.clone(s)).mode=n,i._readable.readFile(t,null,Nn("r"),function(n,o){if(n)return r(n);-1===s.size&&(s.size=o.length);var a=new Rn(i,t,e,s,o);r(null,a)}))});default:return r(h.EEXIST(t))}else switch(e.pathNotExistsAction()){case f.CREATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):i._writable.open(t,e,n,r)});default:return r(h.ENOENT(t))}})},e.prototype.openSync=function(t,e,n){if(this.checkInitialized(),this.checkPath(t),t===In)throw h.EPERM("Cannot open deletion log.");if(this.existsSync(t))switch(e.pathExistsAction()){case f.TRUNCATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);case f.NOP:if(this._writable.existsSync(t))return this._writable.openSync(t,e,n);var r=this._readable.readFileSync(t,null,Nn("r")),i=y.clone(this._readable.statSync(t,!1));return i.mode=n,new Rn(this,t,e,i,r);default:throw h.EEXIST(t)}else switch(e.pathNotExistsAction()){case f.CREATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);default:throw h.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(h.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 h.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(h.ENOTEMPTY(t)):(n.deletePath(t),void e(null))})};this.exists(t,function(i){if(!i)return e(h.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 h.ENOENT(t);if(this._writable.existsSync(t)&&this._writable.rmdirSync(t),this.existsSync(t)){if(this.readdirSync(t).length>0)throw h.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(h.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 h.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,!1,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+"/"+e]})).filter(function(t){var e=!s[t];return s[t]=!0,e});e(null,a)})}):e(h.ENOTDIR(t))})},e.prototype.readdirSync=function(t){var e=this;if(this.checkInitialized(),!this.statSync(t,!1).isDirectory())throw h.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+"/"+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(In,this._deleteLog,"utf8",d.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 h(s.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 h(s.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===In)throw h.EPERM(t)},e.prototype.checkPathAsync=function(t,e){return t===In&&(e(h.EPERM(t)),!0)},e.prototype.createParentDirectoriesAsync=function(t,e){var n=a.dirname(t),r=[],i=this;this._writable.stat(n,!1,function t(o,c){o?"/"===n?e(new h(s.EBUSY,"Invariant failed: root does not exist!")):(r.push(n),n=a.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=a.dirname(t),r=[];!this._writable.existsSync(n);)r.push(n),n=a.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 h.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(h.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,Nn("r")),null,Nn("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,Nn("r"),function(r,o){if(r)return e(r);n.writeFile(t,o,null,Nn("w"),i.mode,e)})})},e}(et),xn=function(t){function e(e,n){t.call(this,new Ln(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 Ln.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}(On);xn.Name="OverlayFS",xn.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."}},function(t){t[t.CB=0]="CB",t[t.FD=1]="FD",t[t.API_ERROR=2]="API_ERROR",t[t.STATS=3]="STATS",t[t.PROBE=4]="PROBE",t[t.FILEFLAG=5]="FILEFLAG",t[t.BUFFER=6]="BUFFER",t[t.ERROR=7]="ERROR"}(Tn||(Tn={}));var Dn=function(){this._callbacks={},this._nextId=0};Dn.prototype.toRemoteArg=function(t){var e=this._nextId++;return this._callbacks[e]=t,{type:Tn.CB,id:e}},Dn.prototype.toLocalArg=function(t){var e=this._callbacks[t];return delete this._callbacks[t],e};var An=function(){this._fileDescriptors={},this._nextId=0};function Pn(t){return{type:Tn.API_ERROR,errorData:Wn(t.writeToBuffer())}}function Cn(t){return h.fromBuffer(Hn(t.errorData))}function Mn(t){return{type:Tn.ERROR,name:t.name,message:t.message,stack:t.stack}}function Un(t){var e=m[t.name];"function"!=typeof e&&(e=Error);var n=new e(t.message);return n.stack=t.stack,n}function jn(t){return{type:Tn.STATS,statsData:Wn(t.toBuffer())}}function Bn(t){return y.fromBuffer(Hn(t.statsData))}function zn(t){return{type:Tn.FILEFLAG,flagStr:t.getFlagString()}}function qn(t){return d.getFileFlag(t.flagStr)}function Wn(t){return z(t)}function Hn(t){return V(t)}function Vn(t){return{type:Tn.BUFFER,data:Wn(t)}}function Zn(t){return Hn(t.data)}An.prototype.toRemoteArg=function(e,n,r,i){var o,s,a=this._nextId++;this._fileDescriptors[a]=e,e.stat(function(c,u){c?i(c):(s=Wn(u.toBuffer()),r.isReadable()?e.read(t.alloc(u.size),0,u.size,0,function(t,e,c){t?i(t):(o=Wn(c),i(null,{type:Tn.FD,id:a,data:o,stat:s,path:n,flag:r.getFlagString()}))}):i(null,{type:Tn.FD,id:a,data:new ArrayBuffer(0),stat:s,path:n,flag:r.getFlagString()}))})},An.prototype.applyFdAPIRequest=function(t,e){var n=this,r=t.args[0];this._applyFdChanges(r,function(i,o){i?e(i):o[t.method](function(i){"close"===t.method&&delete n._fileDescriptors[r.id],e(i)})})},An.prototype._applyFdChanges=function(t,e){var n=this._fileDescriptors[t.id],r=Hn(t.data),i=y.fromBuffer(Hn(t.stat)),o=d.getFileFlag(t.flag);o.isWriteable()?n.write(r,0,r.length,o.isAppendable()?n.getPos():0,function(t){function s(){n.stat(function(t,r){t?e(t):r.mode!==i.mode?n.chmod(i.mode,function(t){e(t,n)}):e(t,n)})}t?e(t):o.isAppendable()?s():n.truncate(r.length,function(){s()})}):e(null,n)};var Yn=function(t){function e(e,n,r,i,o,s){t.call(this,e,n,r,i,s),this._remoteFdId=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getRemoteFdId=function(){return this._remoteFdId},e.prototype.toRemoteArg=function(){return{type:Tn.FD,id:this._remoteFdId,data:Wn(this.getBuffer()),stat:Wn(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},e.prototype.sync=function(t){this._syncClose("sync",t)},e.prototype.close=function(t){this._syncClose("close",t)},e.prototype._syncClose=function(t,e){var n=this;this.isDirty()?this._fs.syncClose(t,this,function(t){t||n.resetDirty(),e(t)}):e()},e}(it),Xn=function(e){function n(t){var n=this;e.call(this),this._callbackConverter=new Dn,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._worker=t,this._worker.addEventListener("message",function(t){var e=t.data;if(function(t){return t&&"object"==typeof t&&t.hasOwnProperty("browserfsMessage")&&t.browserfsMessage}(e)){var r,i=e.args,o=new Array(i.length);for(r=0;r0&&(c=-1,i={browserfsMessage:!0,cbId:o,args:[Pn(t)]},e.postMessage(i))}for(t=0;t0;){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 sr,r.push([h,f,i])):i=new or(new y(p.FILE,-1,365)),c&&(c._ls[u]=i)}}return e},ir.prototype.fileIterator=function(t){for(var e in this._index)if(this._index.hasOwnProperty(e))for(var n=this._index[e],r=0,i=n.getListing();r0&&"/"!==n.charAt(n.length-1)&&(n+="/"),this.prefixUrl=n,this._index=ir.fromListing(e),!er||r&&Kn?(this._requestFileAsyncInternal=Gn,this._requestFileSizeAsyncInternal=tr):(this._requestFileAsyncInternal=nr,this._requestFileSizeAsyncInternal=rr),Kn?(this._requestFileSyncInternal=Qn,this._requestFileSizeSyncInternal=$n):(this._requestFileSyncInternal=ur,this._requestFileSizeSyncInternal=ur)}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?Gn(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 Kn||er},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 Kn},e.prototype.preloadFile=function(t,e){var n=this._index.getInode(t);if(!ar(n))throw h.EISDIR(t);if(null===n)throw h.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(h.ENOENT(t));ar(i)?(r=i.getData()).size<0?this._requestFileSizeAsync(t,function(t,e){if(t)return n(t);r.size=e,n(null,y.clone(r))}):n(null,y.clone(r)):cr(i)?(r=i.getStats(),n(null,r)):n(h.FileError(s.EINVAL,t))},e.prototype.statSync=function(t,e){var n,r=this._index.getInode(t);if(null===r)throw h.ENOENT(t);if(ar(r))(n=r.getData()).size<0&&(n.size=this._requestFileSizeSync(t));else{if(!cr(r))throw h.FileError(s.EINVAL,t);n=r.getStats()}return n},e.prototype.open=function(t,e,n,r){if(e.isWriteable())return r(new h(s.EPERM,t));var i=this,o=this._index.getInode(t);if(null===o)return r(h.ENOENT(t));if(!ar(o))return r(h.EISDIR(t));var a=o.getData();switch(e.pathExistsAction()){case f.THROW_EXCEPTION:case f.TRUNCATE_FILE:return r(h.EEXIST(t));case f.NOP:if(a.fileData)return r(null,new ot(i,t,e,y.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 ot(i,t,e,y.clone(a),o)))});break;default:return r(new h(s.EINVAL,"Invalid FileMode object."))}},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new h(s.EPERM,t);var r=this._index.getInode(t);if(null===r)throw h.ENOENT(t);if(!ar(r))throw h.EISDIR(t);var i=r.getData();switch(e.pathExistsAction()){case f.THROW_EXCEPTION:case f.TRUNCATE_FILE:throw h.EEXIST(t);case f.NOP:if(i.fileData)return new ot(this,t,e,y.clone(i),i.fileData);var o=this._requestFileSync(t,"buffer");return i.size=o.length,i.fileData=o,new ot(this,t,e,y.clone(i),o);default:throw new h(s.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 h.ENOENT(t);if(cr(e))return e.getListing();throw h.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,Z(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?Z(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}(et);fr.Name="HTTPRequest",fr.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."},preferXHR:{type:"boolean",optional:!0,description:"Whether to prefer XmlHttpRequest or fetch for async operations if both are available. Default: false"}};var hr=function(){};hr.str2byte=function(t,e){for(var n=t.length>e.length?e.length:t.length,r=0;r127){var o=hr.extendedChars.indexOf(t.charAt(r));o>-1&&(i=o+128)}e[i]=r}return n},hr.byte2str=function(t){for(var e=new Array(t.length),n=0;n127?hr.extendedChars[r-128]:String.fromCharCode(r)}return e.join("")},hr.byteLength=function(t){return t.length},hr.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];var lr,pr,dr=n(36).inflateRaw,yr={};function gr(t,e){return new Date(1980+(e>>9),(e>>5&15)-1,31&e,t>>11,t>>5&63,31&t)}function _r(t,e,n,r){return 0===r?"":e?t.toString("utf8",n,n+r):hr.byte2str(t.slice(n,n+r))}!function(t){t[t.MSDOS=0]="MSDOS",t[t.AMIGA=1]="AMIGA",t[t.OPENVMS=2]="OPENVMS",t[t.UNIX=3]="UNIX",t[t.VM_CMS=4]="VM_CMS",t[t.ATARI_ST=5]="ATARI_ST",t[t.OS2_HPFS=6]="OS2_HPFS",t[t.MAC=7]="MAC",t[t.Z_SYSTEM=8]="Z_SYSTEM",t[t.CP_M=9]="CP_M",t[t.NTFS=10]="NTFS",t[t.MVS=11]="MVS",t[t.VSE=12]="VSE",t[t.ACORN_RISC=13]="ACORN_RISC",t[t.VFAT=14]="VFAT",t[t.ALT_MVS=15]="ALT_MVS",t[t.BEOS=16]="BEOS",t[t.TANDEM=17]="TANDEM",t[t.OS_400=18]="OS_400",t[t.OSX=19]="OSX"}(lr||(lr={})),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"}(pr||(pr={}));var mr=function(t){if(this.data=t,67324752!==t.readUInt32LE(0))throw new h(s.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))};mr.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},mr.prototype.flags=function(){return this.data.readUInt16LE(6)},mr.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},mr.prototype.lastModFileTime=function(){return gr(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},mr.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},mr.prototype.crc32=function(){return this.data.readUInt32LE(14)},mr.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},mr.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},mr.prototype.fileName=function(){return _r(this.data,this.useUTF8(),30,this.fileNameLength())},mr.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},mr.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},mr.prototype.useUTF8=function(){return 2048==(2048&this.flags())};var wr=function(t,e,n){this.header=t,this.record=e,this.data=n};wr.prototype.decompress=function(){var t=this.header.compressionMethod(),e=yr[t];if(e)return e(this.data,this.record.compressedSize(),this.record.uncompressedSize(),this.record.flag());var n=pr[t];throw n||(n="Unknown: "+t),new h(s.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+n)},wr.prototype.getHeader=function(){return this.header},wr.prototype.getRecord=function(){return this.record},wr.prototype.getRawData=function(){return this.data};var vr=function(t,e){if(this.zipData=t,this.data=e,33639248!==this.data.readUInt32LE(0))throw new h(s.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()};vr.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},vr.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},vr.prototype.flag=function(){return this.data.readUInt16LE(8)},vr.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},vr.prototype.lastModFileTime=function(){return gr(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},vr.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},vr.prototype.crc32=function(){return this.data.readUInt32LE(16)},vr.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},vr.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},vr.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},vr.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},vr.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},vr.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},vr.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},vr.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},vr.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},vr.prototype.produceFilename=function(){return _r(this.data,this.useUTF8(),46,this.fileNameLength()).replace(/\\/g,"/")},vr.prototype.fileName=function(){return this._filename},vr.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},vr.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},vr.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return _r(this.data,this.useUTF8(),t,this.fileCommentLength())},vr.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},vr.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},vr.prototype.isDirectory=function(){var t=this.fileName();return!!(16&this.externalAttributes())||"/"===t.charAt(t.length-1)},vr.prototype.isFile=function(){return!this.isDirectory()},vr.prototype.useUTF8=function(){return 2048==(2048&this.flag())},vr.prototype.isEncrypted=function(){return 1==(1&this.flag())},vr.prototype.getFileData=function(){var t=this.headerRelativeOffset(),e=new mr(this.zipData.slice(t));return new wr(e,this,this.zipData.slice(t+e.totalSize()))},vr.prototype.getData=function(){return this.getFileData().decompress()},vr.prototype.getRawData=function(){return this.getFileData().getRawData()},vr.prototype.getStats=function(){return new y(p.FILE,this.uncompressedSize(),365,Date.now(),this.lastModFileTime().getTime())};var br=function(t){if(this.data=t,101010256!==this.data.readUInt32LE(0))throw new h(s.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))};br.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},br.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},br.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},br.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},br.prototype.cdSize=function(){return this.data.readUInt32LE(12)},br.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},br.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},br.prototype.cdZipComment=function(){return _r(this.data,!0,22,this.cdZipCommentLength())},br.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())};var Sr=function(t){function e(e,n){void 0===n&&(n=""),t.call(this),this.name=n,this._index=new ir,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){yr[t]=e},e._getEOCD=function(t){for(var e=Math.min(65557,t.length-1),n=22;n-1},Dr.prototype.getRockRidgeOffset=function(){return this._rockRidgeOffset},Dr.prototype.rootCheckForRockRidge=function(t){var e=this.getDirectory(t);this._rockRidgeOffset=e.getDotEntry(t)._getRockRidgeOffset(t),this._rockRidgeOffset>-1&&(this._fileOrDir=null)},Dr.prototype.length=function(){return this._data[0]},Dr.prototype.extendedAttributeRecordLength=function(){return this._data[1]},Dr.prototype.lba=function(){return 2048*this._data.readUInt32LE(2)},Dr.prototype.dataLength=function(){return this._data.readUInt32LE(10)},Dr.prototype.recordingDate=function(){return Ir(this._data,18)},Dr.prototype.fileFlags=function(){return this._data[25]},Dr.prototype.fileUnitSize=function(){return this._data[26]},Dr.prototype.interleaveGapSize=function(){return this._data[27]},Dr.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(28)},Dr.prototype.identifier=function(){return this._getString(33,this._data[32])},Dr.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)},Dr.prototype.isDirectory=function(t){var e=!!(2&this.fileFlags());return!e&&this.hasRockRidge()&&(e=this.getSUEntries(t).filter(function(t){return t instanceof Kr}).length>0),e},Dr.prototype.isSymlink=function(t){return this.hasRockRidge()&&this.getSUEntries(t).filter(function(t){return t instanceof Zr}).length>0},Dr.prototype.getSymlinkPath=function(t){for(var e="",n=this.getSUEntries(t),r=this._getGetString(),i=0,o=n;i1&&"/"===e[e.length-1]?e.slice(0,e.length-1):e},Dr.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},Dr.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},Dr.prototype.getSUEntries=function(t){return this._suEntries||this._constructSUEntries(t),this._suEntries},Dr.prototype._rockRidgeFilename=function(t){var e=this.getSUEntries(t).filter(function(t){return t instanceof Xr});if(0===e.length||6&e[0].flags())return null;for(var n="",r=this._getGetString(),i=0,o=e;i0){var n=e[0];if(n instanceof jr&&n.checkBytesPass())for(var r=1;r0?s-4:s;for(n=0;n>16&255,c[f++]=e>>8&255,c[f++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[f++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[f++]=e>>8&255,c[f++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function h(t,e,n){for(var r,i=[],o=e;o>1,f=-7,h=n?i-1:0,l=n?-1:1,p=t[e+h];for(h+=l,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+t[e+h],h+=l,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=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?l/c:l*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+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[n+p]=255&s,p+=d,s/=256,u-=8);t[n+p-d]|=128*y}},function(t,e,n){"use strict";(function(e){var r=this&&this.__extends||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function r(){this.constructor=t}t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=n(5),o=null,s=function(){function t(t,e){this.fun=t,this.array=e}return t.prototype.run=function(){this.fun.apply(null,this.array)},t}(),a=function(){function t(){this._queue=[],this._draining=!1,this._currentQueue=null,this._queueIndex=-1}return t.prototype.push=function(t){var e=this;1!==this._queue.push(t)||this._draining||setTimeout(function(){return e._drainQueue()},0)},t.prototype._cleanUpNextTick=function(){this._draining=!1,this._currentQueue&&this._currentQueue.length?this._queue=this._currentQueue.concat(this._queue):this._queueIndex=-1,this._queue.length&&this._drainQueue()},t.prototype._drainQueue=function(){var t=this;if(!this._draining){var e=setTimeout(function(){return t._cleanUpNextTick()});this._draining=!0;for(var n=this._queue.length;n;){for(this._currentQueue=this._queue,this._queue=[];++this._queueIndex0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),this._waitingForWrites););},n}(n(24).Duplex);t.exports=i}).call(this,n(9))},function(t,e,n){t.exports=i;var r=n(5).EventEmitter;function i(){r.call(this)}n(1)(i,r),i.Readable=n(11),i.Writable=n(31),i.Duplex=n(32),i.Transform=n(33),i.PassThrough=n(34),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",c));var s=!1;function a(){s||(s=!0,t.end())}function c(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(f(),0===r.listenerCount(this,"error"))throw t}function f(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",c),n.removeListener("error",u),t.removeListener("error",u),n.removeListener("end",f),n.removeListener("close",f),t.removeListener("close",f)}return n.on("error",u),t.on("error",u),n.on("end",f),n.on("close",f),t.on("close",f),t.emit("pipe",n),t}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e){},function(t,e,n){"use strict";var r=n(7).Buffer,i=n(28);function o(t,e,n){t.copy(e,n)}t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e=r.allocUnsafe(t>>>0),n=this.head,i=0;n;)o(n.data,e,i),i+=n.data.length,n=n.next;return e},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(4))},function(t,e,n){"use strict";t.exports=o;var r=n(18),i=Object.create(n(3));function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(1),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(12)},function(t,e,n){t.exports=n(0)},function(t,e,n){t.exports=n(11).Transform},function(t,e,n){t.exports=n(11).PassThrough},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";var r=n(37),i=n(8),o=n(42),s=n(43),a=n(44),c=n(45),u=n(46),f=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var 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 c,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,e.windowBits);if(n!==s.Z_OK)throw new Error(a[n]);if(this.header=new u,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=r.inflateSetDictionary(this.strm,e.dictionary))!==s.Z_OK))throw new Error(a[n])}function l(t,e){var n=new h(e);if(n.push(t,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(t,e){var n,a,c,u,h,l=this.strm,p=this.options.chunkSize,d=this.options.dictionary,y=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof t?l.input=o.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new i.Buf8(p),l.next_out=0,l.avail_out=p),(n=r.inflate(l,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&d&&(n=r.inflateSetDictionary(this.strm,d)),n===s.Z_BUF_ERROR&&!0===y&&(n=s.Z_OK,y=!1),n!==s.Z_STREAM_END&&n!==s.Z_OK)return this.onEnd(n),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&n!==s.Z_STREAM_END&&(0!==l.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(c=o.utf8border(l.output,l.next_out),u=l.next_out-c,h=o.buf2string(l.output,c),l.next_out=u,l.avail_out=p-u,u&&i.arraySet(l.output,l.output,c,u,0),this.onData(h)):this.onData(i.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(y=!0)}while((l.avail_in>0||0===l.avail_out)&&n!==s.Z_STREAM_END);return n===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),l.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===s.Z_OK&&("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},e.Inflate=h,e.inflate=l,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},e.ungzip=l},function(t,e,n){"use strict";var r=n(8),i=n(38),o=n(39),s=n(40),a=n(41),c=0,u=1,f=2,h=4,l=5,p=6,d=0,y=1,g=2,_=-2,m=-3,w=-4,v=-5,b=8,S=1,E=2,k=3,O=4,I=5,F=6,N=7,T=8,R=9,L=10,x=11,D=12,A=13,P=14,C=15,M=16,U=17,j=18,B=19,z=20,q=21,W=22,H=23,V=24,Z=25,Y=26,X=27,K=28,J=29,G=30,Q=31,$=32,tt=852,et=592,nt=15;function rt(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function it(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=S,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(tt),e.distcode=e.distdyn=new r.Buf32(et),e.sane=1,e.back=-1,d):_}function ot(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,it(t)):_}function st(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?_:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,ot(t))):_}function at(t,e){var n,i;return t?(i=new function(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=i,i.window=null,(n=st(t,e))!==d&&(t.state=null),n):_}var ct,ut,ft=!0;function ht(t){if(ft){var e;for(ct=new r.Buf32(512),ut=new r.Buf32(32),e=0;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(a(u,t.lens,0,288,ct,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(f,t.lens,0,32,ut,0,t.work,{bits:5}),ft=!1}t.lencode=ct,t.lenbits=9,t.distcode=ut,t.distbits=5}function lt(t,e,n,i){var o,s=t.state;return null===s.window&&(s.wsize=1<=s.wsize?(r.arraySet(s.window,e,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((o=s.wsize-s.wnext)>i&&(o=i),r.arraySet(s.window,e,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,e,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,n.check=o(n.check,Ft,2,0),at=0,ct=0,n.mode=E;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&at)<<8)+(at>>8))%31){t.msg="incorrect header check",n.mode=G;break}if((15&at)!==b){t.msg="unknown compression method",n.mode=G;break}if(ct-=4,St=8+(15&(at>>>=4)),0===n.wbits)n.wbits=St;else if(St>n.wbits){t.msg="invalid window size",n.mode=G;break}n.dmax=1<>8&1),512&n.flags&&(Ft[0]=255&at,Ft[1]=at>>>8&255,n.check=o(n.check,Ft,2,0)),at=0,ct=0,n.mode=k;case k:for(;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<>>8&255,Ft[2]=at>>>16&255,Ft[3]=at>>>24&255,n.check=o(n.check,Ft,4,0)),at=0,ct=0,n.mode=O;case O:for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<>8),512&n.flags&&(Ft[0]=255&at,Ft[1]=at>>>8&255,n.check=o(n.check,Ft,2,0)),at=0,ct=0,n.mode=I;case I:if(1024&n.flags){for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<>>8&255,n.check=o(n.check,Ft,2,0)),at=0,ct=0}else n.head&&(n.head.extra=null);n.mode=F;case F:if(1024&n.flags&&((pt=n.length)>ot&&(pt=ot),pt&&(n.head&&(St=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,tt,nt,pt,St)),512&n.flags&&(n.check=o(n.check,tt,pt,nt)),ot-=pt,nt+=pt,n.length-=pt),n.length))break t;n.length=0,n.mode=N;case N:if(2048&n.flags){if(0===ot)break t;pt=0;do{St=tt[nt+pt++],n.head&&St&&n.length<65536&&(n.head.name+=String.fromCharCode(St))}while(St&&pt>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=D;break;case L:for(;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<>>=7&ct,ct-=7&ct,n.mode=X;break}for(;ct<3;){if(0===ot)break t;ot--,at+=tt[nt++]<>>=1)){case 0:n.mode=P;break;case 1:if(ht(n),n.mode=z,e===p){at>>>=2,ct-=2;break t}break;case 2:n.mode=U;break;case 3:t.msg="invalid block type",n.mode=G}at>>>=2,ct-=2;break;case P:for(at>>>=7&ct,ct-=7&ct;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=G;break}if(n.length=65535&at,at=0,ct=0,n.mode=C,e===p)break t;case C:n.mode=M;case M:if(pt=n.length){if(pt>ot&&(pt=ot),pt>st&&(pt=st),0===pt)break t;r.arraySet(et,tt,nt,pt,it),ot-=pt,nt+=pt,st-=pt,it+=pt,n.length-=pt;break}n.mode=D;break;case U:for(;ct<14;){if(0===ot)break t;ot--,at+=tt[nt++]<>>=5,ct-=5,n.ndist=1+(31&at),at>>>=5,ct-=5,n.ncode=4+(15&at),at>>>=4,ct-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=G;break}n.have=0,n.mode=j;case j:for(;n.have>>=3,ct-=3}for(;n.have<19;)n.lens[Nt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,kt={bits:n.lenbits},Et=a(c,n.lens,0,19,n.lencode,0,n.work,kt),n.lenbits=kt.bits,Et){t.msg="invalid code lengths set",n.mode=G;break}n.have=0,n.mode=B;case B:for(;n.have>>16&255,mt=65535&It,!((gt=It>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<>>=gt,ct-=gt,n.lens[n.have++]=mt;else{if(16===mt){for(Ot=gt+2;ct>>=gt,ct-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=G;break}St=n.lens[n.have-1],pt=3+(3&at),at>>>=2,ct-=2}else if(17===mt){for(Ot=gt+3;ct>>=gt)),at>>>=3,ct-=3}else{for(Ot=gt+7;ct>>=gt)),at>>>=7,ct-=7}if(n.have+pt>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=G;break}for(;pt--;)n.lens[n.have++]=St}}if(n.mode===G)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=G;break}if(n.lenbits=9,kt={bits:n.lenbits},Et=a(u,n.lens,0,n.nlen,n.lencode,0,n.work,kt),n.lenbits=kt.bits,Et){t.msg="invalid literal/lengths set",n.mode=G;break}if(n.distbits=6,n.distcode=n.distdyn,kt={bits:n.distbits},Et=a(f,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,kt),n.distbits=kt.bits,Et){t.msg="invalid distances set",n.mode=G;break}if(n.mode=z,e===p)break t;case z:n.mode=q;case q:if(ot>=6&&st>=258){t.next_out=it,t.avail_out=st,t.next_in=nt,t.avail_in=ot,n.hold=at,n.bits=ct,s(t,ft),it=t.next_out,et=t.output,st=t.avail_out,nt=t.next_in,tt=t.input,ot=t.avail_in,at=n.hold,ct=n.bits,n.mode===D&&(n.back=-1);break}for(n.back=0;_t=(It=n.lencode[at&(1<>>16&255,mt=65535&It,!((gt=It>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<>wt)])>>>16&255,mt=65535&It,!(wt+(gt=It>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<>>=wt,ct-=wt,n.back+=wt}if(at>>>=gt,ct-=gt,n.back+=gt,n.length=mt,0===_t){n.mode=Y;break}if(32&_t){n.back=-1,n.mode=D;break}if(64&_t){t.msg="invalid literal/length code",n.mode=G;break}n.extra=15&_t,n.mode=W;case W:if(n.extra){for(Ot=n.extra;ct>>=n.extra,ct-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=H;case H:for(;_t=(It=n.distcode[at&(1<>>16&255,mt=65535&It,!((gt=It>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<>wt)])>>>16&255,mt=65535&It,!(wt+(gt=It>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<>>=wt,ct-=wt,n.back+=wt}if(at>>>=gt,ct-=gt,n.back+=gt,64&_t){t.msg="invalid distance code",n.mode=G;break}n.offset=mt,n.extra=15&_t,n.mode=V;case V:if(n.extra){for(Ot=n.extra;ct>>=n.extra,ct-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=G;break}n.mode=Z;case Z:if(0===st)break t;if(pt=ft-st,n.offset>pt){if((pt=n.offset-pt)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=G;break}pt>n.wnext?(pt-=n.wnext,dt=n.wsize-pt):dt=n.wnext-pt,pt>n.length&&(pt=n.length),yt=n.window}else yt=et,dt=it-n.offset,pt=n.length;pt>st&&(pt=st),st-=pt,n.length-=pt;do{et[it++]=yt[dt++]}while(--pt);0===n.length&&(n.mode=q);break;case Y:if(0===st)break t;et[it++]=n.length,st--,n.mode=q;break;case X:if(n.wrap){for(;ct<32;){if(0===ot)break t;ot--,at|=tt[nt++]<>>16&65535|0,s=0;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";var r=function(){for(var t,e=[],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=function(t,e,n,i){var o=r,s=i+n;t^=-1;for(var a=i;a>>8^o[255&(t^e[a])];return-1^t}},function(t,e,n){"use strict";t.exports=function(t,e){var n,r,i,o,s,a,c,u,f,h,l,p,d,y,g,_,m,w,v,b,S,E,k,O,I;n=t.state,r=t.next_in,O=t.input,i=r+(t.avail_in-5),o=t.next_out,I=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),c=n.dmax,u=n.wsize,f=n.whave,h=n.wnext,l=n.window,p=n.hold,d=n.bits,y=n.lencode,g=n.distcode,_=(1<>>=v=w>>>24,d-=v,0===(v=w>>>16&255))I[o++]=65535&w;else{if(!(16&v)){if(0==(64&v)){w=y[(65535&w)+(p&(1<>>=v,d-=v),d<15&&(p+=O[r++]<>>=v=w>>>24,d-=v,!(16&(v=w>>>16&255))){if(0==(64&v)){w=g[(65535&w)+(p&(1<c){t.msg="invalid distance too far back",n.mode=30;break t}if(p>>>=v,d-=v,S>(v=o-s)){if((v=S-v)>f&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(E=0,k=l,0===h){if(E+=u-v,v2;)I[o++]=k[E++],I[o++]=k[E++],I[o++]=k[E++],b-=3;b&&(I[o++]=k[E++],b>1&&(I[o++]=k[E++]))}else{E=o-S;do{I[o++]=I[E++],I[o++]=I[E++],I[o++]=I[E++],b-=3}while(b>2);b&&(I[o++]=I[E++],b>1&&(I[o++]=I[E++]))}break}}break}}while(r>3,p&=(1<<(d-=b<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r=1&&0===P[I];I--);if(F>I&&(F=I),0===I)return u[f++]=20971520,u[f++]=20971520,l.bits=1,0;for(O=1;O0&&(0===t||1!==I))return-1;for(C[1]=0,E=1;E<15;E++)C[E+1]=C[E]+P[E];for(k=0;k852||2===t&&L>592)return 1;for(;;){w=E-T,h[k]m?(v=M[U+h[k]],b=D[A+h[k]]):(v=96,b=0),p=1<>T)+(d-=p)]=w<<24|v<<16|b|0}while(0!==d);for(p=1<>=1;if(0!==p?(x&=p-1,x+=p):x=0,k++,0==--P[E]){if(E===I)break;E=e[n+h[k]]}if(E>F&&(x&g)!==y){for(0===T&&(T=F),_+=O,R=1<<(N=E-T);N+T852||2===t&&L>592)return 1;u[y=x&g]=F<<24|N<<16|_-f|0}}return 0!==x&&(u[_+x]=E-T<<24|64<<16|0),l.bits=F,0}},function(t,e,n){"use strict";var r=n(8),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var s=new r.Buf8(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",s=0;s>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},e.buf2binstring=function(t){return c(t,t.length)},e.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n4)u[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&n1?u[r++]=65533:i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return c(u,r)},e.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0?e:0===n?e:n+s[t[n]]>e?n:e}},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_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";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}}])}); //# sourceMappingURL=browserfs.min.js.map