Comparing version 0.4.0 to 0.4.1
@@ -7,2 +7,6 @@ # Changelog | ||
## [0.4.1] - 2018-04-27 | ||
### Added | ||
- Add auto clear keys when the store exceeded quota | ||
## [0.4.0] - 2018-04-26 | ||
@@ -9,0 +13,0 @@ ### Changed |
@@ -5,24 +5,24 @@ "use strict" | ||
function commonjsRequire(){throw Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var utils=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n=Object.prototype.toString | ||
function r(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}function o(e){return!0===r(e)&&"[object Object]"===Object.prototype.toString.call(e)}t.isDate=function(e){return"[object Date]"===n.call(e)},t.isNumber=function(e){return"[object Number]"===n.call(e)},t.isArray=Array.isArray,t.isPlainObject=function(e){if(!1===o(e))return!1 | ||
var r=Object.prototype.toString | ||
function n(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}function o(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}t.isDate=function(e){return"[object Date]"===r.call(e)},t.isNumber=function(e){return"[object Number]"===r.call(e)},t.isArray=Array.isArray,t.isPlainObject=function(e){if(!1===o(e))return!1 | ||
var t=e.constructor | ||
if("function"!=typeof t)return!1 | ||
var n=t.prototype | ||
return!1!==o(n)&&!1!==n.hasOwnProperty("isPrototypeOf")},t.extend=function(e,t){if(null===t||"object"!=typeof t)return e | ||
for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]] | ||
return e},t.omit=function(e,t){if(!r(e))return{} | ||
var r=t.prototype | ||
return!1!==o(r)&&!1!==r.hasOwnProperty("isPrototypeOf")},t.extend=function(e,t){if(null===t||"object"!=typeof t)return e | ||
for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]] | ||
return e},t.omit=function(e,t){if(!n(e))return{} | ||
"string"==typeof t&&(t=[t]) | ||
for(var n={},o=0,i=Object.keys(e);o<i.length;o++){var a=i[o] | ||
t&&-1!==t.indexOf(a)||(n[a]=e[a])}return n},t.utf16ByteLength=function(e){for(var t=0,n=0;n<e.length;n++)t+=e.charCodeAt(n)<=65535?2:4 | ||
for(var r={},o=0,i=Object.keys(e);o<i.length;o++){var a=i[o] | ||
t&&-1!==t.indexOf(a)||(r[a]=e[a])}return r},t.utf16ByteLength=function(e){for(var t=0,r=0;r<e.length;r++)t+=e.charCodeAt(r)<=65535?2:4 | ||
return t}}) | ||
unwrapExports(utils) | ||
var utils_1=utils.isDate,utils_2=utils.isNumber,utils_3=utils.isArray,utils_4=utils.isPlainObject,utils_5=utils.extend,utils_6=utils.omit,utils_7=utils.utf16ByteLength,MemCache_1=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var utils_1=utils.isDate,utils_2=utils.isNumber,utils_3=utils.isArray,utils_4=utils.isPlainObject,utils_5=utils.extend,utils_6=utils.omit,utils_7=utils.utf16ByteLength,MemCache_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},n=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o | ||
switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o | ||
switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
case 5:a.label++,n=i[1],i=[0] | ||
continue | ||
@@ -36,32 +36,32 @@ case 7:i=a.ops.pop(),a.trys.pop() | ||
break}o[2]&&a.ops.pop(),a.trys.pop() | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var o=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(e,{name:"memcache"}),this.cacheInstance={}}return e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,n,o,i,a | ||
return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=r.sent(),n=0,o=t,r.label=2 | ||
case 2:return n<o.length?[4,this.isExpired(i=o[n])]:[3,5] | ||
case 3:r.sent()&&e.push(i),r.label=4 | ||
case 4:return n++,[3,2] | ||
var o=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(e,{name:"memcache"}),this.cacheInstance={}}return e.prototype.getExpiredKeys=function(){return r(this,void 0,void 0,function(){var e,t,r,o,i,a | ||
return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=n.sent(),r=0,o=t,n.label=2 | ||
case 2:return r<o.length?[4,this.isExpired(i=o[r])]:[3,5] | ||
case 3:n.sent()&&e.push(i),n.label=4 | ||
case 4:return r++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return a=r.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.isExpired=function(e){return n(this,void 0,void 0,function(){var t,n,o | ||
return r(this,function(r){return t=this.getKey(e),n=this.cacheInstance[t],o=(new Date).getTime(),n&&n.expire&&n.expire>0&&n.expire<o?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)]})})},e.prototype.get=function(e){return n(this,void 0,void 0,function(){var t,n,o | ||
return r(this,function(r){switch(r.label){case 0:return t=this.getKey(e),n=this.cacheInstance[t],[4,this.isExpired(e)] | ||
case 1:return o=r.sent(),n&&n.value?o?(this.remove(t),[2,Promise.resolve(null)]):n.value?[2,Promise.resolve(n.value)]:[2]:[2,Promise.resolve(null)]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,n,o,i,a | ||
return r(this,function(r){switch(r.label){case 0:t=[],n=0,o=e,r.label=1 | ||
case 1:return n<o.length?(a=(i=t).push,[4,this.get(o[n])]):[3,4] | ||
case 2:a.call(i,r.sent()),r.label=3 | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(t)]}})})},e.prototype.set=function(e,t,n){void 0===n&&(n=-1) | ||
var r=this.getKey(e) | ||
return utils.isDate(n)?n=n.getTime():utils.isNumber(n)&&n>0&&(n=(new Date).getTime()+1e3*n),this.cacheInstance[r]={value:t,expire:n},Promise.resolve(t)},e.prototype.append=function(e,t,n){void 0===n&&(n=-1) | ||
var r=this.cacheInstance[this.getKey(e)] | ||
return r?(utils.isArray(t)&&utils.isArray(r.value)?t=r.value.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(r.value)&&(t=utils.extend(r.value,t)),this.set(e,t,n=n||r.expire)):this.set(e,t,n)},e.prototype.has=function(e){return this.get(e)?Promise.resolve(!0):Promise.resolve(!1)},e.prototype.remove=function(e){var t=this.getKey(e) | ||
return this.cacheInstance[t]&&(this.cacheInstance[t]=null,this.cacheInstance=utils.omit(this.cacheInstance,t)),Promise.resolve()},e.prototype.keys=function(){for(var e=[],t=0,n=Object.keys(this.cacheInstance);t<n.length;t++){e.push(n[t].replace(this.cacheConfig.name+"/",""))}return Promise.resolve(e)},e.prototype.clear=function(){return this.cacheInstance={},Promise.resolve()},e.prototype.length=function(){var e=Object.keys(this.cacheInstance) | ||
return e.length?Promise.resolve(e.length):Promise.resolve(0)},e.prototype.each=function(e){return n(this,void 0,void 0,function(){var t,n,o,i | ||
return r(this,function(r){switch(r.label){case 0:t=Object.keys(this.cacheInstance),n=0,r.label=1 | ||
case 1:return n<t.length?(o=t[n].replace(this.cacheConfig.name+"/",""),[4,this.get(o)]):[3,4] | ||
case 2:i=r.sent(),e&&e(i,o,n),r.label=3 | ||
case 3:return n++,[3,1] | ||
case 6:return a=n.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.isExpired=function(e){return r(this,void 0,void 0,function(){var t,r,o | ||
return n(this,function(n){return t=this.getKey(e),r=this.cacheInstance[t],o=(new Date).getTime(),r&&r.expire&&r.expire>0&&r.expire<o?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)]})})},e.prototype.get=function(e){return r(this,void 0,void 0,function(){var t,r,o | ||
return n(this,function(n){switch(n.label){case 0:return t=this.getKey(e),r=this.cacheInstance[t],[4,this.isExpired(e)] | ||
case 1:return o=n.sent(),r&&r.value?o?(this.remove(t),[2,Promise.resolve(null)]):r.value?[2,Promise.resolve(r.value)]:[2]:[2,Promise.resolve(null)]}})})},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,r,o,i,a | ||
return n(this,function(n){switch(n.label){case 0:t=[],r=0,o=e,n.label=1 | ||
case 1:return r<o.length?(a=(i=t).push,[4,this.get(o[r])]):[3,4] | ||
case 2:a.call(i,n.sent()),n.label=3 | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(t)]}})})},e.prototype.set=function(e,t,r){void 0===r&&(r=-1) | ||
var n=this.getKey(e) | ||
return utils.isDate(r)?r=r.getTime():utils.isNumber(r)&&r>0&&(r=(new Date).getTime()+1e3*r),this.cacheInstance[n]={value:t,expire:r},Promise.resolve(t)},e.prototype.append=function(e,t,r){void 0===r&&(r=-1) | ||
var n=this.cacheInstance[this.getKey(e)] | ||
return n?(utils.isArray(t)&&utils.isArray(n.value)?t=n.value.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(n.value)&&(t=utils.extend(n.value,t)),this.set(e,t,r=r||n.expire)):this.set(e,t,r)},e.prototype.has=function(e){return this.get(e)?Promise.resolve(!0):Promise.resolve(!1)},e.prototype.remove=function(e){var t=this.getKey(e) | ||
return this.cacheInstance[t]&&(this.cacheInstance[t]=null,this.cacheInstance=utils.omit(this.cacheInstance,t)),Promise.resolve()},e.prototype.keys=function(){for(var e=[],t=0,r=Object.keys(this.cacheInstance);t<r.length;t++){e.push(r[t].replace(this.cacheConfig.name+"/",""))}return Promise.resolve(e)},e.prototype.clear=function(){return this.cacheInstance={},Promise.resolve()},e.prototype.length=function(){var e=Object.keys(this.cacheInstance) | ||
return e.length?Promise.resolve(e.length):Promise.resolve(0)},e.prototype.each=function(e){return r(this,void 0,void 0,function(){var t,r,o,i | ||
return n(this,function(n){switch(n.label){case 0:t=Object.keys(this.cacheInstance),r=0,n.label=1 | ||
case 1:return r<t.length?(o=t[r].replace(this.cacheConfig.name+"/",""),[4,this.get(o)]):[3,4] | ||
case 2:i=n.sent(),e&&e(i,o,r),n.label=3 | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(!0)]}})})},e.prototype.getKey=function(e){return this.cacheConfig.name+"/"+e},e}() | ||
@@ -71,23 +71,23 @@ t.default=o}) | ||
var LZString_1=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n=String.fromCharCode,r=function(e){return{v:e,d:{}}},o=function(e){return n(e+32)},i=function(e,t,n){if(null==e)return[] | ||
var o,i=0,a=0,s=0,u={},c=!0,f=0,l=r(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(s=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
var r=String.fromCharCode,n=function(e){return{v:e,d:{}}},o=function(e){return r(e+32)},i=function(e,t,r){if(null==e)return[] | ||
var o,i=0,a=0,s=0,u={},c=!0,f=0,l=n(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(s=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u[f]=l,a=1;a<e.length;a++)if(f=e.charCodeAt(a),o=l.d[f])l=o | ||
else{if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
u[f]=r(d++),c=!0}l.d[f]=r(d++),0==--h&&(h=1<<v++),l=u[f]}if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
return p.push(n(y<<=t-m)),p},a=function(e,t,r){for(var o=["","",""],i=4,a=4,s=3,u="",c=[],f=0,l=2,h=0,d="",v=r(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
u[f]=n(d++),c=!0}l.d[f]=n(d++),0==--h&&(h=1<<v++),l=u[f]}if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
return p.push(r(y<<=t-m)),p},a=function(e,t,n){for(var o=["","",""],i=4,a=4,s=3,u="",c=[],f=0,l=2,h=0,d="",v=n(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
if(2===f)return"" | ||
for(l=8*f+8,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
for(d=n(f),o[3]=d,c.push(d);y<=e;){for(l=s,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
if(f<2){for(l=8+8*f,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
o[a]=n(f),f=a++,0==--i&&(i=1<<s++)}else if(2===f)return c.join("") | ||
for(l=8*f+8,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
for(d=r(f),o[3]=d,c.push(d);y<=e;){for(l=s,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
if(f<2){for(l=8+8*f,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
o[a]=r(f),f=a++,0==--i&&(i=1<<s++)}else if(2===f)return c.join("") | ||
if(f>o.length)return null | ||
u=f<o.length?o[f]:d+d.charAt(0),c.push(u),o[a++]=d+u.charAt(0),d=u,0==--i&&(i=1<<s++)}return""},s=function(e){return i(e,16,function(e){return n(e)})} | ||
u=f<o.length?o[f]:d+d.charAt(0),c.push(u),o[a++]=d+u.charAt(0),d=u,0==--i&&(i=1<<s++)}return""},s=function(e){return i(e,16,function(e){return r(e)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
@@ -97,51 +97,51 @@ var t=i(e,15,o) | ||
unwrapExports(LZString_1) | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof commonjsRequire&&commonjsRequire | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof commonjsRequire&&commonjsRequire | ||
if(!s&&u)return u(a,!0) | ||
if(i)return i(a,!0) | ||
var c=Error("Cannot find module '"+a+"'") | ||
throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}} | ||
t[a][0].call(f.exports,function(e){var n=t[a][1][e] | ||
return o(n||e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof commonjsRequire&&commonjsRequire,a=0;a<r.length;a++)o(r[a]) | ||
return o}({1:[function(e,t,n){!function(e){var n,r,o=e.MutationObserver||e.WebKitMutationObserver | ||
throw c.code="MODULE_NOT_FOUND",c}var f=r[a]={exports:{}} | ||
t[a][0].call(f.exports,function(e){var r=t[a][1][e] | ||
return o(r||e)},f,f.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof commonjsRequire&&commonjsRequire,a=0;a<n.length;a++)o(n[a]) | ||
return o}({1:[function(e,t,r){!function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver | ||
if(o){var i=0,a=new o(f),s=e.document.createTextNode("") | ||
a.observe(s,{characterData:!0}),n=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script") | ||
a.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script") | ||
t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)} | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,n=function(){u.port2.postMessage(0)}}var c=[] | ||
u.port1.onmessage=f,r=function(){u.port2.postMessage(0)}}var c=[] | ||
function f(){var e,t | ||
r=!0 | ||
for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]() | ||
n=c.length}r=!1}t.exports=function(e){1!==c.push(e)||r||n()}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1) | ||
n=!0 | ||
for(var r=c.length;r;){for(t=c,c=[],e=-1;++e<r;)t[e]() | ||
r=c.length}n=!1}t.exports=function(e){1!==c.push(e)||n||r()}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1) | ||
function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],u=["PENDING"] | ||
function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function") | ||
this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r(function(){var r | ||
try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)})}function h(e){var t=e&&e.then | ||
if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var n=!1 | ||
function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=v(function(){t(o,r)}) | ||
"error"===a.status&&r(a.value)}function v(e,t){var n={} | ||
try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this | ||
var n=new this.constructor(o) | ||
if(this.state!==u){var r=this.state===s?e:t | ||
l(n,r,this.outcome)}else this.queue.push(new f(n,e,t)) | ||
return n},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=v(h,t) | ||
if("error"===n.status)return i.reject(e,n.value) | ||
var r=n.value | ||
if(r)d(e,r) | ||
this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n | ||
try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function h(e){var t=e&&e.then | ||
if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1 | ||
function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)}) | ||
"error"===a.status&&n(a.value)}function v(e,t){var r={} | ||
try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this | ||
var r=new this.constructor(o) | ||
if(this.state!==u){var n=this.state===s?e:t | ||
l(r,n,this.outcome)}else this.queue.push(new f(r,e,t)) | ||
return r},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(h,t) | ||
if("error"===r.status)return i.reject(e,r.value) | ||
var n=r.value | ||
if(n)d(e,n) | ||
else{e.state=s,e.outcome=t | ||
for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t | ||
for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t) | ||
for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t) | ||
return e},c.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},c.reject=function(e){var t=new this(o) | ||
return i.reject(t,e)},c.all=function(e){var t=this | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var n=e.length,r=!1 | ||
if(!n)return this.resolve([]) | ||
for(var a=Array(n),s=0,u=-1,c=new this(o);++u<n;)f(e[u],u) | ||
var r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=Array(r),s=0,u=-1,c=new this(o);++u<r;)f(e[u],u) | ||
return c | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==n||r||(r=!0,i.resolve(c,a))},function(e){r||(r=!0,i.reject(c,e))})}},c.race=function(e){var t=this | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!0,i.reject(c,e))})}},c.race=function(e){var t=this | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var n=e.length,r=!1 | ||
if(!n)return this.resolve([]) | ||
for(var a=-1,s=new this(o);++a<n;)t.resolve(e[a]).then(function(e){r||(r=!0,i.resolve(s,e))},function(e){r||(r=!0,i.reject(s,e))}) | ||
return s}},{1:1}],3:[function(e,t,n){var r | ||
"function"!=typeof(r=void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).Promise&&(r.Promise=e(2))},{2:2}],4:[function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB | ||
var r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=-1,s=new this(o);++a<r;)t.resolve(e[a]).then(function(e){n||(n=!0,i.resolve(s,e))},function(e){n||(n=!0,i.reject(s,e))}) | ||
return s}},{1:1}],3:[function(e,t,r){var n | ||
"function"!=typeof(n=void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).Promise&&(n.Promise=e(2))},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB | ||
if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB | ||
@@ -153,131 +153,131 @@ if("undefined"!=typeof mozIndexedDB)return mozIndexedDB | ||
try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i | ||
for(var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,r=new n,o=0;o<e.length;o+=1)r.append(e[o]) | ||
return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3) | ||
for(var r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,n=new r,o=0;o<e.length;o+=1)n.append(e[o]) | ||
return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3) | ||
var a=Promise | ||
function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function m(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var n=e.transaction(l,y),r=i([""]) | ||
n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//) | ||
t(n||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}function b(e){var t=d[e.name],n={} | ||
n.promise=new a(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady=t.dbReady?t.dbReady.then(function(){return n.promise}):n.promise}function g(e){var t=d[e.name],n=t.deferredOperations.pop() | ||
if(n)return n.resolve(),n.promise}function _(e,t){var n=d[e.name],r=n.deferredOperations.pop() | ||
if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(n,r){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db) | ||
function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function m(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var r=e.transaction(l,y),n=i([""]) | ||
r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//) | ||
t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}function b(e){var t=d[e.name],r={} | ||
r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=d[e.name],r=t.deferredOperations.pop() | ||
if(r)return r.resolve(),r.promise}function _(e,t){var r=d[e.name],n=r.deferredOperations.pop() | ||
if(n)return n.reject(t),n.promise}function w(e,t){return new a(function(r,n){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db) | ||
b(e),e.db.close()}var i=[e.name] | ||
t&&i.push(e.version) | ||
var a=o.open.apply(o,i) | ||
t&&(a.onupgradeneeded=function(t){var n=a.result | ||
try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n | ||
console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){n(a.result),g(e)}})}function I(e){return w(e,!1)}function j(e){return w(e,!0)}function S(e,t){if(!e.db)return!0 | ||
var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version | ||
if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var i=e.db.version+1 | ||
i>e.version&&(e.version=i)}return!0}return!1}function x(e){var t=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o) | ||
return n}(atob(e.data)) | ||
return i([t],{type:e.type})}function P(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
t&&(a.onupgradeneeded=function(t){var r=a.result | ||
try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r | ||
console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function j(e){return w(e,!0)}function S(e,t){if(!e.db)return!0 | ||
var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,o=e.version>e.db.version | ||
if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||r){if(r){var i=e.db.version+1 | ||
i>e.version&&(e.version=i)}return!0}return!1}function x(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o) | ||
return r}(atob(e.data)) | ||
return i([t],{type:e.type})}function P(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return u(n,e,e),n}function C(e,t,n,r){void 0===r&&(r=1) | ||
return u(r,e,e),r}function C(e,t,r,n){void 0===n&&(n=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),j(e)}).then(function(){return function(e){b(e) | ||
for(var t=d[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r] | ||
o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,S(e)?j(e):t}).then(function(r){e.db=t.db=r | ||
for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r}).catch(function(t){throw _(e,t),t})}(e).then(function(){C(e,t,n,r-1)})}).catch(n) | ||
n(o)}}var O={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null} | ||
if(e)for(var r in e)n[r]=e[r] | ||
var o=d[n.name] | ||
o||(d[n.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E) | ||
r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),j(e)}).then(function(){return function(e){b(e) | ||
for(var t=d[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n] | ||
o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,S(e)?j(e):t}).then(function(n){e.db=t.db=n | ||
for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){C(e,t,r,n-1)})}).catch(r) | ||
r(o)}}var O={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null} | ||
if(e)for(var n in e)r[n]=e[n] | ||
var o=d[r.name] | ||
o||(d[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E) | ||
var i=[] | ||
function s(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var c=o.forages[u] | ||
c!==t&&i.push(c._initReady().catch(s))}var f=o.forages.slice(0) | ||
return a.all(i).then(function(){return n.db=o.db,I(n)}).then(function(e){return n.db=e,S(n,t._defaultConfig.version)?j(n):e}).then(function(e){n.db=o.db=e,t._dbInfo=n | ||
for(var r=0;r<f.length;r++){var i=f[r] | ||
i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}})},_support:function(){try{if(!o)return!1 | ||
return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,S(r,t._defaultConfig.version)?j(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r | ||
for(var n=0;n<f.length;n++){var i=f[n] | ||
i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o)return!1 | ||
var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==(""+fetch).indexOf("[native code") | ||
return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){C(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=a.openCursor(),u=1 | ||
s.onsuccess=function(){var n=s.result | ||
if(n){var r=n.value | ||
P(r)&&(r=x(r)) | ||
var o=e(r,n.key,u++) | ||
void 0!==o?t(o):n.continue()}else t()},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},getItem:function(e,t){var n=this | ||
return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){C(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=a.openCursor(),u=1 | ||
s.onsuccess=function(){var r=s.result | ||
if(r){var n=r.value | ||
P(n)&&(n=x(n)) | ||
var o=e(n,r.key,u++) | ||
void 0!==o?t(o):r.continue()}else t()},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){C(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=a.get(e) | ||
var n=new a(function(t,n){r.ready().then(function(){C(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=a.get(e) | ||
s.onsuccess=function(){var e=s.result | ||
void 0===e&&(e=null),P(e)&&(e=x(e)),t(e)},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},setItem:function(e,t,n){var r=this | ||
void 0===e&&(e=null),P(e)&&(e=x(e)),t(e)},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},setItem:function(e,t,r){var n=this | ||
e=c(e) | ||
var o=new a(function(n,o){var i | ||
r.ready().then(function(){return i=r._dbInfo,"[object Blob]"===v.call(t)?m(i.db).then(function(e){return e?t:(n=t,new a(function(e,t){var r=new FileReader | ||
r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"") | ||
e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})) | ||
var n}):t}).then(function(t){C(r._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var s=a.objectStore(r._dbInfo.storeName) | ||
var o=new a(function(r,o){var i | ||
n.ready().then(function(){return i=n._dbInfo,"[object Blob]"===v.call(t)?m(i.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader | ||
n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"") | ||
e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)})) | ||
var r}):t}).then(function(t){C(n._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var s=a.objectStore(n._dbInfo.storeName) | ||
null===t&&(t=void 0) | ||
var u=s.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error | ||
a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return s(o,n),o},removeItem:function(e,t){var n=this | ||
return s(o,r),o},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){C(n._dbInfo,y,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){r(s.error)},i.onabort=function(){var e=s.error?s.error:s.transaction.error | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){C(t._dbInfo,y,function(r,o){if(r)return n(r) | ||
var n=new a(function(t,n){r.ready().then(function(){C(r._dbInfo,y,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){n(s.error)},i.onabort=function(){var e=s.error?s.error:s.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){C(t._dbInfo,y,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.clear() | ||
o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=a.error?a.error:a.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){C(t._dbInfo,p,function(r,o){if(r)return n(r) | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){C(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.count() | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){e<0?t(null):n.ready().then(function(){C(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=!1,u=a.openCursor() | ||
u.onsuccess=function(){var n=u.result | ||
n?0===e?t(n.key):s?t(n.key):(s=!0,n.advance(e)):t(null)},u.onerror=function(){r(u.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){C(t._dbInfo,p,function(r,o){if(r)return n(r) | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){C(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=!1,u=a.openCursor() | ||
u.onsuccess=function(){var r=u.result | ||
r?0===e?t(r.key):s?t(r.key):(s=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){C(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),s=[] | ||
a.onsuccess=function(){var t=a.result | ||
t?(s.push(t.key),t.continue()):e(s)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var n,r=this.config() | ||
if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var i=e.name===r.name&&this._dbInfo.db,u=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var n=d[e.name],r=n.forages | ||
n.db=t | ||
for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t | ||
t?(s.push(t.key),t.continue()):e(s)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var r,n=this.config() | ||
if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var i=e.name===n.name&&this._dbInfo.db,u=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var r=d[e.name],n=r.forages | ||
r.db=t | ||
for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t | ||
return t}) | ||
n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
r=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
b(e) | ||
var r=d[e.name],i=r.forages | ||
var n=d[e.name],i=n.forages | ||
t.close() | ||
for(var s=0;s<i.length;s++){var u=i[s] | ||
u._dbInfo.db=null,u._dbInfo.version=n}var c=new a(function(t,r){var i=o.open(e.name,n) | ||
u._dbInfo.db=null,u._dbInfo.version=r}var c=new a(function(t,n){var i=o.open(e.name,r) | ||
i.onerror=function(e){var t=i.result | ||
t.close(),r(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.close(),n(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result | ||
e.close(),t(e)}}) | ||
return c.then(function(e){r.db=e | ||
for(var t=0;t<i.length;t++){var n=i[t] | ||
n._dbInfo.db=e,g(n._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e) | ||
var n=d[e.name],r=n.forages | ||
return c.then(function(e){n.db=e | ||
for(var t=0;t<i.length;t++){var r=i[t] | ||
r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e) | ||
var r=d[e.name],n=r.forages | ||
t.close() | ||
for(var i=0;i<r.length;i++){var s=r[i] | ||
s._dbInfo.db=null}var u=new a(function(t,n){var r=o.deleteDatabase(e.name) | ||
r.onerror=r.onblocked=function(e){var t=r.result | ||
t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result | ||
for(var i=0;i<n.length;i++){var s=n[i] | ||
s._dbInfo.db=null}var u=new a(function(t,r){var n=o.deleteDatabase(e.name) | ||
n.onerror=n.onblocked=function(e){var t=n.result | ||
t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result | ||
e&&e.close(),t(e)}}) | ||
return u.then(function(e){n.db=e | ||
for(var t=0;t<r.length;t++){var o=r[t] | ||
g(o._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments") | ||
return s(n,t),n}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",M=/^~~local_forage_type~([^~]+)~/,k="__lfsc__:",D=k.length,R="arbf",T="blob",B="si08",L="ui08",F="uic8",G="si16",z="si32",U="ur16",q="ui32",K="fl32",W="fl64",V=D+R.length,J=Object.prototype.toString | ||
function H(e){var t,n,r,o,i,a=.75*e.length,s=e.length,u=0 | ||
return u.then(function(e){r.db=e | ||
for(var t=0;t<n.length;t++){var o=n[t] | ||
g(o._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else r=a.reject("Invalid arguments") | ||
return s(r,t),r}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",D=M.length,R="arbf",T="blob",B="si08",L="ui08",F="uic8",G="si16",U="si32",z="ur16",q="ui32",K="fl32",W="fl64",V=D+R.length,J=Object.prototype.toString | ||
function Q(e){var t,r,n,o,i,a=.75*e.length,s=e.length,u=0 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var c=new ArrayBuffer(a),f=new Uint8Array(c) | ||
for(t=0;t<s;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|o>>2,f[u++]=(3&o)<<6|63&i | ||
return c}function Q(e){var t,n=new Uint8Array(e),r="" | ||
for(t=0;t<n.length;t+=3)r+=N[n[t]>>2],r+=N[(3&n[t])<<4|n[t+1]>>4],r+=N[(15&n[t+1])<<2|n[t+2]>>6],r+=N[63&n[t+2]] | ||
return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var X={serialize:function(e,t){var n="" | ||
if(e&&(n=J.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var r,o=k | ||
e instanceof ArrayBuffer?(r=e,o+=R):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=L:"[object Uint8ClampedArray]"===n?o+=F:"[object Int16Array]"===n?o+=G:"[object Uint16Array]"===n?o+=U:"[object Int32Array]"===n?o+=z:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=K:"[object Float64Array]"===n?o+=W:t(Error("Failed to get type for BinaryArray"))),t(o+Q(r))}else if("[object Blob]"===n){var i=new FileReader | ||
i.onload=function(){var n=A+e.type+"~"+Q(this.result) | ||
t(k+T+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,D)!==k)return JSON.parse(e) | ||
var t,n=e.substring(V),type=e.substring(D,V) | ||
if(type===T&&M.test(n)){var r=n.match(M) | ||
t=r[1],n=n.substring(r[0].length)}var o=H(n) | ||
for(t=0;t<s;t+=4)r=N.indexOf(e[t]),n=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|o>>2,f[u++]=(3&o)<<6|63&i | ||
return c}function H(e){var t,r=new Uint8Array(e),n="" | ||
for(t=0;t<r.length;t+=3)n+=N[r[t]>>2],n+=N[(3&r[t])<<4|r[t+1]>>4],n+=N[(15&r[t+1])<<2|r[t+2]>>6],n+=N[63&r[t+2]] | ||
return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var X={serialize:function(e,t){var r="" | ||
if(e&&(r=J.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var n,o=M | ||
e instanceof ArrayBuffer?(n=e,o+=R):(n=e.buffer,"[object Int8Array]"===r?o+=B:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=G:"[object Uint16Array]"===r?o+=z:"[object Int32Array]"===r?o+=U:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=K:"[object Float64Array]"===r?o+=W:t(Error("Failed to get type for BinaryArray"))),t(o+H(n))}else if("[object Blob]"===r){var i=new FileReader | ||
i.onload=function(){var r=A+e.type+"~"+H(this.result) | ||
t(M+T+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,D)!==M)return JSON.parse(e) | ||
var t,r=e.substring(V),type=e.substring(D,V) | ||
if(type===T&&k.test(r)){var n=r.match(k) | ||
t=n[1],r=r.substring(n[0].length)}var o=Q(r) | ||
switch(type){case R:return o | ||
@@ -289,123 +289,123 @@ case T:return i([o],{type:t}) | ||
case G:return new Int16Array(o) | ||
case U:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
case z:return new Uint16Array(o) | ||
case U:return new Int32Array(o) | ||
case q:return new Uint32Array(o) | ||
case K:return new Float32Array(o) | ||
case W:return new Float64Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
function Z(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Y(e,t,n,r,o,i){e.executeSql(n,r,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[name],function(e,s){s.rows.length?i(e,a):Z(e,t,function(){e.executeSql(n,r,o,i)},i)},i):i(e,a)},i)}var $={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null} | ||
if(e)for(var r in e)n[r]="string"!=typeof e[r]?""+e[r]:e[r] | ||
var o=new a(function(e,r){try{n.db=openDatabase(n.name,n.version+"",n.description,n.size)}catch(e){return r(e)}n.db.transaction(function(o){Z(o,n,function(){t._dbInfo=n,e()},function(e,t){r(t)})},r)}) | ||
return n.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName,[],function(n,r){for(var i=r.rows,a=i.length,s=0;s<a;s++){var u=i.item(s),c=u.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},getItem:function(e,t){var n=this | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:Q,bufferToString:H} | ||
function Z(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[name],function(e,s){s.rows.length?i(e,a):Z(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}var $={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null} | ||
if(e)for(var n in e)r[n]="string"!=typeof e[n]?""+e[n]:e[n] | ||
var o=new a(function(e,n){try{r.db=openDatabase(r.name,r.version+"",r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){Z(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)}) | ||
return r.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,s=0;s<a;s++){var u=i.item(s),c=u.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var r=n.rows.length?n.rows.item(0).value:null | ||
r&&(r=o.serializer.deserialize(r)),t(r)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},setItem:function(e,t,n){return function e(t,n,r,o){var i=this | ||
var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null | ||
n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
t=c(t) | ||
var u=new a(function(a,s){i.ready().then(function(){void 0===n&&(n=null) | ||
var u=n,c=i._dbInfo | ||
c.serializer.serialize(n,function(n,f){f?s(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,n],function(){a(u)},function(e,t){s(t)})},function(n){if(n.code===n.QUOTA_ERR){if(o>0)return void a(e.call(i,t,u,r,o-1)) | ||
s(n)}})})}).catch(s)}) | ||
return s(u,r),u}.call(this,e,t,n,1)},removeItem:function(e,t){var n=this | ||
var u=new a(function(a,s){i.ready().then(function(){void 0===r&&(r=null) | ||
var u=r,c=i._dbInfo | ||
c.serializer.serialize(r,function(r,f){f?s(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,r],function(){a(u)},function(e,t){s(t)})},function(r){if(r.code===r.QUOTA_ERR){if(o>0)return void a(e.call(i,t,u,n,o-1)) | ||
s(r)}})})}).catch(s)}) | ||
return s(u,n),u}.call(this,e,t,r,1)},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo | ||
r.db.transaction(function(t){Y(t,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo | ||
r.db.transaction(function(t){Y(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(t,n){var r=n.rows.item(0).c | ||
e(r)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){var r=n.rows.length?n.rows.item(0).key:null | ||
t(r)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo | ||
r.db.transaction(function(t){Y(t,r,"SELECT key FROM "+r.storeName,[],function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key) | ||
e(r)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName) | ||
var r,o=this | ||
return s(r=e.name?new a(function(t){var r | ||
r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:r,storeNames:[e.storeName]}:function(e){return new a(function(t,n){e.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name) | ||
t({db:e,storeNames:o})},function(e,t){n(t)})},function(e){n(e)})})}(r))}).then(function(e){return new a(function(t,n){e.db.transaction(function(r){function o(e){return new a(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var i=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s])) | ||
a.all(i).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):a.reject("Invalid arguments"),t),r}} | ||
function ee(e,t){var n=e.name+"/" | ||
return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function te(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var ne={_driver:"localStorageWrapper",_initStorage:function(e){var t={} | ||
if(e)for(var n in e)t[n]=e[n] | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s) | ||
if(0===u.indexOf(r)){var c=localStorage.getItem(u) | ||
var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c | ||
e(n)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null | ||
t(n)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key) | ||
e(n)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName) | ||
var n,o=this | ||
return s(n=e.name?new a(function(t){var n | ||
n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:function(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name) | ||
t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s])) | ||
a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}} | ||
function ee(e,t){var r=e.name+"/" | ||
return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function te(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={} | ||
if(e)for(var r in e)t[r]=e[r] | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s) | ||
if(0===u.indexOf(n)){var c=localStorage.getItem(u) | ||
if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(o),a++)))return c}}}) | ||
return s(r,t),r},getItem:function(e,t){var n=this | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=n.ready().then(function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e) | ||
return r&&(r=t.serializer.deserialize(r)),r}) | ||
return s(r,t),r},setItem:function(e,t,n){var r=this | ||
var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e) | ||
return n&&(n=t.serializer.deserialize(n)),n}) | ||
return s(n,t),n},setItem:function(e,t,r){var n=this | ||
e=c(e) | ||
var o=r.ready().then(function(){void 0===t&&(t=null) | ||
var n=t | ||
return new a(function(o,i){var a=r._dbInfo | ||
a.serializer.serialize(t,function(t,r){if(r)i(r) | ||
else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})}) | ||
return s(o,n),o},removeItem:function(e,t){var n=this | ||
var o=n.ready().then(function(){void 0===t&&(t=null) | ||
var r=t | ||
return new a(function(o,i){var a=n._dbInfo | ||
a.serializer.serialize(t,function(t,n){if(n)i(n) | ||
else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})}) | ||
return s(o,r),o},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=n.ready().then(function(){var t=n._dbInfo | ||
var n=r.ready().then(function(){var t=r._dbInfo | ||
localStorage.removeItem(t.keyPrefix+e)}) | ||
return s(r,t),r},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n) | ||
0===r.indexOf(e)&&localStorage.removeItem(r)}}) | ||
return s(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return s(t,e),t},key:function(e,t){var n=this,r=n.ready().then(function(){var t,r=n._dbInfo | ||
try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}) | ||
return s(r,t),r},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o) | ||
0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r}) | ||
return s(n,e),n},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config() | ||
e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this | ||
return s(r=e.name?new a(function(t){t(e.storeName?ee(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t) | ||
0===n.indexOf(e)&&localStorage.removeItem(n)}}):a.reject("Invalid arguments"),t),r}},re=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0 | ||
r++}var o,i | ||
return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},se={INDEXEDDB:O,WEBSQL:$,LOCALSTORAGE:ne},ue=[se.INDEXEDDB._driver,se.WEBSQL._driver,se.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:ue.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
function he(e,t){e[t]=function(){var n=arguments | ||
return e.ready().then(function(){return e[t].apply(e,n)})}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e] | ||
if(t)for(var n in t)t.hasOwnProperty(n)&&(arguments[0][n]=oe(t[n])?t[n].slice():t[n])}return arguments[0]}var ve=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),se)if(se.hasOwnProperty(n)){var r=se[n],o=r._driver | ||
this[n]=o,ie[o]||this.defineDriver(r)}this._defaultConfig=de({},le),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return Error("Can't call config() after localforage has been used.") | ||
return s(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r) | ||
0===n.indexOf(e)&&localStorage.removeItem(n)}}) | ||
return s(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo | ||
try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}) | ||
return s(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o) | ||
0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n}) | ||
return s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config() | ||
e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this | ||
return s(n=e.name?new a(function(t){t(e.storeName?ee(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t) | ||
0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0 | ||
n++}var o,i | ||
return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},se={INDEXEDDB:O,WEBSQL:$,LOCALSTORAGE:re},ue=[se.INDEXEDDB._driver,se.WEBSQL._driver,se.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:ue.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
function he(e,t){e[t]=function(){var r=arguments | ||
return e.ready().then(function(){return e[t].apply(e,r)})}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e] | ||
if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),se)if(se.hasOwnProperty(r)){var n=se[r],o=n._driver | ||
this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=de({},le),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return Error("Can't call config() after localforage has been used.") | ||
for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return Error("Database version must be a number.") | ||
this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a(function(t,n){try{var r=e._driver,o=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver") | ||
if(!e._driver)return void n(o) | ||
for(var i=fe.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u],l=!re(ce,f) | ||
if((l||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t) | ||
return s(n,arguments[arguments.length-1]),n}},n=0,r=ce.length;n<r;n++){var o=ce[n] | ||
this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver") | ||
if(!e._driver)return void r(o) | ||
for(var i=fe.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u],l=!ne(ce,f) | ||
if((l||e[f])&&"function"!=typeof e[f])return void r(o)}!function(){for(var t=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t) | ||
return s(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var o=ce[r] | ||
e[o]||(e[o]=t(o))}}() | ||
var h=function(n){ie[r]&&console.info("Redefining LocalForage driver: "+r),ie[r]=e,ae[r]=n,t()} | ||
"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,n):h(!!e._support):h(!0)}catch(e){n(e)}}) | ||
return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this | ||
var h=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()} | ||
"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,r):h(!!e._support):h(!0)}catch(e){r(e)}}) | ||
return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){r._config.driver=r.driver()}function s(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
function i(){n._config.driver=n.driver()}function s(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
return this._driverSet=c.then(function(){var e=o[0] | ||
return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0 | ||
return function n(){for(;t<e.length;){var o=e[t] | ||
return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(s).catch(n)}i() | ||
return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0 | ||
return function r(){for(;t<e.length;){var o=e[t] | ||
return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(s).catch(r)}i() | ||
var u=Error("No available storage method found.") | ||
return r._driverSet=a.reject(u),r._driverSet}()}}(o)})}).catch(function(){i() | ||
return n._driverSet=a.reject(u),n._driverSet}()}}(o)})}).catch(function(){i() | ||
var e=Error("No available storage method found.") | ||
return r._driverSet=a.reject(e),r._driverSet}),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n] | ||
return n._driverSet=a.reject(e),n._driverSet}),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r] | ||
this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=fe.length;e<t;e++)he(this,fe[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new ve | ||
t.exports=pe},{3:3}]},{},[4])(4)}),PersistMeta_1=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n={name:"persistMeta"},r=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(n,e),this.cacheInstance=localforage.createInstance({driver:localforage.LOCALSTORAGE,name:this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e.prototype.keys=function(){return this.cacheInstance.keys()},e.prototype.length=function(){return this.cacheInstance.length()},e}() | ||
t.default=r}) | ||
var r={name:"persistMeta"},n=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(r,e),this.cacheInstance=localforage.createInstance({driver:localforage.LOCALSTORAGE,name:this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e.prototype.keys=function(){return this.cacheInstance.keys()},e.prototype.length=function(){return this.cacheInstance.length()},e}() | ||
t.default=n}) | ||
unwrapExports(PersistMeta_1) | ||
var PersistValue_1=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var PersistValue_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},n=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o | ||
switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o | ||
switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
case 5:a.label++,n=i[1],i=[0] | ||
continue | ||
@@ -419,29 +419,29 @@ case 7:i=a.ops.pop(),a.trys.pop() | ||
break}o[2]&&a.ops.pop(),a.trys.pop() | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var o={name:"persistValue"},i=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(o,e),this.cacheInstance=localforage.createInstance({driver:localforage.INDEXEDDB,name:this.cacheConfig.name,storeName:"store"+this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,n,o,i,a,s | ||
return r(this,function(r){switch(r.label){case 0:r.trys.push([0,5,,6]),t=[],n=0,o=e,r.label=1 | ||
case 1:return n<o.length?(a=(i=t).push,[4,this.get(o[n])]):[3,4] | ||
case 2:a.call(i,r.sent()),r.label=3 | ||
case 3:return n++,[3,1] | ||
var o={name:"persistValue"},i=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(o,e),this.cacheInstance=localforage.createInstance({driver:localforage.INDEXEDDB,name:this.cacheConfig.name,storeName:"store"+this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,r,o,i,a,s | ||
return n(this,function(n){switch(n.label){case 0:n.trys.push([0,5,,6]),t=[],r=0,o=e,n.label=1 | ||
case 1:return r<o.length?(a=(i=t).push,[4,this.get(o[r])]):[3,4] | ||
case 2:a.call(i,n.sent()),n.label=3 | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return s=r.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.append=function(e,t){return n(this,void 0,void 0,function(){var n,o | ||
return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.cacheInstance.getItem(e)] | ||
case 1:return(n=r.sent())?(utils.isArray(t)&&utils.isArray(n)?t=n.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(n)&&(t=utils.extend(n,t)),[2,this.set(e,t)]):[2,this.set(e,t)] | ||
case 2:return o=r.sent(),[2,Promise.reject(o)] | ||
case 5:return s=n.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.append=function(e,t){return r(this,void 0,void 0,function(){var r,o | ||
return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cacheInstance.getItem(e)] | ||
case 1:return(r=n.sent())?(utils.isArray(t)&&utils.isArray(r)?t=r.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(r)&&(t=utils.extend(r,t)),[2,this.set(e,t)]):[2,this.set(e,t)] | ||
case 2:return o=n.sent(),[2,Promise.reject(o)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e}() | ||
t.default=i}) | ||
unwrapExports(PersistValue_1) | ||
var Persist_1=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]) | ||
return e},r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var Persist_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]) | ||
return e},n=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},o=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o | ||
switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o | ||
switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
case 5:a.label++,n=i[1],i=[0] | ||
continue | ||
@@ -455,69 +455,73 @@ case 7:i=a.ops.pop(),a.trys.pop() | ||
break}o[2]&&a.ops.pop(),a.trys.pop() | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var i={name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(i,e),this.metaCacheInstance=new PersistMeta_1.default({name:this.cacheConfig.name}),this.valueCacheInstance=new PersistValue_1.default({name:this.cacheConfig.name})}return e.prototype.getOldKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,i,a,s,u | ||
var i={name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(i,e),this.metaCacheInstance=new PersistMeta_1.default({name:this.cacheConfig.name}),this.valueCacheInstance=new PersistValue_1.default({name:this.cacheConfig.name})}return e.prototype.getOldKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a,s,u | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.length()] | ||
case 1:return e=o.sent(),n=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),r=[],[4,this.getSortedItems()] | ||
case 2:for(i=o.sent(),a=i.reverse(),s=0;s<a.length;s++)s<n&&r.push(a[s].key) | ||
return[2,Promise.resolve(r)] | ||
case 1:return e=o.sent(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
case 2:for(i=o.sent(),a=i.reverse(),s=0;s<a.length;s++)s<r&&n.push(a[s].key) | ||
return[2,Promise.resolve(n)] | ||
case 3:return u=o.sent(),[2,Promise.reject(u)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,i,a | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=o.sent(),n=0,r=t,o.label=2 | ||
case 2:return n<r.length?[4,this.isExpired(i=r[n])]:[3,5] | ||
case 1:t=o.sent(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isExpired(i=n[r])]:[3,5] | ||
case 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 4:return r++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return a=o.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,i,a | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=o.sent(),n=0,r=t,o.label=2 | ||
case 2:return n<r.length?[4,this.isOverLength(i=r[n])]:[3,5] | ||
case 1:t=o.sent(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isOverLength(i=n[r])]:[3,5] | ||
case 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 4:return r++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return a=o.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.isOverLength=function(e){return r(this,void 0,void 0,function(){var t,n | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=r.sent())&&t.length&&t.length>this.cacheConfig.valueMaxLength?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return n=r.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.isExpired=function(e){return r(this,void 0,void 0,function(){var t,n | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=r.sent())&&t.expire?[2,Promise.resolve(this.expiredVaule(t.expire))]:[2,Promise.resolve(!1)] | ||
case 2:return n=r.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.get=function(e){return r(this,void 0,void 0,function(){var t,n,r | ||
case 7:return[2]}})})},e.prototype.isOverLength=function(e){return n(this,void 0,void 0,function(){var t,r | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=n.sent())&&t.length&&t.length>this.cacheConfig.valueMaxLength?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return r=n.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e.prototype.isExpired=function(e){return n(this,void 0,void 0,function(){var t,r | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=n.sent())&&t.expire?[2,Promise.resolve(this.expiredVaule(t.expire))]:[2,Promise.resolve(!1)] | ||
case 2:return r=n.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e.prototype.get=function(e){return n(this,void 0,void 0,function(){var t,r,n | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),[4,this.getMeta(e)] | ||
case 1:return(t=o.sent())?void 0===t.length||void 0===t.expire||void 0===t.now||void 0===t.count?[3,4]:this.expiredVaule(t.expire)?(this.remove(e),[2,Promise.resolve(null)]):[4,this.valueCacheInstance.get(e)]:[2,Promise.resolve(null)] | ||
case 2:return n=o.sent(),[4,this.setMetaCount(e)] | ||
case 3:return o.sent(),[2,Promise.resolve(n)] | ||
case 2:return r=o.sent(),[4,this.setMeta(e)] | ||
case 3:return o.sent(),[2,Promise.resolve(r)] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return r=o.sent(),[2,Promise.reject(r)] | ||
case 6:return[2]}})})},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,n,r,i,a,s | ||
return o(this,function(o){switch(o.label){case 0:o.trys.push([0,5,,6]),t=[],n=0,r=e,o.label=1 | ||
case 1:return n<r.length?(a=(i=t).push,[4,this.get(r[n])]):[3,4] | ||
case 5:return n=o.sent(),[2,Promise.reject(n)] | ||
case 6:return[2]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a,s | ||
return o(this,function(o){switch(o.label){case 0:o.trys.push([0,5,,6]),t=[],r=0,n=e,o.label=1 | ||
case 1:return r<n.length?(a=(i=t).push,[4,this.get(n[r])]):[3,4] | ||
case 2:a.call(i,o.sent()),o.label=3 | ||
case 3:return n++,[3,1] | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return s=o.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,n){return void 0===n&&(n=-1),r(this,void 0,void 0,function(){var r,i | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getMeta(e)] | ||
case 1:return!(r=o.sent())||r.length||r.expire||r.count||r.now?[4,this.setMeta(e,t,n)]:[2,this.metaCacheInstance.set(e,t)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,r){return void 0===r&&(r=-1),n(this,void 0,void 0,function(){var n,i | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,6]),[4,this.getMeta(e)] | ||
case 1:return!(n=o.sent())||n.length||n.expire||n.count||n.now?[4,this.setMeta(e,t,r)]:[2,this.metaCacheInstance.set(e,t)] | ||
case 2:return o.sent(),[2,this.valueCacheInstance.set(e,t)] | ||
case 3:return i=o.sent(),[2,Promise.reject(i)] | ||
case 4:return[2]}})})},e.prototype.append=function(e,t,n){return void 0===n&&(n=-1),r(this,void 0,void 0,function(){var r,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getMeta(e)] | ||
case 1:return(r=o.sent())?(n=n||r.expire,i=this.valueCacheInstance.append(e,t),[4,this.setMeta(e,i,n)]):[2,this.set(e,t,n)] | ||
case 3:return(i=o.sent()).name.toUpperCase().indexOf("QUOTA")>=0?[4,this.clearKeys()]:[3,5] | ||
case 4:return o.sent(),[2,Promise.resolve(null)] | ||
case 5:return[2,Promise.reject(i)] | ||
case 6:return[2]}})})},e.prototype.append=function(e,t,r){return void 0===r&&(r=-1),n(this,void 0,void 0,function(){var n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,6]),[4,this.getMeta(e)] | ||
case 1:return(n=o.sent())?(r=r||n.expire,i=this.valueCacheInstance.append(e,t),[4,this.setMeta(e,i,r)]):[2,this.set(e,t,r)] | ||
case 2:return o.sent(),[2,Promise.resolve(i)] | ||
case 3:return a=o.sent(),[2,Promise.reject(a)] | ||
case 4:return[2]}})})},e.prototype.has=function(e){return r(this,void 0,void 0,function(){var t | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return n.sent()?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return t=n.sent(),[2,Promise.reject(t)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return r(this,void 0,void 0,function(){var t | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.metaCacheInstance.remove(e)] | ||
case 1:return n.sent(),[4,this.valueCacheInstance.remove(e)] | ||
case 2:return n.sent(),[2,Promise.resolve()] | ||
case 3:return t=n.sent(),[2,Promise.reject(t)] | ||
case 4:return[2]}})})},e.prototype.clear=function(){return r(this,void 0,void 0,function(){var e | ||
case 3:return(a=o.sent()).name.toUpperCase().indexOf("QUOTA")>=0?[4,this.clearKeys()]:[3,5] | ||
case 4:return o.sent(),[2,Promise.resolve(null)] | ||
case 5:return[2,Promise.reject(a)] | ||
case 6:return[2]}})})},e.prototype.has=function(e){return n(this,void 0,void 0,function(){var t | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return r.sent()?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return t=r.sent(),[2,Promise.reject(t)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return n(this,void 0,void 0,function(){var t | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.metaCacheInstance.remove(e)] | ||
case 1:return r.sent(),[4,this.valueCacheInstance.remove(e)] | ||
case 2:return r.sent(),[2,Promise.resolve()] | ||
case 3:return t=r.sent(),[2,Promise.reject(t)] | ||
case 4:return[2]}})})},e.prototype.clear=function(){return n(this,void 0,void 0,function(){var e | ||
return o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.metaCacheInstance.clear()] | ||
@@ -527,17 +531,17 @@ case 1:return t.sent(),[4,this.valueCacheInstance.clear()] | ||
case 3:return e=t.sent(),[2,Promise.reject(e)] | ||
case 4:return[2]}})})},e.prototype.keys=function(){return this.metaCacheInstance.keys()},e.prototype.length=function(){return this.metaCacheInstance.length()},e.prototype.each=function(e){return r(this,void 0,void 0,function(){var t,n,r,i,a | ||
case 4:return[2]}})})},e.prototype.keys=function(){return this.metaCacheInstance.keys()},e.prototype.length=function(){return this.metaCacheInstance.length()},e.prototype.each=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,7,,8]),[4,this.keys()] | ||
case 1:t=o.sent(),n=0,o.label=2 | ||
case 2:return n<t.length?[4,this.get(r=t[n])]:[3,6] | ||
case 3:return i=o.sent(),e?[4,e(i,r,n)]:[3,5] | ||
case 1:t=o.sent(),r=0,o.label=2 | ||
case 2:return r<t.length?[4,this.get(n=t[r])]:[3,6] | ||
case 3:return i=o.sent(),e?[4,e(i,n,r)]:[3,5] | ||
case 4:o.sent(),o.label=5 | ||
case 5:return n++,[3,2] | ||
case 5:return r++,[3,2] | ||
case 6:return[2,Promise.resolve(!0)] | ||
case 7:return a=o.sent(),[2,Promise.reject(a)] | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return r(this,void 0,void 0,function(){var e,t,r,i,a,s,u,c,f,l,h,d,v,p,y,m | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return n(this,void 0,void 0,function(){var e,t,n,i,a,s,u,c,f,l,h,d,v,p,y,m | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),[4,this.keys()] | ||
case 1:e=o.sent(),t=[],r=0,i=e,o.label=2 | ||
case 2:return r<i.length?[4,this.getMeta(a=i[r])]:[3,5] | ||
case 3:s=o.sent(),t.push(n({},s,{key:a})),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 1:e=o.sent(),t=[],n=0,i=e,o.label=2 | ||
case 2:return n<i.length?[4,this.getMeta(a=i[n])]:[3,5] | ||
case 3:s=o.sent(),t.push(r({},s,{key:a})),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 5:for(u={},c=0,f=t;c<f.length;c++)u[(l=f[c]).count]||(u[l.count]=[]),u[l.count].push(l) | ||
@@ -549,15 +553,21 @@ for(d in h=[],u)u.hasOwnProperty(d)&&h.push({count:parseInt(d,10),items:u[d].sort(function(e,t){return t.now-e.now})}) | ||
case 7:return[2]}})})},e.prototype.expiredVaule=function(e){var t=(new Date).getTime() | ||
return e&&e>0&&e<t},e.prototype.setMetaCount=function(e){return r(this,void 0,void 0,function(){var t,r,i,a,s,u | ||
return e&&e>0&&e<t},e.prototype.setMeta=function(e,t,i){return void 0===t&&(t=""),void 0===i&&(i=-1),n(this,void 0,void 0,function(){var n,a,s,u,c,f,l | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return t=o.sent(),r=(new Date).getTime(),i=0,t&&void 0!==t.count&&(i=t.count+1),a=n({},t,{now:r,count:i}),s=this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(JSON.stringify(a)):JSON.stringify(a),[2,this.metaCacheInstance.set(e,s)] | ||
case 2:return u=o.sent(),[2,Promise.reject(u)] | ||
case 3:return[2]}})})},e.prototype.setMeta=function(e,t,n){return void 0===n&&(n=-1),r(this,void 0,void 0,function(){var r,i,a,s,u,c,f,l | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return r=o.sent(),i=(new Date).getTime(),void 0,s=utils.utf16ByteLength(JSON.stringify(t)),u=void 0,u=utils.isDate(n)?n.getTime():utils.isNumber(n)&&n>0?i+1e3*n:-1,c=0,r&&r.count&&(c=r.count+1),a={now:i,length:s,count:c,expire:u},f=this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(JSON.stringify(a)):JSON.stringify(a),[2,this.metaCacheInstance.set(e,f)] | ||
case 1:return n=o.sent(),a=(new Date).getTime(),s=void 0,s=utils.isDate(i)?i.getTime():utils.isNumber(i)&&i>0?a+1e3*i:-1,u=0,n&&void 0!==n.count&&(u=n.count+1),c=void 0,c=t?{length:utils.utf16ByteLength(JSON.stringify(t)),now:a,count:u,expire:s}:r({},n,{now:a,count:u}),f=this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(JSON.stringify(c)):JSON.stringify(c),[2,this.metaCacheInstance.set(e,f)] | ||
case 2:return l=o.sent(),[2,Promise.reject(l)] | ||
case 3:return[2]}})})},e.prototype.getMeta=function(e){return r(this,void 0,void 0,function(){var t,n,r | ||
case 3:return[2]}})})},e.prototype.getMeta=function(e){return n(this,void 0,void 0,function(){var t,r,n | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.metaCacheInstance.get(e)] | ||
case 1:return t=o.sent(),n=null,null!=t&&(n=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(t):t)),[2,Promise.resolve(n)] | ||
case 2:return r=o.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e}() | ||
case 1:return t=o.sent(),r=null,null!=t&&(r=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(t):t)),[2,Promise.resolve(r)] | ||
case 2:return n=o.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.clearKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a,s,u | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,8,,9]),[4,this.getExpiredKeys()] | ||
case 1:return e=o.sent(),r=(t=e).concat,[4,this.getOverLengthKeys()] | ||
case 2:return r.call(t,o.sent()),i=(n=e).concat,[4,this.getOldKeys()] | ||
case 3:i.call(n,o.sent()),e=e.sort().filter(function(e,t,r){return!t||e!==r[t-1]}),a=0,s=e,o.label=4 | ||
case 4:return a<s.length?[4,this.remove(s[a])]:[3,7] | ||
case 5:o.sent(),o.label=6 | ||
case 6:return a++,[3,4] | ||
case 7:return[2,Promise.resolve(!0)] | ||
case 8:return u=o.sent(),[2,Promise.reject(u)] | ||
case 9:return[2]}})})},e}() | ||
t.default=a}) | ||
@@ -564,0 +574,0 @@ unwrapExports(Persist_1) |
var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{} | ||
function commonjsRequire(){throw Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var utils=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n=Object.prototype.toString | ||
function r(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}function o(e){return!0===r(e)&&"[object Object]"===Object.prototype.toString.call(e)}t.isDate=function(e){return"[object Date]"===n.call(e)},t.isNumber=function(e){return"[object Number]"===n.call(e)},t.isArray=Array.isArray,t.isPlainObject=function(e){if(!1===o(e))return!1 | ||
var r=Object.prototype.toString | ||
function n(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}function o(e){return!0===n(e)&&"[object Object]"===Object.prototype.toString.call(e)}t.isDate=function(e){return"[object Date]"===r.call(e)},t.isNumber=function(e){return"[object Number]"===r.call(e)},t.isArray=Array.isArray,t.isPlainObject=function(e){if(!1===o(e))return!1 | ||
var t=e.constructor | ||
if("function"!=typeof t)return!1 | ||
var n=t.prototype | ||
return!1!==o(n)&&!1!==n.hasOwnProperty("isPrototypeOf")},t.extend=function(e,t){if(null===t||"object"!=typeof t)return e | ||
for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]] | ||
return e},t.omit=function(e,t){if(!r(e))return{} | ||
var r=t.prototype | ||
return!1!==o(r)&&!1!==r.hasOwnProperty("isPrototypeOf")},t.extend=function(e,t){if(null===t||"object"!=typeof t)return e | ||
for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]] | ||
return e},t.omit=function(e,t){if(!n(e))return{} | ||
"string"==typeof t&&(t=[t]) | ||
for(var n={},o=0,i=Object.keys(e);o<i.length;o++){var a=i[o] | ||
t&&-1!==t.indexOf(a)||(n[a]=e[a])}return n},t.utf16ByteLength=function(e){for(var t=0,n=0;n<e.length;n++)t+=e.charCodeAt(n)<=65535?2:4 | ||
for(var r={},o=0,i=Object.keys(e);o<i.length;o++){var a=i[o] | ||
t&&-1!==t.indexOf(a)||(r[a]=e[a])}return r},t.utf16ByteLength=function(e){for(var t=0,r=0;r<e.length;r++)t+=e.charCodeAt(r)<=65535?2:4 | ||
return t}}) | ||
unwrapExports(utils) | ||
var utils_1=utils.isDate,utils_2=utils.isNumber,utils_3=utils.isArray,utils_4=utils.isPlainObject,utils_5=utils.extend,utils_6=utils.omit,utils_7=utils.utf16ByteLength,MemCache_1=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var utils_1=utils.isDate,utils_2=utils.isNumber,utils_3=utils.isArray,utils_4=utils.isPlainObject,utils_5=utils.extend,utils_6=utils.omit,utils_7=utils.utf16ByteLength,MemCache_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},n=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o | ||
switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o | ||
switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
case 5:a.label++,n=i[1],i=[0] | ||
continue | ||
@@ -33,32 +33,32 @@ case 7:i=a.ops.pop(),a.trys.pop() | ||
break}o[2]&&a.ops.pop(),a.trys.pop() | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var o=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(e,{name:"memcache"}),this.cacheInstance={}}return e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,n,o,i,a | ||
return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=r.sent(),n=0,o=t,r.label=2 | ||
case 2:return n<o.length?[4,this.isExpired(i=o[n])]:[3,5] | ||
case 3:r.sent()&&e.push(i),r.label=4 | ||
case 4:return n++,[3,2] | ||
var o=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(e,{name:"memcache"}),this.cacheInstance={}}return e.prototype.getExpiredKeys=function(){return r(this,void 0,void 0,function(){var e,t,r,o,i,a | ||
return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=n.sent(),r=0,o=t,n.label=2 | ||
case 2:return r<o.length?[4,this.isExpired(i=o[r])]:[3,5] | ||
case 3:n.sent()&&e.push(i),n.label=4 | ||
case 4:return r++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return a=r.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.isExpired=function(e){return n(this,void 0,void 0,function(){var t,n,o | ||
return r(this,function(r){return t=this.getKey(e),n=this.cacheInstance[t],o=(new Date).getTime(),n&&n.expire&&n.expire>0&&n.expire<o?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)]})})},e.prototype.get=function(e){return n(this,void 0,void 0,function(){var t,n,o | ||
return r(this,function(r){switch(r.label){case 0:return t=this.getKey(e),n=this.cacheInstance[t],[4,this.isExpired(e)] | ||
case 1:return o=r.sent(),n&&n.value?o?(this.remove(t),[2,Promise.resolve(null)]):n.value?[2,Promise.resolve(n.value)]:[2]:[2,Promise.resolve(null)]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,n,o,i,a | ||
return r(this,function(r){switch(r.label){case 0:t=[],n=0,o=e,r.label=1 | ||
case 1:return n<o.length?(a=(i=t).push,[4,this.get(o[n])]):[3,4] | ||
case 2:a.call(i,r.sent()),r.label=3 | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(t)]}})})},e.prototype.set=function(e,t,n){void 0===n&&(n=-1) | ||
var r=this.getKey(e) | ||
return utils.isDate(n)?n=n.getTime():utils.isNumber(n)&&n>0&&(n=(new Date).getTime()+1e3*n),this.cacheInstance[r]={value:t,expire:n},Promise.resolve(t)},e.prototype.append=function(e,t,n){void 0===n&&(n=-1) | ||
var r=this.cacheInstance[this.getKey(e)] | ||
return r?(utils.isArray(t)&&utils.isArray(r.value)?t=r.value.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(r.value)&&(t=utils.extend(r.value,t)),this.set(e,t,n=n||r.expire)):this.set(e,t,n)},e.prototype.has=function(e){return this.get(e)?Promise.resolve(!0):Promise.resolve(!1)},e.prototype.remove=function(e){var t=this.getKey(e) | ||
return this.cacheInstance[t]&&(this.cacheInstance[t]=null,this.cacheInstance=utils.omit(this.cacheInstance,t)),Promise.resolve()},e.prototype.keys=function(){for(var e=[],t=0,n=Object.keys(this.cacheInstance);t<n.length;t++){e.push(n[t].replace(this.cacheConfig.name+"/",""))}return Promise.resolve(e)},e.prototype.clear=function(){return this.cacheInstance={},Promise.resolve()},e.prototype.length=function(){var e=Object.keys(this.cacheInstance) | ||
return e.length?Promise.resolve(e.length):Promise.resolve(0)},e.prototype.each=function(e){return n(this,void 0,void 0,function(){var t,n,o,i | ||
return r(this,function(r){switch(r.label){case 0:t=Object.keys(this.cacheInstance),n=0,r.label=1 | ||
case 1:return n<t.length?(o=t[n].replace(this.cacheConfig.name+"/",""),[4,this.get(o)]):[3,4] | ||
case 2:i=r.sent(),e&&e(i,o,n),r.label=3 | ||
case 3:return n++,[3,1] | ||
case 6:return a=n.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.isExpired=function(e){return r(this,void 0,void 0,function(){var t,r,o | ||
return n(this,function(n){return t=this.getKey(e),r=this.cacheInstance[t],o=(new Date).getTime(),r&&r.expire&&r.expire>0&&r.expire<o?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)]})})},e.prototype.get=function(e){return r(this,void 0,void 0,function(){var t,r,o | ||
return n(this,function(n){switch(n.label){case 0:return t=this.getKey(e),r=this.cacheInstance[t],[4,this.isExpired(e)] | ||
case 1:return o=n.sent(),r&&r.value?o?(this.remove(t),[2,Promise.resolve(null)]):r.value?[2,Promise.resolve(r.value)]:[2]:[2,Promise.resolve(null)]}})})},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,r,o,i,a | ||
return n(this,function(n){switch(n.label){case 0:t=[],r=0,o=e,n.label=1 | ||
case 1:return r<o.length?(a=(i=t).push,[4,this.get(o[r])]):[3,4] | ||
case 2:a.call(i,n.sent()),n.label=3 | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(t)]}})})},e.prototype.set=function(e,t,r){void 0===r&&(r=-1) | ||
var n=this.getKey(e) | ||
return utils.isDate(r)?r=r.getTime():utils.isNumber(r)&&r>0&&(r=(new Date).getTime()+1e3*r),this.cacheInstance[n]={value:t,expire:r},Promise.resolve(t)},e.prototype.append=function(e,t,r){void 0===r&&(r=-1) | ||
var n=this.cacheInstance[this.getKey(e)] | ||
return n?(utils.isArray(t)&&utils.isArray(n.value)?t=n.value.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(n.value)&&(t=utils.extend(n.value,t)),this.set(e,t,r=r||n.expire)):this.set(e,t,r)},e.prototype.has=function(e){return this.get(e)?Promise.resolve(!0):Promise.resolve(!1)},e.prototype.remove=function(e){var t=this.getKey(e) | ||
return this.cacheInstance[t]&&(this.cacheInstance[t]=null,this.cacheInstance=utils.omit(this.cacheInstance,t)),Promise.resolve()},e.prototype.keys=function(){for(var e=[],t=0,r=Object.keys(this.cacheInstance);t<r.length;t++){e.push(r[t].replace(this.cacheConfig.name+"/",""))}return Promise.resolve(e)},e.prototype.clear=function(){return this.cacheInstance={},Promise.resolve()},e.prototype.length=function(){var e=Object.keys(this.cacheInstance) | ||
return e.length?Promise.resolve(e.length):Promise.resolve(0)},e.prototype.each=function(e){return r(this,void 0,void 0,function(){var t,r,o,i | ||
return n(this,function(n){switch(n.label){case 0:t=Object.keys(this.cacheInstance),r=0,n.label=1 | ||
case 1:return r<t.length?(o=t[r].replace(this.cacheConfig.name+"/",""),[4,this.get(o)]):[3,4] | ||
case 2:i=n.sent(),e&&e(i,o,r),n.label=3 | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(!0)]}})})},e.prototype.getKey=function(e){return this.cacheConfig.name+"/"+e},e}() | ||
@@ -68,23 +68,23 @@ t.default=o}) | ||
var LZString_1=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n=String.fromCharCode,r=function(e){return{v:e,d:{}}},o=function(e){return n(e+32)},i=function(e,t,n){if(null==e)return[] | ||
var o,i=0,a=0,s=0,u={},c=!0,f=0,l=r(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(s=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
var r=String.fromCharCode,n=function(e){return{v:e,d:{}}},o=function(e){return r(e+32)},i=function(e,t,r){if(null==e)return[] | ||
var o,i=0,a=0,s=0,u={},c=!0,f=0,l=n(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(s=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u[f]=l,a=1;a<e.length;a++)if(f=e.charCodeAt(a),o=l.d[f])l=o | ||
else{if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
u[f]=r(d++),c=!0}l.d[f]=r(d++),0==--h&&(h=1<<v++),l=u[f]}if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
return p.push(n(y<<=t-m)),p},a=function(e,t,r){for(var o=["","",""],i=4,a=4,s=3,u="",c=[],f=0,l=2,h=0,d="",v=r(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
u[f]=n(d++),c=!0}l.d[f]=n(d++),0==--h&&(h=1<<v++),l=u[f]}if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
return p.push(r(y<<=t-m)),p},a=function(e,t,n){for(var o=["","",""],i=4,a=4,s=3,u="",c=[],f=0,l=2,h=0,d="",v=n(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
if(2===f)return"" | ||
for(l=8*f+8,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
for(d=n(f),o[3]=d,c.push(d);y<=e;){for(l=s,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
if(f<2){for(l=8+8*f,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
o[a]=n(f),f=a++,0==--i&&(i=1<<s++)}else if(2===f)return c.join("") | ||
for(l=8*f+8,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
for(d=r(f),o[3]=d,c.push(d);y<=e;){for(l=s,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
if(f<2){for(l=8+8*f,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
o[a]=r(f),f=a++,0==--i&&(i=1<<s++)}else if(2===f)return c.join("") | ||
if(f>o.length)return null | ||
u=f<o.length?o[f]:d+d.charAt(0),c.push(u),o[a++]=d+u.charAt(0),d=u,0==--i&&(i=1<<s++)}return""},s=function(e){return i(e,16,function(e){return n(e)})} | ||
u=f<o.length?o[f]:d+d.charAt(0),c.push(u),o[a++]=d+u.charAt(0),d=u,0==--i&&(i=1<<s++)}return""},s=function(e){return i(e,16,function(e){return r(e)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
@@ -94,51 +94,51 @@ var t=i(e,15,o) | ||
unwrapExports(LZString_1) | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof commonjsRequire&&commonjsRequire | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof commonjsRequire&&commonjsRequire | ||
if(!s&&u)return u(a,!0) | ||
if(i)return i(a,!0) | ||
var c=Error("Cannot find module '"+a+"'") | ||
throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}} | ||
t[a][0].call(f.exports,function(e){var n=t[a][1][e] | ||
return o(n||e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof commonjsRequire&&commonjsRequire,a=0;a<r.length;a++)o(r[a]) | ||
return o}({1:[function(e,t,n){!function(e){var n,r,o=e.MutationObserver||e.WebKitMutationObserver | ||
throw c.code="MODULE_NOT_FOUND",c}var f=r[a]={exports:{}} | ||
t[a][0].call(f.exports,function(e){var r=t[a][1][e] | ||
return o(r||e)},f,f.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof commonjsRequire&&commonjsRequire,a=0;a<n.length;a++)o(n[a]) | ||
return o}({1:[function(e,t,r){!function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver | ||
if(o){var i=0,a=new o(f),s=e.document.createTextNode("") | ||
a.observe(s,{characterData:!0}),n=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script") | ||
a.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script") | ||
t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)} | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,n=function(){u.port2.postMessage(0)}}var c=[] | ||
u.port1.onmessage=f,r=function(){u.port2.postMessage(0)}}var c=[] | ||
function f(){var e,t | ||
r=!0 | ||
for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]() | ||
n=c.length}r=!1}t.exports=function(e){1!==c.push(e)||r||n()}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1) | ||
n=!0 | ||
for(var r=c.length;r;){for(t=c,c=[],e=-1;++e<r;)t[e]() | ||
r=c.length}n=!1}t.exports=function(e){1!==c.push(e)||n||r()}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1) | ||
function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],u=["PENDING"] | ||
function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function") | ||
this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r(function(){var r | ||
try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)})}function h(e){var t=e&&e.then | ||
if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var n=!1 | ||
function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=v(function(){t(o,r)}) | ||
"error"===a.status&&r(a.value)}function v(e,t){var n={} | ||
try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this | ||
var n=new this.constructor(o) | ||
if(this.state!==u){var r=this.state===s?e:t | ||
l(n,r,this.outcome)}else this.queue.push(new f(n,e,t)) | ||
return n},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=v(h,t) | ||
if("error"===n.status)return i.reject(e,n.value) | ||
var r=n.value | ||
if(r)d(e,r) | ||
this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function l(e,t,r){n(function(){var n | ||
try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function h(e){var t=e&&e.then | ||
if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1 | ||
function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=v(function(){t(o,n)}) | ||
"error"===a.status&&n(a.value)}function v(e,t){var r={} | ||
try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this | ||
var r=new this.constructor(o) | ||
if(this.state!==u){var n=this.state===s?e:t | ||
l(r,n,this.outcome)}else this.queue.push(new f(r,e,t)) | ||
return r},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=v(h,t) | ||
if("error"===r.status)return i.reject(e,r.value) | ||
var n=r.value | ||
if(n)d(e,n) | ||
else{e.state=s,e.outcome=t | ||
for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t | ||
for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t) | ||
for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t) | ||
return e},c.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},c.reject=function(e){var t=new this(o) | ||
return i.reject(t,e)},c.all=function(e){var t=this | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var n=e.length,r=!1 | ||
if(!n)return this.resolve([]) | ||
for(var a=Array(n),s=0,u=-1,c=new this(o);++u<n;)f(e[u],u) | ||
var r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=Array(r),s=0,u=-1,c=new this(o);++u<r;)f(e[u],u) | ||
return c | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==n||r||(r=!0,i.resolve(c,a))},function(e){r||(r=!0,i.reject(c,e))})}},c.race=function(e){var t=this | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!0,i.reject(c,e))})}},c.race=function(e){var t=this | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var n=e.length,r=!1 | ||
if(!n)return this.resolve([]) | ||
for(var a=-1,s=new this(o);++a<n;)t.resolve(e[a]).then(function(e){r||(r=!0,i.resolve(s,e))},function(e){r||(r=!0,i.reject(s,e))}) | ||
return s}},{1:1}],3:[function(e,t,n){var r | ||
"function"!=typeof(r=void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).Promise&&(r.Promise=e(2))},{2:2}],4:[function(e,t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB | ||
var r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=-1,s=new this(o);++a<r;)t.resolve(e[a]).then(function(e){n||(n=!0,i.resolve(s,e))},function(e){n||(n=!0,i.reject(s,e))}) | ||
return s}},{1:1}],3:[function(e,t,r){var n | ||
"function"!=typeof(n=void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).Promise&&(n.Promise=e(2))},{2:2}],4:[function(e,t,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB | ||
if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB | ||
@@ -150,131 +150,131 @@ if("undefined"!=typeof mozIndexedDB)return mozIndexedDB | ||
try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i | ||
for(var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,r=new n,o=0;o<e.length;o+=1)r.append(e[o]) | ||
return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3) | ||
for(var r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,n=new r,o=0;o<e.length;o+=1)n.append(e[o]) | ||
return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3) | ||
var a=Promise | ||
function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function m(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var n=e.transaction(l,y),r=i([""]) | ||
n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//) | ||
t(n||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}function b(e){var t=d[e.name],n={} | ||
n.promise=new a(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady=t.dbReady?t.dbReady.then(function(){return n.promise}):n.promise}function g(e){var t=d[e.name],n=t.deferredOperations.pop() | ||
if(n)return n.resolve(),n.promise}function _(e,t){var n=d[e.name],r=n.deferredOperations.pop() | ||
if(r)return r.reject(t),r.promise}function w(e,t){return new a(function(n,r){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db) | ||
function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function m(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var r=e.transaction(l,y),n=i([""]) | ||
r.objectStore(l).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//) | ||
t(r||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}function b(e){var t=d[e.name],r={} | ||
r.promise=new a(function(e,t){r.resolve=e,r.reject=t}),t.deferredOperations.push(r),t.dbReady=t.dbReady?t.dbReady.then(function(){return r.promise}):r.promise}function g(e){var t=d[e.name],r=t.deferredOperations.pop() | ||
if(r)return r.resolve(),r.promise}function _(e,t){var r=d[e.name],n=r.deferredOperations.pop() | ||
if(n)return n.reject(t),n.promise}function w(e,t){return new a(function(r,n){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db) | ||
b(e),e.db.close()}var i=[e.name] | ||
t&&i.push(e.version) | ||
var a=o.open.apply(o,i) | ||
t&&(a.onupgradeneeded=function(t){var n=a.result | ||
try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n | ||
console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){n(a.result),g(e)}})}function I(e){return w(e,!1)}function j(e){return w(e,!0)}function S(e,t){if(!e.db)return!0 | ||
var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version | ||
if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var i=e.db.version+1 | ||
i>e.version&&(e.version=i)}return!0}return!1}function P(e){var t=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o) | ||
return n}(atob(e.data)) | ||
return i([t],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
t&&(a.onupgradeneeded=function(t){var r=a.result | ||
try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r | ||
console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),g(e)}})}function I(e){return w(e,!1)}function j(e){return w(e,!0)}function S(e,t){if(!e.db)return!0 | ||
var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,o=e.version>e.db.version | ||
if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||r){if(r){var i=e.db.version+1 | ||
i>e.version&&(e.version=i)}return!0}return!1}function P(e){var t=function(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o) | ||
return r}(atob(e.data)) | ||
return i([t],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return u(n,e,e),n}function C(e,t,n,r){void 0===r&&(r=1) | ||
return u(r,e,e),r}function C(e,t,r,n){void 0===n&&(n=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),j(e)}).then(function(){return function(e){b(e) | ||
for(var t=d[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r] | ||
o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,S(e)?j(e):t}).then(function(r){e.db=t.db=r | ||
for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r}).catch(function(t){throw _(e,t),t})}(e).then(function(){C(e,t,n,r-1)})}).catch(n) | ||
n(o)}}var O={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null} | ||
if(e)for(var r in e)n[r]=e[r] | ||
var o=d[n.name] | ||
o||(d[n.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E) | ||
r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),j(e)}).then(function(){return function(e){b(e) | ||
for(var t=d[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n] | ||
o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,I(e).then(function(t){return e.db=t,S(e)?j(e):t}).then(function(n){e.db=t.db=n | ||
for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n}).catch(function(t){throw _(e,t),t})}(e).then(function(){C(e,t,r,n-1)})}).catch(r) | ||
r(o)}}var O={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null} | ||
if(e)for(var n in e)r[n]=e[n] | ||
var o=d[r.name] | ||
o||(d[r.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E) | ||
var i=[] | ||
function s(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var c=o.forages[u] | ||
c!==t&&i.push(c._initReady().catch(s))}var f=o.forages.slice(0) | ||
return a.all(i).then(function(){return n.db=o.db,I(n)}).then(function(e){return n.db=e,S(n,t._defaultConfig.version)?j(n):e}).then(function(e){n.db=o.db=e,t._dbInfo=n | ||
for(var r=0;r<f.length;r++){var i=f[r] | ||
i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}})},_support:function(){try{if(!o)return!1 | ||
return a.all(i).then(function(){return r.db=o.db,I(r)}).then(function(e){return r.db=e,S(r,t._defaultConfig.version)?j(r):e}).then(function(e){r.db=o.db=e,t._dbInfo=r | ||
for(var n=0;n<f.length;n++){var i=f[n] | ||
i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}})},_support:function(){try{if(!o)return!1 | ||
var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==(""+fetch).indexOf("[native code") | ||
return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){C(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=a.openCursor(),u=1 | ||
s.onsuccess=function(){var n=s.result | ||
if(n){var r=n.value | ||
x(r)&&(r=P(r)) | ||
var o=e(r,n.key,u++) | ||
void 0!==o?t(o):n.continue()}else t()},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},getItem:function(e,t){var n=this | ||
return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){C(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=a.openCursor(),u=1 | ||
s.onsuccess=function(){var r=s.result | ||
if(r){var n=r.value | ||
x(n)&&(n=P(n)) | ||
var o=e(n,r.key,u++) | ||
void 0!==o?t(o):r.continue()}else t()},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){C(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=a.get(e) | ||
var n=new a(function(t,n){r.ready().then(function(){C(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=a.get(e) | ||
s.onsuccess=function(){var e=s.result | ||
void 0===e&&(e=null),x(e)&&(e=P(e)),t(e)},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},setItem:function(e,t,n){var r=this | ||
void 0===e&&(e=null),x(e)&&(e=P(e)),t(e)},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},setItem:function(e,t,r){var n=this | ||
e=c(e) | ||
var o=new a(function(n,o){var i | ||
r.ready().then(function(){return i=r._dbInfo,"[object Blob]"===v.call(t)?m(i.db).then(function(e){return e?t:(n=t,new a(function(e,t){var r=new FileReader | ||
r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"") | ||
e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})) | ||
var n}):t}).then(function(t){C(r._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var s=a.objectStore(r._dbInfo.storeName) | ||
var o=new a(function(r,o){var i | ||
n.ready().then(function(){return i=n._dbInfo,"[object Blob]"===v.call(t)?m(i.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader | ||
n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"") | ||
e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)})) | ||
var r}):t}).then(function(t){C(n._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var s=a.objectStore(n._dbInfo.storeName) | ||
null===t&&(t=void 0) | ||
var u=s.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error | ||
a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return s(o,n),o},removeItem:function(e,t){var n=this | ||
return s(o,r),o},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){C(n._dbInfo,y,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){r(s.error)},i.onabort=function(){var e=s.error?s.error:s.transaction.error | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){C(t._dbInfo,y,function(r,o){if(r)return n(r) | ||
var n=new a(function(t,n){r.ready().then(function(){C(r._dbInfo,y,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){n(s.error)},i.onabort=function(){var e=s.error?s.error:s.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){C(t._dbInfo,y,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.clear() | ||
o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=a.error?a.error:a.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){C(t._dbInfo,p,function(r,o){if(r)return n(r) | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){C(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.count() | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){e<0?t(null):n.ready().then(function(){C(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),s=!1,u=a.openCursor() | ||
u.onsuccess=function(){var n=u.result | ||
n?0===e?t(n.key):s?t(n.key):(s=!0,n.advance(e)):t(null)},u.onerror=function(){r(u.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){C(t._dbInfo,p,function(r,o){if(r)return n(r) | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){C(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=!1,u=a.openCursor() | ||
u.onsuccess=function(){var r=u.result | ||
r?0===e?t(r.key):s?t(r.key):(s=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){C(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),s=[] | ||
a.onsuccess=function(){var t=a.result | ||
t?(s.push(t.key),t.continue()):e(s)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var n,r=this.config() | ||
if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var i=e.name===r.name&&this._dbInfo.db,u=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var n=d[e.name],r=n.forages | ||
n.db=t | ||
for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t | ||
t?(s.push(t.key),t.continue()):e(s)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var r,n=this.config() | ||
if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName),e.name){var i=e.name===n.name&&this._dbInfo.db,u=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var r=d[e.name],n=r.forages | ||
r.db=t | ||
for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t | ||
return t}) | ||
n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
r=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
b(e) | ||
var r=d[e.name],i=r.forages | ||
var n=d[e.name],i=n.forages | ||
t.close() | ||
for(var s=0;s<i.length;s++){var u=i[s] | ||
u._dbInfo.db=null,u._dbInfo.version=n}var c=new a(function(t,r){var i=o.open(e.name,n) | ||
u._dbInfo.db=null,u._dbInfo.version=r}var c=new a(function(t,n){var i=o.open(e.name,r) | ||
i.onerror=function(e){var t=i.result | ||
t.close(),r(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.close(),n(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result | ||
e.close(),t(e)}}) | ||
return c.then(function(e){r.db=e | ||
for(var t=0;t<i.length;t++){var n=i[t] | ||
n._dbInfo.db=e,g(n._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e) | ||
var n=d[e.name],r=n.forages | ||
return c.then(function(e){n.db=e | ||
for(var t=0;t<i.length;t++){var r=i[t] | ||
r._dbInfo.db=e,g(r._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e) | ||
var r=d[e.name],n=r.forages | ||
t.close() | ||
for(var i=0;i<r.length;i++){var s=r[i] | ||
s._dbInfo.db=null}var u=new a(function(t,n){var r=o.deleteDatabase(e.name) | ||
r.onerror=r.onblocked=function(e){var t=r.result | ||
t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result | ||
for(var i=0;i<n.length;i++){var s=n[i] | ||
s._dbInfo.db=null}var u=new a(function(t,r){var n=o.deleteDatabase(e.name) | ||
n.onerror=n.onblocked=function(e){var t=n.result | ||
t&&t.close(),r(e)},n.onsuccess=function(){var e=n.result | ||
e&&e.close(),t(e)}}) | ||
return u.then(function(e){n.db=e | ||
for(var t=0;t<r.length;t++){var o=r[t] | ||
g(o._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments") | ||
return s(n,t),n}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",D=M.length,R="arbf",T="blob",B="si08",L="ui08",F="uic8",G="si16",z="si32",U="ur16",q="ui32",K="fl32",W="fl64",V=D+R.length,J=Object.prototype.toString | ||
function H(e){var t,n,r,o,i,a=.75*e.length,s=e.length,u=0 | ||
return u.then(function(e){r.db=e | ||
for(var t=0;t<n.length;t++){var o=n[t] | ||
g(o._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else r=a.reject("Invalid arguments") | ||
return s(r,t),r}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",D=M.length,R="arbf",T="blob",B="si08",L="ui08",F="uic8",G="si16",U="si32",z="ur16",q="ui32",K="fl32",W="fl64",V=D+R.length,J=Object.prototype.toString | ||
function Q(e){var t,r,n,o,i,a=.75*e.length,s=e.length,u=0 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var c=new ArrayBuffer(a),f=new Uint8Array(c) | ||
for(t=0;t<s;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|o>>2,f[u++]=(3&o)<<6|63&i | ||
return c}function Q(e){var t,n=new Uint8Array(e),r="" | ||
for(t=0;t<n.length;t+=3)r+=N[n[t]>>2],r+=N[(3&n[t])<<4|n[t+1]>>4],r+=N[(15&n[t+1])<<2|n[t+2]>>6],r+=N[63&n[t+2]] | ||
return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var X={serialize:function(e,t){var n="" | ||
if(e&&(n=J.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var r,o=M | ||
e instanceof ArrayBuffer?(r=e,o+=R):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=L:"[object Uint8ClampedArray]"===n?o+=F:"[object Int16Array]"===n?o+=G:"[object Uint16Array]"===n?o+=U:"[object Int32Array]"===n?o+=z:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=K:"[object Float64Array]"===n?o+=W:t(Error("Failed to get type for BinaryArray"))),t(o+Q(r))}else if("[object Blob]"===n){var i=new FileReader | ||
i.onload=function(){var n=A+e.type+"~"+Q(this.result) | ||
t(M+T+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,D)!==M)return JSON.parse(e) | ||
var t,n=e.substring(V),type=e.substring(D,V) | ||
if(type===T&&k.test(n)){var r=n.match(k) | ||
t=r[1],n=n.substring(r[0].length)}var o=H(n) | ||
for(t=0;t<s;t+=4)r=N.indexOf(e[t]),n=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|o>>2,f[u++]=(3&o)<<6|63&i | ||
return c}function H(e){var t,r=new Uint8Array(e),n="" | ||
for(t=0;t<r.length;t+=3)n+=N[r[t]>>2],n+=N[(3&r[t])<<4|r[t+1]>>4],n+=N[(15&r[t+1])<<2|r[t+2]>>6],n+=N[63&r[t+2]] | ||
return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var X={serialize:function(e,t){var r="" | ||
if(e&&(r=J.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===J.call(e.buffer))){var n,o=M | ||
e instanceof ArrayBuffer?(n=e,o+=R):(n=e.buffer,"[object Int8Array]"===r?o+=B:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=G:"[object Uint16Array]"===r?o+=z:"[object Int32Array]"===r?o+=U:"[object Uint32Array]"===r?o+=q:"[object Float32Array]"===r?o+=K:"[object Float64Array]"===r?o+=W:t(Error("Failed to get type for BinaryArray"))),t(o+H(n))}else if("[object Blob]"===r){var i=new FileReader | ||
i.onload=function(){var r=A+e.type+"~"+H(this.result) | ||
t(M+T+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,D)!==M)return JSON.parse(e) | ||
var t,r=e.substring(V),type=e.substring(D,V) | ||
if(type===T&&k.test(r)){var n=r.match(k) | ||
t=n[1],r=r.substring(n[0].length)}var o=Q(r) | ||
switch(type){case R:return o | ||
@@ -286,123 +286,123 @@ case T:return i([o],{type:t}) | ||
case G:return new Int16Array(o) | ||
case U:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
case z:return new Uint16Array(o) | ||
case U:return new Int32Array(o) | ||
case q:return new Uint32Array(o) | ||
case K:return new Float32Array(o) | ||
case W:return new Float64Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
function Z(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Y(e,t,n,r,o,i){e.executeSql(n,r,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[name],function(e,s){s.rows.length?i(e,a):Z(e,t,function(){e.executeSql(n,r,o,i)},i)},i):i(e,a)},i)}var $={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null} | ||
if(e)for(var r in e)n[r]="string"!=typeof e[r]?""+e[r]:e[r] | ||
var o=new a(function(e,r){try{n.db=openDatabase(n.name,n.version+"",n.description,n.size)}catch(e){return r(e)}n.db.transaction(function(o){Z(o,n,function(){t._dbInfo=n,e()},function(e,t){r(t)})},r)}) | ||
return n.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName,[],function(n,r){for(var i=r.rows,a=i.length,s=0;s<a;s++){var u=i.item(s),c=u.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},getItem:function(e,t){var n=this | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:Q,bufferToString:H} | ||
function Z(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Y(e,t,r,n,o,i){e.executeSql(r,n,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[name],function(e,s){s.rows.length?i(e,a):Z(e,t,function(){e.executeSql(r,n,o,i)},i)},i):i(e,a)},i)}var $={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null} | ||
if(e)for(var n in e)r[n]="string"!=typeof e[n]?""+e[n]:e[n] | ||
var o=new a(function(e,n){try{r.db=openDatabase(r.name,r.version+"",r.description,r.size)}catch(e){return n(e)}r.db.transaction(function(o){Z(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)}) | ||
return r.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,s=0;s<a;s++){var u=i.item(s),c=u.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var r=n.rows.length?n.rows.item(0).value:null | ||
r&&(r=o.serializer.deserialize(r)),t(r)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},setItem:function(e,t,n){return function e(t,n,r,o){var i=this | ||
var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,r){var n=r.rows.length?r.rows.item(0).value:null | ||
n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
t=c(t) | ||
var u=new a(function(a,s){i.ready().then(function(){void 0===n&&(n=null) | ||
var u=n,c=i._dbInfo | ||
c.serializer.serialize(n,function(n,f){f?s(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,n],function(){a(u)},function(e,t){s(t)})},function(n){if(n.code===n.QUOTA_ERR){if(o>0)return void a(e.call(i,t,u,r,o-1)) | ||
s(n)}})})}).catch(s)}) | ||
return s(u,r),u}.call(this,e,t,n,1)},removeItem:function(e,t){var n=this | ||
var u=new a(function(a,s){i.ready().then(function(){void 0===r&&(r=null) | ||
var u=r,c=i._dbInfo | ||
c.serializer.serialize(r,function(r,f){f?s(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,r],function(){a(u)},function(e,t){s(t)})},function(r){if(r.code===r.QUOTA_ERR){if(o>0)return void a(e.call(i,t,u,n,o-1)) | ||
s(r)}})})}).catch(s)}) | ||
return s(u,n),u}.call(this,e,t,r,1)},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo | ||
r.db.transaction(function(t){Y(t,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,e),n},length:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo | ||
r.db.transaction(function(t){Y(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(t,n){var r=n.rows.item(0).c | ||
e(r)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Y(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){var r=n.rows.length?n.rows.item(0).key:null | ||
t(r)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){var r=t._dbInfo | ||
r.db.transaction(function(t){Y(t,r,"SELECT key FROM "+r.storeName,[],function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key) | ||
e(r)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName) | ||
var r,o=this | ||
return s(r=e.name?new a(function(t){var r | ||
r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:r,storeNames:[e.storeName]}:function(e){return new a(function(t,n){e.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name) | ||
t({db:e,storeNames:o})},function(e,t){n(t)})},function(e){n(e)})})}(r))}).then(function(e){return new a(function(t,n){e.db.transaction(function(r){function o(e){return new a(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var i=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s])) | ||
a.all(i).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):a.reject("Invalid arguments"),t),r}} | ||
function ee(e,t){var n=e.name+"/" | ||
return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function te(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var ne={_driver:"localStorageWrapper",_initStorage:function(e){var t={} | ||
if(e)for(var n in e)t[n]=e[n] | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s) | ||
if(0===u.indexOf(r)){var c=localStorage.getItem(u) | ||
var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
n.db.transaction(function(t){Y(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
n.db.transaction(function(t){Y(t,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(t,r){var n=r.rows.item(0).c | ||
e(n)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Y(r,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,r){var n=r.rows.length?r.rows.item(0).key:null | ||
t(n)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
n.db.transaction(function(t){Y(t,n,"SELECT key FROM "+n.storeName,[],function(t,r){for(var n=[],o=0;o<r.rows.length;o++)n.push(r.rows.item(o).key) | ||
e(n)},function(e,t){r(t)})})}).catch(r)}) | ||
return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
var r=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName) | ||
var n,o=this | ||
return s(n=e.name?new a(function(t){var n | ||
n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:n,storeNames:[e.storeName]}:function(e){return new a(function(t,r){e.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(r,n){for(var o=[],i=0;i<n.rows.length;i++)o.push(n.rows.item(i).name) | ||
t({db:e,storeNames:o})},function(e,t){r(t)})},function(e){r(e)})})}(n))}).then(function(e){return new a(function(t,r){e.db.transaction(function(n){function o(e){return new a(function(t,r){n.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){r(t)})})}for(var i=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s])) | ||
a.all(i).then(function(){t()}).catch(function(e){r(e)})},function(e){r(e)})})}):a.reject("Invalid arguments"),t),n}} | ||
function ee(e,t){var r=e.name+"/" | ||
return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function te(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={} | ||
if(e)for(var r in e)t[r]=e[r] | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s) | ||
if(0===u.indexOf(n)){var c=localStorage.getItem(u) | ||
if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(o),a++)))return c}}}) | ||
return s(r,t),r},getItem:function(e,t){var n=this | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=n.ready().then(function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e) | ||
return r&&(r=t.serializer.deserialize(r)),r}) | ||
return s(r,t),r},setItem:function(e,t,n){var r=this | ||
var n=r.ready().then(function(){var t=r._dbInfo,n=localStorage.getItem(t.keyPrefix+e) | ||
return n&&(n=t.serializer.deserialize(n)),n}) | ||
return s(n,t),n},setItem:function(e,t,r){var n=this | ||
e=c(e) | ||
var o=r.ready().then(function(){void 0===t&&(t=null) | ||
var n=t | ||
return new a(function(o,i){var a=r._dbInfo | ||
a.serializer.serialize(t,function(t,r){if(r)i(r) | ||
else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})}) | ||
return s(o,n),o},removeItem:function(e,t){var n=this | ||
var o=n.ready().then(function(){void 0===t&&(t=null) | ||
var r=t | ||
return new a(function(o,i){var a=n._dbInfo | ||
a.serializer.serialize(t,function(t,n){if(n)i(n) | ||
else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})}) | ||
return s(o,r),o},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var r=n.ready().then(function(){var t=n._dbInfo | ||
var n=r.ready().then(function(){var t=r._dbInfo | ||
localStorage.removeItem(t.keyPrefix+e)}) | ||
return s(r,t),r},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n) | ||
0===r.indexOf(e)&&localStorage.removeItem(r)}}) | ||
return s(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return s(t,e),t},key:function(e,t){var n=this,r=n.ready().then(function(){var t,r=n._dbInfo | ||
try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}) | ||
return s(r,t),r},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o) | ||
0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r}) | ||
return s(n,e),n},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config() | ||
e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this | ||
return s(r=e.name?new a(function(t){t(e.storeName?ee(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t) | ||
0===n.indexOf(e)&&localStorage.removeItem(n)}}):a.reject("Invalid arguments"),t),r}},re=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0 | ||
r++}var o,i | ||
return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},se={INDEXEDDB:O,WEBSQL:$,LOCALSTORAGE:ne},ue=[se.INDEXEDDB._driver,se.WEBSQL._driver,se.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:ue.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
function he(e,t){e[t]=function(){var n=arguments | ||
return e.ready().then(function(){return e[t].apply(e,n)})}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e] | ||
if(t)for(var n in t)t.hasOwnProperty(n)&&(arguments[0][n]=oe(t[n])?t[n].slice():t[n])}return arguments[0]}var ve=function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),se)if(se.hasOwnProperty(n)){var r=se[n],o=r._driver | ||
this[n]=o,ie[o]||this.defineDriver(r)}this._defaultConfig=de({},le),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return Error("Can't call config() after localforage has been used.") | ||
return s(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r) | ||
0===n.indexOf(e)&&localStorage.removeItem(n)}}) | ||
return s(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo | ||
try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}) | ||
return s(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o) | ||
0===i.indexOf(e.keyPrefix)&&n.push(i.substring(e.keyPrefix.length))}return n}) | ||
return s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config() | ||
e.name=e.name||r.name,e.storeName=e.storeName||r.storeName}var n,o=this | ||
return s(n=e.name?new a(function(t){t(e.storeName?ee(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t) | ||
0===r.indexOf(e)&&localStorage.removeItem(r)}}):a.reject("Invalid arguments"),t),n}},ne=function(e,t){for(var r=e.length,n=0;n<r;){if((o=e[n])===(i=t)||"number"==typeof o&&"number"==typeof i&&isNaN(o)&&isNaN(i))return!0 | ||
n++}var o,i | ||
return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},se={INDEXEDDB:O,WEBSQL:$,LOCALSTORAGE:re},ue=[se.INDEXEDDB._driver,se.WEBSQL._driver,se.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:ue.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
function he(e,t){e[t]=function(){var r=arguments | ||
return e.ready().then(function(){return e[t].apply(e,r)})}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e] | ||
if(t)for(var r in t)t.hasOwnProperty(r)&&(arguments[0][r]=oe(t[r])?t[r].slice():t[r])}return arguments[0]}var ve=function(){function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),se)if(se.hasOwnProperty(r)){var n=se[r],o=n._driver | ||
this[r]=o,ie[o]||this.defineDriver(n)}this._defaultConfig=de({},le),this._config=de({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return Error("Can't call config() after localforage has been used.") | ||
for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return Error("Database version must be a number.") | ||
this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a(function(t,n){try{var r=e._driver,o=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver") | ||
if(!e._driver)return void n(o) | ||
for(var i=fe.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u],l=!re(ce,f) | ||
if((l||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t) | ||
return s(n,arguments[arguments.length-1]),n}},n=0,r=ce.length;n<r;n++){var o=ce[n] | ||
this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a(function(t,r){try{var n=e._driver,o=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver") | ||
if(!e._driver)return void r(o) | ||
for(var i=fe.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u],l=!ne(ce,f) | ||
if((l||e[f])&&"function"!=typeof e[f])return void r(o)}!function(){for(var t=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t) | ||
return s(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var o=ce[r] | ||
e[o]||(e[o]=t(o))}}() | ||
var h=function(n){ie[r]&&console.info("Redefining LocalForage driver: "+r),ie[r]=e,ae[r]=n,t()} | ||
"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,n):h(!!e._support):h(!0)}catch(e){n(e)}}) | ||
return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this | ||
var h=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()} | ||
"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,r):h(!!e._support):h(!0)}catch(e){r(e)}}) | ||
return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){r._config.driver=r.driver()}function s(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
function i(){n._config.driver=n.driver()}function s(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
return this._driverSet=c.then(function(){var e=o[0] | ||
return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0 | ||
return function n(){for(;t<e.length;){var o=e[t] | ||
return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(s).catch(n)}i() | ||
return n._dbInfo=null,n._ready=null,n.getDriver(e).then(function(e){n._driver=e._driver,i(),n._wrapLibraryMethodsWithReady(),n._initDriver=function(e){return function(){var t=0 | ||
return function r(){for(;t<e.length;){var o=e[t] | ||
return t++,n._dbInfo=null,n._ready=null,n.getDriver(o).then(s).catch(r)}i() | ||
var u=Error("No available storage method found.") | ||
return r._driverSet=a.reject(u),r._driverSet}()}}(o)})}).catch(function(){i() | ||
return n._driverSet=a.reject(u),n._driverSet}()}}(o)})}).catch(function(){i() | ||
var e=Error("No available storage method found.") | ||
return r._driverSet=a.reject(e),r._driverSet}),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n] | ||
return n._driverSet=a.reject(e),n._driverSet}),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r] | ||
this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=fe.length;e<t;e++)he(this,fe[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new ve | ||
t.exports=pe},{3:3}]},{},[4])(4)}),PersistMeta_1=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n={name:"persistMeta"},r=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(n,e),this.cacheInstance=localforage.createInstance({driver:localforage.LOCALSTORAGE,name:this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e.prototype.keys=function(){return this.cacheInstance.keys()},e.prototype.length=function(){return this.cacheInstance.length()},e}() | ||
t.default=r}) | ||
var r={name:"persistMeta"},n=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(r,e),this.cacheInstance=localforage.createInstance({driver:localforage.LOCALSTORAGE,name:this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e.prototype.keys=function(){return this.cacheInstance.keys()},e.prototype.length=function(){return this.cacheInstance.length()},e}() | ||
t.default=n}) | ||
unwrapExports(PersistMeta_1) | ||
var PersistValue_1=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},r=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var PersistValue_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},n=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o | ||
switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o | ||
switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
case 5:a.label++,n=i[1],i=[0] | ||
continue | ||
@@ -416,29 +416,29 @@ case 7:i=a.ops.pop(),a.trys.pop() | ||
break}o[2]&&a.ops.pop(),a.trys.pop() | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var o={name:"persistValue"},i=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(o,e),this.cacheInstance=localforage.createInstance({driver:localforage.INDEXEDDB,name:this.cacheConfig.name,storeName:"store"+this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,n,o,i,a,s | ||
return r(this,function(r){switch(r.label){case 0:r.trys.push([0,5,,6]),t=[],n=0,o=e,r.label=1 | ||
case 1:return n<o.length?(a=(i=t).push,[4,this.get(o[n])]):[3,4] | ||
case 2:a.call(i,r.sent()),r.label=3 | ||
case 3:return n++,[3,1] | ||
var o={name:"persistValue"},i=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(o,e),this.cacheInstance=localforage.createInstance({driver:localforage.INDEXEDDB,name:this.cacheConfig.name,storeName:"store"+this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,r,o,i,a,s | ||
return n(this,function(n){switch(n.label){case 0:n.trys.push([0,5,,6]),t=[],r=0,o=e,n.label=1 | ||
case 1:return r<o.length?(a=(i=t).push,[4,this.get(o[r])]):[3,4] | ||
case 2:a.call(i,n.sent()),n.label=3 | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return s=r.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.append=function(e,t){return n(this,void 0,void 0,function(){var n,o | ||
return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.cacheInstance.getItem(e)] | ||
case 1:return(n=r.sent())?(utils.isArray(t)&&utils.isArray(n)?t=n.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(n)&&(t=utils.extend(n,t)),[2,this.set(e,t)]):[2,this.set(e,t)] | ||
case 2:return o=r.sent(),[2,Promise.reject(o)] | ||
case 5:return s=n.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.append=function(e,t){return r(this,void 0,void 0,function(){var r,o | ||
return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.cacheInstance.getItem(e)] | ||
case 1:return(r=n.sent())?(utils.isArray(t)&&utils.isArray(r)?t=r.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(r)&&(t=utils.extend(r,t)),[2,this.set(e,t)]):[2,this.set(e,t)] | ||
case 2:return o=n.sent(),[2,Promise.reject(o)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e}() | ||
t.default=i}) | ||
unwrapExports(PersistValue_1) | ||
var Persist_1=createCommonjsModule(function(e,t){var n=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]) | ||
return e},r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var Persist_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]) | ||
return e},n=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},o=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o | ||
switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.") | ||
for(;a;)try{if(r=1,n&&(o=n[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(n,i[1])).done)return o | ||
switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
case 5:a.label++,n=i[1],i=[0] | ||
continue | ||
@@ -452,69 +452,73 @@ case 7:i=a.ops.pop(),a.trys.pop() | ||
break}o[2]&&a.ops.pop(),a.trys.pop() | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var i={name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(i,e),this.metaCacheInstance=new PersistMeta_1.default({name:this.cacheConfig.name}),this.valueCacheInstance=new PersistValue_1.default({name:this.cacheConfig.name})}return e.prototype.getOldKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,i,a,s,u | ||
var i={name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(i,e),this.metaCacheInstance=new PersistMeta_1.default({name:this.cacheConfig.name}),this.valueCacheInstance=new PersistValue_1.default({name:this.cacheConfig.name})}return e.prototype.getOldKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a,s,u | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.length()] | ||
case 1:return e=o.sent(),n=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),r=[],[4,this.getSortedItems()] | ||
case 2:for(i=o.sent(),a=i.reverse(),s=0;s<a.length;s++)s<n&&r.push(a[s].key) | ||
return[2,Promise.resolve(r)] | ||
case 1:return e=o.sent(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
case 2:for(i=o.sent(),a=i.reverse(),s=0;s<a.length;s++)s<r&&n.push(a[s].key) | ||
return[2,Promise.resolve(n)] | ||
case 3:return u=o.sent(),[2,Promise.reject(u)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,i,a | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=o.sent(),n=0,r=t,o.label=2 | ||
case 2:return n<r.length?[4,this.isExpired(i=r[n])]:[3,5] | ||
case 1:t=o.sent(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isExpired(i=n[r])]:[3,5] | ||
case 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 4:return r++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return a=o.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,i,a | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=o.sent(),n=0,r=t,o.label=2 | ||
case 2:return n<r.length?[4,this.isOverLength(i=r[n])]:[3,5] | ||
case 1:t=o.sent(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isOverLength(i=n[r])]:[3,5] | ||
case 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 4:return r++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return a=o.sent(),[2,Promise.reject(a)] | ||
case 7:return[2]}})})},e.prototype.isOverLength=function(e){return r(this,void 0,void 0,function(){var t,n | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=r.sent())&&t.length&&t.length>this.cacheConfig.valueMaxLength?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return n=r.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.isExpired=function(e){return r(this,void 0,void 0,function(){var t,n | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=r.sent())&&t.expire?[2,Promise.resolve(this.expiredVaule(t.expire))]:[2,Promise.resolve(!1)] | ||
case 2:return n=r.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.get=function(e){return r(this,void 0,void 0,function(){var t,n,r | ||
case 7:return[2]}})})},e.prototype.isOverLength=function(e){return n(this,void 0,void 0,function(){var t,r | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=n.sent())&&t.length&&t.length>this.cacheConfig.valueMaxLength?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return r=n.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e.prototype.isExpired=function(e){return n(this,void 0,void 0,function(){var t,r | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return(t=n.sent())&&t.expire?[2,Promise.resolve(this.expiredVaule(t.expire))]:[2,Promise.resolve(!1)] | ||
case 2:return r=n.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e.prototype.get=function(e){return n(this,void 0,void 0,function(){var t,r,n | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),[4,this.getMeta(e)] | ||
case 1:return(t=o.sent())?void 0===t.length||void 0===t.expire||void 0===t.now||void 0===t.count?[3,4]:this.expiredVaule(t.expire)?(this.remove(e),[2,Promise.resolve(null)]):[4,this.valueCacheInstance.get(e)]:[2,Promise.resolve(null)] | ||
case 2:return n=o.sent(),[4,this.setMetaCount(e)] | ||
case 3:return o.sent(),[2,Promise.resolve(n)] | ||
case 2:return r=o.sent(),[4,this.setMeta(e)] | ||
case 3:return o.sent(),[2,Promise.resolve(r)] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return r=o.sent(),[2,Promise.reject(r)] | ||
case 6:return[2]}})})},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,n,r,i,a,s | ||
return o(this,function(o){switch(o.label){case 0:o.trys.push([0,5,,6]),t=[],n=0,r=e,o.label=1 | ||
case 1:return n<r.length?(a=(i=t).push,[4,this.get(r[n])]):[3,4] | ||
case 5:return n=o.sent(),[2,Promise.reject(n)] | ||
case 6:return[2]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a,s | ||
return o(this,function(o){switch(o.label){case 0:o.trys.push([0,5,,6]),t=[],r=0,n=e,o.label=1 | ||
case 1:return r<n.length?(a=(i=t).push,[4,this.get(n[r])]):[3,4] | ||
case 2:a.call(i,o.sent()),o.label=3 | ||
case 3:return n++,[3,1] | ||
case 3:return r++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return s=o.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,n){return void 0===n&&(n=-1),r(this,void 0,void 0,function(){var r,i | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getMeta(e)] | ||
case 1:return!(r=o.sent())||r.length||r.expire||r.count||r.now?[4,this.setMeta(e,t,n)]:[2,this.metaCacheInstance.set(e,t)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,r){return void 0===r&&(r=-1),n(this,void 0,void 0,function(){var n,i | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,6]),[4,this.getMeta(e)] | ||
case 1:return!(n=o.sent())||n.length||n.expire||n.count||n.now?[4,this.setMeta(e,t,r)]:[2,this.metaCacheInstance.set(e,t)] | ||
case 2:return o.sent(),[2,this.valueCacheInstance.set(e,t)] | ||
case 3:return i=o.sent(),[2,Promise.reject(i)] | ||
case 4:return[2]}})})},e.prototype.append=function(e,t,n){return void 0===n&&(n=-1),r(this,void 0,void 0,function(){var r,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getMeta(e)] | ||
case 1:return(r=o.sent())?(n=n||r.expire,i=this.valueCacheInstance.append(e,t),[4,this.setMeta(e,i,n)]):[2,this.set(e,t,n)] | ||
case 3:return(i=o.sent()).name.toUpperCase().indexOf("QUOTA")>=0?[4,this.clearKeys()]:[3,5] | ||
case 4:return o.sent(),[2,Promise.resolve(null)] | ||
case 5:return[2,Promise.reject(i)] | ||
case 6:return[2]}})})},e.prototype.append=function(e,t,r){return void 0===r&&(r=-1),n(this,void 0,void 0,function(){var n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,6]),[4,this.getMeta(e)] | ||
case 1:return(n=o.sent())?(r=r||n.expire,i=this.valueCacheInstance.append(e,t),[4,this.setMeta(e,i,r)]):[2,this.set(e,t,r)] | ||
case 2:return o.sent(),[2,Promise.resolve(i)] | ||
case 3:return a=o.sent(),[2,Promise.reject(a)] | ||
case 4:return[2]}})})},e.prototype.has=function(e){return r(this,void 0,void 0,function(){var t | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return n.sent()?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return t=n.sent(),[2,Promise.reject(t)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return r(this,void 0,void 0,function(){var t | ||
return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.metaCacheInstance.remove(e)] | ||
case 1:return n.sent(),[4,this.valueCacheInstance.remove(e)] | ||
case 2:return n.sent(),[2,Promise.resolve()] | ||
case 3:return t=n.sent(),[2,Promise.reject(t)] | ||
case 4:return[2]}})})},e.prototype.clear=function(){return r(this,void 0,void 0,function(){var e | ||
case 3:return(a=o.sent()).name.toUpperCase().indexOf("QUOTA")>=0?[4,this.clearKeys()]:[3,5] | ||
case 4:return o.sent(),[2,Promise.resolve(null)] | ||
case 5:return[2,Promise.reject(a)] | ||
case 6:return[2]}})})},e.prototype.has=function(e){return n(this,void 0,void 0,function(){var t | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return r.sent()?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return t=r.sent(),[2,Promise.reject(t)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return n(this,void 0,void 0,function(){var t | ||
return o(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.metaCacheInstance.remove(e)] | ||
case 1:return r.sent(),[4,this.valueCacheInstance.remove(e)] | ||
case 2:return r.sent(),[2,Promise.resolve()] | ||
case 3:return t=r.sent(),[2,Promise.reject(t)] | ||
case 4:return[2]}})})},e.prototype.clear=function(){return n(this,void 0,void 0,function(){var e | ||
return o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.metaCacheInstance.clear()] | ||
@@ -524,17 +528,17 @@ case 1:return t.sent(),[4,this.valueCacheInstance.clear()] | ||
case 3:return e=t.sent(),[2,Promise.reject(e)] | ||
case 4:return[2]}})})},e.prototype.keys=function(){return this.metaCacheInstance.keys()},e.prototype.length=function(){return this.metaCacheInstance.length()},e.prototype.each=function(e){return r(this,void 0,void 0,function(){var t,n,r,i,a | ||
case 4:return[2]}})})},e.prototype.keys=function(){return this.metaCacheInstance.keys()},e.prototype.length=function(){return this.metaCacheInstance.length()},e.prototype.each=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,7,,8]),[4,this.keys()] | ||
case 1:t=o.sent(),n=0,o.label=2 | ||
case 2:return n<t.length?[4,this.get(r=t[n])]:[3,6] | ||
case 3:return i=o.sent(),e?[4,e(i,r,n)]:[3,5] | ||
case 1:t=o.sent(),r=0,o.label=2 | ||
case 2:return r<t.length?[4,this.get(n=t[r])]:[3,6] | ||
case 3:return i=o.sent(),e?[4,e(i,n,r)]:[3,5] | ||
case 4:o.sent(),o.label=5 | ||
case 5:return n++,[3,2] | ||
case 5:return r++,[3,2] | ||
case 6:return[2,Promise.resolve(!0)] | ||
case 7:return a=o.sent(),[2,Promise.reject(a)] | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return r(this,void 0,void 0,function(){var e,t,r,i,a,s,u,c,f,l,h,d,v,p,y,m | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return n(this,void 0,void 0,function(){var e,t,n,i,a,s,u,c,f,l,h,d,v,p,y,m | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),[4,this.keys()] | ||
case 1:e=o.sent(),t=[],r=0,i=e,o.label=2 | ||
case 2:return r<i.length?[4,this.getMeta(a=i[r])]:[3,5] | ||
case 3:s=o.sent(),t.push(n({},s,{key:a})),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 1:e=o.sent(),t=[],n=0,i=e,o.label=2 | ||
case 2:return n<i.length?[4,this.getMeta(a=i[n])]:[3,5] | ||
case 3:s=o.sent(),t.push(r({},s,{key:a})),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 5:for(u={},c=0,f=t;c<f.length;c++)u[(l=f[c]).count]||(u[l.count]=[]),u[l.count].push(l) | ||
@@ -546,15 +550,21 @@ for(d in h=[],u)u.hasOwnProperty(d)&&h.push({count:parseInt(d,10),items:u[d].sort(function(e,t){return t.now-e.now})}) | ||
case 7:return[2]}})})},e.prototype.expiredVaule=function(e){var t=(new Date).getTime() | ||
return e&&e>0&&e<t},e.prototype.setMetaCount=function(e){return r(this,void 0,void 0,function(){var t,r,i,a,s,u | ||
return e&&e>0&&e<t},e.prototype.setMeta=function(e,t,i){return void 0===t&&(t=""),void 0===i&&(i=-1),n(this,void 0,void 0,function(){var n,a,s,u,c,f,l | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return t=o.sent(),r=(new Date).getTime(),i=0,t&&void 0!==t.count&&(i=t.count+1),a=n({},t,{now:r,count:i}),s=this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(JSON.stringify(a)):JSON.stringify(a),[2,this.metaCacheInstance.set(e,s)] | ||
case 2:return u=o.sent(),[2,Promise.reject(u)] | ||
case 3:return[2]}})})},e.prototype.setMeta=function(e,t,n){return void 0===n&&(n=-1),r(this,void 0,void 0,function(){var r,i,a,s,u,c,f,l | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return r=o.sent(),i=(new Date).getTime(),void 0,s=utils.utf16ByteLength(JSON.stringify(t)),u=void 0,u=utils.isDate(n)?n.getTime():utils.isNumber(n)&&n>0?i+1e3*n:-1,c=0,r&&r.count&&(c=r.count+1),a={now:i,length:s,count:c,expire:u},f=this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(JSON.stringify(a)):JSON.stringify(a),[2,this.metaCacheInstance.set(e,f)] | ||
case 1:return n=o.sent(),a=(new Date).getTime(),s=void 0,s=utils.isDate(i)?i.getTime():utils.isNumber(i)&&i>0?a+1e3*i:-1,u=0,n&&void 0!==n.count&&(u=n.count+1),c=void 0,c=t?{length:utils.utf16ByteLength(JSON.stringify(t)),now:a,count:u,expire:s}:r({},n,{now:a,count:u}),f=this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(JSON.stringify(c)):JSON.stringify(c),[2,this.metaCacheInstance.set(e,f)] | ||
case 2:return l=o.sent(),[2,Promise.reject(l)] | ||
case 3:return[2]}})})},e.prototype.getMeta=function(e){return r(this,void 0,void 0,function(){var t,n,r | ||
case 3:return[2]}})})},e.prototype.getMeta=function(e){return n(this,void 0,void 0,function(){var t,r,n | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.metaCacheInstance.get(e)] | ||
case 1:return t=o.sent(),n=null,null!=t&&(n=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(t):t)),[2,Promise.resolve(n)] | ||
case 2:return r=o.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e}() | ||
case 1:return t=o.sent(),r=null,null!=t&&(r=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(t):t)),[2,Promise.resolve(r)] | ||
case 2:return n=o.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.clearKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a,s,u | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,8,,9]),[4,this.getExpiredKeys()] | ||
case 1:return e=o.sent(),r=(t=e).concat,[4,this.getOverLengthKeys()] | ||
case 2:return r.call(t,o.sent()),i=(n=e).concat,[4,this.getOldKeys()] | ||
case 3:i.call(n,o.sent()),e=e.sort().filter(function(e,t,r){return!t||e!==r[t-1]}),a=0,s=e,o.label=4 | ||
case 4:return a<s.length?[4,this.remove(s[a])]:[3,7] | ||
case 5:o.sent(),o.label=6 | ||
case 6:return a++,[3,4] | ||
case 7:return[2,Promise.resolve(!0)] | ||
case 8:return u=o.sent(),[2,Promise.reject(u)] | ||
case 9:return[2]}})})},e}() | ||
t.default=a}) | ||
@@ -561,0 +571,0 @@ unwrapExports(Persist_1) |
@@ -17,3 +17,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Mycache={})}(this,function(e){"use strict" | ||
r(i) | ||
var a=o(function(e,n){var r=t&&t.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function c(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,c)}u((r=r.apply(e,t||[])).next())})},o=t&&t.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
var a=o(function(e,n){var r=t&&t.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,c)}s((r=r.apply(e,t||[])).next())})},o=t&&t.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
@@ -70,22 +70,22 @@ return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
var n=String.fromCharCode,r=function(e){return{v:e,d:{}}},o=function(e){return n(e+32)},i=function(e,t,n){if(null==e)return[] | ||
var o,i=0,a=0,c=0,u={},s=!0,f=0,l=r(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
var o,i=0,a=0,c=0,s={},u=!0,f=0,l=r(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(c=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=c>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(c=8+8*c,i=0;i<c;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(u[f]=l,a=1;a<e.length;a++)if(f=e.charCodeAt(a),o=l.d[f])l=o | ||
else{if(s)s=!1 | ||
for(s[f]=l,a=1;a<e.length;a++)if(f=e.charCodeAt(a),o=l.d[f])l=o | ||
else{if(u)u=!1 | ||
else for(c=l.v,i=0;i<v;i++)y=c>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),c=f<256?0:1,i=0;i<v;i++)y=c>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===s[f]){for(0==--h&&(h=1<<v++),c=f<256?0:1,i=0;i<v;i++)y=c>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(c=8+8*c,i=0;i<c;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
u[f]=r(d++),s=!0}l.d[f]=r(d++),0==--h&&(h=1<<v++),l=u[f]}if(s)s=!1 | ||
s[f]=r(d++),u=!0}l.d[f]=r(d++),0==--h&&(h=1<<v++),l=s[f]}if(u)u=!1 | ||
else for(c=l.v,i=0;i<v;i++)y=c>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),c=f<256?0:1,i=0;i<v;i++)y=c>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
if(void 0===s[f]){for(0==--h&&(h=1<<v++),c=f<256?0:1,i=0;i<v;i++)y=c>>i|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
for(c=8+8*c,i=0;i<c;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++m===t&&(m=0,p.push(n(y)),y=0) | ||
return p.push(n(y<<=t-m)),p},a=function(e,t,r){for(var o=["","",""],i=4,a=4,c=3,u="",s=[],f=0,l=2,h=0,d="",v=r(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
return p.push(n(y<<=t-m)),p},a=function(e,t,r){for(var o=["","",""],i=4,a=4,c=3,s="",u=[],f=0,l=2,h=0,d="",v=r(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
if(2===f)return"" | ||
for(l=8*f+8,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
for(d=n(f),o[3]=d,s.push(d);y<=e;){for(l=c,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
for(d=n(f),o[3]=d,u.push(d);y<=e;){for(l=c,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
if(f<2){for(l=8+8*f,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=r(y++)) | ||
o[a]=n(f),f=a++,0==--i&&(i=1<<c++)}else if(2===f)return s.join("") | ||
o[a]=n(f),f=a++,0==--i&&(i=1<<c++)}else if(2===f)return u.join("") | ||
if(f>o.length)return null | ||
u=f<o.length?o[f]:d+d.charAt(0),s.push(u),o[a++]=d+u.charAt(0),d=u,0==--i&&(i=1<<c++)}return""},c=function(e){return i(e,16,function(e){return n(e)})} | ||
s=f<o.length?o[f]:d+d.charAt(0),u.push(s),o[a++]=d+s.charAt(0),d=s,0==--i&&(i=1<<c++)}return""},c=function(e){return i(e,16,function(e){return n(e)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
@@ -95,4 +95,4 @@ var t=i(e,15,o) | ||
r(c) | ||
var u=o(function(e,r){e.exports=function e(t,r,o){function i(c,u){if(!r[c]){if(!t[c]){var s=n | ||
if(!u&&s)return s(c,!0) | ||
var s=o(function(e,r){e.exports=function e(t,r,o){function i(c,s){if(!r[c]){if(!t[c]){var u=n | ||
if(!s&&u)return u(c,!0) | ||
if(a)return a(c,!0) | ||
@@ -107,11 +107,11 @@ var f=Error("Cannot find module '"+c+"'") | ||
t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)} | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,t=function(){u.port2.postMessage(0)}}var s=[] | ||
else{var s=new e.MessageChannel | ||
s.port1.onmessage=f,t=function(){s.port2.postMessage(0)}}var u=[] | ||
function f(){var e,t | ||
r=!0 | ||
for(var n=s.length;n;){for(t=s,s=[],e=-1;++e<n;)t[e]() | ||
n=s.length}r=!1}n.exports=function(e){1!==s.push(e)||r||t()}}(void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1) | ||
function o(){}var i={},a=["REJECTED"],c=["FULFILLED"],u=["PENDING"] | ||
function s(e){if("function"!=typeof e)throw new TypeError("resolver must be a function") | ||
this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r(function(){var r | ||
for(var n=u.length;n;){for(t=u,u=[],e=-1;++e<n;)t[e]() | ||
n=u.length}r=!1}n.exports=function(e){1!==u.push(e)||r||t()}}(void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var r=e(1) | ||
function o(){}var i={},a=["REJECTED"],c=["FULFILLED"],s=["PENDING"] | ||
function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function") | ||
this.state=s,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r(function(){var r | ||
try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)})}function h(e){var t=e&&e.then | ||
@@ -121,5 +121,5 @@ if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var n=!1 | ||
"error"===a.status&&r(a.value)}function v(e,t){var n={} | ||
try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=s,s.prototype.catch=function(e){return this.then(null,e)},s.prototype.then=function(e,t){if("function"!=typeof e&&this.state===c||"function"!=typeof t&&this.state===a)return this | ||
try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===c||"function"!=typeof t&&this.state===a)return this | ||
var n=new this.constructor(o) | ||
if(this.state!==u){var r=this.state===c?e:t | ||
if(this.state!==s){var r=this.state===c?e:t | ||
l(n,r,this.outcome)}else this.queue.push(new f(n,e,t)) | ||
@@ -133,10 +133,10 @@ return n},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=v(h,t) | ||
for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t) | ||
return e},s.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},s.reject=function(e){var t=new this(o) | ||
return i.reject(t,e)},s.all=function(e){var t=this | ||
return e},u.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},u.reject=function(e){var t=new this(o) | ||
return i.reject(t,e)},u.all=function(e){var t=this | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var n=e.length,r=!1 | ||
if(!n)return this.resolve([]) | ||
for(var a=Array(n),c=0,u=-1,s=new this(o);++u<n;)f(e[u],u) | ||
return s | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++c!==n||r||(r=!0,i.resolve(s,a))},function(e){r||(r=!0,i.reject(s,e))})}},s.race=function(e){var t=this | ||
for(var a=Array(n),c=0,s=-1,u=new this(o);++s<n;)f(e[s],s) | ||
return u | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++c!==n||r||(r=!0,i.resolve(u,a))},function(e){r||(r=!0,i.reject(u,e))})}},u.race=function(e){var t=this | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
@@ -157,3 +157,3 @@ var n=e.length,r=!1 | ||
var a=Promise | ||
function c(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function s(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function c(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function m(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var n=e.transaction(l,y),r=i([""]) | ||
@@ -175,5 +175,5 @@ n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//) | ||
return n}(atob(e.data)) | ||
return i([t],{type:e.type})}function E(e){return e&&e.__local_forage_encoded_blob}function x(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
return i([t],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return u(n,e,e),n}function O(e,t,n,r){void 0===r&&(r=1) | ||
return s(n,e,e),n}function O(e,t,n,r){void 0===r&&(r=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
@@ -187,6 +187,6 @@ n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),j(e)}).then(function(){return function(e){b(e) | ||
var o=d[n.name] | ||
o||(d[n.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=x) | ||
o||(d[n.name]=o={forages:[],db:null,dbReady:null,deferredOperations:[]}),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E) | ||
var i=[] | ||
function c(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var s=o.forages[u] | ||
s!==t&&i.push(s._initReady().catch(c))}var f=o.forages.slice(0) | ||
function c(){return a.resolve()}for(var s=0;s<o.forages.length;s++){var u=o.forages[s] | ||
u!==t&&i.push(u._initReady().catch(c))}var f=o.forages.slice(0) | ||
return a.all(i).then(function(){return n.db=o.db,I(n)}).then(function(e){return n.db=e,S(n,t._defaultConfig.version)?j(n):e}).then(function(e){n.db=o.db=e,t._dbInfo=n | ||
@@ -197,16 +197,16 @@ for(var r=0;r<f.length;r++){var i=f[r] | ||
return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),c=a.openCursor(),u=1 | ||
try{var a=i.objectStore(n._dbInfo.storeName),c=a.openCursor(),s=1 | ||
c.onsuccess=function(){var n=c.result | ||
if(n){var r=n.value | ||
E(r)&&(r=P(r)) | ||
var o=e(r,n.key,u++) | ||
x(r)&&(r=P(r)) | ||
var o=e(r,n.key,s++) | ||
void 0!==o?t(o):n.continue()}else t()},c.onerror=function(){r(c.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return c(r,t),r},getItem:function(e,t){var n=this | ||
e=s(e) | ||
e=u(e) | ||
var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),c=a.get(e) | ||
c.onsuccess=function(){var e=c.result | ||
void 0===e&&(e=null),E(e)&&(e=P(e)),t(e)},c.onerror=function(){r(c.error)}}catch(e){r(e)}})}).catch(r)}) | ||
void 0===e&&(e=null),x(e)&&(e=P(e)),t(e)},c.onerror=function(){r(c.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return c(r,t),r},setItem:function(e,t,n){var r=this | ||
e=s(e) | ||
e=u(e) | ||
var o=new a(function(n,o){var i | ||
@@ -219,7 +219,7 @@ r.ready().then(function(){return i=r._dbInfo,"[object Blob]"===v.call(t)?m(i.db).then(function(e){return e?t:(n=t,new a(function(e,t){var r=new FileReader | ||
null===t&&(t=void 0) | ||
var u=c.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error | ||
var s=c.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=s.error?s.error:s.transaction.error | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return c(o,n),o},removeItem:function(e,t){var n=this | ||
e=s(e) | ||
e=u(e) | ||
var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o) | ||
@@ -237,5 +237,5 @@ try{var a=i.objectStore(n._dbInfo.storeName),c=a.delete(e) | ||
return c(n,e),n},key:function(e,t){var n=this,r=new a(function(t,r){e<0?t(null):n.ready().then(function(){O(n._dbInfo,p,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),c=!1,u=a.openCursor() | ||
u.onsuccess=function(){var n=u.result | ||
n?0===e?t(n.key):c?t(n.key):(c=!0,n.advance(e)):t(null)},u.onerror=function(){r(u.error)}}catch(e){r(e)}})}).catch(r)}) | ||
try{var a=i.objectStore(n._dbInfo.storeName),c=!1,s=a.openCursor() | ||
s.onsuccess=function(){var n=s.result | ||
n?0===e?t(n.key):c?t(n.key):(c=!0,n.advance(e)):t(null)},s.onerror=function(){r(s.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return c(r,t),r},keys:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,p,function(r,o){if(r)return n(r) | ||
@@ -247,12 +247,12 @@ try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),c=[] | ||
var n,r=this.config() | ||
if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var i=e.name===r.name&&this._dbInfo.db,u=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var n=d[e.name],r=n.forages | ||
if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var i=e.name===r.name&&this._dbInfo.db,s=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var n=d[e.name],r=n.forages | ||
n.db=t | ||
for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t | ||
return t}) | ||
n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
n=s.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
b(e) | ||
var r=d[e.name],i=r.forages | ||
t.close() | ||
for(var c=0;c<i.length;c++){var u=i[c] | ||
u._dbInfo.db=null,u._dbInfo.version=n}var s=new a(function(t,r){var i=o.open(e.name,n) | ||
for(var c=0;c<i.length;c++){var s=i[c] | ||
s._dbInfo.db=null,s._dbInfo.version=n}var u=new a(function(t,r){var i=o.open(e.name,n) | ||
i.onerror=function(e){var t=i.result | ||
@@ -262,3 +262,3 @@ t.close(),r(e)},i.onupgradeneeded=function(){var t=i.result | ||
e.close(),t(e)}}) | ||
return s.then(function(e){r.db=e | ||
return u.then(function(e){r.db=e | ||
for(var t=0;t<i.length;t++){var n=i[t] | ||
@@ -269,36 +269,36 @@ n._dbInfo.db=e,g(n._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})}}:function(t){b(e) | ||
for(var i=0;i<r.length;i++){var c=r[i] | ||
c._dbInfo.db=null}var u=new a(function(t,n){var r=o.deleteDatabase(e.name) | ||
c._dbInfo.db=null}var s=new a(function(t,n){var r=o.deleteDatabase(e.name) | ||
r.onerror=r.onblocked=function(e){var t=r.result | ||
t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result | ||
e&&e.close(),t(e)}}) | ||
return u.then(function(e){n.db=e | ||
return s.then(function(e){n.db=e | ||
for(var t=0;t<r.length;t++){var o=r[t] | ||
g(o._dbInfo)}}).catch(function(t){throw(_(e,t)||a.resolve()).catch(function(){}),t})})}else n=a.reject("Invalid arguments") | ||
return c(n,t),n}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",T=D.length,M="arbf",R="blob",B="si08",F="ui08",L="uic8",z="si16",U="si32",q="ur16",K="ui32",W="fl32",J="fl64",G=T+M.length,V=Object.prototype.toString | ||
function H(e){var t,n,r,o,i,a=.75*e.length,c=e.length,u=0 | ||
return c(n,t),n}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",T=D.length,R="arbf",M="blob",B="si08",L="ui08",F="uic8",U="si16",z="si32",K="ur16",q="ui32",W="fl32",G="fl64",J=T+R.length,Q=Object.prototype.toString | ||
function V(e){var t,n,r,o,i,a=.75*e.length,c=e.length,s=0 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var s=new ArrayBuffer(a),f=new Uint8Array(s) | ||
for(t=0;t<c;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|o>>2,f[u++]=(3&o)<<6|63&i | ||
return s}function Q(e){var t,n=new Uint8Array(e),r="" | ||
var u=new ArrayBuffer(a),f=new Uint8Array(u) | ||
for(t=0;t<c;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[s++]=n<<2|r>>4,f[s++]=(15&r)<<4|o>>2,f[s++]=(3&o)<<6|63&i | ||
return u}function H(e){var t,n=new Uint8Array(e),r="" | ||
for(t=0;t<n.length;t+=3)r+=N[n[t]>>2],r+=N[(3&n[t])<<4|n[t+1]>>4],r+=N[(15&n[t+1])<<2|n[t+2]>>6],r+=N[63&n[t+2]] | ||
return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var X={serialize:function(e,t){var n="" | ||
if(e&&(n=V.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===V.call(e.buffer))){var r,o=D | ||
e instanceof ArrayBuffer?(r=e,o+=M):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=F:"[object Uint8ClampedArray]"===n?o+=L:"[object Int16Array]"===n?o+=z:"[object Uint16Array]"===n?o+=q:"[object Int32Array]"===n?o+=U:"[object Uint32Array]"===n?o+=K:"[object Float32Array]"===n?o+=W:"[object Float64Array]"===n?o+=J:t(Error("Failed to get type for BinaryArray"))),t(o+Q(r))}else if("[object Blob]"===n){var i=new FileReader | ||
i.onload=function(){var n=A+e.type+"~"+Q(this.result) | ||
t(D+R+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,T)!==D)return JSON.parse(e) | ||
var t,n=e.substring(G),type=e.substring(T,G) | ||
if(type===R&&k.test(n)){var r=n.match(k) | ||
t=r[1],n=n.substring(r[0].length)}var o=H(n) | ||
switch(type){case M:return o | ||
case R:return i([o],{type:t}) | ||
if(e&&(n=Q.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===Q.call(e.buffer))){var r,o=D | ||
e instanceof ArrayBuffer?(r=e,o+=R):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=L:"[object Uint8ClampedArray]"===n?o+=F:"[object Int16Array]"===n?o+=U:"[object Uint16Array]"===n?o+=K:"[object Int32Array]"===n?o+=z:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=W:"[object Float64Array]"===n?o+=G:t(Error("Failed to get type for BinaryArray"))),t(o+H(r))}else if("[object Blob]"===n){var i=new FileReader | ||
i.onload=function(){var n=A+e.type+"~"+H(this.result) | ||
t(D+M+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,T)!==D)return JSON.parse(e) | ||
var t,n=e.substring(J),type=e.substring(T,J) | ||
if(type===M&&k.test(n)){var r=n.match(k) | ||
t=r[1],n=n.substring(r[0].length)}var o=V(n) | ||
switch(type){case R:return o | ||
case M:return i([o],{type:t}) | ||
case B:return new Int8Array(o) | ||
case F:return new Uint8Array(o) | ||
case L:return new Uint8ClampedArray(o) | ||
case z:return new Int16Array(o) | ||
case q:return new Uint16Array(o) | ||
case U:return new Int32Array(o) | ||
case K:return new Uint32Array(o) | ||
case L:return new Uint8Array(o) | ||
case F:return new Uint8ClampedArray(o) | ||
case U:return new Int16Array(o) | ||
case K:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
case q:return new Uint32Array(o) | ||
case W:return new Float32Array(o) | ||
case J:return new Float64Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
case G:return new Float64Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:V,bufferToString:H} | ||
function Y(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Z(e,t,n,r,o,i){e.executeSql(n,r,o,function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[name],function(e,c){c.rows.length?i(e,a):Y(e,t,function(){e.executeSql(n,r,o,i)},i)},i):i(e,a)},i)}var $={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null} | ||
@@ -308,6 +308,6 @@ if(e)for(var r in e)n[r]="string"!=typeof e[r]?""+e[r]:e[r] | ||
return n.serializer=X,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Z(n,o,"SELECT * FROM "+o.storeName,[],function(n,r){for(var i=r.rows,a=i.length,c=0;c<a;c++){var u=i.item(c),s=u.value | ||
if(s&&(s=o.serializer.deserialize(s)),void 0!==(s=e(s,u.key,c+1)))return void t(s)}t()},function(e,t){r(t)})})}).catch(r)}) | ||
o.db.transaction(function(n){Z(n,o,"SELECT * FROM "+o.storeName,[],function(n,r){for(var i=r.rows,a=i.length,c=0;c<a;c++){var s=i.item(c),u=s.value | ||
if(u&&(u=o.serializer.deserialize(u)),void 0!==(u=e(u,s.key,c+1)))return void t(u)}t()},function(e,t){r(t)})})}).catch(r)}) | ||
return c(r,t),r},getItem:function(e,t){var n=this | ||
e=s(e) | ||
e=u(e) | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
@@ -317,9 +317,9 @@ o.db.transaction(function(n){Z(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var r=n.rows.length?n.rows.item(0).value:null | ||
return c(r,t),r},setItem:function(e,t,n){return function e(t,n,r,o){var i=this | ||
t=s(t) | ||
var u=new a(function(a,c){i.ready().then(function(){void 0===n&&(n=null) | ||
var u=n,s=i._dbInfo | ||
s.serializer.serialize(n,function(n,f){f?c(f):s.db.transaction(function(e){Z(e,s,"INSERT OR REPLACE INTO "+s.storeName+" (key, value) VALUES (?, ?)",[t,n],function(){a(u)},function(e,t){c(t)})},function(n){if(n.code===n.QUOTA_ERR){if(o>0)return void a(e.call(i,t,u,r,o-1)) | ||
t=u(t) | ||
var s=new a(function(a,c){i.ready().then(function(){void 0===n&&(n=null) | ||
var s=n,u=i._dbInfo | ||
u.serializer.serialize(n,function(n,f){f?c(f):u.db.transaction(function(e){Z(e,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[t,n],function(){a(s)},function(e,t){c(t)})},function(n){if(n.code===n.QUOTA_ERR){if(o>0)return void a(e.call(i,t,s,r,o-1)) | ||
c(n)}})})}).catch(c)}) | ||
return c(u,r),u}.call(this,e,t,n,1)},removeItem:function(e,t){var n=this | ||
e=s(e) | ||
return c(s,r),s}.call(this,e,t,n,1)},removeItem:function(e,t){var n=this | ||
e=u(e) | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
@@ -343,3 +343,3 @@ o.db.transaction(function(n){Z(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)}) | ||
r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:r,storeNames:[e.storeName]}:function(e){return new a(function(t,n){e.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name) | ||
t({db:e,storeNames:o})},function(e,t){n(t)})},function(e){n(e)})})}(r))}).then(function(e){return new a(function(t,n){e.db.transaction(function(r){function o(e){return new a(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var i=[],c=0,u=e.storeNames.length;c<u;c++)i.push(o(e.storeNames[c])) | ||
t({db:e,storeNames:o})},function(e,t){n(t)})},function(e){n(e)})})}(r))}).then(function(e){return new a(function(t,n){e.db.transaction(function(r){function o(e){return new a(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var i=[],c=0,s=e.storeNames.length;c<s;c++)i.push(o(e.storeNames[c])) | ||
a.all(i).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):a.reject("Invalid arguments"),t),r}} | ||
@@ -349,11 +349,11 @@ function ee(e,t){var n=e.name+"/" | ||
if(e)for(var n in e)t[n]=e[n] | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,c=0;c<i;c++){var u=localStorage.key(c) | ||
if(0===u.indexOf(r)){var s=localStorage.getItem(u) | ||
if(s&&(s=t.serializer.deserialize(s)),void 0!==(s=e(s,u.substring(o),a++)))return s}}}) | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,c=0;c<i;c++){var s=localStorage.key(c) | ||
if(0===s.indexOf(r)){var u=localStorage.getItem(s) | ||
if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,s.substring(o),a++)))return u}}}) | ||
return c(r,t),r},getItem:function(e,t){var n=this | ||
e=s(e) | ||
e=u(e) | ||
var r=n.ready().then(function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e) | ||
return r&&(r=t.serializer.deserialize(r)),r}) | ||
return c(r,t),r},setItem:function(e,t,n){var r=this | ||
e=s(e) | ||
e=u(e) | ||
var o=r.ready().then(function(){void 0===t&&(t=null) | ||
@@ -365,3 +365,3 @@ var n=t | ||
return c(o,n),o},removeItem:function(e,t){var n=this | ||
e=s(e) | ||
e=u(e) | ||
var r=n.ready().then(function(){var t=n._dbInfo | ||
@@ -381,3 +381,3 @@ localStorage.removeItem(t.keyPrefix+e)}) | ||
r++}var o,i | ||
return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ce={INDEXEDDB:C,WEBSQL:$,LOCALSTORAGE:ne},ue=[ce.INDEXEDDB._driver,ce.WEBSQL._driver,ce.LOCALSTORAGE._driver],se=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(se),le={description:"",driver:ue.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
return!1},oe=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ie={},ae={},ce={INDEXEDDB:C,WEBSQL:$,LOCALSTORAGE:ne},se=[ce.INDEXEDDB._driver,ce.WEBSQL._driver,ce.LOCALSTORAGE._driver],ue=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ue),le={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
function he(e,t){e[t]=function(){var n=arguments | ||
@@ -390,29 +390,29 @@ return e.ready().then(function(){return e[t].apply(e,n)})}}function de(){for(var e=1;e<arguments.length;e++){var t=arguments[e] | ||
if(!e._driver)return void n(o) | ||
for(var i=fe.concat("_initStorage"),u=0,s=i.length;u<s;u++){var f=i[u],l=!re(se,f) | ||
for(var i=fe.concat("_initStorage"),s=0,u=i.length;s<u;s++){var f=i[s],l=!re(ue,f) | ||
if((l||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t) | ||
return c(n,arguments[arguments.length-1]),n}},n=0,r=se.length;n<r;n++){var o=se[n] | ||
return c(n,arguments[arguments.length-1]),n}},n=0,r=ue.length;n<r;n++){var o=ue[n] | ||
e[o]||(e[o]=t(o))}}() | ||
var h=function(n){ie[r]&&console.info("Redefining LocalForage driver: "+r),ie[r]=e,ae[r]=n,t()} | ||
"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,n):h(!!e._support):h(!0)}catch(e){n(e)}}) | ||
return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this | ||
return s(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return s(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return s(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return s(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){r._config.driver=r.driver()}function c(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var s=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
return this._driverSet=s.then(function(){var e=o[0] | ||
function i(){r._config.driver=r.driver()}function c(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var u=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
return this._driverSet=u.then(function(){var e=o[0] | ||
return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0 | ||
return function n(){for(;t<e.length;){var o=e[t] | ||
return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(c).catch(n)}i() | ||
var u=Error("No available storage method found.") | ||
return r._driverSet=a.reject(u),r._driverSet}()}}(o)})}).catch(function(){i() | ||
var s=Error("No available storage method found.") | ||
return r._driverSet=a.reject(s),r._driverSet}()}}(o)})}).catch(function(){i() | ||
var e=Error("No available storage method found.") | ||
return r._driverSet=a.reject(e),r._driverSet}),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n] | ||
return r._driverSet=a.reject(e),r._driverSet}),s(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n] | ||
this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=fe.length;e<t;e++)he(this,fe[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),pe=new ve | ||
t.exports=pe},{3:3}]},{},[4])(4)}),s=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n={name:"persistMeta"},r=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(n,e),this.cacheInstance=u.createInstance({driver:u.LOCALSTORAGE,name:this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e.prototype.keys=function(){return this.cacheInstance.keys()},e.prototype.length=function(){return this.cacheInstance.length()},e}() | ||
t.exports=pe},{3:3}]},{},[4])(4)}),u=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
var n={name:"persistMeta"},r=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(n,e),this.cacheInstance=s.createInstance({driver:s.LOCALSTORAGE,name:this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.set=function(e,t){return this.cacheInstance.setItem(e,t)},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e.prototype.keys=function(){return this.cacheInstance.keys()},e.prototype.length=function(){return this.cacheInstance.length()},e}() | ||
t.default=r}) | ||
r(s) | ||
var f=o(function(e,n){var r=t&&t.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function c(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,c)}u((r=r.apply(e,t||[])).next())})},o=t&&t.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
r(u) | ||
var f=o(function(e,n){var r=t&&t.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,c)}s((r=r.apply(e,t||[])).next())})},o=t&&t.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
@@ -437,3 +437,3 @@ return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
Object.defineProperty(n,"__esModule",{value:!0}) | ||
var a={name:"persistValue"},c=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(a,e),this.cacheInstance=u.createInstance({driver:u.INDEXEDDB,name:this.cacheConfig.name,storeName:"store"+this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,n,r,i,a,c | ||
var a={name:"persistValue"},c=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(a,e),this.cacheInstance=s.createInstance({driver:s.INDEXEDDB,name:this.cacheConfig.name,storeName:"store"+this.cacheConfig.name})}return e.prototype.get=function(e){return this.cacheInstance.getItem(e)},e.prototype.gets=function(e){return r(this,void 0,void 0,function(){var t,n,r,i,a,c | ||
return o(this,function(o){switch(o.label){case 0:o.trys.push([0,5,,6]),t=[],n=0,r=e,o.label=1 | ||
@@ -453,3 +453,3 @@ case 1:return n<r.length?(a=(i=t).push,[4,this.get(r[n])]):[3,4] | ||
var l=o(function(e,n){var r=t&&t.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]) | ||
return e},o=t&&t.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function c(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,c)}u((r=r.apply(e,t||[])).next())})},a=t&&t.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return e},o=t&&t.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,c)}s((r=r.apply(e,t||[])).next())})},a=t&&t.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return o[1]},trys:[],ops:[]} | ||
@@ -474,3 +474,3 @@ return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
Object.defineProperty(n,"__esModule",{value:!0}) | ||
var u={name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},l=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(u,e),this.metaCacheInstance=new s.default({name:this.cacheConfig.name}),this.valueCacheInstance=new f.default({name:this.cacheConfig.name})}return e.prototype.getOldKeys=function(){return o(this,void 0,void 0,function(){var e,t,n,r,o,i,c,u | ||
var s={name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},l=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(s,e),this.metaCacheInstance=new u.default({name:this.cacheConfig.name}),this.valueCacheInstance=new f.default({name:this.cacheConfig.name})}return e.prototype.getOldKeys=function(){return o(this,void 0,void 0,function(){var e,t,n,r,o,i,c,s | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.length()] | ||
@@ -480,3 +480,3 @@ case 1:return e=a.sent(),n=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),r=[],[4,this.getSortedItems()] | ||
return[2,Promise.resolve(r)] | ||
case 3:return u=a.sent(),[2,Promise.reject(u)] | ||
case 3:return s=a.sent(),[2,Promise.reject(s)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return o(this,void 0,void 0,function(){var e,t,n,r,o,i | ||
@@ -509,3 +509,3 @@ return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:return(t=o.sent())?void 0===t.length||void 0===t.expire||void 0===t.now||void 0===t.count?[3,4]:this.expiredVaule(t.expire)?(this.remove(e),[2,Promise.resolve(null)]):[4,this.valueCacheInstance.get(e)]:[2,Promise.resolve(null)] | ||
case 2:return n=o.sent(),[4,this.setMetaCount(e)] | ||
case 2:return n=o.sent(),[4,this.setMeta(e)] | ||
case 3:return o.sent(),[2,Promise.resolve(n)] | ||
@@ -522,12 +522,16 @@ case 4:return[2,Promise.resolve(t)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,n){return void 0===n&&(n=-1),o(this,void 0,void 0,function(){var r,o | ||
return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.getMeta(e)] | ||
return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,6]),[4,this.getMeta(e)] | ||
case 1:return!(r=i.sent())||r.length||r.expire||r.count||r.now?[4,this.setMeta(e,t,n)]:[2,this.metaCacheInstance.set(e,t)] | ||
case 2:return i.sent(),[2,this.valueCacheInstance.set(e,t)] | ||
case 3:return o=i.sent(),[2,Promise.reject(o)] | ||
case 4:return[2]}})})},e.prototype.append=function(e,t,n){return void 0===n&&(n=-1),o(this,void 0,void 0,function(){var r,o,i | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getMeta(e)] | ||
case 3:return(o=i.sent()).name.toUpperCase().indexOf("QUOTA")>=0?[4,this.clearKeys()]:[3,5] | ||
case 4:return i.sent(),[2,Promise.resolve(null)] | ||
case 5:return[2,Promise.reject(o)] | ||
case 6:return[2]}})})},e.prototype.append=function(e,t,n){return void 0===n&&(n=-1),o(this,void 0,void 0,function(){var r,o,i | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,6]),[4,this.getMeta(e)] | ||
case 1:return(r=a.sent())?(n=n||r.expire,o=this.valueCacheInstance.append(e,t),[4,this.setMeta(e,o,n)]):[2,this.set(e,t,n)] | ||
case 2:return a.sent(),[2,Promise.resolve(o)] | ||
case 3:return i=a.sent(),[2,Promise.reject(i)] | ||
case 4:return[2]}})})},e.prototype.has=function(e){return o(this,void 0,void 0,function(){var t | ||
case 3:return(i=a.sent()).name.toUpperCase().indexOf("QUOTA")>=0?[4,this.clearKeys()]:[3,5] | ||
case 4:return a.sent(),[2,Promise.resolve(null)] | ||
case 5:return[2,Promise.reject(i)] | ||
case 6:return[2]}})})},e.prototype.has=function(e){return o(this,void 0,void 0,function(){var t | ||
return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
@@ -555,3 +559,3 @@ case 1:return n.sent()?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 7:return i=a.sent(),[2,Promise.reject(i)] | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return o(this,void 0,void 0,function(){var e,t,n,o,i,c,u,s,f,l,h,d,v,p,y,m | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return o(this,void 0,void 0,function(){var e,t,n,o,i,c,s,u,f,l,h,d,v,p,y,m | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,6,,7]),[4,this.keys()] | ||
@@ -562,4 +566,4 @@ case 1:e=a.sent(),t=[],n=0,o=e,a.label=2 | ||
case 4:return n++,[3,2] | ||
case 5:for(u={},s=0,f=t;s<f.length;s++)u[(l=f[s]).count]||(u[l.count]=[]),u[l.count].push(l) | ||
for(d in h=[],u)u.hasOwnProperty(d)&&h.push({count:parseInt(d,10),items:u[d].sort(function(e,t){return t.now-e.now})}) | ||
case 5:for(s={},u=0,f=t;u<f.length;u++)s[(l=f[u]).count]||(s[l.count]=[]),s[l.count].push(l) | ||
for(d in h=[],s)s.hasOwnProperty(d)&&h.push({count:parseInt(d,10),items:s[d].sort(function(e,t){return t.now-e.now})}) | ||
for(h=h.sort(function(e,t){return t.count-e.count}),v=[],p=0,y=h;p<y.length;p++)v=v.concat(y[p].items) | ||
@@ -569,9 +573,5 @@ return[2,Promise.resolve(v)] | ||
case 7:return[2]}})})},e.prototype.expiredVaule=function(e){var t=(new Date).getTime() | ||
return e&&e>0&&e<t},e.prototype.setMetaCount=function(e){return o(this,void 0,void 0,function(){var t,n,o,i,u,s | ||
return e&&e>0&&e<t},e.prototype.setMeta=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=-1),o(this,void 0,void 0,function(){var o,s,u,f,l,h,d | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return t=a.sent(),n=(new Date).getTime(),o=0,t&&void 0!==t.count&&(o=t.count+1),i=r({},t,{now:n,count:o}),u=this.cacheConfig.isCompress?c.default.compressToUTF16(JSON.stringify(i)):JSON.stringify(i),[2,this.metaCacheInstance.set(e,u)] | ||
case 2:return s=a.sent(),[2,Promise.reject(s)] | ||
case 3:return[2]}})})},e.prototype.setMeta=function(e,t,n){return void 0===n&&(n=-1),o(this,void 0,void 0,function(){var r,o,u,s,f,l,h,d | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getMeta(e)] | ||
case 1:return r=a.sent(),o=(new Date).getTime(),void 0,s=i.utf16ByteLength(JSON.stringify(t)),f=void 0,f=i.isDate(n)?n.getTime():i.isNumber(n)&&n>0?o+1e3*n:-1,l=0,r&&r.count&&(l=r.count+1),u={now:o,length:s,count:l,expire:f},h=this.cacheConfig.isCompress?c.default.compressToUTF16(JSON.stringify(u)):JSON.stringify(u),[2,this.metaCacheInstance.set(e,h)] | ||
case 1:return o=a.sent(),s=(new Date).getTime(),u=void 0,u=i.isDate(n)?n.getTime():i.isNumber(n)&&n>0?s+1e3*n:-1,f=0,o&&void 0!==o.count&&(f=o.count+1),l=void 0,l=t?{length:i.utf16ByteLength(JSON.stringify(t)),now:s,count:f,expire:u}:r({},o,{now:s,count:f}),h=this.cacheConfig.isCompress?c.default.compressToUTF16(JSON.stringify(l)):JSON.stringify(l),[2,this.metaCacheInstance.set(e,h)] | ||
case 2:return d=a.sent(),[2,Promise.reject(d)] | ||
@@ -582,3 +582,13 @@ case 3:return[2]}})})},e.prototype.getMeta=function(e){return o(this,void 0,void 0,function(){var t,n,r | ||
case 2:return r=o.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e}() | ||
case 3:return[2]}})})},e.prototype.clearKeys=function(){return o(this,void 0,void 0,function(){var e,t,n,r,o,i,c,s | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,8,,9]),[4,this.getExpiredKeys()] | ||
case 1:return e=a.sent(),n=(t=e).concat,[4,this.getOverLengthKeys()] | ||
case 2:return n.call(t,a.sent()),o=(r=e).concat,[4,this.getOldKeys()] | ||
case 3:o.call(r,a.sent()),e=e.sort().filter(function(e,t,n){return!t||e!==n[t-1]}),i=0,c=e,a.label=4 | ||
case 4:return i<c.length?[4,this.remove(c[i])]:[3,7] | ||
case 5:a.sent(),a.label=6 | ||
case 6:return i++,[3,4] | ||
case 7:return[2,Promise.resolve(!0)] | ||
case 8:return s=a.sent(),[2,Promise.reject(s)] | ||
case 9:return[2]}})})},e}() | ||
n.default=l}) | ||
@@ -585,0 +595,0 @@ r(l) |
{ | ||
"name": "mycache", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A Cache library", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"scripts": { | ||
"build": "cross-env rimraf build dist && tsc && rollup -c && node ./scripts/bundles", | ||
"build": "cross-env rimraf lib build dist && tsc && rollup -c && node ./scripts/bundles", | ||
"dev": "tsc --watch src", | ||
@@ -34,0 +34,0 @@ "lint": "tslint src/*", |
@@ -8,4 +8,6 @@ # Mycache | ||
Mycache is a cache library enhanced front end local cache. Mycache provides two kinds of cache: persist cache and memory cache. Persist cache is used [localforage](https://github.com/localForage/localForage). | ||
Mycache is a cache library enhanced front end local cache, and provides two kinds of cache: persist cache and memory cache. | ||
The persist cache use two park to store, localStorage is responsible for store the meta info, and indexeddb is responsible for store value. | ||
## Installation | ||
@@ -89,3 +91,3 @@ NPM is the easiest and fastest way to get started using Mycache. | ||
isCompress: false, // if enable string compress | ||
valueMaxLength: 500 * 1000, // max length of value | ||
valueMaxLength: 20 * 1000, // max length of value | ||
oldItemsCount: 0.2, // this count of old items | ||
@@ -129,3 +131,3 @@ }); | ||
// get items by sorted | ||
function getSortedItems(): Promise<typed.IPersistDataMap[]> {} | ||
function getSortedItems(): Promise<typed.IPersistMetaDataMap[]> {} | ||
``` | ||
@@ -132,0 +134,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1019082
5730
133