From ce2184b8c130d9f1c9523813056283bc1de56567 Mon Sep 17 00:00:00 2001 From: Alan K Date: Tue, 30 Sep 2014 16:16:56 -0400 Subject: [PATCH] v0.0.33 --- bower.json | 2 +- dist/filer.min.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 2f6b564..5d5e1fc 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "filer", - "version": "0.0.32", + "version": "0.0.33", "main": "dist/filer.js", "ignore": [ "build", diff --git a/dist/filer.min.js b/dist/filer.min.js index 7bc86d9..f3d6539 100644 --- a/dist/filer.min.js +++ b/dist/filer.min.js @@ -1,4 +1,4 @@ -/*! filer 0.0.31 2014-09-30 */ +/*! filer 0.0.32 2014-09-30 */ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Filer=t()}}(function(){var t;return function e(t,n,r){function i(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;r.length>a;a++)i(r[a]);return i}({1:[function(e,n){(function(e){(function(){var r={};void 0!==e&&e.nextTick?(r.nextTick=e.nextTick,r.setImmediate="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:r.nextTick):"function"==typeof setImmediate?(r.nextTick=function(t){setImmediate(t)},r.setImmediate=r.nextTick):(r.nextTick=function(t){setTimeout(t,0)},r.setImmediate=r.nextTick),r.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,i=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n():i())})};i()},r.forEachSeries=r.eachSeries,t!==void 0&&t.amd?t([],function(){return r}):n!==void 0&&n.exports?n.exports=r:root.async=r})()}).call(this,e("JkpR2F"))},{JkpR2F:9}],2:[function(t,e){function n(t,e){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1);return e}var r=function(){};r.createInterface=function(t){var e={};return e.on=function(e,n){this[t]===void 0&&(this[t]={}),this[t].hasOwnProperty(e)||(this[t][e]=[]),this[t][e].push(n)},e.off=function(e,r){void 0!==this[t]&&this[t].hasOwnProperty(e)&&n(r,this[t][e])},e.trigger=function(e){if(this[t]!==void 0&&this[t].hasOwnProperty(e))for(var n=Array.prototype.slice.call(arguments,1),r=0;this[t][e].length>r;r++)this[t][e][r].apply(this[t][e][r],n)},e.removeAllListeners=function(e){if(void 0!==this[t]){var n=this;n[t][e].forEach(function(t){n.off(e,t)})}},e};var i=r.createInterface("_handlers");r.prototype._on=i.on,r.prototype._off=i.off,r.prototype._trigger=i.trigger;var o=r.createInterface("handlers");r.prototype.on=function(){o.on.apply(this,arguments),Array.prototype.unshift.call(arguments,"on"),this._trigger.apply(this,arguments)},r.prototype.off=o.off,r.prototype.trigger=o.trigger,r.prototype.removeAllListeners=o.removeAllListeners,e.exports=r},{}],3:[function(t,e){(function(n){function r(t,e){var n=0;return function(){var r=Date.now();r-n>t&&(n=r,e.apply(this,arguments))}}function i(t,e){if(void 0!==t&&t||(t={}),"object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function o(){var t=this,e=Date.now();this.origin=u(),this.lastMessage=e,this.receivedIDs={},this.previousValues={};var r=function(){t._onStorageEvent.apply(t,arguments)};"undefined"!=typeof document&&(document.attachEvent?document.attachEvent("onstorage",r):n.addEventListener("storage",r,!1))}var a=t("./eventemitter.js"),u=t("../src/shared.js").guid,s=function(t){return t===void 0||t.localStorage===void 0?{getItem:function(){},setItem:function(){},removeItem:function(){}}:t.localStorage}(n);o.prototype._transaction=function(t){function e(){if(!a){var c=Date.now(),d=0|s.getItem(l);if(d&&r>c-d)return u||(o._on("storage",e),u=!0),f=setTimeout(e,i),void 0;a=!0,s.setItem(l,c),t(),n()}}function n(){u&&o._off("storage",e),f&&clearTimeout(f),s.removeItem(l)}var r=1e3,i=20,o=this,a=!1,u=!1,f=null;e()},o.prototype._cleanup_emit=r(100,function(){var t=this;t._transaction(function(){var t,e=Date.now(),n=e-d,r=0;try{t=JSON.parse(s.getItem(f)||"[]")}catch(i){t=[]}for(var o=t.length-1;o>=0;o--)n>t[o].timestamp&&(t.splice(o,1),r++);r>0&&s.setItem(f,JSON.stringify(t))})}),o.prototype._cleanup_once=r(100,function(){var t=this;t._transaction(function(){var e,n;Date.now();var r=0;try{n=JSON.parse(s.getItem(c)||"{}")}catch(i){n={}}for(e in n)t._once_expired(e,n)&&(delete n[e],r++);r>0&&s.setItem(c,JSON.stringify(n))})}),o.prototype._once_expired=function(t,e){if(!e)return!0;if(!e.hasOwnProperty(t))return!0;if("object"!=typeof e[t])return!0;var n=e[t].ttl||p,r=Date.now(),i=e[t].timestamp;return r-n>i},o.prototype._localStorageChanged=function(t,e){if(t&&t.key)return t.key===e;var n=s.getItem(e);return n===this.previousValues[e]?!1:(this.previousValues[e]=n,!0)},o.prototype._onStorageEvent=function(t){t=t||n.event;var e=this;this._localStorageChanged(t,f)&&this._transaction(function(){var t,n=Date.now(),r=s.getItem(f);try{t=JSON.parse(r||"[]")}catch(i){t=[]}for(var o=0;t.length>o;o++)if(t[o].origin!==e.origin&&!(t[o].timestampr;r++)if(e.call(n,t[r],r,t)===m)return}else{var o=o(t);for(r=0,i=o.length;i>r;r++)if(e.call(n,t[o[r]],o[r],t)===m)return}}function a(t,e,n){e||(e=i);var r=!1;return null==t?r:p&&t.some===p?t.some(e,n):(o(t,function(t,i,o){return r||(r=e.call(n,t,i,o))?m:void 0}),!!r)}function u(t,e){return null==t?!1:d&&t.indexOf===d?-1!=t.indexOf(e):a(t,function(t){return t===e})}function s(t){this.value=t}function f(t){return t&&"object"==typeof t&&!Array.isArray(t)&&g.call(t,"__wrapped__")?t:new s(t)}var c=Array.prototype,l=c.forEach,d=c.indexOf,p=c.some,h=Object.prototype,g=h.hasOwnProperty,v=Object.keys,m={},E=v||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var r in t)n(t,r)&&e.push(r);return e};s.prototype.has=function(t){return n(this.value,t)},s.prototype.contains=function(t){return u(this.value,t)},s.prototype.size=function(){return r(this.value)},e.exports=f},{}],5:[function(t,e,n){(function(t){"use strict";n.encode=function(e){var n,r=new Uint8Array(e),i=r.length,o="";for(n=0;i>n;n+=3)o+=t[r[n]>>2],o+=t[(3&r[n])<<4|r[n+1]>>4],o+=t[(15&r[n+1])<<2|r[n+2]>>6],o+=t[63&r[n+2]];return 2===i%3?o=o.substring(0,o.length-1)+"=":1===i%3&&(o=o.substring(0,o.length-2)+"=="),o},n.decode=function(e){var n,r,i,o,a,u=.75*e.length,s=e.length,f=0;"="===e[e.length-1]&&(u--,"="===e[e.length-2]&&u--);var c=new ArrayBuffer(u),l=new Uint8Array(c);for(n=0;s>n;n+=4)r=t.indexOf(e[n]),i=t.indexOf(e[n+1]),o=t.indexOf(e[n+2]),a=t.indexOf(e[n+3]),l[f++]=r<<2|i>>4,l[f++]=(15&i)<<4|o>>2,l[f++]=(3&o)<<6|63&a;return c}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],6:[function(t,e,n){function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);var i=typeof t;"base64"===e&&"string"===i&&(t=x(t));var o;if("number"===i)o=_(t);else if("string"===i)o=r.byteLength(t,e);else{if("object"!==i)throw Error("First argument needs to be a number, array or string.");o=_(t.length)}var a;r._useTypedArrays?a=r._augment(new Uint8Array(o)):(a=this,a.length=o,a._isBuffer=!0);var u;if(r._useTypedArrays&&"number"==typeof t.byteLength)a._set(t);else if(L(t))if(r.isBuffer(t))for(u=0;o>u;u++)a[u]=t.readUInt8(u);else for(u=0;o>u;u++)a[u]=(t[u]%256+256)%256;else if("string"===i)a.write(t,0,e);else if("number"===i&&!r._useTypedArrays&&!n)for(u=0;o>u;u++)a[u]=0;return a}function i(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=e.length;W(0===o%2,"Invalid hex string"),r>o/2&&(r=o/2);for(var a=0;r>a;a++){var u=parseInt(e.substr(2*a,2),16);W(!isNaN(u),"Invalid hex string"),t[n+a]=u}return a}function o(t,e,n,r){var i=P(M(e),t,n,r);return i}function a(t,e,n,r){var i=P(F(e),t,n,r);return i}function u(t,e,n,r){return a(t,e,n,r)}function s(t,e,n,r){var i=P(k(e),t,n,r);return i}function f(t,e,n,r){var i=P(C(e),t,n,r);return i}function c(t,e,n){return 0===e&&n===t.length?z.fromByteArray(t):z.fromByteArray(t.slice(e,n))}function l(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;n>o;o++)127>=t[o]?(r+=U(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return r+U(i)}function d(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;n>i;i++)r+=String.fromCharCode(t[i]);return r}function p(t,e,n){return d(t,e,n)}function h(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=e;n>o;o++)i+=B(t[o]);return i}function g(t,e,n){for(var r=t.slice(e,n),i="",o=0;r.length>o;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function v(t,e,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==e&&null!==e,"missing offset"),W(t.length>e+1,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o;return n?(o=t[e],i>e+1&&(o|=t[e+1]<<8)):(o=t[e]<<8,i>e+1&&(o|=t[e+1])),o}}function m(t,e,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==e&&null!==e,"missing offset"),W(t.length>e+3,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o;return n?(i>e+2&&(o=t[e+2]<<16),i>e+1&&(o|=t[e+1]<<8),o|=t[e],i>e+3&&(o+=t[e+3]<<24>>>0)):(i>e+1&&(o=t[e+1]<<16),i>e+2&&(o|=t[e+2]<<8),i>e+3&&(o|=t[e+3]),o+=t[e]<<24>>>0),o}}function E(t,e,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==e&&null!==e,"missing offset"),W(t.length>e+1,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o=v(t,e,n,!0),a=32768&o;return a?-1*(65535-o+1):o}}function y(t,e,n,r){r||(W("boolean"==typeof n,"missing or invalid endian"),W(void 0!==e&&null!==e,"missing offset"),W(t.length>e+3,"Trying to read beyond buffer length"));var i=t.length;if(!(e>=i)){var o=m(t,e,n,!0),a=2147483648&o;return a?-1*(4294967295-o+1):o}}function w(t,e,n,r){return r||(W("boolean"==typeof n,"missing or invalid endian"),W(t.length>e+3,"Trying to read beyond buffer length")),q.read(t,e,n,23,4)}function b(t,e,n,r){return r||(W("boolean"==typeof n,"missing or invalid endian"),W(t.length>e+7,"Trying to read beyond buffer length")),q.read(t,e,n,52,8)}function I(t,e,n,r,i){i||(W(void 0!==e&&null!==e,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(t.length>n+1,"trying to write beyond buffer length"),V(e,65535));var o=t.length;if(!(n>=o)){for(var a=0,u=Math.min(o-n,2);u>a;a++)t[n+a]=(e&255<<8*(r?a:1-a))>>>8*(r?a:1-a);return n+2}}function O(t,e,n,r,i){i||(W(void 0!==e&&null!==e,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(t.length>n+3,"trying to write beyond buffer length"),V(e,4294967295));var o=t.length;if(!(n>=o)){for(var a=0,u=Math.min(o-n,4);u>a;a++)t[n+a]=255&e>>>8*(r?a:3-a);return n+4}}function j(t,e,n,r,i){i||(W(void 0!==e&&null!==e,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(t.length>n+1,"Trying to write beyond buffer length"),Y(e,32767,-32768));var o=t.length;if(!(n>=o))return e>=0?I(t,e,n,r,i):I(t,65535+e+1,n,r,i),n+2}function T(t,e,n,r,i){i||(W(void 0!==e&&null!==e,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(t.length>n+3,"Trying to write beyond buffer length"),Y(e,2147483647,-2147483648));var o=t.length;if(!(n>=o))return e>=0?O(t,e,n,r,i):O(t,4294967295+e+1,n,r,i),n+4}function A(t,e,n,r,i){i||(W(void 0!==e&&null!==e,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(t.length>n+3,"Trying to write beyond buffer length"),X(e,3.4028234663852886e38,-3.4028234663852886e38));var o=t.length;if(!(n>=o))return q.write(t,e,n,r,23,4),n+4}function S(t,e,n,r,i){i||(W(void 0!==e&&null!==e,"missing value"),W("boolean"==typeof r,"missing or invalid endian"),W(void 0!==n&&null!==n,"missing offset"),W(t.length>n+7,"Trying to write beyond buffer length"),X(e,1.7976931348623157e308,-1.7976931348623157e308));var o=t.length;if(!(n>=o))return q.write(t,e,n,r,52,8),n+8}function x(t){for(t=N(t).replace(Q,"");0!==t.length%4;)t+="=";return t}function N(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function D(t,e,n){return"number"!=typeof t?n:(t=~~t,t>=e?e:t>=0?t:(t+=e,t>=0?t:0))}function _(t){return t=~~Math.ceil(+t),0>t?0:t}function R(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function L(t){return R(t)||r.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function B(t){return 16>t?"0"+t.toString(16):t.toString(16)}function M(t){for(var e=[],n=0;t.length>n;n++){var r=t.charCodeAt(n);if(127>=r)e.push(r);else{var i=n;r>=55296&&57343>=r&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),a=0;o.length>a;a++)e.push(parseInt(o[a],16))}}return e}function F(t){for(var e=[],n=0;t.length>n;n++)e.push(255&t.charCodeAt(n));return e}function C(t){for(var e,n,r,i=[],o=0;t.length>o;o++)e=t.charCodeAt(o),n=e>>8,r=e%256,i.push(r),i.push(n);return i}function k(t){return z.toByteArray(t)}function P(t,e,n,r){for(var i=0;r>i&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function U(t){try{return decodeURIComponent(t)}catch(e){return String.fromCharCode(65533)}}function V(t,e){W("number"==typeof t,"cannot write a non-number as a number"),W(t>=0,"specified a negative value for writing an unsigned value"),W(e>=t,"value is larger than maximum value for type"),W(Math.floor(t)===t,"value has a fractional component")}function Y(t,e,n){W("number"==typeof t,"cannot write a non-number as a number"),W(e>=t,"value larger than maximum allowed value"),W(t>=n,"value smaller than minimum allowed value"),W(Math.floor(t)===t,"value has a fractional component")}function X(t,e,n){W("number"==typeof t,"cannot write a non-number as a number"),W(e>=t,"value larger than maximum allowed value"),W(t>=n,"value smaller than minimum allowed value")}function W(t,e){if(!t)throw Error(e||"Failed assertion")}var z=t("base64-js"),q=t("ieee754");n.Buffer=r,n.SlowBuffer=r,n.INSPECT_MAX_BYTES=50,r.poolSize=8192,r._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(n){return!1}}(),r.isEncoding=function(t){switch((t+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.isBuffer=function(t){return!(null===t||void 0===t||!t._isBuffer)},r.byteLength=function(t,e){var n;switch(t=""+t,e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=M(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=k(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw Error("Unknown encoding")}return n},r.concat=function(t,e){if(W(R(t),"Usage: Buffer.concat(list[, length])"),0===t.length)return new r(0);if(1===t.length)return t[0];var n;if(void 0===e)for(e=0,n=0;t.length>n;n++)e+=t[n].length;var i=new r(e),o=0;for(n=0;t.length>n;n++){var a=t[n];a.copy(i,o),o+=a.length}return i},r.compare=function(t,e){W(r.isBuffer(t)&&r.isBuffer(e),"Arguments must be Buffers");for(var n=t.length,i=e.length,o=0,a=Math.min(n,i);a>o&&t[o]===e[o];o++);return o!==a&&(n=t[o],i=e[o]),i>n?-1:n>i?1:0},r.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var c=r;r=e,e=n,n=c}e=Number(e)||0;var l=this.length-e;n?(n=Number(n),n>l&&(n=l)):n=l,r=((r||"utf8")+"").toLowerCase();var d;switch(r){case"hex":d=i(this,t,e,n);break;case"utf8":case"utf-8":d=o(this,t,e,n);break;case"ascii":d=a(this,t,e,n);break;case"binary":d=u(this,t,e,n);break;case"base64":d=s(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":d=f(this,t,e,n);break;default:throw Error("Unknown encoding")}return d},r.prototype.toString=function(t,e,n){var r=this;if(t=((t||"utf8")+"").toLowerCase(),e=Number(e)||0,n=void 0===n?r.length:Number(n),n===e)return"";var i;switch(t){case"hex":i=h(r,e,n);break;case"utf8":case"utf-8":i=l(r,e,n);break;case"ascii":i=d(r,e,n);break;case"binary":i=p(r,e,n);break;case"base64":i=c(r,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=g(r,e,n);break;default:throw Error("Unknown encoding")}return i},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.equals=function(t){return W(r.isBuffer(t),"Argument must be a Buffer"),0===r.compare(this,t)},r.prototype.compare=function(t){return W(r.isBuffer(t),"Argument must be a Buffer"),r.compare(this,t)},r.prototype.copy=function(t,e,n,i){var o=this;if(n||(n=0),i||0===i||(i=this.length),e||(e=0),i!==n&&0!==t.length&&0!==o.length){W(i>=n,"sourceEnd < sourceStart"),W(e>=0&&t.length>e,"targetStart out of bounds"),W(n>=0&&o.length>n,"sourceStart out of bounds"),W(i>=0&&o.length>=i,"sourceEnd out of bounds"),i>this.length&&(i=this.length),i-n>t.length-e&&(i=t.length-e+n);var a=i-n;if(100>a||!r._useTypedArrays)for(var u=0;a>u;u++)t[u+e]=this[u+n];else t._set(this.subarray(n,n+a),e)}},r.prototype.slice=function(t,e){var n=this.length;if(t=D(t,n,0),e=D(e,n,n),r._useTypedArrays)return r._augment(this.subarray(t,e));for(var i=e-t,o=new r(i,void 0,!0),a=0;i>a;a++)o[a]=this[a+t];return o},r.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},r.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},r.prototype.readUInt8=function(t,e){return e||(W(void 0!==t&&null!==t,"missing offset"),W(this.length>t,"Trying to read beyond buffer length")),t>=this.length?void 0:this[t]},r.prototype.readUInt16LE=function(t,e){return v(this,t,!0,e)},r.prototype.readUInt16BE=function(t,e){return v(this,t,!1,e)},r.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e)},r.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e)},r.prototype.readInt8=function(t,e){if(e||(W(void 0!==t&&null!==t,"missing offset"),W(this.length>t,"Trying to read beyond buffer length")),!(t>=this.length)){var n=128&this[t];return n?-1*(255-this[t]+1):this[t]}},r.prototype.readInt16LE=function(t,e){return E(this,t,!0,e)},r.prototype.readInt16BE=function(t,e){return E(this,t,!1,e)},r.prototype.readInt32LE=function(t,e){return y(this,t,!0,e)},r.prototype.readInt32BE=function(t,e){return y(this,t,!1,e)},r.prototype.readFloatLE=function(t,e){return w(this,t,!0,e)},r.prototype.readFloatBE=function(t,e){return w(this,t,!1,e)},r.prototype.readDoubleLE=function(t,e){return b(this,t,!0,e)},r.prototype.readDoubleBE=function(t,e){return b(this,t,!1,e)},r.prototype.writeUInt8=function(t,e,n){return n||(W(void 0!==t&&null!==t,"missing value"),W(void 0!==e&&null!==e,"missing offset"),W(this.length>e,"trying to write beyond buffer length"),V(t,255)),e>=this.length?void 0:(this[e]=t,e+1)},r.prototype.writeUInt16LE=function(t,e,n){return I(this,t,e,!0,n)},r.prototype.writeUInt16BE=function(t,e,n){return I(this,t,e,!1,n)},r.prototype.writeUInt32LE=function(t,e,n){return O(this,t,e,!0,n)},r.prototype.writeUInt32BE=function(t,e,n){return O(this,t,e,!1,n)},r.prototype.writeInt8=function(t,e,n){return n||(W(void 0!==t&&null!==t,"missing value"),W(void 0!==e&&null!==e,"missing offset"),W(this.length>e,"Trying to write beyond buffer length"),Y(t,127,-128)),e>=this.length?void 0:(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n),e+1)},r.prototype.writeInt16LE=function(t,e,n){return j(this,t,e,!0,n)},r.prototype.writeInt16BE=function(t,e,n){return j(this,t,e,!1,n)},r.prototype.writeInt32LE=function(t,e,n){return T(this,t,e,!0,n)},r.prototype.writeInt32BE=function(t,e,n){return T(this,t,e,!1,n)},r.prototype.writeFloatLE=function(t,e,n){return A(this,t,e,!0,n)},r.prototype.writeFloatBE=function(t,e,n){return A(this,t,e,!1,n)},r.prototype.writeDoubleLE=function(t,e,n){return S(this,t,e,!0,n)},r.prototype.writeDoubleBE=function(t,e,n){return S(this,t,e,!1,n)},r.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),W(n>=e,"end < start"),n!==e&&0!==this.length){W(e>=0&&this.length>e,"start out of bounds"),W(n>=0&&this.length>=n,"end out of bounds");var r;if("number"==typeof t)for(r=e;n>r;r++)this[r]=t;else{var i=M(""+t),o=i.length;for(r=e;n>r;r++)this[r]=i[r%o]}return this}},r.prototype.inspect=function(){for(var t=[],e=this.length,r=0;e>r;r++)if(t[r]=B(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return""},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r._useTypedArrays)return new r(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;n>e;e+=1)t[e]=this[e];return t.buffer}throw Error("Buffer.toArrayBuffer not supported in this browser")};var J=r.prototype;r._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=J.get,t.set=J.set,t.write=J.write,t.toString=J.toString,t.toLocaleString=J.toString,t.toJSON=J.toJSON,t.equals=J.equals,t.compare=J.compare,t.copy=J.copy,t.slice=J.slice,t.readUInt8=J.readUInt8,t.readUInt16LE=J.readUInt16LE,t.readUInt16BE=J.readUInt16BE,t.readUInt32LE=J.readUInt32LE,t.readUInt32BE=J.readUInt32BE,t.readInt8=J.readInt8,t.readInt16LE=J.readInt16LE,t.readInt16BE=J.readInt16BE,t.readInt32LE=J.readInt32LE,t.readInt32BE=J.readInt32BE,t.readFloatLE=J.readFloatLE,t.readFloatBE=J.readFloatBE,t.readDoubleLE=J.readDoubleLE,t.readDoubleBE=J.readDoubleBE,t.writeUInt8=J.writeUInt8,t.writeUInt16LE=J.writeUInt16LE,t.writeUInt16BE=J.writeUInt16BE,t.writeUInt32LE=J.writeUInt32LE,t.writeUInt32BE=J.writeUInt32BE,t.writeInt8=J.writeInt8,t.writeInt16LE=J.writeInt16LE,t.writeInt16BE=J.writeInt16BE,t.writeInt32LE=J.writeInt32LE,t.writeInt32BE=J.writeInt32BE,t.writeFloatLE=J.writeFloatLE,t.writeFloatBE=J.writeFloatBE,t.writeDoubleLE=J.writeDoubleLE,t.writeDoubleBE=J.writeDoubleBE,t.fill=J.fill,t.inspect=J.inspect,t.toArrayBuffer=J.toArrayBuffer,t};var Q=/[^+\/0-9A-z]/g},{"base64-js":7,ieee754:8}],7:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a?62:e===u?63:s>e?-1:s+10>e?e-s+26+26:c+26>e?e-c:f+26>e?e-f+26:void 0}function n(t){function n(t){f[l++]=t}var r,i,a,u,s,f;if(t.length%4>0)throw Error("Invalid string. Length must be a multiple of 4");var c=t.length;s="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,f=new o(3*t.length/4-s),a=s>0?t.length-4:t.length;var l=0;for(r=0,i=0;a>r;r+=4,i+=3)u=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&u)>>16),n((65280&u)>>8),n(255&u);return 2===s?(u=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&u)):1===s&&(u=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(255&u>>8),n(255&u)),f}function i(t){function e(t){return r.charAt(t)}function n(t){return e(63&t>>18)+e(63&t>>12)+e(63&t>>6)+e(63&t)}var i,o,a,u=t.length%3,s="";for(i=0,a=t.length-u;a>i;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],s+=n(o);switch(u){case 1:o=t[t.length-1],s+=e(o>>2),s+=e(63&o<<4),s+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],s+=e(o>>10),s+=e(63&o>>4),s+=e(63&o<<2),s+="="}return s}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),u="/".charCodeAt(0),s="0".charCodeAt(0),f="a".charCodeAt(0),c="A".charCodeAt(0);t.toByteArray=n,t.fromByteArray=i})(n===void 0?this.base64js={}:n)},{}],8:[function(t,e,n){n.read=function(t,e,n,r,i){var o,a,u=8*i-r-1,s=(1<>1,c=-7,l=n?i-1:0,d=n?-1:1,p=t[e+l];for(l+=d,o=p&(1<<-c)-1,p>>=-c,c+=u;c>0;o=256*o+t[e+l],l+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+t[e+l],l+=d,c-=8);if(0===o)o=1-f;else{if(o===s)return a?0/0:1/0*(p?-1:1);a+=Math.pow(2,r),o-=f}return(p?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,u,s,f=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,h=r?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(u=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),1>e*(s=Math.pow(2,-a))&&(a--,s*=2),e+=a+l>=1?d/s:d*Math.pow(2,1-l),e*s>=2&&(a++,s/=2),a+l>=c?(u=0,a=c):a+l>=1?(u=(e*s-1)*Math.pow(2,i),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+p]=255&u,p+=h,u/=256,i-=8);for(a=a<0;t[n+p]=255&a,p+=h,a/=256,f-=8);t[n+p-h]|=128*g}},{}],9:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw Error("process.chdir is not supported")}},{}],10:[function(t,e){(function(t){function n(e,n,r){return e instanceof ArrayBuffer&&(e=new Uint8Array(e)),new t(e,n,r)}n.prototype=Object.create(t.prototype),n.prototype.constructor=n,Object.keys(t).forEach(function(e){t.hasOwnProperty(e)&&(n[e]=t[e])}),e.exports=n}).call(this,t("buffer").Buffer)},{buffer:6}],11:[function(t,e){var n="READ",r="WRITE",i="CREATE",o="EXCLUSIVE",a="TRUNCATE",u="APPEND",s="CREATE",f="REPLACE";e.exports={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",FS_NODUPEIDCHECK:"FS_NODUPEIDCHECK",O_READ:n,O_WRITE:r,O_CREATE:i,O_EXCLUSIVE:o,O_TRUNCATE:a,O_APPEND:u,O_FLAGS:{r:[n],"r+":[n,r],w:[r,i,a],"w+":[r,n,i,a],wx:[r,i,o,a],"wx+":[r,n,i,o,a],a:[r,i,u],"a+":[r,n,i,u],ax:[r,i,o,u],"ax+":[r,n,i,o,u]},XATTR_CREATE:s,XATTR_REPLACE:f,FS_READY:"READY",FS_PENDING:"PENDING",FS_ERROR:"ERROR",SUPER_NODE_ID:"00000000-0000-0000-0000-000000000000",STDIN:0,STDOUT:1,STDERR:2,FIRST_DESCRIPTOR:3,ENVIRONMENT:{TMP:"/tmp",PATH:""}}},{}],12:[function(t,e){var n=t("./constants.js").MODE_FILE;e.exports=function(t,e){this.id=t,this.type=e||n}},{"./constants.js":11}],13:[function(t,e){(function(t){function n(t){return t.toString("utf8")}function r(e){return new t(e,"utf8")}e.exports={encode:r,decode:n}}).call(this,t("buffer").Buffer)},{buffer:6}],14:[function(t,e){var n={};["9:EBADF:bad file descriptor","10:EBUSY:resource busy or locked","18:EINVAL:invalid argument","27:ENOTDIR:not a directory","28:EISDIR:illegal operation on a directory","34:ENOENT:no such file or directory","47:EEXIST:file already exists","50:EPERM:operation not permitted","51:ELOOP:too many symbolic links encountered","53:ENOTEMPTY:directory not empty","55:EIO:i/o error","1000:ENOTMOUNTED:not mounted","1001:EFILESYSTEMERROR:missing super node, use 'FORMAT' flag to format filesystem.","1002:ENOATTR:attribute does not exist"].forEach(function(t){function e(t,e){Error.call(this),this.name=i,this.code=i,this.errno=r,this.message=t||o,e&&(this.path=e),this.stack=Error(this.message).stack}t=t.split(":");var r=+t[0],i=t[1],o=t[2];e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(){var t=this.path?", '"+this.path+"'":"";return this.name+": "+this.message+t},n[i]=n[r]=e}),e.exports=n},{}],15:[function(t,e){function n(t){return function(e,n){e?t(e):t(null,n)}}function r(t,e,n,r,i){function o(n){t.changes.push({event:"change",path:e}),i(n)}var a=t.flags;de(a).contains(Fe)&&delete r.ctime,de(a).contains(Me)&&delete r.mtime;var u=!1;r.ctime&&(n.ctime=r.ctime,n.atime=r.ctime,u=!0),r.atime&&(n.atime=r.atime,u=!0),r.mtime&&(n.mtime=r.mtime,u=!0),u?t.putObject(n.id,n,o):o()}function i(t,e,n,i){function a(n,r){n?i(n):r.mode!==be?i(new ke.ENOTDIR("a component of the path prefix is not a directory",e)):(l=r,o(t,e,u))}function u(n,r){!n&&r?i(new ke.EEXIST("path name already exists",e)):!n||n instanceof ke.ENOENT?t.getObject(l.data,s):i(n)}function s(e,r){e?i(e):(d=r,Ye.create({guid:t.guid,mode:n},function(e,n){return e?(i(e),void 0):(p=n,p.nlinks+=1,t.putObject(p.id,p,c),void 0)}))}function f(e){if(e)i(e);else{var n=Date.now();r(t,g,p,{mtime:n,ctime:n},i)}}function c(e){e?i(e):(d[h]=new Pe(p.id,n),t.putObject(l.data,d,f))}if(n!==be&&n!==we)return i(new ke.EINVAL("mode must be a directory or file",e));e=he(e);var l,d,p,h=ve(e),g=ge(e);o(t,g,a)}function o(t,e,n){function r(e,r){e?n(e):r&&r.mode===Oe&&r.rnode?t.getObject(r.rnode,i):n(new ke.EFILESYSTEMERROR)}function i(t,e){t?n(t):e?n(null,e):n(new ke.ENOENT)}function a(r,i){r?n(r):i.mode===be&&i.data?t.getObject(i.data,u):n(new ke.ENOTDIR("a component of the path prefix is not a directory",e))}function u(r,i){if(r)n(r);else if(de(i).has(c)){var o=i[c].id;t.getObject(o,s)}else n(new ke.ENOENT(null,e))}function s(t,r){t?n(t):r.mode==Ie?(d++,d>Ae?n(new ke.ELOOP(null,e)):f(r.data)):n(null,r)}function f(e){e=he(e),l=ge(e),c=ve(e),je==c?t.getObject(Te,r):o(t,l,a)}if(e=he(e),!e)return n(new ke.ENOENT("path is an empty string"));var c=ve(e),l=ge(e),d=0;je==c?t.getObject(Te,r):o(t,l,a)}function a(t,e,n,i,a,u){function s(o,s){function c(e){e?u(e):r(t,f,s,{ctime:Date.now()},u)}s?s.xattrs[n]:null,o?u(o):a===Le&&s.xattrs.hasOwnProperty(n)?u(new ke.EEXIST("attribute already exists",e)):a!==Be||s.xattrs.hasOwnProperty(n)?(s.xattrs[n]=i,t.putObject(s.id,s,c)):u(new ke.ENOATTR(null,e))}var f;"string"==typeof e?(f=e,o(t,e,s)):"object"==typeof e&&"string"==typeof e.id?(f=e.path,t.getObject(e.id,s)):u(new ke.EINVAL("path or file descriptor of wrong type",e))}function u(t,e){function n(n,i){!n&&i?e():!n||n instanceof ke.ENOENT?Ve.create({guid:t.guid},function(n,i){return n?(e(n),void 0):(o=i,t.putObject(o.id,o,r),void 0)}):e(n)}function r(n){n?e(n):Ye.create({guid:t.guid,id:o.rnode,mode:be},function(n,r){return n?(e(n),void 0):(a=r,a.nlinks+=1,t.putObject(a.id,a,i),void 0)})}function i(n){n?e(n):(u={},t.putObject(a.data,u,e))}var o,a,u;t.getObject(Te,n)}function s(t,e,n){function i(r,i){!r&&i?n(new ke.EEXIST(null,e)):!r||r instanceof ke.ENOENT?o(t,v,a):n(r)}function a(e,r){e?n(e):(p=r,t.getObject(p.data,u))}function u(e,r){e?n(e):(h=r,Ye.create({guid:t.guid,mode:be},function(e,r){return e?(n(e),void 0):(l=r,l.nlinks+=1,t.putObject(l.id,l,s),void 0)}))}function s(e){e?n(e):(d={},t.putObject(l.data,d,c))}function f(e){if(e)n(e);else{var i=Date.now();r(t,v,p,{mtime:i,ctime:i},n)}}function c(e){e?n(e):(h[g]=new Pe(l.id,be),t.putObject(p.data,h,f)) }e=he(e);var l,d,p,h,g=ve(e),v=ge(e);o(t,e,i)}function f(t,e,n){function i(e,r){e?n(e):(g=r,t.getObject(g.data,a))}function a(r,i){r?n(r):je==m?n(new ke.EBUSY(null,e)):de(i).has(m)?(v=i,p=v[m].id,t.getObject(p,u)):n(new ke.ENOENT(null,e))}function u(r,i){r?n(r):i.mode!=be?n(new ke.ENOTDIR(null,e)):(p=i,t.getObject(p.data,s))}function s(t,r){t?n(t):(h=r,de(h).size()>0?n(new ke.ENOTEMPTY(null,e)):c())}function f(e){if(e)n(e);else{var i=Date.now();r(t,E,g,{mtime:i,ctime:i},l)}}function c(){delete v[m],t.putObject(g.data,v,f)}function l(e){e?n(e):t.delete(p.id,d)}function d(e){e?n(e):t.delete(p.data,n)}e=he(e);var p,h,g,v,m=ve(e),E=ge(e);o(t,E,i)}function c(t,e,n,i){function a(n,r){n?i(n):r.mode!==be?i(new ke.ENOENT(null,e)):(v=r,t.getObject(v.data,u))}function u(r,o){r?i(r):(m=o,de(m).has(b)?de(n).contains(De)?i(new ke.ENOENT("O_CREATE and O_EXCLUSIVE are set, and the named file exists",e)):(E=m[b],E.type==be&&de(n).contains(xe)?i(new ke.EISDIR("the named file is a directory and O_WRITE is set",e)):t.getObject(E.id,s)):de(n).contains(Ne)?l():i(new ke.ENOENT("O_CREATE is not set and the named file does not exist",e)))}function s(t,n){if(t)i(t);else{var r=n;r.mode==Ie?(O++,O>Ae?i(new ke.ELOOP(null,e)):f(r.data)):c(void 0,r)}}function f(r){r=he(r),I=ge(r),b=ve(r),je==b&&(de(n).contains(xe)?i(new ke.EISDIR("the named file is a directory and O_WRITE is set",e)):o(t,e,c)),o(t,I,a)}function c(t,e){t?i(t):(y=e,i(null,y))}function l(){Ye.create({guid:t.guid,mode:we},function(e,n){return e?(i(e),void 0):(y=n,y.nlinks+=1,t.putObject(y.id,y,d),void 0)})}function d(e){e?i(e):(w=new We(0),w.fill(0),t.putBuffer(y.data,w,h))}function p(e){if(e)i(e);else{var n=Date.now();r(t,I,v,{mtime:n,ctime:n},g)}}function h(e){e?i(e):(m[b]=new Pe(y.id,we),t.putObject(v.data,m,p))}function g(t){t?i(t):i(null,y)}e=he(e);var v,m,E,y,w,b=ve(e),I=ge(e),O=0;je==b?de(n).contains(xe)?i(new ke.EISDIR("the named file is a directory and O_WRITE is set",e)):o(t,e,c):o(t,I,a)}function l(t,e,n,i,o,a){function u(t){t?a(t):a(null,o)}function s(n){if(n)a(n);else{var i=Date.now();r(t,e.path,l,{mtime:i,ctime:i},u)}}function f(e){e?a(e):t.putObject(l.id,l,s)}function c(r,u){if(r)a(r);else{l=u;var s=new We(o);s.fill(0),n.copy(s,0,i,i+o),e.position=o,l.size=o,l.version+=1,t.putBuffer(l.data,s,f)}}var l;t.getObject(e.id,c)}function d(t,e,n,i,o,a,u){function s(t){t?u(t):u(null,o)}function f(n){if(n)u(n);else{var i=Date.now();r(t,e.path,p,{mtime:i,ctime:i},s)}}function c(e){e?u(e):t.putObject(p.id,p,f)}function l(r,s){if(r)u(r);else{if(h=s,!h)return u(new ke.EIO("Expected Buffer"));var f=void 0!==a&&null!==a?a:e.position,l=Math.max(h.length,f+o),d=new We(l);d.fill(0),h&&h.copy(d),n.copy(d,f,i,i+o),void 0===a&&(e.position+=o),p.size=l,p.version+=1,t.putBuffer(p.data,d,c)}}function d(e,n){e?u(e):(p=n,t.getBuffer(p.data,l))}var p,h;t.getObject(e.id,d)}function p(t,e,n,r,i,o,a){function u(t,u){if(t)a(t);else{if(c=u,!c)return a(new ke.EIO("Expected Buffer"));var s=void 0!==o&&null!==o?o:e.position;i=s+i>n.length?i-s:i,c.copy(n,r,s,s+i),void 0===o&&(e.position+=i),a(null,i)}}function s(e,n){e?a(e):(f=n,t.getBuffer(f.data,u))}var f,c;t.getObject(e.id,s)}function h(t,e,r){e=he(e),ve(e),o(t,e,n(r))}function g(t,e,r){t.getObject(e.id,n(r))}function v(t,e,r){function i(e,n){e?r(e):(u=n,t.getObject(u.data,a))}function a(i,o){i?r(i):(s=o,de(s).has(f)?t.getObject(s[f].id,n(r)):r(new ke.ENOENT("a component of the path does not name an existing file",e)))}e=he(e);var u,s,f=ve(e),c=ge(e);je==f?o(t,e,n(r)):o(t,c,i)}function m(t,e,n,i){function a(e){e?i(e):r(t,n,y,{ctime:Date.now()},i)}function u(e,n){e?i(e):(y=n,y.nlinks+=1,t.putObject(y.id,y,a))}function s(e){e?i(e):t.getObject(E[w].id,u)}function f(e,n){e?i(e):(E=n,de(E).has(w)?i(new ke.EEXIST("newpath resolves to an existing file",w)):(E[w]=v[p],t.putObject(m.data,E,s)))}function c(e,n){e?i(e):(m=n,t.getObject(m.data,f))}function l(e,n){e?i(e):(v=n,de(v).has(p)?o(t,b,c):i(new ke.ENOENT("a component of either path prefix does not exist",p)))}function d(e,n){e?i(e):(g=n,t.getObject(g.data,l))}e=he(e);var p=ve(e),h=ge(e);n=he(n);var g,v,m,E,y,w=ve(n),b=ge(n);o(t,h,d)}function E(t,e,n){function i(e){e?n(e):(delete d[h],t.putObject(l.data,d,function(){var e=Date.now();r(t,g,l,{mtime:e,ctime:e},n)}))}function a(e){e?n(e):t.delete(p.data,i)}function u(o,u){o?n(o):(p=u,p.nlinks-=1,1>p.nlinks?t.delete(p.id,a):t.putObject(p.id,p,function(){r(t,e,p,{ctime:Date.now()},i)}))}function s(t,e){t?n(t):"DIRECTORY"===e.mode?n(new ke.EPERM("unlink not permitted on directories",h)):u(null,e)}function f(e,r){e?n(e):(d=r,de(d).has(h)?t.getObject(d[h].id,s):n(new ke.ENOENT("a component of the path does not name an existing file",h)))}function c(e,r){e?n(e):(l=r,t.getObject(l.data,f))}e=he(e);var l,d,p,h=ve(e),g=ge(e);o(t,g,c)}function y(t,e,n){function r(t,e){if(t)n(t);else{u=e;var r=Object.keys(u);n(null,r)}}function i(i,o){i?n(i):o.mode!==be?n(new ke.ENOTDIR(null,e)):(a=o,t.getObject(a.data,r))}e=he(e),ve(e);var a,u;o(t,e,i)}function w(t,e,n,i){function a(e,n){e?i(e):(l=n,t.getObject(l.data,u))}function u(t,e){t?i(t):(d=e,de(d).has(h)?i(new ke.EEXIST(null,h)):s())}function s(){Ye.create({guid:t.guid,mode:Ie},function(n,r){return n?(i(n),void 0):(p=r,p.nlinks+=1,p.size=e.length,p.data=e,t.putObject(p.id,p,c),void 0)})}function f(e){if(e)i(e);else{var n=Date.now();r(t,g,l,{mtime:n,ctime:n},i)}}function c(e){e?i(e):(d[h]=new Pe(p.id,Ie),t.putObject(l.data,d,f))}n=he(n);var l,d,p,h=ve(n),g=ge(n);je==h?i(new ke.EEXIST(null,h)):o(t,g,a)}function b(t,e,n){function r(e,r){e?n(e):(u=r,t.getObject(u.data,i))}function i(e,r){e?n(e):(s=r,de(s).has(f)?t.getObject(s[f].id,a):n(new ke.ENOENT("a component of the path does not name an existing file",f)))}function a(t,r){t?n(t):r.mode!=Ie?n(new ke.EINVAL("path not a symbolic link",e)):n(null,r.data)}e=he(e);var u,s,f=ve(e),c=ge(e);o(t,c,r)}function I(t,e,n,i){function a(n,r){n?i(n):r.mode==be?i(new ke.EISDIR(null,e)):(c=r,t.getBuffer(c.data,u))}function u(e,r){if(e)i(e);else{if(!r)return i(new ke.EIO("Expected Buffer"));var o=new We(n);o.fill(0),r&&r.copy(o),t.putBuffer(c.data,o,f)}}function s(n){if(n)i(n);else{var o=Date.now();r(t,e,c,{mtime:o,ctime:o},i)}}function f(e){e?i(e):(c.size=n,c.version+=1,t.putObject(c.id,c,s))}e=he(e);var c;0>n?i(new ke.EINVAL("length cannot be negative")):o(t,e,a)}function O(t,e,n,i){function o(e,n){e?i(e):n.mode==be?i(new ke.EISDIR):(f=n,t.getBuffer(f.data,a))}function a(e,r){if(e)i(e);else{var o;if(!r)return i(new ke.EIO("Expected Buffer"));r?o=r.slice(0,n):(o=new We(n),o.fill(0)),t.putBuffer(f.data,o,s)}}function u(n){if(n)i(n);else{var o=Date.now();r(t,e.path,f,{mtime:o,ctime:o},i)}}function s(e){e?i(e):(f.size=n,f.version+=1,t.putObject(f.id,f,u))}var f;0>n?i(new ke.EINVAL("length cannot be negative")):t.getObject(e.id,o)}function j(t,e,n,i,a){function u(o,u){o?a(o):r(t,e,u,{atime:n,ctime:i,mtime:i},a)}e=he(e),"number"!=typeof n||"number"!=typeof i?a(new ke.EINVAL("atime and mtime must be number",e)):0>n||0>i?a(new ke.EINVAL("atime and mtime must be positive integers",e)):o(t,e,u)}function T(t,e,n,i,o){function a(a,u){a?o(a):r(t,e.path,u,{atime:n,ctime:i,mtime:i},o)}"number"!=typeof n||"number"!=typeof i?o(new ke.EINVAL("atime and mtime must be a number")):0>n||0>i?o(new ke.EINVAL("atime and mtime must be positive integers")):t.getObject(e.id,a)}function A(t,e,n,r,i,o){e=he(e),"string"!=typeof n?o(new ke.EINVAL("attribute name must be a string",e)):n?null!==i&&i!==Le&&i!==Be?o(new ke.EINVAL("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE",e)):a(t,e,n,r,i,o):o(new ke.EINVAL("attribute name cannot be an empty string",e))}function S(t,e,n,r,i,o){"string"!=typeof n?o(new ke.EINVAL("attribute name must be a string")):n?null!==i&&i!==Le&&i!==Be?o(new ke.EINVAL("invalid flag, must be null, XATTR_CREATE or XATTR_REPLACE")):a(t,e,n,r,i,o):o(new ke.EINVAL("attribute name cannot be an empty string"))}function x(t,e,n,r){function i(t,i){i?i.xattrs[n]:null,t?r(t):i.xattrs.hasOwnProperty(n)?r(null,i.xattrs[n]):r(new ke.ENOATTR(null,e))}e=he(e),"string"!=typeof n?r(new ke.EINVAL("attribute name must be a string",e)):n?o(t,e,i):r(new ke.EINVAL("attribute name cannot be an empty string",e))}function N(t,e,n,r){function i(t,e){e?e.xattrs[n]:null,t?r(t):e.xattrs.hasOwnProperty(n)?r(null,e.xattrs[n]):r(new ke.ENOATTR)}"string"!=typeof n?r(new ke.EINVAL):n?t.getObject(e.id,i):r(new ke.EINVAL("attribute name cannot be an empty string"))}function D(t,e,n,i){function a(o,a){function u(n){n?i(n):r(t,e,a,{ctime:Date.now()},i)}var s=a?a.xattrs:null;o?i(o):s.hasOwnProperty(n)?(delete a.xattrs[n],t.putObject(a.id,a,u)):i(new ke.ENOATTR(null,e))}e=he(e),"string"!=typeof n?i(new ke.EINVAL("attribute name must be a string",e)):n?o(t,e,a):i(new ke.EINVAL("attribute name cannot be an empty string",e))}function _(t,e,n,i){function o(o,a){function u(n){n?i(n):r(t,e.path,a,{ctime:Date.now()},i)}o?i(o):a.xattrs.hasOwnProperty(n)?(delete a.xattrs[n],t.putObject(a.id,a,u)):i(new ke.ENOATTR)}"string"!=typeof n?i(new ke.EINVAL("attribute name must be a string")):n?t.getObject(e.id,o):i(new ke.EINVAL("attribute name cannot be an empty string"))}function R(t){return de(Re).has(t)?Re[t]:null}function L(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 B(t,e){var n;return t?Ee(t)?n=new ke.EINVAL("Path must be a string without null bytes.",t):me(t)||(n=new ke.EINVAL("Path must be absolute.",t)):n=new ke.EINVAL("Path must be a string",t),n?(e(n),!1):!0}function M(t,e,n,r,i,o){function a(e,i){if(e)o(e);else{var a;a=de(r).contains(_e)?i.size:0;var u=new Ue(n,i.id,r,a),s=t.allocDescriptor(u);o(null,s)}}o=arguments[arguments.length-1],B(n,o)&&(r=R(r),r||o(new ke.EINVAL("flags is not valid"),n),c(e,n,r,a))}function F(t,e,n,r){de(t.openFiles).has(n)?(t.releaseDescriptor(n),r(null)):r(new ke.EBADF)}function C(t,e,n,r,o){B(n,o)&&i(e,n,r,o)}function k(t,e,r,i,o){o=arguments[arguments.length-1],B(r,o)&&s(e,r,n(o))}function P(t,e,r,i){B(r,i)&&f(e,r,n(i))}function U(t,e,n,r){function i(e,n){if(e)r(e);else{var i=new Xe(n,t.name);r(null,i)}}B(n,r)&&h(e,n,i)}function V(t,e,n,r){function i(e,n){if(e)r(e);else{var i=new Xe(n,t.name);r(null,i)}}var o=t.openFiles[n];o?g(e,o,i):r(new ke.EBADF)}function Y(t,e,r,i,o){B(r,o)&&B(i,o)&&m(e,r,i,n(o))}function X(t,e,r,i){B(r,i)&&E(e,r,n(i))}function W(t,e,r,i,o,a,u,s){function f(t,e){s(t,e||0,i)}o=void 0===o?0:o,a=void 0===a?i.length-o:a,s=arguments[arguments.length-1];var c=t.openFiles[r];c?de(c.flags).contains(Se)?p(e,c,i,o,a,u,n(f)):s(new ke.EBADF("descriptor does not permit reading")):s(new ke.EBADF)}function z(t,e,n,r,i){if(i=arguments[arguments.length-1],r=L(r,null,"r"),B(n,i)){var o=R(r.flag||"r");return o?(c(e,n,o,function(a,u){function s(){t.releaseDescriptor(c)}if(a)return i(a);var f=new Ue(n,u.id,o,0),c=t.allocDescriptor(f);g(e,f,function(o,a){if(o)return s(),i(o);var u=new Xe(a,t.name);if(u.isDirectory())return s(),i(new ke.EISDIR("illegal operation on directory",n));var c=u.size,l=new We(c);l.fill(0),p(e,f,l,0,c,0,function(t){if(s(),t)return i(t);var e;e="utf8"===r.encoding?Ce.decode(l):l,i(null,e)})})}),void 0):i(new ke.EINVAL("flags is not valid",n))}}function q(t,e,r,i,o,a,u,s){s=arguments[arguments.length-1],o=void 0===o?0:o,a=void 0===a?i.length-o:a;var f=t.openFiles[r];f?de(f.flags).contains(xe)?a>i.length-o?s(new ke.EIO("intput buffer is too small")):d(e,f,i,o,a,u,n(s)):s(new ke.EBADF("descriptor does not permit writing")):s(new ke.EBADF)}function J(t,e,n,r,i,o){if(o=arguments[arguments.length-1],i=L(i,"utf8","w"),B(n,o)){var a=R(i.flag||"w");if(!a)return o(new ke.EINVAL("flags is not valid",n));r=r||"","number"==typeof r&&(r=""+r),"string"==typeof r&&"utf8"===i.encoding&&(r=Ce.encode(r)),c(e,n,a,function(i,u){if(i)return o(i);var s=new Ue(n,u.id,a,0),f=t.allocDescriptor(s);l(e,s,r,0,r.length,function(e){return t.releaseDescriptor(f),e?o(e):(o(null),void 0)})})}}function Q(t,e,n,r,i,o){if(o=arguments[arguments.length-1],i=L(i,"utf8","a"),B(n,o)){var a=R(i.flag||"a");if(!a)return o(new ke.EINVAL("flags is not valid",n));r=r||"","number"==typeof r&&(r=""+r),"string"==typeof r&&"utf8"===i.encoding&&(r=Ce.encode(r)),c(e,n,a,function(i,u){if(i)return o(i);var s=new Ue(n,u.id,a,u.size),f=t.allocDescriptor(s);d(e,s,r,0,r.length,s.position,function(e){return t.releaseDescriptor(f),e?o(e):(o(null),void 0)})})}}function H(t,e,n,r){function i(t){r(t?!1:!0)}U(t,e,n,i)}function K(t,e,r,i,o){B(r,o)&&x(e,r,i,n(o))}function G(t,e,r,i,o){var a=t.openFiles[r];a?N(e,a,i,n(o)):o(new ke.EBADF)}function $(t,e,r,i,o,a,u){"function"==typeof a&&(u=a,a=null),B(r,u)&&A(e,r,i,o,a,n(u))}function Z(t,e,r,i,o,a,u){"function"==typeof a&&(u=a,a=null);var s=t.openFiles[r];s?de(s.flags).contains(xe)?S(e,s,i,o,a,n(u)):u(new ke.EBADF("descriptor does not permit writing")):u(new ke.EBADF)}function te(t,e,r,i,o){B(r,o)&&D(e,r,i,n(o))}function ee(t,e,r,i,o){var a=t.openFiles[r];a?de(a.flags).contains(xe)?_(e,a,i,n(o)):o(new ke.EBADF("descriptor does not permit writing")):o(new ke.EBADF)}function ne(t,e,n,r,i,o){function a(t,e){t?o(t):0>e.size+r?o(new ke.EINVAL("resulting file offset would be negative")):(u.position=e.size+r,o(null,u.position))}var u=t.openFiles[n];u||o(new ke.EBADF),"SET"===i?0>r?o(new ke.EINVAL("resulting file offset would be negative")):(u.position=r,o(null,u.position)):"CUR"===i?0>u.position+r?o(new ke.EINVAL("resulting file offset would be negative")):(u.position+=r,o(null,u.position)):"END"===i?g(e,u,a):o(new ke.EINVAL("whence argument is not a proper value"))}function re(t,e,r,i){B(r,i)&&y(e,r,n(i))}function ie(t,e,r,i,o,a){if(B(r,a)){var u=Date.now();i=i?i:u,o=o?o:u,j(e,r,i,o,n(a))}}function oe(t,e,r,i,o,a){var u=Date.now();i=i?i:u,o=o?o:u;var s=t.openFiles[r];s?de(s.flags).contains(xe)?T(e,s,i,o,n(a)):a(new ke.EBADF("descriptor does not permit writing")):a(new ke.EBADF)}function ae(t,e,r,i,o){function a(t){t?o(t):E(e,r,n(o))}B(r,o)&&B(i,o)&&m(e,r,i,a)}function ue(t,e,r,i,o,a){a=arguments[arguments.length-1],B(r,a)&&B(i,a)&&w(e,r,i,n(a))}function se(t,e,r,i){B(r,i)&&b(e,r,n(i))}function fe(t,e,n,r){function i(e,n){if(e)r(e);else{var i=new Xe(n,t.name);r(null,i)}}B(n,r)&&v(e,n,i)}function ce(t,e,r,i,o){o=arguments[arguments.length-1],i=i||0,B(r,o)&&I(e,r,i,n(o))}function le(t,e,r,i,o){o=arguments[arguments.length-1],i=i||0;var a=t.openFiles[r];a?de(a.flags).contains(xe)?O(e,a,i,n(o)):o(new ke.EBADF("descriptor does not permit writing")):o(new ke.EBADF)}var de=t("../../lib/nodash.js"),pe=t("../path.js"),he=pe.normalize,ge=pe.dirname,ve=pe.basename,me=pe.isAbsolute,Ee=pe.isNull,ye=t("../constants.js"),we=ye.MODE_FILE,be=ye.MODE_DIRECTORY,Ie=ye.MODE_SYMBOLIC_LINK,Oe=ye.MODE_META,je=ye.ROOT_DIRECTORY_NAME,Te=ye.SUPER_NODE_ID,Ae=ye.SYMLOOP_MAX,Se=ye.O_READ,xe=ye.O_WRITE,Ne=ye.O_CREATE,De=ye.O_EXCLUSIVE;ye.O_TRUNCATE;var _e=ye.O_APPEND,Re=ye.O_FLAGS,Le=ye.XATTR_CREATE,Be=ye.XATTR_REPLACE,Me=ye.FS_NOMTIME,Fe=ye.FS_NOCTIME,Ce=t("../encoding.js"),ke=t("../errors.js"),Pe=t("../directory-entry.js"),Ue=t("../open-file-description.js"),Ve=t("../super-node.js"),Ye=t("../node.js"),Xe=t("../stats.js"),We=t("../buffer.js");e.exports={ensureRootDirectory:u,open:M,close:F,mknod:C,mkdir:k,rmdir:P,unlink:X,stat:U,fstat:V,link:Y,read:W,readFile:z,write:q,writeFile:J,appendFile:Q,exists:H,getxattr:K,fgetxattr:G,setxattr:$,fsetxattr:Z,removexattr:te,fremovexattr:ee,lseek:ne,readdir:re,utimes:ie,futimes:oe,rename:ae,symlink:ue,readlink:se,lstat:fe,truncate:ce,ftruncate:le}},{"../../lib/nodash.js":4,"../buffer.js":10,"../constants.js":11,"../directory-entry.js":12,"../encoding.js":13,"../errors.js":14,"../node.js":19,"../open-file-description.js":20,"../path.js":21,"../stats.js":29,"../super-node.js":30}],16:[function(t,e){function n(t){return"function"==typeof t?t:function(t){if(t)throw t}}function r(t,e){function n(){R.forEach(function(t){t.call(this)}.bind(N)),R=null}function r(t){return function(e){function n(e){var r=T();t.getObject(r,function(t,i){return t?(e(t),void 0):(i?n(e):e(null,r),void 0)})}return i(g).contains(p)?(e(null,T()),void 0):(n(e),void 0)}}function u(t){if(t.length){var e=v.getInstance();t.forEach(function(t){e.emit(t.event,t.path)})}}t=t||{},e=e||a;var g=t.flags,T=t.guid?t.guid:y,A=t.provider||new h.Default(t.name||s),S=t.name||A.name,x=i(g).contains(f),N=this;N.readyState=l,N.name=S,N.error=null,N.stdin=w,N.stdout=b,N.stderr=I;var D={},_=O;Object.defineProperty(this,"openFiles",{get:function(){return D}}),this.allocDescriptor=function(t){var e=_++;return D[e]=t,e},this.releaseDescriptor=function(t){delete D[t]};var R=[];this.queueOrRun=function(t){var e;return c==N.readyState?t.call(N):d==N.readyState?e=new E.EFILESYSTEMERROR("unknown error"):R.push(t),e},this.watch=function(t,e,n){if(o(t))throw Error("Path must be a string without null bytes.");"function"==typeof e&&(n=e,e={}),e=e||{},n=n||a;var r=new m;return r.start(t,!1,e.recursive),r.on("change",n),r},A.open(function(t){function i(t){function i(t){var e=A[t]();return e.flags=g,e.changes=[],e.guid=r(e),e.close=function(){var t=e.changes;u(t),t.length=0},e}N.provider={openReadWriteContext:function(){return i("getReadWriteContext")},openReadOnlyContext:function(){return i("getReadOnlyContext")}},N.readyState=t?d:c,n(),e(t,N)}if(t)return i(t);var o=A.getReadWriteContext();o.guid=r(o),x?o.clear(function(t){return t?i(t):(j.ensureRootDirectory(o,i),void 0)}):j.ensureRootDirectory(o,i)})}var i=t("../../lib/nodash.js"),o=t("../path.js").isNull,a=t("../shared.js").nop,u=t("../constants.js"),s=u.FILE_SYSTEM_NAME,f=u.FS_FORMAT,c=u.FS_READY,l=u.FS_PENDING,d=u.FS_ERROR,p=u.FS_NODUPEIDCHECK,h=t("../providers/index.js"),g=t("../shell/shell.js"),v=t("../../lib/intercom.js"),m=t("../fs-watcher.js"),E=t("../errors.js"),y=t("../shared.js").guid,w=u.STDIN,b=u.STDOUT,I=u.STDERR,O=u.FIRST_DESCRIPTOR,j=t("./implementation.js");r.providers=h,["open","close","mknod","mkdir","rmdir","stat","fstat","link","unlink","read","readFile","write","writeFile","appendFile","exists","lseek","readdir","rename","readlink","symlink","lstat","truncate","ftruncate","utimes","futimes","setxattr","getxattr","fsetxattr","fgetxattr","removexattr","fremovexattr"].forEach(function(t){r.prototype[t]=function(){var e=this,r=Array.prototype.slice.call(arguments,0),i=r.length-1,o="function"!=typeof r[i],a=n(r[i]),u=e.queueOrRun(function(){function n(){u.close(),a.apply(e,arguments)}var u=e.provider.openReadWriteContext();if(d===e.readyState){var s=new E.EFILESYSTEMERROR("filesystem unavailable, operation canceled");return a.call(e,s)}o?r.push(n):r[i]=n;var f=[e,u].concat(r);j[t].apply(null,f)});u&&a(u)}}),r.prototype.Shell=function(t){return new g(this,t)},e.exports=r},{"../../lib/intercom.js":3,"../../lib/nodash.js":4,"../constants.js":11,"../errors.js":14,"../fs-watcher.js":17,"../path.js":21,"../providers/index.js":22,"../shared.js":26,"../shell/shell.js":28,"./implementation.js":15}],17:[function(t,e){function n(){function t(t){(n===t||u&&0===t.indexOf(e))&&a.trigger("change","change",t)}r.call(this);var e,n,a=this,u=!1;a.start=function(r,a,s){if(!n){if(i.isNull(r))throw Error("Path must be a string without null bytes.");n=i.normalize(r),u=s===!0,u&&(e="/"===n?"/":n+"/");var f=o.getInstance();f.on("change",t)}},a.close=function(){var e=o.getInstance();e.off("change",t),a.removeAllListeners("change")}}var r=t("../lib/eventemitter.js"),i=t("./path.js"),o=t("../lib/intercom.js");n.prototype=new r,n.prototype.constructor=n,e.exports=n},{"../lib/eventemitter.js":2,"../lib/intercom.js":3,"./path.js":21}],18:[function(t,e){e.exports={FileSystem:t("./filesystem/interface.js"),Buffer:t("./buffer.js"),Path:t("./path.js"),Errors:t("./errors.js")}},{"./buffer.js":10,"./errors.js":14,"./filesystem/interface.js":16,"./path.js":21}],19:[function(t,e){function n(t){var e=Date.now();this.id=t.id,this.mode=t.mode||i,this.size=t.size||0,this.atime=t.atime||e,this.ctime=t.ctime||e,this.mtime=t.mtime||e,this.flags=t.flags||[],this.xattrs=t.xattrs||{},this.nlinks=t.nlinks||0,this.version=t.version||0,this.blksize=void 0,this.nblocks=1,this.data=t.data}function r(t,e,n){t[e]?n(null):t.guid(function(r,i){t[e]=i,n(r)})}var i=t("./constants.js").MODE_FILE;n.create=function(t,e){r(t,"id",function(i){return i?(e(i),void 0):(r(t,"data",function(r){return r?(e(r),void 0):(e(null,new n(t)),void 0)}),void 0)})},e.exports=n},{"./constants.js":11}],20:[function(t,e){e.exports=function(t,e,n,r){this.path=t,this.id=e,this.flags=n,this.position=r}},{}],21:[function(t,e,n){function r(t,e){for(var n=0,r=t.length-1;r>=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function i(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var i=n>=0?arguments[n]:"/";"string"==typeof i&&i&&(t=i+"/"+t,e="/"===i.charAt(0))}return t=r(t.split("/").filter(function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function o(t){var e="/"===t.charAt(0);return"/"===t.substr(-1),t=r(t.split("/").filter(function(t){return!!t}),!e).join("/"),t||e||(t="."),(e?"/":"")+t}function a(){var t=Array.prototype.slice.call(arguments,0);return o(t.filter(function(t){return t&&"string"==typeof t}).join("/"))}function u(t,e){function r(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=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),o=r(e.split("/")),a=Math.min(i.length,o.length),u=a,s=0;a>s;s++)if(i[s]!==o[s]){u=s;break}for(var f=[],s=u;i.length>s;s++)f.push("..");return f=f.concat(o.slice(u)),f.join("/")}function s(t){var e=h(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function f(t,e){var n=h(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),""===n?"/":n}function c(t){return h(t)[3]}function l(t){return"/"===t.charAt(0)?!0:!1}function d(t){return-1!==(""+t).indexOf("\0")?!0:!1}var p=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/,h=function(t){var e=p.exec(t);return[e[1]||"",e[2]||"",e[3]||"",e[4]||""]};e.exports={normalize:o,resolve:i,join:a,relative:u,sep:"/",delimiter:":",dirname:s,basename:f,extname:c,isAbsolute:l,isNull:d}},{}],22:[function(t,e){var n=t("./indexeddb.js"),r=t("./websql.js"),i=t("./memory.js");e.exports={IndexedDB:n,WebSQL:r,Memory:i,Default:n,Fallback:function(){function t(){throw"[Filer Error] Your browser doesn't support IndexedDB or WebSQL."}return n.isSupported()?n:r.isSupported()?r:(t.isSupported=function(){return!1},t)}()}},{"./indexeddb.js":23,"./memory.js":24,"./websql.js":25}],23:[function(t,e){(function(n){function r(t,e){var n=t.transaction(s,e);this.objectStore=n.objectStore(s)}function i(t,e,n){try{var r=t.get(e);r.onsuccess=function(t){var e=t.target.result;n(null,e)},r.onerror=function(t){n(t)}}catch(i){n(i)}}function o(t,e,n,r){try{var i=t.put(n,e);i.onsuccess=function(t){var e=t.target.result;r(null,e)},i.onerror=function(t){r(t)}}catch(o){r(o)}}function a(t){this.name=t||u,this.db=null}var u=t("../constants.js").FILE_SYSTEM_NAME,s=t("../constants.js").FILE_STORE_NAME,f=t("../constants.js").IDB_RW;t("../constants.js").IDB_RO;var c=t("../errors.js"),l=t("../buffer.js"),d=n.indexedDB||n.mozIndexedDB||n.webkitIndexedDB||n.msIndexedDB;r.prototype.clear=function(t){try{var e=this.objectStore.clear();e.onsuccess=function(){t()},e.onerror=function(e){t(e)}}catch(n){t(n)}},r.prototype.getObject=function(t,e){i(this.objectStore,t,e)},r.prototype.getBuffer=function(t,e){i(this.objectStore,t,function(t,n){return t?e(t):(e(null,new l(n)),void 0)})},r.prototype.putObject=function(t,e,n){o(this.objectStore,t,e,n)},r.prototype.putBuffer=function(t,e,n){o(this.objectStore,t,e.buffer,n)},r.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)}},a.isSupported=function(){return!!d},a.prototype.open=function(t){var e=this;if(e.db)return t();var n=d.open(e.name);n.onupgradeneeded=function(t){var e=t.target.result;e.objectStoreNames.contains(s)&&e.deleteObjectStore(s),e.createObjectStore(s)},n.onsuccess=function(n){e.db=n.target.result,t()},n.onerror=function(){t(new c.EINVAL("IndexedDB cannot be accessed. If private browsing is enabled, disable it."))}},a.prototype.getReadOnlyContext=function(){return new r(this.db,f)},a.prototype.getReadWriteContext=function(){return new r(this.db,f)},e.exports=a}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../buffer.js":10,"../constants.js":11,"../errors.js":14}],24:[function(t,e){function n(t,e){this.readOnly=e,this.objectStore=t}function r(t){this.name=t||i}var i=t("../constants.js").FILE_SYSTEM_NAME,o=t("../../lib/async.js").setImmediate,a=function(){var t={};return function(e){return t.hasOwnProperty(e)||(t[e]={}),t[e]}}();n.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)},n.prototype.getObject=n.prototype.getBuffer=function(t,e){var n=this;o(function(){e(null,n.objectStore[t])})},n.prototype.putObject=n.prototype.putBuffer=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)},n.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)},r.isSupported=function(){return!0},r.prototype.open=function(t){this.db=a(this.name),o(t)},r.prototype.getReadOnlyContext=function(){return new n(this.db,!0)},r.prototype.getReadWriteContext=function(){return new n(this.db,!1)},e.exports=r},{"../../lib/async.js":1,"../constants.js":11}],25:[function(t,e){(function(n){function r(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 i(t,e,n){function r(t,e){var r=0===e.rows.length?null:e.rows.item(0).data;n(null,r)}function i(t,e){n(e)}t(function(t){t.executeSql("SELECT data FROM "+s+" WHERE id = ? LIMIT 1;",[e],r,i)})}function o(t,e,n,r){function i(){r(null)}function o(t,e){r(e)}t(function(t){t.executeSql("INSERT OR REPLACE INTO "+s+" (id, data) VALUES (?, ?);",[e,n],i,o)})}function a(t){this.name=t||u,this.db=null}var u=t("../constants.js").FILE_SYSTEM_NAME,s=t("../constants.js").FILE_STORE_NAME,f=t("../constants.js").WSQL_VERSION,c=t("../constants.js").WSQL_SIZE,l=t("../constants.js").WSQL_DESC,d=t("../errors.js"),p=t("../buffer.js"),h=t("base64-arraybuffer");r.prototype.clear=function(t){function e(e,n){t(n)}function n(){t(null)}this.getTransaction(function(t){t.executeSql("DELETE FROM "+s+";",[],n,e)})},r.prototype.getObject=function(t,e){i(this.getTransaction,t,function(t,n){if(t)return e(t);try{n&&(n=JSON.parse(n))}catch(r){return e(r)}e(null,n)})},r.prototype.getBuffer=function(t,e){i(this.getTransaction,t,function(t,n){if(t)return e(t);if(n||""===n){var r=h.decode(n);n=new p(r)}e(null,n)})},r.prototype.putObject=function(t,e,n){var r=JSON.stringify(e);o(this.getTransaction,t,r,n)},r.prototype.putBuffer=function(t,e,n){var r=h.encode(e.buffer);o(this.getTransaction,t,r,n)},r.prototype.delete=function(t,e){function n(){e(null)}function r(t,n){e(n)}this.getTransaction(function(e){e.executeSql("DELETE FROM "+s+" WHERE id = ?;",[t],n,r)})},a.isSupported=function(){return!!n.openDatabase},a.prototype.open=function(t){function e(e,n){5===n.code&&t(new d.EINVAL("WebSQL cannot be accessed. If private browsing is enabled, disable it.")),t(n)}function r(){i.db=o,t()}var i=this;if(i.db)return t();var o=n.openDatabase(i.name,f,l,c);return o?(o.transaction(function(t){function n(t){t.executeSql("CREATE INDEX IF NOT EXISTS idx_"+s+"_id"+" on "+s+" (id);",[],r,e)}t.executeSql("CREATE TABLE IF NOT EXISTS "+s+" (id unique, data TEXT);",[],n,e)}),void 0):(t("[WebSQL] Unable to open database."),void 0)},a.prototype.getReadOnlyContext=function(){return new r(this.db,!0)},a.prototype.getReadWriteContext=function(){return new r(this.db,!1)},e.exports=a}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../buffer.js":10,"../constants.js":11,"../errors.js":14,"base64-arraybuffer":5}],26:[function(t,e){function n(){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 r(){}function i(t){for(var e=[],n=t.length,r=0;n>r;r++)e[r]=t[r];return e}e.exports={guid:n,u8toArray:i,nop:r}},{}],27:[function(t,e){var n=t("../constants.js").ENVIRONMENT;e.exports=function(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}}},{"../constants.js":11}],28:[function(t,e){function n(t,e){e=e||{};var n=new o(e.env),a="/";Object.defineProperty(this,"fs",{get:function(){return t},enumerable:!0}),Object.defineProperty(this,"env",{get:function(){return n},enumerable:!0}),this.cd=function(e,n){e=r.resolve(a,e),t.stat(e,function(t,r){return t?(n(new i.ENOTDIR(null,e)),void 0):("DIRECTORY"===r.type?(a=e,n()):n(new i.ENOTDIR(null,e)),void 0)})},this.pwd=function(){return a}}var r=t("../path.js"),i=t("../errors.js"),o=t("./environment.js"),a=t("../../lib/async.js");t("../encoding.js"),n.prototype.exec=function(t,e,n){var i=this,o=i.fs;"function"==typeof e&&(n=e,e=[]),e=e||[],n=n||function(){},t=r.resolve(i.pwd(),t),o.readFile(t,"utf8",function(t,r){if(t)return n(t),void 0;try{var i=Function("fs","args","callback",r);i(o,e,n)}catch(a){n(a)}})},n.prototype.touch=function(t,e,n){function i(t){u.writeFile(t,"",n)}function o(t){var r=Date.now(),i=e.date||r,o=e.date||r;u.utimes(t,i,o,n)}var a=this,u=a.fs;"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t=r.resolve(a.pwd(),t),u.stat(t,function(r){r?e.updateOnly===!0?n():i(t):o(t)})},n.prototype.cat=function(t,e){function n(t,e){var n=r.resolve(o.pwd(),t);u.readFile(n,"utf8",function(t,n){return t?(e(t),void 0):(s+=n+"\n",e(),void 0)})}var o=this,u=o.fs,s="";return e=e||function(){},t?(t="string"==typeof t?[t]:t,a.eachSeries(t,n,function(t){t?e(t):e(null,s.replace(/\n$/,""))}),void 0):(e(new i.EINVAL("Missing files argument")),void 0)},n.prototype.ls=function(t,e,n){function o(t,n){var i=r.resolve(u.pwd(),t),f=[];s.readdir(i,function(t,u){function c(t,n){t=r.join(i,t),s.stat(t,function(a,u){if(a)return n(a),void 0;var s={path:r.basename(t),links:u.nlinks,size:u.size,modified:u.mtime,type:u.type};e.recursive&&"DIRECTORY"===u.type?o(r.join(i,s.path),function(t,e){return t?(n(t),void 0):(s.contents=e,f.push(s),n(),void 0)}):(f.push(s),n())})}return t?(n(t),void 0):(a.eachSeries(u,c,function(t){n(t,f)}),void 0)})}var u=this,s=u.fs;return"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t?(o(t,n),void 0):(n(new i.EINVAL("Missing dir argument")),void 0)},n.prototype.rm=function(t,e,n){function o(t,n){t=r.resolve(u.pwd(),t),s.stat(t,function(u,f){return u?(n(u),void 0):"FILE"===f.type?(s.unlink(t,n),void 0):(s.readdir(t,function(u,f){return u?(n(u),void 0):0===f.length?(s.rmdir(t,n),void 0):e.recursive?(f=f.map(function(e){return r.join(t,e)}),a.eachSeries(f,o,function(e){return e?(n(e),void 0):(s.rmdir(t,n),void 0)}),void 0):(n(new i.ENOTEMPTY(null,t)),void 0)}),void 0)})}var u=this,s=u.fs;return"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t?(o(t,n),void 0):(n(new i.EINVAL("Missing path argument")),void 0)},n.prototype.tempDir=function(t){var e=this,n=e.fs,r=e.env.get("TMP");t=t||function(){},n.mkdir(r,function(){t(null,r)})},n.prototype.mkdirp=function(t,e){function n(t,e){a.stat(t,function(o,u){if(u){if(u.isDirectory())return e(),void 0;if(u.isFile())return e(new i.ENOTDIR(null,t)),void 0}else{if(o&&"ENOENT"!==o.code)return e(o),void 0;var s=r.dirname(t);"/"===s?a.mkdir(t,function(t){return t&&"EEXIST"!=t.code?(e(t),void 0):(e(),void 0)}):n(s,function(n){return n?e(n):(a.mkdir(t,function(t){return t&&"EEXIST"!=t.code?(e(t),void 0):(e(),void 0) }),void 0)})}})}var o=this,a=o.fs;return e=e||function(){},t?"/"===t?(e(),void 0):(n(t,e),void 0):(e(new i.EINVAL("Missing path argument")),void 0)},e.exports=n},{"../../lib/async.js":1,"../encoding.js":13,"../errors.js":14,"../path.js":21,"./environment.js":27}],29:[function(t,e){function n(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}var r=t("./constants.js");n.prototype.isFile=function(){return this.type===r.MODE_FILE},n.prototype.isDirectory=function(){return this.type===r.MODE_DIRECTORY},n.prototype.isSymbolicLink=function(){return this.type===r.MODE_SYMBOLIC_LINK},n.prototype.isSocket=n.prototype.isFIFO=n.prototype.isCharacterDevice=n.prototype.isBlockDevice=function(){return!1},e.exports=n},{"./constants.js":11}],30:[function(t,e){function n(t){var e=Date.now();this.id=r.SUPER_NODE_ID,this.mode=r.MODE_META,this.atime=t.atime||e,this.ctime=t.ctime||e,this.mtime=t.mtime||e,this.rnode=t.rnode}var r=t("./constants.js");n.create=function(t,e){t.guid(function(r,i){return r?(e(r),void 0):(t.rnode=t.rnode||i,e(null,new n(t)),void 0)})},e.exports=n},{"./constants.js":11}]},{},[18])(18)}); \ No newline at end of file diff --git a/package.json b/package.json index 86c2705..bc35f8c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "idb", "websql" ], - "version": "0.0.32", + "version": "0.0.33", "author": "Alan K (http://blog.modeswitch.org)", "homepage": "http://filerjs.github.io/filer", "bugs": "https://github.com/filerjs/filer/issues",