Comparing version 1.5.0-rc to 1.5.0-rc.2
@@ -34,3 +34,3 @@ { | ||
], | ||
"version": "1.5.0-rc" | ||
"version": "1.5.0-rc.2" | ||
} |
@@ -1,2 +0,2 @@ | ||
// Type definitions for Dexie v1.5.0-rc | ||
// Type definitions for Dexie v1.5.0-rc.2 | ||
// Project: https://github.com/dfahlander/Dexie.js | ||
@@ -3,0 +3,0 @@ // Definitions by: David Fahlander <http://github.com/dfahlander> |
@@ -1,3 +0,3 @@ | ||
!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:(An(t).forEach(function(e){n[e]=t[e]}),n)}function t(n,t){return Cn.call(n,t)}function e(n,t){"function"==typeof t&&(t=t(jn(n))),An(t).forEach(function(e){r(n,e,t[e])})}function r(e,r,i,o){Object.defineProperty(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=Dn(n,t);return r||(e=jn(n))&&o(e,t)}function u(n,t,e){return Pn.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){In.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 p(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=p(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:p(c,e.substr(a+1))}}function v(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)v(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]={}),v(c,a,e)}}else void 0===e?delete n[t]:n[t]=e}}function y(n,t){"string"==typeof t?v(n,t,void 0):"length"in t&&[].map.call(t,function(t){v(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){if(!n||"object"!=typeof n)return n;var e;if(On(n)){e=[];for(var r=0,i=n.length;r<i;++r)e.push(g(n[r]))}else if(n instanceof Date)e=new Date,e.setTime(n.getTime());else{e=n.constructor?Object.create(n.constructor.prototype):{};for(var o in n)t(n,o)&&(e[o]=g(n[o]))}return e}function b(n,e,r,i){return r=r||{},i=i||"",An(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?b(u,a,r,i+o+"."):u!==a&&(r[i+o]=e[o])}else r[i+o]=void 0}),An(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(On(n))return n.slice();if(this===Kn&&"string"==typeof n)return[n];if(i=Tn(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 w(n){return Bn.apply([],n)}function k(){}function x(n){return n}function E(n,t){return null==n||n===x?t:function(e){return t(n(e))}}function A(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function O(n,t){return n===k?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?A(r,this.onsuccess):r),i&&(this.onerror=this.onerror?A(i,this.onerror):i),void 0!==o?o:e}}function I(n,t){return n===k?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?A(e,this.onsuccess):e),r&&(this.onerror=this.onerror?A(r,this.onerror):r)}}function j(t,e){return t===k?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?A(o,this.onsuccess):o),u&&(this.onerror=this.onerror?A(u,this.onerror):u),void 0===i?void 0===a?void 0:a:n(i,a)}}function C(n,t){return n===k?t:function(){return t.apply(this,arguments)!==!1&&n.apply(this,arguments)}}function D(n,t){return n===k?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 P(n,t){Mn=n,Nn=t}function S(){if(Fn)try{throw S.arguments,new Error}catch(n){return n}return new Error}function T(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(Nn).map(function(n){return"\n"+n}).join("")):""}function K(n,t){return function(){return console.warn(n+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+T(S(),1)),t.apply(this,arguments)}}function B(n,t){this._e=S(),this.name=n,this.message=t}function M(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 N(n,t,e,r){this._e=S(),this.failures=t,this.failedKeys=r,this.successCount=e}function F(n,t){this._e=S(),this.name="BulkError",this.failures=t,this.message=M(n,t)}function q(n,t){if(!n||n instanceof B||n instanceof TypeError||n instanceof SyntaxError||!n.name||!Hn[n.name])return n;var e=new Hn[n.name](t||n.message,n);return"stack"in n&&r(e,"stack",{get:function(){return this.inner.stack}}),e}function R(n){function t(n,t,o){if("object"==typeof n)return e(n);t||(t=C),o||(o=k);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){An(n).forEach(function(e){var r=n[e];if(On(r))t(e,n[e][0],n[e][1]);else{if("asap"!==r)throw new Wn.InvalidArgument("Invalid event config");var i=t(e,x,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 U(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=k,this._lib=!1;var t=this._PSD=at;if(Mn&&(this._stackHolder=S(),this._prev=null,this._numPrev=0,Q(this,it)),"function"!=typeof n){if(n!==Jn)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&L(this,this._value))}this._state=null,this._value=null,++t.ref,V(this,n)}function z(n,t,e,r){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r,this.psd=at}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&&$();t&&"function"==typeof t.then?V(n,function(n,e){t instanceof U?t._then(n,e):t.then(n,e)}):(n._state=!0,n._value=t,W(n)),e&&X()}},L.bind(null,n))}catch(t){L(n,t)}}function L(n,t){if(rt.push(t),null===n._state){var e=n._lib&&$();t=ot(t),n._state=!1,n._value=t,Mn&&null!==t&&"object"==typeof t&&!t._promise&&d(function(){var e=o(t,"stack");t._promise=n,r(t,"stack",{get:function(){return $n?e&&(e.get?e.get.apply(t):e.value):n.stack}})}),tn(n),W(n),e&&X()}}function W(n){var t=n._listeners;n._listeners=[];for(var e=0,r=t.length;e<r;++e)H(n,t[e]);var i=n._PSD;--i.ref||i.finalize(),0===st&&(++st,Zn(function(){0===--st&&Z()},[]))}function H(n,t){if(null===n._state)return void n._listeners.push(t);var e=n._state?t.onFulfilled:t.onRejected;if(null===e)return(n._state?t.resolve:t.reject)(n._value);var r=t.psd;++r.ref,++st,Zn(G,[e,n,t])}function G(n,t,e){var r=at,i=e.psd;try{i!==r&&(at=i),it=t;var o,u=t._value;t._state?o=n(u):(rt.length&&(rt=[]),o=n(u),rt.indexOf(u)===-1&&en(t)),e.resolve(o)}catch(n){e.reject(n)}finally{i!==r&&(at=r),it=null,0===--st&&Z(),--i.ref||i.finalize()}}function J(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=T(u,0)):(i=u,o=""),t.push(i+(o?": "+o:"")+r)}return Mn&&(r=T(n._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),n._prev&&J(n._prev,t,e)),t}function Q(n,t){var e=t?t._numPrev+1:0;e<Qn&&(n._prev=t,n._numPrev=e)}function Y(){$()&&X()}function $(){var n=nt;return nt=!1,tt=!1,n}function X(){var n,t,e;do for(;ct.length>0;)for(n=ct,ct=[],e=n.length,t=0;t<e;++t){var r=n[t];r[0].apply(null,r[1])}while(ct.length>0);nt=!0,tt=!0}function Z(){var n=et;et=[],n.forEach(function(n){n._PSD.onunhandled.call(null,n._value,n)});for(var t=ft.slice(0),e=t.length;e;)t[--e]()}function nn(n){function t(){n(),ft.splice(ft.indexOf(t),1)}ft.push(t),++st,Zn(function(){0===--st&&Z()},[])}function tn(n){et.some(function(t){return t._value===n._value})||et.push(n)}function en(n){for(var t=et.length;t;)if(et[--t]._value===n._value)return void et.splice(t,1)}function rn(n){console.warn("Unhandled rejection: "+(n.stack||n))}function on(n){return new U(Jn,!1,n)}function un(n,t){var e=at;return function(){var r=$(),i=at;try{return i!==e&&(at=e),n.apply(this,arguments)}catch(n){t&&t(n)}finally{i!==e&&(at=i),r&&X()}}}function an(n,t,e,r){var i=at,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=cn(o,n,t,e,r);return 0===o.ref&&o.finalize(),u}function cn(n,t,e,r,i){var o=at;try{return n!==o&&(at=n),t(e,r,i)}finally{n!==o&&(at=o)}}function sn(n,t){var e;try{e=t.onuncatched(n)}catch(n){}if(e!==!1)try{U.on.error.fire(n,t)}catch(n){}}function fn(n,t){var e=U.reject(n);return t?e.uncaught(t):e}function ln(o,f){function y(){rt.on("versionchange",function(n){n.newVersion>0?console.warn("Another connection wants to upgrade database '"+rt.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+rt.name+"'. Closing db now to resume the delete request."),rt.close()}),rt.on("blocked",function(n){!n.newVersion||n.newVersion<n.oldVersion?console.warn("Dexie.delete('"+rt.name+"') was blocked"):console.warn("Upgrade '"+rt.name+"' blocked by other connection holding version "+n.oldVersion/10)})}function A(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function C(n,t,e){var r=rt._createTransaction(et,Qn,Gn);r.create(t),r._completion.catch(e);var i=r._reject.bind(r);an(function(){at.trans=r,0===n?(An(Gn).forEach(function(n){B(t,n,Gn[n].primKey,Gn[n].indexes)}),U.follow(function(){return rt.on.populate.fire(r)}).catch(i)):P(n,r,t).catch(i)})}function P(n,t,e){function r(){return i.length?U.resolve(i.shift()(t.idbtrans)).then(r):U.resolve()}var i=[],o=Jn.filter(function(t){return t._cfg.version===n})[0];if(!o)throw new Wn.Upgrade("Dexie specification of currently installed DB version is missing");Gn=rt._dbSchema=o._cfg.dbschema;var u=!1,a=Jn.filter(function(t){return t._cfg.version>n});return a.forEach(function(n){i.push(function(){var r=Gn,i=n._cfg.dbschema;Tn(r,e),Tn(i,e),Gn=rt._dbSchema=i;var o=T(r,i);if(o.add.forEach(function(n){B(e,n[0],n[1].primKey,n[1].indexes)}),o.change.forEach(function(n){if(n.recreate)throw new Wn.Upgrade("Not yet support for changing primary key");var t=e.objectStore(n.name);n.add.forEach(function(n){z(t,n)}),n.change.forEach(function(n){t.deleteIndex(n.name),z(t,n)}),n.del.forEach(function(n){t.deleteIndex(n)})}),n._cfg.contentUpgrade)return u=!0,U.follow(function(){n._cfg.contentUpgrade(t)})}),i.push(function(t){if(!u||!gt){var e=n._cfg.dbschema;q(e,t)}})}),r().then(function(){M(Gn,e)})}function T(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 B(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){z(i,n)}),i}function M(n,t){An(n).forEach(function(e){t.db.objectStoreNames.contains(e)||B(t,e,n[e].primKey,n[e].indexes)})}function q(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 z(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function V(n){return rt.on.error.fire(n)}function L(n,t,e){if(nt||at.letThrough){var r=rt._createTransaction(n,t,Gn);return r._promise(n,function(n,t){an(function(){at.trans=r,e(n,t,r)})}).then(function(n){return r._completion.then(function(){return n})})}if(!Zn){if(!Vn)return fn(new Wn.DatabaseClosed,V);rt.open().catch(k)}return it.then(function(){return L(n,t,e)})}function W(n,t,e){this.name=n,this.schema=t,this.hook=Yn[n]?Yn[n].hook:R(null,{creating:[O,k],reading:[E,x],updating:[j,k],deleting:[I,k]}),this._collClass=e||$}function H(n,t,e){W.call(this,n,t,e||Z)}function G(n,t,e){return(e?mn:yn)(function(e){n.push(e),t&&t()})}function J(n,t,e,r,i){return new U(function(o,u){var a=e.length,c=a-1;if(0===a)return o();if(r){var s,f=mn(u),l=vn(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=vn(o):h.onsuccess=l}},function(n){throw s.onerror&&s.onerror(n),n})}else for(var h=0;h<a;++h){var p=n.delete(e[h]);p.onerror=un(yn(u)),h===c&&(p.onsuccess=un(function(){return o()}))}}).uncaught(V)}function Q(n,t,e,r){var i=this;this.db=rt,this.mode=n,this.storeNames=t,this.idbtrans=null,this.on=R(this,"complete","error","abort"),this.parent=r||null,this.active=!0,this._tables=null,this._reculock=0,this._blockedFuncs=[],this._psd=null,this._dbschema=e,this._resolve=null,this._reject=null,this._completion=new U(function(n,t){i._resolve=n,i._reject=t}).uncaught(V),this._completion.then(function(){i.on.complete.fire()},function(n){return i.on.error.fire(n),i.parent?i.parent._reject(n):i.active&&i.idbtrans&&i.idbtrans.abort(),i.active=!1,fn(n)})}function Y(n,t,e){this._ctx={table:n,index:":id"===t?null:t,collClass:n._collClass,or:e}}function $(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 X(n,t){return!(n.filter||n.algorithm||n.or)&&(t?n.justLimit:!n.replayFilter)}function Z(){$.apply(this,arguments)}function nn(n,t){return n._cfg.version-t._cfg.version}function tn(n,t,e,r){t.forEach(function(t){var i=rt._tableFactory(e,r[t]);n.forEach(function(n){t in n||(n[t]=i)})})}function en(n){n.forEach(function(n){for(var t in n)n[t]instanceof W&&delete n[t]})}function rn(n,t,e,r,i,o){var u=o?function(n,t,r){return e(o(n),t,r)}:e,a=un(u,i);n.onerror||(n.onerror=yn(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 on(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 wn(e,r||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),On(r),/\./.test(n)))}),t}function cn(n,t){return Ln.cmp(n,t)}function sn(n,t){return cn(n,t)<0?n:t}function hn(n,t){return cn(n,t)>0?n:t}function In(n,t){return Ln.cmp(n,t)}function jn(n,t){return Ln.cmp(t,n)}function Cn(n,t){return n<t?-1:n===t?0:1}function Dn(n,t){return n>t?-1:n===t?0:1}function Pn(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}function Sn(){if(rt.verno=$n.version/10,rt._dbSchema=Gn={},Qn=u($n.objectStoreNames,0),0!==Qn.length){var n=$n.transaction(xn(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 wn(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 wn(c.name,r,!!c.unique,!!c.multiEntry,!1,r&&"string"!=typeof r,i);u.push(s)}Gn[t]=new kn(t,o,u,{})}),tn([Yn,Q.prototype],An(Gn),et,Gn)}}function Tn(n,t){for(var e=t.db.objectStoreNames,r=0;r<e.length;++r){var i=e[r],o=t.objectStore(i);qn="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 Bn(n){rt.on("blocked").fire(n),yt.filter(function(n){return n.name===rt.name&&n!==rt&&!n._vcFired}).map(function(t){return t.on("versionchange").fire(n)})}var Nn,Fn,qn,Rn=ln.dependencies,Un=n({addons:ln.addons,autoOpen:!0,indexedDB:Rn.indexedDB,IDBKeyRange:Rn.IDBKeyRange},f),zn=Un.addons,Vn=Un.autoOpen,Ln=Un.indexedDB,Hn=Un.IDBKeyRange,Gn=this._dbSchema={},Jn=[],Qn=[],Yn={},$n=null,Xn=null,Zn=!1,nt=!1,tt="readonly",et="readwrite",rt=this,it=new U(function(n){Nn=n}),ot=new U(function(n,t){Fn=t}),ut=!0,ct=!!En(Ln);this.version=function(n){if($n||Zn)throw new Wn.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var t=Jn.filter(function(t){return t._cfg.version===n})[0];return t?t:(t=new A(n),Jn.push(t),Jn.sort(nn),t)},n(A.prototype,{stores:function(t){this._cfg.storesSource=this._cfg.storesSource?n(this._cfg.storesSource,t):t;var e={};Jn.forEach(function(t){n(e,t._cfg.storesSource)});var r=this._cfg.dbschema={};return this._parseStoresSpec(e,r),Gn=rt._dbSchema=r,en([Yn,rt,Q.prototype]),tn([Yn,rt,Q.prototype,this._cfg.tables],An(r),et,r),Qn=An(r),this},upgrade:function(n){var t=this;return wt(function(){n(rt._createTransaction(et,An(t._cfg.dbschema),t._cfg.dbschema))}),this._cfg.contentUpgrade=n,this},_parseStoresSpec:function(n,t){An(n).forEach(function(e){if(null!==n[e]){var r={},i=on(n[e]),o=i.shift();if(o.multi)throw new Wn.Schema("Primary key cannot be multi-valued");o.keyPath&&v(r,o.keyPath,o.auto?0:o.keyPath),i.forEach(function(n){if(n.auto)throw new Wn.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new Wn.Schema("Index must have a name and cannot be an empty string");v(r,n.keyPath,n.compound?n.keyPath.map(function(){return""}):"")}),t[e]=new kn(e,o,i,r)}})}}),this._allTables=Yn,this._tableFactory=function(n,t){return n===tt?new W(t.name,t,$):new H(t.name,t)},this._createTransaction=function(n,t,e,r){return new Q(n,t,e,r)},this._whenReady=function(n){return new U(kt||nt||at.letThrough?n:function(t,e){if(!Zn){if(!Vn)return void e(new Wn.DatabaseClosed);rt.open().catch(k)}it.then(function(){n(t,e)})}).uncaught(V)},this.verno=0,this.open=function(){if(Zn||$n)return it.then(function(){return Xn?fn(Xn,V):rt});Mn&&(ot._stackHolder=S()),Zn=!0,Xn=null,nt=!1;var n=Nn,t=null;return U.race([ot,new U(function(n,e){if(c(function(){return n()}),Jn.length>0&&(ut=!1),!Ln)throw new Wn.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=ut?Ln.open(o):Ln.open(o,Math.round(10*rt.verno));if(!r)throw new Wn.MissingAPI("IndexedDB API not available");r.onerror=un(yn(e)),r.onblocked=un(Bn),r.onupgradeneeded=un(function(n){if(t=r.transaction,ut&&!rt._allowEmptyDB){r.onerror=gn,t.abort(),r.result.close();var i=Ln.deleteDatabase(o);i.onsuccess=i.onerror=un(function(){e(new Wn.NoSuchDatabase("Database "+o+" doesnt exist"))})}else{t.onerror=un(yn(e));var u=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;C(u/10,t,e,r)}},e),r.onsuccess=un(function(){if(t=null,$n=r.result,yt.push(rt),ut)Sn();else if($n.objectStoreNames.length>0)try{Tn(Gn,$n.transaction(xn($n.objectStoreNames),tt))}catch(n){}$n.onversionchange=un(function(n){rt._vcFired=!0,rt.on("versionchange").fire(n)}),ct||bn(function(n){if(n.indexOf(o)===-1)return n.push(o)}),n()},e)})]).then(function(){return ln.vip(rt.on.ready.fire)}).then(function(){return Zn=!1,rt}).catch(function(n){try{t&&t.abort()}catch(n){}return Zn=!1,rt.close(),Xn=n,fn(Xn,V)}).finally(function(){nt=!0,n()})},this.close=function(){var n=yt.indexOf(rt);if(n>=0&&yt.splice(n,1),$n){try{$n.close()}catch(n){}$n=null}Vn=!1,Xn=new Wn.DatabaseClosed,Zn&&Fn(Xn),it=new U(function(n){Nn=n}),ot=new U(function(n,t){Fn=t})},this.delete=function(){var n=arguments.length>0;return new U(function(t,e){function r(){rt.close();var n=Ln.deleteDatabase(o);n.onsuccess=un(function(){ct||bn(function(n){var t=n.indexOf(o);if(t>=0)return n.splice(t,1)}),t()}),n.onerror=un(yn(e)),n.onblocked=Bn}if(n)throw new Wn.InvalidArgument("Arguments not allowed in db.delete()");Zn?it.then(r):r()}).uncaught(V)},this.backendDB=function(){return $n},this.isOpen=function(){return null!==$n},this.hasFailed=function(){return null!==Xn},this.dynamicallyOpened=function(){return ut},this.name=o,r(this,"tables",{get:function(){return An(Yn).map(function(n){return Yn[n]})}}),this.on=R(this,"error","populate","blocked","versionchange",{ready:[D,k]}),this.on.ready.subscribe=a(this.on.ready.subscribe,function(n){return function(t,e){ln.vip(function(){nt?(U.resolve().then(t),e&&n(t)):(n(t),e||n(function n(){rt.on.ready.unsubscribe(t),rt.on.ready.unsubscribe(n)}))})}}),wt(function(){rt.on("populate").fire(rt._createTransaction(et,Qn,Gn)),rt.on("error").fire(new Error)}),this.transaction=function(n,e,r){function i(e){var i=at;e(U.resolve().then(function(){return an(function(){at.transless=at.transless||i;var e=rt._createTransaction(n,f,Gn,c);at.trans=e,c?e.idbtrans=c.idbtrans:e.create();var o=f.map(function(n){return Yn[n]});o.push(e);var u;return U.follow(function(){if(u=r.apply(e,o))if("function"==typeof u.next&&"function"==typeof u.throw)u=_n(u);else if("function"==typeof u.then&&!t(u,"_PSD"))throw new Wn.IncompatiblePromise("Incompatible Promise returned from transaction scope (read more at http://tinyurl.com/znyqjqc). Transaction scope: "+r.toString())}).uncaught(V).then(function(){return c&&e._resolve(),e._completion}).then(function(){return u}).catch(function(n){return e._reject(n),fn(n)})})}))}var o=arguments.length;if(o<2)throw new Wn.InvalidArgument("Too few arguments");for(var u=new Array(o-1);--o;)u[o-1]=arguments[o];r=u.pop();var a=w(u),c=at.trans;c&&c.db===rt&&n.indexOf("!")===-1||(c=null);var s=n.indexOf("?")!==-1;n=n.replace("!","").replace("?","");try{var f=a.map(function(n){var t=n instanceof W?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==tt)n=tt;else{if("rw"!=n&&n!=et)throw new Wn.InvalidArgument("Invalid transaction mode: "+n);n=et}if(c){if(c.mode===tt&&n===et){if(!s)throw new Wn.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");c=null}c&&f.forEach(function(n){if(c&&c.storeNames.indexOf(n)===-1){if(!s)throw new Wn.SubTransaction("Table "+n+" not included in parent transaction.");c=null}})}}catch(n){return c?c._promise(null,function(t,e){e(n)}):fn(n,V)}return c?c._promise(n,i,"lock"):rt._whenReady(i)},this.table=function(n){if(kt&&ut)return new H(n);if(!t(Yn,n))throw new Wn.InvalidTable("Table "+n+" does not exist");return Yn[n]},e(W.prototype,{_trans:function(n,t,e){var r=at.trans;return r&&r.db===rt?r._promise(n,t,e):L(n,[this.name],t)},_idbstore:function(n,t,e){function r(n,e,r){t(n,e,r.idbtrans.objectStore(o),r)}if(kt)return new U(t);var i=at.trans,o=this.name;return i&&i.db===rt?i._promise(n,r,e):L(n,[this.name],r)},get:function(n,t){var e=this;return this._idbstore(tt,function(t,r,i){kt&&t(e.schema.instanceTemplate);var o=i.get(n);o.onerror=yn(r),o.onsuccess=function(){t(e.hook.reading.fire(o.result))}}).then(t)},where:function(n){return new Y(this,n)},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 this._collClass(new Y(this,n))},toCollection:function(){return new this._collClass(new Y(this))},mapToClass:function(n,e){this.schema.mappedClass=n;var r=Object.create(n.prototype);e&&dn(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)t(e,i)&&(r[i]=e[i]);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(ln.defineClass(n),n)}}),i(H).from(W).extend({bulkDelete:function(n){return this.hook.deleting.fire===k?this._idbstore(et,function(t,e,r,i){t(J(r,i,n,!1,k))}):this.where(":id").anyOf(n).delete().then(function(){})},bulkPut:function(n,t){var e=this;return this._idbstore(et,function(r,i,o){if(!o.keyPath&&!e.schema.primKey.auto&&!t)throw new Wn.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new Wn.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Wn.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 F(e.name+".bulkPut(): "+s.length+" of "+f+" operations failed",s))},s=[],f=n.length,h=e;if(e.hook.creating.fire===k&&e.hook.updating.fire===k){a=G(s);for(var d=0,v=n.length;d<v;++d)u=t?o.put(n[d],t[d]):o.put(n[d]),u.onerror=a;u.onerror=G(s,c),u.onsuccess=pn(c)}else{var y=t||o.keyPath&&n.map(function(n){return p(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(N,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(F,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(et,function(i,o,u,a){function c(n){0===h.length?i(n):o(new F(e.name+".bulkAdd(): "+h.length+" of "+y+" operations failed",h))}if(!u.keyPath&&!e.schema.primKey.auto&&!t)throw new Wn.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(u.keyPath&&t)throw new Wn.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Wn.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!==k){var m,b=u.keyPath;f=G(h,null,!0),l=vn(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:b?p(c,b):void 0,d=r.call(m,h,c,a);null==h&&null!=d&&(b?(c=g(c),v(c,b,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=G(h,c,!0),s.onsuccess=vn(c)}else{f=G(h);for(var _=0,w=n.length;_<w;++_)s=t?u.add(n[_],t[_]):u.add(n[_]),s.onerror=f;s.onerror=G(h,c),s.onsuccess=pn(c)}})},add:function(n,t){var e=this.hook.creating.fire;return this._idbstore(et,function(r,i,o,u){var a={onsuccess:null,onerror:null};if(e!==k){var c=null!=t?t:o.keyPath?p(n,o.keyPath):void 0,s=e.call(a,c,n,u);null==c&&null!=s&&(o.keyPath?v(n,o.keyPath,s):t=s)}try{var f=null!=t?o.add(n,t):o.add(n);f._hookCtx=a,f.onerror=mn(i),f.onsuccess=vn(function(t){var e=o.keyPath;e&&v(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;return r!==k||i!==k?this._trans(et,function(r,i,o){var u=void 0!==t?t:e.schema.primKey.keyPath&&p(n,e.schema.primKey.keyPath);null==u?e.add(n).then(r,i):(o._lock(),n=g(n),e.where(":id").equals(u).modify(function(){this.value=n}).then(function(r){return 0===r?e.add(n,t):u}).finally(function(){o._unlock()}).then(r,i))}):this._idbstore(et,function(e,r,i){var o=void 0!==t?i.put(n,t):i.put(n);o.onerror=yn(r),o.onsuccess=function(t){var r=i.keyPath;r&&v(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(et,function(t,e,r){var i=r.delete(n);i.onerror=yn(e),i.onsuccess=function(){t(i.result)}})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(et,function(n,t,e){var r=e.clear();r.onerror=yn(t),r.onsuccess=function(){n(r.result)}})},update:function(n,t){if("object"!=typeof t||On(t))throw new Wn.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||On(n))return this.where(":id").equals(n).modify(t);An(t).forEach(function(e){v(n,e,t[e])});var e=p(n,this.schema.primKey.keyPath);return void 0===e?fn(new Wn.InvalidArgument("Given object does not contain its primary key"),V):this.where(":id").equals(e).modify(t)}}),e(Q.prototype,{_lock:function(){return s(!at.global),++this._reculock,1!==this._reculock||at.global||(at.lockOwnerFor=this),this},_unlock:function(){if(s(!at.global),0===--this._reculock)for(at.global||(at.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{n()}catch(n){}}return this},_locked:function(){return this._reculock&&at.lockOwnerFor!==this},create:function(n){var t=this;if(s(!this.idbtrans),!n&&!$n)switch(Xn&&Xn.name){case"DatabaseClosedError":throw new Wn.DatabaseClosed(Xn);case"MissingAPIError":throw new Wn.MissingAPI(Xn.message,Xn);default:throw new Wn.OpenFailed(Xn)}if(!this.active)throw new Wn.TransactionInactive;return s(null===this._completion._state),n=this.idbtrans=n||$n.transaction(xn(this.storeNames),this.mode),n.onerror=un(function(e){gn(e),t._reject(n.error)}),n.onabort=un(function(n){gn(n),t.active&&t._reject(new Wn.Abort),t.active=!1,t.on("abort").fire(n)}),n.oncomplete=un(function(){t.active=!1,t._resolve()}),this},_promise:function(n,t,e){var r=this;return an(function(){var i;return r._locked()?i=new U(function(i,o){r._blockedFuncs.push(function(){r._promise(n,t,e).then(i,o)})}):(i=r.active?new U(function(i,o){if(n===et&&r.mode!==et)throw new Wn.ReadOnly("Transaction is readonly");!r.idbtrans&&n&&r.create(),e&&r._lock(),t(i,o,r)}):fn(new Wn.TransactionInactive),r.active&&e&&i.finally(function(){r._unlock()})),i._lib=!0,i.uncaught(V)})},abort:function(){this.active&&this._reject(new Wn.Abort),this.active=!1},tables:{get:K("Transaction.tables",function(){return l(this.storeNames,function(n){return[n,Yn[n]]})},"Use db.tables()")},complete:K("Transaction.complete()",function(n){return this.on("complete",n)}),error:K("Transaction.error()",function(n){return this.on("error",n)}),table:K("Transaction.table()",function(n){if(this.storeNames.indexOf(n)===-1)throw new Wn.InvalidTable("Table "+n+" not in transaction"); | ||
return Yn[n]})}),e(Y.prototype,function(){function n(n,t,e){var r=n instanceof Y?new n._ctx.collClass(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new n._ctx.collClass(n,function(){return Hn.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?Cn:Dn;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}),p=n,v="next"===n?"":a}var s,f,l,h,d,p,v,y=u.length;if(!u.every(function(n){return"string"==typeof n}))return n(t,vt);c("next");var m=new t._ctx.collClass(t,function(){return Hn.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,p);null===s&&null===a?g=c+1:(null===a||l(a,s)>0)&&(a=s)}return t(null!==a?function(){n.continue(a+v)}:e),!1}),m}return{between:function(e,r,i,o){i=i!==!1,o=o===!0;try{return cn(e,r)>0||0===cn(e,r)&&(i||o)&&(!i||!o)?t(this):new this._ctx.collClass(this,function(){return Hn.bound(e,r,!i,!o)})}catch(t){return n(this,pt)}},equals:function(n){return new this._ctx.collClass(this,function(){return Hn.only(n)})},above:function(n){return new this._ctx.collClass(this,function(){return Hn.lowerBound(n,!0)})},aboveOrEqual:function(n){return new this._ctx.collClass(this,function(){return Hn.lowerBound(n)})},below:function(n){return new this._ctx.collClass(this,function(){return Hn.upperBound(n,!0)})},belowOrEqual:function(n){return new this._ctx.collClass(this,function(){return Hn.upperBound(n)})},startsWith:function(t){return"string"!=typeof t?n(this,vt):this.between(t,t+ht,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):o(this,function(n,t){return 0===n.indexOf(t[0])},[n],ht)},equalsIgnoreCase:function(n){return o(this,function(n,t){return n===t[0]},[n],"")},anyOfIgnoreCase:function(){var n=_.apply(Kn,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.indexOf(n)!==-1},n,"")},startsWithAnyOfIgnoreCase:function(){var n=_.apply(Kn,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.some(function(t){return 0===n.indexOf(t)})},n,ht)},anyOf:function(){var e=_.apply(Kn,arguments),r=In;try{e.sort(r)}catch(t){return n(this,pt)}if(0===e.length)return t(this);var i=new this._ctx.collClass(this,function(){return Hn.bound(e[0],e[e.length-1])});i._ondirectionchange=function(n){r="next"===n?In:jn,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([[-(1/0),n],[n,dt]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=_.apply(Kn,arguments);if(0===t.length)return new this._ctx.collClass(this);try{t.sort(In)}catch(t){return n(this,pt)}var e=t.reduce(function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[-(1/0),t]]},null);return e.push([t[t.length-1],dt]),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(cn(t[0],i[1])<0&&cn(t[1],i[0])>0){i[0]=sn(i[0],t[0]),i[1]=hn(i[1],t[1]);break}}return e===r&&n.push(t),n}function o(n,t){return l(n[0],t[0])}function u(n){return!d(n)&&!p(n)}var a=this._ctx;if(0===e.length)return t(this);if(!e.every(function(n){return void 0!==n[0]&&void 0!==n[1]&&In(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",Wn.InvalidArgument);var c,s=!r||r.includeLowers!==!1,f=r&&r.includeUppers===!0,l=In;try{c=e.reduce(i,[]),c.sort(o)}catch(t){return n(this,pt)}var h=0,d=f?function(n){return In(n,c[h][1])>0}:function(n){return In(n,c[h][1])>=0},p=s?function(n){return jn(n,c[h][0])>0}:function(n){return jn(n,c[h][0])>=0},v=d,y=new a.collClass(this,function(){return Hn.bound(c[0][0],c[c.length-1][1],!s,!f)});return y._ondirectionchange=function(n){"next"===n?(v=d,l=In):(v=p,l=jn),c.sort(o)},y._addAlgorithm(function(n,t,e){for(var r=n.key;v(r);)if(++h,h===c.length)return t(e),!1;return!!u(r)||0!==cn(r,c[h][1])&&0!==cn(r,c[h][0])&&(t(function(){l===In?n.continue(c[h][0]):n.continue(c[h][1])}),!1)}),y},startsWithAnyOf:function(){var e=_.apply(Kn,arguments);return e.every(function(n){return"string"==typeof n})?0===e.length?t(this):this.inAnyRange(e.map(function(n){return[n,n+ht]})):n(this,"startsWithAnyOf() only works with strings")}}}),e($.prototype,function(){function e(n,t){n.filter=Pn(n.filter,t)}function r(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return Pn(r(),t())}:t,n.justLimit=e&&!r}function i(n,t){n.isMatch=Pn(n.isMatch,t)}function o(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new Wn.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?Pn(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),rn(u(n,o),n.algorithm,s,c,i,!n.keysOnly&&n.valueMapper)}():rn(u(n,o),Pn(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,function(n,t){t(e.error)}):e.table._idbstore(tt,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,function(n,e){e(t.error)}):t.table._idbstore(et,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=Pn(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(kt){var e=c(t),r=t.table.schema.primKey.keyPath,i=p(e,t.index?t.table.schema.idxByName[t.index].keyPath:r),o=p(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(kt)return U.resolve(0).then(n);var t=this._ctx;if(X(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=yn(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(kt&&n([c(t)]),qn&&"next"===t.dir&&X(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=yn(e),s.onsuccess=i===x?pn(n):un(pn(function(t){n(t.map(i))}))}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,X(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 kt&&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 kt&&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 Y(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(qn&&"next"===t.dir&&X(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=yn(e),u.onsuccess=pn(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}}}),i(Z).from($).extend({modify:function(e){var r=this,i=this._ctx,o=i.table.hook,u=o.updating.fire,a=o.deleting.fire;return kt&&"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 I.push(n),j.push(i.primKey),h(),!0}C=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");++E,d(function(){var n=o?e.delete():e.update(i.value);n._hookCtx=i,n.onerror=mn(r),n.onsuccess=vn(function(){++A,h()})},r)}else i.onsuccess&&i.onsuccess(i.value)}function l(n){return n&&(I.push(n),j.push(C)),o(new N("Error modifying one or more objects",I,A,j))}function h(){O&&A+I.length===E&&(I.length>0?l():i(A))}var y;if("function"==typeof e)y=u===k&&a===k?e:function(n){var r=g(n);if(e.call(this,n,this)===!1)return!1;if(t(this,"value")){var i=b(r,this.value),o=u.call(this,i,this.primKey,r,s);o&&(n=this.value,An(o).forEach(function(t){v(n,t,o[t])}))}else a.call(this,this.primKey,n,s)};else if(u===k){var _=An(e),w=_.length;y=function(n){for(var t=!1,r=0;r<w;++r){var i=_[r],o=e[i];p(n,i)!==o&&(v(n,i,o),t=!0)}return t}}else{var x=e;e=m(x),y=function(t){var r=!1,i=u.call(this,e,this.primKey,g(t),s);return i&&n(e,i),An(e).forEach(function(n){var i=e[n];p(t,n)!==i&&(v(t,n,i),r=!0)}),i&&(e=m(x)),r}}var E=0,A=0,O=!1,I=[],j=[],C=null;r.clone().raw()._iterate(f,function(){O=!0,h()},l,c)})},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==k;if(!i&&X(t)&&(t.isPrimKey&&!bt||!e))return this._write(function(n,t,r){var i=yn(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 In(n[0],t[0])}):l.sort(In),J(a,c,l,i,r)}).then(function(){var n=l.length;return s+=n,l=[],n<o?s:h()})};e(h())})}}),n(this,{Collection:$,Table:W,Transaction:Q,Version:A,WhereClause:Y,WriteableCollection:Z,WriteableTable:H}),y(),zn.forEach(function(n){n(rt)})}function hn(n){if("function"==typeof n)return new n;if(On(n))return[hn(n[0])];if(n&&"object"==typeof n){var t={};return dn(t,n),t}return n}function dn(n,t){return An(t).forEach(function(e){var r=hn(t[e]);n[e]=r}),n}function pn(n){return function(t){n(t.target.result)}}function vn(n){return un(function(t){var e=t.target,r=e.result,i=e._hookCtx,o=i&&i.onsuccess;o&&o(r),n&&n(r)},n)}function yn(n){return function(t){return gn(t),n(t.target.error),!1}}function mn(n){return un(function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),gn(t),n(r),!1})}function gn(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function bn(n){var t,e=ln.dependencies.localStorage;if(!e)return n([]);try{t=JSON.parse(e.getItem("Dexie.DatabaseNames")||"[]")}catch(n){t=[]}n(t)&&e.setItem("Dexie.DatabaseNames",JSON.stringify(t))}function _n(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):On(r)?U.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 wn(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 kn(n,t,e,r){this.name=n,this.primKey=t||new wn,this.indexes=e||[new wn],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=l(e,function(n){return[n.name,n]})}function xn(n){return 1===n.length?n[0]:n}function En(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}var An=Object.keys,On=Array.isArray,In="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,jn=Object.getPrototypeOf,Cn={}.hasOwnProperty,Dn=Object.getOwnPropertyDescriptor,Pn=[].slice,Sn="undefined"!=typeof Symbol&&Symbol.iterator,Tn=Sn?function(n){var t;return null!=n&&(t=n[Sn])&&t.apply(n)}:function(){return null},Kn={},Bn=[].concat,Mn="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),Nn=function(){return!0},Fn=!new Error("").stack,qn=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","IncompatiblePromise"],Rn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Un=qn.concat(Rn),zn={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};i(B).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+T(this._e,2))}},toString:function(){return this.name+": "+this.message}}),i(N).from(B),i(F).from(B);var Vn=Un.reduce(function(n,t){return n[t]=t+"Error",n},{}),Ln=B,Wn=Un.reduce(function(n,t){function e(n,e){this._e=S(),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=zn[t]||r,this.inner=null)}var r=t+"Error";return i(e).from(Ln),n[t]=e,n},{});Wn.Syntax=SyntaxError,Wn.Type=TypeError,Wn.Range=RangeError;var Hn=Rn.reduce(function(n,t){return n[t+"Error"]=Wn[t],n},{}),Gn=Un.reduce(function(n,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(n[t+"Error"]=Wn[t]),n},{});Gn.ModifyError=N,Gn.DexieError=B,Gn.BulkError=F;var Jn={},Qn=100,Yn=20,$n=!1,Xn=In.setImmediate?setImmediate.bind(null,Y):In.MutationObserver?function(){var n=document.createElement("div");new MutationObserver(function(){Y(),n=null}).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(Y,0)},Zn=function(n,t){ct.push([n,t]),tt&&(Xn(),tt=!1)},nt=!0,tt=!0,et=[],rt=[],it=null,ot=x,ut={global:!0,ref:0,unhandleds:[],onunhandled:sn,finalize:function(){this.unhandleds.forEach(function(n){try{sn(n[0],n[1])}catch(n){}})}},at=ut,ct=[],st=0,ft=[];e(U.prototype,{then:function(n,t){var e=this,r=new U(function(r,i){H(e,new z(n,t,r,i))});return Mn&&(!this._prev||null===this._state)&&Q(r,this),r},_then:function(n,t){H(this,new z(null,null,n,t))},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):on(n)}):this.then(null,function(n){return n&&n.name===t?e(n):on(n)})},finally:function(n){return this.then(function(t){return n(),t},function(t){return n(),on(t)})},uncaught:function(n){var t=this;return this.onuncatched=C(this.onuncatched,n),this._state===!1&&et.indexOf(this)===-1&&et.some(function(n,e,r){return n._value===t._value&&(r[e]=t)}),this},stack:{get:function(){if(this._stack)return this._stack;try{$n=!0;var n=J(this,[],Yn),t=n.join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{$n=!1}}}}),e(U,{all:function(){var n=_.apply(null,arguments);return new U(function(t,e){0===n.length&&t([]);var r=n.length;n.forEach(function(i,o){return U.resolve(i).then(function(e){n[o]=e,--r||t(n)},e)})})},resolve:function(n){return n instanceof U?n:n&&"function"==typeof n.then?new U(function(t,e){n.then(t,e)}):new U(Jn,!0,n)},reject:on,race:function(){var n=_.apply(null,arguments);return new U(function(t,e){n.map(function(n){return U.resolve(n).then(t,e)})})},PSD:{get:function(){return at},set:function(n){return at=n}},newPSD:an,usePSD:cn,scheduler:{get:function(){return Zn},set:function(n){Zn=n}},rejectionMapper:{get:function(){return ot},set:function(n){ot=n}},follow:function(n){return new U(function(t,e){return an(function(t,e){var r=at;r.unhandleds=[],r.onunhandled=e,r.finalize=A(function(){var n=this;nn(function(){0===n.unhandleds.length?t():e(n.unhandleds[0])})},r.finalize),n()},t,e)})},on:R(null,{error:[C,rn]})}),c(function(){Zn=function(n,t){setTimeout(function(){n.apply(null,t)},0)}});var lt="1.5.0-rc",ht=String.fromCharCode(65535),dt=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return ht}}(),pt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",vt="String expected.",yt=[],mt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),gt=mt,bt=mt,_t=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};P(Mn,_t);var wt=function(){},kt=!1,xt=In.idbModules&&In.idbModules.shimIndexedDB?In.idbModules:{};return e(ln,Gn),e(ln,{delete:function(n){var t=new ln(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new ln(n).open().then(function(n){return n.close(),!0}).catch(ln.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(n){return new U(function(n,t){var e=En(indexedDB);if(e){var r=e();r.onsuccess=function(t){n(u(t.target.result,0))},r.onerror=yn(t)}else bn(function(t){return n(t),!1})}).then(n)},defineClass:function(t){function e(e){e?n(this,e):kt&&dn(this,t)}return e},applyStructure:dn,ignoreTransaction:function(n){return at.trans?cn(at.transless,n):n()},vip:function(n){return an(function(){return at.letThrough=!0,n()})},async:function(n){return function(){try{var t=_n(n.apply(this,arguments));return t&&"function"==typeof t.then?t:U.resolve(t)}catch(n){return fn(n)}}},spawn:function(n,t,e){try{var r=_n(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:U.resolve(r)}catch(n){return fn(n)}},currentTransaction:{get:function(){return at.trans||null}},Promise:U,debug:{get:function(){return Mn},set:function(n){P(n,"dexie"===n?function(){return!0}:_t)}},derive:i,extend:n,props:e,override:a,Events:R,events:{get:K(function(){return R})},getByKeyPath:p,setByKeyPath:v,delByKeyPath:y,shallowClone:m,deepClone:g,getObjectDiff:b,asap:f,maxKey:dt,addons:[],connections:yt,MultiModifyError:Wn.Modify,errnames:Vn,IndexSpec:wn,TableSchema:kn,dependencies:{indexedDB:xt.shimIndexedDB||In.indexedDB||In.mozIndexedDB||In.webkitIndexedDB||In.msIndexedDB,IDBKeyRange:xt.IDBKeyRange||In.IDBKeyRange||In.webkitIDBKeyRange},semVer:lt,version:lt.split(".").map(function(n){return parseInt(n)}).reduce(function(n,t,e){return n+t/Math.pow(10,2*e)}),fakeAutoComplete:wt,default:ln}),d(function(){ln.dependencies.localStorage=null!=("undefined"!=typeof chrome&&null!==chrome?chrome.storage:void 0)?null:In.localStorage}),U.rejectionMapper=q,c(function(){ln.fakeAutoComplete=wt=c,ln.fake=kt=!0}),ln}); | ||
!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:(jn(t).forEach(function(e){n[e]=t[e]}),n)}function t(n,t){return Cn.call(n,t)}function e(n,t){"function"==typeof t&&(t=t(Pn(n))),jn(t).forEach(function(e){r(n,e,t[e])})}function r(e,r,i,o){Object.defineProperty(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=In(n,t);return r||(e=Pn(n))&&o(e,t)}function u(n,t,e){return Dn.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){On.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){if(!n||"object"!=typeof n)return n;var e;if(An(n)){e=[];for(var r=0,i=n.length;r<i;++r)e.push(g(n[r]))}else if(n instanceof Date)e=new Date,e.setTime(n.getTime());else{e=n.constructor?Object.create(n.constructor.prototype):{};for(var o in n)t(n,o)&&(e[o]=g(n[o]))}return e}function b(n,e,r,i){return r=r||{},i=i||"",jn(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?b(u,a,r,i+o+"."):u!==a&&(r[i+o]=e[o])}else r[i+o]=void 0}),jn(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(An(n))return n.slice();if(this===Kn&&"string"==typeof n)return[n];if(i=Tn(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 w(n){return Bn.apply([],n)}function x(){}function k(n){return n}function E(n,t){return null==n||n===k?t:function(e){return t(n(e))}}function j(n,t){return function(){n.apply(this,arguments),t.apply(this,arguments)}}function A(n,t){return n===x?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?j(r,this.onsuccess):r),i&&(this.onerror=this.onerror?j(i,this.onerror):i),void 0!==o?o:e}}function O(n,t){return n===x?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?j(e,this.onsuccess):e),r&&(this.onerror=this.onerror?j(r,this.onerror):r)}}function P(t,e){return t===x?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?j(o,this.onsuccess):o),u&&(this.onerror=this.onerror?j(u,this.onerror):u),void 0===i?void 0===a?void 0:a:n(i,a)}}function C(n,t){return n===x?t:function(){return t.apply(this,arguments)!==!1&&n.apply(this,arguments)}}function I(n,t){return n===x?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 D(n,t){Mn=n,Nn=t}function S(){if(Fn)try{throw S.arguments,new Error}catch(n){return n}return new Error}function T(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(Nn).map(function(n){return"\n"+n}).join("")):""}function K(n,t){return function(){return console.warn(n+" is deprecated. See https://github.com/dfahlander/Dexie.js/wiki/Deprecations. "+T(S(),1)),t.apply(this,arguments)}}function B(n,t){this._e=S(),this.name=n,this.message=t}function M(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 N(n,t,e,r){this._e=S(),this.failures=t,this.failedKeys=r,this.successCount=e}function F(n,t){this._e=S(),this.name="BulkError",this.failures=t,this.message=M(n,t)}function q(n,t){if(!n||n instanceof B||n instanceof TypeError||n instanceof SyntaxError||!n.name||!Hn[n.name])return n;var e=new Hn[n.name](t||n.message,n);return"stack"in n&&r(e,"stack",{get:function(){return this.inner.stack}}),e}function R(n){function t(n,t,o){if("object"==typeof n)return e(n);t||(t=C),o||(o=x);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){jn(n).forEach(function(e){var r=n[e];if(An(r))t(e,n[e][0],n[e][1]);else{if("asap"!==r)throw new Wn.InvalidArgument("Invalid event config");var i=t(e,k,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 U(n){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=x,this._lib=!1;var t=this._PSD=at;if(Mn&&(this._stackHolder=S(),this._prev=null,this._numPrev=0,Q(this,it)),"function"!=typeof n){if(n!==Jn)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&L(this,this._value))}this._state=null,this._value=null,++t.ref,V(this,n)}function z(n,t,e,r){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=r,this.psd=at}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&&$();t&&"function"==typeof t.then?V(n,function(n,e){t instanceof U?t._then(n,e):t.then(n,e)}):(n._state=!0,n._value=t,W(n)),e&&X()}},L.bind(null,n))}catch(t){L(n,t)}}function L(n,t){if(rt.push(t),null===n._state){var e=n._lib&&$();t=ot(t),n._state=!1,n._value=t,Mn&&null!==t&&"object"==typeof t&&!t._promise&&d(function(){var e=o(t,"stack");t._promise=n,r(t,"stack",{get:function(){return $n?e&&(e.get?e.get.apply(t):e.value):n.stack}})}),tn(n),W(n),e&&X()}}function W(n){var t=n._listeners;n._listeners=[];for(var e=0,r=t.length;e<r;++e)H(n,t[e]);var i=n._PSD;--i.ref||i.finalize(),0===st&&(++st,Zn(function(){0===--st&&Z()},[]))}function H(n,t){if(null===n._state)return void n._listeners.push(t);var e=n._state?t.onFulfilled:t.onRejected;if(null===e)return(n._state?t.resolve:t.reject)(n._value);var r=t.psd;++r.ref,++st,Zn(G,[e,n,t])}function G(n,t,e){var r=at,i=e.psd;try{i!==r&&(at=i),it=t;var o,u=t._value;t._state?o=n(u):(rt.length&&(rt=[]),o=n(u),rt.indexOf(u)===-1&&en(t)),e.resolve(o)}catch(n){e.reject(n)}finally{i!==r&&(at=r),it=null,0===--st&&Z(),--i.ref||i.finalize()}}function J(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=T(u,0)):(i=u,o=""),t.push(i+(o?": "+o:"")+r)}return Mn&&(r=T(n._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),n._prev&&J(n._prev,t,e)),t}function Q(n,t){var e=t?t._numPrev+1:0;e<Qn&&(n._prev=t,n._numPrev=e)}function Y(){$()&&X()}function $(){var n=nt;return nt=!1,tt=!1,n}function X(){var n,t,e;do for(;ct.length>0;)for(n=ct,ct=[],e=n.length,t=0;t<e;++t){var r=n[t];r[0].apply(null,r[1])}while(ct.length>0);nt=!0,tt=!0}function Z(){var n=et;et=[],n.forEach(function(n){n._PSD.onunhandled.call(null,n._value,n)});for(var t=ft.slice(0),e=t.length;e;)t[--e]()}function nn(n){function t(){n(),ft.splice(ft.indexOf(t),1)}ft.push(t),++st,Zn(function(){0===--st&&Z()},[])}function tn(n){et.some(function(t){return t._value===n._value})||et.push(n)}function en(n){for(var t=et.length;t;)if(et[--t]._value===n._value)return void et.splice(t,1)}function rn(n){console.warn("Unhandled rejection: "+(n.stack||n))}function on(n){return new U(Jn,!1,n)}function un(n,t){var e=at;return function(){var r=$(),i=at;try{return i!==e&&(at=e),n.apply(this,arguments)}catch(n){t&&t(n)}finally{i!==e&&(at=i),r&&X()}}}function an(n,t,e,r){var i=at,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var u=cn(o,n,t,e,r);return 0===o.ref&&o.finalize(),u}function cn(n,t,e,r,i){var o=at;try{return n!==o&&(at=n),t(e,r,i)}finally{n!==o&&(at=o)}}function sn(t,e){var r;try{r=e.onuncatched(t)}catch(n){}if(r!==!1)try{var i,o={promise:e,reason:t};if(On.document&&document.createEvent?(i=document.createEvent("Event"),i.initEvent(ht,!0,!0),n(i,o)):On.CustomEvent&&(i=new CustomEvent(ht,{detail:o}),n(i,o)),i&&On.dispatchEvent&&(dispatchEvent(i),!On.PromiseRejectionEvent&&On.onunhandledrejection))try{On.onunhandledrejection(i)}catch(n){}i.defaultPrevented||U.on.error.fire(t,e)}catch(n){}}function fn(n,t){var e=U.reject(n);return t?e.uncaught(t):e}function ln(o,f){function y(){rt.on("versionchange",function(n){n.newVersion>0?console.warn("Another connection wants to upgrade database '"+rt.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+rt.name+"'. Closing db now to resume the delete request."),rt.close()}),rt.on("blocked",function(n){!n.newVersion||n.newVersion<n.oldVersion?console.warn("Dexie.delete('"+rt.name+"') was blocked"):console.warn("Upgrade '"+rt.name+"' blocked by other connection holding version "+n.oldVersion/10)})}function j(n){this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null},this.stores({})}function C(n,t,e){var r=rt._createTransaction(et,Qn,Gn);r.create(t),r._completion.catch(e);var i=r._reject.bind(r);an(function(){at.trans=r,0===n?(jn(Gn).forEach(function(n){B(t,n,Gn[n].primKey,Gn[n].indexes)}),U.follow(function(){return rt.on.populate.fire(r)}).catch(i)):D(n,r,t).catch(i)})}function D(n,t,e){function r(){return i.length?U.resolve(i.shift()(t.idbtrans)).then(r):U.resolve()}var i=[],o=Jn.filter(function(t){return t._cfg.version===n})[0];if(!o)throw new Wn.Upgrade("Dexie specification of currently installed DB version is missing");Gn=rt._dbSchema=o._cfg.dbschema;var u=!1,a=Jn.filter(function(t){return t._cfg.version>n});return a.forEach(function(n){i.push(function(){var r=Gn,i=n._cfg.dbschema;Tn(r,e),Tn(i,e),Gn=rt._dbSchema=i;var o=T(r,i);if(o.add.forEach(function(n){B(e,n[0],n[1].primKey,n[1].indexes)}),o.change.forEach(function(n){if(n.recreate)throw new Wn.Upgrade("Not yet support for changing primary key");var t=e.objectStore(n.name);n.add.forEach(function(n){z(t,n)}),n.change.forEach(function(n){t.deleteIndex(n.name),z(t,n)}),n.del.forEach(function(n){t.deleteIndex(n)})}),n._cfg.contentUpgrade)return u=!0,U.follow(function(){n._cfg.contentUpgrade(t)})}),i.push(function(t){if(!u||!_t){var e=n._cfg.dbschema;q(e,t)}})}),r().then(function(){M(Gn,e)})}function T(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 B(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){z(i,n)}),i}function M(n,t){jn(n).forEach(function(e){t.db.objectStoreNames.contains(e)||B(t,e,n[e].primKey,n[e].indexes)})}function q(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 z(n,t){n.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function V(n){return rt.on.error.fire(n)}function L(n,t,e){if(nt||at.letThrough){var r=rt._createTransaction(n,t,Gn);return r._promise(n,function(n,t){an(function(){at.trans=r,e(n,t,r)})}).then(function(n){return r._completion.then(function(){return n})})}if(!Zn){if(!Vn)return fn(new Wn.DatabaseClosed,V);rt.open().catch(x)}return it.then(function(){return L(n,t,e)})}function W(n,t,e){this.name=n,this.schema=t,this.hook=Yn[n]?Yn[n].hook:R(null,{creating:[A,x],reading:[E,k],updating:[P,x],deleting:[O,x]}),this._collClass=e||$}function H(n,t,e){W.call(this,n,t,e||Z)}function G(n,t,e){return(e?mn:yn)(function(e){n.push(e),t&&t()})}function J(n,t,e,r,i){return new U(function(o,u){var a=e.length,c=a-1;if(0===a)return o();if(r){var s,f=mn(u),l=pn(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=pn(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=un(yn(u)),h===c&&(v.onsuccess=un(function(){return o()}))}}).uncaught(V)}function Q(n,t,e,r){var i=this;this.db=rt,this.mode=n,this.storeNames=t,this.idbtrans=null,this.on=R(this,"complete","error","abort"),this.parent=r||null,this.active=!0,this._tables=null,this._reculock=0,this._blockedFuncs=[],this._psd=null,this._dbschema=e,this._resolve=null,this._reject=null,this._completion=new U(function(n,t){i._resolve=n,i._reject=t}).uncaught(V),this._completion.then(function(){i.on.complete.fire()},function(n){return i.on.error.fire(n),i.parent?i.parent._reject(n):i.active&&i.idbtrans&&i.idbtrans.abort(),i.active=!1,fn(n)})}function Y(n,t,e){this._ctx={table:n,index:":id"===t?null:t,collClass:n._collClass,or:e}}function $(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 X(n,t){return!(n.filter||n.algorithm||n.or)&&(t?n.justLimit:!n.replayFilter)}function Z(){$.apply(this,arguments)}function nn(n,t){return n._cfg.version-t._cfg.version}function tn(n,t,e,r){t.forEach(function(t){var i=rt._tableFactory(e,r[t]);n.forEach(function(n){t in n||(n[t]=i)})})}function en(n){n.forEach(function(n){for(var t in n)n[t]instanceof W&&delete n[t]})}function rn(n,t,e,r,i,o){var u=o?function(n,t,r){return e(o(n),t,r)}:e,a=un(u,i);n.onerror||(n.onerror=yn(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 on(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 wn(e,r||null,/\&/.test(n),/\*/.test(n),/\+\+/.test(n),An(r),/\./.test(n)))}),t}function cn(n,t){return Ln.cmp(n,t)}function sn(n,t){return cn(n,t)<0?n:t}function hn(n,t){return cn(n,t)>0?n:t}function On(n,t){return Ln.cmp(n,t)}function Pn(n,t){return Ln.cmp(t,n)}function Cn(n,t){return n<t?-1:n===t?0:1}function In(n,t){return n>t?-1:n===t?0:1}function Dn(n,t){return n?t?function(){return n.apply(this,arguments)&&t.apply(this,arguments)}:n:t}function Sn(){if(rt.verno=$n.version/10,rt._dbSchema=Gn={},Qn=u($n.objectStoreNames,0),0!==Qn.length){var n=$n.transaction(kn(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 wn(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 wn(c.name,r,!!c.unique,!!c.multiEntry,!1,r&&"string"!=typeof r,i);u.push(s)}Gn[t]=new xn(t,o,u,{})}),tn([Yn,Q.prototype],jn(Gn),et,Gn)}}function Tn(n,t){for(var e=t.db.objectStoreNames,r=0;r<e.length;++r){var i=e[r],o=t.objectStore(i);qn="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 Bn(n){rt.on("blocked").fire(n),gt.filter(function(n){return n.name===rt.name&&n!==rt&&!n._vcFired}).map(function(t){return t.on("versionchange").fire(n)})}var Nn,Fn,qn,Rn=ln.dependencies,Un=n({addons:ln.addons,autoOpen:!0,indexedDB:Rn.indexedDB,IDBKeyRange:Rn.IDBKeyRange},f),zn=Un.addons,Vn=Un.autoOpen,Ln=Un.indexedDB,Hn=Un.IDBKeyRange,Gn=this._dbSchema={},Jn=[],Qn=[],Yn={},$n=null,Xn=null,Zn=!1,nt=!1,tt="readonly",et="readwrite",rt=this,it=new U(function(n){Nn=n}),ot=new U(function(n,t){Fn=t}),ut=!0,ct=!!En(Ln);this.version=function(n){if($n||Zn)throw new Wn.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,n);var t=Jn.filter(function(t){return t._cfg.version===n})[0];return t?t:(t=new j(n),Jn.push(t),Jn.sort(nn),t)},n(j.prototype,{stores:function(t){this._cfg.storesSource=this._cfg.storesSource?n(this._cfg.storesSource,t):t;var e={};Jn.forEach(function(t){n(e,t._cfg.storesSource)});var r=this._cfg.dbschema={};return this._parseStoresSpec(e,r),Gn=rt._dbSchema=r,en([Yn,rt,Q.prototype]),tn([Yn,rt,Q.prototype,this._cfg.tables],jn(r),et,r),Qn=jn(r),this},upgrade:function(n){var t=this;return kt(function(){n(rt._createTransaction(et,jn(t._cfg.dbschema),t._cfg.dbschema))}),this._cfg.contentUpgrade=n,this},_parseStoresSpec:function(n,t){jn(n).forEach(function(e){if(null!==n[e]){var r={},i=on(n[e]),o=i.shift();if(o.multi)throw new Wn.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 Wn.Schema("Only primary key can be marked as autoIncrement (++)");if(!n.keyPath)throw new Wn.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 xn(e,o,i,r)}})}}),this._allTables=Yn,this._tableFactory=function(n,t){return n===tt?new W(t.name,t,$):new H(t.name,t)},this._createTransaction=function(n,t,e,r){return new Q(n,t,e,r)},this._whenReady=function(n){return new U(Et||nt||at.letThrough?n:function(t,e){if(!Zn){if(!Vn)return void e(new Wn.DatabaseClosed);rt.open().catch(x)}it.then(function(){n(t,e)})}).uncaught(V)},this.verno=0,this.open=function(){if(Zn||$n)return it.then(function(){return Xn?fn(Xn,V):rt});Mn&&(ot._stackHolder=S()),Zn=!0,Xn=null,nt=!1;var n=Nn,t=null;return U.race([ot,new U(function(n,e){if(c(function(){return n()}),Jn.length>0&&(ut=!1),!Ln)throw new Wn.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=ut?Ln.open(o):Ln.open(o,Math.round(10*rt.verno));if(!r)throw new Wn.MissingAPI("IndexedDB API not available");r.onerror=un(yn(e)),r.onblocked=un(Bn),r.onupgradeneeded=un(function(n){if(t=r.transaction,ut&&!rt._allowEmptyDB){r.onerror=gn,t.abort(),r.result.close();var i=Ln.deleteDatabase(o);i.onsuccess=i.onerror=un(function(){e(new Wn.NoSuchDatabase("Database "+o+" doesnt exist"))})}else{t.onerror=un(yn(e));var u=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;C(u/10,t,e,r)}},e),r.onsuccess=un(function(){if(t=null,$n=r.result,gt.push(rt),ut)Sn();else if($n.objectStoreNames.length>0)try{Tn(Gn,$n.transaction(kn($n.objectStoreNames),tt))}catch(n){}$n.onversionchange=un(function(n){rt._vcFired=!0,rt.on("versionchange").fire(n)}),ct||bn(function(n){if(n.indexOf(o)===-1)return n.push(o)}),n()},e)})]).then(function(){return ln.vip(rt.on.ready.fire)}).then(function(){return Zn=!1,rt}).catch(function(n){try{t&&t.abort()}catch(n){}return Zn=!1,rt.close(),Xn=n,fn(Xn,V)}).finally(function(){nt=!0,n()})},this.close=function(){var n=gt.indexOf(rt);if(n>=0&>.splice(n,1),$n){try{$n.close()}catch(n){}$n=null}Vn=!1,Xn=new Wn.DatabaseClosed,Zn&&Fn(Xn),it=new U(function(n){Nn=n}),ot=new U(function(n,t){Fn=t})},this.delete=function(){var n=arguments.length>0;return new U(function(t,e){function r(){rt.close();var n=Ln.deleteDatabase(o);n.onsuccess=un(function(){ct||bn(function(n){var t=n.indexOf(o);if(t>=0)return n.splice(t,1)}),t()}),n.onerror=un(yn(e)),n.onblocked=Bn}if(n)throw new Wn.InvalidArgument("Arguments not allowed in db.delete()");Zn?it.then(r):r()}).uncaught(V)},this.backendDB=function(){return $n},this.isOpen=function(){return null!==$n},this.hasFailed=function(){return null!==Xn},this.dynamicallyOpened=function(){return ut},this.name=o,r(this,"tables",{get:function(){return jn(Yn).map(function(n){return Yn[n]})}}),this.on=R(this,"error","populate","blocked","versionchange",{ready:[I,x]}),this.on.error.subscribe=K("Dexie.on.error",this.on.error.subscribe),this.on.error.unsubscribe=K("Dexie.on.error.unsubscribe",this.on.error.unsubscribe),this.on.ready.subscribe=a(this.on.ready.subscribe,function(n){return function(t,e){ln.vip(function(){nt?(Xn||U.resolve().then(t),e&&n(t)):(n(t),e||n(function n(){rt.on.ready.unsubscribe(t),rt.on.ready.unsubscribe(n)}))})}}),kt(function(){rt.on("populate").fire(rt._createTransaction(et,Qn,Gn)),rt.on("error").fire(new Error)}),this.transaction=function(n,e,r){function i(e){var i=at;e(U.resolve().then(function(){return an(function(){at.transless=at.transless||i;var e=rt._createTransaction(n,f,Gn,c);at.trans=e,c?e.idbtrans=c.idbtrans:e.create();var o=f.map(function(n){return Yn[n]});o.push(e);var u;return U.follow(function(){if(u=r.apply(e,o))if("function"==typeof u.next&&"function"==typeof u.throw)u=_n(u);else if("function"==typeof u.then&&!t(u,"_PSD"))throw new Wn.IncompatiblePromise("Incompatible Promise returned from transaction scope (read more at http://tinyurl.com/znyqjqc). Transaction scope: "+r.toString())}).uncaught(V).then(function(){return c&&e._resolve(),e._completion}).then(function(){return u}).catch(function(n){return e._reject(n),fn(n)})})}))}var o=arguments.length;if(o<2)throw new Wn.InvalidArgument("Too few arguments");for(var u=new Array(o-1);--o;)u[o-1]=arguments[o];r=u.pop();var a=w(u),c=at.trans;c&&c.db===rt&&n.indexOf("!")===-1||(c=null);var s=n.indexOf("?")!==-1;n=n.replace("!","").replace("?","");try{var f=a.map(function(n){var t=n instanceof W?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==tt)n=tt;else{if("rw"!=n&&n!=et)throw new Wn.InvalidArgument("Invalid transaction mode: "+n);n=et}if(c){if(c.mode===tt&&n===et){if(!s)throw new Wn.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");c=null}c&&f.forEach(function(n){if(c&&c.storeNames.indexOf(n)===-1){if(!s)throw new Wn.SubTransaction("Table "+n+" not included in parent transaction.");c=null}})}}catch(n){return c?c._promise(null,function(t,e){e(n)}):fn(n,V)}return c?c._promise(n,i,"lock"):rt._whenReady(i)},this.table=function(n){if(Et&&ut)return new H(n);if(!t(Yn,n))throw new Wn.InvalidTable("Table "+n+" does not exist");return Yn[n]},e(W.prototype,{_trans:function(n,t,e){var r=at.trans;return r&&r.db===rt?r._promise(n,t,e):L(n,[this.name],t)},_idbstore:function(n,t,e){function r(n,e,r){t(n,e,r.idbtrans.objectStore(o),r)}if(Et)return new U(t);var i=at.trans,o=this.name;return i&&i.db===rt?i._promise(n,r,e):L(n,[this.name],r)},get:function(n,t){var e=this;return this._idbstore(tt,function(t,r,i){Et&&t(e.schema.instanceTemplate);var o=i.get(n);o.onerror=yn(r),o.onsuccess=function(){t(e.hook.reading.fire(o.result))}}).then(t)},where:function(n){return new Y(this,n)},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 this._collClass(new Y(this,n))},toCollection:function(){return new this._collClass(new Y(this))},mapToClass:function(n,e){this.schema.mappedClass=n;var r=Object.create(n.prototype);e&&dn(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)t(e,i)&&(r[i]=e[i]);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(ln.defineClass(n),n)}}),i(H).from(W).extend({bulkDelete:function(n){return this.hook.deleting.fire===x?this._idbstore(et,function(t,e,r,i){t(J(r,i,n,!1,x))}):this.where(":id").anyOf(n).delete().then(function(){})},bulkPut:function(n,t){var e=this;return this._idbstore(et,function(r,i,o){if(!o.keyPath&&!e.schema.primKey.auto&&!t)throw new Wn.InvalidArgument("bulkPut() with non-inbound keys requires keys array in second argument");if(o.keyPath&&t)throw new Wn.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Wn.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 F(e.name+".bulkPut(): "+s.length+" of "+f+" operations failed",s))},s=[],f=n.length,h=e;if(e.hook.creating.fire===x&&e.hook.updating.fire===x){a=G(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=G(s,c),u.onsuccess=vn(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(N,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(F,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(et,function(i,o,u,a){function c(n){0===h.length?i(n):o(new F(e.name+".bulkAdd(): "+h.length+" of "+y+" operations failed",h))}if(!u.keyPath&&!e.schema.primKey.auto&&!t)throw new Wn.InvalidArgument("bulkAdd() with non-inbound keys requires keys array in second argument");if(u.keyPath&&t)throw new Wn.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(t&&t.length!==n.length)throw new Wn.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!==x){var m,b=u.keyPath;f=G(h,null,!0),l=pn(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:b?v(c,b):void 0,d=r.call(m,h,c,a);null==h&&null!=d&&(b?(c=g(c),p(c,b,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=G(h,c,!0),s.onsuccess=pn(c)}else{f=G(h);for(var _=0,w=n.length;_<w;++_)s=t?u.add(n[_],t[_]):u.add(n[_]),s.onerror=f;s.onerror=G(h,c),s.onsuccess=vn(c)}})},add:function(n,t){var e=this.hook.creating.fire;return this._idbstore(et,function(r,i,o,u){var a={onsuccess:null,onerror:null};if(e!==x){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=mn(i),f.onsuccess=pn(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;return r!==x||i!==x?this._trans(et,function(r,i,o){var u=void 0!==t?t:e.schema.primKey.keyPath&&v(n,e.schema.primKey.keyPath);null==u?e.add(n).then(r,i):(o._lock(),n=g(n),e.where(":id").equals(u).modify(function(){this.value=n}).then(function(r){return 0===r?e.add(n,t):u}).finally(function(){o._unlock()}).then(r,i))}):this._idbstore(et,function(e,r,i){var o=void 0!==t?i.put(n,t):i.put(n);o.onerror=yn(r),o.onsuccess=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(et,function(t,e,r){var i=r.delete(n);i.onerror=yn(e),i.onsuccess=function(){t(i.result)}})},clear:function(){return this.hook.deleting.subscribers.length?this.toCollection().delete():this._idbstore(et,function(n,t,e){var r=e.clear();r.onerror=yn(t),r.onsuccess=function(){n(r.result)}})},update:function(n,t){if("object"!=typeof t||An(t))throw new Wn.InvalidArgument("Modifications must be an object.");if("object"!=typeof n||An(n))return this.where(":id").equals(n).modify(t);jn(t).forEach(function(e){p(n,e,t[e])});var e=v(n,this.schema.primKey.keyPath);return void 0===e?fn(new Wn.InvalidArgument("Given object does not contain its primary key"),V):this.where(":id").equals(e).modify(t)}}),e(Q.prototype,{_lock:function(){return s(!at.global),++this._reculock,1!==this._reculock||at.global||(at.lockOwnerFor=this),this},_unlock:function(){if(s(!at.global),0===--this._reculock)for(at.global||(at.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var n=this._blockedFuncs.shift();try{n()}catch(n){}}return this},_locked:function(){return this._reculock&&at.lockOwnerFor!==this},create:function(n){var t=this;if(s(!this.idbtrans),!n&&!$n)switch(Xn&&Xn.name){case"DatabaseClosedError":throw new Wn.DatabaseClosed(Xn);case"MissingAPIError":throw new Wn.MissingAPI(Xn.message,Xn);default:throw new Wn.OpenFailed(Xn)}if(!this.active)throw new Wn.TransactionInactive;return s(null===this._completion._state),n=this.idbtrans=n||$n.transaction(kn(this.storeNames),this.mode),n.onerror=un(function(e){gn(e),t._reject(n.error)}),n.onabort=un(function(n){gn(n),t.active&&t._reject(new Wn.Abort),t.active=!1,t.on("abort").fire(n)}),n.oncomplete=un(function(){t.active=!1,t._resolve()}),this},_promise:function(n,t,e){var r=this;return an(function(){var i;return r._locked()?i=new U(function(i,o){r._blockedFuncs.push(function(){r._promise(n,t,e).then(i,o)})}):(i=r.active?new U(function(i,o){if(n===et&&r.mode!==et)throw new Wn.ReadOnly("Transaction is readonly");!r.idbtrans&&n&&r.create(),e&&r._lock(),t(i,o,r)}):fn(new Wn.TransactionInactive),r.active&&e&&i.finally(function(){r._unlock(); | ||
})),i._lib=!0,i.uncaught(V)})},abort:function(){this.active&&this._reject(new Wn.Abort),this.active=!1},tables:{get:K("Transaction.tables",function(){return l(this.storeNames,function(n){return[n,Yn[n]]})},"Use db.tables()")},complete:K("Transaction.complete()",function(n){return this.on("complete",n)}),error:K("Transaction.error()",function(n){return this.on("error",n)}),table:K("Transaction.table()",function(n){if(this.storeNames.indexOf(n)===-1)throw new Wn.InvalidTable("Table "+n+" not in transaction");return Yn[n]})}),e(Y.prototype,function(){function n(n,t,e){var r=n instanceof Y?new n._ctx.collClass(n):n;return r._ctx.error=e?new e(t):new TypeError(t),r}function t(n){return new n._ctx.collClass(n,function(){return Hn.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?Cn:In;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,mt);c("next");var m=new t._ctx.collClass(t,function(){return Hn.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 cn(e,r)>0||0===cn(e,r)&&(i||o)&&(!i||!o)?t(this):new this._ctx.collClass(this,function(){return Hn.bound(e,r,!i,!o)})}catch(t){return n(this,yt)}},equals:function(n){return new this._ctx.collClass(this,function(){return Hn.only(n)})},above:function(n){return new this._ctx.collClass(this,function(){return Hn.lowerBound(n,!0)})},aboveOrEqual:function(n){return new this._ctx.collClass(this,function(){return Hn.lowerBound(n)})},below:function(n){return new this._ctx.collClass(this,function(){return Hn.upperBound(n,!0)})},belowOrEqual:function(n){return new this._ctx.collClass(this,function(){return Hn.upperBound(n)})},startsWith:function(t){return"string"!=typeof t?n(this,mt):this.between(t,t+vt,!0,!0)},startsWithIgnoreCase:function(n){return""===n?this.startsWith(n):o(this,function(n,t){return 0===n.indexOf(t[0])},[n],vt)},equalsIgnoreCase:function(n){return o(this,function(n,t){return n===t[0]},[n],"")},anyOfIgnoreCase:function(){var n=_.apply(Kn,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.indexOf(n)!==-1},n,"")},startsWithAnyOfIgnoreCase:function(){var n=_.apply(Kn,arguments);return 0===n.length?t(this):o(this,function(n,t){return t.some(function(t){return 0===n.indexOf(t)})},n,vt)},anyOf:function(){var e=_.apply(Kn,arguments),r=On;try{e.sort(r)}catch(t){return n(this,yt)}if(0===e.length)return t(this);var i=new this._ctx.collClass(this,function(){return Hn.bound(e[0],e[e.length-1])});i._ondirectionchange=function(n){r="next"===n?On:Pn,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([[-(1/0),n],[n,pt]],{includeLowers:!1,includeUppers:!1})},noneOf:function(){var t=_.apply(Kn,arguments);if(0===t.length)return new this._ctx.collClass(this);try{t.sort(On)}catch(t){return n(this,yt)}var e=t.reduce(function(n,t){return n?n.concat([[n[n.length-1][1],t]]):[[-(1/0),t]]},null);return e.push([t[t.length-1],pt]),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(cn(t[0],i[1])<0&&cn(t[1],i[0])>0){i[0]=sn(i[0],t[0]),i[1]=hn(i[1],t[1]);break}}return e===r&&n.push(t),n}function o(n,t){return l(n[0],t[0])}function u(n){return!d(n)&&!v(n)}var a=this._ctx;if(0===e.length)return t(this);if(!e.every(function(n){return void 0!==n[0]&&void 0!==n[1]&&On(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",Wn.InvalidArgument);var c,s=!r||r.includeLowers!==!1,f=r&&r.includeUppers===!0,l=On;try{c=e.reduce(i,[]),c.sort(o)}catch(t){return n(this,yt)}var h=0,d=f?function(n){return On(n,c[h][1])>0}:function(n){return On(n,c[h][1])>=0},v=s?function(n){return Pn(n,c[h][0])>0}:function(n){return Pn(n,c[h][0])>=0},p=d,y=new a.collClass(this,function(){return Hn.bound(c[0][0],c[c.length-1][1],!s,!f)});return y._ondirectionchange=function(n){"next"===n?(p=d,l=On):(p=v,l=Pn),c.sort(o)},y._addAlgorithm(function(n,t,e){for(var r=n.key;p(r);)if(++h,h===c.length)return t(e),!1;return!!u(r)||0!==cn(r,c[h][1])&&0!==cn(r,c[h][0])&&(t(function(){l===On?n.continue(c[h][0]):n.continue(c[h][1])}),!1)}),y},startsWithAnyOf:function(){var e=_.apply(Kn,arguments);return e.every(function(n){return"string"==typeof n})?0===e.length?t(this):this.inAnyRange(e.map(function(n){return[n,n+vt]})):n(this,"startsWithAnyOf() only works with strings")}}}),e($.prototype,function(){function e(n,t){n.filter=Dn(n.filter,t)}function r(n,t,e){var r=n.replayFilter;n.replayFilter=r?function(){return Dn(r(),t())}:t,n.justLimit=e&&!r}function i(n,t){n.isMatch=Dn(n.isMatch,t)}function o(n,t){if(n.isPrimKey)return t;var e=n.table.schema.idxByName[n.index];if(!e)throw new Wn.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?Dn(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),rn(u(n,o),n.algorithm,s,c,i,!n.keysOnly&&n.valueMapper)}():rn(u(n,o),Dn(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,function(n,t){t(e.error)}):e.table._idbstore(tt,n).then(t)},_write:function(n){var t=this._ctx;return t.error?t.table._trans(null,function(n,e){e(t.error)}):t.table._idbstore(et,n,"locked")},_addAlgorithm:function(n){var t=this._ctx;t.algorithm=Dn(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(Et){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(Et)return U.resolve(0).then(n);var t=this._ctx;if(X(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=yn(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(Et&&n([c(t)]),qn&&"next"===t.dir&&X(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=yn(e),s.onsuccess=i===k?vn(n):un(vn(function(t){n(t.map(i))}))}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,X(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 Et&&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 Et&&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 Y(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(qn&&"next"===t.dir&&X(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=yn(e),u.onsuccess=vn(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}}}),i(Z).from($).extend({modify:function(e){var r=this,i=this._ctx,o=i.table.hook,u=o.updating.fire,a=o.deleting.fire;return Et&&"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 O.push(n),P.push(i.primKey),h(),!0}C=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");++E,d(function(){var n=o?e.delete():e.update(i.value);n._hookCtx=i,n.onerror=mn(r),n.onsuccess=pn(function(){++j,h()})},r)}else i.onsuccess&&i.onsuccess(i.value)}function l(n){return n&&(O.push(n),P.push(C)),o(new N("Error modifying one or more objects",O,j,P))}function h(){A&&j+O.length===E&&(O.length>0?l():i(j))}var y;if("function"==typeof e)y=u===x&&a===x?e:function(n){var r=g(n);if(e.call(this,n,this)===!1)return!1;if(t(this,"value")){var i=b(r,this.value),o=u.call(this,i,this.primKey,r,s);o&&(n=this.value,jn(o).forEach(function(t){p(n,t,o[t])}))}else a.call(this,this.primKey,n,s)};else if(u===x){var _=jn(e),w=_.length;y=function(n){for(var t=!1,r=0;r<w;++r){var i=_[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,g(t),s);return i&&n(e,i),jn(e).forEach(function(n){var i=e[n];v(t,n)!==i&&(p(t,n,i),r=!0)}),i&&(e=m(k)),r}}var E=0,j=0,A=!1,O=[],P=[],C=null;r.clone().raw()._iterate(f,function(){A=!0,h()},l,c)})},delete:function(){var n=this,t=this._ctx,e=t.range,r=t.table.hook.deleting.fire,i=r!==x;if(!i&&X(t)&&(t.isPrimKey&&!wt||!e))return this._write(function(n,t,r){var i=yn(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 On(n[0],t[0])}):l.sort(On),J(a,c,l,i,r)}).then(function(){var n=l.length;return s+=n,l=[],n<o?s:h()})};e(h())})}}),n(this,{Collection:$,Table:W,Transaction:Q,Version:j,WhereClause:Y,WriteableCollection:Z,WriteableTable:H}),y(),zn.forEach(function(n){n(rt)})}function hn(n){if("function"==typeof n)return new n;if(An(n))return[hn(n[0])];if(n&&"object"==typeof n){var t={};return dn(t,n),t}return n}function dn(n,t){return jn(t).forEach(function(e){var r=hn(t[e]);n[e]=r}),n}function vn(n){return function(t){n(t.target.result)}}function pn(n){return un(function(t){var e=t.target,r=e.result,i=e._hookCtx,o=i&&i.onsuccess;o&&o(r),n&&n(r)},n)}function yn(n){return function(t){return gn(t),n(t.target.error),!1}}function mn(n){return un(function(t){var e=t.target,r=e.error,i=e._hookCtx,o=i&&i.onerror;return o&&o(r),gn(t),n(r),!1})}function gn(n){n.stopPropagation&&n.stopPropagation(),n.preventDefault&&n.preventDefault()}function bn(n){var t,e=ln.dependencies.localStorage;if(!e)return n([]);try{t=JSON.parse(e.getItem("Dexie.DatabaseNames")||"[]")}catch(n){t=[]}n(t)&&e.setItem("Dexie.DatabaseNames",JSON.stringify(t))}function _n(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):An(r)?U.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 wn(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 xn(n,t,e,r){this.name=n,this.primKey=t||new wn,this.indexes=e||[new wn],this.instanceTemplate=r,this.mappedClass=null,this.idxByName=l(e,function(n){return[n.name,n]})}function kn(n){return 1===n.length?n[0]:n}function En(n){var t=n&&(n.getDatabaseNames||n.webkitGetDatabaseNames);return t&&t.bind(n)}var jn=Object.keys,An=Array.isArray,On="undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Pn=Object.getPrototypeOf,Cn={}.hasOwnProperty,In=Object.getOwnPropertyDescriptor,Dn=[].slice,Sn="undefined"!=typeof Symbol&&Symbol.iterator,Tn=Sn?function(n){var t;return null!=n&&(t=n[Sn])&&t.apply(n)}:function(){return null},Kn={},Bn=[].concat,Mn="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),Nn=function(){return!0},Fn=!new Error("").stack,qn=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","IncompatiblePromise"],Rn=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Un=qn.concat(Rn),zn={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};i(B).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+T(this._e,2))}},toString:function(){return this.name+": "+this.message}}),i(N).from(B),i(F).from(B);var Vn=Un.reduce(function(n,t){return n[t]=t+"Error",n},{}),Ln=B,Wn=Un.reduce(function(n,t){function e(n,e){this._e=S(),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=zn[t]||r,this.inner=null)}var r=t+"Error";return i(e).from(Ln),n[t]=e,n},{});Wn.Syntax=SyntaxError,Wn.Type=TypeError,Wn.Range=RangeError;var Hn=Rn.reduce(function(n,t){return n[t+"Error"]=Wn[t],n},{}),Gn=Un.reduce(function(n,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(n[t+"Error"]=Wn[t]),n},{});Gn.ModifyError=N,Gn.DexieError=B,Gn.BulkError=F;var Jn={},Qn=100,Yn=20,$n=!1,Xn=On.setImmediate?setImmediate.bind(null,Y):On.MutationObserver?function(){var n=document.createElement("div");new MutationObserver(function(){Y(),n=null}).observe(n,{attributes:!0}),n.setAttribute("i","1")}:function(){setTimeout(Y,0)},Zn=function(n,t){ct.push([n,t]),tt&&(Xn(),tt=!1)},nt=!0,tt=!0,et=[],rt=[],it=null,ot=k,ut={global:!0,ref:0,unhandleds:[],onunhandled:sn,finalize:function(){this.unhandleds.forEach(function(n){try{sn(n[0],n[1])}catch(n){}})}},at=ut,ct=[],st=0,ft=[];e(U.prototype,{then:function(n,t){var e=this,r=new U(function(r,i){H(e,new z(n,t,r,i))});return Mn&&(!this._prev||null===this._state)&&Q(r,this),r},_then:function(n,t){H(this,new z(null,null,n,t))},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):on(n)}):this.then(null,function(n){return n&&n.name===t?e(n):on(n)})},finally:function(n){return this.then(function(t){return n(),t},function(t){return n(),on(t)})},uncaught:function(n){var t=this;return this.onuncatched=C(this.onuncatched,n),this._state===!1&&et.indexOf(this)===-1&&et.some(function(n,e,r){return n._value===t._value&&(r[e]=t)}),this},stack:{get:function(){if(this._stack)return this._stack;try{$n=!0;var n=J(this,[],Yn),t=n.join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{$n=!1}}}}),e(U,{all:function(){var n=_.apply(null,arguments);return new U(function(t,e){0===n.length&&t([]);var r=n.length;n.forEach(function(i,o){return U.resolve(i).then(function(e){n[o]=e,--r||t(n)},e)})})},resolve:function(n){return n instanceof U?n:n&&"function"==typeof n.then?new U(function(t,e){n.then(t,e)}):new U(Jn,!0,n)},reject:on,race:function(){var n=_.apply(null,arguments);return new U(function(t,e){n.map(function(n){return U.resolve(n).then(t,e)})})},PSD:{get:function(){return at},set:function(n){return at=n}},newPSD:an,usePSD:cn,scheduler:{get:function(){return Zn},set:function(n){Zn=n}},rejectionMapper:{get:function(){return ot},set:function(n){ot=n}},follow:function(n){return new U(function(t,e){return an(function(t,e){var r=at;r.unhandleds=[],r.onunhandled=e,r.finalize=j(function(){var n=this;nn(function(){0===n.unhandleds.length?t():e(n.unhandleds[0])})},r.finalize),n()},t,e)})},on:R(null,{error:[C,rn]})});var lt=U.on.error;lt.subscribe=K("Promise.on('error')",lt.subscribe),lt.unsubscribe=K("Promise.on('error').unsubscribe",lt.unsubscribe);var ht="unhandledrejection";c(function(){Zn=function(n,t){setTimeout(function(){n.apply(null,t)},0)}});var dt="1.5.0-rc.2",vt=String.fromCharCode(65535),pt=function(){try{return IDBKeyRange.only([[]]),[[]]}catch(n){return vt}}(),yt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",mt="String expected.",gt=[],bt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),_t=bt,wt=bt,xt=function(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};D(Mn,xt);var kt=function(){},Et=!1,jt=On.idbModules&&On.idbModules.shimIndexedDB?On.idbModules:{};return e(ln,Gn),e(ln,{delete:function(n){var t=new ln(n),e=t.delete();return e.onblocked=function(n){return t.on("blocked",n),this},e},exists:function(n){return new ln(n).open().then(function(n){return n.close(),!0}).catch(ln.NoSuchDatabaseError,function(){return!1})},getDatabaseNames:function(n){return new U(function(n,t){var e=En(indexedDB);if(e){var r=e();r.onsuccess=function(t){n(u(t.target.result,0))},r.onerror=yn(t)}else bn(function(t){return n(t),!1})}).then(n)},defineClass:function(t){function e(e){e?n(this,e):Et&&dn(this,t)}return e},applyStructure:dn,ignoreTransaction:function(n){return at.trans?cn(at.transless,n):n()},vip:function(n){return an(function(){return at.letThrough=!0,n()})},async:function(n){return function(){try{var t=_n(n.apply(this,arguments));return t&&"function"==typeof t.then?t:U.resolve(t)}catch(n){return fn(n)}}},spawn:function(n,t,e){try{var r=_n(n.apply(e,t||[]));return r&&"function"==typeof r.then?r:U.resolve(r)}catch(n){return fn(n)}},currentTransaction:{get:function(){return at.trans||null}},Promise:U,debug:{get:function(){return Mn},set:function(n){D(n,"dexie"===n?function(){return!0}:xt)}},derive:i,extend:n,props:e,override:a,Events:R,events:{get:K(function(){return R})},getByKeyPath:v,setByKeyPath:p,delByKeyPath:y,shallowClone:m,deepClone:g,getObjectDiff:b,asap:f,maxKey:pt,addons:[],connections:gt,MultiModifyError:Wn.Modify,errnames:Vn,IndexSpec:wn,TableSchema:xn,dependencies:{indexedDB:jt.shimIndexedDB||On.indexedDB||On.mozIndexedDB||On.webkitIndexedDB||On.msIndexedDB,IDBKeyRange:jt.IDBKeyRange||On.IDBKeyRange||On.webkitIDBKeyRange},semVer:dt,version:dt.split(".").map(function(n){return parseInt(n)}).reduce(function(n,t,e){return n+t/Math.pow(10,2*e)}),fakeAutoComplete:kt,default:ln}),d(function(){ln.dependencies.localStorage=null!=("undefined"!=typeof chrome&&null!==chrome?chrome.storage:void 0)?null:On.localStorage}),U.rejectionMapper=q,c(function(){ln.fakeAutoComplete=kt=c,ln.fake=Et=!0}),ln}); | ||
//# sourceMappingURL=dexie.min.js.map |
{ | ||
"name": "dexie", | ||
"version": "1.5.0-rc", | ||
"version": "1.5.0-rc.2", | ||
"description": "A Minimalistic Wrapper for IndexedDB", | ||
@@ -5,0 +5,0 @@ "main": "dist/dexie.js", |
import {doFakeAutoComplete, tryCatch, props, | ||
setProp, _global, getPropertyDescriptor, getArrayOf} from './utils'; | ||
setProp, _global, getPropertyDescriptor, getArrayOf, extend} from './utils'; | ||
import {reverseStoppableEventChain, nop, callBoth, mirror} from './chaining-functions'; | ||
import Events from './Events'; | ||
import {debug, prettyStack, getErrorWithStack} from './debug'; | ||
import {debug, prettyStack, getErrorWithStack, deprecated} from './debug'; | ||
@@ -87,3 +87,3 @@ // | ||
needsNewPhysicalTick = true, // True when a push to microtickQueue must also schedulePhysicalTick() | ||
unhandledErrors = [], // Rejected promises that has occured. Used for firing Promise.on.error and promise.onuncatched. | ||
unhandledErrors = [], // Rejected promises that has occured. Used for firing unhandledrejection. | ||
rejectingErrors = [], // Tracks if errors are being re-rejected during onRejected callback. | ||
@@ -331,5 +331,9 @@ currentFulfiller = null, | ||
}) | ||
}); | ||
var PromiseOnError = Promise.on.error; | ||
PromiseOnError.subscribe = deprecated ("Promise.on('error')", PromiseOnError.subscribe); | ||
PromiseOnError.unsubscribe = deprecated ("Promise.on('error').unsubscribe", PromiseOnError.unsubscribe); | ||
/** | ||
@@ -662,2 +666,4 @@ * Take a potentially misbehaving resolver function and make sure | ||
const UNHANDLEDREJECTION = "unhandledrejection"; | ||
function globalError(err, promise) { | ||
@@ -669,6 +675,25 @@ var rv; | ||
if (rv !== false) try { | ||
Promise.on.error.fire(err, promise); // TODO: Deprecated and use same global handler as bluebird. | ||
var event, eventData = {promise: promise, reason: err}; | ||
if (_global.document && document.createEvent) { | ||
event = document.createEvent('Event'); | ||
event.initEvent(UNHANDLEDREJECTION, true, true); | ||
extend(event, eventData); | ||
} else if (_global.CustomEvent) { | ||
event = new CustomEvent(UNHANDLEDREJECTION, {detail: eventData}); | ||
extend(event, eventData); | ||
} | ||
if (event && _global.dispatchEvent) { | ||
dispatchEvent(event); | ||
if (!_global.PromiseRejectionEvent && _global.onunhandledrejection) | ||
// No native support for PromiseRejectionEvent but user has set window.onunhandledrejection. Manually call it. | ||
try {_global.onunhandledrejection(event);} catch (_) {} | ||
} | ||
if (!event.defaultPrevented) { | ||
// Backward compatibility: fire to events registered at Promise.on.error | ||
Promise.on.error.fire(err, promise); | ||
} | ||
} catch (e) {} | ||
} | ||
/* **KEEP** | ||
@@ -675,0 +700,0 @@ |
@@ -11,6 +11,2 @@ import Dexie from 'dexie'; | ||
}); | ||
function dbOnErrorHandler (e) { | ||
ok(false, "An error bubbled out to the db.on('error'). Should not happen because all tests should catch their errors themselves. " + e); | ||
} | ||
db.on("error", dbOnErrorHandler); | ||
@@ -28,15 +24,15 @@ module("exception-handling", { | ||
asyncTest("Uncaught promise should signal to Promise.on('error')", function(){ | ||
asyncTest("Uncaught promise should signal 'unhandledrejection'", function(){ | ||
// We must not use finally or catch here because then we don't test what we should. | ||
var onErrorSignals = 0; | ||
function onerror(e) { | ||
function onerror(ev) { | ||
++onErrorSignals; | ||
ev.preventDefault(); | ||
} | ||
Dexie.Promise.on('error', onerror); | ||
db.on('error').unsubscribe(dbOnErrorHandler); | ||
var prevUnhandledRejection = window.onunhandledrejection; | ||
window.onunhandledrejection = onerror; | ||
db.users.add({ id: 1 }); | ||
setTimeout(()=> { | ||
equal(onErrorSignals, 1, "Promise.on('error') should have been signaled"); | ||
db.on("error", dbOnErrorHandler); | ||
Dexie.Promise.on('error').unsubscribe(onerror); | ||
equal(onErrorSignals, 1, "'unhandledrejection' should have been signaled"); | ||
window.onunhandledrejection = prevUnhandledRejection; | ||
start(); | ||
@@ -274,3 +270,3 @@ }, 100); | ||
ourDB.delete().then(()=>{ | ||
Dexie.Promise.on('error').unsubscribe(swallowPromiseOnError); | ||
window.removeEventListener('unhandledrejection', swallowPromiseOnError); | ||
start(); | ||
@@ -280,6 +276,6 @@ }); | ||
}); | ||
function swallowPromiseOnError(e){ | ||
return false; | ||
function swallowPromiseOnError(ev){ | ||
ev.preventDefault(); | ||
} | ||
Dexie.Promise.on('error', swallowPromiseOnError); // Just to get rid of default error logs for not catching. | ||
window.addEventListener('unhandledrejection', swallowPromiseOnError); // Just to get rid of default error logs for not catching. | ||
@@ -503,9 +499,10 @@ ourDB.delete() | ||
var errorList = []; | ||
function globalRejectionHandler(e) { | ||
console.log("Got error: " + e); | ||
if (errorList.indexOf(e) === -1) // Current implementation: accept multiple redundant triggers | ||
errorList.push(e); | ||
function globalRejectionHandler(ev) { | ||
console.log("Got error: " + ev.reason); | ||
if (errorList.indexOf(ev.reason) === -1) // Current implementation: accept multiple redundant triggers | ||
errorList.push(ev.reason); | ||
ev.preventDefault(); | ||
} | ||
Dexie.Promise.on("error", globalRejectionHandler); | ||
window.addEventListener('unhandledrejection', globalRejectionHandler); | ||
@@ -554,7 +551,2 @@ // The most simple case: Any Promise reject that is not catched should | ||
db.version(1).stores({ table1: "id" }); | ||
db.on('error', function(err) { | ||
// Global 'db' error handler (will never be called 'cause the error is not in a transaction) | ||
console.log("db.on.error: " + err); | ||
errorList.push("Got db.on.error: " + err); | ||
}); | ||
db.open().then(function() { | ||
@@ -573,3 +565,3 @@ console.log("before"); | ||
// cleanup: | ||
Dexie.Promise.on("error").unsubscribe(globalRejectionHandler); | ||
window.removeEventListener('unhandledrejection', globalRejectionHandler); | ||
start(); | ||
@@ -576,0 +568,0 @@ }); |
@@ -132,9 +132,9 @@ import Dexie from 'dexie'; | ||
asyncTest("Promise.on.error should propagate once", 1, function(){ | ||
asyncTest("'unhandledrejection' should propagate once", 1, function(){ | ||
var Promise = Dexie.Promise; | ||
function logErr (e) { | ||
ok(true, e); | ||
return false; | ||
function logErr (ev) { | ||
ok(true, ev.reason); | ||
ev.preventDefault(); | ||
} | ||
Promise.on('error', logErr); | ||
window.addEventListener('unhandledrejection', logErr); | ||
var p = new Promise((resolve, reject)=>{ | ||
@@ -156,3 +156,3 @@ reject("apa"); | ||
setTimeout(()=>{ | ||
Promise.on('error').unsubscribe(logErr); | ||
window.removeEventListener('unhandledrejection', logErr); | ||
start(); | ||
@@ -163,8 +163,8 @@ }, 1); | ||
asyncTest("Promise.on.error should not propagate if catched after finally", 1, function(){ | ||
asyncTest("'unhandledrejection' should not propagate if catched after finally", 1, function(){ | ||
var Promise = Dexie.Promise; | ||
function logErr (e) { | ||
ok(false, "Should already be catched:" + e); | ||
function logErr (ev) { | ||
ok(false, "Should already be catched:" + ev.reason); | ||
} | ||
Promise.on('error', logErr); | ||
window.addEventListener('unhandledrejection', logErr); | ||
var p = new Promise((resolve, reject)=>{ | ||
@@ -190,3 +190,3 @@ reject("apa"); | ||
setTimeout(()=>{ | ||
Promise.on('error').unsubscribe(logErr); | ||
window.removeEventListener('unhandledrejection', logErr); | ||
start(); | ||
@@ -307,9 +307,9 @@ }, 1); | ||
asyncTest("Promise.on.error", ()=> { | ||
asyncTest("unhandledrejection", ()=> { | ||
var errors = []; | ||
function onError(e, p) { | ||
errors.push(e); | ||
return false; | ||
function onError(ev) { | ||
errors.push(ev.reason); | ||
ev.preventDefault(); | ||
} | ||
Dexie.Promise.on('error', onError); | ||
window.addEventListener('unhandledrejection', onError); | ||
@@ -322,3 +322,3 @@ new Dexie.Promise((resolve, reject) => { | ||
equal(errors[0], "error", "Should be our error there"); | ||
Dexie.Promise.on.error.unsubscribe(onError); | ||
window.removeEventListener('unhandledrejection', onError); | ||
start(); | ||
@@ -328,9 +328,9 @@ }, 40); | ||
asyncTest("Promise.on.error2", ()=> { | ||
asyncTest("unhandledrejection2", ()=> { | ||
var errors = []; | ||
function onError(e, p) { | ||
errors.push(e); | ||
return false; | ||
function onError(ev) { | ||
errors.push(ev.reason); | ||
ev.preventDefault(); | ||
} | ||
Dexie.Promise.on('error', onError); | ||
window.addEventListener('unhandledrejection', onError); | ||
@@ -349,3 +349,3 @@ new Dexie.Promise((resolve, reject) => { | ||
equal(errors[0], "error", "Should be our error there"); | ||
Dexie.Promise.on.error.unsubscribe(onError); | ||
window.removeEventListener('unhandledrejection', onError); | ||
start(); | ||
@@ -355,9 +355,9 @@ }, 40); | ||
asyncTest("Promise.on.error3", ()=> { | ||
asyncTest("unhandledrejection3", ()=> { | ||
var errors = []; | ||
function onError(e, p) { | ||
errors.push(e); | ||
return false; | ||
function onError(ev) { | ||
errors.push(ev.reason); | ||
ev.preventDefault(); | ||
} | ||
Dexie.Promise.on('error', onError); | ||
window.addEventListener('unhandledrejection', onError); | ||
@@ -375,5 +375,5 @@ new Dexie.Promise((resolve, reject) => { | ||
equal(errors.length, 0, "Should be zarro errors there"); | ||
Dexie.Promise.on.error.unsubscribe(onError); | ||
window.removeEventListener('unhandledrejection', onError); | ||
start(); | ||
}, 40); | ||
}); |
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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2040265
21849