Comparing version 0.3.1 to 0.4.0
@@ -7,2 +7,6 @@ # Changelog | ||
## [0.4.0] - 2018-04-26 | ||
### Changed | ||
- Use localStorage to store meta info, and use indexeddb to store value | ||
## [0.3.1] - 2018-04-24 | ||
@@ -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 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 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 t=e.constructor | ||
if("function"!=typeof t)return!1 | ||
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{} | ||
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{} | ||
"string"==typeof t&&(t=[t]) | ||
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 | ||
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 | ||
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 r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}s((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] | ||
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] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function u(i){return function(u){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 | ||
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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,n=i[1],i=[0] | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
@@ -36,84 +36,110 @@ 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],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=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 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] | ||
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] | ||
case 5:return[2,Promise.resolve(e)] | ||
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 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 4:return[2,Promise.resolve(!0)]}})})},e.prototype.getKey=function(e){return this.cacheConfig.name+"/"+e},e}() | ||
t.default=o}) | ||
unwrapExports(MemCache_1) | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,r,n){function o(a,u){if(!r[a]){if(!t[a]){var s="function"==typeof commonjsRequire&&commonjsRequire | ||
if(!u&&s)return s(a,!0) | ||
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) | ||
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++)) | ||
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("") | ||
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)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
var t=i(e,15,o) | ||
return t.push(" "),t.join("")},decompressFromUTF16:function(e){return null===e?"":""===e?null:a(e.length,15,function(t){return e.charCodeAt(t)-32})},compress:function(e){return s(e).join("")},compressToArray:s,decompress:function(e){return null===e?"":""===e?null:a(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:a(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
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 | ||
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=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),u=e.document.createTextNode("") | ||
a.observe(u,{characterData:!0}),r=function(){u.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") | ||
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 | ||
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") | ||
t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)} | ||
else{var s=new e.MessageChannel | ||
s.port1.onmessage=f,r=function(){s.port2.postMessage(0)}}var c=[] | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,n=function(){u.port2.postMessage(0)}}var c=[] | ||
function f(){var e,t | ||
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"],u=["FULFILLED"],s=["PENDING"] | ||
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) | ||
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=s,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===u||"function"!=typeof t&&this.state===a)return this | ||
var r=new this.constructor(o) | ||
if(this.state!==s){var n=this.state===u?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=u,e.outcome=t | ||
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) | ||
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 r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t) | ||
for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].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 r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=Array(r),u=0,s=-1,c=new this(o);++s<r;)f(e[s],s) | ||
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) | ||
return c | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!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!==n||r||(r=!0,i.resolve(c,a))},function(e){r||(r=!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 r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=-1,u=new this(o);++a<r;)t.resolve(e[a]).then(function(e){n||(n=!0,i.resolve(u,e))},function(e){n||(n=!0,i.reject(u,e))}) | ||
return u}},{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 | ||
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 | ||
if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB | ||
@@ -125,138 +151,138 @@ if("undefined"!=typeof mozIndexedDB)return mozIndexedDB | ||
try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i | ||
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) | ||
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) | ||
var a=Promise | ||
function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(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) | ||
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) | ||
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 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 E(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 O(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
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] | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return s(r,e,e),r}function P(e,t,r,n){void 0===n&&(n=1) | ||
return u(n,e,e),n}function C(e,t,n,r){void 0===r&&(r=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
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(){P(e,t,r,n-1)})}).catch(r) | ||
r(o)}}var N={_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=O) | ||
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) | ||
var i=[] | ||
function u(){return a.resolve()}for(var s=0;s<o.forages.length;s++){var c=o.forages[s] | ||
c!==t&&i.push(c._initReady().catch(u))}var f=o.forages.slice(0) | ||
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 | ||
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 | ||
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 r=this,n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.openCursor(),s=1 | ||
u.onsuccess=function(){var r=u.result | ||
if(r){var n=r.value | ||
x(n)&&(n=E(n)) | ||
var o=e(n,r.key,s++) | ||
void 0!==o?t(o):r.continue()}else t()},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
var n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.get(e) | ||
u.onsuccess=function(){var e=u.result | ||
void 0===e&&(e=null),x(e)&&(e=E(e)),t(e)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},setItem:function(e,t,r){var n=this | ||
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) | ||
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 | ||
e=c(e) | ||
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){P(n._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var u=a.objectStore(n._dbInfo.storeName) | ||
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) | ||
null===t&&(t=void 0) | ||
var s=u.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){var e=s.error?s.error:s.transaction.error | ||
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 | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return u(o,r),o},removeItem:function(e,t){var r=this | ||
return s(o,n),o},removeItem:function(e,t){var n=this | ||
e=c(e) | ||
var n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,y,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){n(u.error)},i.onabort=function(){var e=u.error?u.error:u.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,y,function(n,o){if(n)return r(n) | ||
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) | ||
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 | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
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) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.count() | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=!1,s=a.openCursor() | ||
s.onsuccess=function(){var r=s.result | ||
r?0===e?t(r.key):u?t(r.key):(u=!0,r.advance(e)):t(null)},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),u=[] | ||
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) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),s=[] | ||
a.onsuccess=function(){var t=a.result | ||
t?(u.push(t.key),t.continue()):e(u)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(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,s=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 | ||
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 | ||
return t}) | ||
r=s.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
b(e) | ||
var n=d[e.name],i=n.forages | ||
var r=d[e.name],i=r.forages | ||
t.close() | ||
for(var u=0;u<i.length;u++){var s=i[u] | ||
s._dbInfo.db=null,s._dbInfo.version=r}var c=new a(function(t,n){var i=o.open(e.name,r) | ||
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) | ||
i.onerror=function(e){var t=i.result | ||
t.close(),n(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.close(),r(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){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 | ||
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 | ||
t.close() | ||
for(var i=0;i<n.length;i++){var u=n[i] | ||
u._dbInfo.db=null}var s=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 | ||
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 | ||
e&&e.close(),t(e)}}) | ||
return s.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 u(r,t),r}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",R=D.length,T="arbf",M="blob",B="si08",L="ui08",F="uic8",U="si16",z="si32",G="ur16",q="ui32",K="fl32",W="fl64",J=R+T.length,Z=Object.prototype.toString | ||
function H(e){var t,r,n,o,i,a=.75*e.length,u=e.length,s=0 | ||
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 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var c=new ArrayBuffer(a),f=new Uint8Array(c) | ||
for(t=0;t<u;t+=4)r=C.indexOf(e[t]),n=C.indexOf(e[t+1]),o=C.indexOf(e[t+2]),i=C.indexOf(e[t+3]),f[s++]=r<<2|n>>4,f[s++]=(15&n)<<4|o>>2,f[s++]=(3&o)<<6|63&i | ||
return c}function Q(e){var t,r=new Uint8Array(e),n="" | ||
for(t=0;t<r.length;t+=3)n+=C[r[t]>>2],n+=C[(3&r[t])<<4|r[t+1]>>4],n+=C[(15&r[t+1])<<2|r[t+2]>>6],n+=C[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=Z.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===Z.call(e.buffer))){var n,o=D | ||
e instanceof ArrayBuffer?(n=e,o+=T):(n=e.buffer,"[object Int8Array]"===r?o+=B:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=U:"[object Uint16Array]"===r?o+=G:"[object Int32Array]"===r?o+=z:"[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+Q(n))}else if("[object Blob]"===r){var i=new FileReader | ||
i.onload=function(){var r=A+e.type+"~"+Q(this.result) | ||
t(D+M+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,R)!==D)return JSON.parse(e) | ||
var t,r=e.substring(J),type=e.substring(R,J) | ||
if(type===M&&k.test(r)){var n=r.match(k) | ||
t=n[1],r=r.substring(n[0].length)}var o=H(r) | ||
switch(type){case T:return o | ||
case M:return i([o],{type:t}) | ||
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) | ||
switch(type){case R:return o | ||
case T:return i([o],{type:t}) | ||
case B:return new Int8Array(o) | ||
case L:return new Uint8Array(o) | ||
case F:return new Uint8ClampedArray(o) | ||
case U:return new Int16Array(o) | ||
case G:return new Uint16Array(o) | ||
case G:return new Int16Array(o) | ||
case U:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
@@ -267,140 +293,117 @@ case q:return new Uint32Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
function V(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,u){u.rows.length?i(e,a):V(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){V(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,u=0;u<a;u++){var s=i.item(u),c=s.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,s.key,u+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
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 u(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
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 | ||
t=c(t) | ||
var s=new a(function(a,u){i.ready().then(function(){void 0===r&&(r=null) | ||
var s=r,c=i._dbInfo | ||
c.serializer.serialize(r,function(r,f){f?u(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,r],function(){a(s)},function(e,t){u(t)})},function(r){if(r.code===r.QUOTA_ERR){if(o>0)return void a(e.call(i,t,s,n,o-1)) | ||
u(r)}})})}).catch(u)}) | ||
return u(s,n),s}.call(this,e,t,r,1)},removeItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
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 u(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 u(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 u(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 u(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 u(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 u(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=[],u=0,s=e.storeNames.length;u<s;u++)i.push(o(e.storeNames[u])) | ||
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,u=0;u<i;u++){var s=localStorage.key(u) | ||
if(0===s.indexOf(n)){var c=localStorage.getItem(s) | ||
if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,s.substring(o),a++)))return c}}}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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) | ||
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 | ||
e=c(e) | ||
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 u(n,t),n},setItem:function(e,t,r){var n=this | ||
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 | ||
e=c(e) | ||
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 u(o,r),o},removeItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
var n=r.ready().then(function(){var t=r._dbInfo | ||
var r=n.ready().then(function(){var t=n._dbInfo | ||
localStorage.removeItem(t.keyPrefix+e)}) | ||
return u(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 u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return u(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 u(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 u(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 u(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={},ue={INDEXEDDB:N,WEBSQL:$,LOCALSTORAGE:re},se=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:se.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),ue)if(ue.hasOwnProperty(r)){var n=ue[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.") | ||
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.") | ||
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,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"),s=0,c=i.length;s<c;s++){var f=i[s],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 u(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var o=ce[r] | ||
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] | ||
e[o]||(e[o]=t(o))}}() | ||
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 s(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 s(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return s(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 s(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this | ||
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 | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){n._config.driver=n.driver()}function u(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() | ||
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() | ||
return this._driverSet=c.then(function(){var e=o[0] | ||
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(u).catch(r)}i() | ||
var s=Error("No available storage method found.") | ||
return n._driverSet=a.reject(s),n._driverSet}()}}(o)})}).catch(function(){i() | ||
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() | ||
var u=Error("No available storage method found.") | ||
return r._driverSet=a.reject(u),r._driverSet}()}}(o)})}).catch(function(){i() | ||
var e=Error("No available storage method found.") | ||
return n._driverSet=a.reject(e),n._driverSet}),s(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] | ||
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] | ||
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)}),LZString_1=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!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,u=0,s={},c=!0,f=0,l=n(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(u=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s[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(u=l.v,i=0;i<v;i++)y=u>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===s[f]){for(0==--h&&(h=1<<v++),u=f<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
s[f]=n(d++),c=!0}l.d[f]=n(d++),0==--h&&(h=1<<v++),l=s[f]}if(c)c=!1 | ||
else for(u=l.v,i=0;i<v;i++)y=u>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===s[f]){for(0==--h&&(h=1<<v++),u=f<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;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,u=3,s="",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=n(y++)) | ||
for(d=r(f),o[3]=d,c.push(d);y<=e;){for(l=u,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<<u++)}else if(2===f)return c.join("") | ||
if(f>o.length)return null | ||
s=f<o.length?o[f]:d+d.charAt(0),c.push(s),o[a++]=d+s.charAt(0),d=s,0==--i&&(i=1<<u++)}return""},u=function(e){return i(e,16,function(e){return r(e)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
var t=i(e,15,o) | ||
return t.push(" "),t.join("")},decompressFromUTF16:function(e){return null===e?"":""===e?null:a(e.length,15,function(t){return e.charCodeAt(t)-32})},compress:function(e){return u(e).join("")},compressToArray:u,decompress:function(e){return null===e?"":""===e?null:a(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:a(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
unwrapExports(LZString_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{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}s((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] | ||
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}) | ||
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] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function u(i){return function(u){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 | ||
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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,n=i[1],i=[0] | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
@@ -414,83 +417,142 @@ 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],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=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={driver:[localforage.INDEXEDDB,localforage.LOCALSTORAGE],name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(i,e),this.cacheInstance=localforage.createInstance(this.cacheConfig)}return e.prototype.dropInstance=function(e){return void 0===e&&(e={}),this.cacheInstance.dropInstance(e)},e.prototype.getOldKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a,u,s | ||
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] | ||
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 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] | ||
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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
case 7:i=a.ops.pop(),a.trys.pop() | ||
continue | ||
default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0 | ||
continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1] | ||
break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i | ||
break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i) | ||
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] | ||
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 | ||
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(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
case 2:for(i=o.sent(),a=i.reverse(),u=0;u<a.length;u++)u<r&&n.push(a[u].key) | ||
return[2,Promise.resolve(n)] | ||
case 3:return s=o.sent(),[2,Promise.reject(s)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
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 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 | ||
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(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isExpired(i=n[r])]:[3,5] | ||
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 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[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 n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,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(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isOverLength(i=n[r])]:[3,5] | ||
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 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[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 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.getItem(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,n | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getItem(e)] | ||
case 1:return t=o.sent(),r=(new Date).getTime(),t&&t.expire&&t.expire>0&&t.expire<r?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return n=o.sent(),[2,Promise.reject(n)] | ||
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,3,,4]),[4,this.getItem(e)] | ||
case 1:return t=o.sent(),[4,this.isExpired(e)] | ||
case 2:return o.sent()?(this.remove(e),[2,Promise.resolve(null)]):!t||t&&!t.value?[2,Promise.resolve(null)]:t.value&&t.expire?(r=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(t.value):t.value),this.set(e,t.value,t.expire),[2,Promise.resolve(r)]):[2,Promise.resolve(t)] | ||
case 3:return n=o.sent(),[2,Promise.reject(n)] | ||
case 4:return[2]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a,u | ||
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 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 | ||
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 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 2:a.call(i,o.sent()),o.label=3 | ||
case 3:return r++,[3,1] | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return u=o.sent(),[2,Promise.reject(u)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,i){return void 0===i&&(i=-1),n(this,void 0,void 0,function(){var n,a,u,s,c,f,l,h | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),[4,this.getItem(e)] | ||
case 1:return n=o.sent(),a=(new Date).getTime(),!n||n.value||n.expire?(u=void 0,s=void 0,n&&n.value===t&&n.expire===i?[4,this.setItem(e,r({},n,{now:a,count:++n.count}))]:[3,3]):[2,this.setItem(e,t)] | ||
case 2:return u=o.sent(),s=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompressFromUTF16(u.value)):u.value,[2,Promise.resolve(s)] | ||
case 3:return c=void 0,c=utils.isDate(i)?i.getTime():utils.isNumber(i)&&i>0?a+1e3*i:-1,f=void 0,l=JSON.stringify(t),f=n&&t===n.value?t:this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(l):l,[4,this.setItem(e,{now:a,count:n&&n.count?++n.count:0,length:utils.utf16ByteLength(f),value:f,expire:c})] | ||
case 4:return u=o.sent(),s=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompressFromUTF16(u.value)):u.value,[2,Promise.resolve(s)] | ||
case 5:return h=o.sent(),[2,Promise.reject(h)] | ||
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,2,,3]),[4,this.getItem(e)] | ||
case 1:return(n=o.sent())?(i=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(n.value):n.value),utils.isArray(t)&&utils.isArray(i)?t=i.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(i)&&(t=utils.extend(i,t)),[2,this.set(e,t,r=r||n.expire)]):[2,this.set(e,t,r)] | ||
case 2:return a=o.sent(),[2,Promise.reject(a)] | ||
case 3: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.get(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 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.prototype.each=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a | ||
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 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 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 | ||
return o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.metaCacheInstance.clear()] | ||
case 1:return t.sent(),[4,this.valueCacheInstance.clear()] | ||
case 2:return t.sent(),[2,Promise.resolve()] | ||
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 | ||
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(),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 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 4:o.sent(),o.label=5 | ||
case 5:return r++,[3,2] | ||
case 5:return n++,[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 n(this,void 0,void 0,function(){var e,t,n,i,a,u,s,c,f,l,h,d,v,p,y,m | ||
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 | ||
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=[],n=0,i=e,o.label=2 | ||
case 2:return n<i.length?[4,this.getItem(a=i[n])]:[3,5] | ||
case 3:u=o.sent(),t.push(r({},u,{key:a})),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 5:for(s={},c=0,f=t;c<f.length;c++)s[(l=f[c]).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})}) | ||
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 5:for(u={},c=0,f=t;c<f.length;c++)u[(l=f[c]).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})}) | ||
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) | ||
return[2,Promise.resolve(v)] | ||
case 6:return m=o.sent(),[2,Promise.reject(m)] | ||
case 7:return[2]}})})},e.prototype.getItem=function(e){return this.cacheInstance.getItem(e)},e.prototype.setItem=function(e,t){return this.cacheInstance.setItem(e,t)},e}() | ||
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 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 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 | ||
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}() | ||
t.default=a}) | ||
@@ -497,0 +559,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 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 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 t=e.constructor | ||
if("function"!=typeof t)return!1 | ||
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{} | ||
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{} | ||
"string"==typeof t&&(t=[t]) | ||
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 | ||
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 | ||
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 r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}s((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] | ||
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] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function u(i){return function(u){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 | ||
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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,n=i[1],i=[0] | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
@@ -33,84 +33,110 @@ 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],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=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 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] | ||
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] | ||
case 5:return[2,Promise.resolve(e)] | ||
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 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 4:return[2,Promise.resolve(!0)]}})})},e.prototype.getKey=function(e){return this.cacheConfig.name+"/"+e},e}() | ||
t.default=o}) | ||
unwrapExports(MemCache_1) | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,r,n){function o(a,u){if(!r[a]){if(!t[a]){var s="function"==typeof commonjsRequire&&commonjsRequire | ||
if(!u&&s)return s(a,!0) | ||
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) | ||
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++)) | ||
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("") | ||
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)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
var t=i(e,15,o) | ||
return t.push(" "),t.join("")},decompressFromUTF16:function(e){return null===e?"":""===e?null:a(e.length,15,function(t){return e.charCodeAt(t)-32})},compress:function(e){return s(e).join("")},compressToArray:s,decompress:function(e){return null===e?"":""===e?null:a(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:a(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
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 | ||
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=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),u=e.document.createTextNode("") | ||
a.observe(u,{characterData:!0}),r=function(){u.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") | ||
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 | ||
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") | ||
t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)} | ||
else{var s=new e.MessageChannel | ||
s.port1.onmessage=f,r=function(){s.port2.postMessage(0)}}var c=[] | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,n=function(){u.port2.postMessage(0)}}var c=[] | ||
function f(){var e,t | ||
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"],u=["FULFILLED"],s=["PENDING"] | ||
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) | ||
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=s,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===u||"function"!=typeof t&&this.state===a)return this | ||
var r=new this.constructor(o) | ||
if(this.state!==s){var n=this.state===u?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=u,e.outcome=t | ||
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) | ||
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 r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t) | ||
for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].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 r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=Array(r),u=0,s=-1,c=new this(o);++s<r;)f(e[s],s) | ||
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) | ||
return c | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++u!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!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!==n||r||(r=!0,i.resolve(c,a))},function(e){r||(r=!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 r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=-1,u=new this(o);++a<r;)t.resolve(e[a]).then(function(e){n||(n=!0,i.resolve(u,e))},function(e){n||(n=!0,i.reject(u,e))}) | ||
return u}},{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 | ||
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 | ||
if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB | ||
@@ -122,138 +148,138 @@ if("undefined"!=typeof mozIndexedDB)return mozIndexedDB | ||
try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i | ||
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) | ||
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) | ||
var a=Promise | ||
function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function s(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) | ||
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) | ||
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 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 E(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 O(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
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] | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return s(r,e,e),r}function P(e,t,r,n){void 0===n&&(n=1) | ||
return u(n,e,e),n}function C(e,t,n,r){void 0===r&&(r=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
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(){P(e,t,r,n-1)})}).catch(r) | ||
r(o)}}var N={_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=O) | ||
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) | ||
var i=[] | ||
function u(){return a.resolve()}for(var s=0;s<o.forages.length;s++){var c=o.forages[s] | ||
c!==t&&i.push(c._initReady().catch(u))}var f=o.forages.slice(0) | ||
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 | ||
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 | ||
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 r=this,n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.openCursor(),s=1 | ||
u.onsuccess=function(){var r=u.result | ||
if(r){var n=r.value | ||
x(n)&&(n=E(n)) | ||
var o=e(n,r.key,s++) | ||
void 0!==o?t(o):r.continue()}else t()},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
var n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.get(e) | ||
u.onsuccess=function(){var e=u.result | ||
void 0===e&&(e=null),x(e)&&(e=E(e)),t(e)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},setItem:function(e,t,r){var n=this | ||
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) | ||
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 | ||
e=c(e) | ||
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){P(n._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var u=a.objectStore(n._dbInfo.storeName) | ||
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) | ||
null===t&&(t=void 0) | ||
var s=u.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){var e=s.error?s.error:s.transaction.error | ||
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 | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return u(o,r),o},removeItem:function(e,t){var r=this | ||
return s(o,n),o},removeItem:function(e,t){var n=this | ||
e=c(e) | ||
var n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,y,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){n(u.error)},i.onabort=function(){var e=u.error?u.error:u.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,y,function(n,o){if(n)return r(n) | ||
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) | ||
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 | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
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) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.count() | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=!1,s=a.openCursor() | ||
s.onsuccess=function(){var r=s.result | ||
r?0===e?t(r.key):u?t(r.key):(u=!0,r.advance(e)):t(null)},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),u=[] | ||
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) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),s=[] | ||
a.onsuccess=function(){var t=a.result | ||
t?(u.push(t.key),t.continue()):e(u)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(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,s=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 | ||
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 | ||
return t}) | ||
r=s.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
b(e) | ||
var n=d[e.name],i=n.forages | ||
var r=d[e.name],i=r.forages | ||
t.close() | ||
for(var u=0;u<i.length;u++){var s=i[u] | ||
s._dbInfo.db=null,s._dbInfo.version=r}var c=new a(function(t,n){var i=o.open(e.name,r) | ||
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) | ||
i.onerror=function(e){var t=i.result | ||
t.close(),n(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.close(),r(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){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 | ||
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 | ||
t.close() | ||
for(var i=0;i<n.length;i++){var u=n[i] | ||
u._dbInfo.db=null}var s=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 | ||
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 | ||
e&&e.close(),t(e)}}) | ||
return s.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 u(r,t),r}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",R=D.length,T="arbf",B="blob",M="si08",L="ui08",F="uic8",U="si16",z="si32",G="ur16",q="ui32",K="fl32",W="fl64",J=R+T.length,Z=Object.prototype.toString | ||
function H(e){var t,r,n,o,i,a=.75*e.length,u=e.length,s=0 | ||
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 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var c=new ArrayBuffer(a),f=new Uint8Array(c) | ||
for(t=0;t<u;t+=4)r=C.indexOf(e[t]),n=C.indexOf(e[t+1]),o=C.indexOf(e[t+2]),i=C.indexOf(e[t+3]),f[s++]=r<<2|n>>4,f[s++]=(15&n)<<4|o>>2,f[s++]=(3&o)<<6|63&i | ||
return c}function Q(e){var t,r=new Uint8Array(e),n="" | ||
for(t=0;t<r.length;t+=3)n+=C[r[t]>>2],n+=C[(3&r[t])<<4|r[t+1]>>4],n+=C[(15&r[t+1])<<2|r[t+2]>>6],n+=C[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=Z.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===Z.call(e.buffer))){var n,o=D | ||
e instanceof ArrayBuffer?(n=e,o+=T):(n=e.buffer,"[object Int8Array]"===r?o+=M:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=U:"[object Uint16Array]"===r?o+=G:"[object Int32Array]"===r?o+=z:"[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+Q(n))}else if("[object Blob]"===r){var i=new FileReader | ||
i.onload=function(){var r=A+e.type+"~"+Q(this.result) | ||
t(D+B+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,R)!==D)return JSON.parse(e) | ||
var t,r=e.substring(J),type=e.substring(R,J) | ||
if(type===B&&k.test(r)){var n=r.match(k) | ||
t=n[1],r=r.substring(n[0].length)}var o=H(r) | ||
switch(type){case T:return o | ||
case B:return i([o],{type:t}) | ||
case M:return new Int8Array(o) | ||
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) | ||
switch(type){case R:return o | ||
case T:return i([o],{type:t}) | ||
case B:return new Int8Array(o) | ||
case L:return new Uint8Array(o) | ||
case F:return new Uint8ClampedArray(o) | ||
case U:return new Int16Array(o) | ||
case G:return new Uint16Array(o) | ||
case G:return new Int16Array(o) | ||
case U:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
@@ -264,140 +290,117 @@ case q:return new Uint32Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
function V(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,u){u.rows.length?i(e,a):V(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){V(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,u=0;u<a;u++){var s=i.item(u),c=s.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,s.key,u+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
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 u(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
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 | ||
t=c(t) | ||
var s=new a(function(a,u){i.ready().then(function(){void 0===r&&(r=null) | ||
var s=r,c=i._dbInfo | ||
c.serializer.serialize(r,function(r,f){f?u(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,r],function(){a(s)},function(e,t){u(t)})},function(r){if(r.code===r.QUOTA_ERR){if(o>0)return void a(e.call(i,t,s,n,o-1)) | ||
u(r)}})})}).catch(u)}) | ||
return u(s,n),s}.call(this,e,t,r,1)},removeItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
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 u(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 u(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 u(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 u(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 u(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 u(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=[],u=0,s=e.storeNames.length;u<s;u++)i.push(o(e.storeNames[u])) | ||
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,u=0;u<i;u++){var s=localStorage.key(u) | ||
if(0===s.indexOf(n)){var c=localStorage.getItem(s) | ||
if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,s.substring(o),a++)))return c}}}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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) | ||
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 | ||
e=c(e) | ||
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 u(n,t),n},setItem:function(e,t,r){var n=this | ||
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 | ||
e=c(e) | ||
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 u(o,r),o},removeItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
var n=r.ready().then(function(){var t=r._dbInfo | ||
var r=n.ready().then(function(){var t=n._dbInfo | ||
localStorage.removeItem(t.keyPrefix+e)}) | ||
return u(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 u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return u(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 u(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 u(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 u(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={},ue={INDEXEDDB:N,WEBSQL:$,LOCALSTORAGE:re},se=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:se.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),ue)if(ue.hasOwnProperty(r)){var n=ue[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.") | ||
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.") | ||
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,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"),s=0,c=i.length;s<c;s++){var f=i[s],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 u(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var o=ce[r] | ||
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] | ||
e[o]||(e[o]=t(o))}}() | ||
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 s(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 s(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return s(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 s(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this | ||
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 | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){n._config.driver=n.driver()}function u(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() | ||
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() | ||
return this._driverSet=c.then(function(){var e=o[0] | ||
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(u).catch(r)}i() | ||
var s=Error("No available storage method found.") | ||
return n._driverSet=a.reject(s),n._driverSet}()}}(o)})}).catch(function(){i() | ||
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() | ||
var u=Error("No available storage method found.") | ||
return r._driverSet=a.reject(u),r._driverSet}()}}(o)})}).catch(function(){i() | ||
var e=Error("No available storage method found.") | ||
return n._driverSet=a.reject(e),n._driverSet}),s(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] | ||
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] | ||
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)}),LZString_1=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!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,u=0,s={},c=!0,f=0,l=n(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(u=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s[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(u=l.v,i=0;i<v;i++)y=u>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===s[f]){for(0==--h&&(h=1<<v++),u=f<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
s[f]=n(d++),c=!0}l.d[f]=n(d++),0==--h&&(h=1<<v++),l=s[f]}if(c)c=!1 | ||
else for(u=l.v,i=0;i<v;i++)y=u>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===s[f]){for(0==--h&&(h=1<<v++),u=f<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;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,u=3,s="",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=n(y++)) | ||
for(d=r(f),o[3]=d,c.push(d);y<=e;){for(l=u,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<<u++)}else if(2===f)return c.join("") | ||
if(f>o.length)return null | ||
s=f<o.length?o[f]:d+d.charAt(0),c.push(s),o[a++]=d+s.charAt(0),d=s,0==--i&&(i=1<<u++)}return""},u=function(e){return i(e,16,function(e){return r(e)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
var t=i(e,15,o) | ||
return t.push(" "),t.join("")},decompressFromUTF16:function(e){return null===e?"":""===e?null:a(e.length,15,function(t){return e.charCodeAt(t)-32})},compress:function(e){return u(e).join("")},compressToArray:u,decompress:function(e){return null===e?"":""===e?null:a(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:a(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
unwrapExports(LZString_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{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}s((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] | ||
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}) | ||
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] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function u(i){return function(u){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 | ||
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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,n=i[1],i=[0] | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
@@ -411,83 +414,142 @@ 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],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=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={driver:[localforage.INDEXEDDB,localforage.LOCALSTORAGE],name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=utils.extend(i,e),this.cacheInstance=localforage.createInstance(this.cacheConfig)}return e.prototype.dropInstance=function(e){return void 0===e&&(e={}),this.cacheInstance.dropInstance(e)},e.prototype.getOldKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a,u,s | ||
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] | ||
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 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] | ||
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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
case 7:i=a.ops.pop(),a.trys.pop() | ||
continue | ||
default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0 | ||
continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1] | ||
break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i | ||
break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i) | ||
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] | ||
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 | ||
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(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
case 2:for(i=o.sent(),a=i.reverse(),u=0;u<a.length;u++)u<r&&n.push(a[u].key) | ||
return[2,Promise.resolve(n)] | ||
case 3:return s=o.sent(),[2,Promise.reject(s)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
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 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 | ||
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(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isExpired(i=n[r])]:[3,5] | ||
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 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[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 n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,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(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isOverLength(i=n[r])]:[3,5] | ||
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 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[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 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.getItem(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,n | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getItem(e)] | ||
case 1:return t=o.sent(),r=(new Date).getTime(),t&&t.expire&&t.expire>0&&t.expire<r?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return n=o.sent(),[2,Promise.reject(n)] | ||
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,3,,4]),[4,this.getItem(e)] | ||
case 1:return t=o.sent(),[4,this.isExpired(e)] | ||
case 2:return o.sent()?(this.remove(e),[2,Promise.resolve(null)]):!t||t&&!t.value?[2,Promise.resolve(null)]:t.value&&t.expire?(r=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(t.value):t.value),this.set(e,t.value,t.expire),[2,Promise.resolve(r)]):[2,Promise.resolve(t)] | ||
case 3:return n=o.sent(),[2,Promise.reject(n)] | ||
case 4:return[2]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a,u | ||
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 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 | ||
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 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 2:a.call(i,o.sent()),o.label=3 | ||
case 3:return r++,[3,1] | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return u=o.sent(),[2,Promise.reject(u)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,i){return void 0===i&&(i=-1),n(this,void 0,void 0,function(){var n,a,u,s,c,f,l,h | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),[4,this.getItem(e)] | ||
case 1:return n=o.sent(),a=(new Date).getTime(),!n||n.value||n.expire?(u=void 0,s=void 0,n&&n.value===t&&n.expire===i?[4,this.setItem(e,r({},n,{now:a,count:++n.count}))]:[3,3]):[2,this.setItem(e,t)] | ||
case 2:return u=o.sent(),s=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompressFromUTF16(u.value)):u.value,[2,Promise.resolve(s)] | ||
case 3:return c=void 0,c=utils.isDate(i)?i.getTime():utils.isNumber(i)&&i>0?a+1e3*i:-1,f=void 0,l=JSON.stringify(t),f=n&&t===n.value?t:this.cacheConfig.isCompress?LZString_1.default.compressToUTF16(l):l,[4,this.setItem(e,{now:a,count:n&&n.count?++n.count:0,length:utils.utf16ByteLength(f),value:f,expire:c})] | ||
case 4:return u=o.sent(),s=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompressFromUTF16(u.value)):u.value,[2,Promise.resolve(s)] | ||
case 5:return h=o.sent(),[2,Promise.reject(h)] | ||
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,2,,3]),[4,this.getItem(e)] | ||
case 1:return(n=o.sent())?(i=JSON.parse(this.cacheConfig.isCompress?LZString_1.default.decompressFromUTF16(n.value):n.value),utils.isArray(t)&&utils.isArray(i)?t=i.concat(t):utils.isPlainObject(t)&&utils.isPlainObject(i)&&(t=utils.extend(i,t)),[2,this.set(e,t,r=r||n.expire)]):[2,this.set(e,t,r)] | ||
case 2:return a=o.sent(),[2,Promise.reject(a)] | ||
case 3: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.get(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 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.prototype.each=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a | ||
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 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 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 | ||
return o(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.metaCacheInstance.clear()] | ||
case 1:return t.sent(),[4,this.valueCacheInstance.clear()] | ||
case 2:return t.sent(),[2,Promise.resolve()] | ||
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 | ||
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(),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 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 4:o.sent(),o.label=5 | ||
case 5:return r++,[3,2] | ||
case 5:return n++,[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 n(this,void 0,void 0,function(){var e,t,n,i,a,u,s,c,f,l,h,d,v,p,y,m | ||
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 | ||
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=[],n=0,i=e,o.label=2 | ||
case 2:return n<i.length?[4,this.getItem(a=i[n])]:[3,5] | ||
case 3:u=o.sent(),t.push(r({},u,{key:a})),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 5:for(s={},c=0,f=t;c<f.length;c++)s[(l=f[c]).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})}) | ||
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 5:for(u={},c=0,f=t;c<f.length;c++)u[(l=f[c]).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})}) | ||
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) | ||
return[2,Promise.resolve(v)] | ||
case 6:return m=o.sent(),[2,Promise.reject(m)] | ||
case 7:return[2]}})})},e.prototype.getItem=function(e){return this.cacheInstance.getItem(e)},e.prototype.setItem=function(e,t){return this.cacheInstance.setItem(e,t)},e}() | ||
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 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 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 | ||
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}() | ||
t.default=a}) | ||
@@ -494,0 +556,0 @@ unwrapExports(Persist_1) |
!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" | ||
var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{} | ||
function r(){throw Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}) | ||
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 | ||
function n(){throw Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i=o(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 t=e.constructor | ||
if("function"!=typeof t)return!1 | ||
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{} | ||
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{} | ||
"string"==typeof t&&(t=[t]) | ||
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 | ||
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 | ||
return t}}) | ||
n(i) | ||
var a=o(function(e,r){var n=t&&t.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}c((n=n.apply(e,t||[])).next())})},o=t&&t.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
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] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function u(i){return function(u){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 | ||
return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function c(i){return function(c){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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,n=i[1],i=[0] | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
@@ -34,84 +34,110 @@ 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],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
Object.defineProperty(r,"__esModule",{value:!0}) | ||
var a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(e,{name:"memcache"}),this.cacheInstance={}}return e.prototype.getExpiredKeys=function(){return n(this,void 0,void 0,function(){var e,t,r,n,i,a | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}} | ||
Object.defineProperty(n,"__esModule",{value:!0}) | ||
var a=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(e,{name:"memcache"}),this.cacheInstance={}}return e.prototype.getExpiredKeys=function(){return r(this,void 0,void 0,function(){var e,t,n,r,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(),r=0,n=t,o.label=2 | ||
case 2:return r<n.length?[4,this.isExpired(i=n[r])]:[3,5] | ||
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 3:o.sent()&&e.push(i),o.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[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.isExpired=function(e){return n(this,void 0,void 0,function(){var t,r,n | ||
return o(this,function(o){return t=this.getKey(e),r=this.cacheInstance[t],n=(new Date).getTime(),r&&r.expire&&r.expire>0&&r.expire<n?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)]})})},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 t=this.getKey(e),r=this.cacheInstance[t],[4,this.isExpired(e)] | ||
case 1:return n=o.sent(),r&&r.value?n?(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 n(this,void 0,void 0,function(){var t,r,n,i,a | ||
return o(this,function(o){switch(o.label){case 0: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 7:return[2]}})})},e.prototype.isExpired=function(e){return r(this,void 0,void 0,function(){var t,n,r | ||
return o(this,function(o){return t=this.getKey(e),n=this.cacheInstance[t],r=(new Date).getTime(),n&&n.expire&&n.expire>0&&n.expire<r?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)]})})},e.prototype.get=function(e){return r(this,void 0,void 0,function(){var t,n,r | ||
return o(this,function(o){switch(o.label){case 0:return t=this.getKey(e),n=this.cacheInstance[t],[4,this.isExpired(e)] | ||
case 1:return r=o.sent(),n&&n.value?r?(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 r(this,void 0,void 0,function(){var t,n,r,i,a | ||
return o(this,function(o){switch(o.label){case 0: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 2:a.call(i,o.sent()),o.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 i.isDate(r)?r=r.getTime():i.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?(i.isArray(t)&&i.isArray(n.value)?t=n.value.concat(t):i.isPlainObject(t)&&i.isPlainObject(n.value)&&(t=i.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=i.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 n(this,void 0,void 0,function(){var t,r,n,i | ||
return o(this,function(o){switch(o.label){case 0:t=Object.keys(this.cacheInstance),r=0,o.label=1 | ||
case 1:return r<t.length?(n=t[r].replace(this.cacheConfig.name+"/",""),[4,this.get(n)]):[3,4] | ||
case 2:i=o.sent(),e&&e(i,n,r),o.label=3 | ||
case 3:return r++,[3,1] | ||
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 i.isDate(n)?n=n.getTime():i.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?(i.isArray(t)&&i.isArray(r.value)?t=r.value.concat(t):i.isPlainObject(t)&&i.isPlainObject(r.value)&&(t=i.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=i.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 r(this,void 0,void 0,function(){var t,n,r,i | ||
return o(this,function(o){switch(o.label){case 0:t=Object.keys(this.cacheInstance),n=0,o.label=1 | ||
case 1:return n<t.length?(r=t[n].replace(this.cacheConfig.name+"/",""),[4,this.get(r)]):[3,4] | ||
case 2:i=o.sent(),e&&e(i,r,n),o.label=3 | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(!0)]}})})},e.prototype.getKey=function(e){return this.cacheConfig.name+"/"+e},e}() | ||
r.default=a}) | ||
n(a) | ||
var u=o(function(e,n){e.exports=function e(t,n,o){function i(u,c){if(!n[u]){if(!t[u]){var s=r | ||
if(!c&&s)return s(u,!0) | ||
if(a)return a(u,!0) | ||
var f=Error("Cannot find module '"+u+"'") | ||
throw f.code="MODULE_NOT_FOUND",f}var l=n[u]={exports:{}} | ||
t[u][0].call(l.exports,function(e){var r=t[u][1][e] | ||
return i(r||e)},l,l.exports,e,t,n,o)}return n[u].exports}for(var a=r,u=0;u<o.length;u++)i(o[u]) | ||
return i}({1:[function(e,r,n){!function(e){var t,n,o=e.MutationObserver||e.WebKitMutationObserver | ||
if(o){var i=0,a=new o(f),u=e.document.createTextNode("") | ||
a.observe(u,{characterData:!0}),t=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script") | ||
n.default=a}) | ||
r(a) | ||
var c=o(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,c=0,u={},s=!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 | ||
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) | ||
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 | ||
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) | ||
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++)) | ||
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++)) | ||
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("") | ||
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)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
var t=i(e,15,o) | ||
return t.push(" "),t.join("")},decompressFromUTF16:function(e){return null===e?"":""===e?null:a(e.length,15,function(t){return e.charCodeAt(t)-32})},compress:function(e){return c(e).join("")},compressToArray:c,decompress:function(e){return null===e?"":""===e?null:a(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:a(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
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) | ||
if(a)return a(c,!0) | ||
var f=Error("Cannot find module '"+c+"'") | ||
throw f.code="MODULE_NOT_FOUND",f}var l=r[c]={exports:{}} | ||
t[c][0].call(l.exports,function(e){var n=t[c][1][e] | ||
return i(n||e)},l,l.exports,e,t,r,o)}return r[c].exports}for(var a=n,c=0;c<o.length;c++)i(o[c]) | ||
return i}({1:[function(e,n,r){!function(e){var t,r,o=e.MutationObserver||e.WebKitMutationObserver | ||
if(o){var i=0,a=new o(f),c=e.document.createTextNode("") | ||
a.observe(c,{characterData:!0}),t=function(){c.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="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 c=new e.MessageChannel | ||
c.port1.onmessage=f,t=function(){c.port2.postMessage(0)}}var s=[] | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,t=function(){u.port2.postMessage(0)}}var s=[] | ||
function f(){var e,t | ||
n=!0 | ||
for(var r=s.length;r;){for(t=s,s=[],e=-1;++e<r;)t[e]() | ||
r=s.length}n=!1}r.exports=function(e){1!==s.push(e)||n||t()}}(void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1) | ||
function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],c=["PENDING"] | ||
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=c,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=s,s.prototype.catch=function(e){return this.then(null,e)},s.prototype.then=function(e,t){if("function"!=typeof e&&this.state===u||"function"!=typeof t&&this.state===a)return this | ||
var r=new this.constructor(o) | ||
if(this.state!==c){var n=this.state===u?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=u,e.outcome=t | ||
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=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 | ||
var n=new this.constructor(o) | ||
if(this.state!==u){var r=this.state===c?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) | ||
else{e.state=c,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 r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(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 | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=Array(r),u=0,c=-1,s=new this(o);++c<r;)f(e[c],c) | ||
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,++u!==r||n||(n=!0,i.resolve(s,a))},function(e){n||(n=!0,i.reject(s,e))})}},s.race=function(e){var t=this | ||
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 | ||
if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array")) | ||
var r=e.length,n=!1 | ||
if(!r)return this.resolve([]) | ||
for(var a=-1,u=new this(o);++a<r;)t.resolve(e[a]).then(function(e){n||(n=!0,i.resolve(u,e))},function(e){n||(n=!0,i.reject(u,e))}) | ||
return u}},{1:1}],3:[function(e,r,n){var o | ||
"function"!=typeof(o=void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).Promise&&(o.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 | ||
var n=e.length,r=!1 | ||
if(!n)return this.resolve([]) | ||
for(var a=-1,c=new this(o);++a<n;)t.resolve(e[a]).then(function(e){r||(r=!0,i.resolve(c,e))},function(e){r||(r=!0,i.reject(c,e))}) | ||
return c}},{1:1}],3:[function(e,n,r){var o | ||
"function"!=typeof(o=void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).Promise&&(o.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 | ||
if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB | ||
@@ -123,281 +149,258 @@ if("undefined"!=typeof mozIndexedDB)return mozIndexedDB | ||
try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i | ||
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) | ||
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) | ||
var a=Promise | ||
function u(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}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 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 I(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) | ||
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 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) | ||
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 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 w(e){return I(e,!1)}function S(e){return I(e,!0)}function j(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 E(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 O(e){return e&&e.__local_forage_encoded_blob}function x(e){var t=this,r=t._initReady().then(function(){var e=d[t._dbInfo.name] | ||
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 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] | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return c(r,e,e),r}function P(e,t,r,n){void 0===n&&(n=1) | ||
return u(n,e,e),n}function O(e,t,n,r){void 0===r&&(r=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
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),S(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,w(e).then(function(t){return e.db=t,j(e)?S(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(){P(e,t,r,n-1)})}).catch(r) | ||
r(o)}}var N={_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=x) | ||
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(){O(e,t,n,r-1)})}).catch(n) | ||
n(o)}}var C={_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=x) | ||
var i=[] | ||
function u(){return a.resolve()}for(var c=0;c<o.forages.length;c++){var s=o.forages[c] | ||
s!==t&&i.push(s._initReady().catch(u))}var f=o.forages.slice(0) | ||
return a.all(i).then(function(){return r.db=o.db,w(r)}).then(function(e){return r.db=e,j(r,t._defaultConfig.version)?S(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 | ||
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) | ||
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 | ||
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 r=this,n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.openCursor(),c=1 | ||
u.onsuccess=function(){var r=u.result | ||
if(r){var n=r.value | ||
O(n)&&(n=E(n)) | ||
var o=e(n,r.key,c++) | ||
void 0!==o?t(o):r.continue()}else t()},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
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++) | ||
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) | ||
var n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.get(e) | ||
u.onsuccess=function(){var e=u.result | ||
void 0===e&&(e=null),O(e)&&(e=E(e)),t(e)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},setItem:function(e,t,r){var n=this | ||
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)}) | ||
return c(r,t),r},setItem:function(e,t,n){var r=this | ||
e=s(e) | ||
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){P(n._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var u=a.objectStore(n._dbInfo.storeName) | ||
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){O(r._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var c=a.objectStore(r._dbInfo.storeName) | ||
null===t&&(t=void 0) | ||
var c=u.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){var e=c.error?c.error:c.transaction.error | ||
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 | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return u(o,r),o},removeItem:function(e,t){var r=this | ||
return c(o,n),o},removeItem:function(e,t){var n=this | ||
e=s(e) | ||
var n=new a(function(t,n){r.ready().then(function(){P(r._dbInfo,y,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){n(u.error)},i.onabort=function(){var e=u.error?u.error:u.transaction.error | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,y,function(n,o){if(n)return r(n) | ||
var r=new a(function(t,r){n.ready().then(function(){O(n._dbInfo,y,function(o,i){if(o)return r(o) | ||
try{var a=i.objectStore(n._dbInfo.storeName),c=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){r(c.error)},i.onabort=function(){var e=c.error?c.error:c.transaction.error | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return c(r,t),r},clear:function(e){var t=this,n=new a(function(e,n){t.ready().then(function(){O(t._dbInfo,y,function(r,o){if(r)return n(r) | ||
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 | ||
r(e)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
n(e)}}catch(e){n(e)}})}).catch(n)}) | ||
return c(n,e),n},length: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) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.count() | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),u=!1,c=a.openCursor() | ||
c.onsuccess=function(){var r=c.result | ||
r?0===e?t(r.key):u?t(r.key):(u=!0,r.advance(e)):t(null)},c.onerror=function(){n(c.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return u(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),u=[] | ||
a.onsuccess=function(){e(a.result)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)}) | ||
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)}) | ||
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) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),c=[] | ||
a.onsuccess=function(){var t=a.result | ||
t?(u.push(t.key),t.continue()):e(u)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return u(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,c=i?a.resolve(this._dbInfo.db):w(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 | ||
t?(c.push(t.key),t.continue()):e(c)},a.onerror=function(){n(a.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return c(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 | ||
return t}) | ||
r=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
n=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1 | ||
b(e) | ||
var n=d[e.name],i=n.forages | ||
var r=d[e.name],i=r.forages | ||
t.close() | ||
for(var u=0;u<i.length;u++){var c=i[u] | ||
c._dbInfo.db=null,c._dbInfo.version=r}var s=new a(function(t,n){var i=o.open(e.name,r) | ||
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) | ||
i.onerror=function(e){var t=i.result | ||
t.close(),n(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.close(),r(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result | ||
e.close(),t(e)}}) | ||
return s.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 | ||
return s.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 | ||
t.close() | ||
for(var i=0;i<n.length;i++){var u=n[i] | ||
u._dbInfo.db=null}var c=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 | ||
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) | ||
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 c.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 u(r,t),r}},A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",C="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",T=D.length,R="arbf",B="blob",F="si08",M="ui08",L="uic8",U="si16",z="si32",q="ur16",K="ui32",W="fl32",J="fl64",G=T+R.length,H=Object.prototype.toString | ||
function Q(e){var t,r,n,o,i,a=.75*e.length,u=e.length,c=0 | ||
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 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 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var s=new ArrayBuffer(a),f=new Uint8Array(s) | ||
for(t=0;t<u;t+=4)r=A.indexOf(e[t]),n=A.indexOf(e[t+1]),o=A.indexOf(e[t+2]),i=A.indexOf(e[t+3]),f[c++]=r<<2|n>>4,f[c++]=(15&n)<<4|o>>2,f[c++]=(3&o)<<6|63&i | ||
return s}function X(e){var t,r=new Uint8Array(e),n="" | ||
for(t=0;t<r.length;t+=3)n+=A[r[t]>>2],n+=A[(3&r[t])<<4|r[t+1]>>4],n+=A[(15&r[t+1])<<2|r[t+2]>>6],n+=A[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 V={serialize:function(e,t){var r="" | ||
if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,o=D | ||
e instanceof ArrayBuffer?(n=e,o+=R):(n=e.buffer,"[object Int8Array]"===r?o+=F:"[object Uint8Array]"===r?o+=M:"[object Uint8ClampedArray]"===r?o+=L:"[object Int16Array]"===r?o+=U:"[object Uint16Array]"===r?o+=q:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=K:"[object Float32Array]"===r?o+=W:"[object Float64Array]"===r?o+=J:t(Error("Failed to get type for BinaryArray"))),t(o+X(n))}else if("[object Blob]"===r){var i=new FileReader | ||
i.onload=function(){var r=C+e.type+"~"+X(this.result) | ||
t(D+B+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,T)!==D)return JSON.parse(e) | ||
var t,r=e.substring(G),type=e.substring(T,G) | ||
if(type===B&&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 | ||
case B:return i([o],{type:t}) | ||
case F:return new Int8Array(o) | ||
case M:return new Uint8Array(o) | ||
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="" | ||
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}) | ||
case B:return new Int8Array(o) | ||
case F:return new Uint8Array(o) | ||
case L:return new Uint8ClampedArray(o) | ||
case U:return new Int16Array(o) | ||
case z:return new Int16Array(o) | ||
case q:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
case U:return new Int32Array(o) | ||
case K:return new Uint32Array(o) | ||
case W:return new Float32Array(o) | ||
case J:return new Float64Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:Q,bufferToString:X} | ||
function Y(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Z(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,u){u.rows.length?i(e,a):Y(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){Y(o,r,function(){t._dbInfo=r,e()},function(e,t){n(t)})},n)}) | ||
return r.serializer=V,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){Z(r,o,"SELECT * FROM "+o.storeName,[],function(r,n){for(var i=n.rows,a=i.length,u=0;u<a;u++){var c=i.item(u),s=c.value | ||
if(s&&(s=o.serializer.deserialize(s)),void 0!==(s=e(s,c.key,u+1)))return void t(s)}t()},function(e,t){n(t)})})}).catch(n)}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
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} | ||
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){Y(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){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)}) | ||
return c(r,t),r},getItem:function(e,t){var n=this | ||
e=s(e) | ||
var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Z(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 u(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
var 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+" 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 c(r,t),r},setItem:function(e,t,n){return function e(t,n,r,o){var i=this | ||
t=s(t) | ||
var c=new a(function(a,u){i.ready().then(function(){void 0===r&&(r=null) | ||
var c=r,s=i._dbInfo | ||
s.serializer.serialize(r,function(r,f){f?u(f):s.db.transaction(function(e){Z(e,s,"INSERT OR REPLACE INTO "+s.storeName+" (key, value) VALUES (?, ?)",[t,r],function(){a(c)},function(e,t){u(t)})},function(r){if(r.code===r.QUOTA_ERR){if(o>0)return void a(e.call(i,t,c,n,o-1)) | ||
u(r)}})})}).catch(u)}) | ||
return u(c,n),c}.call(this,e,t,r,1)},removeItem:function(e,t){var r=this | ||
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)) | ||
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) | ||
var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
o.db.transaction(function(r){Z(r,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){n(t)})})}).catch(n)}) | ||
return u(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){Z(t,n,"DELETE FROM "+n.storeName,[],function(){e()},function(e,t){r(t)})})}).catch(r)}) | ||
return u(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){Z(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 u(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){Z(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 u(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){Z(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 u(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 u(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=[],u=0,c=e.storeNames.length;u<c;u++)i.push(o(e.storeNames[u])) | ||
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=V,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,u=0;u<i;u++){var c=localStorage.key(u) | ||
if(0===c.indexOf(n)){var s=localStorage.getItem(c) | ||
if(s&&(s=t.serializer.deserialize(s)),void 0!==(s=e(s,c.substring(o),a++)))return s}}}) | ||
return u(n,t),n},getItem:function(e,t){var r=this | ||
var r=new a(function(t,r){n.ready().then(function(){var o=n._dbInfo | ||
o.db.transaction(function(n){Z(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)}) | ||
return c(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){Z(t,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)}) | ||
return c(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){Z(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 c(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){Z(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 c(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){Z(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 c(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 c(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=[],c=0,u=e.storeNames.length;c<u;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}} | ||
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,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 c(r,t),r},getItem:function(e,t){var n=this | ||
e=s(e) | ||
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 u(n,t),n},setItem:function(e,t,r){var n=this | ||
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) | ||
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 u(o,r),o},removeItem:function(e,t){var r=this | ||
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 c(o,n),o},removeItem:function(e,t){var n=this | ||
e=s(e) | ||
var n=r.ready().then(function(){var t=r._dbInfo | ||
var r=n.ready().then(function(){var t=n._dbInfo | ||
localStorage.removeItem(t.keyPrefix+e)}) | ||
return u(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 u(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return u(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 u(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 u(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 u(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={},ue={INDEXEDDB:N,WEBSQL:$,LOCALSTORAGE:re},ce=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],se=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(se),le={description:"",driver:ce.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),ue)if(ue.hasOwnProperty(r)){var n=ue[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.") | ||
return c(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 c(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return c(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 c(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 c(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 c(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={},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} | ||
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),ce)if(ce.hasOwnProperty(n)){var r=ce[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.") | ||
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,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"),c=0,s=i.length;c<s;c++){var f=i[c],l=!ne(se,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 u(r,arguments[arguments.length-1]),r}},r=0,n=se.length;r<n;r++){var o=se[r] | ||
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,s=i.length;u<s;u++){var f=i[u],l=!re(se,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] | ||
e[o]||(e[o]=t(o))}}() | ||
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 c(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 c(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(V) | ||
return c(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 c(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this | ||
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 | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){n._config.driver=n.driver()}function u(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var s=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
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] | ||
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(u).catch(r)}i() | ||
var c=Error("No available storage method found.") | ||
return n._driverSet=a.reject(c),n._driverSet}()}}(o)})}).catch(function(){i() | ||
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 e=Error("No available storage method found.") | ||
return n._driverSet=a.reject(e),n._driverSet}),c(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] | ||
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] | ||
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)}),c=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!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,u=0,c={},s=!0,f=0,l=n(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(u=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(c[f]=l,a=1;a<e.length;a++)if(f=e.charCodeAt(a),o=l.d[f])l=o | ||
else{if(s)s=!1 | ||
else for(u=l.v,i=0;i<v;i++)y=u>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===c[f]){for(0==--h&&(h=1<<v++),u=f<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
c[f]=n(d++),s=!0}l.d[f]=n(d++),0==--h&&(h=1<<v++),l=c[f]}if(s)s=!1 | ||
else for(u=l.v,i=0;i<v;i++)y=u>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===c[f]){for(0==--h&&(h=1<<v++),u=f<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;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,u=3,c="",s=[],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=n(y++)) | ||
for(d=r(f),o[3]=d,s.push(d);y<=e;){for(l=u,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<<u++)}else if(2===f)return s.join("") | ||
if(f>o.length)return null | ||
c=f<o.length?o[f]:d+d.charAt(0),s.push(c),o[a++]=d+c.charAt(0),d=c,0==--i&&(i=1<<u++)}return""},u=function(e){return i(e,16,function(e){return r(e)})} | ||
t.default={compressToUTF16:function(e){if(null==e)return"" | ||
var t=i(e,15,o) | ||
return t.push(" "),t.join("")},decompressFromUTF16:function(e){return null===e?"":""===e?null:a(e.length,15,function(t){return e.charCodeAt(t)-32})},compress:function(e){return u(e).join("")},compressToArray:u,decompress:function(e){return null===e?"":""===e?null:a(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:a(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
n(c) | ||
var s=o(function(e,r){var n=t&&t.__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},o=t&&t.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}c((n=n.apply(e,t||[])).next())})},a=t&&t.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
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.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] | ||
return o[1]},trys:[],ops:[]} | ||
return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function u(i){return function(u){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 | ||
return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function c(i){return function(c){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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,n=i[1],i=[0] | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
@@ -411,89 +414,148 @@ 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],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
Object.defineProperty(r,"__esModule",{value:!0}) | ||
var s={driver:[u.INDEXEDDB,u.LOCALSTORAGE],name:"persist",isCompress:!1,valueMaxLength:20480,oldItemsCount:.2},f=function(){function e(e){void 0===e&&(e={}),this.cacheConfig=i.extend(s,e),this.cacheInstance=u.createInstance(this.cacheConfig)}return e.prototype.dropInstance=function(e){return void 0===e&&(e={}),this.cacheInstance.dropInstance(e)},e.prototype.getOldKeys=function(){return o(this,void 0,void 0,function(){var e,t,r,n,o,i,u,c | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}} | ||
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 | ||
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 2:a.call(i,o.sent()),o.label=3 | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return c=o.sent(),[2,Promise.reject(c)] | ||
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 n,r | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.cacheInstance.getItem(e)] | ||
case 1:return(n=o.sent())?(i.isArray(t)&&i.isArray(n)?t=n.concat(t):i.isPlainObject(t)&&i.isPlainObject(n)&&(t=i.extend(n,t)),[2,this.set(e,t)]):[2,this.set(e,t)] | ||
case 2:return r=o.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e.prototype.remove=function(e){return this.cacheInstance.removeItem(e)},e.prototype.clear=function(){return this.cacheInstance.clear()},e}() | ||
n.default=c}) | ||
r(f) | ||
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 o[1]},trys:[],ops:[]} | ||
return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
function c(i){return function(c){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 | ||
break | ||
case 4:return a.label++,{value:i[1],done:!1} | ||
case 5:a.label++,r=i[1],i=[0] | ||
continue | ||
case 7:i=a.ops.pop(),a.trys.pop() | ||
continue | ||
default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0 | ||
continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1] | ||
break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i | ||
break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i) | ||
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] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}} | ||
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 | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.length()] | ||
case 1:return e=a.sent(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
case 2:for(o=a.sent(),i=o.reverse(),u=0;u<i.length;u++)u<r&&n.push(i[u].key) | ||
return[2,Promise.resolve(n)] | ||
case 3:return c=a.sent(),[2,Promise.reject(c)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return o(this,void 0,void 0,function(){var e,t,r,n,o,i | ||
case 1:return e=a.sent(),n=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),r=[],[4,this.getSortedItems()] | ||
case 2:for(o=a.sent(),i=o.reverse(),c=0;c<i.length;c++)c<n&&r.push(i[c].key) | ||
return[2,Promise.resolve(r)] | ||
case 3:return u=a.sent(),[2,Promise.reject(u)] | ||
case 4:return[2]}})})},e.prototype.getExpiredKeys=function(){return o(this,void 0,void 0,function(){var e,t,n,r,o,i | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=a.sent(),r=0,n=t,a.label=2 | ||
case 2:return r<n.length?[4,this.isExpired(o=n[r])]:[3,5] | ||
case 1:t=a.sent(),n=0,r=t,a.label=2 | ||
case 2:return n<r.length?[4,this.isExpired(o=r[n])]:[3,5] | ||
case 3:a.sent()&&e.push(o),a.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return i=a.sent(),[2,Promise.reject(i)] | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return o(this,void 0,void 0,function(){var e,t,r,n,o,i | ||
case 7:return[2]}})})},e.prototype.getOverLengthKeys=function(){return o(this,void 0,void 0,function(){var e,t,n,r,o,i | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
case 1:t=a.sent(),r=0,n=t,a.label=2 | ||
case 2:return r<n.length?[4,this.isOverLength(o=n[r])]:[3,5] | ||
case 1:t=a.sent(),n=0,r=t,a.label=2 | ||
case 2:return n<r.length?[4,this.isOverLength(o=r[n])]:[3,5] | ||
case 3:a.sent()&&e.push(o),a.label=4 | ||
case 4:return r++,[3,2] | ||
case 4:return n++,[3,2] | ||
case 5:return[2,Promise.resolve(e)] | ||
case 6:return i=a.sent(),[2,Promise.reject(i)] | ||
case 7:return[2]}})})},e.prototype.isOverLength=function(e){return o(this,void 0,void 0,function(){var t,r | ||
return a(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getItem(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 o(this,void 0,void 0,function(){var t,r,n | ||
return a(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getItem(e)] | ||
case 1:return t=o.sent(),r=(new Date).getTime(),t&&t.expire&&t.expire>0&&t.expire<r?[2,Promise.resolve(!0)]:[2,Promise.resolve(!1)] | ||
case 2:return n=o.sent(),[2,Promise.reject(n)] | ||
case 3:return[2]}})})},e.prototype.get=function(e){return o(this,void 0,void 0,function(){var t,r,n | ||
return a(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.getItem(e)] | ||
case 1:return t=o.sent(),[4,this.isExpired(e)] | ||
case 2:return o.sent()?(this.remove(e),[2,Promise.resolve(null)]):!t||t&&!t.value?[2,Promise.resolve(null)]:t.value&&t.expire?(r=JSON.parse(this.cacheConfig.isCompress?c.default.decompressFromUTF16(t.value):t.value),this.set(e,t.value,t.expire),[2,Promise.resolve(r)]):[2,Promise.resolve(t)] | ||
case 3:return n=o.sent(),[2,Promise.reject(n)] | ||
case 4:return[2]}})})},e.prototype.gets=function(e){return o(this,void 0,void 0,function(){var t,r,n,o,i,u | ||
return a(this,function(a){switch(a.label){case 0:a.trys.push([0,5,,6]),t=[],r=0,n=e,a.label=1 | ||
case 1:return r<n.length?(i=(o=t).push,[4,this.get(n[r])]):[3,4] | ||
case 7:return[2]}})})},e.prototype.isOverLength=function(e){return o(this,void 0,void 0,function(){var t,n | ||
return a(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 o(this,void 0,void 0,function(){var t,n | ||
return a(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 o(this,void 0,void 0,function(){var t,n,r | ||
return a(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 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 o(this,void 0,void 0,function(){var t,n,r,o,i,c | ||
return a(this,function(a){switch(a.label){case 0:a.trys.push([0,5,,6]),t=[],n=0,r=e,a.label=1 | ||
case 1:return n<r.length?(i=(o=t).push,[4,this.get(r[n])]):[3,4] | ||
case 2:i.call(o,a.sent()),a.label=3 | ||
case 3:return r++,[3,1] | ||
case 3:return n++,[3,1] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return u=a.sent(),[2,Promise.reject(u)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,r){return void 0===r&&(r=-1),o(this,void 0,void 0,function(){var o,u,s,f,l,h,d,v | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,5,,6]),[4,this.getItem(e)] | ||
case 1:return o=a.sent(),u=(new Date).getTime(),!o||o.value||o.expire?(s=void 0,f=void 0,o&&o.value===t&&o.expire===r?[4,this.setItem(e,n({},o,{now:u,count:++o.count}))]:[3,3]):[2,this.setItem(e,t)] | ||
case 2:return s=a.sent(),f=this.cacheConfig.isCompress?JSON.parse(c.default.decompressFromUTF16(s.value)):s.value,[2,Promise.resolve(f)] | ||
case 3:return l=void 0,l=i.isDate(r)?r.getTime():i.isNumber(r)&&r>0?u+1e3*r:-1,h=void 0,d=JSON.stringify(t),h=o&&t===o.value?t:this.cacheConfig.isCompress?c.default.compressToUTF16(d):d,[4,this.setItem(e,{now:u,count:o&&o.count?++o.count:0,length:i.utf16ByteLength(h),value:h,expire:l})] | ||
case 4:return s=a.sent(),f=this.cacheConfig.isCompress?JSON.parse(c.default.decompressFromUTF16(s.value)):s.value,[2,Promise.resolve(f)] | ||
case 5:return v=a.sent(),[2,Promise.reject(v)] | ||
case 6:return[2]}})})},e.prototype.append=function(e,t,r){return void 0===r&&(r=-1),o(this,void 0,void 0,function(){var n,o,u | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getItem(e)] | ||
case 1:return(n=a.sent())?(o=JSON.parse(this.cacheConfig.isCompress?c.default.decompressFromUTF16(n.value):n.value),i.isArray(t)&&i.isArray(o)?t=o.concat(t):i.isPlainObject(t)&&i.isPlainObject(o)&&(t=i.extend(o,t)),[2,this.set(e,t,r=r||n.expire)]):[2,this.set(e,t,r)] | ||
case 2:return u=a.sent(),[2,Promise.reject(u)] | ||
case 3:return[2]}})})},e.prototype.has=function(e){return o(this,void 0,void 0,function(){var t | ||
return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.get(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 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.prototype.each=function(e){return o(this,void 0,void 0,function(){var t,r,n,o,i | ||
case 5:return c=a.sent(),[2,Promise.reject(c)] | ||
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)] | ||
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 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 | ||
return a(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 o(this,void 0,void 0,function(){var t | ||
return a(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 o(this,void 0,void 0,function(){var e | ||
return a(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.metaCacheInstance.clear()] | ||
case 1:return t.sent(),[4,this.valueCacheInstance.clear()] | ||
case 2:return t.sent(),[2,Promise.resolve()] | ||
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 o(this,void 0,void 0,function(){var t,n,r,o,i | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,7,,8]),[4,this.keys()] | ||
case 1:t=a.sent(),r=0,a.label=2 | ||
case 2:return r<t.length?[4,this.get(n=t[r])]:[3,6] | ||
case 3:return o=a.sent(),e?[4,e(o,n,r)]:[3,5] | ||
case 1:t=a.sent(),n=0,a.label=2 | ||
case 2:return n<t.length?[4,this.get(r=t[n])]:[3,6] | ||
case 3:return o=a.sent(),e?[4,e(o,r,n)]:[3,5] | ||
case 4:a.sent(),a.label=5 | ||
case 5:return r++,[3,2] | ||
case 5:return n++,[3,2] | ||
case 6:return[2,Promise.resolve(!0)] | ||
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,r,o,i,u,c,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,u,s,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()] | ||
case 1:e=a.sent(),t=[],r=0,o=e,a.label=2 | ||
case 2:return r<o.length?[4,this.getItem(i=o[r])]:[3,5] | ||
case 3:u=a.sent(),t.push(n({},u,{key:i})),a.label=4 | ||
case 4:return r++,[3,2] | ||
case 5:for(c={},s=0,f=t;s<f.length;s++)c[(l=f[s]).count]||(c[l.count]=[]),c[l.count].push(l) | ||
for(d in h=[],c)c.hasOwnProperty(d)&&h.push({count:parseInt(d,10),items:c[d].sort(function(e,t){return t.now-e.now})}) | ||
case 1:e=a.sent(),t=[],n=0,o=e,a.label=2 | ||
case 2:return n<o.length?[4,this.getMeta(i=o[n])]:[3,5] | ||
case 3:c=a.sent(),t.push(r({},c,{key:i})),a.label=4 | ||
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})}) | ||
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) | ||
return[2,Promise.resolve(v)] | ||
case 6:return m=a.sent(),[2,Promise.reject(m)] | ||
case 7:return[2]}})})},e.prototype.getItem=function(e){return this.cacheInstance.getItem(e)},e.prototype.setItem=function(e,t){return this.cacheInstance.setItem(e,t)},e}() | ||
r.default=f}) | ||
n(s) | ||
var f=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0})}) | ||
n(f) | ||
var l=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MemCache=a.default,t.Persist=s.default,t.typed=f}),h=n(l),d=l.MemCache,v=l.Persist,p=l.typed | ||
e.default=h,e.MemCache=d,e.Persist=v,e.typed=p,Object.defineProperty(e,"__esModule",{value:!0})}) | ||
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 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 2:return d=a.sent(),[2,Promise.reject(d)] | ||
case 3:return[2]}})})},e.prototype.getMeta=function(e){return o(this,void 0,void 0,function(){var t,n,r | ||
return a(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?c.default.decompressFromUTF16(t):t)),[2,Promise.resolve(n)] | ||
case 2:return r=o.sent(),[2,Promise.reject(r)] | ||
case 3:return[2]}})})},e}() | ||
n.default=l}) | ||
r(l) | ||
var h=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0})}) | ||
r(h) | ||
var d=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MemCache=a.default,t.Persist=l.default,t.typed=h}),v=r(d),p=d.MemCache,y=d.Persist,m=d.typed | ||
e.default=v,e.MemCache=p,e.Persist=y,e.typed=m,Object.defineProperty(e,"__esModule",{value:!0})}) | ||
//# sourceMappingURL=mycache.prod.min.js.map |
{ | ||
"name": "mycache", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "A Cache library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
1009849
5669