Comparing version 2.0.0-beta.7 to 2.0.0-beta.8
{ | ||
"name": "dexie", | ||
"version": "2.0.0-beta.8", | ||
"homepage": "http://dexie.org", | ||
@@ -33,4 +34,3 @@ "authors": [ | ||
"tools" | ||
], | ||
"version": "2.0.0-beta.7" | ||
] | ||
} |
@@ -1,2 +0,2 @@ | ||
// Type definitions for Dexie v2.0.0-beta.7 | ||
// Type definitions for Dexie v2.0.0-beta.8 | ||
// Project: https://github.com/dfahlander/Dexie.js | ||
@@ -219,3 +219,3 @@ // Definitions by: David Fahlander <http://github.com/dfahlander> | ||
interface Version { | ||
stores(schema: { [key: string]: string }): Version; | ||
stores(schema: { [key: string]: string | null }): Version; | ||
upgrade(fn: (trans: Transaction) => void): Version; | ||
@@ -222,0 +222,0 @@ } |
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.Dexie=t()}(this,function(){"use strict";function n(n,t){return"object"!=typeof t?n:(Cn(t).forEach(function(e){n[e]=t[e]}),n)}function t(n,t){return Fn.call(n,t)}function e(n,t){"function"==typeof t&&(t=t(Bn(n))),Cn(t).forEach(function(e){r(n,e,t[e])})}function r(e,r,i,o){Mn(e,r,n(i&&t(i,"get")&&"function"==typeof i.get?{get:i.get,set:i.set,configurable:!0}:{value:i,configurable:!0,writable:!0},o))}function i(n){return{from:function(t){return n.prototype=Object.create(t.prototype),r(n.prototype,"constructor",n),{extend:e.bind(null,n.prototype)}}}}function o(n,t){var e,r=Nn(n,t);return r||(e=Bn(n))&&o(e,t)}function u(n,t,e){return qn.call(n,t,e)}function a(n,t){return t(n)}function c(n){var t=setTimeout(n,1e3);clearTimeout(t)}function s(n){if(!n)throw new Error("Assertion Failed")}function f(n){Kn.setImmediate?setImmediate(n):setTimeout(n,0)}function l(n,t){return n.reduce(function(n,e,r){var i=t(e,r);return i&&(n[i[0]]=i[1]),n},{})}function h(n,t){return function(){try{n.apply(this,arguments)}catch(n){t(n)}}}function d(n,t,e){try{n.apply(null,e)}catch(n){t&&t(n)}}function v(n,e){if(t(n,e))return n[e];if(!e)return n;if("string"!=typeof e){for(var r=[],i=0,o=e.length;i<o;++i){var u=v(n,e[i]);r.push(u)}return r}var a=e.indexOf(".");if(a!==-1){var c=n[e.substr(0,a)];return void 0===c?void 0:v(c,e.substr(a+1))}}function p(n,t,e){if(n&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(n)))if("string"!=typeof t&&"length"in t){s("string"!=typeof e&&"length"in e);for(var r=0,i=t.length;r<i;++r)p(n,t[r],e[r])}else{var o=t.indexOf(".");if(o!==-1){var u=t.substr(0,o),a=t.substr(o+1);if(""===a)void 0===e?delete n[u]:n[u]=e;else{var c=n[u];c||(c=n[u]={}),p(c,a,e)}}else void 0===e?delete n[t]:n[t]=e}}function y(n,t){"string"==typeof t?p(n,t,void 0):"length"in t&&[].map.call(t,function(t){p(n,t,void 0)})}function m(n){var e={};for(var r in n)t(n,r)&&(e[r]=n[r]);return e}function g(n){return Rn.apply([],n)}function b(n){if(!n||"object"!=typeof n)return n;var e;if(Tn(n)){e=[];for(var r=0,i=n.length;r<i;++r)e.push(b(n[r]))}else if(Un.indexOf(n.constructor)>=0)e=n;else{e=n.constructor?Object.create(n.constructor.prototype):{};for(var o in n)t(n,o)&&(e[o]=b(n[o]))}return e}function w(n,e,r,i){return r=r||{},i=i||"",Cn(n).forEach(function(o){if(t(e,o)){var u=n[o],a=e[o];"object"==typeof u&&"object"==typeof a&&u&&a&&u.constructor===a.constructor?w(u,a,r,i+o+"."):u!==a&&(r[i+o]=e[o])}else r[i+o]=void 0}),Cn(e).forEach(function(o){t(n,o)||(r[i+o]=e[o])}),r}function _(n){var t,e,r,i;if(1===arguments.length){if(Tn(n))return n.slice();if(this===Ln&&"string"==typeof n)return[n];if(i=zn(n)){for(e=[];r=i.next(),!r.done;)e.push(r.value);return e}if(null==n)return[n];if(t=n.length,"number"==typeof t){for(e=new Array(t);t--;)e[t]=n[t];return e}return[n]}for(t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return e}function k(n,t){Wn=n,Qn=t}function x(){if(Hn)try{throw x.arguments,new Error}catch(n){return n}return new Error}function j(n,t){var e=n.stack;return e?(t=t||0,0===e.indexOf(n.name)&&(t+=(n.name+n.message).split("\n").length),e.split("\n").slice(t).filter(Qn).map(function(n){return"\n"+n}).join("")):""}function E(n,t){return function(){return console.warn(n+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+j(x(),1)),t.apply(this,arguments)}}function P(n,t){this._e=x(),this.name=n,this.message=t}function A(n,t){return n+". Errors: "+t.map(function(n){return n.toString()}).filter(function(n,t,e){return e.indexOf(n)===t}).join("\n")}function O(n,t,e,r){this._e=x(),this.failures=t,this.failedKeys=r,this.successCount=e}function S(n,t){this._e=x(),this.name="BulkError",this.failures=t,this.message=A(n,t)}function I(n,t){if(!n||n instanceof P||n instanceof TypeError||n instanceof SyntaxError||!n.name||!tt[n.name])return n;var e=new tt[n.name](t||n.message,n);return"stack"in n&&r(e,"stack",{get:function(){return this.inner.stack}}),e}function D(){}function C(n){return n}function T(n,t){return null==n||n===C?t:function(e){return t(n(e))}}function K(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function B(n,t){return n===D?t:function(){var e=n.apply(this,arguments);void 0!==e&&(arguments[0]=e);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?K(r,this.onsuccess):r),i&&(this.onerror=this.onerror?K(i,this.onerror):i),void 0!==o?o:e}}function F(n,t){return n===D?t:function(){n.apply(this,arguments);var e=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),e&&(this.onsuccess=this.onsuccess?K(e,this.onsuccess):e),r&&(this.onerror=this.onerror?K(r,this.onerror):r)}}function M(t,e){return t===D?e:function(r){var i=t.apply(this,arguments);n(r,i);var o=this.onsuccess,u=this.onerror;this.onsuccess=null,this.onerror=null;var a=e.apply(this,arguments);return o&&(this.onsuccess=this.onsuccess?K(o,this.onsuccess):o),u&&(this.onerror=this.onerror?K(u,this.onerror):u),void 0===i?void 0===a?void 0:a:n(i,a)}}function N(n,t){return n===D?t:function(){return t.apply(this,arguments)!==!1&&n.apply(this,arguments)}}function q(n,t){return n===D?t:function(){var e=n.apply(this,arguments);if(e&&"function"==typeof e.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return e.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}function R(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=D,this._lib=!1;var t=this._PSD=Et;if(Wn&&(this._stackHolder=x(),this._prev=null,this._numPrev=0),"function"!=typeof n){if(n!==rt)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&z(this,this._value))}this._state=null,this._value=null,++t.ref,V(this,n)}function U(n,t,e,r,i){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r,this.psd=i}function V(n,t){try{t(function(t){if(null===n._state){if(t===n)throw new TypeError("A promise cannot be resolved with itself.");var e=n._lib&&Y();t&&"function"==typeof t.then?V(n,function(n,e){t instanceof R?t._then(n,e):t.then(n,e)}):(n._state=!0,n._value=t,L(n)),e&&$()}},z.bind(null,n))}catch(t){z(n,t)}}function z(n,t){if(_t.push(t),null===n._state){var e=n._lib&&Y();t=xt(t),n._state=!1,n._value=t,Wn&&null!==t&&"object"==typeof t&&!t._promise&&d(function(){var e=o(t,"stack");t._promise=n,r(t,"stack",{get:function(){return pt?e&&(e.get?e.get.apply(t):e.value):n.stack}})}),nn(n),L(n),e&&$()}}function L(n){var t=n._listeners;n._listeners=[];for(var e=0,r=t.length;e<r;++e)W(n,t[e]);var i=n._PSD;--i.ref||i.finalize(),0===At&&(++At,mt(function(){0===--At&&X()},[]))}function W(n,t){if(null===n._state)return void n._listeners.push(t);var e=n._state?t.onFulfilled:t.onRejected;return null===e?(n._state?t.resolve:t.reject)(n._value):(++t.psd.ref,++At,void mt(Q,[e,n,t]))}function Q(n,t,e){try{kt=t;var r,i=t._value;t._state?r=n(i):(_t.length&&(_t=[]),r=n(i),_t.indexOf(i)===-1&&tn(t)),e.resolve(r)}catch(n){e.reject(n)}finally{kt=null,0===--At&&X(),--e.psd.ref||e.psd.finalize()}}function H(n,t,e){if(t.length===e)return t;var r="";if(n._state===!1){var i,o,u=n._value;null!=u?(i=u.name||"Error",o=u.message||u,r=j(u,0)):(i=u,o=""),t.push(i+(o?": "+o:"")+r)}return Wn&&(r=j(n._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),n._prev&&H(n._prev,t,e)),t}function G(n,t){var e=t?t._numPrev+1:0;e<it&&(n._prev=t,n._numPrev=e)}function J(){Y()&&$()}function Y(){var n=gt;return gt=!1,bt=!1,n}function $(){var n,t,e;do for(;Pt.length>0;)for(n=Pt,Pt=[],e=n.length,t=0;t<e;++t){var r=n[t];r[0].apply(null,r[1])}while(Pt.length>0);gt=!0,bt=!0}function X(){var n=wt;wt=[],n.forEach(function(n){n._PSD.onunhandled.call(null,n._value,n)});for(var t=Ot.slice(0),e=t.length;e;)t[--e]()}function Z(n){function t(){n(),Ot.splice(Ot.indexOf(t),1)}Ot.push(t),++At,mt(function(){0===--At&&X()},[])}function nn(n){wt.some(function(t){return t._value===n._value})||wt.push(n)}function tn(n){for(var t=wt.length;t;)if(wt[--t]._value===n._value)return void wt.splice(t,1)}function en(n){return new R(rt,!1,n)}function rn(n,t){var e=Et;return function(){var r=Y(),i=Et;try{return ln(e,!0),n.apply(this,arguments)}catch(n){t&&t(n)}finally{ln(i,!1),r&&$()}}}function on(t,e,r,i){var o=Et,u=Object.create(o);u.parent=o,u.ref=0,u.global=!1,u.id=++Bt;var a=jt.env;u.env=vt?{Promise:R,all:R.all,race:R.race,resolve:R.resolve,reject:R.reject,nthen:yn(a.nthen,u),gthen:yn(a.gthen,u)}:{},e&&n(u,e),++o.ref,u.finalize=function(){--this.parent.ref||this.parent.finalize()};var c=dn(u,t,r,i);return 0===u.ref&&u.finalize(),c}function un(){return It.id||(It.id=++Dt),++It.awaits,It.echoes+=ut,It.id}function an(n){!It.awaits||n&&n!==It.id||(0===--It.awaits&&(It.id=0),It.echoes=It.awaits*ut)}function cn(n){return It.echoes&&n&&n.constructor===ht?(un(),n.then(function(n){return an(),n},function(n){return an(),Nt(n)})):n}function sn(n){++Kt,It.echoes&&0!==--It.echoes||(It.echoes=It.id=0),Ct.push(Et),ln(n,!0)}function fn(){var n=Ct[Ct.length-1];Ct.pop(),ln(n,!1)}function ln(n,t){var e=Et;if((t?!It.echoes||Tt++&&n===Et:!Tt||--Tt&&n===Et)||vn(t?sn.bind(null,n):fn),n!==Et&&(Et=n,e===jt&&(jt.env=hn()),vt)){var r=jt.env.Promise,i=n.env;st.then=i.nthen,r.prototype.then=i.gthen,(e.global||n.global)&&(Kn.Promise=i.Promise,r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject)}}function hn(){var n=Kn.Promise;return vt?{Promise:n,all:n.all,race:n.race,resolve:n.resolve,reject:n.reject,nthen:st.then,gthen:n.prototype.then}:{}}function dn(n,t,e,r,i){var o=Et;try{return ln(n,!0),t(e,r,i)}finally{ln(o,!1)}}function vn(n){lt.call(ct,n)}function pn(n,t,e){return"function"!=typeof n?n:function(){var r=Et;e&&un(),ln(t,!0);try{return n.apply(this,arguments)}finally{ln(r,!1)}}}function yn(n,t){return function(e,r){return n.call(this,pn(e,t,!1),pn(r,t,!1))}}function mn(t,e){var r;try{r=e.onuncatched(t)}catch(n){}if(r!==!1)try{var i,o={promise:e,reason:t};if(Kn.document&&document.createEvent?(i=document.createEvent("Event"),i.initEvent(Ft,!0,!0),n(i,o)):Kn.CustomEvent&&(i=new CustomEvent(Ft,{detail:o}),n(i,o)),i&&Kn.dispatchEvent&&(dispatchEvent(i),!Kn.PromiseRejectionEvent&&Kn.onunhandledrejection))try{Kn.onunhandledrejection(i)}catch(n){}i.defaultPrevented||console.warn("Unhandled rejection: "+(t.stack||t))}catch(n){}}function gn(n){function t(n,t,o){if("object"==typeof n)return e(n);t||(t=N),o||(o=D);var u={subscribers:[],fire:o,subscribe:function(n){u.subscribers.indexOf(n)===-1&&(u.subscribers.push(n),u.fire=t(u.fire,n))},unsubscribe:function(n){u.subscribers=u.subscribers.filter(function(t){return t!==n}),u.fire=u.subscribers.reduce(t,o)}};return r[n]=i[n]=u,u}function e(n){Cn(n).forEach(function(e){var r=n[e];if(Tn(r))t(e,n[e][0],n[e][1]);else{if("asap"!==r)throw new nt.InvalidArgument("Invalid event config");var i=t(e,C,function(){for(var n=arguments.length,t=new Array(n);n--;)t[n]=arguments[n];i.subscribers.forEach(function(n){f(function(){n.apply(null,t)})})})}})}var r={},i=function(t,e){if(e){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return r[t].subscribe.apply(null,o),n}if("string"==typeof t)return r[t]};i.addEventType=t;for(var o=1,u=arguments.length;o<u;++o)t(arguments[o]);return i}function bn(i,o){function f(){et.on("versionchange",function(n){n.newVersion>0?console.warn("Another connection wants to upgrade database '"+et.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+et.name+"'. Closing db now to resume the delete request."),et.close()}),et.on("blocked",function(n){!n.newVersion||n.newVersion<n.oldVersion?console.warn("Dexie.delete('"+et.name+"') was blocked"):console.warn("Upgrade '"+et.name+"' blocked by other connection holding version "+n.oldVersion/10)})}function y(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function k(n,t,e){var r=et._createTransaction(tt,Qn,Vn);r.create(t),r._completion.catch(e);var i=r._reject.bind(r);on(function(){Et.trans=r,0===n?(Cn(Vn).forEach(function(n){A(t,n,Vn[n].primKey,Vn[n].indexes)}),R.follow(function(){return et.on.populate.fire(r)}).catch(i)):j(n,r,t).catch(i)})}function j(n,t,e){function r(){return i.length?R.resolve(i.shift()(t.idbtrans)).then(r):R.resolve()}var i=[],o=zn.filter(function(t){return t._cfg.version===n})[0];if(!o)throw new nt.Upgrade("Dexie specification of currently installed DB version is missing");Vn=et._dbSchema=o._cfg.dbschema;var u=!1,a=zn.filter(function(t){return t._cfg.version>n});return a.forEach(function(n){i.push(function(){var r=Vn,i=n._cfg.dbschema;yn(r,e),yn(i,e),Vn=et._dbSchema=i;var o=P(r,i);if(o.add.forEach(function(n){A(e,n[0],n[1].primKey,n[1].indexes)}),o.change.forEach(function(n){if(n.recreate)throw new nt.Upgrade("Not yet support for changing primary key");var t=e.objectStore(n.name);n.add.forEach(function(n){N(t,n)}),n.change.forEach(function(n){t.deleteIndex(n.name),N(t,n)}),n.del.forEach(function(n){t.deleteIndex(n)})}),n._cfg.contentUpgrade)return u=!0,R.follow(function(){n._cfg.contentUpgrade(t)})}),i.push(function(t){if(!u||!Ht){var e=n._cfg.dbschema;K(e,t)}})}),r().then(function(){I(Vn,e)})}function P(n,t){var e={del:[],add:[],change:[]};for(var r in n)t[r]||e.del.push(r);for(r in t){var i=n[r],o=t[r];if(i){var u={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(i.primKey.src!==o.primKey.src)u.recreate=!0,e.change.push(u);else{var a=i.idxByName,c=o.idxByName;for(var s in a)c[s]||u.del.push(s);for(s in c){var f=a[s],l=c[s];f?f.src!==l.src&&u.change.push(l):u.add.push(l)}(u.del.length>0||u.add.length>0||u.change.length>0)&&e.change.push(u)}}else e.add.push([r,o])}return e}function A(n,t,e,r){var i=n.db.createObjectStore(t,e.keyPath?{keyPath:e.keyPath,autoIncrement:e.auto}:{autoIncrement:e.auto});return r.forEach(function(n){N(i,n)}),i}function I(n,t){Cn(n).forEach(function(e){t.db.objectStoreNames.contains(e)||A(t,e,n[e].primKey,n[e].indexes)})}function K(n,t){for(var e=0;e<t.db.objectStoreNames.length;++e){var r=t.db.objectStoreNames[e];null==n[r]&&t.db.deleteObjectStore(r)}}function N(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function U(n,t,e){if(Xn||Et.letThrough){var r=et._createTransaction(n,t,Vn);try{r.create()}catch(n){return Nt(n)}return r._promise(n,function(n,t){return on(function(){return Et.trans=r,e(n,t,r)})}).then(function(n){return r._completion.then(function(){return n})})}if(!Yn){if(!qn)return Nt(new nt.DatabaseClosed);et.open().catch(D)}return rt.then(function(){return U(n,t,e)})}function V(n,t,e){var r=arguments.length;if(r<2)throw new nt.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];e=i.pop();var o=g(i);return[n,o,e]}function z(n,t,e){this.name=n,this.schema=t,this._tx=e,this.hook=Hn[n]?Hn[n].hook:gn(null,{creating:[B,D],reading:[T,C],updating:[M,D],deleting:[F,D]})}function L(n,t,e){return(e?En:xn)(function(e){n.push(e),t&&t()})}function W(n,t,e,r,i){return new R(function(o,u){var a=e.length,c=a-1;if(0===a)return o();if(r){var s,f=En(u),l=kn(null);d(function(){for(var r=0;r<a;++r){s={onsuccess:null,onerror:null};var u=e[r];i.call(s,u[0],u[1],t);var h=n.delete(u[0]);h._hookCtx=s,h.onerror=f,r===c?h.onsuccess=kn(o):h.onsuccess=l}},function(n){throw s.onerror&&s.onerror(n),n})}else for(var h=0;h<a;++h){var v=n.delete(e[h]);v.onerror=xn(u),h===c&&(v.onsuccess=rn(function(){return o()}))}})}function Q(n,t,e,r){var i=this;this.db=et,this.mode=n,this.storeNames=t,this.idbtrans=null,this.on=gn(this,"complete","error","abort"),this.parent=r||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new R(function(n,t){i._resolve=n,i._reject=t}),this._completion.then(function(){i.active=!1,i.on.complete.fire()},function(n){var t=i.active;return i.active=!1,i.on.error.fire(n),i.parent?i.parent._reject(n):t&&i.idbtrans&&i.idbtrans.abort(),Nt(n)})}function H(n,t,e){this._ctx={table:n,index:":id"===t?null:t,or:e}}function G(n,t){var e=null,r=null;if(t)try{e=t()}catch(n){r=n}var i=n._ctx,o=i.table;this._ctx={table:o,index:i.index,isPrimKey:!i.index||o.schema.primKey.keyPath&&i.index===o.schema.primKey.name,range:e,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:o.hook.reading.fire}}function J(n,t){return!(n.filter||n.algorithm||n.or)&&(t?n.justLimit:!n.replayFilter)}function Y(n,t){return n._cfg.version-t._cfg.version}function $(n,t,e){t.forEach(function(t){var i=e[t];n.forEach(function(n){t in n||(n===Q.prototype||n instanceof Q?r(n,t,{get:function(){return this.table(t)}}):n[t]=new z(t,i))})})}function X(n){n.forEach(function(n){for(var t in n)n[t]instanceof z&&delete n[t]})}function Z(n,t,e,r,i,o){var u=o?function(n,t,r){return e(o(n),t,r)}:e,a=rn(u,i);n.onerror||(n.onerror=xn(i)),t?n.onsuccess=h(function(){var e=n.result;if(e){var o=function(){e.continue()};t(e,function(n){o=n},r,i)&&a(e.value,e,function(n){o=n}),o()}else r()},i):n.onsuccess=h(function(){var t=n.result;if(t){var e=function(){t.continue()};a(t.value,t,function(n){e=n}),e()}else r()},i)}function nn(n){var t=[];return n.split(",").forEach(function(n){n=n.trim();var e=n.replace(/([&*]|\+\+)/g,""),r=/^\[/.test(e)?e.match(/^\[(.*)\]$/)[1].split("+"):e;t.push(new On(e,r||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),Tn(r),/\./.test(n)))}),t}function tn(n,t){return Rn.cmp(n,t)}function en(n,t){return tn(n,t)<0?n:t}function cn(n,t){return tn(n,t)>0?n:t}function sn(n,t){return Rn.cmp(n,t)}function fn(n,t){return Rn.cmp(t,n)}function ln(n,t){return n<t?-1:n===t?0:1}function hn(n,t){return n>t?-1:n===t?0:1}function vn(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}function pn(){if(et.verno=Gn.version/10,et._dbSchema=Vn={},Qn=u(Gn.objectStoreNames,0),0!==Qn.length){var n=Gn.transaction(In(Qn),"readonly");Qn.forEach(function(t){for(var e=n.objectStore(t),r=e.keyPath,i=r&&"string"==typeof r&&r.indexOf(".")!==-1,o=new On(r,r||"",!1,!1,!!e.autoIncrement,r&&"string"!=typeof r,i),u=[],a=0;a<e.indexNames.length;++a){var c=e.index(e.indexNames[a]);r=c.keyPath,i=r&&"string"==typeof r&&r.indexOf(".")!==-1;var s=new On(c.name,r,!!c.unique,!!c.multiEntry,!1,r&&"string"!=typeof r,i);u.push(s)}Vn[t]=new Sn(t,o,u,{})}),$([Hn],Cn(Vn),Vn)}}function yn(n,t){for(var e=t.db.objectStoreNames,r=0;r<e.length;++r){var i=e[r],o=t.objectStore(i);Bn="getAll"in o;for(var a=0;a<o.indexNames.length;++a){var c=o.indexNames[a],s=o.index(c).keyPath,f="string"==typeof s?s:"["+u(s).join("+")+"]";if(n[i]){var l=n[i].idxByName[f];l&&(l.name=c)}}}}function mn(n){et.on("blocked").fire(n),Wt.filter(function(n){return n.name===et.name&&n!==et&&!n._vcFired}).map(function(t){return t.on("versionchange").fire(n)})}var wn,Kn,Bn,Fn=bn.dependencies,Mn=n({addons:bn.addons,autoOpen:!0,indexedDB:Fn.indexedDB,IDBKeyRange:Fn.IDBKeyRange},o),Nn=Mn.addons,qn=Mn.autoOpen,Rn=Mn.indexedDB,Un=Mn.IDBKeyRange,Vn=this._dbSchema={},zn=[],Qn=[],Hn={},Gn=null,Jn=null,Yn=!1,$n=null,Xn=!1,Zn="readonly",tt="readwrite",et=this,rt=new R(function(n){wn=n}),it=new R(function(n,t){Kn=t}),ot=!0,ut=!!Dn(Rn);this.version=function(n){if(Gn||Yn)throw new nt.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var t=zn.filter(function(t){return t._cfg.version===n})[0];return t?t:(t=new y(n),zn.push(t),zn.sort(Y),ot=!1,t)},n(y.prototype,{stores:function(t){this._cfg.storesSource=this._cfg.storesSource?n(this._cfg.storesSource,t):t;var e={};zn.forEach(function(t){n(e,t._cfg.storesSource)});var r=this._cfg.dbschema={};return this._parseStoresSpec(e,r),Vn=et._dbSchema=r,X([Hn,et,Q.prototype]),$([Hn,et,Q.prototype,this._cfg.tables],Cn(r),r),Qn=Cn(r),this},upgrade:function(n){var t=this;return Yt(function(){n(et._createTransaction(tt,Cn(t._cfg.dbschema),t._cfg.dbschema))}),this._cfg.contentUpgrade=n,this},_parseStoresSpec:function(n,t){Cn(n).forEach(function(e){if(null!==n[e]){var r={},i=nn(n[e]),o=i.shift();if(o.multi)throw new nt.Schema("Primary key cannot be multi-valued");o.keyPath&&p(r,o.keyPath,o.auto?0:o.keyPath),i.forEach(function(n){if(n.auto)throw new nt.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new nt.Schema("Index must have a name and cannot be an empty string");p(r,n.keyPath,n.compound?n.keyPath.map(function(){return""}):"")}),t[e]=new Sn(e,o,i,r)}})}}),this._allTables=Hn,this._createTransaction=function(n,t,e,r){return new Q(n,t,e,r)},this._whenReady=function(n){return $t||Xn||Et.letThrough?n():new R(function(n,t){if(!Yn){if(!qn)return void t(new nt.DatabaseClosed);et.open().catch(D)}rt.then(n,t)}).then(n)},this.verno=0,this.open=function(){if(Yn||Gn)return rt.then(function(){return Jn?Nt(Jn):et});Wn&&(it._stackHolder=x()),Yn=!0,Jn=null,Xn=!1;var n=wn,t=null;return R.race([it,new R(function(n,e){if(c(function(){return n()}),!Rn)throw new nt.MissingAPI("indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.");var r=ot?Rn.open(i):Rn.open(i,Math.round(10*et.verno));if(!r)throw new nt.MissingAPI("IndexedDB API not available");r.onerror=xn(e),r.onblocked=rn(mn),r.onupgradeneeded=rn(function(n){if(t=r.transaction,ot&&!et._allowEmptyDB){r.onerror=Pn,t.abort(),r.result.close();var o=Rn.deleteDatabase(i);o.onsuccess=o.onerror=rn(function(){e(new nt.NoSuchDatabase("Database "+i+" doesnt exist"))})}else{t.onerror=xn(e);var u=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;k(u/10,t,e,r)}},e),r.onsuccess=rn(function(){if(t=null,Gn=r.result,Wt.push(et),ot)pn();else if(Gn.objectStoreNames.length>0)try{yn(Vn,Gn.transaction(In(Gn.objectStoreNames),Zn))}catch(n){}Gn.onversionchange=rn(function(n){et._vcFired=!0,et.on("versionchange").fire(n)}),ut||"__dbnames"===i||Mt.dbnames.put({name:i}).catch(D),n()},e)})]).then(function(){return $n=[],R.resolve(bn.vip(et.on.ready.fire)).then(function n(){if($n.length>0){var t=$n.reduce(q,D);return $n=[],R.resolve(bn.vip(t)).then(n)}})}).finally(function(){$n=null}).then(function(){return Yn=!1,et}).catch(function(n){try{t&&t.abort()}catch(n){}return Yn=!1,et.close(),Jn=n,Nt(Jn)}).finally(function(){Xn=!0,n()})},this.close=function(){var n=Wt.indexOf(et);if(n>=0&&Wt.splice(n,1),Gn){try{Gn.close()}catch(n){}Gn=null}qn=!1,Jn=new nt.DatabaseClosed,Yn&&Kn(Jn),rt=new R(function(n){wn=n}),it=new R(function(n,t){Kn=t})},this.delete=function(){var n=arguments.length>0;return new R(function(t,e){function r(){et.close();var n=Rn.deleteDatabase(i);n.onsuccess=rn(function(){ut||Mt.dbnames.delete(i).catch(D),t()}),n.onerror=xn(e),n.onblocked=mn}if(n)throw new nt.InvalidArgument("Arguments not allowed in db.delete()");Yn?rt.then(r):r()})},this.backendDB=function(){return Gn},this.isOpen=function(){return null!==Gn},this.hasBeenClosed=function(){return Jn&&Jn instanceof nt.DatabaseClosed},this.hasFailed=function(){return null!==Jn},this.dynamicallyOpened=function(){return ot},this.name=i,e(this,{tables:{get:function(){return Cn(Hn).map(function(n){return Hn[n]})}}}),this.on=gn(this,"populate","blocked","versionchange",{ready:[q,D]}),this.on.ready.subscribe=a(this.on.ready.subscribe,function(n){return function(t,e){bn.vip(function(){Xn?(Jn||R.resolve().then(t),e&&n(t)):$n?($n.push(t),e&&n(t)):(n(t),e||n(function n(){et.on.ready.unsubscribe(t),et.on.ready.unsubscribe(n)}))})}}),Yt(function(){et.on("populate").fire(et._createTransaction(tt,Qn,Vn))}),this.transaction=function(){var n=V.apply(this,arguments);return this._transaction.apply(this,n)},this._transaction=function(n,t,e){function r(){return R.resolve().then(function(){var t=Et.transless||Et,r=et._createTransaction(n,u,Vn,i),o={trans:r,transless:t};i?r.idbtrans=i.idbtrans:r.create(),e.constructor===dt&&un();var a,c=R.follow(function(){if(a=e.call(r,r))if(a.constructor===ht){var n=an.bind(null,null);a.then(n,n)}else"function"==typeof a.next&&"function"==typeof a.throw&&(a=An(a))},o);return(a&&"function"==typeof a.then?R.resolve(a).then(function(n){return r.active?n:Nt(new nt.PrematureCommit("Transaction committed too early. See http://bit.ly/2eVASrf"))}):c.then(function(){return a})).then(function(n){return i&&r._resolve(),r._completion.then(function(){return n})}).catch(function(n){return r._reject(n),Nt(n)})})}var i=Et.trans;i&&i.db===et&&n.indexOf("!")===-1||(i=null);var o=n.indexOf("?")!==-1;n=n.replace("!","").replace("?","");try{var u=t.map(function(n){var t=n instanceof z?n.name:n;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t});if("r"==n||n==Zn)n=Zn;else{if("rw"!=n&&n!=tt)throw new nt.InvalidArgument("Invalid transaction mode: "+n);n=tt}if(i){if(i.mode===Zn&&n===tt){if(!o)throw new nt.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&u.forEach(function(n){if(i&&i.storeNames.indexOf(n)===-1){if(!o)throw new nt.SubTransaction("Table "+n+" not included in parent transaction.");i=null}}),o&&i&&!i.active&&(i=null)}}catch(n){return i?i._promise(null,function(t,e){e(n)}):Nt(n)}return i?i._promise(n,r,"lock"):Et.trans?dn(Et.transless,function(){return et._whenReady(r)}):et._whenReady(r)},this.table=function(n){if($t&&ot)return new z(n);if(!t(Hn,n))throw new nt.InvalidTable("Table "+n+" does not exist");return Hn[n]},e(z.prototype,{_trans:function(n,t,e){var r=this._tx||Et.trans;return r&&r.db===et?r===Et.trans?r._promise(n,t,e):on(function(){return r._promise(n,t,e)},{trans:r,transless:Et.transless||Et}):U(n,[this.name],t)},_idbstore:function(n,t,e){function r(n,e,r){if(r.storeNames.indexOf(i)===-1)throw new nt.NotFound("Table"+i+" not part of transaction");return t(n,e,r.idbtrans.objectStore(i),r)}if($t)return new R(t);var i=this.name;return this._trans(n,r,e)},get:function(n,t){if(n&&n.constructor===Object)return this.where(n).first(t);var e=this;return this._idbstore(Zn,function(t,r,i){$t&&t(e.schema.instanceTemplate);var o=i.get(n);o.onerror=xn(r),o.onsuccess=rn(function(){t(e.hook.reading.fire(o.result))},r)}).then(t)},where:function(n){if("string"==typeof n)return new H(this,n);if(Tn(n))return new H(this,"["+n.join("+")+"]");var t=Cn(n);if(1===t.length)return this.where(t[0]).equals(n[t[0]]);var e=this.schema.indexes.concat(this.schema.primKey).filter(function(n){return n.compound&&t.every(function(t){return n.keyPath.indexOf(t)>=0})&&n.keyPath.every(function(n){return t.indexOf(n)>=0})})[0];if(e&&Ut!==Rt)return this.where(e.name).equals(e.keyPath.map(function(t){return n[t]}));e||console.warn("The query "+JSON.stringify(n)+" on "+this.name+" would benefit of a "+("compound index ["+t.join("+")+"]"));var r=this.schema.idxByName,i=t.reduce(function(t,e){return[t[0]||r[e],t[0]||!r[e]?vn(t[1],function(t){return""+v(t,e)==""+n[e]}):t[1]]},[null,null]),o=i[0];return o?this.where(o.name).equals(n[o.keyPath]).filter(i[1]):e?this.filter(i[1]):this.where(t).equals("")},count:function(n){return this.toCollection().count(n)},offset:function(n){return this.toCollection().offset(n)},limit:function(n){return this.toCollection().limit(n)},reverse:function(){return this.toCollection().reverse()},filter:function(n){return this.toCollection().and(n)},each:function(n){return this.toCollection().each(n)},toArray:function(n){return this.toCollection().toArray(n)},orderBy:function(n){return new G(new H(this,Tn(n)?"["+n.join("+")+"]":n))},toCollection:function(){return new G(new H(this))},mapToClass:function(n,e){this.schema.mappedClass=n;var r=Object.create(n.prototype);e&&_n(r,e),this.schema.instanceTemplate=r;var i=function(e){if(!e)return e;var r=Object.create(n.prototype);for(var i in e)if(t(e,i))try{r[i]=e[i]}catch(n){}return r};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=i,this.hook("reading",i),n},defineClass:function(n){return this.mapToClass(bn.defineClass(n),n)},bulkDelete:function(n){return this.hook.deleting.fire===D?this._idbstore(tt,function(t,e,r,i){t(W(r,i,n,!1,D))}):this.where(":id").anyOf(n).delete().then(function(){})},bulkPut:function(n,t){var e=this;return this._idbstore(tt,function(r,i,o){if(!o.keyPath&&!e.schema.primKey.auto&&!t)throw new nt.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new nt.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new nt.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return r();var u,a,c=function(n){0===s.length?r(n):i(new S(e.name+".bulkPut(): "+s.length+" of "+f+" operations failed",s))},s=[],f=n.length,h=e;if(e.hook.creating.fire===D&&e.hook.updating.fire===D){a=L(s);for(var d=0,p=n.length;d<p;++d)u=t?o.put(n[d],t[d]):o.put(n[d]),u.onerror=a;u.onerror=L(s,c),u.onsuccess=jn(c)}else{var y=t||o.keyPath&&n.map(function(n){return v(n,o.keyPath)}),m=y&&l(y,function(t,e){return null!=t&&[t,n[e]]}),g=y?h.where(":id").anyOf(y.filter(function(n){return null!=n})).modify(function(){this.value=m[this.primKey],m[this.primKey]=null}).catch(O,function(n){s=n.failures}).then(function(){for(var e=[],r=t&&[],i=y.length-1;i>=0;--i){var o=y[i];(null==o||m[o])&&(e.push(n[i]),t&&r.push(o),null!=o&&(m[o]=null))}return e.reverse(),t&&r.reverse(),h.bulkAdd(e,r)}).then(function(n){var t=y[y.length-1];return null!=t?t:n}):h.bulkAdd(n);g.then(c).catch(S,function(n){s=s.concat(n.failures),c()}).catch(i)}},"locked")},bulkAdd:function(n,t){var e=this,r=this.hook.creating.fire;return this._idbstore(tt,function(i,o,u,a){function c(n){0===h.length?i(n):o(new S(e.name+".bulkAdd(): "+h.length+" of "+y+" operations failed",h))}if(!u.keyPath&&!e.schema.primKey.auto&&!t)throw new nt.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(u.keyPath&&t)throw new nt.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new nt.InvalidArgument("Arguments objects and keys must have the same length");if(0===n.length)return i();var s,f,l,h=[],y=n.length;if(r!==D){var m,g=u.keyPath;f=L(h,null,!0),l=kn(null),d(function(){for(var e=0,i=n.length;e<i;++e){m={onerror:null,onsuccess:null};var o=t&&t[e],c=n[e],h=t?o:g?v(c,g):void 0,d=r.call(m,h,c,a);null==h&&null!=d&&(g?(c=b(c),p(c,g,d)):o=d),s=null!=o?u.add(c,o):u.add(c),s._hookCtx=m,e<i-1&&(s.onerror=f,m.onsuccess&&(s.onsuccess=l))}},function(n){throw m.onerror&&m.onerror(n),n}),s.onerror=L(h,c,!0),s.onsuccess=kn(c)}else{f=L(h);for(var w=0,_=n.length;w<_;++w)s=t?u.add(n[w],t[w]):u.add(n[w]),s.onerror=f;s.onerror=L(h,c),s.onsuccess=jn(c)}})},add:function(n,t){var e=this.hook.creating.fire;return this._idbstore(tt,function(r,i,o,u){var a={onsuccess:null,onerror:null};if(e!==D){var c=null!=t?t:o.keyPath?v(n,o.keyPath):void 0,s=e.call(a,c,n,u);null==c&&null!=s&&(o.keyPath?p(n,o.keyPath,s):t=s)}try{var f=null!=t?o.add(n,t):o.add(n);f._hookCtx=a,f.onerror=En(i),f.onsuccess=kn(function(t){var e=o.keyPath;e&&p(n,e,t),r(t)})}catch(n){throw a.onerror&&a.onerror(n),n}})},put:function(n,t){var e=this,r=this.hook.creating.fire,i=this.hook.updating.fire;if(r!==D||i!==D){var o=this.schema.primKey.keyPath,u=void 0!==t?t:o&&v(n,o);return null==u?this.add(n):(n=b(n),this._trans(tt,function(){return e.where(":id").equals(u).modify(function(){this.value=n}).then(function(r){return 0===r?e.add(n,t):u})},"locked"))}return this._idbstore(tt,function(e,r,i){var o=void 0!==t?i.put(n,t):i.put(n);o.onerror=xn(r),o.onsuccess=rn(function(t){var r=i.keyPath;r&&p(n,r,t.target.result),e(o.result)})})},delete:function(n){return this.hook.deleting.subscribers.length?this.where(":id").equals(n).delete():this._idbstore(tt,function(t,e,r){ | ||
var i=r.delete(n);i.onerror=xn(e),i.onsuccess=rn(function(){t(i.result)})})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(tt,function(n,t,e){var r=e.clear();r.onerror=xn(t),r.onsuccess=rn(function(){n(r.result)})})},update:function(n,t){if("object"!=typeof t||Tn(t))throw new nt.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||Tn(n))return this.where(":id").equals(n).modify(t);Cn(t).forEach(function(e){p(n,e,t[e])});var e=v(n,this.schema.primKey.keyPath);return void 0===e?Nt(new nt.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)}}),e(Q.prototype,{_lock:function(){return s(!Et.global),++this._reculock,1!==this._reculock||Et.global||(Et.lockOwnerFor=this),this},_unlock:function(){if(s(!Et.global),0===--this._reculock)for(Et.global||(Et.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{dn(n[1],n[0])}catch(n){}}return this},_locked:function(){return this._reculock&&Et.lockOwnerFor!==this},create:function(n){var t=this;if(!this.mode)return this;if(s(!this.idbtrans),!n&&!Gn)switch(Jn&&Jn.name){case"DatabaseClosedError":throw new nt.DatabaseClosed(Jn);case"MissingAPIError":throw new nt.MissingAPI(Jn.message,Jn);default:throw new nt.OpenFailed(Jn)}if(!this.active)throw new nt.TransactionInactive;return s(null===this._completion._state),n=this.idbtrans=n||Gn.transaction(In(this.storeNames),this.mode),n.onerror=rn(function(e){Pn(e),t._reject(n.error)}),n.onabort=rn(function(n){Pn(n),t.active&&t._reject(new nt.Abort),t.active=!1,t.on("abort").fire(n)}),n.oncomplete=rn(function(){t.active=!1,t._resolve()}),this},_promise:function(n,t,e){var r=this;if(n===tt&&this.mode!==tt)return Nt(new nt.ReadOnly("Transaction is readonly"));if(!this.active)return Nt(new nt.TransactionInactive);if(this._locked())return new R(function(i,o){r._blockedFuncs.push([function(){r._promise(n,t,e).then(i,o)},Et])});if(e)return on(function(){var n=new R(function(n,e){r._lock();var i=t(n,e,r);i&&i.then&&i.then(n,e)});return n.finally(function(){return r._unlock()}),n._lib=!0,n});var i=new R(function(n,e){var i=t(n,e,r);i&&i.then&&i.then(n,e)});return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var t=this._root();if(n=R.resolve(n),t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var e=t.idbtrans.objectStore(t.storeNames[0]);!function n(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(e.get(-(1/0)).onsuccess=n)}()}var r=t._waitingFor;return new R(function(e,i){n.then(function(n){return t._waitingQueue.push(rn(e.bind(null,n)))},function(n){return t._waitingQueue.push(rn(i.bind(null,n)))}).finally(function(){t._waitingFor===r&&(t._waitingFor=null)})})},abort:function(){this.active&&this._reject(new nt.Abort),this.active=!1},tables:{get:E("Transaction.tables",function(){return Hn})},table:function(n){var t=et.table(n);return new z(n,t.schema,this)}}),e(H.prototype,function(){function n(n,t,e){var r=n instanceof H?new G(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new G(n,function(){return Un.only("")}).limit(0)}function e(n){return"next"===n?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}function r(n){return"next"===n?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}function i(n,t,e,r,i,o){for(var u=Math.min(n.length,r.length),a=-1,c=0;c<u;++c){var s=t[c];if(s!==r[c])return i(n[c],e[c])<0?n.substr(0,c)+e[c]+e.substr(c+1):i(n[c],r[c])<0?n.substr(0,c)+r[c]+e.substr(c+1):a>=0?n.substr(0,a)+t[a]+e.substr(a+1):null;i(n[c],s)<0&&(a=c)}return u<r.length&&"next"===o?n+e.substr(n.length):u<n.length&&"prev"===o?n.substr(0,e.length):a<0?null:n.substr(0,a)+r[a]+e.substr(a+1)}function o(t,o,u,a){function c(n){s=e(n),f=r(n),l="next"===n?ln:hn;var t=u.map(function(n){return{lower:f(n),upper:s(n)}}).sort(function(n,t){return l(n.lower,t.lower)});h=t.map(function(n){return n.upper}),d=t.map(function(n){return n.lower}),v=n,p="next"===n?"":a}var s,f,l,h,d,v,p,y=u.length;if(!u.every(function(n){return"string"==typeof n}))return n(t,Lt);c("next");var m=new G(t,function(){return Un.bound(h[0],d[y-1]+a)});m._ondirectionchange=function(n){c(n)};var g=0;return m._addAlgorithm(function(n,t,e){var r=n.key;if("string"!=typeof r)return!1;var u=f(r);if(o(u,d,g))return!0;for(var a=null,c=g;c<y;++c){var s=i(r,u,h[c],d[c],l,v);null===s&&null===a?g=c+1:(null===a||l(a,s)>0)&&(a=s)}return t(null!==a?function(){n.continue(a+p)}:e),!1}),m}return{between:function(e,r,i,o){i=i!==!1,o=o===!0;try{return tn(e,r)>0||0===tn(e,r)&&(i||o)&&(!i||!o)?t(this):new G(this,function(){return Un.bound(e,r,!i,!o)})}catch(t){return n(this,zt)}},equals:function(n){return new G(this,function(){return Un.only(n)})},above:function(n){return new G(this,function(){return Un.lowerBound(n,!0)})},aboveOrEqual:function(n){return new G(this,function(){return Un.lowerBound(n)})},below:function(n){return new G(this,function(){return Un.upperBound(n,!0)})},belowOrEqual:function(n){return new G(this,function(){return Un.upperBound(n)})},startsWith:function(t){return"string"!=typeof t?n(this,Lt):this.between(t,t+Rt,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):o(this,function(n,t){return 0===n.indexOf(t[0])},[n],Rt)},equalsIgnoreCase:function(n){return o(this,function(n,t){return n===t[0]},[n],"")},anyOfIgnoreCase:function(){var n=_.apply(Ln,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.indexOf(n)!==-1},n,"")},startsWithAnyOfIgnoreCase:function(){var n=_.apply(Ln,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.some(function(t){return 0===n.indexOf(t)})},n,Rt)},anyOf:function(){var e=_.apply(Ln,arguments),r=sn;try{e.sort(r)}catch(t){return n(this,zt)}if(0===e.length)return t(this);var i=new G(this,function(){return Un.bound(e[0],e[e.length-1])});i._ondirectionchange=function(n){r="next"===n?sn:fn,e.sort(r)};var o=0;return i._addAlgorithm(function(n,t,i){for(var u=n.key;r(u,e[o])>0;)if(++o,o===e.length)return t(i),!1;return 0===r(u,e[o])||(t(function(){n.continue(e[o])}),!1)}),i},notEqual:function(n){return this.inAnyRange([[Vt,n],[n,Ut]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=_.apply(Ln,arguments);if(0===t.length)return new G(this);try{t.sort(sn)}catch(t){return n(this,zt)}var e=t.reduce(function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[Vt,t]]},null);return e.push([t[t.length-1],Ut]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(e,r){function i(n,t){for(var e=0,r=n.length;e<r;++e){var i=n[e];if(tn(t[0],i[1])<0&&tn(t[1],i[0])>0){i[0]=en(i[0],t[0]),i[1]=cn(i[1],t[1]);break}}return e===r&&n.push(t),n}function o(n,t){return f(n[0],t[0])}function u(n){return!h(n)&&!d(n)}if(0===e.length)return t(this);if(!e.every(function(n){return void 0!==n[0]&&void 0!==n[1]&&sn(n[0],n[1])<=0}))return n(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",nt.InvalidArgument);var a,c=!r||r.includeLowers!==!1,s=r&&r.includeUppers===!0,f=sn;try{a=e.reduce(i,[]),a.sort(o)}catch(t){return n(this,zt)}var l=0,h=s?function(n){return sn(n,a[l][1])>0}:function(n){return sn(n,a[l][1])>=0},d=c?function(n){return fn(n,a[l][0])>0}:function(n){return fn(n,a[l][0])>=0},v=h,p=new G(this,function(){return Un.bound(a[0][0],a[a.length-1][1],!c,!s)});return p._ondirectionchange=function(n){"next"===n?(v=h,f=sn):(v=d,f=fn),a.sort(o)},p._addAlgorithm(function(n,t,e){for(var r=n.key;v(r);)if(++l,l===a.length)return t(e),!1;return!!u(r)||0!==tn(r,a[l][1])&&0!==tn(r,a[l][0])&&(t(function(){f===sn?n.continue(a[l][0]):n.continue(a[l][1])}),!1)}),p},startsWithAnyOf:function(){var e=_.apply(Ln,arguments);return e.every(function(n){return"string"==typeof n})?0===e.length?t(this):this.inAnyRange(e.map(function(n){return[n,n+Rt]})):n(this,"startsWithAnyOf() only works with strings")}}}),e(G.prototype,function(){function e(n,t){n.filter=vn(n.filter,t)}function r(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return vn(r(),t())}:t,n.justLimit=e&&!r}function i(n,t){n.isMatch=vn(n.isMatch,t)}function o(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new nt.Schema("KeyPath "+n.index+" on object store "+t.name+" is not indexed");return t.index(e.name)}function u(n,t){var e=o(n,t);return n.keysOnly&&"openKeyCursor"in e?e.openKeyCursor(n.range||null,n.dir+n.unique):e.openCursor(n.range||null,n.dir+n.unique)}function a(n,e,r,i,o){var a=n.replayFilter?vn(n.filter,n.replayFilter()):n.filter;n.or?function(){function c(){2===++l&&r()}function s(n,r,o){if(!a||a(r,o,c,i)){var u=r.primaryKey.toString();t(f,u)||(f[u]=!0,e(n,r,o))}}var f={},l=0;n.or._iterate(s,c,i,o),Z(u(n,o),n.algorithm,s,c,i,!n.keysOnly&&n.valueMapper)}():Z(u(n,o),vn(n.algorithm,a),e,r,i,!n.keysOnly&&n.valueMapper)}function c(n){return n.table.schema.instanceTemplate}return{_read:function(n,t){var e=this._ctx;return e.error?e.table._trans(null,Nt.bind(null,e.error)):e.table._idbstore(Zn,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,Nt.bind(null,t.error)):t.table._idbstore(tt,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=vn(t.algorithm,n)},_iterate:function(n,t,e,r){return a(this._ctx,n,t,e,r)},clone:function(t){var e=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&n(r,t),e._ctx=r,e},raw:function(){return this._ctx.valueMapper=null,this},each:function(n){var t=this._ctx;if($t){var e=c(t),r=t.table.schema.primKey.keyPath,i=v(e,t.index?t.table.schema.idxByName[t.index].keyPath:r),o=v(e,r);n(e,{key:i,primaryKey:o})}return this._read(function(e,r,i){a(t,n,e,r,i)})},count:function(n){if($t)return R.resolve(0).then(n);var t=this._ctx;if(J(t,!0))return this._read(function(n,e,r){var i=o(t,r),u=t.range?i.count(t.range):i.count();u.onerror=xn(e),u.onsuccess=function(e){n(Math.min(e.target.result,t.limit))}},n);var e=0;return this._read(function(n,r,i){a(t,function(){return++e,!1},function(){n(e)},r,i)},n)},sortBy:function(n,t){function e(n,t){return t?e(n[i[t]],t-1):n[o]}function r(n,t){var r=e(n,u),i=e(t,u);return r<i?-a:r>i?a:0}var i=n.split(".").reverse(),o=i[0],u=i.length-1,a="next"===this._ctx.dir?1:-1;return this.toArray(function(n){return n.sort(r)}).then(t)},toArray:function(n){var t=this._ctx;return this._read(function(n,e,r){if($t&&n([c(t)]),Bn&&"next"===t.dir&&J(t,!0)&&t.limit>0){var i=t.table.hook.reading.fire,u=o(t,r),s=t.limit<1/0?u.getAll(t.range,t.limit):u.getAll(t.range);s.onerror=xn(e),s.onsuccess=jn(i===C?n:function(t){try{n(t.map(i))}catch(n){e(n)}})}else{var f=[];a(t,function(n){f.push(n)},function(){n(f)},e,r)}},n)},offset:function(n){var t=this._ctx;return n<=0?this:(t.offset+=n,J(t)?r(t,function(){var t=n;return function(n,e){return 0===t||(1===t?(--t,!1):(e(function(){n.advance(t),t=0}),!1))}}):r(t,function(){var t=n;return function(){return--t<0}}),this)},limit:function(n){return this._ctx.limit=Math.min(this._ctx.limit,n),r(this._ctx,function(){var t=n;return function(n,e,r){return--t<=0&&e(r),t>=0}},!0),this},until:function(n,t){var r=this._ctx;return $t&&n(c(r)),e(this._ctx,function(e,r,i){return!n(e.value)||(r(i),t)}),this},first:function(n){return this.limit(1).toArray(function(n){return n[0]}).then(n)},last:function(n){return this.reverse().first(n)},filter:function(n){return $t&&n(c(this._ctx)),e(this._ctx,function(t){return n(t.value)}),i(this._ctx,n),this},and:function(n){return this.filter(n)},or:function(n){return new H(this._ctx.table,n,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,e){n(e.key,e)})},eachUniqueKey:function(n){return this._ctx.unique="unique",this.eachKey(n)},eachPrimaryKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,e){n(e.primaryKey,e)})},keys:function(n){var t=this._ctx;t.keysOnly=!t.isMatch;var e=[];return this.each(function(n,t){e.push(t.key)}).then(function(){return e}).then(n)},primaryKeys:function(n){var t=this._ctx;if(Bn&&"next"===t.dir&&J(t,!0)&&t.limit>0)return this._read(function(n,e,r){var i=o(t,r),u=t.limit<1/0?i.getAllKeys(t.range,t.limit):i.getAllKeys(t.range);u.onerror=xn(e),u.onsuccess=jn(n)}).then(n);t.keysOnly=!t.isMatch;var e=[];return this.each(function(n,t){e.push(t.primaryKey)}).then(function(){return e}).then(n)},uniqueKeys:function(n){return this._ctx.unique="unique",this.keys(n)},firstKey:function(n){return this.limit(1).keys(function(n){return n[0]}).then(n)},lastKey:function(n){return this.reverse().firstKey(n)},distinct:function(){var n=this._ctx,r=n.index&&n.table.schema.idxByName[n.index];if(!r||!r.multi)return this;var i={};return e(this._ctx,function(n){var e=n.primaryKey.toString(),r=t(i,e);return i[e]=!0,!r}),this},modify:function(e){var r=this,i=this._ctx,o=i.table.hook,u=o.updating.fire,a=o.deleting.fire;return $t&&"function"==typeof e&&e.call({value:i.table.schema.instanceTemplate},i.table.schema.instanceTemplate),this._write(function(i,o,c,s){function f(n,e){function r(n){return P.push(n),A.push(i.primKey),h(),!0}S=e.primaryKey;var i={primKey:e.primaryKey,value:n,onsuccess:null,onerror:null};if(y.call(i,n,i)!==!1){var o=!t(i,"value");++x,d(function(){var n=o?e.delete():e.update(i.value);n._hookCtx=i,n.onerror=En(r),n.onsuccess=kn(function(){++j,h()})},r)}else i.onsuccess&&i.onsuccess(i.value)}function l(n){return n&&(P.push(n),A.push(S)),o(new O("Error modifying one or more objects",P,j,A))}function h(){E&&j+P.length===x&&(P.length>0?l():i(j))}var y;if("function"==typeof e)y=u===D&&a===D?e:function(n){var r=b(n);if(e.call(this,n,this)===!1)return!1;if(t(this,"value")){var i=w(r,this.value),o=u.call(this,i,this.primKey,r,s);o&&(n=this.value,Cn(o).forEach(function(t){p(n,t,o[t])}))}else a.call(this,this.primKey,n,s)};else if(u===D){var g=Cn(e),_=g.length;y=function(n){for(var t=!1,r=0;r<_;++r){var i=g[r],o=e[i];v(n,i)!==o&&(p(n,i,o),t=!0)}return t}}else{var k=e;e=m(k),y=function(t){var r=!1,i=u.call(this,e,this.primKey,b(t),s);return i&&n(e,i),Cn(e).forEach(function(n){var i=e[n];v(t,n)!==i&&(p(t,n,i),r=!0)}),i&&(e=m(k)),r}}var x=0,j=0,E=!1,P=[],A=[],S=null;r.clone().raw()._iterate(f,function(){E=!0,h()},l,c)})},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==D;if(!i&&J(t)&&(t.isPrimKey&&!Gt||!e))return this._write(function(n,t,r){var i=xn(t),o=e?r.count(e):r.count();o.onerror=i,o.onsuccess=function(){var u=o.result;d(function(){var t=e?r.delete(e):r.clear();t.onerror=i,t.onsuccess=function(){return n(u)}},function(n){return t(n)})}});var o=i?2e3:1e4;return this._write(function(e,u,a,c){var s=0,f=n.clone({keysOnly:!t.isMatch&&!i}).distinct().limit(o).raw(),l=[],h=function(){return f.each(i?function(n,t){l.push([t.primaryKey,t.value])}:function(n,t){l.push(t.primaryKey)}).then(function(){return i?l.sort(function(n,t){return sn(n[0],t[0])}):l.sort(sn),W(a,c,l,i,r)}).then(function(){var n=l.length;return s+=n,l=[],n<o?s:h()})};e(h())})}}}),n(this,{Collection:G,Table:z,Transaction:Q,Version:y,WhereClause:H}),f(),Nn.forEach(function(n){n(et)})}function wn(n){if("function"==typeof n)return new n;if(Tn(n))return[wn(n[0])];if(n&&"object"==typeof n){var t={};return _n(t,n),t}return n}function _n(n,t){return Cn(t).forEach(function(e){var r=wn(t[e]);n[e]=r}),n}function kn(n){return rn(function(t){var e=t.target,r=e.result,i=e._hookCtx,o=i&&i.onsuccess;o&&o(r),n&&n(r)},n)}function xn(n){return rn(function(t){return Pn(t),n(t.target.error),!1})}function jn(n){return rn(function(t){n(t.target.result)})}function En(n){return rn(function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),Pn(t),n(r),!1})}function Pn(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function An(n){function t(n){return function(t){var e=n(t),r=e.value;return e.done?r:r&&"function"==typeof r.then?r.then(i,o):Tn(r)?R.all(r).then(i,o):i(r)}}var e=function(t){return n.next(t)},r=function(t){return n.throw(t)},i=t(e),o=t(r);return t(e)()}function On(n,t,e,r,i,o,u){this.name=n,this.keyPath=t,this.unique=e,this.multi=r,this.auto=i,this.compound=o,this.dotted=u;var a="string"==typeof t?t:t&&"["+[].join.call(t,"+")+"]";this.src=(e?"&":"")+(r?"*":"")+(i?"++":"")+a}function Sn(n,t,e,r){this.name=n,this.primKey=t||new On,this.indexes=e||[new On],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=l(e,function(n){return[n.name,n]})}function In(n){return 1===n.length?n[0]:n}function Dn(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}var Cn=Object.keys,Tn=Array.isArray,Kn="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Bn=Object.getPrototypeOf,Fn={}.hasOwnProperty,Mn=Object.defineProperty,Nn=Object.getOwnPropertyDescriptor,qn=[].slice,Rn=[].concat,Un="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(g([8,16,32,64].map(function(n){return["Int","Uint","Float"].map(function(t){return t+n+"Array"})}))).filter(function(n){return Kn[n]}).map(function(n){return Kn[n]}),Vn="undefined"!=typeof Symbol&&Symbol.iterator,zn=Vn?function(n){var t;return null!=n&&(t=n[Vn])&&t.apply(n)}:function(){return null},Ln={},Wn="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),Qn=function(){return!0},Hn=!new Error("").stack,Gn=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Jn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Yn=Gn.concat(Jn),$n={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};i(P).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+j(this._e,2))}},toString:function(){return this.name+": "+this.message}}),i(O).from(P),i(S).from(P);var Xn=Yn.reduce(function(n,t){return n[t]=t+"Error",n},{}),Zn=P,nt=Yn.reduce(function(n,t){function e(n,e){this._e=x(),this.name=r,n?"string"==typeof n?(this.message=n,this.inner=e||null):"object"==typeof n&&(this.message=n.name+" "+n.message,this.inner=n):(this.message=$n[t]||r,this.inner=null)}var r=t+"Error";return i(e).from(Zn),n[t]=e,n},{});nt.Syntax=SyntaxError,nt.Type=TypeError,nt.Range=RangeError;var tt=Jn.reduce(function(n,t){return n[t+"Error"]=nt[t],n},{}),et=Yn.reduce(function(n,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(n[t+"Error"]=nt[t]),n},{});et.ModifyError=O,et.DexieError=P,et.BulkError=S;var rt={},it=100,ot=20,ut=7,at=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var n=Kn.Promise;return n?[n.resolve(),n.prototype,n.resolve()]:[]}}(),ct=at[0],st=at[1],ft=at[2],lt=st&&st.then,ht=ct&&ct.constructor,dt=at[3],vt=!!ft,pt=!1,yt=ft?function(){ft.then(J)}:Kn.setImmediate?setImmediate.bind(null,J):Kn.MutationObserver?function(){var n=document.createElement("div");new MutationObserver(function(){J(),n=null}).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(J,0)},mt=function(n,t){Pt.push([n,t]),bt&&(yt(),bt=!1)},gt=!0,bt=!0,wt=[],_t=[],kt=null,xt=C,jt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:mn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(n){try{mn(n[0],n[1])}catch(n){}})}},Et=jt,Pt=[],At=0,Ot=[],St={get:function(){function n(n,r){var i=this,o=!t.global&&(t!==Et||e!==Kt);o&&an();var u=new R(function(e,u){W(i,new U(pn(n,t,o),pn(r,t,o),e,u,t))});return Wn&&G(u,this),u}var t=Et,e=Kt;return n.prototype=rt,n},set:function(n){r(this,"then",n&&n.prototype===rt?St:{get:function(){return n},set:St.set})}};e(R.prototype,{then:St,_then:function(n,t){W(this,new U(null,null,n,t,Et))},catch:function(n){if(1===arguments.length)return this.then(null,n);var t=arguments[0],e=arguments[1];return"function"==typeof t?this.then(null,function(n){return n instanceof t?e(n):en(n)}):this.then(null,function(n){return n&&n.name===t?e(n):en(n)})},finally:function(n){return this.then(function(t){return n(),t},function(t){return n(),en(t)})},stack:{get:function(){if(this._stack)return this._stack;try{pt=!0;var n=H(this,[],ot),t=n.join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{pt=!1}}},timeout:function(n,t){var e=this;return n<1/0?new R(function(r,i){var o=setTimeout(function(){return i(new nt.Timeout(t))},n);e.then(r,i).finally(clearTimeout.bind(null,o))}):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&r(R.prototype,Symbol.toStringTag,"Promise"),jt.env=hn(),e(R,{all:function(){var n=_.apply(null,arguments).map(cn);return new R(function(t,e){0===n.length&&t([]);var r=n.length;n.forEach(function(i,o){return R.resolve(i).then(function(e){n[o]=e,--r||t(n)},e)})})},resolve:function(n){if(n instanceof R)return n;if(n&&"function"==typeof n.then)return new R(function(t,e){n.then(t,e)});var t=new R(rt,!0,n);return G(t,kt),t},reject:en,race:function(){var n=_.apply(null,arguments).map(cn);return new R(function(t,e){n.map(function(n){return R.resolve(n).then(t,e)})})},PSD:{get:function(){return Et},set:function(n){return Et=n}},newPSD:on,usePSD:dn,scheduler:{get:function(){return mt},set:function(n){mt=n}},rejectionMapper:{get:function(){return xt},set:function(n){xt=n}},follow:function(n,t){return new R(function(e,r){return on(function(t,e){var r=Et;r.unhandleds=[],r.onunhandled=e,r.finalize=K(function(){var n=this;Z(function(){0===n.unhandleds.length?t():e(n.unhandleds[0])})},r.finalize),n()},t,e,r)})}});var It={awaits:0,echoes:0,id:0},Dt=0,Ct=[],Tt=0,Kt=0,Bt=0,Ft="unhandledrejection";c(function(){mt=function(n,t){setTimeout(function(){n.apply(null,t)},0)}});var Mt,Nt=R.reject,qt="2.0.0-beta.7",Rt=String.fromCharCode(65535),Ut=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return Rt}}(),Vt=-(1/0),zt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Lt="String expected.",Wt=[],Qt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Ht=Qt,Gt=Qt,Jt=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};k(Wn,Jt);var Yt=function(){},$t=!1,Xt=Kn.idbModules&&Kn.idbModules.shimIndexedDB?Kn.idbModules:{};return e(bn,et),e(bn,{delete:function(n){var t=new bn(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new bn(n).open().then(function(n){return n.close(),!0}).catch(bn.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(n){var t=Dn(bn.dependencies.indexedDB);return t?new R(function(n,e){var r=t();r.onsuccess=function(t){n(u(t.target.result,0))},r.onerror=xn(e)}).then(n):Mt.dbnames.toCollection().primaryKeys(n)},defineClass:function(t){function e(e){e?n(this,e):$t&&_n(this,t)}return e},applyStructure:_n,ignoreTransaction:function(n){return Et.trans?dn(Et.transless,n):n()},vip:function(n){return on(function(){return Et.letThrough=!0,n()})},async:function(n){return function(){try{var t=An(n.apply(this,arguments));return t&&"function"==typeof t.then?t:R.resolve(t)}catch(n){return Nt(n)}}},spawn:function(n,t,e){try{var r=An(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:R.resolve(r)}catch(n){return Nt(n)}},currentTransaction:{get:function(){return Et.trans||null}},waitFor:function(n,t){var e=R.resolve("function"==typeof n?bn.ignoreTransaction(n):n).timeout(t||6e4);return Et.trans?Et.trans.waitFor(e):e},Promise:R,debug:{get:function(){return Wn},set:function(n){k(n,"dexie"===n?function(){return!0}:Jt)}},derive:i,extend:n,props:e,override:a,Events:gn,getByKeyPath:v,setByKeyPath:p,delByKeyPath:y,shallowClone:m,deepClone:b,getObjectDiff:w,asap:f,maxKey:Ut,minKey:Vt,addons:[],connections:Wt,MultiModifyError:nt.Modify,errnames:Xn,IndexSpec:On,TableSchema:Sn,dependencies:{indexedDB:Xt.shimIndexedDB||Kn.indexedDB||Kn.mozIndexedDB||Kn.webkitIndexedDB||Kn.msIndexedDB,IDBKeyRange:Xt.IDBKeyRange||Kn.IDBKeyRange||Kn.webkitIDBKeyRange},semVer:qt,version:qt.split(".").map(function(n){return parseInt(n)}).reduce(function(n,t,e){return n+t/Math.pow(10,2*e)}),fakeAutoComplete:Yt,default:bn,Dexie:bn}),R.rejectionMapper=I,c(function(){bn.fakeAutoComplete=Yt=c,bn.fake=$t=!0}),Mt=new bn("__dbnames"),Mt.version(1).stores({dbnames:"name"}),function(){var n="Dexie.DatabaseNames";if(void 0!==typeof localStorage&&void 0!==Kn.document)try{JSON.parse(localStorage.getItem(n)||"[]").forEach(function(n){return Mt.dbnames.put({name:n}).catch(D)}),localStorage.removeItem(n)}catch(n){}}(),bn}); | ||
//# sourceMappingURL=dexie.min.js.map | ||
var i=r.delete(n);i.onerror=xn(e),i.onsuccess=rn(function(){t(i.result)})})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(tt,function(n,t,e){var r=e.clear();r.onerror=xn(t),r.onsuccess=rn(function(){n(r.result)})})},update:function(n,t){if("object"!=typeof t||Tn(t))throw new nt.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||Tn(n))return this.where(":id").equals(n).modify(t);Cn(t).forEach(function(e){p(n,e,t[e])});var e=v(n,this.schema.primKey.keyPath);return void 0===e?Nt(new nt.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)}}),e(Q.prototype,{_lock:function(){return s(!Et.global),++this._reculock,1!==this._reculock||Et.global||(Et.lockOwnerFor=this),this},_unlock:function(){if(s(!Et.global),0===--this._reculock)for(Et.global||(Et.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{dn(n[1],n[0])}catch(n){}}return this},_locked:function(){return this._reculock&&Et.lockOwnerFor!==this},create:function(n){var t=this;if(!this.mode)return this;if(s(!this.idbtrans),!n&&!Gn)switch(Jn&&Jn.name){case"DatabaseClosedError":throw new nt.DatabaseClosed(Jn);case"MissingAPIError":throw new nt.MissingAPI(Jn.message,Jn);default:throw new nt.OpenFailed(Jn)}if(!this.active)throw new nt.TransactionInactive;return s(null===this._completion._state),n=this.idbtrans=n||Gn.transaction(In(this.storeNames),this.mode),n.onerror=rn(function(e){Pn(e),t._reject(n.error)}),n.onabort=rn(function(n){Pn(n),t.active&&t._reject(new nt.Abort),t.active=!1,t.on("abort").fire(n)}),n.oncomplete=rn(function(){t.active=!1,t._resolve()}),this},_promise:function(n,t,e){var r=this;if(n===tt&&this.mode!==tt)return Nt(new nt.ReadOnly("Transaction is readonly"));if(!this.active)return Nt(new nt.TransactionInactive);if(this._locked())return new R(function(i,o){r._blockedFuncs.push([function(){r._promise(n,t,e).then(i,o)},Et])});if(e)return on(function(){var n=new R(function(n,e){r._lock();var i=t(n,e,r);i&&i.then&&i.then(n,e)});return n.finally(function(){return r._unlock()}),n._lib=!0,n});var i=new R(function(n,e){var i=t(n,e,r);i&&i.then&&i.then(n,e)});return i._lib=!0,i},_root:function(){return this.parent?this.parent._root():this},waitFor:function(n){var t=this._root();if(n=R.resolve(n),t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var e=t.idbtrans.objectStore(t.storeNames[0]);!function n(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(e.get(-(1/0)).onsuccess=n)}()}var r=t._waitingFor;return new R(function(e,i){n.then(function(n){return t._waitingQueue.push(rn(e.bind(null,n)))},function(n){return t._waitingQueue.push(rn(i.bind(null,n)))}).finally(function(){t._waitingFor===r&&(t._waitingFor=null)})})},abort:function(){this.active&&this._reject(new nt.Abort),this.active=!1},tables:{get:E("Transaction.tables",function(){return Hn})},table:function(n){var t=et.table(n);return new z(n,t.schema,this)}}),e(H.prototype,function(){function n(n,t,e){var r=n instanceof H?new G(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new G(n,function(){return Un.only("")}).limit(0)}function e(n){return"next"===n?function(n){return n.toUpperCase()}:function(n){return n.toLowerCase()}}function r(n){return"next"===n?function(n){return n.toLowerCase()}:function(n){return n.toUpperCase()}}function i(n,t,e,r,i,o){for(var u=Math.min(n.length,r.length),a=-1,c=0;c<u;++c){var s=t[c];if(s!==r[c])return i(n[c],e[c])<0?n.substr(0,c)+e[c]+e.substr(c+1):i(n[c],r[c])<0?n.substr(0,c)+r[c]+e.substr(c+1):a>=0?n.substr(0,a)+t[a]+e.substr(a+1):null;i(n[c],s)<0&&(a=c)}return u<r.length&&"next"===o?n+e.substr(n.length):u<n.length&&"prev"===o?n.substr(0,e.length):a<0?null:n.substr(0,a)+r[a]+e.substr(a+1)}function o(t,o,u,a){function c(n){s=e(n),f=r(n),l="next"===n?ln:hn;var t=u.map(function(n){return{lower:f(n),upper:s(n)}}).sort(function(n,t){return l(n.lower,t.lower)});h=t.map(function(n){return n.upper}),d=t.map(function(n){return n.lower}),v=n,p="next"===n?"":a}var s,f,l,h,d,v,p,y=u.length;if(!u.every(function(n){return"string"==typeof n}))return n(t,Lt);c("next");var m=new G(t,function(){return Un.bound(h[0],d[y-1]+a)});m._ondirectionchange=function(n){c(n)};var g=0;return m._addAlgorithm(function(n,t,e){var r=n.key;if("string"!=typeof r)return!1;var u=f(r);if(o(u,d,g))return!0;for(var a=null,c=g;c<y;++c){var s=i(r,u,h[c],d[c],l,v);null===s&&null===a?g=c+1:(null===a||l(a,s)>0)&&(a=s)}return t(null!==a?function(){n.continue(a+p)}:e),!1}),m}return{between:function(e,r,i,o){i=i!==!1,o=o===!0;try{return tn(e,r)>0||0===tn(e,r)&&(i||o)&&(!i||!o)?t(this):new G(this,function(){return Un.bound(e,r,!i,!o)})}catch(t){return n(this,zt)}},equals:function(n){return new G(this,function(){return Un.only(n)})},above:function(n){return new G(this,function(){return Un.lowerBound(n,!0)})},aboveOrEqual:function(n){return new G(this,function(){return Un.lowerBound(n)})},below:function(n){return new G(this,function(){return Un.upperBound(n,!0)})},belowOrEqual:function(n){return new G(this,function(){return Un.upperBound(n)})},startsWith:function(t){return"string"!=typeof t?n(this,Lt):this.between(t,t+Rt,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):o(this,function(n,t){return 0===n.indexOf(t[0])},[n],Rt)},equalsIgnoreCase:function(n){return o(this,function(n,t){return n===t[0]},[n],"")},anyOfIgnoreCase:function(){var n=_.apply(Ln,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.indexOf(n)!==-1},n,"")},startsWithAnyOfIgnoreCase:function(){var n=_.apply(Ln,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.some(function(t){return 0===n.indexOf(t)})},n,Rt)},anyOf:function(){var e=_.apply(Ln,arguments),r=sn;try{e.sort(r)}catch(t){return n(this,zt)}if(0===e.length)return t(this);var i=new G(this,function(){return Un.bound(e[0],e[e.length-1])});i._ondirectionchange=function(n){r="next"===n?sn:fn,e.sort(r)};var o=0;return i._addAlgorithm(function(n,t,i){for(var u=n.key;r(u,e[o])>0;)if(++o,o===e.length)return t(i),!1;return 0===r(u,e[o])||(t(function(){n.continue(e[o])}),!1)}),i},notEqual:function(n){return this.inAnyRange([[Vt,n],[n,Ut]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=_.apply(Ln,arguments);if(0===t.length)return new G(this);try{t.sort(sn)}catch(t){return n(this,zt)}var e=t.reduce(function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[Vt,t]]},null);return e.push([t[t.length-1],Ut]),this.inAnyRange(e,{includeLowers:!1,includeUppers:!1})},inAnyRange:function(e,r){function i(n,t){for(var e=0,r=n.length;e<r;++e){var i=n[e];if(tn(t[0],i[1])<0&&tn(t[1],i[0])>0){i[0]=en(i[0],t[0]),i[1]=cn(i[1],t[1]);break}}return e===r&&n.push(t),n}function o(n,t){return f(n[0],t[0])}function u(n){return!h(n)&&!d(n)}if(0===e.length)return t(this);if(!e.every(function(n){return void 0!==n[0]&&void 0!==n[1]&&sn(n[0],n[1])<=0}))return n(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",nt.InvalidArgument);var a,c=!r||r.includeLowers!==!1,s=r&&r.includeUppers===!0,f=sn;try{a=e.reduce(i,[]),a.sort(o)}catch(t){return n(this,zt)}var l=0,h=s?function(n){return sn(n,a[l][1])>0}:function(n){return sn(n,a[l][1])>=0},d=c?function(n){return fn(n,a[l][0])>0}:function(n){return fn(n,a[l][0])>=0},v=h,p=new G(this,function(){return Un.bound(a[0][0],a[a.length-1][1],!c,!s)});return p._ondirectionchange=function(n){"next"===n?(v=h,f=sn):(v=d,f=fn),a.sort(o)},p._addAlgorithm(function(n,t,e){for(var r=n.key;v(r);)if(++l,l===a.length)return t(e),!1;return!!u(r)||0!==tn(r,a[l][1])&&0!==tn(r,a[l][0])&&(t(function(){f===sn?n.continue(a[l][0]):n.continue(a[l][1])}),!1)}),p},startsWithAnyOf:function(){var e=_.apply(Ln,arguments);return e.every(function(n){return"string"==typeof n})?0===e.length?t(this):this.inAnyRange(e.map(function(n){return[n,n+Rt]})):n(this,"startsWithAnyOf() only works with strings")}}}),e(G.prototype,function(){function e(n,t){n.filter=vn(n.filter,t)}function r(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return vn(r(),t())}:t,n.justLimit=e&&!r}function i(n,t){n.isMatch=vn(n.isMatch,t)}function o(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new nt.Schema("KeyPath "+n.index+" on object store "+t.name+" is not indexed");return t.index(e.name)}function u(n,t){var e=o(n,t);return n.keysOnly&&"openKeyCursor"in e?e.openKeyCursor(n.range||null,n.dir+n.unique):e.openCursor(n.range||null,n.dir+n.unique)}function a(n,e,r,i,o){var a=n.replayFilter?vn(n.filter,n.replayFilter()):n.filter;n.or?function(){function c(){2===++l&&r()}function s(n,r,o){if(!a||a(r,o,c,i)){var u=r.primaryKey.toString();t(f,u)||(f[u]=!0,e(n,r,o))}}var f={},l=0;n.or._iterate(s,c,i,o),Z(u(n,o),n.algorithm,s,c,i,!n.keysOnly&&n.valueMapper)}():Z(u(n,o),vn(n.algorithm,a),e,r,i,!n.keysOnly&&n.valueMapper)}function c(n){return n.table.schema.instanceTemplate}return{_read:function(n,t){var e=this._ctx;return e.error?e.table._trans(null,Nt.bind(null,e.error)):e.table._idbstore(Zn,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,Nt.bind(null,t.error)):t.table._idbstore(tt,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=vn(t.algorithm,n)},_iterate:function(n,t,e,r){return a(this._ctx,n,t,e,r)},clone:function(t){var e=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&n(r,t),e._ctx=r,e},raw:function(){return this._ctx.valueMapper=null,this},each:function(n){var t=this._ctx;if($t){var e=c(t),r=t.table.schema.primKey.keyPath,i=v(e,t.index?t.table.schema.idxByName[t.index].keyPath:r),o=v(e,r);n(e,{key:i,primaryKey:o})}return this._read(function(e,r,i){a(t,n,e,r,i)})},count:function(n){if($t)return R.resolve(0).then(n);var t=this._ctx;if(J(t,!0))return this._read(function(n,e,r){var i=o(t,r),u=t.range?i.count(t.range):i.count();u.onerror=xn(e),u.onsuccess=function(e){n(Math.min(e.target.result,t.limit))}},n);var e=0;return this._read(function(n,r,i){a(t,function(){return++e,!1},function(){n(e)},r,i)},n)},sortBy:function(n,t){function e(n,t){return t?e(n[i[t]],t-1):n[o]}function r(n,t){var r=e(n,u),i=e(t,u);return r<i?-a:r>i?a:0}var i=n.split(".").reverse(),o=i[0],u=i.length-1,a="next"===this._ctx.dir?1:-1;return this.toArray(function(n){return n.sort(r)}).then(t)},toArray:function(n){var t=this._ctx;return this._read(function(n,e,r){if($t&&n([c(t)]),Bn&&"next"===t.dir&&J(t,!0)&&t.limit>0){var i=t.table.hook.reading.fire,u=o(t,r),s=t.limit<1/0?u.getAll(t.range,t.limit):u.getAll(t.range);s.onerror=xn(e),s.onsuccess=jn(i===C?n:function(t){try{n(t.map(i))}catch(n){e(n)}})}else{var f=[];a(t,function(n){f.push(n)},function(){n(f)},e,r)}},n)},offset:function(n){var t=this._ctx;return n<=0?this:(t.offset+=n,J(t)?r(t,function(){var t=n;return function(n,e){return 0===t||(1===t?(--t,!1):(e(function(){n.advance(t),t=0}),!1))}}):r(t,function(){var t=n;return function(){return--t<0}}),this)},limit:function(n){return this._ctx.limit=Math.min(this._ctx.limit,n),r(this._ctx,function(){var t=n;return function(n,e,r){return--t<=0&&e(r),t>=0}},!0),this},until:function(n,t){var r=this._ctx;return $t&&n(c(r)),e(this._ctx,function(e,r,i){return!n(e.value)||(r(i),t)}),this},first:function(n){return this.limit(1).toArray(function(n){return n[0]}).then(n)},last:function(n){return this.reverse().first(n)},filter:function(n){return $t&&n(c(this._ctx)),e(this._ctx,function(t){return n(t.value)}),i(this._ctx,n),this},and:function(n){return this.filter(n)},or:function(n){return new H(this._ctx.table,n,this)},reverse:function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},desc:function(){return this.reverse()},eachKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,e){n(e.key,e)})},eachUniqueKey:function(n){return this._ctx.unique="unique",this.eachKey(n)},eachPrimaryKey:function(n){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,e){n(e.primaryKey,e)})},keys:function(n){var t=this._ctx;t.keysOnly=!t.isMatch;var e=[];return this.each(function(n,t){e.push(t.key)}).then(function(){return e}).then(n)},primaryKeys:function(n){var t=this._ctx;if(Bn&&"next"===t.dir&&J(t,!0)&&t.limit>0)return this._read(function(n,e,r){var i=o(t,r),u=t.limit<1/0?i.getAllKeys(t.range,t.limit):i.getAllKeys(t.range);u.onerror=xn(e),u.onsuccess=jn(n)}).then(n);t.keysOnly=!t.isMatch;var e=[];return this.each(function(n,t){e.push(t.primaryKey)}).then(function(){return e}).then(n)},uniqueKeys:function(n){return this._ctx.unique="unique",this.keys(n)},firstKey:function(n){return this.limit(1).keys(function(n){return n[0]}).then(n)},lastKey:function(n){return this.reverse().firstKey(n)},distinct:function(){var n=this._ctx,r=n.index&&n.table.schema.idxByName[n.index];if(!r||!r.multi)return this;var i={};return e(this._ctx,function(n){var e=n.primaryKey.toString(),r=t(i,e);return i[e]=!0,!r}),this},modify:function(e){var r=this,i=this._ctx,o=i.table.hook,u=o.updating.fire,a=o.deleting.fire;return $t&&"function"==typeof e&&e.call({value:i.table.schema.instanceTemplate},i.table.schema.instanceTemplate),this._write(function(i,o,c,s){function f(n,e){function r(n){return P.push(n),A.push(i.primKey),h(),!0}S=e.primaryKey;var i={primKey:e.primaryKey,value:n,onsuccess:null,onerror:null};if(y.call(i,n,i)!==!1){var o=!t(i,"value");++x,d(function(){var n=o?e.delete():e.update(i.value);n._hookCtx=i,n.onerror=En(r),n.onsuccess=kn(function(){++j,h()})},r)}else i.onsuccess&&i.onsuccess(i.value)}function l(n){return n&&(P.push(n),A.push(S)),o(new O("Error modifying one or more objects",P,j,A))}function h(){E&&j+P.length===x&&(P.length>0?l():i(j))}var y;if("function"==typeof e)y=u===D&&a===D?e:function(n){var r=b(n);if(e.call(this,n,this)===!1)return!1;if(t(this,"value")){var i=w(r,this.value),o=u.call(this,i,this.primKey,r,s);o&&(n=this.value,Cn(o).forEach(function(t){p(n,t,o[t])}))}else a.call(this,this.primKey,n,s)};else if(u===D){var g=Cn(e),_=g.length;y=function(n){for(var t=!1,r=0;r<_;++r){var i=g[r],o=e[i];v(n,i)!==o&&(p(n,i,o),t=!0)}return t}}else{var k=e;e=m(k),y=function(t){var r=!1,i=u.call(this,e,this.primKey,b(t),s);return i&&n(e,i),Cn(e).forEach(function(n){var i=e[n];v(t,n)!==i&&(p(t,n,i),r=!0)}),i&&(e=m(k)),r}}var x=0,j=0,E=!1,P=[],A=[],S=null;r.clone().raw()._iterate(f,function(){E=!0,h()},l,c)})},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==D;if(!i&&J(t)&&(t.isPrimKey&&!Gt||!e))return this._write(function(n,t,r){var i=xn(t),o=e?r.count(e):r.count();o.onerror=i,o.onsuccess=function(){var u=o.result;d(function(){var t=e?r.delete(e):r.clear();t.onerror=i,t.onsuccess=function(){return n(u)}},function(n){return t(n)})}});var o=i?2e3:1e4;return this._write(function(e,u,a,c){var s=0,f=n.clone({keysOnly:!t.isMatch&&!i}).distinct().limit(o).raw(),l=[],h=function(){return f.each(i?function(n,t){l.push([t.primaryKey,t.value])}:function(n,t){l.push(t.primaryKey)}).then(function(){return i?l.sort(function(n,t){return sn(n[0],t[0])}):l.sort(sn),W(a,c,l,i,r)}).then(function(){var n=l.length;return s+=n,l=[],n<o?s:h()})};e(h())})}}}),n(this,{Collection:G,Table:z,Transaction:Q,Version:y,WhereClause:H}),f(),Nn.forEach(function(n){n(et)})}function wn(n){if("function"==typeof n)return new n;if(Tn(n))return[wn(n[0])];if(n&&"object"==typeof n){var t={};return _n(t,n),t}return n}function _n(n,t){return Cn(t).forEach(function(e){var r=wn(t[e]);n[e]=r}),n}function kn(n){return rn(function(t){var e=t.target,r=e.result,i=e._hookCtx,o=i&&i.onsuccess;o&&o(r),n&&n(r)},n)}function xn(n){return rn(function(t){return Pn(t),n(t.target.error),!1})}function jn(n){return rn(function(t){n(t.target.result)})}function En(n){return rn(function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),Pn(t),n(r),!1})}function Pn(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function An(n){function t(n){return function(t){var e=n(t),r=e.value;return e.done?r:r&&"function"==typeof r.then?r.then(i,o):Tn(r)?R.all(r).then(i,o):i(r)}}var e=function(t){return n.next(t)},r=function(t){return n.throw(t)},i=t(e),o=t(r);return t(e)()}function On(n,t,e,r,i,o,u){this.name=n,this.keyPath=t,this.unique=e,this.multi=r,this.auto=i,this.compound=o,this.dotted=u;var a="string"==typeof t?t:t&&"["+[].join.call(t,"+")+"]";this.src=(e?"&":"")+(r?"*":"")+(i?"++":"")+a}function Sn(n,t,e,r){this.name=n,this.primKey=t||new On,this.indexes=e||[new On],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=l(e,function(n){return[n.name,n]})}function In(n){return 1===n.length?n[0]:n}function Dn(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}var Cn=Object.keys,Tn=Array.isArray,Kn="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Bn=Object.getPrototypeOf,Fn={}.hasOwnProperty,Mn=Object.defineProperty,Nn=Object.getOwnPropertyDescriptor,qn=[].slice,Rn=[].concat,Un="Boolean,String,Date,RegExp,Blob,File,FileList,ArrayBuffer,DataView,Uint8ClampedArray,ImageData,Map,Set".split(",").concat(g([8,16,32,64].map(function(n){return["Int","Uint","Float"].map(function(t){return t+n+"Array"})}))).filter(function(n){return Kn[n]}).map(function(n){return Kn[n]}),Vn="undefined"!=typeof Symbol&&Symbol.iterator,zn=Vn?function(n){var t;return null!=n&&(t=n[Vn])&&t.apply(n)}:function(){return null},Ln={},Wn="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),Qn=function(){return!0},Hn=!new Error("").stack,Gn=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Jn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Yn=Gn.concat(Jn),$n={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};i(P).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+j(this._e,2))}},toString:function(){return this.name+": "+this.message}}),i(O).from(P),i(S).from(P);var Xn=Yn.reduce(function(n,t){return n[t]=t+"Error",n},{}),Zn=P,nt=Yn.reduce(function(n,t){function e(n,e){this._e=x(),this.name=r,n?"string"==typeof n?(this.message=n,this.inner=e||null):"object"==typeof n&&(this.message=n.name+" "+n.message,this.inner=n):(this.message=$n[t]||r,this.inner=null)}var r=t+"Error";return i(e).from(Zn),n[t]=e,n},{});nt.Syntax=SyntaxError,nt.Type=TypeError,nt.Range=RangeError;var tt=Jn.reduce(function(n,t){return n[t+"Error"]=nt[t],n},{}),et=Yn.reduce(function(n,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(n[t+"Error"]=nt[t]),n},{});et.ModifyError=O,et.DexieError=P,et.BulkError=S;var rt={},it=100,ot=20,ut=7,at=function(){try{return new Function("let F=async ()=>{},p=F();return [p,Object.getPrototypeOf(p),Promise.resolve(),F.constructor];")()}catch(t){var n=Kn.Promise;return n?[n.resolve(),n.prototype,n.resolve()]:[]}}(),ct=at[0],st=at[1],ft=at[2],lt=st&&st.then,ht=ct&&ct.constructor,dt=at[3],vt=!!ft,pt=!1,yt=ft?function(){ft.then(J)}:Kn.setImmediate?setImmediate.bind(null,J):Kn.MutationObserver?function(){var n=document.createElement("div");new MutationObserver(function(){J(),n=null}).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(J,0)},mt=function(n,t){Pt.push([n,t]),bt&&(yt(),bt=!1)},gt=!0,bt=!0,wt=[],_t=[],kt=null,xt=C,jt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:mn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(n){try{mn(n[0],n[1])}catch(n){}})}},Et=jt,Pt=[],At=0,Ot=[],St={get:function(){function n(n,r){var i=this,o=!t.global&&(t!==Et||e!==Kt);o&&an();var u=new R(function(e,u){W(i,new U(pn(n,t,o),pn(r,t,o),e,u,t))});return Wn&&G(u,this),u}var t=Et,e=Kt;return n.prototype=rt,n},set:function(n){r(this,"then",n&&n.prototype===rt?St:{get:function(){return n},set:St.set})}};e(R.prototype,{then:St,_then:function(n,t){W(this,new U(null,null,n,t,Et))},catch:function(n){if(1===arguments.length)return this.then(null,n);var t=arguments[0],e=arguments[1];return"function"==typeof t?this.then(null,function(n){return n instanceof t?e(n):en(n)}):this.then(null,function(n){return n&&n.name===t?e(n):en(n)})},finally:function(n){return this.then(function(t){return n(),t},function(t){return n(),en(t)})},stack:{get:function(){if(this._stack)return this._stack;try{pt=!0;var n=H(this,[],ot),t=n.join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{pt=!1}}},timeout:function(n,t){var e=this;return n<1/0?new R(function(r,i){var o=setTimeout(function(){return i(new nt.Timeout(t))},n);e.then(r,i).finally(clearTimeout.bind(null,o))}):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&r(R.prototype,Symbol.toStringTag,"Promise"),jt.env=hn(),e(R,{all:function(){var n=_.apply(null,arguments).map(cn);return new R(function(t,e){0===n.length&&t([]);var r=n.length;n.forEach(function(i,o){return R.resolve(i).then(function(e){n[o]=e,--r||t(n)},e)})})},resolve:function(n){if(n instanceof R)return n;if(n&&"function"==typeof n.then)return new R(function(t,e){n.then(t,e)});var t=new R(rt,!0,n);return G(t,kt),t},reject:en,race:function(){var n=_.apply(null,arguments).map(cn);return new R(function(t,e){n.map(function(n){return R.resolve(n).then(t,e)})})},PSD:{get:function(){return Et},set:function(n){return Et=n}},newPSD:on,usePSD:dn,scheduler:{get:function(){return mt},set:function(n){mt=n}},rejectionMapper:{get:function(){return xt},set:function(n){xt=n}},follow:function(n,t){return new R(function(e,r){return on(function(t,e){var r=Et;r.unhandleds=[],r.onunhandled=e,r.finalize=K(function(){var n=this;Z(function(){0===n.unhandleds.length?t():e(n.unhandleds[0])})},r.finalize),n()},t,e,r)})}});var It={awaits:0,echoes:0,id:0},Dt=0,Ct=[],Tt=0,Kt=0,Bt=0,Ft="unhandledrejection";c(function(){mt=function(n,t){setTimeout(function(){n.apply(null,t)},0)}});var Mt,Nt=R.reject,qt="2.0.0-beta.8",Rt=String.fromCharCode(65535),Ut=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return Rt}}(),Vt=-(1/0),zt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Lt="String expected.",Wt=[],Qt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Ht=Qt,Gt=Qt,Jt=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};k(Wn,Jt);var Yt=function(){},$t=!1,Xt=Kn.idbModules&&Kn.idbModules.shimIndexedDB?Kn.idbModules:{};return e(bn,et),e(bn,{delete:function(n){var t=new bn(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new bn(n).open().then(function(n){return n.close(),!0}).catch(bn.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(n){var t=Dn(bn.dependencies.indexedDB);return t?new R(function(n,e){var r=t();r.onsuccess=function(t){n(u(t.target.result,0))},r.onerror=xn(e)}).then(n):Mt.dbnames.toCollection().primaryKeys(n)},defineClass:function(t){function e(e){e?n(this,e):$t&&_n(this,t)}return e},applyStructure:_n,ignoreTransaction:function(n){return Et.trans?dn(Et.transless,n):n()},vip:function(n){return on(function(){return Et.letThrough=!0,n()})},async:function(n){return function(){try{var t=An(n.apply(this,arguments));return t&&"function"==typeof t.then?t:R.resolve(t)}catch(n){return Nt(n)}}},spawn:function(n,t,e){try{var r=An(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:R.resolve(r)}catch(n){return Nt(n)}},currentTransaction:{get:function(){return Et.trans||null}},waitFor:function(n,t){var e=R.resolve("function"==typeof n?bn.ignoreTransaction(n):n).timeout(t||6e4);return Et.trans?Et.trans.waitFor(e):e},Promise:R,debug:{get:function(){return Wn},set:function(n){k(n,"dexie"===n?function(){return!0}:Jt)}},derive:i,extend:n,props:e,override:a,Events:gn,getByKeyPath:v,setByKeyPath:p,delByKeyPath:y,shallowClone:m,deepClone:b,getObjectDiff:w,asap:f,maxKey:Ut,minKey:Vt,addons:[],connections:Wt,MultiModifyError:nt.Modify,errnames:Xn,IndexSpec:On,TableSchema:Sn,dependencies:{indexedDB:Xt.shimIndexedDB||Kn.indexedDB||Kn.mozIndexedDB||Kn.webkitIndexedDB||Kn.msIndexedDB,IDBKeyRange:Xt.IDBKeyRange||Kn.IDBKeyRange||Kn.webkitIDBKeyRange},semVer:qt,version:qt.split(".").map(function(n){return parseInt(n)}).reduce(function(n,t,e){return n+t/Math.pow(10,2*e)}),fakeAutoComplete:Yt,default:bn,Dexie:bn}),R.rejectionMapper=I,c(function(){bn.fakeAutoComplete=Yt=c,bn.fake=$t=!0}),Mt=new bn("__dbnames"),Mt.version(1).stores({dbnames:"name"}),function(){var n="Dexie.DatabaseNames";if(void 0!==typeof localStorage&&void 0!==Kn.document)try{JSON.parse(localStorage.getItem(n)||"[]").forEach(function(n){return Mt.dbnames.put({name:n}).catch(D)}),localStorage.removeItem(n)}catch(n){}}(),bn}); | ||
//# sourceMappingURL=dist/dexie.min.js.map |
{ | ||
"name": "dexie", | ||
"version": "2.0.0-beta.7", | ||
"version": "2.0.0-beta.8", | ||
"description": "A Minimalistic Wrapper for IndexedDB", | ||
"main": "dist/dexie.js", | ||
"module": "dist/dexie.es6.js", | ||
"jsnext:main": "dist/dexie.es6.js", | ||
@@ -36,54 +37,77 @@ "typings": "dist/dexie.d.ts", | ||
"scripts": { | ||
"build": "babel-node --presets es2015 --plugins syntax-async-functions,transform-regenerator tools/build.js", | ||
"watch": "babel-node --presets es2015 --plugins syntax-async-functions,transform-regenerator tools/watch.js", | ||
"test": "npm run eslint && npm run build && npm run test:local", | ||
"eslint": "eslint src", | ||
"test:local": "node_modules/.bin/karma start test/karma.conf.js --single-run", | ||
"test:release": "node_modules/.bin/karma start test/karma.release.conf.js --single-run", | ||
"test:debug": "node_modules/.bin/karma start test/karma.conf.js --log-level debug", | ||
"test:typings": "node_modules/.bin/tsc -p test/typings-test/" | ||
"build": "just-build", | ||
"watch": "just-build --watch", | ||
"test": "npm run build && npm run test:typings && npm run test:unit", | ||
"test:unit": "karma start test/karma.conf.js --single-run", | ||
"test:typings": "tsc -p test/typings-test/", | ||
"test:debug": "karma start test/karma.conf.js --log-level debug" | ||
}, | ||
"just-build": { | ||
"default": [ | ||
"# Build all targets (es5, es6 and test) and minify the default es5 UMD module", | ||
"just-build release test" | ||
], | ||
"dexie": [ | ||
"# Build es5 output", | ||
"tsc --allowJs -t es5 -m es2015 --outDir tools/tmp/es5/src/ --sourceMap src/Dexie.js [--watch 'Compilation complete.']", | ||
"rollup -c tools/build-configs/rollup.config.js", | ||
"node tools/replaceVersionAndDate.js dist/dexie.js", | ||
"eslint src" | ||
], | ||
"dexie-es6": [ | ||
"tsc --allowJs -t es2015 -m es2015 --outDir tools/tmp/es6/src/ --sourceMap src/Dexie.js [--watch 'Compilation complete.']", | ||
"rollup -c tools/build-configs/rollup.config.es6.js", | ||
"node tools/replaceVersionAndDate.js dist/dexie.es6.js" | ||
], | ||
"release": [ | ||
"# Build ES5 umd module as well as the es6 module.", | ||
"just-build dexie dexie-es6", | ||
"# Copy Dexie.d.ts to dist and replace version in it", | ||
"node -e \"fs.writeFileSync('dist/dexie.d.ts', fs.readFileSync('src/Dexie.d.ts'))\"", | ||
"node tools/replaceVersionAndDate.js dist/dexie.d.ts", | ||
"# Minify the default ES5 UMD module", | ||
"uglifyjs dist/dexie.js -m -c -o dist/dexie.min.js --source-map dist/dexie.min.js.map --in-source-map dist/dexie.js.map" | ||
], | ||
"dev": [ | ||
"# Build ES5 module and the tests", | ||
"just-build dexie test" | ||
], | ||
"gzip": [ | ||
"# Optionally gzip to find the size of the minified & gzipped version", | ||
"gzip dist/dexie.min.js -k -f -9" | ||
], | ||
"test": [ | ||
"# Build the test suite. Typescript transpiles all but not generators...", | ||
"tsc --allowJs -t es5 -m es2015 --outDir tools/tmp/es5/test/ --sourceMap test/tests-all.js [--watch 'Compilation complete.']", | ||
"rollup -c tools/build-configs/rollup.tests.config.js", | ||
"# As a last step, let babel transpile the generators....", | ||
"babel tools/tmp/es5/test/bundle.js -o test/bundle.js --plugins transform-regenerator --source-maps" | ||
] | ||
}, | ||
"engines": { | ||
"node": ">=4.2" | ||
"node": ">=6.0" | ||
}, | ||
"homepage": "http://dexie.org", | ||
"devDependencies": { | ||
"babel-cli": "^6.16.0", | ||
"babel-core": "^6.17.0", | ||
"babel-plugin-syntax-async-functions": "^6.13.0", | ||
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2", | ||
"babel-plugin-transform-es2015-block-scoped-functions": "^6.6.5", | ||
"babel-plugin-transform-es2015-block-scoping": "^6.15.0", | ||
"babel-plugin-transform-es2015-classes": "^6.14.0", | ||
"babel-plugin-transform-es2015-computed-properties": "^6.6.5", | ||
"babel-plugin-transform-es2015-constants": "^6.1.4", | ||
"babel-plugin-transform-es2015-destructuring": "^6.16.0", | ||
"babel-plugin-transform-es2015-literals": "^6.5.0", | ||
"babel-plugin-transform-es2015-object-super": "^6.6.5", | ||
"babel-plugin-transform-es2015-parameters": "^6.17.0", | ||
"babel-plugin-transform-es2015-shorthand-properties": "^6.5.0", | ||
"babel-plugin-transform-es2015-spread": "^6.6.5", | ||
"babel-plugin-transform-es2015-sticky-regex": "^6.5.0", | ||
"babel-plugin-transform-es2015-template-literals": "^6.6.5", | ||
"babel-plugin-transform-regenerator": "^6.16.1", | ||
"babel-polyfill": "^6.16.0", | ||
"babel-preset-es2015": "^6.16.0", | ||
"es6-promisify": "^5.0.0", | ||
"es6-promisify-all": "^0.1.0", | ||
"babel-cli": "^6.18.0", | ||
"babel-plugin-transform-regenerator": "^6.21.0", | ||
"eslint": "^3.7.1", | ||
"karma": "^0.13.22", | ||
"just-build": "^0.9.16", | ||
"karma": "^1.4.0", | ||
"karma-browserstack-launcher": "^1.1.1", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-mocha-reporter": "^2.2.0", | ||
"karma-mocha-reporter": "^2.2.2", | ||
"karma-qunit": "^1.2.1", | ||
"node-watch": "^0.4.0", | ||
"qunit": "^0.7.7", | ||
"qunitjs": "^1.23.1", | ||
"rollup": "^0.36.1", | ||
"rollup": "^0.41.4", | ||
"rollup-plugin-commonjs": "^7.0.0", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"rollup-plugin-sourcemaps": "^0.4.1", | ||
"serve-static": "^1.11.1", | ||
"typescript": "^2.1.4", | ||
"uglify-js": "^2.7.3" | ||
"uglify-js": "^2.7.5" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -265,3 +265,3 @@ Dexie.js | ||
2. Clone your fork locally by launching a shell/command window and cd to a neutral place (like `~repos/`, `c:\repos` or whatever) | ||
3. Run the following commands: *(if you're on npm 2.x and Windows, you need to elevate your command prompt for `npm install` to succeed)* | ||
3. Run the following commands: | ||
@@ -292,3 +292,3 @@ ``` | ||
``` | ||
npm install (need to be elevated on windows for some reason) | ||
npm install | ||
npm run build | ||
@@ -295,0 +295,0 @@ ``` |
@@ -219,3 +219,3 @@ // Type definitions for Dexie v{version} | ||
interface Version { | ||
stores(schema: { [key: string]: string }): Version; | ||
stores(schema: { [key: string]: string | null }): Version; | ||
upgrade(fn: (trans: Transaction) => void): Version; | ||
@@ -222,0 +222,0 @@ } |
@@ -1,12 +0,2 @@ | ||
/* | ||
* Dexie.js - a minimalistic wrapper for IndexedDB | ||
* =============================================== | ||
* | ||
* By David Fahlander, david.fahlander@gmail.com | ||
* | ||
* Version {version}, {date} | ||
* www.dexie.com | ||
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/ | ||
*/ | ||
export var keys = Object.keys; | ||
export var keys = Object.keys; | ||
export var isArray = Array.isArray; | ||
@@ -13,0 +3,0 @@ export var _global = |
@@ -1,49 +0,16 @@ | ||
module.exports = function(config) { | ||
const configuration = { | ||
const {karmaCommon, getKarmaConfig, defaultBrowserMatrix} = require('./karma.common'); | ||
module.exports = function (config) { | ||
const cfg = getKarmaConfig (defaultBrowserMatrix, { | ||
// Base path should point at the root | ||
basePath: '..', | ||
frameworks: [ | ||
'qunit' | ||
], | ||
reporters: [ | ||
'mocha' | ||
], | ||
client: { | ||
captureConsole: false | ||
}, | ||
files: [ | ||
'test/babel-polyfill/polyfill.min.js', | ||
'node_modules/qunitjs/qunit/qunit.js', | ||
'test/karma-env.js', | ||
// Files to include | ||
files: karmaCommon.files.concat([ | ||
'dist/dexie.js', | ||
'test/bundle.js', | ||
{ pattern: 'test/worker.js', included: false }, | ||
{ pattern: '**/*.map', watched: false, included: false, served: true} | ||
], | ||
{ watched: true, included: false, served: true, pattern: 'test/worker.js' }, | ||
]) | ||
}); | ||
port: 19144, | ||
//captureTimeout: 30 * 1000, | ||
//browserNoActivityTimeout: 10 * 60 * 1000, | ||
colors: true, | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
//logLevel: config.LOG_DEBUG, | ||
browsers: [ | ||
'Chrome' | ||
], | ||
plugins: [ | ||
'karma-qunit', | ||
'karma-mocha-reporter', | ||
'karma-chrome-launcher', | ||
//'karma-firefox-launcher' | ||
] | ||
}; | ||
config.set(configuration); | ||
}; | ||
config.set(cfg); | ||
} |
@@ -186,3 +186,3 @@ import Dexie from 'dexie'; | ||
ok(Dexie.currentTransaction === null, "Should not have an ongoing transaction to start with"); | ||
db.transaction('rw', db.items, ()=>{ | ||
@@ -206,3 +206,3 @@ let trans = Dexie.currentTransaction; | ||
// In parallell with the above 2*100 async tasks are being executed and verified, | ||
// maintain the transaction zone below: | ||
// maintain the transaction zone below: | ||
return Promise.resolve().then(()=> { | ||
@@ -353,3 +353,3 @@ ok(Dexie.currentTransaction === trans, "Still same transaction 1"); | ||
ok(window.Promise !== Dexie.Promise, "At global scope. Promise should not be Dexie.Promise"); | ||
var GlobalPromise = Promise; | ||
var GlobalPromise = window.Promise; | ||
await db.transaction('rw', db.items, async() =>{ | ||
@@ -430,3 +430,3 @@ ok(Promise === Dexie.Promise, "Within transaction scope, Promise should be Dexie.Promise."); | ||
const GlobalPromise = Promise; | ||
const GlobalPromise = window.Promise; | ||
promisedTest ("Should behave outside transactions as well", async () => { | ||
@@ -433,0 +433,0 @@ if (!hasNativeAsyncFunctions) { |
@@ -28,2 +28,6 @@ import Dexie from 'dexie'; | ||
asyncTest("Transaction should work when returning native Promise in transaction scope", function() { | ||
if (!NativePromise) { | ||
ok(true, "Current Browser doesn't have a native Promise"); | ||
return start(); | ||
} | ||
db.transaction('rw', db.users, trans => { | ||
@@ -752,5 +756,5 @@ ok(Dexie.currentTransaction === trans, "First argument to transaction callback should be the transaction instance itself"); | ||
function doTheTests() { | ||
db.users.add({ username: "monkey1" }); | ||
db.users.add({ username: "monkey1" }).catch(function(ex) { | ||
async function doTheTests() { | ||
await db.users.add({ username: "monkey1" }); | ||
await db.users.add({ username: "monkey1" }).catch(function(ex) { | ||
ok(true, "Should fail adding a second monkey1"); | ||
@@ -760,3 +764,3 @@ }); // Trigger creating.onerror | ||
ok(true, "Testing bulkAdd"); | ||
db.users.bulkAdd([{ username: "monkey1" }, { username: "monkey2" }]) | ||
await db.users.bulkAdd([{ username: "monkey1" }, { username: "monkey2" }]) | ||
.then(()=>ok(false, "Should get error on one of the adds")) | ||
@@ -766,7 +770,7 @@ .catch(Dexie.BulkError, e=>{ | ||
ok(e.failures.length === 1, "One error out of two: " + e); | ||
}); | ||
db.users.where("username").equals("monkey1").modify({ | ||
}); | ||
await db.users.where("username").equals("monkey1").modify({ | ||
name: "Monkey 1" | ||
}); | ||
db.users.where("username").equals("monkey1").modify(function (user) { | ||
await db.users.where("username").equals("monkey1").modify(user => { | ||
user.username = "monkey2";// trigger updating.onerror | ||
@@ -776,5 +780,5 @@ }).catch(function(ex) { | ||
}); | ||
db.users.toArray(); | ||
db.users.delete("monkey2"); | ||
return db.users.delete("monkey1"); | ||
await db.users.toArray(); | ||
await db.users.delete("monkey2"); | ||
await db.users.delete("monkey1"); | ||
}; | ||
@@ -784,8 +788,8 @@ | ||
ok(true, "Now in an explicit transaction block..."); | ||
return db.transaction('rw', db.users, function() { | ||
doTheTests(); | ||
return db.transaction('rw', db.users, async () => { | ||
await doTheTests(); | ||
}); | ||
}).catch(function(ex) { | ||
ok(false, ex); | ||
}).finally(function() { | ||
}).then(() => { | ||
db.users.hook.creating.unsubscribe(onCreating); | ||
@@ -792,0 +796,0 @@ db.users.hook.reading.unsubscribe(onReading); |
@@ -50,3 +50,3 @@ import Dexie from 'dexie'; | ||
// Already sorted. | ||
var idbNames = [...db.backendDB().objectStoreNames]; | ||
var idbNames = [].slice.call(db.backendDB().objectStoreNames); | ||
var dexieNames = db.tables.map(t => t.name).sort(); | ||
@@ -53,0 +53,0 @@ deepEqual(dexieNames, |
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 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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
2271324
19
64
22341
11