System.register([],function(e,t){var n,r,i,o,u,a,s,c,l,f,h,p,d,y,v,m,g,b,_,w,k,x,P,E,O,S,j,A,K,C,I,T,B,D,R,F,q,M,N,U,V,W,z,L,Y,G,H,Q,X,J,$,Z,ee,te,ne,re,ie,oe,ue,ae,se,ce,le,fe,he,pe,de,ye,ve,me,ge,be,_e,we,ke,xe,Pe,Ee,Oe,Se,je,Ae,Ke,Ce,Ie,Te,Be,De;function Re(){for(var e=0,t=0,n=arguments.length;t=0)t=e;else for(var o in t=e.constructor?Object.create(e.constructor.prototype):{},e)qe(e,o)&&(t[o]=Ze(e[o]));return t}function et(e){return y.call(e).slice(8,-1)}function tt(e,t,n,i){return n=n||{},i=i||"",r(e).forEach(function(r){if(qe(t,r)){var o=e[r],u=t[r];if("object"==typeof o&&"object"==typeof u&&o&&u){var a=et(o),s=et(u);a===s?d[a]?v(o,a)!==v(u,s)&&(n[i+r]=t[r]):tt(o,u,n,i+r+"."):n[i+r]=t[r]}else o!==u&&(n[i+r]=t[r])}else n[i+r]=void 0}),r(t).forEach(function(r){qe(e,r)||(n[i+r]=t[r])}),n}function nt(e){var t,n,r,o;if(1===arguments.length){if(i(e))return e.slice();if(this===b&&"string"==typeof e)return[e];if(o=g(e)){for(n=[];!(r=o.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}function rt(e,t){w=e,k=t}function it(){if(x)try{throw new Error}catch(e){return e}return new Error}function ot(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(k).map(function(e){return"\n"+e}).join("")):""}function ut(e,t){this._e=it(),this.name=e,this.message=t}function at(e,t){return e+". Errors: "+Object.keys(t).map(function(e){return t[e].toString()}).filter(function(e,t,n){return n.indexOf(e)===t}).join("\n")}function st(e,t,n,r){this._e=it(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=at(e,t)}function ct(e,t){this._e=it(),this.name="BulkError",this.failures=t,this.message=at(e,t)}function lt(e,t){if(!e||e instanceof ut||e instanceof TypeError||e instanceof SyntaxError||!e.name||!K[e.name])return e;var n=new K[e.name](t||e.message,e);return"stack"in e&&Ne(n,"stack",{get:function(){return this.inner.stack}}),n}function ft(){}function ht(e){return e}function pt(e,t){return null==e||e===ht?t:function(n){return t(e(n))}}function dt(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function yt(e,t){return e===ft?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);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?dt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?dt(i,this.onerror):i),void 0!==o?o:n}}function vt(e,t){return e===ft?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?dt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?dt(r,this.onerror):r)}}function mt(e,t){return e===ft?t:function(n){var r=e.apply(this,arguments);Fe(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var u=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?dt(i,this.onsuccess):i),o&&(this.onerror=this.onerror?dt(o,this.onerror):o),void 0===r?void 0===u?void 0:u:Fe(r,u)}}function gt(e,t){return e===ft?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function bt(e,t){return e===ft?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}function _t(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ft,this._lib=!1;var t=this._PSD=$;if(w&&(this._stackHolder=it(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==I)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&xt(this,this._value))}this._state=null,this._value=null,++t.ref,kt(this,e)}function wt(e,t,n,r,i){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=i}function kt(e,t){try{t(function(t){if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Kt();t&&"function"==typeof t.then?kt(e,function(e,n){t instanceof _t?t._then(e,n):t.then(e,n)}):(e._state=!0,e._value=t,Pt(e)),n&&Ct()}},xt.bind(null,e))}catch(n){xt(e,n)}}function xt(e,t){if(H.push(t),null===e._state){var n=e._lib&&Kt();t=X(t),e._state=!1,e._value=t,w&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}(function(){var n=Ve(t,"stack");t._promise=e,Ne(t,"stack",{get:function(){return V?n&&(n.get?n.get.apply(t):n.value):e.stack}})}),function(e){G.some(function(t){return t._value===e._value})||G.push(e)}(e),Pt(e),n&&Ct()}}function Pt(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n0;)for(e=Z,Z=[],n=e.length,t=0;t0);L=!0,Y=!0}function It(){var e=G;G=[],e.forEach(function(e){e._PSD.onunhandled.call(null,e._value,e)});for(var t=te.slice(0),n=t.length;n;)t[--n]()}function Tt(e){return new _t(I,!1,e)}function Bt(e,t){var n=$;return function(){var r=Kt(),i=$;try{return Ut(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{Ut(i,!1),r&&Ct()}}}function Dt(e,t,n,r){var i=$,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++se;var u=J.env;o.env=U?{Promise:_t,PromiseProp:{value:_t,configurable:!0,writable:!0},all:_t.all,race:_t.race,allSettled:_t.allSettled,any:_t.any,resolve:_t.resolve,reject:_t.reject,nthen:Yt(u.nthen,o),gthen:Yt(u.gthen,o)}:{},t&&Fe(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=Wt(o,e,n,r);return 0===o.ref&&o.finalize(),a}function Rt(){return re.id||(re.id=++ie),++re.awaits,re.echoes+=B,re.id}function Ft(){return!!re.awaits&&(0===--re.awaits&&(re.id=0),re.echoes=re.awaits*B,!0)}function qt(e){return re.echoes&&e&&e.constructor===N?(Rt(),e.then(function(e){return Ft(),e},function(e){return Ft(),le(e)})):e}function Mt(e){++ae,re.echoes&&0!==--re.echoes||(re.echoes=re.id=0),oe.push($),Ut(e,!0)}function Nt(){var e=oe[oe.length-1];oe.pop(),Ut(e,!1)}function Ut(e,t){var n=$;if((t?!re.echoes||ue++&&e===$:!ue||--ue&&e===$)||zt(t?Mt.bind(null,e):Nt),e!==$&&($=e,n===J&&(J.env=Vt()),U)){var r=J.env.Promise,i=e.env;F.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(o,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function Vt(){var e=o.Promise;return U?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:F.then,gthen:e.prototype.then}:{}}function Wt(e,t,n,r,i){var o=$;try{return Ut(e,!0),t(n,r,i)}finally{Ut(o,!1)}}function zt(e){M.call(R,e)}function Lt(e,t,n,r){return"function"!=typeof e?e:function(){var i=$;n&&Rt(),Ut(t,!0);try{return e.apply(this,arguments)}finally{Ut(i,!1),r&&zt(Ft)}}}function Yt(e,t){return function(n,r){return e.call(this,Lt(n,t),Lt(r,t))}}function Gt(e,t){var n;try{n=t.onuncatched(e)}catch(u){}if(!1!==n)try{var r,i={promise:t,reason:e};if(o.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(ce,!0,!0),Fe(r,i)):o.CustomEvent&&Fe(r=new CustomEvent(ce,{detail:i}),i),r&&o.dispatchEvent&&(dispatchEvent(r),!o.PromiseRejectionEvent&&o.onunhandledrejection))try{o.onunhandledrejection(r)}catch(a){}w&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch(u){}}function Ht(e,t,n,r){if(e._state.openComplete||$.letThrough){var i=e._createTransaction(t,n,e._dbSchema);try{i.create()}catch(o){return le(o)}return i._promise(t,function(e,t){return Dt(function(){return $.trans=i,r(e,t,i)})}).then(function(e){return i._completion.then(function(){return e})})}if(!e._state.isBeingOpened){if(!e._options.autoOpen)return le(new A.DatabaseClosed);e.open().catch(ft)}return e._state.dbReadyPromise.then(function(){return Ht(e,t,n,r)})}function Qt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}function Xt(e){return function(t){return void 0===He(t,e)&&Xe(t=Ze(t),e),t}}function Jt(e){var t={},n=function(n,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=a;for(var o=1,u=arguments.length;ot?-1:e===t?0:1}function cn(e,t,n){var r=e instanceof Se?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function ln(e){return new e.Collection(e,function(){return dn("")}).limit(0)}function fn(e,t,n,r,i,o){for(var u=Math.min(e.length,r.length),a=-1,s=0;s=0?e.substr(0,a)+t[a]+n.substr(a+1):null;i(e[s],c)<0&&(a=s)}return u0)&&(p=v)}return n(null!==p?function(){e.continue(p+l)}:r),!1}),p}function pn(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function dn(e){return{type:1,lower:e,upper:e}}function yn(e){return 1===e.length?e[0]:e}function vn(e){try{return e.only([[]]),[[]]}catch(t){return he}}function mn(e){return Bt(function(t){return gn(t),e(t.target.error),!1})}function gn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}function bn(e,t,n,r,i,o,u){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!u?"&":"")+(r?"*":"")+(i?"++":"")+_n(t)}}function _n(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function wn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:Ge(n,function(e){return[e.name,e]})}}function kn(e){return null==e?function(){}:"string"==typeof e?function(e){return 1===e.split(".").length?function(t){return t[e]}:function(t){return He(t,e)}}(e):function(t){return He(t,e)}}function xn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}function Pn(e){return[].slice.call(e)}function En(e){return null==e?":id":"string"==typeof e?e:"["+e.join("+")+"]"}function On(e,t,n,r){var o=t.cmp.bind(t);function u(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var t=e.lower,r=e.upper,i=e.lowerOpen,o=e.upperOpen;return void 0===t?void 0===r?null:n.upperBound(r,!!o):void 0===r?n.lowerBound(t,!!i):n.bound(t,r,!!i,!!o)}var a=function(e,t){var n=Pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map(function(e){return t.objectStore(e)}).map(function(e){var t=e.keyPath,n=e.autoIncrement,r=i(t),o=null==t,u={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:o,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:kn(t)},indexes:Pn(e.indexNames).map(function(t){return e.index(t)}).map(function(e){var t=e.name,n=e.unique,r=e.multiEntry,o=e.keyPath,a={name:t,compound:i(o),keyPath:o,unique:n,multiEntry:r,extractKey:kn(o)};return u[En(o)]=a,a}),getIndexByKeyPath:function(e){return u[En(e)]}};return u[":id"]=a.primaryKey,null!=t&&(u[En(t)]=a.primaryKey),a})},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,r),s=a.schema,c=a.hasGetAll,l=s.tables.map(function(e){return function(e){var t=e.name;return{name:t,schema:e,mutate:function(n){var r=n.trans,i=n.type,o=n.keys,a=n.values,s=n.range,c=n.wantResults;return new Promise(function(n,l){n=Bt(n);var f=r.objectStore(t),h=null==f.keyPath,p="put"===i||"add"===i;if(!p&&"delete"!==i&&"deleteRange"!==i)throw new Error("Invalid operation type: "+i);var d=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return n({numFailures:0,failures:{},results:[],lastResult:void 0});var y,v=c&&Re(o||xn(e.primaryKey,{type:i,keys:o,values:a})),m=[],g=0,b=function(e){++g,gn(e),v&&(v[e.target._reqno]=void 0),m[e.target._reqno]=e.target.error},_=function(e){var t=e.target;v[t._reqno]=t.result};if("deleteRange"===i){if(4===s.type)return n({numFailures:g,failures:m,results:v,lastResult:void 0});y=3===s.type?f.clear():f.delete(u(s))}else{var w=p?h?[a,o]:[a,null]:[o,null],k=w[0],x=w[1];if(p)for(var P=0;P=t}).forEach(function(u){o.push(function(){var o=a,c=u._cfg.dbschema;Fn(e,o,i),Fn(e,c,i),a=e._dbSchema=c;var l=Tn(o,c);l.add.forEach(function(e){Bn(i,e[0],e[1].primKey,e[1].indexes)}),l.change.forEach(function(e){if(e.recreate)throw new A.Upgrade("Not yet support for changing primary key");var t=i.objectStore(e.name);e.add.forEach(function(e){return Dn(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),Dn(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})});var f=u._cfg.contentUpgrade;if(f&&u._cfg.version>t){jn(e,i),n._memoizedTables={},s=!0;var h=Je(c);l.del.forEach(function(e){h[e]=o[e]}),Kn(e,[e.Transaction.prototype]),An(e,[e.Transaction.prototype],r(h),h),n.schema=h;var p,d=_(f);d&&Rt();var y=_t.follow(function(){if((p=f(n))&&d){var e=Ft.bind(null,null);p.then(e,e)}});return p&&"function"==typeof p.then?_t.resolve(p):y.then(function(){return p})}}),o.push(function(t){s&&ge||function(e,t){for(var n=0;n0||u.add.length>0||u.change.length>0)&&r.change.push(u)}}else r.add.push([n,o])}return r}function Bn(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(e){return Dn(i,e)}),i}function Dn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Rn(e,t,n){var r={};return We(t.objectStoreNames,0).forEach(function(e){for(var t=n.objectStore(e),i=t.keyPath,o=bn(_n(i),i||"",!1,!1,!!t.autoIncrement,i&&"string"!=typeof i,!0),u=[],a=0;aMath.pow(2,62)?0:r.oldVersion;e.idbdb=s.result,In(e,c/10,o,u)}},u),s.onsuccess=Bt(function(){o=null;var n=e.idbdb=s.result,u=We(n.objectStoreNames);if(u.length>0)try{var c=n.transaction(yn(u),"readonly");t.autoSchema?function(e,t,n){e.verno=t.version/10;var i=e._dbSchema=Rn(0,t,n);e._storeNames=We(t.objectStoreNames,0),An(e,[e._allTables],r(i),i)}(e,n,c):(Fn(e,e._dbSchema,c),function(e,t){var n=Tn(Rn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some(function(e){return e.add.length||e.change.length}))}(e,c)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),jn(e,c)}catch(l){}ve.push(e),n.onversionchange=Bt(function(n){t.vcFired=!0,e.on("versionchange").fire(n)}),Ce.add(a),i()},u)})]).then(function(){return t.onReadyBeingFired=[],_t.resolve(Mn(e.on.ready.fire)).then(function e(){if(t.onReadyBeingFired.length>0){var n=t.onReadyBeingFired.reduce(bt,ft);return t.onReadyBeingFired=[],_t.resolve(Mn(n)).then(e)}})}).finally(function(){t.onReadyBeingFired=null}).then(function(){return t.isBeingOpened=!1,e}).catch(function(n){try{o&&o.abort()}catch(r){}return t.isBeingOpened=!1,e.close(),t.dbOpenError=n,le(t.dbOpenError)}).finally(function(){t.openComplete=!0,i()})}function Un(e){var t=function(t){return e.next(t)},n=o(t),r=o(function(t){return e.throw(t)});function o(e){return function(t){var o=e(t),u=o.value;return o.done?u:u&&"function"==typeof u.then?u.then(n,r):i(u)?Promise.all(u).then(n,r):n(u)}}return o(t)()}function Vn(e,t,n){var r=arguments.length;if(r<2)throw new A.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,$e(i),n]}function Wn(e,t,n,r,i){return _t.resolve().then(function(){var o=$.transless||$,u=e._createTransaction(t,n,e._dbSchema,r),a={trans:u,transless:o};r?u.idbtrans=r.idbtrans:u.create();var s,c=_(i);c&&Rt();var l=_t.follow(function(){if(s=i.call(u,u))if(c){var e=Ft.bind(null,null);s.then(e,e)}else"function"==typeof s.next&&"function"==typeof s.throw&&(s=Un(s))},a);return(s&&"function"==typeof s.then?_t.resolve(s).then(function(e){return u.active?e:le(new A.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):l.then(function(){return s})).then(function(e){return r&&u._resolve(),u._completion.then(function(){return e})}).catch(function(e){return u._reject(e),le(e)})})}function zn(e,t,n){for(var r=i(e)?e.slice():[e],o=0;o0,f=n(n({},r),{isVirtual:l,isPrimaryKey:!l&&r.isPrimaryKey,keyTail:t,keyLength:c,extractKey:kn(e),unique:!l&&r.unique});return s.push(f),f.isPrimaryKey||u.push(f),c>1&&a(2===c?e[0]:e.slice(0,c-1),t+1,r),s.sort(function(e,t){return e.keyTail-t.keyTail}),f}var s=a(i.primaryKey.keyPath,0,i.primaryKey);o[":id"]=[s];for(var c=0,l=i.indexes;c.",ye="String expected.",ve=[],me="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ge=me,be=me,_e=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},we="__dbnames",ke="readonly",xe="readwrite",Pe={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1},Ee=function(){function e(){}return e.prototype._trans=function(e,t,n){var r=this._tx||$.trans,i=this.name;function o(e,n,r){if(!r.schema[i])throw new A.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=Kt();try{return r&&r.db===this.db?r===$.trans?r._promise(e,o,n):Dt(function(){return r._promise(e,o,n)},{trans:r,transless:$.transless||$}):Ht(this.db,e,[this.name],o)}finally{u&&Ct()}},e.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",function(t){return n.core.get({trans:t,key:e}).then(function(e){return n.hook.reading.fire(e)})}).then(t)},e.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(i(e))return new this.db.WhereClause(this,"["+e.join("+")+"]");var t=r(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(e){return e.compound&&t.every(function(t){return e.keyPath.indexOf(t)>=0})&&e.keyPath.every(function(e){return t.indexOf(e)>=0})})[0];if(n&&this.db._maxKey!==he)return this.where(n.name).equals(n.keyPath.map(function(t){return e[t]}));!n&&w&&console.warn("The query "+JSON.stringify(e)+" on "+this.name+" would benefit of a compound index ["+t.join("+")+"]");var o=this.schema.idxByName,u=this.db._deps.indexedDB;function a(e,t){try{return 0===u.cmp(e,t)}catch(n){return!1}}var s=t.reduce(function(t,n){var r=t[0],u=t[1],s=o[n],c=e[n];return[r||s,r||!s?Qt(u,s&&s.multi?function(e){var t=He(e,n);return i(t)&&t.some(function(e){return a(c,e)})}:function(e){return a(c,He(e,n))}):u]},[null,null]),c=s[0],l=s[1];return c?this.where(c.name).equals(e[c.keyPath]).filter(l):n?this.filter(l):this.where(t).equals("")},e.prototype.filter=function(e){return this.toCollection().and(e)},e.prototype.count=function(e){return this.toCollection().count(e)},e.prototype.offset=function(e){return this.toCollection().offset(e)},e.prototype.limit=function(e){return this.toCollection().limit(e)},e.prototype.each=function(e){return this.toCollection().each(e)},e.prototype.toArray=function(e){return this.toCollection().toArray(e)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,i(e)?"["+e.join("+")+"]":e))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(e){this.schema.mappedClass=e;var t=function(t){if(!t)return t;var n=Object.create(e.prototype);for(var r in t)if(qe(t,r))try{n[r]=t[r]}catch(i){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e},e.prototype.defineClass=function(){return this.mapToClass(function(e){Fe(this,e)})},e.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,u=e;return o&&i&&(u=Xt(o)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[u]})}).then(function(e){return e.numFailures?_t.reject(e.failures[0]):e.lastResult}).then(function(t){if(o)try{Qe(e,o,t)}catch(n){}return t})},e.prototype.update=function(e,t){if("object"!=typeof t||i(t))throw new A.InvalidArgument("Modifications must be an object.");if("object"!=typeof e||i(e))return this.where(":id").equals(e).modify(t);r(t).forEach(function(n){Qe(e,n,t[n])});var n=He(e,this.schema.primKey.keyPath);return void 0===n?le(new A.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(n).modify(t)},e.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,u=e;return o&&i&&(u=Xt(o)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"put",values:[u],keys:null!=t?[t]:null})}).then(function(e){return e.numFailures?_t.reject(e.failures[0]):e.lastResult}).then(function(t){if(o)try{Qe(e,o,t)}catch(n){}return t})},e.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]})}).then(function(e){return e.numFailures?_t.reject(e.failures[0]):void 0})},e.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:Pe})}).then(function(e){return e.numFailures?_t.reject(e.failures[0]):void 0})},e.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n}).then(function(e){return e.map(function(e){return t.hook.reading.fire(e)})})})},e.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,u=n.auto,a=n.keyPath;if(a&&i)throw new A.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new A.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=a&&u?e.map(Xt(a)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:c,wantResults:o}).then(function(e){var t=e.numFailures,n=e.results,i=e.lastResult,u=e.failures;if(0===t)return o?n:i;throw new ct(r.name+".bulkAdd(): "+t+" of "+s+" operations failed",Object.keys(u).map(function(e){return u[e]}))})})},e.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,u=n.auto,a=n.keyPath;if(a&&i)throw new A.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new A.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=a&&u?e.map(Xt(a)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:c,wantResults:o}).then(function(e){var t=e.numFailures,n=e.results,i=e.lastResult,u=e.failures;if(0===t)return o?n:i;throw new ct(r.name+".bulkPut(): "+t+" of "+s+" operations failed",Object.keys(u).map(function(e){return u[e]}))})})},e.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:e})}).then(function(e){var r=e.numFailures,i=e.lastResult,o=e.failures;if(0===r)return i;throw new ct(t.name+".bulkDelete(): "+r+" of "+n+" operations failed",o)})},e}(),Oe=function(){function e(){}return e.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,le.bind(null,n.error)):n.table._trans("readonly",e).then(t)},e.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,le.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},e.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Qt(t.algorithm,e)},e.prototype._iterate=function(e,t){return on(this._ctx,e,t,this._ctx.table.core)},e.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&Fe(n,e),t._ctx=n,t},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return on(t,e,n,t.table.core)})},e.prototype.count=function(e){var t=this;return this._read(function(e){var n=t._ctx,r=n.table.core;if(Zt(n,!0))return r.count({trans:e,query:{index:nn(n,r.schema),range:n.range}}).then(function(e){return Math.min(e,n.limit)});var i=0;return on(n,function(){return++i,!1},e,r).then(function(){return i})}).then(e)},e.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var u="next"===this._ctx.dir?1:-1;function a(e,t){var n=o(e,i),r=o(t,i);return nr?u:0}return this.toArray(function(e){return e.sort(a)}).then(t)},e.prototype.toArray=function(e){var t=this;return this._read(function(e){var n=t._ctx;if("next"===n.dir&&Zt(n,!0)&&n.limit>0){var r=n.valueMapper,i=nn(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,query:{index:i,range:n.range}}).then(function(e){var t=e.result;return r?t.map(r):t})}var o=[];return on(n,function(e){return o.push(e)},e,n.table.core).then(function(){return o})},e)},e.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,Zt(t)?tn(t,function(){var t=e;return function(e,n){return 0===t||(1===t?(--t,!1):(n(function(){e.advance(t),t=0}),!1))}}):tn(t,function(){var t=e;return function(){return--t<0}})),this},e.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),tn(this._ctx,function(){var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}},!0),this},e.prototype.until=function(e,t){return en(this._ctx,function(n,r,i){return!e(n.value)||(r(i),t)}),this},e.prototype.first=function(e){return this.limit(1).toArray(function(e){return e[0]}).then(e)},e.prototype.last=function(e){return this.reverse().first(e)},e.prototype.filter=function(e){var t,n;return en(this._ctx,function(t){return e(t.value)}),t=this._ctx,n=e,t.isMatch=Qt(t.isMatch,n),this},e.prototype.and=function(e){return this.filter(e)},e.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},e.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.key,n)})},e.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},e.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.primaryKey,n)})},e.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.key)}).then(function(){return n}).then(e)},e.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&Zt(t,!0)&&t.limit>0)return this._read(function(e){var n=nn(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})}).then(function(e){return e.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.primaryKey)}).then(function(){return n}).then(e)},e.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},e.prototype.firstKey=function(e){return this.limit(1).keys(function(e){return e[0]}).then(e)},e.prototype.lastKey=function(e){return this.reverse().firstKey(e)},e.prototype.distinct=function(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return en(this._ctx,function(e){var t=e.primaryKey.toString(),r=qe(n,t);return n[t]=!0,!r}),this},e.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(i){var o;if("function"==typeof e)o=e;else{var u=r(e),a=u.length;o=function(t){for(var n=!1,r=0;r0&&s.mutate({trans:i,type:"add",values:a}).then(function(e){for(var t in e.failures)y.splice(parseInt(t),1);m(a.length,e)})).then(function(e){return c.length>0&&s.mutate({trans:i,type:"put",keys:d,values:c}).then(function(e){return m(c.length,e)})}).then(function(){return y.length>0&&s.mutate({trans:i,type:"delete",keys:y}).then(function(e){return m(y.length,e)})}).then(function(){return e.length>n+r&&t(n+h)})})};return t(0).then(function(){if(d.length>0)throw new st("Error modifying one or more objects",d,y,v);return e.length})})})},e.prototype.delete=function(){var e=this._ctx,t=e.range;return Zt(e)&&(e.isPrimKey&&!be||3===t.type)?this._write(function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then(function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:i}).then(function(e){var n=e.failures;e.lastResult,e.results;var r=e.numFailures;if(r)throw new st("Could not delete some values",Object.keys(n).map(function(e){return n[e]}),t-r);return t-r})})}):this.modify(function(e,t){return t.value=null})},e}(),Se=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!0,configurable:!0}),e.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?ln(this):new this.Collection(this,function(){return pn(e,t,!n,!r)})}catch(i){return cn(this,de)}},e.prototype.equals=function(e){return null==e?cn(this,de):new this.Collection(this,function(){return dn(e)})},e.prototype.above=function(e){return null==e?cn(this,de):new this.Collection(this,function(){return pn(e,void 0,!0)})},e.prototype.aboveOrEqual=function(e){return null==e?cn(this,de):new this.Collection(this,function(){return pn(e,void 0,!1)})},e.prototype.below=function(e){return null==e?cn(this,de):new this.Collection(this,function(){return pn(void 0,e,!1,!0)})},e.prototype.belowOrEqual=function(e){return null==e?cn(this,de):new this.Collection(this,function(){return pn(void 0,e)})},e.prototype.startsWith=function(e){return"string"!=typeof e?cn(this,ye):this.between(e,e+he,!0,!0)},e.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):hn(this,function(e,t){return 0===e.indexOf(t[0])},[e],he)},e.prototype.equalsIgnoreCase=function(e){return hn(this,function(e,t){return e===t[0]},[e],"")},e.prototype.anyOfIgnoreCase=function(){var e=nt.apply(b,arguments);return 0===e.length?ln(this):hn(this,function(e,t){return-1!==t.indexOf(e)},e,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=nt.apply(b,arguments);return 0===e.length?ln(this):hn(this,function(e,t){return t.some(function(t){return 0===e.indexOf(t)})},e,he)},e.prototype.anyOf=function(){var e=this,t=nt.apply(b,arguments),n=this._cmp;try{t.sort(n)}catch(o){return cn(this,de)}if(0===t.length)return ln(this);var r=new this.Collection(this,function(){return pn(t[0],t[t.length-1])});r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var i=0;return r._addAlgorithm(function(e,r,o){for(var u=e.key;n(u,t[i])>0;)if(++i===t.length)return r(o),!1;return 0===n(u,t[i])||(r(function(){e.continue(t[i])}),!1)}),r},e.prototype.notEqual=function(e){return this.inAnyRange([[pe,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var e=nt.apply(b,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(n){return cn(this,de)}var t=e.reduce(function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[pe,t]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,u=this._min,a=this._max;if(0===e.length)return ln(this);if(!e.every(function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0}))return cn(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",A.InvalidArgument);var s,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=i;function h(e,t){return f(e[0],t[0])}try{s=e.reduce(function(e,t){for(var n=0,i=e.length;n0){o[0]=u(o[0],t[0]),o[1]=a(o[1],t[1]);break}}return n===i&&e.push(t),e},[]),s.sort(h)}catch(g){return cn(this,de)}var p=0,d=l?function(e){return i(e,s[p][1])>0}:function(e){return i(e,s[p][1])>=0},y=c?function(e){return o(e,s[p][0])>0}:function(e){return o(e,s[p][0])>=0},v=d,m=new this.Collection(this,function(){return pn(s[0][0],s[s.length-1][1],!c,!l)});return m._ondirectionchange=function(e){"next"===e?(v=d,f=i):(v=y,f=o),s.sort(h)},m._addAlgorithm(function(e,t,r){for(var o=e.key;v(o);)if(++p===s.length)return t(r),!1;return!!function(e){return!d(e)&&!y(e)}(o)||(0===n._cmp(o,s[p][1])||0===n._cmp(o,s[p][0])||t(function(){f===i?e.continue(s[p][0]):e.continue(s[p][1])}),!1)}),m},e.prototype.startsWithAnyOf=function(){var e=nt.apply(b,arguments);return e.every(function(e){return"string"==typeof e})?0===e.length?ln(this):this.inAnyRange(e.map(function(e){return[e,e+he]})):cn(this,"startsWithAnyOf() only works with strings")},e}(),je=function(){function e(){}return e.prototype._lock=function(){return Le(!$.global),++this._reculock,1!==this._reculock||$.global||($.lockOwnerFor=this),this},e.prototype._unlock=function(){if(Le(!$.global),0===--this._reculock)for($.global||($.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{Wt(e[1],e[0])}catch(t){}}return this},e.prototype._locked=function(){return this._reculock&&$.lockOwnerFor!==this},e.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(Le(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new A.DatabaseClosed(r);case"MissingAPIError":throw new A.MissingAPI(r.message,r);default:throw new A.OpenFailed(r)}if(!this.active)throw new A.TransactionInactive;return Le(null===this._completion._state),(e=this.idbtrans=e||n.transaction(yn(this.storeNames),this.mode)).onerror=Bt(function(n){gn(n),t._reject(e.error)}),e.onabort=Bt(function(n){gn(n),t.active&&t._reject(new A.Abort(e.error)),t.active=!1,t.on("abort").fire(n)}),e.oncomplete=Bt(function(){t.active=!1,t._resolve()}),this},e.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return le(new A.ReadOnly("Transaction is readonly"));if(!this.active)return le(new A.TransactionInactive);if(this._locked())return new _t(function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},$])});if(n)return Dt(function(){var e=new _t(function(e,n){r._lock();var i=t(e,n,r);i&&i.then&&i.then(e,n)});return e.finally(function(){return r._unlock()}),e._lib=!0,e});var i=new _t(function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)});return i._lib=!0,i},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(e){var t=this._root(),n=_t.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then(function(){return n});else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var i=t._waitingFor;return new _t(function(e,r){n.then(function(n){return t._waitingQueue.push(Bt(e.bind(null,n)))},function(e){return t._waitingQueue.push(Bt(r.bind(null,e)))}).finally(function(){t._waitingFor===i&&(t._waitingFor=null)})})},e.prototype.abort=function(){this.active&&this._reject(new A.Abort),this.active=!1},e.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(qe(t,e))return t[e];var n=this.schema[e];if(!n)throw new A.NotFound("Table "+e+" not part of transaction");var r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r},e}(),Ae=0,Ke=function(){function e(){}return e.prototype._parseStoresSpec=function(e,t){r(e).forEach(function(n){if(null!==e[n]){var r=e[n].split(",").map(function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return bn(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),i(r),0===t)}),o=r.shift();if(o.multi)throw new A.Schema("Primary key cannot be multi-valued");r.forEach(function(e){if(e.auto)throw new A.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new A.Schema("Index must have a name and cannot be an empty string")}),t[n]=wn(n,o,r)}})},e.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?Fe(this._cfg.storesSource,e):e;var n=t._versions,i={},o={};return n.forEach(function(e){Fe(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)}),t._dbSchema=o,Kn(t,[t._allTables,t,t.Transaction.prototype]),An(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],r(o),o),t._storeNames=r(o),this},e.prototype.upgrade=function(e){return this._cfg.contentUpgrade=e,this},e}(),Ie={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Ln},Te={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return n(n({},e),{table:function(t){var r=e.table(t),i=r.schema.primaryKey;return n(n({},r),{mutate:function(e){var o=$.trans,u=o.table(t).hook,a=u.deleting,s=u.creating,c=u.updating;switch(e.type){case"add":if(s.fire===ft)break;return o._promise("readwrite",function(){return l(e)},!0);case"put":if(s.fire===ft&&c.fire===ft)break;return o._promise("readwrite",function(){return l(e)},!0);case"delete":if(a.fire===ft)break;return o._promise("readwrite",function(){return l(e)},!0);case"deleteRange":if(a.fire===ft)break;return o._promise("readwrite",function(){return function(e){return f(e.trans,e.range,1e4)}(e)},!0)}return r.mutate(e);function l(e){var t=$.trans,o=e.keys||xn(i,e);if(!o)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?n(n({},e),{keys:o,wantResults:!0}):n({},e)).type&&(e.values=Re(e.values)),e.keys&&(e.keys=Re(e.keys)),function(e,t,n){return"add"===t.type?Promise.resolve(new Array(t.values.length)):e.getMany({trans:t.trans,keys:n})}(r,e,o).then(function(n){var u=o.map(function(r,o){var u=n[o],l={onerror:null,onsuccess:null};if("delete"===e.type)a.fire.call(l,r,u,t);else if("add"===e.type||void 0===u){var f=s.fire.call(l,r,e.values[o],t);null==r&&null!=f&&(r=f,e.keys[o]=r,i.outbound||Qe(e.values[o],i.keyPath,r))}else{var h=tt(u,e.values[o]),p=c.fire.call(l,h,r,u,t);if(p){var d=e.values[o];Object.keys(p).forEach(function(e){qe(d,e)?d[e]=p[e]:Qe(d,e,p[e])})}}return l});return r.mutate(e).then(function(t){for(var r=t.failures,i=t.results,a=t.numFailures,s=t.lastResult,c=0;c0?Promise.reject(r.failures[0]):i.length0?e:t},this._min=function(e,t){return i.cmp(e,t)<0?e:t},this._IDBKeyRange=e._deps.IDBKeyRange})}(this),this.on("versionchange",function(e){e.newVersion>0?console.warn("Another connection wants to upgrade database '"+i.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+i.name+"'. Closing db now to resume the delete request."),i.close()}),this.on("blocked",function(e){!e.newVersion||e.newVersion=0&&ve.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(n){}this.idbdb=null}this._options.autoOpen=!1,t.dbOpenError=new A.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError),t.dbReadyPromise=new _t(function(e){t.dbReadyResolve=e}),t.openCanceller=new _t(function(e,n){t.cancelOpen=n})},e.prototype.delete=function(){var e=this,t=arguments.length>0,n=this._state;return new _t(function(r,i){var o=function(){e.close();var t=e._deps.indexedDB.deleteDatabase(e.name);t.onsuccess=Bt(function(){Ce.remove(e.name),r()}),t.onerror=mn(i),t.onblocked=e._fireOnBlocked};if(t)throw new A.InvalidArgument("Arguments not allowed in db.delete()");n.isBeingOpened?n.dbReadyPromise.then(o):o()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return null!==this.idbdb},e.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},e.prototype.hasFailed=function(){return null!==this._state.dbOpenError},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var e=this;return r(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!0,configurable:!0}),e.prototype.transaction=function(){var e=Vn.apply(this,arguments);return this._transaction.apply(this,e)},e.prototype._transaction=function(e,t,n){var r=this,i=$.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,u,a=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(u=t.map(function(e){var t=e instanceof r.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t}),"r"==e||e===ke)o=ke;else{if("rw"!=e&&e!=xe)throw new A.InvalidArgument("Invalid transaction mode: "+e);o=xe}if(i){if(i.mode===ke&&o===xe){if(!a)throw new A.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&u.forEach(function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!a)throw new A.SubTransaction("Table "+e+" not included in parent transaction.");i=null}}),a&&i&&!i.active&&(i=null)}}catch(c){return i?i._promise(null,function(e,t){t(c)}):le(c)}var s=Wn.bind(null,this,o,u,i,n);return i?i._promise(o,s,"lock"):$.trans?Wt($.transless,function(){return r._whenReady(s)}):this._whenReady(s)},e.prototype.table=function(e){if(!qe(this._allTables,e))throw new A.InvalidTable("Table "+e+" does not exist");return this._allTables[e]},e}()),Me(De=Be,n(n({},C),{delete:function(e){return new De(e).delete()},exists:function(e){return new De(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){return Ce?Ce.getDatabaseNames().then(e):_t.resolve([])},defineClass:function(){return function(e){Fe(this,e)}},ignoreTransaction:function(e){return $.trans?Wt($.transless,e):e()},vip:Mn,async:function(e){return function(){try{var t=Un(e.apply(this,arguments));return t&&"function"==typeof t.then?t:_t.resolve(t)}catch(n){return le(n)}}},spawn:function(e,t,n){try{var r=Un(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:_t.resolve(r)}catch(i){return le(i)}},currentTransaction:{get:function(){return $.trans||null}},waitFor:function(e,t){var n=_t.resolve("function"==typeof e?De.ignoreTransaction(e):e).timeout(t||6e4);return $.trans?$.trans.waitFor(n):n},Promise:_t,debug:{get:function(){return w},set:function(e){rt(e,"dexie"===e?function(){return!0}:_e)}},derive:Ue,extend:Fe,props:Me,override:ze,Events:Jt,getByKeyPath:He,setByKeyPath:Qe,delByKeyPath:Xe,shallowClone:Je,deepClone:Ze,getObjectDiff:tt,asap:Ye,minKey:pe,addons:[],connections:ve,errnames:S,dependencies:function(){try{return{indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch(e){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:fe,version:fe.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)}),default:De,Dexie:De})),De.maxKey=vn(De.dependencies.IDBKeyRange),qn(Be.dependencies.indexedDB),_t.rejectionMapper=lt,rt(w,_e)}}});