forked from cs-education/sysbuild
-
Notifications
You must be signed in to change notification settings - Fork 7
/
browserfs.min.js
9 lines (9 loc) · 228 KB
/
browserfs.min.js
1
2
3
4
5
6
7
8
9
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.BrowserFS=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};a[g][0].call(k.exports,function(b){var c=a[g][1][b];return e(c?c:b)},k,k.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(b,c,d){(function(b,d){!function(){function e(){}function f(a){return a}function g(a){return!!a}function h(a){return!a}function i(a){return function(){if(null===a)throw new Error("Callback was already called.");a.apply(this,arguments),a=null}}function j(a){return function(){null!==a&&(a.apply(this,arguments),a=null)}}function k(a){return O(a)||"number"==typeof a.length&&a.length>=0&&a.length%1===0}function l(a,b){for(var c=-1,d=a.length;++c<d;)b(a[c],c,a)}function m(a,b){for(var c=-1,d=a.length,e=Array(d);++c<d;)e[c]=b(a[c],c,a);return e}function n(a){return m(Array(a),function(a,b){return b})}function o(a,b,c){return l(a,function(a,d,e){c=b(c,a,d,e)}),c}function p(a,b){l(Q(a),function(c){b(a[c],c)})}function q(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return c;return-1}function r(a){var b,c,d=-1;return k(a)?(b=a.length,function(){return d++,b>d?d:null}):(c=Q(a),b=c.length,function(){return d++,b>d?c[d]:null})}function s(a,b){return b=null==b?a.length-1:+b,function(){for(var c=Math.max(arguments.length-b,0),d=Array(c),e=0;c>e;e++)d[e]=arguments[e+b];switch(b){case 0:return a.call(this,d);case 1:return a.call(this,arguments[0],d)}}}function t(a){return function(b,c,d){return a(b,d)}}function u(a){return function(b,c,d){d=j(d||e),b=b||[];var f=r(b);if(0>=a)return d(null);var g=!1,h=0,k=!1;!function l(){if(g&&0>=h)return d(null);for(;a>h&&!k;){var e=f();if(null===e)return g=!0,void(0>=h&&d(null));h+=1,c(b[e],e,i(function(a){h-=1,a?(d(a),k=!0):l()}))}}()}}function v(a){return function(b,c,d){return a(L.eachOf,b,c,d)}}function w(a){return function(b,c,d,e){return a(u(c),b,d,e)}}function x(a){return function(b,c,d){return a(L.eachOfSeries,b,c,d)}}function y(a,b,c,d){d=j(d||e),b=b||[];var f=k(b)?[]:{};a(b,function(a,b,d){c(a,function(a,c){f[b]=c,d(a)})},function(a){d(a,f)})}function z(a,b,c,d){var e=[];a(b,function(a,b,d){c(a,function(c){c&&e.push({index:b,value:a}),d()})},function(){d(m(e.sort(function(a,b){return a.index-b.index}),function(a){return a.value}))})}function A(a,b,c,d){z(a,b,function(a,b){c(a,function(a){b(!a)})},d)}function B(a,b,c){return function(d,e,f,g){function h(){g&&g(c(!1,void 0))}function i(a,d,e){return g?void f(a,function(d){g&&b(d)&&(g(c(!0,a)),g=f=!1),e()}):e()}arguments.length>3?a(d,e,i,h):(g=f,f=e,a(d,i,h))}}function C(a,b){return b}function D(a,b,c){c=c||e;var d=k(b)?[]:{};a(b,function(a,b,c){a(s(function(a,e){e.length<=1&&(e=e[0]),d[b]=e,c(a)}))},function(a){c(a,d)})}function E(a,b,c,d){var e=[];a(b,function(a,b,d){c(a,function(a,b){e=e.concat(b||[]),d(a)})},function(a){d(a,e)})}function F(a,b,c){function d(a,b,c,d){if(null!=d&&"function"!=typeof d)throw new Error("task callback must be a function");return a.started=!0,O(b)||(b=[b]),0===b.length&&a.idle()?L.setImmediate(function(){a.drain()}):(l(b,function(b){var f={data:b,callback:d||e};c?a.tasks.unshift(f):a.tasks.push(f),a.tasks.length===a.concurrency&&a.saturated()}),void L.setImmediate(a.process))}function f(a,b){return function(){g-=1;var c=!1,d=arguments;l(b,function(a){l(h,function(b,d){b!==a||c||(h.splice(d,1),c=!0)}),a.callback.apply(a,d)}),a.tasks.length+g===0&&a.drain(),a.process()}}if(null==b)b=1;else if(0===b)throw new Error("Concurrency must not be zero");var g=0,h=[],j={tasks:[],concurrency:b,payload:c,saturated:e,empty:e,drain:e,started:!1,paused:!1,push:function(a,b){d(j,a,!1,b)},kill:function(){j.drain=e,j.tasks=[]},unshift:function(a,b){d(j,a,!0,b)},process:function(){if(!j.paused&&g<j.concurrency&&j.tasks.length)for(;g<j.concurrency&&j.tasks.length;){var b=j.payload?j.tasks.splice(0,j.payload):j.tasks.splice(0,j.tasks.length),c=m(b,function(a){return a.data});0===j.tasks.length&&j.empty(),g+=1,h.push(b[0]);var d=i(f(j,b));a(c,d)}},length:function(){return j.tasks.length},running:function(){return g},workersList:function(){return h},idle:function(){return j.tasks.length+g===0},pause:function(){j.paused=!0},resume:function(){if(j.paused!==!1){j.paused=!1;for(var a=Math.min(j.concurrency,j.tasks.length),b=1;a>=b;b++)L.setImmediate(j.process)}}};return j}function G(a){return s(function(b,c){b.apply(null,c.concat([s(function(b,c){"object"==typeof console&&(b?console.error&&console.error(b):console[a]&&l(c,function(b){console[a](b)}))})]))})}function H(a){return function(b,c,d){a(n(b),c,d)}}function I(a){return s(function(b,c){var d=s(function(c){var d=this,e=c.pop();return a(b,function(a,b,e){a.apply(d,c.concat([e]))},e)});return c.length?d.apply(this,c):d})}function J(a){return s(function(b){var c=b.pop();b.push(function(){var a=arguments;d?L.setImmediate(function(){c.apply(null,a)}):c.apply(null,a)});var d=!0;a.apply(this,b),d=!1})}var K,L={},M="object"==typeof self&&self.self===self&&self||"object"==typeof d&&d.global===d&&d||this;null!=M&&(K=M.async),L.noConflict=function(){return M.async=K,L};var N=Object.prototype.toString,O=Array.isArray||function(a){return"[object Array]"===N.call(a)},P=function(a){var b=typeof a;return"function"===b||"object"===b&&!!a},Q=Object.keys||function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},R="function"==typeof setImmediate&&setImmediate,S=R?function(a){R(a)}:function(a){setTimeout(a,0)};"object"==typeof b&&"function"==typeof b.nextTick?L.nextTick=b.nextTick:L.nextTick=S,L.setImmediate=R?S:L.nextTick,L.forEach=L.each=function(a,b,c){return L.eachOf(a,t(b),c)},L.forEachSeries=L.eachSeries=function(a,b,c){return L.eachOfSeries(a,t(b),c)},L.forEachLimit=L.eachLimit=function(a,b,c,d){return u(b)(a,t(c),d)},L.forEachOf=L.eachOf=function(a,b,c){function d(a){h--,a?c(a):null===f&&0>=h&&c(null)}c=j(c||e),a=a||[];for(var f,g=r(a),h=0;null!=(f=g());)h+=1,b(a[f],f,i(d));0===h&&c(null)},L.forEachOfSeries=L.eachOfSeries=function(a,b,c){function d(){var e=!0;return null===g?c(null):(b(a[g],g,i(function(a){if(a)c(a);else{if(g=f(),null===g)return c(null);e?L.setImmediate(d):d()}})),void(e=!1))}c=j(c||e),a=a||[];var f=r(a),g=f();d()},L.forEachOfLimit=L.eachOfLimit=function(a,b,c,d){u(b)(a,c,d)},L.map=v(y),L.mapSeries=x(y),L.mapLimit=w(y),L.inject=L.foldl=L.reduce=function(a,b,c,d){L.eachOfSeries(a,function(a,d,e){c(b,a,function(a,c){b=c,e(a)})},function(a){d(a,b)})},L.foldr=L.reduceRight=function(a,b,c,d){var e=m(a,f).reverse();L.reduce(e,b,c,d)},L.transform=function(a,b,c,d){3===arguments.length&&(d=c,c=b,b=O(a)?[]:{}),L.eachOf(a,function(a,d,e){c(b,a,d,e)},function(a){d(a,b)})},L.select=L.filter=v(z),L.selectLimit=L.filterLimit=w(z),L.selectSeries=L.filterSeries=x(z),L.reject=v(A),L.rejectLimit=w(A),L.rejectSeries=x(A),L.any=L.some=B(L.eachOf,g,f),L.someLimit=B(L.eachOfLimit,g,f),L.all=L.every=B(L.eachOf,h,h),L.everyLimit=B(L.eachOfLimit,h,h),L.detect=B(L.eachOf,f,C),L.detectSeries=B(L.eachOfSeries,f,C),L.detectLimit=B(L.eachOfLimit,f,C),L.sortBy=function(a,b,c){function d(a,b){var c=a.criteria,d=b.criteria;return d>c?-1:c>d?1:0}L.map(a,function(a,c){b(a,function(b,d){b?c(b):c(null,{value:a,criteria:d})})},function(a,b){return a?c(a):void c(null,m(b.sort(d),function(a){return a.value}))})},L.auto=function(a,b,c){function d(a){n.unshift(a)}function f(a){var b=q(n,a);b>=0&&n.splice(b,1)}function g(){i--,l(n.slice(0),function(a){a()})}c||(c=b,b=null),c=j(c||e);var h=Q(a),i=h.length;if(!i)return c(null);b||(b=i);var k={},m=0,n=[];d(function(){i||c(null,k)}),l(h,function(e){function h(){return b>m&&o(r,function(a,b){return a&&k.hasOwnProperty(b)},!0)&&!k.hasOwnProperty(e)}function i(){h()&&(m++,f(i),l[l.length-1](n,k))}for(var j,l=O(a[e])?a[e]:[a[e]],n=s(function(a,b){if(m--,b.length<=1&&(b=b[0]),a){var d={};p(k,function(a,b){d[b]=a}),d[e]=b,c(a,d)}else k[e]=b,L.setImmediate(g)}),r=l.slice(0,l.length-1),t=r.length;t--;){if(!(j=a[r[t]]))throw new Error("Has inexistant dependency");if(O(j)&&q(j,e)>=0)throw new Error("Has cyclic dependencies")}h()?(m++,l[l.length-1](n,k)):d(i)})},L.retry=function(a,b,c){function d(a,b){if("number"==typeof b)a.times=parseInt(b,10)||f;else{if("object"!=typeof b)throw new Error("Unsupported argument type for 'times': "+typeof b);a.times=parseInt(b.times,10)||f,a.interval=parseInt(b.interval,10)||g}}function e(a,b){function c(a,c){return function(d){a(function(a,b){d(!a||c,{err:a,result:b})},b)}}function d(a){return function(b){setTimeout(function(){b(null)},a)}}for(;i.times;){var e=!(i.times-=1);h.push(c(i.task,e)),!e&&i.interval>0&&h.push(d(i.interval))}L.series(h,function(b,c){c=c[c.length-1],(a||i.callback)(c.err,c.result)})}var f=5,g=0,h=[],i={times:f,interval:g},j=arguments.length;if(1>j||j>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=j&&"function"==typeof a&&(c=b,b=a),"function"!=typeof a&&d(i,a),i.callback=c,i.task=b,i.callback?e():e},L.waterfall=function(a,b){function c(a){return s(function(d,e){if(d)b.apply(null,[d].concat(e));else{var f=a.next();f?e.push(c(f)):e.push(b),J(a).apply(null,e)}})}if(b=j(b||e),!O(a)){var d=new Error("First argument to waterfall must be an array of functions");return b(d)}return a.length?void c(L.iterator(a))():b()},L.parallel=function(a,b){D(L.eachOf,a,b)},L.parallelLimit=function(a,b,c){D(u(b),a,c)},L.series=function(a,b){D(L.eachOfSeries,a,b)},L.iterator=function(a){function b(c){function d(){return a.length&&a[c].apply(null,arguments),d.next()}return d.next=function(){return c<a.length-1?b(c+1):null},d}return b(0)},L.apply=s(function(a,b){return s(function(c){return a.apply(null,b.concat(c))})}),L.concat=v(E),L.concatSeries=x(E),L.whilst=function(a,b,c){if(c=c||e,a()){var d=s(function(e,f){e?c(e):a.apply(this,f)?b(d):c(null)});b(d)}else c(null)},L.doWhilst=function(a,b,c){var d=0;return L.whilst(function(){return++d<=1||b.apply(this,arguments)},a,c)},L.until=function(a,b,c){return L.whilst(function(){return!a.apply(this,arguments)},b,c)},L.doUntil=function(a,b,c){return L.doWhilst(a,function(){return!b.apply(this,arguments)},c)},L.during=function(a,b,c){c=c||e;var d=s(function(b,d){b?c(b):(d.push(f),a.apply(this,d))}),f=function(a,e){a?c(a):e?b(d):c(null)};a(f)},L.doDuring=function(a,b,c){var d=0;L.during(function(a){d++<1?a(null,!0):b.apply(this,arguments)},a,c)},L.queue=function(a,b){var c=F(function(b,c){a(b[0],c)},b,1);return c},L.priorityQueue=function(a,b){function c(a,b){return a.priority-b.priority}function d(a,b,c){for(var d=-1,e=a.length-1;e>d;){var f=d+(e-d+1>>>1);c(b,a[f])>=0?d=f:e=f-1}return d}function f(a,b,f,g){if(null!=g&&"function"!=typeof g)throw new Error("task callback must be a function");return a.started=!0,O(b)||(b=[b]),0===b.length?L.setImmediate(function(){a.drain()}):void l(b,function(b){var h={data:b,priority:f,callback:"function"==typeof g?g:e};a.tasks.splice(d(a.tasks,h,c)+1,0,h),a.tasks.length===a.concurrency&&a.saturated(),L.setImmediate(a.process)})}var g=L.queue(a,b);return g.push=function(a,b,c){f(g,a,b,c)},delete g.unshift,g},L.cargo=function(a,b){return F(a,1,b)},L.log=G("log"),L.dir=G("dir"),L.memoize=function(a,b){var c={},d={};b=b||f;var e=s(function(e){var f=e.pop(),g=b.apply(null,e);g in c?L.setImmediate(function(){f.apply(null,c[g])}):g in d?d[g].push(f):(d[g]=[f],a.apply(null,e.concat([s(function(a){c[g]=a;var b=d[g];delete d[g];for(var e=0,f=b.length;f>e;e++)b[e].apply(null,a)})])))});return e.memo=c,e.unmemoized=a,e},L.unmemoize=function(a){return function(){return(a.unmemoized||a).apply(null,arguments)}},L.times=H(L.map),L.timesSeries=H(L.mapSeries),L.timesLimit=function(a,b,c,d){return L.mapLimit(n(a),b,c,d)},L.seq=function(){var a=arguments;return s(function(b){var c=this,d=b[b.length-1];"function"==typeof d?b.pop():d=e,L.reduce(a,b,function(a,b,d){b.apply(c,a.concat([s(function(a,b){d(a,b)})]))},function(a,b){d.apply(c,[a].concat(b))})})},L.compose=function(){return L.seq.apply(null,Array.prototype.reverse.call(arguments))},L.applyEach=I(L.eachOf),L.applyEachSeries=I(L.eachOfSeries),L.forever=function(a,b){function c(a){return a?d(a):void f(c)}var d=i(b||e),f=J(a);c()},L.ensureAsync=J,L.constant=s(function(a){var b=[null].concat(a);return function(a){return a.apply(this,b)}}),L.wrapSync=L.asyncify=function(a){return s(function(b){var c,d=b.pop();try{c=a.apply(this,b)}catch(e){return d(e)}P(c)&&"function"==typeof c.then?c.then(function(a){d(null,a)})["catch"](function(a){d(a.message?a:new Error(a))}):d(null,c)})},"object"==typeof c&&c.exports?c.exports=L:"function"==typeof a&&a.amd?a([],function(){return L}):M.async=L}()}).call(this,b("bfs-process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bfs-process":11}],2:[function(a,b,c){function d(a,b,c,d,e,f){if(b>e||f>b)throw new TypeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function e(a,b,c,d){if(c+d>a.length)throw new RangeError("index out of range")}function f(a,b,c){if(a+b>c)throw new RangeError("index out of range")}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("./buffer_core"),i=a("./buffer_core_array"),j=a("./buffer_core_arraybuffer"),k=a("./buffer_core_imagedata"),l=a("./string_util"),m=a("./util"),n=[j,k,i],o=function(){var a,b;for(a=0;a<n.length;a++)if(b=n[a],b.isAvailable())return b;throw new Error("This browser does not support any available BufferCore implementations.")}(),p={};p[0]=0,p[1]=127,p[2]=32767,p[3]=8388607,p[4]=2147483647,p[5]=549755813887,p[6]=0x7fffffffffff;var q={};q[0]=0,q[1]=-128,q[2]=-32768,q[3]=-8388608,q[4]=-2147483648,q[5]=-549755813888,q[6]=-0x800000000000;var r={};r[0]=0,r[1]=255,r[2]=65535,r[3]=16777215,r[4]=4294967295,r[5]=0xffffffffff,r[6]=0xffffffffffff;var s=function(){function a(b,c,d){void 0===c&&(c="utf8"),this.offset=0;var e;if(!(this instanceof a))return new a(b,c);if(b instanceof h.BufferCoreCommon){this.data=b;var f="number"==typeof c?c:0,g="number"==typeof d?d:this.data.getLength();this.offset=f,this.length=g-f}else if("number"==typeof b){if(b!==b>>>0)throw new RangeError("Buffer size must be a uint32.");this.length=b,this.data=new o(b)}else if(m.isArrayBufferView(b))this.data=new j(b),this.length=b.byteLength;else if(m.isArrayBuffer(b))this.data=new j(b),this.length=b.byteLength;else if(b instanceof a){var i=b;this.data=new o(b.length),this.length=b.length,i.copy(this)}else if(Array.isArray(b)||null!=b&&"object"==typeof b&&"number"==typeof b[0]){for(this.data=new o(b.length),e=0;e<b.length;e++)this.data.writeUInt8(e,b[e]);this.length=b.length}else if("string"==typeof b)this.length=a.byteLength(b,c),this.data=new o(this.length),this.write(b,0,this.length,c);else{if("Buffer"!==b.type||!Array.isArray(b.data))throw new Error("Invalid argument to Buffer constructor: "+b);for(this.data=new o(b.data.length),e=0;e<b.data.length;e++)this.data.writeUInt8(e,b.data[e]);this.length=b.data.length}}return a.getAvailableBufferCores=function(){return n.filter(function(a){return a.isAvailable()})},a.getPreferredBufferCore=function(){return o},a.setPreferredBufferCore=function(a){o=a},a.prototype.getBufferCore=function(){return this.data},a.prototype.getOffset=function(){return this.offset},a.prototype.set=function(a,b){return 0>b?this.writeInt8(b,a):this.writeUInt8(b,a)},a.prototype.get=function(a){return this.readUInt8(a)},a.prototype.write=function(b,c,d,e){if(void 0===c&&(c=0),void 0===d&&(d=this.length),void 0===e&&(e="utf8"),"string"==typeof c?(e=""+c,c=0,d=this.length):"string"==typeof d&&(e=""+d,d=this.length),c>this.length||0>c)throw new RangeError("Invalid offset.");var f=l.FindUtil(e);return d=d+c>this.length?this.length-c:d,c+=this.offset,f.str2byte(b,0===c&&d===this.length?this:new a(this.data,c,d+c))},a.prototype.toString=function(b,c,d){if(void 0===b&&(b="utf8"),void 0===c&&(c=0),void 0===d&&(d=this.length),!(d>=c))throw new Error("Invalid start/end positions: "+c+" - "+d);if(c===d)return"";d>this.length&&(d=this.length);var e=l.FindUtil(b);return e.byte2str(0===c&&d===this.length?this:new a(this.data,c+this.offset,d+this.offset))},a.prototype.toJSON=function(){for(var a=this.length,b=new Array(a),c=0;a>c;c++)b[c]=this.readUInt8(c);return{type:"Buffer",data:b}},a.prototype.inspect=function(){var a,b=[],d=this.length<c.INSPECT_MAX_BYTES?this.length:c.INSPECT_MAX_BYTES;for(a=0;d>a;a++)b.push(this.readUInt8(a).toString(16));return"<Buffer "+b.join(" ")+(this.length>d?" ... ":"")+">"},a.prototype.toArrayBuffer=function(){var b=this.getBufferCore();if(b instanceof j){var c=b.getDataView(),d=c.buffer;return 0===this.offset&&0===c.byteOffset&&c.byteLength===d.byteLength&&this.length===c.byteLength?d:d.slice(this.offset+c.byteOffset,this.length)}var d=new ArrayBuffer(this.length),e=new a(d);return this.copy(e,0,0,this.length),d},a.prototype.toUint8Array=function(){var b=this.getBufferCore();if(b instanceof j){var c=b.getDataView(),d=c.buffer,e=this.offset+c.byteOffset,f=this.length;return new Uint8Array(d).subarray(e,e+f)}var d=new ArrayBuffer(this.length),g=new a(d);return this.copy(g,0,0,this.length),new Uint8Array(d)},a.prototype.indexOf=function(b,c){void 0===c&&(c=0);var d;if("string"==typeof b)d=new a(b,"utf8");else if(a.isBuffer(b))d=b;else{if("number"!=typeof b)throw new TypeError("indexOf only operates on strings, buffers, and numbers.");d=new a([b])}c>2147483647?c=2147483647:-2147483648>c&&(c=-2147483648),c>>=0,0>c&&(c=this.length+c,0>c&&(c=0));var e=0,f=d.length,g=this.length;if(0===f)return-1;for(;f>e&&g>c;)d.readUInt8(e)==this.readUInt8(c)?e++:e=0,c++;return e==f?c-f:-1},a.prototype.copy=function(b,c,d,e){if(void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=this.length),0>d)throw new RangeError("sourceStart out of bounds");if(0>e)throw new RangeError("sourceEnd out of bounds");if(0>c)throw new RangeError("targetStart out of bounds");if(d>=e||d>=this.length||c>b.length)return 0;var f=Math.min(e-d,b.length-c,this.length-d);if(b instanceof a&&this.data instanceof j){var g=b.getBufferCore();if(g instanceof j)return this.data.copyTo(g,c+b.offset,d+this.offset,d+f+this.offset)}for(var h=0;f-3>h;h+=4)b.writeInt32LE(this.readInt32LE(d+h),c+h);for(var h=4294967292&f;f>h;h++)b.writeUInt8(this.readUInt8(d+h),c+h);return f},a.prototype.slice=function(b,c){if(void 0===b&&(b=0),void 0===c&&(c=this.length),b>>=0,c>>=0,0>b&&(b+=this.length,0>b&&(b=0)),0>c&&(c+=this.length,0>c&&(c=0)),c>this.length&&(c=this.length),b>c&&(b=c),0>b||0>c||b>this.length||c>this.length)throw new Error("Invalid slice indices.");return new a(this.data,b+this.offset,c+this.offset)},a.prototype.sliceCopy=function(b,c){if(void 0===b&&(b=0),void 0===c&&(c=this.length),0>b&&(b+=this.length,0>b&&(b=0)),0>c&&(c+=this.length,0>c&&(c=0)),c>this.length&&(c=this.length),b>c&&(b=c),0>b||0>c||b>=this.length||c>this.length)throw new Error("Invalid slice indices.");return new a(this.data.copy(b+this.offset,c+this.offset))},a.prototype.fill=function(b,c,d){void 0===c&&(c=0),void 0===d&&(d=this.length);if(c>>=0,d>>=0,0>c||d>this.length)throw new RangeError("out of range index");if(c>=d)return this;if("string"!=typeof b)b>>>=0;else if(1===b.length){var e=b.charCodeAt(0);256>e&&(b=e)}if("number"==typeof b)c+=this.offset,d+=this.offset,this.data.fill(b,c,d);else if(b.length>0){for(var f=a.byteLength(b,"utf8"),g=d-f;g>c;)this.write(b,c,f,"utf8"),c+=f;d>c&&this.write(b,c,d-c,"utf8")}return this},a.prototype.readUIntLE=function(a,b,c){void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset;var d=0;switch(b){case 1:return this.data.readUInt8(a);case 2:return this.data.readUInt16LE(a);case 3:return this.data.readUInt8(a)|this.data.readUInt16LE(a+1)<<8;case 4:return this.data.readUInt32LE(a);case 6:d+=131072*(this.data.readUInt8(a+5)<<23);case 5:return d+=512*(this.data.readUInt8(a+4)<<23),d+this.data.readUInt32LE(a);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readUIntBE=function(a,b,c){void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset;var d=0;switch(b){case 1:return this.data.readUInt8(a);case 2:return this.data.readUInt16BE(a);case 3:return this.data.readUInt8(a+2)|this.data.readUInt16BE(a)<<8;case 4:return this.data.readUInt32BE(a);case 6:d+=131072*(this.data.readUInt8(a)<<23),a++;case 5:return d+=512*(this.data.readUInt8(a)<<23),d+this.data.readUInt32BE(a+1);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readIntLE=function(a,b,c){switch(void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset,b){case 1:return this.data.readInt8(a);case 2:return this.data.readInt16LE(a);case 3:return this.data.readUInt8(a)|this.data.readInt16LE(a+1)<<8;case 4:return this.data.readInt32LE(a);case 6:return 131072*(this.data.readInt8(a+5)<<23)+this.readUIntLE(a-this.offset,5,c);case 5:return 512*(this.data.readInt8(a+4)<<23)+this.data.readUInt32LE(a);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readIntBE=function(a,b,c){switch(void 0===c&&(c=!1),a>>>=0,b>>>=0,c||f(a,b,this.length),a+=this.offset,b){case 1:return this.data.readInt8(a);case 2:return this.data.readInt16BE(a);case 3:return this.data.readUInt8(a+2)|this.data.readInt16BE(a)<<8;case 4:return this.data.readInt32BE(a);case 6:return 131072*(this.data.readInt8(a)<<23)+this.readUIntBE(a-this.offset+1,5,c);case 5:return 512*(this.data.readInt8(a)<<23)+this.data.readUInt32BE(a+1);default:throw new Error("Invalid byteLength: "+b)}},a.prototype.readUInt8=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,1,this.length),a+=this.offset,this.data.readUInt8(a)},a.prototype.readUInt16LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readUInt16LE(a)},a.prototype.readUInt16BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readUInt16BE(a)},a.prototype.readUInt32LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readUInt32LE(a)},a.prototype.readUInt32BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readUInt32BE(a)},a.prototype.readInt8=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,1,this.length),a+=this.offset,this.data.readInt8(a)},a.prototype.readInt16LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readInt16LE(a)},a.prototype.readInt16BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,2,this.length),a+=this.offset,this.data.readInt16BE(a)},a.prototype.readInt32LE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readInt32LE(a)},a.prototype.readInt32BE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readInt32BE(a)},a.prototype.readFloatLE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readFloatLE(a)},a.prototype.readFloatBE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,4,this.length),a+=this.offset,this.data.readFloatBE(a)},a.prototype.readDoubleLE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,8,this.length),a+=this.offset,this.data.readDoubleLE(a)},a.prototype.readDoubleBE=function(a,b){return void 0===b&&(b=!1),a>>>=0,b||f(a,8,this.length),a+=this.offset,this.data.readDoubleBE(a)},a.prototype.writeUIntLE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,r[c],0);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeUInt8(b,a);break;case 2:this.data.writeUInt16LE(b,a);break;case 3:this.data.writeUInt8(b,255&a),this.data.writeUInt16LE(b+1,a>>8);break;case 4:this.data.writeUInt32LE(b,a);break;case 6:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),b++;case 5:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),this.data.writeUInt32LE(b+1,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeUIntBE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,r[c],0);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeUInt8(b,a);break;case 2:this.data.writeUInt16BE(b,a);break;case 3:this.data.writeUInt8(b+2,255&a),this.data.writeUInt16BE(b,a>>8);break;case 4:this.data.writeUInt32BE(b,a);break;case 6:this.data.writeUInt8(b+5,255&a),a=Math.floor(a/256);case 5:this.data.writeUInt8(b+4,255&a),a=Math.floor(a/256),this.data.writeUInt32BE(b,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeIntLE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,p[c],q[c]);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeInt8(b,a);break;case 2:this.data.writeInt16LE(b,a);break;case 3:this.data.writeUInt8(b,255&a),this.data.writeInt16LE(b+1,a>>8);break;case 4:this.data.writeInt32LE(b,a);break;case 6:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),b++;case 5:this.data.writeUInt8(b,255&a),a=Math.floor(a/256),this.data.writeInt32LE(b+1,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeIntBE=function(a,b,c,e){void 0===e&&(e=!1),b>>>=0,e||d(this,a,b,c,p[c],q[c]);var f=b+c;switch(b+=this.offset,c){case 1:this.data.writeInt8(b,a);break;case 2:this.data.writeInt16BE(b,a);break;case 3:this.data.writeUInt8(b+2,255&a),this.data.writeInt16BE(b,a>>8);break;case 4:this.data.writeInt32BE(b,a);break;case 6:this.data.writeUInt8(b+5,255&a),a=Math.floor(a/256);case 5:this.data.writeUInt8(b+4,255&a),a=Math.floor(a/256),this.data.writeInt32BE(b,a);break;default:throw new Error("Invalid byteLength: "+c)}return f},a.prototype.writeUInt8=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,1,255,0),this.data.writeUInt8(b+this.offset,a),b+1},a.prototype.writeUInt16LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,65535,0),this.data.writeUInt16LE(b+this.offset,a),b+2},a.prototype.writeUInt16BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,65535,0),this.data.writeUInt16BE(b+this.offset,a),b+2},a.prototype.writeUInt32LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,4294967295,0),this.data.writeUInt32LE(b+this.offset,a),b+4},a.prototype.writeUInt32BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,4294967295,0),this.data.writeUInt32BE(b+this.offset,a),b+4},a.prototype.writeInt8=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,1,127,-128),this.data.writeInt8(b+this.offset,a),b+1},a.prototype.writeInt16LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,32767,-32768),this.data.writeInt16LE(b+this.offset,a),b+2},a.prototype.writeInt16BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,2,32767,-32768),this.data.writeInt16BE(b+this.offset,a),b+2},a.prototype.writeInt32LE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,2147483647,-2147483648),this.data.writeInt32LE(b+this.offset,a),b+4},a.prototype.writeInt32BE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||d(this,a,b,4,2147483647,-2147483648),this.data.writeInt32BE(b+this.offset,a),b+4},a.prototype.writeFloatLE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,4),this.data.writeFloatLE(b+this.offset,a),b+4},a.prototype.writeFloatBE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,4),this.data.writeFloatBE(b+this.offset,a),b+4},a.prototype.writeDoubleLE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,8),this.data.writeDoubleLE(b+this.offset,a),b+8},a.prototype.writeDoubleBE=function(a,b,c){return void 0===c&&(c=!1),b>>>=0,c||e(this,a,b,8),this.data.writeDoubleBE(b+this.offset,a),b+8},a.isEncoding=function(a){try{l.FindUtil(a)}catch(b){return!1}return!0},a.compare=function(a,b){if(a===b)return 0;var c,d,e,f=a.length,g=b.length,h=Math.min(f,g);for(c=0;h>c;c++)if(d=a.readUInt8(c),e=b.readUInt8(c),d!==e)return d>e?1:-1;return f===g?0:f>g?1:-1},a.isBuffer=function(b){return b instanceof a},a.byteLength=function(a,b){void 0===b&&(b="utf8");var c;try{c=l.FindUtil(b)}catch(d){c=l.FindUtil("utf8")}return"string"!=typeof a&&(a=""+a),c.byteLength(a)},a.concat=function(b,c){var d;if(0===b.length||0===c)return new a(0);if(void 0===c){c=0;for(var e=0;e<b.length;e++){if(d=b[e],!a.isBuffer(d))throw new TypeError("Concat only operates on Buffer objects.");c+=d.length}}for(var f=new a(c),g=0,h=0;h<b.length;h++){if(d=b[h],!a.isBuffer(d))throw new TypeError("Concat only operates on Buffer objects.");g+=d.copy(f,g)}return f},a.prototype.equals=function(b){if(a.isBuffer(b)){var c;if(b.length!==this.length)return!1;for(c=0;c<this.length;c++)if(this.readUInt8(c)!==b.readUInt8(c))return!1;return!0}throw new TypeError("Argument must be a buffer.")},a.prototype.compare=function(b){return a.compare(this,b)},a}();c.Buffer=s;var t=s,u=function(a){function b(c,d,e){return this instanceof b?(+c!=c&&(c=0),void a.call(this,+c)):new b(c,d,e)}return g(b,a),b.isBuffer=function(a){return s.isBuffer(a)},b.byteLength=function(a,b){return s.byteLength(a,b)},b.concat=function(a,b){return s.concat(a,b)},b}(s);c.SlowBuffer=u,t=u,c.INSPECT_MAX_BYTES=50},{"./buffer_core":3,"./buffer_core_array":4,"./buffer_core_arraybuffer":5,"./buffer_core_imagedata":6,"./string_util":8,"./util":9}],3:[function(a,b,c){var d=Math.pow(2,128),e=-1*d,f=2139095040,g=-8388608,h=2143289344,i=function(){function a(){}return a.prototype.getLength=function(){throw new Error("BufferCore implementations should implement getLength.")},a.prototype.writeInt8=function(a,b){this.writeUInt8(a,255&b|(2147483648&b)>>>24)},a.prototype.writeInt16LE=function(a,b){this.writeUInt8(a,255&b),this.writeUInt8(a+1,b>>>8&255|(2147483648&b)>>>24)},a.prototype.writeInt16BE=function(a,b){this.writeUInt8(a+1,255&b),this.writeUInt8(a,b>>>8&255|(2147483648&b)>>>24)},a.prototype.writeInt32LE=function(a,b){this.writeUInt8(a,255&b),this.writeUInt8(a+1,b>>>8&255),this.writeUInt8(a+2,b>>>16&255),this.writeUInt8(a+3,b>>>24&255)},a.prototype.writeInt32BE=function(a,b){this.writeUInt8(a+3,255&b),this.writeUInt8(a+2,b>>>8&255),this.writeUInt8(a+1,b>>>16&255),this.writeUInt8(a,b>>>24&255)},a.prototype.writeUInt8=function(a,b){throw new Error("BufferCore implementations should implement writeUInt8.")},a.prototype.writeUInt16LE=function(a,b){this.writeUInt8(a,255&b),this.writeUInt8(a+1,b>>8&255)},a.prototype.writeUInt16BE=function(a,b){this.writeUInt8(a+1,255&b),this.writeUInt8(a,b>>8&255)},a.prototype.writeUInt32LE=function(a,b){this.writeInt32LE(a,0|b)},a.prototype.writeUInt32BE=function(a,b){this.writeInt32BE(a,0|b)},a.prototype.writeFloatLE=function(a,b){this.writeInt32LE(a,this.float2intbits(b))},a.prototype.writeFloatBE=function(a,b){this.writeInt32BE(a,this.float2intbits(b))},a.prototype.writeDoubleLE=function(a,b){var c=this.double2longbits(b);this.writeInt32LE(a,c[0]),this.writeInt32LE(a+4,c[1])},a.prototype.writeDoubleBE=function(a,b){var c=this.double2longbits(b);this.writeInt32BE(a+4,c[0]),this.writeInt32BE(a,c[1])},a.prototype.readInt8=function(a){var b=this.readUInt8(a);return 128&b?4294967168|b:b},a.prototype.readInt16LE=function(a){var b=this.readUInt16LE(a);return 32768&b?4294934528|b:b},a.prototype.readInt16BE=function(a){var b=this.readUInt16BE(a);return 32768&b?4294934528|b:b},a.prototype.readInt32LE=function(a){return 0|this.readUInt32LE(a)},a.prototype.readInt32BE=function(a){return 0|this.readUInt32BE(a)},a.prototype.readUInt8=function(a){throw new Error("BufferCore implementations should implement readUInt8.")},a.prototype.readUInt16LE=function(a){return this.readUInt8(a+1)<<8|this.readUInt8(a)},a.prototype.readUInt16BE=function(a){return this.readUInt8(a)<<8|this.readUInt8(a+1);
},a.prototype.readUInt32LE=function(a){return(this.readUInt8(a+3)<<24|this.readUInt8(a+2)<<16|this.readUInt8(a+1)<<8|this.readUInt8(a))>>>0},a.prototype.readUInt32BE=function(a){return(this.readUInt8(a)<<24|this.readUInt8(a+1)<<16|this.readUInt8(a+2)<<8|this.readUInt8(a+3))>>>0},a.prototype.readFloatLE=function(a){return this.intbits2float(this.readInt32LE(a))},a.prototype.readFloatBE=function(a){return this.intbits2float(this.readInt32BE(a))},a.prototype.readDoubleLE=function(a){return this.longbits2double(this.readInt32LE(a+4),this.readInt32LE(a))},a.prototype.readDoubleBE=function(a){return this.longbits2double(this.readInt32BE(a),this.readInt32BE(a+4))},a.prototype.copy=function(a,b){throw new Error("BufferCore implementations should implement copy.")},a.prototype.fill=function(a,b,c){for(var d=b;c>d;d++)this.writeUInt8(d,a)},a.prototype.float2intbits=function(a){var b,c,d;return 0===a?0:a===Number.POSITIVE_INFINITY?f:a===Number.NEGATIVE_INFINITY?g:isNaN(a)?h:(d=0>a?1:0,a=Math.abs(a),1.1754942106924411e-38>=a&&a>=1.401298464324817e-45?(b=0,c=Math.round(a/Math.pow(2,-126)*Math.pow(2,23)),d<<31|b<<23|c):(b=Math.floor(Math.log(a)/Math.LN2),c=Math.round((a/Math.pow(2,b)-1)*Math.pow(2,23)),d<<31|b+127<<23|c))},a.prototype.double2longbits=function(a){var b,c,d,e;return 0===a?[0,0]:a===Number.POSITIVE_INFINITY?[0,2146435072]:a===Number.NEGATIVE_INFINITY?[0,-1048576]:isNaN(a)?[0,2146959360]:(e=0>a?1<<31:0,a=Math.abs(a),2.225073858507201e-308>=a&&a>=5e-324?(b=0,d=a/Math.pow(2,-1022)*Math.pow(2,52)):(b=Math.floor(Math.log(a)/Math.LN2),a<Math.pow(2,b)&&(b-=1),d=(a/Math.pow(2,b)-1)*Math.pow(2,52),b=b+1023<<20),c=d*Math.pow(2,-32)|0|e|b,[65535&d,c])},a.prototype.intbits2float=function(a){if(a===f)return Number.POSITIVE_INFINITY;if(a===g)return Number.NEGATIVE_INFINITY;var b,c=(2147483648&a)>>>31,h=(2139095040&a)>>>23,i=8388607&a;return b=0===h?Math.pow(-1,c)*i*Math.pow(2,-149):Math.pow(-1,c)*(1+i*Math.pow(2,-23))*Math.pow(2,h-127),(e>b||b>d)&&(b=NaN),b},a.prototype.longbits2double=function(a,b){var c=(2147483648&a)>>>31,d=(2146435072&a)>>>20,e=(1048575&a)*Math.pow(2,32)+b;return 0===d&&0===e?0:2047===d?0===e?1===c?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:NaN:0===d?Math.pow(-1,c)*e*Math.pow(2,-1074):Math.pow(-1,c)*(1+e*Math.pow(2,-52))*Math.pow(2,d-1023)},a}();c.BufferCoreCommon=i},{}],4:[function(a,b,c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("./buffer_core"),f=[4294967040,4294902015,4278255615,16777215],g=function(a){function b(b){a.call(this),this.length=b,this.buff=new Array(Math.ceil(b/4));for(var c=this.buff.length,d=0;c>d;d++)this.buff[d]=0}return d(b,a),b.isAvailable=function(){return!0},b.prototype.getLength=function(){return this.length},b.prototype.writeUInt8=function(a,b){b&=255;var c=a>>2,d=3&a;this.buff[c]=this.buff[c]&f[d],this.buff[c]=this.buff[c]|b<<(d<<3)},b.prototype.readUInt8=function(a){var b=a>>2,c=3&a;return this.buff[b]>>(c<<3)&255},b.prototype.copy=function(a,c){for(var d=new b(c-a),e=a;c>e;e++)d.writeUInt8(e-a,this.readUInt8(e));return d},b.name="Array",b}(e.BufferCoreCommon);b.exports=g},{"./buffer_core":3}],5:[function(a,b,c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("./buffer_core"),f=a("./util"),g=function(a){function b(b){if(a.call(this),"number"==typeof b)this.buff=new DataView(new ArrayBuffer(b));else if(b instanceof DataView)this.buff=b;else if(f.isArrayBufferView(b))this.buff=new DataView(b.buffer,b.byteOffset,b.byteLength);else{if(!f.isArrayBuffer(b))throw new TypeError("Invalid argument.");this.buff=new DataView(b)}this.length=this.buff.byteLength}return d(b,a),b.isAvailable=function(){return"undefined"!=typeof DataView},b.prototype.getLength=function(){return this.length},b.prototype.writeInt8=function(a,b){this.buff.setInt8(a,b)},b.prototype.writeInt16LE=function(a,b){this.buff.setInt16(a,b,!0)},b.prototype.writeInt16BE=function(a,b){this.buff.setInt16(a,b,!1)},b.prototype.writeInt32LE=function(a,b){this.buff.setInt32(a,b,!0)},b.prototype.writeInt32BE=function(a,b){this.buff.setInt32(a,b,!1)},b.prototype.writeUInt8=function(a,b){this.buff.setUint8(a,b)},b.prototype.writeUInt16LE=function(a,b){this.buff.setUint16(a,b,!0)},b.prototype.writeUInt16BE=function(a,b){this.buff.setUint16(a,b,!1)},b.prototype.writeUInt32LE=function(a,b){this.buff.setUint32(a,b,!0)},b.prototype.writeUInt32BE=function(a,b){this.buff.setUint32(a,b,!1)},b.prototype.writeFloatLE=function(a,b){this.buff.setFloat32(a,b,!0)},b.prototype.writeFloatBE=function(a,b){this.buff.setFloat32(a,b,!1)},b.prototype.writeDoubleLE=function(a,b){this.buff.setFloat64(a,b,!0)},b.prototype.writeDoubleBE=function(a,b){this.buff.setFloat64(a,b,!1)},b.prototype.readInt8=function(a){return this.buff.getInt8(a)},b.prototype.readInt16LE=function(a){return this.buff.getInt16(a,!0)},b.prototype.readInt16BE=function(a){return this.buff.getInt16(a,!1)},b.prototype.readInt32LE=function(a){return this.buff.getInt32(a,!0)},b.prototype.readInt32BE=function(a){return this.buff.getInt32(a,!1)},b.prototype.readUInt8=function(a){return this.buff.getUint8(a)},b.prototype.readUInt16LE=function(a){return this.buff.getUint16(a,!0)},b.prototype.readUInt16BE=function(a){return this.buff.getUint16(a,!1)},b.prototype.readUInt32LE=function(a){return this.buff.getUint32(a,!0)},b.prototype.readUInt32BE=function(a){return this.buff.getUint32(a,!1)},b.prototype.readFloatLE=function(a){return this.buff.getFloat32(a,!0)},b.prototype.readFloatBE=function(a){return this.buff.getFloat32(a,!1)},b.prototype.readDoubleLE=function(a){return this.buff.getFloat64(a,!0)},b.prototype.readDoubleBE=function(a){return this.buff.getFloat64(a,!1)},b.prototype.copy=function(a,c){var d,e=this.buff.buffer,f=this.buff.byteOffset;if(ArrayBuffer.prototype.slice)d=e.slice(f+a,f+c);else{var g=c-a;d=new ArrayBuffer(g);var h=new Uint8Array(d),i=new Uint8Array(e,f);h.set(i.subarray(a,c))}return new b(d)},b.prototype.copyTo=function(a,b,c,d){var e=new Uint8Array(a.buff.buffer,a.buff.byteOffset),f=new Uint8Array(this.buff.buffer,this.buff.byteOffset+c,d-c);return e.set(f,b),d-c},b.prototype.fill=function(a,b,c){a=255&a;var d,e=c-b,f=4*(e/4|0),g=a<<24|a<<16|a<<8|a;for(d=0;f>d;d+=4)this.writeInt32LE(d+b,g);for(d=f;e>d;d++)this.writeUInt8(d+b,a)},b.prototype.getDataView=function(){return this.buff},b.name="ArrayBuffer",b}(e.BufferCoreCommon);b.exports=g},{"./buffer_core":3,"./util":9}],6:[function(a,b,c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("./buffer_core"),f=function(a){function b(c){a.call(this),this.length=c,this.buff=b.getCanvasPixelArray(c)}return d(b,a),b.getCanvasPixelArray=function(a){var c=b.imageDataFactory;return void 0===c&&(b.imageDataFactory=c=document.createElement("canvas").getContext("2d")),0===a&&(a=1),c.createImageData(Math.ceil(a/4),1).data},b.isAvailable=function(){return"undefined"!=typeof CanvasPixelArray&&void 0!==document.createElement("canvas").getContext},b.prototype.getLength=function(){return this.length},b.prototype.writeUInt8=function(a,b){this.buff[a]=b},b.prototype.readUInt8=function(a){return this.buff[a]},b.prototype.copy=function(a,c){for(var d=new b(c-a),e=a;c>e;e++)d.writeUInt8(e-a,this.buff[e]);return d},b.name="ImageData",b}(e.BufferCoreCommon);b.exports=f},{"./buffer_core":3}],7:[function(a,b,c){var d=function(){function a(){}return a.str2byte=function(b,c){for(var d=b.length>c.length?c.length:b.length,e=0;d>e;e++){var f=b.charCodeAt(e);if(f>127){var g=a.extendedChars.indexOf(b.charAt(e));g>-1&&(f=g+128)}c.writeUInt8(f,e)}return d},a.byte2str=function(b){for(var c=new Array(b.length),d=0;d<b.length;d++){var e=b.readUInt8(d);e>127?c[d]=a.extendedChars[e-128]:c[d]=String.fromCharCode(e)}return c.join("")},a.byteLength=function(a){return a.length},a.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "],a}();c.__esModule=!0,c["default"]=d},{}],8:[function(a,b,c){function d(a){var b,c=a.length,d=(c-1>>13)+1,e=new Array(d);for(b=0;d>b;b++)e[b]=g.apply(String,a.slice(8192*b,8192*(b+1)));return e.join("")}function e(a){switch(a=function(){switch(typeof a){case"object":return""+a;case"string":return a;default:throw new TypeError("Invalid encoding argument specified")}}(),a=a.toLowerCase()){case"utf8":case"utf-8":return h;case"ascii":return i;case"binary":return j;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l;case"hex":return m;case"base64":return k;case"binary_string":return n;case"binary_string_ie":return o;case"extended_ascii":return f["default"];default:throw new TypeError("Unknown encoding: "+a)}}var f=a("./extended_ascii"),g=String.fromCharCode;c.fromCharCodes=d,c.FindUtil=e;var h=function(){function a(){}return a.str2byte=function(a,b){for(var c=b.length,d=0,e=0,f=a.length;f>d&&c>e;){var g=a.charCodeAt(d++);if(g>=55296&&56319>=g){if(e+3>=c||d>=f)break;var h=a.charCodeAt(d);if(h>=56320&&57343>=h){var i=(1023&g|1024)<<10|1023&h;b.writeUInt8(i>>18|240,e++),b.writeUInt8(i>>12&63|128,e++),b.writeUInt8(i>>6&63|128,e++),b.writeUInt8(63&i|128,e++),d++}else b.writeUInt8(239,e++),b.writeUInt8(191,e++),b.writeUInt8(189,e++)}else if(g>=56320&&57343>=g)b.writeUInt8(239,e++),b.writeUInt8(191,e++),b.writeUInt8(189,e++);else if(128>g)b.writeUInt8(g,e++);else if(2048>g){if(e+1>=c)break;b.writeUInt8(g>>6|192,e++),b.writeUInt8(63&g|128,e++)}else if(65536>g){if(e+2>=c)break;b.writeUInt8(g>>12|224,e++),b.writeUInt8(g>>6&63|128,e++),b.writeUInt8(63&g|128,e++)}}return e},a.byte2str=function(a){for(var b=[],c=0;c<a.length;){var e=a.readUInt8(c++);if(128>e)b.push(e);else{if(192>e)throw new Error("Found incomplete part of character in string.");if(224>e)b.push((31&e)<<6|63&a.readUInt8(c++));else if(240>e)b.push((15&e)<<12|(63&a.readUInt8(c++))<<6|63&a.readUInt8(c++));else{if(!(248>e))throw new Error("Unable to represent UTF-8 string as UTF-16 JavaScript string.");var f=a.readUInt8(c+2);b.push(1023&((7&e)<<8|(63&a.readUInt8(c++))<<2|(63&a.readUInt8(c++))>>4)|55296),b.push((15&f)<<6|63&a.readUInt8(c++)|56320)}}}return d(b)},a.byteLength=function(a){for(var b=a.length,c=a.length-1;c>=0;c--){var d=a.charCodeAt(c);d>127&&2047>=d?b++:d>2047&&65535>=d&&(b+=2),d>=56320&&57343>=d&&c--}return b},a}();c.UTF8=h;var i=function(){function a(){}return a.str2byte=function(a,b){for(var c=a.length>b.length?b.length:a.length,d=0;c>d;d++)b.writeUInt8(a.charCodeAt(d)%256,d);return c},a.byte2str=function(a){for(var b=new Array(a.length),c=0;c<a.length;c++)b[c]=127&a.readUInt8(c);return d(b)},a.byteLength=function(a){return a.length},a}();c.ASCII=i;var j=function(){function a(){}return a.str2byte=function(a,b){for(var c=a.length>b.length?b.length:a.length,d=0;c>d;d++)b.writeUInt8(255&a.charCodeAt(d),d);return c},a.byte2str=function(a){for(var b=new Array(a.length),c=0;c<a.length;c++)b[c]=255&a.readUInt8(c);return d(b)},a.byteLength=function(a){return a.length},a}();c.BINARY=j;var k=function(){function a(){}return a.byte2str=function(b){for(var c="",d=0;d<b.length;){var e=b.readUInt8(d++),f=d<b.length?b.readUInt8(d++):NaN,g=d<b.length?b.readUInt8(d++):NaN,h=e>>2,i=(3&e)<<4|f>>4,j=(15&f)<<2|g>>6,k=63&g;isNaN(f)?j=k=64:isNaN(g)&&(k=64),c=c+a.num2b64[h]+a.num2b64[i]+a.num2b64[j]+a.num2b64[k]}return c},a.str2byte=function(b,c){var d=c.length,e="",f=0;b=b.replace(/[^A-Za-z0-9\+\/\=\-\_]/g,"");for(var g=0;f<b.length&&g<c.length;){var h=a.b642num[b.charAt(f++)],i=a.b642num[b.charAt(f++)],j=a.b642num[b.charAt(f++)],k=a.b642num[b.charAt(f++)],l=h<<2|i>>4,m=(15&i)<<4|j>>2,n=(3&j)<<6|k;if(c.writeUInt8(l,g++),g===d)break;if(64!==j&&(e+=c.writeUInt8(m,g++)),g===d)break;if(64!==k&&(e+=c.writeUInt8(n,g++)),g===d)break}return g},a.byteLength=function(a){return Math.floor(6*a.replace(/[^A-Za-z0-9\+\/\-\_]/g,"").length/8)},a.b64chars=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/","="],a.num2b64=function(){for(var b=new Array(a.b64chars.length),c=0;c<a.b64chars.length;c++){var d=a.b64chars[c];b[c]=d}return b}(),a.b642num=function(){for(var b={},c=0;c<a.b64chars.length;c++){var d=a.b64chars[c];b[d]=c}return b["-"]=62,b._=63,b}(),a}();c.BASE64=k;var l=function(){function a(){}return a.str2byte=function(a,b){var c=a.length;2*c>b.length&&(c=b.length%2===1?(b.length-1)/2:b.length/2);for(var d=0;c>d;d++)b.writeUInt16LE(a.charCodeAt(d),2*d);return 2*c},a.byte2str=function(a){if(a.length%2!==0)throw new Error("Invalid UCS2 byte array.");for(var b=new Array(a.length/2),c=0;c<a.length;c+=2)b[c/2]=String.fromCharCode(a.readUInt8(c)|a.readUInt8(c+1)<<8);return b.join("")},a.byteLength=function(a){return 2*a.length},a}();c.UCS2=l;var m=function(){function a(){}return a.str2byte=function(a,b){if(a.length%2===1)throw new Error("Invalid hex string");var c=a.length>>1;c>b.length&&(c=b.length);for(var d=0;c>d;d++){var e=this.hex2num[a.charAt(d<<1)],f=this.hex2num[a.charAt((d<<1)+1)];b.writeUInt8(e<<4|f,d)}return c},a.byte2str=function(a){for(var b=a.length,c=new Array(b<<1),d=0,e=0;b>e;e++){var f=15&a.readUInt8(e),g=a.readUInt8(e)>>4;c[d++]=this.num2hex[g],c[d++]=this.num2hex[f]}return c.join("")},a.byteLength=function(a){return a.length>>1},a.HEXCHARS="0123456789abcdef",a.num2hex=function(){for(var b=new Array(a.HEXCHARS.length),c=0;c<a.HEXCHARS.length;c++){var d=a.HEXCHARS[c];b[c]=d}return b}(),a.hex2num=function(){var b,c,d={};for(b=0;b<a.HEXCHARS.length;b++)c=a.HEXCHARS[b],d[c]=b;var e="ABCDEF";for(b=0;b<e.length;b++)c=e[b],d[c]=b+10;return d}(),a}();c.HEX=m;var n=function(){function a(){}return a.str2byte=function(b,c){if(0===b.length)return 0;var d=a.byteLength(b);d>c.length&&(d=c.length);var e=0,f=0,g=f+d,h=b.charCodeAt(e++);0!==h&&(c.writeUInt8(255&h,0),f=1);for(var i=f;g>i;i+=2){var j=b.charCodeAt(e++);g-i===1&&c.writeUInt8(j>>8,i),g-i>=2&&c.writeUInt16BE(j,i)}return d},a.byte2str=function(a){var b=a.length;if(0===b)return"";var c,e=(b>>1)+1,f=new Array(e),g=0;for(1===(1&b)?f[0]=256|a.readUInt8(g++):f[0]=0,c=1;e>c;c++)f[c]=a.readUInt16BE(g),g+=2;return d(f)},a.byteLength=function(a){if(0===a.length)return 0;var b=a.charCodeAt(0),c=a.length-1<<1;return 0!==b&&c++,c},a}();c.BINSTR=n;var o=function(){function a(){}return a.str2byte=function(a,b){for(var c=a.length>b.length?b.length:a.length,d=0;c>d;d++)b.writeUInt8(a.charCodeAt(d)-32,d);return c},a.byte2str=function(a){for(var b=new Array(a.length),c=0;c<a.length;c++)b[c]=String.fromCharCode(a.readUInt8(c)+32);return b.join("")},a.byteLength=function(a){return a.length},a}();c.BINSTRIE=o},{"./extended_ascii":7}],9:[function(a,b,c){"undefined"==typeof ArrayBuffer?(c.isArrayBufferView=function(a){return!1},c.isArrayBuffer=function(a){return!1}):(c.isArrayBuffer=function(a){return"number"==typeof a.byteLength},ArrayBuffer.isView?c.isArrayBufferView=function(a){return ArrayBuffer.isView(a)}:c.isArrayBufferView=function(a){return c.isArrayBuffer(a.buffer)})},{}],10:[function(a,b,c){(function(a){function c(a){var b=d.exec(a);return b.shift(),b}var d=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,e=function(){function b(){}return b.normalize=function(a){""===a&&(a=".");var c=a.charAt(0)===b.sep;a=b._removeDuplicateSeps(a);for(var d=a.split(b.sep),e=[],f=0;f<d.length;f++){var g=d[f];"."!==g&&(".."===g&&(c||!c&&e.length>0&&".."!==e[0])?e.pop():e.push(g))}if(!c&&e.length<2)switch(e.length){case 1:""===e[0]&&e.unshift(".");break;default:e.push(".")}return a=e.join(b.sep),c&&a.charAt(0)!==b.sep&&(a=b.sep+a),a},b.join=function(){for(var a=[],c=0;c<arguments.length;c++)a[c-0]=arguments[c];for(var d=[],e=0;e<a.length;e++){var f=a[e];if("string"!=typeof f)throw new TypeError("Invalid argument type to path.join: "+typeof f);""!==f&&d.push(f)}return b.normalize(d.join(b.sep))},b.resolve=function(){for(var c=[],d=0;d<arguments.length;d++)c[d-0]=arguments[d];for(var e=[],f=0;f<c.length;f++){var g=c[f];if("string"!=typeof g)throw new TypeError("Invalid argument type to path.join: "+typeof g);""!==g&&(g.charAt(0)===b.sep&&(e=[]),e.push(g))}var h=b.normalize(e.join(b.sep));if(h.length>1&&h.charAt(h.length-1)===b.sep)return h.substr(0,h.length-1);if(h.charAt(0)!==b.sep){"."!==h.charAt(0)||1!==h.length&&h.charAt(1)!==b.sep||(h=1===h.length?"":h.substr(2));var i=a.cwd();h=""!==h?this.normalize(i+("/"!==i?b.sep:"")+h):i}return h},b.relative=function(a,c){var d;a=b.resolve(a),c=b.resolve(c);var e=a.split(b.sep),f=c.split(b.sep);f.shift(),e.shift();var g=0,h=[];for(d=0;d<e.length;d++){var i=e[d];if(i!==f[d]){g=e.length-d;break}}h=f.slice(d),1===e.length&&""===e[0]&&(g=0),g>e.length&&(g=e.length);var j="";for(d=0;g>d;d++)j+="../";return j+=h.join(b.sep),j.length>1&&j.charAt(j.length-1)===b.sep&&(j=j.substr(0,j.length-1)),j},b.dirname=function(a){a=b._removeDuplicateSeps(a);var c=a.charAt(0)===b.sep,d=a.split(b.sep);return""===d.pop()&&d.length>0&&d.pop(),d.length>1||1===d.length&&!c?d.join(b.sep):c?b.sep:"."},b.basename=function(a,c){if(void 0===c&&(c=""),""===a)return a;a=b.normalize(a);var d=a.split(b.sep),e=d[d.length-1];if(""===e&&d.length>1)return d[d.length-2];if(c.length>0){var f=e.substr(e.length-c.length);if(f===c)return e.substr(0,e.length-c.length)}return e},b.extname=function(a){a=b.normalize(a);var c=a.split(b.sep);if(a=c.pop(),""===a&&c.length>0&&(a=c.pop()),".."===a)return"";var d=a.lastIndexOf(".");return-1===d||0===d?"":a.substr(d)},b.isAbsolute=function(a){return a.length>0&&a.charAt(0)===b.sep},b._makeLong=function(a){return a},b.parse=function(a){var b=c(a);return{root:b[0],dir:b[0]+b[1].slice(0,-1),base:b[2],ext:b[3],name:b[2].slice(0,b[2].length-b[3].length)}},b.format=function(a){if(null===a||"object"!=typeof a)throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof a);var c=a.root||"";if("string"!=typeof c)throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof a.root);var d=a.dir?a.dir+b.sep:"",e=a.base||"";return d+e},b._removeDuplicateSeps=function(a){return a=a.replace(this._replaceRegex,this.sep)},b.sep="/",b._replaceRegex=new RegExp("//+","g"),b.delimiter=":",b.posix=b,b.win32=b,b}();b.exports=e}).call(this,a("bfs-process"))},{"bfs-process":11}],11:[function(a,b,c){function d(a){g[a]||("function"==typeof f[a]?g[a]=function(){return f[a].apply(f,arguments)}:g[a]=f[a])}var e=a("./process"),f=new e,g={};for(var h in f)d(h);g.initializeTTYs=function(){null===f.stdin&&(f.initializeTTYs(),g.stdin=f.stdin,g.stdout=f.stdout,g.stderr=f.stderr)},f.nextTick(function(){g.initializeTTYs()}),b.exports=g},{"./process":12}],12:[function(a,b,c){(function(c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("events"),f=null,g=function(){function a(a,b){this.fun=a,this.array=b}return a.prototype.run=function(){this.fun.apply(null,this.array)},a}(),h=function(){function a(){this._queue=[],this._draining=!1,this._currentQueue=null,this._queueIndex=-1}return a.prototype.push=function(a){var b=this;1!==this._queue.push(a)||this._draining||setTimeout(function(){return b._drainQueue()},0)},a.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()},a.prototype._drainQueue=function(){var a=this;if(!this._draining){var b=setTimeout(function(){return a._cleanUpNextTick()});this._draining=!0;for(var c=this._queue.length;c;){for(this._currentQueue=this._queue,this._queue=[];++this._queueIndex<c;)this._currentQueue&&this._currentQueue[this._queueIndex].run();this._queueIndex=-1,c=this._queue.length}this._currentQueue=null,this._draining=!1,clearTimeout(b)}},a}(),i=function(b){function e(){b.apply(this,arguments),this.startTime=Date.now(),this._cwd="/",this.platform="browser",this.argv=[],this.stdout=null,this.stderr=null,this.stdin=null,this._queue=new h,this.execPath=c,this.env={},this.exitCode=0,this._gid=1,this._uid=1,this.version="v5.0",this.versions={http_parser:"0.0",node:"5.0",v8:"0.0",uv:"0.0",zlib:"0.0",ares:"0.0",icu:"0.0",modules:"0",openssl:"0.0"},this.config={target_defaults:{cflags:[],default_configuration:"Release",defines:[],include_dirs:[],libraries:[]},variables:{clang:0,host_arch:"x32",node_install_npm:!1,node_install_waf:!1,node_prefix:"",node_shared_cares:!1,node_shared_http_parser:!1,node_shared_libuv:!1,node_shared_zlib:!1,node_shared_v8:!1,node_use_dtrace:!1,node_use_etw:!1,node_use_openssl:!1,node_shared_openssl:!1,strict_aliasing:!1,target_arch:"x32",v8_use_snapshot:!1,v8_no_strict_aliasing:0,visibility:""}},this.pid=1e3*Math.random()|0,this.title="node",this.arch="x32",this._mask=18}return d(e,b),e.prototype.chdir=function(b){null===f&&(f=a("path")),this._cwd=f.resolve(b)},e.prototype.cwd=function(){return this._cwd},e.prototype.uptime=function(){return(Date.now()-this.startTime)/1e3|0},e.prototype.nextTick=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];this._queue.push(new g(a,b))},e.prototype.abort=function(){this.emit("abort")},e.prototype.exit=function(a){this.exitCode=a,this.emit("exit",[a])},e.prototype.getgid=function(){return this._gid},e.prototype.setgid=function(a){"number"==typeof a?this._gid=a:this._gid=1},e.prototype.getuid=function(){return this._uid},e.prototype.setuid=function(a){"number"==typeof a?this._uid=a:this._uid=1},e.prototype.kill=function(a,b){this.emit("kill",[a,b])},e.prototype.memoryUsage=function(){return{rss:0,heapTotal:0,heapUsed:0}},e.prototype.umask=function(a){void 0===a&&(a=this._mask);var b=this._mask;return this._mask=a,this.emit("umask",[a]),b},e.prototype.hrtime=function(){var a;a="undefined"!=typeof performance?performance.now():Date.now?Date.now():(new Date).getTime();var b=a/1e3|0;return a-=1e3*b,a=1e6*a|0,[b,a]},e.prototype.initializeTTYs=function(){if(null===this.stdout){var b=a("./tty");this.stdout=new b,this.stderr=new b,this.stdin=new b}},e}(e.EventEmitter);b.exports=i}).call(this,"/node_modules/bfs-process/js")},{"./tty":13,events:16,path:10}],13:[function(a,b,c){(function(c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("stream"),f=function(a){function b(){a.call(this),this.isRaw=!1,this.columns=80,this.rows=120,this.isTTY=!0,this._bufferedWrites=[]}return d(b,a),b.prototype.setRawMode=function(a){this.isRaw!==a&&(this.isRaw=a,this.emit("modeChange"))},b.prototype.changeColumns=function(a){a!==this.columns&&(this.columns=a,this.emit("resize"))},b.prototype.changeRows=function(a){a!==this.rows&&(this.rows=a,this.emit("resize"))},b.isatty=function(a){return a&&a instanceof b},b.prototype._write=function(a,b,d){var e;try{var f;f="string"==typeof a?new c(a,b):a,this._bufferedWrites.push(f)}catch(g){e=g}finally{d(e)}},b.prototype._read=function(a){var b;for(b=0;b<this._bufferedWrites.length&&this.push(this._bufferedWrites[b]);b++);this._bufferedWrites=this._bufferedWrites.slice(b+1)},b}(e.Duplex);b.exports=f}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2,stream:22}],14:[function(a,b,c){},{}],15:[function(a,b,c){(function(a){function b(a){return Array.isArray(a)}function d(a){return"boolean"==typeof a}function e(a){return null===a}function f(a){return null==a}function g(a){return"number"==typeof a}function h(a){return"string"==typeof a}function i(a){return"symbol"==typeof a}function j(a){return void 0===a}function k(a){return l(a)&&"[object RegExp]"===r(a)}function l(a){return"object"==typeof a&&null!==a}function m(a){return l(a)&&"[object Date]"===r(a)}function n(a){return l(a)&&("[object Error]"===r(a)||a instanceof Error)}function o(a){return"function"==typeof a}function p(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function q(b){return a.isBuffer(b)}function r(a){return Object.prototype.toString.call(a)}c.isArray=b,c.isBoolean=d,c.isNull=e,c.isNullOrUndefined=f,c.isNumber=g,c.isString=h,c.isSymbol=i,c.isUndefined=j,c.isRegExp=k,c.isObject=l,c.isDate=m,c.isError=n,c.isFunction=o,c.isPrimitive=p,c.isBuffer=q}).call(this,{isBuffer:a("/Users/jvilk/Code/browserfs/node_modules/is-buffer/index.js")})},{"/Users/jvilk/Code/browserfs/node_modules/is-buffer/index.js":18}],16:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];c.apply(this,f)}else if(g(c)){for(d=arguments.length,f=new Array(d-1),i=1;d>i;i++)f[i-1]=arguments[i];for(j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f)}return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned){var c;c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],17:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],18:[function(a,b,c){b.exports=function(a){return!(null==a||!(a._isBuffer||a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)))}},{}],19:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],20:[function(b,c,d){(function(e){!function(b){if("object"==typeof d&&"undefined"!=typeof c)c.exports=b();else if("function"==typeof a&&a.amd)a([],b);else{var f;f="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:this,f.pako=b()}}(function(){return function a(c,d,e){function f(h,i){if(!d[h]){if(!c[h]){var j="function"==typeof b&&b;if(!i&&j)return j(h,!0);if(g)return g(h,!0);var k=new Error("Cannot find module '"+h+"'");throw k.code="MODULE_NOT_FOUND",k}var l=d[h]={exports:{}};c[h][0].call(l.exports,function(a){var b=c[h][1][a];return f(b?b:a)},l,l.exports,a,c,d,e)}return d[h].exports}for(var g="function"==typeof b&&b,h=0;h<e.length;h++)f(e[h]);return f}({1:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;c>b;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;c>b;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],2:[function(a,b,c){"use strict";function d(a,b){if(65537>b&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;b>d;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;256>j;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=new e.Buf8(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,
b[g++]=128|63&c):65536>c?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;d>c;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;h>c;)if(f=a[c++],128>f)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&h>c;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:65536>f?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return 0>c?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":1}],3:[function(a,b,c){"use strict";function d(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=d},{}],4:[function(a,b,c){b.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}},{}],5:[function(a,b,c){"use strict";function d(){for(var a,b=[],c=0;256>c;c++){a=c;for(var d=0;8>d;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function e(a,b,c,d){var e=f,g=d+c;a=-1^a;for(var h=d;g>h;h++)a=a>>>8^e[255&(a^b[h])];return-1^a}var f=d();b.exports=e},{}],6:[function(a,b,c){"use strict";function d(){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}b.exports=d},{}],7:[function(a,b,c){"use strict";var d=30,e=12;b.exports=function(a,b){var c,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;c=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=c.dmax,l=c.wsize,m=c.whave,n=c.wnext,o=c.window,p=c.hold,q=c.bits,r=c.lencode,s=c.distcode,t=(1<<c.lenbits)-1,u=(1<<c.distbits)-1;a:do{15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){c.mode=e;break a}a.msg="invalid literal/length code",c.mode=d;break a}x=65535&v,w&=15,w&&(w>q&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",c.mode=d;break a}if(y=65535&v,w&=15,w>q&&(p+=B[f++]<<q,q+=8,w>q&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",c.mode=d;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&c.sane){a.msg="invalid distance too far back",c.mode=d;break a}if(z=0,A=o,0===n){if(z+=l-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(w>n){if(z+=l+n-w,w-=n,x>w){x-=w;do C[h++]=o[z++];while(--w);if(z=0,x>n){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(g>f&&j>h);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=g>f?5+(g-f):5-(f-g),a.avail_out=j>h?257+(j-h):257-(h-j),c.hold=p,c.bits=q}},{}],8:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){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}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(oa),b.distcode=b.distdyn=new r.Buf32(pa),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,0>b?(c=0,b=-b):(c=(b>>4)+1,48>b&&(b&=15)),b&&(8>b||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,ra)}function k(a){if(sa){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;144>b;)a.lens[b++]=8;for(;256>b;)a.lens[b++]=9;for(;280>b;)a.lens[b++]=7;for(;288>b;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;32>b;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sa=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new r.Buf8(f.wsize)),d>=f.wsize?(r.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa=0,Ba=new r.Buf8(4),Ca=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return F;c=a.state,c.mode===V&&(c.mode=W),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xa=C;a:for(;;)switch(c.mode){case K:if(0===c.wrap){c.mode=W;break}for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0),m=0,n=0,c.mode=L;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=la;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=la;break}if(m>>>=4,n-=4,wa=(15&m)+8,0===c.wbits)c.wbits=wa;else if(wa>c.wbits){a.msg="invalid window size",c.mode=la;break}c.dmax=1<<wa,a.adler=c.check=1,c.mode=512&m?T:V,m=0,n=0;break;case L:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==J){a.msg="unknown compression method",c.mode=la;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=la;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=M;case M:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,Ba[2]=m>>>16&255,Ba[3]=m>>>24&255,c.check=t(c.check,Ba,4,0)),m=0,n=0,c.mode=N;case N:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Ba[0]=255&m,Ba[1]=m>>>8&255,c.check=t(c.check,Ba,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wa=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wa)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.name+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=R;case R:if(4096&c.flags){if(0===i)break a;q=0;do wa=e[g+q++],c.head&&wa&&c.length<65536&&(c.head.comment+=String.fromCharCode(wa));while(wa&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wa)break a}else c.head&&(c.head.comment=null);c.mode=S;case S:if(512&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=la;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=U;case U:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,E;a.adler=c.check=1,c.mode=V;case V:if(b===A||b===B)break a;case W:if(c.last){m>>>=7&n,n-=7&n,c.mode=ia;break}for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=ba,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=la}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=la;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(;14>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=la;break}c.have=0,c.mode=_;case _:for(;c.have<c.ncode;){for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Ca[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Ca[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,ya={bits:c.lenbits},xa=v(w,c.lens,0,19,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid code lengths set",c.mode=la;break}c.have=0,c.mode=aa;case aa:for(;c.have<c.nlen+c.ndist;){for(;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(16>sa)m>>>=qa,n-=qa,c.lens[c.have++]=sa;else{if(16===sa){for(za=qa+2;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qa,n-=qa,0===c.have){a.msg="invalid bit length repeat",c.mode=la;break}wa=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sa){for(za=qa+3;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=3+(7&m),m>>>=3,n-=3}else{for(za=qa+7;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qa,n-=qa,wa=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=la;break}for(;q--;)c.lens[c.have++]=wa}}if(c.mode===la)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=la;break}if(c.lenbits=9,ya={bits:c.lenbits},xa=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,ya),c.lenbits=ya.bits,xa){a.msg="invalid literal/lengths set",c.mode=la;break}if(c.distbits=6,c.distcode=c.distdyn,ya={bits:c.distbits},xa=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,ya),c.distbits=ya.bits,xa){a.msg="invalid distances set",c.mode=la;break}if(c.mode=ba,b===B)break a;case ba:c.mode=ca;case ca:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,u(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===V&&(c.back=-1);break}for(c.back=0;Aa=c.lencode[m&(1<<c.lenbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(ra&&0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.lencode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,c.length=sa,0===ra){c.mode=ha;break}if(32&ra){c.back=-1,c.mode=V;break}if(64&ra){a.msg="invalid literal/length code",c.mode=la;break}c.extra=15&ra,c.mode=da;case da:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=ea;case ea:for(;Aa=c.distcode[m&(1<<c.distbits)-1],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&ra)){for(ta=qa,ua=ra,va=sa;Aa=c.distcode[va+((m&(1<<ta+ua)-1)>>ta)],qa=Aa>>>24,ra=Aa>>>16&255,sa=65535&Aa,!(n>=ta+qa);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=ta,n-=ta,c.back+=ta}if(m>>>=qa,n-=qa,c.back+=qa,64&ra){a.msg="invalid distance code",c.mode=la;break}c.offset=sa,c.extra=15&ra,c.mode=fa;case fa:if(c.extra){for(za=c.extra;za>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=la;break}c.mode=ga;case ga:if(0===j)break a;if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=la;break}q>c.wnext?(q-=c.wnext,oa=c.wsize-q):oa=c.wnext-q,q>c.length&&(q=c.length),pa=c.window}else pa=f,oa=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pa[oa++];while(--q);0===c.length&&(c.mode=ca);break;case ha:if(0===j)break a;f[h++]=c.length,j--,c.mode=ca;break;case ia:if(c.wrap){for(;32>n;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?t(c.check,f,p,h-p):s(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=la;break}m=0,n=0}c.mode=ja;case ja:if(c.wrap&&c.flags){for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=la;break}m=0,n=0}c.mode=ka;case ka:xa=D;break a;case la:xa=G;break a;case ma:return H;case na:default:return F}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<la&&(c.mode<ia||b!==z))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=ma,H):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?t(c.check,f,p,a.next_out-p):s(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===V?128:0)+(c.mode===ba||c.mode===Y?256:0),(0===o&&0===p||b===z)&&xa===C&&(xa=I),xa)}function n(a){if(!a||!a.state)return F;var b=a.state;return b.window&&(b.window=null),a.state=null,C}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?F:(c.head=b,b.done=!1,C)):F}var p,q,r=a("../utils/common"),s=a("./adler32"),t=a("./crc32"),u=a("./inffast"),v=a("./inftrees"),w=0,x=1,y=2,z=4,A=5,B=6,C=0,D=1,E=2,F=-2,G=-3,H=-4,I=-5,J=8,K=1,L=2,M=3,N=4,O=5,P=6,Q=7,R=8,S=9,T=10,U=11,V=12,W=13,X=14,Y=15,Z=16,$=17,_=18,aa=19,ba=20,ca=21,da=22,ea=23,fa=24,ga=25,ha=26,ia=27,ja=28,ka=29,la=30,ma=31,na=32,oa=852,pa=592,qa=15,ra=qa,sa=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(a,b,c){"use strict";var d=a("../utils/common"),e=15,f=852,g=592,h=0,i=1,j=2,k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],m=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],n=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,c,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new d.Buf16(e+1),Q=new d.Buf16(e+1),R=null,S=0;for(D=0;e>=D;D++)P[D]=0;for(E=0;o>E;E++)P[b[c+E]]++;for(H=C,G=e;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;G>F&&0===P[F];F++);for(F>H&&(H=F),K=1,D=1;e>=D;D++)if(K<<=1,K-=P[D],0>K)return-1;if(K>0&&(a===h||1!==G))return-1;for(Q[1]=0,D=1;e>D;D++)Q[D+1]=Q[D]+P[D];for(E=0;o>E;E++)0!==b[c+E]&&(r[Q[b[c+E]]++]=E);if(a===h?(N=R=r,y=19):a===i?(N=k,O-=257,R=l,S-=257,y=256):(N=m,R=n,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===i&&L>f||a===j&&L>g)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[c+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;G>I+J&&(K-=P[I+J],!(0>=K));)I++,K<<=1;if(L+=1<<I,a===i&&L>f||a===j&&L>g)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":1}],10:[function(a,b,c){"use strict";b.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"}},{}],11:[function(a,b,c){"use strict";function d(){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}b.exports=d},{}],"/lib/inflate.js":[function(a,b,c){"use strict";function d(a,b){var c=new n(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}var f=a("./zlib/inflate.js"),g=a("./utils/common"),h=a("./utils/strings"),i=a("./zlib/constants"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=a("./zlib/gzheader"),m=Object.prototype.toString,n=function(a){this.options=g.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=f.inflateInit2(this.strm,b.windowBits);if(c!==i.Z_OK)throw new Error(j[c]);this.header=new l,f.inflateGetHeader(this.strm,this.header)};n.prototype.push=function(a,b){var c,d,e,j,k,l=this.strm,n=this.options.chunkSize,o=!1;if(this.ended)return!1;d=b===~~b?b:b===!0?i.Z_FINISH:i.Z_NO_FLUSH,"string"==typeof a?l.input=h.binstring2buf(a):"[object ArrayBuffer]"===m.call(a)?l.input=new Uint8Array(a):l.input=a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new g.Buf8(n),l.next_out=0,l.avail_out=n),c=f.inflate(l,i.Z_NO_FLUSH),c===i.Z_BUF_ERROR&&o===!0&&(c=i.Z_OK,o=!1),c!==i.Z_STREAM_END&&c!==i.Z_OK)return this.onEnd(c),this.ended=!0,!1;l.next_out&&(0===l.avail_out||c===i.Z_STREAM_END||0===l.avail_in&&(d===i.Z_FINISH||d===i.Z_SYNC_FLUSH))&&("string"===this.options.to?(e=h.utf8border(l.output,l.next_out),j=l.next_out-e,k=h.buf2string(l.output,e),l.next_out=j,l.avail_out=n-j,j&&g.arraySet(l.output,l.output,e,j,0),this.onData(k)):this.onData(g.shrinkBuf(l.output,l.next_out))),0===l.avail_in&&0===l.avail_out&&(o=!0)}while((l.avail_in>0||0===l.avail_out)&&c!==i.Z_STREAM_END);return c===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(c=f.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===i.Z_OK):d===i.Z_SYNC_FLUSH?(this.onEnd(i.Z_OK),l.avail_out=0,!0):!0},n.prototype.onData=function(a){this.chunks.push(a)},n.prototype.onEnd=function(a){a===i.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=g.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=n,c.inflate=d,c.inflateRaw=e,c.ungzip=d},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate.js":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(a,b,c){(function(a){"use strict";function c(b){for(var c=new Array(arguments.length-1),d=0;d<c.length;)c[d++]=arguments[d];a.nextTick(function(){b.apply(null,c)})}b.exports=c}).call(this,a("bfs-process"))},{"bfs-process":11}],22:[function(a,b,c){function d(){e.call(this)}b.exports=d;var e=a("events").EventEmitter,f=a("inherits");f(d,e),d.Readable=a("readable-stream/readable.js"),d.Writable=a("readable-stream/writable.js"),d.Duplex=a("readable-stream/duplex.js"),d.Transform=a("readable-stream/transform.js"),d.PassThrough=a("readable-stream/passthrough.js"),d.Stream=d,d.prototype.pipe=function(a,b){function c(b){a.writable&&!1===a.write(b)&&j.pause&&j.pause()}function d(){j.readable&&j.resume&&j.resume()}function f(){k||(k=!0,a.end())}function g(){k||(k=!0,"function"==typeof a.destroy&&a.destroy())}function h(a){if(i(),0===e.listenerCount(this,"error"))throw a}function i(){j.removeListener("data",c),a.removeListener("drain",d),j.removeListener("end",f),j.removeListener("close",g),j.removeListener("error",h),a.removeListener("error",h),j.removeListener("end",i),j.removeListener("close",i),a.removeListener("close",i)}var j=this;j.on("data",c),a.on("drain",d),a._isStdio||b&&b.end===!1||(j.on("end",f),j.on("close",g));var k=!1;return j.on("error",h),a.on("error",h),j.on("end",i),j.on("close",i),a.on("close",i),a.emit("pipe",j),a}},{events:16,inherits:17,"readable-stream/duplex.js":23,"readable-stream/passthrough.js":29,"readable-stream/readable.js":30,"readable-stream/transform.js":31,"readable-stream/writable.js":32}],23:[function(a,b,c){b.exports=a("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":24}],24:[function(a,b,c){"use strict";function d(a){return this instanceof d?(j.call(this,a),k.call(this,a),a&&a.readable===!1&&(this.readable=!1),a&&a.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,a&&a.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",e)):new d(a)}function e(){this.allowHalfOpen||this._writableState.ended||h(f,this)}function f(a){a.end()}var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b};b.exports=d;var h=a("process-nextick-args"),i=a("core-util-is");i.inherits=a("inherits");var j=a("./_stream_readable"),k=a("./_stream_writable");i.inherits(d,j);for(var l=g(k.prototype),m=0;m<l.length;m++){var n=l[m];d.prototype[n]||(d.prototype[n]=k.prototype[n])}},{"./_stream_readable":26,"./_stream_writable":28,"core-util-is":15,inherits:17,"process-nextick-args":21}],25:[function(a,b,c){"use strict";function d(a){return this instanceof d?void e.call(this,a):new d(a)}b.exports=d;var e=a("./_stream_transform"),f=a("core-util-is");f.inherits=a("inherits"),f.inherits(d,e),d.prototype._transform=function(a,b,c){c(null,a)}},{"./_stream_transform":27,"core-util-is":15,inherits:17}],26:[function(a,b,c){(function(c){"use strict";function d(b,c){var d=a("./_stream_duplex");b=b||{},this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.readableObjectMode);var e=b.highWaterMark,f=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.buffer=[],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.defaultEncoding=b.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(G||(G=a("string_decoder/").StringDecoder),this.decoder=new G(b.encoding),this.encoding=b.encoding)}function e(b){a("./_stream_duplex");return this instanceof e?(this._readableState=new d(b,this),this.readable=!0,b&&"function"==typeof b.read&&(this._read=b.read),void D.call(this)):new e(b)}function f(a,b,c,d,e){var f=j(b,c);if(f)a.emit("error",f);else if(null===c)b.reading=!1,k(a,b);else if(b.objectMode||c&&c.length>0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),e||(b.reading=!1),b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&l(a)),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length<a.highWaterMark||0===a.length)}function h(a){if(a>=H)a=H;else{a--;for(var b=1;32>b;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:null===a||isNaN(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:0>=a?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return B.isBuffer(b)||"string"==typeof b||null===b||void 0===b||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(!b.ended){if(b.decoder){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,l(a)}}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(F("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?z(m,a):m(a))}function m(a){F("emit readable"),a.emit("readable"),t(a)}function n(a,b){b.readingMore||(b.readingMore=!0,z(o,a,b))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(F("maybeReadMore read 0"),a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}function p(a){return function(){var b=a._readableState;F("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,0===b.awaitDrain&&C.listenerCount(a,"data")&&(b.flowing=!0,t(a))}}function q(a){F("readable nexttick read 0"),a.read(0)}function r(a,b){b.resumeScheduled||(b.resumeScheduled=!0,z(s,a,b))}function s(a,b){b.reading||(F("resume read 0"),a.read(0)),b.resumeScheduled=!1,a.emit("resume"),t(a),b.flowing&&!b.reading&&a.read(0)}function t(a){var b=a._readableState;if(F("flow",b.flowing),b.flowing)do var c=a.read();while(null!==c&&b.flowing)}function u(a,b){var c,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)return null;if(0===e)c=null;else if(g)c=d.shift();else if(!a||a>=e)c=f?d.join(""):B.concat(d,e),d.length=0;else if(a<d[0].length){var h=d[0];c=h.slice(0,a),d[0]=h.slice(a)}else if(a===d[0].length)c=d.shift();else{c=f?"":new B(a);for(var i=0,j=0,k=d.length;k>j&&a>i;j++){var h=d[0],l=Math.min(a-i,h.length);f?c+=h.slice(0,l):h.copy(c,i,0,l),l<h.length?d[0]=h.slice(l):d.shift(),i+=l}}return c}function v(a){var b=a._readableState;if(b.length>0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,z(w,b,a))}function w(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}function x(a,b){for(var c=0,d=a.length;d>c;c++)b(a[c],c)}function y(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}b.exports=e;var z=a("process-nextick-args"),A=a("isarray"),B=a("buffer").Buffer;e.ReadableState=d;var C=a("events").EventEmitter;C.listenerCount||(C.listenerCount=function(a,b){return a.listeners(b).length});var D;!function(){try{D=a("stream")}catch(b){}finally{D||(D=a("events").EventEmitter)}}();var B=a("buffer").Buffer,E=a("core-util-is");E.inherits=a("inherits");var F=a("util");F=F&&F.debuglog?F.debuglog("stream"):function(){};var G;E.inherits(e,D),e.prototype.push=function(a,b){var c=this._readableState;return c.objectMode||"string"!=typeof a||(b=b||c.defaultEncoding,b!==c.encoding&&(a=new B(a,b),b="")),f(this,c,a,b,!1)},e.prototype.unshift=function(a){var b=this._readableState;return f(this,b,a,"",!0)},e.prototype.isPaused=function(){return this._readableState.flowing===!1},e.prototype.setEncoding=function(b){return G||(G=a("string_decoder/").StringDecoder),this._readableState.decoder=new G(b),this._readableState.encoding=b,this};var H=8388608;e.prototype.read=function(a){F("read",a);var b=this._readableState,c=a;if(("number"!=typeof a||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return F("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?v(this):l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&v(this),null;var d=b.needReadable;F("need readable",d),(0===b.length||b.length-a<b.highWaterMark)&&(d=!0,F("length less than watermark",d)),(b.ended||b.reading)&&(d=!1,F("reading or ended",d)),d&&(F("do read"),b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=i(c,b));var e;return e=a>0?u(a,b):null,null===e&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&v(this),null!==e&&this.emit("data",e),e},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){F("onunpipe"),a===l&&f()}function e(){F("onend"),a.end()}function f(){F("cleanup"),a.removeListener("close",i),a.removeListener("finish",j),a.removeListener("drain",q),a.removeListener("error",h),a.removeListener("unpipe",d),l.removeListener("end",e),l.removeListener("end",f),l.removeListener("data",g),!m.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function g(b){F("ondata");var c=a.write(b);!1===c&&(F("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,l.pause())}function h(b){F("onerror",b),k(),a.removeListener("error",h),0===C.listenerCount(a,"error")&&a.emit("error",b)}function i(){a.removeListener("finish",j),k()}function j(){F("onfinish"),a.removeListener("close",i),k()}function k(){F("unpipe"),l.unpipe(a)}var l=this,m=this._readableState;switch(m.pipesCount){case 0:m.pipes=a;break;case 1:m.pipes=[m.pipes,a];break;default:m.pipes.push(a)}m.pipesCount+=1,F("pipe count=%d opts=%j",m.pipesCount,b);var n=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,o=n?e:f;m.endEmitted?z(o):l.once("end",o),a.on("unpipe",d);var q=p(l);return a.on("drain",q),l.on("data",g),a._events&&a._events.error?A(a._events.error)?a._events.error.unshift(h):a._events.error=[h,a._events.error]:a.on("error",h),a.once("close",i),a.once("finish",j),a.emit("pipe",l),m.flowing||(F("pipe resume"),l.resume()),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;d>e;e++)c[e].emit("unpipe",this);return this}var e=y(b.pipes,a);return-1===e?this:(b.pipes.splice(e,1),b.pipesCount-=1,1===b.pipesCount&&(b.pipes=b.pipes[0]),a.emit("unpipe",this),this)},e.prototype.on=function(a,b){var c=D.prototype.on.call(this,a,b);if("data"===a&&!1!==this._readableState.flowing&&this.resume(),"readable"===a&&this.readable){var d=this._readableState;d.readableListening||(d.readableListening=!0,d.emittedReadable=!1,d.needReadable=!0,d.reading?d.length&&l(this,d):z(q,this))}return c},e.prototype.addListener=e.prototype.on,e.prototype.resume=function(){var a=this._readableState;return a.flowing||(F("resume"),a.flowing=!0,r(this,a)),this},e.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this},e.prototype.wrap=function(a){var b=this._readableState,c=!1,d=this;a.on("end",function(){if(F("wrapped end"),b.decoder&&!b.ended){var a=b.decoder.end();a&&a.length&&d.push(a)}d.push(null)}),a.on("data",function(e){if(F("wrapped data"),b.decoder&&(e=b.decoder.write(e)),(!b.objectMode||null!==e&&void 0!==e)&&(b.objectMode||e&&e.length)){var f=d.push(e);f||(c=!0,a.pause())}});for(var e in a)void 0===this[e]&&"function"==typeof a[e]&&(this[e]=function(b){return function(){return a[b].apply(a,arguments)}}(e));var f=["error","close","destroy","pause","resume"];
return x(f,function(b){a.on(b,d.emit.bind(d,b))}),d._read=function(b){F("wrapped _read",b),c&&(c=!1,a.resume())},d},e._fromList=u}).call(this,a("bfs-process"))},{"./_stream_duplex":24,"bfs-process":11,buffer:2,"core-util-is":15,events:16,inherits:17,isarray:19,"process-nextick-args":21,"string_decoder/":33,util:14}],27:[function(a,b,c){"use strict";function d(a){this.afterTransform=function(b,c){return e(a,b,c)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function e(a,b,c){var d=a._transformState;d.transforming=!1;var e=d.writecb;if(!e)return a.emit("error",new Error("no writecb in Transform class"));d.writechunk=null,d.writecb=null,null!==c&&void 0!==c&&a.push(c),e&&e(b);var f=a._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&a._read(f.highWaterMark)}function f(a){if(!(this instanceof f))return new f(a);h.call(this,a),this._transformState=new d(this);var b=this;this._readableState.needReadable=!0,this._readableState.sync=!1,a&&("function"==typeof a.transform&&(this._transform=a.transform),"function"==typeof a.flush&&(this._flush=a.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(a){g(b,a)}):g(b)})}function g(a,b){if(b)return a.emit("error",b);var c=a._writableState,d=a._transformState;if(c.length)throw new Error("calling transform done when ws.length != 0");if(d.transforming)throw new Error("calling transform done when still transforming");return a.push(null)}b.exports=f;var h=a("./_stream_duplex"),i=a("core-util-is");i.inherits=a("inherits"),i.inherits(f,h),f.prototype.push=function(a,b){return this._transformState.needTransform=!1,h.prototype.push.call(this,a,b)},f.prototype._transform=function(a,b,c){throw new Error("not implemented")},f.prototype._write=function(a,b,c){var d=this._transformState;if(d.writecb=c,d.writechunk=a,d.writeencoding=b,!d.transforming){var e=this._readableState;(d.needTransform||e.needReadable||e.length<e.highWaterMark)&&this._read(e.highWaterMark)}},f.prototype._read=function(a){var b=this._transformState;null!==b.writechunk&&b.writecb&&!b.transforming?(b.transforming=!0,this._transform(b.writechunk,b.writeencoding,b.afterTransform)):b.needTransform=!0}},{"./_stream_duplex":24,"core-util-is":15,inherits:17}],28:[function(a,b,c){"use strict";function d(){}function e(a,b,c){this.chunk=a,this.encoding=b,this.callback=c,this.next=null}function f(b,c){var d=a("./_stream_duplex");b=b||{},this.objectMode=!!b.objectMode,c instanceof d&&(this.objectMode=this.objectMode||!!b.writableObjectMode);var e=b.highWaterMark,f=this.objectMode?16:16384;this.highWaterMark=e||0===e?e:f,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var g=b.decodeStrings===!1;this.decodeStrings=!g,this.defaultEncoding=b.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(a){o(c,a)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function g(b){var c=a("./_stream_duplex");return this instanceof g||this instanceof c?(this._writableState=new f(b,this),this.writable=!0,b&&("function"==typeof b.write&&(this._write=b.write),"function"==typeof b.writev&&(this._writev=b.writev)),void z.call(this)):new g(b)}function h(a,b){var c=new Error("write after end");a.emit("error",c),w(b,c)}function i(a,b,c,d){var e=!0;if(!x.isBuffer(c)&&"string"!=typeof c&&null!==c&&void 0!==c&&!b.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");a.emit("error",f),w(d,f),e=!1}return e}function j(a,b,c){return a.objectMode||a.decodeStrings===!1||"string"!=typeof b||(b=new x(b,c)),b}function k(a,b,c,d,f){c=j(b,c,d),x.isBuffer(c)&&(d="buffer");var g=b.objectMode?1:c.length;b.length+=g;var h=b.length<b.highWaterMark;if(h||(b.needDrain=!0),b.writing||b.corked){var i=b.lastBufferedRequest;b.lastBufferedRequest=new e(c,d,f),i?i.next=b.lastBufferedRequest:b.bufferedRequest=b.lastBufferedRequest}else l(a,b,!1,g,c,d,f);return h}function l(a,b,c,d,e,f,g){b.writelen=d,b.writecb=g,b.writing=!0,b.sync=!0,c?a._writev(e,b.onwrite):a._write(e,f,b.onwrite),b.sync=!1}function m(a,b,c,d,e){--b.pendingcb,c?w(e,d):e(d),a._writableState.errorEmitted=!0,a.emit("error",d)}function n(a){a.writing=!1,a.writecb=null,a.length-=a.writelen,a.writelen=0}function o(a,b){var c=a._writableState,d=c.sync,e=c.writecb;if(n(c),b)m(a,c,d,b,e);else{var f=s(c);f||c.corked||c.bufferProcessing||!c.bufferedRequest||r(a,c),d?w(p,a,c,f,e):p(a,c,f,e)}}function p(a,b,c,d){c||q(a,b),b.pendingcb--,d(),u(a,b)}function q(a,b){0===b.length&&b.needDrain&&(b.needDrain=!1,a.emit("drain"))}function r(a,b){b.bufferProcessing=!0;var c=b.bufferedRequest;if(a._writev&&c&&c.next){for(var d=[],e=[];c;)e.push(c.callback),d.push(c),c=c.next;b.pendingcb++,b.lastBufferedRequest=null,l(a,b,!0,b.length,d,"",function(a){for(var c=0;c<e.length;c++)b.pendingcb--,e[c](a)})}else{for(;c;){var f=c.chunk,g=c.encoding,h=c.callback,i=b.objectMode?1:f.length;if(l(a,b,!1,i,f,g,h),c=c.next,b.writing)break}null===c&&(b.lastBufferedRequest=null)}b.bufferedRequest=c,b.bufferProcessing=!1}function s(a){return a.ending&&0===a.length&&null===a.bufferedRequest&&!a.finished&&!a.writing}function t(a,b){b.prefinished||(b.prefinished=!0,a.emit("prefinish"))}function u(a,b){var c=s(b);return c&&(0===b.pendingcb?(t(a,b),b.finished=!0,a.emit("finish")):t(a,b)),c}function v(a,b,c){b.ending=!0,u(a,b),c&&(b.finished?w(c):a.once("finish",c)),b.ended=!0}b.exports=g;var w=a("process-nextick-args"),x=a("buffer").Buffer;g.WritableState=f;var y=a("core-util-is");y.inherits=a("inherits");var z;!function(){try{z=a("stream")}catch(b){}finally{z||(z=a("events").EventEmitter)}}();var x=a("buffer").Buffer;y.inherits(g,z),f.prototype.getBuffer=function(){for(var a=this.bufferedRequest,b=[];a;)b.push(a),a=a.next;return b},function(){try{Object.defineProperty(f.prototype,"buffer",{get:a("util-deprecate")(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer() instead.")})}catch(b){}}(),g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},g.prototype.write=function(a,b,c){var e=this._writableState,f=!1;return"function"==typeof b&&(c=b,b=null),x.isBuffer(a)?b="buffer":b||(b=e.defaultEncoding),"function"!=typeof c&&(c=d),e.ended?h(this,c):i(this,e,a,c)&&(e.pendingcb++,f=k(this,e,a,b,c)),f},g.prototype.cork=function(){var a=this._writableState;a.corked++},g.prototype.uncork=function(){var a=this._writableState;a.corked&&(a.corked--,a.writing||a.corked||a.finished||a.bufferProcessing||!a.bufferedRequest||r(this,a))},g.prototype.setDefaultEncoding=function(a){if("string"==typeof a&&(a=a.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((a+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+a);this._writableState.defaultEncoding=a},g.prototype._write=function(a,b,c){c(new Error("not implemented"))},g.prototype._writev=null,g.prototype.end=function(a,b,c){var d=this._writableState;"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null),null!==a&&void 0!==a&&this.write(a,b),d.corked&&(d.corked=1,this.uncork()),d.ending||d.finished||v(this,d,c)}},{"./_stream_duplex":24,buffer:2,"core-util-is":15,events:16,inherits:17,"process-nextick-args":21,"util-deprecate":34}],29:[function(a,b,c){b.exports=a("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":25}],30:[function(a,b,c){var d=function(){try{return a("stream")}catch(b){}}();c=b.exports=a("./lib/_stream_readable.js"),c.Stream=d||c,c.Readable=c,c.Writable=a("./lib/_stream_writable.js"),c.Duplex=a("./lib/_stream_duplex.js"),c.Transform=a("./lib/_stream_transform.js"),c.PassThrough=a("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":24,"./lib/_stream_passthrough.js":25,"./lib/_stream_readable.js":26,"./lib/_stream_transform.js":27,"./lib/_stream_writable.js":28}],31:[function(a,b,c){b.exports=a("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":27}],32:[function(a,b,c){b.exports=a("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":28}],33:[function(a,b,c){function d(a){if(a&&!i(a))throw new Error("Unknown encoding: "+a)}function e(a){return a.toString(this.encoding)}function f(a){this.charReceived=a.length%2,this.charLength=this.charReceived?2:0}function g(a){this.charReceived=a.length%3,this.charLength=this.charReceived?3:0}var h=a("buffer").Buffer,i=h.isEncoding||function(a){switch(a&&a.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},j=c.StringDecoder=function(a){switch(this.encoding=(a||"utf8").toLowerCase().replace(/[-_]/,""),d(a),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=g;break;default:return void(this.write=e)}this.charBuffer=new h(6),this.charReceived=0,this.charLength=0};j.prototype.write=function(a){for(var b="";this.charLength;){var c=a.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived<this.charLength)return"";a=a.slice(c,a.length),b=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var d=b.charCodeAt(b.length-1);if(!(d>=55296&&56319>=d)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&56319>=d){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(2>=b&&c>>4==14){this.charLength=3;break}if(3>=b&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:2}],34:[function(a,b,c){(function(a){function c(a,b){function c(){if(!e){if(d("throwDeprecation"))throw new Error(b);d("traceDeprecation")?console.trace(b):console.warn(b),e=!0}return a.apply(this,arguments)}if(d("noDeprecation"))return a;var e=!1;return c}function d(b){try{if(!a.localStorage)return!1}catch(c){return!1}var d=a.localStorage[b];return null==d?!1:"true"===String(d).toLowerCase()}b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],35:[function(a,b,c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("../core/file_system"),f=a("../core/file_flag"),g=a("../generic/preload_file"),h=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return d(b,a),b.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},b.prototype.closeSync=function(){this.syncSync()},b}(g.PreloadFile),i=function(a){function b(b,c){if(a.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._sync=b,this._async=c,!b.supportsSynch())throw new Error("Expected synchronous storage.");if(c.supportsSynch())throw new Error("Expected asynchronous storage.")}return d(b,a),b.prototype.getName=function(){return"AsyncMirror"},b.isAvailable=function(){return!0},b.prototype._syncSync=function(a){this._sync.writeFileSync(a.getPath(),a.getBuffer(),null,f.FileFlag.getFileFlag("w"),a.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[a.getPath(),a.getBuffer(),null,a.getFlag(),a.getStats().mode]})},b.prototype.initialize=function(a){var b=this;if(this._isInitialized)a();else{var c=function(a,c,d){"/"!==a&&b._sync.mkdirSync(a,c),b._async.readdir(a,function(b,c){function f(b){b?d(b):g<c.length?(e(a+"/"+c[g],f),g++):d()}if(b)d(b);else{var g=0;f()}})},d=function(a,c,d){b._async.readFile(a,null,f.FileFlag.getFileFlag("r"),function(e,g){if(e)d(e);else try{b._sync.writeFileSync(a,g,null,f.FileFlag.getFileFlag("w"),c)}catch(h){e=h}finally{d(e)}})},e=function(a,e){b._async.stat(a,!1,function(b,f){b?e(b):f.isDirectory()?c(a,f.mode,e):d(a,f.mode,e)})};c("/",0,function(c){c?a(c):(b._isInitialized=!0,a())})}},b.prototype.isReadOnly=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return this._sync.supportsProps()&&this._async.supportsProps()},b.prototype.enqueueOp=function(a){var b=this;if(this._queue.push(a),!this._queueRunning){this._queueRunning=!0;var c=function(a){if(a&&console.error("WARNING: File system has desynchronized. Received following error: "+a+"\n$"),b._queue.length>0){var d=b._queue.shift(),e=d.arguments;e.push(c),b._async[d.apiMethod].apply(b._async,e)}else b._queueRunning=!1};c()}},b.prototype.renameSync=function(a,b){this._sync.renameSync(a,b),this.enqueueOp({apiMethod:"rename",arguments:[a,b]})},b.prototype.statSync=function(a,b){return this._sync.statSync(a,b)},b.prototype.openSync=function(a,b,c){var d=this._sync.openSync(a,b,c);return d.closeSync(),new h(this,a,b,this._sync.statSync(a,!1),this._sync.readFileSync(a,null,f.FileFlag.getFileFlag("r")))},b.prototype.unlinkSync=function(a){this._sync.unlinkSync(a),this.enqueueOp({apiMethod:"unlink",arguments:[a]})},b.prototype.rmdirSync=function(a){this._sync.rmdirSync(a),this.enqueueOp({apiMethod:"rmdir",arguments:[a]})},b.prototype.mkdirSync=function(a,b){this._sync.mkdirSync(a,b),this.enqueueOp({apiMethod:"mkdir",arguments:[a,b]})},b.prototype.readdirSync=function(a){return this._sync.readdirSync(a)},b.prototype.existsSync=function(a){return this._sync.existsSync(a)},b.prototype.chmodSync=function(a,b,c){this._sync.chmodSync(a,b,c),this.enqueueOp({apiMethod:"chmod",arguments:[a,b,c]})},b.prototype.chownSync=function(a,b,c,d){this._sync.chownSync(a,b,c,d),this.enqueueOp({apiMethod:"chown",arguments:[a,b,c,d]})},b.prototype.utimesSync=function(a,b,c){this._sync.utimesSync(a,b,c),this.enqueueOp({apiMethod:"utimes",arguments:[a,b,c]})},b}(e.SynchronousFileSystem);c.__esModule=!0,c["default"]=i},{"../core/file_flag":53,"../core/file_system":54,"../generic/preload_file":63}],36:[function(a,b,c){(function(b){function d(){null===p&&(p={},p[Dropbox.ApiError.NETWORK_ERROR]=l.ErrorCode.EIO,p[Dropbox.ApiError.INVALID_PARAM]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.INVALID_TOKEN]=l.ErrorCode.EPERM,p[Dropbox.ApiError.OAUTH_ERROR]=l.ErrorCode.EPERM,p[Dropbox.ApiError.NOT_FOUND]=l.ErrorCode.ENOENT,p[Dropbox.ApiError.INVALID_METHOD]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.NOT_ACCEPTABLE]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.CONFLICT]=l.ErrorCode.EINVAL,p[Dropbox.ApiError.RATE_LIMITED]=l.ErrorCode.EBUSY,p[Dropbox.ApiError.SERVER_ERROR]=l.ErrorCode.EBUSY,p[Dropbox.ApiError.OVER_QUOTA]=l.ErrorCode.ENOSPC)}function e(a){return a&&a.stat.isFile}function f(a){return a&&a.stat.isFolder}function g(a){return null===a||void 0===a||"object"==typeof a&&"number"==typeof a.byteLength}var h=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},i=a("../generic/preload_file"),j=a("../core/file_system"),k=a("../core/node_fs_stats"),l=a("../core/api_error"),m=a("async"),n=a("path"),o=a("../core/util"),p=null,q=function(){function a(a){this._cache={},this._client=a}return a.prototype.getCachedInfo=function(a){return this._cache[a.toLowerCase()]},a.prototype.putCachedInfo=function(a,b){this._cache[a.toLowerCase()]=b},a.prototype.deleteCachedInfo=function(a){delete this._cache[a.toLowerCase()]},a.prototype.getCachedDirInfo=function(a){var b=this.getCachedInfo(a);return f(b)?b:null},a.prototype.getCachedFileInfo=function(a){var b=this.getCachedInfo(a);return e(b)?b:null},a.prototype.updateCachedDirInfo=function(a,b,c){void 0===c&&(c=null);var d=this.getCachedInfo(a);null===b.contentHash||void 0!==d&&d.stat.contentHash===b.contentHash||this.putCachedInfo(a,{stat:b,contents:c})},a.prototype.updateCachedFileInfo=function(a,b,c){void 0===c&&(c=null);var d=this.getCachedInfo(a);null===b.versionTag||void 0!==d&&d.stat.versionTag===b.versionTag||this.putCachedInfo(a,{stat:b,contents:c})},a.prototype.updateCachedInfo=function(a,b,c){void 0===c&&(c=null),b.isFile&&g(c)?this.updateCachedFileInfo(a,b,c):b.isFolder&&Array.isArray(c)&&this.updateCachedDirInfo(a,b,c)},a.prototype.readdir=function(a,b){var c=this,d=this.getCachedDirInfo(a);this._wrap(function(b){null!==d&&d.contents?c._client.readdir(a,{contentHash:d.stat.contentHash},b):c._client.readdir(a,b)},function(e,f,g,h){e?e.status===Dropbox.ApiError.NO_CONTENT&&null!==d?b(null,d.contents.slice(0)):b(e):(c.updateCachedDirInfo(a,g,f.slice(0)),h.forEach(function(b){c.updateCachedInfo(n.join(a,b.name),b)}),b(null,f))})},a.prototype.remove=function(a,b){var c=this;this._wrap(function(b){c._client.remove(a,b)},function(d,e){d||c.updateCachedInfo(a,e),b(d)})},a.prototype.move=function(a,b,c){var d=this;this._wrap(function(c){d._client.move(a,b,c)},function(e,f){e||(d.deleteCachedInfo(a),d.updateCachedInfo(b,f)),c(e)})},a.prototype.stat=function(a,b){var c=this;this._wrap(function(b){c._client.stat(a,b)},function(d,e){d||c.updateCachedInfo(a,e),b(d,e)})},a.prototype.readFile=function(a,b){var c=this,d=this.getCachedFileInfo(a);null!==d&&null!==d.contents?this.stat(a,function(e,f){e?b(e):f.contentHash===d.stat.contentHash?b(e,d.contents.slice(0),d.stat):c.readFile(a,b)}):this._wrap(function(b){c._client.readFile(a,{arrayBuffer:!0},b)},function(d,e,f){d||c.updateCachedInfo(a,f,e.slice(0)),b(d,e,f)})},a.prototype.writeFile=function(a,b,c){var d=this;this._wrap(function(c){d._client.writeFile(a,b,c)},function(e,f){e||d.updateCachedInfo(a,f,b.slice(0)),c(e,f)})},a.prototype.mkdir=function(a,b){var c=this;this._wrap(function(b){c._client.mkdir(a,b)},function(d,e){d||c.updateCachedInfo(a,e,[]),b(d)})},a.prototype._wrap=function(a,b){var c=0,d=function(e){var f=2;if(e&&3>++c)switch(e.status){case Dropbox.ApiError.SERVER_ERROR:case Dropbox.ApiError.NETWORK_ERROR:case Dropbox.ApiError.RATE_LIMITED:setTimeout(function(){a(d)},1e3*f);break;default:b.apply(null,arguments)}else b.apply(null,arguments)};a(d)},a}(),r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return h(b,a),b.prototype.sync=function(a){var b=this;if(this.isDirty()){var c=this.getBuffer(),d=o.buffer2ArrayBuffer(c);this._fs._writeFileStrict(this.getPath(),d,function(c){c||b.resetDirty(),a(c)})}else a()},b.prototype.close=function(a){this.sync(a)},b}(i.PreloadFile);c.DropboxFile=r;var s=function(a){function c(b){a.call(this),this._client=new q(b),d()}return h(c,a),c.prototype.getName=function(){return"Dropbox"},c.isAvailable=function(){return"undefined"!=typeof Dropbox},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSymlinks=function(){return!1},c.prototype.supportsProps=function(){return!1},c.prototype.supportsSynch=function(){return!1},c.prototype.empty=function(a){var b=this;this._client.readdir("/",function(c,d){if(c)a(b.convert(c,"/"));else{var e=function(a,c){var d=n.join("/",a);b._client.remove(d,function(a){c(a?b.convert(a,d):null)})},f=function(b){b?a(b):a()};m.each(d,e,f)}})},c.prototype.rename=function(a,b,c){var d=this;this._client.move(a,b,function(e){e?d._client.stat(b,function(f,g){if(f||g.isFolder){var h=e.response.error.indexOf(a)>-1?a:b;c(d.convert(e,h))}else d._client.remove(b,function(e){e?c(d.convert(e,b)):d.rename(a,b,c)})}):c()})},c.prototype.stat=function(a,b,c){var d=this;this._client.stat(a,function(b,e){if(b)c(d.convert(b,a));else{if(null==e||!e.isRemoved){var f=new k["default"](d._statType(e),e.size);return c(null,f)}c(l.ApiError.FileError(l.ErrorCode.ENOENT,a))}})},c.prototype.open=function(a,c,d,e){var f=this;this._client.readFile(a,function(d,g,h){if(!d){var i;i=null===g?new b(0):o.arrayBuffer2Buffer(g);var j=f._makeFile(a,c,h,i);return e(null,j)}if(c.isReadable())e(f.convert(d,a));else switch(d.status){case Dropbox.ApiError.NOT_FOUND:var k=new ArrayBuffer(0);return f._writeFileStrict(a,k,function(b,d){if(b)e(b);else{var g=f._makeFile(a,c,d,o.arrayBuffer2Buffer(k));e(null,g)}});default:return e(f.convert(d,a))}})},c.prototype._writeFileStrict=function(a,b,c){var d=this,e=n.dirname(a);this.stat(e,!1,function(f,g){f?c(l.ApiError.FileError(l.ErrorCode.ENOENT,e)):d._client.writeFile(a,b,function(b,e){b?c(d.convert(b,a)):c(null,e)})})},c.prototype._statType=function(a){return a.isFile?k.FileType.FILE:k.FileType.DIRECTORY},c.prototype._makeFile=function(a,b,c,d){var e=this._statType(c),f=new k["default"](e,c.size);return new r(this,a,b,f,d)},c.prototype._remove=function(a,b,c){var d=this;this._client.stat(a,function(e,f){e?b(d.convert(e,a)):f.isFile&&!c?b(l.ApiError.FileError(l.ErrorCode.ENOTDIR,a)):!f.isFile&&c?b(l.ApiError.FileError(l.ErrorCode.EISDIR,a)):d._client.remove(a,function(c){b(c?d.convert(c,a):null)})})},c.prototype.unlink=function(a,b){this._remove(a,b,!0)},c.prototype.rmdir=function(a,b){this._remove(a,b,!1)},c.prototype.mkdir=function(a,b,c){var d=this,e=n.dirname(a);this._client.stat(e,function(b,f){b?c(d.convert(b,e)):d._client.mkdir(a,function(b){c(b?l.ApiError.FileError(l.ErrorCode.EEXIST,a):null)})})},c.prototype.readdir=function(a,b){var c=this;this._client.readdir(a,function(a,d){return a?b(c.convert(a)):b(null,d)})},c.prototype.convert=function(a,b){void 0===b&&(b=null);var c=p[a.status];return void 0===c&&(c=l.ErrorCode.EIO),null==b?new l.ApiError(c):l.ApiError.FileError(c,b)},c}(j.BaseFileSystem);c.__esModule=!0,c["default"]=s}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/file_system":54,"../core/node_fs_stats":57,"../core/util":58,"../generic/preload_file":63,async:1,"bfs-buffer":2,path:10}],37:[function(a,b,c){function d(a,b){if(null!==b&&"object"==typeof b){var c=b,d=c.path;d&&(d="/"+i.relative(a,d),c.message=c.message.replace(c.path,d),c.path=d)}return b}function e(a,b){return"function"==typeof b?function(c){arguments.length>0&&(arguments[0]=d(a,c)),b.apply(null,arguments)}:b}function f(a,b,c){return"Sync"!==a.slice(a.length-4)?function(){return arguments.length>0&&(b&&(arguments[0]=i.join(this._folder,arguments[0])),c&&(arguments[1]=i.join(this._folder,arguments[1])),arguments[arguments.length-1]=e(this._folder,arguments[arguments.length-1])),this._wrapped[a].apply(this._wrapped,arguments)}:function(){try{return b&&(arguments[0]=i.join(this._folder,arguments[0])),c&&(arguments[1]=i.join(this._folder,arguments[1])),this._wrapped[a].apply(this._wrapped,arguments)}catch(e){throw d(this._folder,e)}}}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("../core/file_system"),i=a("path"),j=a("../core/api_error"),k=function(a){function b(b,c){a.call(this),this._folder=b,this._wrapped=c}return g(b,a),b.prototype.initialize=function(a){var b=this;this._wrapped.exists(this._folder,function(c){c?a():b._wrapped.isReadOnly()?a(j.ApiError.ENOENT(b._folder)):b._wrapped.mkdir(b._folder,511,a)})},b.prototype.getName=function(){return this._wrapped.getName()},b.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},b.prototype.supportsProps=function(){return this._wrapped.supportsProps()},b.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},b.prototype.supportsLinks=function(){return!1},b.isAvailable=function(){return!0},b}(h.BaseFileSystem);c.__esModule=!0,c["default"]=k,["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimeSync","readlink","readlinkSync"].forEach(function(a){k.prototype[a]=f(a,!0,!1)}),["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(function(a){k.prototype[a]=f(a,!0,!0)})},{"../core/api_error":49,"../core/file_system":54,path:10}],38:[function(a,b,c){function d(a){return a.isDirectory}function e(a,b,c,d){if("undefined"!=typeof navigator.webkitPersistentStorage)switch(a){case n.PERSISTENT:navigator.webkitPersistentStorage.requestQuota(b,c,d);break;case n.TEMPORARY:navigator.webkitTemporaryStorage.requestQuota(b,c,d);break;default:d(new TypeError("Invalid storage type: "+a))}else n.webkitStorageInfo.requestQuota(a,b,c,d)}function f(a){return Array.prototype.slice.call(a||[],0)}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("../generic/preload_file"),i=a("../core/file_system"),j=a("../core/api_error"),k=a("../core/file_flag"),l=a("../core/node_fs_stats"),m=a("path"),n=a("../core/global"),o=a("async"),p=a("../core/util"),q=n.webkitRequestFileSystem||n.requestFileSystem||null,r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return g(b,a),b.prototype.sync=function(a){var b=this;if(this.isDirty()){var c={create:!1},d=this._fs,e=function(c){c.createWriter(function(c){var e=b.getBuffer(),f=new Blob([p.buffer2ArrayBuffer(e)]),g=f.size;c.onwriteend=function(){c.onwriteend=null,c.truncate(g),b.resetDirty(),a()},c.onerror=function(c){a(d.convert(c,b.getPath(),!1))},c.write(f)})},f=function(c){a(d.convert(c,b.getPath(),!1))};d.fs.root.getFile(this.getPath(),c,e,f)}else a()},b.prototype.close=function(a){this.sync(a)},b}(h.PreloadFile);c.HTML5FSFile=r;var s=function(a){function b(b,c){void 0===b&&(b=5),void 0===c&&(c=n.PERSISTENT),a.call(this),this.size=1048576*b,this.type=c}return g(b,a),b.prototype.getName=function(){return"HTML5 FileSystem"},b.isAvailable=function(){return null!=q},b.prototype.isReadOnly=function(){return!1},b.prototype.supportsSymlinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!1},b.prototype.convert=function(a,b,c){switch(a.name){case"PathExistsError":return j.ApiError.EEXIST(b);case"QuotaExceededError":return j.ApiError.FileError(j.ErrorCode.ENOSPC,b);case"NotFoundError":return j.ApiError.ENOENT(b);case"SecurityError":return j.ApiError.FileError(j.ErrorCode.EACCES,b);case"InvalidModificationError":return j.ApiError.FileError(j.ErrorCode.EPERM,b);case"TypeMismatchError":return j.ApiError.FileError(c?j.ErrorCode.ENOTDIR:j.ErrorCode.EISDIR,b);case"EncodingError":case"InvalidStateError":case"NoModificationAllowedError":default:return j.ApiError.FileError(j.ErrorCode.EINVAL,b)}},b.prototype.allocate=function(a){var b=this;void 0===a&&(a=function(){});var c=function(c){b.fs=c,a()},d=function(c){a(b.convert(c,"/",!0))};this.type===n.PERSISTENT?e(this.type,this.size,function(a){q(b.type,a,c,d)},d):q(this.type,this.size,c,d)},b.prototype.empty=function(a){var b=this;this._readdir("/",function(c,e){if(c)console.error("Failed to empty FS"),a(c);else{var f=function(b){c?(console.error("Failed to empty FS"),a(c)):a()},g=function(a,c){var e=function(){c()},f=function(d){c(b.convert(d,a.fullPath,!a.isDirectory))};d(a)?a.removeRecursively(e,f):a.remove(e,f)};o.each(e,g,f)}})},b.prototype.rename=function(a,b,c){var d=this,e=2,f=0,g=this.fs.root,h=a,i=function(a){--e<=0&&c(d.convert(a,h,!1))},k=function(e){return 2===++f?c(new j.ApiError(j.ErrorCode.EINVAL,"Something was identified as both a file and a directory. This should never happen.")):a===b?c():(h=m.dirname(b),void g.getDirectory(h,{},function(f){h=m.basename(b),e.moveTo(f,h,function(a){c()},function(f){e.isDirectory?(h=b,d.unlink(b,function(e){e?i(f):d.rename(a,b,c)})):i(f)})},i))};g.getFile(a,{},k,i),g.getDirectory(a,{},k,i)},b.prototype.stat=function(a,b,c){var d=this,e={create:!1},f=function(a){var b=function(a){var b=new l["default"](l.FileType.FILE,a.size);c(null,b)};a.file(b,h)},g=function(a){var b=4096,d=new l["default"](l.FileType.DIRECTORY,b);c(null,d)},h=function(b){c(d.convert(b,a,!1))},i=function(){d.fs.root.getDirectory(a,e,g,h)};this.fs.root.getFile(a,e,f,i)},b.prototype.open=function(a,b,c,d){var e=this,f=function(c){d("InvalidModificationError"===c.name&&b.isExclusive()?j.ApiError.EEXIST(a):e.convert(c,a,!1))};this.fs.root.getFile(a,{create:b.pathNotExistsAction()===k.ActionType.CREATE_FILE,exclusive:b.isExclusive()},function(c){c.file(function(c){var g=new FileReader;g.onloadend=function(f){var h=e._makeFile(a,b,c,g.result);d(null,h)},g.onerror=function(a){f(g.error)},g.readAsArrayBuffer(c)},f)},f)},b.prototype._statType=function(a){return a.isFile?l.FileType.FILE:l.FileType.DIRECTORY},b.prototype._makeFile=function(a,b,c,d){void 0===d&&(d=new ArrayBuffer(0));var e=new l["default"](l.FileType.FILE,c.size),f=p.arrayBuffer2Buffer(d);return new r(this,a,b,e,f)},b.prototype._remove=function(a,b,c){var d=this,e=function(e){var f=function(){b()},g=function(e){b(d.convert(e,a,!c))};e.remove(f,g)},f=function(e){b(d.convert(e,a,!c))},g={create:!1};c?this.fs.root.getFile(a,g,e,f):this.fs.root.getDirectory(a,g,e,f)},b.prototype.unlink=function(a,b){this._remove(a,b,!0)},b.prototype.rmdir=function(a,b){this._remove(a,b,!1)},b.prototype.mkdir=function(a,b,c){var d=this,e={create:!0,exclusive:!0},f=function(a){c()},g=function(b){c(d.convert(b,a,!0))};this.fs.root.getDirectory(a,e,f,g)},b.prototype._readdir=function(a,b){var c=this,d=function(d){b(c.convert(d,a,!0))};this.fs.root.getDirectory(a,{create:!1},function(a){var c=a.createReader(),e=[],g=function(){c.readEntries(function(a){a.length?(e=e.concat(f(a)),g()):b(null,e)},d)};g()},d)},b.prototype.readdir=function(a,b){this._readdir(a,function(a,c){if(a)return b(a);for(var d=[],e=0;e<c.length;e++)d.push(c[e].name);b(null,d)})},b}(i.BaseFileSystem);c.__esModule=!0,c["default"]=s},{"../core/api_error":49,"../core/file_flag":53,"../core/file_system":54,"../core/global":55,"../core/node_fs_stats":57,"../core/util":58,"../generic/preload_file":63,async:1,path:10}],39:[function(a,b,c){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("../generic/key_value_filesystem"),f=function(){function a(){this.store={}}return a.prototype.name=function(){return"In-memory"},a.prototype.clear=function(){this.store={}},a.prototype.beginTransaction=function(a){return new e.SimpleSyncRWTransaction(this)},a.prototype.get=function(a){return this.store[a]},a.prototype.put=function(a,b,c){return!c&&this.store.hasOwnProperty(a)?!1:(this.store[a]=b,!0)},a.prototype.del=function(a){delete this.store[a]},a}();c.InMemoryStore=f;var g=function(a){function b(){a.call(this,{store:new f})}return d(b,a),b}(e.SyncKeyValueFileSystem);c.__esModule=!0,c["default"]=g},{"../generic/key_value_filesystem":62}],40:[function(a,b,c){function d(a,b){switch(void 0===b&&(b=a.toString()),a.name){case"NotFoundError":return new h.ApiError(h.ErrorCode.ENOENT,b);case"QuotaExceededError":return new h.ApiError(h.ErrorCode.ENOSPC,b);default:return new h.ApiError(h.ErrorCode.EIO,b)}}function e(a,b,c){return void 0===b&&(b=h.ErrorCode.EIO),void 0===c&&(c=null),function(d){d.preventDefault(),a(new h.ApiError(b,c))}}var f=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,
new c)},g=a("../generic/key_value_filesystem"),h=a("../core/api_error"),i=a("../core/global"),j=a("../core/util"),k=i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,l=function(){function a(a,b){this.tx=a,this.store=b}return a.prototype.get=function(a,b){try{var c=this.store.get(a);c.onerror=e(b),c.onsuccess=function(a){var c=a.target.result;void 0===c?b(null,c):b(null,j.arrayBuffer2Buffer(c))}}catch(f){b(d(f))}},a}();c.IndexedDBROTransaction=l;var m=function(a){function b(b,c){a.call(this,b,c)}return f(b,a),b.prototype.put=function(a,b,c,f){try{var g,h=j.buffer2ArrayBuffer(b);g=c?this.store.put(h,a):this.store.add(h,a),g.onerror=e(f),g.onsuccess=function(a){f(null,!0)}}catch(i){f(d(i))}},b.prototype.del=function(a,b){try{var c=this.store["delete"](a);c.onerror=e(b),c.onsuccess=function(a){b()}}catch(f){b(d(f))}},b.prototype.commit=function(a){setTimeout(a,0)},b.prototype.abort=function(a){var b;try{this.tx.abort()}catch(c){b=d(c)}finally{a(b)}},b}(l);c.IndexedDBRWTransaction=m;var n=function(){function a(a,b){var c=this;void 0===b&&(b="browserfs"),this.storeName=b;var d=k.open(this.storeName,1);d.onupgradeneeded=function(a){var b=a.target.result;b.objectStoreNames.contains(c.storeName)&&b.deleteObjectStore(c.storeName),b.createObjectStore(c.storeName)},d.onsuccess=function(b){c.db=b.target.result,a(null,c)},d.onerror=e(a,h.ErrorCode.EACCES)}return a.prototype.name=function(){return"IndexedDB - "+this.storeName},a.prototype.clear=function(a){try{var b=this.db.transaction(this.storeName,"readwrite"),c=b.objectStore(this.storeName),f=c.clear();f.onsuccess=function(b){setTimeout(a,0)},f.onerror=e(a)}catch(g){a(d(g))}},a.prototype.beginTransaction=function(a){void 0===a&&(a="readonly");var b=this.db.transaction(this.storeName,a),c=b.objectStore(this.storeName);if("readwrite"===a)return new m(b,c);if("readonly"===a)return new l(b,c);throw new h.ApiError(h.ErrorCode.EINVAL,"Invalid transaction type.")},a}();c.IndexedDBStore=n;var o=function(a){function b(b,c){var d=this;a.call(this),new n(function(a,c){a?b(a):d.init(c,function(a){b(a,d)})},c)}return f(b,a),b.isAvailable=function(){try{return"undefined"!=typeof k&&null!==k.open("__browserfs_test__")}catch(a){return!1}},b}(g.AsyncKeyValueFileSystem);c.__esModule=!0,c["default"]=o},{"../core/api_error":49,"../core/global":55,"../core/util":58,"../generic/key_value_filesystem":62}],41:[function(a,b,c){(function(b){var d,e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},f=a("../generic/key_value_filesystem"),g=a("../core/api_error"),h=a("../core/global"),i=!1;try{h.localStorage.setItem("__test__",String.fromCharCode(55296)),i=h.localStorage.getItem("__test__")===String.fromCharCode(55296)}catch(j){i=!1}d=i?"binary_string":"binary_string_ie",b.isEncoding(d)||(d="base64");var k=function(){function a(){}return a.prototype.name=function(){return"LocalStorage"},a.prototype.clear=function(){h.localStorage.clear()},a.prototype.beginTransaction=function(a){return new f.SimpleSyncRWTransaction(this)},a.prototype.get=function(a){try{var c=h.localStorage.getItem(a);if(null!==c)return new b(c,d)}catch(e){}return void 0},a.prototype.put=function(a,b,c){try{return c||null===h.localStorage.getItem(a)?(h.localStorage.setItem(a,b.toString(d)),!0):!1}catch(e){throw new g.ApiError(g.ErrorCode.ENOSPC,"LocalStorage is full.")}},a.prototype.del=function(a){try{h.localStorage.removeItem(a)}catch(b){throw new g.ApiError(g.ErrorCode.EIO,"Unable to delete key "+a+": "+b)}},a}();c.LocalStorageStore=k;var l=function(a){function b(){a.call(this,{store:new k})}return e(b,a),b.isAvailable=function(){return"undefined"!=typeof h.localStorage},b}(f.SyncKeyValueFileSystem);c.__esModule=!0,c["default"]=l}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/global":55,"../generic/key_value_filesystem":62,"bfs-buffer":2}],42:[function(a,b,c){function d(a,b,c){return b?function(){for(var b=[],c=0;c<arguments.length;c++)b[c-0]=arguments[c];var d=this,e=b[0],f=d._getFs(e);b[0]=f.path;try{return f.fs[a].apply(f.fs,b)}catch(g){throw d.standardizeError(g,f.path,e),g}}:function(){for(var b=[],c=0;c<arguments.length;c++)b[c-0]=arguments[c];var d=this,e=b[0],f=d._getFs(e);if(b[0]=f.path,"function"==typeof b[b.length-1]){var g=b[b.length-1];b[b.length-1]=function(){for(var a=[],b=0;b<arguments.length;b++)a[b-0]=arguments[b];a.length>0&&a[0]instanceof h.ApiError&&d.standardizeError(a[0],f.path,e),g.apply(null,a)}}return f.fs[a].apply(f.fs,b)}}var e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},f=a("../core/file_system"),g=a("./InMemory"),h=a("../core/api_error"),i=a("../core/node_fs"),j=a("path"),k=a("../core/util"),l=function(a){function b(){a.call(this),this.mountList=[],this.mntMap={},this.rootFs=new g["default"]}return e(b,a),b.prototype.mount=function(a,b){if("/"!==a[0]&&(a="/"+a),a=j.resolve(a),this.mntMap[a])throw new h.ApiError(h.ErrorCode.EINVAL,"Mount point "+a+" is already taken.");k.mkdirpSync(a,511,this.rootFs),this.mntMap[a]=b,this.mountList.push(a),this.mountList=this.mountList.sort(function(a,b){return b.length-a.length})},b.prototype.umount=function(a){if("/"!==a[0]&&(a="/"+a),a=j.resolve(a),!this.mntMap[a])throw new h.ApiError(h.ErrorCode.EINVAL,"Mount point "+a+" is already unmounted.");for(delete this.mntMap[a],this.mountList.splice(this.mountList.indexOf(a),1);"/"!==a&&0===this.rootFs.readdirSync(a).length;)this.rootFs.rmdirSync(a),a=j.dirname(a)},b.prototype._getFs=function(a){for(var b=this.mountList,c=b.length,d=0;c>d;d++){var e=b[d];if(e.length<=a.length&&0===a.indexOf(e))return a=a.substr(e.length>1?e.length:0),""===a&&(a="/"),{fs:this.mntMap[e],path:a}}return{fs:this.rootFs,path:a}},b.prototype.getName=function(){return"MountableFileSystem"},b.isAvailable=function(){return!0},b.prototype.diskSpace=function(a,b){b(0,0)},b.prototype.isReadOnly=function(){return!1},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.standardizeError=function(a,b,c){var d;return-1!==(d=a.message.indexOf(b))&&(a.message=a.message.substr(0,d)+c+a.message.substr(d+b.length),a.path=c),a},b.prototype.rename=function(a,b,c){var d=this._getFs(a),e=this._getFs(b);if(d.fs===e.fs){var f=this;return d.fs.rename(d.path,e.path,function(g){g&&f.standardizeError(f.standardizeError(g,d.path,a),e.path,b),c(g)})}return i.readFile(a,function(d,e){return d?c(d):void i.writeFile(b,e,function(b){return b?c(b):void i.unlink(a,c)})})},b.prototype.renameSync=function(a,b){var c=this._getFs(a),d=this._getFs(b);if(c.fs===d.fs)try{return c.fs.renameSync(c.path,d.path)}catch(e){throw this.standardizeError(this.standardizeError(e,c.path,a),d.path,b),e}var f=i.readFileSync(a);return i.writeFileSync(b,f),i.unlinkSync(a)},b.prototype.readdirSync=function(a){var b=this._getFs(a),c=null;if(b.fs!==this.rootFs)try{c=this.rootFs.readdirSync(a)}catch(d){}try{var e=b.fs.readdirSync(b.path);return null===c?e:e.concat(c.filter(function(a){return-1===e.indexOf(a)}))}catch(d){if(null===c)throw this.standardizeError(d,b.path,a);return c}},b.prototype.readdir=function(a,b){var c=this,d=this._getFs(a);d.fs.readdir(d.path,function(e,f){if(d.fs!==c.rootFs)try{var g=c.rootFs.readdirSync(a);f=f?f.concat(g.filter(function(a){return-1===f.indexOf(a)})):g}catch(h){if(e)return b(c.standardizeError(e,d.path,a))}else if(e)return b(c.standardizeError(e,d.path,a));b(null,f)})},b.prototype.rmdirSync=function(a){var b=this._getFs(a);if(this._containsMountPt(a))throw h.ApiError.ENOTEMPTY(a);try{b.fs.rmdirSync(b.path)}catch(c){throw this.standardizeError(c,b.path,a)}},b.prototype._containsMountPt=function(a){for(var b=this.mountList,c=b.length,d=0;c>d;d++){var e=b[d];if(e.length>=a.length&&e.slice(0,a.length)===a)return!0}return!1},b.prototype.rmdir=function(a,b){var c=this,d=this._getFs(a);this._containsMountPt(a)?b(h.ApiError.ENOTEMPTY(a)):d.fs.rmdir(d.path,function(e){b(e?c.standardizeError(e,d.path,a):null)})},b}(f.BaseFileSystem);c.__esModule=!0,c["default"]=l;for(var m=[["exists","unlink","readlink"],["stat","mkdir","realpath","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],n=0;n<m.length;n++)for(var o=m[n],p=0;p<o.length;p++){var q=o[p];l.prototype[q]=d(q,!1,n+1),l.prototype[q+"Sync"]=d(q+"Sync",!0,n+1)}},{"../core/api_error":49,"../core/file_system":54,"../core/node_fs":56,"../core/util":58,"./InMemory":39,path:10}],43:[function(a,b,c){(function(b){function d(a){return 146|a}var e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},f=a("../core/file_system"),g=a("../core/api_error"),h=a("../core/file_flag"),i=a("../generic/preload_file"),j=a("path"),k="/.deletedFiles.log",l=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return e(b,a),b.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},b.prototype.closeSync=function(){this.syncSync()},b}(i.PreloadFile),m=function(a){function c(b,c){if(a.call(this),this._isInitialized=!1,this._deletedFiles={},this._deleteLog=null,this._writable=b,this._readable=c,this._writable.isReadOnly())throw new g.ApiError(g.ErrorCode.EINVAL,"Writable file system must be writable.");if(!this._writable.supportsSynch()||!this._readable.supportsSynch())throw new g.ApiError(g.ErrorCode.EINVAL,"OverlayFS currently only operates on synchronous file systems.")}return e(c,a),c.prototype.getOverlayedFileSystems=function(){return{readable:this._readable,writable:this._writable}},c.prototype.createParentDirectories=function(a){for(var b=this,c=j.dirname(a),d=[];!this._writable.existsSync(c);)d.push(c),c=j.dirname(c);d=d.reverse(),d.forEach(function(a){b._writable.mkdirSync(a,b.statSync(a,!1).mode)})},c.isAvailable=function(){return!0},c.prototype._syncSync=function(a){this.createParentDirectories(a.getPath()),this._writable.writeFileSync(a.getPath(),a.getBuffer(),null,h.FileFlag.getFileFlag("w"),a.getStats().mode)},c.prototype.getName=function(){return"OverlayFS"},c.prototype.initialize=function(a){var b=this;this._isInitialized?a():this._writable.readFile(k,"utf8",h.FileFlag.getFileFlag("r"),function(c,d){if(c){if(c.errno!==g.ErrorCode.ENOENT)return a(c)}else d.split("\n").forEach(function(a){b._deletedFiles[a.slice(1)]="d"===a.slice(0,1)});b._writable.open(k,h.FileFlag.getFileFlag("a"),420,function(c,d){c?a(c):(b._deleteLog=d,a())})})},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSynch=function(){return!0},c.prototype.supportsLinks=function(){return!1},c.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},c.prototype.deletePath=function(a){this._deletedFiles[a]=!0;var c=new b("d"+a+"\n");this._deleteLog.writeSync(c,0,c.length,null),this._deleteLog.syncSync()},c.prototype.undeletePath=function(a){if(this._deletedFiles[a]){this._deletedFiles[a]=!1;var c=new b("u"+a);this._deleteLog.writeSync(c,0,c.length,null),this._deleteLog.syncSync()}},c.prototype.renameSync=function(a,b){var c=this,d=this.statSync(a,!1);if(d.isDirectory()){if(a===b)return;var e=511;if(this.existsSync(b)){var f=this.statSync(b,!1),e=f.mode;if(!f.isDirectory())throw g.ApiError.ENOTDIR(b);if(this.readdirSync(b).length>0)throw g.ApiError.ENOTEMPTY(b)}this._writable.existsSync(a)?this._writable.renameSync(a,b):this._writable.existsSync(b)||this._writable.mkdirSync(b,e),this._readable.existsSync(a)&&this._readable.readdirSync(a).forEach(function(d){c.renameSync(j.resolve(a,d),j.resolve(b,d))})}else{if(this.existsSync(b)&&this.statSync(b,!1).isDirectory())throw g.ApiError.EISDIR(b);this.writeFileSync(b,this.readFileSync(a,null,h.FileFlag.getFileFlag("r")),null,h.FileFlag.getFileFlag("w"),d.mode)}a!==b&&this.existsSync(a)&&this.unlinkSync(a)},c.prototype.statSync=function(a,b){try{return this._writable.statSync(a,b)}catch(c){if(this._deletedFiles[a])throw g.ApiError.ENOENT(a);var e=this._readable.statSync(a,b).clone();return e.mode=d(e.mode),e}},c.prototype.openSync=function(a,b,c){if(this.existsSync(a))switch(b.pathExistsAction()){case h.ActionType.TRUNCATE_FILE:return this.createParentDirectories(a),this._writable.openSync(a,b,c);case h.ActionType.NOP:if(this._writable.existsSync(a))return this._writable.openSync(a,b,c);var d=this._readable.statSync(a,!1).clone();return d.mode=c,new l(this,a,b,d,this._readable.readFileSync(a,null,h.FileFlag.getFileFlag("r")));default:throw g.ApiError.EEXIST(a)}else switch(b.pathNotExistsAction()){case h.ActionType.CREATE_FILE:return this.createParentDirectories(a),this._writable.openSync(a,b,c);default:throw g.ApiError.ENOENT(a)}},c.prototype.unlinkSync=function(a){if(!this.existsSync(a))throw g.ApiError.ENOENT(a);this._writable.existsSync(a)&&this._writable.unlinkSync(a),this.existsSync(a)&&this.deletePath(a)},c.prototype.rmdirSync=function(a){if(!this.existsSync(a))throw g.ApiError.ENOENT(a);if(this._writable.existsSync(a)&&this._writable.rmdirSync(a),this.existsSync(a)){if(this.readdirSync(a).length>0)throw g.ApiError.ENOTEMPTY(a);this.deletePath(a)}},c.prototype.mkdirSync=function(a,b){if(this.existsSync(a))throw g.ApiError.EEXIST(a);this.createParentDirectories(a),this._writable.mkdirSync(a,b)},c.prototype.readdirSync=function(a){var b=this,c=this.statSync(a,!1);if(!c.isDirectory())throw g.ApiError.ENOTDIR(a);var d=[];try{d=d.concat(this._writable.readdirSync(a))}catch(e){}try{d=d.concat(this._readable.readdirSync(a))}catch(e){}var f={};return d.filter(function(c){var d=void 0===f[c]&&b._deletedFiles[a+"/"+c]!==!0;return f[c]=!0,d})},c.prototype.existsSync=function(a){return this._writable.existsSync(a)||this._readable.existsSync(a)&&this._deletedFiles[a]!==!0},c.prototype.chmodSync=function(a,b,c){var d=this;this.operateOnWritable(a,function(){d._writable.chmodSync(a,b,c)})},c.prototype.chownSync=function(a,b,c,d){var e=this;this.operateOnWritable(a,function(){e._writable.chownSync(a,b,c,d)})},c.prototype.utimesSync=function(a,b,c){var d=this;this.operateOnWritable(a,function(){d._writable.utimesSync(a,b,c)})},c.prototype.operateOnWritable=function(a,b){if(!this.existsSync(a))throw g.ApiError.ENOENT(a);this._writable.existsSync(a)||this.copyToWritable(a),b()},c.prototype.copyToWritable=function(a){var b=this.statSync(a,!1);b.isDirectory()?this._writable.mkdirSync(a,b.mode):this.writeFileSync(a,this._readable.readFileSync(a,null,h.FileFlag.getFileFlag("r")),null,h.FileFlag.getFileFlag("w"),this.statSync(a,!1).mode)},c}(f.SynchronousFileSystem);c.__esModule=!0,c["default"]=m}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/file_flag":53,"../core/file_system":54,"../generic/preload_file":63,"bfs-buffer":2,path:10}],44:[function(a,b,c){(function(b){function d(a){return{type:r.API_ERROR,errorData:l(a.writeToBuffer())}}function e(a){return u.ApiError.fromBuffer(m(a.errorData))}function f(a){return{type:r.ERROR,name:a.name,message:a.message,stack:a.stack}}function g(a){var b=A[a.name];"function"!=typeof b&&(b=Error);var c=new b(a.message);return c.stack=a.stack,c}function h(a){return{type:r.STATS,statsData:l(a.toBuffer())}}function i(a){return y["default"].fromBuffer(m(a.statsData))}function j(a){return{type:r.FILEFLAG,flagStr:a.getFlagString()}}function k(a){return v.FileFlag.getFileFlag(a.flagStr)}function l(a){return w.buffer2ArrayBuffer(a)}function m(a){return w.arrayBuffer2Buffer(a)}function n(a){return{type:r.BUFFER,data:l(a)}}function o(a){return m(a.data)}function p(a){return null!=a&&"object"==typeof a&&a.hasOwnProperty("browserfsMessage")&&a.browserfsMessage}function q(a){return null!=a&&"object"==typeof a&&a.hasOwnProperty("browserfsMessage")&&a.browserfsMessage}var r,s=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},t=a("../core/file_system"),u=a("../core/api_error"),v=a("../core/file_flag"),w=a("../core/util"),x=a("../core/file"),y=a("../core/node_fs_stats"),z=a("../generic/preload_file"),A=a("../core/global"),B=a("../core/node_fs");!function(a){a[a.CB=0]="CB",a[a.FD=1]="FD",a[a.API_ERROR=2]="API_ERROR",a[a.STATS=3]="STATS",a[a.PROBE=4]="PROBE",a[a.FILEFLAG=5]="FILEFLAG",a[a.BUFFER=6]="BUFFER",a[a.ERROR=7]="ERROR"}(r||(r={}));var C=function(){function a(){this._callbacks={},this._nextId=0}return a.prototype.toRemoteArg=function(a){var b=this._nextId++;return this._callbacks[b]=a,{type:r.CB,id:b}},a.prototype.toLocalArg=function(a){var b=this._callbacks[a];return delete this._callbacks[a],b},a}(),D=function(){function a(){this._fileDescriptors={},this._nextId=0}return a.prototype.toRemoteArg=function(a,c,d,e){var f,g,h=this._nextId++;this._fileDescriptors[h]=a,a.stat(function(i,j){i?e(i):(g=l(j.toBuffer()),d.isReadable()?a.read(new b(j.size),0,j.size,0,function(a,b,i){a?e(a):(f=l(i),e(null,{type:r.FD,id:h,data:f,stat:g,path:c,flag:d.getFlagString()}))}):e(null,{type:r.FD,id:h,data:new ArrayBuffer(0),stat:g,path:c,flag:d.getFlagString()}))})},a.prototype._applyFdChanges=function(a,b){var c=this._fileDescriptors[a.id],d=m(a.data),e=y["default"].fromBuffer(m(a.stat)),f=v.FileFlag.getFileFlag(a.flag);f.isWriteable()?c.write(d,0,d.length,f.isAppendable()?c.getPos():0,function(a){function g(){c.stat(function(a,d){a?b(a):d.mode!==e.mode?c.chmod(e.mode,function(a){b(a,c)}):b(a,c)})}a?b(a):f.isAppendable()?g():c.truncate(d.length,function(){g()})}):b(null,c)},a.prototype.applyFdAPIRequest=function(a,b){var c=this,d=a.args[0];this._applyFdChanges(d,function(e,f){e?b(e):f[a.method](function(e){"close"===a.method&&delete c._fileDescriptors[d.id],b(e)})})},a}(),E=function(a){function b(b,c,d,e,f,g){a.call(this,b,c,d,e,g),this._remoteFdId=f}return s(b,a),b.prototype.getRemoteFdId=function(){return this._remoteFdId},b.prototype.toRemoteArg=function(){return{type:r.FD,id:this._remoteFdId,data:l(this.getBuffer()),stat:l(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},b.prototype._syncClose=function(a,b){var c=this;this.isDirty()?this._fs.syncClose(a,this,function(a){a||c.resetDirty(),b(a)}):b()},b.prototype.sync=function(a){this._syncClose("sync",a)},b.prototype.close=function(a){this._syncClose("close",a)},b}(z.PreloadFile),F=function(a){function c(b){var c=this;a.call(this),this._callbackConverter=new C,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._outstandingRequests={},this._worker=b,this._worker.addEventListener("message",function(a){var b=a.data;if(q(b)){var d,e=b.args,f=new Array(e.length);for(d=0;d<f.length;d++)f[d]=c._argRemote2Local(e[d]);c._callbackConverter.toLocalArg(b.cbId).apply(null,f)}})}return s(c,a),c.isAvailable=function(){return"undefined"!=typeof Worker},c.prototype.getName=function(){return"WorkerFS"},c.prototype._argRemote2Local=function(a){if(null==a)return a;switch(typeof a){case"object":if(null==a.type||"number"!=typeof a.type)return a;var b=a;switch(b.type){case r.API_ERROR:return e(b);case r.FD:var c=b;return new E(this,c.path,v.FileFlag.getFileFlag(c.flag),y["default"].fromBuffer(m(c.stat)),c.id,m(c.data));case r.STATS:return i(b);case r.FILEFLAG:return k(b);case r.BUFFER:return o(b);case r.ERROR:return g(b);default:return a}default:return a}},c.prototype._argLocal2Remote=function(a){if(null==a)return a;switch(typeof a){case"object":return a instanceof y["default"]?h(a):a instanceof u.ApiError?d(a):a instanceof E?a.toRemoteArg():a instanceof v.FileFlag?j(a):a instanceof b?n(a):a instanceof Error?f(a):"Unknown argument";case"function":return this._callbackConverter.toRemoteArg(a);default:return a}},c.prototype.initialize=function(a){var c=this;if(this._isInitialized)a();else{var d={browserfsMessage:!0,method:"probe",args:[this._argLocal2Remote(new b(0)),this._callbackConverter.toRemoteArg(function(b){c._isInitialized=!0,c._isReadOnly=b.isReadOnly,c._supportLinks=b.supportsLinks,c._supportProps=b.supportsProps,a()})]};this._worker.postMessage(d)}},c.prototype.isReadOnly=function(){return this._isReadOnly},c.prototype.supportsSynch=function(){return!1},c.prototype.supportsLinks=function(){return this._supportLinks},c.prototype.supportsProps=function(){return this._supportProps},c.prototype._rpc=function(a,b){var c,d={browserfsMessage:!0,method:a,args:null},e=new Array(b.length);for(c=0;c<b.length;c++)e[c]=this._argLocal2Remote(b[c]);d.args=e,this._worker.postMessage(d)},c.prototype.rename=function(a,b,c){this._rpc("rename",arguments)},c.prototype.stat=function(a,b,c){this._rpc("stat",arguments)},c.prototype.open=function(a,b,c,d){this._rpc("open",arguments)},c.prototype.unlink=function(a,b){this._rpc("unlink",arguments)},c.prototype.rmdir=function(a,b){this._rpc("rmdir",arguments)},c.prototype.mkdir=function(a,b,c){this._rpc("mkdir",arguments)},c.prototype.readdir=function(a,b){this._rpc("readdir",arguments)},c.prototype.exists=function(a,b){this._rpc("exists",arguments)},c.prototype.realpath=function(a,b,c){this._rpc("realpath",arguments)},c.prototype.truncate=function(a,b,c){this._rpc("truncate",arguments)},c.prototype.readFile=function(a,b,c,d){this._rpc("readFile",arguments)},c.prototype.writeFile=function(a,b,c,d,e,f){this._rpc("writeFile",arguments)},c.prototype.appendFile=function(a,b,c,d,e,f){this._rpc("appendFile",arguments)},c.prototype.chmod=function(a,b,c,d){this._rpc("chmod",arguments)},c.prototype.chown=function(a,b,c,d,e){this._rpc("chown",arguments)},c.prototype.utimes=function(a,b,c,d){this._rpc("utimes",arguments)},c.prototype.link=function(a,b,c){this._rpc("link",arguments)},c.prototype.symlink=function(a,b,c,d){this._rpc("symlink",arguments)},c.prototype.readlink=function(a,b){this._rpc("readlink",arguments)},c.prototype.syncClose=function(a,b,c){this._worker.postMessage({browserfsMessage:!0,method:a,args:[b.toRemoteArg(),this._callbackConverter.toRemoteArg(c)]})},c.attachRemoteListener=function(a){function c(a,c,e){switch(typeof a){case"object":a instanceof y["default"]?e(null,h(a)):a instanceof u.ApiError?e(null,d(a)):a instanceof x.BaseFile?e(null,m.toRemoteArg(a,c[0],c[1],e)):a instanceof v.FileFlag?e(null,j(a)):a instanceof b?e(null,n(a)):a instanceof Error?e(null,f(a)):e(null,a);break;default:e(null,a)}}function l(b,f){if(null==b)return b;switch(typeof b){case"object":if("number"!=typeof b.type)return b;var h=b;switch(h.type){case r.CB:var j=b.id;return function(){function b(b){i>0&&(i=-1,g={browserfsMessage:!0,cbId:j,args:[d(b)]},a.postMessage(g))}var e,g,h=new Array(arguments.length),i=arguments.length;for(e=0;e<arguments.length;e++)!function(d,e){c(e,f,function(c,e){h[d]=e,c?b(c):0===--i&&(g={browserfsMessage:!0,cbId:j,args:h},a.postMessage(g))})}(e,arguments[e]);0===arguments.length&&(g={browserfsMessage:!0,cbId:j,args:h},a.postMessage(g))};case r.API_ERROR:return e(h);case r.STATS:return i(h);case r.FILEFLAG:return k(h);case r.BUFFER:return o(h);case r.ERROR:return g(h);default:return b}default:return b}}var m=new D;a.addEventListener("message",function(b){var c=b.data;if(p(c)){var e,f=c.args,g=new Array(f.length);switch(c.method){case"close":case"sync":!function(){var b=f[1];m.applyFdAPIRequest(c,function(c){var e={browserfsMessage:!0,cbId:b.id,args:c?[d(c)]:[]};a.postMessage(e)})}();break;case"probe":!function(){var b=B.getRootFS(),c=f[1],d={type:r.PROBE,isReadOnly:b.isReadOnly(),supportsLinks:b.supportsLinks(),supportsProps:b.supportsProps()},e={browserfsMessage:!0,cbId:c.id,args:[d]};a.postMessage(e)}();break;default:for(e=0;e<f.length;e++)g[e]=l(f[e],g);var h=B.getRootFS();h[c.method].apply(h,g)}}})},c}(t.BaseFileSystem);c.__esModule=!0,c["default"]=F}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/file":52,"../core/file_flag":53,"../core/file_system":54,"../core/global":55,"../core/node_fs":56,"../core/node_fs_stats":57,"../core/util":58,"../generic/preload_file":63,"bfs-buffer":2}],45:[function(a,b,c){function d(a,b,c){try{c(null,a.toString(b))}catch(d){c(d)}}var e=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},f=a("../core/file_system"),g=a("../core/api_error"),h=a("../core/file_flag"),i=a("../core/util"),j=a("../generic/preload_file"),k=a("../generic/xhr"),l=a("../generic/file_index"),m=function(a){function b(b,c){void 0===c&&(c=""),a.call(this),null==b&&(b="index.json"),c.length>0&&"/"!==c.charAt(c.length-1)&&(c+="/"),this.prefixUrl=c;var d=this._requestFileSync(b,"json");if(null==d)throw new Error("Unable to find listing at URL: "+b);this._index=l.FileIndex.fromListing(d)}return e(b,a),b.prototype.empty=function(){this._index.fileIterator(function(a){a.file_data=null})},b.prototype.getXhrPath=function(a){return"/"===a.charAt(0)&&(a=a.slice(1)),this.prefixUrl+a},b.prototype._requestFileSizeAsync=function(a,b){k.getFileSizeAsync(this.getXhrPath(a),b)},b.prototype._requestFileSizeSync=function(a){return k.getFileSizeSync(this.getXhrPath(a))},b.prototype._requestFileAsync=function(a,b,c){k.asyncDownloadFile(this.getXhrPath(a),b,c)},b.prototype._requestFileSync=function(a,b){return k.syncDownloadFile(this.getXhrPath(a),b)},b.prototype.getName=function(){return"XmlHttpRequest"},b.isAvailable=function(){return"undefined"!=typeof XMLHttpRequest&&null!==XMLHttpRequest},b.prototype.diskSpace=function(a,b){b(0,0)},b.prototype.isReadOnly=function(){return!0},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.preloadFile=function(a,b){var c=this._index.getInode(a);if(!l.isFileInode(c))throw g.ApiError.EISDIR(a);if(null===c)throw g.ApiError.ENOENT(a);var d=c.getData();d.size=b.length,d.file_data=b},b.prototype.stat=function(a,b,c){var d=this._index.getInode(a);if(null===d)return c(g.ApiError.ENOENT(a));var e;l.isFileInode(d)?(e=d.getData(),e.size<0?this._requestFileSizeAsync(a,function(a,b){return a?c(a):(e.size=b,void c(null,e.clone()))}):c(null,e.clone())):l.isDirInode(d)?(e=d.getStats(),c(null,e)):c(g.ApiError.FileError(g.ErrorCode.EINVAL,a))},b.prototype.statSync=function(a,b){var c=this._index.getInode(a);if(null===c)throw g.ApiError.ENOENT(a);var d;if(l.isFileInode(c))d=c.getData(),d.size<0&&(d.size=this._requestFileSizeSync(a));else{if(!l.isDirInode(c))throw g.ApiError.FileError(g.ErrorCode.EINVAL,a);d=c.getStats()}return d},b.prototype.open=function(a,b,c,d){if(b.isWriteable())return d(new g.ApiError(g.ErrorCode.EPERM,a));var e=this,f=this._index.getInode(a);if(null===f)return d(g.ApiError.ENOENT(a));if(!l.isFileInode(f))return d(g.ApiError.EISDIR(a));var i=f.getData();switch(b.pathExistsAction()){case h.ActionType.THROW_EXCEPTION:case h.ActionType.TRUNCATE_FILE:return d(g.ApiError.EEXIST(a));case h.ActionType.NOP:if(null!=i.file_data)return d(null,new j.NoSyncFile(e,a,b,i.clone(),i.file_data));this._requestFileAsync(a,"buffer",function(c,f){return c?d(c):(i.size=f.length,i.file_data=f,d(null,new j.NoSyncFile(e,a,b,i.clone(),f)))});break;default:return d(new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object."))}},b.prototype.openSync=function(a,b,c){if(b.isWriteable())throw new g.ApiError(g.ErrorCode.EPERM,a);var d=this._index.getInode(a);if(null===d)throw g.ApiError.ENOENT(a);if(!l.isFileInode(d))throw g.ApiError.EISDIR(a);var e=d.getData();switch(b.pathExistsAction()){case h.ActionType.THROW_EXCEPTION:case h.ActionType.TRUNCATE_FILE:throw g.ApiError.EEXIST(a);case h.ActionType.NOP:if(null!=e.file_data)return new j.NoSyncFile(this,a,b,e.clone(),e.file_data);var f=this._requestFileSync(a,"buffer");return e.size=f.length,e.file_data=f,new j.NoSyncFile(this,a,b,e.clone(),f);default:throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object.")}},b.prototype.readdir=function(a,b){try{b(null,this.readdirSync(a))}catch(c){b(c)}},b.prototype.readdirSync=function(a){var b=this._index.getInode(a);if(null===b)throw g.ApiError.ENOENT(a);if(l.isDirInode(b))return b.getListing();throw g.ApiError.ENOTDIR(a)},b.prototype.readFile=function(a,b,c,e){var f=e;this.open(a,c,420,function(a,c){if(a)return e(a);e=function(a,b){c.close(function(c){return null==a&&(a=c),f(a,b)})};var g=c,h=g.getBuffer();null===b?e(a,i.copyingSlice(h)):d(h,b,e)})},b.prototype.readFileSync=function(a,b,c){var d=this.openSync(a,c,420);try{var e=d,f=e.getBuffer();return null===b?i.copyingSlice(f):f.toString(b)}finally{d.closeSync()}},b}(f.BaseFileSystem);c.__esModule=!0,c["default"]=m},{"../core/api_error":49,"../core/file_flag":53,"../core/file_system":54,"../core/util":58,"../generic/file_index":60,"../generic/preload_file":63,"../generic/xhr":64}],46:[function(a,b,c){function d(a,b){var c=31&b,d=(b>>5&15)-1,e=(b>>9)+1980,f=31&a,g=a>>5&63,h=a>>11;return new Date(e,d,c,h,g,f)}function e(a,b,c,d){return 0===d?"":b?a.toString("utf8",c,c+d):m["default"].byte2str(a.slice(c,c+d))}var f=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},g=a("../core/api_error"),h=a("../core/node_fs_stats"),i=a("../core/file_system"),j=a("../core/file_flag"),k=a("../generic/preload_file"),l=a("../core/util"),m=a("bfs-buffer/js/extended_ascii"),n=a("pako/dist/pako_inflate.min").inflateRaw,o=a("../generic/file_index");!function(a){a[a.MSDOS=0]="MSDOS",a[a.AMIGA=1]="AMIGA",a[a.OPENVMS=2]="OPENVMS",a[a.UNIX=3]="UNIX",a[a.VM_CMS=4]="VM_CMS",a[a.ATARI_ST=5]="ATARI_ST",a[a.OS2_HPFS=6]="OS2_HPFS",a[a.MAC=7]="MAC",a[a.Z_SYSTEM=8]="Z_SYSTEM",a[a.CP_M=9]="CP_M",a[a.NTFS=10]="NTFS",a[a.MVS=11]="MVS",a[a.VSE=12]="VSE",a[a.ACORN_RISC=13]="ACORN_RISC",a[a.VFAT=14]="VFAT",a[a.ALT_MVS=15]="ALT_MVS",a[a.BEOS=16]="BEOS",a[a.TANDEM=17]="TANDEM",a[a.OS_400=18]="OS_400",a[a.OSX=19]="OSX"}(c.ExternalFileAttributeType||(c.ExternalFileAttributeType={}));c.ExternalFileAttributeType;!function(a){a[a.STORED=0]="STORED",a[a.SHRUNK=1]="SHRUNK",a[a.REDUCED_1=2]="REDUCED_1",a[a.REDUCED_2=3]="REDUCED_2",a[a.REDUCED_3=4]="REDUCED_3",a[a.REDUCED_4=5]="REDUCED_4",a[a.IMPLODE=6]="IMPLODE",a[a.DEFLATE=8]="DEFLATE",a[a.DEFLATE64=9]="DEFLATE64",a[a.TERSE_OLD=10]="TERSE_OLD",a[a.BZIP2=12]="BZIP2",a[a.LZMA=14]="LZMA",a[a.TERSE_NEW=18]="TERSE_NEW",a[a.LZ77=19]="LZ77",a[a.WAVPACK=97]="WAVPACK",a[a.PPMD=98]="PPMD"}(c.CompressionMethod||(c.CompressionMethod={}));var p=c.CompressionMethod,q=function(){function a(a){if(this.data=a,67324752!==a.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))}return a.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},a.prototype.flags=function(){return this.data.readUInt16LE(6)},a.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},a.prototype.lastModFileTime=function(){return d(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},a.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},a.prototype.crc32=function(){return this.data.readUInt32LE(14)},a.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},a.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},a.prototype.fileName=function(){return e(this.data,this.useUTF8(),30,this.fileNameLength())},a.prototype.extraField=function(){var a=30+this.fileNameLength();return this.data.slice(a,a+this.extraFieldLength())},a.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},a.prototype.useUTF8=function(){return 2048===(2048&this.flags())},a}();c.FileHeader=q;var r=function(){function a(a,b,c){this.header=a,this.record=b,this.data=c}return a.prototype.decompress=function(){var a=this.header.compressionMethod();switch(a){case p.DEFLATE:var b=n(l.buffer2Arrayish(this.data.slice(0,this.record.compressedSize())),{
chunkSize:this.record.uncompressedSize()});return l.arrayish2Buffer(b);case p.STORED:return l.copyingSlice(this.data,0,this.record.uncompressedSize());default:var c=p[a];throw c=c?c:"Unknown: "+a,new g.ApiError(g.ErrorCode.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+c)}},a.prototype.getHeader=function(){return this.header},a.prototype.getRecord=function(){return this.record},a.prototype.getRawData=function(){return this.data},a}();c.FileData=r;var s=function(){function a(a){this.data=a}return a.prototype.crc32=function(){return this.data.readUInt32LE(0)},a.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},a.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)},a}();c.DataDescriptor=s;var t=function(){function a(a){if(this.data=a,134630224!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))}return a.prototype.length=function(){return this.data.readUInt32LE(4)},a.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())},a}();c.ArchiveExtraDataRecord=t;var u=function(){function a(a){if(this.data=a,84233040!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))}return a.prototype.size=function(){return this.data.readUInt16LE(4)},a.prototype.signatureData=function(){return this.data.slice(6,6+this.size())},a}();c.DigitalSignature=u;var v=function(){function a(a,b){if(this.zipData=a,this.data=b,33639248!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()}return a.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},a.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},a.prototype.flag=function(){return this.data.readUInt16LE(8)},a.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},a.prototype.lastModFileTime=function(){return d(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},a.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},a.prototype.crc32=function(){return this.data.readUInt32LE(16)},a.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},a.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},a.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},a.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},a.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},a.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},a.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},a.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},a.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},a.prototype.produceFilename=function(){var a=e(this.data,this.useUTF8(),46,this.fileNameLength());return a.replace(/\\/g,"/")},a.prototype.fileName=function(){return this._filename},a.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},a.prototype.extraField=function(){var a=44+this.fileNameLength();return this.data.slice(a,a+this.extraFieldLength())},a.prototype.fileComment=function(){var a=46+this.fileNameLength()+this.extraFieldLength();return e(this.data,this.useUTF8(),a,this.fileCommentLength())},a.prototype.rawFileComment=function(){var a=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(a,a+this.fileCommentLength())},a.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},a.prototype.isDirectory=function(){var a=this.fileName();return(16&this.externalAttributes()?!0:!1)||"/"===a.charAt(a.length-1)},a.prototype.isFile=function(){return!this.isDirectory()},a.prototype.useUTF8=function(){return 2048===(2048&this.flag())},a.prototype.isEncrypted=function(){return 1===(1&this.flag())},a.prototype.getFileData=function(){var a=this.headerRelativeOffset(),b=new q(this.zipData.slice(a));return new r(b,this,this.zipData.slice(a+b.totalSize()))},a.prototype.getData=function(){return this.getFileData().decompress()},a.prototype.getRawData=function(){return this.getFileData().getRawData()},a.prototype.getStats=function(){return new h["default"](h.FileType.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())},a}();c.CentralDirectory=v;var w=function(){function a(a){if(this.data=a,101010256!==this.data.readUInt32LE(0))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))}return a.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},a.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},a.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},a.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},a.prototype.cdSize=function(){return this.data.readUInt32LE(12)},a.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},a.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},a.prototype.cdZipComment=function(){return e(this.data,!0,22,this.cdZipCommentLength())},a.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())},a}();c.EndOfCentralDirectory=w;var x=function(a){function b(b,c){void 0===c&&(c=""),a.call(this),this.data=b,this.name=c,this._index=new o.FileIndex,this._directoryEntries=[],this._eocd=null,this.populateIndex()}return f(b,a),b.prototype.getName=function(){return"ZipFS"+(""!==this.name?" "+this.name:"")},b.prototype.getCentralDirectoryEntry=function(a){var b=this._index.getInode(a);if(null===b)throw g.ApiError.ENOENT(a);return o.isFileInode(b)?b.getData():o.isDirInode(b)?b.getData():void 0},b.prototype.getCentralDirectoryEntryAt=function(a){var b=this._directoryEntries[a];if(!b)throw new RangeError("Invalid directory index: "+a+".");return b},b.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},b.prototype.getEndOfCentralDirectory=function(){return this._eocd},b.isAvailable=function(){return!0},b.prototype.diskSpace=function(a,b){b(this.data.length,0)},b.prototype.isReadOnly=function(){return!0},b.prototype.supportsLinks=function(){return!1},b.prototype.supportsProps=function(){return!1},b.prototype.supportsSynch=function(){return!0},b.prototype.statSync=function(a,b){var c=this._index.getInode(a);if(null===c)throw g.ApiError.ENOENT(a);var d;if(o.isFileInode(c))d=c.getData().getStats();else{if(!o.isDirInode(c))throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid inode.");d=c.getStats()}return d},b.prototype.openSync=function(a,b,c){if(b.isWriteable())throw new g.ApiError(g.ErrorCode.EPERM,a);var d=this._index.getInode(a);if(d){if(o.isFileInode(d)){var e=d.getData(),f=e.getStats();switch(b.pathExistsAction()){case j.ActionType.THROW_EXCEPTION:case j.ActionType.TRUNCATE_FILE:throw g.ApiError.EEXIST(a);case j.ActionType.NOP:return new k.NoSyncFile(this,a,b,f,e.getData());default:throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid FileMode object.")}return null}throw g.ApiError.EISDIR(a)}throw g.ApiError.ENOENT(a)},b.prototype.readdirSync=function(a){var b=this._index.getInode(a);if(b){if(o.isDirInode(b))return b.getListing();throw g.ApiError.ENOTDIR(a)}throw g.ApiError.ENOENT(a)},b.prototype.readFileSync=function(a,b,c){var d=this.openSync(a,c,420);try{var e=d,f=e.getBuffer();return null===b?l.copyingSlice(f):f.toString(b)}finally{d.closeSync()}},b.prototype.getEOCD=function(){for(var a=22,b=Math.min(a+65535,this.data.length-1),c=a;b>c;c++)if(101010256===this.data.readUInt32LE(this.data.length-c))return new w(this.data.slice(this.data.length-c));throw new g.ApiError(g.ErrorCode.EINVAL,"Invalid ZIP file: Could not locate End of Central Directory signature.")},b.prototype.populateIndex=function(){var a=this._eocd=this.getEOCD();if(a.diskNumber()!==a.cdDiskNumber())throw new g.ApiError(g.ErrorCode.EINVAL,"ZipFS does not support spanned zip files.");var b=a.cdOffset();if(4294967295===b)throw new g.ApiError(g.ErrorCode.EINVAL,"ZipFS does not support Zip64.");for(var c=b+a.cdSize();c>b;){var d=new v(this.data,this.data.slice(b));b+=d.totalSize();var e=d.fileName();if("/"===e.charAt(0))throw new Error("WHY IS THIS ABSOLUTE");"/"===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),d.isDirectory()?this._index.addPath("/"+e,new o.DirInode(d)):this._index.addPath("/"+e,new o.FileInode(d)),this._directoryEntries.push(d)}},b}(i.SynchronousFileSystem);c.__esModule=!0,c["default"]=x},{"../core/api_error":49,"../core/file_flag":53,"../core/file_system":54,"../core/node_fs_stats":57,"../core/util":58,"../generic/file_index":60,"../generic/preload_file":63,"bfs-buffer/js/extended_ascii":7,"pako/dist/pako_inflate.min":20}],47:[function(a,b,c){b.exports=a("./main")},{"./main":65}],48:[function(a,b,c){(function(b){function d(a,b){if("function"!=typeof a)throw new j.ApiError(j.ErrorCode.EINVAL,"Callback must be a function.");switch("undefined"==typeof __numWaiting&&(__numWaiting=0),__numWaiting++,b){case 1:return function(b){setImmediate(function(){return __numWaiting--,a(b)})};case 2:return function(b,c){setImmediate(function(){return __numWaiting--,a(b,c)})};case 3:return function(b,c,d){setImmediate(function(){return __numWaiting--,a(b,c,d)})};default:throw new Error("Invalid invocation of wrapCb.")}}function e(a,b){switch(typeof a){case"number":return a;case"string":var c=parseInt(a,8);if(NaN!==c)return c;default:return b}}function f(a){if(a instanceof Date)return a;if("number"==typeof a)return new Date(1e3*a);throw new j.ApiError(j.ErrorCode.EINVAL,"Invalid time.")}function g(a){if(a.indexOf("\x00")>=0)throw new j.ApiError(j.ErrorCode.EINVAL,"Path must be a string without null bytes.");if(""===a)throw new j.ApiError(j.ErrorCode.EINVAL,"Path must not be empty.");return l.resolve(a)}function h(a,b,c,d){switch(typeof a){case"object":return{encoding:"undefined"!=typeof a.encoding?a.encoding:b,flag:"undefined"!=typeof a.flag?a.flag:c,mode:e(a.mode,d)};case"string":return{encoding:a,flag:c,mode:d};default:return{encoding:b,flag:c,mode:d}}}function i(){}var j=a("./api_error"),k=a("./file_flag"),l=a("path"),m=a("./node_fs_stats"),n=function(){function a(){this.root=null,this.fdMap={},this.nextFd=100,this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1}return a.prototype.getFdForFile=function(a){var b=this.nextFd++;return this.fdMap[b]=a,b},a.prototype.fd2file=function(a){var b=this.fdMap[a];if(b)return b;throw new j.ApiError(j.ErrorCode.EBADF,"Invalid file descriptor.")},a.prototype.closeFd=function(a){delete this.fdMap[a]},a.prototype.initialize=function(a){if(!a.constructor.isAvailable())throw new j.ApiError(j.ErrorCode.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=a},a.prototype._toUnixTimestamp=function(a){if("number"==typeof a)return a;if(a instanceof Date)return a.getTime()/1e3;throw new Error("Cannot parse time: "+a)},a.prototype.getRootFS=function(){return this.root?this.root:null},a.prototype.rename=function(a,b,c){void 0===c&&(c=i);var e=d(c,1);try{this.root.rename(g(a),g(b),e)}catch(f){e(f)}},a.prototype.renameSync=function(a,b){this.root.renameSync(g(a),g(b))},a.prototype.exists=function(a,b){void 0===b&&(b=i);var c=d(b,1);try{return this.root.exists(g(a),c)}catch(e){return c(!1)}},a.prototype.existsSync=function(a){try{return this.root.existsSync(g(a))}catch(b){return!1}},a.prototype.stat=function(a,b){void 0===b&&(b=i);var c=d(b,2);try{return this.root.stat(g(a),!1,c)}catch(e){return c(e,null)}},a.prototype.statSync=function(a){return this.root.statSync(g(a),!1)},a.prototype.lstat=function(a,b){void 0===b&&(b=i);var c=d(b,2);try{return this.root.stat(g(a),!0,c)}catch(e){return c(e,null)}},a.prototype.lstatSync=function(a){return this.root.statSync(g(a),!0)},a.prototype.truncate=function(a,b,c){void 0===b&&(b=0),void 0===c&&(c=i);var e=0;"function"==typeof b?c=b:"number"==typeof b&&(e=b);var f=d(c,1);try{if(0>e)throw new j.ApiError(j.ErrorCode.EINVAL);return this.root.truncate(g(a),e,f)}catch(h){return f(h)}},a.prototype.truncateSync=function(a,b){if(void 0===b&&(b=0),0>b)throw new j.ApiError(j.ErrorCode.EINVAL);return this.root.truncateSync(g(a),b)},a.prototype.unlink=function(a,b){void 0===b&&(b=i);var c=d(b,1);try{return this.root.unlink(g(a),c)}catch(e){return c(e)}},a.prototype.unlinkSync=function(a){return this.root.unlinkSync(g(a))},a.prototype.open=function(a,b,c,f){var h=this;void 0===f&&(f=i);var j=e(c,420);f="function"==typeof c?c:f;var l=d(f,2);try{this.root.open(g(a),k.FileFlag.getFileFlag(b),j,function(a,b){b?l(a,h.getFdForFile(b)):l(a)})}catch(m){l(m,null)}},a.prototype.openSync=function(a,b,c){return void 0===c&&(c=420),this.getFdForFile(this.root.openSync(g(a),k.FileFlag.getFileFlag(b),e(c,420)))},a.prototype.readFile=function(a,b,c){void 0===b&&(b={}),void 0===c&&(c=i);var e=h(b,null,"r",null);c="function"==typeof b?b:c;var f=d(c,2);try{var l=k.FileFlag.getFileFlag(e.flag);return l.isReadable()?this.root.readFile(g(a),e.encoding,l,f):f(new j.ApiError(j.ErrorCode.EINVAL,"Flag passed to readFile must allow for reading."))}catch(m){return f(m,null)}},a.prototype.readFileSync=function(a,b){void 0===b&&(b={});var c=h(b,null,"r",null),d=k.FileFlag.getFileFlag(c.flag);if(!d.isReadable())throw new j.ApiError(j.ErrorCode.EINVAL,"Flag passed to readFile must allow for reading.");return this.root.readFileSync(g(a),c.encoding,d)},a.prototype.writeFile=function(a,b,c,e){void 0===c&&(c={}),void 0===e&&(e=i);var f=h(c,"utf8","w",420);e="function"==typeof c?c:e;var l=d(e,1);try{var m=k.FileFlag.getFileFlag(f.flag);return m.isWriteable()?this.root.writeFile(g(a),b,f.encoding,m,f.mode,l):l(new j.ApiError(j.ErrorCode.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(n){return l(n)}},a.prototype.writeFileSync=function(a,b,c){var d=h(c,"utf8","w",420),e=k.FileFlag.getFileFlag(d.flag);if(!e.isWriteable())throw new j.ApiError(j.ErrorCode.EINVAL,"Flag passed to writeFile must allow for writing.");return this.root.writeFileSync(g(a),b,d.encoding,e,d.mode)},a.prototype.appendFile=function(a,b,c,e){void 0===e&&(e=i);var f=h(c,"utf8","a",420);e="function"==typeof c?c:e;var l=d(e,1);try{var m=k.FileFlag.getFileFlag(f.flag);if(!m.isAppendable())return l(new j.ApiError(j.ErrorCode.EINVAL,"Flag passed to appendFile must allow for appending."));this.root.appendFile(g(a),b,f.encoding,m,f.mode,l)}catch(n){l(n)}},a.prototype.appendFileSync=function(a,b,c){var d=h(c,"utf8","a",420),e=k.FileFlag.getFileFlag(d.flag);if(!e.isAppendable())throw new j.ApiError(j.ErrorCode.EINVAL,"Flag passed to appendFile must allow for appending.");return this.root.appendFileSync(g(a),b,d.encoding,e,d.mode)},a.prototype.fstat=function(a,b){void 0===b&&(b=i);var c=d(b,2);try{var e=this.fd2file(a);e.stat(c)}catch(f){c(f)}},a.prototype.fstatSync=function(a){return this.fd2file(a).statSync()},a.prototype.close=function(a,b){var c=this;void 0===b&&(b=i);var e=d(b,1);try{this.fd2file(a).close(function(b){b||c.closeFd(a),e(b)})}catch(f){e(f)}},a.prototype.closeSync=function(a){this.fd2file(a).closeSync(),this.closeFd(a)},a.prototype.ftruncate=function(a,b,c){void 0===c&&(c=i);var e="number"==typeof b?b:0;c="function"==typeof b?b:c;var f=d(c,1);try{var g=this.fd2file(a);if(0>e)throw new j.ApiError(j.ErrorCode.EINVAL);g.truncate(e,f)}catch(h){f(h)}},a.prototype.ftruncateSync=function(a,b){void 0===b&&(b=0);var c=this.fd2file(a);if(0>b)throw new j.ApiError(j.ErrorCode.EINVAL);c.truncateSync(b)},a.prototype.fsync=function(a,b){void 0===b&&(b=i);var c=d(b,1);try{this.fd2file(a).sync(c)}catch(e){c(e)}},a.prototype.fsyncSync=function(a){this.fd2file(a).syncSync()},a.prototype.fdatasync=function(a,b){void 0===b&&(b=i);var c=d(b,1);try{this.fd2file(a).datasync(c)}catch(e){c(e)}},a.prototype.fdatasyncSync=function(a){this.fd2file(a).datasyncSync()},a.prototype.write=function(a,c,e,f,g,h){void 0===h&&(h=i);var k,l,m,n=null;if("string"==typeof c){var o="utf8";switch(typeof e){case"function":h=e;break;case"number":n=e,o="string"==typeof f?f:"utf8",h="function"==typeof g?g:h;break;default:return(h="function"==typeof f?f:"function"==typeof g?g:h)(new j.ApiError(j.ErrorCode.EINVAL,"Invalid arguments."))}k=new b(c,o),l=0,m=k.length}else k=c,l=e,m=f,n="number"==typeof g?g:null,h="function"==typeof g?g:h;var p=d(h,3);try{var q=this.fd2file(a);null==n&&(n=q.getPos()),q.write(k,l,m,n,p)}catch(r){p(r)}},a.prototype.writeSync=function(a,c,d,e,f){var g,h,i,j=0;if("string"==typeof c){i="number"==typeof d?d:null;var k="string"==typeof e?e:"utf8";j=0,g=new b(c,k),h=g.length}else g=c,j=d,h=e,i="number"==typeof f?f:null;var l=this.fd2file(a);return null==i&&(i=l.getPos()),l.writeSync(g,j,h,i)},a.prototype.read=function(a,c,e,f,g,h){void 0===h&&(h=i);var j,k,l,m,n;if("number"==typeof c){l=c,j=e;var o=f;h="function"==typeof g?g:h,k=0,m=new b(l),n=d(function(a,b,c){return a?h(a):void h(a,c.toString(o),b)},3)}else m=c,k=e,l=f,j=g,n=d(h,3);try{var p=this.fd2file(a);null==j&&(j=p.getPos()),p.read(m,k,l,j,n)}catch(q){n(q)}},a.prototype.readSync=function(a,c,d,e,f){var g,h,i,j,k=!1;if("number"==typeof c){i=c,j=d;var l=e;h=0,g=new b(i),k=!0}else g=c,h=d,i=e,j=f;var m=this.fd2file(a);null==j&&(j=m.getPos());var n=m.readSync(g,h,i,j);return k?[g.toString(l),n]:n},a.prototype.fchown=function(a,b,c,e){void 0===e&&(e=i);var f=d(e,1);try{this.fd2file(a).chown(b,c,f)}catch(g){f(g)}},a.prototype.fchownSync=function(a,b,c){this.fd2file(a).chownSync(b,c)},a.prototype.fchmod=function(a,b,c){var e=d(c,1);try{var f="string"==typeof b?parseInt(b,8):b;this.fd2file(a).chmod(f,e)}catch(g){e(g)}},a.prototype.fchmodSync=function(a,b){var c="string"==typeof b?parseInt(b,8):b;this.fd2file(a).chmodSync(c)},a.prototype.futimes=function(a,b,c,e){void 0===e&&(e=i);var f=d(e,1);try{var g=this.fd2file(a);"number"==typeof b&&(b=new Date(1e3*b)),"number"==typeof c&&(c=new Date(1e3*c)),g.utimes(b,c,f)}catch(h){f(h)}},a.prototype.futimesSync=function(a,b,c){this.fd2file(a).utimesSync(f(b),f(c))},a.prototype.rmdir=function(a,b){void 0===b&&(b=i);var c=d(b,1);try{a=g(a),this.root.rmdir(a,c)}catch(e){c(e)}},a.prototype.rmdirSync=function(a){return a=g(a),this.root.rmdirSync(a)},a.prototype.mkdir=function(a,b,c){void 0===c&&(c=i),"function"==typeof b&&(c=b,b=511);var e=d(c,1);try{a=g(a),this.root.mkdir(a,b,e)}catch(f){e(f)}},a.prototype.mkdirSync=function(a,b){this.root.mkdirSync(g(a),e(b,511))},a.prototype.readdir=function(a,b){void 0===b&&(b=i);var c=d(b,2);try{a=g(a),this.root.readdir(a,c)}catch(e){c(e)}},a.prototype.readdirSync=function(a){return a=g(a),this.root.readdirSync(a)},a.prototype.link=function(a,b,c){void 0===c&&(c=i);var e=d(c,1);try{a=g(a),b=g(b),this.root.link(a,b,e)}catch(f){e(f)}},a.prototype.linkSync=function(a,b){return a=g(a),b=g(b),this.root.linkSync(a,b)},a.prototype.symlink=function(a,b,c,e){void 0===e&&(e=i);var f="string"==typeof c?c:"file";e="function"==typeof c?c:e;var h=d(e,1);try{if("file"!==f&&"dir"!==f)return h(new j.ApiError(j.ErrorCode.EINVAL,"Invalid type: "+f));a=g(a),b=g(b),this.root.symlink(a,b,f,h)}catch(k){h(k)}},a.prototype.symlinkSync=function(a,b,c){if(null==c)c="file";else if("file"!==c&&"dir"!==c)throw new j.ApiError(j.ErrorCode.EINVAL,"Invalid type: "+c);return a=g(a),b=g(b),this.root.symlinkSync(a,b,c)},a.prototype.readlink=function(a,b){void 0===b&&(b=i);var c=d(b,2);try{a=g(a),this.root.readlink(a,c)}catch(e){c(e)}},a.prototype.readlinkSync=function(a){return a=g(a),this.root.readlinkSync(a)},a.prototype.chown=function(a,b,c,e){void 0===e&&(e=i);var f=d(e,1);try{a=g(a),this.root.chown(a,!1,b,c,f)}catch(h){f(h)}},a.prototype.chownSync=function(a,b,c){a=g(a),this.root.chownSync(a,!1,b,c)},a.prototype.lchown=function(a,b,c,e){void 0===e&&(e=i);var f=d(e,1);try{a=g(a),this.root.chown(a,!0,b,c,f)}catch(h){f(h)}},a.prototype.lchownSync=function(a,b,c){a=g(a),this.root.chownSync(a,!0,b,c)},a.prototype.chmod=function(a,b,c){void 0===c&&(c=i);var f=d(c,1);try{var h=e(b,-1);if(0>h)throw new j.ApiError(j.ErrorCode.EINVAL,"Invalid mode.");this.root.chmod(g(a),!1,h,f)}catch(k){f(k)}},a.prototype.chmodSync=function(a,b){var c=e(b,-1);if(0>c)throw new j.ApiError(j.ErrorCode.EINVAL,"Invalid mode.");a=g(a),this.root.chmodSync(a,!1,c)},a.prototype.lchmod=function(a,b,c){void 0===c&&(c=i);var f=d(c,1);try{var h=e(b,-1);if(0>h)throw new j.ApiError(j.ErrorCode.EINVAL,"Invalid mode.");this.root.chmod(g(a),!0,h,f)}catch(k){f(k)}},a.prototype.lchmodSync=function(a,b){var c=e(b,-1);if(1>c)throw new j.ApiError(j.ErrorCode.EINVAL,"Invalid mode.");this.root.chmodSync(g(a),!0,c)},a.prototype.utimes=function(a,b,c,e){void 0===e&&(e=i);var h=d(e,1);try{this.root.utimes(g(a),f(b),f(c),h)}catch(j){h(j)}},a.prototype.utimesSync=function(a,b,c){this.root.utimesSync(g(a),f(b),f(c))},a.prototype.realpath=function(a,b,c){void 0===c&&(c=i);var e="object"==typeof b?b:{};c="function"==typeof b?b:i;var f=d(c,2);try{a=g(a),this.root.realpath(a,e,f)}catch(h){f(h)}},a.prototype.realpathSync=function(a,b){return void 0===b&&(b={}),a=g(a),this.root.realpathSync(a,b)},a.prototype.watchFile=function(a,b,c){throw void 0===c&&(c=i),new j.ApiError(j.ErrorCode.ENOTSUP)},a.prototype.unwatchFile=function(a,b){throw void 0===b&&(b=i),new j.ApiError(j.ErrorCode.ENOTSUP)},a.prototype.watch=function(a,b,c){throw void 0===c&&(c=i),new j.ApiError(j.ErrorCode.ENOTSUP)},a.prototype.access=function(a,b,c){throw void 0===c&&(c=i),new j.ApiError(j.ErrorCode.ENOTSUP)},a.prototype.accessSync=function(a,b){throw new j.ApiError(j.ErrorCode.ENOTSUP)},a.prototype.createReadStream=function(a,b){throw new j.ApiError(j.ErrorCode.ENOTSUP)},a.prototype.createWriteStream=function(a,b){throw new j.ApiError(j.ErrorCode.ENOTSUP)},a.Stats=m["default"],a}();c.__esModule=!0,c["default"]=n;new n}).call(this,a("bfs-buffer").Buffer)},{"./api_error":49,"./file_flag":53,"./node_fs_stats":57,"bfs-buffer":2,path:10}],49:[function(a,b,c){(function(a){var b=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};!function(a){a[a.EPERM=0]="EPERM",a[a.ENOENT=1]="ENOENT",a[a.EIO=2]="EIO",a[a.EBADF=3]="EBADF",a[a.EACCES=4]="EACCES",a[a.EBUSY=5]="EBUSY",a[a.EEXIST=6]="EEXIST",a[a.ENOTDIR=7]="ENOTDIR",a[a.EISDIR=8]="EISDIR",a[a.EINVAL=9]="EINVAL",a[a.EFBIG=10]="EFBIG",a[a.ENOSPC=11]="ENOSPC",a[a.EROFS=12]="EROFS",a[a.ENOTEMPTY=13]="ENOTEMPTY",a[a.ENOTSUP=14]="ENOTSUP"}(c.ErrorCode||(c.ErrorCode={}));var d=c.ErrorCode,e={};e[d.EPERM]="Operation not permitted.",e[d.ENOENT]="No such file or directory.",e[d.EIO]="Input/output error.",e[d.EBADF]="Bad file descriptor.",e[d.EACCES]="Permission denied.",e[d.EBUSY]="Resource busy or locked.",e[d.EEXIST]="File exists.",e[d.ENOTDIR]="File is not a directory.",e[d.EISDIR]="File is a directory.",e[d.EINVAL]="Invalid argument.",e[d.EFBIG]="File is too big.",e[d.ENOSPC]="No space left on disk.",e[d.EROFS]="Cannot modify a read-only file system.",e[d.ENOTEMPTY]="Directory is not empty.",e[d.ENOTSUP]="Operation is not supported.";var f=function(c){function f(a,b,f){void 0===b&&(b=e[a]),void 0===f&&(f=null),c.call(this,b),this.syscall="",this.errno=a,this.code=d[a],this.path=f,this.stack=(new Error).stack,this.message="Error: "+this.code+": "+b+(this.path?", '"+this.path+"'":"")}return b(f,c),f.prototype.toString=function(){return this.message},f.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},f.fromJSON=function(a){var b=new f(0);return b.errno=a.errno,b.code=a.code,b.path=a.path,b.stack=a.stack,b.message=a.message,b},f.prototype.writeToBuffer=function(b,c){void 0===b&&(b=new a(this.bufferSize())),void 0===c&&(c=0);var d=b.write(JSON.stringify(this.toJSON()),c+4);return b.writeUInt32LE(d,c),b},f.fromBuffer=function(a,b){return void 0===b&&(b=0),f.fromJSON(JSON.parse(a.toString("utf8",b+4,b+4+a.readUInt32LE(b))))},f.prototype.bufferSize=function(){return 4+a.byteLength(JSON.stringify(this.toJSON()))},f.FileError=function(a,b){return new f(a,e[a],b)},f.ENOENT=function(a){return this.FileError(d.ENOENT,a)},f.EEXIST=function(a){return this.FileError(d.EEXIST,a)},f.EISDIR=function(a){return this.FileError(d.EISDIR,a)},f.ENOTDIR=function(a){return this.FileError(d.ENOTDIR,a)},f.EPERM=function(a){return this.FileError(d.EPERM,a)},f.ENOTEMPTY=function(a){return this.FileError(d.ENOTEMPTY,a)},f}(Error);c.ApiError=f}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2}],50:[function(a,b,c){var d=a("../backend/AsyncMirror");c.AsyncMirror=d["default"];var e=a("../backend/Dropbox");c.Dropbox=e["default"];var f=a("../backend/FolderAdapter");c.FolderAdapter=f["default"];var g=a("../backend/HTML5FS");c.HTML5FS=g["default"];var h=a("../backend/InMemory");c.InMemory=h["default"];var i=a("../backend/IndexedDB");c.IndexedDB=i["default"];var j=a("../backend/LocalStorage");c.LocalStorage=j["default"];var k=a("../backend/MountableFileSystem");c.MountableFileSystem=k["default"];var l=a("../backend/OverlayFS");c.OverlayFS=l["default"];var m=a("../backend/WorkerFS");c.WorkerFS=m["default"];var n=a("../backend/XmlHttpRequest");c.XmlHttpRequest=n["default"];var o=a("../backend/ZipFS");c.ZipFS=o["default"]},{"../backend/AsyncMirror":35,"../backend/Dropbox":36,"../backend/FolderAdapter":37,"../backend/HTML5FS":38,"../backend/InMemory":39,"../backend/IndexedDB":40,"../backend/LocalStorage":41,"../backend/MountableFileSystem":42,"../backend/OverlayFS":43,"../backend/WorkerFS":44,"../backend/XmlHttpRequest":45,"../backend/ZipFS":46}],51:[function(a,b,c){(function(b,d){function e(a){a.Buffer=d,a.process=b;var c=null!=a.require?a.require:null;a.require=function(a){var b=g(a);return null==b?c.apply(null,Array.prototype.slice.call(arguments,0)):b}}function f(a,b){m[a]=b}function g(a){switch(a){case"fs":return j;case"path":return k;case"buffer":return i;case"process":return b;case"bfs_utils":return n;default:return m[a]}}function h(a){return j.initialize(a)}var i=a("buffer"),j=a("./node_fs"),k=a("path"),l=a("../generic/emscripten_fs");c.EmscriptenFS=l["default"];var m=a("./backends");c.FileSystem=m;var n=a("./util");c.install=e,c.registerFileSystem=f,c.BFSRequire=g,c.initialize=h}).call(this,a("bfs-process"),a("bfs-buffer").Buffer)},{"../generic/emscripten_fs":59,"./backends":50,"./node_fs":56,"./util":58,"bfs-buffer":2,"bfs-process":11,buffer:2,path:10}],52:[function(a,b,c){var d=a("./api_error"),e=function(){function a(){}return a.prototype.sync=function(a){a(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.syncSync=function(){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a.prototype.datasync=function(a){this.sync(a)},a.prototype.datasyncSync=function(){return this.syncSync()},a.prototype.chown=function(a,b,c){c(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.chownSync=function(a,b){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a.prototype.chmod=function(a,b){b(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.chmodSync=function(a){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a.prototype.utimes=function(a,b,c){c(new d.ApiError(d.ErrorCode.ENOTSUP))},a.prototype.utimesSync=function(a,b){throw new d.ApiError(d.ErrorCode.ENOTSUP)},a}();c.BaseFile=e},{"./api_error":49}],53:[function(a,b,c){var d=a("./api_error");!function(a){a[a.NOP=0]="NOP",a[a.THROW_EXCEPTION=1]="THROW_EXCEPTION",a[a.TRUNCATE_FILE=2]="TRUNCATE_FILE",a[a.CREATE_FILE=3]="CREATE_FILE"}(c.ActionType||(c.ActionType={}));var e=c.ActionType,f=function(){function a(b){if(this.flagStr=b,a.validFlagStrs.indexOf(b)<0)throw new d.ApiError(d.ErrorCode.EINVAL,"Invalid flag: "+b)}return a.getFileFlag=function(b){return a.flagCache.hasOwnProperty(b)?a.flagCache[b]:a.flagCache[b]=new a(b)},a.prototype.getFlagString=function(){return this.flagStr},a.prototype.isReadable=function(){return-1!==this.flagStr.indexOf("r")||-1!==this.flagStr.indexOf("+")},a.prototype.isWriteable=function(){return-1!==this.flagStr.indexOf("w")||-1!==this.flagStr.indexOf("a")||-1!==this.flagStr.indexOf("+")},a.prototype.isTruncating=function(){return-1!==this.flagStr.indexOf("w")},a.prototype.isAppendable=function(){return-1!==this.flagStr.indexOf("a")},a.prototype.isSynchronous=function(){return-1!==this.flagStr.indexOf("s")},a.prototype.isExclusive=function(){return-1!==this.flagStr.indexOf("x")},a.prototype.pathExistsAction=function(){return this.isExclusive()?e.THROW_EXCEPTION:this.isTruncating()?e.TRUNCATE_FILE:e.NOP},a.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&"r+"!==this.flagStr?e.CREATE_FILE:e.THROW_EXCEPTION},a.flagCache={},a.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"],a}();c.FileFlag=f},{"./api_error":49}],54:[function(a,b,c){(function(b){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("./api_error"),f=a("./file_flag"),g=a("path"),h=function(){function a(){}return a.prototype.supportsLinks=function(){return!1},a.prototype.diskSpace=function(a,b){b(0,0)},a.prototype.openFile=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.createFile=function(a,b,c,d){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.open=function(a,b,c,d){var h=this,i=function(i,j){if(i)switch(b.pathNotExistsAction()){case f.ActionType.CREATE_FILE:return h.stat(g.dirname(a),!1,function(f,i){f?d(f):i.isDirectory()?h.createFile(a,b,c,d):d(e.ApiError.ENOTDIR(g.dirname(a)))});case f.ActionType.THROW_EXCEPTION:return d(e.ApiError.ENOENT(a));default:return d(new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object."))}else{if(j.isDirectory())return d(e.ApiError.EISDIR(a));switch(b.pathExistsAction()){case f.ActionType.THROW_EXCEPTION:return d(e.ApiError.EEXIST(a));case f.ActionType.TRUNCATE_FILE:return h.openFile(a,b,function(a,b){a?d(a):b.truncate(0,function(){b.sync(function(){d(null,b)})})});case f.ActionType.NOP:return h.openFile(a,b,d);default:return d(new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object."))}}};this.stat(a,!1,i)},a.prototype.rename=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.renameSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.stat=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.statSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.openFileSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.createFileSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.openSync=function(a,b,c){var d;try{d=this.statSync(a,!1)}catch(h){switch(b.pathNotExistsAction()){case f.ActionType.CREATE_FILE:var i=this.statSync(g.dirname(a),!1);if(!i.isDirectory())throw e.ApiError.ENOTDIR(g.dirname(a));return this.createFileSync(a,b,c);case f.ActionType.THROW_EXCEPTION:throw e.ApiError.ENOENT(a);default:throw new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object.")}}if(d.isDirectory())throw e.ApiError.EISDIR(a);switch(b.pathExistsAction()){case f.ActionType.THROW_EXCEPTION:throw e.ApiError.EEXIST(a);case f.ActionType.TRUNCATE_FILE:return this.unlinkSync(a),this.createFileSync(a,b,d.mode);case f.ActionType.NOP:return this.openFileSync(a,b);default:throw new e.ApiError(e.ErrorCode.EINVAL,"Invalid FileFlag object.")}},a.prototype.unlink=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.unlinkSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.rmdir=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.rmdirSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.mkdir=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.mkdirSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.readdir=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP));
},a.prototype.readdirSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.exists=function(a,b){this.stat(a,null,function(a){b(null==a)})},a.prototype.existsSync=function(a){try{return this.statSync(a,!0),!0}catch(b){return!1}},a.prototype.realpath=function(a,b,c){if(this.supportsLinks())for(var d=a.split(g.sep),f=0;f<d.length;f++){var h=d.slice(0,f+1);d[f]=g.join.apply(null,h)}else this.exists(a,function(b){b?c(null,a):c(e.ApiError.ENOENT(a))})},a.prototype.realpathSync=function(a,b){if(!this.supportsLinks()){if(this.existsSync(a))return a;throw e.ApiError.ENOENT(a)}for(var c=a.split(g.sep),d=0;d<c.length;d++){var f=c.slice(0,d+1);c[d]=g.join.apply(null,f)}},a.prototype.truncate=function(a,b,c){this.open(a,f.FileFlag.getFileFlag("r+"),420,function(a,d){return a?c(a):void d.truncate(b,function(a){d.close(function(b){c(a||b)})})})},a.prototype.truncateSync=function(a,b){var c=this.openSync(a,f.FileFlag.getFileFlag("r+"),420);try{c.truncateSync(b)}catch(d){throw d}finally{c.closeSync()}},a.prototype.readFile=function(a,c,d,e){var f=e;this.open(a,d,420,function(a,d){return a?e(a):(e=function(a,b){d.close(function(c){return null==a&&(a=c),f(a,b)})},void d.stat(function(a,f){if(null!=a)return e(a);var g=new b(f.size);d.read(g,0,f.size,0,function(a){if(null!=a)return e(a);if(null===c)return e(a,g);try{e(null,g.toString(c))}catch(b){e(b)}})}))})},a.prototype.readFileSync=function(a,c,d){var e=this.openSync(a,d,420);try{var f=e.statSync(),g=new b(f.size);return e.readSync(g,0,f.size,0),e.closeSync(),null===c?g:g.toString(c)}finally{e.closeSync()}},a.prototype.writeFile=function(a,c,d,e,f,g){var h=g;this.open(a,e,420,function(a,e){if(null!=a)return g(a);g=function(a){e.close(function(b){h(null!=a?a:b)})};try{"string"==typeof c&&(c=new b(c,d))}catch(f){return g(f)}e.write(c,0,c.length,0,g)})},a.prototype.writeFileSync=function(a,c,d,e,f){var g=this.openSync(a,e,f);try{"string"==typeof c&&(c=new b(c,d)),g.writeSync(c,0,c.length,0)}finally{g.closeSync()}},a.prototype.appendFile=function(a,c,d,e,f,g){var h=g;this.open(a,e,f,function(a,e){return null!=a?g(a):(g=function(a){e.close(function(b){h(null!=a?a:b)})},"string"==typeof c&&(c=new b(c,d)),void e.write(c,0,c.length,null,g))})},a.prototype.appendFileSync=function(a,c,d,e,f){var g=this.openSync(a,e,f);try{"string"==typeof c&&(c=new b(c,d)),g.writeSync(c,0,c.length,null)}finally{g.closeSync()}},a.prototype.chmod=function(a,b,c,d){d(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.chmodSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.chown=function(a,b,c,d,f){f(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.chownSync=function(a,b,c,d){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.utimes=function(a,b,c,d){d(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.utimesSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.link=function(a,b,c){c(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.linkSync=function(a,b){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.symlink=function(a,b,c,d){d(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.symlinkSync=function(a,b,c){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a.prototype.readlink=function(a,b){b(new e.ApiError(e.ErrorCode.ENOTSUP))},a.prototype.readlinkSync=function(a){throw new e.ApiError(e.ErrorCode.ENOTSUP)},a}();c.BaseFileSystem=h;var i=function(a){function b(){a.apply(this,arguments)}return d(b,a),b.prototype.supportsSynch=function(){return!0},b.prototype.rename=function(a,b,c){try{this.renameSync(a,b),c()}catch(d){c(d)}},b.prototype.stat=function(a,b,c){try{c(null,this.statSync(a,b))}catch(d){c(d)}},b.prototype.open=function(a,b,c,d){try{d(null,this.openSync(a,b,c))}catch(e){d(e)}},b.prototype.unlink=function(a,b){try{this.unlinkSync(a),b()}catch(c){b(c)}},b.prototype.rmdir=function(a,b){try{this.rmdirSync(a),b()}catch(c){b(c)}},b.prototype.mkdir=function(a,b,c){try{this.mkdirSync(a,b),c()}catch(d){c(d)}},b.prototype.readdir=function(a,b){try{b(null,this.readdirSync(a))}catch(c){b(c)}},b.prototype.chmod=function(a,b,c,d){try{this.chmodSync(a,b,c),d()}catch(e){d(e)}},b.prototype.chown=function(a,b,c,d,e){try{this.chownSync(a,b,c,d),e()}catch(f){e(f)}},b.prototype.utimes=function(a,b,c,d){try{this.utimesSync(a,b,c),d()}catch(e){d(e)}},b.prototype.link=function(a,b,c){try{this.linkSync(a,b),c()}catch(d){c(d)}},b.prototype.symlink=function(a,b,c,d){try{this.symlinkSync(a,b,c),d()}catch(e){d(e)}},b.prototype.readlink=function(a,b){try{b(null,this.readlinkSync(a))}catch(c){b(c)}},b}(h);c.SynchronousFileSystem=i}).call(this,a("bfs-buffer").Buffer)},{"./api_error":49,"./file_flag":53,"bfs-buffer":2,path:10}],55:[function(a,b,c){(function(a){var c;c="undefined"!=typeof window?window:"undefined"!=typeof self?self:a,b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],56:[function(a,b,c){var d=a("./FS"),e=new d["default"],f={},g=d["default"].prototype;Object.keys(g).forEach(function(a){"function"==typeof e[a]?f[a]=function(){return e[a].apply(e,arguments)}:f[a]=e[a]}),f.changeFSModule=function(a){e=a},f.getFSModule=function(){return e},f.FS=d["default"],b.exports=f},{"./FS":48}],57:[function(a,b,c){(function(a){!function(a){a[a.FILE=32768]="FILE",a[a.DIRECTORY=16384]="DIRECTORY",a[a.SYMLINK=40960]="SYMLINK"}(c.FileType||(c.FileType={}));var b=c.FileType,d=function(){function c(a,c,d,e,f,g){if(void 0===e&&(e=new Date),void 0===f&&(f=new Date),void 0===g&&(g=new Date),this.size=c,this.mode=d,this.atime=e,this.mtime=f,this.ctime=g,this.dev=0,this.ino=0,this.rdev=0,this.nlink=1,this.blksize=4096,this.uid=0,this.gid=0,this.birthtime=new Date(0),this.file_data=null,null==this.mode)switch(a){case b.FILE:this.mode=420;break;case b.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(c/512),this.mode<4096&&(this.mode|=a)}return c.prototype.toBuffer=function(){var b=new a(32);return b.writeUInt32LE(this.size,0),b.writeUInt32LE(this.mode,4),b.writeDoubleLE(this.atime.getTime(),8),b.writeDoubleLE(this.mtime.getTime(),16),b.writeDoubleLE(this.ctime.getTime(),24),b},c.fromBuffer=function(a){var b=a.readUInt32LE(0),d=a.readUInt32LE(4),e=a.readDoubleLE(8),f=a.readDoubleLE(16),g=a.readDoubleLE(24);return new c(61440&d,b,4095&d,new Date(e),new Date(f),new Date(g))},c.prototype.clone=function(){return new c(61440&this.mode,this.size,4095&this.mode,this.atime,this.mtime,this.ctime)},c.prototype.isFile=function(){return(61440&this.mode)===b.FILE},c.prototype.isDirectory=function(){return(61440&this.mode)===b.DIRECTORY},c.prototype.isSymbolicLink=function(){return(61440&this.mode)===b.SYMLINK},c.prototype.chmod=function(a){this.mode=61440&this.mode|a},c.prototype.isSocket=function(){return!1},c.prototype.isBlockDevice=function(){return!1},c.prototype.isCharacterDevice=function(){return!1},c.prototype.isFIFO=function(){return!1},c}();c.__esModule=!0,c["default"]=d}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2}],58:[function(a,b,c){(function(b){function d(a,b,c){c.existsSync(a)||(d(l.dirname(a),b,c),c.mkdirSync(a,b))}function e(a){var b=f(a),c=b.byteOffset,d=b.byteLength;return 0===c&&d===b.buffer.byteLength?b.buffer:b.buffer.slice(c,c+d)}function f(a){return a.toUint8Array?a.toUint8Array():a instanceof Uint8Array?a:new Uint8Array(a)}function g(a){return"number"==typeof a[0]?a:"undefined"!=typeof ArrayBuffer?f(a):a.toJSON().data}function h(a){return a instanceof Uint8Array?i(a):a instanceof b?a:new b(a)}function i(a){return 0===a.byteOffset&&a.byteLength===a.buffer.byteLength?j(a):new b(a)}function j(a){try{return new b(a)}catch(c){return new b(new Uint8Array(a))}}function k(a,c,d){if(void 0===c&&(c=0),void 0===d&&(d=a.length),0>c||0>d||d>a.length||c>d)throw new TypeError("Invalid slice bounds on buffer of length "+a.length+": ["+c+", "+d+"]");if(0===a.length)return new b(0);if("undefined"!=typeof ArrayBuffer){var e=f(a),g=a.readUInt8(0),h=(g+1)%255;return a.writeUInt8(h,0),e[0]===h?(e[0]=g,i(e.slice(c,d))):(a.writeUInt8(g,0),i(e.subarray(c,d)))}var j=new b(d-c);return a.copy(j,0,c,d),j}var l=a("path");c.isIE="undefined"!=typeof navigator&&(null!=/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||-1!==navigator.userAgent.indexOf("Trident")),c.isWebWorker="undefined"==typeof window,c.mkdirpSync=d,c.buffer2ArrayBuffer=e,c.buffer2Uint8array=f,c.buffer2Arrayish=g,c.arrayish2Buffer=h,c.uint8Array2Buffer=i,c.arrayBuffer2Buffer=j,"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&(Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(a,b){void 0===a&&(a=0),void 0===b&&(b=this.length);var c=this;return 0>a&&(a=this.length+a,0>a&&(a=0)),0>b&&(b=this.length+b,0>b&&(b=0)),a>b&&(b=a),new Uint8Array(c.buffer,c.byteOffset+a,b-a)})),c.copyingSlice=k}).call(this,a("bfs-buffer").Buffer)},{"bfs-buffer":2,path:10}],59:[function(a,b,c){var d=a("../core/browserfs"),e=a("../core/node_fs"),f=a("../core/util"),g=function(){function a(a){this.fs=a,this.nodefs=a.getNodeFS(),this.FS=a.getFS(),this.PATH=a.getPATH(),this.ERRNO_CODES=a.getERRNO_CODES()}return a.prototype.open=function(a){var b=this.fs.realPath(a.node),c=this.FS;try{c.isFile(a.node.mode)&&(a.nfd=this.nodefs.openSync(b,this.fs.flagsToPermissionString(a.flags)))}catch(d){if(!d.code)throw d;throw new c.ErrnoError(this.ERRNO_CODES[d.code])}},a.prototype.close=function(a){var b=this.FS;try{b.isFile(a.node.mode)&&a.nfd&&this.nodefs.closeSync(a.nfd)}catch(c){if(!c.code)throw c;throw new b.ErrnoError(this.ERRNO_CODES[c.code])}},a.prototype.read=function(a,b,c,d,e){try{return this.nodefs.readSync(a.nfd,f.uint8Array2Buffer(b),c,d,e)}catch(g){throw new this.FS.ErrnoError(this.ERRNO_CODES[g.code])}},a.prototype.write=function(a,b,c,d,e){try{return this.nodefs.writeSync(a.nfd,f.uint8Array2Buffer(b),c,d,e)}catch(g){throw new this.FS.ErrnoError(this.ERRNO_CODES[g.code])}},a.prototype.llseek=function(a,b,c){var d=b;if(1===c)d+=a.position;else if(2===c&&this.FS.isFile(a.node.mode))try{var e=this.nodefs.fstatSync(a.nfd);d+=e.size}catch(f){throw new this.FS.ErrnoError(this.ERRNO_CODES[f.code])}if(0>d)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return a.position=d,d},a}(),h=function(){function a(a){this.fs=a,this.nodefs=a.getNodeFS(),this.FS=a.getFS(),this.PATH=a.getPATH(),this.ERRNO_CODES=a.getERRNO_CODES()}return a.prototype.getattr=function(a){var b,c=this.fs.realPath(a);try{b=this.nodefs.lstatSync(c)}catch(d){if(!d.code)throw d;throw new this.FS.ErrnoError(this.ERRNO_CODES[d.code])}return{dev:b.dev,ino:b.ino,mode:b.mode,nlink:b.nlink,uid:b.uid,gid:b.gid,rdev:b.rdev,size:b.size,atime:b.atime,mtime:b.mtime,ctime:b.ctime,blksize:b.blksize,blocks:b.blocks}},a.prototype.setattr=function(a,b){var c=this.fs.realPath(a);try{if(void 0!==b.mode&&(this.nodefs.chmodSync(c,b.mode),a.mode=b.mode),void 0!==b.timestamp){var d=new Date(b.timestamp);this.nodefs.utimesSync(c,d,d)}}catch(e){if(!e.code)throw e;if("ENOTSUP"!==e.code)throw new this.FS.ErrnoError(this.ERRNO_CODES[e.code])}if(void 0!==b.size)try{this.nodefs.truncateSync(c,b.size)}catch(e){if(!e.code)throw e;throw new this.FS.ErrnoError(this.ERRNO_CODES[e.code])}},a.prototype.lookup=function(a,b){var c=this.PATH.join2(this.fs.realPath(a),b),d=this.fs.getMode(c);return this.fs.createNode(a,b,d)},a.prototype.mknod=function(a,b,c,d){var e=this.fs.createNode(a,b,c,d),f=this.fs.realPath(e);try{this.FS.isDir(e.mode)?this.nodefs.mkdirSync(f,e.mode):this.nodefs.writeFileSync(f,"",{mode:e.mode})}catch(g){if(!g.code)throw g;throw new this.FS.ErrnoError(this.ERRNO_CODES[g.code])}return e},a.prototype.rename=function(a,b,c){var d=this.fs.realPath(a),e=this.PATH.join2(this.fs.realPath(b),c);try{this.nodefs.renameSync(d,e)}catch(f){if(!f.code)throw f;throw new this.FS.ErrnoError(this.ERRNO_CODES[f.code])}},a.prototype.unlink=function(a,b){var c=this.PATH.join2(this.fs.realPath(a),b);try{this.nodefs.unlinkSync(c)}catch(d){if(!d.code)throw d;throw new this.FS.ErrnoError(this.ERRNO_CODES[d.code])}},a.prototype.rmdir=function(a,b){var c=this.PATH.join2(this.fs.realPath(a),b);try{this.nodefs.rmdirSync(c)}catch(d){if(!d.code)throw d;throw new this.FS.ErrnoError(this.ERRNO_CODES[d.code])}},a.prototype.readdir=function(a){var b=this.fs.realPath(a);try{return this.nodefs.readdirSync(b)}catch(c){if(!c.code)throw c;throw new this.FS.ErrnoError(this.ERRNO_CODES[c.code])}},a.prototype.symlink=function(a,b,c){var d=this.PATH.join2(this.fs.realPath(a),b);try{this.nodefs.symlinkSync(c,d)}catch(e){if(!e.code)throw e;throw new this.FS.ErrnoError(this.ERRNO_CODES[e.code])}},a.prototype.readlink=function(a){var b=this.fs.realPath(a);try{return this.nodefs.readlinkSync(b)}catch(c){if(!c.code)throw c;throw new this.FS.ErrnoError(this.ERRNO_CODES[c.code])}},a}(),i=function(){function a(a,b,c,f){if(void 0===a&&(a=self.FS),void 0===b&&(b=self.PATH),void 0===c&&(c=self.ERRNO_CODES),void 0===f&&(f=e),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+"},"undefined"==typeof d)throw new Error("BrowserFS is not loaded. Please load it before this library.");this.nodefs=f,this.FS=a,this.PATH=b,this.ERRNO_CODES=c,this.node_ops=new h(this),this.stream_ops=new g(this)}return a.prototype.mount=function(a){return this.createNode(null,"/",this.getMode(a.opts.root),0)},a.prototype.createNode=function(a,b,c,d){var e=this.FS;if(!e.isDir(c)&&!e.isFile(c)&&!e.isLink(c))throw new e.ErrnoError(this.ERRNO_CODES.EINVAL);var f=e.createNode(a,b,c);return f.node_ops=this.node_ops,f.stream_ops=this.stream_ops,f},a.prototype.getMode=function(a){var b;try{b=this.nodefs.lstatSync(a)}catch(c){if(!c.code)throw c;throw new this.FS.ErrnoError(this.ERRNO_CODES[c.code])}return b.mode},a.prototype.realPath=function(a){for(var b=[];a.parent!==a;)b.push(a.name),a=a.parent;return b.push(a.mount.opts.root),b.reverse(),this.PATH.join.apply(null,b)},a.prototype.flagsToPermissionString=function(a){var b="string"==typeof a?parseInt(a,10):a;return b&=8191,b in this.flagsToPermissionStringMap?this.flagsToPermissionStringMap[b]:a},a.prototype.getNodeFS=function(){return this.nodefs},a.prototype.getFS=function(){return this.FS},a.prototype.getPATH=function(){return this.PATH},a.prototype.getERRNO_CODES=function(){return this.ERRNO_CODES},a}();c.__esModule=!0,c["default"]=i},{"../core/browserfs":51,"../core/node_fs":56,"../core/util":58}],60:[function(a,b,c){function d(a){return a&&a.isFile()}function e(a){return a&&a.isDir()}var f=a("../core/node_fs_stats"),g=a("path"),h=function(){function a(){this._index={},this.addPath("/",new j)}return a.prototype._split_path=function(a){var b=g.dirname(a),c=a.substr(b.length+("/"===b?0:1));return[b,c]},a.prototype.fileIterator=function(a){for(var b in this._index)for(var c=this._index[b],e=c.getListing(),f=0;f<e.length;f++){var g=c.getItem(e[f]);d(g)&&a(g.getData())}},a.prototype.addPath=function(a,b){if(null==b)throw new Error("Inode must be specified");if("/"!==a[0])throw new Error("Path must be absolute, got: "+a);if(this._index.hasOwnProperty(a))return this._index[a]===b;var c=this._split_path(a),d=c[0],f=c[1],g=this._index[d];return(void 0!==g||"/"===a||(g=new j,this.addPath(d,g)))&&("/"===a||g.addItem(f,b))?(e(b)&&(this._index[a]=b),!0):!1},a.prototype.removePath=function(a){var b=this._split_path(a),c=b[0],d=b[1],f=this._index[c];if(void 0===f)return null;var g=f.remItem(d);if(null===g)return null;if(e(g)){for(var h=g.getListing(),i=0;i<h.length;i++)this.removePath(a+"/"+h[i]);"/"!==a&&delete this._index[a]}return g},a.prototype.ls=function(a){var b=this._index[a];return void 0===b?null:b.getListing()},a.prototype.getInode=function(a){var b=this._split_path(a),c=b[0],d=b[1],e=this._index[c];return void 0===e?null:c===a?e:e.getItem(d)},a.fromListing=function(b){var c=new a,d=new j;c._index["/"]=d;for(var e=[["",b,d]];e.length>0;){var g,h=e.pop(),k=h[0],l=h[1],m=h[2];for(var n in l){var o=l[n],p=""+k+"/"+n;null!=o?(c._index[p]=g=new j,e.push([p,o,g])):g=new i(new f["default"](f.FileType.FILE,-1,365)),null!=m&&(m._ls[n]=g)}}return c},a}();c.FileIndex=h;var i=function(){function a(a){this.data=a}return a.prototype.isFile=function(){return!0},a.prototype.isDir=function(){return!1},a.prototype.getData=function(){return this.data},a.prototype.setData=function(a){this.data=a},a}();c.FileInode=i;var j=function(){function a(a){void 0===a&&(a=null),this.data=a,this._ls={}}return a.prototype.isFile=function(){return!1},a.prototype.isDir=function(){return!0},a.prototype.getData=function(){return this.data},a.prototype.getStats=function(){return new f["default"](f.FileType.DIRECTORY,4096,365)},a.prototype.getListing=function(){return Object.keys(this._ls)},a.prototype.getItem=function(a){var b;return null!=(b=this._ls[a])?b:null},a.prototype.addItem=function(a,b){return a in this._ls?!1:(this._ls[a]=b,!0)},a.prototype.remItem=function(a){var b=this._ls[a];return void 0===b?null:(delete this._ls[a],b)},a}();c.DirInode=j,c.isFileInode=d,c.isDirInode=e},{"../core/node_fs_stats":57,path:10}],61:[function(a,b,c){(function(c){var d=a("../core/node_fs_stats"),e=function(){function a(a,b,c,d,e,f){this.id=a,this.size=b,this.mode=c,this.atime=d,this.mtime=e,this.ctime=f}return a.prototype.toStats=function(){return new d["default"]((61440&this.mode)===d.FileType.DIRECTORY?d.FileType.DIRECTORY:d.FileType.FILE,this.size,this.mode,new Date(this.atime),new Date(this.mtime),new Date(this.ctime))},a.prototype.getSize=function(){return 30+this.id.length},a.prototype.toBuffer=function(a){return void 0===a&&(a=new c(this.getSize())),a.writeUInt32LE(this.size,0),a.writeUInt16LE(this.mode,4),a.writeDoubleLE(this.atime,6),a.writeDoubleLE(this.mtime,14),a.writeDoubleLE(this.ctime,22),a.write(this.id,30,this.id.length,"ascii"),a},a.prototype.update=function(a){var b=!1;this.size!==a.size&&(this.size=a.size,b=!0),this.mode!==a.mode&&(this.mode=a.mode,b=!0);var c=a.atime.getTime();this.atime!==c&&(this.atime=c,b=!0);var d=a.mtime.getTime();this.mtime!==d&&(this.mtime=d,b=!0);var e=a.ctime.getTime();return this.ctime!==e&&(this.ctime=e,b=!0),b},a.fromBuffer=function(b){if(void 0===b)throw new Error("NO");return new a(b.toString("ascii",30),b.readUInt32LE(0),b.readUInt16LE(4),b.readDoubleLE(6),b.readDoubleLE(14),b.readDoubleLE(22))},a.prototype.isFile=function(){return(61440&this.mode)===d.FileType.FILE},a.prototype.isDirectory=function(){return(61440&this.mode)===d.FileType.DIRECTORY},a}();b.exports=e}).call(this,a("bfs-buffer").Buffer)},{"../core/node_fs_stats":57,"bfs-buffer":2}],62:[function(a,b,c){(function(b){function d(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})}function e(a,b){return a?(b(a),!1):!0}function f(a,b,c){return a?(b.abort(function(){c(a)}),!1):!0}var g=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},h=a("../core/file_system"),i=a("../core/api_error"),j=a("../core/node_fs_stats"),k=a("path"),l=a("../generic/inode"),m=a("../generic/preload_file"),n="/",o=function(){function a(a){this.store=a,this.originalData={},this.modifiedKeys=[]}return a.prototype.stashOldValue=function(a,b){this.originalData.hasOwnProperty(a)||(this.originalData[a]=b)},a.prototype.markModified=function(a){-1===this.modifiedKeys.indexOf(a)&&(this.modifiedKeys.push(a),this.originalData.hasOwnProperty(a)||(this.originalData[a]=this.store.get(a)))},a.prototype.get=function(a){var b=this.store.get(a);return this.stashOldValue(a,b),b},a.prototype.put=function(a,b,c){return this.markModified(a),this.store.put(a,b,c)},a.prototype.del=function(a){this.markModified(a),this.store.del(a)},a.prototype.commit=function(){},a.prototype.abort=function(){var a,b,c;for(a=0;a<this.modifiedKeys.length;a++)b=this.modifiedKeys[a],c=this.originalData[b],null===c?this.store.del(b):this.store.put(b,c,!0)},a}();c.SimpleSyncRWTransaction=o;var p=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return g(b,a),b.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())},b.prototype.closeSync=function(){this.syncSync()},b}(m.PreloadFile);c.SyncKeyValueFile=p;var q=function(a){function c(b){a.call(this),this.store=b.store,this.makeRootDirectory()}return g(c,a),c.isAvailable=function(){return!0},c.prototype.getName=function(){return this.store.name()},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSymlinks=function(){return!1},c.prototype.supportsProps=function(){return!1},c.prototype.supportsSynch=function(){return!0},c.prototype.makeRootDirectory=function(){var a=this.store.beginTransaction("readwrite");if(void 0===a.get(n)){var c=(new Date).getTime(),e=new l(d(),4096,511|j.FileType.DIRECTORY,c,c,c);a.put(e.id,new b("{}"),!1),a.put(n,e.toBuffer(),!1),a.commit()}},c.prototype._findINode=function(a,b,c){var d=this,e=function(e){var f=d.getDirListing(a,b,e);if(f[c])return f[c];throw i.ApiError.ENOENT(k.resolve(b,c))};return"/"===b?""===c?n:e(this.getINode(a,b,n)):e(this.getINode(a,b+k.sep+c,this._findINode(a,k.dirname(b),k.basename(b))))},c.prototype.findINode=function(a,b){return this.getINode(a,b,this._findINode(a,k.dirname(b),k.basename(b)))},c.prototype.getINode=function(a,b,c){var d=a.get(c);if(void 0===d)throw i.ApiError.ENOENT(b);return l.fromBuffer(d)},c.prototype.getDirListing=function(a,b,c){if(!c.isDirectory())throw i.ApiError.ENOTDIR(b);var d=a.get(c.id);if(void 0===d)throw i.ApiError.ENOENT(b);return JSON.parse(d.toString())},c.prototype.addNewNode=function(a,b){for(var c,e=0;5>e;)try{return c=d(),a.put(c,b,!1),c}catch(f){}throw new i.ApiError(i.ErrorCode.EIO,"Unable to commit data to key-value store.")},c.prototype.commitNewFile=function(a,c,d,e,f){var g=k.dirname(c),h=k.basename(c),j=this.findINode(a,g),m=this.getDirListing(a,g,j),n=(new Date).getTime();if("/"===c)throw i.ApiError.EEXIST(c);if(m[h])throw i.ApiError.EEXIST(c);try{var o=this.addNewNode(a,f),p=new l(o,f.length,e|d,n,n,n),q=this.addNewNode(a,p.toBuffer());m[h]=q,a.put(j.id,new b(JSON.stringify(m)),!0)}catch(r){throw a.abort(),r}return a.commit(),p},c.prototype.empty=function(){this.store.clear(),this.makeRootDirectory()},c.prototype.renameSync=function(a,c){var d=this.store.beginTransaction("readwrite"),e=k.dirname(a),f=k.basename(a),g=k.dirname(c),h=k.basename(c),j=this.findINode(d,e),l=this.getDirListing(d,e,j);if(!l[f])throw i.ApiError.ENOENT(a);var m=l[f];if(delete l[f],0===(g+"/").indexOf(a+"/"))throw new i.ApiError(i.ErrorCode.EBUSY,e);var n,o;if(g===e?(n=j,o=l):(n=this.findINode(d,g),o=this.getDirListing(d,g,n)),o[h]){var p=this.getINode(d,c,o[h]);if(!p.isFile())throw i.ApiError.EPERM(c);try{d.del(p.id),d.del(o[h])}catch(q){throw d.abort(),q}}o[h]=m;try{d.put(j.id,new b(JSON.stringify(l)),!0),d.put(n.id,new b(JSON.stringify(o)),!0)}catch(q){throw d.abort(),q}d.commit()},c.prototype.statSync=function(a,b){return this.findINode(this.store.beginTransaction("readonly"),a).toStats()},c.prototype.createFileSync=function(a,c,d){var e=this.store.beginTransaction("readwrite"),f=new b(0),g=this.commitNewFile(e,a,j.FileType.FILE,d,f);return new p(this,a,c,g.toStats(),f)},c.prototype.openFileSync=function(a,b){var c=this.store.beginTransaction("readonly"),d=this.findINode(c,a),e=c.get(d.id);if(void 0===e)throw i.ApiError.ENOENT(a);return new p(this,a,b,d.toStats(),e)},c.prototype.removeEntry=function(a,c){var d=this.store.beginTransaction("readwrite"),e=k.dirname(a),f=this.findINode(d,e),g=this.getDirListing(d,e,f),h=k.basename(a);if(!g[h])throw i.ApiError.ENOENT(a);var j=g[h];delete g[h];var l=this.getINode(d,a,j);if(!c&&l.isDirectory())throw i.ApiError.EISDIR(a);if(c&&!l.isDirectory())throw i.ApiError.ENOTDIR(a);try{d.del(l.id),d.del(j),d.put(f.id,new b(JSON.stringify(g)),!0)}catch(m){throw d.abort(),m}d.commit()},c.prototype.unlinkSync=function(a){this.removeEntry(a,!1)},c.prototype.rmdirSync=function(a){this.removeEntry(a,!0)},c.prototype.mkdirSync=function(a,c){var d=this.store.beginTransaction("readwrite"),e=new b("{}");this.commitNewFile(d,a,j.FileType.DIRECTORY,c,e)},c.prototype.readdirSync=function(a){var b=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(b,a,this.findINode(b,a)))},c.prototype._syncSync=function(a,b,c){var d=this.store.beginTransaction("readwrite"),e=this._findINode(d,k.dirname(a),k.basename(a)),f=this.getINode(d,a,e),g=f.update(c);try{d.put(f.id,b,!0),g&&d.put(e,f.toBuffer(),!0)}catch(h){throw d.abort(),h}d.commit()},c}(h.SynchronousFileSystem);c.SyncKeyValueFileSystem=q;var r=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return g(b,a),b.prototype.sync=function(a){var b=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(c){c||b.resetDirty(),a(c)}):a()},b.prototype.close=function(a){this.sync(a)},b}(m.PreloadFile);c.AsyncKeyValueFile=r;var s=function(a){function c(){a.apply(this,arguments)}return g(c,a),c.prototype.init=function(a,b){this.store=a,this.makeRootDirectory(b)},c.isAvailable=function(){return!0},c.prototype.getName=function(){return this.store.name()},c.prototype.isReadOnly=function(){return!1},c.prototype.supportsSymlinks=function(){return!1},c.prototype.supportsProps=function(){return!1},c.prototype.supportsSynch=function(){return!1},c.prototype.makeRootDirectory=function(a){var c=this.store.beginTransaction("readwrite");c.get(n,function(e,g){if(e||void 0===g){var h=(new Date).getTime(),i=new l(d(),4096,511|j.FileType.DIRECTORY,h,h,h);c.put(i.id,new b("{}"),!1,function(b){f(b,c,a)&&c.put(n,i.toBuffer(),!1,function(b){b?c.abort(function(){a(b)}):c.commit(a)})})}else c.commit(a)})},c.prototype._findINode=function(a,b,c,d){var f=this,g=function(a,e,f){a?d(a):f[c]?d(null,f[c]):d(i.ApiError.ENOENT(k.resolve(b,c)))};"/"===b?""===c?d(null,n):this.getINode(a,b,n,function(c,h){e(c,d)&&f.getDirListing(a,b,h,function(a,b){g(a,h,b)})}):this.findINodeAndDirListing(a,b,g)},c.prototype.findINode=function(a,b,c){var d=this;this._findINode(a,k.dirname(b),k.basename(b),function(f,g){e(f,c)&&d.getINode(a,b,g,c)})},c.prototype.getINode=function(a,b,c,d){a.get(c,function(a,c){e(a,d)&&(void 0===c?d(i.ApiError.ENOENT(b)):d(null,l.fromBuffer(c)))})},c.prototype.getDirListing=function(a,b,c,d){c.isDirectory()?a.get(c.id,function(a,c){if(e(a,d))try{d(null,JSON.parse(c.toString()))}catch(a){d(i.ApiError.ENOENT(b))}}):d(i.ApiError.ENOTDIR(b))},c.prototype.findINodeAndDirListing=function(a,b,c){var d=this;this.findINode(a,b,function(f,g){e(f,c)&&d.getDirListing(a,b,g,function(a,b){e(a,c)&&c(null,g,b)})})},c.prototype.addNewNode=function(a,b,c){var e,f=0,g=function(){5===++f?c(new i.ApiError(i.ErrorCode.EIO,"Unable to commit data to key-value store.")):(e=d(),a.put(e,b,!1,function(a,b){a||!b?g():c(null,e)}))};g()},c.prototype.commitNewFile=function(a,c,d,e,g,h){var j=this,m=k.dirname(c),n=k.basename(c),o=(new Date).getTime();return"/"===c?h(i.ApiError.EEXIST(c)):void this.findINodeAndDirListing(a,m,function(k,m,p){f(k,a,h)&&(p[n]?a.abort(function(){h(i.ApiError.EEXIST(c))}):j.addNewNode(a,g,function(c,i){if(f(c,a,h)){var k=new l(i,g.length,e|d,o,o,o);j.addNewNode(a,k.toBuffer(),function(c,d){f(c,a,h)&&(p[n]=d,a.put(m.id,new b(JSON.stringify(p)),!0,function(b){f(b,a,h)&&a.commit(function(b){f(b,a,h)&&h(null,k)})}))})}}))})},c.prototype.empty=function(a){var b=this;this.store.clear(function(c){e(c,a)&&b.makeRootDirectory(a)})},c.prototype.rename=function(a,c,d){var e=this,g=this.store.beginTransaction("readwrite"),h=k.dirname(a),j=k.basename(a),l=k.dirname(c),m=k.basename(c),n={},o={},p=!1;if(0===(l+"/").indexOf(a+"/"))return d(new i.ApiError(i.ErrorCode.EBUSY,h));var q=function(){if(!p&&o.hasOwnProperty(h)&&o.hasOwnProperty(l)){var k=o[h],q=n[h],r=o[l],s=n[l];if(k[j]){var t=k[j];delete k[j];var u=function(){r[m]=t,g.put(q.id,new b(JSON.stringify(k)),!0,function(a){f(a,g,d)&&(h===l?g.commit(d):g.put(s.id,new b(JSON.stringify(r)),!0,function(a){f(a,g,d)&&g.commit(d)}))})};r[m]?e.getINode(g,c,r[m],function(a,b){f(a,g,d)&&(b.isFile()?g.del(b.id,function(a){f(a,g,d)&&g.del(r[m],function(a){f(a,g,d)&&u()})}):g.abort(function(a){d(i.ApiError.EPERM(c))}))}):u()}else d(i.ApiError.ENOENT(a))}},r=function(a){e.findINodeAndDirListing(g,a,function(b,c,e){b?p||(p=!0,g.abort(function(){d(b)})):(n[a]=c,o[a]=e,q())})};r(h),h!==l&&r(l)},c.prototype.stat=function(a,b,c){var d=this.store.beginTransaction("readonly");this.findINode(d,a,function(a,b){e(a,c)&&c(null,b.toStats())})},c.prototype.createFile=function(a,c,d,f){var g=this,h=this.store.beginTransaction("readwrite"),i=new b(0);this.commitNewFile(h,a,j.FileType.FILE,d,i,function(b,d){e(b,f)&&f(null,new r(g,a,c,d.toStats(),i))})},c.prototype.openFile=function(a,b,c){var d=this,f=this.store.beginTransaction("readonly");this.findINode(f,a,function(g,h){e(g,c)&&f.get(h.id,function(f,g){e(f,c)&&(void 0===g?c(i.ApiError.ENOENT(a)):c(null,new r(d,a,b,h.toStats(),g)))})})},c.prototype.removeEntry=function(a,c,d){var e=this,g=this.store.beginTransaction("readwrite"),h=k.dirname(a),j=k.basename(a);this.findINodeAndDirListing(g,h,function(h,k,l){if(f(h,g,d))if(l[j]){var m=l[j];delete l[j],e.getINode(g,a,m,function(e,h){f(e,g,d)&&(!c&&h.isDirectory()?g.abort(function(){d(i.ApiError.EISDIR(a))}):c&&!h.isDirectory()?g.abort(function(){d(i.ApiError.ENOTDIR(a))}):g.del(h.id,function(a){f(a,g,d)&&g.del(m,function(a){f(a,g,d)&&g.put(k.id,new b(JSON.stringify(l)),!0,function(a){f(a,g,d)&&g.commit(d)})})}))})}else g.abort(function(){d(i.ApiError.ENOENT(a))})})},c.prototype.unlink=function(a,b){this.removeEntry(a,!1,b)},c.prototype.rmdir=function(a,b){this.removeEntry(a,!0,b)},c.prototype.mkdir=function(a,c,d){var e=this.store.beginTransaction("readwrite"),f=new b("{}");this.commitNewFile(e,a,j.FileType.DIRECTORY,c,f,d)},c.prototype.readdir=function(a,b){var c=this,d=this.store.beginTransaction("readonly");this.findINode(d,a,function(f,g){e(f,b)&&c.getDirListing(d,a,g,function(a,c){e(a,b)&&b(null,Object.keys(c))})})},c.prototype._sync=function(a,b,c,d){var e=this,g=this.store.beginTransaction("readwrite");this._findINode(g,k.dirname(a),k.basename(a),function(h,i){f(h,g,d)&&e.getINode(g,a,i,function(a,e){if(f(a,g,d)){var h=e.update(c);g.put(e.id,b,!0,function(a){f(a,g,d)&&(h?g.put(i,e.toBuffer(),!0,function(a){f(a,g,d)&&g.commit(d)}):g.commit(d))})}})})},c}(h.BaseFileSystem);c.AsyncKeyValueFileSystem=s}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/file_system":54,"../core/node_fs_stats":57,"../generic/inode":61,"../generic/preload_file":63,"bfs-buffer":2,path:10}],63:[function(a,b,c){(function(b){var d=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)},e=a("../core/file"),f=a("../core/api_error"),g=a("../core/node_fs"),h=function(a){function c(c,d,e,f,g){if(a.call(this),this._pos=0,this._dirty=!1,this._fs=c,this._path=d,this._flag=e,this._stat=f,null!=g?this._buffer=g:this._buffer=new b(0),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return d(c,a),c.prototype.isDirty=function(){return this._dirty},c.prototype.resetDirty=function(){this._dirty=!1},c.prototype.getBuffer=function(){return this._buffer},c.prototype.getStats=function(){return this._stat},c.prototype.getFlag=function(){return this._flag},c.prototype.getPath=function(){return this._path},c.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},c.prototype.advancePos=function(a){return this._pos+=a},c.prototype.setPos=function(a){return this._pos=a},c.prototype.sync=function(a){try{this.syncSync(),a()}catch(b){a(b)}},c.prototype.syncSync=function(){throw new f.ApiError(f.ErrorCode.ENOTSUP);
},c.prototype.close=function(a){try{this.closeSync(),a()}catch(b){a(b)}},c.prototype.closeSync=function(){throw new f.ApiError(f.ErrorCode.ENOTSUP)},c.prototype.stat=function(a){try{a(null,this._stat.clone())}catch(b){a(b)}},c.prototype.statSync=function(){return this._stat.clone()},c.prototype.truncate=function(a,b){try{this.truncateSync(a),this._flag.isSynchronous()&&!g.getRootFS().supportsSynch()&&this.sync(b),b()}catch(c){return b(c)}},c.prototype.truncateSync=function(a){if(this._dirty=!0,!this._flag.isWriteable())throw new f.ApiError(f.ErrorCode.EPERM,"File not opened with a writeable mode.");if(this._stat.mtime=new Date,a>this._buffer.length){var c=new b(a-this._buffer.length);return c.fill(0),this.writeSync(c,0,c.length,this._buffer.length),void(this._flag.isSynchronous()&&g.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=a;var d=new b(a);this._buffer.copy(d,0,0,a),this._buffer=d,this._flag.isSynchronous()&&g.getRootFS().supportsSynch()&&this.syncSync()},c.prototype.write=function(a,b,c,d,e){try{e(null,this.writeSync(a,b,c,d),a)}catch(f){e(f)}},c.prototype.writeSync=function(a,c,d,e){if(this._dirty=!0,null==e&&(e=this.getPos()),!this._flag.isWriteable())throw new f.ApiError(f.ErrorCode.EPERM,"File not opened with a writeable mode.");var g=e+d;if(g>this._stat.size&&(this._stat.size=g,g>this._buffer.length)){var h=new b(g);this._buffer.copy(h),this._buffer=h}var i=a.copy(this._buffer,e,c,c+d);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),i):(this.setPos(e+i),i)},c.prototype.read=function(a,b,c,d,e){try{e(null,this.readSync(a,b,c,d),a)}catch(f){e(f)}},c.prototype.readSync=function(a,b,c,d){if(!this._flag.isReadable())throw new f.ApiError(f.ErrorCode.EPERM,"File not opened with a readable mode.");null==d&&(d=this.getPos());var e=d+c;e>this._stat.size&&(c=this._stat.size-d);var g=this._buffer.copy(a,b,d,d+c);return this._stat.atime=new Date,this._pos=d+c,g},c.prototype.chmod=function(a,b){try{this.chmodSync(a),b()}catch(c){b(c)}},c.prototype.chmodSync=function(a){if(!this._fs.supportsProps())throw new f.ApiError(f.ErrorCode.ENOTSUP);this._dirty=!0,this._stat.chmod(a),this.syncSync()},c}(e.BaseFile);c.PreloadFile=h;var i=function(a){function b(b,c,d,e,f){a.call(this,b,c,d,e,f)}return d(b,a),b.prototype.sync=function(a){a()},b.prototype.syncSync=function(){},b.prototype.close=function(a){a()},b.prototype.closeSync=function(){},b}(h);c.NoSyncFile=i}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/file":52,"../core/node_fs":56,"bfs-buffer":2}],64:[function(a,b,c){(function(b){function d(a){for(var b=IEBinaryToArray_ByteStr(a),c=IEBinaryToArray_ByteStr_Last(a),d=b.replace(/[\s\S]/g,function(a){var b=a.charCodeAt(0);return String.fromCharCode(255&b,b>>8)})+c,e=new Array(d.length),f=0;f<d.length;f++)e[f]=d.charCodeAt(f);return e}function e(a,c,e,f){switch(e){case"buffer":case"json":break;default:return f(new o.ApiError(o.ErrorCode.EINVAL,"Invalid download type: "+e))}var g=new XMLHttpRequest;g.open("GET",c,a),g.setRequestHeader("Accept-Charset","x-user-defined"),g.onreadystatechange=function(a){var c;if(4===g.readyState){if(200!==g.status)return f(new o.ApiError(g.status,"XHR error."));switch(e){case"buffer":return c=d(g.responseBody),f(null,new b(c));case"json":return f(null,JSON.parse(g.responseText))}}},g.send()}function f(a,b,c){e(!0,a,b,c)}function g(a,b){var c;return e(!1,a,b,function(a,b){if(a)throw a;c=b}),c}function h(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0);var f=!0;switch(c){case"buffer":e.responseType="arraybuffer";break;case"json":try{e.responseType="json",f="json"===e.responseType}catch(g){f=!1}break;default:return d(new o.ApiError(o.ErrorCode.EINVAL,"Invalid download type: "+c))}e.onreadystatechange=function(a){if(4===e.readyState){if(200!==e.status)return d(new o.ApiError(e.status,"XHR error."));switch(c){case"buffer":return d(null,new b(e.response?e.response:0));case"json":return f?d(null,e.response):d(null,JSON.parse(e.responseText))}}},e.send()}function i(a,c){var d=new XMLHttpRequest;d.open("GET",a,!1);var e=null,f=null;if(d.overrideMimeType("text/plain; charset=x-user-defined"),d.onreadystatechange=function(a){if(4===d.readyState){if(200!==d.status)return void(f=new o.ApiError(d.status,"XHR error."));switch(c){case"buffer":var g=d.responseText;e=new b(g.length);for(var h=0;h<g.length;h++)e.writeUInt8(g.charCodeAt(h),h);return;case"json":return void(e=JSON.parse(d.responseText))}}},d.send(),f)throw f;return e}function j(a,c){var d=new XMLHttpRequest;switch(d.open("GET",a,!1),c){case"buffer":d.responseType="arraybuffer";break;case"json":break;default:throw new o.ApiError(o.ErrorCode.EINVAL,"Invalid download type: "+c)}var e,f;if(d.onreadystatechange=function(a){if(4===d.readyState)if(200===d.status)switch(c){case"buffer":e=new b(d.response);break;case"json":e=JSON.parse(d.response)}else f=new o.ApiError(d.status,"XHR error.")},d.send(),f)throw f;return e}function k(a,b,c){var d=new XMLHttpRequest;d.open("HEAD",b,a),d.onreadystatechange=function(a){if(4===d.readyState){if(200!=d.status)return c(new o.ApiError(d.status,"XHR HEAD error."));try{return c(null,parseInt(d.getResponseHeader("Content-Length"),10))}catch(a){return c(new o.ApiError(o.ErrorCode.EIO,"XHR HEAD error: Could not read content-length."))}}},d.send()}function l(a){var b;return k(!1,a,function(a,c){if(a)throw a;b=c}),b}function m(a,b){k(!0,a,b)}var n=a("../core/util"),o=a("../core/api_error");c.asyncDownloadFile=n.isIE&&"undefined"==typeof Blob?f:h,c.syncDownloadFile=n.isIE&&"undefined"==typeof Blob?g:n.isIE&&"undefined"!=typeof Blob?j:i,c.getFileSizeSync=l,c.getFileSizeAsync=m}).call(this,a("bfs-buffer").Buffer)},{"../core/api_error":49,"../core/util":58,"bfs-buffer":2}],65:[function(a,b,c){var d=a("./core/global");if(Date.now||(Date.now=function(){return(new Date).getTime()}),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Object.keys||(Object.keys=function(){"use strict";var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&("function"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var f,g,h=[];for(f in e)a.call(e,f)&&h.push(f);if(b)for(g=0;d>g;g++)a.call(e,c[g])&&h.push(c[g]);return h}}()),"b"!=="ab".substr(-1)&&(String.prototype.substr=function(a){return function(b,c){return 0>b&&(b=this.length+b),a.call(this,b,c)}}(String.prototype.substr)),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){for(var c=0;c<this.length;++c)c in this&&a.call(b,this[c],c,this)}),Array.prototype.filter||(Array.prototype.filter=function(a){"use strict";if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d}),"undefined"==typeof setImmediate){var e=d,f=[],g="zero-timeout-message",h=function(){if("undefined"!=typeof e.importScripts||!e.postMessage)return!1;var a=!0,b=e.onmessage;return e.onmessage=function(){a=!1},e.postMessage("","*"),e.onmessage=b,a};if(h()){e.setImmediate=function(a){f.push(a),e.postMessage(g,"*")};var i=function(a){if(a.source===self&&a.data===g&&(a.stopPropagation?a.stopPropagation():a.cancelBubble=!0,f.length>0)){var b=f.shift();return b()}};e.addEventListener?e.addEventListener("message",i,!0):e.attachEvent("onmessage",i)}else if(e.MessageChannel){var j=new e.MessageChannel;j.port1.onmessage=function(a){return f.length>0?f.shift()():void 0},e.setImmediate=function(a){f.push(a),j.port2.postMessage("")}}else e.setImmediate=function(a){return setTimeout(a,0)}}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){if(void 0===b&&(b=0),!this)throw new TypeError;var c=this.length;if(0===c||d>=c)return-1;var d=b;0>d&&(d=c+d);for(var e=d;c>e;e++)if(this[e]===a)return e;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;for(c=0,d=this.length;d>c;++c)c in this&&a.call(b,this[c],c,this)}),Array.prototype.map||(Array.prototype.map=function(a,b){var c,d,e;if(null==this)throw new TypeError(" this is null or not defined");var f=Object(this),g=f.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(b&&(c=b),d=new Array(g),e=0;g>e;){var h,i;e in f&&(h=f[e],i=a.call(c,h,e,f),d[e]=i),e++}return d}),"undefined"!=typeof document&&"undefined"!=typeof window&&void 0===window.chrome&&document.write("<!-- IEBinaryToArray_ByteStr -->\r\n<script type='text/vbscript'>\r\nFunction IEBinaryToArray_ByteStr(Binary)\r\n IEBinaryToArray_ByteStr = CStr(Binary)\r\nEnd Function\r\nFunction IEBinaryToArray_ByteStr_Last(Binary)\r\n Dim lastIndex\r\n lastIndex = LenB(Binary)\r\n if lastIndex mod 2 Then\r\n IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n Else\r\n IEBinaryToArray_ByteStr_Last = \"\"\r\n End If\r\nEnd Function\r\n</script>\r\n");var k=a("./core/browserfs");b.exports=k},{"./core/browserfs":51,"./core/global":55}]},{},[47])(47)});
//# sourceMappingURL=browserfs.min.js.map