diff --git a/README.md b/README.md index 1b3b4a4..877cb4e 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,10 @@ Accepts two arguments: an `options` object, and an optional `callback`. The `opt object can specify a number of optional arguments, including: * `name`: the name of the file system, defaults to `'"local'` -* `flags`: one or more flags to use when creating/opening the file system. Use `'FORMAT'` to force Filer to format (i.e., erase) the file system +* `flags`: an Array of one or more flags to use when creating/opening the file system: + *`'FORMAT'` to force Filer to format (i.e., erase) the file system + *`'NOCTIME'` to force Filer to not update `ctime` on nodes when metadata changes (i.e., for better performance) + *`'NOMTIME'` to force Filer to not update `mtime` on nodes when data changes (i.e., for better performance) * `provider`: an explicit storage provider to use for the file system's database context provider. See the section on [Storage Providers](#providers). The `callback` function indicates when the file system is ready for use. Depending on the storage provider used, this might @@ -98,7 +101,7 @@ function fsReady(err, fs) { fs = new Filer.FileSystem({ name: "my-filesystem", - flags: 'FORMAT', + flags: [ 'FORMAT' ], provider: new Filer.FileSystem.providers.Memory() }, fsReady); ``` @@ -175,7 +178,6 @@ interface as providers. See the code in `src/providers` and `src/adapters` for The node.js [path module](http://nodejs.org/api/path.html) is available via the `Filer.Path` object. It is identical to the node.js version with the following differences: -* No support for `exits()` or `existsSync()`. Use `fs.stat()` instead. * No notion of a current working directory in `resolve` (the root dir is used instead) ```javascript @@ -219,6 +221,7 @@ var fs = new Filer.FileSystem(); * [fs.stat(path, callback)](#stat) * [fs.fstat(fd, callback)](#fstat) * [fs.lstat(path, callback)](#lstat) +* [fs.exists(path, callback)](#exists) * [fs.link(srcpath, dstpath, callback)](#link) * [fs.symlink(srcpath, dstpath, [type], callback)](#symlink) * [fs.readlink(path, callback)](#readlink) @@ -417,7 +420,25 @@ fs.link("/data/logs/august", "/data/logs/current", function(err) { var size = stats.size; }); }); -```` +``` + +#### fs.exists(path, callback) + +Test whether or not the given path exists by checking with the file system. +Then call the callback argument with either true or false. + +Example: + +```javascript +//Test if the file exists +fs.exists('/myfile', function (exists) { + console.log(exists ? "file exists" : "file not found"); +}); +``` + +fs.exists() is an anachronism and exists only for historical reasons. There should almost never be a reason to use it in your own code. + +In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to fs.exists() and fs.open(). Just open the file and handle the error when it's not there. #### fs.link(srcPath, dstPath, callback) diff --git a/dist/filer.js b/dist/filer.js index 96ebfd0..1434a57 100644 --- a/dist/filer.js +++ b/dist/filer.js @@ -3053,6 +3053,20 @@ define('src/path',[],function() { return splitPath(path)[3]; } + function isAbsolute(path) { + if(path.charAt(0) === '/') { + return true; + } + return false; + } + + function isNull(path) { + if (('' + path).indexOf('\u0000') !== -1) { + return true; + } + return false; + } + // XXXidbfs: we don't support path.exists() or path.existsSync(), which // are deprecated, and need a FileSystem instance to work. Use fs.stat(). @@ -3065,7 +3079,9 @@ define('src/path',[],function() { delimiter: ':', dirname: dirname, basename: basename, - extname: extname + extname: extname, + isAbsolute: isAbsolute, + isNull: isNull }; }); @@ -3105,9 +3121,22 @@ define('src/shared',['require','../lib/crypto-js/rollups/sha256'],function(requi function nop() {} + /** + * Convert a Uint8Array to a regular array + */ + function u8toArray(u8) { + var array = []; + var len = u8.length; + for(var i = 0; i < len; i++) { + array[i] = u8[i]; + } + return array; + } + return { guid: guid, hash: hash, + u8toArray: u8toArray, nop: nop }; @@ -3124,122 +3153,570 @@ Redistribution and use in source and binary forms, with or without modification, Neither the name of the Mozilla Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Errors based off Node.js custom errors (https://github.com/rvagg/node-errno) made available under the MIT license */ define('src/error',['require'],function(require) { // - - function EExists(message){ - this.message = message || ''; + + function Unknown(message){ + this.message = message || 'unknown error'; } - EExists.prototype = new Error(); - EExists.prototype.name = "EExists"; - EExists.prototype.constructor = EExists; + Unknown.prototype = new Error(); + Unknown.prototype.errno = -1; + Unknown.prototype.code = "UNKNOWN"; + Unknown.prototype.constructor = Unknown; - function EIsDirectory(message){ - this.message = message || ''; + function OK(message){ + this.message = message || 'success'; } - EIsDirectory.prototype = new Error(); - EIsDirectory.prototype.name = "EIsDirectory"; - EIsDirectory.prototype.constructor = EIsDirectory; + OK.prototype = new Error(); + OK.prototype.errno = 0; + OK.prototype.code = "OK"; + OK.prototype.constructor = OK; - function ENoEntry(message){ - this.message = message || ''; + function EOF(message){ + this.message = message || 'end of file'; } - ENoEntry.prototype = new Error(); - ENoEntry.prototype.name = "ENoEntry"; - ENoEntry.prototype.constructor = ENoEntry; + EOF.prototype = new Error(); + EOF.prototype.errno = 1; + EOF.prototype.code = "EOF"; + EOF.prototype.constructor = EOF; + + function EAddrInfo(message){ + this.message = message || 'getaddrinfo error'; + } + EAddrInfo.prototype = new Error(); + EAddrInfo.prototype.errno = 2; + EAddrInfo.prototype.code = "EADDRINFO"; + EAddrInfo.prototype.constructor = EAddrInfo; + + function EAcces(message){ + this.message = message || 'permission denied'; + } + EAcces.prototype = new Error(); + EAcces.prototype.errno = 3; + EAcces.prototype.code = "EACCES"; + EAcces.prototype.constructor = EAcces; + + function EAgain(message){ + this.message = message || 'resource temporarily unavailable'; + } + EAgain.prototype = new Error(); + EAgain.prototype.errno = 4; + EAgain.prototype.code = "EAGAIN"; + EAgain.prototype.constructor = EAgain; + + function EAddrInUse(message){ + this.message = message || 'address already in use'; + } + EAddrInUse.prototype = new Error(); + EAddrInUse.prototype.errno = 5; + EAddrInUse.prototype.code = "EADDRINUSE"; + EAddrInUse.prototype.constructor = EAddrInUse; + + function EAddrNotAvail(message){ + this.message = message || 'address not available'; + } + EAddrNotAvail.prototype = new Error(); + EAddrNotAvail.prototype.errno = 6; + EAddrNotAvail.prototype.code = "EADDRNOTAVAIL"; + EAddrNotAvail.prototype.constructor = EAddrNotAvail; + + function EAFNoSupport(message){ + this.message = message || 'address family not supported'; + } + EAFNoSupport.prototype = new Error(); + EAFNoSupport.prototype.errno = 7; + EAFNoSupport.prototype.code = "EAFNOSUPPORT"; + EAFNoSupport.prototype.constructor = EAFNoSupport; - function EBusy(message){ - this.message = message || ''; + function EAlready(message){ + this.message = message || 'connection already in progress'; } - EBusy.prototype = new Error(); - EBusy.prototype.name = "EBusy"; - EBusy.prototype.constructor = EBusy; - - function ENotEmpty(message){ - this.message = message || ''; - } - ENotEmpty.prototype = new Error(); - ENotEmpty.prototype.name = "ENotEmpty"; - ENotEmpty.prototype.constructor = ENotEmpty; - - function ENotDirectory(message){ - this.message = message || ''; - } - ENotDirectory.prototype = new Error(); - ENotDirectory.prototype.name = "ENotDirectory"; - ENotDirectory.prototype.constructor = ENotDirectory; + EAlready.prototype = new Error(); + EAlready.prototype.errno = 8; + EAlready.prototype.code = "EALREADY"; + EAlready.prototype.constructor = EAlready; function EBadFileDescriptor(message){ - this.message = message || ''; + this.message = message || 'bad file descriptor'; } EBadFileDescriptor.prototype = new Error(); - EBadFileDescriptor.prototype.name = "EBadFileDescriptor"; + EBadFileDescriptor.prototype.errno = 9; + EBadFileDescriptor.prototype.code = "EBADF"; EBadFileDescriptor.prototype.constructor = EBadFileDescriptor; - function ENotImplemented(message){ - this.message = message || ''; + function EBusy(message){ + this.message = message || 'resource busy or locked'; } - ENotImplemented.prototype = new Error(); - ENotImplemented.prototype.name = "ENotImplemented"; - ENotImplemented.prototype.constructor = ENotImplemented; + EBusy.prototype = new Error(); + EBusy.prototype.errno = 10; + EBusy.prototype.code = "EBUSY"; + EBusy.prototype.constructor = EBusy; - function ENotMounted(message){ - this.message = message || ''; + function EConnAborted(message){ + this.message = message || 'software caused connection abort'; } - ENotMounted.prototype = new Error(); - ENotMounted.prototype.name = "ENotMounted"; - ENotMounted.prototype.constructor = ENotMounted; + EConnAborted.prototype = new Error(); + EConnAborted.prototype.errno = 11; + EConnAborted.prototype.code = "ECONNABORTED"; + EConnAborted.prototype.constructor = EConnAborted; + function EConnRefused(message){ + this.message = message || 'connection refused'; + } + EConnRefused.prototype = new Error(); + EConnRefused.prototype.errno = 12; + EConnRefused.prototype.code = "ECONNREFUSED"; + EConnRefused.prototype.constructor = EConnRefused; + + function EConnReset(message){ + this.message = message || 'connection reset by peer'; + } + EConnReset.prototype = new Error(); + EConnReset.prototype.errno = 13; + EConnReset.prototype.code = "ECONNRESET"; + EConnReset.prototype.constructor = EConnReset; + + function EDestAddrReq(message){ + this.message = message || 'destination address required'; + } + EDestAddrReq.prototype = new Error(); + EDestAddrReq.prototype.errno = 14; + EDestAddrReq.prototype.code = "EDESTADDRREQ"; + EDestAddrReq.prototype.constructor = EDestAddrReq; + + function EFault(message){ + this.message = message || 'bad address in system call argument'; + } + EFault.prototype = new Error(); + EFault.prototype.errno = 15; + EFault.prototype.code = "EFAULT"; + EFault.prototype.constructor = EFault; + + function EHostUnreach(message){ + this.message = message || 'host is unreachable'; + } + EHostUnreach.prototype = new Error(); + EHostUnreach.prototype.errno = 16; + EHostUnreach.prototype.code = "EHOSTUNREACH"; + EHostUnreach.prototype.constructor = EHostUnreach; + + function EIntr(message){ + this.message = message || 'interrupted system call'; + } + EIntr.prototype = new Error(); + EIntr.prototype.errno = 17; + EIntr.prototype.code = "EINTR"; + EIntr.prototype.constructor = EIntr; + function EInvalid(message){ - this.message = message || ''; + this.message = message || 'invalid argument'; } EInvalid.prototype = new Error(); - EInvalid.prototype.name = "EInvalid"; + EInvalid.prototype.errno = 18; + EInvalid.prototype.code = "EINVAL"; EInvalid.prototype.constructor = EInvalid; - function EIO(message){ - this.message = message || ''; + function EIsConn(message){ + this.message = message || 'socket is already connected'; } - EIO.prototype = new Error(); - EIO.prototype.name = "EIO"; - EIO.prototype.constructor = EIO; + EIsConn.prototype = new Error(); + EIsConn.prototype.errno = 19; + EIsConn.prototype.code = "EISCONN"; + EIsConn.prototype.constructor = EIsConn; + + function EMFile(message){ + this.message = message || 'too many open files'; + } + EMFile.prototype = new Error(); + EMFile.prototype.errno = 20; + EMFile.prototype.code = "EMFILE"; + EMFile.prototype.constructor = EMFile; + + function EMsgSize(message){ + this.message = message || 'message too long'; + } + EMsgSize.prototype = new Error(); + EMsgSize.prototype.errno = 21; + EMsgSize.prototype.code = "EMSGSIZE"; + EMsgSize.prototype.constructor = EMsgSize; + + function ENetDown(message){ + this.message = message || 'network is down'; + } + ENetDown.prototype = new Error(); + ENetDown.prototype.errno = 22; + ENetDown.prototype.code = "ENETDOWN"; + ENetDown.prototype.constructor = ENetDown; + + function ENetUnreach(message){ + this.message = message || 'network is unreachable'; + } + ENetUnreach.prototype = new Error(); + ENetUnreach.prototype.errno = 23; + ENetUnreach.prototype.code = "ENETUNREACH"; + ENetUnreach.prototype.constructor = ENetUnreach; + + function ENFile(message){ + this.message = message || 'file table overflow'; + } + ENFile.prototype = new Error(); + ENFile.prototype.errno = 24; + ENFile.prototype.code = "ENFILE"; + ENFile.prototype.constructor = ENFile; + + function ENoBufS(message){ + this.message = message || 'no buffer space available'; + } + ENoBufS.prototype = new Error(); + ENoBufS.prototype.errno = 25; + ENoBufS.prototype.code = "ENOBUFS"; + ENoBufS.prototype.constructor = ENoBufS; + + function ENoMem(message){ + this.message = message || 'not enough memory'; + } + ENoMem.prototype = new Error(); + ENoMem.prototype.errno = 26; + ENoMem.prototype.code = "ENOMEM"; + ENoMem.prototype.constructor = ENoMem; + + function ENotDirectory(message){ + this.message = message || 'not a directory'; + } + ENotDirectory.prototype = new Error(); + ENotDirectory.prototype.errno = 27; + ENotDirectory.prototype.code = "ENOTDIR"; + ENotDirectory.prototype.constructor = ENotDirectory; + + function EIsDirectory(message){ + this.message = message || 'illegal operation on a directory'; + } + EIsDirectory.prototype = new Error(); + EIsDirectory.prototype.errno = 28; + EIsDirectory.prototype.code = "EISDIR"; + EIsDirectory.prototype.constructor = EIsDirectory; + + function ENoNet(message){ + this.message = message || 'machine is not on the network'; + } + ENoNet.prototype = new Error(); + ENoNet.prototype.errno = 29; + ENoNet.prototype.code = "ENONET"; + ENoNet.prototype.constructor = ENoNet; + + function ENotConn(message){ + this.message = message || 'socket is not connected'; + } + ENotConn.prototype = new Error(); + ENotConn.prototype.errno = 31; + ENotConn.prototype.code = "ENOTCONN"; + ENotConn.prototype.constructor = ENotConn; + + function ENotSock(message){ + this.message = message || 'socket operation on non-socket'; + } + ENotSock.prototype = new Error(); + ENotSock.prototype.errno = 32; + ENotSock.prototype.code = "ENOTSOCK"; + ENotSock.prototype.constructor = ENotSock; + + function ENotSup(message){ + this.message = message || 'operation not supported on socket'; + } + ENotSup.prototype = new Error(); + ENotSup.prototype.errno = 33; + ENotSup.prototype.code = "ENOTSUP"; + ENotSup.prototype.constructor = ENotSup; + + function ENoEntry(message){ + this.message = message || 'no such file or directory'; + } + ENoEntry.prototype = new Error(); + ENoEntry.prototype.errno = 34; + ENoEntry.prototype.code = "ENOENT"; + ENoEntry.prototype.constructor = ENoEntry; + + function ENotImplemented(message){ + this.message = message || 'function not implemented'; + } + ENotImplemented.prototype = new Error(); + ENotImplemented.prototype.errno = 35; + ENotImplemented.prototype.code = "ENOSYS"; + ENotImplemented.prototype.constructor = ENotImplemented; + + function EPipe(message){ + this.message = message || 'broken pipe'; + } + EPipe.prototype = new Error(); + EPipe.prototype.errno = 36; + EPipe.prototype.code = "EPIPE"; + EPipe.prototype.constructor = EPipe; + + function EProto(message){ + this.message = message || 'protocol error'; + } + EProto.prototype = new Error(); + EProto.prototype.errno = 37; + EProto.prototype.code = "EPROTO"; + EProto.prototype.constructor = EProto; + + function EProtoNoSupport(message){ + this.message = message || 'protocol not supported'; + } + EProtoNoSupport.prototype = new Error(); + EProtoNoSupport.prototype.errno = 38; + EProtoNoSupport.prototype.code = "EPROTONOSUPPORT"; + EProtoNoSupport.prototype.constructor = EProtoNoSupport; + + function EPrototype(message){ + this.message = message || 'protocol wrong type for socket'; + } + EPrototype.prototype = new Error(); + EPrototype.prototype.errno = 39; + EPrototype.prototype.code = "EPROTOTYPE"; + EPrototype.prototype.constructor = EPrototype; + + function ETimedOut(message){ + this.message = message || 'connection timed out'; + } + ETimedOut.prototype = new Error(); + ETimedOut.prototype.errno = 40; + ETimedOut.prototype.code = "ETIMEDOUT"; + ETimedOut.prototype.constructor = ETimedOut; + + function ECharset(message){ + this.message = message || 'invalid Unicode character'; + } + ECharset.prototype = new Error(); + ECharset.prototype.errno = 41; + ECharset.prototype.code = "ECHARSET"; + ECharset.prototype.constructor = ECharset; + + function EAIFamNoSupport(message){ + this.message = message || 'address family for hostname not supported'; + } + EAIFamNoSupport.prototype = new Error(); + EAIFamNoSupport.prototype.errno = 42; + EAIFamNoSupport.prototype.code = "EAIFAMNOSUPPORT"; + EAIFamNoSupport.prototype.constructor = EAIFamNoSupport; + + function EAIService(message){ + this.message = message || 'servname not supported for ai_socktype'; + } + EAIService.prototype = new Error(); + EAIService.prototype.errno = 44; + EAIService.prototype.code = "EAISERVICE"; + EAIService.prototype.constructor = EAIService; + + function EAISockType(message){ + this.message = message || 'ai_socktype not supported'; + } + EAISockType.prototype = new Error(); + EAISockType.prototype.errno = 45; + EAISockType.prototype.code = "EAISOCKTYPE"; + EAISockType.prototype.constructor = EAISockType; + + function EShutdown(message){ + this.message = message || 'cannot send after transport endpoint shutdown'; + } + EShutdown.prototype = new Error(); + EShutdown.prototype.errno = 46; + EShutdown.prototype.code = "ESHUTDOWN"; + EShutdown.prototype.constructor = EShutdown; + + function EExists(message){ + this.message = message || 'file already exists'; + } + EExists.prototype = new Error(); + EExists.prototype.errno = 47; + EExists.prototype.code = "EEXIST"; + EExists.prototype.constructor = EExists; + + function ESrch(message){ + this.message = message || 'no such process'; + } + ESrch.prototype = new Error(); + ESrch.prototype.errno = 48; + ESrch.prototype.code = "ESRCH"; + ESrch.prototype.constructor = ESrch; + + function ENameTooLong(message){ + this.message = message || 'name too long'; + } + ENameTooLong.prototype = new Error(); + ENameTooLong.prototype.errno = 49; + ENameTooLong.prototype.code = "ENAMETOOLONG"; + ENameTooLong.prototype.constructor = ENameTooLong; + + function EPerm(message){ + this.message = message || 'operation not permitted'; + } + EPerm.prototype = new Error(); + EPerm.prototype.errno = 50; + EPerm.prototype.code = "EPERM"; + EPerm.prototype.constructor = EPerm; function ELoop(message){ - this.message = message || ''; + this.message = message || 'too many symbolic links encountered'; } ELoop.prototype = new Error(); - ELoop.prototype.name = "ELoop"; + ELoop.prototype.errno = 51; + ELoop.prototype.code = "ELOOP"; ELoop.prototype.constructor = ELoop; + function EXDev(message){ + this.message = message || 'cross-device link not permitted'; + } + EXDev.prototype = new Error(); + EXDev.prototype.errno = 52; + EXDev.prototype.code = "EXDEV"; + EXDev.prototype.constructor = EXDev; + + function ENotEmpty(message){ + this.message = message || 'directory not empty'; + } + ENotEmpty.prototype = new Error(); + ENotEmpty.prototype.errno = 53; + ENotEmpty.prototype.code = "ENOTEMPTY"; + ENotEmpty.prototype.constructor = ENotEmpty; + + function ENoSpc(message){ + this.message = message || 'no space left on device'; + } + ENoSpc.prototype = new Error(); + ENoSpc.prototype.errno = 54; + ENoSpc.prototype.code = "ENOSPC"; + ENoSpc.prototype.constructor = ENoSpc; + + function EIO(message){ + this.message = message || 'i/o error'; + } + EIO.prototype = new Error(); + EIO.prototype.errno = 55; + EIO.prototype.code = "EIO"; + EIO.prototype.constructor = EIO; + + function EROFS(message){ + this.message = message || 'read-only file system'; + } + EROFS.prototype = new Error(); + EROFS.prototype.errno = 56; + EROFS.prototype.code = "EROFS"; + EROFS.prototype.constructor = EROFS; + + function ENoDev(message){ + this.message = message || 'no such device'; + } + ENoDev.prototype = new Error(); + ENoDev.prototype.errno = 57; + ENoDev.prototype.code = "ENODEV"; + ENoDev.prototype.constructor = ENoDev; + + function ESPipe(message){ + this.message = message || 'invalid seek'; + } + ESPipe.prototype = new Error(); + ESPipe.prototype.errno = 58; + ESPipe.prototype.code = "ESPIPE"; + ESPipe.prototype.constructor = ESPipe; + + function ECanceled(message){ + this.message = message || 'operation canceled'; + } + ECanceled.prototype = new Error(); + ECanceled.prototype.errno = 59; + ECanceled.prototype.code = "ECANCELED"; + ECanceled.prototype.constructor = ECanceled; + + function ENotMounted(message){ + this.message = message || 'not mounted'; + } + ENotMounted.prototype = new Error(); + ENotMounted.prototype.errno = 60; + ENotMounted.prototype.code = "ENotMounted"; + ENotMounted.prototype.constructor = ENotMounted; + function EFileSystemError(message){ - this.message = message || ''; + this.message = message || 'missing super node'; } EFileSystemError.prototype = new Error(); - EFileSystemError.prototype.name = "EFileSystemError"; + EFileSystemError.prototype.errno = 61; + EFileSystemError.prototype.code = "EFileSystemError"; EFileSystemError.prototype.constructor = EFileSystemError; function ENoAttr(message) { - this.message = message || ''; + this.message = message || 'attribute does not exist'; } ENoAttr.prototype = new Error(); - ENoAttr.prototype.name = 'ENoAttr'; + ENoAttr.prototype.errno = 62; + ENoAttr.prototype.code = 'ENoAttr'; ENoAttr.prototype.constructor = ENoAttr; return { - EExists: EExists, - EIsDirectory: EIsDirectory, - ENoEntry: ENoEntry, - EBusy: EBusy, - ENotEmpty: ENotEmpty, - ENotDirectory: ENotDirectory, + Unknown: Unknown, + OK: OK, + EOF: EOF, + EAddrInfo: EAddrInfo, + EAcces: EAcces, + EAgain: EAgain, + EAddrInUse: EAddrInUse, + EAddrNotAvail: EAddrNotAvail, + EAFNoSupport: EAFNoSupport, + EAlready: EAlready, EBadFileDescriptor: EBadFileDescriptor, - ENotImplemented: ENotImplemented, - ENotMounted: ENotMounted, + EBusy: EBusy, + EConnAborted: EConnAborted, + EConnRefused: EConnRefused, + EConnReset: EConnReset, + EDestAddrReq: EDestAddrReq, + EFault: EFault, + EHostUnreach: EHostUnreach, + EIntr: EIntr, EInvalid: EInvalid, - EIO: EIO, + EIsConn: EIsConn, + EMFile: EMFile, + EMsgSize: EMsgSize, + ENetDown: ENetDown, + ENetUnreach: ENetUnreach, + ENFile: ENFile, + ENoBufS: ENoBufS, + ENoMem: ENoMem, + ENotDirectory: ENotDirectory, + EIsDirectory: EIsDirectory, + ENoNet: ENoNet, + ENotConn: ENotConn, + ENotSock: ENotSock, + ENotSup: ENotSup, + ENoEntry: ENoEntry, + ENotImplemented: ENotImplemented, + EPipe: EPipe, + EProto: EProto, + EProtoNoSupport: EProtoNoSupport, + EPrototype: EPrototype, + ETimedOut: ETimedOut, + ECharset: ECharset, + EAIFamNoSupport: EAIFamNoSupport, + EAIService: EAIService, + EAISockType: EAISockType, + EShutdown: EShutdown, + EExists: EExists, + ESrch: ESrch, + ENameTooLong: ENameTooLong, + EPerm: EPerm, ELoop: ELoop, + EXDev: EXDev, + ENotEmpty: ENotEmpty, + ENoSpc: ENoSpc, + EIO: EIO, + EROFS: EROFS, + ENoDev: ENoDev, + ESPipe: ESPipe, + ECanceled: ECanceled, + ENotMounted: ENotMounted, EFileSystemError: EFileSystemError, ENoAttr: ENoAttr }; @@ -3281,8 +3758,12 @@ define('src/constants',['require'],function(require) { ROOT_DIRECTORY_NAME: '/', // basename(normalize(path)) + // FS Mount Flags FS_FORMAT: 'FORMAT', + FS_NOCTIME: 'NOCTIME', + FS_NOMTIME: 'NOMTIME', + // FS File Open Flags O_READ: O_READ, O_WRITE: O_WRITE, O_CREATE: O_CREATE, @@ -3437,7 +3918,10 @@ define('src/providers/indexeddb',['require','../constants','../constants','../co }; }; IndexedDB.prototype.getReadOnlyContext = function() { - return new IndexedDBContext(this.db, IDB_RO); + // Due to timing issues in Chrome with readwrite vs. readonly indexeddb transactions + // always use readwrite so we can make sure pending commits finish before callbacks. + // See https://github.com/js-platform/filer/issues/128 + return new IndexedDBContext(this.db, IDB_RW); }; IndexedDB.prototype.getReadWriteContext = function() { return new IndexedDBContext(this.db, IDB_RW); @@ -3446,12 +3930,13 @@ define('src/providers/indexeddb',['require','../constants','../constants','../co return IndexedDB; }); -define('src/providers/websql',['require','../constants','../constants','../constants','../constants','../constants'],function(require) { +define('src/providers/websql',['require','../constants','../constants','../constants','../constants','../constants','../shared'],function(require) { var FILE_SYSTEM_NAME = require('../constants').FILE_SYSTEM_NAME; var FILE_STORE_NAME = require('../constants').FILE_STORE_NAME; var WSQL_VERSION = require('../constants').WSQL_VERSION; var WSQL_SIZE = require('../constants').WSQL_SIZE; var WSQL_DESC = require('../constants').WSQL_DESC; + var u8toArray = require('../shared').u8toArray; function WebSQLContext(db, isReadOnly) { var that = this; @@ -3475,7 +3960,7 @@ define('src/providers/websql',['require','../constants','../constants','../const callback(null); } this.getTransaction(function(transaction) { - transaction.executeSql("DELETE FROM " + FILE_STORE_NAME, + transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + ";", [], onSuccess, onError); }); }; @@ -3483,17 +3968,37 @@ define('src/providers/websql',['require','../constants','../constants','../const function onSuccess(transaction, result) { // If the key isn't found, return null var value = result.rows.length === 0 ? null : result.rows.item(0).data; - callback(null, value); + try { + if(value) { + value = JSON.parse(value); + // Deal with special-cased flattened typed arrays in WebSQL (see put() below) + if(value.__isUint8Array) { + value = new Uint8Array(value.__array); + } + } + callback(null, value); + } catch(e) { + callback(e); + } } function onError(transaction, error) { callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("SELECT data FROM " + FILE_STORE_NAME + " WHERE id = ?", + transaction.executeSql("SELECT data FROM " + FILE_STORE_NAME + " WHERE id = ?;", [key], onSuccess, onError); }); }; WebSQLContext.prototype.put = function(key, value, callback) { + // We do extra work to make sure typed arrays survive + // being stored in the db and still get the right prototype later. + if(Object.prototype.toString.call(value) === "[object Uint8Array]") { + value = { + __isUint8Array: true, + __array: u8toArray(value) + }; + } + value = JSON.stringify(value); function onSuccess(transaction, result) { callback(null); } @@ -3501,7 +4006,7 @@ define('src/providers/websql',['require','../constants','../constants','../const callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("INSERT OR REPLACE INTO " + FILE_STORE_NAME + " (id, data) VALUES (?, ?)", + transaction.executeSql("INSERT OR REPLACE INTO " + FILE_STORE_NAME + " (id, data) VALUES (?, ?);", [key, value], onSuccess, onError); }); }; @@ -3513,7 +4018,7 @@ define('src/providers/websql',['require','../constants','../constants','../const callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + " WHERE id = ?", + transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + " WHERE id = ?;", [key], onSuccess, onError); }); }; @@ -3561,9 +4066,15 @@ define('src/providers/websql',['require','../constants','../constants','../const [], gotCount, onError); } + // Create the table and index we'll need to store the fs data. db.transaction(function(transaction) { - transaction.executeSql("CREATE TABLE IF NOT EXISTS " + FILE_STORE_NAME + " (id unique, data)", - [], onSuccess, onError); + function createIndex(transaction) { + transaction.executeSql("CREATE INDEX IF NOT EXISTS idx_" + FILE_STORE_NAME + "_id" + + " on " + FILE_STORE_NAME + " (id);", + [], onSuccess, onError); + } + transaction.executeSql("CREATE TABLE IF NOT EXISTS " + FILE_STORE_NAME + " (id unique, data TEXT);", + [], createIndex, onError); }); }; WebSQL.prototype.getReadOnlyContext = function() { @@ -4929,9 +5440,9 @@ define('src/adapters/adapters',['require','./zlib','./crypto'],function(require) }); -define('src/environment',['require','src/constants'],function(require) { +define('src/environment',['require','./constants'],function(require) { - var defaults = require('src/constants').ENVIRONMENT; + var defaults = require('./constants').ENVIRONMENT; function Environment(env) { env = env || {}; @@ -5309,7 +5820,7 @@ define('src/shell',['require','./path','./error','./environment','./../lib/async }); -define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./path','./path','./shared','./shared','./shared','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','src/providers/providers','src/adapters/adapters','src/shell'],function(require) { +define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./path','./path','./path','./path','./shared','./shared','./shared','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./error','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./constants','./providers/providers','./adapters/adapters','./shell'],function(require) { var _ = require('./../lib/nodash'); @@ -5320,6 +5831,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat var normalize = require('./path').normalize; var dirname = require('./path').dirname; var basename = require('./path').basename; + var isAbsolutePath = require('./path').isAbsolute; + var isNullPath = require('./path').isNull; var guid = require('./shared').guid; var hash = require('./shared').hash; @@ -5361,10 +5874,12 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat var O_FLAGS = require('./constants').O_FLAGS; var XATTR_CREATE = require('./constants').XATTR_CREATE; var XATTR_REPLACE = require('./constants').XATTR_REPLACE; + var FS_NOMTIME = require('./constants').FS_NOMTIME; + var FS_NOCTIME = require('./constants').FS_NOCTIME; - var providers = require('src/providers/providers'); - var adapters = require('src/adapters/adapters'); - var Shell = require('src/shell'); + var providers = require('./providers/providers'); + var adapters = require('./adapters/adapters'); + var Shell = require('./shell'); /* * DirectoryEntry @@ -5379,7 +5894,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat * OpenFileDescription */ - function OpenFileDescription(id, flags, position) { + function OpenFileDescription(path, id, flags, position) { + this.path = path; this.id = id; this.flags = flags; this.position = position; @@ -5410,8 +5926,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat this.id = id || guid(); this.mode = mode || MODE_FILE; // node type (file, directory, etc) this.size = size || 0; // size (bytes for files, entries for directories) - this.atime = atime || now; // access time - this.ctime = ctime || now; // creation time + this.atime = atime || now; // access time (will mirror ctime after creation) + this.ctime = ctime || now; // creation/change time this.mtime = mtime || now; // modified time this.flags = flags || []; // file flags this.xattrs = xattrs || {}; // extended attributes @@ -5437,6 +5953,46 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat this.type = fileNode.mode; } + /* + * Update node times. Only passed times are modified (undefined times are ignored) + * and filesystem flags are examined in order to override update logic. + */ + function update_node_times(context, path, node, times, callback) { + // Honour mount flags for how we update times + var flags = context.flags; + if(_(flags).contains(FS_NOCTIME)) { + delete times.ctime; + } + if(_(flags).contains(FS_NOMTIME)) { + delete times.mtime; + } + + // Only do the update if required (i.e., times are still present) + var update = false; + if(times.ctime) { + node.ctime = times.ctime; + // We don't do atime tracking for perf reasons, but do mirror ctime + node.atime = times.ctime; + update = true; + } + if(times.atime) { + // The only time we explicitly pass atime is when utimes(), futimes() is called. + // Override ctime mirror here if so + node.atime = times.atime; + update = true; + } + if(times.mtime) { + node.mtime = times.mtime; + update = true; + } + + if(update) { + context.put(node.id, node, callback); + } else { + callback(); + } + } + /* * find_node */ @@ -5540,9 +6096,19 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat */ function set_extended_attribute (context, path_or_fd, name, value, flag, callback) { + var path; + function set_xattr (error, node) { var xattr = (node ? node.xattrs[name] : null); + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, path, node, { ctime: Date.now() }, callback); + } + } + if (error) { callback(error); } @@ -5554,14 +6120,16 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } else { node.xattrs[name] = value; - context.put(node.id, node, callback); + context.put(node.id, node, update_time); } } if (typeof path_or_fd == 'string') { + path = path_or_fd; find_node(context, path_or_fd, set_xattr); } else if (typeof path_or_fd == 'object' && typeof path_or_fd.id == 'string') { + path = path_or_fd.path; context.get(path_or_fd.id, set_xattr); } else { @@ -5665,12 +6233,21 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, parentDirectoryNode, { mtime: now, ctime: now }, callback); + } + } + function update_parent_directory_data(error) { if(error) { callback(error); } else { parentDirectoryData[name] = new DirectoryEntry(directoryNode.id, MODE_DIRECTORY); - context.put(parentDirectoryNode.data, parentDirectoryData, callback); + context.put(parentDirectoryNode.data, parentDirectoryData, update_time); } } @@ -5738,9 +6315,18 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, parentDirectoryNode, { mtime: now, ctime: now }, remove_directory_node); + } + } + function remove_directory_entry_from_parent_directory_node() { delete parentDirectoryData[name]; - context.put(parentDirectoryNode.data, parentDirectoryData, remove_directory_node); + context.put(parentDirectoryNode.data, parentDirectoryData, update_time); } function remove_directory_node(error) { @@ -5876,12 +6462,21 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, directoryNode, { mtime: now, ctime: now }, handle_update_result); + } + } + function update_directory_data(error) { if(error) { callback(error); } else { directoryData[name] = new DirectoryEntry(fileNode.id, MODE_FILE); - context.put(directoryNode.data, directoryData, handle_update_result); + context.put(directoryNode.data, directoryData, update_time); } } @@ -5905,11 +6500,20 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, ofd.path, fileNode, { mtime: now, ctime: now }, return_nbytes); + } + } + function update_file_node(error) { if(error) { callback(error); } else { - context.put(fileNode.id, fileNode, return_nbytes); + context.put(fileNode.id, fileNode, update_time); } } @@ -5924,7 +6528,6 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat ofd.position = length; fileNode.size = length; - fileNode.mtime = Date.now(); fileNode.version += 1; context.put(fileNode.data, newData, update_file_node); @@ -5946,11 +6549,20 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, ofd.path, fileNode, { mtime: now, ctime: now }, return_nbytes); + } + } + function update_file_node(error) { if(error) { callback(error); } else { - context.put(fileNode.id, fileNode, return_nbytes); + context.put(fileNode.id, fileNode, update_time); } } @@ -5972,7 +6584,6 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } fileNode.size = newSize; - fileNode.mtime = Date.now(); fileNode.version += 1; context.put(fileNode.data, newData, update_file_node); @@ -6011,6 +6622,14 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + + } + } + function read_file_data(error, result) { if(error) { callback(error); @@ -6110,13 +6729,21 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat var newDirectoryData; var fileNode; + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, newpath, fileNode, { ctime: Date.now() }, callback); + } + } + function update_file_node(error, result) { if(error) { callback(error); } else { fileNode = result; fileNode.nlinks += 1; - context.put(fileNode.id, fileNode, callback); + context.put(fileNode.id, fileNode, update_time); } } @@ -6190,7 +6817,10 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat callback(error); } else { delete directoryData[name]; - context.put(directoryNode.data, directoryData, callback); + context.put(directoryNode.data, directoryData, function(error) { + var now = Date.now(); + update_node_times(context, parentPath, directoryNode, { mtime: now, ctime: now }, callback); + }); } } @@ -6211,7 +6841,9 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat if(fileNode.nlinks < 1) { context.delete(fileNode.id, delete_file_data); } else { - context.put(fileNode.id, fileNode, update_directory_data); + context.put(fileNode.id, fileNode, function(error) { + update_node_times(context, path, fileNode, { ctime: Date.now() }, update_directory_data); + }); } } } @@ -6315,12 +6947,21 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat context.put(fileNode.id, fileNode, update_directory_data); } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, directoryNode, { mtime: now, ctime: now }, callback); + } + } + function update_directory_data(error) { if(error) { callback(error); } else { directoryData[name] = new DirectoryEntry(fileNode.id, MODE_SYMBOLIC_LINK); - context.put(directoryNode.data, directoryData, callback); + context.put(directoryNode.data, directoryData, update_time); } } } @@ -6398,14 +7039,22 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, path, fileNode, { mtime: now, ctime: now }, callback); + } + } + function update_file_node (error) { if(error) { callback(error); } else { fileNode.size = length; - fileNode.mtime = Date.now(); fileNode.version += 1; - context.put(fileNode.id, fileNode, callback); + context.put(fileNode.id, fileNode, update_time); } } @@ -6442,14 +7091,21 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, ofd.path, fileNode, { mtime: now, ctime: now }, callback); + } + } function update_file_node (error) { if(error) { callback(error); } else { fileNode.size = length; - fileNode.mtime = Date.now(); fileNode.version += 1; - context.put(fileNode.id, fileNode, callback); + context.put(fileNode.id, fileNode, update_time); } } @@ -6463,14 +7119,11 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function utimes_file(context, path, atime, mtime, callback) { path = normalize(path); - function update_times (error, node) { + function update_times(error, node) { if (error) { callback(error); - } - else { - node.atime = atime; - node.mtime = mtime; - context.put(node.id, node, callback); + } else { + update_node_times(context, path, node, { atime: atime, ctime: mtime, mtime: mtime }, callback); } } @@ -6490,11 +7143,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function update_times (error, node) { if (error) { callback(error); - } - else { - node.atime = atime; - node.mtime = mtime; - context.put(node.id, node, callback); + } else { + update_node_times(context, ofd.path, node, { atime: atime, ctime: mtime, mtime: mtime }, callback); } } @@ -6605,6 +7255,14 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function remove_xattr (error, node) { var xattr = (node ? node.xattrs : null); + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, path, node, { ctime: Date.now() }, callback); + } + } + if (error) { callback(error); } @@ -6613,7 +7271,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } else { delete node.xattrs[name]; - context.put(node.id, node, callback); + context.put(node.id, node, update_time); } } @@ -6631,6 +7289,14 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function fremovexattr_file (context, ofd, name, callback) { function remove_xattr (error, node) { + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, ofd.path, node, { ctime: Date.now() }, callback); + } + } + if (error) { callback(error); } @@ -6639,7 +7305,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } else { delete node.xattrs[name]; - context.put(node.id, node, callback); + context.put(node.id, node, update_time); } } @@ -6672,11 +7338,16 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat return options; } - // nullCheck from https://github.com/joyent/node/blob/master/lib/fs.js - function nullCheck(path, callback) { - if (('' + path).indexOf('\u0000') !== -1) { - var er = new Error('Path must be a string without null bytes.'); - callback(er); + function pathCheck(path, callback) { + var err; + if(isNullPath(path)) { + err = new Error('Path must be a string without null bytes.'); + } else if(!isAbsolutePath(path)) { + err = new Error('Path must be absolute.'); + } + + if(err) { + callback(err); return false; } return true; @@ -6775,7 +7446,21 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat // Open file system storage provider provider.open(function(err, needsFormatting) { function complete(error) { - fs.provider = provider; + // Wrap the provider so we can extend the context with fs flags. + // From this point forward we won't call open again, so drop it. + fs.provider = { + getReadWriteContext: function() { + var context = provider.getReadWriteContext(); + context.flags = flags; + return context; + }, + getReadOnlyContext: function() { + var context = provider.getReadOnlyContext(); + context.flags = flags; + return context; + } + }; + if(error) { fs.readyState = FS_ERROR; } else { @@ -6812,7 +7497,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat FileSystem.adapters = adapters; function _open(fs, context, path, flags, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, fileNode) { if(error) { @@ -6824,7 +7509,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } else { position = 0; } - var openFileDescription = new OpenFileDescription(fileNode.id, flags, position); + var openFileDescription = new OpenFileDescription(path, fileNode.id, flags, position); var fd = fs.allocDescriptor(openFileDescription); callback(null, fd); } @@ -6848,7 +7533,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _mkdir(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -6862,7 +7547,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _rmdir(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -6876,7 +7561,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _stat(context, name, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, result) { if(error) { @@ -6910,8 +7595,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _link(context, oldpath, newpath, callback) { - if(!nullCheck(oldpath, callback)) return; - if(!nullCheck(newpath, callback)) return; + if(!pathCheck(oldpath, callback)) return; + if(!pathCheck(newpath, callback)) return; function check_result(error) { if(error) { @@ -6925,7 +7610,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _unlink(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -6964,7 +7649,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function _readFile(fs, context, path, options, callback) { options = validate_file_options(options, null, 'r'); - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var flags = validate_flags(options.flag || 'r'); if(!flags) { @@ -6975,7 +7660,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat if(err) { return callback(err); } - var ofd = new OpenFileDescription(fileNode.id, flags, 0); + var ofd = new OpenFileDescription(path, fileNode.id, flags, 0); var fd = fs.allocDescriptor(ofd); fstat_file(context, ofd, function(err2, fstatResult) { @@ -7033,7 +7718,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function _writeFile(fs, context, path, data, options, callback) { options = validate_file_options(options, 'utf8', 'w'); - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var flags = validate_flags(options.flag || 'w'); if(!flags) { @@ -7052,7 +7737,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat if(err) { return callback(err); } - var ofd = new OpenFileDescription(fileNode.id, flags, 0); + var ofd = new OpenFileDescription(path, fileNode.id, flags, 0); var fd = fs.allocDescriptor(ofd); replace_data(context, ofd, data, 0, data.length, function(err2, nbytes) { @@ -7068,7 +7753,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat function _appendFile(fs, context, path, data, options, callback) { options = validate_file_options(options, 'utf8', 'a'); - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var flags = validate_flags(options.flag || 'a'); if(!flags) { @@ -7087,7 +7772,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat if(err) { return callback(err); } - var ofd = new OpenFileDescription(fileNode.id, flags, fileNode.size); + var ofd = new OpenFileDescription(path, fileNode.id, flags, fileNode.size); var fd = fs.allocDescriptor(ofd); write_data(context, ofd, data, 0, data.length, ofd.position, function(err2, nbytes) { @@ -7100,8 +7785,15 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat }); } + function _exists (context, name, path, callback) { + function cb(err, stats) { + callback(err ? false : true); + } + _stat(context, name, path, cb); + } + function _getxattr (context, path, name, callback) { - if (!nullCheck(path, callback)) return; + if (!pathCheck(path, callback)) return; function fetch_value (error, value) { if (error) { @@ -7137,7 +7829,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _setxattr (context, path, name, value, flag, callback) { - if (!nullCheck(path, callback)) return; + if (!pathCheck(path, callback)) return; function check_result (error) { if (error) { @@ -7175,7 +7867,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _removexattr (context, path, name, callback) { - if (!nullCheck(path, callback)) return; + if (!pathCheck(path, callback)) return; function remove_xattr (error) { if (error) { @@ -7263,7 +7955,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _readdir(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, files) { if(error) { @@ -7277,7 +7969,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _utimes(context, path, atime, mtime, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var currentTime = Date.now(); atime = (atime) ? atime : currentTime; @@ -7320,8 +8012,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _rename(context, oldpath, newpath, callback) { - if(!nullCheck(oldpath, callback)) return; - if(!nullCheck(newpath, callback)) return; + if(!pathCheck(oldpath, callback)) return; + if(!pathCheck(newpath, callback)) return; function check_result(error) { if(error) { @@ -7343,8 +8035,8 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _symlink(context, srcpath, dstpath, callback) { - if(!nullCheck(srcpath, callback)) return; - if(!nullCheck(dstpath, callback)) return; + if(!pathCheck(srcpath, callback)) return; + if(!pathCheck(dstpath, callback)) return; function check_result(error) { if(error) { @@ -7358,7 +8050,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _readlink(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, result) { if(error) { @@ -7376,7 +8068,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _lstat(fs, context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, result) { if(error) { @@ -7391,7 +8083,7 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat } function _truncate(context, path, length, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -7576,6 +8268,17 @@ define('src/fs',['require','./../lib/nodash','./../lib/encoding','./path','./pat ); if(error) callback(error); }; + FileSystem.prototype.exists = function(path, callback_) { + var callback = maybeCallback(arguments[arguments.length - 1]); + var fs = this; + var error = fs.queueOrRun( + function() { + var context = fs.provider.getReadWriteContext(); + _exists(context, fs.name, path, callback); + } + ); + if(error) callback(error); + }; FileSystem.prototype.lseek = function(fd, offset, whence, callback) { callback = maybeCallback(callback); var fs = this; diff --git a/dist/filer.min.js b/dist/filer.min.js index 0c7f68d..eddedd3 100644 --- a/dist/filer.min.js +++ b/dist/filer.min.js @@ -1,5 +1,5 @@ -/*! filer 2014-02-20 */ -(function(t,n){"object"==typeof exports?module.exports=n():"function"==typeof define&&define.amd?define(n):t.Filer||(t.Filer=n())})(this,function(){var t,n,e;(function(r){function i(t,n){return w.call(t,n)}function o(t,n){var e,r,i,o,a,s,u,c,f,l,h=n&&n.split("/"),p=m.map,d=p&&p["*"]||{};if(t&&"."===t.charAt(0))if(n){for(h=h.slice(0,h.length-1),t=h.concat(t.split("/")),c=0;t.length>c;c+=1)if(l=t[c],"."===l)t.splice(c,1),c-=1;else if(".."===l){if(1===c&&(".."===t[2]||".."===t[0]))break;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((h||d)&&p){for(e=t.split("/"),c=e.length;c>0;c-=1){if(r=e.slice(0,c).join("/"),h)for(f=h.length;f>0;f-=1)if(i=p[h.slice(0,f).join("/")],i&&(i=i[r])){o=i,a=c;break}if(o)break;!s&&d&&d[r]&&(s=d[r],u=c)}!o&&s&&(o=s,a=u),o&&(e.splice(0,a,o),t=e.join("/"))}return t}function a(t,n){return function(){return p.apply(r,E.call(arguments,0).concat([t,n]))}}function s(t){return function(n){return o(n,t)}}function u(t){return function(n){v[t]=n}}function c(t){if(i(y,t)){var n=y[t];delete y[t],b[t]=!0,h.apply(r,n)}if(!i(v,t)&&!i(b,t))throw Error("No "+t);return v[t]}function f(t){var n,e=t?t.indexOf("!"):-1;return e>-1&&(n=t.substring(0,e),t=t.substring(e+1,t.length)),[n,t]}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var h,p,d,g,v={},y={},m={},b={},w=Object.prototype.hasOwnProperty,E=[].slice;d=function(t,n){var e,r=f(t),i=r[0];return t=r[1],i&&(i=o(i,n),e=c(i)),i?t=e&&e.normalize?e.normalize(t,s(n)):o(t,n):(t=o(t,n),r=f(t),i=r[0],t=r[1],i&&(e=c(i))),{f:i?i+"!"+t:t,n:t,pr:i,p:e}},g={require:function(t){return a(t)},exports:function(t){var n=v[t];return n!==void 0?n:v[t]={}},module:function(t){return{id:t,uri:"",exports:v[t],config:l(t)}}},h=function(t,n,e,o){var s,f,l,h,p,m,w=[];if(o=o||t,"function"==typeof e){for(n=!n.length&&e.length?["require","exports","module"]:n,p=0;n.length>p;p+=1)if(h=d(n[p],o),f=h.f,"require"===f)w[p]=g.require(t);else if("exports"===f)w[p]=g.exports(t),m=!0;else if("module"===f)s=w[p]=g.module(t);else if(i(v,f)||i(y,f)||i(b,f))w[p]=c(f);else{if(!h.p)throw Error(t+" missing "+f);h.p.load(h.n,a(o,!0),u(f),{}),w[p]=v[f]}l=e.apply(v[t],w),t&&(s&&s.exports!==r&&s.exports!==v[t]?v[t]=s.exports:l===r&&m||(v[t]=l))}else t&&(v[t]=e)},t=n=p=function(t,n,e,i,o){return"string"==typeof t?g[t]?g[t](n):c(d(t,n).f):(t.splice||(m=t,n.splice?(t=n,n=e,e=null):t=r),n=n||function(){},"function"==typeof e&&(e=i,i=o),i?h(r,t,n,e):setTimeout(function(){h(r,t,n,e)},4),p)},p.config=function(t){return m=t,m.deps&&p(m.deps,m.callback),p},e=function(t,n,e){n.splice||(e=n,n=[]),i(v,t)||i(y,t)||(y[t]=[t,n,e])},e.amd={jQuery:!0}})(),e("build/almond",function(){}),e("lib/nodash",["require"],function(){function t(t,n){return p.call(t,n)}function n(t){return null==t?0:t.length===+t.length?t.length:v(t).length}function e(t){return t}function r(t,n,e){var r,i;if(null!=t)if(c&&t.forEach===c)t.forEach(n,e);else if(t.length===+t.length){for(r=0,i=t.length;i>r;r++)if(n.call(e,t[r],r,t)===g)return}else{var o=o(t);for(r=0,i=o.length;i>r;r++)if(n.call(e,t[o[r]],o[r],t)===g)return}}function i(t,n,i){n||(n=e);var o=!1;return null==t?o:l&&t.some===l?t.some(n,i):(r(t,function(t,e,r){return o||(o=n.call(i,t,e,r))?g:void 0}),!!o)}function o(t,n){return null==t?!1:f&&t.indexOf===f?-1!=t.indexOf(n):i(t,function(t){return t===n})}function a(t){this.value=t}function s(t){return t&&"object"==typeof t&&!Array.isArray(t)&&p.call(t,"__wrapped__")?t:new a(t)}var u=Array.prototype,c=u.forEach,f=u.indexOf,l=u.some,h=Object.prototype,p=h.hasOwnProperty,d=Object.keys,g={},v=d||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var e=[];for(var r in n)t(n,r)&&e.push(r);return e};return a.prototype.has=function(n){return t(this.value,n)},a.prototype.contains=function(t){return o(this.value,t)},a.prototype.size=function(){return n(this.value)},s}),function(t){function n(t,n,e){return t>=n&&e>=t}function e(t,n){return Math.floor(t/n)}function r(t){var n=0;this.get=function(){return n>=t.length?F:Number(t[n])},this.offset=function(e){if(n+=e,0>n)throw Error("Seeking past start of the buffer");if(n>t.length)throw Error("Seeking past EOF")},this.match=function(e){if(e.length>n+t.length)return!1;var r;for(r=0;e.length>r;r+=1)if(Number(t[n+r])!==e[r])return!1;return!0}}function i(t){var n=0;this.emit=function(){var e,r=F;for(e=0;arguments.length>e;++e)r=Number(arguments[e]),t[n++]=r;return r}}function o(t){function e(t){for(var e=[],r=0,i=t.length;t.length>r;){var o=t.charCodeAt(r);if(n(o,55296,57343))if(n(o,56320,57343))e.push(65533);else if(r===i-1)e.push(65533);else{var a=t.charCodeAt(r+1);if(n(a,56320,57343)){var s=1023&o,u=1023&a;r+=1,e.push(65536+(s<<10)+u)}else e.push(65533)}else e.push(o);r+=1}return e}var r=0,i=e(t);this.offset=function(t){if(r+=t,0>r)throw Error("Seeking past start of the buffer");if(r>i.length)throw Error("Seeking past EOF")},this.get=function(){return r>=i.length?U:i[r]}}function a(){var t="";this.string=function(){return t},this.emit=function(n){65535>=n?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(1023&n>>10)),t+=String.fromCharCode(56320+(1023&n)))}}function s(t){this.name="EncodingError",this.message=t,this.code=0}function u(t,n){if(t)throw new s("Decoder error");return n||65533}function c(t){throw new s("The code point "+t+" could not be encoded.")}function f(t){return t=(t+"").trim().toLowerCase(),Object.prototype.hasOwnProperty.call(W,t)?W[t]:null}function l(t,n){return(n||[])[t]||null}function h(t,n){var e=n.indexOf(t);return-1===e?null:e}function p(n){if(!("encoding-indexes"in t))throw Error("Indexes missing. Did you forget to include encoding-indexes.js?");return t["encoding-indexes"][n]}function d(t){if(t>39419&&189e3>t||t>1237575)return null;var n,e=0,r=0,i=p("gb18030");for(n=0;i.length>n;++n){var o=i[n];if(!(t>=o[0]))break;e=o[0],r=o[1]}return r+t-e}function g(t){var n,e=0,r=0,i=p("gb18030");for(n=0;i.length>n;++n){var o=i[n];if(!(t>=o[1]))break;e=o[1],r=o[0]}return r+t-e}function v(t){var e=t.fatal,r=0,i=0,o=0,a=0;this.decode=function(t){var s=t.get();if(s===F)return 0!==i?u(e):U;if(t.offset(1),0===i){if(n(s,0,127))return s;if(n(s,194,223))i=1,a=128,r=s-192;else if(n(s,224,239))i=2,a=2048,r=s-224;else{if(!n(s,240,244))return u(e);i=3,a=65536,r=s-240}return r*=Math.pow(64,i),null}if(!n(s,128,191))return r=0,i=0,o=0,a=0,t.offset(-1),u(e);if(o+=1,r+=(s-128)*Math.pow(64,i-o),o!==i)return null;var c=r,f=a;return r=0,i=0,o=0,a=0,n(c,f,1114111)&&!n(c,55296,57343)?c:u(e)}}function y(t){t.fatal,this.encode=function(t,r){var i=r.get();if(i===U)return F;if(r.offset(1),n(i,55296,57343))return c(i);if(n(i,0,127))return t.emit(i);var o,a;n(i,128,2047)?(o=1,a=192):n(i,2048,65535)?(o=2,a=224):n(i,65536,1114111)&&(o=3,a=240);for(var s=t.emit(e(i,Math.pow(64,o))+a);o>0;){var u=e(i,Math.pow(64,o-1));s=t.emit(128+u%64),o-=1}return s}}function m(t,e){var r=e.fatal;this.decode=function(e){var i=e.get();if(i===F)return U;if(e.offset(1),n(i,0,127))return i;var o=t[i-128];return null===o?u(r):o}}function b(t,e){e.fatal,this.encode=function(e,r){var i=r.get();if(i===U)return F;if(r.offset(1),n(i,0,127))return e.emit(i);var o=h(i,t);return null===o&&c(i),e.emit(o+128)}}function w(t,e){var r=e.fatal,i=0,o=0,a=0;this.decode=function(e){var s=e.get();if(s===F&&0===i&&0===o&&0===a)return U;s!==F||0===i&&0===o&&0===a||(i=0,o=0,a=0,u(r)),e.offset(1);var c;if(0!==a)return c=null,n(s,48,57)&&(c=d(10*(126*(10*(i-129)+(o-48))+(a-129))+s-48)),i=0,o=0,a=0,null===c?(e.offset(-3),u(r)):c;if(0!==o)return n(s,129,254)?(a=s,null):(e.offset(-2),i=0,o=0,u(r));if(0!==i){if(n(s,48,57)&&t)return o=s,null;var f=i,h=null;i=0;var g=127>s?64:65;return(n(s,64,126)||n(s,128,254))&&(h=190*(f-129)+(s-g)),c=null===h?null:l(h,p("gbk")),null===h&&e.offset(-1),null===c?u(r):c}return n(s,0,127)?s:128===s?8364:n(s,129,254)?(i=s,null):u(r)}}function E(t,r){r.fatal,this.encode=function(r,i){var o=i.get();if(o===U)return F;if(i.offset(1),n(o,0,127))return r.emit(o);var a=h(o,p("gbk"));if(null!==a){var s=e(a,190)+129,u=a%190,f=63>u?64:65;return r.emit(s,u+f)}if(null===a&&!t)return c(o);a=g(o);var l=e(e(e(a,10),126),10);a-=10*126*10*l;var d=e(e(a,10),126);a-=126*10*d;var v=e(a,10),y=a-10*v;return r.emit(l+129,d+48,v+129,y+48)}}function x(t){var e=t.fatal,r=!1,i=0;this.decode=function(t){var o=t.get();if(o===F&&0===i)return U;if(o===F&&0!==i)return i=0,u(e);if(t.offset(1),126===i)return i=0,123===o?(r=!0,null):125===o?(r=!1,null):126===o?126:10===o?null:(t.offset(-1),u(e));if(0!==i){var a=i;i=0;var s=null;return n(o,33,126)&&(s=l(190*(a-1)+(o+63),p("gbk"))),10===o&&(r=!1),null===s?u(e):s}return 126===o?(i=126,null):r?n(o,32,127)?(i=o,null):(10===o&&(r=!1),u(e)):n(o,0,127)?o:u(e)}}function _(t){t.fatal;var r=!1;this.encode=function(t,i){var o=i.get();if(o===U)return F;if(i.offset(1),n(o,0,127)&&r)return i.offset(-1),r=!1,t.emit(126,125);if(126===o)return t.emit(126,126);if(n(o,0,127))return t.emit(o);if(!r)return i.offset(-1),r=!0,t.emit(126,123);var a=h(o,p("gbk"));if(null===a)return c(o);var s=e(a,190)+1,u=a%190-63;return n(s,33,126)&&n(u,33,126)?t.emit(s,u):c(o)}}function k(t){var e=t.fatal,r=0,i=null;this.decode=function(t){if(null!==i){var o=i;return i=null,o}var a=t.get();if(a===F&&0===r)return U;if(a===F&&0!==r)return r=0,u(e);if(t.offset(1),0!==r){var s=r,c=null;r=0;var f=127>a?64:98;if((n(a,64,126)||n(a,161,254))&&(c=157*(s-129)+(a-f)),1133===c)return i=772,202;if(1135===c)return i=780,202;if(1164===c)return i=772,234;if(1166===c)return i=780,234;var h=null===c?null:l(c,p("big5"));return null===c&&t.offset(-1),null===h?u(e):h}return n(a,0,127)?a:n(a,129,254)?(r=a,null):u(e)}}function A(t){t.fatal,this.encode=function(t,r){var i=r.get();if(i===U)return F;if(r.offset(1),n(i,0,127))return t.emit(i);var o=h(i,p("big5"));if(null===o)return c(i);var a=e(o,157)+129,s=o%157,u=63>s?64:98;return t.emit(a,s+u)}}function S(t){var e=t.fatal,r=0,i=0;this.decode=function(t){var o=t.get();if(o===F)return 0===r&&0===i?U:(r=0,i=0,u(e));t.offset(1);var a,s;return 0!==i?(a=i,i=0,s=null,n(a,161,254)&&n(o,161,254)&&(s=l(94*(a-161)+o-161,p("jis0212"))),n(o,161,254)||t.offset(-1),null===s?u(e):s):142===r&&n(o,161,223)?(r=0,65377+o-161):143===r&&n(o,161,254)?(r=0,i=o,null):0!==r?(a=r,r=0,s=null,n(a,161,254)&&n(o,161,254)&&(s=l(94*(a-161)+o-161,p("jis0208"))),n(o,161,254)||t.offset(-1),null===s?u(e):s):n(o,0,127)?o:142===o||143===o||n(o,161,254)?(r=o,null):u(e)}}function O(t){t.fatal,this.encode=function(t,r){var i=r.get();if(i===U)return F;if(r.offset(1),n(i,0,127))return t.emit(i);if(165===i)return t.emit(92);if(8254===i)return t.emit(126);if(n(i,65377,65439))return t.emit(142,i-65377+161);var o=h(i,p("jis0208"));if(null===o)return c(i);var a=e(o,94)+161,s=o%94+161;return t.emit(a,s)}}function R(t){var e=t.fatal,r={ASCII:0,escape_start:1,escape_middle:2,escape_final:3,lead:4,trail:5,Katakana:6},i=r.ASCII,o=!1,a=0;this.decode=function(t){var s=t.get();switch(s!==F&&t.offset(1),i){default:case r.ASCII:return 27===s?(i=r.escape_start,null):n(s,0,127)?s:s===F?U:u(e);case r.escape_start:return 36===s||40===s?(a=s,i=r.escape_middle,null):(s!==F&&t.offset(-1),i=r.ASCII,u(e));case r.escape_middle:var c=a;return a=0,36!==c||64!==s&&66!==s?36===c&&40===s?(i=r.escape_final,null):40!==c||66!==s&&74!==s?40===c&&73===s?(i=r.Katakana,null):(s===F?t.offset(-1):t.offset(-2),i=r.ASCII,u(e)):(i=r.ASCII,null):(o=!1,i=r.lead,null);case r.escape_final:return 68===s?(o=!0,i=r.lead,null):(s===F?t.offset(-2):t.offset(-3),i=r.ASCII,u(e));case r.lead:return 10===s?(i=r.ASCII,u(e,10)):27===s?(i=r.escape_start,null):s===F?U:(a=s,i=r.trail,null);case r.trail:if(i=r.lead,s===F)return u(e);var f=null,h=94*(a-33)+s-33;return n(a,33,126)&&n(s,33,126)&&(f=o===!1?l(h,p("jis0208")):l(h,p("jis0212"))),null===f?u(e):f;case r.Katakana:return 27===s?(i=r.escape_start,null):n(s,33,95)?65377+s-33:s===F?U:u(e)}}}function C(t){t.fatal;var r={ASCII:0,lead:1,Katakana:2},i=r.ASCII;this.encode=function(t,o){var a=o.get();if(a===U)return F;if(o.offset(1),(n(a,0,127)||165===a||8254===a)&&i!==r.ASCII)return o.offset(-1),i=r.ASCII,t.emit(27,40,66);if(n(a,0,127))return t.emit(a);if(165===a)return t.emit(92);if(8254===a)return t.emit(126);if(n(a,65377,65439)&&i!==r.Katakana)return o.offset(-1),i=r.Katakana,t.emit(27,40,73);if(n(a,65377,65439))return t.emit(a-65377-33);if(i!==r.lead)return o.offset(-1),i=r.lead,t.emit(27,36,66);var s=h(a,p("jis0208"));if(null===s)return c(a);var u=e(s,94)+33,f=s%94+33;return t.emit(u,f)}}function I(t){var e=t.fatal,r=0;this.decode=function(t){var i=t.get();if(i===F&&0===r)return U;if(i===F&&0!==r)return r=0,u(e);if(t.offset(1),0!==r){var o=r;if(r=0,n(i,64,126)||n(i,128,252)){var a=127>i?64:65,s=160>o?129:193,c=l(188*(o-s)+i-a,p("jis0208"));return null===c?u(e):c}return t.offset(-1),u(e)}return n(i,0,128)?i:n(i,161,223)?65377+i-161:n(i,129,159)||n(i,224,252)?(r=i,null):u(e)}}function D(t){t.fatal,this.encode=function(t,r){var i=r.get();if(i===U)return F;if(r.offset(1),n(i,0,128))return t.emit(i);if(165===i)return t.emit(92);if(8254===i)return t.emit(126);if(n(i,65377,65439))return t.emit(i-65377+161);var o=h(i,p("jis0208"));if(null===o)return c(i);var a=e(o,188),s=31>a?129:193,u=o%188,f=63>u?64:65;return t.emit(a+s,u+f)}}function T(t){var e=t.fatal,r=0;this.decode=function(t){var i=t.get();if(i===F&&0===r)return U;if(i===F&&0!==r)return r=0,u(e);if(t.offset(1),0!==r){var o=r,a=null;if(r=0,n(o,129,198)){var s=178*(o-129);n(i,65,90)?a=s+i-65:n(i,97,122)?a=s+26+i-97:n(i,129,254)&&(a=s+26+26+i-129)}n(o,199,253)&&n(i,161,254)&&(a=12460+94*(o-199)+(i-161));var c=null===a?null:l(a,p("euc-kr"));return null===a&&t.offset(-1),null===c?u(e):c}return n(i,0,127)?i:n(i,129,253)?(r=i,null):u(e)}}function B(t){t.fatal,this.encode=function(t,r){var i=r.get();if(i===U)return F;if(r.offset(1),n(i,0,127))return t.emit(i);var o=h(i,p("euc-kr"));if(null===o)return c(i);var a,s;if(12460>o){a=e(o,178)+129,s=o%178;var u=26>s?65:52>s?71:77;return t.emit(a,s+u)}return o-=12460,a=e(o,94)+199,s=o%94+161,t.emit(a,s)}}function M(t,e){var r=e.fatal,i=null,o=null;this.decode=function(e){var a=e.get();if(a===F&&null===i&&null===o)return U;if(a===F&&(null!==i||null!==o))return u(r);if(e.offset(1),null===i)return i=a,null;var s;if(s=t?(i<<8)+a:(a<<8)+i,i=null,null!==o){var c=o;return o=null,n(s,56320,57343)?65536+1024*(c-55296)+(s-56320):(e.offset(-2),u(r))}return n(s,55296,56319)?(o=s,null):n(s,56320,57343)?u(r):s}}function j(t,r){r.fatal,this.encode=function(r,i){function o(n){var e=n>>8,i=255&n;return t?r.emit(e,i):r.emit(i,e)}var a=i.get();if(a===U)return F;if(i.offset(1),n(a,55296,57343)&&c(a),65535>=a)return o(a);var s=e(a-65536,1024)+55296,u=(a-65536)%1024+56320;return o(s),o(u)}}function z(t,n){if(!(this instanceof z))throw new TypeError("Constructor cannot be called as a function");if(t=t?t+"":q,n=Object(n),this._encoding=f(t),null===this._encoding||"utf-8"!==this._encoding.name&&"utf-16le"!==this._encoding.name&&"utf-16be"!==this._encoding.name)throw new TypeError("Unknown encoding: "+t);return this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(n.fatal)},Object.defineProperty?Object.defineProperty(this,"encoding",{get:function(){return this._encoding.name}}):this.encoding=this._encoding.name,this}function N(t,n){if(!(this instanceof N))throw new TypeError("Constructor cannot be called as a function");if(t=t?t+"":q,n=Object(n),this._encoding=f(t),null===this._encoding)throw new TypeError("Unknown encoding: "+t);return this._streaming=!1,this._decoder=null,this._options={fatal:Boolean(n.fatal)},Object.defineProperty?Object.defineProperty(this,"encoding",{get:function(){return this._encoding.name}}):this.encoding=this._encoding.name,this}var F=-1,U=-1;s.prototype=Error.prototype;var L=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"utf-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"ibm866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"iso-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"iso-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"iso-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"iso-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"iso-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"iso-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"iso-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"iso-8859-8-i"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"iso-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"iso-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"iso-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"iso-8859-15"},{labels:["iso-8859-16"],name:"iso-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"koi8-r"},{labels:["koi8-u"],name:"koi8-u"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"gbk"},{labels:["gb18030"],name:"gb18030"},{labels:["hz-gb-2312"],name:"hz-gb-2312"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"euc-jp"},{labels:["csiso2022jp","iso-2022-jp"],name:"iso-2022-jp"},{labels:["csshiftjis","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"shift_jis"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"euc-kr"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","iso-2022-kr","iso-2022-cn","iso-2022-cn-ext"],name:"replacement"},{labels:["utf-16be"],name:"utf-16be"},{labels:["utf-16","utf-16le"],name:"utf-16le"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],P={},W={};L.forEach(function(t){t.encodings.forEach(function(t){P[t.name]=t,t.labels.forEach(function(n){W[n]=t})})}),P["utf-8"].getEncoder=function(t){return new y(t)},P["utf-8"].getDecoder=function(t){return new v(t)},function(){L.forEach(function(t){"Legacy single-byte encodings"===t.heading&&t.encodings.forEach(function(t){var n=p(t.name);t.getDecoder=function(t){return new m(n,t)},t.getEncoder=function(t){return new b(n,t)}})})}(),P.gbk.getEncoder=function(t){return new E(!1,t)},P.gbk.getDecoder=function(t){return new w(!1,t)},P.gb18030.getEncoder=function(t){return new E(!0,t)},P.gb18030.getDecoder=function(t){return new w(!0,t)},P["hz-gb-2312"].getEncoder=function(t){return new _(t)},P["hz-gb-2312"].getDecoder=function(t){return new x(t)},P.big5.getEncoder=function(t){return new A(t)},P.big5.getDecoder=function(t){return new k(t)},P["euc-jp"].getEncoder=function(t){return new O(t)},P["euc-jp"].getDecoder=function(t){return new S(t)},P["iso-2022-jp"].getEncoder=function(t){return new C(t)},P["iso-2022-jp"].getDecoder=function(t){return new R(t)},P.shift_jis.getEncoder=function(t){return new D(t)},P.shift_jis.getDecoder=function(t){return new I(t)},P["euc-kr"].getEncoder=function(t){return new B(t)},P["euc-kr"].getDecoder=function(t){return new T(t)},P["utf-16le"].getEncoder=function(t){return new j(!1,t)},P["utf-16le"].getDecoder=function(t){return new M(!1,t)},P["utf-16be"].getEncoder=function(t){return new j(!0,t)},P["utf-16be"].getDecoder=function(t){return new M(!0,t)};var q="utf-8";z.prototype={encode:function(t,n){t=t?t+"":"",n=Object(n),this._streaming||(this._encoder=this._encoding.getEncoder(this._options)),this._streaming=Boolean(n.stream);for(var e=[],r=new i(e),a=new o(t);a.get()!==U;)this._encoder.encode(r,a);if(!this._streaming){var s;do s=this._encoder.encode(r,a);while(s!==F);this._encoder=null}return new Uint8Array(e)}},N.prototype={decode:function(t,n){if(t&&!("buffer"in t&&"byteOffset"in t&&"byteLength"in t))throw new TypeError("Expected ArrayBufferView");t||(t=new Uint8Array(0)),n=Object(n),this._streaming||(this._decoder=this._encoding.getDecoder(this._options),this._BOMseen=!1),this._streaming=Boolean(n.stream);for(var e,i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=new r(i),s=new a;o.get()!==F;)e=this._decoder.decode(o),null!==e&&e!==U&&s.emit(e);if(!this._streaming){do e=this._decoder.decode(o),null!==e&&e!==U&&s.emit(e);while(e!==U&&o.get()!=F);this._decoder=null}var u=s.string();return!this._BOMseen&&u.length&&(this._BOMseen=!0,-1!==["utf-8","utf-16le","utf-16be"].indexOf(this.encoding)&&65279===u.charCodeAt(0)&&(u=u.substring(1))),u}},t.TextEncoder=t.TextEncoder||z,t.TextDecoder=t.TextDecoder||N}(this),e("lib/encoding",function(){}),e("src/path",[],function(){function t(t,n){for(var e=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),e++):e&&(t.splice(r,1),e--)}if(n)for(;e--;e)t.unshift("..");return t}function n(){for(var n="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var i=r>=0?arguments[r]:"/";"string"==typeof i&&i&&(n=i+"/"+n,e="/"===i.charAt(0))}return n=t(n.split("/").filter(function(t){return!!t}),!e).join("/"),(e?"/":"")+n||"."}function e(n){var e="/"===n.charAt(0);return"/"===n.substr(-1),n=t(n.split("/").filter(function(t){return!!t}),!e).join("/"),n||e||(n="."),(e?"/":"")+n}function r(){var t=Array.prototype.slice.call(arguments,0);return e(t.filter(function(t){return t&&"string"==typeof t}).join("/"))}function i(t,n){function e(t){for(var n=0;t.length>n&&""===t[n];n++);for(var e=t.length-1;e>=0&&""===t[e];e--);return n>e?[]:t.slice(n,e-n+1)}t=exports.resolve(t).substr(1),n=exports.resolve(n).substr(1);for(var r=e(t.split("/")),i=e(n.split("/")),o=Math.min(r.length,i.length),a=o,s=0;o>s;s++)if(r[s]!==i[s]){a=s;break}for(var u=[],s=a;r.length>s;s++)u.push("..");return u=u.concat(i.slice(a)),u.join("/")}function o(t){var n=c(t),e=n[0],r=n[1];return e||r?(r&&(r=r.substr(0,r.length-1)),e+r):"."}function a(t,n){var e=c(t)[2];return n&&e.substr(-1*n.length)===n&&(e=e.substr(0,e.length-n.length)),""===e?"/":e}function s(t){return c(t)[3]}var u=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/,c=function(t){var n=u.exec(t);return[n[1]||"",n[2]||"",n[3]||"",n[4]||""]};return{normalize:e,resolve:n,join:r,relative:i,sep:"/",delimiter:":",dirname:o,basename:a,extname:s}});var r=r||function(t,n){var e={},r=e.lib={},i=r.Base=function(){function t(){}return{extend:function(n){t.prototype=this;var e=new t;return n&&e.mixIn(n),e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.$super.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=e!=n?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var n=this.words,e=t.words,r=this.sigBytes,t=t.sigBytes;if(this.clamp(),r%4)for(var i=0;t>i;i++)n[r+i>>>2]|=(255&e[i>>>2]>>>24-8*(i%4))<<24-8*((r+i)%4);else if(e.length>65535)for(i=0;t>i;i+=4)n[r+i>>>2]=e[i>>>2];else n.push.apply(n,e);return this.sigBytes+=t,this},clamp:function(){var n=this.words,e=this.sigBytes;n[e>>>2]&=4294967295<<32-8*(e%4),n.length=t.ceil(e/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(n){for(var e=[],r=0;n>r;r+=4)e.push(0|4294967296*t.random());return o.create(e,n)}}),a=e.enc={},s=a.Hex={stringify:function(t){for(var n=t.words,t=t.sigBytes,e=[],r=0;t>r;r++){var i=255&n[r>>>2]>>>24-8*(r%4);e.push((i>>>4).toString(16)),e.push((15&i).toString(16))}return e.join("")},parse:function(t){for(var n=t.length,e=[],r=0;n>r;r+=2)e[r>>>3]|=parseInt(t.substr(r,2),16)<<24-4*(r%8);return o.create(e,n/2)}},u=a.Latin1={stringify:function(t){for(var n=t.words,t=t.sigBytes,e=[],r=0;t>r;r++)e.push(String.fromCharCode(255&n[r>>>2]>>>24-8*(r%4)));return e.join("")},parse:function(t){for(var n=t.length,e=[],r=0;n>r;r++)e[r>>>2]|=(255&t.charCodeAt(r))<<24-8*(r%4);return o.create(e,n)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(n){throw Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},f=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=o.create(),this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(n){var e=this._data,r=e.words,i=e.sigBytes,a=this.blockSize,s=i/(4*a),s=n?t.ceil(s):t.max((0|s)-this._minBufferSize,0),n=s*a,i=t.min(4*n,i);if(n){for(var u=0;n>u;u+=a)this._doProcessBlock(r,u);u=r.splice(0,n),e.sigBytes-=i}return o.create(u,i)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=f.extend({init:function(){this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize(),this._hash},clone:function(){var t=f.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:16,_createHelper:function(t){return function(n,e){return t.create(e).finalize(n)}},_createHmacHelper:function(t){return function(n,e){return l.HMAC.create(t,e).finalize(n)}}});var l=e.algo={};return e}(Math);(function(t){var n=r,e=n.lib,i=e.WordArray,e=e.Hasher,o=n.algo,a=[],s=[];(function(){function n(n){for(var e=t.sqrt(n),r=2;e>=r;r++)if(!(n%r))return!1;return!0}function e(t){return 0|4294967296*(t-(0|t))}for(var r=2,i=0;64>i;)n(r)&&(8>i&&(a[i]=e(t.pow(r,.5))),s[i]=e(t.pow(r,1/3)),i++),r++})();var u=[],o=o.SHA256=e.extend({_doReset:function(){this._hash=i.create(a.slice(0))},_doProcessBlock:function(t,n){for(var e=this._hash.words,r=e[0],i=e[1],o=e[2],a=e[3],c=e[4],f=e[5],l=e[6],h=e[7],p=0;64>p;p++){if(16>p)u[p]=0|t[n+p];else{var d=u[p-15],g=u[p-2];u[p]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+u[p-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+u[p-16]}d=h+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&f^~c&l)+s[p]+u[p],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),h=l,l=f,f=c,c=0|a+d,a=o,o=i,i=r,r=0|d+g}e[0]=0|e[0]+r,e[1]=0|e[1]+i,e[2]=0|e[2]+o,e[3]=0|e[3]+a,e[4]=0|e[4]+c,e[5]=0|e[5]+f,e[6]=0|e[6]+l,e[7]=0|e[7]+h},_doFinalize:function(){var t=this._data,n=t.words,e=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32,n[(r+64>>>9<<4)+15]=e,t.sigBytes=4*n.length,this._process()}});n.SHA256=e._createHelper(o),n.HmacSHA256=e._createHmacHelper(o)})(Math),e("lib/crypto-js/rollups/sha256",function(){}),e("src/shared",["require","../lib/crypto-js/rollups/sha256"],function(t){function n(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=0|16*Math.random(),e="x"==t?n:8|3&n;return e.toString(16)}).toUpperCase()}function e(t){return o.SHA256(t).toString(o.enc.hex)}function i(){}t("../lib/crypto-js/rollups/sha256");var o=r;return{guid:n,hash:e,nop:i}}),e("src/error",["require"],function(){function t(t){this.message=t||""}function n(t){this.message=t||""}function e(t){this.message=t||""}function r(t){this.message=t||""}function i(t){this.message=t||""}function o(t){this.message=t||""}function a(t){this.message=t||""}function s(t){this.message=t||""}function u(t){this.message=t||""}function c(t){this.message=t||""}function f(t){this.message=t||""}function l(t){this.message=t||""}function h(t){this.message=t||""}function p(t){this.message=t||""}return t.prototype=Error(),t.prototype.name="EExists",t.prototype.constructor=t,n.prototype=Error(),n.prototype.name="EIsDirectory",n.prototype.constructor=n,e.prototype=Error(),e.prototype.name="ENoEntry",e.prototype.constructor=e,r.prototype=Error(),r.prototype.name="EBusy",r.prototype.constructor=r,i.prototype=Error(),i.prototype.name="ENotEmpty",i.prototype.constructor=i,o.prototype=Error(),o.prototype.name="ENotDirectory",o.prototype.constructor=o,a.prototype=Error(),a.prototype.name="EBadFileDescriptor",a.prototype.constructor=a,s.prototype=Error(),s.prototype.name="ENotImplemented",s.prototype.constructor=s,u.prototype=Error(),u.prototype.name="ENotMounted",u.prototype.constructor=u,c.prototype=Error(),c.prototype.name="EInvalid",c.prototype.constructor=c,f.prototype=Error(),f.prototype.name="EIO",f.prototype.constructor=f,l.prototype=Error(),l.prototype.name="ELoop",l.prototype.constructor=l,h.prototype=Error(),h.prototype.name="EFileSystemError",h.prototype.constructor=h,p.prototype=Error(),p.prototype.name="ENoAttr",p.prototype.constructor=p,{EExists:t,EIsDirectory:n,ENoEntry:e,EBusy:r,ENotEmpty:i,ENotDirectory:o,EBadFileDescriptor:a,ENotImplemented:s,ENotMounted:u,EInvalid:c,EIO:f,ELoop:l,EFileSystemError:h,ENoAttr:p}}),e("src/constants",["require"],function(){var t="READ",n="WRITE",e="CREATE",r="EXCLUSIVE",i="TRUNCATE",o="APPEND",a="CREATE",s="REPLACE";return{FILE_SYSTEM_NAME:"local",FILE_STORE_NAME:"files",IDB_RO:"readonly",IDB_RW:"readwrite",WSQL_VERSION:"1",WSQL_SIZE:5242880,WSQL_DESC:"FileSystem Storage",MODE_FILE:"FILE",MODE_DIRECTORY:"DIRECTORY",MODE_SYMBOLIC_LINK:"SYMLINK",MODE_META:"META",SYMLOOP_MAX:10,BINARY_MIME_TYPE:"application/octet-stream",JSON_MIME_TYPE:"application/json",ROOT_DIRECTORY_NAME:"/",FS_FORMAT:"FORMAT",O_READ:t,O_WRITE:n,O_CREATE:e,O_EXCLUSIVE:r,O_TRUNCATE:i,O_APPEND:o,O_FLAGS:{r:[t],"r+":[t,n],w:[n,e,i],"w+":[n,t,e,i],wx:[n,e,r,i],"wx+":[n,t,e,r,i],a:[n,e,o],"a+":[n,t,e,o],ax:[n,e,r,o],"ax+":[n,t,e,r,o]},XATTR_CREATE:a,XATTR_REPLACE:s,FS_READY:"READY",FS_PENDING:"PENDING",FS_ERROR:"ERROR",SUPER_NODE_ID:"00000000-0000-0000-0000-000000000000",ENVIRONMENT:{TMP:"/tmp",PATH:""}}}),e("src/providers/indexeddb",["require","../constants","../constants","../constants","../constants"],function(t){function n(t,n){var e=t.transaction(i,n);this.objectStore=e.objectStore(i)}function e(t){this.name=t||r,this.db=null}var r=t("../constants").FILE_SYSTEM_NAME,i=t("../constants").FILE_STORE_NAME,o=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,a=t("../constants").IDB_RW,s=t("../constants").IDB_RO;return n.prototype.clear=function(t){try{var n=this.objectStore.clear(); -n.onsuccess=function(){t()},n.onerror=function(n){t(n)}}catch(e){t(e)}},n.prototype.get=function(t,n){try{var e=this.objectStore.get(t);e.onsuccess=function(t){var e=t.target.result;n(null,e)},e.onerror=function(t){n(t)}}catch(r){n(r)}},n.prototype.put=function(t,n,e){try{var r=this.objectStore.put(n,t);r.onsuccess=function(t){var n=t.target.result;e(null,n)},r.onerror=function(t){e(t)}}catch(i){e(i)}},n.prototype.delete=function(t,n){try{var e=this.objectStore.delete(t);e.onsuccess=function(t){var e=t.target.result;n(null,e)},e.onerror=function(t){n(t)}}catch(r){n(r)}},e.isSupported=function(){return!!o},e.prototype.open=function(t){var n=this;if(n.db)return t(null,!1),void 0;var e=!1,r=o.open(n.name);r.onupgradeneeded=function(t){var n=t.target.result;n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.createObjectStore(i),e=!0},r.onsuccess=function(r){n.db=r.target.result,t(null,e)},r.onerror=function(n){t(n)}},e.prototype.getReadOnlyContext=function(){return new n(this.db,s)},e.prototype.getReadWriteContext=function(){return new n(this.db,a)},e}),e("src/providers/websql",["require","../constants","../constants","../constants","../constants","../constants"],function(t){function n(t,n){var e=this;this.getTransaction=function(r){return e.transaction?(r(e.transaction),void 0):(t[n?"readTransaction":"transaction"](function(t){e.transaction=t,r(t)}),void 0)}}function e(t){this.name=t||r,this.db=null}var r=t("../constants").FILE_SYSTEM_NAME,i=t("../constants").FILE_STORE_NAME,o=t("../constants").WSQL_VERSION,a=t("../constants").WSQL_SIZE,s=t("../constants").WSQL_DESC;return n.prototype.clear=function(t){function n(n,e){t(e)}function e(){t(null)}this.getTransaction(function(t){t.executeSql("DELETE FROM "+i,[],e,n)})},n.prototype.get=function(t,n){function e(t,e){var r=0===e.rows.length?null:e.rows.item(0).data;n(null,r)}function r(t,e){n(e)}this.getTransaction(function(n){n.executeSql("SELECT data FROM "+i+" WHERE id = ?",[t],e,r)})},n.prototype.put=function(t,n,e){function r(){e(null)}function o(t,n){e(n)}this.getTransaction(function(e){e.executeSql("INSERT OR REPLACE INTO "+i+" (id, data) VALUES (?, ?)",[t,n],r,o)})},n.prototype.delete=function(t,n){function e(){n(null)}function r(t,e){n(e)}this.getTransaction(function(n){n.executeSql("DELETE FROM "+i+" WHERE id = ?",[t],e,r)})},e.isSupported=function(){return!!window.openDatabase},e.prototype.open=function(t){function n(n,e){t(e)}function e(n){function e(n,e){var r=0===e.rows.item(0).count;t(null,r)}function o(n,e){t(e)}r.db=u,n.executeSql("SELECT COUNT(id) AS count FROM "+i+";",[],e,o)}var r=this;if(r.db)return t(null,!1),void 0;var u=window.openDatabase(r.name,o,s,a);return u?(u.transaction(function(t){t.executeSql("CREATE TABLE IF NOT EXISTS "+i+" (id unique, data)",[],e,n)}),void 0):(t("[WebSQL] Unable to open database."),void 0)},e.prototype.getReadOnlyContext=function(){return new n(this.db,!0)},e.prototype.getReadWriteContext=function(){return new n(this.db,!1)},e}),function(){function t(t){var e=!1;return function(){if(e)throw Error("Callback was already called.");e=!0,t.apply(n,arguments)}}var n,r,i={};n=this,null!=n&&(r=n.async),i.noConflict=function(){return n.async=r,i};var o=function(t,n){if(t.forEach)return t.forEach(n);for(var e=0;t.length>e;e+=1)n(t[e],e,t)},a=function(t,n){if(t.map)return t.map(n);var e=[];return o(t,function(t,r,i){e.push(n(t,r,i))}),e},s=function(t,n,e){return t.reduce?t.reduce(n,e):(o(t,function(t,r,i){e=n(e,t,r,i)}),e)},u=function(t){if(Object.keys)return Object.keys(t);var n=[];for(var e in t)t.hasOwnProperty(e)&&n.push(e);return n};"undefined"!=typeof process&&process.nextTick?(i.nextTick=process.nextTick,i.setImmediate="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:i.nextTick):"function"==typeof setImmediate?(i.nextTick=function(t){setImmediate(t)},i.setImmediate=i.nextTick):(i.nextTick=function(t){setTimeout(t,0)},i.setImmediate=i.nextTick),i.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var i=0;o(n,function(o){e(o,t(function(t){t?(r(t),r=function(){}):(i+=1,i>=n.length&&r(null))}))})},i.forEach=i.each,i.eachSeries=function(t,n,e){if(e=e||function(){},!t.length)return e();var r=0,i=function(){n(t[r],function(n){n?(e(n),e=function(){}):(r+=1,r>=t.length?e(null):i())})};i()},i.forEachSeries=i.eachSeries,i.eachLimit=function(t,n,e,r){var i=c(n);i.apply(null,[t,e,r])},i.forEachLimit=i.eachLimit;var c=function(t){return function(n,e,r){if(r=r||function(){},!n.length||0>=t)return r();var i=0,o=0,a=0;(function s(){if(i>=n.length)return r();for(;t>a&&n.length>o;)o+=1,a+=1,e(n[o-1],function(t){t?(r(t),r=function(){}):(i+=1,a-=1,i>=n.length?r():s())})})()}},f=function(t){return function(){var n=Array.prototype.slice.call(arguments);return t.apply(null,[i.each].concat(n))}},l=function(t,n){return function(){var e=Array.prototype.slice.call(arguments);return n.apply(null,[c(t)].concat(e))}},h=function(t){return function(){var n=Array.prototype.slice.call(arguments);return t.apply(null,[i.eachSeries].concat(n))}},p=function(t,n,e,r){var i=[];n=a(n,function(t,n){return{index:n,value:t}}),t(n,function(t,n){e(t.value,function(e,r){i[t.index]=r,n(e)})},function(t){r(t,i)})};i.map=f(p),i.mapSeries=h(p),i.mapLimit=function(t,n,e,r){return d(n)(t,e,r)};var d=function(t){return l(t,p)};i.reduce=function(t,n,e,r){i.eachSeries(t,function(t,r){e(n,t,function(t,e){n=e,r(t)})},function(t){r(t,n)})},i.inject=i.reduce,i.foldl=i.reduce,i.reduceRight=function(t,n,e,r){var o=a(t,function(t){return t}).reverse();i.reduce(o,n,e,r)},i.foldr=i.reduceRight;var g=function(t,n,e,r){var i=[];n=a(n,function(t,n){return{index:n,value:t}}),t(n,function(t,n){e(t.value,function(e){e&&i.push(t),n()})},function(){r(a(i.sort(function(t,n){return t.index-n.index}),function(t){return t.value}))})};i.filter=f(g),i.filterSeries=h(g),i.select=i.filter,i.selectSeries=i.filterSeries;var v=function(t,n,e,r){var i=[];n=a(n,function(t,n){return{index:n,value:t}}),t(n,function(t,n){e(t.value,function(e){e||i.push(t),n()})},function(){r(a(i.sort(function(t,n){return t.index-n.index}),function(t){return t.value}))})};i.reject=f(v),i.rejectSeries=h(v);var y=function(t,n,e,r){t(n,function(t,n){e(t,function(e){e?(r(t),r=function(){}):n()})},function(){r()})};i.detect=f(y),i.detectSeries=h(y),i.some=function(t,n,e){i.each(t,function(t,r){n(t,function(t){t&&(e(!0),e=function(){}),r()})},function(){e(!1)})},i.any=i.some,i.every=function(t,n,e){i.each(t,function(t,r){n(t,function(t){t||(e(!1),e=function(){}),r()})},function(){e(!0)})},i.all=i.every,i.sortBy=function(t,n,e){i.map(t,function(t,e){n(t,function(n,r){n?e(n):e(null,{value:t,criteria:r})})},function(t,n){if(t)return e(t);var r=function(t,n){var e=t.criteria,r=n.criteria;return r>e?-1:e>r?1:0};e(null,a(n.sort(r),function(t){return t.value}))})},i.auto=function(t,n){n=n||function(){};var e=u(t);if(!e.length)return n(null);var r={},a=[],c=function(t){a.unshift(t)},f=function(t){for(var n=0;a.length>n;n+=1)if(a[n]===t)return a.splice(n,1),void 0},l=function(){o(a.slice(0),function(t){t()})};c(function(){u(r).length===e.length&&(n(null,r),n=function(){})}),o(e,function(e){var a=t[e]instanceof Function?[t[e]]:t[e],h=function(t){var a=Array.prototype.slice.call(arguments,1);if(1>=a.length&&(a=a[0]),t){var s={};o(u(r),function(t){s[t]=r[t]}),s[e]=a,n(t,s),n=function(){}}else r[e]=a,i.setImmediate(l)},p=a.slice(0,Math.abs(a.length-1))||[],d=function(){return s(p,function(t,n){return t&&r.hasOwnProperty(n)},!0)&&!r.hasOwnProperty(e)};if(d())a[a.length-1](h,r);else{var g=function(){d()&&(f(g),a[a.length-1](h,r))};c(g)}})},i.waterfall=function(t,n){if(n=n||function(){},t.constructor!==Array){var e=Error("First argument to waterfall must be an array of functions");return n(e)}if(!t.length)return n();var r=function(t){return function(e){if(e)n.apply(null,arguments),n=function(){};else{var o=Array.prototype.slice.call(arguments,1),a=t.next();a?o.push(r(a)):o.push(n),i.setImmediate(function(){t.apply(null,o)})}}};r(i.iterator(t))()};var m=function(t,n,e){if(e=e||function(){},n.constructor===Array)t.map(n,function(t,n){t&&t(function(t){var e=Array.prototype.slice.call(arguments,1);1>=e.length&&(e=e[0]),n.call(null,t,e)})},e);else{var r={};t.each(u(n),function(t,e){n[t](function(n){var i=Array.prototype.slice.call(arguments,1);1>=i.length&&(i=i[0]),r[t]=i,e(n)})},function(t){e(t,r)})}};i.parallel=function(t,n){m({map:i.map,each:i.each},t,n)},i.parallelLimit=function(t,n,e){m({map:d(n),each:c(n)},t,e)},i.series=function(t,n){if(n=n||function(){},t.constructor===Array)i.mapSeries(t,function(t,n){t&&t(function(t){var e=Array.prototype.slice.call(arguments,1);1>=e.length&&(e=e[0]),n.call(null,t,e)})},n);else{var e={};i.eachSeries(u(t),function(n,r){t[n](function(t){var i=Array.prototype.slice.call(arguments,1);1>=i.length&&(i=i[0]),e[n]=i,r(t)})},function(t){n(t,e)})}},i.iterator=function(t){var n=function(e){var r=function(){return t.length&&t[e].apply(null,arguments),r.next()};return r.next=function(){return t.length-1>e?n(e+1):null},r};return n(0)},i.apply=function(t){var n=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,n.concat(Array.prototype.slice.call(arguments)))}};var b=function(t,n,e,r){var i=[];t(n,function(t,n){e(t,function(t,e){i=i.concat(e||[]),n(t)})},function(t){r(t,i)})};i.concat=f(b),i.concatSeries=h(b),i.whilst=function(t,n,e){t()?n(function(r){return r?e(r):(i.whilst(t,n,e),void 0)}):e()},i.doWhilst=function(t,n,e){t(function(r){return r?e(r):(n()?i.doWhilst(t,n,e):e(),void 0)})},i.until=function(t,n,e){t()?e():n(function(r){return r?e(r):(i.until(t,n,e),void 0)})},i.doUntil=function(t,n,e){t(function(r){return r?e(r):(n()?e():i.doUntil(t,n,e),void 0)})},i.queue=function(n,e){function r(t,n,r,a){n.constructor!==Array&&(n=[n]),o(n,function(n){var o={data:n,callback:"function"==typeof a?a:null};r?t.tasks.unshift(o):t.tasks.push(o),t.saturated&&t.tasks.length===e&&t.saturated(),i.setImmediate(t.process)})}void 0===e&&(e=1);var a=0,s={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(t,n){r(s,t,!1,n)},unshift:function(t,n){r(s,t,!0,n)},process:function(){if(s.concurrency>a&&s.tasks.length){var e=s.tasks.shift();s.empty&&0===s.tasks.length&&s.empty(),a+=1;var r=function(){a-=1,e.callback&&e.callback.apply(e,arguments),s.drain&&0===s.tasks.length+a&&s.drain(),s.process()},i=t(r);n(e.data,i)}},length:function(){return s.tasks.length},running:function(){return a}};return s},i.cargo=function(t,n){var e=!1,r=[],s={tasks:r,payload:n,saturated:null,empty:null,drain:null,push:function(t,e){t.constructor!==Array&&(t=[t]),o(t,function(t){r.push({data:t,callback:"function"==typeof e?e:null}),s.saturated&&r.length===n&&s.saturated()}),i.setImmediate(s.process)},process:function u(){if(!e){if(0===r.length)return s.drain&&s.drain(),void 0;var i="number"==typeof n?r.splice(0,n):r.splice(0),c=a(i,function(t){return t.data});s.empty&&s.empty(),e=!0,t(c,function(){e=!1;var t=arguments;o(i,function(n){n.callback&&n.callback.apply(null,t)}),u()})}},length:function(){return r.length},running:function(){return e}};return s};var w=function(t){return function(n){var e=Array.prototype.slice.call(arguments,1);n.apply(null,e.concat([function(n){var e=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(n?console.error&&console.error(n):console[t]&&o(e,function(n){console[t](n)}))}]))}};i.log=w("log"),i.dir=w("dir"),i.memoize=function(t,n){var e={},r={};n=n||function(t){return t};var i=function(){var i=Array.prototype.slice.call(arguments),o=i.pop(),a=n.apply(null,i);a in e?o.apply(null,e[a]):a in r?r[a].push(o):(r[a]=[o],t.apply(null,i.concat([function(){e[a]=arguments;var t=r[a];delete r[a];for(var n=0,i=t.length;i>n;n++)t[n].apply(null,arguments)}])))};return i.memo=e,i.unmemoized=t,i},i.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},i.times=function(t,n,e){for(var r=[],o=0;t>o;o++)r.push(o);return i.map(r,n,e)},i.timesSeries=function(t,n,e){for(var r=[],o=0;t>o;o++)r.push(o);return i.mapSeries(r,n,e)},i.compose=function(){var t=Array.prototype.reverse.call(arguments);return function(){var n=this,e=Array.prototype.slice.call(arguments),r=e.pop();i.reduce(t,e,function(t,e,r){e.apply(n,t.concat([function(){var t=arguments[0],n=Array.prototype.slice.call(arguments,1);r(t,n)}]))},function(t,e){r.apply(n,[t].concat(e))})}};var E=function(t,n){var e=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r.pop();return t(n,function(t,n){t.apply(e,r.concat([n]))},i)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return e.apply(this,r)}return e};i.applyEach=f(E),i.applyEachSeries=h(E),i.forever=function(t,n){function e(r){if(r){if(n)return n(r);throw r}t(e)}e()},e!==void 0&&e.amd?e("lib/async",[],function(){return i}):"undefined"!=typeof module&&module.exports?module.exports=i:n.async=i}(),e("src/providers/memory",["require","../constants","../../lib/async"],function(t){function n(t,n){this.readOnly=n,this.objectStore=t}function e(t){this.name=t||r,this.db={}}var r=t("../constants").FILE_SYSTEM_NAME,i=t("../../lib/async").nextTick;return n.prototype.clear=function(t){if(this.readOnly)return i(function(){t("[MemoryContext] Error: write operation on read only context")}),void 0;var n=this.objectStore;Object.keys(n).forEach(function(t){delete n[t]}),i(t)},n.prototype.get=function(t,n){var e=this;i(function(){n(null,e.objectStore[t])})},n.prototype.put=function(t,n,e){return this.readOnly?(i(function(){e("[MemoryContext] Error: write operation on read only context")}),void 0):(this.objectStore[t]=n,i(e),void 0)},n.prototype.delete=function(t,n){return this.readOnly?(i(function(){n("[MemoryContext] Error: write operation on read only context")}),void 0):(delete this.objectStore[t],i(n),void 0)},e.isSupported=function(){return!0},e.prototype.open=function(t){i(function(){t(null,!0)})},e.prototype.getReadOnlyContext=function(){return new n(this.db,!0)},e.prototype.getReadWriteContext=function(){return new n(this.db,!1)},e}),e("src/providers/providers",["require","./indexeddb","./websql","./memory"],function(t){var n=t("./indexeddb"),e=t("./websql"),r=t("./memory");return{IndexedDB:n,WebSQL:e,Memory:r,Default:n,Fallback:function(){function t(){throw"[Filer Error] Your browser doesn't support IndexedDB or WebSQL."}return n.isSupported()?n:e.isSupported()?e:(t.isSupported=function(){return!1},t)}()}}),function(){function t(t){throw t}function n(t,n){var e=t.split("."),r=x;!(e[0]in r)&&r.execScript&&r.execScript("var "+e[0]);for(var i;e.length&&(i=e.shift());)e.length||n===w?r=r[i]?r[i]:r[i]={}:r[i]=n}function e(n,e){this.index="number"==typeof e?e:0,this.i=0,this.buffer=n instanceof(_?Uint8Array:Array)?n:new(_?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}function r(t){this.buffer=new(_?Uint16Array:Array)(2*t),this.length=0}function i(t){var n,e,r,i,o,a,s,u,c,f=t.length,l=0,h=Number.POSITIVE_INFINITY;for(u=0;f>u;++u)t[u]>l&&(l=t[u]),h>t[u]&&(h=t[u]);for(n=1<=r;){for(u=0;f>u;++u)if(t[u]===r){for(a=0,s=i,c=0;r>c;++c)a=a<<1|1&s,s>>=1;for(c=a;n>c;c+=o)e[c]=r<<16|u;++i}++r,i<<=1,o<<=1}return[e,l,h]}function o(t,n){this.h=D,this.w=0,this.input=_&&t instanceof Array?new Uint8Array(t):t,this.b=0,n&&(n.lazy&&(this.w=n.lazy),"number"==typeof n.compressionType&&(this.h=n.compressionType),n.outputBuffer&&(this.a=_&&n.outputBuffer instanceof Array?new Uint8Array(n.outputBuffer):n.outputBuffer),"number"==typeof n.outputIndex&&(this.b=n.outputIndex)),this.a||(this.a=new(_?Uint8Array:Array)(32768))}function a(t,n){this.length=t,this.G=n}function s(n,e){function r(n,e){var r,i=n.G,o=[],a=0;r=j[n.length],o[a++]=65535&r,o[a++]=255&r>>16,o[a++]=r>>24;var s;switch(E){case 1===i:s=[0,i-1,0];break;case 2===i:s=[1,i-2,0];break;case 3===i:s=[2,i-3,0];break;case 4===i:s=[3,i-4,0];break;case 6>=i:s=[4,i-5,1];break;case 8>=i:s=[5,i-7,1];break;case 12>=i:s=[6,i-9,2];break;case 16>=i:s=[7,i-13,2];break;case 24>=i:s=[8,i-17,3];break;case 32>=i:s=[9,i-25,3];break;case 48>=i:s=[10,i-33,4];break;case 64>=i:s=[11,i-49,4];break;case 96>=i:s=[12,i-65,5];break;case 128>=i:s=[13,i-97,5];break;case 192>=i:s=[14,i-129,6];break;case 256>=i:s=[15,i-193,6];break;case 384>=i:s=[16,i-257,7];break;case 512>=i:s=[17,i-385,7];break;case 768>=i:s=[18,i-513,8];break;case 1024>=i:s=[19,i-769,8];break;case 1536>=i:s=[20,i-1025,9];break;case 2048>=i:s=[21,i-1537,9];break;case 3072>=i:s=[22,i-2049,10];break;case 4096>=i:s=[23,i-3073,10];break;case 6144>=i:s=[24,i-4097,11];break;case 8192>=i:s=[25,i-6145,11];break;case 12288>=i:s=[26,i-8193,12];break;case 16384>=i:s=[27,i-12289,12];break;case 24576>=i:s=[28,i-16385,13];break;case 32768>=i:s=[29,i-24577,13];break;default:t("invalid distance")}r=s,o[a++]=r[0],o[a++]=r[1],o[a++]=r[2];var u,c;for(u=0,c=o.length;c>u;++u)g[v++]=o[u];m[o[0]]++,b[o[3]]++,y=n.length+e-1,h=null}var i,o,a,s,c,f,l,h,p,d={},g=_?new Uint16Array(2*e.length):[],v=0,y=0,m=new(_?Uint32Array:Array)(286),b=new(_?Uint32Array:Array)(30),x=n.w;if(!_){for(a=0;285>=a;)m[a++]=0;for(a=0;29>=a;)b[a++]=0}for(m[256]=1,i=0,o=e.length;o>i;++i){for(a=c=0,s=3;s>a&&i+a!==o;++a)c=c<<8|e[i+a];if(d[c]===w&&(d[c]=[]),f=d[c],!(y-->0)){for(;f.length>0&&i-f[0]>32768;)f.shift();if(i+3>=o){for(h&&r(h,-1),a=0,s=o-i;s>a;++a)p=e[i+a],g[v++]=p,++m[p];break}f.length>0?(l=u(e,i,f),h?h.lengthl.length?h=l:r(l,0)):h?r(h,-1):(p=e[i],g[v++]=p,++m[p])}f.push(i)}return g[v++]=256,m[256]++,n.L=m,n.K=b,_?g.subarray(0,v):g}function u(t,n,e){var r,i,o,s,u,c,f=0,l=t.length;s=0,c=e.length;t:for(;c>s;s++){if(r=e[c-s-1],o=3,f>3){for(u=f;u>3;u--)if(t[r+u-1]!==t[n+u-1])continue t;o=f}for(;258>o&&l>n+o&&t[r+o]===t[n+o];)++o;if(o>f&&(i=r,f=o),258===o)break}return new a(f,n-i)}function c(t,n){var e,i,o,a,s,u=t.length,c=new r(572),l=new(_?Uint8Array:Array)(u);if(!_)for(a=0;u>a;a++)l[a]=0;for(a=0;u>a;++a)t[a]>0&&c.push(a,t[a]);if(e=Array(c.length/2),i=new(_?Uint32Array:Array)(c.length/2),1===e.length)return l[c.pop().index]=1,l;for(a=0,s=c.length/2;s>a;++a)e[a]=c.pop(),i[a]=e[a].value;for(o=f(i,i.length,n),a=0,s=e.length;s>a;++a)l[e[a].index]=o[a];return l}function f(t,n,e){function r(t){var e=p[t][d[t]];e===n?(r(t+1),r(t+1)):--l[e],++d[t]}var i,o,a,s,u,c=new(_?Uint16Array:Array)(e),f=new(_?Uint8Array:Array)(e),l=new(_?Uint8Array:Array)(n),h=Array(e),p=Array(e),d=Array(e),g=(1<o;++o)v>g?f[o]=0:(f[o]=1,g-=v),g<<=1,c[e-2-o]=(0|c[e-1-o]/2)+n;for(c[0]=f[0],h[0]=Array(c[0]),p[0]=Array(c[0]),o=1;e>o;++o)c[o]>2*c[o-1]+f[o]&&(c[o]=2*c[o-1]+f[o]),h[o]=Array(c[o]),p[o]=Array(c[o]);for(i=0;n>i;++i)l[i]=e;for(a=0;c[e-1]>a;++a)h[e-1][a]=t[a],p[e-1][a]=a;for(i=0;e>i;++i)d[i]=0;for(1===f[e-1]&&(--l[0],++d[e-1]),o=e-2;o>=0;--o){for(s=i=0,u=d[o+1],a=0;c[o]>a;a++)s=h[o+1][u]+h[o+1][u+1],s>t[i]?(h[o][a]=s,p[o][a]=n,u+=2):(h[o][a]=t[i],p[o][a]=i,++i);d[o]=0,1===f[o]&&r(o)}return l}function l(t){var n,e,r,i,o=new(_?Uint16Array:Array)(t.length),a=[],s=[],u=0;for(n=0,e=t.length;e>n;n++)a[t[n]]=(0|a[t[n]])+1;for(n=1,e=16;e>=n;n++)s[n]=u,u+=0|a[n],u<<=1;for(n=0,e=t.length;e>n;n++)for(u=s[t[n]],s[t[n]]+=1,r=o[n]=0,i=t[n];i>r;r++)o[n]=o[n]<<1|1&u,u>>>=1;return o}function h(n,e){switch(this.l=[],this.m=32768,this.e=this.g=this.c=this.q=0,this.input=_?new Uint8Array(n):n,this.s=!1,this.n=N,this.B=!1,(e||!(e={}))&&(e.index&&(this.c=e.index),e.bufferSize&&(this.m=e.bufferSize),e.bufferType&&(this.n=e.bufferType),e.resize&&(this.B=e.resize)),this.n){case z:this.b=32768,this.a=new(_?Uint8Array:Array)(32768+this.m+258);break;case N:this.b=0,this.a=new(_?Uint8Array:Array)(this.m),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}function p(n,e){for(var r,i=n.g,o=n.e,a=n.input,s=n.c;e>o;)r=a[s++],r===w&&t(Error("input buffer is broken")),i|=r<>>e,n.e=o-e,n.c=s,r}function d(t,n){for(var e,r,i,o=t.g,a=t.e,s=t.input,u=t.c,c=n[0],f=n[1];f>a&&(e=s[u++],e!==w);)o|=e<>>16,t.g=o>>i,t.e=a-i,t.c=u,65535&r}function g(t){function n(t,n,e){var r,i,o,a;for(a=0;t>a;)switch(r=d(this,n)){case 16:for(o=3+p(this,2);o--;)e[a++]=i;break;case 17:for(o=3+p(this,3);o--;)e[a++]=0;i=0;break;case 18:for(o=11+p(this,7);o--;)e[a++]=0;i=0;break;default:i=e[a++]=r}return e}var e,r,o,a,s=p(t,5)+257,u=p(t,5)+1,c=p(t,4)+4,f=new(_?Uint8Array:Array)(W.length);for(a=0;c>a;++a)f[W[a]]=p(t,3);e=i(f),r=new(_?Uint8Array:Array)(s),o=new(_?Uint8Array:Array)(u),t.o(i(n.call(t,s,e,r)),i(n.call(t,u,e,o)))}function v(t){if("string"==typeof t){var n,e,r=t.split("");for(n=0,e=r.length;e>n;n++)r[n]=(255&r[n].charCodeAt(0))>>>0;t=r}for(var i,o=1,a=0,s=t.length,u=0;s>0;){i=s>1024?1024:s,s-=i;do o+=t[u++],a+=o;while(--i);o%=65521,a%=65521}return(a<<16|o)>>>0}function y(n,e){var r,i;switch(this.input=n,this.c=0,(e||!(e={}))&&(e.index&&(this.c=e.index),e.verify&&(this.M=e.verify)),r=n[this.c++],i=n[this.c++],15&r){case rn:this.method=rn;break;default:t(Error("unsupported compression method"))}0!==((r<<8)+i)%31&&t(Error("invalid fcheck flag:"+((r<<8)+i)%31)),32&i&&t(Error("fdict flag is not supported")),this.A=new h(n,{index:this.c,bufferSize:e.bufferSize,bufferType:e.bufferType,resize:e.resize})}function m(t,n){this.input=t,this.a=new(_?Uint8Array:Array)(32768),this.h=on.k;var e,r={};!n&&(n={})||"number"!=typeof n.compressionType||(this.h=n.compressionType);for(e in n)r[e]=n[e];r.outputBuffer=this.a,this.z=new o(this.input,r)}function b(t,e){var r,i,o,a;if(Object.keys)r=Object.keys(e);else for(i in r=[],o=0,e)r[o++]=i;for(o=0,a=r.length;a>o;++o)i=r[o],n(t+"."+i,e[i])}var w=void 0,E=!0,x=this,_="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;e.prototype.f=function(){var t,n=this.buffer,e=n.length,r=new(_?Uint8Array:Array)(e<<1);if(_)r.set(n);else for(t=0;e>t;++t)r[t]=n[t];return this.buffer=r},e.prototype.d=function(t,n,e){var r,i=this.buffer,o=this.index,a=this.i,s=i[o];if(e&&n>1&&(t=n>8?(C[255&t]<<24|C[255&t>>>8]<<16|C[255&t>>>16]<<8|C[255&t>>>24])>>32-n:C[t]>>8-n),8>n+a)s=s<r;++r)s=s<<1|1&t>>n-r-1,8===++a&&(a=0,i[o++]=C[s],s=0,o===i.length&&(i=this.f()));i[o]=s,this.buffer=i,this.i=a,this.index=o},e.prototype.finish=function(){var t,n=this.buffer,e=this.index;return this.i>0&&(n[e]<<=8-this.i,n[e]=C[n[e]],e++),_?t=n.subarray(0,e):(n.length=e,t=n),t};var k,A=new(_?Uint8Array:Array)(256);for(k=0;256>k;++k){for(var S=k,O=S,R=7,S=S>>>1;S;S>>>=1)O<<=1,O|=1&S,--R;A[k]=(255&O<>>0}var C=A;r.prototype.getParent=function(t){return 2*(0|(t-2)/4)},r.prototype.push=function(t,n){var e,r,i,o=this.buffer;for(e=this.length,o[this.length++]=n,o[this.length++]=t;e>0&&(r=this.getParent(e),o[e]>o[r]);)i=o[e],o[e]=o[r],o[r]=i,i=o[e+1],o[e+1]=o[r+1],o[r+1]=i,e=r;return this.length},r.prototype.pop=function(){var t,n,e,r,i,o=this.buffer;for(n=o[0],t=o[1],this.length-=2,o[0]=o[this.length],o[1]=o[this.length+1],i=0;(r=2*i+2,!(r>=this.length))&&(this.length>r+2&&o[r+2]>o[r]&&(r+=2),o[r]>o[i]);)e=o[i],o[i]=o[r],o[r]=e,e=o[i+1],o[i+1]=o[r+1],o[r+1]=e,i=r;return{index:t,value:n,length:this.length}};var I,D=2,T={NONE:0,r:1,k:D,N:3},B=[];for(I=0;288>I;I++)switch(E){case 143>=I:B.push([I+48,8]);break;case 255>=I:B.push([I-144+400,9]);break;case 279>=I:B.push([I-256+0,7]);break;case 287>=I:B.push([I-280+192,8]);break;default:t("invalid literal: "+I)}o.prototype.j=function(){var n,r,i,o,a=this.input;switch(this.h){case 0:for(i=0,o=a.length;o>i;){r=_?a.subarray(i,i+65535):a.slice(i,i+65535),i+=r.length;var u=r,f=i===o,h=w,p=w,d=w,g=w,v=w,y=this.a,m=this.b;if(_){for(y=new Uint8Array(this.a.buffer);y.length<=m+u.length+5;)y=new Uint8Array(y.length<<1);y.set(this.a)}if(h=f?1:0,y[m++]=0|h,p=u.length,d=65535&~p+65536,y[m++]=255&p,y[m++]=255&p>>>8,y[m++]=255&d,y[m++]=255&d>>>8,_)y.set(u,m),m+=u.length,y=y.subarray(0,m);else{for(g=0,v=u.length;v>g;++g)y[m++]=u[g];y.length=m}this.b=m,this.a=y}break;case 1:var b=new e(_?new Uint8Array(this.a.buffer):this.a,this.b);b.d(1,1,E),b.d(1,2,E);var x,k,A,S=s(this,a);for(x=0,k=S.length;k>x;x++)if(A=S[x],e.prototype.d.apply(b,B[A]),A>256)b.d(S[++x],S[++x],E),b.d(S[++x],5),b.d(S[++x],S[++x],E);else if(256===A)break;this.a=b.finish(),this.b=this.a.length;break;case D:var O,R,C,I,T,M,j,z,N,F,U,L,P,W,q,H=new e(_?new Uint8Array(this.a.buffer):this.a,this.b),Y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=Array(19);for(O=D,H.d(1,1,E),H.d(O,2,E),R=s(this,a),M=c(this.L,15),j=l(M),z=c(this.K,7),N=l(z),C=286;C>257&&0===M[C-1];C--);for(I=30;I>1&&0===z[I-1];I--);var K,V,Z,Q,G,$,J=C,tn=I,nn=new(_?Uint32Array:Array)(J+tn),en=new(_?Uint32Array:Array)(316),rn=new(_?Uint8Array:Array)(19);for(K=V=0;J>K;K++)nn[V++]=M[K];for(K=0;tn>K;K++)nn[V++]=z[K];if(!_)for(K=0,Q=rn.length;Q>K;++K)rn[K]=0;for(K=G=0,Q=nn.length;Q>K;K+=V){for(V=1;Q>K+V&&nn[K+V]===nn[K];++V);if(Z=V,0===nn[K])if(3>Z)for(;Z-->0;)en[G++]=0,rn[0]++;else for(;Z>0;)$=138>Z?Z:138,$>Z-3&&Z>$&&($=Z-3),10>=$?(en[G++]=17,en[G++]=$-3,rn[17]++):(en[G++]=18,en[G++]=$-11,rn[18]++),Z-=$;else if(en[G++]=nn[K],rn[nn[K]]++,Z--,3>Z)for(;Z-->0;)en[G++]=nn[K],rn[nn[K]]++;else for(;Z>0;)$=6>Z?Z:6,$>Z-3&&Z>$&&($=Z-3),en[G++]=16,en[G++]=$-3,rn[16]++,Z-=$}for(n=_?en.subarray(0,G):en.slice(0,G),F=c(rn,7),W=0;19>W;W++)X[W]=F[Y[W]];for(T=19;T>4&&0===X[T-1];T--);for(U=l(F),H.d(C-257,5,E),H.d(I-1,5,E),H.d(T-4,4,E),W=0;T>W;W++)H.d(X[W],3,E);for(W=0,q=n.length;q>W;W++)if(L=n[W],H.d(U[L],F[L],E),L>=16){switch(W++,L){case 16:P=2;break;case 17:P=3;break;case 18:P=7;break;default:t("invalid code: "+L)}H.d(n[W],P,E)}var on,an,sn,un,cn,fn,ln,hn,pn=[j,M],dn=[N,z];for(cn=pn[0],fn=pn[1],ln=dn[0],hn=dn[1],on=0,an=R.length;an>on;++on)if(sn=R[on],H.d(cn[sn],fn[sn],E),sn>256)H.d(R[++on],R[++on],E),un=R[++on],H.d(ln[un],hn[un],E),H.d(R[++on],R[++on],E);else if(256===sn)break;this.a=H.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var M=function(){function n(n){switch(E){case 3===n:return[257,n-3,0];case 4===n:return[258,n-4,0];case 5===n:return[259,n-5,0];case 6===n:return[260,n-6,0];case 7===n:return[261,n-7,0];case 8===n:return[262,n-8,0];case 9===n:return[263,n-9,0];case 10===n:return[264,n-10,0];case 12>=n:return[265,n-11,1];case 14>=n:return[266,n-13,1];case 16>=n:return[267,n-15,1];case 18>=n:return[268,n-17,1];case 22>=n:return[269,n-19,2];case 26>=n:return[270,n-23,2];case 30>=n:return[271,n-27,2];case 34>=n:return[272,n-31,2];case 42>=n:return[273,n-35,3];case 50>=n:return[274,n-43,3];case 58>=n:return[275,n-51,3];case 66>=n:return[276,n-59,3];case 82>=n:return[277,n-67,4];case 98>=n:return[278,n-83,4];case 114>=n:return[279,n-99,4];case 130>=n:return[280,n-115,4];case 162>=n:return[281,n-131,5];case 194>=n:return[282,n-163,5];case 226>=n:return[283,n-195,5];case 257>=n:return[284,n-227,5];case 258===n:return[285,n-258,0];default:t("invalid length: "+n)}}var e,r,i=[];for(e=3;258>=e;e++)r=n(e),i[e]=r[2]<<24|r[1]<<16|r[0];return i}(),j=_?new Uint32Array(M):M,z=0,N=1,F={D:z,C:N};h.prototype.p=function(){for(;!this.s;){var n=p(this,3);switch(1&n&&(this.s=E),n>>>=1){case 0:var e=this.input,r=this.c,i=this.a,o=this.b,a=w,s=w,u=w,c=i.length,f=w;switch(this.e=this.g=0,a=e[r++],a===w&&t(Error("invalid uncompressed block header: LEN (first byte)")),s=a,a=e[r++],a===w&&t(Error("invalid uncompressed block header: LEN (second byte)")),s|=a<<8,a=e[r++],a===w&&t(Error("invalid uncompressed block header: NLEN (first byte)")),u=a,a=e[r++],a===w&&t(Error("invalid uncompressed block header: NLEN (second byte)")),u|=a<<8,s===~u&&t(Error("invalid uncompressed block header: length verify")),r+s>e.length&&t(Error("input buffer is broken")),this.n){case z:for(;o+s>i.length;){if(f=c-o,s-=f,_)i.set(e.subarray(r,r+f),o),o+=f,r+=f;else for(;f--;)i[o++]=e[r++];this.b=o,i=this.f(),o=this.b}break;case N:for(;o+s>i.length;)i=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(_)i.set(e.subarray(r,r+s),o),o+=s,r+=s;else for(;s--;)i[o++]=e[r++];this.c=r,this.b=o,this.a=i;break;case 1:this.o(tn,en);break;case 2:g(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var U,L,P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=_?new Uint16Array(P):P,q=[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,258,258],H=_?new Uint16Array(q):q,Y=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],X=_?new Uint8Array(Y):Y,K=[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],V=_?new Uint16Array(K):K,Z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Q=_?new Uint8Array(Z):Z,G=new(_?Uint8Array:Array)(288);for(U=0,L=G.length;L>U;++U)G[U]=143>=U?8:255>=U?9:279>=U?7:8;var $,J,tn=i(G),nn=new(_?Uint8Array:Array)(30);for($=0,J=nn.length;J>$;++$)nn[$]=5;var en=i(nn);h.prototype.o=function(t,n){var e=this.a,r=this.b;this.u=t;for(var i,o,a,s,u=e.length-258;256!==(i=d(this,t));)if(256>i)r>=u&&(this.b=r,e=this.f(),r=this.b),e[r++]=i;else for(o=i-257,s=H[o],X[o]>0&&(s+=p(this,X[o])),i=d(this,n),a=V[i],Q[i]>0&&(a+=p(this,Q[i])),r>=u&&(this.b=r,e=this.f(),r=this.b);s--;)e[r]=e[r++-a];for(;this.e>=8;)this.e-=8,this.c--;this.b=r},h.prototype.I=function(t,n){var e=this.a,r=this.b;this.u=t;for(var i,o,a,s,u=e.length;256!==(i=d(this,t));)if(256>i)r>=u&&(e=this.f(),u=e.length),e[r++]=i;else for(o=i-257,s=H[o],X[o]>0&&(s+=p(this,X[o])),i=d(this,n),a=V[i],Q[i]>0&&(a+=p(this,Q[i])),r+s>u&&(e=this.f(),u=e.length);s--;)e[r]=e[r++-a];for(;this.e>=8;)this.e-=8,this.c--;this.b=r},h.prototype.f=function(){var t,n,e=new(_?Uint8Array:Array)(this.b-32768),r=this.b-32768,i=this.a;if(_)e.set(i.subarray(32768,e.length));else for(t=0,n=e.length;n>t;++t)e[t]=i[t+32768];if(this.l.push(e),this.q+=e.length,_)i.set(i.subarray(r,r+32768));else for(t=0;32768>t;++t)i[t]=i[r+t];return this.b=32768,i},h.prototype.J=function(t){var n,e,r,i,o=0|this.input.length/this.c+1,a=this.input,s=this.a;return t&&("number"==typeof t.v&&(o=t.v),"number"==typeof t.F&&(o+=t.F)),2>o?(e=(a.length-this.c)/this.u[2],i=0|258*(e/2),r=s.length>i?s.length+i:s.length<<1):r=s.length*o,_?(n=new Uint8Array(r),n.set(s)):n=s,this.a=n},h.prototype.t=function(){var t,n,e,r,i,o=0,a=this.a,s=this.l,u=new(_?Uint8Array:Array)(this.q+(this.b-32768));if(0===s.length)return _?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(n=0,e=s.length;e>n;++n)for(t=s[n],r=0,i=t.length;i>r;++r)u[o++]=t[r];for(n=32768,e=this.b;e>n;++n)u[o++]=a[n];return this.l=[],this.buffer=u},h.prototype.H=function(){var t,n=this.b;return _?this.B?(t=new Uint8Array(n),t.set(this.a.subarray(0,n))):t=this.a.subarray(0,n):(this.a.length>n&&(this.a.length=n),t=this.a),this.buffer=t},y.prototype.p=function(){var n,e,r=this.input;return n=this.A.p(),this.c=this.A.c,this.M&&(e=(r[this.c++]<<24|r[this.c++]<<16|r[this.c++]<<8|r[this.c++])>>>0,e!==v(n)&&t(Error("invalid adler-32 checksum"))),n};var rn=8,on=T;m.prototype.j=function(){var n,e,r,i,o,a,s,u=0;switch(s=this.a,n=rn){case rn:e=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(r=e<<4|n,s[u++]=r,n){case rn:switch(this.h){case on.NONE:o=0;break;case on.r:o=1;break;case on.k:o=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return i=0|o<<6,s[u++]=i|31-(256*r+i)%31,a=v(this.input),this.z.b=u,s=this.z.j(),u=s.length,_&&(s=new Uint8Array(s.buffer),u+4>=s.length&&(this.a=new Uint8Array(s.length+4),this.a.set(s),s=this.a),s=s.subarray(0,u+4)),s[u++]=255&a>>24,s[u++]=255&a>>16,s[u++]=255&a>>8,s[u++]=255&a,s},n("Zlib.Inflate",y),n("Zlib.Inflate.prototype.decompress",y.prototype.p),b("Zlib.Inflate.BufferType",{ADAPTIVE:F.C,BLOCK:F.D}),n("Zlib.Deflate",m),n("Zlib.Deflate.compress",function(t,n){return new m(t,n).j()}),n("Zlib.Deflate.prototype.compress",m.prototype.j),b("Zlib.Deflate.CompressionType",{NONE:on.NONE,FIXED:on.r,DYNAMIC:on.k})}.call(this),e("lib/zlib",function(){}),e("src/adapters/zlib",["require","../../lib/zlib"],function(t){function n(t){return new o(t).decompress() -}function e(t){return new a(t).compress()}function r(t){this.context=t}function i(t){this.provider=t}t("../../lib/zlib");var o=Zlib.Inflate,a=Zlib.Deflate;return r.prototype.clear=function(t){this.context.clear(t)},r.prototype.get=function(t,e){this.context.get(t,function(t,r){return t?(e(t),void 0):(r&&(r=n(r)),e(null,r),void 0)})},r.prototype.put=function(t,n,r){n=e(n),this.context.put(t,n,r)},r.prototype.delete=function(t,n){this.context.delete(t,n)},i.isSupported=function(){return!0},i.prototype.open=function(t){this.provider.open(t)},i.prototype.getReadOnlyContext=function(){return new r(this.provider.getReadOnlyContext())},i.prototype.getReadWriteContext=function(){return new r(this.provider.getReadWriteContext())},i});var r=r||function(t,n){var e={},r=e.lib={},i=r.Base=function(){function t(){}return{extend:function(n){t.prototype=this;var e=new t;return n&&e.mixIn(n),e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.$super.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=e!=n?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var n=this.words,e=t.words,r=this.sigBytes,t=t.sigBytes;if(this.clamp(),r%4)for(var i=0;t>i;i++)n[r+i>>>2]|=(255&e[i>>>2]>>>24-8*(i%4))<<24-8*((r+i)%4);else if(e.length>65535)for(i=0;t>i;i+=4)n[r+i>>>2]=e[i>>>2];else n.push.apply(n,e);return this.sigBytes+=t,this},clamp:function(){var n=this.words,e=this.sigBytes;n[e>>>2]&=4294967295<<32-8*(e%4),n.length=t.ceil(e/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(n){for(var e=[],r=0;n>r;r+=4)e.push(0|4294967296*t.random());return o.create(e,n)}}),a=e.enc={},s=a.Hex={stringify:function(t){for(var n=t.words,t=t.sigBytes,e=[],r=0;t>r;r++){var i=255&n[r>>>2]>>>24-8*(r%4);e.push((i>>>4).toString(16)),e.push((15&i).toString(16))}return e.join("")},parse:function(t){for(var n=t.length,e=[],r=0;n>r;r+=2)e[r>>>3]|=parseInt(t.substr(r,2),16)<<24-4*(r%8);return o.create(e,n/2)}},u=a.Latin1={stringify:function(t){for(var n=t.words,t=t.sigBytes,e=[],r=0;t>r;r++)e.push(String.fromCharCode(255&n[r>>>2]>>>24-8*(r%4)));return e.join("")},parse:function(t){for(var n=t.length,e=[],r=0;n>r;r++)e[r>>>2]|=(255&t.charCodeAt(r))<<24-8*(r%4);return o.create(e,n)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(n){throw Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},f=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=o.create(),this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(n){var e=this._data,r=e.words,i=e.sigBytes,a=this.blockSize,s=i/(4*a),s=n?t.ceil(s):t.max((0|s)-this._minBufferSize,0),n=s*a,i=t.min(4*n,i);if(n){for(var u=0;n>u;u+=a)this._doProcessBlock(r,u);u=r.splice(0,n),e.sigBytes-=i}return o.create(u,i)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=f.extend({init:function(){this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize(),this._hash},clone:function(){var t=f.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:16,_createHelper:function(t){return function(n,e){return t.create(e).finalize(n)}},_createHmacHelper:function(t){return function(n,e){return l.HMAC.create(t,e).finalize(n)}}});var l=e.algo={};return e}(Math);(function(){var t=r,n=t.lib.WordArray;t.enc.Base64={stringify:function(t){var n=t.words,e=t.sigBytes,r=this._map;t.clamp();for(var t=[],i=0;e>i;i+=3)for(var o=(255&n[i>>>2]>>>24-8*(i%4))<<16|(255&n[i+1>>>2]>>>24-8*((i+1)%4))<<8|255&n[i+2>>>2]>>>24-8*((i+2)%4),a=0;4>a&&e>i+.75*a;a++)t.push(r.charAt(63&o>>>6*(3-a)));if(n=r.charAt(64))for(;t.length%4;)t.push(n);return t.join("")},parse:function(t){var t=t.replace(/\s/g,""),e=t.length,r=this._map,i=r.charAt(64);i&&(i=t.indexOf(i),-1!=i&&(e=i));for(var i=[],o=0,a=0;e>a;a++)if(a%4){var s=r.indexOf(t.charAt(a-1))<<2*(a%4),u=r.indexOf(t.charAt(a))>>>6-2*(a%4);i[o>>>2]|=(s|u)<<24-8*(o%4),o++}return n.create(i,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(),function(t){function n(t,n,e,r,i,o,a){return t=t+(n&e|~n&r)+i+a,(t<>>32-o)+n}function e(t,n,e,r,i,o,a){return t=t+(n&r|e&~r)+i+a,(t<>>32-o)+n}function i(t,n,e,r,i,o,a){return t=t+(n^e^r)+i+a,(t<>>32-o)+n}function o(t,n,e,r,i,o,a){return t=t+(e^(n|~r))+i+a,(t<>>32-o)+n}var a=r,s=a.lib,u=s.WordArray,s=s.Hasher,c=a.algo,f=[];(function(){for(var n=0;64>n;n++)f[n]=0|4294967296*t.abs(t.sin(n+1))})(),c=c.MD5=s.extend({_doReset:function(){this._hash=u.create([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,r){for(var a=0;16>a;a++){var s=r+a,u=t[s];t[s]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}for(var s=this._hash.words,u=s[0],c=s[1],l=s[2],h=s[3],a=0;64>a;a+=4)16>a?(u=n(u,c,l,h,t[r+a],7,f[a]),h=n(h,u,c,l,t[r+a+1],12,f[a+1]),l=n(l,h,u,c,t[r+a+2],17,f[a+2]),c=n(c,l,h,u,t[r+a+3],22,f[a+3])):32>a?(u=e(u,c,l,h,t[r+(a+1)%16],5,f[a]),h=e(h,u,c,l,t[r+(a+6)%16],9,f[a+1]),l=e(l,h,u,c,t[r+(a+11)%16],14,f[a+2]),c=e(c,l,h,u,t[r+a%16],20,f[a+3])):48>a?(u=i(u,c,l,h,t[r+(3*a+5)%16],4,f[a]),h=i(h,u,c,l,t[r+(3*a+8)%16],11,f[a+1]),l=i(l,h,u,c,t[r+(3*a+11)%16],16,f[a+2]),c=i(c,l,h,u,t[r+(3*a+14)%16],23,f[a+3])):(u=o(u,c,l,h,t[r+3*a%16],6,f[a]),h=o(h,u,c,l,t[r+(3*a+7)%16],10,f[a+1]),l=o(l,h,u,c,t[r+(3*a+14)%16],15,f[a+2]),c=o(c,l,h,u,t[r+(3*a+5)%16],21,f[a+3]));s[0]=0|s[0]+u,s[1]=0|s[1]+c,s[2]=0|s[2]+l,s[3]=0|s[3]+h},_doFinalize:function(){var t=this._data,n=t.words,e=8*this._nDataBytes,r=8*t.sigBytes;for(n[r>>>5]|=128<<24-r%32,n[(r+64>>>9<<4)+14]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8),t.sigBytes=4*(n.length+1),this._process(),t=this._hash.words,n=0;4>n;n++)e=t[n],t[n]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8)}}),a.MD5=s._createHelper(c),a.HmacMD5=s._createHmacHelper(c)}(Math),function(){var t=r,n=t.lib,e=n.Base,i=n.WordArray,n=t.algo,o=n.EvpKDF=e.extend({cfg:e.extend({keySize:4,hasher:n.MD5,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,n){for(var e=this.cfg,r=e.hasher.create(),o=i.create(),a=o.words,s=e.keySize,e=e.iterations;s>a.length;){u&&r.update(u);var u=r.update(t).finalize(n);r.reset();for(var c=1;e>c;c++)u=r.finalize(u),r.reset();o.concat(u)}return o.sigBytes=4*s,o}});t.EvpKDF=function(t,n,e){return o.create(e).compute(t,n)}}(),r.lib.Cipher||function(t){var n=r,e=n.lib,i=e.Base,o=e.WordArray,a=e.BufferedBlockAlgorithm,s=n.enc.Base64,u=n.algo.EvpKDF,c=e.Cipher=a.extend({cfg:i.extend(),createEncryptor:function(t,n){return this.create(this._ENC_XFORM_MODE,t,n)},createDecryptor:function(t,n){return this.create(this._DEC_XFORM_MODE,t,n)},init:function(t,n,e){this.cfg=this.cfg.extend(e),this._xformMode=t,this._key=n,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){return function(t){return{encrypt:function(n,e,r){return("string"==typeof e?g:d).encrypt(t,n,e,r)},decrypt:function(n,e,r){return("string"==typeof e?g:d).decrypt(t,n,e,r)}}}}()});e.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var f=n.mode={},l=e.BlockCipherMode=i.extend({createEncryptor:function(t,n){return this.Encryptor.create(t,n)},createDecryptor:function(t,n){return this.Decryptor.create(t,n)},init:function(t,n){this._cipher=t,this._iv=n}}),f=f.CBC=function(){function n(n,e,r){var i=this._iv;i?this._iv=t:i=this._prevBlock;for(var o=0;r>o;o++)n[e+o]^=i[o]}var e=l.extend();return e.Encryptor=e.extend({processBlock:function(t,e){var r=this._cipher,i=r.blockSize;n.call(this,t,e,i),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var r=this._cipher,i=r.blockSize,o=t.slice(e,e+i);r.decryptBlock(t,e),n.call(this,t,e,i),this._prevBlock=o}}),e}(),h=(n.pad={}).Pkcs7={pad:function(t,n){for(var e=4*n,e=e-t.sigBytes%e,r=e<<24|e<<16|e<<8|e,i=[],a=0;e>a;a+=4)i.push(r);e=o.create(i,e),t.concat(e)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}};e.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:h}),reset:function(){c.reset.call(this);var t=this.cfg,n=t.iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var e=t.createEncryptor;else e=t.createDecryptor,this._minBufferSize=1;this._mode=e.call(t,this,n&&n.words)},_doProcessBlock:function(t,n){this._mode.processBlock(t,n)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var n=this._process(!0)}else n=this._process(!0),t.unpad(n);return n},blockSize:4});var p=e.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),f=(n.format={}).OpenSSL={stringify:function(t){var n=t.ciphertext,t=t.salt,n=(t?o.create([1398893684,1701076831]).concat(t).concat(n):n).toString(s);return n=n.replace(/(.{64})/g,"$1\n")},parse:function(t){var t=s.parse(t),n=t.words;if(1398893684==n[0]&&1701076831==n[1]){var e=o.create(n.slice(2,4));n.splice(0,4),t.sigBytes-=16}return p.create({ciphertext:t,salt:e})}},d=e.SerializableCipher=i.extend({cfg:i.extend({format:f}),encrypt:function(t,n,e,r){var r=this.cfg.extend(r),i=t.createEncryptor(e,r),n=i.finalize(n),i=i.cfg;return p.create({ciphertext:n,key:e,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,n,e,r){return r=this.cfg.extend(r),n=this._parse(n,r.format),t.createDecryptor(e,r).finalize(n.ciphertext)},_parse:function(t,n){return"string"==typeof t?n.parse(t):t}}),n=(n.kdf={}).OpenSSL={compute:function(t,n,e,r){return r||(r=o.random(8)),t=u.create({keySize:n+e}).compute(t,r),e=o.create(t.words.slice(n),4*e),t.sigBytes=4*n,p.create({key:t,iv:e,salt:r})}},g=e.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:n}),encrypt:function(t,n,e,r){return r=this.cfg.extend(r),e=r.kdf.compute(e,t.keySize,t.ivSize),r.iv=e.iv,t=d.encrypt.call(this,t,n,e.key,r),t.mixIn(e),t},decrypt:function(t,n,e,r){return r=this.cfg.extend(r),n=this._parse(n,r.format),e=r.kdf.compute(e,t.keySize,t.ivSize,n.salt),r.iv=e.iv,d.decrypt.call(this,t,n,e.key,r)}})}(),function(){var t=r,n=t.lib.BlockCipher,e=t.algo,i=[],o=[],a=[],s=[],u=[],c=[],f=[],l=[],h=[],p=[];(function(){for(var t=[],n=0;256>n;n++)t[n]=128>n?n<<1:283^n<<1;for(var e=0,r=0,n=0;256>n;n++){var d=r^r<<1^r<<2^r<<3^r<<4,d=99^(d>>>8^255&d);i[e]=d,o[d]=e;var g=t[e],v=t[g],y=t[v],m=257*t[d]^16843008*d;a[e]=m<<24|m>>>8,s[e]=m<<16|m>>>16,u[e]=m<<8|m>>>24,c[e]=m,m=16843009*y^65537*v^257*g^16843008*e,f[d]=m<<24|m>>>8,l[d]=m<<16|m>>>16,h[d]=m<<8|m>>>24,p[d]=m,e?(e=g^t[t[t[y^g]]],r^=t[t[r]]):e=r=1}})();var d=[0,1,2,4,8,16,32,64,128,27,54],e=e.AES=n.extend({_doReset:function(){for(var t=this._key,n=t.words,e=t.sigBytes/4,t=4*((this._nRounds=e+6)+1),r=this._keySchedule=[],o=0;t>o;o++)if(e>o)r[o]=n[o];else{var a=r[o-1];o%e?e>6&&4==o%e&&(a=i[a>>>24]<<24|i[255&a>>>16]<<16|i[255&a>>>8]<<8|i[255&a]):(a=a<<8|a>>>24,a=i[a>>>24]<<24|i[255&a>>>16]<<16|i[255&a>>>8]<<8|i[255&a],a^=d[0|o/e]<<24),r[o]=r[o-e]^a}for(n=this._invKeySchedule=[],e=0;t>e;e++)o=t-e,a=e%4?r[o]:r[o-4],n[e]=4>e||4>=o?a:f[i[a>>>24]]^l[i[255&a>>>16]]^h[i[255&a>>>8]]^p[i[255&a]]},encryptBlock:function(t,n){this._doCryptBlock(t,n,this._keySchedule,a,s,u,c,i)},decryptBlock:function(t,n){var e=t[n+1];t[n+1]=t[n+3],t[n+3]=e,this._doCryptBlock(t,n,this._invKeySchedule,f,l,h,p,o),e=t[n+1],t[n+1]=t[n+3],t[n+3]=e},_doCryptBlock:function(t,n,e,r,i,o,a,s){for(var u=this._nRounds,c=t[n]^e[0],f=t[n+1]^e[1],l=t[n+2]^e[2],h=t[n+3]^e[3],p=4,d=1;u>d;d++)var g=r[c>>>24]^i[255&f>>>16]^o[255&l>>>8]^a[255&h]^e[p++],v=r[f>>>24]^i[255&l>>>16]^o[255&h>>>8]^a[255&c]^e[p++],y=r[l>>>24]^i[255&h>>>16]^o[255&c>>>8]^a[255&f]^e[p++],h=r[h>>>24]^i[255&c>>>16]^o[255&f>>>8]^a[255&l]^e[p++],c=g,f=v,l=y;g=(s[c>>>24]<<24|s[255&f>>>16]<<16|s[255&l>>>8]<<8|s[255&h])^e[p++],v=(s[f>>>24]<<24|s[255&l>>>16]<<16|s[255&h>>>8]<<8|s[255&c])^e[p++],y=(s[l>>>24]<<24|s[255&h>>>16]<<16|s[255&c>>>8]<<8|s[255&f])^e[p++],h=(s[h>>>24]<<24|s[255&c>>>16]<<16|s[255&f>>>8]<<8|s[255&l])^e[p++],t[n]=g,t[n+1]=v,t[n+2]=y,t[n+3]=h},keySize:8});t.AES=n._createHelper(e)}(),e("lib/crypto-js/rollups/aes",function(){}),e("src/adapters/crypto",["require","../../lib/crypto-js/rollups/aes","../../lib/encoding"],function(t){function n(t){for(var n=t.length,e=[],r=0;n>r;r++)e[r>>>2]|=(255&t[r])<<24-8*(r%4);return s.create(e,n)}function e(t){return new TextEncoder("utf-8").encode(t)}function i(t){return new TextDecoder("utf-8").decode(t)}function o(t,n,e){this.context=t,this.encrypt=n,this.decrypt=e}function a(t,o){this.provider=o;var a=r.AES;this.encrypt=function(r){var i=n(r),o=a.encrypt(i,t),s=e(o);return s},this.decrypt=function(n){var o=i(n),s=a.decrypt(o,t),u=s.toString(r.enc.Utf8),c=e(u);return c}}t("../../lib/crypto-js/rollups/aes");var s=r.lib.WordArray;return t("../../lib/encoding"),o.prototype.clear=function(t){this.context.clear(t)},o.prototype.get=function(t,n){var e=this.decrypt;this.context.get(t,function(t,r){return t?(n(t),void 0):(r&&(r=e(r)),n(null,r),void 0)})},o.prototype.put=function(t,n,e){var r=this.encrypt(n);this.context.put(t,r,e)},o.prototype.delete=function(t,n){this.context.delete(t,n)},a.isSupported=function(){return!0},a.prototype.open=function(t){this.provider.open(t)},a.prototype.getReadOnlyContext=function(){return new o(this.provider.getReadOnlyContext(),this.encrypt,this.decrypt)},a.prototype.getReadWriteContext=function(){return new o(this.provider.getReadWriteContext(),this.encrypt,this.decrypt)},a}),e("src/adapters/adapters",["require","./zlib","./crypto"],function(t){return{Compression:t("./zlib"),Encryption:t("./crypto")}}),e("src/environment",["require","src/constants"],function(t){function n(t){t=t||{},t.TMP=t.TMP||e.TMP,t.PATH=t.PATH||e.PATH,this.get=function(n){return t[n]},this.set=function(n,e){t[n]=e}}var e=t("src/constants").ENVIRONMENT;return n}),e("src/shell",["require","./path","./error","./environment","./../lib/async"],function(t){function n(t,n){n=n||{};var o=new i(n.env),a="/";Object.defineProperty(this,"fs",{get:function(){return t},enumerable:!0}),Object.defineProperty(this,"env",{get:function(){return o},enumerable:!0}),this.cd=function(n,i){n=e.resolve(this.cwd,n),t.stat(n,function(t,e){return t?(i(new r.ENotDirectory),void 0):("DIRECTORY"===e.type?(a=n,i()):i(new r.ENotDirectory),void 0)})},this.pwd=function(){return a}}var e=t("./path"),r=t("./error"),i=t("./environment"),o=t("./../lib/async");return n.prototype.exec=function(t,n,r){var i=this.fs;"function"==typeof n&&(r=n,n=[]),n=n||[],r=r||function(){},t=e.resolve(this.cwd,t),i.readFile(t,"utf8",function(t,e){if(t)return r(t),void 0;try{var o=Function("fs","args","callback",e);o(i,n,r)}catch(a){r(a)}})},n.prototype.touch=function(t,n,r){function i(t){a.writeFile(t,"",r)}function o(t){var e=Date.now(),i=n.date||e,o=n.date||e;a.utimes(t,i,o,r)}var a=this.fs;"function"==typeof n&&(r=n,n={}),n=n||{},r=r||function(){},t=e.resolve(this.cwd,t),a.stat(t,function(e){e?n.updateOnly===!0?r():i(t):o(t)})},n.prototype.cat=function(t,n){function r(t,n){var r=e.resolve(this.cwd,t);i.readFile(r,"utf8",function(t,e){return t?(n(t),void 0):(a+=e+"\n",n(),void 0)})}var i=this.fs,a="";return n=n||function(){},t?(t="string"==typeof t?[t]:t,o.eachSeries(t,r,function(t){t?n(t):n(null,a.replace(/\n$/,""))}),void 0):(n(Error("Missing files argument")),void 0)},n.prototype.ls=function(t,n,r){function i(t,r){var s=e.resolve(this.cwd,t),u=[];a.readdir(s,function(t,c){function f(t,r){t=e.join(s,t),a.stat(t,function(o,a){if(o)return r(o),void 0;var c={path:e.basename(t),links:a.nlinks,size:a.size,modified:a.mtime,type:a.type};n.recursive&&"DIRECTORY"===a.type?i(e.join(s,c.path),function(t,n){return t?(r(t),void 0):(c.contents=n,u.push(c),r(),void 0)}):(u.push(c),r())})}return t?(r(t),void 0):(o.each(c,f,function(t){r(t,u)}),void 0)})}var a=this.fs;return"function"==typeof n&&(r=n,n={}),n=n||{},r=r||function(){},t?(i(t,r),void 0):(r(Error("Missing dir argument")),void 0)},n.prototype.rm=function(t,n,i){function a(t,i){t=e.resolve(this.cwd,t),s.stat(t,function(u,c){return u?(i(u),void 0):"FILE"===c.type?(s.unlink(t,i),void 0):(s.readdir(t,function(u,c){return u?(i(u),void 0):0===c.length?(s.rmdir(t,i),void 0):n.recursive?(c=c.map(function(n){return e.join(t,n)}),o.each(c,a,function(n){return n?(i(n),void 0):(s.rmdir(t,i),void 0)}),void 0):(i(new r.ENotEmpty),void 0)}),void 0)})}var s=this.fs;return"function"==typeof n&&(i=n,n={}),n=n||{},i=i||function(){},t?(a(t,i),void 0):(i(Error("Missing path argument")),void 0)},n.prototype.tempDir=function(t){var n=this.fs,e=this.env.get("TMP");t=t||function(){},n.mkdir(e,function(){t(null,e)})},n}),e("src/fs",["require","./../lib/nodash","./../lib/encoding","./path","./path","./path","./shared","./shared","./shared","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","src/providers/providers","src/adapters/adapters","src/shell"],function(t){function n(t,n){this.id=t,this.type=n||Mn}function e(t,n,e){this.id=t,this.flags=n,this.position=e}function r(t,n,e){var r=Date.now();this.id=Un,this.mode=Nn,this.atime=t||r,this.ctime=n||r,this.mtime=e||r,this.rnode=mn()}function i(t,n,e,r,i,o,a,s,u,c){var f=Date.now();this.id=t||mn(),this.mode=n||Mn,this.size=e||0,this.atime=r||f,this.ctime=i||f,this.mtime=o||f,this.flags=a||[],this.xattrs=s||{},this.nlinks=u||0,this.version=c||0,this.blksize=void 0,this.nblocks=1,this.data=mn()}function o(t,n){this.node=t.id,this.dev=n,this.size=t.size,this.nlinks=t.nlinks,this.atime=t.atime,this.mtime=t.mtime,this.ctime=t.ctime,this.type=t.mode}function a(t,n,e){function r(n,r){n?e(n):r&&r.mode===Nn&&r.rnode?t.get(r.rnode,i):e(new In("missing super node"))}function i(t,n){t?e(t):n?e(null,n):e(new xn("path does not exist"))}function o(n,r){n?e(n):r.mode===jn&&r.data?t.get(r.data,s):e(new An("a component of the path prefix is not a directory"))}function s(n,r){if(n)e(n);else if(dn(r).has(f)){var i=r[f].id;t.get(i,u)}else e(new xn("path does not exist"))}function u(t,n){t?e(t):n.mode==zn?(h++,h>Ln?e(new Cn("too many symbolic links were encountered")):c(n.data)):e(null,n)}function c(n){n=gn(n),l=vn(n),f=yn(n),Fn==f?t.get(Un,r):a(t,l,o)}if(n=gn(n),!n)return e(new xn("path is an empty string"));var f=yn(n),l=vn(n),h=0;Fn==f?t.get(Un,r):a(t,l,o)}function s(t,n,e,r,i,o){function s(n,a){a?a.xattrs[e]:null,n?o(n):i===Qn&&a.xattrs.hasOwnProperty(e)?o(new wn("attribute already exists")):i!==Gn||a.xattrs.hasOwnProperty(e)?(a.xattrs[e]=r,t.put(a.id,a,o)):o(new Dn("attribute does not exist"))}"string"==typeof n?a(t,n,s):"object"==typeof n&&"string"==typeof n.id?t.get(n.id,s):o(new On("path or file descriptor of wrong type"))}function u(t,n){function e(e,i){!e&&i?n(new wn):e&&!e instanceof xn?n(e):(s=new r,t.put(s.id,s,o))}function o(e){e?n(e):(u=new i(s.rnode,jn),u.nlinks+=1,t.put(u.id,u,a))}function a(e){e?n(e):(c={},t.put(u.data,c,n))}var s,u,c;t.get(Un,e)}function c(t,e,r){function o(n,e){!n&&e?r(new wn):n&&!n instanceof xn?r(n):a(t,v,s)}function s(n,e){n?r(n):(p=e,t.get(p.data,u))}function u(n,e){n?r(n):(d=e,l=new i(void 0,jn),l.nlinks+=1,t.put(l.id,l,c))}function c(n){n?r(n):(h={},t.put(l.data,h,f))}function f(e){e?r(e):(d[g]=new n(l.id,jn),t.put(p.data,d,r))}e=gn(e);var l,h,p,d,g=yn(e),v=vn(e);a(t,e,o)}function f(t,n,e){function r(n,r){n?e(n):(p=r,t.get(p.data,i))}function i(n,r){n?e(n):Fn==g?e(new _n):dn(r).has(g)?(d=r,l=d[g].id,t.get(l,o)):e(new xn)}function o(n,r){n?e(n):r.mode!=jn?e(new An):(l=r,t.get(l.data,s))}function s(t,n){t?e(t):(h=n,dn(h).size()>0?e(new kn):u())}function u(){delete d[g],t.put(p.data,d,c)}function c(n){n?e(n):t.delete(l.id,f)}function f(n){n?e(n):t.delete(l.data,e)}n=gn(n);var l,h,p,d,g=yn(n),v=vn(n);a(t,v,r)}function l(t,e,r,o){function s(n,e){n?o(n):(v=e,t.get(v.data,u))}function u(n,e){n?o(n):(y=e,dn(y).has(E)?dn(r).contains(Kn)?o(new xn("O_CREATE and O_EXCLUSIVE are set, and the named file exists")):(m=y[E],m.type==jn&&dn(r).contains(Yn)?o(new En("the named file is a directory and O_WRITE is set")):t.get(m.id,c)):dn(r).contains(Xn)?h():o(new xn("O_CREATE is not set and the named file does not exist")))}function c(t,n){if(t)o(t);else{var e=n;e.mode==zn?(_++,_>Ln?o(new Cn("too many symbolic links were encountered")):f(e.data)):l(void 0,e)}}function f(n){n=gn(n),x=vn(n),E=yn(n),Fn==E&&(dn(r).contains(Yn)?o(new En("the named file is a directory and O_WRITE is set")):a(t,e,l)),a(t,x,s)}function l(t,n){t?o(t):(b=n,o(null,b))}function h(){b=new i(void 0,Mn),b.nlinks+=1,t.put(b.id,b,p)}function p(n){n?o(n):(w=new Uint8Array(0),t.put(b.data,w,d))}function d(e){e?o(e):(y[E]=new n(b.id,Mn),t.put(v.data,y,g))}function g(t){t?o(t):o(null,b)}e=gn(e);var v,y,m,b,w,E=yn(e),x=vn(e),_=0;Fn==E?dn(r).contains(Yn)?o(new En("the named file is a directory and O_WRITE is set")):a(t,e,l):a(t,x,s)}function h(t,n,e,r,i,o){function a(t){t?o(t):o(null,i)}function s(n){n?o(n):t.put(c.id,c,a)}function u(a,u){if(a)o(a);else{c=u;var f=new Uint8Array(i),l=e.subarray(r,r+i);f.set(l),n.position=i,c.size=i,c.mtime=Date.now(),c.version+=1,t.put(c.data,f,s)}}var c;t.get(n.id,u)}function p(t,n,e,r,i,o,a){function s(t){t?a(t):a(null,i)}function u(n){n?a(n):t.put(l.id,l,s)}function c(s,c){if(s)a(s);else{h=c;var f=void 0!==o&&null!==o?o:n.position,p=Math.max(h.length,f+i),d=new Uint8Array(p);h&&d.set(h);var g=e.subarray(r,r+i);d.set(g,f),void 0===o&&(n.position+=i),l.size=p,l.mtime=Date.now(),l.version+=1,t.put(l.data,d,u)}}function f(n,e){n?a(n):(l=e,t.get(l.data,c))}var l,h;t.get(n.id,f)}function d(t,n,e,r,i,o,a){function s(t,s){if(t)a(t);else{f=s;var u=void 0!==o&&null!==o?o:n.position;i=u+i>e.length?i-u:i;var c=f.subarray(u,u+i);e.set(c,r),void 0===o&&(n.position+=i),a(null,i)}}function u(n,e){n?a(n):(c=e,t.get(c.data,s))}var c,f;t.get(n.id,u)}function g(t,n,e){function r(t,n){t?e(t):e(null,n)}n=gn(n),yn(n),a(t,n,r)}function v(t,n,e){function r(t,n){t?e(t):e(null,n)}t.get(n.id,r)}function y(t,n,e){function r(n,r){n?e(n):(s=r,t.get(s.data,i))}function i(n,r){n?e(n):(u=r,dn(u).has(c)?t.get(u[c].id,o):e(new xn("a component of the path does not name an existing file")))}function o(t,n){t?e(t):e(null,n)}n=gn(n);var s,u,c=yn(n),f=vn(n);Fn==c?a(t,n,o):a(t,f,r)}function m(t,n,e,r){function i(n,e){n?r(n):(y=e,y.nlinks+=1,t.put(y.id,y,r))}function o(n){n?r(n):t.get(v[m].id,i)}function s(n,e){n?r(n):(v=e,dn(v).has(m)?r(new wn("newpath resolves to an existing file")):(v[m]=d[l],t.put(g.data,v,o)))}function u(n,e){n?r(n):(g=e,t.get(g.data,s))}function c(n,e){n?r(n):(d=e,dn(d).has(l)?a(t,b,u):r(new xn("a component of either path prefix does not exist")))}function f(n,e){n?r(n):(p=e,t.get(p.data,c))}n=gn(n);var l=yn(n),h=vn(n);e=gn(e);var p,d,g,v,y,m=yn(e),b=vn(e);a(t,h,f)}function b(t,n,e){function r(n){n?e(n):(delete f[h],t.put(c.data,f,e))}function i(n){n?e(n):t.delete(l.data,r)}function o(n,o){n?e(n):(l=o,l.nlinks-=1,1>l.nlinks?t.delete(l.id,i):t.put(l.id,l,r))}function s(n,r){n?e(n):(f=r,dn(f).has(h)?t.get(f[h].id,o):e(new xn("a component of the path does not name an existing file")))}function u(n,r){n?e(n):(c=r,t.get(c.data,s))}n=gn(n);var c,f,l,h=yn(n),p=vn(n);a(t,p,u)}function w(t,n,e){function r(t,n){if(t)e(t);else{s=n;var r=Object.keys(s);e(null,r)}}function i(n,i){n?e(n):(o=i,t.get(o.data,r))}n=gn(n),yn(n);var o,s;a(t,n,i)}function E(t,e,r,o){function s(n,e){n?o(n):(l=e,t.get(l.data,u))}function u(t,n){t?o(t):(h=n,dn(h).has(d)?o(new wn("the destination path already exists")):c())}function c(){p=new i(void 0,zn),p.nlinks+=1,p.size=e.length,p.data=e,t.put(p.id,p,f)}function f(e){e?o(e):(h[d]=new n(p.id,zn),t.put(l.data,h,o))}r=gn(r);var l,h,p,d=yn(r),g=vn(r);Fn==d?o(new wn("the destination path already exists")):a(t,g,s)}function x(t,n,e){function r(n,r){n?e(n):(s=r,t.get(s.data,i))}function i(n,r){n?e(n):(u=r,dn(u).has(c)?t.get(u[c].id,o):e(new xn("a component of the path does not name an existing file")))}function o(t,n){t?e(t):n.mode!=zn?e(new On("path not a symbolic link")):e(null,n.data)}n=gn(n);var s,u,c=yn(n),f=vn(n);a(t,f,r)}function _(t,n,e,r){function i(n,e){n?r(n):e.mode==jn?r(new En("the named file is a directory")):(u=e,t.get(u.data,o))}function o(n,i){if(n)r(n);else{var o=new Uint8Array(e);i&&o.set(i.subarray(0,e)),t.put(u.data,o,s)}}function s(n){n?r(n):(u.size=e,u.mtime=Date.now(),u.version+=1,t.put(u.id,u,r))}n=gn(n);var u;0>e?r(new On("length cannot be negative")):a(t,n,i)}function k(t,n,e,r){function i(n,e){n?r(n):e.mode==jn?r(new En("the named file is a directory")):(s=e,t.get(s.data,o))}function o(n,i){if(n)r(n);else{var o=new Uint8Array(e);i&&o.set(i.subarray(0,e)),t.put(s.data,o,a)}}function a(n){n?r(n):(s.size=e,s.mtime=Date.now(),s.version+=1,t.put(s.id,s,r))}var s;0>e?r(new On("length cannot be negative")):t.get(n.id,i)}function A(t,n,e,r,i){function o(n,o){n?i(n):(o.atime=e,o.mtime=r,t.put(o.id,o,i))}n=gn(n),"number"!=typeof e||"number"!=typeof r?i(new On("atime and mtime must be number")):0>e||0>r?i(new On("atime and mtime must be positive integers")):a(t,n,o)}function S(t,n,e,r,i){function o(n,o){n?i(n):(o.atime=e,o.mtime=r,t.put(o.id,o,i))}"number"!=typeof e||"number"!=typeof r?i(new On("atime and mtime must be a number")):0>e||0>r?i(new On("atime and mtime must be positive integers")):t.get(n.id,o)}function O(t,n,e,r,i,o){n=gn(n),"string"!=typeof e?o(new On("attribute name must be a string")):e?null!==i&&i!==Qn&&i!==Gn?o(new On("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE")):s(t,n,e,r,i,o):o(new On("attribute name cannot be an empty string"))}function R(t,n,e,r,i,o){"string"!=typeof e?o(new On("attribute name must be a string")):e?null!==i&&i!==Qn&&i!==Gn?o(new On("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE")):s(t,n,e,r,i,o):o(new On("attribute name cannot be an empty string"))}function C(t,n,e,r){function i(t,n){n?n.xattrs[e]:null,t?r(t):n.xattrs.hasOwnProperty(e)?r(null,n.xattrs[e]):r(new Dn("attribute does not exist"))}n=gn(n),"string"!=typeof e?r(new On("attribute name must be a string")):e?a(t,n,i):r(new On("attribute name cannot be an empty string"))}function I(t,n,e,r){function i(t,n){n?n.xattrs[e]:null,t?r(t):n.xattrs.hasOwnProperty(e)?r(null,n.xattrs[e]):r(new Dn("attribute does not exist"))}"string"!=typeof e?r(new On("attribute name must be a string")):e?t.get(n.id,i):r(new On("attribute name cannot be an empty string"))}function D(t,n,e,r){function i(n,i){var o=i?i.xattrs:null;n?r(n):o.hasOwnProperty(e)?(delete i.xattrs[e],t.put(i.id,i,r)):r(new Dn("attribute does not exist"))}n=gn(n),"string"!=typeof e?r(new On("attribute name must be a string")):e?a(t,n,i):r(new On("attribute name cannot be an empty string"))}function T(t,n,e,r){function i(n,i){n?r(n):i.xattrs.hasOwnProperty(e)?(delete i.xattrs[e],t.put(i.id,i,r)):r(new Dn("attribute does not exist"))}"string"!=typeof e?r(new On("attribute name must be a string")):e?t.get(n.id,i):r(new On("attribute name cannot be an empty string"))}function B(t){return dn(Zn).has(t)?Zn[t]:null}function M(t,n,e){return t?"function"==typeof t?t={encoding:n,flag:e}:"string"==typeof t&&(t={encoding:t,flag:e}):t={encoding:n,flag:e},t}function j(t,n){if(-1!==(""+t).indexOf("\0")){var e=Error("Path must be a string without null bytes.");return n(e),!1}return!0}function z(t){return"function"==typeof t?t:function(t){if(t)throw t}}function N(t,n){function e(){l.forEach(function(t){t.call(this)}.bind(s)),l=null}t=t||{},n=n||bn;var r=t.name||Tn,i=t.flags,o=t.provider||new $n.Default(r),a=dn(i).contains(Bn),s=this;s.readyState=Wn,s.name=r,s.error=null;var c={},f=1;Object.defineProperty(this,"openFiles",{get:function(){return c}}),this.allocDescriptor=function(t){var n=f++;return c[n]=t,n},this.releaseDescriptor=function(t){delete c[t]};var l=[];this.queueOrRun=function(t){var n;return Pn==s.readyState?t.call(s):qn==s.readyState?n=new In("unknown error"):l.push(t),n},o.open(function(t,r){function i(t){s.provider=o,t?s.readyState=qn:(s.readyState=Pn,e()),n(t,s)}if(t)return i(t);if(!a&&!r)return i(null);var c=o.getReadWriteContext();c.clear(function(t){return t?(i(t),void 0):(u(c,i),void 0)})})}function F(t,n,r,i,o){function a(n,r){if(n)o(n);else{var a;a=dn(i).contains(Vn)?r.size:0;var s=new e(r.id,i,a),u=t.allocDescriptor(s);o(null,u)}}j(r,o)&&(i=B(i),i||o(new On("flags is not valid")),l(n,r,i,a))}function U(t,n,e){dn(t.openFiles).has(n)?(t.releaseDescriptor(n),e(null)):e(new Sn("invalid file descriptor"))}function L(t,n,e){function r(t){t?e(t):e(null)}j(n,e)&&c(t,n,r)}function P(t,n,e){function r(t){t?e(t):e(null)}j(n,e)&&f(t,n,r)}function W(t,n,e,r){function i(t,e){if(t)r(t);else{var i=new o(e,n);r(null,i)}}j(e,r)&&g(t,e,i)}function q(t,n,e,r){function i(n,e){if(n)r(n);else{var i=new o(e,t.name);r(null,i)}}var a=t.openFiles[e];a?v(n,a,i):r(new Sn("invalid file descriptor"))}function H(t,n,e,r){function i(t){t?r(t):r(null)}j(n,r)&&j(e,r)&&m(t,n,e,i)}function Y(t,n,e){function r(t){t?e(t):e(null)}j(n,e)&&b(t,n,r)}function X(t,n,e,r,i,o,a,s){function u(t,n){t?s(t):s(null,n)}i=void 0===i?0:i,o=void 0===o?r.length-i:o;var c=t.openFiles[e];c?dn(c.flags).contains(Hn)?d(n,c,r,i,o,a,u):s(new Sn("descriptor does not permit reading")):s(new Sn("invalid file descriptor"))}function K(t,n,r,i,a){if(i=M(i,null,"r"),j(r,a)){var s=B(i.flag||"r");s||a(new On("flags is not valid")),l(n,r,s,function(r,u){if(r)return a(r);var c=new e(u.id,s,0),f=t.allocDescriptor(c);v(n,c,function(e,r){if(e)return a(e);var s=new o(r,t.name),u=s.size,l=new Uint8Array(u);d(n,c,l,0,u,0,function(n){if(n)return a(n);t.releaseDescriptor(f);var e;e="utf8"===i.encoding?new TextDecoder("utf-8").decode(l):l,a(null,e)})})})}}function V(t,n,e,r,i,o,a,s){function u(t,n){t?s(t):s(null,n)}i=void 0===i?0:i,o=void 0===o?r.length-i:o;var c=t.openFiles[e];c?dn(c.flags).contains(Yn)?o>r.length-i?s(new Rn("intput buffer is too small")):p(n,c,r,i,o,a,u):s(new Sn("descriptor does not permit writing")):s(new Sn("invalid file descriptor"))}function Z(t,n,r,i,o,a){if(o=M(o,"utf8","w"),j(r,a)){var s=B(o.flag||"w");s||a(new On("flags is not valid")),i=i||"","number"==typeof i&&(i=""+i),"string"==typeof i&&"utf8"===o.encoding&&(i=new TextEncoder("utf-8").encode(i)),l(n,r,s,function(r,o){if(r)return a(r);var u=new e(o.id,s,0),c=t.allocDescriptor(u);h(n,u,i,0,i.length,function(n){return n?a(n):(t.releaseDescriptor(c),a(null),void 0)})})}}function Q(t,n,r,i,o,a){if(o=M(o,"utf8","a"),j(r,a)){var s=B(o.flag||"a");s||a(new On("flags is not valid")),i=i||"","number"==typeof i&&(i=""+i),"string"==typeof i&&"utf8"===o.encoding&&(i=new TextEncoder("utf-8").encode(i)),l(n,r,s,function(r,o){if(r)return a(r);var u=new e(o.id,s,o.size),c=t.allocDescriptor(u);p(n,u,i,0,i.length,u.position,function(n){return n?a(n):(t.releaseDescriptor(c),a(null),void 0)})})}}function G(t,n,e,r){function i(t,n){t?r(t):r(null,n)}j(n,r)&&C(t,n,e,i)}function $(t,n,e,r,i){function o(t,n){t?i(t):i(null,n)}var a=t.openFiles[e];a?I(n,a,r,o):i(new Sn("invalid file descriptor"))}function J(t,n,e,r,i,o){function a(t){t?o(t):o(null)}j(n,o)&&O(t,n,e,r,i,a)}function tn(t,n,e,r,i,o,a){function s(t){t?a(t):a(null)}var u=t.openFiles[e];u?dn(u.flags).contains(Yn)?R(n,u,r,i,o,s):a(new Sn("descriptor does not permit writing")):a(new Sn("invalid file descriptor")) -}function nn(t,n,e,r){function i(t){t?r(t):r(null)}j(n,r)&&D(t,n,e,i)}function en(t,n,e,r,i){function o(t){t?i(t):i(null)}var a=t.openFiles[e];a?dn(a.flags).contains(Yn)?T(n,a,r,o):i(new Sn("descriptor does not permit writing")):i(new Sn("invalid file descriptor"))}function rn(t,n,e,r,i,o){function a(t,n){t?o(t):0>n.size+r?o(new On("resulting file offset would be negative")):(s.position=n.size+r,o(null,s.position))}var s=t.openFiles[e];s||o(new Sn("invalid file descriptor")),"SET"===i?0>r?o(new On("resulting file offset would be negative")):(s.position=r,o(null,s.position)):"CUR"===i?0>s.position+r?o(new On("resulting file offset would be negative")):(s.position+=r,o(null,s.position)):"END"===i?v(n,s,a):o(new On("whence argument is not a proper value"))}function on(t,n,e){function r(t,n){t?e(t):e(null,n)}j(n,e)&&w(t,n,r)}function an(t,n,e,r,i){function o(t){t?i(t):i(null)}if(j(n,i)){var a=Date.now();e=e?e:a,r=r?r:a,A(t,n,e,r,o)}}function sn(t,n,e,r,i,o){function a(t){t?o(t):o(null)}var s=Date.now();r=r?r:s,i=i?i:s;var u=t.openFiles[e];u?dn(u.flags).contains(Yn)?S(n,u,r,i,a):o(new Sn("descriptor does not permit writing")):o(new Sn("invalid file descriptor"))}function un(t,n,e,r){function i(t){t?r(t):r(null)}function o(e){e?r(e):b(t,n,i)}j(n,r)&&j(e,r)&&m(t,n,e,o)}function cn(t,n,e,r){function i(t){t?r(t):r(null)}j(n,r)&&j(e,r)&&E(t,n,e,i)}function fn(t,n,e){function r(t,n){t?e(t):e(null,n)}j(n,e)&&x(t,n,r)}function ln(t,n,e,r){function i(n,e){if(n)r(n);else{var i=new o(e,t.name);r(null,i)}}j(e,r)&&y(n,e,i)}function hn(t,n,e,r){function i(t){t?r(t):r(null)}j(n,r)&&_(t,n,e,i)}function pn(t,n,e,r,i){function o(t){t?i(t):i(null)}var a=t.openFiles[e];a?dn(a.flags).contains(Yn)?k(n,a,r,o):i(new Sn("descriptor does not permit writing")):i(new Sn("invalid file descriptor"))}var dn=t("./../lib/nodash");t("./../lib/encoding");var gn=t("./path").normalize,vn=t("./path").dirname,yn=t("./path").basename,mn=t("./shared").guid;t("./shared").hash;var bn=t("./shared").nop,wn=t("./error").EExists,En=t("./error").EIsDirectory,xn=t("./error").ENoEntry,_n=t("./error").EBusy,kn=t("./error").ENotEmpty,An=t("./error").ENotDirectory,Sn=t("./error").EBadFileDescriptor;t("./error").ENotImplemented,t("./error").ENotMounted;var On=t("./error").EInvalid,Rn=t("./error").EIO,Cn=t("./error").ELoop,In=t("./error").EFileSystemError,Dn=t("./error").ENoAttr,Tn=t("./constants").FILE_SYSTEM_NAME,Bn=t("./constants").FS_FORMAT,Mn=t("./constants").MODE_FILE,jn=t("./constants").MODE_DIRECTORY,zn=t("./constants").MODE_SYMBOLIC_LINK,Nn=t("./constants").MODE_META,Fn=t("./constants").ROOT_DIRECTORY_NAME,Un=t("./constants").SUPER_NODE_ID,Ln=t("./constants").SYMLOOP_MAX,Pn=t("./constants").FS_READY,Wn=t("./constants").FS_PENDING,qn=t("./constants").FS_ERROR,Hn=t("./constants").O_READ,Yn=t("./constants").O_WRITE,Xn=t("./constants").O_CREATE,Kn=t("./constants").O_EXCLUSIVE;t("./constants").O_TRUNCATE;var Vn=t("./constants").O_APPEND,Zn=t("./constants").O_FLAGS,Qn=t("./constants").XATTR_CREATE,Gn=t("./constants").XATTR_REPLACE,$n=t("src/providers/providers"),Jn=t("src/adapters/adapters"),te=t("src/shell");return N.providers=$n,N.adapters=Jn,N.prototype.open=function(t,n,e,r){r=z(arguments[arguments.length-1]);var i=this,o=i.queueOrRun(function(){var e=i.provider.getReadWriteContext();F(i,e,t,n,r)});o&&r(o)},N.prototype.close=function(t,n){U(this,t,z(n))},N.prototype.mkdir=function(t,n,e){"function"==typeof n&&(e=n),e=z(e);var r=this,i=r.queueOrRun(function(){var n=r.provider.getReadWriteContext();L(n,t,e)});i&&e(i)},N.prototype.rmdir=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();P(r,t,n)});r&&n(r)},N.prototype.stat=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();W(r,e.name,t,n)});r&&n(r)},N.prototype.fstat=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();q(e,r,t,n)});r&&n(r)},N.prototype.link=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();H(i,t,n,e)});i&&e(i)},N.prototype.unlink=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();Y(r,t,n)});r&&n(r)},N.prototype.read=function(t,n,e,r,i,o){function a(t,e){o(t,e||0,n)}o=z(o);var s=this,u=s.queueOrRun(function(){var o=s.provider.getReadWriteContext();X(s,o,t,n,e,r,i,a)});u&&o(u)},N.prototype.readFile=function(t,n){var e=z(arguments[arguments.length-1]),r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();K(r,i,t,n,e)});i&&e(i)},N.prototype.write=function(t,n,e,r,i,o){o=z(o);var a=this,s=a.queueOrRun(function(){var s=a.provider.getReadWriteContext();V(a,s,t,n,e,r,i,o)});s&&o(s)},N.prototype.writeFile=function(t,n,e){var r=z(arguments[arguments.length-1]),i=this,o=i.queueOrRun(function(){var o=i.provider.getReadWriteContext();Z(i,o,t,n,e,r)});o&&r(o)},N.prototype.appendFile=function(t,n,e){var r=z(arguments[arguments.length-1]),i=this,o=i.queueOrRun(function(){var o=i.provider.getReadWriteContext();Q(i,o,t,n,e,r)});o&&r(o)},N.prototype.lseek=function(t,n,e,r){r=z(r);var i=this,o=i.queueOrRun(function(){var o=i.provider.getReadWriteContext();rn(i,o,t,n,e,r)});o&&r(o)},N.prototype.readdir=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();on(r,t,n)});r&&n(r)},N.prototype.rename=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();un(i,t,n,e)});i&&e(i)},N.prototype.readlink=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();fn(r,t,n)});r&&n(r)},N.prototype.symlink=function(t,n){var e=z(arguments[arguments.length-1]),r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();cn(i,t,n,e)});i&&e(i)},N.prototype.lstat=function(t,n){n=z(n);var e=this,r=e.queueOrRun(function(){var r=e.provider.getReadWriteContext();ln(e,r,t,n)});r&&n(r)},N.prototype.truncate=function(t,n,e){"function"==typeof n&&(e=n,n=0),e=z(e),n="number"==typeof n?n:0;var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();hn(i,t,n,e)});i&&e(i)},N.prototype.ftruncate=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();pn(r,i,t,n,e)});i&&e(i)},N.prototype.utimes=function(t,n,e,r){r=z(r);var i=this,o=i.queueOrRun(function(){var o=i.provider.getReadWriteContext();an(o,t,n,e,r)});o&&r(o)},N.prototype.futimes=function(t,n,e,r){r=z(r);var i=this,o=i.queueOrRun(function(){var o=i.provider.getReadWriteContext();sn(i,o,t,n,e,r)});o&&r(o)},N.prototype.setxattr=function(t,n,e,r,i){i=z(arguments[arguments.length-1]);var o="function"!=typeof r?r:null,a=this,s=a.queueOrRun(function(){var r=a.provider.getReadWriteContext();J(r,t,n,e,o,i)});s&&i(s)},N.prototype.getxattr=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();G(i,t,n,e)});i&&e(i)},N.prototype.fsetxattr=function(t,n,e,r,i){i=z(arguments[arguments.length-1]);var o="function"!=typeof r?r:null,a=this,s=a.queueOrRun(function(){var r=a.provider.getReadWriteContext();tn(a,r,t,n,e,o,i)});s&&i(s)},N.prototype.fgetxattr=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();$(r,i,t,n,e)});i&&e(i)},N.prototype.removexattr=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();nn(i,t,n,e)});i&&e(i)},N.prototype.fremovexattr=function(t,n,e){e=z(e);var r=this,i=r.queueOrRun(function(){var i=r.provider.getReadWriteContext();en(r,i,t,n,e)});i&&e(i)},N.prototype.Shell=function(t){return new te(this,t)},N}),e("src/index",["require","./fs","./path","./error"],function(t){return{FileSystem:t("./fs"),Path:t("./path"),Errors:t("./error")}});var i=n("src/index");return i}); \ No newline at end of file +/*! filer 2014-03-06 */ +(function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Filer||(t.Filer=e())})(this,function(){var t,e,n;(function(r){function o(t,e){return b.call(t,e)}function i(t,e){var n,r,o,i,s,a,c,u,f,l,p=e&&e.split("/"),h=m.map,d=h&&h["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=p.concat(t.split("/")),u=0;t.length>u;u+=1)if(l=t[u],"."===l)t.splice(u,1),u-=1;else if(".."===l){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||d)&&h){for(n=t.split("/"),u=n.length;u>0;u-=1){if(r=n.slice(0,u).join("/"),p)for(f=p.length;f>0;f-=1)if(o=h[p.slice(0,f).join("/")],o&&(o=o[r])){i=o,s=u;break}if(i)break;!a&&d&&d[r]&&(a=d[r],c=u)}!i&&a&&(i=a,s=c),i&&(n.splice(0,s,i),t=n.join("/"))}return t}function s(t,e){return function(){return h.apply(r,w.call(arguments,0).concat([t,e]))}}function a(t){return function(e){return i(e,t)}}function c(t){return function(e){g[t]=e}}function u(t){if(o(v,t)){var e=v[t];delete v[t],E[t]=!0,p.apply(r,e)}if(!o(g,t)&&!o(E,t))throw Error("No "+t);return g[t]}function f(t){var e,n=t?t.indexOf("!"):-1;return n>-1&&(e=t.substring(0,n),t=t.substring(n+1,t.length)),[e,t]}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var p,h,d,y,g={},v={},m={},E={},b=Object.prototype.hasOwnProperty,w=[].slice;d=function(t,e){var n,r=f(t),o=r[0];return t=r[1],o&&(o=i(o,e),n=u(o)),o?t=n&&n.normalize?n.normalize(t,a(e)):i(t,e):(t=i(t,e),r=f(t),o=r[0],t=r[1],o&&(n=u(o))),{f:o?o+"!"+t:t,n:t,pr:o,p:n}},y={require:function(t){return s(t)},exports:function(t){var e=g[t];return e!==void 0?e:g[t]={}},module:function(t){return{id:t,uri:"",exports:g[t],config:l(t)}}},p=function(t,e,n,i){var a,f,l,p,h,m,b=[];if(i=i||t,"function"==typeof n){for(e=!e.length&&n.length?["require","exports","module"]:e,h=0;e.length>h;h+=1)if(p=d(e[h],i),f=p.f,"require"===f)b[h]=y.require(t);else if("exports"===f)b[h]=y.exports(t),m=!0;else if("module"===f)a=b[h]=y.module(t);else if(o(g,f)||o(v,f)||o(E,f))b[h]=u(f);else{if(!p.p)throw Error(t+" missing "+f);p.p.load(p.n,s(i,!0),c(f),{}),b[h]=g[f]}l=n.apply(g[t],b),t&&(a&&a.exports!==r&&a.exports!==g[t]?g[t]=a.exports:l===r&&m||(g[t]=l))}else t&&(g[t]=n)},t=e=h=function(t,e,n,o,i){return"string"==typeof t?y[t]?y[t](e):u(d(t,e).f):(t.splice||(m=t,e.splice?(t=e,e=n,n=null):t=r),e=e||function(){},"function"==typeof n&&(n=o,o=i),o?p(r,t,e,n):setTimeout(function(){p(r,t,e,n)},4),h)},h.config=function(t){return m=t,m.deps&&h(m.deps,m.callback),h},n=function(t,e,n){e.splice||(n=e,e=[]),o(g,t)||o(v,t)||(v[t]=[t,e,n])},n.amd={jQuery:!0}})(),n("build/almond",function(){}),n("lib/nodash",["require"],function(){function t(t,e){return h.call(t,e)}function e(t){return null==t?0:t.length===+t.length?t.length:g(t).length}function n(t){return t}function r(t,e,n){var r,o;if(null!=t)if(u&&t.forEach===u)t.forEach(e,n);else if(t.length===+t.length){for(r=0,o=t.length;o>r;r++)if(e.call(n,t[r],r,t)===y)return}else{var i=i(t);for(r=0,o=i.length;o>r;r++)if(e.call(n,t[i[r]],i[r],t)===y)return}}function o(t,e,o){e||(e=n);var i=!1;return null==t?i:l&&t.some===l?t.some(e,o):(r(t,function(t,n,r){return i||(i=e.call(o,t,n,r))?y:void 0}),!!i)}function i(t,e){return null==t?!1:f&&t.indexOf===f?-1!=t.indexOf(e):o(t,function(t){return t===e})}function s(t){this.value=t}function a(t){return t&&"object"==typeof t&&!Array.isArray(t)&&h.call(t,"__wrapped__")?t:new s(t)}var c=Array.prototype,u=c.forEach,f=c.indexOf,l=c.some,p=Object.prototype,h=p.hasOwnProperty,d=Object.keys,y={},g=d||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var n=[];for(var r in e)t(e,r)&&n.push(r);return n};return s.prototype.has=function(e){return t(this.value,e)},s.prototype.contains=function(t){return i(this.value,t)},s.prototype.size=function(){return e(this.value)},a}),function(t){function e(t,e,n){return t>=e&&n>=t}function n(t,e){return Math.floor(t/e)}function r(t){var e=0;this.get=function(){return e>=t.length?j:Number(t[e])},this.offset=function(n){if(e+=n,0>e)throw Error("Seeking past start of the buffer");if(e>t.length)throw Error("Seeking past EOF")},this.match=function(n){if(n.length>e+t.length)return!1;var r;for(r=0;n.length>r;r+=1)if(Number(t[e+r])!==n[r])return!1;return!0}}function o(t){var e=0;this.emit=function(){var n,r=j;for(n=0;arguments.length>n;++n)r=Number(arguments[n]),t[e++]=r;return r}}function i(t){function n(t){for(var n=[],r=0,o=t.length;t.length>r;){var i=t.charCodeAt(r);if(e(i,55296,57343))if(e(i,56320,57343))n.push(65533);else if(r===o-1)n.push(65533);else{var s=t.charCodeAt(r+1);if(e(s,56320,57343)){var a=1023&i,c=1023&s;r+=1,n.push(65536+(a<<10)+c)}else n.push(65533)}else n.push(i);r+=1}return n}var r=0,o=n(t);this.offset=function(t){if(r+=t,0>r)throw Error("Seeking past start of the buffer");if(r>o.length)throw Error("Seeking past EOF")},this.get=function(){return r>=o.length?z:o[r]}}function s(){var t="";this.string=function(){return t},this.emit=function(e){65535>=e?t+=String.fromCharCode(e):(e-=65536,t+=String.fromCharCode(55296+(1023&e>>10)),t+=String.fromCharCode(56320+(1023&e)))}}function a(t){this.name="EncodingError",this.message=t,this.code=0}function c(t,e){if(t)throw new a("Decoder error");return e||65533}function u(t){throw new a("The code point "+t+" could not be encoded.")}function f(t){return t=(t+"").trim().toLowerCase(),Object.prototype.hasOwnProperty.call(W,t)?W[t]:null}function l(t,e){return(e||[])[t]||null}function p(t,e){var n=e.indexOf(t);return-1===n?null:n}function h(e){if(!("encoding-indexes"in t))throw Error("Indexes missing. Did you forget to include encoding-indexes.js?");return t["encoding-indexes"][e]}function d(t){if(t>39419&&189e3>t||t>1237575)return null;var e,n=0,r=0,o=h("gb18030");for(e=0;o.length>e;++e){var i=o[e];if(!(t>=i[0]))break;n=i[0],r=i[1]}return r+t-n}function y(t){var e,n=0,r=0,o=h("gb18030");for(e=0;o.length>e;++e){var i=o[e];if(!(t>=i[1]))break;n=i[1],r=i[0]}return r+t-n}function g(t){var n=t.fatal,r=0,o=0,i=0,s=0;this.decode=function(t){var a=t.get();if(a===j)return 0!==o?c(n):z;if(t.offset(1),0===o){if(e(a,0,127))return a;if(e(a,194,223))o=1,s=128,r=a-192;else if(e(a,224,239))o=2,s=2048,r=a-224;else{if(!e(a,240,244))return c(n);o=3,s=65536,r=a-240}return r*=Math.pow(64,o),null}if(!e(a,128,191))return r=0,o=0,i=0,s=0,t.offset(-1),c(n);if(i+=1,r+=(a-128)*Math.pow(64,o-i),i!==o)return null;var u=r,f=s;return r=0,o=0,i=0,s=0,e(u,f,1114111)&&!e(u,55296,57343)?u:c(n)}}function v(t){t.fatal,this.encode=function(t,r){var o=r.get();if(o===z)return j;if(r.offset(1),e(o,55296,57343))return u(o);if(e(o,0,127))return t.emit(o);var i,s;e(o,128,2047)?(i=1,s=192):e(o,2048,65535)?(i=2,s=224):e(o,65536,1114111)&&(i=3,s=240);for(var a=t.emit(n(o,Math.pow(64,i))+s);i>0;){var c=n(o,Math.pow(64,i-1));a=t.emit(128+c%64),i-=1}return a}}function m(t,n){var r=n.fatal;this.decode=function(n){var o=n.get();if(o===j)return z;if(n.offset(1),e(o,0,127))return o;var i=t[o-128];return null===i?c(r):i}}function E(t,n){n.fatal,this.encode=function(n,r){var o=r.get();if(o===z)return j;if(r.offset(1),e(o,0,127))return n.emit(o);var i=p(o,t);return null===i&&u(o),n.emit(i+128)}}function b(t,n){var r=n.fatal,o=0,i=0,s=0;this.decode=function(n){var a=n.get();if(a===j&&0===o&&0===i&&0===s)return z;a!==j||0===o&&0===i&&0===s||(o=0,i=0,s=0,c(r)),n.offset(1);var u;if(0!==s)return u=null,e(a,48,57)&&(u=d(10*(126*(10*(o-129)+(i-48))+(s-129))+a-48)),o=0,i=0,s=0,null===u?(n.offset(-3),c(r)):u;if(0!==i)return e(a,129,254)?(s=a,null):(n.offset(-2),o=0,i=0,c(r));if(0!==o){if(e(a,48,57)&&t)return i=a,null;var f=o,p=null;o=0;var y=127>a?64:65;return(e(a,64,126)||e(a,128,254))&&(p=190*(f-129)+(a-y)),u=null===p?null:l(p,h("gbk")),null===p&&n.offset(-1),null===u?c(r):u}return e(a,0,127)?a:128===a?8364:e(a,129,254)?(o=a,null):c(r)}}function w(t,r){r.fatal,this.encode=function(r,o){var i=o.get();if(i===z)return j;if(o.offset(1),e(i,0,127))return r.emit(i);var s=p(i,h("gbk"));if(null!==s){var a=n(s,190)+129,c=s%190,f=63>c?64:65;return r.emit(a,c+f)}if(null===s&&!t)return u(i);s=y(i);var l=n(n(n(s,10),126),10);s-=10*126*10*l;var d=n(n(s,10),126);s-=126*10*d;var g=n(s,10),v=s-10*g;return r.emit(l+129,d+48,g+129,v+48)}}function x(t){var n=t.fatal,r=!1,o=0;this.decode=function(t){var i=t.get();if(i===j&&0===o)return z;if(i===j&&0!==o)return o=0,c(n);if(t.offset(1),126===o)return o=0,123===i?(r=!0,null):125===i?(r=!1,null):126===i?126:10===i?null:(t.offset(-1),c(n));if(0!==o){var s=o;o=0;var a=null;return e(i,33,126)&&(a=l(190*(s-1)+(i+63),h("gbk"))),10===i&&(r=!1),null===a?c(n):a}return 126===i?(o=126,null):r?e(i,32,127)?(o=i,null):(10===i&&(r=!1),c(n)):e(i,0,127)?i:c(n)}}function _(t){t.fatal;var r=!1;this.encode=function(t,o){var i=o.get();if(i===z)return j;if(o.offset(1),e(i,0,127)&&r)return o.offset(-1),r=!1,t.emit(126,125);if(126===i)return t.emit(126,126);if(e(i,0,127))return t.emit(i);if(!r)return o.offset(-1),r=!0,t.emit(126,123);var s=p(i,h("gbk"));if(null===s)return u(i);var a=n(s,190)+1,c=s%190-63;return e(a,33,126)&&e(c,33,126)?t.emit(a,c):u(i)}}function A(t){var n=t.fatal,r=0,o=null;this.decode=function(t){if(null!==o){var i=o;return o=null,i}var s=t.get();if(s===j&&0===r)return z;if(s===j&&0!==r)return r=0,c(n);if(t.offset(1),0!==r){var a=r,u=null;r=0;var f=127>s?64:98;if((e(s,64,126)||e(s,161,254))&&(u=157*(a-129)+(s-f)),1133===u)return o=772,202;if(1135===u)return o=780,202;if(1164===u)return o=772,234;if(1166===u)return o=780,234;var p=null===u?null:l(u,h("big5"));return null===u&&t.offset(-1),null===p?c(n):p}return e(s,0,127)?s:e(s,129,254)?(r=s,null):c(n)}}function k(t){t.fatal,this.encode=function(t,r){var o=r.get();if(o===z)return j;if(r.offset(1),e(o,0,127))return t.emit(o);var i=p(o,h("big5"));if(null===i)return u(o);var s=n(i,157)+129,a=i%157,c=63>a?64:98;return t.emit(s,a+c)}}function O(t){var n=t.fatal,r=0,o=0;this.decode=function(t){var i=t.get();if(i===j)return 0===r&&0===o?z:(r=0,o=0,c(n));t.offset(1);var s,a;return 0!==o?(s=o,o=0,a=null,e(s,161,254)&&e(i,161,254)&&(a=l(94*(s-161)+i-161,h("jis0212"))),e(i,161,254)||t.offset(-1),null===a?c(n):a):142===r&&e(i,161,223)?(r=0,65377+i-161):143===r&&e(i,161,254)?(r=0,o=i,null):0!==r?(s=r,r=0,a=null,e(s,161,254)&&e(i,161,254)&&(a=l(94*(s-161)+i-161,h("jis0208"))),e(i,161,254)||t.offset(-1),null===a?c(n):a):e(i,0,127)?i:142===i||143===i||e(i,161,254)?(r=i,null):c(n)}}function S(t){t.fatal,this.encode=function(t,r){var o=r.get();if(o===z)return j;if(r.offset(1),e(o,0,127))return t.emit(o);if(165===o)return t.emit(92);if(8254===o)return t.emit(126);if(e(o,65377,65439))return t.emit(142,o-65377+161);var i=p(o,h("jis0208"));if(null===i)return u(o);var s=n(i,94)+161,a=i%94+161;return t.emit(s,a)}}function R(t){var n=t.fatal,r={ASCII:0,escape_start:1,escape_middle:2,escape_final:3,lead:4,trail:5,Katakana:6},o=r.ASCII,i=!1,s=0;this.decode=function(t){var a=t.get();switch(a!==j&&t.offset(1),o){default:case r.ASCII:return 27===a?(o=r.escape_start,null):e(a,0,127)?a:a===j?z:c(n);case r.escape_start:return 36===a||40===a?(s=a,o=r.escape_middle,null):(a!==j&&t.offset(-1),o=r.ASCII,c(n));case r.escape_middle:var u=s;return s=0,36!==u||64!==a&&66!==a?36===u&&40===a?(o=r.escape_final,null):40!==u||66!==a&&74!==a?40===u&&73===a?(o=r.Katakana,null):(a===j?t.offset(-1):t.offset(-2),o=r.ASCII,c(n)):(o=r.ASCII,null):(i=!1,o=r.lead,null);case r.escape_final:return 68===a?(i=!0,o=r.lead,null):(a===j?t.offset(-2):t.offset(-3),o=r.ASCII,c(n));case r.lead:return 10===a?(o=r.ASCII,c(n,10)):27===a?(o=r.escape_start,null):a===j?z:(s=a,o=r.trail,null);case r.trail:if(o=r.lead,a===j)return c(n);var f=null,p=94*(s-33)+a-33;return e(s,33,126)&&e(a,33,126)&&(f=i===!1?l(p,h("jis0208")):l(p,h("jis0212"))),null===f?c(n):f;case r.Katakana:return 27===a?(o=r.escape_start,null):e(a,33,95)?65377+a-33:a===j?z:c(n)}}}function C(t){t.fatal;var r={ASCII:0,lead:1,Katakana:2},o=r.ASCII;this.encode=function(t,i){var s=i.get();if(s===z)return j;if(i.offset(1),(e(s,0,127)||165===s||8254===s)&&o!==r.ASCII)return i.offset(-1),o=r.ASCII,t.emit(27,40,66);if(e(s,0,127))return t.emit(s);if(165===s)return t.emit(92);if(8254===s)return t.emit(126);if(e(s,65377,65439)&&o!==r.Katakana)return i.offset(-1),o=r.Katakana,t.emit(27,40,73);if(e(s,65377,65439))return t.emit(s-65377-33);if(o!==r.lead)return i.offset(-1),o=r.lead,t.emit(27,36,66);var a=p(s,h("jis0208"));if(null===a)return u(s);var c=n(a,94)+33,f=a%94+33;return t.emit(c,f)}}function T(t){var n=t.fatal,r=0;this.decode=function(t){var o=t.get();if(o===j&&0===r)return z;if(o===j&&0!==r)return r=0,c(n);if(t.offset(1),0!==r){var i=r;if(r=0,e(o,64,126)||e(o,128,252)){var s=127>o?64:65,a=160>i?129:193,u=l(188*(i-a)+o-s,h("jis0208"));return null===u?c(n):u}return t.offset(-1),c(n)}return e(o,0,128)?o:e(o,161,223)?65377+o-161:e(o,129,159)||e(o,224,252)?(r=o,null):c(n)}}function I(t){t.fatal,this.encode=function(t,r){var o=r.get();if(o===z)return j;if(r.offset(1),e(o,0,128))return t.emit(o);if(165===o)return t.emit(92);if(8254===o)return t.emit(126);if(e(o,65377,65439))return t.emit(o-65377+161);var i=p(o,h("jis0208"));if(null===i)return u(o);var s=n(i,188),a=31>s?129:193,c=i%188,f=63>c?64:65;return t.emit(s+a,c+f)}}function D(t){var n=t.fatal,r=0;this.decode=function(t){var o=t.get();if(o===j&&0===r)return z;if(o===j&&0!==r)return r=0,c(n);if(t.offset(1),0!==r){var i=r,s=null;if(r=0,e(i,129,198)){var a=178*(i-129);e(o,65,90)?s=a+o-65:e(o,97,122)?s=a+26+o-97:e(o,129,254)&&(s=a+26+26+o-129)}e(i,199,253)&&e(o,161,254)&&(s=12460+94*(i-199)+(o-161));var u=null===s?null:l(s,h("euc-kr"));return null===s&&t.offset(-1),null===u?c(n):u}return e(o,0,127)?o:e(o,129,253)?(r=o,null):c(n)}}function N(t){t.fatal,this.encode=function(t,r){var o=r.get();if(o===z)return j;if(r.offset(1),e(o,0,127))return t.emit(o);var i=p(o,h("euc-kr"));if(null===i)return u(o);var s,a;if(12460>i){s=n(i,178)+129,a=i%178;var c=26>a?65:52>a?71:77;return t.emit(s,a+c)}return i-=12460,s=n(i,94)+199,a=i%94+161,t.emit(s,a)}}function M(t,n){var r=n.fatal,o=null,i=null;this.decode=function(n){var s=n.get();if(s===j&&null===o&&null===i)return z;if(s===j&&(null!==o||null!==i))return c(r);if(n.offset(1),null===o)return o=s,null;var a;if(a=t?(o<<8)+s:(s<<8)+o,o=null,null!==i){var u=i;return i=null,e(a,56320,57343)?65536+1024*(u-55296)+(a-56320):(n.offset(-2),c(r))}return e(a,55296,56319)?(i=a,null):e(a,56320,57343)?c(r):a}}function B(t,r){r.fatal,this.encode=function(r,o){function i(e){var n=e>>8,o=255&e;return t?r.emit(n,o):r.emit(o,n)}var s=o.get();if(s===z)return j;if(o.offset(1),e(s,55296,57343)&&u(s),65535>=s)return i(s);var a=n(s-65536,1024)+55296,c=(s-65536)%1024+56320;return i(a),i(c)}}function F(t,e){if(!(this instanceof F))throw new TypeError("Constructor cannot be called as a function");if(t=t?t+"":q,e=Object(e),this._encoding=f(t),null===this._encoding||"utf-8"!==this._encoding.name&&"utf-16le"!==this._encoding.name&&"utf-16be"!==this._encoding.name)throw new TypeError("Unknown encoding: "+t);return this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty?Object.defineProperty(this,"encoding",{get:function(){return this._encoding.name}}):this.encoding=this._encoding.name,this}function U(t,e){if(!(this instanceof U))throw new TypeError("Constructor cannot be called as a function");if(t=t?t+"":q,e=Object(e),this._encoding=f(t),null===this._encoding)throw new TypeError("Unknown encoding: "+t);return this._streaming=!1,this._decoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty?Object.defineProperty(this,"encoding",{get:function(){return this._encoding.name}}):this.encoding=this._encoding.name,this}var j=-1,z=-1;a.prototype=Error.prototype;var P=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"utf-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"ibm866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"iso-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"iso-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"iso-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"iso-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"iso-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"iso-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"iso-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"iso-8859-8-i"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"iso-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"iso-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"iso-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"iso-8859-15"},{labels:["iso-8859-16"],name:"iso-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"koi8-r"},{labels:["koi8-u"],name:"koi8-u"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"gbk"},{labels:["gb18030"],name:"gb18030"},{labels:["hz-gb-2312"],name:"hz-gb-2312"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"euc-jp"},{labels:["csiso2022jp","iso-2022-jp"],name:"iso-2022-jp"},{labels:["csshiftjis","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"shift_jis"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"euc-kr"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","iso-2022-kr","iso-2022-cn","iso-2022-cn-ext"],name:"replacement"},{labels:["utf-16be"],name:"utf-16be"},{labels:["utf-16","utf-16le"],name:"utf-16le"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],L={},W={};P.forEach(function(t){t.encodings.forEach(function(t){L[t.name]=t,t.labels.forEach(function(e){W[e]=t})})}),L["utf-8"].getEncoder=function(t){return new v(t)},L["utf-8"].getDecoder=function(t){return new g(t)},function(){P.forEach(function(t){"Legacy single-byte encodings"===t.heading&&t.encodings.forEach(function(t){var e=h(t.name);t.getDecoder=function(t){return new m(e,t)},t.getEncoder=function(t){return new E(e,t)}})})}(),L.gbk.getEncoder=function(t){return new w(!1,t)},L.gbk.getDecoder=function(t){return new b(!1,t)},L.gb18030.getEncoder=function(t){return new w(!0,t)},L.gb18030.getDecoder=function(t){return new b(!0,t)},L["hz-gb-2312"].getEncoder=function(t){return new _(t)},L["hz-gb-2312"].getDecoder=function(t){return new x(t)},L.big5.getEncoder=function(t){return new k(t)},L.big5.getDecoder=function(t){return new A(t)},L["euc-jp"].getEncoder=function(t){return new S(t)},L["euc-jp"].getDecoder=function(t){return new O(t)},L["iso-2022-jp"].getEncoder=function(t){return new C(t)},L["iso-2022-jp"].getDecoder=function(t){return new R(t)},L.shift_jis.getEncoder=function(t){return new I(t)},L.shift_jis.getDecoder=function(t){return new T(t)},L["euc-kr"].getEncoder=function(t){return new N(t)},L["euc-kr"].getDecoder=function(t){return new D(t)},L["utf-16le"].getEncoder=function(t){return new B(!1,t)},L["utf-16le"].getDecoder=function(t){return new M(!1,t)},L["utf-16be"].getEncoder=function(t){return new B(!0,t)},L["utf-16be"].getDecoder=function(t){return new M(!0,t)};var q="utf-8";F.prototype={encode:function(t,e){t=t?t+"":"",e=Object(e),this._streaming||(this._encoder=this._encoding.getEncoder(this._options)),this._streaming=Boolean(e.stream);for(var n=[],r=new o(n),s=new i(t);s.get()!==z;)this._encoder.encode(r,s);if(!this._streaming){var a;do a=this._encoder.encode(r,s);while(a!==j);this._encoder=null}return new Uint8Array(n)}},U.prototype={decode:function(t,e){if(t&&!("buffer"in t&&"byteOffset"in t&&"byteLength"in t))throw new TypeError("Expected ArrayBufferView");t||(t=new Uint8Array(0)),e=Object(e),this._streaming||(this._decoder=this._encoding.getDecoder(this._options),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var n,o=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),i=new r(o),a=new s;i.get()!==j;)n=this._decoder.decode(i),null!==n&&n!==z&&a.emit(n);if(!this._streaming){do n=this._decoder.decode(i),null!==n&&n!==z&&a.emit(n);while(n!==z&&i.get()!=j);this._decoder=null}var c=a.string();return!this._BOMseen&&c.length&&(this._BOMseen=!0,-1!==["utf-8","utf-16le","utf-16be"].indexOf(this.encoding)&&65279===c.charCodeAt(0)&&(c=c.substring(1))),c}},t.TextEncoder=t.TextEncoder||F,t.TextDecoder=t.TextDecoder||U}(this),n("lib/encoding",function(){}),n("src/path",[],function(){function t(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];"."===o?t.splice(r,1):".."===o?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function e(){for(var e="",n=!1,r=arguments.length-1;r>=-1&&!n;r--){var o=r>=0?arguments[r]:"/";"string"==typeof o&&o&&(e=o+"/"+e,n="/"===o.charAt(0))}return e=t(e.split("/").filter(function(t){return!!t}),!n).join("/"),(n?"/":"")+e||"."}function n(e){var n="/"===e.charAt(0);return"/"===e.substr(-1),e=t(e.split("/").filter(function(t){return!!t}),!n).join("/"),e||n||(e="."),(n?"/":"")+e}function r(){var t=Array.prototype.slice.call(arguments,0);return n(t.filter(function(t){return t&&"string"==typeof t}).join("/"))}function o(t,e){function n(t){for(var e=0;t.length>e&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=exports.resolve(t).substr(1),e=exports.resolve(e).substr(1);for(var r=n(t.split("/")),o=n(e.split("/")),i=Math.min(r.length,o.length),s=i,a=0;i>a;a++)if(r[a]!==o[a]){s=a;break}for(var c=[],a=s;r.length>a;a++)c.push("..");return c=c.concat(o.slice(s)),c.join("/")}function i(t){var e=l(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function s(t,e){var n=l(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),""===n?"/":n}function a(t){return l(t)[3]}function c(t){return"/"===t.charAt(0)?!0:!1}function u(t){return-1!==(""+t).indexOf("\0")?!0:!1}var f=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/,l=function(t){var e=f.exec(t);return[e[1]||"",e[2]||"",e[3]||"",e[4]||""]};return{normalize:n,resolve:e,join:r,relative:o,sep:"/",delimiter:":",dirname:i,basename:s,extname:a,isAbsolute:c,isNull:u}});var r=r||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.$super.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,t=t.sigBytes;if(this.clamp(),r%4)for(var o=0;t>o;o++)e[r+o>>>2]|=(255&n[o>>>2]>>>24-8*(o%4))<<24-8*((r+o)%4);else if(n.length>65535)for(o=0;t>o;o+=4)e[r+o>>>2]=n[o>>>2];else e.push.apply(e,n);return this.sigBytes+=t,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-8*(n%4),e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n=[],r=0;e>r;r+=4)n.push(0|4294967296*t.random());return i.create(n,e)}}),s=n.enc={},a=s.Hex={stringify:function(t){for(var e=t.words,t=t.sigBytes,n=[],r=0;t>r;r++){var o=255&e[r>>>2]>>>24-8*(r%4);n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-4*(r%8);return i.create(n,e/2)}},c=s.Latin1={stringify:function(t){for(var e=t.words,t=t.sigBytes,n=[],r=0;t>r;r++)n.push(String.fromCharCode(255&e[r>>>2]>>>24-8*(r%4)));return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-8*(r%4);return i.create(n,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=i.create(),this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0),e=a*s,o=t.min(4*e,o);if(e){for(var c=0;e>c;c+=s)this._doProcessBlock(r,c);c=r.splice(0,e),n.sigBytes-=o}return i.create(c,o)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=f.extend({init:function(){this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize(),this._hash},clone:function(){var t=f.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:16,_createHelper:function(t){return function(e,n){return t.create(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return l.HMAC.create(t,n).finalize(e)}}});var l=n.algo={};return n}(Math);(function(t){var e=r,n=e.lib,o=n.WordArray,n=n.Hasher,i=e.algo,s=[],a=[];(function(){function e(e){for(var n=t.sqrt(e),r=2;n>=r;r++)if(!(e%r))return!1;return!0}function n(t){return 0|4294967296*(t-(0|t))}for(var r=2,o=0;64>o;)e(r)&&(8>o&&(s[o]=n(t.pow(r,.5))),a[o]=n(t.pow(r,1/3)),o++),r++})();var c=[],i=i.SHA256=n.extend({_doReset:function(){this._hash=o.create(s.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],u=n[4],f=n[5],l=n[6],p=n[7],h=0;64>h;h++){if(16>h)c[h]=0|t[e+h];else{var d=c[h-15],y=c[h-2];c[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+c[h-7]+((y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10)+c[h-16]}d=p+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&f^~u&l)+a[h]+c[h],y=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&o^r&i^o&i),p=l,l=f,f=u,u=0|s+d,s=i,i=o,o=r,r=0|d+y}n[0]=0|n[0]+r,n[1]=0|n[1]+o,n[2]=0|n[2]+i,n[3]=0|n[3]+s,n[4]=0|n[4]+u,n[5]=0|n[5]+f,n[6]=0|n[6]+l,n[7]=0|n[7]+p},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;e[r>>>5]|=128<<24-r%32,e[(r+64>>>9<<4)+15]=n,t.sigBytes=4*e.length,this._process()}});e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)})(Math),n("lib/crypto-js/rollups/sha256",function(){}),n("src/shared",["require","../lib/crypto-js/rollups/sha256"],function(t){function e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=0|16*Math.random(),n="x"==t?e:8|3&e;return n.toString(16)}).toUpperCase()}function n(t){return s.SHA256(t).toString(s.enc.hex)}function o(){}function i(t){for(var e=[],n=t.length,r=0;n>r;r++)e[r]=t[r];return e}t("../lib/crypto-js/rollups/sha256");var s=r;return{guid:e,hash:n,u8toArray:i,nop:o}}),n("src/error",["require"],function(){function t(t){this.message=t||"unknown error"}function e(t){this.message=t||"success"}function n(t){this.message=t||"end of file"}function r(t){this.message=t||"getaddrinfo error"}function o(t){this.message=t||"permission denied"}function i(t){this.message=t||"resource temporarily unavailable"}function s(t){this.message=t||"address already in use"}function a(t){this.message=t||"address not available"}function c(t){this.message=t||"address family not supported"}function u(t){this.message=t||"connection already in progress"}function f(t){this.message=t||"bad file descriptor"}function l(t){this.message=t||"resource busy or locked"}function p(t){this.message=t||"software caused connection abort"}function h(t){this.message=t||"connection refused"}function d(t){this.message=t||"connection reset by peer"}function y(t){this.message=t||"destination address required"}function g(t){this.message=t||"bad address in system call argument"}function v(t){this.message=t||"host is unreachable"}function m(t){this.message=t||"interrupted system call"}function E(t){this.message=t||"invalid argument"}function b(t){this.message=t||"socket is already connected"}function w(t){this.message=t||"too many open files"}function x(t){this.message=t||"message too long"}function _(t){this.message=t||"network is down"}function A(t){this.message=t||"network is unreachable"}function k(t){this.message=t||"file table overflow"}function O(t){this.message=t||"no buffer space available"}function S(t){this.message=t||"not enough memory"}function R(t){this.message=t||"not a directory"}function C(t){this.message=t||"illegal operation on a directory"}function T(t){this.message=t||"machine is not on the network"}function I(t){this.message=t||"socket is not connected"}function D(t){this.message=t||"socket operation on non-socket"}function N(t){this.message=t||"operation not supported on socket"}function M(t){this.message=t||"no such file or directory"}function B(t){this.message=t||"function not implemented"}function F(t){this.message=t||"broken pipe"}function U(t){this.message=t||"protocol error"}function j(t){this.message=t||"protocol not supported"}function z(t){this.message=t||"protocol wrong type for socket"}function P(t){this.message=t||"connection timed out"}function L(t){this.message=t||"invalid Unicode character"}function W(t){this.message=t||"address family for hostname not supported"}function q(t){this.message=t||"servname not supported for ai_socktype"}function H(t){this.message=t||"ai_socktype not supported"}function Y(t){this.message=t||"cannot send after transport endpoint shutdown"}function X(t){this.message=t||"file already exists"}function K(t){this.message=t||"no such process"}function V(t){this.message=t||"name too long"}function Z(t){this.message=t||"operation not permitted"}function G(t){this.message=t||"too many symbolic links encountered" +}function Q(t){this.message=t||"cross-device link not permitted"}function $(t){this.message=t||"directory not empty"}function J(t){this.message=t||"no space left on device"}function te(t){this.message=t||"i/o error"}function ee(t){this.message=t||"read-only file system"}function ne(t){this.message=t||"no such device"}function re(t){this.message=t||"invalid seek"}function oe(t){this.message=t||"operation canceled"}function ie(t){this.message=t||"not mounted"}function se(t){this.message=t||"missing super node"}function ae(t){this.message=t||"attribute does not exist"}return t.prototype=Error(),t.prototype.errno=-1,t.prototype.code="UNKNOWN",t.prototype.constructor=t,e.prototype=Error(),e.prototype.errno=0,e.prototype.code="OK",e.prototype.constructor=e,n.prototype=Error(),n.prototype.errno=1,n.prototype.code="EOF",n.prototype.constructor=n,r.prototype=Error(),r.prototype.errno=2,r.prototype.code="EADDRINFO",r.prototype.constructor=r,o.prototype=Error(),o.prototype.errno=3,o.prototype.code="EACCES",o.prototype.constructor=o,i.prototype=Error(),i.prototype.errno=4,i.prototype.code="EAGAIN",i.prototype.constructor=i,s.prototype=Error(),s.prototype.errno=5,s.prototype.code="EADDRINUSE",s.prototype.constructor=s,a.prototype=Error(),a.prototype.errno=6,a.prototype.code="EADDRNOTAVAIL",a.prototype.constructor=a,c.prototype=Error(),c.prototype.errno=7,c.prototype.code="EAFNOSUPPORT",c.prototype.constructor=c,u.prototype=Error(),u.prototype.errno=8,u.prototype.code="EALREADY",u.prototype.constructor=u,f.prototype=Error(),f.prototype.errno=9,f.prototype.code="EBADF",f.prototype.constructor=f,l.prototype=Error(),l.prototype.errno=10,l.prototype.code="EBUSY",l.prototype.constructor=l,p.prototype=Error(),p.prototype.errno=11,p.prototype.code="ECONNABORTED",p.prototype.constructor=p,h.prototype=Error(),h.prototype.errno=12,h.prototype.code="ECONNREFUSED",h.prototype.constructor=h,d.prototype=Error(),d.prototype.errno=13,d.prototype.code="ECONNRESET",d.prototype.constructor=d,y.prototype=Error(),y.prototype.errno=14,y.prototype.code="EDESTADDRREQ",y.prototype.constructor=y,g.prototype=Error(),g.prototype.errno=15,g.prototype.code="EFAULT",g.prototype.constructor=g,v.prototype=Error(),v.prototype.errno=16,v.prototype.code="EHOSTUNREACH",v.prototype.constructor=v,m.prototype=Error(),m.prototype.errno=17,m.prototype.code="EINTR",m.prototype.constructor=m,E.prototype=Error(),E.prototype.errno=18,E.prototype.code="EINVAL",E.prototype.constructor=E,b.prototype=Error(),b.prototype.errno=19,b.prototype.code="EISCONN",b.prototype.constructor=b,w.prototype=Error(),w.prototype.errno=20,w.prototype.code="EMFILE",w.prototype.constructor=w,x.prototype=Error(),x.prototype.errno=21,x.prototype.code="EMSGSIZE",x.prototype.constructor=x,_.prototype=Error(),_.prototype.errno=22,_.prototype.code="ENETDOWN",_.prototype.constructor=_,A.prototype=Error(),A.prototype.errno=23,A.prototype.code="ENETUNREACH",A.prototype.constructor=A,k.prototype=Error(),k.prototype.errno=24,k.prototype.code="ENFILE",k.prototype.constructor=k,O.prototype=Error(),O.prototype.errno=25,O.prototype.code="ENOBUFS",O.prototype.constructor=O,S.prototype=Error(),S.prototype.errno=26,S.prototype.code="ENOMEM",S.prototype.constructor=S,R.prototype=Error(),R.prototype.errno=27,R.prototype.code="ENOTDIR",R.prototype.constructor=R,C.prototype=Error(),C.prototype.errno=28,C.prototype.code="EISDIR",C.prototype.constructor=C,T.prototype=Error(),T.prototype.errno=29,T.prototype.code="ENONET",T.prototype.constructor=T,I.prototype=Error(),I.prototype.errno=31,I.prototype.code="ENOTCONN",I.prototype.constructor=I,D.prototype=Error(),D.prototype.errno=32,D.prototype.code="ENOTSOCK",D.prototype.constructor=D,N.prototype=Error(),N.prototype.errno=33,N.prototype.code="ENOTSUP",N.prototype.constructor=N,M.prototype=Error(),M.prototype.errno=34,M.prototype.code="ENOENT",M.prototype.constructor=M,B.prototype=Error(),B.prototype.errno=35,B.prototype.code="ENOSYS",B.prototype.constructor=B,F.prototype=Error(),F.prototype.errno=36,F.prototype.code="EPIPE",F.prototype.constructor=F,U.prototype=Error(),U.prototype.errno=37,U.prototype.code="EPROTO",U.prototype.constructor=U,j.prototype=Error(),j.prototype.errno=38,j.prototype.code="EPROTONOSUPPORT",j.prototype.constructor=j,z.prototype=Error(),z.prototype.errno=39,z.prototype.code="EPROTOTYPE",z.prototype.constructor=z,P.prototype=Error(),P.prototype.errno=40,P.prototype.code="ETIMEDOUT",P.prototype.constructor=P,L.prototype=Error(),L.prototype.errno=41,L.prototype.code="ECHARSET",L.prototype.constructor=L,W.prototype=Error(),W.prototype.errno=42,W.prototype.code="EAIFAMNOSUPPORT",W.prototype.constructor=W,q.prototype=Error(),q.prototype.errno=44,q.prototype.code="EAISERVICE",q.prototype.constructor=q,H.prototype=Error(),H.prototype.errno=45,H.prototype.code="EAISOCKTYPE",H.prototype.constructor=H,Y.prototype=Error(),Y.prototype.errno=46,Y.prototype.code="ESHUTDOWN",Y.prototype.constructor=Y,X.prototype=Error(),X.prototype.errno=47,X.prototype.code="EEXIST",X.prototype.constructor=X,K.prototype=Error(),K.prototype.errno=48,K.prototype.code="ESRCH",K.prototype.constructor=K,V.prototype=Error(),V.prototype.errno=49,V.prototype.code="ENAMETOOLONG",V.prototype.constructor=V,Z.prototype=Error(),Z.prototype.errno=50,Z.prototype.code="EPERM",Z.prototype.constructor=Z,G.prototype=Error(),G.prototype.errno=51,G.prototype.code="ELOOP",G.prototype.constructor=G,Q.prototype=Error(),Q.prototype.errno=52,Q.prototype.code="EXDEV",Q.prototype.constructor=Q,$.prototype=Error(),$.prototype.errno=53,$.prototype.code="ENOTEMPTY",$.prototype.constructor=$,J.prototype=Error(),J.prototype.errno=54,J.prototype.code="ENOSPC",J.prototype.constructor=J,te.prototype=Error(),te.prototype.errno=55,te.prototype.code="EIO",te.prototype.constructor=te,ee.prototype=Error(),ee.prototype.errno=56,ee.prototype.code="EROFS",ee.prototype.constructor=ee,ne.prototype=Error(),ne.prototype.errno=57,ne.prototype.code="ENODEV",ne.prototype.constructor=ne,re.prototype=Error(),re.prototype.errno=58,re.prototype.code="ESPIPE",re.prototype.constructor=re,oe.prototype=Error(),oe.prototype.errno=59,oe.prototype.code="ECANCELED",oe.prototype.constructor=oe,ie.prototype=Error(),ie.prototype.errno=60,ie.prototype.code="ENotMounted",ie.prototype.constructor=ie,se.prototype=Error(),se.prototype.errno=61,se.prototype.code="EFileSystemError",se.prototype.constructor=se,ae.prototype=Error(),ae.prototype.errno=62,ae.prototype.code="ENoAttr",ae.prototype.constructor=ae,{Unknown:t,OK:e,EOF:n,EAddrInfo:r,EAcces:o,EAgain:i,EAddrInUse:s,EAddrNotAvail:a,EAFNoSupport:c,EAlready:u,EBadFileDescriptor:f,EBusy:l,EConnAborted:p,EConnRefused:h,EConnReset:d,EDestAddrReq:y,EFault:g,EHostUnreach:v,EIntr:m,EInvalid:E,EIsConn:b,EMFile:w,EMsgSize:x,ENetDown:_,ENetUnreach:A,ENFile:k,ENoBufS:O,ENoMem:S,ENotDirectory:R,EIsDirectory:C,ENoNet:T,ENotConn:I,ENotSock:D,ENotSup:N,ENoEntry:M,ENotImplemented:B,EPipe:F,EProto:U,EProtoNoSupport:j,EPrototype:z,ETimedOut:P,ECharset:L,EAIFamNoSupport:W,EAIService:q,EAISockType:H,EShutdown:Y,EExists:X,ESrch:K,ENameTooLong:V,EPerm:Z,ELoop:G,EXDev:Q,ENotEmpty:$,ENoSpc:J,EIO:te,EROFS:ee,ENoDev:ne,ESPipe:re,ECanceled:oe,ENotMounted:ie,EFileSystemError:se,ENoAttr:ae}}),n("src/constants",["require"],function(){var t="READ",e="WRITE",n="CREATE",r="EXCLUSIVE",o="TRUNCATE",i="APPEND",s="CREATE",a="REPLACE";return{FILE_SYSTEM_NAME:"local",FILE_STORE_NAME:"files",IDB_RO:"readonly",IDB_RW:"readwrite",WSQL_VERSION:"1",WSQL_SIZE:5242880,WSQL_DESC:"FileSystem Storage",MODE_FILE:"FILE",MODE_DIRECTORY:"DIRECTORY",MODE_SYMBOLIC_LINK:"SYMLINK",MODE_META:"META",SYMLOOP_MAX:10,BINARY_MIME_TYPE:"application/octet-stream",JSON_MIME_TYPE:"application/json",ROOT_DIRECTORY_NAME:"/",FS_FORMAT:"FORMAT",FS_NOCTIME:"NOCTIME",FS_NOMTIME:"NOMTIME",O_READ:t,O_WRITE:e,O_CREATE:n,O_EXCLUSIVE:r,O_TRUNCATE:o,O_APPEND:i,O_FLAGS:{r:[t],"r+":[t,e],w:[e,n,o],"w+":[e,t,n,o],wx:[e,n,r,o],"wx+":[e,t,n,r,o],a:[e,n,i],"a+":[e,t,n,i],ax:[e,n,r,i],"ax+":[e,t,n,r,i]},XATTR_CREATE:s,XATTR_REPLACE:a,FS_READY:"READY",FS_PENDING:"PENDING",FS_ERROR:"ERROR",SUPER_NODE_ID:"00000000-0000-0000-0000-000000000000",ENVIRONMENT:{TMP:"/tmp",PATH:""}}}),n("src/providers/indexeddb",["require","../constants","../constants","../constants","../constants"],function(t){function e(t,e){var n=t.transaction(o,e);this.objectStore=n.objectStore(o)}function n(t){this.name=t||r,this.db=null}var r=t("../constants").FILE_SYSTEM_NAME,o=t("../constants").FILE_STORE_NAME,i=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,s=t("../constants").IDB_RW;return t("../constants").IDB_RO,e.prototype.clear=function(t){try{var e=this.objectStore.clear();e.onsuccess=function(){t()},e.onerror=function(e){t(e)}}catch(n){t(n)}},e.prototype.get=function(t,e){try{var n=this.objectStore.get(t);n.onsuccess=function(t){var n=t.target.result;e(null,n)},n.onerror=function(t){e(t)}}catch(r){e(r)}},e.prototype.put=function(t,e,n){try{var r=this.objectStore.put(e,t);r.onsuccess=function(t){var e=t.target.result;n(null,e)},r.onerror=function(t){n(t)}}catch(o){n(o)}},e.prototype.delete=function(t,e){try{var n=this.objectStore.delete(t);n.onsuccess=function(t){var n=t.target.result;e(null,n)},n.onerror=function(t){e(t)}}catch(r){e(r)}},n.isSupported=function(){return!!i},n.prototype.open=function(t){var e=this;if(e.db)return t(null,!1),void 0;var n=!1,r=i.open(e.name);r.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(o)&&e.deleteObjectStore(o),e.createObjectStore(o),n=!0},r.onsuccess=function(r){e.db=r.target.result,t(null,n)},r.onerror=function(e){t(e)}},n.prototype.getReadOnlyContext=function(){return new e(this.db,s)},n.prototype.getReadWriteContext=function(){return new e(this.db,s)},n}),n("src/providers/websql",["require","../constants","../constants","../constants","../constants","../constants","../shared"],function(t){function e(t,e){var n=this;this.getTransaction=function(r){return n.transaction?(r(n.transaction),void 0):(t[e?"readTransaction":"transaction"](function(t){n.transaction=t,r(t)}),void 0)}}function n(t){this.name=t||r,this.db=null}var r=t("../constants").FILE_SYSTEM_NAME,o=t("../constants").FILE_STORE_NAME,i=t("../constants").WSQL_VERSION,s=t("../constants").WSQL_SIZE,a=t("../constants").WSQL_DESC,c=t("../shared").u8toArray;return e.prototype.clear=function(t){function e(e,n){t(n)}function n(){t(null)}this.getTransaction(function(t){t.executeSql("DELETE FROM "+o+";",[],n,e)})},e.prototype.get=function(t,e){function n(t,n){var r=0===n.rows.length?null:n.rows.item(0).data;try{r&&(r=JSON.parse(r),r.__isUint8Array&&(r=new Uint8Array(r.__array))),e(null,r)}catch(o){e(o)}}function r(t,n){e(n)}this.getTransaction(function(e){e.executeSql("SELECT data FROM "+o+" WHERE id = ?;",[t],n,r)})},e.prototype.put=function(t,e,n){function r(){n(null)}function i(t,e){n(e)}"[object Uint8Array]"===Object.prototype.toString.call(e)&&(e={__isUint8Array:!0,__array:c(e)}),e=JSON.stringify(e),this.getTransaction(function(n){n.executeSql("INSERT OR REPLACE INTO "+o+" (id, data) VALUES (?, ?);",[t,e],r,i)})},e.prototype.delete=function(t,e){function n(){e(null)}function r(t,n){e(n)}this.getTransaction(function(e){e.executeSql("DELETE FROM "+o+" WHERE id = ?;",[t],n,r)})},n.isSupported=function(){return!!window.openDatabase},n.prototype.open=function(t){function e(e,n){t(n)}function n(e){function n(e,n){var r=0===n.rows.item(0).count;t(null,r)}function i(e,n){t(n)}r.db=c,e.executeSql("SELECT COUNT(id) AS count FROM "+o+";",[],n,i)}var r=this;if(r.db)return t(null,!1),void 0;var c=window.openDatabase(r.name,i,a,s);return c?(c.transaction(function(t){function r(t){t.executeSql("CREATE INDEX IF NOT EXISTS idx_"+o+"_id"+" on "+o+" (id);",[],n,e)}t.executeSql("CREATE TABLE IF NOT EXISTS "+o+" (id unique, data TEXT);",[],r,e)}),void 0):(t("[WebSQL] Unable to open database."),void 0)},n.prototype.getReadOnlyContext=function(){return new e(this.db,!0)},n.prototype.getReadWriteContext=function(){return new e(this.db,!1)},n}),function(){function t(t){var n=!1;return function(){if(n)throw Error("Callback was already called.");n=!0,t.apply(e,arguments)}}var e,r,o={};e=this,null!=e&&(r=e.async),o.noConflict=function(){return e.async=r,o};var i=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;t.length>n;n+=1)e(t[n],n,t)},s=function(t,e){if(t.map)return t.map(e);var n=[];return i(t,function(t,r,o){n.push(e(t,r,o))}),n},a=function(t,e,n){return t.reduce?t.reduce(e,n):(i(t,function(t,r,o){n=e(n,t,r,o)}),n)},c=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e};"undefined"!=typeof process&&process.nextTick?(o.nextTick=process.nextTick,o.setImmediate="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:o.nextTick):"function"==typeof setImmediate?(o.nextTick=function(t){setImmediate(t)},o.setImmediate=o.nextTick):(o.nextTick=function(t){setTimeout(t,0)},o.setImmediate=o.nextTick),o.each=function(e,n,r){if(r=r||function(){},!e.length)return r();var o=0;i(e,function(i){n(i,t(function(t){t?(r(t),r=function(){}):(o+=1,o>=e.length&&r(null))}))})},o.forEach=o.each,o.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,o=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n(null):o())})};o()},o.forEachSeries=o.eachSeries,o.eachLimit=function(t,e,n,r){var o=u(e);o.apply(null,[t,n,r])},o.forEachLimit=o.eachLimit;var u=function(t){return function(e,n,r){if(r=r||function(){},!e.length||0>=t)return r();var o=0,i=0,s=0;(function a(){if(o>=e.length)return r();for(;t>s&&e.length>i;)i+=1,s+=1,n(e[i-1],function(t){t?(r(t),r=function(){}):(o+=1,s-=1,o>=e.length?r():a())})})()}},f=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[o.each].concat(e))}},l=function(t,e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[u(t)].concat(n))}},p=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[o.eachSeries].concat(e))}},h=function(t,e,n,r){var o=[];e=s(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n,r){o[t.index]=r,e(n)})},function(t){r(t,o)})};o.map=f(h),o.mapSeries=p(h),o.mapLimit=function(t,e,n,r){return d(e)(t,n,r)};var d=function(t){return l(t,h)};o.reduce=function(t,e,n,r){o.eachSeries(t,function(t,r){n(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})},o.inject=o.reduce,o.foldl=o.reduce,o.reduceRight=function(t,e,n,r){var i=s(t,function(t){return t}).reverse();o.reduce(i,e,n,r)},o.foldr=o.reduceRight;var y=function(t,e,n,r){var o=[];e=s(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n&&o.push(t),e()})},function(){r(s(o.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};o.filter=f(y),o.filterSeries=p(y),o.select=o.filter,o.selectSeries=o.filterSeries;var g=function(t,e,n,r){var o=[];e=s(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n||o.push(t),e()})},function(){r(s(o.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};o.reject=f(g),o.rejectSeries=p(g);var v=function(t,e,n,r){t(e,function(t,e){n(t,function(n){n?(r(t),r=function(){}):e()})},function(){r()})};o.detect=f(v),o.detectSeries=p(v),o.some=function(t,e,n){o.each(t,function(t,r){e(t,function(t){t&&(n(!0),n=function(){}),r()})},function(){n(!1)})},o.any=o.some,o.every=function(t,e,n){o.each(t,function(t,r){e(t,function(t){t||(n(!1),n=function(){}),r()})},function(){n(!0)})},o.all=o.every,o.sortBy=function(t,e,n){o.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){if(t)return n(t);var r=function(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0};n(null,s(e.sort(r),function(t){return t.value}))})},o.auto=function(t,e){e=e||function(){};var n=c(t);if(!n.length)return e(null);var r={},s=[],u=function(t){s.unshift(t)},f=function(t){for(var e=0;s.length>e;e+=1)if(s[e]===t)return s.splice(e,1),void 0},l=function(){i(s.slice(0),function(t){t()})};u(function(){c(r).length===n.length&&(e(null,r),e=function(){})}),i(n,function(n){var s=t[n]instanceof Function?[t[n]]:t[n],p=function(t){var s=Array.prototype.slice.call(arguments,1);if(1>=s.length&&(s=s[0]),t){var a={};i(c(r),function(t){a[t]=r[t]}),a[n]=s,e(t,a),e=function(){}}else r[n]=s,o.setImmediate(l)},h=s.slice(0,Math.abs(s.length-1))||[],d=function(){return a(h,function(t,e){return t&&r.hasOwnProperty(e)},!0)&&!r.hasOwnProperty(n)};if(d())s[s.length-1](p,r);else{var y=function(){d()&&(f(y),s[s.length-1](p,r))};u(y)}})},o.waterfall=function(t,e){if(e=e||function(){},t.constructor!==Array){var n=Error("First argument to waterfall must be an array of functions");return e(n)}if(!t.length)return e();var r=function(t){return function(n){if(n)e.apply(null,arguments),e=function(){};else{var i=Array.prototype.slice.call(arguments,1),s=t.next();s?i.push(r(s)):i.push(e),o.setImmediate(function(){t.apply(null,i)})}}};r(o.iterator(t))()};var m=function(t,e,n){if(n=n||function(){},e.constructor===Array)t.map(e,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);1>=n.length&&(n=n[0]),e.call(null,t,n)})},n);else{var r={};t.each(c(e),function(t,n){e[t](function(e){var o=Array.prototype.slice.call(arguments,1);1>=o.length&&(o=o[0]),r[t]=o,n(e)})},function(t){n(t,r)})}};o.parallel=function(t,e){m({map:o.map,each:o.each},t,e)},o.parallelLimit=function(t,e,n){m({map:d(e),each:u(e)},t,n)},o.series=function(t,e){if(e=e||function(){},t.constructor===Array)o.mapSeries(t,function(t,e){t&&t(function(t){var n=Array.prototype.slice.call(arguments,1);1>=n.length&&(n=n[0]),e.call(null,t,n)})},e);else{var n={};o.eachSeries(c(t),function(e,r){t[e](function(t){var o=Array.prototype.slice.call(arguments,1);1>=o.length&&(o=o[0]),n[e]=o,r(t)})},function(t){e(t,n)})}},o.iterator=function(t){var e=function(n){var r=function(){return t.length&&t[n].apply(null,arguments),r.next()};return r.next=function(){return t.length-1>n?e(n+1):null},r};return e(0)},o.apply=function(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e.concat(Array.prototype.slice.call(arguments)))}};var E=function(t,e,n,r){var o=[];t(e,function(t,e){n(t,function(t,n){o=o.concat(n||[]),e(t)})},function(t){r(t,o)})};o.concat=f(E),o.concatSeries=p(E),o.whilst=function(t,e,n){t()?e(function(r){return r?n(r):(o.whilst(t,e,n),void 0)}):n()},o.doWhilst=function(t,e,n){t(function(r){return r?n(r):(e()?o.doWhilst(t,e,n):n(),void 0)})},o.until=function(t,e,n){t()?n():e(function(r){return r?n(r):(o.until(t,e,n),void 0)})},o.doUntil=function(t,e,n){t(function(r){return r?n(r):(e()?n():o.doUntil(t,e,n),void 0)})},o.queue=function(e,n){function r(t,e,r,s){e.constructor!==Array&&(e=[e]),i(e,function(e){var i={data:e,callback:"function"==typeof s?s:null};r?t.tasks.unshift(i):t.tasks.push(i),t.saturated&&t.tasks.length===n&&t.saturated(),o.setImmediate(t.process)})}void 0===n&&(n=1);var s=0,a={tasks:[],concurrency:n,saturated:null,empty:null,drain:null,push:function(t,e){r(a,t,!1,e)},unshift:function(t,e){r(a,t,!0,e)},process:function(){if(a.concurrency>s&&a.tasks.length){var n=a.tasks.shift();a.empty&&0===a.tasks.length&&a.empty(),s+=1;var r=function(){s-=1,n.callback&&n.callback.apply(n,arguments),a.drain&&0===a.tasks.length+s&&a.drain(),a.process()},o=t(r);e(n.data,o)}},length:function(){return a.tasks.length},running:function(){return s}};return a},o.cargo=function(t,e){var n=!1,r=[],a={tasks:r,payload:e,saturated:null,empty:null,drain:null,push:function(t,n){t.constructor!==Array&&(t=[t]),i(t,function(t){r.push({data:t,callback:"function"==typeof n?n:null}),a.saturated&&r.length===e&&a.saturated()}),o.setImmediate(a.process)},process:function c(){if(!n){if(0===r.length)return a.drain&&a.drain(),void 0;var o="number"==typeof e?r.splice(0,e):r.splice(0),u=s(o,function(t){return t.data});a.empty&&a.empty(),n=!0,t(u,function(){n=!1;var t=arguments;i(o,function(e){e.callback&&e.callback.apply(null,t)}),c()})}},length:function(){return r.length},running:function(){return n}};return a};var b=function(t){return function(e){var n=Array.prototype.slice.call(arguments,1);e.apply(null,n.concat([function(e){var n=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(e?console.error&&console.error(e):console[t]&&i(n,function(e){console[t](e)}))}]))}};o.log=b("log"),o.dir=b("dir"),o.memoize=function(t,e){var n={},r={};e=e||function(t){return t};var o=function(){var o=Array.prototype.slice.call(arguments),i=o.pop(),s=e.apply(null,o);s in n?i.apply(null,n[s]):s in r?r[s].push(i):(r[s]=[i],t.apply(null,o.concat([function(){n[s]=arguments;var t=r[s];delete r[s];for(var e=0,o=t.length;o>e;e++)t[e].apply(null,arguments)}])))};return o.memo=n,o.unmemoized=t,o},o.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},o.times=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return o.map(r,e,n)},o.timesSeries=function(t,e,n){for(var r=[],i=0;t>i;i++)r.push(i);return o.mapSeries(r,e,n)},o.compose=function(){var t=Array.prototype.reverse.call(arguments);return function(){var e=this,n=Array.prototype.slice.call(arguments),r=n.pop();o.reduce(t,n,function(t,n,r){n.apply(e,t.concat([function(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);r(t,e)}]))},function(t,n){r.apply(e,[t].concat(n))})}};var w=function(t,e){var n=function(){var n=this,r=Array.prototype.slice.call(arguments),o=r.pop();return t(e,function(t,e){t.apply(n,r.concat([e]))},o)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return n.apply(this,r)}return n};o.applyEach=f(w),o.applyEachSeries=p(w),o.forever=function(t,e){function n(r){if(r){if(e)return e(r);throw r}t(n)}n()},n!==void 0&&n.amd?n("lib/async",[],function(){return o}):"undefined"!=typeof module&&module.exports?module.exports=o:e.async=o}(),n("src/providers/memory",["require","../constants","../../lib/async"],function(t){function e(t,e){this.readOnly=e,this.objectStore=t}function n(t){this.name=t||r,this.db={}}var r=t("../constants").FILE_SYSTEM_NAME,o=t("../../lib/async").nextTick;return e.prototype.clear=function(t){if(this.readOnly)return o(function(){t("[MemoryContext] Error: write operation on read only context")}),void 0;var e=this.objectStore;Object.keys(e).forEach(function(t){delete e[t]}),o(t)},e.prototype.get=function(t,e){var n=this;o(function(){e(null,n.objectStore[t])})},e.prototype.put=function(t,e,n){return this.readOnly?(o(function(){n("[MemoryContext] Error: write operation on read only context")}),void 0):(this.objectStore[t]=e,o(n),void 0)},e.prototype.delete=function(t,e){return this.readOnly?(o(function(){e("[MemoryContext] Error: write operation on read only context")}),void 0):(delete this.objectStore[t],o(e),void 0)},n.isSupported=function(){return!0},n.prototype.open=function(t){o(function(){t(null,!0)})},n.prototype.getReadOnlyContext=function(){return new e(this.db,!0)},n.prototype.getReadWriteContext=function(){return new e(this.db,!1)},n}),n("src/providers/providers",["require","./indexeddb","./websql","./memory"],function(t){var e=t("./indexeddb"),n=t("./websql"),r=t("./memory");return{IndexedDB:e,WebSQL:n,Memory:r,Default:e,Fallback:function(){function t(){throw"[Filer Error] Your browser doesn't support IndexedDB or WebSQL."}return e.isSupported()?e:n.isSupported()?n:(t.isSupported=function(){return!1},t)}()}}),function(){function t(t){throw t}function e(t,e){var n=t.split("."),r=x;!(n[0]in r)&&r.execScript&&r.execScript("var "+n[0]);for(var o;n.length&&(o=n.shift());)n.length||e===b?r=r[o]?r[o]:r[o]={}:r[o]=e}function n(e,n){this.index="number"==typeof n?n:0,this.i=0,this.buffer=e instanceof(_?Uint8Array:Array)?e:new(_?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}function r(t){this.buffer=new(_?Uint16Array:Array)(2*t),this.length=0}function o(t){var e,n,r,o,i,s,a,c,u,f=t.length,l=0,p=Number.POSITIVE_INFINITY;for(c=0;f>c;++c)t[c]>l&&(l=t[c]),p>t[c]&&(p=t[c]);for(e=1<=r;){for(c=0;f>c;++c)if(t[c]===r){for(s=0,a=o,u=0;r>u;++u)s=s<<1|1&a,a>>=1;for(u=s;e>u;u+=i)n[u]=r<<16|c;++o}++r,o<<=1,i<<=1}return[n,l,p]}function i(t,e){this.h=I,this.w=0,this.input=_&&t instanceof Array?new Uint8Array(t):t,this.b=0,e&&(e.lazy&&(this.w=e.lazy),"number"==typeof e.compressionType&&(this.h=e.compressionType),e.outputBuffer&&(this.a=_&&e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.b=e.outputIndex)),this.a||(this.a=new(_?Uint8Array:Array)(32768))}function s(t,e){this.length=t,this.G=e}function a(e,n){function r(e,n){var r,o=e.G,i=[],s=0;r=B[e.length],i[s++]=65535&r,i[s++]=255&r>>16,i[s++]=r>>24;var a;switch(w){case 1===o:a=[0,o-1,0];break;case 2===o:a=[1,o-2,0];break;case 3===o:a=[2,o-3,0];break;case 4===o:a=[3,o-4,0];break;case 6>=o:a=[4,o-5,1];break;case 8>=o:a=[5,o-7,1];break;case 12>=o:a=[6,o-9,2];break;case 16>=o:a=[7,o-13,2];break;case 24>=o:a=[8,o-17,3];break;case 32>=o:a=[9,o-25,3];break;case 48>=o:a=[10,o-33,4];break;case 64>=o:a=[11,o-49,4];break;case 96>=o:a=[12,o-65,5];break;case 128>=o:a=[13,o-97,5];break;case 192>=o:a=[14,o-129,6];break;case 256>=o:a=[15,o-193,6];break;case 384>=o:a=[16,o-257,7];break;case 512>=o:a=[17,o-385,7];break;case 768>=o:a=[18,o-513,8];break;case 1024>=o:a=[19,o-769,8];break;case 1536>=o:a=[20,o-1025,9];break;case 2048>=o:a=[21,o-1537,9];break;case 3072>=o:a=[22,o-2049,10];break;case 4096>=o:a=[23,o-3073,10];break;case 6144>=o:a=[24,o-4097,11];break;case 8192>=o:a=[25,o-6145,11];break;case 12288>=o:a=[26,o-8193,12];break;case 16384>=o:a=[27,o-12289,12];break;case 24576>=o:a=[28,o-16385,13];break;case 32768>=o:a=[29,o-24577,13];break;default:t("invalid distance")}r=a,i[s++]=r[0],i[s++]=r[1],i[s++]=r[2];var c,u;for(c=0,u=i.length;u>c;++c)y[g++]=i[c];m[i[0]]++,E[i[3]]++,v=e.length+n-1,p=null}var o,i,s,a,u,f,l,p,h,d={},y=_?new Uint16Array(2*n.length):[],g=0,v=0,m=new(_?Uint32Array:Array)(286),E=new(_?Uint32Array:Array)(30),x=e.w;if(!_){for(s=0;285>=s;)m[s++]=0;for(s=0;29>=s;)E[s++]=0}for(m[256]=1,o=0,i=n.length;i>o;++o){for(s=u=0,a=3;a>s&&o+s!==i;++s)u=u<<8|n[o+s];if(d[u]===b&&(d[u]=[]),f=d[u],!(v-->0)){for(;f.length>0&&o-f[0]>32768;)f.shift();if(o+3>=i){for(p&&r(p,-1),s=0,a=i-o;a>s;++s)h=n[o+s],y[g++]=h,++m[h];break}f.length>0?(l=c(n,o,f),p?p.lengthl.length?p=l:r(l,0)):p?r(p,-1):(h=n[o],y[g++]=h,++m[h])}f.push(o)}return y[g++]=256,m[256]++,e.L=m,e.K=E,_?y.subarray(0,g):y}function c(t,e,n){var r,o,i,a,c,u,f=0,l=t.length;a=0,u=n.length;t:for(;u>a;a++){if(r=n[u-a-1],i=3,f>3){for(c=f;c>3;c--)if(t[r+c-1]!==t[e+c-1])continue t;i=f}for(;258>i&&l>e+i&&t[r+i]===t[e+i];)++i;if(i>f&&(o=r,f=i),258===i)break}return new s(f,e-o)}function u(t,e){var n,o,i,s,a,c=t.length,u=new r(572),l=new(_?Uint8Array:Array)(c);if(!_)for(s=0;c>s;s++)l[s]=0;for(s=0;c>s;++s)t[s]>0&&u.push(s,t[s]);if(n=Array(u.length/2),o=new(_?Uint32Array:Array)(u.length/2),1===n.length)return l[u.pop().index]=1,l;for(s=0,a=u.length/2;a>s;++s)n[s]=u.pop(),o[s]=n[s].value;for(i=f(o,o.length,e),s=0,a=n.length;a>s;++s)l[n[s].index]=i[s];return l}function f(t,e,n){function r(t){var n=h[t][d[t]];n===e?(r(t+1),r(t+1)):--l[n],++d[t]}var o,i,s,a,c,u=new(_?Uint16Array:Array)(n),f=new(_?Uint8Array:Array)(n),l=new(_?Uint8Array:Array)(e),p=Array(n),h=Array(n),d=Array(n),y=(1<i;++i)g>y?f[i]=0:(f[i]=1,y-=g),y<<=1,u[n-2-i]=(0|u[n-1-i]/2)+e;for(u[0]=f[0],p[0]=Array(u[0]),h[0]=Array(u[0]),i=1;n>i;++i)u[i]>2*u[i-1]+f[i]&&(u[i]=2*u[i-1]+f[i]),p[i]=Array(u[i]),h[i]=Array(u[i]);for(o=0;e>o;++o)l[o]=n;for(s=0;u[n-1]>s;++s)p[n-1][s]=t[s],h[n-1][s]=s;for(o=0;n>o;++o)d[o]=0;for(1===f[n-1]&&(--l[0],++d[n-1]),i=n-2;i>=0;--i){for(a=o=0,c=d[i+1],s=0;u[i]>s;s++)a=p[i+1][c]+p[i+1][c+1],a>t[o]?(p[i][s]=a,h[i][s]=e,c+=2):(p[i][s]=t[o],h[i][s]=o,++o);d[i]=0,1===f[i]&&r(i)}return l}function l(t){var e,n,r,o,i=new(_?Uint16Array:Array)(t.length),s=[],a=[],c=0;for(e=0,n=t.length;n>e;e++)s[t[e]]=(0|s[t[e]])+1;for(e=1,n=16;n>=e;e++)a[e]=c,c+=0|s[e],c<<=1;for(e=0,n=t.length;n>e;e++)for(c=a[t[e]],a[t[e]]+=1,r=i[e]=0,o=t[e];o>r;r++)i[e]=i[e]<<1|1&c,c>>>=1;return i}function p(e,n){switch(this.l=[],this.m=32768,this.e=this.g=this.c=this.q=0,this.input=_?new Uint8Array(e):e,this.s=!1,this.n=U,this.B=!1,(n||!(n={}))&&(n.index&&(this.c=n.index),n.bufferSize&&(this.m=n.bufferSize),n.bufferType&&(this.n=n.bufferType),n.resize&&(this.B=n.resize)),this.n){case F:this.b=32768,this.a=new(_?Uint8Array:Array)(32768+this.m+258);break;case U:this.b=0,this.a=new(_?Uint8Array:Array)(this.m),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}function h(e,n){for(var r,o=e.g,i=e.e,s=e.input,a=e.c;n>i;)r=s[a++],r===b&&t(Error("input buffer is broken")),o|=r<>>n,e.e=i-n,e.c=a,r}function d(t,e){for(var n,r,o,i=t.g,s=t.e,a=t.input,c=t.c,u=e[0],f=e[1];f>s&&(n=a[c++],n!==b);)i|=n<>>16,t.g=i>>o,t.e=s-o,t.c=c,65535&r}function y(t){function e(t,e,n){var r,o,i,s;for(s=0;t>s;)switch(r=d(this,e)){case 16:for(i=3+h(this,2);i--;)n[s++]=o;break;case 17:for(i=3+h(this,3);i--;)n[s++]=0;o=0;break;case 18:for(i=11+h(this,7);i--;)n[s++]=0;o=0;break;default:o=n[s++]=r}return n}var n,r,i,s,a=h(t,5)+257,c=h(t,5)+1,u=h(t,4)+4,f=new(_?Uint8Array:Array)(W.length);for(s=0;u>s;++s)f[W[s]]=h(t,3);n=o(f),r=new(_?Uint8Array:Array)(a),i=new(_?Uint8Array:Array)(c),t.o(o(e.call(t,a,n,r)),o(e.call(t,c,n,i)))}function g(t){if("string"==typeof t){var e,n,r=t.split("");for(e=0,n=r.length;n>e;e++)r[e]=(255&r[e].charCodeAt(0))>>>0;t=r}for(var o,i=1,s=0,a=t.length,c=0;a>0;){o=a>1024?1024:a,a-=o;do i+=t[c++],s+=i;while(--o);i%=65521,s%=65521}return(s<<16|i)>>>0}function v(e,n){var r,o;switch(this.input=e,this.c=0,(n||!(n={}))&&(n.index&&(this.c=n.index),n.verify&&(this.M=n.verify)),r=e[this.c++],o=e[this.c++],15&r){case re:this.method=re;break;default:t(Error("unsupported compression method"))}0!==((r<<8)+o)%31&&t(Error("invalid fcheck flag:"+((r<<8)+o)%31)),32&o&&t(Error("fdict flag is not supported")),this.A=new p(e,{index:this.c,bufferSize:n.bufferSize,bufferType:n.bufferType,resize:n.resize})}function m(t,e){this.input=t,this.a=new(_?Uint8Array:Array)(32768),this.h=oe.k;var n,r={};!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType);for(n in e)r[n]=e[n];r.outputBuffer=this.a,this.z=new i(this.input,r)}function E(t,n){var r,o,i,s;if(Object.keys)r=Object.keys(n);else for(o in r=[],i=0,n)r[i++]=o;for(i=0,s=r.length;s>i;++i)o=r[i],e(t+"."+o,n[o])}var b=void 0,w=!0,x=this,_="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;n.prototype.f=function(){var t,e=this.buffer,n=e.length,r=new(_?Uint8Array:Array)(n<<1);if(_)r.set(e);else for(t=0;n>t;++t)r[t]=e[t];return this.buffer=r},n.prototype.d=function(t,e,n){var r,o=this.buffer,i=this.index,s=this.i,a=o[i];if(n&&e>1&&(t=e>8?(C[255&t]<<24|C[255&t>>>8]<<16|C[255&t>>>16]<<8|C[255&t>>>24])>>32-e:C[t]>>8-e),8>e+s)a=a<r;++r)a=a<<1|1&t>>e-r-1,8===++s&&(s=0,o[i++]=C[a],a=0,i===o.length&&(o=this.f()));o[i]=a,this.buffer=o,this.i=s,this.index=i},n.prototype.finish=function(){var t,e=this.buffer,n=this.index;return this.i>0&&(e[n]<<=8-this.i,e[n]=C[e[n]],n++),_?t=e.subarray(0,n):(e.length=n,t=e),t};var A,k=new(_?Uint8Array:Array)(256);for(A=0;256>A;++A){for(var O=A,S=O,R=7,O=O>>>1;O;O>>>=1)S<<=1,S|=1&O,--R;k[A]=(255&S<>>0}var C=k;r.prototype.getParent=function(t){return 2*(0|(t-2)/4)},r.prototype.push=function(t,e){var n,r,o,i=this.buffer;for(n=this.length,i[this.length++]=e,i[this.length++]=t;n>0&&(r=this.getParent(n),i[n]>i[r]);)o=i[n],i[n]=i[r],i[r]=o,o=i[n+1],i[n+1]=i[r+1],i[r+1]=o,n=r;return this.length},r.prototype.pop=function(){var t,e,n,r,o,i=this.buffer;for(e=i[0],t=i[1],this.length-=2,i[0]=i[this.length],i[1]=i[this.length+1],o=0;(r=2*o+2,!(r>=this.length))&&(this.length>r+2&&i[r+2]>i[r]&&(r+=2),i[r]>i[o]);)n=i[o],i[o]=i[r],i[r]=n,n=i[o+1],i[o+1]=i[r+1],i[r+1]=n,o=r; +return{index:t,value:e,length:this.length}};var T,I=2,D={NONE:0,r:1,k:I,N:3},N=[];for(T=0;288>T;T++)switch(w){case 143>=T:N.push([T+48,8]);break;case 255>=T:N.push([T-144+400,9]);break;case 279>=T:N.push([T-256+0,7]);break;case 287>=T:N.push([T-280+192,8]);break;default:t("invalid literal: "+T)}i.prototype.j=function(){var e,r,o,i,s=this.input;switch(this.h){case 0:for(o=0,i=s.length;i>o;){r=_?s.subarray(o,o+65535):s.slice(o,o+65535),o+=r.length;var c=r,f=o===i,p=b,h=b,d=b,y=b,g=b,v=this.a,m=this.b;if(_){for(v=new Uint8Array(this.a.buffer);v.length<=m+c.length+5;)v=new Uint8Array(v.length<<1);v.set(this.a)}if(p=f?1:0,v[m++]=0|p,h=c.length,d=65535&~h+65536,v[m++]=255&h,v[m++]=255&h>>>8,v[m++]=255&d,v[m++]=255&d>>>8,_)v.set(c,m),m+=c.length,v=v.subarray(0,m);else{for(y=0,g=c.length;g>y;++y)v[m++]=c[y];v.length=m}this.b=m,this.a=v}break;case 1:var E=new n(_?new Uint8Array(this.a.buffer):this.a,this.b);E.d(1,1,w),E.d(1,2,w);var x,A,k,O=a(this,s);for(x=0,A=O.length;A>x;x++)if(k=O[x],n.prototype.d.apply(E,N[k]),k>256)E.d(O[++x],O[++x],w),E.d(O[++x],5),E.d(O[++x],O[++x],w);else if(256===k)break;this.a=E.finish(),this.b=this.a.length;break;case I:var S,R,C,T,D,M,B,F,U,j,z,P,L,W,q,H=new n(_?new Uint8Array(this.a.buffer):this.a,this.b),Y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=Array(19);for(S=I,H.d(1,1,w),H.d(S,2,w),R=a(this,s),M=u(this.L,15),B=l(M),F=u(this.K,7),U=l(F),C=286;C>257&&0===M[C-1];C--);for(T=30;T>1&&0===F[T-1];T--);var K,V,Z,G,Q,$,J=C,te=T,ee=new(_?Uint32Array:Array)(J+te),ne=new(_?Uint32Array:Array)(316),re=new(_?Uint8Array:Array)(19);for(K=V=0;J>K;K++)ee[V++]=M[K];for(K=0;te>K;K++)ee[V++]=F[K];if(!_)for(K=0,G=re.length;G>K;++K)re[K]=0;for(K=Q=0,G=ee.length;G>K;K+=V){for(V=1;G>K+V&&ee[K+V]===ee[K];++V);if(Z=V,0===ee[K])if(3>Z)for(;Z-->0;)ne[Q++]=0,re[0]++;else for(;Z>0;)$=138>Z?Z:138,$>Z-3&&Z>$&&($=Z-3),10>=$?(ne[Q++]=17,ne[Q++]=$-3,re[17]++):(ne[Q++]=18,ne[Q++]=$-11,re[18]++),Z-=$;else if(ne[Q++]=ee[K],re[ee[K]]++,Z--,3>Z)for(;Z-->0;)ne[Q++]=ee[K],re[ee[K]]++;else for(;Z>0;)$=6>Z?Z:6,$>Z-3&&Z>$&&($=Z-3),ne[Q++]=16,ne[Q++]=$-3,re[16]++,Z-=$}for(e=_?ne.subarray(0,Q):ne.slice(0,Q),j=u(re,7),W=0;19>W;W++)X[W]=j[Y[W]];for(D=19;D>4&&0===X[D-1];D--);for(z=l(j),H.d(C-257,5,w),H.d(T-1,5,w),H.d(D-4,4,w),W=0;D>W;W++)H.d(X[W],3,w);for(W=0,q=e.length;q>W;W++)if(P=e[W],H.d(z[P],j[P],w),P>=16){switch(W++,P){case 16:L=2;break;case 17:L=3;break;case 18:L=7;break;default:t("invalid code: "+P)}H.d(e[W],L,w)}var oe,ie,se,ae,ce,ue,fe,le,pe=[B,M],he=[U,F];for(ce=pe[0],ue=pe[1],fe=he[0],le=he[1],oe=0,ie=R.length;ie>oe;++oe)if(se=R[oe],H.d(ce[se],ue[se],w),se>256)H.d(R[++oe],R[++oe],w),ae=R[++oe],H.d(fe[ae],le[ae],w),H.d(R[++oe],R[++oe],w);else if(256===se)break;this.a=H.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var M=function(){function e(e){switch(w){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}var n,r,o=[];for(n=3;258>=n;n++)r=e(n),o[n]=r[2]<<24|r[1]<<16|r[0];return o}(),B=_?new Uint32Array(M):M,F=0,U=1,j={D:F,C:U};p.prototype.p=function(){for(;!this.s;){var e=h(this,3);switch(1&e&&(this.s=w),e>>>=1){case 0:var n=this.input,r=this.c,o=this.a,i=this.b,s=b,a=b,c=b,u=o.length,f=b;switch(this.e=this.g=0,s=n[r++],s===b&&t(Error("invalid uncompressed block header: LEN (first byte)")),a=s,s=n[r++],s===b&&t(Error("invalid uncompressed block header: LEN (second byte)")),a|=s<<8,s=n[r++],s===b&&t(Error("invalid uncompressed block header: NLEN (first byte)")),c=s,s=n[r++],s===b&&t(Error("invalid uncompressed block header: NLEN (second byte)")),c|=s<<8,a===~c&&t(Error("invalid uncompressed block header: length verify")),r+a>n.length&&t(Error("input buffer is broken")),this.n){case F:for(;i+a>o.length;){if(f=u-i,a-=f,_)o.set(n.subarray(r,r+f),i),i+=f,r+=f;else for(;f--;)o[i++]=n[r++];this.b=i,o=this.f(),i=this.b}break;case U:for(;i+a>o.length;)o=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(_)o.set(n.subarray(r,r+a),i),i+=a,r+=a;else for(;a--;)o[i++]=n[r++];this.c=r,this.b=i,this.a=o;break;case 1:this.o(te,ne);break;case 2:y(this);break;default:t(Error("unknown BTYPE: "+e))}}return this.t()};var z,P,L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],W=_?new Uint16Array(L):L,q=[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,258,258],H=_?new Uint16Array(q):q,Y=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],X=_?new Uint8Array(Y):Y,K=[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],V=_?new Uint16Array(K):K,Z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],G=_?new Uint8Array(Z):Z,Q=new(_?Uint8Array:Array)(288);for(z=0,P=Q.length;P>z;++z)Q[z]=143>=z?8:255>=z?9:279>=z?7:8;var $,J,te=o(Q),ee=new(_?Uint8Array:Array)(30);for($=0,J=ee.length;J>$;++$)ee[$]=5;var ne=o(ee);p.prototype.o=function(t,e){var n=this.a,r=this.b;this.u=t;for(var o,i,s,a,c=n.length-258;256!==(o=d(this,t));)if(256>o)r>=c&&(this.b=r,n=this.f(),r=this.b),n[r++]=o;else for(i=o-257,a=H[i],X[i]>0&&(a+=h(this,X[i])),o=d(this,e),s=V[o],G[o]>0&&(s+=h(this,G[o])),r>=c&&(this.b=r,n=this.f(),r=this.b);a--;)n[r]=n[r++-s];for(;this.e>=8;)this.e-=8,this.c--;this.b=r},p.prototype.I=function(t,e){var n=this.a,r=this.b;this.u=t;for(var o,i,s,a,c=n.length;256!==(o=d(this,t));)if(256>o)r>=c&&(n=this.f(),c=n.length),n[r++]=o;else for(i=o-257,a=H[i],X[i]>0&&(a+=h(this,X[i])),o=d(this,e),s=V[o],G[o]>0&&(s+=h(this,G[o])),r+a>c&&(n=this.f(),c=n.length);a--;)n[r]=n[r++-s];for(;this.e>=8;)this.e-=8,this.c--;this.b=r},p.prototype.f=function(){var t,e,n=new(_?Uint8Array:Array)(this.b-32768),r=this.b-32768,o=this.a;if(_)n.set(o.subarray(32768,n.length));else for(t=0,e=n.length;e>t;++t)n[t]=o[t+32768];if(this.l.push(n),this.q+=n.length,_)o.set(o.subarray(r,r+32768));else for(t=0;32768>t;++t)o[t]=o[r+t];return this.b=32768,o},p.prototype.J=function(t){var e,n,r,o,i=0|this.input.length/this.c+1,s=this.input,a=this.a;return t&&("number"==typeof t.v&&(i=t.v),"number"==typeof t.F&&(i+=t.F)),2>i?(n=(s.length-this.c)/this.u[2],o=0|258*(n/2),r=a.length>o?a.length+o:a.length<<1):r=a.length*i,_?(e=new Uint8Array(r),e.set(a)):e=a,this.a=e},p.prototype.t=function(){var t,e,n,r,o,i=0,s=this.a,a=this.l,c=new(_?Uint8Array:Array)(this.q+(this.b-32768));if(0===a.length)return _?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(e=0,n=a.length;n>e;++e)for(t=a[e],r=0,o=t.length;o>r;++r)c[i++]=t[r];for(e=32768,n=this.b;n>e;++e)c[i++]=s[e];return this.l=[],this.buffer=c},p.prototype.H=function(){var t,e=this.b;return _?this.B?(t=new Uint8Array(e),t.set(this.a.subarray(0,e))):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},v.prototype.p=function(){var e,n,r=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&(n=(r[this.c++]<<24|r[this.c++]<<16|r[this.c++]<<8|r[this.c++])>>>0,n!==g(e)&&t(Error("invalid adler-32 checksum"))),e};var re=8,oe=D;m.prototype.j=function(){var e,n,r,o,i,s,a,c=0;switch(a=this.a,e=re){case re:n=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(r=n<<4|e,a[c++]=r,e){case re:switch(this.h){case oe.NONE:i=0;break;case oe.r:i=1;break;case oe.k:i=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return o=0|i<<6,a[c++]=o|31-(256*r+o)%31,s=g(this.input),this.z.b=c,a=this.z.j(),c=a.length,_&&(a=new Uint8Array(a.buffer),c+4>=a.length&&(this.a=new Uint8Array(a.length+4),this.a.set(a),a=this.a),a=a.subarray(0,c+4)),a[c++]=255&s>>24,a[c++]=255&s>>16,a[c++]=255&s>>8,a[c++]=255&s,a},e("Zlib.Inflate",v),e("Zlib.Inflate.prototype.decompress",v.prototype.p),E("Zlib.Inflate.BufferType",{ADAPTIVE:j.C,BLOCK:j.D}),e("Zlib.Deflate",m),e("Zlib.Deflate.compress",function(t,e){return new m(t,e).j()}),e("Zlib.Deflate.prototype.compress",m.prototype.j),E("Zlib.Deflate.CompressionType",{NONE:oe.NONE,FIXED:oe.r,DYNAMIC:oe.k})}.call(this),n("lib/zlib",function(){}),n("src/adapters/zlib",["require","../../lib/zlib"],function(t){function e(t){return new i(t).decompress()}function n(t){return new s(t).compress()}function r(t){this.context=t}function o(t){this.provider=t}t("../../lib/zlib");var i=Zlib.Inflate,s=Zlib.Deflate;return r.prototype.clear=function(t){this.context.clear(t)},r.prototype.get=function(t,n){this.context.get(t,function(t,r){return t?(n(t),void 0):(r&&(r=e(r)),n(null,r),void 0)})},r.prototype.put=function(t,e,r){e=n(e),this.context.put(t,e,r)},r.prototype.delete=function(t,e){this.context.delete(t,e)},o.isSupported=function(){return!0},o.prototype.open=function(t){this.provider.open(t)},o.prototype.getReadOnlyContext=function(){return new r(this.provider.getReadOnlyContext())},o.prototype.getReadWriteContext=function(){return new r(this.provider.getReadWriteContext())},o});var r=r||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.$super.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,t=t.sigBytes;if(this.clamp(),r%4)for(var o=0;t>o;o++)e[r+o>>>2]|=(255&n[o>>>2]>>>24-8*(o%4))<<24-8*((r+o)%4);else if(n.length>65535)for(o=0;t>o;o+=4)e[r+o>>>2]=n[o>>>2];else e.push.apply(e,n);return this.sigBytes+=t,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-8*(n%4),e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n=[],r=0;e>r;r+=4)n.push(0|4294967296*t.random());return i.create(n,e)}}),s=n.enc={},a=s.Hex={stringify:function(t){for(var e=t.words,t=t.sigBytes,n=[],r=0;t>r;r++){var o=255&e[r>>>2]>>>24-8*(r%4);n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-4*(r%8);return i.create(n,e/2)}},c=s.Latin1={stringify:function(t){for(var e=t.words,t=t.sigBytes,n=[],r=0;t>r;r++)n.push(String.fromCharCode(255&e[r>>>2]>>>24-8*(r%4)));return n.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-8*(r%4);return i.create(n,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=i.create(),this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,s=this.blockSize,a=o/(4*s),a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0),e=a*s,o=t.min(4*e,o);if(e){for(var c=0;e>c;c+=s)this._doProcessBlock(r,c);c=r.splice(0,e),n.sigBytes-=o}return i.create(c,o)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=f.extend({init:function(){this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize(),this._hash},clone:function(){var t=f.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:16,_createHelper:function(t){return function(e,n){return t.create(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return l.HMAC.create(t,n).finalize(e)}}});var l=n.algo={};return n}(Math);(function(){var t=r,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var t=[],o=0;n>o;o+=3)for(var i=(255&e[o>>>2]>>>24-8*(o%4))<<16|(255&e[o+1>>>2]>>>24-8*((o+1)%4))<<8|255&e[o+2>>>2]>>>24-8*((o+2)%4),s=0;4>s&&n>o+.75*s;s++)t.push(r.charAt(63&i>>>6*(3-s)));if(e=r.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var t=t.replace(/\s/g,""),n=t.length,r=this._map,o=r.charAt(64);o&&(o=t.indexOf(o),-1!=o&&(n=o));for(var o=[],i=0,s=0;n>s;s++)if(s%4){var a=r.indexOf(t.charAt(s-1))<<2*(s%4),c=r.indexOf(t.charAt(s))>>>6-2*(s%4);o[i>>>2]|=(a|c)<<24-8*(i%4),i++}return e.create(o,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(),function(t){function e(t,e,n,r,o,i,s){return t=t+(e&n|~e&r)+o+s,(t<>>32-i)+e}function n(t,e,n,r,o,i,s){return t=t+(e&r|n&~r)+o+s,(t<>>32-i)+e}function o(t,e,n,r,o,i,s){return t=t+(e^n^r)+o+s,(t<>>32-i)+e}function i(t,e,n,r,o,i,s){return t=t+(n^(e|~r))+o+s,(t<>>32-i)+e}var s=r,a=s.lib,c=a.WordArray,a=a.Hasher,u=s.algo,f=[];(function(){for(var e=0;64>e;e++)f[e]=0|4294967296*t.abs(t.sin(e+1))})(),u=u.MD5=a.extend({_doReset:function(){this._hash=c.create([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,r){for(var s=0;16>s;s++){var a=r+s,c=t[a];t[a]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}for(var a=this._hash.words,c=a[0],u=a[1],l=a[2],p=a[3],s=0;64>s;s+=4)16>s?(c=e(c,u,l,p,t[r+s],7,f[s]),p=e(p,c,u,l,t[r+s+1],12,f[s+1]),l=e(l,p,c,u,t[r+s+2],17,f[s+2]),u=e(u,l,p,c,t[r+s+3],22,f[s+3])):32>s?(c=n(c,u,l,p,t[r+(s+1)%16],5,f[s]),p=n(p,c,u,l,t[r+(s+6)%16],9,f[s+1]),l=n(l,p,c,u,t[r+(s+11)%16],14,f[s+2]),u=n(u,l,p,c,t[r+s%16],20,f[s+3])):48>s?(c=o(c,u,l,p,t[r+(3*s+5)%16],4,f[s]),p=o(p,c,u,l,t[r+(3*s+8)%16],11,f[s+1]),l=o(l,p,c,u,t[r+(3*s+11)%16],16,f[s+2]),u=o(u,l,p,c,t[r+(3*s+14)%16],23,f[s+3])):(c=i(c,u,l,p,t[r+3*s%16],6,f[s]),p=i(p,c,u,l,t[r+(3*s+7)%16],10,f[s+1]),l=i(l,p,c,u,t[r+(3*s+14)%16],15,f[s+2]),u=i(u,l,p,c,t[r+(3*s+5)%16],21,f[s+3]));a[0]=0|a[0]+c,a[1]=0|a[1]+u,a[2]=0|a[2]+l,a[3]=0|a[3]+p},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;for(e[r>>>5]|=128<<24-r%32,e[(r+64>>>9<<4)+14]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process(),t=this._hash.words,e=0;4>e;e++)n=t[e],t[e]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}}),s.MD5=a._createHelper(u),s.HmacMD5=a._createHmacHelper(u)}(Math),function(){var t=r,e=t.lib,n=e.Base,o=e.WordArray,e=t.algo,i=e.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:e.MD5,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,r=n.hasher.create(),i=o.create(),s=i.words,a=n.keySize,n=n.iterations;a>s.length;){c&&r.update(c);var c=r.update(t).finalize(e);r.reset();for(var u=1;n>u;u++)c=r.finalize(c),r.reset();i.concat(c)}return i.sigBytes=4*a,i}});t.EvpKDF=function(t,e,n){return i.create(n).compute(t,e)}}(),r.lib.Cipher||function(t){var e=r,n=e.lib,o=n.Base,i=n.WordArray,s=n.BufferedBlockAlgorithm,a=e.enc.Base64,c=e.algo.EvpKDF,u=n.Cipher=s.extend({cfg:o.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){return function(t){return{encrypt:function(e,n,r){return("string"==typeof n?y:d).encrypt(t,e,n,r)},decrypt:function(e,n,r){return("string"==typeof n?y:d).decrypt(t,e,n,r)}}}}()});n.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var f=e.mode={},l=n.BlockCipherMode=o.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),f=f.CBC=function(){function e(e,n,r){var o=this._iv;o?this._iv=t:o=this._prevBlock;for(var i=0;r>i;i++)e[n+i]^=o[i]}var n=l.extend();return n.Encryptor=n.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize;e.call(this,t,n,o),r.encryptBlock(t,n),this._prevBlock=t.slice(n,n+o)}}),n.Decryptor=n.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize,i=t.slice(n,n+o);r.decryptBlock(t,n),e.call(this,t,n,o),this._prevBlock=i}}),n}(),p=(e.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,n=n-t.sigBytes%n,r=n<<24|n<<16|n<<8|n,o=[],s=0;n>s;s+=4)o.push(r);n=i.create(o,n),t.concat(n)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}};n.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){u.reset.call(this);var t=this.cfg,e=t.iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var h=n.CipherParams=o.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),f=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,t=t.salt,e=(t?i.create([1398893684,1701076831]).concat(t).concat(e):e).toString(a);return e=e.replace(/(.{64})/g,"$1\n")},parse:function(t){var t=a.parse(t),e=t.words;if(1398893684==e[0]&&1701076831==e[1]){var n=i.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return h.create({ciphertext:t,salt:n})}},d=n.SerializableCipher=o.extend({cfg:o.extend({format:f}),encrypt:function(t,e,n,r){var r=this.cfg.extend(r),o=t.createEncryptor(n,r),e=o.finalize(e),o=o.cfg;return h.create({ciphertext:e,key:n,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),t.createDecryptor(n,r).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t):t}}),e=(e.kdf={}).OpenSSL={compute:function(t,e,n,r){return r||(r=i.random(8)),t=c.create({keySize:e+n}).compute(t,r),n=i.create(t.words.slice(e),4*n),t.sigBytes=4*e,h.create({key:t,iv:n,salt:r})}},y=n.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:e}),encrypt:function(t,e,n,r){return r=this.cfg.extend(r),n=r.kdf.compute(n,t.keySize,t.ivSize),r.iv=n.iv,t=d.encrypt.call(this,t,e,n.key,r),t.mixIn(n),t},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),n=r.kdf.compute(n,t.keySize,t.ivSize,e.salt),r.iv=n.iv,d.decrypt.call(this,t,e,n.key,r)}})}(),function(){var t=r,e=t.lib.BlockCipher,n=t.algo,o=[],i=[],s=[],a=[],c=[],u=[],f=[],l=[],p=[],h=[];(function(){for(var t=[],e=0;256>e;e++)t[e]=128>e?e<<1:283^e<<1;for(var n=0,r=0,e=0;256>e;e++){var d=r^r<<1^r<<2^r<<3^r<<4,d=99^(d>>>8^255&d);o[n]=d,i[d]=n;var y=t[n],g=t[y],v=t[g],m=257*t[d]^16843008*d;s[n]=m<<24|m>>>8,a[n]=m<<16|m>>>16,c[n]=m<<8|m>>>24,u[n]=m,m=16843009*v^65537*g^257*y^16843008*n,f[d]=m<<24|m>>>8,l[d]=m<<16|m>>>16,p[d]=m<<8|m>>>24,h[d]=m,n?(n=y^t[t[t[v^y]]],r^=t[t[r]]):n=r=1}})();var d=[0,1,2,4,8,16,32,64,128,27,54],n=n.AES=e.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes/4,t=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],i=0;t>i;i++)if(n>i)r[i]=e[i];else{var s=r[i-1];i%n?n>6&&4==i%n&&(s=o[s>>>24]<<24|o[255&s>>>16]<<16|o[255&s>>>8]<<8|o[255&s]):(s=s<<8|s>>>24,s=o[s>>>24]<<24|o[255&s>>>16]<<16|o[255&s>>>8]<<8|o[255&s],s^=d[0|i/n]<<24),r[i]=r[i-n]^s}for(e=this._invKeySchedule=[],n=0;t>n;n++)i=t-n,s=n%4?r[i]:r[i-4],e[n]=4>n||4>=i?s:f[o[s>>>24]]^l[o[255&s>>>16]]^p[o[255&s>>>8]]^h[o[255&s]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,a,c,u,o)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,f,l,p,h,i),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,r,o,i,s,a){for(var c=this._nRounds,u=t[e]^n[0],f=t[e+1]^n[1],l=t[e+2]^n[2],p=t[e+3]^n[3],h=4,d=1;c>d;d++)var y=r[u>>>24]^o[255&f>>>16]^i[255&l>>>8]^s[255&p]^n[h++],g=r[f>>>24]^o[255&l>>>16]^i[255&p>>>8]^s[255&u]^n[h++],v=r[l>>>24]^o[255&p>>>16]^i[255&u>>>8]^s[255&f]^n[h++],p=r[p>>>24]^o[255&u>>>16]^i[255&f>>>8]^s[255&l]^n[h++],u=y,f=g,l=v;y=(a[u>>>24]<<24|a[255&f>>>16]<<16|a[255&l>>>8]<<8|a[255&p])^n[h++],g=(a[f>>>24]<<24|a[255&l>>>16]<<16|a[255&p>>>8]<<8|a[255&u])^n[h++],v=(a[l>>>24]<<24|a[255&p>>>16]<<16|a[255&u>>>8]<<8|a[255&f])^n[h++],p=(a[p>>>24]<<24|a[255&u>>>16]<<16|a[255&f>>>8]<<8|a[255&l])^n[h++],t[e]=y,t[e+1]=g,t[e+2]=v,t[e+3]=p},keySize:8});t.AES=e._createHelper(n)}(),n("lib/crypto-js/rollups/aes",function(){}),n("src/adapters/crypto",["require","../../lib/crypto-js/rollups/aes","../../lib/encoding"],function(t){function e(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t[r])<<24-8*(r%4);return a.create(n,e)}function n(t){return new TextEncoder("utf-8").encode(t)}function o(t){return new TextDecoder("utf-8").decode(t)}function i(t,e,n){this.context=t,this.encrypt=e,this.decrypt=n}function s(t,i){this.provider=i;var s=r.AES;this.encrypt=function(r){var o=e(r),i=s.encrypt(o,t),a=n(i);return a},this.decrypt=function(e){var i=o(e),a=s.decrypt(i,t),c=a.toString(r.enc.Utf8),u=n(c);return u}}t("../../lib/crypto-js/rollups/aes");var a=r.lib.WordArray;return t("../../lib/encoding"),i.prototype.clear=function(t){this.context.clear(t)},i.prototype.get=function(t,e){var n=this.decrypt;this.context.get(t,function(t,r){return t?(e(t),void 0):(r&&(r=n(r)),e(null,r),void 0)})},i.prototype.put=function(t,e,n){var r=this.encrypt(e);this.context.put(t,r,n)},i.prototype.delete=function(t,e){this.context.delete(t,e)},s.isSupported=function(){return!0},s.prototype.open=function(t){this.provider.open(t)},s.prototype.getReadOnlyContext=function(){return new i(this.provider.getReadOnlyContext(),this.encrypt,this.decrypt)},s.prototype.getReadWriteContext=function(){return new i(this.provider.getReadWriteContext(),this.encrypt,this.decrypt)},s}),n("src/adapters/adapters",["require","./zlib","./crypto"],function(t){return{Compression:t("./zlib"),Encryption:t("./crypto")}}),n("src/environment",["require","./constants"],function(t){function e(t){t=t||{},t.TMP=t.TMP||n.TMP,t.PATH=t.PATH||n.PATH,this.get=function(e){return t[e]},this.set=function(e,n){t[e]=n}}var n=t("./constants").ENVIRONMENT;return e}),n("src/shell",["require","./path","./error","./environment","./../lib/async"],function(t){function e(t,e){e=e||{};var i=new o(e.env),s="/";Object.defineProperty(this,"fs",{get:function(){return t},enumerable:!0}),Object.defineProperty(this,"env",{get:function(){return i},enumerable:!0}),this.cd=function(e,o){e=n.resolve(this.cwd,e),t.stat(e,function(t,n){return t?(o(new r.ENotDirectory),void 0):("DIRECTORY"===n.type?(s=e,o()):o(new r.ENotDirectory),void 0)})},this.pwd=function(){return s}}var n=t("./path"),r=t("./error"),o=t("./environment"),i=t("./../lib/async");return e.prototype.exec=function(t,e,r){var o=this.fs;"function"==typeof e&&(r=e,e=[]),e=e||[],r=r||function(){},t=n.resolve(this.cwd,t),o.readFile(t,"utf8",function(t,n){if(t)return r(t),void 0;try{var i=Function("fs","args","callback",n);i(o,e,r)}catch(s){r(s)}})},e.prototype.touch=function(t,e,r){function o(t){s.writeFile(t,"",r)}function i(t){var n=Date.now(),o=e.date||n,i=e.date||n;s.utimes(t,o,i,r)}var s=this.fs;"function"==typeof e&&(r=e,e={}),e=e||{},r=r||function(){},t=n.resolve(this.cwd,t),s.stat(t,function(n){n?e.updateOnly===!0?r():o(t):i(t)})},e.prototype.cat=function(t,e){function r(t,e){var r=n.resolve(this.cwd,t);o.readFile(r,"utf8",function(t,n){return t?(e(t),void 0):(s+=n+"\n",e(),void 0)})}var o=this.fs,s="";return e=e||function(){},t?(t="string"==typeof t?[t]:t,i.eachSeries(t,r,function(t){t?e(t):e(null,s.replace(/\n$/,""))}),void 0):(e(Error("Missing files argument")),void 0)},e.prototype.ls=function(t,e,r){function o(t,r){var a=n.resolve(this.cwd,t),c=[];s.readdir(a,function(t,u){function f(t,r){t=n.join(a,t),s.stat(t,function(i,s){if(i)return r(i),void 0;var u={path:n.basename(t),links:s.nlinks,size:s.size,modified:s.mtime,type:s.type};e.recursive&&"DIRECTORY"===s.type?o(n.join(a,u.path),function(t,e){return t?(r(t),void 0):(u.contents=e,c.push(u),r(),void 0)}):(c.push(u),r())})}return t?(r(t),void 0):(i.each(u,f,function(t){r(t,c)}),void 0)})}var s=this.fs;return"function"==typeof e&&(r=e,e={}),e=e||{},r=r||function(){},t?(o(t,r),void 0):(r(Error("Missing dir argument")),void 0)},e.prototype.rm=function(t,e,o){function s(t,o){t=n.resolve(this.cwd,t),a.stat(t,function(c,u){return c?(o(c),void 0):"FILE"===u.type?(a.unlink(t,o),void 0):(a.readdir(t,function(c,u){return c?(o(c),void 0):0===u.length?(a.rmdir(t,o),void 0):e.recursive?(u=u.map(function(e){return n.join(t,e)}),i.each(u,s,function(e){return e?(o(e),void 0):(a.rmdir(t,o),void 0)}),void 0):(o(new r.ENotEmpty),void 0)}),void 0)})}var a=this.fs;return"function"==typeof e&&(o=e,e={}),e=e||{},o=o||function(){},t?(s(t,o),void 0):(o(Error("Missing path argument")),void 0)},e.prototype.tempDir=function(t){var e=this.fs,n=this.env.get("TMP");t=t||function(){},e.mkdir(n,function(){t(null,n)})},e}),n("src/fs",["require","./../lib/nodash","./../lib/encoding","./path","./path","./path","./path","./path","./shared","./shared","./shared","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./error","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./constants","./providers/providers","./adapters/adapters","./shell"],function(t){function e(t,e){this.id=t,this.type=e||Ue}function n(t,e,n,r){this.path=t,this.id=e,this.flags=n,this.position=r}function r(t,e,n){var r=Date.now();this.id=We,this.mode=Pe,this.atime=t||r,this.ctime=e||r,this.mtime=n||r,this.rnode=we()}function o(t,e,n,r,o,i,s,a,c,u){var f=Date.now();this.id=t||we(),this.mode=e||Ue,this.size=n||0,this.atime=r||f,this.ctime=o||f,this.mtime=i||f,this.flags=s||[],this.xattrs=a||{},this.nlinks=c||0,this.version=u||0,this.blksize=void 0,this.nblocks=1,this.data=we()}function i(t,e){this.node=t.id,this.dev=e,this.size=t.size,this.nlinks=t.nlinks,this.atime=t.atime,this.mtime=t.mtime,this.ctime=t.ctime,this.type=t.mode}function s(t,e,n,r,o){var i=t.flags;ye(i).contains(nn)&&delete r.ctime,ye(i).contains(en)&&delete r.mtime;var s=!1;r.ctime&&(n.ctime=r.ctime,n.atime=r.ctime,s=!0),r.atime&&(n.atime=r.atime,s=!0),r.mtime&&(n.mtime=r.mtime,s=!0),s?t.put(n.id,n,o):o()}function a(t,e,n){function r(e,r){e?n(e):r&&r.mode===Pe&&r.rnode?t.get(r.rnode,o):n(new Ne("missing super node"))}function o(t,e){t?n(t):e?n(null,e):n(new ke("path does not exist"))}function i(e,r){e?n(e):r.mode===je&&r.data?t.get(r.data,s):n(new Re("a component of the path prefix is not a directory"))}function s(e,r){if(e)n(e);else if(ye(r).has(f)){var o=r[f].id;t.get(o,c)}else n(new ke("path does not exist"))}function c(t,e){t?n(t):e.mode==ze?(p++,p>qe?n(new De("too many symbolic links were encountered")):u(e.data)):n(null,e)}function u(e){e=ge(e),l=ve(e),f=me(e),Le==f?t.get(We,r):a(t,l,i)}if(e=ge(e),!e)return n(new ke("path is an empty string"));var f=me(e),l=ve(e),p=0;Le==f?t.get(We,r):a(t,l,i)}function c(t,e,n,r,o,i){function c(e,a){function c(e){e?i(e):s(t,u,a,{ctime:Date.now()},i)}a?a.xattrs[n]:null,e?i(e):o===Je&&a.xattrs.hasOwnProperty(n)?i(new _e("attribute already exists")):o!==tn||a.xattrs.hasOwnProperty(n)?(a.xattrs[n]=r,t.put(a.id,a,c)):i(new Me("attribute does not exist"))}var u;"string"==typeof e?(u=e,a(t,e,c)):"object"==typeof e&&"string"==typeof e.id?(u=e.path,t.get(e.id,c)):i(new Te("path or file descriptor of wrong type"))}function u(t,e){function n(n,o){!n&&o?e(new _e):n&&!n instanceof ke?e(n):(a=new r,t.put(a.id,a,i))}function i(n){n?e(n):(c=new o(a.rnode,je),c.nlinks+=1,t.put(c.id,c,s))}function s(n){n?e(n):(u={},t.put(c.data,u,e))}var a,c,u;t.get(We,n)}function f(t,n,r){function i(e,n){!e&&n?r(new _e):e&&!e instanceof ke?r(e):a(t,m,c)}function c(e,n){e?r(e):(y=n,t.get(y.data,u))}function u(e,n){e?r(e):(g=n,h=new o(void 0,je),h.nlinks+=1,t.put(h.id,h,f))}function f(e){e?r(e):(d={},t.put(h.data,d,p))}function l(e){if(e)r(e);else{var n=Date.now();s(t,m,y,{mtime:n,ctime:n},r)}}function p(n){n?r(n):(g[v]=new e(h.id,je),t.put(y.data,g,l))}n=ge(n);var h,d,y,g,v=me(n),m=ve(n);a(t,n,i)}function l(t,e,n){function r(e,r){e?n(e):(y=r,t.get(y.data,o))}function o(e,r){e?n(e):Le==v?n(new Oe):ye(r).has(v)?(g=r,h=g[v].id,t.get(h,i)):n(new ke)}function i(e,r){e?n(e):r.mode!=je?n(new Re):(h=r,t.get(h.data,c))}function c(t,e){t?n(t):(d=e,ye(d).size()>0?n(new Se):f())}function u(e){if(e)n(e);else{var r=Date.now();s(t,m,y,{mtime:r,ctime:r},l)}}function f(){delete g[v],t.put(y.data,g,u)}function l(e){e?n(e):t.delete(h.id,p)}function p(e){e?n(e):t.delete(h.data,n)}e=ge(e);var h,d,y,g,v=me(e),m=ve(e);a(t,m,r)}function p(t,n,r,i){function c(e,n){e?i(e):(m=n,t.get(m.data,u))}function u(e,n){e?i(e):(E=n,ye(E).has(_)?ye(r).contains(Ge)?i(new ke("O_CREATE and O_EXCLUSIVE are set, and the named file exists")):(b=E[_],b.type==je&&ye(r).contains(Ve)?i(new Ae("the named file is a directory and O_WRITE is set")):t.get(b.id,f)):ye(r).contains(Ze)?h():i(new ke("O_CREATE is not set and the named file does not exist")))}function f(t,e){if(t)i(t);else{var n=e;n.mode==ze?(k++,k>qe?i(new De("too many symbolic links were encountered")):l(n.data)):p(void 0,n)}}function l(e){e=ge(e),A=ve(e),_=me(e),Le==_&&(ye(r).contains(Ve)?i(new Ae("the named file is a directory and O_WRITE is set")):a(t,n,p)),a(t,A,c)}function p(t,e){t?i(t):(w=e,i(null,w))}function h(){w=new o(void 0,Ue),w.nlinks+=1,t.put(w.id,w,d)}function d(e){e?i(e):(x=new Uint8Array(0),t.put(w.data,x,g))}function y(e){if(e)i(e);else{var n=Date.now();s(t,A,m,{mtime:n,ctime:n},v)}}function g(n){n?i(n):(E[_]=new e(w.id,Ue),t.put(m.data,E,y))}function v(t){t?i(t):i(null,w)}n=ge(n);var m,E,b,w,x,_=me(n),A=ve(n),k=0;Le==_?ye(r).contains(Ve)?i(new Ae("the named file is a directory and O_WRITE is set")):a(t,n,p):a(t,A,c)}function h(t,e,n,r,o,i){function a(t){t?i(t):i(null,o)}function c(n){if(n)i(n);else{var r=Date.now();s(t,e.path,l,{mtime:r,ctime:r},a)}}function u(e){e?i(e):t.put(l.id,l,c)}function f(s,a){if(s)i(s);else{l=a;var c=new Uint8Array(o),f=n.subarray(r,r+o);c.set(f),e.position=o,l.size=o,l.version+=1,t.put(l.data,c,u)}}var l;t.get(e.id,f)}function d(t,e,n,r,o,i,a){function c(t){t?a(t):a(null,o)}function u(n){if(n)a(n);else{var r=Date.now();s(t,e.path,h,{mtime:r,ctime:r},c)}}function f(e){e?a(e):t.put(h.id,h,u)}function l(s,c){if(s)a(s);else{d=c;var u=void 0!==i&&null!==i?i:e.position,l=Math.max(d.length,u+o),p=new Uint8Array(l);d&&p.set(d);var y=n.subarray(r,r+o);p.set(y,u),void 0===i&&(e.position+=o),h.size=l,h.version+=1,t.put(h.data,p,f)}}function p(e,n){e?a(e):(h=n,t.get(h.data,l)) +}var h,d;t.get(e.id,p)}function y(t,e,n,r,o,i,s){function a(t,a){if(t)s(t);else{f=a;var c=void 0!==i&&null!==i?i:e.position;o=c+o>n.length?o-c:o;var u=f.subarray(c,c+o);n.set(u,r),void 0===i&&(e.position+=o),s(null,o)}}function c(e,n){e?s(e):(u=n,t.get(u.data,a))}var u,f;t.get(e.id,c)}function g(t,e,n){function r(t,e){t?n(t):n(null,e)}e=ge(e),me(e),a(t,e,r)}function v(t,e,n){function r(t,e){t?n(t):n(null,e)}t.get(e.id,r)}function m(t,e,n){function r(e,r){e?n(e):(s=r,t.get(s.data,o))}function o(e,r){e?n(e):(c=r,ye(c).has(u)?t.get(c[u].id,i):n(new ke("a component of the path does not name an existing file")))}function i(t,e){t?n(t):n(null,e)}e=ge(e);var s,c,u=me(e),f=ve(e);Le==u?a(t,e,i):a(t,f,r)}function E(t,e,n,r){function o(e){e?r(e):s(t,n,E,{ctime:Date.now()},r)}function i(e,n){e?r(e):(E=n,E.nlinks+=1,t.put(E.id,E,o))}function c(e){e?r(e):t.get(m[b].id,i)}function u(e,n){e?r(e):(m=n,ye(m).has(b)?r(new _e("newpath resolves to an existing file")):(m[b]=g[h],t.put(v.data,m,c)))}function f(e,n){e?r(e):(v=n,t.get(v.data,u))}function l(e,n){e?r(e):(g=n,ye(g).has(h)?a(t,w,f):r(new ke("a component of either path prefix does not exist")))}function p(e,n){e?r(e):(y=n,t.get(y.data,l))}e=ge(e);var h=me(e),d=ve(e);n=ge(n);var y,g,v,m,E,b=me(n),w=ve(n);a(t,d,p)}function b(t,e,n){function r(e){e?n(e):(delete l[h],t.put(f.data,l,function(){var e=Date.now();s(t,d,f,{mtime:e,ctime:e},n)}))}function o(e){e?n(e):t.delete(p.data,r)}function i(i,a){i?n(i):(p=a,p.nlinks-=1,1>p.nlinks?t.delete(p.id,o):t.put(p.id,p,function(){s(t,e,p,{ctime:Date.now()},r)}))}function c(e,r){e?n(e):(l=r,ye(l).has(h)?t.get(l[h].id,i):n(new ke("a component of the path does not name an existing file")))}function u(e,r){e?n(e):(f=r,t.get(f.data,c))}e=ge(e);var f,l,p,h=me(e),d=ve(e);a(t,d,u)}function w(t,e,n){function r(t,e){if(t)n(t);else{s=e;var r=Object.keys(s);n(null,r)}}function o(e,o){e?n(e):(i=o,t.get(i.data,r))}e=ge(e),me(e);var i,s;a(t,e,o)}function x(t,n,r,i){function c(e,n){e?i(e):(h=n,t.get(h.data,u))}function u(t,e){t?i(t):(d=e,ye(d).has(g)?i(new _e("the destination path already exists")):f())}function f(){y=new o(void 0,ze),y.nlinks+=1,y.size=n.length,y.data=n,t.put(y.id,y,p)}function l(e){if(e)i(e);else{var n=Date.now();s(t,v,h,{mtime:n,ctime:n},i)}}function p(n){n?i(n):(d[g]=new e(y.id,ze),t.put(h.data,d,l))}r=ge(r);var h,d,y,g=me(r),v=ve(r);Le==g?i(new _e("the destination path already exists")):a(t,v,c)}function _(t,e,n){function r(e,r){e?n(e):(s=r,t.get(s.data,o))}function o(e,r){e?n(e):(c=r,ye(c).has(u)?t.get(c[u].id,i):n(new ke("a component of the path does not name an existing file")))}function i(t,e){t?n(t):e.mode!=ze?n(new Te("path not a symbolic link")):n(null,e.data)}e=ge(e);var s,c,u=me(e),f=ve(e);a(t,f,r)}function A(t,e,n,r){function o(e,n){e?r(e):n.mode==je?r(new Ae("the named file is a directory")):(f=n,t.get(f.data,i))}function i(e,o){if(e)r(e);else{var i=new Uint8Array(n);o&&i.set(o.subarray(0,n)),t.put(f.data,i,u)}}function c(n){if(n)r(n);else{var o=Date.now();s(t,e,f,{mtime:o,ctime:o},r)}}function u(e){e?r(e):(f.size=n,f.version+=1,t.put(f.id,f,c))}e=ge(e);var f;0>n?r(new Te("length cannot be negative")):a(t,e,o)}function k(t,e,n,r){function o(e,n){e?r(e):n.mode==je?r(new Ae("the named file is a directory")):(u=n,t.get(u.data,i))}function i(e,o){if(e)r(e);else{var i=new Uint8Array(n);o&&i.set(o.subarray(0,n)),t.put(u.data,i,c)}}function a(n){if(n)r(n);else{var o=Date.now();s(t,e.path,u,{mtime:o,ctime:o},r)}}function c(e){e?r(e):(u.size=n,u.version+=1,t.put(u.id,u,a))}var u;0>n?r(new Te("length cannot be negative")):t.get(e.id,o)}function O(t,e,n,r,o){function i(i,a){i?o(i):s(t,e,a,{atime:n,ctime:r,mtime:r},o)}e=ge(e),"number"!=typeof n||"number"!=typeof r?o(new Te("atime and mtime must be number")):0>n||0>r?o(new Te("atime and mtime must be positive integers")):a(t,e,i)}function S(t,e,n,r,o){function i(i,a){i?o(i):s(t,e.path,a,{atime:n,ctime:r,mtime:r},o)}"number"!=typeof n||"number"!=typeof r?o(new Te("atime and mtime must be a number")):0>n||0>r?o(new Te("atime and mtime must be positive integers")):t.get(e.id,i)}function R(t,e,n,r,o,i){e=ge(e),"string"!=typeof n?i(new Te("attribute name must be a string")):n?null!==o&&o!==Je&&o!==tn?i(new Te("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE")):c(t,e,n,r,o,i):i(new Te("attribute name cannot be an empty string"))}function C(t,e,n,r,o,i){"string"!=typeof n?i(new Te("attribute name must be a string")):n?null!==o&&o!==Je&&o!==tn?i(new Te("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE")):c(t,e,n,r,o,i):i(new Te("attribute name cannot be an empty string"))}function T(t,e,n,r){function o(t,e){e?e.xattrs[n]:null,t?r(t):e.xattrs.hasOwnProperty(n)?r(null,e.xattrs[n]):r(new Me("attribute does not exist"))}e=ge(e),"string"!=typeof n?r(new Te("attribute name must be a string")):n?a(t,e,o):r(new Te("attribute name cannot be an empty string"))}function I(t,e,n,r){function o(t,e){e?e.xattrs[n]:null,t?r(t):e.xattrs.hasOwnProperty(n)?r(null,e.xattrs[n]):r(new Me("attribute does not exist"))}"string"!=typeof n?r(new Te("attribute name must be a string")):n?t.get(e.id,o):r(new Te("attribute name cannot be an empty string"))}function D(t,e,n,r){function o(o,i){function a(n){n?r(n):s(t,e,i,{ctime:Date.now()},r)}var c=i?i.xattrs:null;o?r(o):c.hasOwnProperty(n)?(delete i.xattrs[n],t.put(i.id,i,a)):r(new Me("attribute does not exist"))}e=ge(e),"string"!=typeof n?r(new Te("attribute name must be a string")):n?a(t,e,o):r(new Te("attribute name cannot be an empty string"))}function N(t,e,n,r){function o(o,i){function a(n){n?r(n):s(t,e.path,i,{ctime:Date.now()},r)}o?r(o):i.xattrs.hasOwnProperty(n)?(delete i.xattrs[n],t.put(i.id,i,a)):r(new Me("attribute does not exist"))}"string"!=typeof n?r(new Te("attribute name must be a string")):n?t.get(e.id,o):r(new Te("attribute name cannot be an empty string"))}function M(t){return ye($e).has(t)?$e[t]:null}function B(t,e,n){return t?"function"==typeof t?t={encoding:e,flag:n}:"string"==typeof t&&(t={encoding:t,flag:n}):t={encoding:e,flag:n},t}function F(t,e){var n;return be(t)?n=Error("Path must be a string without null bytes."):Ee(t)||(n=Error("Path must be absolute.")),n?(e(n),!1):!0}function U(t){return"function"==typeof t?t:function(t){if(t)throw t}}function j(t,e){function n(){l.forEach(function(t){t.call(this)}.bind(a)),l=null}t=t||{},e=e||xe;var r=t.name||Be,o=t.flags,i=t.provider||new rn.Default(r),s=ye(o).contains(Fe),a=this;a.readyState=Ye,a.name=r,a.error=null;var c={},f=1;Object.defineProperty(this,"openFiles",{get:function(){return c}}),this.allocDescriptor=function(t){var e=f++;return c[e]=t,e},this.releaseDescriptor=function(t){delete c[t]};var l=[];this.queueOrRun=function(t){var e;return He==a.readyState?t.call(a):Xe==a.readyState?e=new Ne("unknown error"):l.push(t),e},i.open(function(t,r){function c(t){a.provider={getReadWriteContext:function(){var t=i.getReadWriteContext();return t.flags=o,t},getReadOnlyContext:function(){var t=i.getReadOnlyContext();return t.flags=o,t}},t?a.readyState=Xe:(a.readyState=He,n()),e(t,a)}if(t)return c(t);if(!s&&!r)return c(null);var f=i.getReadWriteContext();f.clear(function(t){return t?(c(t),void 0):(u(f,c),void 0)})})}function z(t,e,r,o,i){function s(e,s){if(e)i(e);else{var a;a=ye(o).contains(Qe)?s.size:0;var c=new n(r,s.id,o,a),u=t.allocDescriptor(c);i(null,u)}}F(r,i)&&(o=M(o),o||i(new Te("flags is not valid")),p(e,r,o,s))}function P(t,e,n){ye(t.openFiles).has(e)?(t.releaseDescriptor(e),n(null)):n(new Ce("invalid file descriptor"))}function L(t,e,n){function r(t){t?n(t):n(null)}F(e,n)&&f(t,e,r)}function W(t,e,n){function r(t){t?n(t):n(null)}F(e,n)&&l(t,e,r)}function q(t,e,n,r){function o(t,n){if(t)r(t);else{var o=new i(n,e);r(null,o)}}F(n,r)&&g(t,n,o)}function H(t,e,n,r){function o(e,n){if(e)r(e);else{var o=new i(n,t.name);r(null,o)}}var s=t.openFiles[n];s?v(e,s,o):r(new Ce("invalid file descriptor"))}function Y(t,e,n,r){function o(t){t?r(t):r(null)}F(e,r)&&F(n,r)&&E(t,e,n,o)}function X(t,e,n){function r(t){t?n(t):n(null)}F(e,n)&&b(t,e,r)}function K(t,e,n,r,o,i,s,a){function c(t,e){t?a(t):a(null,e)}o=void 0===o?0:o,i=void 0===i?r.length-o:i;var u=t.openFiles[n];u?ye(u.flags).contains(Ke)?y(e,u,r,o,i,s,c):a(new Ce("descriptor does not permit reading")):a(new Ce("invalid file descriptor"))}function V(t,e,r,o,s){if(o=B(o,null,"r"),F(r,s)){var a=M(o.flag||"r");a||s(new Te("flags is not valid")),p(e,r,a,function(c,u){if(c)return s(c);var f=new n(r,u.id,a,0),l=t.allocDescriptor(f);v(e,f,function(n,r){if(n)return s(n);var a=new i(r,t.name),c=a.size,u=new Uint8Array(c);y(e,f,u,0,c,0,function(e){if(e)return s(e);t.releaseDescriptor(l);var n;n="utf8"===o.encoding?new TextDecoder("utf-8").decode(u):u,s(null,n)})})})}}function Z(t,e,n,r,o,i,s,a){function c(t,e){t?a(t):a(null,e)}o=void 0===o?0:o,i=void 0===i?r.length-o:i;var u=t.openFiles[n];u?ye(u.flags).contains(Ve)?i>r.length-o?a(new Ie("intput buffer is too small")):d(e,u,r,o,i,s,c):a(new Ce("descriptor does not permit writing")):a(new Ce("invalid file descriptor"))}function G(t,e,r,o,i,s){if(i=B(i,"utf8","w"),F(r,s)){var a=M(i.flag||"w");a||s(new Te("flags is not valid")),o=o||"","number"==typeof o&&(o=""+o),"string"==typeof o&&"utf8"===i.encoding&&(o=new TextEncoder("utf-8").encode(o)),p(e,r,a,function(i,c){if(i)return s(i);var u=new n(r,c.id,a,0),f=t.allocDescriptor(u);h(e,u,o,0,o.length,function(e){return e?s(e):(t.releaseDescriptor(f),s(null),void 0)})})}}function Q(t,e,r,o,i,s){if(i=B(i,"utf8","a"),F(r,s)){var a=M(i.flag||"a");a||s(new Te("flags is not valid")),o=o||"","number"==typeof o&&(o=""+o),"string"==typeof o&&"utf8"===i.encoding&&(o=new TextEncoder("utf-8").encode(o)),p(e,r,a,function(i,c){if(i)return s(i);var u=new n(r,c.id,a,c.size),f=t.allocDescriptor(u);d(e,u,o,0,o.length,u.position,function(e){return e?s(e):(t.releaseDescriptor(f),s(null),void 0)})})}}function $(t,e,n,r){function o(t){r(t?!1:!0)}q(t,e,n,o)}function J(t,e,n,r){function o(t,e){t?r(t):r(null,e)}F(e,r)&&T(t,e,n,o)}function te(t,e,n,r,o){function i(t,e){t?o(t):o(null,e)}var s=t.openFiles[n];s?I(e,s,r,i):o(new Ce("invalid file descriptor"))}function ee(t,e,n,r,o,i){function s(t){t?i(t):i(null)}F(e,i)&&R(t,e,n,r,o,s)}function ne(t,e,n,r,o,i,s){function a(t){t?s(t):s(null)}var c=t.openFiles[n];c?ye(c.flags).contains(Ve)?C(e,c,r,o,i,a):s(new Ce("descriptor does not permit writing")):s(new Ce("invalid file descriptor"))}function re(t,e,n,r){function o(t){t?r(t):r(null)}F(e,r)&&D(t,e,n,o)}function oe(t,e,n,r,o){function i(t){t?o(t):o(null)}var s=t.openFiles[n];s?ye(s.flags).contains(Ve)?N(e,s,r,i):o(new Ce("descriptor does not permit writing")):o(new Ce("invalid file descriptor"))}function ie(t,e,n,r,o,i){function s(t,e){t?i(t):0>e.size+r?i(new Te("resulting file offset would be negative")):(a.position=e.size+r,i(null,a.position))}var a=t.openFiles[n];a||i(new Ce("invalid file descriptor")),"SET"===o?0>r?i(new Te("resulting file offset would be negative")):(a.position=r,i(null,a.position)):"CUR"===o?0>a.position+r?i(new Te("resulting file offset would be negative")):(a.position+=r,i(null,a.position)):"END"===o?v(e,a,s):i(new Te("whence argument is not a proper value"))}function se(t,e,n){function r(t,e){t?n(t):n(null,e)}F(e,n)&&w(t,e,r)}function ae(t,e,n,r,o){function i(t){t?o(t):o(null)}if(F(e,o)){var s=Date.now();n=n?n:s,r=r?r:s,O(t,e,n,r,i)}}function ce(t,e,n,r,o,i){function s(t){t?i(t):i(null)}var a=Date.now();r=r?r:a,o=o?o:a;var c=t.openFiles[n];c?ye(c.flags).contains(Ve)?S(e,c,r,o,s):i(new Ce("descriptor does not permit writing")):i(new Ce("invalid file descriptor"))}function ue(t,e,n,r){function o(t){t?r(t):r(null)}function i(n){n?r(n):b(t,e,o)}F(e,r)&&F(n,r)&&E(t,e,n,i)}function fe(t,e,n,r){function o(t){t?r(t):r(null)}F(e,r)&&F(n,r)&&x(t,e,n,o)}function le(t,e,n){function r(t,e){t?n(t):n(null,e)}F(e,n)&&_(t,e,r)}function pe(t,e,n,r){function o(e,n){if(e)r(e);else{var o=new i(n,t.name);r(null,o)}}F(n,r)&&m(e,n,o)}function he(t,e,n,r){function o(t){t?r(t):r(null)}F(e,r)&&A(t,e,n,o)}function de(t,e,n,r,o){function i(t){t?o(t):o(null)}var s=t.openFiles[n];s?ye(s.flags).contains(Ve)?k(e,s,r,i):o(new Ce("descriptor does not permit writing")):o(new Ce("invalid file descriptor"))}var ye=t("./../lib/nodash");t("./../lib/encoding");var ge=t("./path").normalize,ve=t("./path").dirname,me=t("./path").basename,Ee=t("./path").isAbsolute,be=t("./path").isNull,we=t("./shared").guid;t("./shared").hash;var xe=t("./shared").nop,_e=t("./error").EExists,Ae=t("./error").EIsDirectory,ke=t("./error").ENoEntry,Oe=t("./error").EBusy,Se=t("./error").ENotEmpty,Re=t("./error").ENotDirectory,Ce=t("./error").EBadFileDescriptor;t("./error").ENotImplemented,t("./error").ENotMounted;var Te=t("./error").EInvalid,Ie=t("./error").EIO,De=t("./error").ELoop,Ne=t("./error").EFileSystemError,Me=t("./error").ENoAttr,Be=t("./constants").FILE_SYSTEM_NAME,Fe=t("./constants").FS_FORMAT,Ue=t("./constants").MODE_FILE,je=t("./constants").MODE_DIRECTORY,ze=t("./constants").MODE_SYMBOLIC_LINK,Pe=t("./constants").MODE_META,Le=t("./constants").ROOT_DIRECTORY_NAME,We=t("./constants").SUPER_NODE_ID,qe=t("./constants").SYMLOOP_MAX,He=t("./constants").FS_READY,Ye=t("./constants").FS_PENDING,Xe=t("./constants").FS_ERROR,Ke=t("./constants").O_READ,Ve=t("./constants").O_WRITE,Ze=t("./constants").O_CREATE,Ge=t("./constants").O_EXCLUSIVE;t("./constants").O_TRUNCATE;var Qe=t("./constants").O_APPEND,$e=t("./constants").O_FLAGS,Je=t("./constants").XATTR_CREATE,tn=t("./constants").XATTR_REPLACE,en=t("./constants").FS_NOMTIME,nn=t("./constants").FS_NOCTIME,rn=t("./providers/providers"),on=t("./adapters/adapters"),sn=t("./shell");return j.providers=rn,j.adapters=on,j.prototype.open=function(t,e,n,r){r=U(arguments[arguments.length-1]);var o=this,i=o.queueOrRun(function(){var n=o.provider.getReadWriteContext();z(o,n,t,e,r)});i&&r(i)},j.prototype.close=function(t,e){P(this,t,U(e))},j.prototype.mkdir=function(t,e,n){"function"==typeof e&&(n=e),n=U(n);var r=this,o=r.queueOrRun(function(){var e=r.provider.getReadWriteContext();L(e,t,n)});o&&n(o)},j.prototype.rmdir=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();W(r,t,e)});r&&e(r)},j.prototype.stat=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();q(r,n.name,t,e)});r&&e(r)},j.prototype.fstat=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();H(n,r,t,e)});r&&e(r)},j.prototype.link=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();Y(o,t,e,n)});o&&n(o)},j.prototype.unlink=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();X(r,t,e)});r&&e(r)},j.prototype.read=function(t,e,n,r,o,i){function s(t,n){i(t,n||0,e)}i=U(i);var a=this,c=a.queueOrRun(function(){var i=a.provider.getReadWriteContext();K(a,i,t,e,n,r,o,s)});c&&i(c)},j.prototype.readFile=function(t,e){var n=U(arguments[arguments.length-1]),r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();V(r,o,t,e,n)});o&&n(o)},j.prototype.write=function(t,e,n,r,o,i){i=U(i);var s=this,a=s.queueOrRun(function(){var a=s.provider.getReadWriteContext();Z(s,a,t,e,n,r,o,i)});a&&i(a)},j.prototype.writeFile=function(t,e,n){var r=U(arguments[arguments.length-1]),o=this,i=o.queueOrRun(function(){var i=o.provider.getReadWriteContext();G(o,i,t,e,n,r)});i&&r(i)},j.prototype.appendFile=function(t,e,n){var r=U(arguments[arguments.length-1]),o=this,i=o.queueOrRun(function(){var i=o.provider.getReadWriteContext();Q(o,i,t,e,n,r)});i&&r(i)},j.prototype.exists=function(t){var e=U(arguments[arguments.length-1]),n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();$(r,n.name,t,e)});r&&e(r)},j.prototype.lseek=function(t,e,n,r){r=U(r);var o=this,i=o.queueOrRun(function(){var i=o.provider.getReadWriteContext();ie(o,i,t,e,n,r)});i&&r(i)},j.prototype.readdir=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();se(r,t,e)});r&&e(r)},j.prototype.rename=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();ue(o,t,e,n)});o&&n(o)},j.prototype.readlink=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();le(r,t,e)});r&&e(r)},j.prototype.symlink=function(t,e){var n=U(arguments[arguments.length-1]),r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();fe(o,t,e,n)});o&&n(o)},j.prototype.lstat=function(t,e){e=U(e);var n=this,r=n.queueOrRun(function(){var r=n.provider.getReadWriteContext();pe(n,r,t,e)});r&&e(r)},j.prototype.truncate=function(t,e,n){"function"==typeof e&&(n=e,e=0),n=U(n),e="number"==typeof e?e:0;var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();he(o,t,e,n)});o&&n(o)},j.prototype.ftruncate=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();de(r,o,t,e,n)});o&&n(o)},j.prototype.utimes=function(t,e,n,r){r=U(r);var o=this,i=o.queueOrRun(function(){var i=o.provider.getReadWriteContext();ae(i,t,e,n,r)});i&&r(i)},j.prototype.futimes=function(t,e,n,r){r=U(r);var o=this,i=o.queueOrRun(function(){var i=o.provider.getReadWriteContext();ce(o,i,t,e,n,r)});i&&r(i)},j.prototype.setxattr=function(t,e,n,r,o){o=U(arguments[arguments.length-1]);var i="function"!=typeof r?r:null,s=this,a=s.queueOrRun(function(){var r=s.provider.getReadWriteContext();ee(r,t,e,n,i,o)});a&&o(a)},j.prototype.getxattr=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();J(o,t,e,n)});o&&n(o)},j.prototype.fsetxattr=function(t,e,n,r,o){o=U(arguments[arguments.length-1]);var i="function"!=typeof r?r:null,s=this,a=s.queueOrRun(function(){var r=s.provider.getReadWriteContext();ne(s,r,t,e,n,i,o)});a&&o(a)},j.prototype.fgetxattr=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();te(r,o,t,e,n)});o&&n(o)},j.prototype.removexattr=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();re(o,t,e,n)});o&&n(o)},j.prototype.fremovexattr=function(t,e,n){n=U(n);var r=this,o=r.queueOrRun(function(){var o=r.provider.getReadWriteContext();oe(r,o,t,e,n)});o&&n(o)},j.prototype.Shell=function(t){return new sn(this,t)},j}),n("src/index",["require","./fs","./path","./error"],function(t){return{FileSystem:t("./fs"),Path:t("./path"),Errors:t("./error")}});var o=e("src/index");return o}); \ No newline at end of file diff --git a/examples/refactoring-test.html b/examples/refactoring-test.html index 9770aca..87bb106 100644 --- a/examples/refactoring-test.html +++ b/examples/refactoring-test.html @@ -19,9 +19,9 @@ var fs = new Filer.FileSystem({ //var data = new Uint8Array(buffer.length); try { -fs.stat('/', function(error, stats) { +fs.readdir('\u0000', function(error, files) { if(error) throw error; - console.log('stats:', stats); + console.log('contents:', files); }); } catch(e) { console.error(e); diff --git a/src/constants.js b/src/constants.js index 74871ae..660810f 100644 --- a/src/constants.js +++ b/src/constants.js @@ -33,8 +33,12 @@ define(function(require) { ROOT_DIRECTORY_NAME: '/', // basename(normalize(path)) + // FS Mount Flags FS_FORMAT: 'FORMAT', + FS_NOCTIME: 'NOCTIME', + FS_NOMTIME: 'NOMTIME', + // FS File Open Flags O_READ: O_READ, O_WRITE: O_WRITE, O_CREATE: O_CREATE, diff --git a/src/error.js b/src/error.js index 686fbf3..4cf22f5 100644 --- a/src/error.js +++ b/src/error.js @@ -9,122 +9,570 @@ Redistribution and use in source and binary forms, with or without modification, Neither the name of the Mozilla Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Errors based off Node.js custom errors (https://github.com/rvagg/node-errno) made available under the MIT license */ define(function(require) { // 'use strict'; - - function EExists(message){ - this.message = message || ''; + + function Unknown(message){ + this.message = message || 'unknown error'; } - EExists.prototype = new Error(); - EExists.prototype.name = "EExists"; - EExists.prototype.constructor = EExists; + Unknown.prototype = new Error(); + Unknown.prototype.errno = -1; + Unknown.prototype.code = "UNKNOWN"; + Unknown.prototype.constructor = Unknown; - function EIsDirectory(message){ - this.message = message || ''; + function OK(message){ + this.message = message || 'success'; } - EIsDirectory.prototype = new Error(); - EIsDirectory.prototype.name = "EIsDirectory"; - EIsDirectory.prototype.constructor = EIsDirectory; + OK.prototype = new Error(); + OK.prototype.errno = 0; + OK.prototype.code = "OK"; + OK.prototype.constructor = OK; - function ENoEntry(message){ - this.message = message || ''; + function EOF(message){ + this.message = message || 'end of file'; } - ENoEntry.prototype = new Error(); - ENoEntry.prototype.name = "ENoEntry"; - ENoEntry.prototype.constructor = ENoEntry; + EOF.prototype = new Error(); + EOF.prototype.errno = 1; + EOF.prototype.code = "EOF"; + EOF.prototype.constructor = EOF; + + function EAddrInfo(message){ + this.message = message || 'getaddrinfo error'; + } + EAddrInfo.prototype = new Error(); + EAddrInfo.prototype.errno = 2; + EAddrInfo.prototype.code = "EADDRINFO"; + EAddrInfo.prototype.constructor = EAddrInfo; + + function EAcces(message){ + this.message = message || 'permission denied'; + } + EAcces.prototype = new Error(); + EAcces.prototype.errno = 3; + EAcces.prototype.code = "EACCES"; + EAcces.prototype.constructor = EAcces; + + function EAgain(message){ + this.message = message || 'resource temporarily unavailable'; + } + EAgain.prototype = new Error(); + EAgain.prototype.errno = 4; + EAgain.prototype.code = "EAGAIN"; + EAgain.prototype.constructor = EAgain; + + function EAddrInUse(message){ + this.message = message || 'address already in use'; + } + EAddrInUse.prototype = new Error(); + EAddrInUse.prototype.errno = 5; + EAddrInUse.prototype.code = "EADDRINUSE"; + EAddrInUse.prototype.constructor = EAddrInUse; + + function EAddrNotAvail(message){ + this.message = message || 'address not available'; + } + EAddrNotAvail.prototype = new Error(); + EAddrNotAvail.prototype.errno = 6; + EAddrNotAvail.prototype.code = "EADDRNOTAVAIL"; + EAddrNotAvail.prototype.constructor = EAddrNotAvail; + + function EAFNoSupport(message){ + this.message = message || 'address family not supported'; + } + EAFNoSupport.prototype = new Error(); + EAFNoSupport.prototype.errno = 7; + EAFNoSupport.prototype.code = "EAFNOSUPPORT"; + EAFNoSupport.prototype.constructor = EAFNoSupport; - function EBusy(message){ - this.message = message || ''; + function EAlready(message){ + this.message = message || 'connection already in progress'; } - EBusy.prototype = new Error(); - EBusy.prototype.name = "EBusy"; - EBusy.prototype.constructor = EBusy; - - function ENotEmpty(message){ - this.message = message || ''; - } - ENotEmpty.prototype = new Error(); - ENotEmpty.prototype.name = "ENotEmpty"; - ENotEmpty.prototype.constructor = ENotEmpty; - - function ENotDirectory(message){ - this.message = message || ''; - } - ENotDirectory.prototype = new Error(); - ENotDirectory.prototype.name = "ENotDirectory"; - ENotDirectory.prototype.constructor = ENotDirectory; + EAlready.prototype = new Error(); + EAlready.prototype.errno = 8; + EAlready.prototype.code = "EALREADY"; + EAlready.prototype.constructor = EAlready; function EBadFileDescriptor(message){ - this.message = message || ''; + this.message = message || 'bad file descriptor'; } EBadFileDescriptor.prototype = new Error(); - EBadFileDescriptor.prototype.name = "EBadFileDescriptor"; + EBadFileDescriptor.prototype.errno = 9; + EBadFileDescriptor.prototype.code = "EBADF"; EBadFileDescriptor.prototype.constructor = EBadFileDescriptor; - function ENotImplemented(message){ - this.message = message || ''; + function EBusy(message){ + this.message = message || 'resource busy or locked'; } - ENotImplemented.prototype = new Error(); - ENotImplemented.prototype.name = "ENotImplemented"; - ENotImplemented.prototype.constructor = ENotImplemented; + EBusy.prototype = new Error(); + EBusy.prototype.errno = 10; + EBusy.prototype.code = "EBUSY"; + EBusy.prototype.constructor = EBusy; - function ENotMounted(message){ - this.message = message || ''; + function EConnAborted(message){ + this.message = message || 'software caused connection abort'; } - ENotMounted.prototype = new Error(); - ENotMounted.prototype.name = "ENotMounted"; - ENotMounted.prototype.constructor = ENotMounted; + EConnAborted.prototype = new Error(); + EConnAborted.prototype.errno = 11; + EConnAborted.prototype.code = "ECONNABORTED"; + EConnAborted.prototype.constructor = EConnAborted; + function EConnRefused(message){ + this.message = message || 'connection refused'; + } + EConnRefused.prototype = new Error(); + EConnRefused.prototype.errno = 12; + EConnRefused.prototype.code = "ECONNREFUSED"; + EConnRefused.prototype.constructor = EConnRefused; + + function EConnReset(message){ + this.message = message || 'connection reset by peer'; + } + EConnReset.prototype = new Error(); + EConnReset.prototype.errno = 13; + EConnReset.prototype.code = "ECONNRESET"; + EConnReset.prototype.constructor = EConnReset; + + function EDestAddrReq(message){ + this.message = message || 'destination address required'; + } + EDestAddrReq.prototype = new Error(); + EDestAddrReq.prototype.errno = 14; + EDestAddrReq.prototype.code = "EDESTADDRREQ"; + EDestAddrReq.prototype.constructor = EDestAddrReq; + + function EFault(message){ + this.message = message || 'bad address in system call argument'; + } + EFault.prototype = new Error(); + EFault.prototype.errno = 15; + EFault.prototype.code = "EFAULT"; + EFault.prototype.constructor = EFault; + + function EHostUnreach(message){ + this.message = message || 'host is unreachable'; + } + EHostUnreach.prototype = new Error(); + EHostUnreach.prototype.errno = 16; + EHostUnreach.prototype.code = "EHOSTUNREACH"; + EHostUnreach.prototype.constructor = EHostUnreach; + + function EIntr(message){ + this.message = message || 'interrupted system call'; + } + EIntr.prototype = new Error(); + EIntr.prototype.errno = 17; + EIntr.prototype.code = "EINTR"; + EIntr.prototype.constructor = EIntr; + function EInvalid(message){ - this.message = message || ''; + this.message = message || 'invalid argument'; } EInvalid.prototype = new Error(); - EInvalid.prototype.name = "EInvalid"; + EInvalid.prototype.errno = 18; + EInvalid.prototype.code = "EINVAL"; EInvalid.prototype.constructor = EInvalid; - function EIO(message){ - this.message = message || ''; + function EIsConn(message){ + this.message = message || 'socket is already connected'; } - EIO.prototype = new Error(); - EIO.prototype.name = "EIO"; - EIO.prototype.constructor = EIO; + EIsConn.prototype = new Error(); + EIsConn.prototype.errno = 19; + EIsConn.prototype.code = "EISCONN"; + EIsConn.prototype.constructor = EIsConn; + + function EMFile(message){ + this.message = message || 'too many open files'; + } + EMFile.prototype = new Error(); + EMFile.prototype.errno = 20; + EMFile.prototype.code = "EMFILE"; + EMFile.prototype.constructor = EMFile; + + function EMsgSize(message){ + this.message = message || 'message too long'; + } + EMsgSize.prototype = new Error(); + EMsgSize.prototype.errno = 21; + EMsgSize.prototype.code = "EMSGSIZE"; + EMsgSize.prototype.constructor = EMsgSize; + + function ENetDown(message){ + this.message = message || 'network is down'; + } + ENetDown.prototype = new Error(); + ENetDown.prototype.errno = 22; + ENetDown.prototype.code = "ENETDOWN"; + ENetDown.prototype.constructor = ENetDown; + + function ENetUnreach(message){ + this.message = message || 'network is unreachable'; + } + ENetUnreach.prototype = new Error(); + ENetUnreach.prototype.errno = 23; + ENetUnreach.prototype.code = "ENETUNREACH"; + ENetUnreach.prototype.constructor = ENetUnreach; + + function ENFile(message){ + this.message = message || 'file table overflow'; + } + ENFile.prototype = new Error(); + ENFile.prototype.errno = 24; + ENFile.prototype.code = "ENFILE"; + ENFile.prototype.constructor = ENFile; + + function ENoBufS(message){ + this.message = message || 'no buffer space available'; + } + ENoBufS.prototype = new Error(); + ENoBufS.prototype.errno = 25; + ENoBufS.prototype.code = "ENOBUFS"; + ENoBufS.prototype.constructor = ENoBufS; + + function ENoMem(message){ + this.message = message || 'not enough memory'; + } + ENoMem.prototype = new Error(); + ENoMem.prototype.errno = 26; + ENoMem.prototype.code = "ENOMEM"; + ENoMem.prototype.constructor = ENoMem; + + function ENotDirectory(message){ + this.message = message || 'not a directory'; + } + ENotDirectory.prototype = new Error(); + ENotDirectory.prototype.errno = 27; + ENotDirectory.prototype.code = "ENOTDIR"; + ENotDirectory.prototype.constructor = ENotDirectory; + + function EIsDirectory(message){ + this.message = message || 'illegal operation on a directory'; + } + EIsDirectory.prototype = new Error(); + EIsDirectory.prototype.errno = 28; + EIsDirectory.prototype.code = "EISDIR"; + EIsDirectory.prototype.constructor = EIsDirectory; + + function ENoNet(message){ + this.message = message || 'machine is not on the network'; + } + ENoNet.prototype = new Error(); + ENoNet.prototype.errno = 29; + ENoNet.prototype.code = "ENONET"; + ENoNet.prototype.constructor = ENoNet; + + function ENotConn(message){ + this.message = message || 'socket is not connected'; + } + ENotConn.prototype = new Error(); + ENotConn.prototype.errno = 31; + ENotConn.prototype.code = "ENOTCONN"; + ENotConn.prototype.constructor = ENotConn; + + function ENotSock(message){ + this.message = message || 'socket operation on non-socket'; + } + ENotSock.prototype = new Error(); + ENotSock.prototype.errno = 32; + ENotSock.prototype.code = "ENOTSOCK"; + ENotSock.prototype.constructor = ENotSock; + + function ENotSup(message){ + this.message = message || 'operation not supported on socket'; + } + ENotSup.prototype = new Error(); + ENotSup.prototype.errno = 33; + ENotSup.prototype.code = "ENOTSUP"; + ENotSup.prototype.constructor = ENotSup; + + function ENoEntry(message){ + this.message = message || 'no such file or directory'; + } + ENoEntry.prototype = new Error(); + ENoEntry.prototype.errno = 34; + ENoEntry.prototype.code = "ENOENT"; + ENoEntry.prototype.constructor = ENoEntry; + + function ENotImplemented(message){ + this.message = message || 'function not implemented'; + } + ENotImplemented.prototype = new Error(); + ENotImplemented.prototype.errno = 35; + ENotImplemented.prototype.code = "ENOSYS"; + ENotImplemented.prototype.constructor = ENotImplemented; + + function EPipe(message){ + this.message = message || 'broken pipe'; + } + EPipe.prototype = new Error(); + EPipe.prototype.errno = 36; + EPipe.prototype.code = "EPIPE"; + EPipe.prototype.constructor = EPipe; + + function EProto(message){ + this.message = message || 'protocol error'; + } + EProto.prototype = new Error(); + EProto.prototype.errno = 37; + EProto.prototype.code = "EPROTO"; + EProto.prototype.constructor = EProto; + + function EProtoNoSupport(message){ + this.message = message || 'protocol not supported'; + } + EProtoNoSupport.prototype = new Error(); + EProtoNoSupport.prototype.errno = 38; + EProtoNoSupport.prototype.code = "EPROTONOSUPPORT"; + EProtoNoSupport.prototype.constructor = EProtoNoSupport; + + function EPrototype(message){ + this.message = message || 'protocol wrong type for socket'; + } + EPrototype.prototype = new Error(); + EPrototype.prototype.errno = 39; + EPrototype.prototype.code = "EPROTOTYPE"; + EPrototype.prototype.constructor = EPrototype; + + function ETimedOut(message){ + this.message = message || 'connection timed out'; + } + ETimedOut.prototype = new Error(); + ETimedOut.prototype.errno = 40; + ETimedOut.prototype.code = "ETIMEDOUT"; + ETimedOut.prototype.constructor = ETimedOut; + + function ECharset(message){ + this.message = message || 'invalid Unicode character'; + } + ECharset.prototype = new Error(); + ECharset.prototype.errno = 41; + ECharset.prototype.code = "ECHARSET"; + ECharset.prototype.constructor = ECharset; + + function EAIFamNoSupport(message){ + this.message = message || 'address family for hostname not supported'; + } + EAIFamNoSupport.prototype = new Error(); + EAIFamNoSupport.prototype.errno = 42; + EAIFamNoSupport.prototype.code = "EAIFAMNOSUPPORT"; + EAIFamNoSupport.prototype.constructor = EAIFamNoSupport; + + function EAIService(message){ + this.message = message || 'servname not supported for ai_socktype'; + } + EAIService.prototype = new Error(); + EAIService.prototype.errno = 44; + EAIService.prototype.code = "EAISERVICE"; + EAIService.prototype.constructor = EAIService; + + function EAISockType(message){ + this.message = message || 'ai_socktype not supported'; + } + EAISockType.prototype = new Error(); + EAISockType.prototype.errno = 45; + EAISockType.prototype.code = "EAISOCKTYPE"; + EAISockType.prototype.constructor = EAISockType; + + function EShutdown(message){ + this.message = message || 'cannot send after transport endpoint shutdown'; + } + EShutdown.prototype = new Error(); + EShutdown.prototype.errno = 46; + EShutdown.prototype.code = "ESHUTDOWN"; + EShutdown.prototype.constructor = EShutdown; + + function EExists(message){ + this.message = message || 'file already exists'; + } + EExists.prototype = new Error(); + EExists.prototype.errno = 47; + EExists.prototype.code = "EEXIST"; + EExists.prototype.constructor = EExists; + + function ESrch(message){ + this.message = message || 'no such process'; + } + ESrch.prototype = new Error(); + ESrch.prototype.errno = 48; + ESrch.prototype.code = "ESRCH"; + ESrch.prototype.constructor = ESrch; + + function ENameTooLong(message){ + this.message = message || 'name too long'; + } + ENameTooLong.prototype = new Error(); + ENameTooLong.prototype.errno = 49; + ENameTooLong.prototype.code = "ENAMETOOLONG"; + ENameTooLong.prototype.constructor = ENameTooLong; + + function EPerm(message){ + this.message = message || 'operation not permitted'; + } + EPerm.prototype = new Error(); + EPerm.prototype.errno = 50; + EPerm.prototype.code = "EPERM"; + EPerm.prototype.constructor = EPerm; function ELoop(message){ - this.message = message || ''; + this.message = message || 'too many symbolic links encountered'; } ELoop.prototype = new Error(); - ELoop.prototype.name = "ELoop"; + ELoop.prototype.errno = 51; + ELoop.prototype.code = "ELOOP"; ELoop.prototype.constructor = ELoop; + function EXDev(message){ + this.message = message || 'cross-device link not permitted'; + } + EXDev.prototype = new Error(); + EXDev.prototype.errno = 52; + EXDev.prototype.code = "EXDEV"; + EXDev.prototype.constructor = EXDev; + + function ENotEmpty(message){ + this.message = message || 'directory not empty'; + } + ENotEmpty.prototype = new Error(); + ENotEmpty.prototype.errno = 53; + ENotEmpty.prototype.code = "ENOTEMPTY"; + ENotEmpty.prototype.constructor = ENotEmpty; + + function ENoSpc(message){ + this.message = message || 'no space left on device'; + } + ENoSpc.prototype = new Error(); + ENoSpc.prototype.errno = 54; + ENoSpc.prototype.code = "ENOSPC"; + ENoSpc.prototype.constructor = ENoSpc; + + function EIO(message){ + this.message = message || 'i/o error'; + } + EIO.prototype = new Error(); + EIO.prototype.errno = 55; + EIO.prototype.code = "EIO"; + EIO.prototype.constructor = EIO; + + function EROFS(message){ + this.message = message || 'read-only file system'; + } + EROFS.prototype = new Error(); + EROFS.prototype.errno = 56; + EROFS.prototype.code = "EROFS"; + EROFS.prototype.constructor = EROFS; + + function ENoDev(message){ + this.message = message || 'no such device'; + } + ENoDev.prototype = new Error(); + ENoDev.prototype.errno = 57; + ENoDev.prototype.code = "ENODEV"; + ENoDev.prototype.constructor = ENoDev; + + function ESPipe(message){ + this.message = message || 'invalid seek'; + } + ESPipe.prototype = new Error(); + ESPipe.prototype.errno = 58; + ESPipe.prototype.code = "ESPIPE"; + ESPipe.prototype.constructor = ESPipe; + + function ECanceled(message){ + this.message = message || 'operation canceled'; + } + ECanceled.prototype = new Error(); + ECanceled.prototype.errno = 59; + ECanceled.prototype.code = "ECANCELED"; + ECanceled.prototype.constructor = ECanceled; + + function ENotMounted(message){ + this.message = message || 'not mounted'; + } + ENotMounted.prototype = new Error(); + ENotMounted.prototype.errno = 60; + ENotMounted.prototype.code = "ENotMounted"; + ENotMounted.prototype.constructor = ENotMounted; + function EFileSystemError(message){ - this.message = message || ''; + this.message = message || 'missing super node'; } EFileSystemError.prototype = new Error(); - EFileSystemError.prototype.name = "EFileSystemError"; + EFileSystemError.prototype.errno = 61; + EFileSystemError.prototype.code = "EFileSystemError"; EFileSystemError.prototype.constructor = EFileSystemError; function ENoAttr(message) { - this.message = message || ''; + this.message = message || 'attribute does not exist'; } ENoAttr.prototype = new Error(); - ENoAttr.prototype.name = 'ENoAttr'; + ENoAttr.prototype.errno = 62; + ENoAttr.prototype.code = 'ENoAttr'; ENoAttr.prototype.constructor = ENoAttr; return { - EExists: EExists, - EIsDirectory: EIsDirectory, - ENoEntry: ENoEntry, - EBusy: EBusy, - ENotEmpty: ENotEmpty, - ENotDirectory: ENotDirectory, + Unknown: Unknown, + OK: OK, + EOF: EOF, + EAddrInfo: EAddrInfo, + EAcces: EAcces, + EAgain: EAgain, + EAddrInUse: EAddrInUse, + EAddrNotAvail: EAddrNotAvail, + EAFNoSupport: EAFNoSupport, + EAlready: EAlready, EBadFileDescriptor: EBadFileDescriptor, - ENotImplemented: ENotImplemented, - ENotMounted: ENotMounted, + EBusy: EBusy, + EConnAborted: EConnAborted, + EConnRefused: EConnRefused, + EConnReset: EConnReset, + EDestAddrReq: EDestAddrReq, + EFault: EFault, + EHostUnreach: EHostUnreach, + EIntr: EIntr, EInvalid: EInvalid, - EIO: EIO, + EIsConn: EIsConn, + EMFile: EMFile, + EMsgSize: EMsgSize, + ENetDown: ENetDown, + ENetUnreach: ENetUnreach, + ENFile: ENFile, + ENoBufS: ENoBufS, + ENoMem: ENoMem, + ENotDirectory: ENotDirectory, + EIsDirectory: EIsDirectory, + ENoNet: ENoNet, + ENotConn: ENotConn, + ENotSock: ENotSock, + ENotSup: ENotSup, + ENoEntry: ENoEntry, + ENotImplemented: ENotImplemented, + EPipe: EPipe, + EProto: EProto, + EProtoNoSupport: EProtoNoSupport, + EPrototype: EPrototype, + ETimedOut: ETimedOut, + ECharset: ECharset, + EAIFamNoSupport: EAIFamNoSupport, + EAIService: EAIService, + EAISockType: EAISockType, + EShutdown: EShutdown, + EExists: EExists, + ESrch: ESrch, + ENameTooLong: ENameTooLong, + EPerm: EPerm, ELoop: ELoop, + EXDev: EXDev, + ENotEmpty: ENotEmpty, + ENoSpc: ENoSpc, + EIO: EIO, + EROFS: EROFS, + ENoDev: ENoDev, + ESPipe: ESPipe, + ECanceled: ECanceled, + ENotMounted: ENotMounted, EFileSystemError: EFileSystemError, ENoAttr: ENoAttr }; diff --git a/src/fs.js b/src/fs.js index c3d1119..8d5a8b2 100644 --- a/src/fs.js +++ b/src/fs.js @@ -9,6 +9,8 @@ define(function(require) { var normalize = require('./path').normalize; var dirname = require('./path').dirname; var basename = require('./path').basename; + var isAbsolutePath = require('./path').isAbsolute; + var isNullPath = require('./path').isNull; var guid = require('./shared').guid; var hash = require('./shared').hash; @@ -50,6 +52,8 @@ define(function(require) { var O_FLAGS = require('./constants').O_FLAGS; var XATTR_CREATE = require('./constants').XATTR_CREATE; var XATTR_REPLACE = require('./constants').XATTR_REPLACE; + var FS_NOMTIME = require('./constants').FS_NOMTIME; + var FS_NOCTIME = require('./constants').FS_NOCTIME; var providers = require('./providers/providers'); var adapters = require('./adapters/adapters'); @@ -68,7 +72,8 @@ define(function(require) { * OpenFileDescription */ - function OpenFileDescription(id, flags, position) { + function OpenFileDescription(path, id, flags, position) { + this.path = path; this.id = id; this.flags = flags; this.position = position; @@ -99,8 +104,8 @@ define(function(require) { this.id = id || guid(); this.mode = mode || MODE_FILE; // node type (file, directory, etc) this.size = size || 0; // size (bytes for files, entries for directories) - this.atime = atime || now; // access time - this.ctime = ctime || now; // creation time + this.atime = atime || now; // access time (will mirror ctime after creation) + this.ctime = ctime || now; // creation/change time this.mtime = mtime || now; // modified time this.flags = flags || []; // file flags this.xattrs = xattrs || {}; // extended attributes @@ -126,6 +131,46 @@ define(function(require) { this.type = fileNode.mode; } + /* + * Update node times. Only passed times are modified (undefined times are ignored) + * and filesystem flags are examined in order to override update logic. + */ + function update_node_times(context, path, node, times, callback) { + // Honour mount flags for how we update times + var flags = context.flags; + if(_(flags).contains(FS_NOCTIME)) { + delete times.ctime; + } + if(_(flags).contains(FS_NOMTIME)) { + delete times.mtime; + } + + // Only do the update if required (i.e., times are still present) + var update = false; + if(times.ctime) { + node.ctime = times.ctime; + // We don't do atime tracking for perf reasons, but do mirror ctime + node.atime = times.ctime; + update = true; + } + if(times.atime) { + // The only time we explicitly pass atime is when utimes(), futimes() is called. + // Override ctime mirror here if so + node.atime = times.atime; + update = true; + } + if(times.mtime) { + node.mtime = times.mtime; + update = true; + } + + if(update) { + context.put(node.id, node, callback); + } else { + callback(); + } + } + /* * find_node */ @@ -229,9 +274,19 @@ define(function(require) { */ function set_extended_attribute (context, path_or_fd, name, value, flag, callback) { + var path; + function set_xattr (error, node) { var xattr = (node ? node.xattrs[name] : null); + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, path, node, { ctime: Date.now() }, callback); + } + } + if (error) { callback(error); } @@ -243,14 +298,16 @@ define(function(require) { } else { node.xattrs[name] = value; - context.put(node.id, node, callback); + context.put(node.id, node, update_time); } } if (typeof path_or_fd == 'string') { + path = path_or_fd; find_node(context, path_or_fd, set_xattr); } else if (typeof path_or_fd == 'object' && typeof path_or_fd.id == 'string') { + path = path_or_fd.path; context.get(path_or_fd.id, set_xattr); } else { @@ -354,12 +411,21 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, parentDirectoryNode, { mtime: now, ctime: now }, callback); + } + } + function update_parent_directory_data(error) { if(error) { callback(error); } else { parentDirectoryData[name] = new DirectoryEntry(directoryNode.id, MODE_DIRECTORY); - context.put(parentDirectoryNode.data, parentDirectoryData, callback); + context.put(parentDirectoryNode.data, parentDirectoryData, update_time); } } @@ -427,9 +493,18 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, parentDirectoryNode, { mtime: now, ctime: now }, remove_directory_node); + } + } + function remove_directory_entry_from_parent_directory_node() { delete parentDirectoryData[name]; - context.put(parentDirectoryNode.data, parentDirectoryData, remove_directory_node); + context.put(parentDirectoryNode.data, parentDirectoryData, update_time); } function remove_directory_node(error) { @@ -565,12 +640,21 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, directoryNode, { mtime: now, ctime: now }, handle_update_result); + } + } + function update_directory_data(error) { if(error) { callback(error); } else { directoryData[name] = new DirectoryEntry(fileNode.id, MODE_FILE); - context.put(directoryNode.data, directoryData, handle_update_result); + context.put(directoryNode.data, directoryData, update_time); } } @@ -594,11 +678,20 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, ofd.path, fileNode, { mtime: now, ctime: now }, return_nbytes); + } + } + function update_file_node(error) { if(error) { callback(error); } else { - context.put(fileNode.id, fileNode, return_nbytes); + context.put(fileNode.id, fileNode, update_time); } } @@ -613,7 +706,6 @@ define(function(require) { ofd.position = length; fileNode.size = length; - fileNode.mtime = Date.now(); fileNode.version += 1; context.put(fileNode.data, newData, update_file_node); @@ -635,11 +727,20 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, ofd.path, fileNode, { mtime: now, ctime: now }, return_nbytes); + } + } + function update_file_node(error) { if(error) { callback(error); } else { - context.put(fileNode.id, fileNode, return_nbytes); + context.put(fileNode.id, fileNode, update_time); } } @@ -661,7 +762,6 @@ define(function(require) { } fileNode.size = newSize; - fileNode.mtime = Date.now(); fileNode.version += 1; context.put(fileNode.data, newData, update_file_node); @@ -700,6 +800,14 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + + } + } + function read_file_data(error, result) { if(error) { callback(error); @@ -799,13 +907,21 @@ define(function(require) { var newDirectoryData; var fileNode; + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, newpath, fileNode, { ctime: Date.now() }, callback); + } + } + function update_file_node(error, result) { if(error) { callback(error); } else { fileNode = result; fileNode.nlinks += 1; - context.put(fileNode.id, fileNode, callback); + context.put(fileNode.id, fileNode, update_time); } } @@ -879,7 +995,10 @@ define(function(require) { callback(error); } else { delete directoryData[name]; - context.put(directoryNode.data, directoryData, callback); + context.put(directoryNode.data, directoryData, function(error) { + var now = Date.now(); + update_node_times(context, parentPath, directoryNode, { mtime: now, ctime: now }, callback); + }); } } @@ -900,7 +1019,9 @@ define(function(require) { if(fileNode.nlinks < 1) { context.delete(fileNode.id, delete_file_data); } else { - context.put(fileNode.id, fileNode, update_directory_data); + context.put(fileNode.id, fileNode, function(error) { + update_node_times(context, path, fileNode, { ctime: Date.now() }, update_directory_data); + }); } } } @@ -1004,12 +1125,21 @@ define(function(require) { context.put(fileNode.id, fileNode, update_directory_data); } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, parentPath, directoryNode, { mtime: now, ctime: now }, callback); + } + } + function update_directory_data(error) { if(error) { callback(error); } else { directoryData[name] = new DirectoryEntry(fileNode.id, MODE_SYMBOLIC_LINK); - context.put(directoryNode.data, directoryData, callback); + context.put(directoryNode.data, directoryData, update_time); } } } @@ -1087,14 +1217,22 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, path, fileNode, { mtime: now, ctime: now }, callback); + } + } + function update_file_node (error) { if(error) { callback(error); } else { fileNode.size = length; - fileNode.mtime = Date.now(); fileNode.version += 1; - context.put(fileNode.id, fileNode, callback); + context.put(fileNode.id, fileNode, update_time); } } @@ -1131,14 +1269,21 @@ define(function(require) { } } + function update_time(error) { + if(error) { + callback(error); + } else { + var now = Date.now(); + update_node_times(context, ofd.path, fileNode, { mtime: now, ctime: now }, callback); + } + } function update_file_node (error) { if(error) { callback(error); } else { fileNode.size = length; - fileNode.mtime = Date.now(); fileNode.version += 1; - context.put(fileNode.id, fileNode, callback); + context.put(fileNode.id, fileNode, update_time); } } @@ -1152,14 +1297,11 @@ define(function(require) { function utimes_file(context, path, atime, mtime, callback) { path = normalize(path); - function update_times (error, node) { + function update_times(error, node) { if (error) { callback(error); - } - else { - node.atime = atime; - node.mtime = mtime; - context.put(node.id, node, callback); + } else { + update_node_times(context, path, node, { atime: atime, ctime: mtime, mtime: mtime }, callback); } } @@ -1179,11 +1321,8 @@ define(function(require) { function update_times (error, node) { if (error) { callback(error); - } - else { - node.atime = atime; - node.mtime = mtime; - context.put(node.id, node, callback); + } else { + update_node_times(context, ofd.path, node, { atime: atime, ctime: mtime, mtime: mtime }, callback); } } @@ -1294,6 +1433,14 @@ define(function(require) { function remove_xattr (error, node) { var xattr = (node ? node.xattrs : null); + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, path, node, { ctime: Date.now() }, callback); + } + } + if (error) { callback(error); } @@ -1302,7 +1449,7 @@ define(function(require) { } else { delete node.xattrs[name]; - context.put(node.id, node, callback); + context.put(node.id, node, update_time); } } @@ -1320,6 +1467,14 @@ define(function(require) { function fremovexattr_file (context, ofd, name, callback) { function remove_xattr (error, node) { + function update_time(error) { + if(error) { + callback(error); + } else { + update_node_times(context, ofd.path, node, { ctime: Date.now() }, callback); + } + } + if (error) { callback(error); } @@ -1328,7 +1483,7 @@ define(function(require) { } else { delete node.xattrs[name]; - context.put(node.id, node, callback); + context.put(node.id, node, update_time); } } @@ -1361,11 +1516,16 @@ define(function(require) { return options; } - // nullCheck from https://github.com/joyent/node/blob/master/lib/fs.js - function nullCheck(path, callback) { - if (('' + path).indexOf('\u0000') !== -1) { - var er = new Error('Path must be a string without null bytes.'); - callback(er); + function pathCheck(path, callback) { + var err; + if(isNullPath(path)) { + err = new Error('Path must be a string without null bytes.'); + } else if(!isAbsolutePath(path)) { + err = new Error('Path must be absolute.'); + } + + if(err) { + callback(err); return false; } return true; @@ -1464,7 +1624,21 @@ define(function(require) { // Open file system storage provider provider.open(function(err, needsFormatting) { function complete(error) { - fs.provider = provider; + // Wrap the provider so we can extend the context with fs flags. + // From this point forward we won't call open again, so drop it. + fs.provider = { + getReadWriteContext: function() { + var context = provider.getReadWriteContext(); + context.flags = flags; + return context; + }, + getReadOnlyContext: function() { + var context = provider.getReadOnlyContext(); + context.flags = flags; + return context; + } + }; + if(error) { fs.readyState = FS_ERROR; } else { @@ -1501,7 +1675,7 @@ define(function(require) { FileSystem.adapters = adapters; function _open(fs, context, path, flags, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, fileNode) { if(error) { @@ -1513,7 +1687,7 @@ define(function(require) { } else { position = 0; } - var openFileDescription = new OpenFileDescription(fileNode.id, flags, position); + var openFileDescription = new OpenFileDescription(path, fileNode.id, flags, position); var fd = fs.allocDescriptor(openFileDescription); callback(null, fd); } @@ -1537,7 +1711,7 @@ define(function(require) { } function _mkdir(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -1551,7 +1725,7 @@ define(function(require) { } function _rmdir(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -1565,7 +1739,7 @@ define(function(require) { } function _stat(context, name, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, result) { if(error) { @@ -1599,8 +1773,8 @@ define(function(require) { } function _link(context, oldpath, newpath, callback) { - if(!nullCheck(oldpath, callback)) return; - if(!nullCheck(newpath, callback)) return; + if(!pathCheck(oldpath, callback)) return; + if(!pathCheck(newpath, callback)) return; function check_result(error) { if(error) { @@ -1614,7 +1788,7 @@ define(function(require) { } function _unlink(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -1653,7 +1827,7 @@ define(function(require) { function _readFile(fs, context, path, options, callback) { options = validate_file_options(options, null, 'r'); - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var flags = validate_flags(options.flag || 'r'); if(!flags) { @@ -1664,7 +1838,7 @@ define(function(require) { if(err) { return callback(err); } - var ofd = new OpenFileDescription(fileNode.id, flags, 0); + var ofd = new OpenFileDescription(path, fileNode.id, flags, 0); var fd = fs.allocDescriptor(ofd); fstat_file(context, ofd, function(err2, fstatResult) { @@ -1722,7 +1896,7 @@ define(function(require) { function _writeFile(fs, context, path, data, options, callback) { options = validate_file_options(options, 'utf8', 'w'); - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var flags = validate_flags(options.flag || 'w'); if(!flags) { @@ -1741,7 +1915,7 @@ define(function(require) { if(err) { return callback(err); } - var ofd = new OpenFileDescription(fileNode.id, flags, 0); + var ofd = new OpenFileDescription(path, fileNode.id, flags, 0); var fd = fs.allocDescriptor(ofd); replace_data(context, ofd, data, 0, data.length, function(err2, nbytes) { @@ -1757,7 +1931,7 @@ define(function(require) { function _appendFile(fs, context, path, data, options, callback) { options = validate_file_options(options, 'utf8', 'a'); - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var flags = validate_flags(options.flag || 'a'); if(!flags) { @@ -1776,7 +1950,7 @@ define(function(require) { if(err) { return callback(err); } - var ofd = new OpenFileDescription(fileNode.id, flags, fileNode.size); + var ofd = new OpenFileDescription(path, fileNode.id, flags, fileNode.size); var fd = fs.allocDescriptor(ofd); write_data(context, ofd, data, 0, data.length, ofd.position, function(err2, nbytes) { @@ -1789,8 +1963,15 @@ define(function(require) { }); } + function _exists (context, name, path, callback) { + function cb(err, stats) { + callback(err ? false : true); + } + _stat(context, name, path, cb); + } + function _getxattr (context, path, name, callback) { - if (!nullCheck(path, callback)) return; + if (!pathCheck(path, callback)) return; function fetch_value (error, value) { if (error) { @@ -1826,7 +2007,7 @@ define(function(require) { } function _setxattr (context, path, name, value, flag, callback) { - if (!nullCheck(path, callback)) return; + if (!pathCheck(path, callback)) return; function check_result (error) { if (error) { @@ -1864,7 +2045,7 @@ define(function(require) { } function _removexattr (context, path, name, callback) { - if (!nullCheck(path, callback)) return; + if (!pathCheck(path, callback)) return; function remove_xattr (error) { if (error) { @@ -1952,7 +2133,7 @@ define(function(require) { } function _readdir(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, files) { if(error) { @@ -1966,7 +2147,7 @@ define(function(require) { } function _utimes(context, path, atime, mtime, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; var currentTime = Date.now(); atime = (atime) ? atime : currentTime; @@ -2009,8 +2190,8 @@ define(function(require) { } function _rename(context, oldpath, newpath, callback) { - if(!nullCheck(oldpath, callback)) return; - if(!nullCheck(newpath, callback)) return; + if(!pathCheck(oldpath, callback)) return; + if(!pathCheck(newpath, callback)) return; function check_result(error) { if(error) { @@ -2032,8 +2213,8 @@ define(function(require) { } function _symlink(context, srcpath, dstpath, callback) { - if(!nullCheck(srcpath, callback)) return; - if(!nullCheck(dstpath, callback)) return; + if(!pathCheck(srcpath, callback)) return; + if(!pathCheck(dstpath, callback)) return; function check_result(error) { if(error) { @@ -2047,7 +2228,7 @@ define(function(require) { } function _readlink(context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, result) { if(error) { @@ -2065,7 +2246,7 @@ define(function(require) { } function _lstat(fs, context, path, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error, result) { if(error) { @@ -2080,7 +2261,7 @@ define(function(require) { } function _truncate(context, path, length, callback) { - if(!nullCheck(path, callback)) return; + if(!pathCheck(path, callback)) return; function check_result(error) { if(error) { @@ -2265,6 +2446,17 @@ define(function(require) { ); if(error) callback(error); }; + FileSystem.prototype.exists = function(path, callback_) { + var callback = maybeCallback(arguments[arguments.length - 1]); + var fs = this; + var error = fs.queueOrRun( + function() { + var context = fs.provider.getReadWriteContext(); + _exists(context, fs.name, path, callback); + } + ); + if(error) callback(error); + }; FileSystem.prototype.lseek = function(fd, offset, whence, callback) { callback = maybeCallback(callback); var fs = this; diff --git a/src/path.js b/src/path.js index 7958773..ab99cce 100644 --- a/src/path.js +++ b/src/path.js @@ -193,6 +193,20 @@ define(function() { return splitPath(path)[3]; } + function isAbsolute(path) { + if(path.charAt(0) === '/') { + return true; + } + return false; + } + + function isNull(path) { + if (('' + path).indexOf('\u0000') !== -1) { + return true; + } + return false; + } + // XXXidbfs: we don't support path.exists() or path.existsSync(), which // are deprecated, and need a FileSystem instance to work. Use fs.stat(). @@ -205,7 +219,9 @@ define(function() { delimiter: ':', dirname: dirname, basename: basename, - extname: extname + extname: extname, + isAbsolute: isAbsolute, + isNull: isNull }; }); diff --git a/src/providers/indexeddb.js b/src/providers/indexeddb.js index ce58f2e..bfc3d74 100644 --- a/src/providers/indexeddb.js +++ b/src/providers/indexeddb.js @@ -116,7 +116,10 @@ define(function(require) { }; }; IndexedDB.prototype.getReadOnlyContext = function() { - return new IndexedDBContext(this.db, IDB_RO); + // Due to timing issues in Chrome with readwrite vs. readonly indexeddb transactions + // always use readwrite so we can make sure pending commits finish before callbacks. + // See https://github.com/js-platform/filer/issues/128 + return new IndexedDBContext(this.db, IDB_RW); }; IndexedDB.prototype.getReadWriteContext = function() { return new IndexedDBContext(this.db, IDB_RW); diff --git a/src/providers/websql.js b/src/providers/websql.js index 73040f3..194c94c 100644 --- a/src/providers/websql.js +++ b/src/providers/websql.js @@ -4,6 +4,7 @@ define(function(require) { var WSQL_VERSION = require('../constants').WSQL_VERSION; var WSQL_SIZE = require('../constants').WSQL_SIZE; var WSQL_DESC = require('../constants').WSQL_DESC; + var u8toArray = require('../shared').u8toArray; function WebSQLContext(db, isReadOnly) { var that = this; @@ -27,7 +28,7 @@ define(function(require) { callback(null); } this.getTransaction(function(transaction) { - transaction.executeSql("DELETE FROM " + FILE_STORE_NAME, + transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + ";", [], onSuccess, onError); }); }; @@ -35,17 +36,37 @@ define(function(require) { function onSuccess(transaction, result) { // If the key isn't found, return null var value = result.rows.length === 0 ? null : result.rows.item(0).data; - callback(null, value); + try { + if(value) { + value = JSON.parse(value); + // Deal with special-cased flattened typed arrays in WebSQL (see put() below) + if(value.__isUint8Array) { + value = new Uint8Array(value.__array); + } + } + callback(null, value); + } catch(e) { + callback(e); + } } function onError(transaction, error) { callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("SELECT data FROM " + FILE_STORE_NAME + " WHERE id = ?", + transaction.executeSql("SELECT data FROM " + FILE_STORE_NAME + " WHERE id = ?;", [key], onSuccess, onError); }); }; WebSQLContext.prototype.put = function(key, value, callback) { + // We do extra work to make sure typed arrays survive + // being stored in the db and still get the right prototype later. + if(Object.prototype.toString.call(value) === "[object Uint8Array]") { + value = { + __isUint8Array: true, + __array: u8toArray(value) + }; + } + value = JSON.stringify(value); function onSuccess(transaction, result) { callback(null); } @@ -53,7 +74,7 @@ define(function(require) { callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("INSERT OR REPLACE INTO " + FILE_STORE_NAME + " (id, data) VALUES (?, ?)", + transaction.executeSql("INSERT OR REPLACE INTO " + FILE_STORE_NAME + " (id, data) VALUES (?, ?);", [key, value], onSuccess, onError); }); }; @@ -65,7 +86,7 @@ define(function(require) { callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + " WHERE id = ?", + transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + " WHERE id = ?;", [key], onSuccess, onError); }); }; @@ -113,9 +134,15 @@ define(function(require) { [], gotCount, onError); } + // Create the table and index we'll need to store the fs data. db.transaction(function(transaction) { - transaction.executeSql("CREATE TABLE IF NOT EXISTS " + FILE_STORE_NAME + " (id unique, data)", - [], onSuccess, onError); + function createIndex(transaction) { + transaction.executeSql("CREATE INDEX IF NOT EXISTS idx_" + FILE_STORE_NAME + "_id" + + " on " + FILE_STORE_NAME + " (id);", + [], onSuccess, onError); + } + transaction.executeSql("CREATE TABLE IF NOT EXISTS " + FILE_STORE_NAME + " (id unique, data TEXT);", + [], createIndex, onError); }); }; WebSQL.prototype.getReadOnlyContext = function() { diff --git a/src/shared.js b/src/shared.js index 9c1fbb7..affad17 100644 --- a/src/shared.js +++ b/src/shared.js @@ -15,9 +15,22 @@ define(function(require) { function nop() {} + /** + * Convert a Uint8Array to a regular array + */ + function u8toArray(u8) { + var array = []; + var len = u8.length; + for(var i = 0; i < len; i++) { + array[i] = u8[i]; + } + return array; + } + return { guid: guid, hash: hash, + u8toArray: u8toArray, nop: nop }; diff --git a/tests/require-config.js b/tests/require-config.js index 5dfdeb7..2415177 100644 --- a/tests/require-config.js +++ b/tests/require-config.js @@ -78,8 +78,9 @@ require.config(config); assert = chai.assert; expect = chai.expect; -// We need to setup describe() support before loading tests -mocha.setup("bdd"); +// We need to setup describe() support before loading tests. +// Use a test timeout of 5s and a slow-test warning of 250ms +mocha.setup("bdd").timeout(5000).slow(250); require(["tests/test-manifest"], function() { window.onload = function() { diff --git a/tests/spec/adapters/adapters.general.spec.js b/tests/spec/adapters/adapters.general.spec.js index 709b53a..068457f 100644 --- a/tests/spec/adapters/adapters.general.spec.js +++ b/tests/spec/adapters/adapters.general.spec.js @@ -3,7 +3,7 @@ define(["Filer", "util"], function(Filer, util) { // We reuse the same set of tests for all adapters. // buildTestsFor() creates a set of tests bound to an // adapter, and uses the provider set on the query string - // (defaults to Memory, see test-utils.js). + // (defaults to best available/supported provider, see test-utils.js). function buildTestsFor(adapterName, buildAdapter) { function encode(str) { // TextEncoder is either native, or shimmed by Filer @@ -38,7 +38,7 @@ define(["Filer", "util"], function(Filer, util) { }); }); - describe("open a Memory provider with an " + adapterName + " adapter", function() { + describe("open a provider with an " + adapterName + " adapter", function() { beforeEach(util.setup); afterEach(util.cleanup); @@ -46,13 +46,17 @@ define(["Filer", "util"], function(Filer, util) { var provider = createProvider(); provider.open(function(error, firstAccess) { expect(error).not.to.exist; - expect(firstAccess).to.be.true; + // NOTE: we test firstAccess logic in the individual provider tests + // (see tests/spec/providers/*) but can't easily/actually test it here, + // since the provider-agnostic code in test-utils pre-creates a + // FileSystem object, thus eating the first access info. + // See https://github.com/js-platform/filer/issues/127 done(); }); }); }); - describe("Read/Write operations on a Memory provider with an " + adapterName + " adapter", function() { + describe("Read/Write operations on a provider with an " + adapterName + " adapter", function() { beforeEach(util.setup); afterEach(util.cleanup); @@ -127,7 +131,13 @@ define(["Filer", "util"], function(Filer, util) { }); }); - it("should fail when trying to write on ReadOnlyContext", function(done) { + /** + * With issue 123 (see https://github.com/js-platform/filer/issues/128) we had to + * start using readwrite contexts everywhere with IndexedDB. As such, we can't + * easily test this here, without knowing which provider we have. We test this + * in the actual providers, so this isn't really needed. Skipping for now. + */ + it.skip("should fail when trying to write on ReadOnlyContext", function(done) { var provider = createProvider(); provider.open(function(error, firstAccess) { if(error) throw error; diff --git a/tests/spec/fs.exists.spec.js b/tests/spec/fs.exists.spec.js new file mode 100644 index 0000000..5000d05 --- /dev/null +++ b/tests/spec/fs.exists.spec.js @@ -0,0 +1,59 @@ +define(["Filer", "util"], function(Filer, util) { + + describe('fs.exists', function() { + beforeEach(util.setup); + afterEach(util.cleanup); + + it('should be a function', function() { + var fs = util.fs(); + expect(typeof fs.exists).to.equal('function'); + }); + + it('should return false if path does not exist', function(done) { + var fs = util.fs(); + + fs.exists('/tmp', function(result) { + expect(result).to.be.false; + done(); + }); + }); + + it('should return true if path exists', function(done) { + var fs = util.fs(); + + fs.open('/myfile', 'w', function(err, fd) { + if(err) throw err; + + fs.close(fd, function(err) { + if(err) throw err; + + fs.exists('/myfile', function(result) { + expect(result).to.be.true; + done(); + }); + }); + }); + }); + + it('should follow symbolic links and return true for the resulting path', function(done) { + var fs = util.fs(); + + fs.open('/myfile', 'w', function(error, fd) { + if(error) throw error; + + fs.close(fd, function(error) { + if(error) throw error; + + fs.symlink('/myfile', '/myfilelink', function(error) { + if(error) throw error; + + fs.exists('/myfilelink', function(result) { + expect(result).to.be.true; + done(); + }); + }); + }); + }); + }); + }); +}); diff --git a/tests/spec/fs.link.spec.js b/tests/spec/fs.link.spec.js index d6ad840..b4db747 100644 --- a/tests/spec/fs.link.spec.js +++ b/tests/spec/fs.link.spec.js @@ -28,7 +28,10 @@ define(["Filer", "util"], function(Filer, util) { fs.stat('/myotherfile', function(error, result) { expect(error).not.to.exist; expect(result.nlinks).to.equal(2); - expect(result).to.deep.equal(_oldstats); + expect(result.dev).to.equal(_oldstats.dev); + expect(result.node).to.equal(_oldstats.node); + expect(result.size).to.equal(_oldstats.size); + expect(result.type).to.equal(_oldstats.type); done(); }); }); @@ -52,7 +55,10 @@ define(["Filer", "util"], function(Filer, util) { var _linkstats = result; fs.lstat('/myotherfile', function (error, result) { expect(error).not.to.exist; - expect(result).to.deep.equal(_linkstats); + expect(result.dev).to.equal(_linkstats.dev); + expect(result.node).to.equal(_linkstats.node); + expect(result.size).to.equal(_linkstats.size); + expect(result.type).to.equal(_linkstats.type); expect(result.nlinks).to.equal(2); done(); }); diff --git a/tests/spec/fs.utimes.spec.js b/tests/spec/fs.utimes.spec.js index 70c6a5d..cdf5213 100644 --- a/tests/spec/fs.utimes.spec.js +++ b/tests/spec/fs.utimes.spec.js @@ -17,7 +17,7 @@ define(["Filer", "util"], function(Filer, util) { fs.utimes('/testfile', -1, Date.now(), function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -31,7 +31,7 @@ define(["Filer", "util"], function(Filer, util) { fs.utimes('/testfile', Date.now(), -1, function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -45,7 +45,7 @@ define(["Filer", "util"], function(Filer, util) { fs.utimes('/testfile', 'invalid datetime', Date.now(), function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -58,7 +58,7 @@ define(["Filer", "util"], function(Filer, util) { fs.utimes('/pathdoesnotexist', atime, mtime, function (error) { expect(error).to.exist; - expect(error.name).to.equal('ENoEntry'); + expect(error.code).to.equal('ENOENT'); done(); }); }); @@ -71,7 +71,7 @@ define(["Filer", "util"], function(Filer, util) { fs.utimes('/testfile', Date.now(), 'invalid datetime', function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -84,7 +84,7 @@ define(["Filer", "util"], function(Filer, util) { fs.futimes(1, atime, mtime, function (error) { expect(error).to.exist; - expect(error.name).to.equal('EBadFileDescriptor'); + expect(error.code).to.equal('EBADF'); done(); }); }); @@ -102,7 +102,6 @@ define(["Filer", "util"], function(Filer, util) { fs.stat('/testfile', function (error, stat) { expect(error).not.to.exist; - expect(stat.atime).to.equal(atime); expect(stat.mtime).to.equal(mtime); done(); }); @@ -125,7 +124,6 @@ define(["Filer", "util"], function(Filer, util) { fs.fstat(ofd, function (error, stat) { expect(error).not.to.exist; - expect(stat.atime).to.equal(atime); expect(stat.mtime).to.equal(mtime); done(); }); @@ -146,7 +144,6 @@ define(["Filer", "util"], function(Filer, util) { fs.stat('/testdir', function (error, stat) { expect(error).not.to.exist; - expect(stat.atime).to.equal(atime); expect(stat.mtime).to.equal(mtime); done(); }); @@ -158,22 +155,21 @@ define(["Filer", "util"], function(Filer, util) { var fs = util.fs(); var atimeEst; var mtimeEst; - var now; fs.writeFile('/myfile', '', function (error) { if (error) throw error; + var then = Date.now(); fs.utimes('/myfile', null, null, function (error) { expect(error).not.to.exist; - now = Date.now(); - fs.stat('/myfile', function (error, stat) { expect(error).not.to.exist; // Note: testing estimation as time may differ by a couple of milliseconds // This number should be increased if tests are on slow systems - expect(now - stat.atime).to.be.below(75); - expect(now - stat.mtime).to.be.below(75); + var delta = Date.now() - then; + expect(then - stat.atime).to.be.below(delta); + expect(then - stat.mtime).to.be.below(delta); done(); }); }); diff --git a/tests/spec/fs.xattr.spec.js b/tests/spec/fs.xattr.spec.js index bb1bf80..618d94b 100644 --- a/tests/spec/fs.xattr.spec.js +++ b/tests/spec/fs.xattr.spec.js @@ -21,7 +21,7 @@ define(["Filer", "util"], function(Filer, util) { fs.setxattr('/testfile', 89, 'testvalue', function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -35,7 +35,7 @@ define(["Filer", "util"], function(Filer, util) { fs.setxattr('/testfile', null, 'testvalue', function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -49,7 +49,7 @@ define(["Filer", "util"], function(Filer, util) { fs.setxattr('/testfile', 'test', 'value', 'InvalidFlag', function (error) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -66,7 +66,7 @@ define(["Filer", "util"], function(Filer, util) { fs.setxattr('/testfile', 'test', 'othervalue', 'CREATE', function(error) { expect(error).to.exist; - expect(error.name).to.equal('EExists'); + expect(error.code).to.equal('EEXIST'); done(); }); }); @@ -81,7 +81,7 @@ define(["Filer", "util"], function(Filer, util) { fs.setxattr('/testfile', 'test', 'value', 'REPLACE', function(error) { expect(error).to.exist; - expect(error.name).to.equal('ENoAttr'); + expect(error.code).to.equal('ENoAttr'); done(); }); }); @@ -95,7 +95,7 @@ define(["Filer", "util"], function(Filer, util) { fs.getxattr('/testfile', '', function(error, value) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -109,7 +109,7 @@ define(["Filer", "util"], function(Filer, util) { fs.getxattr('/testfile', 89, function(error, value) { expect(error).to.exist; - expect(error.name).to.equal('EInvalid'); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -123,7 +123,7 @@ define(["Filer", "util"], function(Filer, util) { fs.getxattr('/testfile', 'test', function(error, value) { expect(error).to.exist; - expect(error.name).to.equal('ENoAttr'); + expect(error.code).to.equal('ENoAttr'); done(); }); }); @@ -144,14 +144,14 @@ define(["Filer", "util"], function(Filer, util) { fs.fsetxattr(1, 'test', 'value', function(error) { expect(error).to.exist; - expect(error.name).to.equal('EBadFileDescriptor'); + expect(error.code).to.equal('EBADF'); completeSet = true; maybeDone(); }); fs.fgetxattr(1, 'test', function(error, value) { expect(error).to.exist; - expect(error.name).to.equal('EBadFileDescriptor'); + expect(error.code).to.equal('EBADF'); expect(value).not.to.exist; completeGet = true; maybeDone(); @@ -159,7 +159,7 @@ define(["Filer", "util"], function(Filer, util) { fs.fremovexattr(1, 'test', function(error, value) { expect(error).to.exist; - expect(error.name).to.equal('EBadFileDescriptor'); + expect(error.code).to.equal('EBADF'); completeRemove = true; maybeDone(); }); @@ -195,7 +195,7 @@ define(["Filer", "util"], function(Filer, util) { fs.removexattr('/testfile', 'testenoattr', function (error) { expect(error).to.exist; - expect(error.name).to.equal('ENoAttr'); + expect(error.code).to.equal('ENoAttr'); done(); }); }); @@ -336,7 +336,7 @@ define(["Filer", "util"], function(Filer, util) { fs.getxattr('/testfile', 'test', function (error) { expect(error).to.exist; - expect(error.name).to.equal('ENoAttr'); + expect(error.code).to.equal('ENoAttr'); done(); }); }); @@ -363,7 +363,7 @@ define(["Filer", "util"], function(Filer, util) { fs.fgetxattr(ofd, 'test', function (error) { expect(error).to.exist; - expect(error.name).to.equal('ENoAttr'); + expect(error.code).to.equal('ENoAttr'); done(); }); }); diff --git a/tests/spec/node-js/simple/test-fs-null-bytes.js b/tests/spec/node-js/simple/test-fs-null-bytes.js index 7668148..1c4c276 100644 --- a/tests/spec/node-js/simple/test-fs-null-bytes.js +++ b/tests/spec/node-js/simple/test-fs-null-bytes.js @@ -29,30 +29,30 @@ define(["Filer", "util"], function(Filer, util) { fn.apply(fs, args); } - check(fs.link, 'foo\u0000bar', 'foobar'); - check(fs.link, 'foobar', 'foo\u0000bar'); - check(fs.lstat, 'foo\u0000bar'); - check(fs.mkdir, 'foo\u0000bar', '0755'); - check(fs.open, 'foo\u0000bar', 'r'); - check(fs.readFile, 'foo\u0000bar'); - check(fs.readdir, 'foo\u0000bar'); - check(fs.readlink, 'foo\u0000bar'); - check(fs.rename, 'foo\u0000bar', 'foobar'); - check(fs.rename, 'foobar', 'foo\u0000bar'); - check(fs.rmdir, 'foo\u0000bar'); - check(fs.stat, 'foo\u0000bar'); - check(fs.symlink, 'foo\u0000bar', 'foobar'); - check(fs.symlink, 'foobar', 'foo\u0000bar'); - check(fs.unlink, 'foo\u0000bar'); - check(fs.writeFile, 'foo\u0000bar'); - check(fs.appendFile, 'foo\u0000bar'); - check(fs.truncate, 'foo\u0000bar'); - check(fs.utimes, 'foo\u0000bar', 0, 0); + check(fs.link, '/foo\u0000bar', 'foobar'); + check(fs.link, '/foobar', 'foo\u0000bar'); + check(fs.lstat, '/foo\u0000bar'); + check(fs.mkdir, '/foo\u0000bar', '0755'); + check(fs.open, '/foo\u0000bar', 'r'); + check(fs.readFile, '/foo\u0000bar'); + check(fs.readdir, '/foo\u0000bar'); + check(fs.readlink, '/foo\u0000bar'); + check(fs.rename, '/foo\u0000bar', 'foobar'); + check(fs.rename, '/foobar', 'foo\u0000bar'); + check(fs.rmdir, '/foo\u0000bar'); + check(fs.stat, '/foo\u0000bar'); + check(fs.symlink, '/foo\u0000bar', 'foobar'); + check(fs.symlink, '/foobar', 'foo\u0000bar'); + check(fs.unlink, '/foo\u0000bar'); + check(fs.writeFile, '/foo\u0000bar'); + check(fs.appendFile, '/foo\u0000bar'); + check(fs.truncate, '/foo\u0000bar'); + check(fs.utimes, '/foo\u0000bar', 0, 0); // TODO - need to be implemented still... - // check(fs.realpath, 'foo\u0000bar'); - // check(fs.chmod, 'foo\u0000bar', '0644'); - // check(fs.chown, 'foo\u0000bar', 12, 34); - // check(fs.realpath, 'foo\u0000bar'); + // check(fs.realpath, '/foo\u0000bar'); + // check(fs.chmod, '/foo\u0000bar', '0644'); + // check(fs.chown, '/foo\u0000bar', 12, 34); + // check(fs.realpath, '/foo\u0000bar'); checks.forEach(function(fn){ fn(); diff --git a/tests/spec/path-resolution.spec.js b/tests/spec/path-resolution.spec.js index 0fa0330..6553be8 100644 --- a/tests/spec/path-resolution.spec.js +++ b/tests/spec/path-resolution.spec.js @@ -149,7 +149,7 @@ define(["Filer", "util"], function(Filer, util) { createSymlinkChain(1, function() { fs.stat('/myfile11', function(error, result) { expect(error).to.exist; - expect(error.name).to.equal('ELoop'); + expect(error.code).to.equal('ELOOP'); expect(result).not.to.exist; done(); }); diff --git a/tests/spec/providers/providers.indexeddb.spec.js b/tests/spec/providers/providers.indexeddb.spec.js index 6789243..47aec77 100644 --- a/tests/spec/providers/providers.indexeddb.spec.js +++ b/tests/spec/providers/providers.indexeddb.spec.js @@ -129,7 +129,11 @@ define(["Filer", "util"], function(Filer, util) { }); }); - it("should fail when trying to write on ReadOnlyContext", function(done) { + /** + * With issue 123 (see https://github.com/js-platform/filer/issues/128) we had to + * start using readwrite contexts everywhere with IndexedDB. Skipping for now. + */ + it.skip("should fail when trying to write on ReadOnlyContext", function(done) { var provider = _provider.provider; provider.open(function(error, firstAccess) { if(error) throw error; diff --git a/tests/spec/shell/cd.spec.js b/tests/spec/shell/cd.spec.js index 02bb90b..308cb7f 100644 --- a/tests/spec/shell/cd.spec.js +++ b/tests/spec/shell/cd.spec.js @@ -40,7 +40,7 @@ define(["Filer", "util"], function(Filer, util) { expect(shell.pwd()).to.equal('/'); shell.cd('/nodir', function(err) { expect(err).to.exist; - expect(err.name).to.equal('ENotDirectory'); + expect(err.code).to.equal('ENOTDIR'); expect(shell.pwd()).to.equal('/'); done(); }); @@ -57,7 +57,7 @@ define(["Filer", "util"], function(Filer, util) { expect(shell.pwd()).to.equal('/'); shell.cd('/file', function(err) { expect(err).to.exist; - expect(err.name).to.equal('ENotDirectory'); + expect(err.code).to.equal('ENOTDIR'); expect(shell.pwd()).to.equal('/'); done(); }); diff --git a/tests/spec/shell/rm.spec.js b/tests/spec/shell/rm.spec.js index 628e03f..bae180e 100644 --- a/tests/spec/shell/rm.spec.js +++ b/tests/spec/shell/rm.spec.js @@ -71,7 +71,7 @@ define(["Filer", "util"], function(Filer, util) { shell.rm('/dir', function(err) { expect(err).to.exist; - expect(err.name).to.equal('ENotEmpty'); + expect(err.code).to.equal('ENOTEMPTY'); done(); }); }); diff --git a/tests/spec/shell/touch.spec.js b/tests/spec/shell/touch.spec.js index 3b3a12a..224c8e7 100644 --- a/tests/spec/shell/touch.spec.js +++ b/tests/spec/shell/touch.spec.js @@ -92,7 +92,6 @@ define(["Filer", "util"], function(Filer, util) { getTimes(fs, '/newfile', function(times) { expect(times.mtime).to.equal(date); - expect(times.atime).to.equal(date); done(); }); }); diff --git a/tests/spec/time-flags.spec.js b/tests/spec/time-flags.spec.js new file mode 100644 index 0000000..49b17a4 --- /dev/null +++ b/tests/spec/time-flags.spec.js @@ -0,0 +1,106 @@ +define(["Filer", "util"], function(Filer, util) { + + describe('node times (atime, mtime, ctime) with mount flags', function() { + + var dirname = "/dir"; + var filename = "/dir/file"; + + function memoryFS(flags, callback) { + var name = util.uniqueName(); + var fs = new Filer.FileSystem({ + name: name, + flags: flags || [], + provider: new Filer.FileSystem.providers.Memory(name) + }, callback); + } + + function createTree(fs, callback) { + fs.mkdir(dirname, function(error) { + if(error) throw error; + + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + fs.close(fd, callback); + }); + }); + } + + function stat(fs, path, callback) { + fs.stat(path, function(error, stats) { + if(error) throw error; + + callback(stats); + }); + } + + /** + * We test the actual time updates in times.spec.js, whereas these just test + * the overrides with the mount flags. The particular fs methods called + * are unimportant, but are known to affect the particular times being suppressed. + */ + + it('should not update ctime when calling fs.rename() with NOCTIME', function(done) { + memoryFS(['NOCTIME'], function(error, fs) { + var newfilename = filename + '1'; + + createTree(fs, function() { + stat(fs, filename, function(stats1) { + + fs.rename(filename, newfilename, function(error) { + if(error) throw error; + + stat(fs, newfilename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should not update ctime, mtime, atime when calling fs.truncate() with NOCTIME, NOMTIME', function(done) { + memoryFS(['NOCTIME', 'NOMTIME'], function(error, fs) { + createTree(fs, function() { + stat(fs, filename, function(stats1) { + + fs.truncate(filename, 5, function(error) { + if(error) throw error; + + stat(fs, filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should not update mtime when calling fs.truncate() with NOMTIME', function(done) { + memoryFS(['NOMTIME'], function(error, fs) { + createTree(fs, function() { + stat(fs, filename, function(stats1) { + + fs.truncate(filename, 5, function(error) { + if(error) throw error; + + stat(fs, filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + }); +}); diff --git a/tests/spec/times.spec.js b/tests/spec/times.spec.js new file mode 100644 index 0000000..835b005 --- /dev/null +++ b/tests/spec/times.spec.js @@ -0,0 +1,622 @@ +define(["Filer", "util"], function(Filer, util) { + + describe('node times (atime, mtime, ctime)', function() { + beforeEach(util.setup); + afterEach(util.cleanup); + + var dirname = "/dir"; + var filename = "/dir/file"; + + function createTree(callback) { + var fs = util.fs(); + fs.mkdir(dirname, function(error) { + if(error) throw error; + + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + fs.close(fd, callback); + }); + }); + } + + function stat(path, callback) { + var fs = util.fs(); + fs.stat(path, function(error, stats) { + if(error) throw error; + + callback(stats); + }); + } + + it('should update ctime when calling fs.rename()', function(done) { + var fs = util.fs(); + var newfilename = filename + '1'; + + createTree(function() { + stat(filename, function(stats1) { + + fs.rename(filename, newfilename, function(error) { + if(error) throw error; + + stat(newfilename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update ctime, mtime, atime when calling fs.truncate()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + + fs.truncate(filename, 5, function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update ctime, mtime, atime when calling fs.ftruncate()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + fs.ftruncate(fd, 5, function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + + fs.close(fd, done); + }); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.stat()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + + fs.stat(filename, function(error, stats2) { + if(error) throw error; + + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + + it('should make no change when calling fs.fstat()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + fs.fstat(fd, function(error, stats2) { + if(error) throw error; + + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + + fs.close(fd, done); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.lstat()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.link(filename, '/link', function(error) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.lstat('/link', function(error, stats2) { + if(error) throw error; + + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.exists()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + + fs.exists(filename, function(exists) { + expect(exists).to.be.true; + + fs.stat(filename, function(error, stats2) { + if(error) throw error; + + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update ctime, atime when calling fs.link()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.link(filename, '/link', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.symlink()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.symlink(filename, '/link', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.readlink()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.symlink(filename, '/link', function(error) { + if(error) throw error; + + stat('/link', function(stats1) { + fs.readlink('/link', function(error, contents) { + if(error) throw error; + expect(contents).to.equal(filename); + + stat('/link', function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should update ctime, atime, mtime of parent dir when calling fs.unlink()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(dirname, function(stats1) { + fs.unlink(filename, function(error) { + if(error) throw error; + + stat(dirname, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update ctime, atime, mtime of parent dir when calling fs.rmdir()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat('/', function(stats1) { + + fs.unlink(filename, function(error) { + if(error) throw error; + + fs.rmdir(dirname, function(error) { + if(error) throw error; + + stat('/', function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should update ctime, atime, mtime of parent dir when calling fs.mkdir()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat('/', function(stats1) { + + fs.mkdir('/a', function(error) { + if(error) throw error; + + stat('/', function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.close()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.close(fd, function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.open()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + + fs.close(fd, done); + }); + }); + }); + }); + }); + + /** + * fs.utimes and fs.futimes are tested elsewhere already, skipping + */ + + it('should update atime, ctime, mtime when calling fs.write()', function(done) { + var fs = util.fs(); + var buffer = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); + + createTree(function() { + fs.open('/myfile', 'w', function(err, fd) { + if(err) throw error; + + stat('/myfile', function(stats1) { + fs.write(fd, buffer, 0, buffer.length, 0, function(err, nbytes) { + if(err) throw error; + + fs.close(fd, function(error) { + if(error) throw error; + + stat('/myfile', function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.read()', function(done) { + var fs = util.fs(); + var buffer = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); + + createTree(function() { + fs.open('/myfile', 'w', function(err, fd) { + if(err) throw err; + + fs.write(fd, buffer, 0, buffer.length, 0, function(err, nbytes) { + if(err) throw err; + + fs.close(fd, function(error) { + if(error) throw error; + + fs.open('/myfile', 'r', function(error, fd) { + if(error) throw error; + + stat('/myfile', function(stats1) { + var buffer2 = new Uint8Array(buffer.length); + fs.read(fd, buffer2, 0, buffer2.length, 0, function(err, nbytes) { + + fs.close(fd, function(error) { + if(error) throw error; + + stat('/myfile', function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.readFile()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.readFile(filename, function(error, data) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update atime, ctime, mtime when calling fs.writeFile()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.writeFile(filename, 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update atime, ctime, mtime when calling fs.appendFile()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.appendFile(filename, '...more data', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.be.above(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update ctime, atime when calling fs.setxattr()', function(done) { + var fs = util.fs(); + + createTree(function() { + stat(filename, function(stats1) { + fs.setxattr(filename, 'extra', 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + + it('should update ctime, atime when calling fs.fsetxattr()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.fsetxattr(fd, 'extra', 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.getxattr()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.setxattr(filename, 'extra', 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.getxattr(filename, 'extra', function(error, value) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should make no change when calling fs.fgetxattr()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + fs.fsetxattr(fd, 'extra', 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.fgetxattr(fd, 'extra', function(error, value) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.equal(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.equal(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + }); + + it('should update ctime, atime when calling fs.removexattr()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.setxattr(filename, 'extra', 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.removexattr(filename, 'extra', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + + it('should update ctime, atime when calling fs.fremovexattr()', function(done) { + var fs = util.fs(); + + createTree(function() { + fs.open(filename, 'w', function(error, fd) { + if(error) throw error; + + fs.fsetxattr(fd, 'extra', 'data', function(error) { + if(error) throw error; + + stat(filename, function(stats1) { + fs.fremovexattr(fd, 'extra', function(error) { + if(error) throw error; + + stat(filename, function(stats2) { + expect(stats2.ctime).to.be.above(stats1.ctime); + expect(stats2.mtime).to.equal(stats1.mtime); + expect(stats2.atime).to.be.above(stats1.atime); + done(); + }); + }); + }); + }); + }); + }); + }); + + }); +}); diff --git a/tests/test-manifest.js b/tests/test-manifest.js index 3b903a6..688d231 100644 --- a/tests/test-manifest.js +++ b/tests/test-manifest.js @@ -12,6 +12,7 @@ define([ "spec/fs.spec", "spec/fs.stat.spec", "spec/fs.lstat.spec", + "spec/fs.exists.spec", "spec/fs.mkdir.spec", "spec/fs.readdir.spec", "spec/fs.rmdir.spec", @@ -31,6 +32,8 @@ define([ "spec/fs.utimes.spec", "spec/fs.xattr.spec", "spec/path-resolution.spec", + "spec/times.spec", + "spec/time-flags.spec", // Filer.FileSystem.providers.* "spec/providers/providers.spec",