securityos/public/Program Files/BoxedWine/browserfs.boxedwine.js

9 lines
242 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters!

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

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.BrowserFS=e():t.BrowserFS=e()}(this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){(function(t,r,i,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s,a=n(2),c=n(9);!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"}(s||(s={}));var u={};u[s.EPERM]="Operation not permitted.",u[s.ENOENT]="No such file or directory.",u[s.EIO]="Input/output error.",u[s.EBADF]="Bad file descriptor.",u[s.EACCES]="Permission denied.",u[s.EBUSY]="Resource busy or locked.",u[s.EEXIST]="File exists.",u[s.ENOTDIR]="File is not a directory.",u[s.EISDIR]="File is a directory.",u[s.EINVAL]="Invalid argument.",u[s.EFBIG]="File is too big.",u[s.ENOSPC]="No space left on disk.",u[s.EROFS]="Cannot modify a read-only file system.",u[s.ENOTEMPTY]="Directory is not empty.",u[s.ENOTSUP]="Operation is not supported.";var f,h=function(e){function n(t,n,r){void 0===n&&(n=u[t]),e.call(this,n),this.syscall="",this.errno=t,this.code=s[t],this.path=r,this.stack=(new e).stack,this.message="Error: "+this.code+": "+n+(this.path?", '"+this.path+"'":"")}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.fromJSON=function(t){var e=new n(0);return e.errno=t.errno,e.code=t.code,e.path=t.path,e.stack=t.stack,e.message=t.message,e},n.fromBuffer=function(t,e){return void 0===e&&(e=0),n.fromJSON(JSON.parse(t.toString("utf8",e+4,e+4+t.readUInt32LE(e))))},n.FileError=function(t,e){return new n(t,u[t],e)},n.ENOENT=function(t){return this.FileError(s.ENOENT,t)},n.EEXIST=function(t){return this.FileError(s.EEXIST,t)},n.EISDIR=function(t){return this.FileError(s.EISDIR,t)},n.ENOTDIR=function(t){return this.FileError(s.ENOTDIR,t)},n.EPERM=function(t){return this.FileError(s.EPERM,t)},n.ENOTEMPTY=function(t){return this.FileError(s.ENOTEMPTY,t)},n.prototype.toString=function(){return this.message},n.prototype.toJSON=function(){return{errno:this.errno,code:this.code,path:this.path,stack:this.stack,message:this.message}},n.prototype.writeToBuffer=function(e,n){void 0===e&&(e=t.alloc(this.bufferSize())),void 0===n&&(n=0);var r=e.write(JSON.stringify(this.toJSON()),n+4);return e.writeUInt32LE(r,n),e},n.prototype.bufferSize=function(){return 4+t.byteLength(JSON.stringify(this.toJSON()))},n}(Error),p=Object.freeze({get ErrorCode(){return s},ErrorStrings:u,ApiError:h});!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"}(f||(f={}));var l,d=function t(e){if(this.flagStr=e,t.validFlagStrs.indexOf(e)<0)throw new h(s.EINVAL,"Invalid flag: "+e)};d.getFileFlag=function(t){return d.flagCache.hasOwnProperty(t)?d.flagCache[t]:d.flagCache[t]=new d(t)},d.prototype.getFlagString=function(){return this.flagStr},d.prototype.isReadable=function(){return-1!==this.flagStr.indexOf("r")||-1!==this.flagStr.indexOf("+")},d.prototype.isWriteable=function(){return-1!==this.flagStr.indexOf("w")||-1!==this.flagStr.indexOf("a")||-1!==this.flagStr.indexOf("+")},d.prototype.isTruncating=function(){return-1!==this.flagStr.indexOf("w")},d.prototype.isAppendable=function(){return-1!==this.flagStr.indexOf("a")},d.prototype.isSynchronous=function(){return-1!==this.flagStr.indexOf("s")},d.prototype.isExclusive=function(){return-1!==this.flagStr.indexOf("x")},d.prototype.pathExistsAction=function(){return this.isExclusive()?f.THROW_EXCEPTION:this.isTruncating()?f.TRUNCATE_FILE:f.NOP},d.prototype.pathNotExistsAction=function(){return(this.isWriteable()||this.isAppendable())&&"r+"!==this.flagStr?f.CREATE_FILE:f.THROW_EXCEPTION},d.flagCache={},d.validFlagStrs=["r","r+","rs","rs+","w","wx","w+","wx+","a","ax","a+","ax+"],function(t){t[t.FILE=32768]="FILE",t[t.DIRECTORY=16384]="DIRECTORY",t[t.SYMLINK=40960]="SYMLINK"}(l||(l={}));var y=function(t,e,n,r,i,o){if(void 0===r&&(r=new Date),void 0===i&&(i=new Date),void 0===o&&(o=new Date),this.size=e,this.atime=r,this.mtime=i,this.ctime=o,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 l.FILE:this.mode=420;break;case l.DIRECTORY:default:this.mode=511}this.blocks=Math.ceil(e/512),this.mode<4096&&(this.mode|=t)};y.fromBuffer=function(t){var e=t.readUInt32LE(0),n=t.readUInt32LE(4),r=t.readDoubleLE(8),i=t.readDoubleLE(16),o=t.readDoubleLE(24);return new y(61440&n,e,4095&n,new Date(r),new Date(i),new Date(o))},y.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},y.prototype.clone=function(){return new y(61440&this.mode,this.size,4095&this.mode,this.atime,this.mtime,this.ctime)},y.prototype.isFile=function(){return(61440&this.mode)===l.FILE},y.prototype.isDirectory=function(){return(61440&this.mode)===l.DIRECTORY},y.prototype.isSymbolicLink=function(){return(61440&this.mode)===l.SYMLINK},y.prototype.chmod=function(t){this.mode=61440&this.mode|t},y.prototype.isSocket=function(){return!1},y.prototype.isBlockDevice=function(){return!1},y.prototype.isCharacterDevice=function(){return!1},y.prototype.isFIFO=function(){return!1};var g=function(t,e){return t};function m(t){if(t)return t;throw new h(s.EIO,"Initialize BrowserFS with a file system using BrowserFS.initialize(filesystem)")}function _(t,e){switch(typeof t){case"number":return t;case"string":var n=parseInt(t,8);return isNaN(n)?e:n;default:return e}}function w(t){if(t instanceof Date)return t;if("number"==typeof t)return new Date(1e3*t);throw new h(s.EINVAL,"Invalid time.")}function v(t){if(t.indexOf("\0")>=0)throw new h(s.EINVAL,"Path must be a string without null bytes.");if(""===t)throw new h(s.EINVAL,"Path must not be empty.");return c.resolve(t)}function E(t,e,n,r){switch(typeof t){case"object":return{encoding:void 0!==t.encoding?t.encoding:e,flag:void 0!==t.flag?t.flag:n,mode:_(t.mode,r)};case"string":return{encoding:t,flag:n,mode:r};default:return{encoding:e,flag:n,mode:r}}}function b(){}var S=function(){this.F_OK=0,this.R_OK=4,this.W_OK=2,this.X_OK=1,this.root=null,this.fdMap={},this.nextFd=100};S.prototype.initialize=function(t){if(!t.constructor.isAvailable())throw new h(s.EINVAL,"Tried to instantiate BrowserFS with an unavailable file system.");return this.root=t},S.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)},S.prototype.getRootFS=function(){return this.root?this.root:null},S.prototype.rename=function(t,e,n){void 0===n&&(n=b);var r=g(n,1);try{m(this.root).rename(v(t),v(e),r)}catch(t){r(t)}},S.prototype.renameSync=function(t,e){m(this.root).renameSync(v(t),v(e))},S.prototype.exists=function(t,e){void 0===e&&(e=b);var n=g(e,1);try{return m(this.root).exists(v(t),n)}catch(t){return n(!1)}},S.prototype.existsSync=function(t){try{return m(this.root).existsSync(v(t))}catch(t){return!1}},S.prototype.stat=function(t,e){void 0===e&&(e=b);var n=g(e,2);try{return m(this.root).stat(v(t),!1,n)}catch(t){return n(t)}},S.prototype.statSync=function(t){return m(this.root).statSync(v(t),!1)},S.prototype.lstat=function(t,e){void 0===e&&(e=b);var n=g(e,2);try{return m(this.root).stat(v(t),!0,n)}catch(t){return n(t)}},S.prototype.lstatSync=function(t){return m(this.root).statSync(v(t),!0)},S.prototype.truncate=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=b);var r=0;"function"==typeof e?n=e:"number"==typeof e&&(r=e);var i=g(n,1);try{if(r<0)throw new h(s.EINVAL);return m(this.root).truncate(v(t),r,i)}catch(t){return i(t)}},S.prototype.truncateSync=function(t,e){if(void 0===e&&(e=0),e<0)throw new h(s.EINVAL);return m(this.root).truncateSync(v(t),e)},S.prototype.unlink=function(t,e){void 0===e&&(e=b);var n=g(e,1);try{return m(this.root).unlink(v(t),n)}catch(t){return n(t)}},S.prototype.unlinkSync=function(t){return m(this.root).unlinkSync(v(t))},S.prototype.open=function(t,e,n,r){var i=this;void 0===r&&(r=b);var o=_(n,420),s=g(r="function"==typeof n?n:r,2);try{m(this.root).open(v(t),d.getFileFlag(e),o,function(t,e){e?s(t,i.getFdForFile(e)):s(t)})}catch(t){s(t)}},S.prototype.openSync=function(t,e,n){return void 0===n&&(n=420),this.getFdForFile(m(this.root).openSync(v(t),d.getFileFlag(e),_(n,420)))},S.prototype.readFile=function(t,e,n){void 0===e&&(e={}),void 0===n&&(n=b);var r=E(e,null,"r",null),i=g(n="function"==typeof e?e:n,2);try{var o=d.getFileFlag(r.flag);return o.isReadable()?m(this.root).readFile(v(t),r.encoding,o,i):i(new h(s.EINVAL,"Flag passed to readFile must allow for reading."))}catch(t){return i(t)}},S.prototype.readFileSync=function(t,e){void 0===e&&(e={});var n=E(e,null,"r",null),r=d.getFileFlag(n.flag);if(!r.isReadable())throw new h(s.EINVAL,"Flag passed to readFile must allow for reading.");return m(this.root).readFileSync(v(t),n.encoding,r)},S.prototype.writeFile=function(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r=b);var i=E(n,"utf8","w",420),o=g(r="function"==typeof n?n:r,1);try{var a=d.getFileFlag(i.flag);return a.isWriteable()?m(this.root).writeFile(v(t),e,i.encoding,a,i.mode,o):o(new h(s.EINVAL,"Flag passed to writeFile must allow for writing."))}catch(t){return o(t)}},S.prototype.writeFileSync=function(t,e,n){var r=E(n,"utf8","w",420),i=d.getFileFlag(r.flag);if(!i.isWriteable())throw new h(s.EINVAL,"Flag passed to writeFile must allow for writing.");return m(this.root).writeFileSync(v(t),e,r.encoding,i,r.mode)},S.prototype.appendFile=function(t,e,n,r){void 0===r&&(r=b);var i=E(n,"utf8","a",420),o=g(r="function"==typeof n?n:r,1);try{var a=d.getFileFlag(i.flag);if(!a.isAppendable())return o(new h(s.EINVAL,"Flag passed to appendFile must allow for appending."));m(this.root).appendFile(v(t),e,i.encoding,a,i.mode,o)}catch(t){o(t)}},S.prototype.appendFileSync=function(t,e,n){var r=E(n,"utf8","a",420),i=d.getFileFlag(r.flag);if(!i.isAppendable())throw new h(s.EINVAL,"Flag passed to appendFile must allow for appending.");return m(this.root).appendFileSync(v(t),e,r.encoding,i,r.mode)},S.prototype.fstat=function(t,e){void 0===e&&(e=b);var n=g(e,2);try{this.fd2file(t).stat(n)}catch(t){n(t)}},S.prototype.fstatSync=function(t){return this.fd2file(t).statSync()},S.prototype.close=function(t,e){var n=this;void 0===e&&(e=b);var r=g(e,1);try{this.fd2file(t).close(function(e){e||n.closeFd(t),r(e)})}catch(t){r(t)}},S.prototype.closeSync=function(t){this.fd2file(t).closeSync(),this.closeFd(t)},S.prototype.ftruncate=function(t,e,n){void 0===n&&(n=b);var r="number"==typeof e?e:0,i=g(n="function"==typeof e?e:n,1);try{var o=this.fd2file(t);if(r<0)throw new h(s.EINVAL);o.truncate(r,i)}catch(t){i(t)}},S.prototype.ftruncateSync=function(t,e){void 0===e&&(e=0);var n=this.fd2file(t);if(e<0)throw new h(s.EINVAL);n.truncateSync(e)},S.prototype.fsync=function(t,e){void 0===e&&(e=b);var n=g(e,1);try{this.fd2file(t).sync(n)}catch(t){n(t)}},S.prototype.fsyncSync=function(t){this.fd2file(t).syncSync()},S.prototype.fdatasync=function(t,e){void 0===e&&(e=b);var n=g(e,1);try{this.fd2file(t).datasync(n)}catch(t){n(t)}},S.prototype.fdatasyncSync=function(t){this.fd2file(t).datasyncSync()},S.prototype.write=function(e,n,r,i,o,a){void 0===a&&(a=b);var c,u,f,p=null;if("string"==typeof n){var l="utf8";switch(typeof r){case"function":a=r;break;case"number":p=r,l="string"==typeof i?i:"utf8",a="function"==typeof o?o:a;break;default:return(a="function"==typeof i?i:"function"==typeof o?o:a)(new h(s.EINVAL,"Invalid arguments."))}u=0,f=(c=t.from(n,l)).length}else c=n,u=r,f=i,p="number"==typeof o?o:null,a="function"==typeof o?o:a;var d=g(a,3);try{var y=this.fd2file(e);null==p&&(p=y.getPos()),y.write(c,u,f,p,d)}catch(t){d(t)}},S.prototype.writeSync=function(e,n,r,i,o){var s,a,c,u=0;if("string"==typeof n){c="number"==typeof r?r:null;var f="string"==typeof i?i:"utf8";u=0,a=(s=t.from(n,f)).length}else s=n,u=r,a=i,c="number"==typeof o?o:null;var h=this.fd2file(e);return null==c&&(c=h.getPos()),h.writeSync(s,u,a,c)},S.prototype.read=function(e,n,r,i,o,s){var a,c,u,f,h;if(void 0===s&&(s=b),"number"==typeof n){u=n,a=r;var p=i;s="function"==typeof o?o:s,c=0,f=t.alloc(u),h=g(function(t,e,n){if(t)return s(t);s(t,n.toString(p),e)},3)}else f=n,c=r,u=i,a=o,h=g(s,3);try{var l=this.fd2file(e);null==a&&(a=l.getPos()),l.read(f,c,u,a,h)}catch(t){h(t)}},S.prototype.readSync=function(e,n,r,i,o){var s,a,c,u,f=!1,h="utf8";"number"==typeof n?(c=n,u=r,h=i,a=0,s=t.alloc(c),f=!0):(s=n,a=r,c=i,u=o);var p=this.fd2file(e);null==u&&(u=p.getPos());var l=p.readSync(s,a,c,u);return f?[s.toString(h),l]:l},S.prototype.fchown=function(t,e,n,r){void 0===r&&(r=b);var i=g(r,1);try{this.fd2file(t).chown(e,n,i)}catch(t){i(t)}},S.prototype.fchownSync=function(t,e,n){this.fd2file(t).chownSync(e,n)},S.prototype.fchmod=function(t,e,n){var r=g(n,1);try{var i="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmod(i,r)}catch(t){r(t)}},S.prototype.fchmodSync=function(t,e){var n="string"==typeof e?parseInt(e,8):e;this.fd2file(t).chmodSync(n)},S.prototype.futimes=function(t,e,n,r){void 0===r&&(r=b);var i=g(r,1);try{var o=this.fd2file(t);"number"==typeof e&&(e=new Date(1e3*e)),"number"==typeof n&&(n=new Date(1e3*n)),o.utimes(e,n,i)}catch(t){i(t)}},S.prototype.futimesSync=function(t,e,n){this.fd2file(t).utimesSync(w(e),w(n))},S.prototype.rmdir=function(t,e){void 0===e&&(e=b);var n=g(e,1);try{t=v(t),m(this.root).rmdir(t,n)}catch(t){n(t)}},S.prototype.rmdirSync=function(t){return t=v(t),m(this.root).rmdirSync(t)},S.prototype.mkdir=function(t,e,n){void 0===n&&(n=b),"function"==typeof e&&(n=e,e=511);var r=g(n,1);try{t=v(t),m(this.root).mkdir(t,e,r)}catch(t){r(t)}},S.prototype.mkdirSync=function(t,e){m(this.root).mkdirSync(v(t),_(e,511))},S.prototype.readdir=function(t,e){void 0===e&&(e=b);var n=g(e,2);try{t=v(t),m(this.root).readdir(t,n)}catch(t){n(t)}},S.prototype.readdirSync=function(t){return t=v(t),m(this.root).readdirSync(t)},S.prototype.link=function(t,e,n){void 0===n&&(n=b);var r=g(n,1);try{t=v(t),e=v(e),m(this.root).link(t,e,r)}catch(t){r(t)}},S.prototype.linkSync=function(t,e){return t=v(t),e=v(e),m(this.root).linkSync(t,e)},S.prototype.symlink=function(t,e,n,r){void 0===r&&(r=b);var i="string"==typeof n?n:"file",o=g(r="function"==typeof n?n:r,1);try{if("file"!==i&&"dir"!==i)return o(new h(s.EINVAL,"Invalid type: "+i));t=v(t),e=v(e),m(this.root).symlink(t,e,i,o)}catch(t){o(t)}},S.prototype.symlinkSync=function(t,e,n){if(n){if("file"!==n&&"dir"!==n)throw new h(s.EINVAL,"Invalid type: "+n)}else n="file";return t=v(t),e=v(e),m(this.root).symlinkSync(t,e,n)},S.prototype.readlink=function(t,e){void 0===e&&(e=b);var n=g(e,2);try{t=v(t),m(this.root).readlink(t,n)}catch(t){n(t)}},S.prototype.readlinkSync=function(t){return t=v(t),m(this.root).readlinkSync(t)},S.prototype.chown=function(t,e,n,r){void 0===r&&(r=b);var i=g(r,1);try{t=v(t),m(this.root).chown(t,!1,e,n,i)}catch(t){i(t)}},S.prototype.chownSync=function(t,e,n){t=v(t),m(this.root).chownSync(t,!1,e,n)},S.prototype.lchown=function(t,e,n,r){void 0===r&&(r=b);var i=g(r,1);try{t=v(t),m(this.root).chown(t,!0,e,n,i)}catch(t){i(t)}},S.prototype.lchownSync=function(t,e,n){t=v(t),m(this.root).chownSync(t,!0,e,n)},S.prototype.chmod=function(t,e,n){void 0===n&&(n=b);var r=g(n,1);try{var i=_(e,-1);if(i<0)throw new h(s.EINVAL,"Invalid mode.");m(this.root).chmod(v(t),!1,i,r)}catch(t){r(t)}},S.prototype.chmodSync=function(t,e){var n=_(e,-1);if(n<0)throw new h(s.EINVAL,"Invalid mode.");t=v(t),m(this.root).chmodSync(t,!1,n)},S.prototype.lchmod=function(t,e,n){void 0===n&&(n=b);var r=g(n,1);try{var i=_(e,-1);if(i<0)throw new h(s.EINVAL,"Invalid mode.");m(this.root).chmod(v(t),!0,i,r)}catch(t){r(t)}},S.prototype.lchmodSync=function(t,e){var n=_(e,-1);if(n<1)throw new h(s.EINVAL,"Invalid mode.");m(this.root).chmodSync(v(t),!0,n)},S.prototype.utimes=function(t,e,n,r){void 0===r&&(r=b);var i=g(r,1);try{m(this.root).utimes(v(t),w(e),w(n),i)}catch(t){i(t)}},S.prototype.utimesSync=function(t,e,n){m(this.root).utimesSync(v(t),w(e),w(n))},S.prototype.realpath=function(t,e,n){void 0===n&&(n=b);var r="object"==typeof e?e:{},i=g(n="function"==typeof e?e:b,2);try{t=v(t),m(this.root).realpath(t,r,i)}catch(t){i(t)}},S.prototype.realpathSync=function(t,e){return void 0===e&&(e={}),t=v(t),m(this.root).realpathSync(t,e)},S.prototype.watchFile=function(t,e,n){throw void 0===n&&(n=b),new h(s.ENOTSUP)},S.prototype.unwatchFile=function(t,e){throw void 0===e&&(e=b),new h(s.ENOTSUP)},S.prototype.watch=function(t,e,n){throw void 0===n&&(n=b),new h(s.ENOTSUP)},S.prototype.access=function(t,e,n){throw void 0===n&&(n=b),new h(s.ENOTSUP)},S.prototype.accessSync=function(t,e){throw new h(s.ENOTSUP)},S.prototype.createReadStream=function(t,e){throw new h(s.ENOTSUP)},S.prototype.createWriteStream=function(t,e){throw new h(s.ENOTSUP)},S.prototype.wrapCallbacks=function(t){g=t},S.prototype.getFdForFile=function(t){var e=this.nextFd++;return this.fdMap[e]=t,e},S.prototype.fd2file=function(t){var e=this.fdMap[t];if(e)return e;throw new h(s.EBADF,"Invalid file descriptor.")},S.prototype.closeFd=function(t){delete this.fdMap[t]},S.Stats=y;var k=new S,I={},O=S.prototype;function F(t,e,n,r,i){return t<e||n<e?t>n?n+1:t+1:r===i?e:e+1}function N(t,e,n){t&&console.warn("["+e+"] Direct file system constructor usage is deprecated for this file system, and will be removed in the next major version. Please use the '"+e+".Create("+JSON.stringify(n)+", callback)' method instead. See https://github.com/jvilk/BrowserFS/issues/176 for more details.")}Object.keys(O).forEach(function(t){"function"==typeof k[t]?I[t]=function(){return k[t].apply(k,arguments)}:I[t]=k[t]}),I.changeFSModule=function(t){k=t},I.getFSModule=function(){return k},I.FS=S;var R="undefined"!=typeof navigator&&!(!/(msie) ([\w.]+)/.exec(navigator.userAgent.toLowerCase())&&-1===navigator.userAgent.indexOf("Trident")),L="undefined"==typeof window;function T(){throw new Error("BFS has reached an impossible code path; please file a bug.")}function x(t,e,n){n.existsSync(t)||(x(c.dirname(t),e,n),n.mkdirSync(t,e))}function A(t){var e=D(t),n=e.byteOffset,r=e.byteLength;return 0===n&&r===e.buffer.byteLength?e.buffer:e.buffer.slice(n,n+r)}function D(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function P(e){return e instanceof t?e:e instanceof Uint8Array?C(e):t.from(e)}function C(e){return e instanceof t?e:0===e.byteOffset&&e.byteLength===e.buffer.byteLength?U(e.buffer):t.from(e.buffer,e.byteOffset,e.byteLength)}function U(e){return t.from(e)}function M(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=t.length),e<0||n<0||n>t.length||e>n)throw new TypeError("Invalid slice bounds on buffer of length "+t.length+": ["+e+", "+n+"]");if(0===t.length)return B();var r=D(t),i=t[0],o=(i+1)%255;return t[0]=o,r[0]===o?(r[0]=i,C(r.slice(e,n))):(t[0]=i,C(r.subarray(e,n)))}var j=null;function B(){return j||(j=t.alloc(0))}function z(e,n){t.isBuffer(e)?n():n(new h(s.EINVAL,"option must be a Buffer."))}function q(t,e,n){var r=t.Options,i=t.Name,o=0,a=!1,c=!1;function u(t){a||(t&&(a=!0,n(t)),0===--o&&c&&n())}var f=function(t){if(r.hasOwnProperty(t)){var c=r[t],f=e[t];if(null==f){if(!c.optional){var p=Object.keys(e).filter(function(t){return!(t in r)}).map(function(e){return{str:e,distance:function(t,e){if(t===e)return 0;if(t.length>e.length){var n=t;t=e,e=n}for(var r=t.length,i=e.length;r>0&&t.charCodeAt(r-1)===e.charCodeAt(i-1);)r--,i--;for(var o=0;o<r&&t.charCodeAt(o)===e.charCodeAt(o);)o++;if(i-=o,0==(r-=o)||1===i)return i;for(var s,a,c,u,f,h=new Array(r<<1),p=0;p<r;)h[r+p]=t.charCodeAt(o+p),h[p]=++p;for(s=0;s+3<i;)for(var l=e.charCodeAt(o+(a=s)),d=e.charCodeAt(o+(c=s+1)),y=e.charCodeAt(o+(u=s+2)),g=e.charCodeAt(o+(f=s+3)),m=s+=4,_=0;_<r;){var w=h[r+_],v=h[_];m=F(u=F(c=F(a=F(v,a,c,l,w),c,u,d,w),u,f,y,w),f,m,g,w),h[_++]=m,f=u,u=c,c=a,a=v}for(var E=0;s<i;){var b=e.charCodeAt(o+(a=s));E=++s;for(var S=0;S<r;S++){var k=h[S];h[S]=E=k<a||E<a?k>E?E+1:k+1:b===h[r+S]?a:a+1,a=k}}return E}(t,e)}}).filter(function(t){return t.distance<5}).sort(function(t,e){return t.distance-e.distance});return a?{}:(a=!0,{v:n(new h(s.EINVAL,"["+i+"] Required option '"+t+"' not provided."+(p.length>0?" You provided unrecognized option '"+p[0].str+"'; perhaps you meant to type '"+t+"'.":"")+"\nOption description: "+c.description))})}}else{if(!(Array.isArray(c.type)?-1!==c.type.indexOf(typeof f):typeof f===c.type))return a?{}:(a=!0,{v:n(new h(s.EINVAL,"["+i+"] Value provided for option "+t+" is not the proper type. Expected "+(Array.isArray(c.type)?"one of {"+c.type.join(", ")+"}":c.type)+", but received "+typeof f+"\nOption description: "+c.description))});c.validator&&(o++,c.validator(f,u))}}};for(var p in r){var l=f(p);if(l)return l.v}c=!0,0!==o||a||n()}var V=Object.freeze({deprecationMessage:N,isIE:R,isWebWorker:L,fail:T,mkdirpSync:x,buffer2ArrayBuffer:A,buffer2Uint8array:D,arrayish2Buffer:P,uint8Array2Buffer:C,arrayBuffer2Buffer:U,copyingSlice:M,emptyBuffer:B,bufferValidator:z,checkOptions:q}),W=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};W.prototype.open=function(t){var e=this.fs.realPath(t.node),n=this.FS;try{n.isFile(t.node.mode)&&(t.nfd=this.nodefs.openSync(e,this.fs.flagsToPermissionString(t.flags)))}catch(t){if(!t.code)throw t;throw new n.ErrnoError(this.ERRNO_CODES[t.code])}},W.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])}},W.prototype.read=function(t,e,n,r,i){try{return this.nodefs.readSync(t.nfd,C(e),n,r,i)}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},W.prototype.write=function(t,e,n,r,i){try{return this.nodefs.writeSync(t.nfd,C(e),n,r,i)}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},W.prototype.llseek=function(t,e,n){var r=e;if(1===n)r+=t.position;else if(2===n&&this.FS.isFile(t.node.mode))try{r+=this.nodefs.fstatSync(t.nfd).size}catch(t){throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}if(r<0)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return t.position=r,r};var H=function(t){this.fs=t,this.nodefs=t.getNodeFS(),this.FS=t.getFS(),this.PATH=t.getPATH(),this.ERRNO_CODES=t.getERRNO_CODES()};H.prototype.getattr=function(t){var e,n=this.fs.realPath(t);try{e=this.nodefs.lstatSync(n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},H.prototype.setattr=function(t,e){var n=this.fs.realPath(t);try{if(void 0!==e.mode&&(this.nodefs.chmodSync(n,e.mode),t.mode=e.mode),void 0!==e.timestamp){var r=new Date(e.timestamp);this.nodefs.utimesSync(n,r,r)}}catch(t){if(!t.code)throw t;if("ENOTSUP"!==t.code)throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}if(void 0!==e.size)try{this.nodefs.truncateSync(n,e.size)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},H.prototype.lookup=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e),r=this.fs.getMode(n);return this.fs.createNode(t,e,r)},H.prototype.mknod=function(t,e,n,r){var i=this.fs.createNode(t,e,n,r),o=this.fs.realPath(i);try{this.FS.isDir(i.mode)?this.nodefs.mkdirSync(o,i.mode):this.nodefs.writeFileSync(o,"",{mode:i.mode})}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}return i},H.prototype.rename=function(t,e,n){var r=this.fs.realPath(t),i=this.PATH.join2(this.fs.realPath(e),n);try{this.nodefs.renameSync(r,i),t.name=n,t.parent=e}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},H.prototype.unlink=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.unlinkSync(n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},H.prototype.rmdir=function(t,e){var n=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.rmdirSync(n)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},H.prototype.readdir=function(t){var e=this.fs.realPath(t);try{var n=this.nodefs.readdirSync(e);return n.push(".",".."),n}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},H.prototype.symlink=function(t,e,n){var r=this.PATH.join2(this.fs.realPath(t),e);try{this.nodefs.symlinkSync(n,r)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}},H.prototype.readlink=function(t){var e=this.fs.realPath(t);try{return this.nodefs.readlinkSync(e)}catch(t){if(!t.code)throw t;throw new this.FS.ErrnoError(this.ERRNO_CODES[t.code])}};var Z=function(t,e,n,r){void 0===t&&(t=self.FS),void 0===e&&(e=self.PATH),void 0===n&&(n=self.ERRNO_CODES),void 0===r&&(r=I),this.flagsToPermissionStringMap={0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},this.nodefs=r,this.FS=t,this.PATH=e,this.ERRNO_CODES=n,this.node_ops=new H(this),this.stream_ops=new W(this)};Z.prototype.mount=function(t){return this.createNode(null,"/",this.getMode(t.opts.root),0)},Z.prototype.createNode=function(t,e,n,r){var i=this.FS;if(!i.isDir(n)&&!i.isFile(n)&&!i.isLink(n))throw new i.ErrnoError(this.ERRNO_CODES.EINVAL);var o=i.createNode(t,e,n);return o.node_ops=this.node_ops,o.stream_ops=this.stream_ops,o},Z.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},Z.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)},Z.prototype.flagsToPermissionString=function(t){var e="string"==typeof t?parseInt(t,10):t;return(e&=8191)in this.flagsToPermissionStringMap?this.flagsToPermissionStringMap[e]:t},Z.prototype.getNodeFS=function(){return this.nodefs},Z.prototype.getFS=function(){return this.FS},Z.prototype.getPATH=function(){return this.PATH},Z.prototype.getERRNO_CODES=function(){return this.ERRNO_CODES};var Y=function(){};Y.prototype.supportsLinks=function(){return!1},Y.prototype.diskSpace=function(t,e){e(0,0)},Y.prototype.openFile=function(t,e,n){throw new h(s.ENOTSUP)},Y.prototype.createFile=function(t,e,n,r){throw new h(s.ENOTSUP)},Y.prototype.open=function(t,e,n,r){var i=this;this.stat(t,!1,function(o,a){if(o)switch(e.pathNotExistsAction()){case f.CREATE_FILE:return i.stat(c.dirname(t),!1,function(o,s){o?r(o):s&&!s.isDirectory()?r(h.ENOTDIR(c.dirname(t))):i.createFile(t,e,n,r)});case f.THROW_EXCEPTION:return r(h.ENOENT(t));default:return r(new h(s.EINVAL,"Invalid FileFlag object."))}else{if(a&&a.isDirectory())return r(h.EISDIR(t));switch(e.pathExistsAction()){case f.THROW_EXCEPTION:return r(h.EEXIST(t));case f.TRUNCATE_FILE:return i.openFile(t,e,function(t,e){t?r(t):e?e.truncate(0,function(){e.sync(function(){r(null,e)})}):T()});case f.NOP:return i.openFile(t,e,r);default:return r(new h(s.EINVAL,"Invalid FileFlag object."))}}})},Y.prototype.rename=function(t,e,n){n(new h(s.ENOTSUP))},Y.prototype.renameSync=function(t,e){throw new h(s.ENOTSUP)},Y.prototype.stat=function(t,e,n){n(new h(s.ENOTSUP))},Y.prototype.statSync=function(t,e){throw new h(s.ENOTSUP)},Y.prototype.openFileSync=function(t,e,n){throw new h(s.ENOTSUP)},Y.prototype.createFileSync=function(t,e,n){throw new h(s.ENOTSUP)},Y.prototype.openSync=function(t,e,n){var r;try{r=this.statSync(t,!1)}catch(r){switch(e.pathNotExistsAction()){case f.CREATE_FILE:if(!this.statSync(c.dirname(t),!1).isDirectory())throw h.ENOTDIR(c.dirname(t));return this.createFileSync(t,e,n);case f.THROW_EXCEPTION:throw h.ENOENT(t);default:throw new h(s.EINVAL,"Invalid FileFlag object.")}}if(r.isDirectory())throw h.EISDIR(t);switch(e.pathExistsAction()){case f.THROW_EXCEPTION:throw h.EEXIST(t);case f.TRUNCATE_FILE:return this.unlinkSync(t),this.createFileSync(t,e,r.mode);case f.NOP:return this.openFileSync(t,e,n);default:throw new h(s.EINVAL,"Invalid FileFlag object.")}},Y.prototype.unlink=function(t,e){e(new h(s.ENOTSUP))},Y.prototype.unlinkSync=function(t){throw new h(s.ENOTSUP)},Y.prototype.rmdir=function(t,e){e(new h(s.ENOTSUP))},Y.prototype.rmdirSync=function(t){throw new h(s.ENOTSUP)},Y.prototype.mkdir=function(t,e,n){n(new h(s.ENOTSUP))},Y.prototype.mkdirSync=function(t,e){throw new h(s.ENOTSUP)},Y.prototype.readdir=function(t,e){e(new h(s.ENOTSUP))},Y.prototype.readdirSync=function(t){throw new h(s.ENOTSUP)},Y.prototype.exists=function(t,e){this.stat(t,null,function(t){e(!t)})},Y.prototype.existsSync=function(t){try{return this.statSync(t,!0),!0}catch(t){return!1}},Y.prototype.realpath=function(t,e,n){if(this.supportsLinks())for(var r=t.split(c.sep),i=0;i<r.length;i++){var o=r.slice(0,i+1);r[i]=c.join.apply(null,o)}else this.exists(t,function(e){e?n(null,t):n(h.ENOENT(t))})},Y.prototype.realpathSync=function(t,e){if(this.supportsLinks()){for(var n=t.split(c.sep),r=0;r<n.length;r++){var i=n.slice(0,r+1);n[r]=c.join.apply(c,i)}return n.join(c.sep)}if(this.existsSync(t))return t;throw h.ENOENT(t)},Y.prototype.truncate=function(t,e,n){this.open(t,d.getFileFlag("r+"),420,function(t,r){if(t)return n(t);r.truncate(e,function(t){r.close(function(e){n(t||e)})})})},Y.prototype.truncateSync=function(t,e){var n=this.openSync(t,d.getFileFlag("r+"),420);try{n.truncateSync(e)}catch(t){throw t}finally{n.closeSync()}},Y.prototype.readFile=function(e,n,r,i){var o=i;this.open(e,r,420,function(e,r){if(e)return i(e);i=function(t,e){r.close(function(n){return t||(t=n),o(t,e)})},r.stat(function(e,o){if(e)return i(e);var s=t.alloc(o.size);r.read(s,0,o.size,0,function(t){if(t)return i(t);if(null===n)return i(t,s);try{i(null,s.toString(n))}catch(t){i(t)}})})})},Y.prototype.readFileSync=function(e,n,r){var i=this.openSync(e,r,420);try{var o=i.statSync(),s=t.alloc(o.size);return i.readSync(s,0,o.size,0),i.closeSync(),null===n?s:s.toString(n)}finally{i.closeSync()}},Y.prototype.writeFile=function(e,n,r,i,o,s){var a=s;this.open(e,i,420,function(e,i){if(e)return s(e);s=function(t){i.close(function(e){a(t||e)})};try{"string"==typeof n&&(n=t.from(n,r))}catch(t){return s(t)}i.write(n,0,n.length,0,s)})},Y.prototype.writeFileSync=function(e,n,r,i,o){var s=this.openSync(e,i,o);try{"string"==typeof n&&(n=t.from(n,r)),s.writeSync(n,0,n.length,0)}finally{s.closeSync()}},Y.prototype.appendFile=function(e,n,r,i,o,s){var a=s;this.open(e,i,o,function(e,i){if(e)return s(e);s=function(t){i.close(function(e){a(t||e)})},"string"==typeof n&&(n=t.from(n,r)),i.write(n,0,n.length,null,s)})},Y.prototype.appendFileSync=function(e,n,r,i,o){var s=this.openSync(e,i,o);try{"string"==typeof n&&(n=t.from(n,r)),s.writeSync(n,0,n.length,null)}finally{s.closeSync()}},Y.prototype.chmod=function(t,e,n,r){r(new h(s.ENOTSUP))},Y.prototype.chmodSync=function(t,e,n){throw new h(s.ENOTSUP)},Y.prototype.chown=function(t,e,n,r,i){i(new h(s.ENOTSUP))},Y.prototype.chownSync=function(t,e,n,r){throw new h(s.ENOTSUP)},Y.prototype.utimes=function(t,e,n,r){r(new h(s.ENOTSUP))},Y.prototype.utimesSync=function(t,e,n){throw new h(s.ENOTSUP)},Y.prototype.link=function(t,e,n){n(new h(s.ENOTSUP))},Y.prototype.linkSync=function(t,e){throw new h(s.ENOTSUP)},Y.prototype.symlink=function(t,e,n,r){r(new h(s.ENOTSUP))},Y.prototype.symlinkSync=function(t,e,n){throw new h(s.ENOTSUP)},Y.prototype.readlink=function(t,e){e(new h(s.ENOTSUP))},Y.prototype.readlinkSync=function(t){throw new h(s.ENOTSUP)};var X=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.supportsSynch=function(){return!0},e.prototype.rename=function(t,e,n){try{this.renameSync(t,e),n()}catch(t){n(t)}},e.prototype.stat=function(t,e,n){try{n(null,this.statSync(t,e))}catch(t){n(t)}},e.prototype.open=function(t,e,n,r){try{r(null,this.openSync(t,e,n))}catch(t){r(t)}},e.prototype.unlink=function(t,e){try{this.unlinkSync(t),e()}catch(t){e(t)}},e.prototype.rmdir=function(t,e){try{this.rmdirSync(t),e()}catch(t){e(t)}},e.prototype.mkdir=function(t,e,n){try{this.mkdirSync(t,e),n()}catch(t){n(t)}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(t){e(t)}},e.prototype.chmod=function(t,e,n,r){try{this.chmodSync(t,e,n),r()}catch(t){r(t)}},e.prototype.chown=function(t,e,n,r,i){try{this.chownSync(t,e,n,r),i()}catch(t){i(t)}},e.prototype.utimes=function(t,e,n,r){try{this.utimesSync(t,e,n),r()}catch(t){r(t)}},e.prototype.link=function(t,e,n){try{this.linkSync(t,e),n()}catch(t){n(t)}},e.prototype.symlink=function(t,e,n,r){try{this.symlinkSync(t,e,n),r()}catch(t){r(t)}},e.prototype.readlink=function(t,e){try{e(null,this.readlinkSync(t))}catch(t){e(t)}},e}(Y),K=function(){};K.prototype.sync=function(t){t(new h(s.ENOTSUP))},K.prototype.syncSync=function(){throw new h(s.ENOTSUP)},K.prototype.datasync=function(t){this.sync(t)},K.prototype.datasyncSync=function(){return this.syncSync()},K.prototype.chown=function(t,e,n){n(new h(s.ENOTSUP))},K.prototype.chownSync=function(t,e){throw new h(s.ENOTSUP)},K.prototype.chmod=function(t,e){e(new h(s.ENOTSUP))},K.prototype.chmodSync=function(t){throw new h(s.ENOTSUP)},K.prototype.utimes=function(t,e,n){n(new h(s.ENOTSUP))},K.prototype.utimesSync=function(t,e){throw new h(s.ENOTSUP)};var J=function(e){function n(t,n,r,i,o){if(e.call(this),this._pos=0,this._dirty=!1,this._fs=t,this._path=n,this._flag=r,this._stat=i,this._buffer=o||B(),this._stat.size!==this._buffer.length&&this._flag.isReadable())throw new Error("Invalid buffer: Buffer is "+this._buffer.length+" long, yet Stats object specifies that file is "+this._stat.size+" long.")}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.getBuffer=function(){return this._buffer},n.prototype.getStats=function(){return this._stat},n.prototype.getFlag=function(){return this._flag},n.prototype.getPath=function(){return this._path},n.prototype.getPos=function(){return this._flag.isAppendable()?this._stat.size:this._pos},n.prototype.advancePos=function(t){return this._pos+=t},n.prototype.setPos=function(t){return this._pos=t},n.prototype.sync=function(t){try{this.syncSync(),t()}catch(e){t(e)}},n.prototype.syncSync=function(){throw new h(s.ENOTSUP)},n.prototype.close=function(t){try{this.closeSync(),t()}catch(e){t(e)}},n.prototype.closeSync=function(){throw new h(s.ENOTSUP)},n.prototype.stat=function(t){try{t(null,this._stat.clone())}catch(e){t(e)}},n.prototype.statSync=function(){return this._stat.clone()},n.prototype.truncate=function(t,e){try{this.truncateSync(t),this._flag.isSynchronous()&&!I.getRootFS().supportsSynch()&&this.sync(e),e()}catch(t){return e(t)}},n.prototype.truncateSync=function(e){if(this._dirty=!0,!this._flag.isWriteable())throw new h(s.EPERM,"File not opened with a writeable mode.");if(this._stat.mtime=new Date,e>this._buffer.length){var n=t.alloc(e-this._buffer.length,0);return this.writeSync(n,0,n.length,this._buffer.length),void(this._flag.isSynchronous()&&I.getRootFS().supportsSynch()&&this.syncSync())}this._stat.size=e;var r=t.alloc(e);this._buffer.copy(r,0,0,e),this._buffer=r,this._flag.isSynchronous()&&I.getRootFS().supportsSynch()&&this.syncSync()},n.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(t){i(t)}},n.prototype.writeSync=function(e,n,r,i){if(this._dirty=!0,null==i&&(i=this.getPos()),!this._flag.isWriteable())throw new h(s.EPERM,"File not opened with a writeable mode.");var o=i+r;if(o>this._stat.size&&(this._stat.size=o,o>this._buffer.length)){var a=t.alloc(o);this._buffer.copy(a),this._buffer=a}var c=e.copy(this._buffer,i,n,n+r);return this._stat.mtime=new Date,this._flag.isSynchronous()?(this.syncSync(),c):(this.setPos(i+c),c)},n.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(t){i(t)}},n.prototype.readSync=function(t,e,n,r){if(!this._flag.isReadable())throw new h(s.EPERM,"File not opened with a readable mode.");null==r&&(r=this.getPos()),r+n>this._stat.size&&(n=this._stat.size-r);var i=this._buffer.copy(t,e,r,r+n);return this._stat.atime=new Date,this._pos=r+n,i},n.prototype.chmod=function(t,e){try{this.chmodSync(t),e()}catch(t){e(t)}},n.prototype.chmodSync=function(t){if(!this._fs.supportsProps())throw new h(s.ENOTSUP);this._dirty=!0,this._stat.chmod(t),this.syncSync()},n.prototype.isDirty=function(){return this._dirty},n.prototype.resetDirty=function(){this._dirty=!1},n}(K),G=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.close=function(t){t()},e.prototype.closeSync=function(){},e}(J),Q=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(J),$=function(t){function e(n,r,i){if(void 0===i&&(i=!0),t.call(this),this._queue=[],this._queueRunning=!1,this._isInitialized=!1,this._initializeCallbacks=[],this._sync=n,this._async=r,!n.supportsSynch())throw new Error("The first argument to AsyncMirror needs to be a synchronous file system.");N(i,e.Name,{sync:"sync file system instance",async:"async file system instance"})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){try{var r=new e(t.sync,t.async,!1);r.initialize(function(t){t?n(t):n(null,r)},!1)}catch(t){n(t)}},e.isAvailable=function(){return!0},e.prototype.getName=function(){return e.Name},e.prototype._syncSync=function(t){this._sync.writeFileSync(t.getPath(),t.getBuffer(),null,d.getFileFlag("w"),t.getStats().mode),this.enqueueOp({apiMethod:"writeFile",arguments:[t.getPath(),t.getBuffer(),null,t.getFlag(),t.getStats().mode]})},e.prototype.initialize=function(t,e){var n=this;void 0===e&&(e=!0),e&&console.warn("[AsyncMirror] AsyncMirror.initialize() is deprecated and will be removed in the next major version. Please use 'AsyncMirror.Create({ sync: (sync file system instance), async: (async file system instance)}, cb)' to create and initialize AsyncMirror instances.");var r=this._initializeCallbacks;if(this._isInitialized)t();else if(1===r.push(t)){var i=function(t,e,r){"/"!==t&&n._sync.mkdirSync(t,e),n._async.readdir(t,function(e,n){var i=0;e?r(e):function e(s){s?r(s):i<n.length?(o(c.join(t,n[i]),e),i++):r()}()})},o=function(t,e){n._async.stat(t,!1,function(r,o){r?e(r):o.isDirectory()?i(t,o.mode,e):function(t,e,r){n._async.readFile(t,null,d.getFileFlag("r"),function(i,o){if(i)r(i);else try{n._sync.writeFileSync(t,o,null,d.getFileFlag("w"),e)}catch(t){i=t}finally{r(i)}})}(t,o.mode,e)})};i("/",0,function(t){n._isInitialized=!t,n._initializeCallbacks=[],r.forEach(function(e){return e(t)})})}},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._sync.supportsProps()&&this._async.supportsProps()},e.prototype.renameSync=function(t,e){this.checkInitialized(),this._sync.renameSync(t,e),this.enqueueOp({apiMethod:"rename",arguments:[t,e]})},e.prototype.statSync=function(t,e){return this.checkInitialized(),this._sync.statSync(t,e)},e.prototype.openSync=function(t,e,n){return this.checkInitialized(),this._sync.openSync(t,e,n).closeSync(),new Q(this,t,e,this._sync.statSync(t,!1),this._sync.readFileSync(t,null,d.getFileFlag("r")))},e.prototype.unlinkSync=function(t){this.checkInitialized(),this._sync.unlinkSync(t),this.enqueueOp({apiMethod:"unlink",arguments:[t]})},e.prototype.rmdirSync=function(t){this.checkInitialized(),this._sync.rmdirSync(t),this.enqueueOp({apiMethod:"rmdir",arguments:[t]})},e.prototype.mkdirSync=function(t,e){this.checkInitialized(),this._sync.mkdirSync(t,e),this.enqueueOp({apiMethod:"mkdir",arguments:[t,e]})},e.prototype.readdirSync=function(t){return this.checkInitialized(),this._sync.readdirSync(t)},e.prototype.existsSync=function(t){return this.checkInitialized(),this._sync.existsSync(t)},e.prototype.chmodSync=function(t,e,n){this.checkInitialized(),this._sync.chmodSync(t,e,n),this.enqueueOp({apiMethod:"chmod",arguments:[t,e,n]})},e.prototype.chownSync=function(t,e,n,r){this.checkInitialized(),this._sync.chownSync(t,e,n,r),this.enqueueOp({apiMethod:"chown",arguments:[t,e,n,r]})},e.prototype.utimesSync=function(t,e,n){this.checkInitialized(),this._sync.utimesSync(t,e,n),this.enqueueOp({apiMethod:"utimes",arguments:[t,e,n]})},e.prototype.checkInitialized=function(){if(!this._isInitialized)throw new h(s.EPERM,"AsyncMirrorFS is not initialized. Please initialize AsyncMirrorFS using its initialize() method before using it.")},e.prototype.enqueueOp=function(t){var e=this;if(this._queue.push(t),!this._queueRunning){this._queueRunning=!0;var n=function(t){if(t&&console.error("WARNING: File system has desynchronized. Received following error: "+t+"\n$"),e._queue.length>0){var r=e._queue.shift(),i=r.arguments;i.push(n),e._async[r.apiMethod].apply(e._async,i)}else e._queueRunning=!1};n()}},e}(X);$.Name="AsyncMirror",$.Options={sync:{type:"object",description:"The synchronous file system to mirror the asynchronous file system to."},async:{type:"object",description:"The asynchronous file system to mirror."}};var tt=Math.max;function et(t){return t}function nt(t,e){return function(t,e,n){return e=tt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=tt(r.length-e,0),s=Array(o);++i<o;)s[i]=r[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=r[i];return a[e]=n(s),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,a)}}(t,e,et)}var rt=function(t){return nt(function(e){var n=e.pop();t.call(this,e,n)})};function it(t){return nt(function(e,n){var r=rt(function(n,r){var i=this;return t(e,function(t,e){t.apply(i,n.concat(e))},r)});return n.length?r.apply(this,n):r})}var ot="object"==typeof r&&r&&r.Object===Object&&r,st="object"==typeof self&&self&&self.Object===Object&&self,at=ot||st||Function("return this")(),ct=at.Symbol,ut=Object.prototype,ft=ut.hasOwnProperty,ht=ut.toString,pt=ct?ct.toStringTag:void 0;var lt=Object.prototype.toString;var dt="[object Null]",yt="[object Undefined]",gt=ct?ct.toStringTag:void 0;function mt(t){return null==t?void 0===t?yt:dt:gt&&gt in Object(t)?function(t){var e=ft.call(t,pt),n=t[pt];try{t[pt]=void 0;var r=!0}catch(t){}var i=ht.call(t);return r&&(e?t[pt]=n:delete t[pt]),i}(t):function(t){return lt.call(t)}(t)}var _t="[object AsyncFunction]",wt="[object Function]",vt="[object GeneratorFunction]",Et="[object Proxy]";var bt=9007199254740991;function St(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=bt}function kt(t){return null!=t&&St(t.length)&&!function(t){if(!function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}(t))return!1;var e=mt(t);return e==wt||e==vt||e==_t||e==Et}(t)}var It={};function Ot(){}function Ft(t){return function(){if(null!==t){var e=t;t=null,e.apply(this,arguments)}}}var Nt="function"==typeof Symbol&&Symbol.iterator,Rt=function(t){return Nt&&t[Nt]&&t[Nt]()};function Lt(t){return null!=t&&"object"==typeof t}var Tt="[object Arguments]";function xt(t){return Lt(t)&&mt(t)==Tt}var At=Object.prototype,Dt=At.hasOwnProperty,Pt=At.propertyIsEnumerable,Ct=xt(function(){return arguments}())?xt:function(t){return Lt(t)&&Dt.call(t,"callee")&&!Pt.call(t,"callee")},Ut=Array.isArray;var Mt="object"==typeof e&&e&&!e.nodeType&&e,jt=Mt&&"object"==typeof i&&i&&!i.nodeType&&i,Bt=jt&&jt.exports===Mt?at.Buffer:void 0,zt=(Bt?Bt.isBuffer:void 0)||function(){return!1},qt=9007199254740991,Vt=/^(?:0|[1-9]\d*)$/;function Wt(t,e){return!!(e=null==e?qt:e)&&("number"==typeof t||Vt.test(t))&&t>-1&&t%1==0&&t<e}var Ht={};Ht["[object Float32Array]"]=Ht["[object Float64Array]"]=Ht["[object Int8Array]"]=Ht["[object Int16Array]"]=Ht["[object Int32Array]"]=Ht["[object Uint8Array]"]=Ht["[object Uint8ClampedArray]"]=Ht["[object Uint16Array]"]=Ht["[object Uint32Array]"]=!0,Ht["[object Arguments]"]=Ht["[object Array]"]=Ht["[object ArrayBuffer]"]=Ht["[object Boolean]"]=Ht["[object DataView]"]=Ht["[object Date]"]=Ht["[object Error]"]=Ht["[object Function]"]=Ht["[object Map]"]=Ht["[object Number]"]=Ht["[object Object]"]=Ht["[object RegExp]"]=Ht["[object Set]"]=Ht["[object String]"]=Ht["[object WeakMap]"]=!1;var Zt,Yt="object"==typeof e&&e&&!e.nodeType&&e,Xt=Yt&&"object"==typeof i&&i&&!i.nodeType&&i,Kt=Xt&&Xt.exports===Yt&&ot.process,Jt=function(){try{return Kt&&Kt.binding&&Kt.binding("util")}catch(t){}}(),Gt=Jt&&Jt.isTypedArray,Qt=Gt?(Zt=Gt,function(t){return Zt(t)}):function(t){return Lt(t)&&St(t.length)&&!!Ht[mt(t)]},$t=Object.prototype.hasOwnProperty;function te(t,e){var n=Ut(t),r=!n&&Ct(t),i=!n&&!r&&zt(t),o=!n&&!r&&!i&&Qt(t),s=n||r||i||o,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var u in t)!e&&!$t.call(t,u)||s&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||Wt(u,c))||a.push(u);return a}var ee=Object.prototype;var ne=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),re=Object.prototype.hasOwnProperty;function ie(t){if(n=(e=t)&&e.constructor,e!==("function"==typeof n&&n.prototype||ee))return ne(t);var e,n,r=[];for(var i in Object(t))re.call(t,i)&&"constructor"!=i&&r.push(i);return r}function oe(t){return kt(t)?te(t):ie(t)}function se(t){if(kt(t))return function(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}(t);var e,n,r,i,o=Rt(t);return o?function(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}(o):(n=oe(e=t),r=-1,i=n.length,function(){var t=n[++r];return r<i?{value:e[t],key:t}:null})}function ae(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null,e.apply(this,arguments)}}function ce(t){return function(e,n,r){if(r=Ft(r||Ot),t<=0||!e)return r(null);var i=se(e),o=!1,s=0;function a(t,e){if(s-=1,t)o=!0,r(t);else{if(e===It||o&&s<=0)return o=!0,r(null);c()}}function c(){for(;s<t&&!o;){var e=i();if(null===e)return o=!0,void(s<=0&&r(null));s+=1,n(e.value,e.key,ae(a))}}c()}}function ue(t,e,n,r){ce(e)(t,n,r)}function fe(t,e){return function(n,r,i){return t(n,e,r,i)}}function he(t,e,n){n=Ft(n||Ot);var r=0,i=0,o=t.length;function s(t,e){t?n(t):++i!==o&&e!==It||n(null)}for(0===o&&n(null);r<o;r++)e(t[r],r,ae(s))}var pe,le=fe(ue,1/0),de=function(t,e,n){(kt(t)?he:le)(t,e,n)};function ye(t,e,n,r){r=r||Ot;var i=[],o=0;t(e=e||[],function(t,e,r){var s=o++;n(t,function(t,e){i[s]=e,r(t)})},function(t){r(t,i)})}it((pe=ye,function(t,e,n){return pe(de,t,e,n)})),it(fe(function(t){return function(e,n,r,i){return t(ce(n),e,r,i)}}(ye),1)),nt(function(t,e){return nt(function(n){return t.apply(null,e.concat(n))})});var ge="[\\ud800-\\udfff]",me="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",_e="[^\\ud800-\\udfff]",we="(?:\\ud83c[\\udde6-\\uddff]){2}",ve="[\\ud800-\\udbff][\\udc00-\\udfff]",Ee="(?:"+me+"|\\ud83c[\\udffb-\\udfff])"+"?",be=([_e,we,ve].join("|"),[_e+me+"?",me,we,ve,ge].join("|"),"function"==typeof setImmediate&&setImmediate),Se="object"==typeof o&&"function"==typeof o.nextTick;function ke(t){setTimeout(t,0)}function Ie(t){return nt(function(e,n){t(function(){e.apply(null,n)})})}Ie(be?setImmediate:Se?o.nextTick:ke);var Oe=fe(ue,1);var Fe=nt(function(t){return nt(function(e){var n,r,i,o,s=this,a=e[e.length-1];"function"==typeof a?e.pop():a=Ot,n=t,r=e,i=function(t,e,n){e.apply(s,t.concat(nt(function(t,e){n(t,e)})))},o=Ft((o=function(t,e){a.apply(s,[t].concat(e))})||Ot),Oe(n,function(t,e,n){i(r,t,function(t,e){r=e,n(t)})},function(t){o(t,r)})})});function Ne(t){return nt(function(e,n){e.apply(null,n.concat(nt(function(e,n){"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););}(n,function(e){console[t](e)}))})))})}function Re(t,e,n){de(t,function(t){return function(e,n,r){return t(e,r)}}(e),n)}nt(function(t){return Fe.apply(null,t.reverse())}),nt(function(t){var e=[null].concat(t);return rt(function(t,n){return n.apply(this,e)})}),Ne("dir"),Ne("log"),Ie(Se?o.nextTick:be?setImmediate:ke);var Le;Math.ceil,Math.max;var Te=function(t){this._cache={},this._client=t};Te.prototype.readdir=function(t,e){var n=this,r=this.getCachedDirInfo(t);this._wrap(function(e){null!==r&&r.contents?n._client.readdir(t,{contentHash:r.stat.contentHash},e):n._client.readdir(t,e)},function(i,o,s,a){i?i.status===Dropbox.ApiError.NO_CONTENT&&null!==r?e(null,r.contents.slice(0)):e(i):(n.updateCachedDirInfo(t,s,o.slice(0)),a.forEach(function(e){n.updateCachedInfo(c.join(t,e.name),e)}),e(null,o))})},Te.prototype.remove=function(t,e){var n=this;this._wrap(function(e){n._client.remove(t,e)},function(r,i){r||n.updateCachedInfo(t,i),e(r)})},Te.prototype.move=function(t,e,n){var r=this;this._wrap(function(n){r._client.move(t,e,n)},function(i,o){i||(r.deleteCachedInfo(t),r.updateCachedInfo(e,o)),n(i)})},Te.prototype.stat=function(t,e){var n=this;this._wrap(function(e){n._client.stat(t,e)},function(r,i){r||n.updateCachedInfo(t,i),e(r,i)})},Te.prototype.readFile=function(t,e){var n=this,r=this.getCachedFileInfo(t);null!==r&&null!==r.contents?this.stat(t,function(i,o){i?e(i):o.contentHash===r.stat.contentHash?e(i,r.contents.slice(0),r.stat):n.readFile(t,e)}):this._wrap(function(e){n._client.readFile(t,{arrayBuffer:!0},e)},function(r,i,o){r||n.updateCachedInfo(t,o,i.slice(0)),e(r,i,o)})},Te.prototype.writeFile=function(t,e,n){var r=this;this._wrap(function(n){r._client.writeFile(t,e,n)},function(i,o){i||r.updateCachedInfo(t,o,e.slice(0)),n(i,o)})},Te.prototype.mkdir=function(t,e){var n=this;this._wrap(function(e){n._client.mkdir(t,e)},function(r,i){r||n.updateCachedInfo(t,i,[]),e(r)})},Te.prototype._wrap=function(t,e){var n=0,r=function(i){if(i&&3>++n)switch(i.status){case Dropbox.ApiError.SERVER_ERROR:case Dropbox.ApiError.NETWORK_ERROR:case Dropbox.ApiError.RATE_LIMITED:setTimeout(function(){t(r)},2e3);break;default:e.apply(null,arguments)}else e.apply(null,arguments)};t(r)},Te.prototype.getCachedInfo=function(t){return this._cache[t.toLowerCase()]},Te.prototype.putCachedInfo=function(t,e){this._cache[t.toLowerCase()]=e},Te.prototype.deleteCachedInfo=function(t){delete this._cache[t.toLowerCase()]},Te.prototype.getCachedDirInfo=function(t){var e,n=this.getCachedInfo(t);return(e=n)&&e.stat.isFolder?n:null},Te.prototype.getCachedFileInfo=function(t){var e,n=this.getCachedInfo(t);return(e=n)&&e.stat.isFile?n:null},Te.prototype.updateCachedDirInfo=function(t,e,n){void 0===n&&(n=null);var r=this.getCachedInfo(t);null===e.contentHash||void 0!==r&&r.stat.contentHash===e.contentHash||this.putCachedInfo(t,{stat:e,contents:n})},Te.prototype.updateCachedFileInfo=function(t,e,n){void 0===n&&(n=null);var r=this.getCachedInfo(t);null===e.versionTag||void 0!==r&&r.stat.versionTag===e.versionTag||this.putCachedInfo(t,{stat:e,contents:n})},Te.prototype.updateCachedInfo=function(t,e,n){var r;void 0===n&&(n=null),e.isFile&&(null==(r=n)||"object"==typeof r&&"number"==typeof r.byteLength)?this.updateCachedFileInfo(t,e,n):e.isFolder&&Array.isArray(n)&&this.updateCachedDirInfo(t,e,n)};var xe=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;if(this.isDirty()){var n=A(this.getBuffer());this._fs._writeFileStrict(this.getPath(),n,function(n){n||e.resetDirty(),t(n)})}else t()},e.prototype.close=function(t){this.sync(t)},e}(J),Ae=function(t){function e(n,r){void 0===r&&(r=!0),t.call(this),this._client=new Te(n),N(r,e.Name,{client:"authenticated dropbox client instance"}),Le||((Le={})[Dropbox.ApiError.NETWORK_ERROR]=s.EIO,Le[Dropbox.ApiError.INVALID_PARAM]=s.EINVAL,Le[Dropbox.ApiError.INVALID_TOKEN]=s.EPERM,Le[Dropbox.ApiError.OAUTH_ERROR]=s.EPERM,Le[Dropbox.ApiError.NOT_FOUND]=s.ENOENT,Le[Dropbox.ApiError.INVALID_METHOD]=s.EINVAL,Le[Dropbox.ApiError.NOT_ACCEPTABLE]=s.EINVAL,Le[Dropbox.ApiError.CONFLICT]=s.EINVAL,Le[Dropbox.ApiError.RATE_LIMITED]=s.EBUSY,Le[Dropbox.ApiError.SERVER_ERROR]=s.EBUSY,Le[Dropbox.ApiError.OVER_QUOTA]=s.ENOSPC)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){n(null,new e(t.client,!1))},e.isAvailable=function(){return"undefined"!=typeof Dropbox},e.prototype.getName=function(){return e.Name},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.empty=function(t){var e=this;this._client.readdir("/",function(n,r){if(n)t(e.convert(n,"/"));else{Re(r,function(t,n){var r=c.join("/",t);e._client.remove(r,function(t){n(t?e.convert(t,r):null)})},function(e){e?t(e):t()})}})},e.prototype.rename=function(t,e,n){var r=this;this._client.move(t,e,function(i){i?r._client.stat(e,function(o,s){if(o||s.isFolder){var a=i.response.error.indexOf(t)>-1?t:e;n(r.convert(i,a))}else r._client.remove(e,function(i){i?n(r.convert(i,e)):r.rename(t,e,n)})}):n()})},e.prototype.stat=function(t,e,n){var r=this;this._client.stat(t,function(e,i){if(e)n(r.convert(e,t));else{if(!i||!i.isRemoved){var o=new y(r._statType(i),i.size);return n(null,o)}n(h.FileError(s.ENOENT,t))}})},e.prototype.open=function(t,e,n,r){var i=this;this._client.readFile(t,function(n,o,s){if(!n){var a;a=null===o?B():U(o);var c=i._makeFile(t,e,s,a);return r(null,c)}if(e.isReadable())r(i.convert(n,t));else switch(n.status){case Dropbox.ApiError.NOT_FOUND:var u=new ArrayBuffer(0);return i._writeFileStrict(t,u,function(n,o){if(n)r(n);else{var s=i._makeFile(t,e,o,U(u));r(null,s)}});default:return r(i.convert(n,t))}})},e.prototype._writeFileStrict=function(t,e,n){var r=this,i=c.dirname(t);this.stat(i,!1,function(o,a){o?n(h.FileError(s.ENOENT,i)):r._client.writeFile(t,e,function(e,i){e?n(r.convert(e,t)):n(null,i)})})},e.prototype._statType=function(t){return t.isFile?l.FILE:l.DIRECTORY},e.prototype._makeFile=function(t,e,n,r){var i=this._statType(n),o=new y(i,n.size);return new xe(this,t,e,o,r)},e.prototype._remove=function(t,e,n){var r=this;this._client.stat(t,function(i,o){i?e(r.convert(i,t)):o.isFile&&!n?e(h.FileError(s.ENOTDIR,t)):!o.isFile&&n?e(h.FileError(s.EISDIR,t)):r._client.remove(t,function(n){e(n?r.convert(n,t):null)})})},e.prototype.unlink=function(t,e){this._remove(t,e,!0)},e.prototype.rmdir=function(t,e){this._remove(t,e,!1)},e.prototype.mkdir=function(t,e,n){var r=this,i=c.dirname(t);this._client.stat(i,function(e,o){e?n(r.convert(e,i)):r._client.mkdir(t,function(e){n(e?h.FileError(s.EEXIST,t):null)})})},e.prototype.readdir=function(t,e){var n=this;this._client.readdir(t,function(t,r){return t?e(n.convert(t)):e(null,r)})},e.prototype.convert=function(t,e){void 0===e&&(e=null);var n=Le[t.status];return void 0===n&&(n=s.EIO),e?h.FileError(n,e):new h(n)},e}(Y);function De(t,e){void 0===e&&(e="");for(var n=t.errno,r=t.node,i=[];r&&(i.unshift(r.name),r!==r.parent);)r=r.parent;return new h(n,u[n],i.length>0?"/"+i.join("/"):e)}Ae.Name="Dropbox",Ae.Options={client:{type:"object",description:"An *authenticated* Dropbox client. Must be from the 0.10 JS SDK.",validator:function(t,e){t.isAuthenticated&&t.isAuthenticated()?e():e(new h(s.EINVAL,"'client' option must be an authenticated Dropbox client from the v0.10 JS SDK."))}}};var Pe=function(t){function e(e,n,r,i){t.call(this),this._fs=e,this._FS=n,this._path=r,this._stream=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getPos=function(){},e.prototype.close=function(t){var e=null;try{this.closeSync()}catch(t){e=t}finally{t(e)}},e.prototype.closeSync=function(){try{this._FS.close(this._stream)}catch(t){throw De(t,this._path)}},e.prototype.stat=function(t){try{t(null,this.statSync())}catch(e){t(e)}},e.prototype.statSync=function(){try{return this._fs.statSync(this._path,!1)}catch(t){throw De(t,this._path)}},e.prototype.truncate=function(t,e){var n=null;try{this.truncateSync(t)}catch(t){n=t}finally{e(n)}},e.prototype.truncateSync=function(t){try{this._FS.ftruncate(this._stream.fd,t)}catch(t){throw De(t,this._path)}},e.prototype.write=function(t,e,n,r,i){try{i(null,this.writeSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.writeSync=function(t,e,n,r){try{var i=D(t),o=null===r?void 0:r;return this._FS.write(this._stream,i,e,n,o)}catch(t){throw De(t,this._path)}},e.prototype.read=function(t,e,n,r,i){try{i(null,this.readSync(t,e,n,r),t)}catch(t){i(t)}},e.prototype.readSync=function(t,e,n,r){try{var i=D(t),o=null===r?void 0:r;return this._FS.read(this._stream,i,e,n,o)}catch(t){throw De(t,this._path)}},e.prototype.sync=function(t){t()},e.prototype.syncSync=function(){},e.prototype.chown=function(t,e,n){var r=null;try{this.chownSync(t,e)}catch(t){r=t}finally{n(r)}},e.prototype.chownSync=function(t,e){try{this._FS.fchown(this._stream.fd,t,e)}catch(t){throw De(t,this._path)}},e.prototype.chmod=function(t,e){var n=null;try{this.chmodSync(t)}catch(t){n=t}finally{e(n)}},e.prototype.chmodSync=function(t){try{this._FS.fchmod(this._stream.fd,t)}catch(t){throw De(t,this._path)}},e.prototype.utimes=function(t,e,n){var r=null;try{this.utimesSync(t,e)}catch(t){r=t}finally{n(r)}},e.prototype.utimesSync=function(t,e){this._fs.utimesSync(this._path,t,e)},e}(K),Ce=function(e){function n(t){e.call(this),this._FS=t}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.Create=function(t,e){e(null,new n(t.FS))},n.isAvailable=function(){return!0},n.prototype.getName=function(){return this._FS.DB_NAME()},n.prototype.isReadOnly=function(){return!1},n.prototype.supportsLinks=function(){return!0},n.prototype.supportsProps=function(){return!0},n.prototype.supportsSynch=function(){return!0},n.prototype.renameSync=function(t,e){try{this._FS.rename(t,e)}catch(n){throw n.errno===s.ENOENT?De(n,this.existsSync(t)?e:t):De(n)}},n.prototype.statSync=function(t,e){try{var n=e?this._FS.lstat(t):this._FS.stat(t),r=this.modeToFileType(n.mode);return new y(r,n.size,n.mode,n.atime,n.mtime,n.ctime)}catch(e){throw De(e,t)}},n.prototype.openSync=function(t,e,n){try{var r=this._FS.open(t,e.getFlagString(),n);if(this._FS.isDir(r.node.mode))throw this._FS.close(r),h.EISDIR(t);return new Pe(this,this._FS,t,r)}catch(e){throw De(e,t)}},n.prototype.unlinkSync=function(t){try{this._FS.unlink(t)}catch(e){throw De(e,t)}},n.prototype.rmdirSync=function(t){try{this._FS.rmdir(t)}catch(e){throw De(e,t)}},n.prototype.mkdirSync=function(t,e){try{this._FS.mkdir(t,e)}catch(e){throw De(e,t)}},n.prototype.readdirSync=function(t){try{return this._FS.readdir(t).filter(function(t){return"."!==t&&".."!==t})}catch(e){throw De(e,t)}},n.prototype.truncateSync=function(t,e){try{this._FS.truncate(t,e)}catch(e){throw De(e,t)}},n.prototype.readFileSync=function(t,e,n){try{var r=C(this._FS.readFile(t,{flags:n.getFlagString()}));return e?r.toString(e):r}catch(e){throw De(e,t)}},n.prototype.writeFileSync=function(e,n,r,i,o){try{r&&(n=t.from(n,r));var s=D(n);this._FS.writeFile(e,s,{flags:i.getFlagString(),encoding:"binary"}),this._FS.chmod(e,o)}catch(t){throw De(t,e)}},n.prototype.chmodSync=function(t,e,n){try{e?this._FS.lchmod(t,n):this._FS.chmod(t,n)}catch(e){throw De(e,t)}},n.prototype.chownSync=function(t,e,n,r){try{e?this._FS.lchown(t,n,r):this._FS.chown(t,n,r)}catch(e){throw De(e,t)}},n.prototype.symlinkSync=function(t,e,n){try{this._FS.symlink(t,e)}catch(t){throw De(t)}},n.prototype.readlinkSync=function(t){try{return this._FS.readlink(t)}catch(e){throw De(e,t)}},n.prototype.utimesSync=function(t,e,n){try{this._FS.utime(t,e.getTime(),n.getTime())}catch(e){throw De(e,t)}},n.prototype.modeToFileType=function(t){if(this._FS.isDir(t))return l.DIRECTORY;if(this._FS.isFile(t))return l.FILE;if(this._FS.isLink(t))return l.SYMLINK;throw h.EPERM("Invalid mode: "+t)},n}(X);Ce.Name="EmscriptenFileSystem",Ce.Options={FS:{type:"object",description:"The Emscripten file system to use (the `FS` variable)"}};var Ue=function(t){function e(e,n){t.call(this),this._folder=e,this._wrapped=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){n(null,new e(t.folder,t.wrapped))},e.isAvailable=function(){return!0},e.prototype.initialize=function(t){var e=this;this._wrapped.exists(this._folder,function(n){n?t():e._wrapped.isReadOnly()?t(h.ENOENT(e._folder)):e._wrapped.mkdir(e._folder,511,t)})},e.prototype.getName=function(){return this._wrapped.getName()},e.prototype.isReadOnly=function(){return this._wrapped.isReadOnly()},e.prototype.supportsProps=function(){return this._wrapped.supportsProps()},e.prototype.supportsSynch=function(){return this._wrapped.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e}(Y);function Me(t,e){if(null!==e&&"object"==typeof e){var n=e,r=n.path;r&&(r="/"+c.relative(t,r),n.message=n.message.replace(n.path,r),n.path=r)}return e}function je(t,e,n){return"Sync"!==t.slice(t.length-4)?function(){var r,i;return arguments.length>0&&(e&&(arguments[0]=c.join(this._folder,arguments[0])),n&&(arguments[1]=c.join(this._folder,arguments[1])),arguments[arguments.length-1]=(r=this._folder,"function"==typeof(i=arguments[arguments.length-1])?function(t){arguments.length>0&&(arguments[0]=Me(r,t)),i.apply(null,arguments)}:i)),this._wrapped[t].apply(this._wrapped,arguments)}:function(){try{return e&&(arguments[0]=c.join(this._folder,arguments[0])),n&&(arguments[1]=c.join(this._folder,arguments[1])),this._wrapped[t].apply(this._wrapped,arguments)}catch(t){throw Me(this._folder,t)}}}Ue.Name="FolderAdapter",Ue.Options={folder:{type:"string",description:"The folder to use as the root directory"},wrapped:{type:"object",description:"The file system to wrap"}},["diskSpace","stat","statSync","open","openSync","unlink","unlinkSync","rmdir","rmdirSync","mkdir","mkdirSync","readdir","readdirSync","exists","existsSync","realpath","realpathSync","truncate","truncateSync","readFile","readFileSync","writeFile","writeFileSync","appendFile","appendFileSync","chmod","chmodSync","chown","chownSync","utimes","utimesSync","readlink","readlinkSync"].forEach(function(t){Ue.prototype[t]=je(t,!0,!1)}),["rename","renameSync","link","linkSync","symlink","symlinkSync"].forEach(function(t){Ue.prototype[t]=je(t,!0,!0)});var Be="undefined"!=typeof window?window:"undefined"!=typeof self?self:r;var ze=Be.webkitRequestFileSystem||Be.requestFileSystem||null;function qe(t,e,n){switch(t.name){case"PathExistsError":return h.EEXIST(e);case"QuotaExceededError":return h.FileError(s.ENOSPC,e);case"NotFoundError":return h.ENOENT(e);case"SecurityError":return h.FileError(s.EACCES,e);case"InvalidModificationError":return h.FileError(s.EPERM,e);case"TypeMismatchError":return h.FileError(n?s.ENOTDIR:s.EISDIR,e);case"EncodingError":case"InvalidStateError":case"NoModificationAllowedError":default:return h.FileError(s.EINVAL,e)}}var Ve=function(t){function e(e,n,r,i,o,s){t.call(this,e,r,i,o,s),this._entry=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;if(!this.isDirty())return t();this._entry.createWriter(function(n){var r=e.getBuffer(),i=new Blob([A(r)]),o=i.size;n.onwriteend=function(r){n.onwriteend=null,n.onerror=null,n.truncate(o),e.resetDirty(),t()},n.onerror=function(n){t(qe(n,e.getPath(),!1))},n.write(i)})},e.prototype.close=function(t){this.sync(t)},e}(J),We=function(t){function e(n,r,i){void 0===n&&(n=5),void 0===r&&(r=Be.PERSISTENT),void 0===i&&(i=!0),t.call(this),this.size=1048576*n,this.type=r,N(i,e.Name,{size:n,type:r})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){var r=new e(t.size,t.type,!1);r.allocate(function(t){return t?n(t):n(null,r)},!1)},e.isAvailable=function(){return!!ze},e.prototype.getName=function(){return e.Name},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSymlinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!1},e.prototype.allocate=function(t,e){var n=this;void 0===t&&(t=function(){}),void 0===e&&(e=!0),e&&console.warn("[HTML5FS] HTML5FS.allocate() is deprecated and will be removed in the next major release. Please use 'HTML5FS.Create({type: "+this.type+", size: "+this.size+"}, cb)' to create and allocate HTML5FS instances.");var r=function(e){n.fs=e,t()},i=function(e){t(qe(e,"/",!0))};this.type===Be.PERSISTENT?function(t,e,n,r){if(void 0!==navigator.webkitPersistentStorage)switch(t){case Be.PERSISTENT:navigator.webkitPersistentStorage.requestQuota(e,n,r);break;case Be.TEMPORARY:navigator.webkitTemporaryStorage.requestQuota(e,n,r);break;default:r(new TypeError("Invalid storage type: "+t))}else Be.webkitStorageInfo.requestQuota(t,e,n,r)}(this.type,this.size,function(t){ze(n.type,t,r,i)},i):ze(this.type,this.size,r,i)},e.prototype.empty=function(t){this._readdir("/",function(e,n){if(e)console.error("Failed to empty FS"),t(e);else{Re(n,function(t,e){var n=function(){e()},r=function(n){e(qe(n,t.fullPath,!t.isDirectory))};!function(t){return t.isDirectory}(t)?t.remove(n,r):t.removeRecursively(n,r)},function(n){e?(console.error("Failed to empty FS"),t(e)):t()})}})},e.prototype.rename=function(t,e,n){var r=this,i=2,o=0,a=this.fs.root,u=t,f=function(t){--i<=0&&n(qe(t,u,!1))},p=function(i){return 2==++o?n(new h(s.EINVAL,"Something was identified as both a file and a directory. This should never happen.")):t===e?n():(u=c.dirname(e),void a.getDirectory(u,{},function(o){u=c.basename(e),i.moveTo(o,u,function(t){n()},function(o){i.isDirectory?(u=e,r.unlink(e,function(i){i?f(o):r.rename(t,e,n)})):f(o)})},f))};a.getFile(t,{},p,f),a.getDirectory(t,{},p,f)},e.prototype.stat=function(t,e,n){var r=this,i={create:!1},o=function(t){var e=new y(l.DIRECTORY,4096);n(null,e)},s=function(e){n(qe(e,t,!1))};this.fs.root.getFile(t,i,function(t){t.file(function(t){var e=new y(l.FILE,t.size);n(null,e)},s)},function(){r.fs.root.getDirectory(t,i,o,s)})},e.prototype.open=function(t,e,n,r){var i=this,o=function(n){"InvalidModificationError"===n.name&&e.isExclusive()?r(h.EEXIST(t)):r(qe(n,t,!1))};this.fs.root.getFile(t,{create:e.pathNotExistsAction()===f.CREATE_FILE,exclusive:e.isExclusive()},function(n){n.file(function(s){var a=new FileReader;a.onloadend=function(o){var c=i._makeFile(t,n,e,s,a.result);r(null,c)},a.onerror=function(t){o(a.error)},a.readAsArrayBuffer(s)},o)},o)},e.prototype.unlink=function(t,e){this._remove(t,e,!0)},e.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(h.ENOTEMPTY(t)):n._remove(t,e,!1)})},e.prototype.mkdir=function(t,e,n){this.fs.root.getDirectory(t,{create:!0,exclusive:!0},function(t){n()},function(e){n(qe(e,t,!0))})},e.prototype.readdir=function(t,e){this._readdir(t,function(t,n){if(!n)return e(t);for(var r=[],i=0,o=n;i<o.length;i+=1){var s=o[i];r.push(s.name)}e(null,r)})},e.prototype._makeFile=function(t,e,n,r,i){void 0===i&&(i=new ArrayBuffer(0));var o=new y(l.FILE,r.size),s=U(i);return new Ve(this,e,t,n,o,s)},e.prototype._readdir=function(t,e){var n=function(n){e(qe(n,t,!0))};this.fs.root.getDirectory(t,{create:!1},function(t){var r=t.createReader(),i=[],o=function(){r.readEntries(function(t){var n;t.length?(i=i.concat((n=t,Array.prototype.slice.call(n||[],0))),o()):e(null,i)},n)};o()},n)},e.prototype._remove=function(t,e,n){var r=function(r){r.remove(function(){e()},function(r){e(qe(r,t,!n))})},i=function(r){e(qe(r,t,!n))},o={create:!1};n?this.fs.root.getFile(t,o,r,i):this.fs.root.getDirectory(t,o,r,i)},e}(Y);We.Name="HTML5FS",We.Options={size:{type:"number",optional:!0,description:"Storage quota to request, in megabytes. Allocated value may be less. Defaults to 5."},type:{type:"number",optional:!0,description:"window.PERSISTENT or window.TEMPORARY. Defaults to PERSISTENT."}};var He=function(t,e,n,r,i,o){this.id=t,this.size=e,this.mode=n,this.atime=r,this.mtime=i,this.ctime=o};He.fromBuffer=function(t){if(void 0===t)throw new Error("NO");return new He(t.toString("ascii",30),t.readUInt32LE(0),t.readUInt16LE(4),t.readDoubleLE(6),t.readDoubleLE(14),t.readDoubleLE(22))},He.prototype.toStats=function(){return new y((61440&this.mode)===l.DIRECTORY?l.DIRECTORY:l.FILE,this.size,this.mode,new Date(this.atime),new Date(this.mtime),new Date(this.ctime))},He.prototype.getSize=function(){return 30+this.id.length},He.prototype.toBuffer=function(e){return void 0===e&&(e=t.alloc(this.getSize())),e.writeUInt32LE(this.size,0),e.writeUInt16LE(this.mode,4),e.writeDoubleLE(this.atime,6),e.writeDoubleLE(this.mtime,14),e.writeDoubleLE(this.ctime,22),e.write(this.id,30,this.id.length,"ascii"),e},He.prototype.update=function(t){var e=!1;this.size!==t.size&&(this.size=t.size,e=!0),this.mode!==t.mode&&(this.mode=t.mode,e=!0);var n=t.atime.getTime();this.atime!==n&&(this.atime=n,e=!0);var r=t.mtime.getTime();this.mtime!==r&&(this.mtime=r,e=!0);var i=t.ctime.getTime();return this.ctime!==i&&(this.ctime=i,e=!0),e},He.prototype.isFile=function(){return(61440&this.mode)===l.FILE},He.prototype.isDirectory=function(){return(61440&this.mode)===l.DIRECTORY};var Ze=null;function Ye(){return Ze||(Ze=t.from("{}"))}function Xe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function Ke(t,e){return!t||(e(t),!1)}function Je(t,e,n){return!t||(e.abort(function(){n(t)}),!1)}var Ge=function(t){this.store=t,this.originalData={},this.modifiedKeys=[]};Ge.prototype.get=function(t){var e=this.store.get(t);return this.stashOldValue(t,e),e},Ge.prototype.put=function(t,e,n){return this.markModified(t),this.store.put(t,e,n)},Ge.prototype.del=function(t){this.markModified(t),this.store.del(t)},Ge.prototype.commit=function(){},Ge.prototype.abort=function(){for(var t=0,e=this.modifiedKeys;t<e.length;t+=1){var n=e[t],r=this.originalData[n];r?this.store.put(n,r,!0):this.store.del(n)}},Ge.prototype.stashOldValue=function(t,e){this.originalData.hasOwnProperty(t)||(this.originalData[t]=e)},Ge.prototype.markModified=function(t){-1===this.modifiedKeys.indexOf(t)&&(this.modifiedKeys.push(t),this.originalData.hasOwnProperty(t)||(this.originalData[t]=this.store.get(t)))};var Qe=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this.getPath(),this.getBuffer(),this.getStats()),this.resetDirty())},e.prototype.closeSync=function(){this.syncSync()},e}(J),$e=function(e){function n(t){e.call(this),this.store=t.store,this.makeRootDirectory()}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.isAvailable=function(){return!0},n.prototype.getName=function(){return this.store.name()},n.prototype.isReadOnly=function(){return!1},n.prototype.supportsSymlinks=function(){return!1},n.prototype.supportsProps=function(){return!1},n.prototype.supportsSynch=function(){return!0},n.prototype.empty=function(){this.store.clear(),this.makeRootDirectory()},n.prototype.renameSync=function(e,n){var r=this.store.beginTransaction("readwrite"),i=c.dirname(e),o=c.basename(e),a=c.dirname(n),u=c.basename(n),f=this.findINode(r,i),p=this.getDirListing(r,i,f);if(!p[o])throw h.ENOENT(e);var l,d,y=p[o];if(delete p[o],0===(a+"/").indexOf(e+"/"))throw new h(s.EBUSY,i);if(a===i?(l=f,d=p):(l=this.findINode(r,a),d=this.getDirListing(r,a,l)),d[u]){var g=this.getINode(r,n,d[u]);if(!g.isFile())throw h.EPERM(n);try{r.del(g.id),r.del(d[u])}catch(t){throw r.abort(),t}}d[u]=y;try{r.put(f.id,t.from(JSON.stringify(p)),!0),r.put(l.id,t.from(JSON.stringify(d)),!0)}catch(t){throw r.abort(),t}r.commit()},n.prototype.statSync=function(t,e){return this.findINode(this.store.beginTransaction("readonly"),t).toStats()},n.prototype.createFileSync=function(t,e,n){var r=this.store.beginTransaction("readwrite"),i=B(),o=this.commitNewFile(r,t,l.FILE,n,i);return new Qe(this,t,e,o.toStats(),i)},n.prototype.openFileSync=function(t,e){var n=this.store.beginTransaction("readonly"),r=this.findINode(n,t),i=n.get(r.id);if(void 0===i)throw h.ENOENT(t);return new Qe(this,t,e,r.toStats(),i)},n.prototype.unlinkSync=function(t){this.removeEntry(t,!1)},n.prototype.rmdirSync=function(t){if(this.readdirSync(t).length>0)throw h.ENOTEMPTY(t);this.removeEntry(t,!0)},n.prototype.mkdirSync=function(e,n){var r=this.store.beginTransaction("readwrite"),i=t.from("{}");this.commitNewFile(r,e,l.DIRECTORY,n,i)},n.prototype.readdirSync=function(t){var e=this.store.beginTransaction("readonly");return Object.keys(this.getDirListing(e,t,this.findINode(e,t)))},n.prototype._syncSync=function(t,e,n){var r=this.store.beginTransaction("readwrite"),i=this._findINode(r,c.dirname(t),c.basename(t)),o=this.getINode(r,t,i),s=o.update(n);try{r.put(o.id,e,!0),s&&r.put(i,o.toBuffer(),!0)}catch(t){throw r.abort(),t}r.commit()},n.prototype.makeRootDirectory=function(){var t=this.store.beginTransaction("readwrite");if(void 0===t.get("/")){var e=(new Date).getTime(),n=new He(Xe(),4096,511|l.DIRECTORY,e,e,e);t.put(n.id,Ye(),!1),t.put("/",n.toBuffer(),!1),t.commit()}},n.prototype._findINode=function(t,e,n){var r=this,i=function(i){var o=r.getDirListing(t,e,i);if(o[n])return o[n];throw h.ENOENT(c.resolve(e,n))};return"/"===e?""===n?"/":i(this.getINode(t,e,"/")):i(this.getINode(t,e+c.sep+n,this._findINode(t,c.dirname(e),c.basename(e))))},n.prototype.findINode=function(t,e){return this.getINode(t,e,this._findINode(t,c.dirname(e),c.basename(e)))},n.prototype.getINode=function(t,e,n){var r=t.get(n);if(void 0===r)throw h.ENOENT(e);return He.fromBuffer(r)},n.prototype.getDirListing=function(t,e,n){if(!n.isDirectory())throw h.ENOTDIR(e);var r=t.get(n.id);if(void 0===r)throw h.ENOENT(e);return JSON.parse(r.toString())},n.prototype.addNewNode=function(t,e){for(var n;;)try{return n=Xe(),t.put(n,e,!1),n}catch(t){}throw new h(s.EIO,"Unable to commit data to key-value store.")},n.prototype.commitNewFile=function(e,n,r,i,o){var s,a=c.dirname(n),u=c.basename(n),f=this.findINode(e,a),p=this.getDirListing(e,a,f),l=(new Date).getTime();if("/"===n)throw h.EEXIST(n);if(p[u])throw h.EEXIST(n);try{var d=this.addNewNode(e,o);s=new He(d,o.length,i|r,l,l,l);var y=this.addNewNode(e,s.toBuffer());p[u]=y,e.put(f.id,t.from(JSON.stringify(p)),!0)}catch(t){throw e.abort(),t}return e.commit(),s},n.prototype.removeEntry=function(e,n){var r=this.store.beginTransaction("readwrite"),i=c.dirname(e),o=this.findINode(r,i),s=this.getDirListing(r,i,o),a=c.basename(e);if(!s[a])throw h.ENOENT(e);var u=s[a];delete s[a];var f=this.getINode(r,e,u);if(!n&&f.isDirectory())throw h.EISDIR(e);if(n&&!f.isDirectory())throw h.ENOTDIR(e);try{r.del(f.id),r.del(u),r.put(o.id,t.from(JSON.stringify(s)),!0)}catch(t){throw r.abort(),t}r.commit()},n}(X),tn=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._sync(this.getPath(),this.getBuffer(),this.getStats(),function(n){n||e.resetDirty(),t(n)}):t()},e.prototype.close=function(t){this.sync(t)},e}(J),en=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.isAvailable=function(){return!0},n.prototype.init=function(t,e){this.store=t,this.makeRootDirectory(e)},n.prototype.getName=function(){return this.store.name()},n.prototype.isReadOnly=function(){return!1},n.prototype.supportsSymlinks=function(){return!1},n.prototype.supportsProps=function(){return!1},n.prototype.supportsSynch=function(){return!1},n.prototype.empty=function(t){var e=this;this.store.clear(function(n){Ke(n,t)&&e.makeRootDirectory(t)})},n.prototype.rename=function(e,n,r){var i=this,o=this.store.beginTransaction("readwrite"),a=c.dirname(e),u=c.basename(e),f=c.dirname(n),p=c.basename(n),l={},d={},y=!1;if(0===(f+"/").indexOf(e+"/"))return r(new h(s.EBUSY,a));var g=function(s){i.findINodeAndDirListing(o,s,function(c,g,m){c?y||(y=!0,o.abort(function(){r(c)})):(l[s]=g,d[s]=m,function(){if(!y&&d.hasOwnProperty(a)&&d.hasOwnProperty(f)){var s=d[a],c=l[a],g=d[f],m=l[f];if(s[u]){var _=s[u];delete s[u];var w=function(){g[p]=_,o.put(c.id,t.from(JSON.stringify(s)),!0,function(e){Je(e,o,r)&&(a===f?o.commit(r):o.put(m.id,t.from(JSON.stringify(g)),!0,function(t){Je(t,o,r)&&o.commit(r)}))})};g[p]?i.getINode(o,n,g[p],function(t,e){Je(t,o,r)&&(e.isFile()?o.del(e.id,function(t){Je(t,o,r)&&o.del(g[p],function(t){Je(t,o,r)&&w()})}):o.abort(function(t){r(h.EPERM(n))}))}):w()}else r(h.ENOENT(e))}}())})};g(a),a!==f&&g(f)},n.prototype.stat=function(t,e,n){var r=this.store.beginTransaction("readonly");this.findINode(r,t,function(t,e){Ke(t,n)&&n(null,e.toStats())})},n.prototype.createFile=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite"),s=B();this.commitNewFile(o,t,l.FILE,n,s,function(n,o){Ke(n,r)&&r(null,new tn(i,t,e,o.toStats(),s))})},n.prototype.openFile=function(t,e,n){var r=this,i=this.store.beginTransaction("readonly");this.findINode(i,t,function(o,s){Ke(o,n)&&i.get(s.id,function(i,o){Ke(i,n)&&(void 0===o?n(h.ENOENT(t)):n(null,new tn(r,t,e,s.toStats(),o)))})})},n.prototype.unlink=function(t,e){this.removeEntry(t,!1,e)},n.prototype.rmdir=function(t,e){var n=this;this.readdir(t,function(r,i){r?e(r):i.length>0?e(h.ENOTEMPTY(t)):n.removeEntry(t,!0,e)})},n.prototype.mkdir=function(e,n,r){var i=this.store.beginTransaction("readwrite"),o=t.from("{}");this.commitNewFile(i,e,l.DIRECTORY,n,o,r)},n.prototype.readdir=function(t,e){var n=this,r=this.store.beginTransaction("readonly");this.findINode(r,t,function(i,o){Ke(i,e)&&n.getDirListing(r,t,o,function(t,n){Ke(t,e)&&e(null,Object.keys(n))})})},n.prototype._sync=function(t,e,n,r){var i=this,o=this.store.beginTransaction("readwrite");this._findINode(o,c.dirname(t),c.basename(t),function(s,a){Je(s,o,r)&&i.getINode(o,t,a,function(t,i){if(Je(t,o,r)){var s=i.update(n);o.put(i.id,e,!0,function(t){Je(t,o,r)&&(s?o.put(a,i.toBuffer(),!0,function(t){Je(t,o,r)&&o.commit(r)}):o.commit(r))})}})})},n.prototype.makeRootDirectory=function(t){var e=this.store.beginTransaction("readwrite");e.get("/",function(n,r){if(n||void 0===r){var i=(new Date).getTime(),o=new He(Xe(),4096,511|l.DIRECTORY,i,i,i);e.put(o.id,Ye(),!1,function(n){Je(n,e,t)&&e.put("/",o.toBuffer(),!1,function(n){n?e.abort(function(){t(n)}):e.commit(t)})})}else e.commit(t)})},n.prototype._findINode=function(t,e,n,r){var i=this,o=function(t,i,o){t?r(t):o[n]?r(null,o[n]):r(h.ENOENT(c.resolve(e,n)))};"/"===e?""===n?r(null,"/"):this.getINode(t,e,"/",function(n,s){Ke(n,r)&&i.getDirListing(t,e,s,function(t,e){o(t,0,e)})}):this.findINodeAndDirListing(t,e,o)},n.prototype.findINode=function(t,e,n){var r=this;this._findINode(t,c.dirname(e),c.basename(e),function(i,o){Ke(i,n)&&r.getINode(t,e,o,n)})},n.prototype.getINode=function(t,e,n,r){t.get(n,function(t,n){Ke(t,r)&&(void 0===n?r(h.ENOENT(e)):r(null,He.fromBuffer(n)))})},n.prototype.getDirListing=function(t,e,n,r){n.isDirectory()?t.get(n.id,function(t,n){if(Ke(t,r))try{r(null,JSON.parse(n.toString()))}catch(t){r(h.ENOENT(e))}}):r(h.ENOTDIR(e))},n.prototype.findINodeAndDirListing=function(t,e,n){var r=this;this.findINode(t,e,function(i,o){Ke(i,n)&&r.getDirListing(t,e,o,function(t,e){Ke(t,n)&&n(null,o,e)})})},n.prototype.addNewNode=function(t,e,n){var r,i=0,o=function(){5==++i?n(new h(s.EIO,"Unable to commit data to key-value store.")):(r=Xe(),t.put(r,e,!1,function(t,e){t||!e?o():n(null,r)}))};o()},n.prototype.commitNewFile=function(e,n,r,i,o,s){var a=this,u=c.dirname(n),f=c.basename(n),p=(new Date).getTime();if("/"===n)return s(h.EEXIST(n));this.findINodeAndDirListing(e,u,function(c,u,l){Je(c,e,s)&&(l[f]?e.abort(function(){s(h.EEXIST(n))}):a.addNewNode(e,o,function(n,c){if(Je(n,e,s)){var h=new He(c,o.length,i|r,p,p,p);a.addNewNode(e,h.toBuffer(),function(n,r){Je(n,e,s)&&(l[f]=r,e.put(u.id,t.from(JSON.stringify(l)),!0,function(t){Je(t,e,s)&&e.commit(function(t){Je(t,e,s)&&s(null,h)})}))})}}))})},n.prototype.removeEntry=function(e,n,r){var i=this,o=this.store.beginTransaction("readwrite"),s=c.dirname(e),a=c.basename(e);this.findINodeAndDirListing(o,s,function(s,c,u){if(Je(s,o,r))if(u[a]){var f=u[a];delete u[a],i.getINode(o,e,f,function(i,s){Je(i,o,r)&&(!n&&s.isDirectory()?o.abort(function(){r(h.EISDIR(e))}):n&&!s.isDirectory()?o.abort(function(){r(h.ENOTDIR(e))}):o.del(s.id,function(e){Je(e,o,r)&&o.del(f,function(e){Je(e,o,r)&&o.put(c.id,t.from(JSON.stringify(u)),!0,function(t){Je(t,o,r)&&o.commit(r)})})}))})}else o.abort(function(){r(h.ENOENT(e))})})},n}(Y),nn=function(){this.store={}};nn.prototype.name=function(){return rn.Name},nn.prototype.clear=function(){this.store={}},nn.prototype.beginTransaction=function(t){return new Ge(this)},nn.prototype.get=function(t){return this.store[t]},nn.prototype.put=function(t,e,n){return!(!n&&this.store.hasOwnProperty(t))&&(this.store[t]=e,!0)},nn.prototype.del=function(t){delete this.store[t]};var rn=function(t){function e(){t.call(this,{store:new nn})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){n(null,new e)},e}($e);rn.Name="InMemory",rn.Options={};var on=Be.indexedDB||Be.mozIndexedDB||Be.webkitIndexedDB||Be.msIndexedDB;function sn(t,e){switch(void 0===e&&(e=t.toString()),t.name){case"NotFoundError":return new h(s.ENOENT,e);case"QuotaExceededError":return new h(s.ENOSPC,e);default:return new h(s.EIO,e)}}function an(t,e,n){return void 0===e&&(e=s.EIO),void 0===n&&(n=null),function(r){r.preventDefault(),t(new h(e,null!==n?n:void 0))}}var cn=function(t,e){this.tx=t,this.store=e};cn.prototype.get=function(t,e){try{var n=this.store.get(t);n.onerror=an(e),n.onsuccess=function(t){var n=t.target.result;e(null,void 0===n?n:U(n))}}catch(t){e(sn(t))}};var un=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.put=function(t,e,n,r){try{var i,o=A(e);(i=n?this.store.put(o,t):this.store.add(o,t)).onerror=an(r),i.onsuccess=function(t){r(null,!0)}}catch(t){r(sn(t))}},e.prototype.del=function(t,e){try{var n=this.store.delete(t);n.onerror=an(e),n.onsuccess=function(t){e()}}catch(t){e(sn(t))}},e.prototype.commit=function(t){setTimeout(t,0)},e.prototype.abort=function(t){var e=null;try{this.tx.abort()}catch(t){e=sn(t)}finally{t(e)}},e}(cn),fn=function(t,e){var n=this;void 0===e&&(e="browserfs"),this.storeName=e;var r=on.open(this.storeName,1);r.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(n.storeName)&&e.deleteObjectStore(n.storeName),e.createObjectStore(n.storeName)},r.onsuccess=function(e){n.db=e.target.result,t(null,n)},r.onerror=an(t,s.EACCES)};fn.prototype.name=function(){return hn.Name+" - "+this.storeName},fn.prototype.clear=function(t){try{var e=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).clear();e.onsuccess=function(e){setTimeout(t,0)},e.onerror=an(t)}catch(e){t(sn(e))}},fn.prototype.beginTransaction=function(t){void 0===t&&(t="readonly");var e=this.db.transaction(this.storeName,t),n=e.objectStore(this.storeName);if("readwrite"===t)return new un(e,n);if("readonly"===t)return new cn(e,n);throw new h(s.EINVAL,"Invalid transaction type.")};var hn=function(t){function e(n,r,i){var o=this;void 0===i&&(i=!0),t.call(this),this.store=new fn(function(t){t?n(t):o.init(o.store,function(t){n(t,o)})},r),N(i,e.Name,{storeName:r})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){new e(n,t.storeName,!1)},e.isAvailable=function(){try{return void 0!==on&&null!==on.open("__browserfs_test__")}catch(t){return!1}},e}(en);hn.Name="IndexedDB",hn.Options={storeName:{type:"string",optional:!0,description:"The name of this file system. You can have multiple IndexedDB file systems operating at once, but each must have a different name."}};var pn,ln=!1;try{Be.localStorage.setItem("__test__",String.fromCharCode(55296)),ln=Be.localStorage.getItem("__test__")===String.fromCharCode(55296)}catch(t){ln=!1}pn=ln?"binary_string":"binary_string_ie",t.isEncoding(pn)||(pn="base64");var dn=function(){};dn.prototype.name=function(){return yn.Name},dn.prototype.clear=function(){Be.localStorage.clear()},dn.prototype.beginTransaction=function(t){return new Ge(this)},dn.prototype.get=function(e){try{var n=Be.localStorage.getItem(e);if(null!==n)return t.from(n,pn)}catch(t){}},dn.prototype.put=function(t,e,n){try{return!(!n&&null!==Be.localStorage.getItem(t))&&(Be.localStorage.setItem(t,e.toString(pn)),!0)}catch(t){throw new h(s.ENOSPC,"LocalStorage is full.")}},dn.prototype.del=function(t){try{Be.localStorage.removeItem(t)}catch(e){throw new h(s.EIO,"Unable to delete key "+t+": "+e)}};var yn=function(t){function e(){t.call(this,{store:new dn})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){n(null,new e)},e.isAvailable=function(){return void 0!==Be.localStorage},e}($e);yn.Name="LocalStorage",yn.Options={};var gn=function(t){function e(){t.call(this),this.mountList=[],this.mntMap={},this.rootFs=new rn}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){var r=new e;Object.keys(t).forEach(function(e){r.mount(e,t[e])}),n(null,r)},e.isAvailable=function(){return!0},e.prototype.mount=function(t,e){if("/"!==t[0]&&(t="/"+t),t=c.resolve(t),this.mntMap[t])throw new h(s.EINVAL,"Mount point "+t+" is already taken.");x(t,511,this.rootFs),this.mntMap[t]=e,this.mountList.push(t),this.mountList=this.mountList.sort(function(t,e){return e.length-t.length})},e.prototype.umount=function(t){if("/"!==t[0]&&(t="/"+t),t=c.resolve(t),!this.mntMap[t])throw new h(s.EINVAL,"Mount point "+t+" is already unmounted.");for(delete this.mntMap[t],this.mountList.splice(this.mountList.indexOf(t),1);"/"!==t&&0===this.rootFs.readdirSync(t).length;)this.rootFs.rmdirSync(t),t=c.dirname(t)},e.prototype._getFs=function(t){for(var e=this.mountList,n=e.length,r=0;r<n;r++){var i=e[r];if(i.length<=t.length&&0===t.indexOf(i))return""===(t=t.substr(i.length>1?i.length:0))&&(t="/"),{fs:this.mntMap[i],path:t}}return{fs:this.rootFs,path:t}},e.prototype.getName=function(){return e.Name},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.standardizeError=function(t,e,n){var r=t.message.indexOf(e);return-1!==r&&(t.message=t.message.substr(0,r)+n+t.message.substr(r+e.length),t.path=n),t},e.prototype.rename=function(t,e,n){var r=this,i=this._getFs(t),o=this._getFs(e);return i.fs===o.fs?i.fs.rename(i.path,o.path,function(s){s&&r.standardizeError(r.standardizeError(s,i.path,t),o.path,e),n(s)}):I.readFile(t,function(r,i){if(r)return n(r);I.writeFile(e,i,function(e){if(e)return n(e);I.unlink(t,n)})})},e.prototype.renameSync=function(t,e){var n=this._getFs(t),r=this._getFs(e);if(n.fs===r.fs)try{return n.fs.renameSync(n.path,r.path)}catch(i){throw this.standardizeError(this.standardizeError(i,n.path,t),r.path,e),i}var i=I.readFileSync(t);return I.writeFileSync(e,i),I.unlinkSync(t)},e.prototype.readdirSync=function(t){var e=this._getFs(t),n=null;if(e.fs!==this.rootFs)try{n=this.rootFs.readdirSync(t)}catch(t){}try{var r=e.fs.readdirSync(e.path);return null===n?r:r.concat(n.filter(function(t){return-1===r.indexOf(t)}))}catch(r){if(null===n)throw this.standardizeError(r,e.path,t);return n}},e.prototype.readdir=function(t,e){var n=this,r=this._getFs(t);r.fs.readdir(r.path,function(i,o){if(r.fs!==n.rootFs)try{var s=n.rootFs.readdirSync(t);o=o?o.concat(s.filter(function(t){return-1===o.indexOf(t)})):s}catch(o){if(i)return e(n.standardizeError(i,r.path,t))}else if(i)return e(n.standardizeError(i,r.path,t));e(null,o)})},e.prototype.rmdirSync=function(t){var e=this._getFs(t);if(this._containsMountPt(t))throw h.ENOTEMPTY(t);try{e.fs.rmdirSync(e.path)}catch(n){throw this.standardizeError(n,e.path,t)}},e.prototype.rmdir=function(t,e){var n=this,r=this._getFs(t);this._containsMountPt(t)?e(h.ENOTEMPTY(t)):r.fs.rmdir(r.path,function(i){e(i?n.standardizeError(i,r.path,t):null)})},e.prototype._containsMountPt=function(t){for(var e=this.mountList,n=e.length,r=0;r<n;r++){var i=e[r];if(i.length>=t.length&&i.slice(0,t.length)===t)return!0}return!1},e}(Y);function mn(t,e,n){return e?function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=e[0],i=this._getFs(r);e[0]=i.path;try{return i.fs[t].apply(i.fs,e)}catch(t){throw this.standardizeError(t,i.path,r),t}}:function(){for(var e=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];var i=n[0],o=this._getFs(i);if(n[0]=o.path,"function"==typeof n[n.length-1]){var s=n[n.length-1];n[n.length-1]=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];t.length>0&&t[0]instanceof h&&e.standardizeError(t[0],o.path,i),s.apply(null,t)}}return o.fs[t].apply(o.fs,n)}}gn.Name="MountableFileSystem",gn.Options={};for(var _n,wn=[["exists","unlink","readlink"],["stat","mkdir","realpath","truncate"],["open","readFile","chmod","utimes"],["chown"],["writeFile","appendFile"]],vn=0;vn<wn.length;vn++)for(var En=0,bn=wn[vn];En<bn.length;En+=1){var Sn=bn[En];gn.prototype[Sn]=mn(Sn,!1),gn.prototype[Sn+"Sync"]=mn(Sn+"Sync",!0)}if("undefined"!=typeof setImmediate)_n=setImmediate;else{var kn=Be,In=[];if(function(){if(void 0!==kn.importScripts||!kn.postMessage)return!1;var t=!0,e=kn.onmessage;return kn.onmessage=function(){t=!1},kn.postMessage("","*"),kn.onmessage=e,t}()){_n=function(t){In.push(t),kn.postMessage("zero-timeout-message","*")};var On=function(t){if(t.source===self&&"zero-timeout-message"===t.data&&(t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,In.length>0))return In.shift()()};kn.addEventListener?kn.addEventListener("message",On,!0):kn.attachEvent("onmessage",On)}else if(kn.MessageChannel){var Fn=new kn.MessageChannel;Fn.port1.onmessage=function(t){if(In.length>0)return In.shift()()},_n=function(t){In.push(t),Fn.port2.postMessage("")}}else _n=function(t){return setTimeout(t,0)}}var Nn=_n,Rn=function(){this._locked=!1,this._waiters=[]};Rn.prototype.lock=function(t){this._locked?this._waiters.push(t):(this._locked=!0,t())},Rn.prototype.unlock=function(){if(!this._locked)throw new Error("unlock of a non-locked mutex");var t=this._waiters.shift();t?Nn(t):this._locked=!1},Rn.prototype.tryLock=function(){return!this._locked&&(this._locked=!0,!0)},Rn.prototype.isLocked=function(){return this._locked};var Ln=function(t){this._fs=t,this._mu=new Rn};Ln.prototype.getName=function(){return"LockedFS<"+this._fs.getName()+">"},Ln.prototype.getFSUnlocked=function(){return this._fs},Ln.prototype.initialize=function(t){this._fs.initialize(t)},Ln.prototype.diskSpace=function(t,e){this._fs.diskSpace(t,e)},Ln.prototype.isReadOnly=function(){return this._fs.isReadOnly()},Ln.prototype.supportsLinks=function(){return this._fs.supportsLinks()},Ln.prototype.supportsProps=function(){return this._fs.supportsProps()},Ln.prototype.supportsSynch=function(){return this._fs.supportsSynch()},Ln.prototype.rename=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.rename(t,e,function(t){r._mu.unlock(),n(t)})})},Ln.prototype.renameSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.renameSync(t,e)},Ln.prototype.stat=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.stat(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},Ln.prototype.statSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.statSync(t,e)},Ln.prototype.open=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.open(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},Ln.prototype.openSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.openSync(t,e,n)},Ln.prototype.unlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.unlink(t,function(t){n._mu.unlock(),e(t)})})},Ln.prototype.unlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.unlinkSync(t)},Ln.prototype.rmdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.rmdir(t,function(t){n._mu.unlock(),e(t)})})},Ln.prototype.rmdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.rmdirSync(t)},Ln.prototype.mkdir=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.mkdir(t,e,function(t){r._mu.unlock(),n(t)})})},Ln.prototype.mkdirSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.mkdirSync(t,e)},Ln.prototype.readdir=function(t,e){var n=this;this._mu.lock(function(){n._fs.readdir(t,function(t,r){n._mu.unlock(),e(t,r)})})},Ln.prototype.readdirSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readdirSync(t)},Ln.prototype.exists=function(t,e){var n=this;this._mu.lock(function(){n._fs.exists(t,function(t){n._mu.unlock(),e(t)})})},Ln.prototype.existsSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.existsSync(t)},Ln.prototype.realpath=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.realpath(t,e,function(t,e){r._mu.unlock(),n(t,e)})})},Ln.prototype.realpathSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.realpathSync(t,e)},Ln.prototype.truncate=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.truncate(t,e,function(t){r._mu.unlock(),n(t)})})},Ln.prototype.truncateSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.truncateSync(t,e)},Ln.prototype.readFile=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.readFile(t,e,n,function(t,e){i._mu.unlock(),r(t,e)})})},Ln.prototype.readFileSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readFileSync(t,e,n)},Ln.prototype.writeFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.writeFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},Ln.prototype.writeFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.writeFileSync(t,e,n,r,i)},Ln.prototype.appendFile=function(t,e,n,r,i,o){var s=this;this._mu.lock(function(){s._fs.appendFile(t,e,n,r,i,function(t){s._mu.unlock(),o(t)})})},Ln.prototype.appendFileSync=function(t,e,n,r,i){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.appendFileSync(t,e,n,r,i)},Ln.prototype.chmod=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.chmod(t,e,n,function(t){i._mu.unlock(),r(t)})})},Ln.prototype.chmodSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chmodSync(t,e,n)},Ln.prototype.chown=function(t,e,n,r,i){var o=this;this._mu.lock(function(){o._fs.chown(t,e,n,r,function(t){o._mu.unlock(),i(t)})})},Ln.prototype.chownSync=function(t,e,n,r){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.chownSync(t,e,n,r)},Ln.prototype.utimes=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.utimes(t,e,n,function(t){i._mu.unlock(),r(t)})})},Ln.prototype.utimesSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.utimesSync(t,e,n)},Ln.prototype.link=function(t,e,n){var r=this;this._mu.lock(function(){r._fs.link(t,e,function(t){r._mu.unlock(),n(t)})})},Ln.prototype.linkSync=function(t,e){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.linkSync(t,e)},Ln.prototype.symlink=function(t,e,n,r){var i=this;this._mu.lock(function(){i._fs.symlink(t,e,n,function(t){i._mu.unlock(),r(t)})})},Ln.prototype.symlinkSync=function(t,e,n){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.symlinkSync(t,e,n)},Ln.prototype.readlink=function(t,e){var n=this;this._mu.lock(function(){n._fs.readlink(t,function(t,r){n._mu.unlock(),e(t,r)})})},Ln.prototype.readlinkSync=function(t){if(this._mu.isLocked())throw new Error("invalid sync call");return this._fs.readlinkSync(t)};var Tn="/.deletedFiles.log";function xn(t){return 146|t}function An(t){return d.getFileFlag(t)}var Dn,Pn=function(t){function e(e,n,r,i,o){t.call(this,e,n,r,i,o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.sync=function(t){var e=this;this.isDirty()?this._fs._syncAsync(this,function(n){e.resetDirty(),t(n)}):t(null)},e.prototype.syncSync=function(){this.isDirty()&&(this._fs._syncSync(this),this.resetDirty())},e.prototype.close=function(t){this.sync(t)},e.prototype.closeSync=function(){this.syncSync()},e}(J),Cn=function(t){function e(e,n){if(t.call(this),this._isInitialized=!1,this._initializeCallbacks=[],this._deletedFiles={},this._deleteLog="",this._deleteLogUpdatePending=!1,this._deleteLogUpdateNeeded=!1,this._deleteLogError=null,this._writable=e,this._readable=n,this._writable.isReadOnly())throw new h(s.EINVAL,"Writable file system must be writable.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.isAvailable=function(){return!0},e.prototype.getOverlayedFileSystems=function(){return{readable:this._readable,writable:this._writable}},e.prototype._syncAsync=function(t,e){var n=this;this.createParentDirectoriesAsync(t.getPath(),function(r){if(r)return e(r);n._writable.writeFile(t.getPath(),t.getBuffer(),null,An("w"),t.getStats().mode,e)})},e.prototype._syncSync=function(t){this.createParentDirectories(t.getPath()),this._writable.writeFileSync(t.getPath(),t.getBuffer(),null,An("w"),t.getStats().mode)},e.prototype.getName=function(){return Un.Name},e.prototype.initialize=function(t){var e=this,n=this._initializeCallbacks,r=function(t){e._isInitialized=!t,e._initializeCallbacks=[],n.forEach(function(e){return e(t)})};if(this._isInitialized)return t();n.push(t),1===n.length&&this._writable.readFile(Tn,"utf8",An("r"),function(t,n){if(t){if(t.errno!==s.ENOENT)return r(t)}else e._deleteLog=n;e._reparseDeletionLog(),r()})},e.prototype.isReadOnly=function(){return!1},e.prototype.supportsSynch=function(){return this._readable.supportsSynch()&&this._writable.supportsSynch()},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return this._readable.supportsProps()&&this._writable.supportsProps()},e.prototype.getDeletionLog=function(){return this._deleteLog},e.prototype.restoreDeletionLog=function(t){this._deleteLog=t,this._reparseDeletionLog(),this.updateLog("")},e.prototype.rename=function(t,e,n){var r=this;if(this.checkInitAsync(n)&&!this.checkPathAsync(t,n)&&!this.checkPathAsync(e,n))return t===Tn||e===Tn?n(h.EPERM("Cannot rename deletion log.")):t===e?n():void this.stat(t,!1,function(i,o){return i?n(i):r.stat(e,!1,function(i,a){var u=r;function f(r){var i=r.shift();if(!i)return n();var o=c.resolve(t,i),s=c.resolve(e,i);u.rename(o,s,function(t){if(t)return n(t);f(r)})}var p=511;if(o.isDirectory()){if(i)return i.errno!==s.ENOENT?n(i):r._writable.exists(t,function(i){if(i)return r._writable.rename(t,e,n);r._writable.mkdir(e,p,function(e){if(e)return n(e);r._readable.readdir(t,function(t,e){if(t)return n();f(e)})})});if(p=a.mode,!a.isDirectory())return n(h.ENOTDIR(e));r.readdir(e,function(i,o){if(o&&o.length)return n(h.ENOTEMPTY(e));r._readable.readdir(t,function(t,e){if(t)return n();f(e)})})}if(a&&a.isDirectory())return n(h.EISDIR(e));r.readFile(t,null,An("r"),function(i,s){return i?n(i):r.writeFile(e,s,null,An("w"),o.mode,function(e){return e?n(e):r.unlink(t,n)})})})})},e.prototype.renameSync=function(t,e){var n=this;if(this.checkInitialized(),this.checkPath(t),this.checkPath(e),t===Tn||e===Tn)throw h.EPERM("Cannot rename deletion log.");var r=this.statSync(t,!1);if(r.isDirectory()){if(t===e)return;var i=511;if(this.existsSync(e)){var o=this.statSync(e,!1);if(i=o.mode,!o.isDirectory())throw h.ENOTDIR(e);if(this.readdirSync(e).length>0)throw h.ENOTEMPTY(e)}this._writable.existsSync(t)?this._writable.renameSync(t,e):this._writable.existsSync(e)||this._writable.mkdirSync(e,i),this._readable.existsSync(t)&&this._readable.readdirSync(t).forEach(function(r){n.renameSync(c.resolve(t,r),c.resolve(e,r))})}else{if(this.existsSync(e)&&this.statSync(e,!1).isDirectory())throw h.EISDIR(e);this.writeFileSync(e,this.readFileSync(t,null,An("r")),null,An("w"),r.mode)}t!==e&&this.existsSync(t)&&this.unlinkSync(t)},e.prototype.stat=function(t,e,n){var r=this;this.checkInitAsync(n)&&this._writable.stat(t,e,function(i,o){i&&i.errno===s.ENOENT?(r._deletedFiles[t]&&n(h.ENOENT(t)),r._readable.stat(t,e,function(t,e){e&&((e=e.clone()).mode=xn(e.mode)),n(t,e)})):n(i,o)})},e.prototype.statSync=function(t,e){this.checkInitialized();try{return this._writable.statSync(t,e)}catch(r){if(this._deletedFiles[t])throw h.ENOENT(t);var n=this._readable.statSync(t,e).clone();return n.mode=xn(n.mode),n}},e.prototype.open=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&!this.checkPathAsync(t,r)&&this.stat(t,!1,function(o,s){if(s)switch(e.pathExistsAction()){case f.TRUNCATE_FILE:return i.createParentDirectoriesAsync(t,function(o){if(o)return r(o);i._writable.open(t,e,n,r)});case f.NOP:return i._writable.exists(t,function(o){o?i._writable.open(t,e,n,r):((s=s.clone()).mode=n,i._readable.readFile(t,null,An("r"),function(n,o){if(n)return r(n);-1===s.size&&(s.size=o.length);var a=new Pn(i,t,e,s,o);r(null,a)}))});default:return r(h.EEXIST(t))}else switch(e.pathNotExistsAction()){case f.CREATE_FILE:return i.createParentDirectoriesAsync(t,function(o){return o?r(o):i._writable.open(t,e,n,r)});default:return r(h.ENOENT(t))}})},e.prototype.openSync=function(t,e,n){if(this.checkInitialized(),this.checkPath(t),t===Tn)throw h.EPERM("Cannot open deletion log.");if(this.existsSync(t))switch(e.pathExistsAction()){case f.TRUNCATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);case f.NOP:if(this._writable.existsSync(t))return this._writable.openSync(t,e,n);var r=this._readable.readFileSync(t,null,An("r")),i=this._readable.statSync(t,!1).clone();return i.mode=n,new Pn(this,t,e,i,r);default:throw h.EEXIST(t)}else switch(e.pathNotExistsAction()){case f.CREATE_FILE:return this.createParentDirectories(t),this._writable.openSync(t,e,n);default:throw h.ENOENT(t)}},e.prototype.unlink=function(t,e){var n=this;this.checkInitAsync(e)&&!this.checkPathAsync(t,e)&&this.exists(t,function(r){if(!r)return e(h.ENOENT(t));n._writable.exists(t,function(r){if(r)return n._writable.unlink(t,function(r){if(r)return e(r);n.exists(t,function(r){r&&n.deletePath(t),e(null)})});n.deletePath(t),e(null)})})},e.prototype.unlinkSync=function(t){if(this.checkInitialized(),this.checkPath(t),!this.existsSync(t))throw h.ENOENT(t);this._writable.existsSync(t)&&this._writable.unlinkSync(t),this.existsSync(t)&&this.deletePath(t)},e.prototype.rmdir=function(t,e){var n=this;if(this.checkInitAsync(e)){var r=function(){n.readdir(t,function(r,i){return r?e(r):i.length?e(h.ENOTEMPTY(t)):(n.deletePath(t),void e(null))})};this.exists(t,function(i){if(!i)return e(h.ENOENT(t));n._writable.exists(t,function(i){i?n._writable.rmdir(t,function(i){if(i)return e(i);n._readable.exists(t,function(t){t?r():e()})}):r()})})}},e.prototype.rmdirSync=function(t){if(this.checkInitialized(),!this.existsSync(t))throw h.ENOENT(t);if(this._writable.existsSync(t)&&this._writable.rmdirSync(t),this.existsSync(t)){if(this.readdirSync(t).length>0)throw h.ENOTEMPTY(t);this.deletePath(t)}},e.prototype.mkdir=function(t,e,n){var r=this;this.checkInitAsync(n)&&this.exists(t,function(i){if(i)return n(h.EEXIST(t));r.createParentDirectoriesAsync(t,function(i){if(i)return n(i);r._writable.mkdir(t,e,n)})})},e.prototype.mkdirSync=function(t,e){if(this.checkInitialized(),this.existsSync(t))throw h.EEXIST(t);this.createParentDirectories(t),this._writable.mkdirSync(t,e)},e.prototype.readdir=function(t,e){var n=this;this.checkInitAsync(e)&&this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?void n._writable.readdir(t,function(r,i){if(r&&"ENOENT"!==r.code)return e(r);!r&&i||(i=[]),n._readable.readdir(t,function(r,o){!r&&o||(o=[]);var s={},a=i.concat(o.filter(function(e){return!n._deletedFiles[t+"/"+e]})).filter(function(t){var e=!s[t];return s[t]=!0,e});e(null,a)})}):e(h.ENOTDIR(t))})},e.prototype.readdirSync=function(t){var e=this;if(this.checkInitialized(),!this.statSync(t,!1).isDirectory())throw h.ENOTDIR(t);var n=[];try{n=n.concat(this._writable.readdirSync(t))}catch(t){}try{n=n.concat(this._readable.readdirSync(t).filter(function(n){return!e._deletedFiles[t+"/"+n]}))}catch(t){}var r={};return n.filter(function(t){var e=!r[t];return r[t]=!0,e})},e.prototype.exists=function(t,e){var n=this;this.checkInitialized(),this._writable.exists(t,function(r){if(r)return e(!0);n._readable.exists(t,function(r){e(r&&!0!==n._deletedFiles[t])})})},e.prototype.existsSync=function(t){return this.checkInitialized(),this._writable.existsSync(t)||this._readable.existsSync(t)&&!0!==this._deletedFiles[t]},e.prototype.chmod=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){if(o)return r(o);i._writable.chmod(t,e,n,r)})},e.prototype.chmodSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.chmodSync(t,e,n)})},e.prototype.chown=function(t,e,n,r,i){var o=this;this.checkInitAsync(i)&&this.operateOnWritableAsync(t,function(s){if(s)return i(s);o._writable.chown(t,e,n,r,i)})},e.prototype.chownSync=function(t,e,n,r){var i=this;this.checkInitialized(),this.operateOnWritable(t,function(){i._writable.chownSync(t,e,n,r)})},e.prototype.utimes=function(t,e,n,r){var i=this;this.checkInitAsync(r)&&this.operateOnWritableAsync(t,function(o){if(o)return r(o);i._writable.utimes(t,e,n,r)})},e.prototype.utimesSync=function(t,e,n){var r=this;this.checkInitialized(),this.operateOnWritable(t,function(){r._writable.utimesSync(t,e,n)})},e.prototype.deletePath=function(t){this._deletedFiles[t]=!0,this.updateLog("d"+t+"\n")},e.prototype.updateLog=function(t){var e=this;this._deleteLog+=t,this._deleteLogUpdatePending?this._deleteLogUpdateNeeded=!0:(this._deleteLogUpdatePending=!0,this._writable.writeFile(Tn,this._deleteLog,"utf8",d.getFileFlag("w"),420,function(t){e._deleteLogUpdatePending=!1,t?e._deleteLogError=t:e._deleteLogUpdateNeeded&&(e._deleteLogUpdateNeeded=!1,e.updateLog(""))}))},e.prototype._reparseDeletionLog=function(){var t=this;this._deletedFiles={},this._deleteLog.split("\n").forEach(function(e){t._deletedFiles[e.slice(1)]="d"===e.slice(0,1)})},e.prototype.checkInitialized=function(){if(!this._isInitialized)throw new h(s.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.");if(null!==this._deleteLogError){var t=this._deleteLogError;throw this._deleteLogError=null,t}},e.prototype.checkInitAsync=function(t){if(!this._isInitialized)return t(new h(s.EPERM,"OverlayFS is not initialized. Please initialize OverlayFS using its initialize() method before using it.")),!1;if(null!==this._deleteLogError){var e=this._deleteLogError;return this._deleteLogError=null,t(e),!1}return!0},e.prototype.checkPath=function(t){if(t===Tn)throw h.EPERM(t)},e.prototype.checkPathAsync=function(t,e){return t===Tn&&(e(h.EPERM(t)),!0)},e.prototype.createParentDirectoriesAsync=function(t,e){var n=c.dirname(t),r=[],i=this;this._writable.stat(n,!1,function t(o,s){o?(r.push(n),n=c.dirname(n),i._writable.stat(n,!1,t)):function t(){if(!r.length)return e();var n=r.pop();i._readable.stat(n,!1,function(r,o){if(!o)return e();i._writable.mkdir(n,o.mode,function(n){if(n)return e(n);t()})})}()})},e.prototype.createParentDirectories=function(t){for(var e=this,n=c.dirname(t),r=[];!this._writable.existsSync(n);)r.push(n),n=c.dirname(n);(r=r.reverse()).forEach(function(t){e._writable.mkdirSync(t,e.statSync(t,!1).mode)})},e.prototype.operateOnWritable=function(t,e){if(!this.existsSync(t))throw h.ENOENT(t);this._writable.existsSync(t)||this.copyToWritable(t),e()},e.prototype.operateOnWritableAsync=function(t,e){var n=this;this.exists(t,function(r){if(!r)return e(h.ENOENT(t));n._writable.exists(t,function(r){if(!r)return n.copyToWritableAsync(t,e);e()})})},e.prototype.copyToWritable=function(t){var e=this.statSync(t,!1);e.isDirectory()?this._writable.mkdirSync(t,e.mode):this.writeFileSync(t,this._readable.readFileSync(t,null,An("r")),null,An("w"),this.statSync(t,!1).mode)},e.prototype.copyToWritableAsync=function(t,e){var n=this;this.stat(t,!1,function(r,i){return r?e(r):i.isDirectory()?n._writable.mkdir(t,i.mode,e):void n._readable.readFile(t,null,An("r"),function(r,o){if(r)return e(r);n.writeFile(t,o,null,An("w"),i.mode,e)})})},e}(Y),Un=function(t){function e(n,r,i){void 0===i&&(i=!0),t.call(this,new Cn(n,r)),N(i,e.Name,{readable:"readable file system",writable:"writable file system"})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){try{var r=new e(t.writable,t.readable,!1);r.initialize(function(t){n(t,r)},!1)}catch(t){n(t)}},e.isAvailable=function(){return Cn.isAvailable()},e.prototype.initialize=function(e,n){void 0===n&&(n=!0),n&&console.warn("[OverlayFS] OverlayFS.initialize() is deprecated and will be removed in the next major release. Please use 'OverlayFS.Create({readable: readable file system instance, writable: writable file system instance}, cb)' to create and initialize OverlayFS instances."),t.prototype.initialize.call(this,e)},e.prototype.getOverlayedFileSystems=function(){return t.prototype.getFSUnlocked.call(this).getOverlayedFileSystems()},e.prototype.unwrap=function(){return t.prototype.getFSUnlocked.call(this)},e}(Ln);Un.Name="OverlayFS",Un.Options={writable:{type:"object",description:"The file system to write modified files to."},readable:{type:"object",description:"The file system that initially populates this file system."}},function(t){t[t.CB=0]="CB",t[t.FD=1]="FD",t[t.API_ERROR=2]="API_ERROR",t[t.STATS=3]="STATS",t[t.PROBE=4]="PROBE",t[t.FILEFLAG=5]="FILEFLAG",t[t.BUFFER=6]="BUFFER",t[t.ERROR=7]="ERROR"}(Dn||(Dn={}));var Mn=function(){this._callbacks={},this._nextId=0};Mn.prototype.toRemoteArg=function(t){var e=this._nextId++;return this._callbacks[e]=t,{type:Dn.CB,id:e}},Mn.prototype.toLocalArg=function(t){var e=this._callbacks[t];return delete this._callbacks[t],e};var jn=function(){this._fileDescriptors={},this._nextId=0};function Bn(t){return{type:Dn.API_ERROR,errorData:Xn(t.writeToBuffer())}}function zn(t){return h.fromBuffer(Kn(t.errorData))}function qn(t){return{type:Dn.ERROR,name:t.name,message:t.message,stack:t.stack}}function Vn(t){var e=Be[t.name];"function"!=typeof e&&(e=Error);var n=new e(t.message);return n.stack=t.stack,n}function Wn(t){return{type:Dn.STATS,statsData:Xn(t.toBuffer())}}function Hn(t){return y.fromBuffer(Kn(t.statsData))}function Zn(t){return{type:Dn.FILEFLAG,flagStr:t.getFlagString()}}function Yn(t){return d.getFileFlag(t.flagStr)}function Xn(t){return A(t)}function Kn(t){return U(t)}function Jn(t){return{type:Dn.BUFFER,data:Xn(t)}}function Gn(t){return Kn(t.data)}jn.prototype.toRemoteArg=function(e,n,r,i){var o,s,a=this._nextId++;this._fileDescriptors[a]=e,e.stat(function(c,u){c?i(c):(s=Xn(u.toBuffer()),r.isReadable()?e.read(t.alloc(u.size),0,u.size,0,function(t,e,c){t?i(t):(o=Xn(c),i(null,{type:Dn.FD,id:a,data:o,stat:s,path:n,flag:r.getFlagString()}))}):i(null,{type:Dn.FD,id:a,data:new ArrayBuffer(0),stat:s,path:n,flag:r.getFlagString()}))})},jn.prototype.applyFdAPIRequest=function(t,e){var n=this,r=t.args[0];this._applyFdChanges(r,function(i,o){i?e(i):o[t.method](function(i){"close"===t.method&&delete n._fileDescriptors[r.id],e(i)})})},jn.prototype._applyFdChanges=function(t,e){var n=this._fileDescriptors[t.id],r=Kn(t.data),i=y.fromBuffer(Kn(t.stat)),o=d.getFileFlag(t.flag);o.isWriteable()?n.write(r,0,r.length,o.isAppendable()?n.getPos():0,function(t){function s(){n.stat(function(t,r){t?e(t):r.mode!==i.mode?n.chmod(i.mode,function(t){e(t,n)}):e(t,n)})}t?e(t):o.isAppendable()?s():n.truncate(r.length,function(){s()})}):e(null,n)};var Qn=function(t){function e(e,n,r,i,o,s){t.call(this,e,n,r,i,s),this._remoteFdId=o}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getRemoteFdId=function(){return this._remoteFdId},e.prototype.toRemoteArg=function(){return{type:Dn.FD,id:this._remoteFdId,data:Xn(this.getBuffer()),stat:Xn(this.getStats().toBuffer()),path:this.getPath(),flag:this.getFlag().getFlagString()}},e.prototype.sync=function(t){this._syncClose("sync",t)},e.prototype.close=function(t){this._syncClose("close",t)},e.prototype._syncClose=function(t,e){var n=this;this.isDirty()?this._fs.syncClose(t,this,function(t){t||n.resetDirty(),e(t)}):e()},e}(J),$n=function(e){function n(t,r){var i=this;void 0===r&&(r=!0),e.call(this),this._callbackConverter=new Mn,this._isInitialized=!1,this._isReadOnly=!1,this._supportLinks=!1,this._supportProps=!1,this._worker=t,N(r,n.Name,{worker:"Web Worker instance"}),this._worker.addEventListener("message",function(t){var e,n=t.data;if((e=n)&&"object"==typeof e&&e.hasOwnProperty("browserfsMessage")&&e.browserfsMessage){var r,o=n.args,s=new Array(o.length);for(r=0;r<s.length;r++)s[r]=i._argRemote2Local(o[r]);i._callbackConverter.toLocalArg(n.cbId).apply(null,s)}})}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.Create=function(t,e){var r=new n(t.worker,!1);r.initialize(function(){e(null,r)})},n.isAvailable=function(){return"undefined"!=typeof importScripts||"undefined"!=typeof Worker},n.attachRemoteListener=function(e){var n=new jn;function r(e,r,i){switch(typeof e){case"object":e instanceof y?i(null,Wn(e)):e instanceof h?i(null,Bn(e)):e instanceof K?i(null,n.toRemoteArg(e,r[0],r[1],i)):e instanceof d?i(null,Zn(e)):e instanceof t?i(null,Jn(e)):e instanceof Error?i(null,qn(e)):i(null,e);break;default:i(null,e)}}function i(t,n){if(!t)return t;switch(typeof t){case"object":if("number"!=typeof t.type)return t;var i=t;switch(i.type){case Dn.CB:var o=t.id;return function(){var t,i,s=arguments,a=new Array(arguments.length),c=arguments.length;function u(t){c>0&&(c=-1,i={browserfsMessage:!0,cbId:o,args:[Bn(t)]},e.postMessage(i))}for(t=0;t<arguments.length;t++)!function(t,s){r(s,n,function(n,r){a[t]=r,n?u(n):0==--c&&(i={browserfsMessage:!0,cbId:o,args:a},e.postMessage(i))})}(t,s[t]);0===arguments.length&&(i={browserfsMessage:!0,cbId:o,args:a},e.postMessage(i))};case Dn.API_ERROR:return zn(i);case Dn.STATS:return Hn(i);case Dn.FILEFLAG:return Yn(i);case Dn.BUFFER:return Gn(i);case Dn.ERROR:return Vn(i);default:return t}default:return t}}e.addEventListener("message",function(t){var r,o,s=t.data;if((o=s)&&"object"==typeof o&&o.hasOwnProperty("browserfsMessage")&&o.browserfsMessage){var a=s.args,c=new Array(a.length);switch(s.method){case"close":case"sync":r=a[1],n.applyFdAPIRequest(s,function(t){var n={browserfsMessage:!0,cbId:r.id,args:t?[Bn(t)]:[]};e.postMessage(n)});break;case"probe":!function(){var t=I.getRootFS(),n=a[1],r={type:Dn.PROBE,isReadOnly:t.isReadOnly(),supportsLinks:t.supportsLinks(),supportsProps:t.supportsProps()},i={browserfsMessage:!0,cbId:n.id,args:[r]};e.postMessage(i)}();break;default:for(var u=0;u<a.length;u++)c[u]=i(a[u],c);var f=I.getRootFS();f[s.method].apply(f,c)}}})},n.prototype.getName=function(){return n.Name},n.prototype.initialize=function(t){var e=this;if(this._isInitialized)t();else{var n={browserfsMessage:!0,method:"probe",args:[this._argLocal2Remote(B()),this._callbackConverter.toRemoteArg(function(n){e._isInitialized=!0,e._isReadOnly=n.isReadOnly,e._supportLinks=n.supportsLinks,e._supportProps=n.supportsProps,t()})]};this._worker.postMessage(n)}},n.prototype.isReadOnly=function(){return this._isReadOnly},n.prototype.supportsSynch=function(){return!1},n.prototype.supportsLinks=function(){return this._supportLinks},n.prototype.supportsProps=function(){return this._supportProps},n.prototype.rename=function(t,e,n){this._rpc("rename",arguments)},n.prototype.stat=function(t,e,n){this._rpc("stat",arguments)},n.prototype.open=function(t,e,n,r){this._rpc("open",arguments)},n.prototype.unlink=function(t,e){this._rpc("unlink",arguments)},n.prototype.rmdir=function(t,e){this._rpc("rmdir",arguments)},n.prototype.mkdir=function(t,e,n){this._rpc("mkdir",arguments)},n.prototype.readdir=function(t,e){this._rpc("readdir",arguments)},n.prototype.exists=function(t,e){this._rpc("exists",arguments)},n.prototype.realpath=function(t,e,n){this._rpc("realpath",arguments)},n.prototype.truncate=function(t,e,n){this._rpc("truncate",arguments)},n.prototype.readFile=function(t,e,n,r){this._rpc("readFile",arguments)},n.prototype.writeFile=function(t,e,n,r,i,o){this._rpc("writeFile",arguments)},n.prototype.appendFile=function(t,e,n,r,i,o){this._rpc("appendFile",arguments)},n.prototype.chmod=function(t,e,n,r){this._rpc("chmod",arguments)},n.prototype.chown=function(t,e,n,r,i){this._rpc("chown",arguments)},n.prototype.utimes=function(t,e,n,r){this._rpc("utimes",arguments)},n.prototype.link=function(t,e,n){this._rpc("link",arguments)},n.prototype.symlink=function(t,e,n,r){this._rpc("symlink",arguments)},n.prototype.readlink=function(t,e){this._rpc("readlink",arguments)},n.prototype.syncClose=function(t,e,n){this._worker.postMessage({browserfsMessage:!0,method:t,args:[e.toRemoteArg(),this._callbackConverter.toRemoteArg(n)]})},n.prototype._argRemote2Local=function(t){if(!t)return t;switch(typeof t){case"object":if("number"!=typeof t.type)return t;var e=t;switch(e.type){case Dn.API_ERROR:return zn(e);case Dn.FD:var n=e;return new Qn(this,n.path,d.getFileFlag(n.flag),y.fromBuffer(Kn(n.stat)),n.id,Kn(n.data));case Dn.STATS:return Hn(e);case Dn.FILEFLAG:return Yn(e);case Dn.BUFFER:return Gn(e);case Dn.ERROR:return Vn(e);default:return t}default:return t}},n.prototype._rpc=function(t,e){for(var n=new Array(e.length),r=0;r<e.length;r++)n[r]=this._argLocal2Remote(e[r]);var i={browserfsMessage:!0,method:t,args:n};this._worker.postMessage(i)},n.prototype._argLocal2Remote=function(e){if(!e)return e;switch(typeof e){case"object":return e instanceof y?Wn(e):e instanceof h?Bn(e):e instanceof Qn?e.toRemoteArg():e instanceof d?Zn(e):e instanceof t?Jn(e):e instanceof Error?qn(e):"Unknown argument";case"function":return this._callbackConverter.toRemoteArg(e);default:return e}},n}(Y);function tr(t,e,n){var r=new XMLHttpRequest;r.open("HEAD",e,t),r.onreadystatechange=function(t){if(4===r.readyState){if(200!==r.status)return n(new h(r.status,"XHR HEAD error."));try{return n(null,parseInt(r.getResponseHeader("Content-Length")||"-1",10))}catch(t){return n(new h(s.EIO,"XHR HEAD error: Could not read content-length."))}}},r.send()}$n.Name="WorkerFS",$n.Options={worker:{type:"object",description:"The target worker that you want to connect to, or the current worker if in a worker context.",validator:function(t,e){t.postMessage?e():e(new h(s.EINVAL,"option must be a Web Worker instance."))}}};var er=function(e,n,r){var i=new XMLHttpRequest;i.open("GET",e,!0);var o=!0;switch(n){case"buffer":i.responseType="arraybuffer";break;case"json":try{i.responseType="json",o="json"===i.responseType}catch(t){o=!1}break;default:return r(new h(s.EINVAL,"Invalid download type: "+n))}i.onreadystatechange=function(e){if(4===i.readyState){if(200!==i.status)return r(new h(i.status,"XHR error."));switch(n){case"buffer":return r(null,i.response?t.from(i.response):B());case"json":return r(null,o?i.response:JSON.parse(i.responseText))}}},i.send()},nr=R&&"undefined"!=typeof Blob?function(e,n){var r,i,o=new XMLHttpRequest;switch(o.open("GET",e,!1),n){case"buffer":o.responseType="arraybuffer";break;case"json":break;default:throw new h(s.EINVAL,"Invalid download type: "+n)}if(o.onreadystatechange=function(e){if(4===o.readyState)if(200===o.status)switch(n){case"buffer":r=t.from(o.response);break;case"json":r=JSON.parse(o.response)}else i=new h(o.status,"XHR error.")},o.send(),i)throw i;return r}:function(e,n){var r=new XMLHttpRequest;r.open("GET",e,!1);var i=null,o=null;if(r.overrideMimeType("text/plain; charset=x-user-defined"),r.onreadystatechange=function(e){if(4===r.readyState){if(200!==r.status)return void(o=new h(r.status,"XHR error."));switch(n){case"buffer":var s=r.responseText;i=t.alloc(s.length);for(var a=0;a<s.length;a++)i[a]=s.charCodeAt(a);return;case"json":return void(i=JSON.parse(r.responseText))}}},r.send(),o)throw o;return i};var rr=function(){this._index={},this.addPath("/",new or)};rr.fromListing=function(t){var e=new rr,n=new or;e._index["/"]=n;for(var r=[["",t,n]];r.length>0;){var i=void 0,o=r.pop(),s=o[0],a=o[1],c=o[2];for(var u in a)if(a.hasOwnProperty(u)){var f=a[u],h=s+"/"+u;f?(e._index[h]=i=new or,r.push([h,f,i])):i=new ir(new y(l.FILE,-1,365)),c&&(c._ls[u]=i)}}return e},rr.prototype.fileIterator=function(t){for(var e in this._index)if(this._index.hasOwnProperty(e))for(var n=this._index[e],r=0,i=n.getListing();r<i.length;r+=1){var o=i[r],s=n.getItem(o);sr(s)&&t(s.getData())}},rr.prototype.addPath=function(t,e){if(!e)throw new Error("Inode must be specified");if("/"!==t[0])throw new Error("Path must be absolute, got: "+t);if(this._index.hasOwnProperty(t))return this._index[t]===e;var n=this._split_path(t),r=n[0],i=n[1],o=this._index[r];return!(void 0===o&&"/"!==t&&(o=new or,!this.addPath(r,o)))&&(!("/"!==t&&!o.addItem(i,e))&&(ar(e)&&(this._index[t]=e),!0))},rr.prototype.addPathFast=function(t,e){var n=t.lastIndexOf("/"),r=0===n?"/":t.substring(0,n),i=t.substring(n+1),o=this._index[r];return void 0===o&&(o=new or,this.addPathFast(r,o)),!!o.addItem(i,e)&&(e.isDir()&&(this._index[t]=e),!0)},rr.prototype.removePath=function(t){var e=this._split_path(t),n=e[0],r=e[1],i=this._index[n];if(void 0===i)return null;var o=i.remItem(r);if(null===o)return null;if(ar(o)){for(var s=0,a=o.getListing();s<a.length;s+=1){var c=a[s];this.removePath(t+"/"+c)}"/"!==t&&delete this._index[t]}return o},rr.prototype.ls=function(t){var e=this._index[t];return void 0===e?null:e.getListing()},rr.prototype.getInode=function(t){var e=this._split_path(t),n=e[0],r=e[1],i=this._index[n];return void 0===i?null:n===t?i:i.getItem(r)},rr.prototype._split_path=function(t){var e=c.dirname(t);return[e,t.substr(e.length+("/"===e?0:1))]};var ir=function(t){this.data=t};ir.prototype.isFile=function(){return!0},ir.prototype.isDir=function(){return!1},ir.prototype.getData=function(){return this.data},ir.prototype.setData=function(t){this.data=t};var or=function(t){void 0===t&&(t=null),this.data=t,this._ls={}};function sr(t){return!!t&&t.isFile()}function ar(t){return!!t&&t.isDir()}or.prototype.isFile=function(){return!1},or.prototype.isDir=function(){return!0},or.prototype.getData=function(){return this.data},or.prototype.getStats=function(){return new y(l.DIRECTORY,4096,365)},or.prototype.getListing=function(){return Object.keys(this._ls)},or.prototype.getItem=function(t){var e=this._ls[t];return e||null},or.prototype.addItem=function(t,e){return!(t in this._ls)&&(this._ls[t]=e,!0)},or.prototype.remItem=function(t){var e=this._ls[t];return void 0===e?null:(delete this._ls[t],e)};var cr=function(t){function e(n,r,i){void 0===r&&(r=""),void 0===i&&(i=!0),t.call(this),n||(n="index.json"),r.length>0&&"/"!==r.charAt(r.length-1)&&(r+="/"),this.prefixUrl=r;var o=null;if("string"==typeof n){if(!(o=this._requestFileSync(n,"json")))throw new Error("Unable to find listing at URL: ${listingUrlOrObj}")}else o=n;N(i,e.Name,{index:"string"==typeof n?n:"file index as an object",baseUrl:r}),this._index=rr.fromListing(o)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){void 0===t.index&&(t.index="index.json"),"string"==typeof t.index?e.FromURL(t.index,n,t.baseUrl,!1):n(null,new e(t.index,t.baseUrl,!1))},e.isAvailable=function(){return"undefined"!=typeof XMLHttpRequest&&null!==XMLHttpRequest},e.FromURL=function(t,n,r,i){void 0===r&&(r=t.slice(0,t.lastIndexOf("/")+1)),void 0===i&&(i=!0),i&&console.warn("[XmlHttpRequest] XmlHttpRequest.FromURL() is deprecated and will be removed in the next major release. Please use 'XmlHttpRequest.Create({ index: \""+t+'", baseUrl: "'+r+"\" }, cb)' instead."),er(t,"json",function(t,i){t?n(t):n(null,new e(i,r,!1))})},e.prototype.empty=function(){this._index.fileIterator(function(t){t.fileData=null})},e.prototype.getName=function(){return e.Name},e.prototype.diskSpace=function(t,e){e(0,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.preloadFile=function(t,e){var n=this._index.getInode(t);if(!sr(n))throw h.EISDIR(t);if(null===n)throw h.ENOENT(t);var r=n.getData();r.size=e.length,r.fileData=e},e.prototype.stat=function(t,e,n){var r,i=this._index.getInode(t);if(null===i)return n(h.ENOENT(t));sr(i)?(r=i.getData()).size<0?this._requestFileSizeAsync(t,function(t,e){if(t)return n(t);r.size=e,n(null,r.clone())}):n(null,r.clone()):ar(i)?(r=i.getStats(),n(null,r)):n(h.FileError(s.EINVAL,t))},e.prototype.statSync=function(t,e){var n,r=this._index.getInode(t);if(null===r)throw h.ENOENT(t);if(sr(r))(n=r.getData()).size<0&&(n.size=this._requestFileSizeSync(t));else{if(!ar(r))throw h.FileError(s.EINVAL,t);n=r.getStats()}return n},e.prototype.open=function(t,e,n,r){if(e.isWriteable())return r(new h(s.EPERM,t));var i=this,o=this._index.getInode(t);if(null===o)return r(h.ENOENT(t));if(!sr(o))return r(h.EISDIR(t));var a=o.getData();switch(e.pathExistsAction()){case f.THROW_EXCEPTION:case f.TRUNCATE_FILE:return r(h.EEXIST(t));case f.NOP:if(a.fileData)return r(null,new G(i,t,e,a.clone(),a.fileData));this._requestFileAsync(t,"buffer",function(n,o){return n?r(n):(a.size=o.length,a.fileData=o,r(null,new G(i,t,e,a.clone(),o)))});break;default:return r(new h(s.EINVAL,"Invalid FileMode object."))}},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new h(s.EPERM,t);var r=this._index.getInode(t);if(null===r)throw h.ENOENT(t);if(!sr(r))throw h.EISDIR(t);var i=r.getData();switch(e.pathExistsAction()){case f.THROW_EXCEPTION:case f.TRUNCATE_FILE:throw h.EEXIST(t);case f.NOP:if(i.fileData)return new G(this,t,e,i.clone(),i.fileData);var o=this._requestFileSync(t,"buffer");return i.size=o.length,i.fileData=o,new G(this,t,e,i.clone(),o);default:throw new h(s.EINVAL,"Invalid FileMode object.")}},e.prototype.readdir=function(t,e){try{e(null,this.readdirSync(t))}catch(t){e(t)}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(null===e)throw h.ENOENT(t);if(ar(e))return e.getListing();throw h.ENOTDIR(t)},e.prototype.readFile=function(t,e,n,r){var i=r;this.open(t,n,420,function(t,n){if(t)return r(t);r=function(t,e){n.close(function(n){return t||(t=n),i(t,e)})};var o=n.getBuffer();null===e?r(t,M(o)):function(t,e,n){try{n(null,t.toString(e))}catch(t){n(t)}}(o,e,r)})},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r.getBuffer();return null===e?M(i):i.toString(e)}finally{r.closeSync()}},e.prototype.getXhrPath=function(t){return"/"===t.charAt(0)&&(t=t.slice(1)),this.prefixUrl+t},e.prototype._requestFileAsync=function(t,e,n){er(this.getXhrPath(t),e,n)},e.prototype._requestFileSync=function(t,e){return nr(this.getXhrPath(t),e)},e.prototype._requestFileSizeAsync=function(t,e){!function(t,e){tr(!0,t,e)}(this.getXhrPath(t),e)},e.prototype._requestFileSizeSync=function(t){return e=this.getXhrPath(t),n=-1,tr(!1,e,function(t,e){if(t)throw t;n=e}),n;var e,n},e}(Y);cr.Name="XmlHttpRequest",cr.Options={index:{type:["string","object"],optional:!0,description:"URL to a file index as a JSON file or the file index object itself, generated with the make_xhrfs_index script. Defaults to `index.json`."},baseUrl:{type:"string",optional:!0,description:"Used as the URL prefix for fetched files. Default: Fetch files relative to the index."}};var ur=function(){};ur.str2byte=function(t,e){for(var n=t.length>e.length?e.length:t.length,r=0;r<n;r++){var i=t.charCodeAt(r);if(i>127){var o=ur.extendedChars.indexOf(t.charAt(r));o>-1&&(i=o+128)}e[i]=r}return n},ur.byte2str=function(t){for(var e=new Array(t.length),n=0;n<t.length;n++){var r=t[n];e[n]=r>127?ur.extendedChars[r-128]:String.fromCharCode(r)}return e.join("")},ur.byteLength=function(t){return t.length},ur.extendedChars=["Ç","ü","é","â","ä","à","å","ç","ê","ë","è","ï","î","ì","Ä","Å","É","æ","Æ","ô","ö","ò","û","ù","ÿ","Ö","Ü","ø","£","Ø","×","ƒ","á","í","ó","ú","ñ","Ñ","ª","º","¿","®","¬","½","¼","¡","«","»","_","_","_","¦","¦","Á","Â","À","©","¦","¦","+","+","¢","¥","+","+","-","-","+","-","+","ã","Ã","+","+","-","-","¦","-","+","¤","ð","Ð","Ê","Ë","È","i","Í","Î","Ï","+","+","_","_","¦","Ì","_","Ó","ß","Ô","Ò","õ","Õ","µ","þ","Þ","Ú","Û","Ù","ý","Ý","¯","´","­","±","_","¾","¶","§","÷","¸","°","¨","·","¹","³","²","_"," "];var fr,hr,pr=n(31).inflateRaw,lr={};function dr(t,e){return new Date(1980+(e>>9),(e>>5&15)-1,31&e,t>>11,t>>5&63,31&t)}function yr(t,e,n,r){return 0===r?"":e?t.toString("utf8",n,n+r):ur.byte2str(t.slice(n,n+r))}!function(t){t[t.MSDOS=0]="MSDOS",t[t.AMIGA=1]="AMIGA",t[t.OPENVMS=2]="OPENVMS",t[t.UNIX=3]="UNIX",t[t.VM_CMS=4]="VM_CMS",t[t.ATARI_ST=5]="ATARI_ST",t[t.OS2_HPFS=6]="OS2_HPFS",t[t.MAC=7]="MAC",t[t.Z_SYSTEM=8]="Z_SYSTEM",t[t.CP_M=9]="CP_M",t[t.NTFS=10]="NTFS",t[t.MVS=11]="MVS",t[t.VSE=12]="VSE",t[t.ACORN_RISC=13]="ACORN_RISC",t[t.VFAT=14]="VFAT",t[t.ALT_MVS=15]="ALT_MVS",t[t.BEOS=16]="BEOS",t[t.TANDEM=17]="TANDEM",t[t.OS_400=18]="OS_400",t[t.OSX=19]="OSX"}(fr||(fr={})),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"}(hr||(hr={}));var gr=function(t){if(this.data=t,67324752!==t.readUInt32LE(0))throw new h(s.EINVAL,"Invalid Zip file: Local file header has invalid signature: "+this.data.readUInt32LE(0))};gr.prototype.versionNeeded=function(){return this.data.readUInt16LE(4)},gr.prototype.flags=function(){return this.data.readUInt16LE(6)},gr.prototype.compressionMethod=function(){return this.data.readUInt16LE(8)},gr.prototype.lastModFileTime=function(){return dr(this.data.readUInt16LE(10),this.data.readUInt16LE(12))},gr.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(10)},gr.prototype.crc32=function(){return this.data.readUInt32LE(14)},gr.prototype.fileNameLength=function(){return this.data.readUInt16LE(26)},gr.prototype.extraFieldLength=function(){return this.data.readUInt16LE(28)},gr.prototype.fileName=function(){return yr(this.data,this.useUTF8(),30,this.fileNameLength())},gr.prototype.extraField=function(){var t=30+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},gr.prototype.totalSize=function(){return 30+this.fileNameLength()+this.extraFieldLength()},gr.prototype.useUTF8=function(){return 2048==(2048&this.flags())};var mr=function(t,e,n){this.header=t,this.record=e,this.data=n};mr.prototype.decompress=function(){var t=this.header.compressionMethod(),e=lr[t];if(e)return e(this.data,this.record.compressedSize(),this.record.uncompressedSize(),this.record.flag());var n=hr[t];throw n||(n="Unknown: "+t),new h(s.EINVAL,"Invalid compression method on file '"+this.header.fileName()+"': "+n)},mr.prototype.getHeader=function(){return this.header},mr.prototype.getRecord=function(){return this.record},mr.prototype.getRawData=function(){return this.data};var _r=function(t){this.data=t};_r.prototype.crc32=function(){return this.data.readUInt32LE(0)},_r.prototype.compressedSize=function(){return this.data.readUInt32LE(4)},_r.prototype.uncompressedSize=function(){return this.data.readUInt32LE(8)};var wr=function(t){if(this.data=t,134630224!==this.data.readUInt32LE(0))throw new h(s.EINVAL,"Invalid archive extra data record signature: "+this.data.readUInt32LE(0))};wr.prototype.length=function(){return this.data.readUInt32LE(4)},wr.prototype.extraFieldData=function(){return this.data.slice(8,8+this.length())};var vr=function(t){if(this.data=t,84233040!==this.data.readUInt32LE(0))throw new h(s.EINVAL,"Invalid digital signature signature: "+this.data.readUInt32LE(0))};vr.prototype.size=function(){return this.data.readUInt16LE(4)},vr.prototype.signatureData=function(){return this.data.slice(6,6+this.size())};var Er=function(t,e,n){if(this.zipData=e,this.data=n,this.zipFilename=t,33639248!==this.data.readUInt32LE(0))throw new h(s.EINVAL,"Invalid Zip file: Central directory record has invalid signature: "+this.data.readUInt32LE(0));this._filename=this.produceFilename()};Er.prototype.versionMadeBy=function(){return this.data.readUInt16LE(4)},Er.prototype.versionNeeded=function(){return this.data.readUInt16LE(6)},Er.prototype.flag=function(){return this.data.readUInt16LE(8)},Er.prototype.compressionMethod=function(){return this.data.readUInt16LE(10)},Er.prototype.lastModFileTime=function(){return dr(this.data.readUInt16LE(12),this.data.readUInt16LE(14))},Er.prototype.rawLastModFileTime=function(){return this.data.readUInt32LE(12)},Er.prototype.crc32=function(){return this.data.readUInt32LE(16)},Er.prototype.compressedSize=function(){return this.data.readUInt32LE(20)},Er.prototype.uncompressedSize=function(){return this.data.readUInt32LE(24)},Er.prototype.fileNameLength=function(){return this.data.readUInt16LE(28)},Er.prototype.extraFieldLength=function(){return this.data.readUInt16LE(30)},Er.prototype.fileCommentLength=function(){return this.data.readUInt16LE(32)},Er.prototype.diskNumberStart=function(){return this.data.readUInt16LE(34)},Er.prototype.internalAttributes=function(){return this.data.readUInt16LE(36)},Er.prototype.externalAttributes=function(){return this.data.readUInt32LE(38)},Er.prototype.headerRelativeOffset=function(){return this.data.readUInt32LE(42)},Er.prototype.produceFilename=function(){return yr(this.data,this.useUTF8(),46,this.fileNameLength()).replace(/\\/g,"/")},Er.prototype.fileName=function(){return this._filename},Er.prototype.rawFileName=function(){return this.data.slice(46,46+this.fileNameLength())},Er.prototype.extraField=function(){var t=44+this.fileNameLength();return this.data.slice(t,t+this.extraFieldLength())},Er.prototype.fileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return yr(this.data,this.useUTF8(),t,this.fileCommentLength())},Er.prototype.rawFileComment=function(){var t=46+this.fileNameLength()+this.extraFieldLength();return this.data.slice(t,t+this.fileCommentLength())},Er.prototype.totalSize=function(){return 46+this.fileNameLength()+this.extraFieldLength()+this.fileCommentLength()},Er.prototype.isDirectory=function(){var t=this.fileName();return!!(16&this.externalAttributes())||"/"===t.charAt(t.length-1)},Er.prototype.isFile=function(){return!this.isDirectory()},Er.prototype.useUTF8=function(){return 2048==(2048&this.flag())},Er.prototype.isEncrypted=function(){return 1==(1&this.flag())},Er.prototype.getFileData=function(){if(null==this.zipFilename){var t=this.headerRelativeOffset(),e=new gr(this.zipData.slice(t));return new mr(e,this,this.zipData.slice(t+e.totalSize()))}{window.BoxedWineConfig.consoleLog("remote zip request for file:"+this.fileName());let t=this.headerRelativeOffset(),e=this.extraFieldLength(),n=0==e?e:e+4,r=30+this.fileNameLength()+n;const i=this.syncCall(this.zipFilename,t,r+this.compressedSize());return new mr(new gr(i.slice(0,r)),this,i.slice(r))}},Er.prototype.syncCall=function(e,n,r){var i=new XMLHttpRequest;i.open("GET",e,!1);var o=null,s=null;i.overrideMimeType("text/plain; charset=x-user-defined");let a="bytes="+n+"-"+(n+r-1);if(i.setRequestHeader("Range",a),i.onreadystatechange=function(e){if(4!==i.readyState);else{if(200===i.status||206===i.status){var n=i.responseText;o=t.alloc(n.length);for(var r=0;r<n.length;r++)o[r]=n.charCodeAt(r);return}s=new h(i.status,"XHR error.")}},i.send(),s)throw s;return o},Er.prototype.getData=function(){return this.getFileData().decompress()},Er.prototype.getRawData=function(){return this.getFileData().getRawData()},Er.prototype.getStats=function(){return new y(l.FILE,this.uncompressedSize(),365,new Date,this.lastModFileTime())};var br=function(t){if(this.data=t,101010256!==this.data.readUInt32LE(0))throw new h(s.EINVAL,"Invalid Zip file: End of central directory record has invalid signature: "+this.data.readUInt32LE(0))};br.prototype.diskNumber=function(){return this.data.readUInt16LE(4)},br.prototype.cdDiskNumber=function(){return this.data.readUInt16LE(6)},br.prototype.cdDiskEntryCount=function(){return this.data.readUInt16LE(8)},br.prototype.cdTotalEntryCount=function(){return this.data.readUInt16LE(10)},br.prototype.cdSize=function(){return this.data.readUInt32LE(12)},br.prototype.cdOffset=function(){return this.data.readUInt32LE(16)},br.prototype.cdZipCommentLength=function(){return this.data.readUInt16LE(20)},br.prototype.cdZipComment=function(){return yr(this.data,!0,22,this.cdZipCommentLength())},br.prototype.rawCdZipComment=function(){return this.data.slice(22,22+this.cdZipCommentLength())};var Sr=function(t,e,n,r){this.index=t,this.directoryEntries=e,this.eocd=n,this.data=r},kr=function(t){function e(n,r,i){void 0===r&&(r=""),void 0===i&&(i=!0),t.call(this),this.name=r,this._index=new rr,this._directoryEntries=[],this._eocd=null,N(i,e.Name,{zipData:"zip data as a Buffer",name:r}),n instanceof Sr?(this._index=n.index,this._directoryEntries=n.directoryEntries,this._eocd=n.eocd,this.data=n.data):(this.data=n,this.populateIndex())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){try{e.computeIndex(t.name,t.zipData,function(r){var i=new e(r,t.name,!1);n(null,i)},!1)}catch(t){n(t)}},e.isAvailable=function(){return!0},e.RegisterDecompressionMethod=function(t,e){lr[t]=e},e.computeIndex=function(t,n,r,i){void 0===i&&(i=!0),i&&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 rr,a=e.getEOCD(n);if(a.diskNumber()!==a.cdDiskNumber())throw new h(s.EINVAL,"ZipFS does not support spanned zip files.");var c=null==t?a.cdOffset():0;if(4294967295===c)throw new h(s.EINVAL,"ZipFS does not support Zip64.");var u=c+a.cdSize();e.computeIndexResponsive(t,n,o,c,u,r,[],a)},e.getEOCD=function(t){for(var e=Math.min(65557,t.length-1),n=22;n<e;n++)if(101010256===t.readUInt32LE(t.length-n))return new br(t.slice(t.length-n));throw new h(s.EINVAL,"Invalid ZIP file: Could not locate End of Central Directory signature.")},e.addToIndex=function(t,e){var n=t.fileName();if("/"===n.charAt(0))throw new Error("WHY IS THIS ABSOLUTE");"/"===n.charAt(n.length-1)&&(n=n.substr(0,n.length-1)),t.isDirectory()?e.addPathFast("/"+n,new or(t)):e.addPathFast("/"+n,new ir(t))},e.computeIndexResponsive=function(t,n,r,i,o,s,a,c){if(i<o){for(var u=0;u++<200&&i<o;){var f=new Er(t,n,n.slice(i));e.addToIndex(f,r),i+=f.totalSize(),a.push(f)}Nn(function(){e.computeIndexResponsive(t,n,r,i,o,s,a,c)})}else s(new Sr(r,a,c,n))},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 h.ENOENT(t);if(sr(e))return e.getData();if(ar(e))return e.getData();throw h.EPERM("Invalid inode: "+e)},e.prototype.getCentralDirectoryEntryAt=function(t){var e=this._directoryEntries[t];if(!e)throw new RangeError("Invalid directory index: "+t+".");return e},e.prototype.getNumberOfCentralDirectoryEntries=function(){return this._directoryEntries.length},e.prototype.getEndOfCentralDirectory=function(){return this._eocd},e.prototype.diskSpace=function(t,e){e(this.data.length,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.statSync=function(t,e){var n,r=this._index.getInode(t);if(null===r)throw h.ENOENT(t);if(sr(r))n=r.getData().getStats();else{if(!ar(r))throw new h(s.EINVAL,"Invalid inode.");n=r.getStats()}return n},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new h(s.EPERM,t);var r=this._index.getInode(t);if(!r)throw h.ENOENT(t);if(!sr(r))throw h.EISDIR(t);var i=r.getData(),o=i.getStats();switch(e.pathExistsAction()){case f.THROW_EXCEPTION:case f.TRUNCATE_FILE:throw h.EEXIST(t);case f.NOP:return new G(this,t,e,o,i.getData());default:throw new h(s.EINVAL,"Invalid FileMode object.")}},e.prototype.readdirSync=function(t){var e=this._index.getInode(t);if(e){if(ar(e))return e.getListing();throw h.ENOTDIR(t)}throw h.ENOENT(t)},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r.getBuffer();return null===e?M(i):i.toString(e)}finally{r.closeSync()}},e.prototype.populateIndex=function(){var t=this._eocd=e.getEOCD(this.data);if(t.diskNumber()!==t.cdDiskNumber())throw new h(s.EINVAL,"ZipFS does not support spanned zip files.");var n=t.cdOffset();if(4294967295===n)throw new h(s.EINVAL,"ZipFS does not support Zip64.");for(var r=n+t.cdSize();n<r;){var i=new Er(this.data,this.data.slice(n));n+=i.totalSize(),e.addToIndex(i,this._index),this._directoryEntries.push(i)}},e}(X);kr.Name="ZipFS",kr.Options={zipData:{type:"object",description:"The zip file as a Buffer object.",validator:z},name:{type:"string",optional:!0,description:"The name of the zip file (optional)."}},kr.CompressionMethod=hr,kr.RegisterDecompressionMethod(hr.DEFLATE,function(t,e,n){return P(pr(t.slice(0,e),{chunkSize:n}))}),kr.RegisterDecompressionMethod(hr.STORED,function(t,e,n){return M(t,0,n)});function Ir(t,e,n){return t.toString("ascii",e,e+n).trim()}function Or(t,e,n){if(1===n)return String.fromCharCode(t[e]);for(var r=Math.floor(n/2),i=new Array(r),o=0;o<r;o++){var s=e+(o<<1);i[o]=String.fromCharCode(t[s+1]|t[s]<<8)}return i.join("")}function Fr(t,e){var n=parseInt(Ir(t,e,4),10),r=parseInt(Ir(t,e+4,2),10),i=parseInt(Ir(t,e+6,2),10),o=parseInt(Ir(t,e+8,2),10),s=parseInt(Ir(t,e+10,2),10),a=parseInt(Ir(t,e+12,2),10),c=parseInt(Ir(t,e+14,2),10);return new Date(n,r,i,o,s,a,100*c)}function Nr(t,e){var n=t[e],r=t[e+1],i=t[e+2],o=t[e+3],s=t[e+4],a=t[e+5];return new Date(n,r-1,i,o,s,a)}function Rr(t,e){var n=t.slice(e),r=new Mr(n);switch(r.signatureWord()){case 17221:return new jr(n);case 20548:return new Br(n);case 21328:return new zr(n);case 21332:return new qr(n);case 17746:return new Vr(n);case 17747:return new Wr(n);case 20568:return new Zr(n);case 20558:return new Yr(n);case 21324:return new Xr(n);case 20045:return new Jr(n);case 17228:return new Gr(n);case 20556:return new Qr(n);case 21061:return new $r(n);case 21574:return new ti(n);case 21318:return new ei(n);case 21074:return new Hr(n);default:return r}}function Lr(t,e,n,r){n-=4;for(var i=new Array;e<n;){var o=Rr(t,e),s=o.length();if(0===s)return i;if(e+=s,o instanceof qr)break;o instanceof jr?i=i.concat(o.getEntries(r)):i.push(o)}return i}var Tr=function(t){this._data=t};Tr.prototype.type=function(){return this._data[0]},Tr.prototype.standardIdentifier=function(){return Ir(this._data,1,5)},Tr.prototype.version=function(){return this._data[6]},Tr.prototype.data=function(){return this._data.slice(7,2048)};var xr=function(t){function e(e){t.call(this,e),this._root=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.systemIdentifier=function(){return this._getString32(8)},e.prototype.volumeIdentifier=function(){return this._getString32(40)},e.prototype.volumeSpaceSize=function(){return this._data.readUInt32LE(80)},e.prototype.volumeSetSize=function(){return this._data.readUInt16LE(120)},e.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(124)},e.prototype.logicalBlockSize=function(){return this._data.readUInt16LE(128)},e.prototype.pathTableSize=function(){return this._data.readUInt32LE(132)},e.prototype.locationOfTypeLPathTable=function(){return this._data.readUInt32LE(140)},e.prototype.locationOfOptionalTypeLPathTable=function(){return this._data.readUInt32LE(144)},e.prototype.locationOfTypeMPathTable=function(){return this._data.readUInt32BE(148)},e.prototype.locationOfOptionalTypeMPathTable=function(){return this._data.readUInt32BE(152)},e.prototype.rootDirectoryEntry=function(t){return null===this._root&&(this._root=this._constructRootDirectoryRecord(this._data.slice(156)),this._root.rootCheckForRockRidge(t)),this._root},e.prototype.volumeSetIdentifier=function(){return this._getString(190,128)},e.prototype.publisherIdentifier=function(){return this._getString(318,128)},e.prototype.dataPreparerIdentifier=function(){return this._getString(446,128)},e.prototype.applicationIdentifier=function(){return this._getString(574,128)},e.prototype.copyrightFileIdentifier=function(){return this._getString(702,38)},e.prototype.abstractFileIdentifier=function(){return this._getString(740,36)},e.prototype.bibliographicFileIdentifier=function(){return this._getString(776,37)},e.prototype.volumeCreationDate=function(){return Fr(this._data,813)},e.prototype.volumeModificationDate=function(){return Fr(this._data,830)},e.prototype.volumeExpirationDate=function(){return Fr(this._data,847)},e.prototype.volumeEffectiveDate=function(){return Fr(this._data,864)},e.prototype.fileStructureVersion=function(){return this._data[881]},e.prototype.applicationUsed=function(){return this._data.slice(883,1395)},e.prototype.reserved=function(){return this._data.slice(1395,2048)},e.prototype._getString32=function(t){return this._getString(t,32)},e}(Tr),Ar=function(t){function e(e){if(t.call(this,e),1!==this.type())throw new h(s.EIO,"Invalid primary volume descriptor.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.name=function(){return"ISO9660"},e.prototype._constructRootDirectoryRecord=function(t){return new Cr(t,-1)},e.prototype._getString=function(t,e){return this._getString(t,e)},e}(xr),Dr=function(t){function e(e){if(t.call(this,e),2!==this.type())throw new h(s.EIO,"Invalid supplementary volume descriptor.");var n=this.escapeSequence(),r=n[2];if(37!==n[0]||47!==n[1]||64!==r&&67!==r&&69!==r)throw new h(s.EIO,"Unrecognized escape sequence for SupplementaryVolumeDescriptor: "+n.toString())}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.name=function(){return"Joliet"},e.prototype.escapeSequence=function(){return this._data.slice(88,120)},e.prototype._constructRootDirectoryRecord=function(t){return new Ur(t,-1)},e.prototype._getString=function(t,e){return Or(this._data,t,e)},e}(xr),Pr=function(t,e){this._suEntries=null,this._fileOrDir=null,this._data=t,this._rockRidgeOffset=e};Pr.prototype.hasRockRidge=function(){return this._rockRidgeOffset>-1},Pr.prototype.getRockRidgeOffset=function(){return this._rockRidgeOffset},Pr.prototype.rootCheckForRockRidge=function(t){var e=this.getDirectory(t);this._rockRidgeOffset=e.getDotEntry(t)._getRockRidgeOffset(t),this._rockRidgeOffset>-1&&(this._fileOrDir=null)},Pr.prototype.length=function(){return this._data[0]},Pr.prototype.extendedAttributeRecordLength=function(){return this._data[1]},Pr.prototype.lba=function(){return 2048*this._data.readUInt32LE(2)},Pr.prototype.dataLength=function(){return this._data.readUInt32LE(10)},Pr.prototype.recordingDate=function(){return Nr(this._data,18)},Pr.prototype.fileFlags=function(){return this._data[25]},Pr.prototype.fileUnitSize=function(){return this._data[26]},Pr.prototype.interleaveGapSize=function(){return this._data[27]},Pr.prototype.volumeSequenceNumber=function(){return this._data.readUInt16LE(28)},Pr.prototype.identifier=function(){return this._getString(33,this._data[32])},Pr.prototype.fileName=function(t){if(this.hasRockRidge()){var e=this._rockRidgeFilename(t);if(null!==e)return e}var n=this.identifier();if(this.isDirectory(t))return n;var r=n.indexOf(";");return-1===r?n:"."===n[r-1]?n.slice(0,r-1):n.slice(0,r)},Pr.prototype.isDirectory=function(t){var e=!!(2&this.fileFlags());return!e&&this.hasRockRidge()&&(e=this.getSUEntries(t).filter(function(t){return t instanceof Gr}).length>0),e},Pr.prototype.isSymlink=function(t){return this.hasRockRidge()&&this.getSUEntries(t).filter(function(t){return t instanceof Xr}).length>0},Pr.prototype.getSymlinkPath=function(t){for(var e="",n=this.getSUEntries(t),r=this._getGetString(),i=0,o=n;i<o.length;i+=1){var s=o[i];if(s instanceof Xr){for(var a=0,c=s.componentRecords();a<c.length;a+=1){var u=c[a],f=u.flags();2&f?e+="./":4&f?e+="../":8&f?e+="/":(e+=u.content(r),1&f||(e+="/"))}if(!s.continueFlag())break}}return e.length>1&&"/"===e[e.length-1]?e.slice(0,e.length-1):e},Pr.prototype.getFile=function(t){if(this.isDirectory(t))throw new Error("Tried to get a File from a directory.");return null===this._fileOrDir&&(this._fileOrDir=t.slice(this.lba(),this.lba()+this.dataLength())),this._fileOrDir},Pr.prototype.getDirectory=function(t){if(!this.isDirectory(t))throw new Error("Tried to get a Directory from a file.");return null===this._fileOrDir&&(this._fileOrDir=this._constructDirectory(t)),this._fileOrDir},Pr.prototype.getSUEntries=function(t){return this._suEntries||this._constructSUEntries(t),this._suEntries},Pr.prototype._rockRidgeFilename=function(t){var e=this.getSUEntries(t).filter(function(t){return t instanceof Jr});if(0===e.length||6&e[0].flags())return null;for(var n="",r=this._getGetString(),i=0,o=e;i<o.length;i+=1){var s=o[i];if(n+=s.name(r),!(1&s.flags()))break}return n},Pr.prototype._constructSUEntries=function(t){var e=33+this._data[32];e%2==1&&e++,e+=this._rockRidgeOffset,this._suEntries=Lr(this._data,e,this.length(),t)},Pr.prototype._getRockRidgeOffset=function(t){this._rockRidgeOffset=0;var e=this.getSUEntries(t);if(e.length>0){var n=e[0];if(n instanceof zr&&n.checkBytesPass())for(var r=1;r<e.length;r++){var i=e[r];if(i instanceof Hr||i instanceof Vr&&"IEEE_P1282"===i.extensionIdentifier())return n.bytesSkipped()}}return this._rockRidgeOffset=-1,-1};var Cr=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._getString=function(t,e){return Ir(this._data,t,e)},e.prototype._constructDirectory=function(t){return new ri(this,t)},e.prototype._getGetString=function(){return Ir},e}(Pr),Ur=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._getString=function(t,e){return Or(this._data,t,e)},e.prototype._constructDirectory=function(t){return new ii(this,t)},e.prototype._getGetString=function(){return Or},e}(Pr),Mr=function(t){this._data=t};Mr.prototype.signatureWord=function(){return this._data.readUInt16BE(0)},Mr.prototype.signatureWordString=function(){return Ir(this._data,0,2)},Mr.prototype.length=function(){return this._data[2]},Mr.prototype.suVersion=function(){return this._data[3]};var jr=function(t){function e(e){t.call(this,e),this._entries=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.continuationLba=function(){return this._data.readUInt32LE(4)},e.prototype.continuationLbaOffset=function(){return this._data.readUInt32LE(12)},e.prototype.continuationLength=function(){return this._data.readUInt32LE(20)},e.prototype.getEntries=function(t){if(!this._entries){var e=2048*this.continuationLba()+this.continuationLbaOffset();this._entries=Lr(t,e,this.continuationLength(),t)}return this._entries},e}(Mr),Br=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mr),zr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.checkBytesPass=function(){return 190===this._data[4]&&239===this._data[5]},e.prototype.bytesSkipped=function(){return this._data[6]},e}(Mr),qr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mr),Vr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.identifierLength=function(){return this._data[4]},e.prototype.descriptorLength=function(){return this._data[5]},e.prototype.sourceLength=function(){return this._data[6]},e.prototype.extensionVersion=function(){return this._data[7]},e.prototype.extensionIdentifier=function(){return Ir(this._data,8,this.identifierLength())},e.prototype.extensionDescriptor=function(){return Ir(this._data,8+this.identifierLength(),this.descriptorLength())},e.prototype.extensionSource=function(){return Ir(this._data,8+this.identifierLength()+this.descriptorLength(),this.sourceLength())},e}(Mr),Wr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.extensionSequence=function(){return this._data[4]},e}(Mr),Hr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mr),Zr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.mode=function(){return this._data.readUInt32LE(4)},e.prototype.fileLinks=function(){return this._data.readUInt32LE(12)},e.prototype.uid=function(){return this._data.readUInt32LE(20)},e.prototype.gid=function(){return this._data.readUInt32LE(28)},e.prototype.inode=function(){return this._data.readUInt32LE(36)},e}(Mr),Yr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.devTHigh=function(){return this._data.readUInt32LE(4)},e.prototype.devTLow=function(){return this._data.readUInt32LE(12)},e}(Mr),Xr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flags=function(){return this._data[4]},e.prototype.continueFlag=function(){return 1&this.flags()},e.prototype.componentRecords=function(){for(var t=new Array,e=5;e<this.length();){var n=new Kr(this._data.slice(e));t.push(n),e+=n.length()}return t},e}(Mr),Kr=function(t){this._data=t};Kr.prototype.flags=function(){return this._data[0]},Kr.prototype.length=function(){return 2+this.componentLength()},Kr.prototype.componentLength=function(){return this._data[1]},Kr.prototype.content=function(t){return t(this._data,2,this.componentLength())};var Jr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flags=function(){return this._data[4]},e.prototype.name=function(t){return t(this._data,5,this.length()-5)},e}(Mr),Gr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.childDirectoryLba=function(){return this._data.readUInt32LE(4)},e}(Mr),Qr=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.parentDirectoryLba=function(){return this._data.readUInt32LE(4)},e}(Mr),$r=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Mr),ti=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flags=function(){return this._data[4]},e.prototype.creation=function(){return 1&this.flags()?this._longFormDates()?Fr(this._data,5):Nr(this._data,5):null},e.prototype.modify=function(){if(2&this.flags()){var t=1&this.flags()?1:0;return this._longFormDates?Fr(this._data,5+17*t):Nr(this._data,5+7*t)}return null},e.prototype.access=function(){if(4&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,this._longFormDates?Fr(this._data,5+17*t):Nr(this._data,5+7*t)}return null},e.prototype.backup=function(){if(16&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,t+=4&this.flags()?1:0,this._longFormDates?Fr(this._data,5+17*t):Nr(this._data,5+7*t)}return null},e.prototype.expiration=function(){if(32&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,t+=4&this.flags()?1:0,t+=16&this.flags()?1:0,this._longFormDates?Fr(this._data,5+17*t):Nr(this._data,5+7*t)}return null},e.prototype.effective=function(){if(64&this.flags()){var t=1&this.flags()?1:0;return t+=2&this.flags()?1:0,t+=4&this.flags()?1:0,t+=16&this.flags()?1:0,t+=32&this.flags()?1:0,this._longFormDates?Fr(this._data,5+17*t):Nr(this._data,5+7*t)}return null},e.prototype._longFormDates=function(){return!!this.flags()},e}(Mr),ei=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.virtualSizeHigh=function(){return this._data.readUInt32LE(4)},e.prototype.virtualSizeLow=function(){return this._data.readUInt32LE(12)},e.prototype.tableDepth=function(){return this._data[20]},e}(Mr),ni=function(t,e){this._fileList=[],this._fileMap={},this._record=t;var n=t.lba(),r=n+t.dataLength();2&t.fileFlags()||(n=2048*t.getSUEntries(e).filter(function(t){return t instanceof Gr})[0].childDirectoryLba(),r=1/0);for(;n<r;){if(0!==e[n]){var i=this._constructDirectoryRecord(e.slice(n)),o=i.fileName(e);"\0"!==o&&""!==o?i.hasRockRidge()&&0!==i.getSUEntries(e).filter(function(t){return t instanceof $r}).length||(this._fileMap[o]=i,this._fileList.push(o)):r===1/0&&(r=n+i.dataLength()),n+=i.length()}else n++}};ni.prototype.getRecord=function(t){return this._fileMap[t]},ni.prototype.getFileList=function(){return this._fileList},ni.prototype.getDotEntry=function(t){return this._constructDirectoryRecord(t.slice(this._record.lba()))};var ri=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._constructDirectoryRecord=function(t){return new Cr(t,this._record.getRockRidgeOffset())},e}(ni),ii=function(t){function e(e,n){t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._constructDirectoryRecord=function(t){return new Ur(t,this._record.getRockRidgeOffset())},e}(ni),oi=function(t){function e(n,r,i){var o=this;void 0===r&&(r=""),void 0===i&&(i=!0),t.call(this),this._data=n,N(i,e.Name,{data:"ISO data as a Buffer",name:r});for(var a=!1,c=32768,u=new Array;!a;){var f=n.slice(c);switch(new Tr(f).type()){case 1:u.push(new Ar(f));break;case 2:u.push(new Dr(f));break;case 255:a=!0}c+=2048}if(0===u.length)throw new h(s.EIO,"Unable to find a suitable volume descriptor.");u.forEach(function(t){o._pvd&&2===o._pvd.type()||(o._pvd=t)}),this._root=this._pvd.rootDirectoryEntry(n),this._name=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.Create=function(t,n){var r,i;try{r=new e(t.data,t.name,!1)}catch(i){i=i}finally{n(void 0,r)}},e.isAvailable=function(){return!0},e.prototype.getName=function(){var t="IsoFS"+this._name+(this._pvd?"-"+this._pvd.name():"");return this._root&&this._root.hasRockRidge()&&(t+="-RockRidge"),t},e.prototype.diskSpace=function(t,e){e(this._data.length,0)},e.prototype.isReadOnly=function(){return!0},e.prototype.supportsLinks=function(){return!1},e.prototype.supportsProps=function(){return!1},e.prototype.supportsSynch=function(){return!0},e.prototype.statSync=function(t,e){var n=this._getDirectoryRecord(t);if(null===n)throw h.ENOENT(t);return this._getStats(t,n)},e.prototype.openSync=function(t,e,n){if(e.isWriteable())throw new h(s.EPERM,t);var r=this._getDirectoryRecord(t);if(!r)throw h.ENOENT(t);if(r.isSymlink(this._data))return this.openSync(c.resolve(t,r.getSymlinkPath(this._data)),e,n);if(r.isDirectory(this._data))throw h.EISDIR(t);var i=r.getFile(this._data),o=this._getStats(t,r);switch(e.pathExistsAction()){case f.THROW_EXCEPTION:case f.TRUNCATE_FILE:throw h.EEXIST(t);case f.NOP:return new G(this,t,e,o,i);default:throw new h(s.EINVAL,"Invalid FileMode object.")}},e.prototype.readdirSync=function(t){var e=this._getDirectoryRecord(t);if(e){if(e.isDirectory(this._data))return e.getDirectory(this._data).getFileList().slice(0);throw h.ENOTDIR(t)}throw h.ENOENT(t)},e.prototype.readFileSync=function(t,e,n){var r=this.openSync(t,n,420);try{var i=r.getBuffer();return null===e?M(i):i.toString(e)}finally{r.closeSync()}},e.prototype._getDirectoryRecord=function(t){if("/"===t)return this._root;for(var e=t.split("/").slice(1),n=this._root,r=0,i=e;r<i.length;r+=1){var o=i[r];if(!n.isDirectory(this._data))return null;if(!(n=n.getDirectory(this._data).getRecord(o)))return null}return n},e.prototype._getStats=function(t,e){if(e.isSymlink(this._data)){var n=c.resolve(t,e.getSymlinkPath(this._data)),r=this._getDirectoryRecord(n);return r?this._getStats(n,r):null}var i=e.dataLength(),o=365,s=e.recordingDate(),a=s,u=s,f=s;if(e.hasRockRidge())for(var h=0,p=e.getSUEntries(this._data);h<p.length;h+=1){var d=p[h];if(d instanceof Zr)o=d.mode();else if(d instanceof ti){var g=d.flags();4&g&&(a=d.access()),2&g&&(u=d.modify()),1&g&&(f=d.creation())}}return o&=365,new y(e.isDirectory(this._data)?l.DIRECTORY:l.FILE,i,o,a,u,f)},e}(X);oi.Name="IsoFS",oi.Options={data:{type:"object",description:"The ISO file in a buffer",validator:z}},[$,Ae,Ce,Ue,We,rn,hn,oi,yn,gn,Un,$n,cr,kr].forEach(function(t){var e=t.Create;t.Create=function(n,r){var i="function"==typeof n,o=i?n:r,s=i?{}:n;q(t,s,function(n){n?o(n):e.call(t,s,o)})}});var si,ai={AsyncMirror:$,Dropbox:Ae,Emscripten:Ce,FolderAdapter:Ue,HTML5FS:We,InMemory:rn,IndexedDB:hn,IsoFS:oi,LocalStorage:yn,MountableFileSystem:gn,OverlayFS:Un,WorkerFS:$n,XmlHttpRequest:cr,ZipFS:kr};function ci(t){switch(t){case"fs":return I;case"path":return c;case"buffer":return a;case"process":return o;case"bfs_utils":return V;default:return ai[t]}}function ui(t){return I.initialize(t)}function fi(t,e){var n=t.fs;if(!n)return e(new h(s.EPERM,'Missing "fs" property on configuration object.'));var r=t.options,i=0,o=!1;function a(){if(!o){o=!0;var t=ai[n];t?t.Create(r,e):e(new h(s.EPERM,"File system "+n+" is not available in BrowserFS."))}}if(null!==r&&"object"==typeof r){var c=!1;Object.keys(r).filter(function(t){return"fs"!==t}).forEach(function(t){var n=r[t];null!==n&&"object"==typeof n&&n.fs&&(i++,fi(n,function(n,s){if(i--,n){if(o)return;o=!0,e(n)}else r[t]=s,0===i&&c&&a()}))}),c=!0}0===i&&a()}o.initializeTTYs&&o.initializeTTYs(),"b"!=="ab".substr(-1)&&(String.prototype.substr=(si=String.prototype.substr,function(t,e){return t<0&&(t=this.length+t),si.call(this,t,e)})),"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&(Uint8Array.prototype.slice||(Uint8Array.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.length);return t<0&&(t=this.length+t)<0&&(t=0),e<0&&(e=this.length+e)<0&&(e=0),e<t&&(e=t),new Uint8Array(this.buffer,this.byteOffset+t,e-t)})),e.install=function(e){e.Buffer=t,e.process=o;var n=e.require?e.require:null;e.require=function(t){var e=ci(t);return e||n.apply(null,Array.prototype.slice.call(arguments,0))}},e.registerFileSystem=function(t,e){ai[t]=e},e.BFSRequire=ci,e.initialize=ui,e.configure=function(t,e){fi(t,function(t,n){n?(ui(n),e()):e(t)})},e.getFileSystem=fi,e.EmscriptenFS=Z,e.FileSystem=ai,e.Errors=p,e.setImmediate=Nn}).call(e,n(1),function(){return this}(),n(5)(t),n(6))},function(t,e,n){t.exports=n(2).Buffer},function(t,e,n){(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
* @license MIT
*/
"use strict";var r=n(3),i=n(4);e.Buffer=t,e.SlowBuffer=function(e){+e!=e&&(e=0);return t.alloc(+e)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function s(e){if(e>o)throw new RangeError("Invalid typed array length");var n=new Uint8Array(e);return n.__proto__=t.prototype,n}function t(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return a(t,e,n)}function a(e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return j(e)?function(e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);return i.__proto__=t.prototype,i}(e,n,r):"string"==typeof e?function(e,n){"string"==typeof n&&""!==n||(n="utf8");if(!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=s(r),o=i.write(e,n);o!==r&&(i=i.slice(0,o));return i}(e,n):function(e){if(t.isBuffer(e)){var n=0|h(e.length),r=s(n);return 0===r.length?r:(e.copy(r,0,0,n),r)}if(e){if(B(e)||"length"in e)return"number"!=typeof e.length||z(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e)}function c(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 u(t){return c(t),s(t<0?0:0|h(t))}function f(t){for(var e=t.length<0?0:0|h(t.length),n=s(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function p(e,n){if(t.isBuffer(e))return e.length;if(B(e)||j(e))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(n){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return C(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return C(e).length;n=(""+n).toLowerCase(),i=!0}}function l(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function d(e,n,r,i,o){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof n&&(n=t.from(n,i)),t.isBuffer(n))return 0===n.length?-1:y(e,n,r,i,o);if("number"==typeof n)return n&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,n,r):Uint8Array.prototype.lastIndexOf.call(e,n,r):y(e,[n],r,i,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,i){var o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=n;o<a;o++)if(u(t,o)===u(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===c)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){for(var h=!0,p=0;p<c;p++)if(u(t,o+p)!==u(e,p)){h=!1;break}if(h)return o}return-1}function g(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(z(a))return s;t[n+s]=a}return s}function m(t,e,n,r){return M(C(e,t.length-n),t,n,r)}function _(t,e,n,r){return M(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function w(t,e,n,r){return _(t,e,n,r)}function v(t,e,n,r){return M(U(e),t,n,r)}function E(t,e,n,r){return M(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)n=t.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function b(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,c,u=t[i],f=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(f=u);break;case 2:128==(192&(o=t[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,h=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=h}return function(t){var e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=k));return n}(r)}e.kMaxLength=o,t.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),t.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(t,e,n){return a(t,e,n)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(t,e,n){return function(t,e,n){return c(t),t<=0?s(t):void 0!==e?"string"==typeof n?s(t).fill(e,n):s(t).fill(e):s(t)}(t,e,n)},t.allocUnsafe=function(t){return u(t)},t.allocUnsafeSlow=function(t){return u(t)},t.isBuffer=function(t){return null!=t&&!0===t._isBuffer},t.compare=function(e,n){if(!t.isBuffer(e)||!t.isBuffer(n))throw new TypeError("Arguments must be Buffers");if(e===n)return 0;for(var r=e.length,i=n.length,o=0,s=Math.min(r,i);o<s;++o)if(e[o]!==n[o]){r=e[o],i=n[o];break}return r<i?-1:i<r?1:0},t.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}},t.concat=function(e,n){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var r;if(void 0===n)for(n=0,r=0;r<e.length;++r)n+=e[r].length;var i=t.allocUnsafe(n),o=0;for(r=0;r<e.length;++r){var s=e[r];if(!t.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i},t.byteLength=p,t.prototype._isBuffer=!0,t.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)l(this,e,e+1);return this},t.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)l(this,e,e+3),l(this,e+1,e+2);return this},t.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)l(this,e,e+7),l(this,e+1,e+6),l(this,e+2,e+5),l(this,e+3,e+4);return this},t.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return F(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return b(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},t.prototype.compare=function(e,n,r,i,o){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===n&&(n=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),n<0||r>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&n>=r)return 0;if(i>=o)return-1;if(n>=r)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(r>>>=0)-(n>>>=0),c=Math.min(s,a),u=this.slice(i,o),f=e.slice(n,r),h=0;h<c;++h)if(u[h]!==f[h]){s=u[h],a=f[h];break}return s<a?-1:a<s?1:0},t.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},t.prototype.indexOf=function(t,e,n){return d(this,t,e,n,!0)},t.prototype.lastIndexOf=function(t,e,n){return d(this,t,e,n,!1)},t.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return m(this,t,e,n);case"ascii":return _(this,t,e,n);case"latin1":case"binary":return w(this,t,e,n);case"base64":return v(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function I(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function F(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=P(t[o]);return i}function N(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function R(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function L(e,n,r,i,o,s){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>o||n<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function T(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function x(t,e,n,r,o){return e=+e,n>>>=0,o||T(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function A(t,e,n,r,o){return e=+e,n>>>=0,o||T(t,0,n,8),i.write(t,e,n,r,52,8),n+8}t.prototype.slice=function(e,n){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(n=void 0===n?r:~~n)<0?(n+=r)<0&&(n=0):n>r&&(n=r),n<e&&(n=e);var i=this.subarray(e,n);return i.__proto__=t.prototype,i},t.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},t.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||R(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},t.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},t.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||R(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},t.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},t.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||L(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},t.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||L(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},t.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,1,255,0),this[e]=255&t,e+1},t.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},t.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},t.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);L(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},t.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);L(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},t.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},t.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},t.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},t.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},t.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},t.prototype.writeFloatLE=function(t,e,n){return x(this,t,e,!0,n)},t.prototype.writeFloatBE=function(t,e,n){return x(this,t,e,!1,n)},t.prototype.writeDoubleLE=function(t,e,n){return A(this,t,e,!0,n)},t.prototype.writeDoubleBE=function(t,e,n){return A(this,t,e,!1,n)},t.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},t.prototype.fill=function(e,n,r,i){if("string"==typeof e){if("string"==typeof n?(i=n,n=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(n<0||this.length<n||this.length<r)throw new RangeError("Out of range index");if(r<=n)return this;var s;if(n>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=n;s<r;++s)this[s]=e;else{var a=t.isBuffer(e)?e:new t(e,i),c=a.length;for(s=0;s<r-n;++s)this[s+n]=a[s%c]}return this};var D=/[^+/0-9A-Za-z-_]/g;function P(t){return t<16?"0"+t.toString(16):t.toString(16)}function C(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(t){return r.toByteArray(function(t){if((t=t.trim().replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function M(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function j(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function B(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function z(t){return t!=t}}).call(e,n(1))},function(t,e){"use strict";e.byteLength=function(t){return 3*t.length/4-c(t)},e.toByteArray=function(t){var e,n,o,s,a,u,f=t.length;a=c(t),u=new i(3*f/4-a),o=a>0?f-4:f;var h=0;for(e=0,n=0;e<o;e+=4,n+=3)s=r[t.charCodeAt(e)]<<18|r[t.charCodeAt(e+1)]<<12|r[t.charCodeAt(e+2)]<<6|r[t.charCodeAt(e+3)],u[h++]=s>>16&255,u[h++]=s>>8&255,u[h++]=255&s;2===a?(s=r[t.charCodeAt(e)]<<2|r[t.charCodeAt(e+1)]>>4,u[h++]=255&s):1===a&&(s=r[t.charCodeAt(e)]<<10|r[t.charCodeAt(e+1)]<<4|r[t.charCodeAt(e+2)]>>2,u[h++]=s>>8&255,u[h++]=255&s);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o="",s=[],a=0,c=r-i;a<c;a+=16383)s.push(u(t,a,a+16383>c?c:a+16383));1===i?(e=t[r-1],o+=n[e>>2],o+=n[e<<4&63],o+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],o+=n[e>>10],o+=n[e>>4&63],o+=n[e<<2&63],o+="=");return s.push(o),s.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function u(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16)+(t[a+1]<<8)+t[a+2],s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,u=c>>1,f=-7,h=n?i-1:0,p=n?-1:1,l=t[e+h];for(h+=p,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+t[e+h],h+=p,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=256*s+t[e+h],h+=p,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,r),o-=u}return(l?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,u=8*o-i-1,f=(1<<u)-1,h=f>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+h>=1?p/c:p*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(e*c-1)*Math.pow(2,i),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[n+l]=255&a,l+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+l]=255&s,l+=d,s/=256,u-=8);t[n+l-d]|=128*y}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){"use strict";var r=new(n(7)),i={};function o(t){i[t]||("function"==typeof r[t]?i[t]=function(){return r[t].apply(r,arguments)}:i[t]=r[t])}for(var s in r)o(s);i.initializeTTYs=function(){null===r.stdin&&(r.initializeTTYs(),i.stdin=r.stdin,i.stdout=r.stdout,i.stderr=r.stderr)},r.nextTick(function(){i.initializeTTYs()}),t.exports=i},function(t,e,n){(function(e){"use strict";var r=this&&this.__extends||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function r(){this.constructor=t}t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=n(8),o=null,s=function(){function t(t,e){this.fun=t,this.array=e}return t.prototype.run=function(){this.fun.apply(null,this.array)},t}(),a=function(){function t(){this._queue=[],this._draining=!1,this._currentQueue=null,this._queueIndex=-1}return t.prototype.push=function(t){var e=this;1!==this._queue.push(t)||this._draining||setTimeout(function(){return e._drainQueue()},0)},t.prototype._cleanUpNextTick=function(){this._draining=!1,this._currentQueue&&this._currentQueue.length?this._queue=this._currentQueue.concat(this._queue):this._queueIndex=-1,this._queue.length&&this._drainQueue()},t.prototype._drainQueue=function(){var t=this;if(!this._draining){var e=setTimeout(function(){return t._cleanUpNextTick()});this._draining=!0;for(var n=this._queue.length;n;){for(this._currentQueue=this._queue,this._queue=[];++this._queueIndex<n;)this._currentQueue&&this._currentQueue[this._queueIndex].run();this._queueIndex=-1,n=this._queue.length}this._currentQueue=null,this._draining=!1,clearTimeout(e)}},t}(),c=function(t){function i(){t.apply(this,arguments),this.startTime=Date.now(),this._cwd="/",this.platform="browser",this.argv=[],this.execArgv=[],this.stdout=null,this.stderr=null,this.stdin=null,this.domain=null,this._queue=new a,this.execPath=e,this.env={},this.exitCode=0,this._gid=1,this._uid=1,this.version="v5.0",this.versions={http_parser:"0.0",node:"5.0",v8:"0.0",uv:"0.0",zlib:"0.0",ares:"0.0",icu:"0.0",modules:"0",openssl:"0.0"},this.config={target_defaults:{cflags:[],default_configuration:"Release",defines:[],include_dirs:[],libraries:[]},variables:{clang:0,host_arch:"x32",node_install_npm:!1,node_install_waf:!1,node_prefix:"",node_shared_cares:!1,node_shared_http_parser:!1,node_shared_libuv:!1,node_shared_zlib:!1,node_shared_v8:!1,node_use_dtrace:!1,node_use_etw:!1,node_use_openssl:!1,node_shared_openssl:!1,strict_aliasing:!1,target_arch:"x32",v8_use_snapshot:!1,v8_no_strict_aliasing:0,visibility:""}},this.pid=1e3*Math.random()|0,this.title="node",this.arch="x32",this._mask=18,this.connected=void 0}return r(i,t),i.prototype.chdir=function(t){null===o&&(o=n(9)),this._cwd=o.resolve(t)},i.prototype.cwd=function(){return this._cwd},i.prototype.uptime=function(){return(Date.now()-this.startTime)/1e3|0},i.prototype.nextTick=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this._queue.push(new s(t,e))},i.prototype.abort=function(){this.emit("abort")},i.prototype.exit=function(t){this.exitCode=t,this.emit("exit",[t])},i.prototype.getgid=function(){return this._gid},i.prototype.setgid=function(t){this._gid="number"==typeof t?t:1},i.prototype.getuid=function(){return this._uid},i.prototype.setuid=function(t){this._uid="number"==typeof t?t:1},i.prototype.kill=function(t,e){this.emit("kill",[t,e])},i.prototype.memoryUsage=function(){return{rss:0,heapTotal:0,heapUsed:0}},i.prototype.umask=function(t){void 0===t&&(t=this._mask);var e=this._mask;return this._mask=t,this.emit("umask",[t]),e},i.prototype.hrtime=function(){var t,e=(t="undefined"!=typeof performance?performance.now():Date.now?Date.now():(new Date).getTime())/1e3|0;return[e,t=1e6*(t-=1e3*e)|0]},i.prototype.initializeTTYs=function(){if(null===this.stdout){var t=n(10);this.stdout=new t,this.stderr=new t,this.stdin=new t}},i.prototype.disconnect=function(){},i}(i.EventEmitter);t.exports=c}).call(e,"/")},function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,s,a,c,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var f=new Error('Uncaught, unspecified "error" event. ('+e+")");throw f.context=e,f}if(o(n=this._events[t]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(i(n))for(a=Array.prototype.slice.call(arguments,1),s=(u=n.slice()).length,c=0;c<s;c++)u[c].apply(this,a);return!0},n.prototype.addListener=function(t,e){var s;if(!r(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?i(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,i(this._events[t])&&!this._events[t].warned&&(s=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[t].length>s&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){if(!r(e))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(t,i),n||(n=!0,e.apply(this,arguments))}return i.listener=e,this.on(t,i),this},n.prototype.removeListener=function(t,e){var n,o,s,a;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(s=(n=this._events[t]).length,o=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(a=s;a-- >0;)if(n[a]===e||n[a].listener&&n[a].listener===e){o=a;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(r(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},function(t,e,n){(function(e){"use strict";var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var r=function(){function t(){}return t.normalize=function(e){""===e&&(e=".");for(var n=e.charAt(0)===t.sep,r=(e=t._removeDuplicateSeps(e)).split(t.sep),i=[],o=0;o<r.length;o++){var s=r[o];"."!==s&&(".."===s&&(n||!n&&i.length>0&&".."!==i[0])?i.pop():i.push(s))}if(!n&&i.length<2)switch(i.length){case 1:""===i[0]&&i.unshift(".");break;default:i.push(".")}return e=i.join(t.sep),n&&e.charAt(0)!==t.sep&&(e=t.sep+e),e},t.join=function(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];for(var r=[],i=0;i<e.length;i++){var o=e[i];if("string"!=typeof o)throw new TypeError("Invalid argument type to path.join: "+typeof o);""!==o&&r.push(o)}return t.normalize(r.join(t.sep))},t.resolve=function(){for(var n=[],r=0;r<arguments.length;r++)n[r-0]=arguments[r];for(var i=[],o=0;o<n.length;o++){var s=n[o];if("string"!=typeof s)throw new TypeError("Invalid argument type to path.join: "+typeof s);""!==s&&(s.charAt(0)===t.sep&&(i=[]),i.push(s))}var a=t.normalize(i.join(t.sep));if(a.length>1&&a.charAt(a.length-1)===t.sep)return a.substr(0,a.length-1);if(a.charAt(0)!==t.sep){"."!==a.charAt(0)||1!==a.length&&a.charAt(1)!==t.sep||(a=1===a.length?"":a.substr(2));var c=e.cwd();a=""!==a?this.normalize(c+("/"!==c?t.sep:"")+a):c}return a},t.relative=function(e,n){var r;e=t.resolve(e),n=t.resolve(n);var i=e.split(t.sep),o=n.split(t.sep);o.shift(),i.shift();var s=0,a=[];for(r=0;r<i.length;r++){if(i[r]!==o[r]){s=i.length-r;break}}a=o.slice(r),1===i.length&&""===i[0]&&(s=0),s>i.length&&(s=i.length);var c="";for(r=0;r<s;r++)c+="../";return(c+=a.join(t.sep)).length>1&&c.charAt(c.length-1)===t.sep&&(c=c.substr(0,c.length-1)),c},t.dirname=function(e){var n=(e=t._removeDuplicateSeps(e)).charAt(0)===t.sep,r=e.split(t.sep);return""===r.pop()&&r.length>0&&r.pop(),r.length>1||1===r.length&&!n?r.join(t.sep):n?t.sep:"."},t.basename=function(e,n){if(void 0===n&&(n=""),""===e)return e;var r=(e=t.normalize(e)).split(t.sep),i=r[r.length-1];if(""===i&&r.length>1)return r[r.length-2];if(n.length>0&&i.substr(i.length-n.length)===n)return i.substr(0,i.length-n.length);return i},t.extname=function(e){var n=(e=t.normalize(e)).split(t.sep);if(""===(e=n.pop())&&n.length>0&&(e=n.pop()),".."===e)return"";var r=e.lastIndexOf(".");return-1===r||0===r?"":e.substr(r)},t.isAbsolute=function(e){return e.length>0&&e.charAt(0)===t.sep},t._makeLong=function(t){return t},t.parse=function(t){var e,r,i=(e=t,(r=n.exec(e)).shift(),r);return{root:i[0],dir:i[0]+i[1].slice(0,-1),base:i[2],ext:i[3],name:i[2].slice(0,i[2].length-i[3].length)}},t.format=function(e){if(null===e||"object"!=typeof e)throw new TypeError("Parameter 'pathObject' must be an object, not "+typeof e);if("string"!=typeof(e.root||""))throw new TypeError("'pathObject.root' must be a string or undefined, not "+typeof e.root);return(e.dir?e.dir+t.sep:"")+(e.base||"")},t._removeDuplicateSeps=function(t){return t=t.replace(this._replaceRegex,this.sep)},t.sep="/",t._replaceRegex=new RegExp("//+","g"),t.delimiter=":",t.posix=t,t.win32=t,t}();t.exports=r}).call(e,n(6))},function(t,e,n){(function(e){"use strict";var r=this&&this.__extends||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);function r(){this.constructor=t}t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},i=function(t){function n(){t.call(this),this.isRaw=!1,this.columns=80,this.rows=120,this.isTTY=!0,this._bufferedWrites=[],this._waitingForWrites=!1}return r(n,t),n.prototype.setRawMode=function(t){this.isRaw!==t&&(this.isRaw=t,this.emit("modeChange"))},n.prototype.changeColumns=function(t){t!==this.columns&&(this.columns=t,this.emit("resize"))},n.prototype.changeRows=function(t){t!==this.rows&&(this.rows=t,this.emit("resize"))},n.isatty=function(t){return t&&t instanceof n},n.prototype._write=function(t,n,r){var i;try{var o;o="string"==typeof t?new e(t,n):t,this._bufferedWrites.push(o),this._waitingForWrites&&this._read(1024)}catch(t){i=t}finally{r(i)}},n.prototype._read=function(t){if(0===this._bufferedWrites.length)this._waitingForWrites=!0;else for(;this._bufferedWrites.length>0&&(this._waitingForWrites=this.push(this._bufferedWrites.shift()),this._waitingForWrites););},n}(n(11).Duplex);t.exports=i}).call(e,n(1))},function(t,e,n){t.exports=i;var r=n(8).EventEmitter;function i(){r.call(this)}n(12)(i,r),i.Readable=n(13),i.Writable=n(27),i.Duplex=n(28),i.Transform=n(29),i.PassThrough=n(30),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",a),n.on("close",c));var s=!1;function a(){s||(s=!0,t.end())}function c(){s||(s=!0,"function"==typeof t.destroy&&t.destroy())}function u(t){if(f(),0===r.listenerCount(this,"error"))throw t}function f(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",a),n.removeListener("close",c),n.removeListener("error",u),t.removeListener("error",u),n.removeListener("end",f),n.removeListener("close",f),t.removeListener("close",f)}return n.on("error",u),t.on("error",u),n.on("end",f),n.on("close",f),t.on("close",f),t.emit("pipe",n),t}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){(function(r){var i=function(){try{return n(11)}catch(t){}}();(e=t.exports=n(14)).Stream=i||e,e.Readable=e,e.Writable=n(22),e.Duplex=n(21),e.Transform=n(25),e.PassThrough=n(26),!r.browser&&"disable"===r.env.READABLE_STREAM&&i&&(t.exports=i)}).call(e,n(6))},function(t,e,n){(function(e){"use strict";t.exports=g;var r,i=n(15),o=n(16);g.ReadableState=y;n(8).EventEmitter;var s,a=function(t,e){return t.listeners(e).length};!function(){try{s=n(11)}catch(t){}finally{s||(s=n(8).EventEmitter)}}();var c=n(2).Buffer,u=n(17),f=n(18);f.inherits=n(12);var h=n(19),p=void 0;p=h&&h.debuglog?h.debuglog("stream"):function(){};var l,d=n(20);function y(t,e){r=r||n(21),t=t||{},this.objectMode=!!t.objectMode,e instanceof r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,o=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:o,this.highWaterMark=~~this.highWaterMark,this.buffer=new d,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(24).StringDecoder),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function g(t){if(r=r||n(21),!(this instanceof g))return new g(t);this._readableState=new y(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),s.call(this)}function m(t,e,n,r,o){var s=function(t,e){var n=null;c.isBuffer(e)||"string"==typeof e||null==e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(e,n);if(s)t.emit("error",s);else if(null===n)e.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,v(t)}(t,e);else if(e.objectMode||n&&n.length>0)if(e.ended&&!o){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&o){var u=new Error("stream.unshift() after end event");t.emit("error",u)}else{var f;!e.decoder||o||r||(n=e.decoder.write(n),f=!e.objectMode&&0===n.length),o||(e.reading=!1),f||(e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,o?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&v(t))),function(t,e){e.readingMore||(e.readingMore=!0,i(b,t,e))}(t,e)}else o||(e.reading=!1);return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(e)}f.inherits(g,s),g.prototype.push=function(t,e){var n=this._readableState;return n.objectMode||"string"!=typeof t||(e=e||n.defaultEncoding)!==n.encoding&&(t=u.from(t,e),e=""),m(this,n,t,e,!1)},g.prototype.unshift=function(t){return m(this,this._readableState,t,"",!0)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(t){return l||(l=n(24).StringDecoder),this._readableState.decoder=new l(t),this._readableState.encoding=t,this};var _=8388608;function w(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=_?t=_:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function v(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(p("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i(E,t):E(t))}function E(t){p("emit readable"),t.emit("readable"),I(t)}function b(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(p("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function S(t){p("readable nexttick read 0"),t.read(0)}function k(t,e){e.reading||(p("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),I(t),e.flowing&&!e.reading&&t.read(0)}function I(t){var e=t._readableState;for(p("flow",e.flowing);e.flowing&&null!==t.read(););}function O(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,s=t>o.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=u.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function F(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}g.prototype.read=function(t){p("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return p("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):v(this),null;if(0===(t=w(t,e))&&e.ended)return 0===e.length&&F(this),null;var r,i=e.needReadable;return p("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&p("length less than watermark",i=!0),e.ended||e.reading?p("reading or ended",i=!1):i&&(p("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=w(n,e))),null===(r=t>0?O(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&F(this)),null!==r&&this.emit("data",r),r},g.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,n){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,n);var c=(!n||!1!==n.end)&&t!==e.stdout&&t!==e.stderr?f:d;function u(t){p("onunpipe"),t===r&&d()}function f(){p("onend"),t.end()}s.endEmitted?i(c):r.once("end",c),t.on("unpipe",u);var h=function(t){return function(){var e=t._readableState;p("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,I(t))}}(r);t.on("drain",h);var l=!1;function d(){p("cleanup"),t.removeListener("close",_),t.removeListener("finish",w),t.removeListener("drain",h),t.removeListener("error",m),t.removeListener("unpipe",u),r.removeListener("end",f),r.removeListener("end",d),r.removeListener("data",g),l=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||h()}var y=!1;function g(e){p("ondata"),y=!1,!1!==t.write(e)||y||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==R(s.pipes,t))&&!l&&(p("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,y=!0),r.pause())}function m(e){p("onerror",e),v(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function _(){t.removeListener("finish",w),v()}function w(){p("onfinish"),t.removeListener("close",_),v()}function v(){p("unpipe"),r.unpipe(t)}return r.on("data",g),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",m),t.once("close",_),t.once("finish",w),t.emit("pipe",r),s.flowing||(p("pipe resume"),r.resume()),t},g.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var n=e.pipes,r=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var o=R(e.pipes,t);return-1===o?this:(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},g.prototype.on=function(t,e){var n=s.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&v(this):i(S,this))}return n},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var t=this._readableState;return t.flowing||(p("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i(k,t,e))}(this,t)),this},g.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(t){var e=this._readableState,n=!1,r=this;for(var i in t.on("end",function(){if(p("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&r.push(t)}r.push(null)}),t.on("data",function(i){(p("wrapped data"),e.decoder&&(i=e.decoder.write(i)),e.objectMode&&null==i)||(e.objectMode||i&&i.length)&&(r.push(i)||(n=!0,t.pause()))}),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));return function(t,e){for(var n=0,r=t.length;n<r;n++)e(t[n],n)}(["error","close","destroy","pause","resume"],function(e){t.on(e,r.emit.bind(r,e))}),r._read=function(e){p("wrapped _read",e),n&&(n=!1,t.resume())},r},g._fromList=O}).call(e,n(6))},function(t,e,n){(function(e){"use strict";!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports=function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,n)});case 3:return e.nextTick(function(){t.call(null,n,r)});case 4:return e.nextTick(function(){t.call(null,n,r,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}:t.exports=e.nextTick}).call(e,n(6))},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){(function(t){"use strict";var r=n(2),i=r.Buffer,o=r.SlowBuffer,s=r.kMaxLength||2147483647;e.alloc=function(t,e,n){if("function"==typeof i.alloc)return i.alloc(t,e,n);if("number"==typeof n)throw new TypeError("encoding must not be number");if("number"!=typeof t)throw new TypeError("size must be a number");if(t>s)throw new RangeError("size is too large");var r=n,o=e;void 0===o&&(r=void 0,o=0);var a=new i(t);if("string"==typeof o)for(var c=new i(o,r),u=c.length,f=-1;++f<t;)a[f]=c[f%u];else a.fill(o);return a},e.allocUnsafe=function(t){if("function"==typeof i.allocUnsafe)return i.allocUnsafe(t);if("number"!=typeof t)throw new TypeError("size must be a number");if(t>s)throw new RangeError("size is too large");return new i(t)},e.from=function(e,n,r){if("function"==typeof i.from&&(!t.Uint8Array||Uint8Array.from!==i.from))return i.from(e,n,r);if("number"==typeof e)throw new TypeError('"value" argument must not be a number');if("string"==typeof e)return new i(e,n);if("undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer){var o=n;if(1===arguments.length)return new i(e);void 0===o&&(o=0);var s=r;if(void 0===s&&(s=e.byteLength-o),o>=e.byteLength)throw new RangeError("'offset' is out of bounds");if(s>e.byteLength-o)throw new RangeError("'length' is out of bounds");return new i(e.slice(o,o+s))}if(i.isBuffer(e)){var a=new i(e.length);return e.copy(a,0,0,e.length),a}if(e){if(Array.isArray(e)||"undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return new i(e);if("Buffer"===e.type&&Array.isArray(e.data))return new i(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},e.allocUnsafeSlow=function(t){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(t);if("number"!=typeof t)throw new TypeError("size must be a number");if(t>=s)throw new RangeError("size is too large");return new o(t)}}).call(e,function(){return this}())},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(e,n(1))},function(t,e){},function(t,e,n){"use strict";n(2).Buffer;var r=n(17);function i(){this.head=null,this.tail=null,this.length=0}t.exports=i,i.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},i.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},i.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},i.prototype.clear=function(){this.head=this.tail=null,this.length=0},i.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},i.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e=r.allocUnsafe(t>>>0),n=this.head,i=0;n;)n.data.copy(e,i),i+=n.data.length,n=n.next;return e}},function(t,e,n){"use strict";var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=h;var i=n(15),o=n(18);o.inherits=n(12);var s=n(14),a=n(22);o.inherits(h,s);for(var c=r(a.prototype),u=0;u<c.length;u++){var f=c[u];h.prototype[f]||(h.prototype[f]=a.prototype[f])}function h(t){if(!(this instanceof h))return new h(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||i(l,this)}function l(t){t.end()}},function(t,e,n){(function(e){"use strict";t.exports=d;var r,i=n(15),o=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?setImmediate:i;d.WritableState=l;var s=n(18);s.inherits=n(12);var a,c={deprecate:n(23)};!function(){try{a=n(11)}catch(t){}finally{a||(a=n(8).EventEmitter)}}();var u,f=n(2).Buffer,h=n(17);function p(){}function l(t,e){r=r||n(21),t=t||{},this.objectMode=!!t.objectMode,e instanceof r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var s=t.highWaterMark,a=this.objectMode?16:16384;this.highWaterMark=s||0===s?s:a,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,s=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?i(o,r):o(r);t._writableState.errorEmitted=!0,t.emit("error",r)}(t,n,r,e,s);else{var a=_(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||m(t,n),r?o(g,t,n,a,s):g(t,n,a,s)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new E(this)}function d(t){if(r=r||n(21),!(u.call(d,this)||this instanceof r))return new d(t);this._writableState=new l(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),a.call(this)}function y(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function g(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),v(t,e)}function m(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var s=0;n;)i[s]=n,n=n.next,s+=1;y(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new E(e)}else{for(;n;){var a=n.chunk,c=n.encoding,u=n.callback;if(y(t,e,!1,e.objectMode?1:a.length,a,c,u),n=n.next,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequestCount=0,e.bufferedRequest=n,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function w(t,e){e.prefinished||(e.prefinished=!0,t.emit("prefinish"))}function v(t,e){var n=_(e);return n&&(0===e.pendingcb?(w(t,e),e.finished=!0,t.emit("finish")):w(t,e)),n}function E(t){var e=this;this.next=null,this.entry=null,this.finish=function(n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}}s.inherits(d,a),l.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(l.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(u=Function.prototype[Symbol.hasInstance],Object.defineProperty(d,Symbol.hasInstance,{value:function(t){return!!u.call(this,t)||t&&t._writableState instanceof l}})):u=function(t){return t instanceof this},d.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},d.prototype.write=function(t,e,n){var r=this._writableState,o=!1,s=f.isBuffer(t);return"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=p),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),i(e,n)}(this,n):(s||function(t,e,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),i(r,s),o=!1),o}(this,r,t,n))&&(r.pendingcb++,o=function(t,e,n,r,i,o){n||(r=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,r,i),f.isBuffer(r)&&(i="buffer"));var s=e.objectMode?1:r.length;e.length+=s;var a=e.length<e.highWaterMark;a||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest=new function(t,e,n){this.chunk=t,this.encoding=e,this.callback=n,this.next=null}(r,i,o),c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else y(t,e,!1,s,r,i,o);return a}(this,r,s,t,e,n)),o},d.prototype.cork=function(){this._writableState.corked++},d.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||m(this,t))},d.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},d.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},d.prototype._writev=null,d.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,v(t,e),n&&(e.finished?i(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)}}).call(e,n(6))},function(t,e){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(e,function(){return this}())},function(t,e,n){var r=n(2).Buffer,i=r.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};var o=e.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!i(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=c;break;default:return void(this.write=s)}this.charBuffer=new r(6),this.charReceived=0,this.charLength=0};function s(t){return t.toString(this.encoding)}function a(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function c(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}o.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(t=t.slice(n,t.length),!((i=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,r),r-=this.charReceived);var i;r=(e+=t.toString(this.encoding,0,r)).length-1;if((i=e.charCodeAt(r))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),t.copy(this.charBuffer,0,0,o),e.substring(0,r)}return e},o.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},o.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;e+=r.slice(0,n).toString(i)}return e}},function(t,e,n){"use strict";t.exports=s;var r=n(21),i=n(18);function o(t){this.afterTransform=function(e,n){return function(t,e,n){var r=t._transformState;r.transforming=!1;var i=r.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,null!=n&&t.push(n);i(e);var o=t._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&t._read(o.highWaterMark)}(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function s(t){if(!(this instanceof s))return new s(t);r.call(this,t),this._transformState=new o(this);var e=this;this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(t,n){a(e,t,n)}):a(e)})}function a(t,e,n){if(e)return t.emit("error",e);null!=n&&t.push(n);var r=t._writableState,i=t._transformState;if(r.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=n(12),i.inherits(s,r),s.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},s.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},function(t,e,n){"use strict";t.exports=o;var r=n(25),i=n(18);function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(12),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(22)},function(t,e,n){t.exports=n(21)},function(t,e,n){t.exports=n(25)},function(t,e,n){t.exports=n(26)},function(t,e,n){"use strict";var r=n(32),i=n(33),o=n(38),s=n(39),a=n(40),c=n(41),u=n(42),f=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,e.windowBits);if(n!==s.Z_OK)throw new Error(a[n]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function p(t,e){var n=new h(e);if(n.push(t,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(t,e){var n,a,c,u,h,p,l=this.strm,d=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?s.Z_FINISH:s.Z_NO_FLUSH,"string"==typeof t?l.input=o.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new i.Buf8(d),l.next_out=0,l.avail_out=d),(n=r.inflate(l,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&y&&(p="string"==typeof y?o.string2buf(y):"[object ArrayBuffer]"===f.call(y)?new Uint8Array(y):y,n=r.inflateSetDictionary(this.strm,p)),n===s.Z_BUF_ERROR&&!0===g&&(n=s.Z_OK,g=!1),n!==s.Z_STREAM_END&&n!==s.Z_OK)return this.onEnd(n),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&n!==s.Z_STREAM_END&&(0!==l.avail_in||a!==s.Z_FINISH&&a!==s.Z_SYNC_FLUSH)||("string"===this.options.to?(c=o.utf8border(l.output,l.next_out),u=l.next_out-c,h=o.buf2string(l.output,c),l.next_out=u,l.avail_out=d-u,u&&i.arraySet(l.output,l.output,c,u,0),this.onData(h)):this.onData(i.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(g=!0)}while((l.avail_in>0||0===l.avail_out)&&n!==s.Z_STREAM_END);return n===s.Z_STREAM_END&&(a=s.Z_FINISH),a===s.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===s.Z_OK):a!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),l.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===s.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=h,e.inflate=p,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,p(t,e)},e.ungzip=p},function(t,e,n){"use strict";var r=n(33),i=n(34),o=n(35),s=n(36),a=n(37),c=0,u=1,f=2,h=4,p=5,l=6,d=0,y=1,g=2,m=-2,_=-3,w=-4,v=-5,E=8,b=1,S=2,k=3,I=4,O=5,F=6,N=7,R=8,L=9,T=10,x=11,A=12,D=13,P=14,C=15,U=16,M=17,j=18,B=19,z=20,q=21,V=22,W=23,H=24,Z=25,Y=26,X=27,K=28,J=29,G=30,Q=31,$=32,tt=852,et=592,nt=15;function rt(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function it(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=b,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(tt),e.distcode=e.distdyn=new r.Buf32(et),e.sane=1,e.back=-1,d):m}function ot(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,it(t)):m}function st(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?m:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,ot(t))):m}function at(t,e){var n,i;return t?(i=new function(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0},t.state=i,i.window=null,(n=st(t,e))!==d&&(t.state=null),n):m}var ct,ut,ft=!0;function ht(t){if(ft){var e;for(ct=new r.Buf32(512),ut=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(a(u,t.lens,0,288,ct,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(f,t.lens,0,32,ut,0,t.work,{bits:5}),ft=!1}t.lencode=ct,t.lenbits=9,t.distcode=ut,t.distbits=5}function pt(t,e,n,i){var o,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new r.Buf8(s.wsize)),i>=s.wsize?(r.arraySet(s.window,e,n-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((o=s.wsize-s.wnext)>i&&(o=i),r.arraySet(s.window,e,n-i,o,s.wnext),(i-=o)?(r.arraySet(s.window,e,n-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=o,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=o))),0}e.inflateReset=ot,e.inflateReset2=st,e.inflateResetKeep=it,e.inflateInit=function(t){return at(t,nt)},e.inflateInit2=at,e.inflate=function(t,e){var n,tt,et,nt,it,ot,st,at,ct,ut,ft,lt,dt,yt,gt,mt,_t,wt,vt,Et,bt,St,kt,It,Ot=0,Ft=new r.Buf8(4),Nt=[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 m;(n=t.state).mode===A&&(n.mode=D),it=t.next_out,et=t.output,st=t.avail_out,nt=t.next_in,tt=t.input,ot=t.avail_in,at=n.hold,ct=n.bits,ut=ot,ft=st,St=d;t:for(;;)switch(n.mode){case b:if(0===n.wrap){n.mode=D;break}for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(2&n.wrap&&35615===at){n.check=0,Ft[0]=255&at,Ft[1]=at>>>8&255,n.check=o(n.check,Ft,2,0),at=0,ct=0,n.mode=S;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&at)<<8)+(at>>8))%31){t.msg="incorrect header check",n.mode=G;break}if((15&at)!==E){t.msg="unknown compression method",n.mode=G;break}if(ct-=4,bt=8+(15&(at>>>=4)),0===n.wbits)n.wbits=bt;else if(bt>n.wbits){t.msg="invalid window size",n.mode=G;break}n.dmax=1<<bt,t.adler=n.check=1,n.mode=512&at?T:A,at=0,ct=0;break;case S:for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(n.flags=at,(255&n.flags)!==E){t.msg="unknown compression method",n.mode=G;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=G;break}n.head&&(n.head.text=at>>8&1),512&n.flags&&(Ft[0]=255&at,Ft[1]=at>>>8&255,n.check=o(n.check,Ft,2,0)),at=0,ct=0,n.mode=k;case k:for(;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}n.head&&(n.head.time=at),512&n.flags&&(Ft[0]=255&at,Ft[1]=at>>>8&255,Ft[2]=at>>>16&255,Ft[3]=at>>>24&255,n.check=o(n.check,Ft,4,0)),at=0,ct=0,n.mode=I;case I:for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}n.head&&(n.head.xflags=255&at,n.head.os=at>>8),512&n.flags&&(Ft[0]=255&at,Ft[1]=at>>>8&255,n.check=o(n.check,Ft,2,0)),at=0,ct=0,n.mode=O;case O:if(1024&n.flags){for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}n.length=at,n.head&&(n.head.extra_len=at),512&n.flags&&(Ft[0]=255&at,Ft[1]=at>>>8&255,n.check=o(n.check,Ft,2,0)),at=0,ct=0}else n.head&&(n.head.extra=null);n.mode=F;case F:if(1024&n.flags&&((lt=n.length)>ot&&(lt=ot),lt&&(n.head&&(bt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,tt,nt,lt,bt)),512&n.flags&&(n.check=o(n.check,tt,lt,nt)),ot-=lt,nt+=lt,n.length-=lt),n.length))break t;n.length=0,n.mode=N;case N:if(2048&n.flags){if(0===ot)break t;lt=0;do{bt=tt[nt+lt++],n.head&&bt&&n.length<65536&&(n.head.name+=String.fromCharCode(bt))}while(bt&&lt<ot);if(512&n.flags&&(n.check=o(n.check,tt,lt,nt)),ot-=lt,nt+=lt,bt)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=R;case R:if(4096&n.flags){if(0===ot)break t;lt=0;do{bt=tt[nt+lt++],n.head&&bt&&n.length<65536&&(n.head.comment+=String.fromCharCode(bt))}while(bt&&lt<ot);if(512&n.flags&&(n.check=o(n.check,tt,lt,nt)),ot-=lt,nt+=lt,bt)break t}else n.head&&(n.head.comment=null);n.mode=L;case L:if(512&n.flags){for(;ct<16;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(at!==(65535&n.check)){t.msg="header crc mismatch",n.mode=G;break}at=0,ct=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=A;break;case T:for(;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}t.adler=n.check=rt(at),at=0,ct=0,n.mode=x;case x:if(0===n.havedict)return t.next_out=it,t.avail_out=st,t.next_in=nt,t.avail_in=ot,n.hold=at,n.bits=ct,g;t.adler=n.check=1,n.mode=A;case A:if(e===p||e===l)break t;case D:if(n.last){at>>>=7&ct,ct-=7&ct,n.mode=X;break}for(;ct<3;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}switch(n.last=1&at,ct-=1,3&(at>>>=1)){case 0:n.mode=P;break;case 1:if(ht(n),n.mode=z,e===l){at>>>=2,ct-=2;break t}break;case 2:n.mode=M;break;case 3:t.msg="invalid block type",n.mode=G}at>>>=2,ct-=2;break;case P:for(at>>>=7&ct,ct-=7&ct;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if((65535&at)!=(at>>>16^65535)){t.msg="invalid stored block lengths",n.mode=G;break}if(n.length=65535&at,at=0,ct=0,n.mode=C,e===l)break t;case C:n.mode=U;case U:if(lt=n.length){if(lt>ot&&(lt=ot),lt>st&&(lt=st),0===lt)break t;r.arraySet(et,tt,nt,lt,it),ot-=lt,nt+=lt,st-=lt,it+=lt,n.length-=lt;break}n.mode=A;break;case M:for(;ct<14;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(n.nlen=257+(31&at),at>>>=5,ct-=5,n.ndist=1+(31&at),at>>>=5,ct-=5,n.ncode=4+(15&at),at>>>=4,ct-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=G;break}n.have=0,n.mode=j;case j:for(;n.have<n.ncode;){for(;ct<3;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}n.lens[Nt[n.have++]]=7&at,at>>>=3,ct-=3}for(;n.have<19;)n.lens[Nt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,kt={bits:n.lenbits},St=a(c,n.lens,0,19,n.lencode,0,n.work,kt),n.lenbits=kt.bits,St){t.msg="invalid code lengths set",n.mode=G;break}n.have=0,n.mode=B;case B:for(;n.have<n.nlen+n.ndist;){for(;mt=(Ot=n.lencode[at&(1<<n.lenbits)-1])>>>16&255,_t=65535&Ot,!((gt=Ot>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(_t<16)at>>>=gt,ct-=gt,n.lens[n.have++]=_t;else{if(16===_t){for(It=gt+2;ct<It;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(at>>>=gt,ct-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=G;break}bt=n.lens[n.have-1],lt=3+(3&at),at>>>=2,ct-=2}else if(17===_t){for(It=gt+3;ct<It;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}ct-=gt,bt=0,lt=3+(7&(at>>>=gt)),at>>>=3,ct-=3}else{for(It=gt+7;ct<It;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}ct-=gt,bt=0,lt=11+(127&(at>>>=gt)),at>>>=7,ct-=7}if(n.have+lt>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=G;break}for(;lt--;)n.lens[n.have++]=bt}}if(n.mode===G)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=G;break}if(n.lenbits=9,kt={bits:n.lenbits},St=a(u,n.lens,0,n.nlen,n.lencode,0,n.work,kt),n.lenbits=kt.bits,St){t.msg="invalid literal/lengths set",n.mode=G;break}if(n.distbits=6,n.distcode=n.distdyn,kt={bits:n.distbits},St=a(f,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,kt),n.distbits=kt.bits,St){t.msg="invalid distances set",n.mode=G;break}if(n.mode=z,e===l)break t;case z:n.mode=q;case q:if(ot>=6&&st>=258){t.next_out=it,t.avail_out=st,t.next_in=nt,t.avail_in=ot,n.hold=at,n.bits=ct,s(t,ft),it=t.next_out,et=t.output,st=t.avail_out,nt=t.next_in,tt=t.input,ot=t.avail_in,at=n.hold,ct=n.bits,n.mode===A&&(n.back=-1);break}for(n.back=0;mt=(Ot=n.lencode[at&(1<<n.lenbits)-1])>>>16&255,_t=65535&Ot,!((gt=Ot>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(mt&&0==(240&mt)){for(wt=gt,vt=mt,Et=_t;mt=(Ot=n.lencode[Et+((at&(1<<wt+vt)-1)>>wt)])>>>16&255,_t=65535&Ot,!(wt+(gt=Ot>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}at>>>=wt,ct-=wt,n.back+=wt}if(at>>>=gt,ct-=gt,n.back+=gt,n.length=_t,0===mt){n.mode=Y;break}if(32&mt){n.back=-1,n.mode=A;break}if(64&mt){t.msg="invalid literal/length code",n.mode=G;break}n.extra=15&mt,n.mode=V;case V:if(n.extra){for(It=n.extra;ct<It;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}n.length+=at&(1<<n.extra)-1,at>>>=n.extra,ct-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=W;case W:for(;mt=(Ot=n.distcode[at&(1<<n.distbits)-1])>>>16&255,_t=65535&Ot,!((gt=Ot>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(0==(240&mt)){for(wt=gt,vt=mt,Et=_t;mt=(Ot=n.distcode[Et+((at&(1<<wt+vt)-1)>>wt)])>>>16&255,_t=65535&Ot,!(wt+(gt=Ot>>>24)<=ct);){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}at>>>=wt,ct-=wt,n.back+=wt}if(at>>>=gt,ct-=gt,n.back+=gt,64&mt){t.msg="invalid distance code",n.mode=G;break}n.offset=_t,n.extra=15&mt,n.mode=H;case H:if(n.extra){for(It=n.extra;ct<It;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}n.offset+=at&(1<<n.extra)-1,at>>>=n.extra,ct-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=G;break}n.mode=Z;case Z:if(0===st)break t;if(lt=ft-st,n.offset>lt){if((lt=n.offset-lt)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=G;break}lt>n.wnext?(lt-=n.wnext,dt=n.wsize-lt):dt=n.wnext-lt,lt>n.length&&(lt=n.length),yt=n.window}else yt=et,dt=it-n.offset,lt=n.length;lt>st&&(lt=st),st-=lt,n.length-=lt;do{et[it++]=yt[dt++]}while(--lt);0===n.length&&(n.mode=q);break;case Y:if(0===st)break t;et[it++]=n.length,st--,n.mode=q;break;case X:if(n.wrap){for(;ct<32;){if(0===ot)break t;ot--,at|=tt[nt++]<<ct,ct+=8}if(ft-=st,t.total_out+=ft,n.total+=ft,ft&&(t.adler=n.check=n.flags?o(n.check,et,ft,it-ft):i(n.check,et,ft,it-ft)),ft=st,(n.flags?at:rt(at))!==n.check){t.msg="incorrect data check",n.mode=G;break}at=0,ct=0}n.mode=K;case K:if(n.wrap&&n.flags){for(;ct<32;){if(0===ot)break t;ot--,at+=tt[nt++]<<ct,ct+=8}if(at!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=G;break}at=0,ct=0}n.mode=J;case J:St=y;break t;case G:St=_;break t;case Q:return w;case $:default:return m}return t.next_out=it,t.avail_out=st,t.next_in=nt,t.avail_in=ot,n.hold=at,n.bits=ct,(n.wsize||ft!==t.avail_out&&n.mode<G&&(n.mode<X||e!==h))&&pt(t,t.output,t.next_out,ft-t.avail_out)?(n.mode=Q,w):(ut-=t.avail_in,ft-=t.avail_out,t.total_in+=ut,t.total_out+=ft,n.total+=ft,n.wrap&&ft&&(t.adler=n.check=n.flags?o(n.check,et,ft,t.next_out-ft):i(n.check,et,ft,t.next_out-ft)),t.data_type=n.bits+(n.last?64:0)+(n.mode===A?128:0)+(n.mode===z||n.mode===C?256:0),(0===ut&&0===ft||e===h)&&St===d&&(St=v),St)},e.inflateEnd=function(t){if(!t||!t.state)return m;var e=t.state;return e.window&&(e.window=null),t.state=null,d},e.inflateGetHeader=function(t,e){var n;return t&&t.state?0==(2&(n=t.state).wrap)?m:(n.head=e,e.done=!1,d):m},e.inflateSetDictionary=function(t,e){var n,r=e.length;return t&&t.state?0!==(n=t.state).wrap&&n.mode!==x?m:n.mode===x&&i(1,e,r,0)!==n.check?_:pt(t,e,r,r)?(n.mode=Q,w):(n.havedict=1,d):m},e.inflateInfo="pako inflate (from Nodeca project)"},function(t,e){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var r={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){var e,n,r,i,o,s;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(s=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)o=t[e],s.set(o,i),i+=o.length;return s}},i={arraySet:function(t,e,n,r,i){for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,r)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(n)},function(t,e){"use strict";t.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,s=0;0!==n;){n-=s=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--s);i%=65521,o%=65521}return i|o<<16|0}},function(t,e){"use strict";var n=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();t.exports=function(t,e,r,i){var o=n,s=i+r;t^=-1;for(var a=i;a<s;a++)t=t>>>8^o[255&(t^e[a])];return-1^t}},function(t,e){"use strict";t.exports=function(t,e){var n,r,i,o,s,a,c,u,f,h,p,l,d,y,g,m,_,w,v,E,b,S,k,I,O;n=t.state,r=t.next_in,I=t.input,i=r+(t.avail_in-5),o=t.next_out,O=t.output,s=o-(e-t.avail_out),a=o+(t.avail_out-257),c=n.dmax,u=n.wsize,f=n.whave,h=n.wnext,p=n.window,l=n.hold,d=n.bits,y=n.lencode,g=n.distcode,m=(1<<n.lenbits)-1,_=(1<<n.distbits)-1;t:do{d<15&&(l+=I[r++]<<d,d+=8,l+=I[r++]<<d,d+=8),w=y[l&m];e:for(;;){if(l>>>=v=w>>>24,d-=v,0===(v=w>>>16&255))O[o++]=65535&w;else{if(!(16&v)){if(0==(64&v)){w=y[(65535&w)+(l&(1<<v)-1)];continue e}if(32&v){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}E=65535&w,(v&=15)&&(d<v&&(l+=I[r++]<<d,d+=8),E+=l&(1<<v)-1,l>>>=v,d-=v),d<15&&(l+=I[r++]<<d,d+=8,l+=I[r++]<<d,d+=8),w=g[l&_];n:for(;;){if(l>>>=v=w>>>24,d-=v,!(16&(v=w>>>16&255))){if(0==(64&v)){w=g[(65535&w)+(l&(1<<v)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(b=65535&w,d<(v&=15)&&(l+=I[r++]<<d,(d+=8)<v&&(l+=I[r++]<<d,d+=8)),(b+=l&(1<<v)-1)>c){t.msg="invalid distance too far back",n.mode=30;break t}if(l>>>=v,d-=v,b>(v=o-s)){if((v=b-v)>f&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(S=0,k=p,0===h){if(S+=u-v,v<E){E-=v;do{O[o++]=p[S++]}while(--v);S=o-b,k=O}}else if(h<v){if(S+=u+h-v,(v-=h)<E){E-=v;do{O[o++]=p[S++]}while(--v);if(S=0,h<E){E-=v=h;do{O[o++]=p[S++]}while(--v);S=o-b,k=O}}}else if(S+=h-v,v<E){E-=v;do{O[o++]=p[S++]}while(--v);S=o-b,k=O}for(;E>2;)O[o++]=k[S++],O[o++]=k[S++],O[o++]=k[S++],E-=3;E&&(O[o++]=k[S++],E>1&&(O[o++]=k[S++]))}else{S=o-b;do{O[o++]=O[S++],O[o++]=O[S++],O[o++]=O[S++],E-=3}while(E>2);E&&(O[o++]=O[S++],E>1&&(O[o++]=O[S++]))}break}}break}}while(r<i&&o<a);r-=E=d>>3,l&=(1<<(d-=E<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<a?a-o+257:257-(o-a),n.hold=l,n.bits=d}},function(t,e,n){"use strict";var r=n(33),i=[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],o=[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,n,c,u,f,h,p){var l,d,y,g,m,_,w,v,E,b=p.bits,S=0,k=0,I=0,O=0,F=0,N=0,R=0,L=0,T=0,x=0,A=null,D=0,P=new r.Buf16(16),C=new r.Buf16(16),U=null,M=0;for(S=0;S<=15;S++)P[S]=0;for(k=0;k<c;k++)P[e[n+k]]++;for(F=b,O=15;O>=1&&0===P[O];O--);if(F>O&&(F=O),0===O)return u[f++]=20971520,u[f++]=20971520,p.bits=1,0;for(I=1;I<O&&0===P[I];I++);for(F<I&&(F=I),L=1,S=1;S<=15;S++)if(L<<=1,(L-=P[S])<0)return-1;if(L>0&&(0===t||1!==O))return-1;for(C[1]=0,S=1;S<15;S++)C[S+1]=C[S]+P[S];for(k=0;k<c;k++)0!==e[n+k]&&(h[C[e[n+k]]++]=k);if(0===t?(A=U=h,_=19):1===t?(A=i,D-=257,U=o,M-=257,_=256):(A=s,U=a,_=-1),x=0,k=0,S=I,m=f,N=F,R=0,y=-1,g=(T=1<<F)-1,1===t&&T>852||2===t&&T>592)return 1;for(;;){w=S-R,h[k]<_?(v=0,E=h[k]):h[k]>_?(v=U[M+h[k]],E=A[D+h[k]]):(v=96,E=0),l=1<<S-R,I=d=1<<N;do{u[m+(x>>R)+(d-=l)]=w<<24|v<<16|E|0}while(0!==d);for(l=1<<S-1;x&l;)l>>=1;if(0!==l?(x&=l-1,x+=l):x=0,k++,0==--P[S]){if(S===O)break;S=e[n+h[k]]}if(S>F&&(x&g)!==y){for(0===R&&(R=F),m+=I,L=1<<(N=S-R);N+R<O&&!((L-=P[N+R])<=0);)N++,L<<=1;if(T+=1<<N,1===t&&T>852||2===t&&T>592)return 1;u[y=x&g]=F<<24|N<<16|m-f|0}}return 0!==x&&(u[m+x]=S-R<<24|64<<16|0),p.bits=F,0}},function(t,e,n){"use strict";var r=n(33),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var s=new r.Buf8(256),a=0;a<256;a++)s[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",s=0;s<e;s++)n+=String.fromCharCode(t[s]);return n}s[254]=s[254]=1,e.string2buf=function(t){var e,n,i,o,s,a=t.length,c=0;for(o=0;o<a;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),c+=n<128?1:n<2048?2:n<65536?3:4;for(e=new r.Buf8(c),s=0,o=0;s<c;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<a&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?e[s++]=n:n<2048?(e[s++]=192|n>>>6,e[s++]=128|63&n):n<65536?(e[s++]=224|n>>>12,e[s++]=128|n>>>6&63,e[s++]=128|63&n):(e[s++]=240|n>>>18,e[s++]=128|n>>>12&63,e[s++]=128|n>>>6&63,e[s++]=128|63&n);return e},e.buf2binstring=function(t){return c(t,t.length)},e.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n<i;n++)e[n]=t.charCodeAt(n);return e},e.buf2string=function(t,e){var n,r,i,o,a=e||t.length,u=new Array(2*a);for(r=0,n=0;n<a;)if((i=t[n++])<128)u[r++]=i;else if((o=s[i])>4)u[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&n<a;)i=i<<6|63&t[n++],o--;o>1?u[r++]=65533:i<65536?u[r++]=i:(i-=65536,u[r++]=55296|i>>10&1023,u[r++]=56320|1023&i)}return c(u,r)},e.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0?e:0===n?e:n+s[t[n]]>e?n:e}},function(t,e){"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){"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){"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){"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}}])});