}functionu(l,n){returnMath.floor(l/n)}functione(l){varn=0;this.get=function(){returnn>=l.length?M:Number(l[n])},this.offset=function(u){if(n+=u,0>n)throwError("Seeking past start of the buffer");if(n>l.length)throwError("Seeking past EOF")},this.match=function(u){if(u.length>n+l.length)return!1;vare;for(e=0;u.length>e;e+=1)if(Number(l[n+e])!==u[e])return!1;return!0}}functiont(l){varn=0;this.emit=function(){varu,e=M;for(u=0;arguments.length>u;++u)e=Number(arguments[u]),l[n++]=e;returne}}functionr(l){functionu(l){for(varu=[],e=0,t=l.length;l.length>e;){varr=l.charCodeAt(e);if(n(r,55296,57343))if(n(r,56320,57343))u.push(65533);elseif(e===t-1)u.push(65533);else{varo=l.charCodeAt(e+1);if(n(o,56320,57343)){vari=1023&r,a=1023&o;e+=1,u.push(65536+(i<<10)+a)}elseu.push(65533)}elseu.push(r);e+=1}returnu}vare=0,t=u(l);this.offset=function(l){if(e+=l,0>e)throwError("Seeking past start of the buffer");if(e>t.length)throwError("Seeking past EOF")},this.get=function(){returne>=t.length?P:t[e]}}functiono(){varl="";this.string=function(){returnl},this.emit=function(n){65535>=n?l+=String.fromCharCode(n):(n-=65536,l+=String.fromCharCode(55296+(1023&n>>10)),l+=String.fromCharCode(56320+(1023&n)))}}functioni(l){this.name="EncodingError",this.message=l,this.code=0}functiona(l,n){if(l)thrownewi("Decoder error");returnn||65533}functions(l){thrownewi("The code point "+l+" could not be encoded.")}functionc(l){returnl=(l+"").trim().toLowerCase(),Object.prototype.hasOwnProperty.call(U,l)?U[l]:null}functionf(l,n){return(n||[])[l]||null}functionp(l,n){varu=n.indexOf(l);return-1===u?null:u}functiond(n){if(!("encoding-indexes"inl))throwError("Indexes missing. Did you forget to include encoding-indexes.js?");returnl["encoding-indexes"][n]}functionh(l){if(l>39419&&189e3>l||l>1237575)returnnull;varn,u=0,e=0,t=d("gb18030");for(n=0;t.length>n;++n){varr=t[n];if(!(l>=r[0]))break;u=r[0],e=r[1]}returne+l-u}functiong(l){varn,u=0,e=0,t=d("gb18030");for(n=0;t.length>n;++n){varr=t[n];if(!(l>=r[1]))break;u=r[1],e=r[0]}returne+l-u}functionv(l){varu=l.fatal,e=0,t=0,r=0,o=0;this.decode=function(l){vari=l.get();if(i===M)return0!==t?a(u):P;if(l.offset(1),0===t){if(n(i,0,127))returni;if(n(i,194,223))t=1,o=128,e=i-192;elseif(n(i,224,239))t=2,o=2048,e=i-224;else{if(!n(i,240,244))returna(u);t=3,o=65536,e=i-240}returne*=Math.pow(64,t),null}if(!n(i,128,191))returne=0,t=0,r=0,o=0,l.offset(-1),a(u);if(r+=1,e+=(i-128)*Math.pow(64,t-r),r!==t)returnnull;vars=e,c=o;returne=0,t=0,r=0,o=0,n(s,c,1114111)&&!n(s,55296,57343)?s:a(u)}}functionm(l){l.fatal,this.encode=function(l,e){vart=e.get();if(t===P)returnM;if(e.offset(1),n(t,55296,57343))returns(t);if(n(t,0,127))returnl.emit(t);varr,o;n(t,128,2047)?(r=1,o=192):n(t,2048,65535)?(r=2,o=224):n(t,65536,1114111)&&(r=3,o=240);for(vari=l.emit(u(t,Math.pow(64,r))+o);r>0;){vara=u(t,Math.pow(64,r-1));i=l.emit(128+a%64),r-=1}returni}}functiony(l,u){vare=u.fatal;this.decode=function(u){vart=u.get();if(t===M)returnP;if(u.offset(1),n(t,0,127))returnt;varr=l[t-128];returnnull===r?a(e):r}}functionb(l,u){u.fatal,this.encode=function(u,e){vart=e.get();if(t===P)returnM;if(e.offset(1),n(t,0,127))returnu.emit(t);varr=p(t,l);returnnull===r&&s(t),u.emit(r+128)}}functionw(l,u){vare=u.fatal,t=0,r=0,o=0;this.decode=function(u){vari=u.get();if(i===M&&0===t&&0===r&&0===o)returnP;i!==M||0===t&&0===r&&0===o||(t=0,r=0,o=0,a(e)),u.offset(1);vars;if(0!==o)returns=null,n(i,48,57)&&(s=h(10*(126*(10*(t-129)+(r-48))+(o-129))+i-48)),t=0,r=0,o=0,null===s?(u.offset(-3),a(e)):s;if(0!==r)returnn(i,129,254)?(o=i,null):(u.offset(-2),t=0,r=0,a(e));if(0!==t){if(n(i,48,57)&&l)returnr=i,null;varc=t,p=null;t=0;varg=127>i?64:65;return(n(i,64,126)||n(i,128,254))&&(p=190*(c-129)+(i-g)),s=null===p?null:f(p,d("gbk")),null===p&&u.offset(-1),null===s?a(e):s}returnn(i,0,127)?i:128===i?8364:n(i,129,254)?(t=i,null):a(e)}}function_(l,e){e.fatal,this.encode=function(e,t){varr=t.get();if(r===P)returnM;if(t.offset(1),n(r,0,127))returne.emit(r);varo=p(r,d("gbk"));if(null!==o){vari=u(o,190)+129,
}varr=l.target.result,o=r.transaction([X],G),i=o.objectStore(X),a=newx(i);if(u){varc=i.clear();c.onsuccess=function(){s(a,n)},c.onerror=function(l){n(l)}}elsen()},r.onerror=function(l){this.readyState=ln,t.reject(l)};varo=1,i={};this.readyState=Z,this.db=null,this.nextDescriptor=o,this.openFiles=i,this.name=l}functionj(l){this.transaction=l}functionk(){}varA=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,O=l("lodash"),S=l("when");l("encoding-indexes"),l("encoding");varI=l("src/path").normalize,B=l("src/path").dirname,D=l("src/path").basename,L=l("src/shared").guid,C=l("src/shared").hash;l("src/shared").nop;varR=l("src/error").EExists,F=l("src/error").EIsDirectory,T=l("src/error").ENoEntry,N=l("src/error").EBusy,M=l("src/error").ENotEmpty,P=l("src/error").ENotDirectory,z=l("src/error").EBadFileDescriptor;l("src/error").ENotImplemented,l("src/error").ENotMounted;varH=l("src/error").EInvalid,U=l("src/error").EIO,q=l("src/error").EFileSystemError,$=l("src/constants").FS_FORMAT,K=l("src/constants").MODE_FILE,Y=l("src/constants").MODE_DIRECTORY,W=l("src/constants").ROOT_DIRECTORY_NAME,V=l("src/constants").ROOT_NODE_ID,G=l("src/constants").IDB_RW;l("src/constants").IDB_RO;varX=l("src/constants").FILE_STORE_NAME,J=l("src/constants").METADATA_STORE_NAME,Q=l("src/constants").FS_READY,Z=l("src/constants").FS_PENDING,ln=l("src/constants").FS_ERROR,nn=l("src/constants").O_READ,un=l("src/constants").O_WRITE,en=l("src/constants").O_CREATE,tn=l("src/constants").O_EXCLUSIVE;l("src/constants").O_TRUNCATE;varrn=l("src/constants").O_APPEND,on=l("src/constants").O_FLAGS;return_.prototype._allocate_descriptor=function(l){varn=this.nextDescriptor++;returnthis.openFiles[n]=l,n},_.prototype._release_descriptor=function(l){deletethis.openFiles[l]},_.prototype._open=function(l,n,e,t){functionr(l,n){if(l)i.reject(l);else{vart;t=O(e).contains(rn)?n.size:0;varr=newu(n.id,e,t),a=o._allocate_descriptor(r);i.resolve(a)}}varo=this,i=S.defer();e=w(e),e||i.reject(newH("flags is not valid")),p(o,l,n,e,r),i.promise.then(function(l){t(void0,l)},function(l){t(l)})},_.prototype._close=function(l,n){varu=S.defer();O(this.openFiles).has(l)?(this._release_descriptor(l),u.resolve()):u.reject(newz("invalid file descriptor")),u.promise.then(function(){n()},function(l){n(l)})},_.prototype._mkdir=function(l,n,u){functione(l){l?t.reject(l):t.resolve()}vart=S.defer();c(l,n,e),t.promise.then(function(){u()},function(l){u(l)})},_.prototype._rmdir=function(l,n,u){functione(l){l?t.reject(l):t.resolve()}vart=S.defer();f(l,n,e),t.promise.then(function(){u()},function(l){u(l)})},_.prototype._stat=function(l,n,u){functione(l,n){if(l)o.reject(l);else{varu=newt(n,r.name);o.resolve(u)}}varr=this,o=S.defer();g(l,n,e),o.promise.then(function(l){u(void0,l)},function(l){u(l)})},_.prototype._fstat=function(l,n,u){functione(l,n){if(l)o.reject(l);else{varu=newt(n,r.name);o.resolve(u)}}varr=this,o=S.defer(),i=r.openFiles[n];i?v(l,i,e):o.reject(newz("invalid file descriptor")),o.promise.then(function(l){u(void0,l)},function(l){u(l)})},_.prototype._link=function(l,n,u,e){functiont(l){l?r.reject(l):r.resolve()}varr=S.defer();m(l,n,u,t),r.promise.then(function(){e()},function(l){e(l)})},_.prototype._unlink=function(l,n,u){functione(l){l?t.reject(l):t.resolve()}vart=S.defer();y(l,n,e),t.promise.then(function(){u()},function(l){u(l)})},_.prototype._read=function(l,n,u,e,t,r,o){functioni(l,n){l?s.reject(l):s.resolve(n)}vara=this,s=S.defer();e=void0===e?0:e,t=void0===t?u.length-e:t;varc=a.openFiles[n];c?O(c.flags).contains(nn)?h(l,c,u,e,t,r,i):s.reject(newz("descriptor does not permit reading")):s.reject(newz("invalid file descriptor")),s.promise.then(function(l){o(void0,l)},function(l){o(l)})},_.prototype._readFile=function(l,n,e,r){varo=this,i=S.defer();e?"function"==typeofe?(r=e,e={encoding:null,flag:"r"}):"string"==typeofe&&(e={encoding:e,flag:"r"}):e={encoding:null,flag:"r"};vara=w(e.flag||"r");a||i.reject(newH("flags is not valid")),p(o,l,n,a,function(n,r){if(n)returni.reject(n);vars=newu(r.id,a,