Skip to content

Instantly share code, notes, and snippets.

@bryangingechen
Created September 19, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryangingechen/7034d893411caa0bdb00228fa5300fc2 to your computer and use it in GitHub Desktop.
Save bryangingechen/7034d893411caa0bdb00228fa5300fc2 to your computer and use it in GitHub Desktop.
!function (t, e) {
'object' == typeof exports && 'object' == typeof module ? module.exports = e() : 'function' == typeof define && define.amd ? define([], e) : 'object' == typeof exports ? exports.leanBrowser = e() : t.leanBrowser = e()
}('undefined' != typeof self ? self : this, function () {
return function (t) {
var e = {
};
function r(n) {
if (e[n]) return e[n].exports;
var o = e[n] = {
i: n,
l: !1,
exports: {
}
};
return t[n].call(o.exports, o, o.exports, r),
o.l = !0,
o.exports
}
return r.m = t,
r.c = e,
r.d = function (t, e, n) {
r.o(t, e) || Object.defineProperty(t, e, {
configurable: !1,
enumerable: !0,
get: n
})
},
r.n = function (t) {
var e = t && t.__esModule ? function () {
return t.default
}
: function () {
return t
};
return r.d(e, 'a', e),
e
},
r.o = function (t, e) {
return Object.prototype.hasOwnProperty.call(t, e)
},
r.p = '/',
r(r.s = 2)
}([function (t, e, r) {
'use strict';
function n(t) {
for (var r in t) e.hasOwnProperty(r) || (e[r] = t[r])
}
Object.defineProperty(e, '__esModule', {
value: !0
}),
n(r(1)),
n(r(4))
},
function (t, e, r) {
'use strict';
Object.defineProperty(e, '__esModule', {
value: !0
});
e.Event = class {
constructor() {
this.handlers = [
]
}
on(t) {
return this.handlers.push(t),
{
dispose: () =>{
this.handlers = this.handlers.filter(e=>e !== t)
}
}
}
fire(t) {
for (const eofthis.handlers) e(t)
}
dispose() {
this.handlers = [
]
}
}
},
function (t, e, r) {
t.exports = r(3)
},
function (t, e, r) {
'use strict';
function n(t) {
for (var r in t) e.hasOwnProperty(r) || (e[r] = t[r])
}
Object.defineProperty(e, '__esModule', {
value: !0
}),
n(r(0));
var o = r(5);
e.LeanJsOpts = o.LeanJsOpts,
n(r(6))
},
function (t, e, r) {
'use strict';
Object.defineProperty(e, '__esModule', {
value: !0
});
const n = r(1);
e.Server = class {
constructor(t) {
this.transport = t,
this.error = new n.Event,
this.allMessages = new n.Event,
this.tasks = new n.Event,
this.logMessagesToConsole = !1,
this.currentSeqNum = 0,
this.currentMessages = [
],
this.sentRequests = new Map
}
connect() {
this.conn = this.transport.connect(),
this.conn.jsonMessage.on(t=>this.onMessage(t)),
this.conn.error.on(t=>this.error.fire(t))
}
restart() {
this.dispose(),
this.connect()
}
send(t) {
if (!this.alive()) return new Promise((t, e) =>e('server is not alive'));
this.logMessagesToConsole && console.log('=> server: ', t),
t.seq_num = this.currentSeqNum++;
const e = new Promise((e, r) =>this.sentRequests.set(t.seq_num, {
resolve: e,
reject: r
}));
return this.conn.send(t),
e
}
info(t, e, r) {
return this.send({
command: 'info',
file_name: t,
line: e,
column: r
})
}
sync(t, e) {
return this.send({
command: 'sync',
file_name: t,
content: e
})
}
complete(t, e, r, n) {
return this.send({
command: 'complete',
file_name: t,
line: e,
column: r,
skip_completions: n || !1
})
}
search(t) {
return this.send({
command: 'search',
query: t
})
}
allHoleCommands(t) {
return this.send({
command: 'all_hole_commands',
file_name: t
})
}
holeCommands(t, e, r) {
return this.send({
command: 'hole_commands',
file_name: t,
line: e,
column: r
})
}
hole(t, e, r, n) {
return this.send({
command: 'hole',
file_name: t,
line: e,
column: r,
action: n
})
}
roi(t, e) {
return this.send({
command: 'roi',
files: e,
mode: t
})
}
alive() {
return this.conn && this.conn.alive
}
dispose() {
this.conn && (this.conn.dispose(), this.sentRequests.forEach((t, e) =>t.reject('disposed')), this.sentRequests.clear(), this.currentSeqNum = 0, this.conn = null)
}
onMessage(t) {
this.logMessagesToConsole && console.log('<= server: ', t);
const e = this.sentRequests.get(t.seq_num);
if (void 0 !== e) this.sentRequests.delete (t.seq_num),
'ok' === t.response ? e.resolve(t) : e.reject(t.message || t);
else if ('all_messages' === t.response) {
const e = t;
this.currentMessages = e.msgs,
this.allMessages.fire(e)
} else if ('additional_message' === t.response) {
const e = t;
this.currentMessages = this.currentMessages.concat([e.msg]),
this.allMessages.fire({
response: 'all_messages',
msgs: this.currentMessages
})
} else 'current_tasks' === t.response ? this.tasks.fire(t) : this.error.fire({
error: 'unrelated',
message: t.message || JSON.stringify(t)
})
}
}
},
function (t, e, r) {
'use strict';
Object.defineProperty(e, '__esModule', {
value: !0
})
},
function (t, e, r) {
'use strict';
var n = this && this.__importDefault || function (t) {
return t && t.__esModule ? t : {
default:
t
}
};
Object.defineProperty(e, '__esModule', {
value: !0
});
const o = r(0),
i = n(r(7));
e.WebWorkerTransport = class {
constructor(t) {
this.opts = t
}
connect() {
const t = new i.default;
t.postMessage({
command: 'start-webworker',
opts: this.opts
});
const e = new s(t);
return t.onmessage = (t=>{
const r = t.data;
e.jsonMessage.fire(r)
}),
e
}
};
class s{
constructor(t) {
this.error = new o.Event,
this.jsonMessage = new o.Event,
this.alive = !0,
this.worker = t
}
send(t) {
this.worker.postMessage(t)
}
dispose() {
this.worker.terminate(),
this.alive = !1
}
}
e.WebWorkerConnection = s
},
function (t, e, r) {
t.exports = function () {
return r(8) ('!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=12)}([function(t,e,r){"use strict";(function(t){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n * @license MIT\n */\nvar n=r(14),o=r(15),i=r(16);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=c.prototype:(null===t&&(t=new c(e)),t.length=e),t}function c(t,e,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return u(this,t,e,r)}function u(t,e,r,n){if("number"==typeof e)throw new TypeError(\'"value" argument must not be a number\');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("\'offset\' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("\'length\' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);c.TYPED_ARRAY_SUPPORT?(t=e).__proto__=c.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError(\'"encoding" must be a valid string encoding\');var n=0|p(e,r),o=(t=a(t,n)).write(e,r);o!==n&&(t=t.slice(0,o));return t}(t,e,r):function(t,e){if(c.isBuffer(e)){var r=0|d(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):l(t,e);if("Buffer"===e.type&&i(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError(\'"size" argument must be a number\');if(t<0)throw new RangeError(\'"size" argument must not be negative\')}function h(t,e){if(f(e),t=a(t,e<0?0:0|d(e)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|d(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(c.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function E(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,o);if("number"==typeof e)return e&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,o){var i,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var f=-1;for(i=r;i<a;i++)if(u(t,i)===u(e,-1===f?0:i-f)){if(-1===f&&(f=i),i-f+1===c)return f*s}else-1!==f&&(i-=i-f),f=-1}else for(r+c>a&&(r=a-c),i=r;i>=0;i--){for(var h=!0,l=0;l<c;l++)if(u(t,i+l)!==u(e,l)){h=!1;break}if(h)return i}return-1}function w(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function m(t,e,r,n){return Z(z(e,t.length-r),t,r,n)}function v(t,e,r,n){return Z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return v(t,e,r,n)}function _(t,e,r,n){return Z(j(e),t,r,n)}function b(t,e,r,n){return Z(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,c,u=t[o],f=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=r)switch(h){case 1:u<128&&(f=u);break;case 2:128==(192&(i=t[o+1]))&&(c=(31&u)<<6|63&i)>127&&(f=c);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,h=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),o+=h}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),c.poolSize=8192,c._augment=function(t){return t.__proto__=c.prototype,t},c.from=function(t,e,r){return u(null,t,e,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(t,e,r){return function(t,e,r,n){return f(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},c.allocUnsafe=function(t){return h(null,t)},c.allocUnsafeSlow=function(t){return h(null,t)},c.isBuffer=function(t){return!(null==t||!t._isBuffer)},c.compare=function(t,e){if(!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!i(t))throw new TypeError(\'"list" argument must be an Array of Buffers\');if(0===t.length)return c.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=c.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(!c.isBuffer(s))throw new TypeError(\'"list" argument must be an Array of Buffers\');s.copy(n,o),o+=s.length}return n},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)y(this,e,e+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},c.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return F(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},c.prototype.compare=function(t,e,r,n,o){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),u=this.slice(n,o),f=t.slice(e,r),h=0;h<a;++h)if(u[h]!==f[h]){i=u[h],s=f[h];break}return i<s?-1:s<i?1:0},c.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},c.prototype.indexOf=function(t,e,r){return E(this,t,e,r,!0)},c.prototype.lastIndexOf=function(t,e,r){return E(this,t,e,r,!1)},c.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function F(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function N(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=B(t[i]);return o}function C(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,r,n,o,i){if(!c.isBuffer(t))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(e>o||e<i)throw new RangeError(\'"value" argument is out of bounds\');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function L(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function x(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return i||x(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return i||x(t,0,r,8),o.write(t,e,r,n,52,8),r+8}c.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),c.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=c.prototype;else{var o=e-t;r=new c(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},c.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},c.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},c.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},c.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},c.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||R(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},c.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),o.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),o.read(this,t,!1,52,8)},c.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},c.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||k(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},c.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,255,0),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);k(this,t,e,r,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},c.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);k(this,t,e,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,1,127,-128),c.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),c.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},c.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},c.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var s=c.isBuffer(t)?t:z(new c(t,n).toString()),a=s.length;for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var M=/[^+\\/0-9A-Za-z-_]/g;function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function z(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\\s+|\\s+$/g,"")}(t).replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Z(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(e,r(2))},function(t,e,r){(function(t){var r,n,o=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,function(t){t[t.EPERM=1]="EPERM",t[t.ENOENT=2]="ENOENT",t[t.EIO=5]="EIO",t[t.EBADF=9]="EBADF",t[t.EACCES=13]="EACCES",t[t.EBUSY=16]="EBUSY",t[t.EEXIST=17]="EEXIST",t[t.ENOTDIR=20]="ENOTDIR",t[t.EISDIR=21]="EISDIR",t[t.EINVAL=22]="EINVAL",t[t.EFBIG=27]="EFBIG",t[t.ENOSPC=28]="ENOSPC",t[t.EROFS=30]="EROFS",t[t.ENOTEMPTY=39]="ENOTEMPTY",t[t.ENOTSUP=95]="ENOTSUP"}(n=e.ErrorCode||(e.ErrorCode={})),e.ErrorStrings={},e.ErrorStrings[n.EPERM]="Operation not permitted.",e.ErrorStrings[n.ENOENT]="No such file or directory.",e.ErrorStrings[n.EIO]="Input/output error.",e.ErrorStrings[n.EBADF]="Bad file descriptor.",e.ErrorStrings[n.EACCES]="Permission denied.",e.ErrorStrings[n.EBUSY]="Resource busy or locked.",e.ErrorStrings[n.EEXIST]="File exists.",e.ErrorStrings[n.ENOTDIR]="File is not a directory.",e.ErrorStrings[n.EISDIR]="File is a directory.",e.ErrorStrings[n.EINVAL]="Invalid argument.",e.ErrorStrings[n.EFBIG]="File is too big.",e.ErrorStrings[n.ENOSPC]="No space left on disk.",e.ErrorStrings[n.EROFS]="Cannot modify a read-only file system.",e.ErrorStrings[n.ENOTEMPTY]="Directory is not empty.",e.ErrorStrings[n.ENOTSUP]="Operation is not supported.";var i=function(r){function i(t,o,i){void 0===o&&(o=e.ErrorStrings[t]);var s=r.call(this,o)||this;return s.syscall="",s.errno=t,s.code=n[t],s.path=i,s.stack=(new Error).stack,s.message="Error: "+s.code+": "+o+(s.path?", \'"+s.path+"\'":""),s}return o(i,r),i.fromJSON=function(t){var e=new i(0);return e.errno=t.errno,e.code=t.code,e.path=t.path,e.stack=t.stack,e.message=t.message,e},i.fromBuffer=function(t,e){return void 0===e&&(e=0),i.fromJSON(JSON.parse(t.toString("utf8",e+4,e+4+t.readUInt32LE(e))))},i.FileError=function(t,r){return new i(t,e.ErrorStrings[t],r)},i.ENOENT=function(t){return this.FileError(n.ENOENT,t)},i.EEXIST=function(t){return this.FileError(n.EEXIST,t)},i.EISDIR=function(t){return this.FileError(n.EISDIR,t)},i.ENOTDIR=function(t){return this.FileError(n.ENOTDIR,t)},i.EPERM=function(t){return this.FileError(n.EPERM,t)},i.ENOTEMPTY=function(t){return this.FileError(n.ENOTEMPTY,t)},i.prototype.toString=function(){return this.message},i.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},i.prototype.writeToBuffer=function(e,r){void 0===e&&(e=t.alloc(this.bufferSize())),void 0===r&&(r=0);var n=e.write(JSON.stringify(this.toJSON()),r+4);return e.writeUInt32LE(n,r),e},i.prototype.bufferSize=function(){return 4+t.byteLength(JSON.stringify(this.toJSON()))},i}(Error);e.ApiError=i}).call(e,r(0).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){(function(t){function r(t,e){for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}var n=/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/,o=function(t){return n.exec(t).slice(1)};function i(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}e.resolve=function(){for(var e="",n=!1,o=arguments.length-1;o>=-1&&!n;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,n="/"===s.charAt(0))}return(n?"/":"")+(e=r(i(e.split("/"),function(t){return!!t}),!n).join("/"))||"."},e.normalize=function(t){var n=e.isAbsolute(t),o="/"===s(t,-1);return(t=r(i(t.split("/"),function(t){return!!t}),!n).join("/"))||n||(t="."),t&&o&&(t+="/"),(n?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,r){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var o=n(t.split("/")),i=n(r.split("/")),s=Math.min(o.length,i.length),a=s,c=0;c<s;c++)if(o[c]!==i[c]){a=c;break}var u=[];for(c=a;c<o.length;c++)u.push("..");return(u=u.concat(i.slice(a))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=o(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},e.basename=function(t,e){var r=o(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},e.extname=function(t){return o(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}}).call(e,r(8))},function(t,e,r){(function(t){e.__esModule=!0;var n=r(1),o=r(19),i=r(3);function s(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function a(e){return e instanceof t?e:0===e.byteOffset&&e.byteLength===e.buffer.byteLength?c(e.buffer):t.from(e.buffer,e.byteOffset,e.byteLength)}function c(e){return t.from(e)}e.deprecationMessage=function(t,e,r){t&&console.warn("["+e+"] Direct file system constructor usage is deprecated for this file system, and will be removed in the next major version. Please use the \'"+e+".Create("+JSON.stringify(r)+", callback)\' method instead. See https://github.com/jvilk/BrowserFS/issues/176 for more details.")},e.isIE="undefined"!=typeof navigator&&!(!/(msie) ([\\w.]+)/.exec(navigator.userAgent.toLowerCase())&&-1===navigator.userAgent.indexOf("Trident")),e.isWebWorker="undefined"==typeof window,e.fail=function(){throw new Error("BFS has reached an impossible code path; please file a bug.")},e.mkdirpSync=function t(e,r,n){n.existsSync(e)||(t(i.dirname(e),r,n),n.mkdirSync(e,r))},e.buffer2ArrayBuffer=function(t){var e=s(t),r=e.byteOffset,n=e.byteLength;return 0===r&&n===e.buffer.byteLength?e.buffer:e.buffer.slice(r,r+n)},e.buffer2Uint8array=s,e.arrayish2Buffer=function(e){return e instanceof t?e:e instanceof Uint8Array?a(e):t.from(e)},e.uint8Array2Buffer=a,e.arrayBuffer2Buffer=c,e.copyingSlice=function(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=t.length),e<0||r<0||r>t.length||e>r)throw new TypeError("Invalid slice bounds on buffer of length "+t.length+": ["+e+", "+r+"]");if(0===t.length)return f();var n=s(t),o=t[0],i=(o+1)%255;return t[0]=i,n[0]===i?(n[0]=o,a(n.slice(e,r))):(t[0]=o,a(n.subarray(e,r)))};var u=null;function f(){return u||(u=t.alloc(0))}e.emptyBuffer=f,e.bufferValidator=function(e,r){t.isBuffer(e)?r():r(new n.ApiError(n.ErrorCode.EINVAL,"option must be a Buffer."))},e.checkOptions=function(t,e,r){var i=t.Options,s=t.Name,a=0,c=!1,u=!1;function f(t){c||(t&&(c=!0,r(t)),0==--a&&u&&r())}var h=function(t){if(i.hasOwnProperty(t)){var u=i[t],h=e[t];if(null==h){if(!u.optional){var l=Object.keys(e).filter(function(t){return!(t in i)}).map(function(e){return{str:e,distance:o.default(t,e)}}).filter(function(t){return t.distance<5}).sort(function(t,e){return t.distance-e.distance});return c?{value:void 0}:(c=!0,{value:r(new n.ApiError(n.ErrorCode.EINVAL,"["+s+"] Required option \'"+t+"\' not provided."+(l.length>0?" You provided unrecognized option \'"+l[0].str+"\'; perhaps you meant to type \'"+t+"\'.":"")+"\\nOption description: "+u.description))})}}else{if(!(Array.isArray(u.type)?-1!==u.type.indexOf(typeof h):typeof h===u.type))return c?{value:void 0}:(c=!0,{value:r(new n.ApiError(n.ErrorCode.EINVAL,"["+s+"] Value provided for option "+t+" is not the proper type. Expected "+(Array.isArray(u.type)?"one of {"+u.type.join(", ")+"}":u.type)+", but received "+typeof h+"\\nOption description: "+u.description))});u.validator&&(a++,u.validator(h,f))}}};for(var l in i){var d=h(l);if("object"==typeof d)return d.value}u=!0,0!==a||c||r()}}).call(e,r(0).Buffer)},function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)o(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,r,n,o){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),o);else for(var i=0;i<n;i++)t[o+i]=e[r+i]},flattenChunks:function(t){var e,r,n,o,i,s;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(s=new Uint8Array(n),o=0,e=0,r=t.length;e<r;e++)i=t[e],s.set(i,o),o+=i.length;return s}},s={arraySet:function(t,e,r,n,o){for(var i=0;i<n;i++)t[o+i]=e[r+i]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,s))},e.setTyped(n)},function(t,e,r){(function(t){var r;e.__esModule=!0,function(t){t[t.FILE=32768]="FILE",t[t.DIRECTORY=16384]="DIRECTORY",t[t.SYMLINK=40960]="SYMLINK"}(r=e.FileType||(e.FileType={}));var n=function(){function e(t,e,n,o,i,s){if(void 0===o&&(o=new Date),void 0===i&&(i=new Date),void 0===s&&(s=new Date),this.size=e,this.atime=o,this.mtime=i,this.ctime=s,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.fileData=null,n)this.mode=n;else switch(t){case r.FILE:this.mode=420;break;case r.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(e/512),this.mode<4096&&(this.mode|=t)}return e.fromBuffer=function(t){var r=t.readUInt32LE(0),n=t.readUInt32LE(4),o=t.readDoubleLE(8),i=t.readDoubleLE(16),s=t.readDoubleLE(24);return new e(61440&n,r,4095&n,new Date(o),new Date(i),new Date(s))},e.prototype.toBuffer=function(){var e=t.alloc(32);return e.writeUInt32LE(this.size,0),e.writeUInt32LE(this.mode,4),e.writeDoubleLE(this.atime.getTime(),8),e.writeDoubleLE(this.mtime.getTime(),16),e.writeDoubleLE(this.ctime.getTime(),24),e},e.prototype.clone=function(){return new e(61440&this.mode,this.size,4095&this.mode,this.atime,this.mtime,this.ctime)},e.prototype.isFile=function(){return(61440&this.mode)===r.FILE},e.prototype.isDirectory=function(){return(61440&this.mode)===r.DIRECTORY},e.prototype.isSymbolicLink=function(){return(61440&this.mode)===r.SYMLINK},e.prototype.chmod=function(t){this.mode=61440&this.mode|t},e.prototype.isSocket=function(){return!1},e.prototype.isBlockDevice=function(){return!1},e.prototype.isCharacterDevice=function(){return!1},e.prototype.isFIFO=function(){return!1},e}();e.default=n}).call(e,r(0).Buffer)},function(t,e,r){e.__esModule=!0;var n,o=r(1);!function(t){t[t.NOP=0]="NOP",t[t.THROW_EXCEPTION=1]="THROW_EXCEPTION",t[t.TRUNCATE_FILE=2]="TRUNCATE_FILE",t[t.CREATE_FILE=3]="CREATE_FILE"}(n=e.ActionType||(e.ActionType={}));var i=function(){function t(e){if(this.flagStr=e,t.validFlagStrs.indexOf(e)<0)throw new o.ApiError(o.ErrorCode.EINVAL,"Invalid flag: "+e)}return t.getFileFlag=function(e){return t.flagCache.hasOwnProperty(e)?t.flagCache[e]:t.flagCache[e]=new t(e)},t.prototype.getFlagString=function(){return this.flagStr},t.prototype.isReadable=function(){return-1!==this.flagStr.indexOf("r")||-1!==this.flagStr.indexOf("+")},t.prototype.isWriteable=function(){return-1!==this.flagStr.indexOf("w")||-1!==this.flagStr.indexOf("a")||-1!==this.flagStr.indexOf("+")},t.prototype.isTruncating=function(){return-1!==this.flagStr.indexOf("w")},t.prototype.isAppendable=function(){return-1!==this.flagStr.indexOf("a")},t.prototype.isSynchronous=function(){return-1!==this.flagStr.indexOf("s")},t.prototype.isExclusive=function(){return-1!==this.flagStr.indexOf("x")},t.prototype.pathExistsAction=function(){return this.isExclusive()?n.THROW_EXCEPTION:this.isTruncating()?n.TRUNCATE_FILE:n.NOP},t.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&"r+"!==this.flagStr?n.CREATE_FILE:n.THROW_EXCEPTION},t}();i.flagCache={},i.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"],e.FileFlag=i},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],f=!1,h=-1;function l(){f&&c&&(f=!1,c.length?u=c.concat(u):h=-1,u.length&&d())}function d(){if(!f){var t=a(l);f=!0;for(var e=u.length;e;){for(c=u,u=[];++h<e;)c&&c[h].run();h=-1,e=u.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){e.__esModule=!0;var n=r(10),o=new n.default,i={},s=n.default.prototype;Object.keys(s).forEach(function(t){"function"==typeof o[t]?i[t]=function(){return o[t].apply(o,arguments)}:i[t]=o[t]}),i.changeFSModule=function(t){o=t},i.getFSModule=function(){return o},i.FS=n.default,e.default=i},function(t,e,r){(function(t){e.__esModule=!0;var n=r(1),o=r(7),i=r(3),s=r(6),a=function(t,e){return t};function c(t){if(t)return t;throw new n.ApiError(n.ErrorCode.EIO,"Initialize BrowserFS with a file system using BrowserFS.initialize(filesystem)")}function u(t,e){switch(typeof t){case"number":return t;case"string":var r=parseInt(t,8);return isNaN(r)?e:r;default:return e}}function f(t){if(t instanceof Date)return t;if("number"==typeof t)return new Date(1e3*t);throw new n.ApiError(n.ErrorCode.EINVAL,"Invalid time.")}function h(t){if(t.indexOf("\\0")>=0)throw new n.ApiError(n.ErrorCode.EINVAL,"Path must be a string without null bytes.");if(""===t)throw new n.ApiError(n.ErrorCode.EINVAL,"Path must not be empty.");return i.resolve(t)}function l(t,e,r,n){switch(typeof t){case"object":return{encoding:void 0!==t.encoding?t.encoding:e,flag:void 0!==t.flag?t.flag:r,mode:u(t.mode,n)};case"string":return{encoding:t,flag:r,mode:n};default:return{encoding:e,flag:r,mode:n}}}function d(){}var p=function(){function e(){this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1,this.root=null,this.fdMap={},this.nextFd=100}return e.prototype.initialize=function(t){if(!t.constructor.isAvailable())throw new n.ApiError(n.ErrorCode.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=t},e.prototype._toUnixTimestamp=function(t){if("number"==typeof t)return t;if(t instanceof Date)return t.getTime()/1e3;throw new Error("Cannot parse time: "+t)},e.prototype.getRootFS=function(){return this.root?this.root:null},e.prototype.rename=function(t,e,r){void 0===r&&(r=d);var n=a(r,1);try{c(this.root).rename(h(t),h(e),n)}catch(t){n(t)}},e.prototype.renameSync=function(t,e){c(this.root).renameSync(h(t),h(e))},e.prototype.exists=function(t,e){void 0===e&&(e=d);var r=a(e,1);try{return c(this.root).exists(h(t),r)}catch(t){return r(!1)}},e.prototype.existsSync=function(t){try{return c(this.root).existsSync(h(t))}catch(t){return!1}},e.prototype.stat=function(t,e){void 0===e&&(e=d);var r=a(e,2);try{return c(this.root).stat(h(t),!1,r)}catch(t){return r(t)}},e.prototype.statSync=function(t){return c(this.root).statSync(h(t),!1)},e.prototype.lstat=function(t,e){void 0===e&&(e=d);var r=a(e,2);try{return c(this.root).stat(h(t),!0,r)}catch(t){return r(t)}},e.prototype.lstatSync=function(t){return c(this.root).statSync(h(t),!0)},e.prototype.truncate=function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=d);var o=0;"function"==typeof e?r=e:"number"==typeof e&&(o=e);var i=a(r,1);try{if(o<0)throw new n.ApiError(n.ErrorCode.EINVAL);return c(this.root).truncate(h(t),o,i)}catch(t){return i(t)}},e.prototype.truncateSync=function(t,e){if(void 0===e&&(e=0),e<0)throw new n.ApiError(n.ErrorCode.EINVAL);return c(this.root).truncateSync(h(t),e)},e.prototype.unlink=function(t,e){void 0===e&&(e=d);var r=a(e,1);try{return c(this.root).unlink(h(t),r)}catch(t){return r(t)}},e.prototype.unlinkSync=function(t){return c(this.root).unlinkSync(h(t))},e.prototype.open=function(t,e,r,n){var i=this;void 0===n&&(n=d);var s=u(r,420),f=a(n="function"==typeof r?r:n,2);try{c(this.root).open(h(t),o.FileFlag.getFileFlag(e),s,function(t,e){e?f(t,i.getFdForFile(e)):f(t)})}catch(t){f(t)}},e.prototype.openSync=function(t,e,r){return void 0===r&&(r=420),this.getFdForFile(c(this.root).openSync(h(t),o.FileFlag.getFileFlag(e),u(r,420)))},e.prototype.readFile=function(t,e,r){void 0===e&&(e={}),void 0===r&&(r=d);var i=l(e,null,"r",null),s=a(r="function"==typeof e?e:r,2);try{var u=o.FileFlag.getFileFlag(i.flag);return u.isReadable()?c(this.root).readFile(h(t),i.encoding,u,s):s(new n.ApiError(n.ErrorCode.EINVAL,"Flag passed to readFile must allow for reading."))}catch(t){return s(t)}},e.prototype.readFileSync=function(t,e){void 0===e&&(e={});var r=l(e,null,"r",null),i=o.FileFlag.getFileFlag(r.flag);if(!i.isReadable())throw new n.ApiError(n.ErrorCode.EINVAL,"Flag passed to readFile must allow for reading.");return c(this.root).readFileSync(h(t),r.encoding,i)},e.prototype.writeFile=function(t,e,r,i){void 0===r&&(r={}),void 0===i&&(i=d);var s=l(r,"utf8","w",420),u=a(i="function"==typeof r?r:i,1);try{var f=o.FileFlag.getFileFlag(s.flag);return f.isWriteable()?c(this.root).writeFile(h(t),e,s.encoding,f,s.mode,u):u(new n.ApiError(n.ErrorCode.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(t){return u(t)}},e.prototype.writeFileSync=function(t,e,r){var i=l(r,"utf8","w",420),s=o.FileFlag.getFileFlag(i.flag);if(!s.isWriteable())throw new n.ApiError(n.ErrorCode.EINVAL,"Flag passed to writeFile must allow for writing.");return c(this.root).writeFileSync(h(t),e,i.encoding,s,i.mode)},e.prototype.appendFile=function(t,e,r,i){void 0===i&&(i=d);var s=l(r,"utf8","a",420),u=a(i="function"==typeof r?r:i,1);try{var f=o.FileFlag.getFileFlag(s.flag);if(!f.isAppendable())return u(new n.ApiError(n.ErrorCode.EINVAL,"Flag passed to appendFile must allow for appending."));c(this.root).appendFile(h(t),e,s.encoding,f,s.mode,u)}catch(t){u(t)}},e.prototype.appendFileSync=function(t,e,r){var i=l(r,"utf8","a",420),s=o.FileFlag.getFileFlag(i.flag);if(!s.isAppendable())throw new n.ApiError(n.ErrorCode.EINVAL,"Flag passed to appendFile must allow for appending.");return c(this.root).appendFileSync(h(t),e,i.encoding,s,i.mode)},e.prototype.fstat=function(t,e){void 0===e&&(e=d);var r=a(e,2);try{this.fd2file(t).stat(r)}catch(t){r(t)}},e.prototype.fstatSync=function(t){return this.fd2file(t).statSync()},e.prototype.close=function(t,e){var r=this;void 0===e&&(e=d);var n=a(e,1);try{this.fd2file(t).close(function(e){e||r.closeFd(t),n(e)})}catch(t){n(t)}},e.prototype.closeSync=function(t){this.fd2file(t).closeSync(),this.closeFd(t)},e.prototype.ftruncate=function(t,e,r){void 0===r&&(r=d);var o="number"==typeof e?e:0,i=a(r="function"==typeof e?e:r,1);try{var s=this.fd2file(t);if(o<0)throw new n.ApiError(n.ErrorCode.EINVAL);s.truncate(o,i)}catch(t){i(t)}},e.prototype.ftruncateSync=function(t,e){void 0===e&&(e=0);var r=this.fd2file(t);if(e<0)throw new n.ApiError(n.ErrorCode.EINVAL);r.truncateSync(e)},e.prototype.fsync=function(t,e){void 0===e&&(e=d);var r=a(e,1);try{this.fd2file(t).sync(r)}catch(t){r(t)}},e.prototype.fsyncSync=function(t){this.fd2file(t).syncSync()},e.prototype.fdatasync=function(t,e){void 0===e&&(e=d);var r=a(e,1);try{this.fd2file(t).datasync(r)}catch(t){r(t)}},e.prototype.fdatasyncSync=function(t){this.fd2file(t).datasyncSync()},e.prototype.write=function(e,r,o,i,s,c){void 0===c&&(c=d);var u,f,h,l=null;if("string"==typeof r){var p="utf8";switch(typeof o){case"function":c=o;break;case"number":l=o,p="string"==typeof i?i:"utf8",c="function"==typeof s?s:c;break;default:return(c="function"==typeof i?i:"function"==typeof s?s:c)(new n.ApiError(n.ErrorCode.EINVAL,"Invalid arguments."))}f=0,h=(u=t.from(r,p)).length}else u=r,f=o,h=i,l="number"==typeof s?s:null,c="function"==typeof s?s:c;var y=a(c,3);try{var E=this.fd2file(e);null==l&&(l=E.getPos()),E.write(u,f,h,l,y)}catch(t){y(t)}},e.prototype.writeSync=function(e,r,n,o,i){var s,a,c,u=0;if("string"==typeof r){c="number"==typeof n?n:null;var f="string"==typeof o?o:"utf8";u=0,a=(s=t.from(r,f)).length}else s=r,u=n,a=o,c="number"==typeof i?i:null;var h=this.fd2file(e);return null==c&&(c=h.getPos()),h.writeSync(s,u,a,c)},e.prototype.read=function(e,r,n,o,i,s){var c,u,f,h,l;if(void 0===s&&(s=d),"number"==typeof r){f=r,c=n;var p=o;s="function"==typeof i?i:s,u=0,h=t.alloc(f),l=a(function(t,e,r){if(t)return s(t);s(t,r.toString(p),e)},3)}else h=r,u=n,f=o,c=i,l=a(s,3);try{var y=this.fd2file(e);null==c&&(c=y.getPos()),y.read(h,u,f,c,l)}catch(t){l(t)}},e.prototype.readSync=function(e,r,n,o,i){var s,a,c,u,f=!1,h="utf8";"number"==typeof r?(c=r,u=n,h=o,a=0,s=t.alloc(c),f=!0):(s=r,a=n,c=o,u=i);var l=this.fd2file(e);null==u&&(u=l.getPos());var d=l.readSync(s,a,c,u);return f?[s.toString(h),d]:d},e.prototype.fchown=function(t,e,r,n){void 0===n&&(n=d);var o=a(n,1);try{this.fd2file(t).chown(e,r,o)}catch(t){o(t)}},e.prototype.fchownSync=function(t,e,r){this.fd2file(t).chownSync(e,r)},e.prototype.fchmod=function(t,e,r){var n=a(r,1);try{var o="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmod(o,n)}catch(t){n(t)}},e.prototype.fchmodSync=function(t,e){var r="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmodSync(r)},e.prototype.futimes=function(t,e,r,n){void 0===n&&(n=d);var o=a(n,1);try{var i=this.fd2file(t);"number"==typeof e&&(e=new Date(1e3*e)),"number"==typeof r&&(r=new Date(1e3*r)),i.utimes(e,r,o)}catch(t){o(t)}},e.prototype.futimesSync=function(t,e,r){this.fd2file(t).utimesSync(f(e),f(r))},e.prototype.rmdir=function(t,e){void 0===e&&(e=d);var r=a(e,1);try{t=h(t),c(this.root).rmdir(t,r)}catch(t){r(t)}},e.prototype.rmdirSync=function(t){return t=h(t),c(this.root).rmdirSync(t)},e.prototype.mkdir=function(t,e,r){void 0===r&&(r=d),"function"==typeof e&&(r=e,e=511);var n=a(r,1);try{t=h(t),c(this.root).mkdir(t,e,n)}catch(t){n(t)}},e.prototype.mkdirSync=function(t,e){c(this.root).mkdirSync(h(t),u(e,511))},e.prototype.readdir=function(t,e){void 0===e&&(e=d);var r=a(e,2);try{t=h(t),c(this.root).readdir(t,r)}catch(t){r(t)}},e.prototype.readdirSync=function(t){return t=h(t),c(this.root).readdirSync(t)},e.prototype.link=function(t,e,r){void 0===r&&(r=d);var n=a(r,1);try{t=h(t),e=h(e),c(this.root).link(t,e,n)}catch(t){n(t)}},e.prototype.linkSync=function(t,e){return t=h(t),e=h(e),c(this.root).linkSync(t,e)},e.prototype.symlink=function(t,e,r,o){void 0===o&&(o=d);var i="string"==typeof r?r:"file",s=a(o="function"==typeof r?r:o,1);try{if("file"!==i&&"dir"!==i)return s(new n.ApiError(n.ErrorCode.EINVAL,"Invalid type: "+i));t=h(t),e=h(e),c(this.root).symlink(t,e,i,s)}catch(t){s(t)}},e.prototype.symlinkSync=function(t,e,r){if(r){if("file"!==r&&"dir"!==r)throw new n.ApiError(n.ErrorCode.EINVAL,"Invalid type: "+r)}else r="file";return t=h(t),e=h(e),c(this.root).symlinkSync(t,e,r)},e.prototype.readlink=function(t,e){void 0===e&&(e=d);var r=a(e,2);try{t=h(t),c(this.root).readlink(t,r)}catch(t){r(t)}},e.prototype.readlinkSync=function(t){return t=h(t),c(this.root).readlinkSync(t)},e.prototype.chown=function(t,e,r,n){void 0===n&&(n=d);var o=a(n,1);try{t=h(t),c(this.root).chown(t,!1,e,r,o)}catch(t){o(t)}},e.prototype.chownSync=function(t,e,r){t=h(t),c(this.root).chownSync(t,!1,e,r)},e.prototype.lchown=function(t,e,r,n){void 0===n&&(n=d);var o=a(n,1);try{t=h(t),c(this.root).chown(t,!0,e,r,o)}catch(t){o(t)}},e.prototype.lchownSync=function(t,e,r){t=h(t),c(this.root).chownSync(t,!0,e,r)},e.prototype.chmod=function(t,e,r){void 0===r&&(r=d);var o=a(r,1);try{var i=u(e,-1);if(i<0)throw new n.ApiError(n.ErrorCode.EINVAL,"Invalid mode.");c(this.root).chmod(h(t),!1,i,o)}catch(t){o(t)}},e.prototype.chmodSync=function(t,e){var r=u(e,-1);if(r<0)throw new n.ApiError(n.ErrorCode.EINVAL,"Invalid mode.");t=h(t),c(this.root).chmodSync(t,!1,r)},e.prototype.lchmod=function(t,e,r){void 0===r&&(r=d);var o=a(r,1);try{var i=u(e,-1);if(i<0)throw new n.ApiError(n.ErrorCode.EINVAL,"Invalid mode.");c(this.root).chmod(h(t),!0,i,o)}catch(t){o(t)}},e.prototype.lchmodSync=function(t,e){var r=u(e,-1);if(r<1)throw new n.ApiError(n.ErrorCode.EINVAL,"Invalid mode.");c(this.root).chmodSync(h(t),!0,r)},e.prototype.utimes=function(t,e,r,n){void 0===n&&(n=d);var o=a(n,1);try{c(this.root).utimes(h(t),f(e),f(r),o)}catch(t){o(t)}},e.prototype.utimesSync=function(t,e,r){c(this.root).utimesSync(h(t),f(e),f(r))},e.prototype.realpath=function(t,e,r){void 0===r&&(r=d);var n="object"==typeof e?e:{},o=a(r="function"==typeof e?e:d,2);try{t=h(t),c(this.root).realpath(t,n,o)}catch(t){o(t)}},e.prototype.realpathSync=function(t,e){return void 0===e&&(e={}),t=h(t),c(this.root).realpathSync(t,e)},e.prototype.watchFile=function(t,e,r){throw void 0===r&&(r=d),new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.unwatchFile=function(t,e){throw void 0===e&&(e=d),new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.watch=function(t,e,r){throw void 0===r&&(r=d),new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.access=function(t,e,r){throw void 0===r&&(r=d),new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.accessSync=function(t,e){throw new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.createReadStream=function(t,e){throw new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.createWriteStream=function(t,e){throw new n.ApiError(n.ErrorCode.ENOTSUP)},e.prototype.wrapCallbacks=function(t){a=t},e.prototype.getFdForFile=function(t){var e=this.nextFd++;return this.fdMap[e]=t,e},e.prototype.fd2file=function(t){var e=this.fdMap[t];if(e)return e;throw new n.ApiError(n.ErrorCode.EBADF,"Invalid file descriptor.")},e.prototype.closeFd=function(t){delete this.fdMap[t]},e}();p.Stats=s.default,e.default=p}).call(e,r(0).Buffer)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.Event=class{constructor(){this.handlers=[]}on(t){return this.handlers.push(t),{dispose:()=>{this.handlers=this.handlers.filter(e=>e!==t)}}}fire(t){for(const e of this.handlers)e(t)}dispose(){this.handlers=[]}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(13);let o=null;onmessage=(t=>{const e=t.data;switch(e.command){case"start-webworker":const t=e.opts,r=t=>new Promise(e=>{importScripts(t),e()}),i=t=>fetch(t).then(t=>t.ok&&t.json());(o=new n.InProcessTransport(()=>n.loadJsOrWasm(t,r),n.loadBufferFromURLCached(t.libraryZip),t.memoryMB||256,()=>i(t.libraryZip.slice(0,-3)+"olean_map.json")).connect()).jsonMessage.on(t=>postMessage(t)),o.error.on(t=>postMessage({response:"webworker-error",error:t}));break;default:o&&o.send(e)}}),e.default={}},function(t,e,r){"use strict";(function(t){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,a)}c((n=n.apply(t,e||[])).next())})},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=o(r(17)),s=o(r(10)),a=o(r(39)),c=r(40);e.InProcessTransport=class{constructor(t,e,r,n){this.loadJs=t,this.libraryZip=e,this.memoryMB=r,this.loadOlean=n}connect(){if(self.Module)throw new Error("cannot use more than one instance of InProcessTransport");self.Module={},Module.noExitRuntime=!0,Module.preRun=[()=>console.log("starting lean...")];const t=new u;Module.print=(e=>{try{const r=JSON.parse(e);if(this.oleanMap&&this.info)if(r.record&&r.record.source&&r.record.source.file)r.record.source.file=this.getUrl(r.record.source.file);else if(r.results&&!r.file)for(let t=0;t<r.results.length;t++)r.results[t].source&&r.results[t].source.file&&(r.results[t].source.file=this.getUrl(r.results[t].source.file));else if(r.completions)for(let t=0;t<r.completions.length;t++)r.completions[t].source&&r.completions[t].source.file&&(r.completions[t].source.file=this.getUrl(r.completions[t].source.file));t.jsonMessage.fire(r)}catch(r){t.error.fire({error:"connect",message:`cannot parse: ${e}, error: ${r}`})}}),Module.printErr=(e=>t.error.fire({error:"stderr",chunk:e})),Module.TOTAL_MEMORY=1024*this.memoryMB*1024;const e=new Promise((t,e)=>Module.onRuntimeInitialized=t);return console.log("downloading lean..."),t.module=this.init(e),t.module.catch(e=>t.error.fire({error:"connect",message:`could not start emscripten version of lean: ${e}`})),t}getUrl(t){const e=t.slice(9,-5),r=this.info[this.oleanMap[e]];return r?r+e+".lean":t}init(t){return n(this,void 0,void 0,function*(){const[e,r,n,o]=yield Promise.all([this.loadJs(),t,this.libraryZip,this.loadOlean()]);if(n){const t=yield new Promise((t,e)=>i.default.Create({zipData:n.zipBuffer},(r,n)=>r?e(r):t(n))),e=new s.default;e.initialize(t);const r=new a.default(Module.FS,Module.PATH,Module.ERRNO_CODES,e);Module.FS.createFolder(Module.FS.root,"library",!0,!0),Module.FS.mount(r,{root:"/"},"/library"),this.info=n.urls}return this.oleanMap=o,(Module.lean_init||Module._lean_init)(),console.log("lean server initialized."),Module})}};class u{constructor(){this.error=new c.Event,this.jsonMessage=new c.Event,this.alive=!0}send(t){this.module.then(e=>{const r=JSON.stringify(t),n=(lengthBytesUTF8||e.lengthBytesUTF8)(r)+1,o=e._malloc(n);(stringToUTF8||e.stringToUTF8)(r,o,n),(e.lean_process_request||e._lean_process_request)(o),e._free(o)})}dispose(){}}function f(t){return new Promise((e,r)=>{const n=new XMLHttpRequest;n.responseType="text",n.open("GET",t),n.onloadend=(r=>{200===n.status?e(n.responseText):(console.log(`could not fetch ${t}: http code ${n.status} ${n.statusText}`),e(null))}),n.onerror=(r=>{console.log(`error fetching ${t}: ${r}`),e(null)}),n.send()})}function h(e,r){return new Promise((n,o)=>{const i=new XMLHttpRequest;i.responseType="arraybuffer",i.open("GET",e),i.onloadend=(s=>{200===i.status?r?f(e.slice(0,-3)+"info.json").then(e=>n({zipBuffer:new t(i.response),urls:JSON.parse(e)})):n({zipBuffer:new t(i.response)}):o(`could not fetch ${e}: http code ${i.status} ${i.statusText}`)}),i.onerror=(t=>o(t)),i.send()})}e.loadJsBrowser=function(t){return new Promise((t,e)=>{document.body?t():window.onload=t}).then(()=>new Promise((e,r)=>{const n=document.createElement("script");n.onload=e,n.src=t,document.body.appendChild(n)}))},e.loadJsOrWasm=function(t,e){if(self.WebAssembly&&t.webassemblyJs&&t.webassemblyWasm)return Module.locateFile=(()=>t.webassemblyWasm),e(t.webassemblyJs);if(t.javascript)return e(t.javascript);throw new Error(`cannot load lean.js from urls in ${t}`)},e.loadBufferFromURL=h,e.loadBufferFromURLCached=function(e){if(!e)return null;if(!e.toLowerCase().endsWith(".zip"))return null;if(!("indexedDB"in self))return h(e,!0);const r=e.split("/").pop().split(".")[0],n=f(e.slice(0,-3)+"info.json"),o=new Promise((t,e)=>{const r=indexedDB.open("leanlibrary",3);r.onsuccess=(e=>{t(r.result)}),r.onerror=(t=>{console.log("failed to open indexedDB"),e(r.error)}),r.onupgradeneeded=(t=>{const{result:e}=r,n=r.result.objectStoreNames;for(let t=0;t<n.length;t++)e.deleteObjectStore(n[t]);e.createObjectStore("library"),e.createObjectStore("meta")})}),i=o.then(t=>new Promise((e,n)=>{const o=t.transaction("meta").objectStore("meta").get(r);o.onsuccess=(t=>{e(o.result)}),o.onerror=(t=>{console.log(`error getting info.json for ${r} from cache`),n(o.error)})}));return Promise.all([n,o,i]).then(([n,o,i])=>{if(!i||i!==n){const t=h(e),i=new Promise((t,e)=>{const i=o.transaction("meta","readwrite").objectStore("meta").put(n,r);i.onsuccess=(e=>{t(i.result)}),i.onerror=(t=>{console.log(`error saving info.json for ${r} to cache`,t),e(i.error)})});return Promise.all([t,i]).then(([t,e])=>new Promise((e,i)=>{const s=o.transaction("library","readwrite").objectStore("library").put(t.zipBuffer,r);s.onsuccess=(r=>{e({zipBuffer:t.zipBuffer,urls:JSON.parse(n)})}),s.onerror=(t=>{console.log(`error saving ${r} to cache`,t),i(s.error)})}))}return new Promise((e,i)=>{const s=o.transaction("library").objectStore("library").get(r);s.onsuccess=(r=>{e({zipBuffer:new t(s.result),urls:JSON.parse(n)})}),s.onerror=(t=>{console.log(`error getting ${r} from cache`,t),i(s.error)})})},t=>(console.log(`error in caching: ${t}, falling back to uncached download`),h(e,!0)))}}).call(e,r(0).Buffer)},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=u(t),n=r[0],s=r[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,n,s)),c=0,f=s>0?n-4:n,h=0;h<f;h+=4)e=o[t.charCodeAt(h)]<<18|o[t.charCodeAt(h+1)]<<12|o[t.charCodeAt(h+2)]<<6|o[t.charCodeAt(h+3)],a[c++]=e>>16&255,a[c++]=e>>8&255,a[c++]=255&e;2===s&&(e=o[t.charCodeAt(h)]<<2|o[t.charCodeAt(h+1)]>>4,a[c++]=255&e);1===s&&(e=o[t.charCodeAt(h)]<<10|o[t.charCodeAt(h+1)]<<4|o[t.charCodeAt(h+2)]>>2,a[c++]=e>>8&255,a[c++]=255&e);return a},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],s=0,a=r-o;s<a;s+=16383)i.push(f(t,s,s+16383>a?a:s+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var o,i,s=[],a=e;a<r;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,c=(1<<a)-1,u=c>>1,f=-7,h=r?o-1:0,l=r?-1:1,d=t[e+h];for(h+=l,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=256*i+t[e+h],h+=l,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=256*s+t[e+h],h+=l,f-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=u}return(d?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,c,u=8*i-o-1,f=(1<<u)-1,h=f>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?l/c:l*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*c-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[r+d]=255&a,d+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[r+d]=255&s,d+=p,s/=256,u-=8);t[r+d-p]|=128*y}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});e.__esModule=!0;var i,s=r(1),a=r(6),c=r(18),u=r(7),f=r(20),h=r(4),l=r(22),d=r(23),p=r(27).inflateRaw,y=r(38),E={};function g(t,e){return new Date(1980+(e>>9),(e>>5&15)-1,31&e,t>>11,t>>5&63,31&t)}function w(t,e,r,n){return 0===n?"":e?t.toString("utf8",r,r+n):l.default.byte2str(t.slice(r,r+n))}!function(t){t[t.MSDOS=0]="MSDOS",t[t.AMIGA=1]="AMIGA",t[t.OPENVMS=2]="OPENVMS",t[t.UNIX=3]="UNIX",t[t.VM_CMS=4]="VM_CMS",t[t.ATARI_ST=5]="ATARI_ST",t[t.OS2_HPFS=6]="OS2_HPFS",t[t.MAC=7]="MAC",t[t.Z_SYSTEM=8]="Z_SYSTEM",t[t.CP_M=9]="CP_M",t[t.NTFS=10]="NTFS",t[t.MVS=11]="MVS",t[t.VSE=12]="VSE",t[t.ACORN_RISC=13]="ACORN_RISC",t[t.VFAT=14]="VFAT",t[t.ALT_MVS=15]="ALT_MVS",t[t.BEOS=16]="BEOS",t[t.TANDEM=17]="TANDEM",t[t.OS_400=18]="OS_400",t[t.OSX=19]="OSX"}(e.ExternalFileAttributeType||(e.ExternalFileAttributeType={})),function(t){t[t.STORED=0]="STORED",t[t.SHRUNK=1]="SHRUNK",t[t.REDUCED_1=2]="REDUCED_1",t[t.REDUCED_2=3]="REDUCED_2",t[t.REDUCED_3=4]="REDUCED_3",t[t.REDUCED_4=5]="REDUCED_4",t[t.IMPLODE=6]="IMPLODE",t[t.DEFLATE=8]="DEFLATE",t[t.DEFLATE64=9]="DEFLATE64",t[t.TERSE_OLD=10]="TERSE_OLD",t[t.BZIP2=12]="BZIP2",t[t.LZMA=14]="LZMA",t[t.TERSE_NEW=18]="TERSE_NEW",t[t.LZ77=19]="LZ77",t[t.WAVPACK=97]="WAVPACK",t[t.PPMD=98]="PPMD"}(i=e.CompressionMethod||(e.CompressionMethod={}));var m=function(){function t(t){if(this.data=t,67324752!==t.readUInt32LE(0))throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))}return t.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},t.prototype.flags=function(){return this.data.readUInt16LE(6)},t.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},t.prototype.lastModFileTime=function(){return g(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},t.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},t.prototype.crc32=function(){return this.data.readUInt32LE(14)},t.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},t.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},t.prototype.fileName=function(){return w(this.data,this.useUTF8(),30,this.fileNameLength())},t.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},t.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},t.prototype.useUTF8=function(){return 2048==(2048&this.flags())},t}();e.FileHeader=m;var v=function(){function t(t,e,r){this.header=t,this.record=e,this.data=r}return t.prototype.decompress=function(){var t=this.header.compressionMethod(),e=E[t];if(e)return e(this.data,this.record.compressedSize(),this.record.uncompressedSize(),this.record.flag());var r=i[t];throw r||(r="Unknown: "+t),new s.ApiError(s.ErrorCode.EINVAL,"Invalid compression method on file \'"+this.header.fileName()+"\': "+r)},t.prototype.getHeader=function(){return this.header},t.prototype.getRecord=function(){return this.record},t.prototype.getRawData=function(){return this.data},t}();e.FileData=v;var S=function(){function t(t){this.data=t}return t.prototype.crc32=function(){return this.data.readUInt32LE(0)},t.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},t.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)},t}();e.DataDescriptor=S;var _=function(){function t(t){if(this.data=t,134630224!==this.data.readUInt32LE(0))throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))}return t.prototype.length=function(){return this.data.readUInt32LE(4)},t.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())},t}();e.ArchiveExtraDataRecord=_;var b=function(){function t(t){if(this.data=t,84233040!==this.data.readUInt32LE(0))throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))}return t.prototype.size=function(){return this.data.readUInt16LE(4)},t.prototype.signatureData=function(){return this.data.slice(6,6+this.size())},t}();e.DigitalSignature=b;var A=function(){function t(t,e){if(this.zipData=t,this.data=e,33639248!==this.data.readUInt32LE(0))throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()}return t.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},t.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},t.prototype.flag=function(){return this.data.readUInt16LE(8)},t.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},t.prototype.lastModFileTime=function(){return g(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},t.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},t.prototype.crc32=function(){return this.data.readUInt32LE(16)},t.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},t.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},t.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},t.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},t.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},t.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},t.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},t.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},t.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},t.prototype.produceFilename=function(){return w(this.data,this.useUTF8(),46,this.fileNameLength()).replace(/\\\\/g,"/")},t.prototype.fileName=function(){return this._filename},t.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},t.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},t.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return w(this.data,this.useUTF8(),t,this.fileCommentLength())},t.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},t.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},t.prototype.isDirectory=function(){var t=this.fileName();return!!(16&this.externalAttributes())||"/"===t.charAt(t.length-1)},t.prototype.isFile=function(){return!this.isDirectory()},t.prototype.useUTF8=function(){return 2048==(2048&this.flag())},t.prototype.isEncrypted=function(){return 1==(1&this.flag())},t.prototype.getFileData=function(){var t=this.headerRelativeOffset(),e=new m(this.zipData.slice(t));return new v(e,this,this.zipData.slice(t+e.totalSize()))},t.prototype.getData=function(){return this.getFileData().decompress()},t.prototype.getRawData=function(){return this.getFileData().getRawData()},t.prototype.getStats=function(){return new a.default(a.FileType.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())},t}();e.CentralDirectory=A;var T=function(){function t(t){if(this.data=t,101010256!==this.data.readUInt32LE(0))throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))}return t.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},t.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},t.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},t.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},t.prototype.cdSize=function(){return this.data.readUInt32LE(12)},t.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},t.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},t.prototype.cdZipComment=function(){return w(this.data,!0,22,this.cdZipCommentLength())},t.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())},t}();e.EndOfCentralDirectory=T;var I=function(){return function(t,e,r,n){this.index=t,this.directoryEntries=e,this.eocd=r,this.data=n}}();e.ZipTOC=I;var O=function(t){function e(r,n,o){void 0===n&&(n=""),void 0===o&&(o=!0);var i=t.call(this)||this;return i.name=n,i._index=new y.FileIndex,i._directoryEntries=[],i._eocd=null,h.deprecationMessage(o,e.Name,{zipData:"zip data as a Buffer",name:n}),r instanceof I?(i._index=r.index,i._directoryEntries=r.directoryEntries,i._eocd=r.eocd,i.data=r.data):(i.data=r,i.populateIndex()),i}return o(e,t),e.Create=function(t,r){try{e.computeIndex(t.zipData,function(n){var o=new e(n,t.name,!1);r(null,o)},!1)}catch(t){r(t)}},e.isAvailable=function(){return!0},e.RegisterDecompressionMethod=function(t,e){E[t]=e},e.computeIndex=function(t,r,n){void 0===n&&(n=!0),n&&console.warn("[ZipFS] ZipFS.computeIndex is now deprecated, and will be removed in the next major release. Please update your code to use \'ZipFS.Create({ zipData: zip file as a Buffer}, cb)\' instead.");var o=new y.FileIndex,i=e.getEOCD(t);if(i.diskNumber()!==i.cdDiskNumber())throw new s.ApiError(s.ErrorCode.EINVAL,"ZipFS does not support spanned zip files.");var a=i.cdOffset();if(4294967295===a)throw new s.ApiError(s.ErrorCode.EINVAL,"ZipFS does not support Zip64.");var c=a+i.cdSize();e.computeIndexResponsive(t,o,a,c,r,[],i)},e.getEOCD=function(t){for(var e=Math.min(65557,t.length-1),r=22;r<e;r++)if(101010256===t.readUInt32LE(t.length-r))return new T(t.slice(t.length-r));throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid ZIP file: Could not locate End of Central Directory signature.")},e.addToIndex=function(t,e){var r=t.fileName();if("/"===r.charAt(0))throw new Error("WHY IS THIS ABSOLUTE");"/"===r.charAt(r.length-1)&&(r=r.substr(0,r.length-1)),t.isDirectory()?e.addPathFast("/"+r,new y.DirInode(t)):e.addPathFast("/"+r,new y.FileInode(t))},e.computeIndexResponsive=function(t,r,n,o,i,s,a){if(n<o){for(var c=0;c++<200&&n<o;){var u=new A(t,t.slice(n));e.addToIndex(u,r),n+=u.totalSize(),s.push(u)}d.default(function(){e.computeIndexResponsive(t,r,n,o,i,s,a)})}else i(new I(r,s,a,t))},e.prototype.getName=function(){return e.Name+(""!==this.name?" "+this.name:"")},e.prototype.getCentralDirectoryEntry=function(t){var e=this._index.getInode(t);if(null===e)throw s.ApiError.ENOENT(t);if(y.isFileInode(e))return e.getData();if(y.isDirInode(e))return e.getData();throw s.ApiError.EPERM("Invalid inode: "+e)},e.prototype.getCentralDirectoryEntryAt=function(t){var e=this._directoryEntries[t];if(!e)throw new RangeError("Invalid directory index: "+t+".");return e},e.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},e.prototype.getEndOfCentralDirectory=function(){return this._eocd},e.prototype.diskSpace=function(t,e){e(this.data.length,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.statSync=function(t,e){var r,n=this._index.getInode(t);if(null===n)throw s.ApiError.ENOENT(t);if(y.isFileInode(n))r=n.getData().getStats();else{if(!y.isDirInode(n))throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid inode.");r=n.getStats()}return r},e.prototype.openSync=function(t,e,r){if(e.isWriteable())throw new s.ApiError(s.ErrorCode.EPERM,t);var n=this._index.getInode(t);if(!n)throw s.ApiError.ENOENT(t);if(!y.isFileInode(n))throw s.ApiError.EISDIR(t);var o=n.getData(),i=o.getStats();switch(e.pathExistsAction()){case u.ActionType.THROW_EXCEPTION:case u.ActionType.TRUNCATE_FILE:throw s.ApiError.EEXIST(t);case u.ActionType.NOP:return new f.NoSyncFile(this,t,e,i,o.getData());default:throw new s.ApiError(s.ErrorCode.EINVAL,"Invalid FileMode object.")}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(e){if(y.isDirInode(e))return e.getListing();throw s.ApiError.ENOTDIR(t)}throw s.ApiError.ENOENT(t)},e.prototype.readFileSync=function(t,e,r){var n=this.openSync(t,r,420);try{var o=n.getBuffer();return null===e?h.copyingSlice(o):o.toString(e)}finally{n.closeSync()}},e.prototype.populateIndex=function(){var t=this._eocd=e.getEOCD(this.data);if(t.diskNumber()!==t.cdDiskNumber())throw new s.ApiError(s.ErrorCode.EINVAL,"ZipFS does not support spanned zip files.");var r=t.cdOffset();if(4294967295===r)throw new s.ApiError(s.ErrorCode.EINVAL,"ZipFS does not support Zip64.");for(var n=r+t.cdSize();r<n;){var o=new A(this.data,this.data.slice(r));r+=o.totalSize(),e.addToIndex(o,this._index),this._directoryEntries.push(o)}},e}(c.SynchronousFileSystem);O.Name="ZipFS",O.Options={zipData:{type:"object",description:"The zip file as a Buffer object.",validator:h.bufferValidator},name:{type:"string",optional:!0,description:"The name of the zip file (optional)."}},O.CompressionMethod=i,e.default=O,O.RegisterDecompressionMethod(i.DEFLATE,function(t,e,r){return h.arrayish2Buffer(p(t.slice(0,e),{chunkSize:r}))}),O.RegisterDecompressionMethod(i.STORED,function(t,e,r){return h.copyingSlice(t,0,r)})},function(t,e,r){(function(t){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});e.__esModule=!0;var i=r(1),s=r(7),a=r(3),c=r(4),u=function(){function e(){}return e.prototype.supportsLinks=function(){return!1},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.openFile=function(t,e,r){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.createFile=function(t,e,r,n){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.open=function(t,e,r,n){var o=this;this.stat(t,!1,function(u,f){if(u)switch(e.pathNotExistsAction()){case s.ActionType.CREATE_FILE:return o.stat(a.dirname(t),!1,function(s,c){s?n(s):c&&!c.isDirectory()?n(i.ApiError.ENOTDIR(a.dirname(t))):o.createFile(t,e,r,n)});case s.ActionType.THROW_EXCEPTION:return n(i.ApiError.ENOENT(t));default:return n(new i.ApiError(i.ErrorCode.EINVAL,"Invalid FileFlag object."))}else{if(f&&f.isDirectory())return n(i.ApiError.EISDIR(t));switch(e.pathExistsAction()){case s.ActionType.THROW_EXCEPTION:return n(i.ApiError.EEXIST(t));case s.ActionType.TRUNCATE_FILE:return o.openFile(t,e,function(t,e){t?n(t):e?e.truncate(0,function(){e.sync(function(){n(null,e)})}):c.fail()});case s.ActionType.NOP:return o.openFile(t,e,n);default:return n(new i.ApiError(i.ErrorCode.EINVAL,"Invalid FileFlag object."))}}})},e.prototype.rename=function(t,e,r){r(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.renameSync=function(t,e){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.stat=function(t,e,r){r(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.statSync=function(t,e){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.openFileSync=function(t,e,r){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.createFileSync=function(t,e,r){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.openSync=function(t,e,r){var n;try{n=this.statSync(t,!1)}catch(n){switch(e.pathNotExistsAction()){case s.ActionType.CREATE_FILE:if(!this.statSync(a.dirname(t),!1).isDirectory())throw i.ApiError.ENOTDIR(a.dirname(t));return this.createFileSync(t,e,r);case s.ActionType.THROW_EXCEPTION:throw i.ApiError.ENOENT(t);default:throw new i.ApiError(i.ErrorCode.EINVAL,"Invalid FileFlag object.")}}if(n.isDirectory())throw i.ApiError.EISDIR(t);switch(e.pathExistsAction()){case s.ActionType.THROW_EXCEPTION:throw i.ApiError.EEXIST(t);case s.ActionType.TRUNCATE_FILE:return this.unlinkSync(t),this.createFileSync(t,e,n.mode);case s.ActionType.NOP:return this.openFileSync(t,e,r);default:throw new i.ApiError(i.ErrorCode.EINVAL,"Invalid FileFlag object.")}},e.prototype.unlink=function(t,e){e(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.unlinkSync=function(t){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.rmdir=function(t,e){e(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.rmdirSync=function(t){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.mkdir=function(t,e,r){r(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.mkdirSync=function(t,e){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.readdir=function(t,e){e(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.readdirSync=function(t){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.exists=function(t,e){this.stat(t,null,function(t){e(!t)})},e.prototype.existsSync=function(t){try{return this.statSync(t,!0),!0}catch(t){return!1}},e.prototype.realpath=function(t,e,r){if(this.supportsLinks())for(var n=t.split(a.sep),o=0;o<n.length;o++){var s=n.slice(0,o+1);n[o]=a.join.apply(null,s)}else this.exists(t,function(e){e?r(null,t):r(i.ApiError.ENOENT(t))})},e.prototype.realpathSync=function(t,e){if(this.supportsLinks()){for(var r=t.split(a.sep),n=0;n<r.length;n++){var o=r.slice(0,n+1);r[n]=a.join.apply(a,o)}return r.join(a.sep)}if(this.existsSync(t))return t;throw i.ApiError.ENOENT(t)},e.prototype.truncate=function(t,e,r){this.open(t,s.FileFlag.getFileFlag("r+"),420,function(t,n){if(t)return r(t);n.truncate(e,function(t){n.close(function(e){r(t||e)})})})},e.prototype.truncateSync=function(t,e){var r=this.openSync(t,s.FileFlag.getFileFlag("r+"),420);try{r.truncateSync(e)}catch(t){throw t}finally{r.closeSync()}},e.prototype.readFile=function(e,r,n,o){var i=o;this.open(e,n,420,function(e,n){if(e)return o(e);o=function(t,e){n.close(function(r){return t||(t=r),i(t,e)})},n.stat(function(e,i){if(e)return o(e);var s=t.alloc(i.size);n.read(s,0,i.size,0,function(t){if(t)return o(t);if(null===r)return o(t,s);try{o(null,s.toString(r))}catch(t){o(t)}})})})},e.prototype.readFileSync=function(e,r,n){var o=this.openSync(e,n,420);try{var i=o.statSync(),s=t.alloc(i.size);return o.readSync(s,0,i.size,0),o.closeSync(),null===r?s:s.toString(r)}finally{o.closeSync()}},e.prototype.writeFile=function(e,r,n,o,i,s){var a=s;this.open(e,o,420,function(e,o){if(e)return s(e);s=function(t){o.close(function(e){a(t||e)})};try{"string"==typeof r&&(r=t.from(r,n))}catch(t){return s(t)}o.write(r,0,r.length,0,s)})},e.prototype.writeFileSync=function(e,r,n,o,i){var s=this.openSync(e,o,i);try{"string"==typeof r&&(r=t.from(r,n)),s.writeSync(r,0,r.length,0)}finally{s.closeSync()}},e.prototype.appendFile=function(e,r,n,o,i,s){var a=s;this.open(e,o,i,function(e,o){if(e)return s(e);s=function(t){o.close(function(e){a(t||e)})},"string"==typeof r&&(r=t.from(r,n)),o.write(r,0,r.length,null,s)})},e.prototype.appendFileSync=function(e,r,n,o,i){var s=this.openSync(e,o,i);try{"string"==typeof r&&(r=t.from(r,n)),s.writeSync(r,0,r.length,null)}finally{s.closeSync()}},e.prototype.chmod=function(t,e,r,n){n(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.chmodSync=function(t,e,r){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.chown=function(t,e,r,n,o){o(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.chownSync=function(t,e,r,n){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.utimes=function(t,e,r,n){n(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.utimesSync=function(t,e,r){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.link=function(t,e,r){r(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.linkSync=function(t,e){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.symlink=function(t,e,r,n){n(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.symlinkSync=function(t,e,r){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e.prototype.readlink=function(t,e){e(new i.ApiError(i.ErrorCode.ENOTSUP))},e.prototype.readlinkSync=function(t){throw new i.ApiError(i.ErrorCode.ENOTSUP)},e}();e.BaseFileSystem=u;var f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.supportsSynch=function(){return!0},e.prototype.rename=function(t,e,r){try{this.renameSync(t,e),r()}catch(t){r(t)}},e.prototype.stat=function(t,e,r){try{r(null,this.statSync(t,e))}catch(t){r(t)}},e.prototype.open=function(t,e,r,n){try{n(null,this.openSync(t,e,r))}catch(t){n(t)}},e.prototype.unlink=function(t,e){try{this.unlinkSync(t),e()}catch(t){e(t)}},e.prototype.rmdir=function(t,e){try{this.rmdirSync(t),e()}catch(t){e(t)}},e.prototype.mkdir=function(t,e,r){try{this.mkdirSync(t,e),r()}catch(t){r(t)}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(t){e(t)}},e.prototype.chmod=function(t,e,r,n){try{this.chmodSync(t,e,r),n()}catch(t){n(t)}},e.prototype.chown=function(t,e,r,n,o){try{this.chownSync(t,e,r,n),o()}catch(t){o(t)}},e.prototype.utimes=function(t,e,r,n){try{this.utimesSync(t,e,r),n()}catch(t){n(t)}},e.prototype.link=function(t,e,r){try{this.linkSync(t,e),r()}catch(t){r(t)}},e.prototype.symlink=function(t,e,r,n){try{this.symlinkSync(t,e,r),n()}catch(t){n(t)}},e.prototype.readlink=function(t,e){try{e(null,this.readlinkSync(t))}catch(t){e(t)}},e}(u);e.SynchronousFileSystem=f}).call(e,r(0).Buffer)},function(t,e){function r(t,e,r,n,o){return t<e||r<e?t>r?r+1:t+1:n===o?e:e+1}e.__esModule=!0,e.default=function(t,e){if(t===e)return 0;if(t.length>e.length){var n=t;t=e,e=n}for(var o=t.length,i=e.length;o>0&&t.charCodeAt(o-1)===e.charCodeAt(i-1);)o--,i--;for(var s=0;s<o&&t.charCodeAt(s)===e.charCodeAt(s);)s++;if(i-=s,0==(o-=s)||1===i)return i;for(var a,c,u,f,h,l=new Array(o<<1),d=0;d<o;)l[o+d]=t.charCodeAt(s+d),l[d]=++d;for(a=0;a+3<i;){var p=e.charCodeAt(s+(c=a)),y=e.charCodeAt(s+(u=a+1)),E=e.charCodeAt(s+(f=a+2)),g=e.charCodeAt(s+(h=a+3)),w=a+=4;for(d=0;d<o;){var m=l[o+d];c=r(S=l[d],c,u,p,m),u=r(c,u,f,y,m),f=r(u,f,h,E,m),w=r(f,h,w,g,m),l[d++]=w,h=f,f=u,u=c,c=S}}for(var v=0;a<i;)for(p=e.charCodeAt(s+(c=a)),v=++a,d=0;d<o;d++){var S=l[d];l[d]=v=S<c||v<c?S>v?v+1:S+1:p===l[o+d]?c:c+1,c=S}return v}},function(t,e,r){(function(t){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});e.__esModule=!0;var i=r(21),s=r(1),a=r(9),c=r(4),u=function(e){function r(t,r,n,o,i){var s=e.call(this)||this;if(s._pos=0,s._dirty=!1,s._fs=t,s._path=r,s._flag=n,s._stat=o,s._buffer=i||c.emptyBuffer(),s._stat.size!==s._buffer.length&&s._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+s._buffer.length+" long, yet Stats object specifies that file is "+s._stat.size+" long.");return s}return o(r,e),r.prototype.getBuffer=function(){return this._buffer},r.prototype.getStats=function(){return this._stat},r.prototype.getFlag=function(){return this._flag},r.prototype.getPath=function(){return this._path},r.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},r.prototype.advancePos=function(t){return this._pos+=t},r.prototype.setPos=function(t){return this._pos=t},r.prototype.sync=function(t){try{this.syncSync(),t()}catch(e){t(e)}},r.prototype.syncSync=function(){throw new s.ApiError(s.ErrorCode.ENOTSUP)},r.prototype.close=function(t){try{this.closeSync(),t()}catch(e){t(e)}},r.prototype.closeSync=function(){throw new s.ApiError(s.ErrorCode.ENOTSUP)},r.prototype.stat=function(t){try{t(null,this._stat.clone())}catch(e){t(e)}},r.prototype.statSync=function(){return this._stat.clone()},r.prototype.truncate=function(t,e){try{this.truncateSync(t),this._flag.isSynchronous()&&!a.default.getRootFS().supportsSynch()&&this.sync(e),e()}catch(t){return e(t)}},r.prototype.truncateSync=function(e){if(this._dirty=!0,!this._flag.isWriteable())throw new s.ApiError(s.ErrorCode.EPERM,"File not opened with a writeable mode.");if(this._stat.mtime=new Date,e>this._buffer.length){var r=t.alloc(e-this._buffer.length,0);return this.writeSync(r,0,r.length,this._buffer.length),void(this._flag.isSynchronous()&&a.default.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=e;var n=t.alloc(e);this._buffer.copy(n,0,0,e),this._buffer=n,this._flag.isSynchronous()&&a.default.getRootFS().supportsSynch()&&this.syncSync()},r.prototype.write=function(t,e,r,n,o){try{o(null,this.writeSync(t,e,r,n),t)}catch(t){o(t)}},r.prototype.writeSync=function(e,r,n,o){if(this._dirty=!0,null==o&&(o=this.getPos()),!this._flag.isWriteable())throw new s.ApiError(s.ErrorCode.EPERM,"File not opened with a writeable mode.");var i=o+n;if(i>this._stat.size&&(this._stat.size=i,i>this._buffer.length)){var a=t.alloc(i);this._buffer.copy(a),this._buffer=a}var c=e.copy(this._buffer,o,r,r+n);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),c):(this.setPos(o+c),c)},r.prototype.read=function(t,e,r,n,o){try{o(null,this.readSync(t,e,r,n),t)}catch(t){o(t)}},r.prototype.readSync=function(t,e,r,n){if(!this._flag.isReadable())throw new s.ApiError(s.ErrorCode.EPERM,"File not opened with a readable mode.");null==n&&(n=this.getPos()),n+r>this._stat.size&&(r=this._stat.size-n);var o=this._buffer.copy(t,e,n,n+r);return this._stat.atime=new Date,this._pos=n+r,o},r.prototype.chmod=function(t,e){try{this.chmodSync(t),e()}catch(t){e(t)}},r.prototype.chmodSync=function(t){if(!this._fs.supportsProps())throw new s.ApiError(s.ErrorCode.ENOTSUP);this._dirty=!0,this._stat.chmod(t),this.syncSync()},r.prototype.isDirty=function(){return this._dirty},r.prototype.resetDirty=function(){this._dirty=!1},r}(i.BaseFile);e.default=u;var f=function(t){function e(e,r,n,o,i){return t.call(this,e,r,n,o,i)||this}return o(e,t),e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.close=function(t){t()},e.prototype.closeSync=function(){},e}(u);e.NoSyncFile=f}).call(e,r(0).Buffer)},function(t,e,r){e.__esModule=!0;var n=r(1),o=function(){function t(){}return t.prototype.sync=function(t){t(new n.ApiError(n.ErrorCode.ENOTSUP))},t.prototype.syncSync=function(){throw new n.ApiError(n.ErrorCode.ENOTSUP)},t.prototype.datasync=function(t){this.sync(t)},t.prototype.datasyncSync=function(){return this.syncSync()},t.prototype.chown=function(t,e,r){r(new n.ApiError(n.ErrorCode.ENOTSUP))},t.prototype.chownSync=function(t,e){throw new n.ApiError(n.ErrorCode.ENOTSUP)},t.prototype.chmod=function(t,e){e(new n.ApiError(n.ErrorCode.ENOTSUP))},t.prototype.chmodSync=function(t){throw new n.ApiError(n.ErrorCode.ENOTSUP)},t.prototype.utimes=function(t,e,r){r(new n.ApiError(n.ErrorCode.ENOTSUP))},t.prototype.utimesSync=function(t,e){throw new n.ApiError(n.ErrorCode.ENOTSUP)},t}();e.BaseFile=o},function(t,e){e.__esModule=!0;var r=function(){function t(){}return t.str2byte=function(e,r){for(var n=e.length>r.length?r.length:e.length,o=0;o<n;o++){var i=e.charCodeAt(o);if(i>127){var s=t.extendedChars.indexOf(e.charAt(o));s>-1&&(i=s+128)}r[i]=o}return n},t.byte2str=function(e){for(var r=new Array(e.length),n=0;n<e.length;n++){var o=e[n];r[n]=o>127?t.extendedChars[o-128]:String.fromCharCode(o)}return r.join("")},t.byteLength=function(t){return t.length},t}();r.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "],e.default=r},function(t,e,r){(function(t){e.__esModule=!0;var n,o=r(26);if(void 0!==t)n=t;else{var i=o.default,s=[];if(function(){if(void 0!==i.importScripts||!i.postMessage)return!1;var t=!0,e=i.onmessage;return i.onmessage=function(){t=!1},i.postMessage("","*"),i.onmessage=e,t}()){n=function(t){s.push(t),i.postMessage("zero-timeout-message","*")};var a=function(t){if(t.source===self&&"zero-timeout-message"===t.data&&(t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,s.length>0))return s.shift()()};i.addEventListener?i.addEventListener("message",a,!0):i.attachEvent("onmessage",a)}else if(i.MessageChannel){var c=new i.MessageChannel;c.port1.onmessage=function(t){if(s.length>0)return s.shift()()},n=function(t){s.push(t),c.port2.postMessage("")}}else n=function(t){return setTimeout(t,0)}}e.default=n}).call(e,r(24).setImmediate)},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},r(25),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(e,r(2))},function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,o,i,s,a,c=1,u={},f=!1,h=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick(function(){p(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){i.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(o=h.documentElement,n=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):n=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var o={callback:t,args:e};return u[c]=o,n(c),c++},l.clearImmediate=d}function d(t){delete u[t]}function p(t){if(f)setTimeout(p,0,t);else{var e=u[t];if(e){f=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(r,n)}}(e)}finally{d(t),f=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(e,r(2),r(8))},function(t,e,r){(function(t){var r;e.__esModule=!0,r="undefined"!=typeof window?window:"undefined"!=typeof self?self:t,e.default=r}).call(e,r(2))},function(t,e,r){"use strict";var n=r(28),o=r(5),i=r(33),s=r(34),a=r(35),c=r(36),u=r(37),f=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=n.inflateInit2(this.strm,e.windowBits);if(r!==s.Z_OK)throw new Error(a[r]);if(this.header=new u,n.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=i.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=n.inflateSetDictionary(this.strm,e.dictionary))!==s.Z_OK))throw new Error(a[r])}function l(t,e){var r=new h(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}h.prototype.push=function(t,e){var r,a,c,u,h,l=this.strm,d=this.options.chunkSize,p=this.options.dictionary,y=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof t?l.input=i.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new o.Buf8(d),l.next_out=0,l.avail_out=d),(r=n.inflate(l,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&p&&(r=n.inflateSetDictionary(this.strm,p)),r===s.Z_BUF_ERROR&&!0===y&&(r=s.Z_OK,y=!1),r!==s.Z_STREAM_END&&r!==s.Z_OK)return this.onEnd(r),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&r!==s.Z_STREAM_END&&(0!==l.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(c=i.utf8border(l.output,l.next_out),u=l.next_out-c,h=i.buf2string(l.output,c),l.next_out=u,l.avail_out=d-u,u&&o.arraySet(l.output,l.output,c,u,0),this.onData(h)):this.onData(o.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(y=!0)}while((l.avail_in>0||0===l.avail_out)&&r!==s.Z_STREAM_END);return r===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(r=n.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),l.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=h,e.inflate=l,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},e.ungzip=l},function(t,e,r){"use strict";var n=r(5),o=r(29),i=r(30),s=r(31),a=r(32),c=0,u=1,f=2,h=4,l=5,d=6,p=0,y=1,E=2,g=-2,w=-3,m=-4,v=-5,S=8,_=1,b=2,A=3,T=4,I=5,O=6,F=7,N=8,C=9,R=10,k=11,P=12,L=13,x=14,D=15,U=16,M=17,B=18,z=19,j=20,Z=21,Y=22,V=23,H=24,W=25,X=26,J=27,K=28,q=29,$=30,G=31,Q=32,tt=852,et=592,rt=15;function nt(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function ot(){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 n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function it(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=_,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(tt),e.distcode=e.distdyn=new n.Buf32(et),e.sane=1,e.back=-1,p):g}function st(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,it(t)):g}function at(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?g:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,st(t))):g}function ct(t,e){var r,n;return t?(n=new ot,t.state=n,n.window=null,(r=at(t,e))!==p&&(t.state=null),r):g}var ut,ft,ht=!0;function lt(t){if(ht){var e;for(ut=new n.Buf32(512),ft=new n.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(a(u,t.lens,0,288,ut,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(f,t.lens,0,32,ft,0,t.work,{bits:5}),ht=!1}t.lencode=ut,t.lenbits=9,t.distcode=ft,t.distbits=5}function dt(t,e,r,o){var i,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new n.Buf8(s.wsize)),o>=s.wsize?(n.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((i=s.wsize-s.wnext)>o&&(i=o),n.arraySet(s.window,e,r-o,i,s.wnext),(o-=i)?(n.arraySet(s.window,e,r-o,o,0),s.wnext=o,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}e.inflateReset=st,e.inflateReset2=at,e.inflateResetKeep=it,e.inflateInit=function(t){return ct(t,rt)},e.inflateInit2=ct,e.inflate=function(t,e){var r,tt,et,rt,ot,it,st,at,ct,ut,ft,ht,pt,yt,Et,gt,wt,mt,vt,St,_t,bt,At,Tt,It=0,Ot=new n.Buf8(4),Ft=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return g;(r=t.state).mode===P&&(r.mode=L),ot=t.next_out,et=t.output,st=t.avail_out,rt=t.next_in,tt=t.input,it=t.avail_in,at=r.hold,ct=r.bits,ut=it,ft=st,bt=p;t:for(;;)switch(r.mode){case _:if(0===r.wrap){r.mode=L;break}for(;ct<16;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(2&r.wrap&&35615===at){r.check=0,Ot[0]=255&at,Ot[1]=at>>>8&255,r.check=i(r.check,Ot,2,0),at=0,ct=0,r.mode=b;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&at)<<8)+(at>>8))%31){t.msg="incorrect header check",r.mode=$;break}if((15&at)!==S){t.msg="unknown compression method",r.mode=$;break}if(ct-=4,_t=8+(15&(at>>>=4)),0===r.wbits)r.wbits=_t;else if(_t>r.wbits){t.msg="invalid window size",r.mode=$;break}r.dmax=1<<_t,t.adler=r.check=1,r.mode=512&at?R:P,at=0,ct=0;break;case b:for(;ct<16;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(r.flags=at,(255&r.flags)!==S){t.msg="unknown compression method",r.mode=$;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=$;break}r.head&&(r.head.text=at>>8&1),512&r.flags&&(Ot[0]=255&at,Ot[1]=at>>>8&255,r.check=i(r.check,Ot,2,0)),at=0,ct=0,r.mode=A;case A:for(;ct<32;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}r.head&&(r.head.time=at),512&r.flags&&(Ot[0]=255&at,Ot[1]=at>>>8&255,Ot[2]=at>>>16&255,Ot[3]=at>>>24&255,r.check=i(r.check,Ot,4,0)),at=0,ct=0,r.mode=T;case T:for(;ct<16;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}r.head&&(r.head.xflags=255&at,r.head.os=at>>8),512&r.flags&&(Ot[0]=255&at,Ot[1]=at>>>8&255,r.check=i(r.check,Ot,2,0)),at=0,ct=0,r.mode=I;case I:if(1024&r.flags){for(;ct<16;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}r.length=at,r.head&&(r.head.extra_len=at),512&r.flags&&(Ot[0]=255&at,Ot[1]=at>>>8&255,r.check=i(r.check,Ot,2,0)),at=0,ct=0}else r.head&&(r.head.extra=null);r.mode=O;case O:if(1024&r.flags&&((ht=r.length)>it&&(ht=it),ht&&(r.head&&(_t=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,tt,rt,ht,_t)),512&r.flags&&(r.check=i(r.check,tt,ht,rt)),it-=ht,rt+=ht,r.length-=ht),r.length))break t;r.length=0,r.mode=F;case F:if(2048&r.flags){if(0===it)break t;ht=0;do{_t=tt[rt+ht++],r.head&&_t&&r.length<65536&&(r.head.name+=String.fromCharCode(_t))}while(_t&&ht<it);if(512&r.flags&&(r.check=i(r.check,tt,ht,rt)),it-=ht,rt+=ht,_t)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=N;case N:if(4096&r.flags){if(0===it)break t;ht=0;do{_t=tt[rt+ht++],r.head&&_t&&r.length<65536&&(r.head.comment+=String.fromCharCode(_t))}while(_t&&ht<it);if(512&r.flags&&(r.check=i(r.check,tt,ht,rt)),it-=ht,rt+=ht,_t)break t}else r.head&&(r.head.comment=null);r.mode=C;case C:if(512&r.flags){for(;ct<16;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(at!==(65535&r.check)){t.msg="header crc mismatch",r.mode=$;break}at=0,ct=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=P;break;case R:for(;ct<32;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}t.adler=r.check=nt(at),at=0,ct=0,r.mode=k;case k:if(0===r.havedict)return t.next_out=ot,t.avail_out=st,t.next_in=rt,t.avail_in=it,r.hold=at,r.bits=ct,E;t.adler=r.check=1,r.mode=P;case P:if(e===l||e===d)break t;case L:if(r.last){at>>>=7&ct,ct-=7&ct,r.mode=J;break}for(;ct<3;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}switch(r.last=1&at,ct-=1,3&(at>>>=1)){case 0:r.mode=x;break;case 1:if(lt(r),r.mode=j,e===d){at>>>=2,ct-=2;break t}break;case 2:r.mode=M;break;case 3:t.msg="invalid block type",r.mode=$}at>>>=2,ct-=2;break;case x:for(at>>>=7&ct,ct-=7&ct;ct<32;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if((65535&at)!=(at>>>16^65535)){t.msg="invalid stored block lengths",r.mode=$;break}if(r.length=65535&at,at=0,ct=0,r.mode=D,e===d)break t;case D:r.mode=U;case U:if(ht=r.length){if(ht>it&&(ht=it),ht>st&&(ht=st),0===ht)break t;n.arraySet(et,tt,rt,ht,ot),it-=ht,rt+=ht,st-=ht,ot+=ht,r.length-=ht;break}r.mode=P;break;case M:for(;ct<14;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(r.nlen=257+(31&at),at>>>=5,ct-=5,r.ndist=1+(31&at),at>>>=5,ct-=5,r.ncode=4+(15&at),at>>>=4,ct-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=$;break}r.have=0,r.mode=B;case B:for(;r.have<r.ncode;){for(;ct<3;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}r.lens[Ft[r.have++]]=7&at,at>>>=3,ct-=3}for(;r.have<19;)r.lens[Ft[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,At={bits:r.lenbits},bt=a(c,r.lens,0,19,r.lencode,0,r.work,At),r.lenbits=At.bits,bt){t.msg="invalid code lengths set",r.mode=$;break}r.have=0,r.mode=z;case z:for(;r.have<r.nlen+r.ndist;){for(;gt=(It=r.lencode[at&(1<<r.lenbits)-1])>>>16&255,wt=65535&It,!((Et=It>>>24)<=ct);){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(wt<16)at>>>=Et,ct-=Et,r.lens[r.have++]=wt;else{if(16===wt){for(Tt=Et+2;ct<Tt;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(at>>>=Et,ct-=Et,0===r.have){t.msg="invalid bit length repeat",r.mode=$;break}_t=r.lens[r.have-1],ht=3+(3&at),at>>>=2,ct-=2}else if(17===wt){for(Tt=Et+3;ct<Tt;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}ct-=Et,_t=0,ht=3+(7&(at>>>=Et)),at>>>=3,ct-=3}else{for(Tt=Et+7;ct<Tt;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}ct-=Et,_t=0,ht=11+(127&(at>>>=Et)),at>>>=7,ct-=7}if(r.have+ht>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=$;break}for(;ht--;)r.lens[r.have++]=_t}}if(r.mode===$)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=$;break}if(r.lenbits=9,At={bits:r.lenbits},bt=a(u,r.lens,0,r.nlen,r.lencode,0,r.work,At),r.lenbits=At.bits,bt){t.msg="invalid literal/lengths set",r.mode=$;break}if(r.distbits=6,r.distcode=r.distdyn,At={bits:r.distbits},bt=a(f,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,At),r.distbits=At.bits,bt){t.msg="invalid distances set",r.mode=$;break}if(r.mode=j,e===d)break t;case j:r.mode=Z;case Z:if(it>=6&&st>=258){t.next_out=ot,t.avail_out=st,t.next_in=rt,t.avail_in=it,r.hold=at,r.bits=ct,s(t,ft),ot=t.next_out,et=t.output,st=t.avail_out,rt=t.next_in,tt=t.input,it=t.avail_in,at=r.hold,ct=r.bits,r.mode===P&&(r.back=-1);break}for(r.back=0;gt=(It=r.lencode[at&(1<<r.lenbits)-1])>>>16&255,wt=65535&It,!((Et=It>>>24)<=ct);){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(gt&&0==(240&gt)){for(mt=Et,vt=gt,St=wt;gt=(It=r.lencode[St+((at&(1<<mt+vt)-1)>>mt)])>>>16&255,wt=65535&It,!(mt+(Et=It>>>24)<=ct);){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}at>>>=mt,ct-=mt,r.back+=mt}if(at>>>=Et,ct-=Et,r.back+=Et,r.length=wt,0===gt){r.mode=X;break}if(32&gt){r.back=-1,r.mode=P;break}if(64&gt){t.msg="invalid literal/length code",r.mode=$;break}r.extra=15&gt,r.mode=Y;case Y:if(r.extra){for(Tt=r.extra;ct<Tt;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}r.length+=at&(1<<r.extra)-1,at>>>=r.extra,ct-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=V;case V:for(;gt=(It=r.distcode[at&(1<<r.distbits)-1])>>>16&255,wt=65535&It,!((Et=It>>>24)<=ct);){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(0==(240&gt)){for(mt=Et,vt=gt,St=wt;gt=(It=r.distcode[St+((at&(1<<mt+vt)-1)>>mt)])>>>16&255,wt=65535&It,!(mt+(Et=It>>>24)<=ct);){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}at>>>=mt,ct-=mt,r.back+=mt}if(at>>>=Et,ct-=Et,r.back+=Et,64&gt){t.msg="invalid distance code",r.mode=$;break}r.offset=wt,r.extra=15&gt,r.mode=H;case H:if(r.extra){for(Tt=r.extra;ct<Tt;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}r.offset+=at&(1<<r.extra)-1,at>>>=r.extra,ct-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=$;break}r.mode=W;case W:if(0===st)break t;if(ht=ft-st,r.offset>ht){if((ht=r.offset-ht)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=$;break}ht>r.wnext?(ht-=r.wnext,pt=r.wsize-ht):pt=r.wnext-ht,ht>r.length&&(ht=r.length),yt=r.window}else yt=et,pt=ot-r.offset,ht=r.length;ht>st&&(ht=st),st-=ht,r.length-=ht;do{et[ot++]=yt[pt++]}while(--ht);0===r.length&&(r.mode=Z);break;case X:if(0===st)break t;et[ot++]=r.length,st--,r.mode=Z;break;case J:if(r.wrap){for(;ct<32;){if(0===it)break t;it--,at|=tt[rt++]<<ct,ct+=8}if(ft-=st,t.total_out+=ft,r.total+=ft,ft&&(t.adler=r.check=r.flags?i(r.check,et,ft,ot-ft):o(r.check,et,ft,ot-ft)),ft=st,(r.flags?at:nt(at))!==r.check){t.msg="incorrect data check",r.mode=$;break}at=0,ct=0}r.mode=K;case K:if(r.wrap&&r.flags){for(;ct<32;){if(0===it)break t;it--,at+=tt[rt++]<<ct,ct+=8}if(at!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=$;break}at=0,ct=0}r.mode=q;case q:bt=y;break t;case $:bt=w;break t;case G:return m;case Q:default:return g}return t.next_out=ot,t.avail_out=st,t.next_in=rt,t.avail_in=it,r.hold=at,r.bits=ct,(r.wsize||ft!==t.avail_out&&r.mode<$&&(r.mode<J||e!==h))&&dt(t,t.output,t.next_out,ft-t.avail_out)?(r.mode=G,m):(ut-=t.avail_in,ft-=t.avail_out,t.total_in+=ut,t.total_out+=ft,r.total+=ft,r.wrap&&ft&&(t.adler=r.check=r.flags?i(r.check,et,ft,t.next_out-ft):o(r.check,et,ft,t.next_out-ft)),t.data_type=r.bits+(r.last?64:0)+(r.mode===P?128:0)+(r.mode===j||r.mode===D?256:0),(0===ut&&0===ft||e===h)&&bt===p&&(bt=v),bt)},e.inflateEnd=function(t){if(!t||!t.state)return g;var e=t.state;return e.window&&(e.window=null),t.state=null,p},e.inflateGetHeader=function(t,e){var r;return t&&t.state?0==(2&(r=t.state).wrap)?g:(r.head=e,e.done=!1,p):g},e.inflateSetDictionary=function(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&r.mode!==k?g:r.mode===k&&o(1,e,n,0)!==r.check?w:dt(t,e,n,n)?(r.mode=G,m):(r.havedict=1,p):g},e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e,r){"use strict";t.exports=function(t,e,r,n){for(var o=65535&t|0,i=t>>>16&65535|0,s=0;0!==r;){r-=s=r>2e3?2e3:r;do{i=i+(o=o+e[n++]|0)|0}while(--s);o%=65521,i%=65521}return o|i<<16|0}},function(t,e,r){"use strict";var n=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,e,r,o){var i=n,s=o+r;t^=-1;for(var a=o;a<s;a++)t=t>>>8^i[255&(t^e[a])];return-1^t}},function(t,e,r){"use strict";t.exports=function(t,e){var r,n,o,i,s,a,c,u,f,h,l,d,p,y,E,g,w,m,v,S,_,b,A,T,I;r=t.state,n=t.next_in,T=t.input,o=n+(t.avail_in-5),i=t.next_out,I=t.output,s=i-(e-t.avail_out),a=i+(t.avail_out-257),c=r.dmax,u=r.wsize,f=r.whave,h=r.wnext,l=r.window,d=r.hold,p=r.bits,y=r.lencode,E=r.distcode,g=(1<<r.lenbits)-1,w=(1<<r.distbits)-1;t:do{p<15&&(d+=T[n++]<<p,p+=8,d+=T[n++]<<p,p+=8),m=y[d&g];e:for(;;){if(d>>>=v=m>>>24,p-=v,0===(v=m>>>16&255))I[i++]=65535&m;else{if(!(16&v)){if(0==(64&v)){m=y[(65535&m)+(d&(1<<v)-1)];continue e}if(32&v){r.mode=12;break t}t.msg="invalid literal/length code",r.mode=30;break t}S=65535&m,(v&=15)&&(p<v&&(d+=T[n++]<<p,p+=8),S+=d&(1<<v)-1,d>>>=v,p-=v),p<15&&(d+=T[n++]<<p,p+=8,d+=T[n++]<<p,p+=8),m=E[d&w];r:for(;;){if(d>>>=v=m>>>24,p-=v,!(16&(v=m>>>16&255))){if(0==(64&v)){m=E[(65535&m)+(d&(1<<v)-1)];continue r}t.msg="invalid distance code",r.mode=30;break t}if(_=65535&m,p<(v&=15)&&(d+=T[n++]<<p,(p+=8)<v&&(d+=T[n++]<<p,p+=8)),(_+=d&(1<<v)-1)>c){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=v,p-=v,_>(v=i-s)){if((v=_-v)>f&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(b=0,A=l,0===h){if(b+=u-v,v<S){S-=v;do{I[i++]=l[b++]}while(--v);b=i-_,A=I}}else if(h<v){if(b+=u+h-v,(v-=h)<S){S-=v;do{I[i++]=l[b++]}while(--v);if(b=0,h<S){S-=v=h;do{I[i++]=l[b++]}while(--v);b=i-_,A=I}}}else if(b+=h-v,v<S){S-=v;do{I[i++]=l[b++]}while(--v);b=i-_,A=I}for(;S>2;)I[i++]=A[b++],I[i++]=A[b++],I[i++]=A[b++],S-=3;S&&(I[i++]=A[b++],S>1&&(I[i++]=A[b++]))}else{b=i-_;do{I[i++]=I[b++],I[i++]=I[b++],I[i++]=I[b++],S-=3}while(S>2);S&&(I[i++]=I[b++],S>1&&(I[i++]=I[b++]))}break}}break}}while(n<o&&i<a);n-=S=p>>3,d&=(1<<(p-=S<<3))-1,t.next_in=n,t.next_out=i,t.avail_in=n<o?o-n+5:5-(n-o),t.avail_out=i<a?a-i+257:257-(i-a),r.hold=d,r.bits=p}},function(t,e,r){"use strict";var n=r(5),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],i=[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],s=[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],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,c,u,f,h,l){var d,p,y,E,g,w,m,v,S,_=l.bits,b=0,A=0,T=0,I=0,O=0,F=0,N=0,C=0,R=0,k=0,P=null,L=0,x=new n.Buf16(16),D=new n.Buf16(16),U=null,M=0;for(b=0;b<=15;b++)x[b]=0;for(A=0;A<c;A++)x[e[r+A]]++;for(O=_,I=15;I>=1&&0===x[I];I--);if(O>I&&(O=I),0===I)return u[f++]=20971520,u[f++]=20971520,l.bits=1,0;for(T=1;T<I&&0===x[T];T++);for(O<T&&(O=T),C=1,b=1;b<=15;b++)if(C<<=1,(C-=x[b])<0)return-1;if(C>0&&(0===t||1!==I))return-1;for(D[1]=0,b=1;b<15;b++)D[b+1]=D[b]+x[b];for(A=0;A<c;A++)0!==e[r+A]&&(h[D[e[r+A]]++]=A);if(0===t?(P=U=h,w=19):1===t?(P=o,L-=257,U=i,M-=257,w=256):(P=s,U=a,w=-1),k=0,A=0,b=T,g=f,F=O,N=0,y=-1,E=(R=1<<O)-1,1===t&&R>852||2===t&&R>592)return 1;for(;;){m=b-N,h[A]<w?(v=0,S=h[A]):h[A]>w?(v=U[M+h[A]],S=P[L+h[A]]):(v=96,S=0),d=1<<b-N,T=p=1<<F;do{u[g+(k>>N)+(p-=d)]=m<<24|v<<16|S|0}while(0!==p);for(d=1<<b-1;k&d;)d>>=1;if(0!==d?(k&=d-1,k+=d):k=0,A++,0==--x[b]){if(b===I)break;b=e[r+h[A]]}if(b>O&&(k&E)!==y){for(0===N&&(N=O),g+=T,C=1<<(F=b-N);F+N<I&&!((C-=x[F+N])<=0);)F++,C<<=1;if(R+=1<<F,1===t&&R>852||2===t&&R>592)return 1;u[y=k&E]=O<<24|F<<16|g-f|0}}return 0!==k&&(u[g+k]=b-N<<24|64<<16|0),l.bits=O,0}},function(t,e,r){"use strict";var n=r(5),o=!0,i=!0;try{String.fromCharCode.apply(null,[0])}catch(t){o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){i=!1}for(var s=new n.Buf8(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(t,e){if(e<65534&&(t.subarray&&i||!t.subarray&&o))return String.fromCharCode.apply(null,n.shrinkBuf(t,e));for(var r="",s=0;s<e;s++)r+=String.fromCharCode(t[s]);return r}s[254]=s[254]=1,e.string2buf=function(t){var e,r,o,i,s,a=t.length,c=0;for(i=0;i<a;i++)55296==(64512&(r=t.charCodeAt(i)))&&i+1<a&&56320==(64512&(o=t.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(o-56320),i++),c+=r<128?1:r<2048?2:r<65536?3:4;for(e=new n.Buf8(c),s=0,i=0;s<c;i++)55296==(64512&(r=t.charCodeAt(i)))&&i+1<a&&56320==(64512&(o=t.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(o-56320),i++),r<128?e[s++]=r:r<2048?(e[s++]=192|r>>>6,e[s++]=128|63&r):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|63&r):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|63&r);return e},e.buf2binstring=function(t){return c(t,t.length)},e.binstring2buf=function(t){for(var e=new n.Buf8(t.length),r=0,o=e.length;r<o;r++)e[r]=t.charCodeAt(r);return e},e.buf2string=function(t,e){var r,n,o,i,a=e||t.length,u=new Array(2*a);for(n=0,r=0;r<a;)if((o=t[r++])<128)u[n++]=o;else if((i=s[o])>4)u[n++]=65533,r+=i-1;else{for(o&=2===i?31:3===i?15:7;i>1&&r<a;)o=o<<6|63&t[r++],i--;i>1?u[n++]=65533:o<65536?u[n++]=o:(o-=65536,u[n++]=55296|o>>10&1023,u[n++]=56320|1023&o)}return c(u,n)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0?e:0===r?e:r+s[t[r]]>e?r:e}},function(t,e,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(t,e,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(t,e,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(t,e,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(t,e,r){e.__esModule=!0;var n=r(6),o=r(3),i=function(){function t(){this._index={},this.addPath("/",new a)}return t.fromListing=function(e){var r=new t,o=new a;r._index["/"]=o;for(var i=[["",e,o]];i.length>0;){var c=void 0,u=i.pop(),f=u[0],h=u[1],l=u[2];for(var d in h)if(h.hasOwnProperty(d)){var p=h[d],y=f+"/"+d;p?(r._index[y]=c=new a,i.push([y,p,c])):c=new s(new n.default(n.FileType.FILE,-1,365)),l&&(l._ls[d]=c)}}return r},t.prototype.fileIterator=function(t){for(var e in this._index)if(this._index.hasOwnProperty(e))for(var r=this._index[e],n=0,o=r.getListing();n<o.length;n++){var i=o[n],s=r.getItem(i);c(s)&&t(s.getData())}},t.prototype.addPath=function(t,e){if(!e)throw new Error("Inode must be specified");if("/"!==t[0])throw new Error("Path must be absolute, got: "+t);if(this._index.hasOwnProperty(t))return this._index[t]===e;var r=this._split_path(t),n=r[0],o=r[1],i=this._index[n];return!(void 0===i&&"/"!==t&&(i=new a,!this.addPath(n,i)))&&(!("/"!==t&&!i.addItem(o,e))&&(u(e)&&(this._index[t]=e),!0))},t.prototype.addPathFast=function(t,e){var r=t.lastIndexOf("/"),n=0===r?"/":t.substring(0,r),o=t.substring(r+1),i=this._index[n];return void 0===i&&(i=new a,this.addPathFast(n,i)),!!i.addItem(o,e)&&(e.isDir()&&(this._index[t]=e),!0)},t.prototype.removePath=function(t){var e=this._split_path(t),r=e[0],n=e[1],o=this._index[r];if(void 0===o)return null;var i=o.remItem(n);if(null===i)return null;if(u(i)){for(var s=0,a=i.getListing();s<a.length;s++){var c=a[s];this.removePath(t+"/"+c)}"/"!==t&&delete this._index[t]}return i},t.prototype.ls=function(t){var e=this._index[t];return void 0===e?null:e.getListing()},t.prototype.getInode=function(t){var e=this._split_path(t),r=e[0],n=e[1],o=this._index[r];return void 0===o?null:r===t?o:o.getItem(n)},t.prototype._split_path=function(t){var e=o.dirname(t);return[e,t.substr(e.length+("/"===e?0:1))]},t}();e.FileIndex=i;var s=function(){function t(t){this.data=t}return t.prototype.isFile=function(){return!0},t.prototype.isDir=function(){return!1},t.prototype.getData=function(){return this.data},t.prototype.setData=function(t){this.data=t},t}();e.FileInode=s;var a=function(){function t(t){void 0===t&&(t=null),this.data=t,this._ls={}}return t.prototype.isFile=function(){return!1},t.prototype.isDir=function(){return!0},t.prototype.getData=function(){return this.data},t.prototype.getStats=function(){return new n.default(n.FileType.DIRECTORY,4096,365)},t.prototype.getListing=function(){return Object.keys(this._ls)},t.prototype.getItem=function(t){var e=this._ls[t];return e||null},t.prototype.addItem=function(t,e){return!(t in this._ls)&&(this._ls[t]=e,!0)},t.prototype.remItem=function(t){var e=this._ls[t];return void 0===e?null:(delete this._ls[t],e)},t}();function c(t){return!!t&&t.isFile()}function u(t){return!!t&&t.isDir()}e.DirInode=a,e.isFileInode=c,e.isDirInode=u},function(t,e,r){e.__esModule=!0;var n=r(9),o=r(4),i=function(){function t(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()}return t.prototype.open=function(t){var e=this.fs.realPath(t.node),r=this.FS;try{r.isFile(t.node.mode)&&(t.nfd=this.nodefs.openSync(e,this.fs.flagsToPermissionString(t.flags)))}catch(t){if(!t.code)throw t;throw new r.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.close=function(t){var e=this.FS;try{e.isFile(t.node.mode)&&t.nfd&&this.nodefs.closeSync(t.nfd)}catch(t){if(!t.code)throw t;throw new e.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.read=function(t,e,r,n,i){try{return this.nodefs.readSync(t.nfd,o.uint8Array2Buffer(e),r,n,i)}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.write=function(t,e,r,n,i){try{return this.nodefs.writeSync(t.nfd,o.uint8Array2Buffer(e),r,n,i)}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.llseek=function(t,e,r){var n=e;if(1===r)n+=t.position;else if(2===r&&this.FS.isFile(t.node.mode))try{n+=this.nodefs.fstatSync(t.nfd).size}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}if(n<0)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return t.position=n,n},t}(),s=function(){function t(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()}return t.prototype.getattr=function(t){var e,r=this.fs.realPath(t);try{e=this.nodefs.lstatSync(r)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},t.prototype.setattr=function(t,e){var r=this.fs.realPath(t);try{if(void 0!==e.mode&&(this.nodefs.chmodSync(r,e.mode),t.mode=e.mode),void 0!==e.timestamp){var n=new Date(e.timestamp);this.nodefs.utimesSync(r,n,n)}}catch(t){if(!t.code)throw t;if("ENOTSUP"!==t.code)throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}if(void 0!==e.size)try{this.nodefs.truncateSync(r,e.size)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.lookup=function(t,e){var r=this.PATH.join2(this.fs.realPath(t),e),n=this.fs.getMode(r);return this.fs.createNode(t,e,n)},t.prototype.mknod=function(t,e,r,n){var o=this.fs.createNode(t,e,r,n),i=this.fs.realPath(o);try{this.FS.isDir(o.mode)?this.nodefs.mkdirSync(i,o.mode):this.nodefs.writeFileSync(i,"",{mode:o.mode})}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return o},t.prototype.rename=function(t,e,r){var n=this.fs.realPath(t),o=this.PATH.join2(this.fs.realPath(e),r);try{this.nodefs.renameSync(n,o),t.name=r,t.parent=e}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.unlink=function(t,e){var r=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.unlinkSync(r)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.rmdir=function(t,e){var r=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.rmdirSync(r)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.readdir=function(t){var e=this.fs.realPath(t);try{var r=this.nodefs.readdirSync(e);return r.push(".",".."),r}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.symlink=function(t,e,r){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.symlinkSync(r,n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t.prototype.readlink=function(t){var e=this.fs.realPath(t);try{return this.nodefs.readlinkSync(e)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},t}(),a=function(){function t(t,e,r,o){void 0===t&&(t=self.FS),void 0===e&&(e=self.PATH),void 0===r&&(r=self.ERRNO_CODES),void 0===o&&(o=n.default),this.flagsToPermissionStringMap={0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},this.nodefs=o,this.FS=t,this.PATH=e,this.ERRNO_CODES=r,this.node_ops=new s(this),this.stream_ops=new i(this)}return t.prototype.mount=function(t){return this.createNode(null,"/",this.getMode(t.opts.root),0)},t.prototype.createNode=function(t,e,r,n){var o=this.FS;if(!o.isDir(r)&&!o.isFile(r)&&!o.isLink(r))throw new o.ErrnoError(this.ERRNO_CODES.EINVAL);var i=o.createNode(t,e,r);return i.node_ops=this.node_ops,i.stream_ops=this.stream_ops,i},t.prototype.getMode=function(t){var e;try{e=this.nodefs.lstatSync(t)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return e.mode},t.prototype.realPath=function(t){for(var e=[];t.parent!==t;)e.push(t.name),t=t.parent;return e.push(t.mount.opts.root),e.reverse(),this.PATH.join.apply(null,e)},t.prototype.flagsToPermissionString=function(t){var e="string"==typeof t?parseInt(t,10):t;return(e&=8191)in this.flagsToPermissionStringMap?this.flagsToPermissionStringMap[e]:t},t.prototype.getNodeFS=function(){return this.nodefs},t.prototype.getFS=function(){return this.FS},t.prototype.getPATH=function(){return this.PATH},t.prototype.getERRNO_CODES=function(){return this.ERRNO_CODES},t}();e.default=a},function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(11)),n(r(41))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(11);e.Server=class{constructor(t){this.transport=t,this.error=new n.Event,this.allMessages=new n.Event,this.tasks=new n.Event,this.logMessagesToConsole=!1,this.currentSeqNum=0,this.currentMessages=[],this.sentRequests=new Map}connect(){this.conn=this.transport.connect(),this.conn.jsonMessage.on(t=>this.onMessage(t)),this.conn.error.on(t=>this.error.fire(t))}restart(){this.dispose(),this.connect()}send(t){if(!this.alive())return new Promise((t,e)=>e("server is not alive"));this.logMessagesToConsole&&console.log("=> server: ",t),t.seq_num=this.currentSeqNum++;const e=new Promise((e,r)=>this.sentRequests.set(t.seq_num,{resolve:e,reject:r}));return this.conn.send(t),e}info(t,e,r){return this.send({command:"info",file_name:t,line:e,column:r})}sync(t,e){return this.send({command:"sync",file_name:t,content:e})}complete(t,e,r,n){return this.send({command:"complete",file_name:t,line:e,column:r,skip_completions:n||!1})}search(t){return this.send({command:"search",query:t})}allHoleCommands(t){return this.send({command:"all_hole_commands",file_name:t})}holeCommands(t,e,r){return this.send({command:"hole_commands",file_name:t,line:e,column:r})}hole(t,e,r,n){return this.send({command:"hole",file_name:t,line:e,column:r,action:n})}roi(t,e){return this.send({command:"roi",files:e,mode:t})}alive(){return this.conn&&this.conn.alive}dispose(){this.conn&&(this.conn.dispose(),this.sentRequests.forEach((t,e)=>t.reject("disposed")),this.sentRequests.clear(),this.currentSeqNum=0,this.conn=null)}onMessage(t){this.logMessagesToConsole&&console.log("<= server: ",t);const e=this.sentRequests.get(t.seq_num);if(void 0!==e)this.sentRequests.delete(t.seq_num),"ok"===t.response?e.resolve(t):e.reject(t.message||t);else if("all_messages"===t.response){const e=t;this.currentMessages=e.msgs,this.allMessages.fire(e)}else if("additional_message"===t.response){const e=t;this.currentMessages=this.currentMessages.concat([e.msg]),this.allMessages.fire({response:"all_messages",msgs:this.currentMessages})}else"current_tasks"===t.response?this.tasks.fire(t):this.error.fire({error:"unrelated",message:t.message||JSON.stringify(t)})}}}]);', null)
}
},
function (t, e, r) {
'use strict';
var n = window.URL || window.webkitURL;
t.exports = function (t, e) {
try {
try {
var r;
try {
(r = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder)).append(t),
r = r.getBlob()
} catch (e) {
r = new Blob([t])
}
return new Worker(n.createObjectURL(r))
} catch (e) {
return new Worker('data:application/javascript,' + encodeURIComponent(t))
}
} catch (t) {
if (!e) throw Error('Inline worker is not supported');
return new Worker(e)
}
}
}
])
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment