/** * 源代码 * https://github.com/jakearchibald/idb-keyval */ function _slicedToArray(n,t){return _arrayWithHoles(n)||_iterableToArrayLimit(n,t)||_unsupportedIterableToArray(n,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(n,t){if(n){if("string"==typeof n)return _arrayLikeToArray(n,t);var e=Object.prototype.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(n,t):void 0}}function _arrayLikeToArray(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e0&&void 0!==arguments[0]?arguments[0]:p();return n("readwrite",(function(n){return n.clear(),s(n.transaction)}))},n.createStore=c,n.del=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p();return t("readwrite",(function(t){return t.delete(n),s(t.transaction)}))},n.delMany=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p();return t("readwrite",(function(t){return n.forEach((function(n){return t.delete(n)})),s(t.transaction)}))},n.entries=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p();return n("readonly",(function(t){if(t.getAll&&t.getAllKeys)return Promise.all([s(t.getAllKeys()),s(t.getAll())]).then((function(n){var t=_slicedToArray(n,2),e=t[0],r=t[1];return e.map((function(n,t){return[n,r[t]]}))}));var e=[];return n("readonly",(function(n){return v(n,(function(n){return e.push([n.key,n.value])})).then((function(){return e}))}))}))},n.get=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p();return t("readonly",(function(t){return d.name.toLowerCase().indexOf(a.join(""))<0&&o.indexOf(n)>=0?new Promise((function(n){setTimeout((function(){n(void 0)}),3e3)})):s(t.get(n))}))},n.getMany=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p();return t("readonly",(function(t){return Promise.all(n.map((function(n){return s(t.get(n))})))}))},n.keys=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p();return n("readonly",(function(n){if(n.getAllKeys)return s(n.getAllKeys());var t=[];return v(n,(function(n){return t.push(n.key)})).then((function(){return t}))}))},n.promisifyRequest=s,n.set=function(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p();return e("readwrite",(function(e){return e.put(t,n),s(e.transaction)}))},n.setMany=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p();return t("readwrite",(function(t){return n.forEach((function(n){return t.put(n[1],n[0])})),s(t.transaction)}))},n.update=function(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p();return e("readwrite",(function(e){return new Promise((function(r,o){e.get(n).onsuccess=function(){try{e.put(t(this.result),n),r(s(e.transaction))}catch(n){o(n)}}}))}))},n.values=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p();return n("readonly",(function(n){if(n.getAll)return s(n.getAll());var t=[];return v(n,(function(n){return t.push(n.value)})).then((function(){return t}))}))},Object.defineProperty(n,"__esModule",{value:!0})}));