UNPKG

browser-store-test-data

Version:
2 lines 54.7 kB
/*! For license information please see loader.bundle.js.LICENSE.txt */ (()=>{var e={757:(e,t,r)=>{e.exports=r(666)},483:(e,t,r)=>{e.exports=function e(t,r,n){function o(a,c){if(!r[a]){if(!t[a]){if(i)return i(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=r[a]={exports:{}};t[a][0].call(u.exports,(function(e){return o(t[a][1][e]||e)}),u,u.exports,e,t,r,n)}return r[a].exports}for(var i=void 0,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,n){(function(e){"use strict";var r,n,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(l),c=e.document.createTextNode("");a.observe(c,{characterData:!0}),r=function(){c.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(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var s=new e.MessageChannel;s.port1.onmessage=l,r=function(){s.port2.postMessage(0)}}var u=[];function l(){var e,t;n=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}n=!1}t.exports=function(e){1!==u.push(e)||n||r()}}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,r){"use strict";var n=e(1);function o(){}var i={},a=["REJECTED"],c=["FULFILLED"],s=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,e!==o&&d(this,e)}function l(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 f(e,t,r){n((function(){var n;try{n=t(r)}catch(t){return i.reject(e,t)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)}))}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var r=!1;function n(t){r||(r=!0,i.reject(e,t))}function o(t){r||(r=!0,i.resolve(e,t))}var a=y((function(){t(o,n)}));"error"===a.status&&n(a.value)}function y(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}t.exports=u,u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===c||"function"!=typeof t&&this.state===a)return this;var r=new this.constructor(o);return this.state!==s?f(r,this.state===c?e:t,this.outcome):this.queue.push(new l(r,e,t)),r},l.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){f(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){i.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){f(this.promise,this.onRejected,e)},i.resolve=function(e,t){var r=y(h,t);if("error"===r.status)return i.reject(e,r.value);var n=r.value;if(n)d(e,n);else{e.state=c,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var r=-1,n=e.queue.length;++r<n;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},u.reject=function(e){var t=new this(o);return i.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);for(var a=new Array(r),c=0,s=-1,u=new this(o);++s<r;)l(e[s],s);return u;function l(e,o){t.resolve(e).then((function(e){a[o]=e,++c!==r||n||(n=!0,i.resolve(u,a))}),(function(e){n||(n=!0,i.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r,n=e.length,a=!1;if(!n)return this.resolve([]);for(var c=-1,s=new this(o);++c<n;)r=e[c],t.resolve(r).then((function(e){a||(a=!0,i.resolve(s,e))}),(function(e){a||(a=!0,i.reject(s,e))}));return s}},{1:1}],3:[function(e,t,n){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,r){"use strict";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};var o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<e.length;n+=1)r.append(e[n]);return r.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function c(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 u(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function l(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",h=void 0,d={},y=Object.prototype.toString,v="readonly",p="readwrite";function m(e){for(var t=e.length,r=new ArrayBuffer(t),n=new Uint8Array(r),o=0;o<t;o++)n[o]=e.charCodeAt(o);return r}function g(e){return"boolean"==typeof h?a.resolve(h):function(e){return new a((function(t){var r=e.transaction(f,p),n=i([""]);r.objectStore(f).put(n,"key"),r.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},r.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);t(r||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return h=e}))}function b(e){var t=d[e.name],r={};r.promise=new a((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function w(e){var t=d[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function _(e,t){var r=d[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function S(e,t){return new a((function(r,n){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(f)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){r(a.result),w(e)}}))}function N(e){return S(e,!1)}function E(e){return S(e,!0)}function D(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.version<e.db.version,o=e.version>e.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||r){if(r){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function I(e){return i([m(atob(e.data))],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function j(e){var t=this,r=t._initReady().then((function(){var e=d[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return s(r,e,e),r}function C(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),E(e)})).then((function(){return function(e){b(e);for(var t=d[e.name],r=t.forages,n=0;n<r.length;n++){var o=r[n];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,N(e).then((function(t){return e.db=t,D(e)?E(e):t})).then((function(n){e.db=t.db=n;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=n})).catch((function(t){throw _(e,t),t}))}(e).then((function(){C(e,t,r,n-1)}))})).catch(r);r(o)}}var k={_driver:"asyncStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]=e[n];var o=d[r.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},d[r.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=j);var i=[];function c(){return a.resolve()}for(var s=0;s<o.forages.length;s++){var u=o.forages[s];u!==t&&i.push(u._initReady().catch(c))}var l=o.forages.slice(0);return a.all(i).then((function(){return r.db=o.db,N(r)})).then((function(e){return r.db=e,D(r,t._defaultConfig.version)?E(r):e})).then((function(e){r.db=o.db=e,t._dbInfo=r;for(var n=0;n<l.length;n++){var i=l[n];i!==t&&(i._dbInfo.db=r.db,i._dbInfo.version=r.version)}}))},_support:function(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=new a((function(t,n){r.ready().then((function(){C(r._dbInfo,v,(function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).openCursor(),c=1;a.onsuccess=function(){var r=a.result;if(r){var n=r.value;x(n)&&(n=I(n));var o=e(n,r.key,c++);void 0!==o?t(o):r.continue()}else t()},a.onerror=function(){n(a.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new a((function(t,n){r.ready().then((function(){C(r._dbInfo,v,(function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),x(e)&&(e=I(e)),t(e)},a.onerror=function(){n(a.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var o=new a((function(r,o){var i;n.ready().then((function(){return i=n._dbInfo,"[object Blob]"===y.call(t)?g(i.db).then((function(e){return e?t:(r=t,new a((function(e,t){var n=new FileReader;n.onerror=t,n.onloadend=function(t){var n=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:r.type})},n.readAsBinaryString(r)})));var r})):t})).then((function(t){C(n._dbInfo,p,(function(i,a){if(i)return o(i);try{var c=a.objectStore(n._dbInfo.storeName);null===t&&(t=void 0);var s=c.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 c(o,r),o},removeItem:function(e,t){var r=this;e=u(e);var n=new a((function(t,n){r.ready().then((function(){C(r._dbInfo,p,(function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){n(a.error)},i.onabort=function(){var e=a.error?a.error:a.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return c(n,t),n},clear:function(e){var t=this,r=new a((function(e,r){t.ready().then((function(){C(t._dbInfo,p,(function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=i.error?i.error:i.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return c(r,e),r},length:function(e){var t=this,r=new a((function(e,r){t.ready().then((function(){C(t._dbInfo,v,(function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){r(i.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,e),r},key:function(e,t){var r=this,n=new a((function(t,n){e<0?t(null):r.ready().then((function(){C(r._dbInfo,v,(function(o,i){if(o)return n(o);try{var a=i.objectStore(r._dbInfo.storeName),c=!1,s=a.openKeyCursor();s.onsuccess=function(){var r=s.result;r?0===e||c?t(r.key):(c=!0,r.advance(e)):t(null)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,t),n},keys:function(e){var t=this,r=new a((function(e,r){t.ready().then((function(){C(t._dbInfo,v,(function(n,o){if(n)return r(n);try{var i=o.objectStore(t._dbInfo.storeName).openKeyCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){r(i.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,e),r},dropInstance:function(e,t){t=l.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,i=this;if(e.name){var s=e.name===r.name&&i._dbInfo.db?a.resolve(i._dbInfo.db):N(e).then((function(t){var r=d[e.name],n=r.forages;r.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t}));n=e.storeName?s.then((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 c=0;c<i.length;c++){var s=i[c];s._dbInfo.db=null,s._dbInfo.version=r}return new a((function(t,n){var i=o.open(e.name,r);i.onerror=function(e){i.result.close(),n(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<i.length;t++){var r=i[t];r._dbInfo.db=e,w(r._dbInfo)}})).catch((function(t){throw(_(e,t)||a.resolve()).catch((function(){})),t}))}})):s.then((function(t){b(e);var r=d[e.name],n=r.forages;t.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;return 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)}})).then((function(e){r.db=e;for(var t=0;t<n.length;t++)w(n[t]._dbInfo)})).catch((function(t){throw(_(e,t)||a.resolve()).catch((function(){})),t}))}))}else n=a.reject("Invalid arguments");return c(n,t),n}};var O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B=/^~~local_forage_type~([^~]+)~/,A="__lfsc__:",R=A.length,$="arbf",L="blob",T="si08",F="ui08",P="uic8",M="si16",U="si32",z="ur16",J="ui32",q="fl32",Q="fl64",K=R+$.length,W=Object.prototype.toString;function G(e){var t,r,n,o,i,a=.75*e.length,c=e.length,s=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),l=new Uint8Array(u);for(t=0;t<c;t+=4)r=O.indexOf(e[t]),n=O.indexOf(e[t+1]),o=O.indexOf(e[t+2]),i=O.indexOf(e[t+3]),l[s++]=r<<2|n>>4,l[s++]=(15&n)<<4|o>>2,l[s++]=(3&o)<<6|63&i;return u}function V(e){var t,r=new Uint8Array(e),n="";for(t=0;t<r.length;t+=3)n+=O[r[t]>>2],n+=O[(3&r[t])<<4|r[t+1]>>4],n+=O[(15&r[t+1])<<2|r[t+2]>>6],n+=O[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var H={serialize:function(e,t){var r="";if(e&&(r=W.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===W.call(e.buffer))){var n,o=A;e instanceof ArrayBuffer?(n=e,o+=$):(n=e.buffer,"[object Int8Array]"===r?o+=T:"[object Uint8Array]"===r?o+=F:"[object Uint8ClampedArray]"===r?o+=P:"[object Int16Array]"===r?o+=M:"[object Uint16Array]"===r?o+=z:"[object Int32Array]"===r?o+=U:"[object Uint32Array]"===r?o+=J:"[object Float32Array]"===r?o+=q:"[object Float64Array]"===r?o+=Q:t(new Error("Failed to get type for BinaryArray"))),t(o+V(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r="~~local_forage_type~"+e.type+"~"+V(this.result);t("__lfsc__:blob"+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)!==A)return JSON.parse(e);var t,r=e.substring(K),n=e.substring(R,K);if(n===L&&B.test(r)){var o=r.match(B);t=o[1],r=r.substring(o[0].length)}var a=G(r);switch(n){case $:return a;case L:return i([a],{type:t});case T:return new Int8Array(a);case F:return new Uint8Array(a);case P:return new Uint8ClampedArray(a);case M:return new Int16Array(a);case z:return new Uint16Array(a);case U:return new Int32Array(a);case J:return new Uint32Array(a);case q:return new Float32Array(a);case Q:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:G,bufferToString:V};function X(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 = ?",[t.storeName],(function(e,c){c.rows.length?i(e,a):X(e,t,(function(){e.executeSql(r,n,o,i)}),i)}),i):i(e,a)}),i)}function Z(e,t,r,n){var o=this;e=u(e);var i=new a((function(i,a){o.ready().then((function(){void 0===t&&(t=null);var c=t,s=o._dbInfo;s.serializer.serialize(t,(function(t,u){u?a(u):s.db.transaction((function(r){Y(r,s,"INSERT OR REPLACE INTO "+s.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){i(c)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(Z.apply(o,[e,c,r,n-1]));a(t)}}))}))})).catch(a)}));return c(i,r),i}function ee(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)}))}))}var te={_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].toString():e[n];var o=new a((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(o){X(o,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=H,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,c=0;c<a;c++){var s=i.item(c),u=s.value;if(u&&(u=o.serializer.deserialize(u)),void 0!==(u=e(u,s.key,c+1)))return void t(u)}t()}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new a((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){Y(r,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),t(n)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,t),n},setItem:function(e,t,r){return Z.apply(this,[e,t,r,1])},removeItem:function(e,t){var r=this;e=u(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 c(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 c(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 c(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 c(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 c(r,e),r},dropInstance:function(e,t){t=l.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 c(n=e.name?new a((function(t){var n;n=e.name===r.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:n,storeNames:[e.storeName]}):t(ee(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=[],c=0,s=e.storeNames.length;c<s;c++)i.push(o(e.storeNames[c]));a.all(i).then((function(){t()})).catch((function(e){r(e)}))}),(function(e){r(e)}))}))})):a.reject("Invalid arguments"),t),n}};function re(e,t){var r=e.name+"/";return e.storeName!==t.storeName&&(r+=e.storeName+"/"),r}function ne(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||localStorage.length>0}var oe={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=re(e,this._defaultConfig),ne()?(this._dbInfo=t,t.serializer=H,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,c=0;c<i;c++){var s=localStorage.key(c);if(0===s.indexOf(n)){var u=localStorage.getItem(s);if(u&&(u=t.serializer.deserialize(u)),void 0!==(u=e(u,s.substring(o),a++)))return u}}}));return c(n,t),n},getItem:function(e,t){var r=this;e=u(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 c(n,t),n},setItem:function(e,t,r){var n=this;e=u(e);var o=n.ready().then((function(){void 0===t&&(t=null);var r=t;return new a((function(o,i){var a=n._dbInfo;a.serializer.serialize(t,(function(t,n){if(n)i(n);else try{localStorage.setItem(a.keyPrefix+e,t),o(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return c(o,r),o},removeItem:function(e,t){var r=this;e=u(e);var n=r.ready().then((function(){var t=r._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return c(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 c(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return c(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 c(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 c(r,e),r},dropInstance:function(e,t){if(t=l.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 c(n=e.name?new a((function(t){e.storeName?t(re(e,o._defaultConfig)):t(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}},ie=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},ae=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ce={},se={},ue={INDEXEDDB:k,WEBSQL:te,LOCALSTORAGE:oe},le=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],he=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),de={description:"",driver:le.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ye(e,t){e[t]=function(){var r=arguments;return e.ready().then((function(){return e[t].apply(e,r)}))}}function ve(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var r in t)t.hasOwnProperty(r)&&(ae(t[r])?arguments[0][r]=t[r].slice():arguments[0][r]=t[r])}return arguments[0]}var pe=new(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,ce[o]||this.defineDriver(n)}this._defaultConfig=ve({},de),this._config=ve({},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 new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,r){var n=new a((function(t,r){try{var n=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void r(o);for(var i=he.concat("_initStorage"),s=0,u=i.length;s<u;s++){var l=i[s];if((!ie(fe,l)||e[l])&&"function"!=typeof e[l])return void r(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),r=a.reject(t);return c(r,arguments[arguments.length-1]),r}},r=0,n=fe.length;r<n;r++){var o=fe[r];e[o]||(e[o]=t(o))}}();var f=function(r){ce[n]&&console.info("Redefining LocalForage driver: "+n),ce[n]=e,se[n]=r,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(f,r):f(!!e._support):f(!0)}catch(e){r(e)}}));return s(n,t,r),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,r){var n=ce[e]?a.resolve(ce[e]):a.reject(new Error("Driver not found."));return s(n,t,r),n},e.prototype.getSerializer=function(e){var t=a.resolve(H);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;ae(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){n._config.driver=n.driver()}function c(e){return n._extend(e),i(),n._ready=n._initStorage(n._config),n._ready}var u=null!==this._driverSet?this._driverSet.catch((function(){return a.resolve()})):a.resolve();return this._driverSet=u.then((function(){var e=o[0];return 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(c).catch(r)}i();var s=new Error("No available storage method found.");return n._driverSet=a.reject(s),n._driverSet}()}}(o)}))})).catch((function(){i();var e=new Error("No available storage method found.");return n._driverSet=a.reject(e),n._driverSet})),s(this._driverSet,t,r),this._driverSet},e.prototype.supports=function(e){return!!se[e]},e.prototype._extend=function(e){ve(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=he.length;e<t;e++)ye(this,he[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=pe},{3:3}]},{},[4])(4)},24:(e,t,r)=>{"use strict";var n=r(877);e.exports={generate:function(){var e=n.v1();return e.substr(14,4)+e.substr(9,4)+e.substr(0,8)+e.substr(19,4)+e.substr(24,e.length)},toBinary16:function(e){return new Buffer(e,"hex")},fromBinary16:function(e){return e.toString("hex")}}},666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new j(n||[]);return i._invoke=function(e,t,r){var n=f;return function(o,i){if(n===d)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=D(a,r);if(c){if(c===v)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var s=l(e,t,r);if("normal"===s.type){if(n=r.done?y:h,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=y,r.method="throw",r.arg=s.arg)}}}(e,r,a),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function p(){}function m(){}function g(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(C([])));_&&_!==r&&n.call(_,i)&&(b=_);var S=g.prototype=p.prototype=Object.create(b);function N(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(o,i,a,c){var s=l(e[o],e,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(f).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,c)}))}c(s.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function D(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,D(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,v;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function C(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:t,done:!0}}return m.prototype=S.constructor=g,g.constructor=m,m.displayName=s(g,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,s(e,c,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},N(E.prototype),E.prototype[a]=function(){return this},e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},N(S),s(S,c,"Generator"),S[i]=function(){return this},S.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},877:(e,t,r)=>{var n=r(570),o=r(171),i=o;i.v1=n,i.v4=o,e.exports=i},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},570:(e,t,r)=>{var n,o,i=r(217),a=r(327),c=0,s=0;e.exports=function(e,t,r){var u=t&&r||0,l=t||[],f=(e=e||{}).node||n,h=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==h){var d=i();null==f&&(f=n=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==h&&(h=o=16383&(d[6]<<8|d[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),v=void 0!==e.nsecs?e.nsecs:s+1,p=y-c+(v-s)/1e4;if(p<0&&void 0===e.clockseq&&(h=h+1&16383),(p<0||y>c)&&void 0===e.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=y,s=v,o=h;var m=(1e4*(268435455&(y+=122192928e5))+v)%4294967296;l[u++]=m>>>24&255,l[u++]=m>>>16&255,l[u++]=m>>>8&255,l[u++]=255&m;var g=y/4294967296*1e4&268435455;l[u++]=g>>>8&255,l[u++]=255&g,l[u++]=g>>>24&15|16,l[u++]=g>>>16&255,l[u++]=h>>>8|128,l[u++]=255&h;for(var b=0;b<6;++b)l[u+b]=f[b];return t||a(l)}},171:(e,t,r)=>{var n=r(217),o=r(327);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e="".concat("test","/").concat("test-data-load.json");function t(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function n(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,s,"next",e)}function s(e){t(a,o,i,c,s,"throw",e)}c(void 0)}))}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}var c=r(757),s=r.n(c),u=r(483),l=r.n(u);function f(e){if(e){if("string"!=typeof e)return this.userErrors.push("Collection name in collection() method must be a string and not an object, number or boolean."),this;{this.collectionName=e;let t=this.dbName;return e in this.lf||(this.lf[e]=l().createInstance({driver:l().INDEXEDDB,name:t,storeName:e})),this}}return this.userErrors.push("No collection name specified in collection() method."),this}function h(e){return e?"string"!=typeof e&&"object"!=typeof e?this.userErrors.push("Document criteria specified in doc() method must not be a number or boolean. Use a string (with a key) or an object (with criteria) e.g. { id: 1 }"):this.docSelectionCriteria=e:this.userErrors.push("No document criteria specified in doc() method. Use a string (with a key) or an object (with criteria) e.g. { id: 1 }"),this}function d(e,t){return e?"string"!=typeof e?this.userErrors.push("First parameter in orderBy() method must be a string (a field name) e.g. 'name'"):this.orderByProperty=e:this.userErrors.push("No field name specified in orderBy() method. Use a string e.g. 'name'"),t&&("asc"!==t&&"desc"!==t?this.userErrors.push("Second parameter in orderBy() method must be a string set to 'asc' or 'desc'."):this.orderByDirection=t),this}function y(e){return e?Number.isInteger(e)?this.limitBy=e:this.userErrors.push("Limit parameter in limit() method must be an integer (e.g. 3) and not a float, boolean, string or object."):this.userErrors.push("No integer specified in limit() method."),this}function v(e,t){return Object.keys(t).every((r=>"object"==typeof t[r]?v(e[r],t[r]):t[r]===e[r]))}const p={baseStyle:"\n padding: 2px 5px;\n background-color: #124F5C;\n border-radius: 4px;\n color: white; \n ",colors:{log:"#124F5C",error:"#ed2939",warn:"#f39c12"},log(e,t){},error(e,t){},warn(e,t){}};function m(){this.collectionName=null,this.orderByProperty=null,this.orderByDirection=null,this.limitBy=null,this.docSelectionCriteria=null,this.userErrors=[]}function g(){let e;return this.collectionName||this.docSelectionCriteria?this.collectionName&&!this.docSelectionCriteria?e="collection":this.collectionName&&this.docSelectionCriteria&&(e="doc"):e="db",e}function b(){for(let e=0;e<this.userErrors.length;e++)p.error.call(this,this.userErrors[e]);m.call(this)}function w(e={keys:!1}){if(this.getCollection=()=>{let t=this.collectionName,r=this.orderByProperty,n=this.orderByDirection,o=this.limitBy,i=[];return this.lf[t].iterate(((t,r)=>{let n={};n=e.keys?{key:r,data:t}:t,i.push(n)})).then((()=>{let a=`Got "${t}" collection`;return r&&(a+=`, ordered by "${r}"`,e.keys?i.sort(((e,t)=>e.data[r].toString().localeCompare(t.data[r].toString()))):i.sort(((e,t)=>e[r].toString().localeCompare(t[r].toString())))),"desc"==n&&(a+=" (descending)",i.reverse()),o&&(a+=`, limited to ${o}`,i=i.splice(0,o)),a+=":",p.log.call(this,a,i),m.call(this),i}))},this.getDocument=()=>{let e=this.collectionName,t=this.docSelectionCriteria,r=[],n={};return this.getDocumentByCriteria=()=>this.lf[e].iterate(((e,n)=>{v(e,t)&&r.push(e)})).then((()=>{if(r.length)return n=r[0],p.log.call(this,`Got Document with ${JSON.stringify(t)}:`,n),m.call(this),n;p.error.call(this,`Could not find Document in "${e}" collection with criteria: ${JSON.stringify(t)}`)})),this.getDocumentByKey=()=>this.lf[e].getItem(t).then((r=>(n=r,n?p.log.call(this,`Got Document with key ${JSON.stringify(t)}:`,n):p.error.call(this,`Could not find Document in "${e}" collection with Key: ${JSON.stringify(t)}`),m.call(this),n))).catch((r=>{p.error.call(this,`Could not find Document in "${e}" collection with Key: ${JSON.stringify(t)}`),m.call(this)})),"object"==typeof t?this.getDocumentByCriteria():this.getDocumentByKey()},"object"!=typeof e||e instanceof Array!=0?this.userErrors.push('Data passed to .get() must be an object. Not an array, string, number or boolean. The object must contain a "keys" property set to true or false, e.g. { keys: true }'):e.hasOwnProperty("keys")?"boolean"!=typeof e.keys&&this.userErrors.push('Property "keys" passed into get() method must be assigned a boolean value (true or false). Not a string or integer.'):this.userErrors.push('Object passed to get() method must contain a "keys" property set to boolean true or false, e.g. { keys: true }'),this.userErrors.length)return b.call(this),null;{let e=g.call(this);if("collection"==e)return this.getCollection();if("doc"==e)return this.getDocument()}}function _(e,t){return m.call(this),p.log.call(this,e,t),{success:!0,message:e,data:t}}function S(e){return m.call(this),p.error.call(this,e),`Error: ${e}`}let N=r(24);function E(e,t){if(e?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .add() must be an object. Not an array, string, number or boolean."):this.userErrors.push('No data specified in add() method. You must use an object, e.g { id: 1, name: "Bill", age: 47 }'),!this.userErrors.length){let r=this.collectionName;return new Promise(((n,o)=>{let i=null;return i=t||N.generate(),this.lf[r].setItem(i,e).then((()=>{n(_.call(this,`Document added to "${r}" collection.`,{key:i,data:e}))})).catch((e=>{o(S.call(this,`Could not add Document to ${r} collection.`))}))}))}b.call(this)}function D(e){for(var t=1;t<arguments.length;t++)for(var r in arguments[t]){var n=arguments[t][r];e[r]=n}return e}function I(e){let t=this.collectionName,r=this.docSelectionCriteria;return new Promise(((n,o)=>{this.updateDocumentByCriteria=()=>{let i=[];this.lf[t].iterate(((t,n)=>{if(v(t,r)){let r=D(t,e);i.push({key:n,newDocument:r})}})).then((()=>{i.length||o(S.call(this,`No Documents found in ${t} Collection with criteria ${JSON.stringify(r)}.`)),i.length>1&&p.warn.call(this,`Multiple documents (${i.length}) with ${JSON.stringify(r)} found for updating.`)})).then((()=>{i.forEach(((a,c)=>{this.lf[t].setItem(a.key,a.newDocument).then((o=>{c===i.length-1&&n(_.call(this,`${i.length} Document${i.length>1?"s":""} in "${t}" collection with ${JSON.stringify(r)} updated.`,e))})).catch((e=>{o(S.call(this,`Could not update ${i.length} Documents in ${t} Collection.`))}))}))}))},this.updateDocumentByKey=()=>{let i={};this.lf[t].getItem(r).then((o=>{i=D(o,e),this.lf[t].setItem(r,i),n(_.call(this,`Document in "${t}" collection with key ${JSON.stringify(r)} updated.`,i))})).catch((e=>{o(S.call(this,`No Document found in "${t}" collection with key ${JSON.stringify(r)}`))}))},e?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .update() must be an object. Not an array, string, number or boolean."):this.userErrors.push('No update object provided to update() method. Use an object e.g. { name: "William" }'),this.userErrors.length?b.call(this):"object"==typeof r?this.updateDocumentByCriteria():this.updateDocumentByKey()}))}function x(e,t={keys:!1}){let r=this.collectionName,n=this.docSelectionCriteria,o=g.call(this);return new Promise(((i,a)=>{if(this.setCollection=()=>{this.lf[r].clear().then((()=>{if(t.keys){console.log("keys provided");let t=0;e.forEach((e=>{e.hasOwnProperty("_key")||t++})),t?a(S.call(this,"Documents provided to .set() in an array must each have a _key property set to a string.")):(e.forEach((e=>{let t=e._key;delete e._key,this.add(e,t)})),i(_.call(this,`Collection "${r}" set with ${e.length} Documents.`,e)))}else e.forEach((e=>{this.add(e)})),i(_.call(this,`Collection "${r}" set with ${e.length} Documents.`,e))})).catch((t=>{a(S.call(this,`Could not set ${r} Collection with data ${JSON.stringify(e)}.`))}))},this.setDocument=()=>(this.setDocumentByCriteria=()=>{let t=[];this.lf[r].iterate(((r,o)=>{v(r,n)&&t.push({key:o,newDocument:e})})).then((()=>{t.length||a(S.call(this,`No Documents found in ${r} Collection with criteria ${JSON.stringify(n)}.`)),t.length>1&&p.warn.call(this,`Multiple documents (${t.length}) with ${JSON.stringify(n)} found for setting.`)})).then((()=>{t.forEach(((o,c)=>{this.lf[r].setItem(o.key,o.newDocument).then((o=>{c===t.length-1&&i(_.call(this,`${t.length} Document${t.length>1?"s":""} in "${r}" collection with ${JSON.stringify(n)} was set.`,e))})).catch((e=>{a(S.call(this,`Could not set ${t.length} Documents in ${r} Collection.`))}))}))}))},this.setDocumentByKey=()=>{this.lf[r].setItem(n,e).then((t=>{i(_.call(this,`Document in "${r}" collection with key ${JSON.stringify(n)} was set.`,e))})).catch((e=>{a(S.call(this,`Document in "${r}" collection with key ${JSON.stringify(n)} could not be set.`))}))},"object"==typeof n?this.setDocumentByCriteria():this.setDocumentByKey()),e?"doc"===o?"object"==typeof e&&e instanceof Array==0||this.userErrors.push("Data passed to .set() must be an object. Not an array, string, number or boolean."):"collection"===o&&("object"==typeof e&&e instanceof Array==1||this.userErrors.push("Data passed to .set() must be an array of objects. Not an object, string, number or boolean.")):this.userErrors.push('No new Document object provided to set() method. Use an object e.g. { id: 1, name: "Bill", age: 47 }'),this.userErrors.length)b.call(this);else{if("collection"==o)return this.setCollection();if("doc"==o)return this.setDocument()}}))}function j(){return new Promise(((e,t)=>{if(this.deleteDatabase=()=>{let t=this.dbName;indexedDB.deleteDatabase(t),e(_.call(this,`Database "${t}" deleted.`,{database:t}))},this.deleteCollection=()=>{let r=this.dbName,n=this.collectionName;this.addToDeleteCollectionQueue=e=>{this.deleteCollectionQueue.queue.push(e),this.runDeleteCollectionQueue()},this.runDeleteCollectionQueue=()=>{0==this.deleteCollectionQueue.running&&(this.deleteCollectionQueue.running=!0,this.deleteNextCollectionFromQueue())},this.deleteNextCollectionFromQueue=()=>{if(this.deleteCollectionQueue.queue.length){let n=this.deleteCollectionQueue.queue[0];this.deleteCollectionQueue.queue.shift(),this.lf[n].dropInstance({name:r,storeName:n}).then((()=>{this.deleteNextCollectionFromQueue(),e(_.call(this,`Collection "${n}" deleted.`,{collection:n}))})).catch((e=>{t(e.call(this,`Collection "${n}" could not be deleted.`))}))}else this.deleteCollectionQueue.running=!1},this.addToDeleteCollectionQueue(n)},this.deleteDocument=()=>{let r=this.collectionName,n=this.docSelectionCriteria;return this.deleteDocumentByCriteria=()=>{let o=[];this.lf[r].iterate(((e,t)=>{v(e,n)&&o.push(t)})).then((()=>{o.length||t(S.call(this,`No Documents found in "${r}" Collection with criteria ${JSON.stringify(n)}. No documents deleted.`)),o.length>1&&p.warn.call(this,`Multiple documents (${o.length}) with ${JSON.stringify(n)} found.`)})).then((()=>{o.forEach(((i,a)=>{this.lf[r].removeItem(i).then((()=>{a===o.length-1&&e(_.call(this,`${o.length} Document${o.length>1?"s":""} with ${JSON.stringify(n)} deleted.`,{keys:o}))})).catch((e=>{t(S.call(this,`Could not delete ${o.length} Documents in ${r} Collection.`))}))}))}))},this.deleteDocumentByKey=()=>{this.lf[r].getItem(n).then((o=>{o?this.lf[r].removeItem(n).then((()=>{e(_.call(this,`Document with key ${JSON.stringify(n)} deleted.`,{key:n}))})).catch((function(e){t(S.call(this,`No Document found in "${r}" Collection with key ${JSON.stringify(n)}. No