Comparing version 0.3.0 to 0.3.1
@@ -7,2 +7,6 @@ # Changelog | ||
## [0.3.1] - 2018-04-24 | ||
### Changed | ||
- Some functions use utf-16 to replace utf-8 | ||
## [0.3.0] - 2018-04-24 | ||
@@ -9,0 +13,0 @@ ### Added |
@@ -15,8 +15,9 @@ "use strict" | ||
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&&-1!==t.indexOf(a)||(r[a]=e[a])}return r},t.utf16ByteLength=function(e){for(var t=0,r=0;r<e.length;r++)t+=e.charCodeAt(r)<=65535?2:4 | ||
return t}}) | ||
unwrapExports(utils) | ||
var utils_1=utils.isDate,utils_2=utils.isNumber,utils_3=utils.isArray,utils_4=utils.isPlainObject,utils_5=utils.extend,utils_6=utils.omit,MemCache_1=createCommonjsModule(function(e,t){var r=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},n=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
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] | ||
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(r)throw new TypeError("Generator is already executing.") | ||
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 | ||
@@ -36,3 +37,3 @@ switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
@@ -69,4 +70,4 @@ 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 | ||
unwrapExports(MemCache_1) | ||
var localforage=createCommonjsModule(function(e,t){e.exports=function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof commonjsRequire&&commonjsRequire | ||
if(!s&&u)return u(a,!0) | ||
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) | ||
if(i)return i(a,!0) | ||
@@ -78,7 +79,7 @@ var c=Error("Cannot find module '"+a+"'") | ||
return o}({1:[function(e,t,r){!function(e){var r,n,o=e.MutationObserver||e.WebKitMutationObserver | ||
if(o){var i=0,a=new o(f),s=e.document.createTextNode("") | ||
a.observe(s,{characterData:!0}),r=function(){s.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script") | ||
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") | ||
t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)} | ||
else{var u=new e.MessageChannel | ||
u.port1.onmessage=f,r=function(){u.port2.postMessage(0)}}var c=[] | ||
else{var s=new e.MessageChannel | ||
s.port1.onmessage=f,r=function(){s.port2.postMessage(0)}}var c=[] | ||
function f(){var e,t | ||
@@ -88,5 +89,5 @@ n=!0 | ||
r=c.length}n=!1}t.exports=function(e){1!==c.push(e)||n||r()}}(void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){var n=e(1) | ||
function o(){}var i={},a=["REJECTED"],s=["FULFILLED"],u=["PENDING"] | ||
function o(){}var i={},a=["REJECTED"],u=["FULFILLED"],s=["PENDING"] | ||
function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function") | ||
this.state=u,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function f(e,t,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 | ||
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 | ||
@@ -96,5 +97,5 @@ if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1 | ||
"error"===a.status&&n(a.value)}function v(e,t){var r={} | ||
try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===s||"function"!=typeof t&&this.state===a)return this | ||
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!==u){var n=this.state===s?e:t | ||
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)) | ||
@@ -105,3 +106,3 @@ 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(n)d(e,n) | ||
else{e.state=s,e.outcome=t | ||
else{e.state=u,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 | ||
@@ -114,10 +115,10 @@ for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t) | ||
if(!r)return this.resolve([]) | ||
for(var a=Array(r),s=0,u=-1,c=new this(o);++u<r;)f(e[u],u) | ||
for(var a=Array(r),u=0,s=-1,c=new this(o);++s<r;)f(e[s],s) | ||
return c | ||
function f(e,o){t.resolve(e).then(function(e){a[o]=e,++s!==r||n||(n=!0,i.resolve(c,a))},function(e){n||(n=!0,i.reject(c,e))})}},c.race=function(e){var t=this | ||
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 | ||
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,s=new this(o);++a<r;)t.resolve(e[a]).then(function(e){n||(n=!0,i.resolve(s,e))},function(e){n||(n=!0,i.reject(s,e))}) | ||
return s}},{1:1}],3:[function(e,t,r){var n | ||
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 | ||
@@ -133,3 +134,3 @@ if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB | ||
var a=Promise | ||
function s(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function u(e,t,r){"function"==typeof t&&e.then(t),"function"==typeof r&&e.catch(r)}function c(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e+=""),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",h=void 0,d={},v=Object.prototype.toString,p="readonly",y="readwrite" | ||
function 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([""]) | ||
@@ -153,3 +154,3 @@ 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\//) | ||
if(e&&e.dbReady)return e.dbReady}) | ||
return u(r,e,e),r}function P(e,t,r,n){void 0===n&&(n=1) | ||
return s(r,e,e),r}function P(e,t,r,n){void 0===n&&(n=1) | ||
try{var o=e.db.transaction(e.storeName,t) | ||
@@ -165,4 +166,4 @@ 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) | ||
var i=[] | ||
function s(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var c=o.forages[u] | ||
c!==t&&i.push(c._initReady().catch(s))}var f=o.forages.slice(0) | ||
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 | ||
@@ -173,15 +174,15 @@ for(var n=0;n<f.length;n++){var i=f[n] | ||
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),s=a.openCursor(),u=1 | ||
s.onsuccess=function(){var r=s.result | ||
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,u++) | ||
void 0!==o?t(o):r.continue()}else t()},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
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),s=a.get(e) | ||
s.onsuccess=function(){var e=s.result | ||
void 0===e&&(e=null),x(e)&&(e=E(e)),t(e)},s.onerror=function(){n(s.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},setItem:function(e,t,r){var n=this | ||
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 | ||
e=c(e) | ||
@@ -193,40 +194,40 @@ var o=new a(function(r,o){var i | ||
var r}):t}).then(function(t){P(n._dbInfo,y,function(i,a){if(i)return o(i) | ||
try{var s=a.objectStore(n._dbInfo.storeName) | ||
try{var u=a.objectStore(n._dbInfo.storeName) | ||
null===t&&(t=void 0) | ||
var u=s.put(t,e) | ||
a.oncomplete=function(){void 0===t&&(t=null),r(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error | ||
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 | ||
o(e)}}catch(e){o(e)}})}).catch(o)}) | ||
return s(o,r),o},removeItem:function(e,t){var r=this | ||
return u(o,r),o},removeItem:function(e,t){var r=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),s=a.delete(e) | ||
i.oncomplete=function(){t()},i.onerror=function(){n(s.error)},i.onabort=function(){var e=s.error?s.error:s.transaction.error | ||
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 s(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) | ||
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) | ||
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 s(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) | ||
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) | ||
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 s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){e<0?t(null):r.ready().then(function(){P(r._dbInfo,p,function(o,i){if(o)return n(o) | ||
try{var a=i.objectStore(r._dbInfo.storeName),s=!1,u=a.openCursor() | ||
u.onsuccess=function(){var r=u.result | ||
r?0===e?t(r.key):s?t(r.key):(s=!0,r.advance(e)):t(null)},u.onerror=function(){n(u.error)}}catch(e){n(e)}})}).catch(n)}) | ||
return s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){P(t._dbInfo,p,function(n,o){if(n)return r(n) | ||
try{var i=o.objectStore(t._dbInfo.storeName),a=i.openCursor(),s=[] | ||
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(){var t=a.result | ||
t?(s.push(t.key),t.continue()):e(s)},a.onerror=function(){r(a.error)}}catch(e){r(e)}})}).catch(r)}) | ||
return s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
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,u=i?a.resolve(this._dbInfo.db):I(e).then(function(t){var r=d[e.name],n=r.forages | ||
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 | ||
return t}) | ||
r=u.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
r=s.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
b(e) | ||
var n=d[e.name],i=n.forages | ||
t.close() | ||
for(var s=0;s<i.length;s++){var u=i[s] | ||
u._dbInfo.db=null,u._dbInfo.version=r}var c=new a(function(t,n){var i=o.open(e.name,r) | ||
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) | ||
i.onerror=function(e){var t=i.result | ||
@@ -241,15 +242,15 @@ t.close(),n(e)},i.onupgradeneeded=function(){var t=i.result | ||
t.close() | ||
for(var i=0;i<n.length;i++){var s=n[i] | ||
s._dbInfo.db=null}var u=new a(function(t,r){var n=o.deleteDatabase(e.name) | ||
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 | ||
e&&e.close(),t(e)}}) | ||
return u.then(function(e){r.db=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 s(r,t),r}},C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",k=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",R=D.length,M="arbf",T="blob",B="si08",L="ui08",F="uic8",z="si16",G="si32",q="ur16",U="ui32",K="fl32",W="fl64",J=R+M.length,Z=Object.prototype.toString | ||
function H(e){var t,r,n,o,i,a=.75*e.length,s=e.length,u=0 | ||
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 | ||
"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
var c=new ArrayBuffer(a),f=new Uint8Array(c) | ||
for(t=0;t<s;t+=4)r=C.indexOf(e[t]),n=C.indexOf(e[t+1]),o=C.indexOf(e[t+2]),i=C.indexOf(e[t+3]),f[u++]=r<<2|n>>4,f[u++]=(15&n)<<4|o>>2,f[u++]=(3&o)<<6|63&i | ||
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="" | ||
@@ -259,27 +260,27 @@ 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]] | ||
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+=M):(n=e.buffer,"[object Int8Array]"===r?o+=B:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=z:"[object Uint16Array]"===r?o+=q:"[object Int32Array]"===r?o+=G:"[object Uint32Array]"===r?o+=U:"[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 | ||
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+T+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,R)!==D)return JSON.parse(e) | ||
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===T&&k.test(r)){var n=r.match(k) | ||
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 M:return o | ||
case T:return i([o],{type:t}) | ||
switch(type){case T:return o | ||
case M:return i([o],{type:t}) | ||
case B:return new Int8Array(o) | ||
case L:return new Uint8Array(o) | ||
case F:return new Uint8ClampedArray(o) | ||
case z:return new Int16Array(o) | ||
case q:return new Uint16Array(o) | ||
case G:return new Int32Array(o) | ||
case U:return new Uint32Array(o) | ||
case U:return new Int16Array(o) | ||
case G:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
case q:return new Uint32Array(o) | ||
case K:return new Float32Array(o) | ||
case W:return new Float64Array(o) | ||
default:throw Error("Unkown type: "+type)}},stringToBuffer:H,bufferToString:Q} | ||
function 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,s){s.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} | ||
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,s=0;s<a;s++){var u=i.item(s),c=u.value | ||
if(c&&(c=o.serializer.deserialize(c)),void 0!==(c=e(c,u.key,s+1)))return void t(c)}t()},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
e=c(e) | ||
@@ -289,29 +290,29 @@ var n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
n&&(n=o.serializer.deserialize(n)),t(n)},function(e,t){n(t)})})}).catch(n)}) | ||
return s(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
return u(n,t),n},setItem:function(e,t,r){return function e(t,r,n,o){var i=this | ||
t=c(t) | ||
var u=new a(function(a,s){i.ready().then(function(){void 0===r&&(r=null) | ||
var u=r,c=i._dbInfo | ||
c.serializer.serialize(r,function(r,f){f?s(f):c.db.transaction(function(e){Y(e,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[t,r],function(){a(u)},function(e,t){s(t)})},function(r){if(r.code===r.QUOTA_ERR){if(o>0)return void a(e.call(i,t,u,n,o-1)) | ||
s(r)}})})}).catch(s)}) | ||
return s(u,n),u}.call(this,e,t,r,1)},removeItem:function(e,t){var r=this | ||
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 | ||
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 s(n,t),n},clear:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
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 s(r,e),r},length:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
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 s(r,e),r},key:function(e,t){var r=this,n=new a(function(t,n){r.ready().then(function(){var o=r._dbInfo | ||
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 s(n,t),n},keys:function(e){var t=this,r=new a(function(e,r){t.ready().then(function(){var n=t._dbInfo | ||
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 s(r,e),r},dropInstance:function(e,t){t=f.apply(this,arguments) | ||
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 s(n=e.name?new a(function(t){var n | ||
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=[],s=0,u=e.storeNames.length;s<u;s++)i.push(o(e.storeNames[s])) | ||
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}} | ||
@@ -321,10 +322,10 @@ function ee(e,t){var r=e.name+"/" | ||
if(e)for(var r in e)t[r]=e[r] | ||
return t.keyPrefix=ee(e,this._defaultConfig),te()?(this._dbInfo=t,t.serializer=X,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then(function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,s=0;s<i;s++){var u=localStorage.key(s) | ||
if(0===u.indexOf(n)){var c=localStorage.getItem(u) | ||
if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,u.substring(o),a++)))return c}}}) | ||
return s(n,t),n},getItem:function(e,t){var r=this | ||
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 | ||
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 s(n,t),n},setItem:function(e,t,r){var n=this | ||
return u(n,t),n},setItem:function(e,t,r){var n=this | ||
e=c(e) | ||
@@ -336,22 +337,22 @@ var o=n.ready().then(function(){void 0===t&&(t=null) | ||
else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}})})}) | ||
return s(o,r),o},removeItem:function(e,t){var r=this | ||
return u(o,r),o},removeItem:function(e,t){var r=this | ||
e=c(e) | ||
var n=r.ready().then(function(){var t=r._dbInfo | ||
localStorage.removeItem(t.keyPrefix+e)}) | ||
return s(n,t),n},clear:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r) | ||
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 s(r,e),r},length:function(e){var t=this.keys().then(function(e){return e.length}) | ||
return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then(function(){var t,n=r._dbInfo | ||
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 s(n,t),n},keys:function(e){var t=this,r=t.ready().then(function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o<r;o++){var i=localStorage.key(o) | ||
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 s(r,e),r},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var r=this.config() | ||
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 s(n=e.name?new a(function(t){t(e.storeName?ee(e,o._defaultConfig):e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var r=localStorage.key(t) | ||
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={},se={INDEXEDDB:N,WEBSQL:$,LOCALSTORAGE:re},ue=[se.INDEXEDDB._driver,se.WEBSQL._driver,se.LOCALSTORAGE._driver],ce=["dropInstance"],fe=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ce),le={description:"",driver:ue.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1} | ||
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),se)if(se.hasOwnProperty(r)){var n=se[r],o=n._driver | ||
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.") | ||
@@ -361,53 +362,55 @@ 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.") | ||
if(!e._driver)return void r(o) | ||
for(var i=fe.concat("_initStorage"),u=0,c=i.length;u<c;u++){var f=i[u],l=!ne(ce,f) | ||
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 s(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var o=ce[r] | ||
return u(r,arguments[arguments.length-1]),r}},r=0,n=ce.length;r<n;r++){var o=ce[r] | ||
e[o]||(e[o]=t(o))}}() | ||
var h=function(r){ie[n]&&console.info("Redefining LocalForage driver: "+n),ie[n]=e,ae[n]=r,t()} | ||
"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,r):h(!!e._support):h(!0)}catch(e){r(e)}}) | ||
return u(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ie[e]?a.resolve(ie[e]):a.reject(Error("Driver not found.")) | ||
return u(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(X) | ||
return u(t,e),t},e.prototype.ready=function(e){var t=this,r=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}) | ||
return u(r,e,e),r},e.prototype.setDriver=function(e,t,r){var n=this | ||
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 | ||
oe(e)||(e=[e]) | ||
var o=this._getSupportedDrivers(e) | ||
function i(){n._config.driver=n.driver()}function s(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return a.resolve()}):a.resolve() | ||
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() | ||
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(s).catch(r)}i() | ||
var u=Error("No available storage method found.") | ||
return n._driverSet=a.reject(u),n._driverSet}()}}(o)})}).catch(function(){i() | ||
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() | ||
var e=Error("No available storage method found.") | ||
return n._driverSet=a.reject(e),n._driverSet}),u(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!ae[e]},e.prototype._extend=function(e){de(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var o=e[r] | ||
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] | ||
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,t,n){for(var o=["","",""],i=4,a=4,s=3,u="",c=[],f=0,l=2,h=0,d="",v=n(0),p=t,y=1;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
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=s,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<<s++)}else if(2===f)return c.join("") | ||
o[a]=r(f),f=a++,0==--i&&(i=1<<u++)}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""},i=function(e){return function(e,t,r){if(null==e)return[] | ||
var o,i=0,a=0,s=0,u={},c=!0,f=0,l=n(3),h=1,d=4,v=2,p=[],y=0,m=0 | ||
if(e.length){for(s=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(u[f]=l,a=1;a<e.length;a++)if(f=e.charCodeAt(a),o=l.d[f])l=o | ||
else{if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
u[f]=n(d++),c=!0}l.d[f]=n(d++),0==--h&&(h=1<<v++),l=u[f]}if(c)c=!1 | ||
else for(s=l.v,i=0;i<v;i++)y=s>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
if(void 0===u[f]){for(0==--h&&(h=1<<v++),s=f<256?0:1,i=0;i<v;i++)y=s>>i|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
for(s=8+8*s,i=0;i<s;i++)y=f>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++m===t&&(m=0,p.push(r(y)),y=0) | ||
return p.push(r(y<<=t-m)),p}(e,16,function(e){return r(e)})} | ||
t.default={compress:function(e){return i(e).join("")},compressToArray:i,decompress:function(e){return null===e?"":""===e?null:o(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:o(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
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{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,s)}u((n=n.apply(e,t||[])).next())})},o=commonjsGlobal&&commonjsGlobal.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1] | ||
return 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] | ||
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(r)throw new TypeError("Generator is already executing.") | ||
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 | ||
@@ -427,10 +430,10 @@ switch(n=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i | ||
continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1] | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}} | ||
return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}} | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var i={driver:[localforage.INDEXEDDB,localforage.LOCALSTORAGE],name:"persist",isCompress:!1,valueMaxLength:512e3,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,s,u | ||
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 | ||
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(),s=0;s<a.length;s++)s<r&&n.push(a[s].key) | ||
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 u=o.sent(),[2,Promise.reject(u)] | ||
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 | ||
@@ -463,5 +466,5 @@ return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),e=[],[4,this.keys()] | ||
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.decompress(t.value):t.value),this.set(e,t.value,t.expire),[2,Promise.resolve(r)]):[2,Promise.resolve(t)] | ||
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,s | ||
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 | ||
@@ -472,13 +475,13 @@ case 1:return r<n.length?(a=(i=t).push,[4,this.get(n[r])]):[3,4] | ||
case 4:return[2,Promise.resolve(t)] | ||
case 5:return s=o.sent(),[2,Promise.reject(s)] | ||
case 6:return[2]}})})},e.prototype.set=function(e,t,i){return void 0===i&&(i=-1),n(this,void 0,void 0,function(){var n,a,s,u,c,f,l,h | ||
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?(s=void 0,u=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 s=o.sent(),u=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompress(s.value)):s.value,[2,Promise.resolve(u)] | ||
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.compress(l):l,[4,this.setItem(e,{now:a,count:n&&n.count?++n.count:0,length:f.length,value:f,expire:c})] | ||
case 4:return s=o.sent(),u=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompress(s.value)):s.value,[2,Promise.resolve(u)] | ||
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.decompress(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 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)] | ||
@@ -498,10 +501,10 @@ case 3:return[2]}})})},e.prototype.has=function(e){return n(this,void 0,void 0,function(){var t | ||
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,s,u,c,f,l,h,d,v,p,y,m | ||
case 8:return[2]}})})},e.prototype.getSortedItems=function(){return n(this,void 0,void 0,function(){var e,t,n,i,a,u,s,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:s=o.sent(),t.push(r({},s,{key:a})),o.label=4 | ||
case 3:u=o.sent(),t.push(r({},u,{key:a})),o.label=4 | ||
case 4:return n++,[3,2] | ||
case 5:for(u={},c=0,f=t;c<f.length;c++)u[(l=f[c]).count]||(u[l.count]=[]),u[l.count].push(l) | ||
for(d in h=[],u)u.hasOwnProperty(d)&&h.push({count:parseInt(d,10),items:u[d].sort(function(e,t){return t.now-e.now})}) | ||
case 5:for(s={},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})}) | ||
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) | ||
@@ -508,0 +511,0 @@ return[2,Promise.resolve(v)] |
@@ -13,5 +13,6 @@ var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{} | ||
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&&-1!==t.indexOf(a)||(r[a]=e[a])}return r},t.utf16ByteLength=function(e){for(var t=0,r=0;r<e.length;r++)t+=e.charCodeAt(r)<=65535?2:4 | ||
return t}}) | ||
unwrapExports(utils) | ||
var utils_1=utils.isDate,utils_2=utils.isNumber,utils_3=utils.isArray,utils_4=utils.isPlainObject,utils_5=utils.extend,utils_6=utils.omit,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 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] | ||
return o[1]},trys:[],ops:[]} | ||
@@ -235,3 +236,3 @@ return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i | ||
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,M="arbf",T="blob",B="si08",L="ui08",F="uic8",z="si16",G="si32",q="ur16",U="ui32",K="fl32",W="fl64",J=R+M.length,Z=Object.prototype.toString | ||
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 | ||
@@ -245,17 +246,17 @@ "="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
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+=M):(n=e.buffer,"[object Int8Array]"===r?o+=B:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=z:"[object Uint16Array]"===r?o+=q:"[object Int32Array]"===r?o+=G:"[object Uint32Array]"===r?o+=U:"[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 | ||
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+T+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,R)!==D)return JSON.parse(e) | ||
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===T&&k.test(r)){var n=r.match(k) | ||
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 M:return o | ||
case T:return i([o],{type:t}) | ||
case B:return new Int8Array(o) | ||
switch(type){case T:return o | ||
case B:return i([o],{type:t}) | ||
case M:return new Int8Array(o) | ||
case L:return new Uint8Array(o) | ||
case F:return new Uint8ClampedArray(o) | ||
case z:return new Int16Array(o) | ||
case q:return new Uint16Array(o) | ||
case G:return new Int32Array(o) | ||
case U:return new Uint32Array(o) | ||
case U:return new Int16Array(o) | ||
case G:return new Uint16Array(o) | ||
case z:return new Int32Array(o) | ||
case q:return new Uint32Array(o) | ||
case K:return new Float32Array(o) | ||
@@ -367,10 +368,3 @@ case W:return new Float64Array(o) | ||
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,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""},i=function(e){return function(e,t,r){if(null==e)return[] | ||
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 | ||
@@ -388,4 +382,13 @@ 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)}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}(e,16,function(e){return r(e)})} | ||
t.default={compress:function(e){return i(e).join("")},compressToArray:i,decompress:function(e){return null===e?"":""===e?null:o(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:o(e.length,16,function(t){return e[t].charCodeAt(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) | ||
@@ -413,3 +416,3 @@ 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]) | ||
Object.defineProperty(t,"__esModule",{value:!0}) | ||
var i={driver:[localforage.INDEXEDDB,localforage.LOCALSTORAGE],name:"persist",isCompress:!1,valueMaxLength:512e3,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 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 | ||
return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.length()] | ||
@@ -447,3 +450,3 @@ case 1:return e=o.sent(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
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.decompress(t.value):t.value),this.set(e,t.value,t.expire),[2,Promise.resolve(r)]):[2,Promise.resolve(t)] | ||
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)] | ||
@@ -460,9 +463,9 @@ case 4:return[2]}})})},e.prototype.gets=function(e){return n(this,void 0,void 0,function(){var t,r,n,i,a,u | ||
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.decompress(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.compress(l):l,[4,this.setItem(e,{now:a,count:n&&n.count?++n.count:0,length:f.length,value:f,expire:c})] | ||
case 4:return u=o.sent(),s=this.cacheConfig.isCompress?JSON.parse(LZString_1.default.decompress(u.value)):u.value,[2,Promise.resolve(s)] | ||
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.decompress(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 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)] | ||
@@ -469,0 +472,0 @@ case 3:return[2]}})})},e.prototype.has=function(e){return n(this,void 0,void 0,function(){var t |
@@ -14,3 +14,4 @@ !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" | ||
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&&-1!==t.indexOf(a)||(r[a]=e[a])}return r},t.utf16ByteLength=function(e){for(var t=0,r=0;r<e.length;r++)t+=e.charCodeAt(r)<=65535?2:4 | ||
return t}}) | ||
n(i) | ||
@@ -126,9 +127,9 @@ 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] | ||
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 b(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a(function(t){var r=e.transaction(l,y),n=i([""]) | ||
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 m(e){var t=d[e.name],r={} | ||
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) | ||
m(e),e.db.close()}var i=[e.name] | ||
b(e),e.db.close()}var i=[e.name] | ||
t&&i.push(e.version) | ||
@@ -147,3 +148,3 @@ var a=o.open.apply(o,i) | ||
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){m(e) | ||
r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then(function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),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] | ||
@@ -179,3 +180,3 @@ 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 | ||
var o=new a(function(r,o){var i | ||
n.ready().then(function(){return i=n._dbInfo,"[object Blob]"===v.call(t)?b(i.db).then(function(e){return e?t:(r=t,new a(function(e,t){var n=new FileReader | ||
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||"") | ||
@@ -217,3 +218,3 @@ e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)})) | ||
r=c.then(e.storeName?function(t){if(t.objectStoreNames.contains(e.storeName)){var r=t.version+1 | ||
m(e) | ||
b(e) | ||
var n=d[e.name],i=n.forages | ||
@@ -229,3 +230,3 @@ t.close() | ||
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){m(e) | ||
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 | ||
@@ -241,3 +242,3 @@ t.close() | ||
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__:",R=D.length,T="arbf",B="blob",M="si08",L="ui08",F="uic8",z="si16",U="si32",q="ur16",K="ui32",W="fl32",J="fl64",G=R+T.length,H=Object.prototype.toString | ||
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 | ||
@@ -251,16 +252,16 @@ "="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--) | ||
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+=T):(n=e.buffer,"[object Int8Array]"===r?o+=M:"[object Uint8Array]"===r?o+=L:"[object Uint8ClampedArray]"===r?o+=F:"[object Int16Array]"===r?o+=z:"[object Uint16Array]"===r?o+=q:"[object Int32Array]"===r?o+=U:"[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 | ||
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,R)!==D)return JSON.parse(e) | ||
var t,r=e.substring(G),type=e.substring(R,G) | ||
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 T:return o | ||
switch(type){case R:return o | ||
case B:return i([o],{type:t}) | ||
case M:return new Int8Array(o) | ||
case L:return new Uint8Array(o) | ||
case F:return new Uint8ClampedArray(o) | ||
case z:return new Int16Array(o) | ||
case F:return new Int8Array(o) | ||
case M:return new Uint8Array(o) | ||
case L:return new Uint8ClampedArray(o) | ||
case U:return new Int16Array(o) | ||
case q:return new Uint16Array(o) | ||
case U:return new Int32Array(o) | ||
case z:return new Int32Array(o) | ||
case K:return new Uint32Array(o) | ||
@@ -373,3 +374,16 @@ case W:return new Float32Array(o) | ||
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,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++)) | ||
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"" | ||
@@ -381,17 +395,6 @@ for(l=8*f+8,f=h=0;h!==l;)f+=(v>>--p&1)<<h++,0===p&&(p=t,v=n(y++)) | ||
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""},i=function(e){return 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,b=0 | ||
if(e.length){for(u=(f=e.charCodeAt(0))<256?0:1,i=0;i<v;i++)y=u>>i|y<<1,++b===t&&(b=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++b===t&&(b=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,++b===t&&(b=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,++b===t&&(b=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++b===t&&(b=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,++b===t&&(b=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,++b===t&&(b=0,p.push(r(y)),y=0) | ||
for(u=8+8*u,i=0;i<u;i++)y=f>>i&1|y<<1,++b===t&&(b=0,p.push(r(y)),y=0)}0==--h&&(h=1<<v++)}for(i=0;i<v;i++)y=2>>i&1|y<<1,++b===t&&(b=0,p.push(r(y)),y=0) | ||
return p.push(r(y<<=t-b)),p}(e,16,function(e){return r(e)})} | ||
t.default={compress:function(e){return i(e).join("")},compressToArray:i,decompress:function(e){return null===e?"":""===e?null:o(e.length,16,function(t){return e.charCodeAt(t)})},decompressFromArray:function(e){return null===e?"":0===e.length?null:o(e.length,16,function(t){return e[t].charCodeAt(0)})}}}) | ||
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) | ||
@@ -419,3 +422,3 @@ 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]) | ||
Object.defineProperty(r,"__esModule",{value:!0}) | ||
var s={driver:[u.INDEXEDDB,u.LOCALSTORAGE],name:"persist",isCompress:!1,valueMaxLength:512e3,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 | ||
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 | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.length()] | ||
@@ -453,3 +456,3 @@ case 1:return e=a.sent(),r=Math.floor((t=this.cacheConfig.oldItemsCount)<1?e*t:t),n=[],[4,this.getSortedItems()] | ||
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.decompress(t.value):t.value),this.set(e,t.value,t.expire),[2,Promise.resolve(r)]):[2,Promise.resolve(t)] | ||
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)] | ||
@@ -466,9 +469,9 @@ case 4:return[2]}})})},e.prototype.gets=function(e){return o(this,void 0,void 0,function(){var t,r,n,o,i,u | ||
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.decompress(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.compress(d):d,[4,this.setItem(e,{now:u,count:o&&o.count?++o.count:0,length:h.length,value:h,expire:l})] | ||
case 4:return s=a.sent(),f=this.cacheConfig.isCompress?JSON.parse(c.default.decompress(s.value)):s.value,[2,Promise.resolve(f)] | ||
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.decompress(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 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)] | ||
@@ -488,3 +491,3 @@ case 3:return[2]}})})},e.prototype.has=function(e){return o(this,void 0,void 0,function(){var t | ||
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,b | ||
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 | ||
return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,6,,7]),[4,this.keys()] | ||
@@ -499,3 +502,3 @@ case 1:e=a.sent(),t=[],r=0,o=e,a.label=2 | ||
return[2,Promise.resolve(v)] | ||
case 6:return b=a.sent(),[2,Promise.reject(b)] | ||
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}() | ||
@@ -502,0 +505,0 @@ r.default=f}) |
{ | ||
"name": "mycache", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A Cache library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -54,25 +54,25 @@ # Mycache | ||
```js | ||
```ts | ||
// get value of key | ||
function get(key: string): Promise<any> | ||
function get(key: string): Promise<any> {} | ||
// get all value of keys | ||
function gets() : Promise<any> | ||
function gets() : Promise<any> {} | ||
// set key value and expire time | ||
function set<T>(key: string, value: T, expire: number | Date = -1): Promise<T> | ||
function set<T>(key: string, value: T, expire: number | Date = -1): Promise<T> {} | ||
// append key value and expire time | ||
function append<T>(key: string, value: T, expire: number | Date = -1): Promise<T> | ||
function append<T>(key: string, value: T, expire: number | Date = -1): Promise<T> {} | ||
// if the key has in local | ||
function has(key: string): Promise<boolean> | ||
function has(key: string): Promise<boolean> {} | ||
// remove key | ||
function remove(key: string): Promise<void> | ||
function remove(key: string): Promise<void> {} | ||
// get all keys | ||
function keys(): Promise<string[]> | ||
function keys(): Promise<string[]> {} | ||
// clear all keys | ||
function clear(): Promise<void> | ||
function clear(): Promise<void> {} | ||
// the length of all keys | ||
function length(): Promise<number> | ||
function length(): Promise<number> {} | ||
// each all keys by callback | ||
function each(iterator: (value: any, key: string, iterationNumber: number) => void): Promise<boolean> | ||
function each(iterator: (value: any, key: string, iterationNumber: number) => void): Promise<boolean> {} | ||
// if the key is expired | ||
function isExpired(key: string): Promise<boolean> | ||
function isExpired(key: string): Promise<boolean> {} | ||
``` | ||
@@ -88,2 +88,3 @@ | ||
storeName: 'persist', // The name of the datastore | ||
isCompress: false, // if enable string compress | ||
valueMaxLength: 500 * 1000, // max length of value | ||
@@ -96,35 +97,35 @@ oldItemsCount: 0.2, // this count of old items | ||
```js | ||
```ts | ||
// get value of key | ||
function get(key: string): Promise<any> | ||
function get(key: string): Promise<any> {} | ||
// get all value of keys | ||
function gets() : Promise<any> | ||
function gets() : Promise<any> {} | ||
// set key value and expire time | ||
function set<T>(key: string, value: T, expire: number | Date = -1): Promise<T> | ||
function set<T>(key: string, value: T, expire: number | Date = -1): Promise<T> {} | ||
// append key value and expire time | ||
function append<T>(key: string, value: T, expire: number | Date = -1): Promise<T> | ||
function append<T>(key: string, value: T, expire: number | Date = -1): Promise<T> {} | ||
// if the key has in local | ||
function has(key: string): Promise<boolean> | ||
function has(key: string): Promise<boolean> {} | ||
// remove key | ||
function remove(key: string): Promise<void> | ||
function remove(key: string): Promise<void> {} | ||
// get all keys | ||
function keys(): Promise<string[]> | ||
function keys(): Promise<string[]> {} | ||
// clear all keys | ||
function clear(): Promise<void> | ||
function clear(): Promise<void> {} | ||
// the length of all keys | ||
function length(): Promise<number> | ||
function length(): Promise<number> {} | ||
// each all keys by callback | ||
function each(iterator: (value: any, key: string, iterationNumber: number) => void): Promise<boolean> | ||
function each(iterator: (value: any, key: string, iterationNumber: number) => void): Promise<boolean> {} | ||
// if the key is expired | ||
function isExpired(key: string): Promise<boolean> | ||
function isExpired(key: string): Promise<boolean> {} | ||
// get all expired keys | ||
function getExpiredKeys(): Promise<string[]> | ||
function getExpiredKeys(): Promise<string[]> {} | ||
// if the key is overlength | ||
function isOverLength(key: string): Promise<boolean> | ||
function isOverLength(key: string): Promise<boolean> {} | ||
// get all overlength keys | ||
function getOverLengthKeys(): Promise<string[]> | ||
function getOverLengthKeys(): Promise<string[]> {} | ||
// if the key is old | ||
function getOldKeys(): Promise<string[]> | ||
function getOldKeys(): Promise<string[]> {} | ||
// get items by sorted | ||
function getSortedItems(): Promise<typed.IPersistDataMap[]> | ||
function getSortedItems(): Promise<typed.IPersistDataMap[]> {} | ||
``` | ||
@@ -131,0 +132,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
931913
5226
131