(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["third_vendors_003dex~app"],{"4dec":function(e,n,t){"use strict";(function(e){var t=function(){return t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t=0)n=e;else for(var i in n=e.constructor?Object.create(e.constructor.prototype):{},e)l(e,i)&&(n[i]=T(e[i]));return n}var B={}.toString;function D(e){return B.call(e).slice(8,-1)}var R=function(e,n){return"Array"===n?""+e.map((function(e){return R(e,D(e))})):"ArrayBuffer"===n?""+new Uint8Array(e):"Date"===n?e.getTime():ArrayBuffer.isView(e)?""+new Uint8Array(e.buffer):e};function F(e,n,t,r){return t=t||{},r=r||"",i(e).forEach((function(i){if(l(n,i)){var o=e[i],u=n[i];if("object"===typeof o&&"object"===typeof u&&o&&u){var a=D(o),s=D(u);a===s?I[a]?R(o,a)!==R(u,s)&&(t[r+i]=n[i]):F(o,u,t,r+i+"."):t[r+i]=n[i]}else o!==u&&(t[r+i]=n[i])}else t[r+i]=void 0})),i(n).forEach((function(i){l(e,i)||(t[r+i]=n[i])})),t}var q="undefined"!==typeof Symbol&&Symbol.iterator,M=q?function(e){var n;return null!=e&&(n=e[q])&&n.apply(e)}:function(){return null},N={};function U(e){var n,t,r,i;if(1===arguments.length){if(o(e))return e.slice();if(this===N&&"string"===typeof e)return[e];if(i=M(e)){t=[];while(r=i.next(),!r.done)t.push(r.value);return t}if(null==e)return[e];if(n=e.length,"number"===typeof n){t=new Array(n);while(n--)t[n]=e[n];return t}return[e]}n=arguments.length,t=new Array(n);while(n--)t[n]=arguments[n];return t}var V="undefined"!==typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},W="undefined"!==typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function z(e,n){W=e,L=n}var L=function(){return!0},Y=!new Error("").stack;function G(){if(Y)try{throw new Error}catch(e){return e}return new Error}function H(e,n){var t=e.stack;return t?(n=n||0,0===t.indexOf(e.name)&&(n+=(e.name+e.message).split("\n").length),t.split("\n").slice(n).filter(L).map((function(e){return"\n"+e})).join("")):""}var Q=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],X=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],J=Q.concat(X),$={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed"};function Z(e,n){this._e=G(),this.name=e,this.message=n}function ee(e,n){return e+". Errors: "+Object.keys(n).map((function(e){return n[e].toString()})).filter((function(e,n,t){return t.indexOf(e)===n})).join("\n")}function ne(e,n,t,r){this._e=G(),this.failures=n,this.failedKeys=r,this.successCount=t,this.message=ee(e,n)}function te(e,n){this._e=G(),this.name="BulkError",this.failures=n,this.message=ee(e,n)}d(Z).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+H(this._e,2))}},toString:function(){return this.name+": "+this.message}}),d(ne).from(Z),d(te).from(Z);var re=J.reduce((function(e,n){return e[n]=n+"Error",e}),{}),ie=Z,oe=J.reduce((function(e,n){var t=n+"Error";function r(e,r){this._e=G(),this.name=t,e?"string"===typeof e?(this.message=e+(r?"\n "+r:""),this.inner=r||null):"object"===typeof e&&(this.message=e.name+" "+e.message,this.inner=e):(this.message=$[n]||t,this.inner=null)}return d(r).from(ie),e[n]=r,e}),{});oe.Syntax=SyntaxError,oe.Type=TypeError,oe.Range=RangeError;var ue=X.reduce((function(e,n){return e[n+"Error"]=oe[n],e}),{});function ae(e,n){if(!e||e instanceof Z||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ue[e.name])return e;var t=new ue[e.name](n||e.message,e);return"stack"in e&&p(t,"stack",{get:function(){return this.inner.stack}}),t}var se=J.reduce((function(e,n){return-1===["Syntax","Type","Range"].indexOf(n)&&(e[n+"Error"]=oe[n]),e}),{});function ce(){}function le(e){return e}function fe(e,n){return null==e||e===le?n:function(t){return n(e(t))}}function he(e,n){return function(){e.apply(this,arguments),n.apply(this,arguments)}}function pe(e,n){return e===ce?n:function(){var t=e.apply(this,arguments);void 0!==t&&(arguments[0]=t);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=n.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?he(r,this.onsuccess):r),i&&(this.onerror=this.onerror?he(i,this.onerror):i),void 0!==o?o:t}}function de(e,n){return e===ce?n:function(){e.apply(this,arguments);var t=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,n.apply(this,arguments),t&&(this.onsuccess=this.onsuccess?he(t,this.onsuccess):t),r&&(this.onerror=this.onerror?he(r,this.onerror):r)}}function ye(e,n){return e===ce?n:function(t){var r=e.apply(this,arguments);a(t,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var u=n.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?he(i,this.onsuccess):i),o&&(this.onerror=this.onerror?he(o,this.onerror):o),void 0===r?void 0===u?void 0:u:a(r,u)}}function ve(e,n){return e===ce?n:function(){return!1!==n.apply(this,arguments)&&e.apply(this,arguments)}}function me(e,n){return e===ce?n:function(){var t=e.apply(this,arguments);if(t&&"function"===typeof t.then){var r=this,i=arguments.length,o=new Array(i);while(i--)o[i]=arguments[i];return t.then((function(){return n.apply(r,o)}))}return n.apply(this,arguments)}}se.ModifyError=ne,se.DexieError=Z,se.BulkError=te;var ge={},be=100,we=20,_e=100,ke="undefined"===typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"===typeof crypto||!crypto.subtle)return[e,e.__proto__,e];var n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,n.__proto__,e]}(),xe=ke[0],Pe=ke[1],Ee=ke[2],Oe=Pe&&Pe.then,Se=xe&&xe.constructor,je=!!Ee,Ae=!1,Ke=Ee?function(){Ee.then(Ze)}:u.setImmediate?setImmediate.bind(null,Ze):u.MutationObserver?function(){var e=document.createElement("div");new MutationObserver((function(){Ze(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(Ze,0)},Ce=function(e,n){Ne.push([e,n]),Te&&(Ke(),Te=!1)},Ie=!0,Te=!0,Be=[],De=[],Re=null,Fe=le,qe={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:jn,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((function(e){try{jn(e[0],e[1])}catch(n){}}))}},Me=qe,Ne=[],Ue=0,Ve=[];function We(e){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=ce,this._lib=!1;var n=this._PSD=Me;if(W&&(this._stackHolder=G(),this._prev=null,this._numPrev=0),"function"!==typeof e){if(e!==ge)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Ge(this,this._value))}this._state=null,this._value=null,++n.ref,Ye(this,e)}var ze={get:function(){var e=Me,n=pn;function t(t,r){var i=this,o=!e.global&&(e!==Me||n!==pn),u=o&&!mn(),a=new We((function(n,a){Qe(i,new Le(En(t,e,o,u),En(r,e,o,u),n,a,e))}));return W&&$e(a,this),a}return t.prototype=ge,t},set:function(e){p(this,"then",e&&e.prototype===ge?ze:{get:function(){return e},set:ze.set})}};function Le(e,n,t,r,i){this.onFulfilled="function"===typeof e?e:null,this.onRejected="function"===typeof n?n:null,this.resolve=t,this.reject=r,this.psd=i}function Ye(e,n){try{n((function(n){if(null===e._state){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var t=e._lib&&en();n&&"function"===typeof n.then?Ye(e,(function(e,t){n instanceof We?n._then(e,t):n.then(e,t)})):(e._state=!0,e._value=n,He(e)),t&&nn()}}),Ge.bind(null,e))}catch(t){Ge(e,t)}}function Ge(e,n){if(De.push(n),null===e._state){var t=e._lib&&en();n=Fe(n),e._state=!1,e._value=n,W&&null!==n&&"object"===typeof n&&!n._promise&&x((function(){var t=v(n,"stack");n._promise=e,p(n,"stack",{get:function(){return Ae?t&&(t.get?t.get.apply(n):t.value):e.stack}})})),on(e),He(e),t&&nn()}}function He(e){var n=e._listeners;e._listeners=[];for(var t=0,r=n.length;t0)for(e=Ne,Ne=[],t=e.length,n=0;n0);Ie=!0,Te=!0}function tn(){var e=Be;Be=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));var n=Ve.slice(0),t=n.length;while(t)n[--t]()}function rn(e){function n(){e(),Ve.splice(Ve.indexOf(n),1)}Ve.push(n),++Ue,Ce((function(){0===--Ue&&tn()}),[])}function on(e){Be.some((function(n){return n._value===e._value}))||Be.push(e)}function un(e){var n=Be.length;while(n)if(Be[--n]._value===e._value)return void Be.splice(n,1)}function an(e){return new We(ge,!1,e)}function sn(e,n){var t=Me;return function(){var r=en(),i=Me;try{return _n(t,!0),e.apply(this,arguments)}catch(o){n&&n(o)}finally{_n(i,!1),r&&nn()}}}f(We.prototype,{then:ze,_then:function(e,n){Qe(this,new Le(null,null,e,n,Me))},catch:function(e){if(1===arguments.length)return this.then(null,e);var n=arguments[0],t=arguments[1];return"function"===typeof n?this.then(null,(function(e){return e instanceof n?t(e):an(e)})):this.then(null,(function(e){return e&&e.name===n?t(e):an(e)}))},finally:function(e){return this.then((function(n){return e(),n}),(function(n){return e(),an(n)}))},stack:{get:function(){if(this._stack)return this._stack;try{Ae=!0;var e=Je(this,[],we),n=e.join("\nFrom previous: ");return null!==this._state&&(this._stack=n),n}finally{Ae=!1}}},timeout:function(e,n){var t=this;return e<1/0?new We((function(r,i){var o=setTimeout((function(){return i(new oe.Timeout(n))}),e);t.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!==typeof Symbol&&Symbol.toStringTag&&p(We.prototype,Symbol.toStringTag,"Dexie.Promise"),qe.env=kn(),f(We,{all:function(){var e=U.apply(null,arguments).map(gn);return new We((function(n,t){0===e.length&&n([]);var r=e.length;e.forEach((function(i,o){return We.resolve(i).then((function(t){e[o]=t,--r||n(e)}),t)}))}))},resolve:function(e){if(e instanceof We)return e;if(e&&"function"===typeof e.then)return new We((function(n,t){e.then(n,t)}));var n=new We(ge,!0,e);return $e(n,Re),n},reject:an,race:function(){var e=U.apply(null,arguments).map(gn);return new We((function(n,t){e.map((function(e){return We.resolve(e).then(n,t)}))}))},PSD:{get:function(){return Me},set:function(e){return Me=e}},totalEchoes:{get:function(){return pn}},newPSD:yn,usePSD:xn,scheduler:{get:function(){return Ce},set:function(e){Ce=e}},rejectionMapper:{get:function(){return Fe},set:function(e){Fe=e}},follow:function(e,n){return new We((function(t,r){return yn((function(n,t){var r=Me;r.unhandleds=[],r.onunhandled=t,r.finalize=he((function(){var e=this;rn((function(){0===e.unhandleds.length?n():t(e.unhandleds[0])}))}),r.finalize),e()}),n,t,r)}))}}),Se&&(Se.allSettled&&p(We,"allSettled",(function(){var e=U.apply(null,arguments).map(gn);return new We((function(n){0===e.length&&n([]);var t=e.length,r=new Array(t);e.forEach((function(e,i){return We.resolve(e).then((function(e){return r[i]={status:"fulfilled",value:e}}),(function(e){return r[i]={status:"rejected",reason:e}})).then((function(){return--t||n(r)}))}))}))})),Se.any&&"undefined"!==typeof AggregateError&&p(We,"any",(function(){var e=U.apply(null,arguments).map(gn);return new We((function(n,t){0===e.length&&t(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return We.resolve(e).then((function(e){return n(e)}),(function(e){i[o]=e,--r||t(new AggregateError(i))}))}))}))})));var cn={awaits:0,echoes:0,id:0},ln=0,fn=[],hn=0,pn=0,dn=0;function yn(e,n,t,r){var i=Me,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++dn;var u=qe.env;o.env=je?{Promise:We,PromiseProp:{value:We,configurable:!0,writable:!0},all:We.all,race:We.race,allSettled:We.allSettled,any:We.any,resolve:We.resolve,reject:We.reject,nthen:On(u.nthen,o),gthen:On(u.gthen,o)}:{},n&&a(o,n),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=xn(o,e,t,r);return 0===o.ref&&o.finalize(),s}function vn(){return cn.id||(cn.id=++ln),++cn.awaits,cn.echoes+=_e,cn.id}function mn(){return!!cn.awaits&&(0===--cn.awaits&&(cn.id=0),cn.echoes=cn.awaits*_e,!0)}function gn(e){return cn.echoes&&e&&e.constructor===Se?(vn(),e.then((function(e){return mn(),e}),(function(e){return mn(),An(e)}))):e}function bn(e){++pn,cn.echoes&&0!==--cn.echoes||(cn.echoes=cn.id=0),fn.push(Me),_n(e,!0)}function wn(){var e=fn[fn.length-1];fn.pop(),_n(e,!1)}function _n(e,n){var t=Me;if((n?!cn.echoes||hn++&&e===Me:!hn||--hn&&e===Me)||Pn(n?bn.bind(null,e):wn),e!==Me&&(Me=e,t===qe&&(qe.env=kn()),je)){var r=qe.env.Promise,i=e.env;Pe.then=i.nthen,r.prototype.then=i.gthen,(t.global||e.global)&&(Object.defineProperty(u,"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 kn(){var e=u.Promise;return je?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(u,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:Pe.then,gthen:e.prototype.then}:{}}function xn(e,n,t,r,i){var o=Me;try{return _n(e,!0),n(t,r,i)}finally{_n(o,!1)}}function Pn(e){Oe.call(xe,e)}function En(e,n,t,r){return"function"!==typeof e?e:function(){var i=Me;t&&vn(),_n(n,!0);try{return e.apply(this,arguments)}finally{_n(i,!1),r&&Pn(mn)}}}function On(e,n){return function(t,r){return e.call(this,En(t,n),En(r,n))}}-1===(""+Oe).indexOf("[native code]")&&(vn=mn=ce);var Sn="unhandledrejection";function jn(e,n){var t;try{t=n.onuncatched(e)}catch(o){}if(!1!==t)try{var r,i={promise:n,reason:e};if(u.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(Sn,!0,!0),a(r,i)):u.CustomEvent&&(r=new CustomEvent(Sn,{detail:i}),a(r,i)),r&&u.dispatchEvent&&(dispatchEvent(r),!u.PromiseRejectionEvent&&u.onunhandledrejection))try{u.onunhandledrejection(r)}catch(s){}W&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch(o){}}var An=We.reject;function Kn(e,n,t,r){if(e._state.openComplete||Me.letThrough){var i=e._createTransaction(n,t,e._dbSchema);try{i.create()}catch(o){return An(o)}return i._promise(n,(function(e,n){return yn((function(){return Me.trans=i,r(e,n,i)}))})).then((function(e){return i._completion.then((function(){return e}))}))}if(!e._state.isBeingOpened){if(!e._options.autoOpen)return An(new oe.DatabaseClosed);e.open().catch(ce)}return e._state.dbReadyPromise.then((function(){return Kn(e,n,t,r)}))}var Cn="3.0.3",In=String.fromCharCode(65535),Tn=-1/0,Bn="Invalid key provided. Keys must be of type string, number, Date or Array.",Dn="String expected.",Rn=[],Fn="undefined"!==typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),qn=Fn,Mn=Fn,Nn=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Un="__dbnames",Vn="readonly",Wn="readwrite";function zn(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}var Ln={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Yn(e){return function(n){return void 0===P(n,e)&&(n=T(n),O(n,e)),n}}var Gn=function(){function e(){}return e.prototype._trans=function(e,n,t){var r=this._tx||Me.trans,i=this.name;function o(e,t,r){if(!r.schema[i])throw new oe.NotFound("Table "+i+" not part of transaction");return n(r.idbtrans,r)}var u=en();try{return r&&r.db===this.db?r===Me.trans?r._promise(e,o,t):yn((function(){return r._promise(e,o,t)}),{trans:r,transless:Me.transless||Me}):Kn(this.db,e,[this.name],o)}finally{u&&nn()}},e.prototype.get=function(e,n){var t=this;return e&&e.constructor===Object?this.where(e).first(n):this._trans("readonly",(function(n){return t.core.get({trans:n,key:e}).then((function(e){return t.hook.reading.fire(e)}))})).then(n)},e.prototype.where=function(e){if("string"===typeof e)return new this.db.WhereClause(this,e);if(o(e))return new this.db.WhereClause(this,"["+e.join("+")+"]");var n=i(e);if(1===n.length)return this.where(n[0]).equals(e[n[0]]);var t=this.schema.indexes.concat(this.schema.primKey).filter((function(e){return e.compound&&n.every((function(n){return e.keyPath.indexOf(n)>=0}))&&e.keyPath.every((function(e){return n.indexOf(e)>=0}))}))[0];if(t&&this.db._maxKey!==In)return this.where(t.name).equals(t.keyPath.map((function(n){return e[n]})));!t&&W&&console.warn("The query "+JSON.stringify(e)+" on "+this.name+" would benefit of a compound index ["+n.join("+")+"]");var r=this.schema.idxByName,u=this.db._deps.indexedDB;function a(e,n){try{return 0===u.cmp(e,n)}catch(t){return!1}}var s=n.reduce((function(n,t){var i=n[0],u=n[1],s=r[t],c=e[t];return[i||s,i||!s?zn(u,s&&s.multi?function(e){var n=P(e,t);return o(n)&&n.some((function(e){return a(c,e)}))}:function(e){return a(c,P(e,t))}):u]}),[null,null]),c=s[0],l=s[1];return c?this.where(c.name).equals(e[c.keyPath]).filter(l):t?this.filter(l):this.where(n).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,o(e)?"["+e.join("+")+"]":e))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(e){this.schema.mappedClass=e;var n=function(n){if(!n)return n;var t=Object.create(e.prototype);for(var r in n)if(l(n,r))try{t[r]=n[r]}catch(i){}return t};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),e},e.prototype.defineClass=function(){function e(e){a(this,e)}return this.mapToClass(e)},e.prototype.add=function(e,n){var t=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,u=e;return o&&i&&(u=Yn(o)(e)),this._trans("readwrite",(function(e){return t.core.mutate({trans:e,type:"add",keys:null!=n?[n]:null,values:[u]})})).then((function(e){return e.numFailures?We.reject(e.failures[0]):e.lastResult})).then((function(n){if(o)try{E(e,o,n)}catch(t){}return n}))},e.prototype.update=function(e,n){if("object"!==typeof n||o(n))throw new oe.InvalidArgument("Modifications must be an object.");if("object"!==typeof e||o(e))return this.where(":id").equals(e).modify(n);i(n).forEach((function(t){E(e,t,n[t])}));var t=P(e,this.schema.primKey.keyPath);return void 0===t?An(new oe.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(t).modify(n)},e.prototype.put=function(e,n){var t=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,u=e;return o&&i&&(u=Yn(o)(e)),this._trans("readwrite",(function(e){return t.core.mutate({trans:e,type:"put",values:[u],keys:null!=n?[n]:null})})).then((function(e){return e.numFailures?We.reject(e.failures[0]):e.lastResult})).then((function(n){if(o)try{E(e,o,n)}catch(t){}return n}))},e.prototype.delete=function(e){var n=this;return this._trans("readwrite",(function(t){return n.core.mutate({trans:t,type:"delete",keys:[e]})})).then((function(e){return e.numFailures?We.reject(e.failures[0]):void 0}))},e.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(n){return e.core.mutate({trans:n,type:"deleteRange",range:Ln})})).then((function(e){return e.numFailures?We.reject(e.failures[0]):void 0}))},e.prototype.bulkGet=function(e){var n=this;return this._trans("readonly",(function(t){return n.core.getMany({keys:e,trans:t}).then((function(e){return e.map((function(e){return n.hook.reading.fire(e)}))}))}))},e.prototype.bulkAdd=function(e,n,t){var r=this,i=Array.isArray(n)?n:void 0;t=t||(i?void 0:n);var o=t?t.allKeys:void 0;return this._trans("readwrite",(function(n){var t=r.schema.primKey,u=t.auto,a=t.keyPath;if(a&&i)throw new oe.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new oe.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=a&&u?e.map(Yn(a)):e;return r.core.mutate({trans:n,type:"add",keys:i,values:c,wantResults:o}).then((function(e){var n=e.numFailures,t=e.results,i=e.lastResult,u=e.failures,a=o?t:i;if(0===n)return a;throw new te(r.name+".bulkAdd(): "+n+" of "+s+" operations failed",Object.keys(u).map((function(e){return u[e]})))}))}))},e.prototype.bulkPut=function(e,n,t){var r=this,i=Array.isArray(n)?n:void 0;t=t||(i?void 0:n);var o=t?t.allKeys:void 0;return this._trans("readwrite",(function(n){var t=r.schema.primKey,u=t.auto,a=t.keyPath;if(a&&i)throw new oe.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new oe.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=a&&u?e.map(Yn(a)):e;return r.core.mutate({trans:n,type:"put",keys:i,values:c,wantResults:o}).then((function(e){var n=e.numFailures,t=e.results,i=e.lastResult,u=e.failures,a=o?t:i;if(0===n)return a;throw new te(r.name+".bulkPut(): "+n+" of "+s+" operations failed",Object.keys(u).map((function(e){return u[e]})))}))}))},e.prototype.bulkDelete=function(e){var n=this,t=e.length;return this._trans("readwrite",(function(t){return n.core.mutate({trans:t,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,i=e.lastResult,o=e.failures;if(0===r)return i;throw new te(n.name+".bulkDelete(): "+r+" of "+t+" operations failed",o)}))},e}();function Hn(e){var n={},t=function(t,r){if(r){var i=arguments.length,o=new Array(i-1);while(--i)o[i-1]=arguments[i];return n[t].subscribe.apply(null,o),e}if("string"===typeof t)return n[t]};t.addEventType=a;for(var r=1,u=arguments.length;rr?u:0}return this.toArray((function(e){return e.sort(a)})).then(n)},e.prototype.toArray=function(e){var n=this;return this._read((function(e){var t=n._ctx;if("next"===t.dir&&Jn(t,!0)&&t.limit>0){var r=t.valueMapper,i=nt(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:i,range:t.range}}).then((function(e){var n=e.result;return r?n.map(r):n}))}var o=[];return rt(t,(function(e){return o.push(e)}),e,t.table.core).then((function(){return o}))}),e)},e.prototype.offset=function(e){var n=this._ctx;return e<=0||(n.offset+=e,Jn(n)?Zn(n,(function(){var n=e;return function(e,t){return 0===n||(1===n?(--n,!1):(t((function(){e.advance(n),n=0})),!1))}})):Zn(n,(function(){var n=e;return function(){return--n<0}}))),this},e.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Zn(this._ctx,(function(){var n=e;return function(e,t,r){return--n<=0&&t(r),n>=0}}),!0),this},e.prototype.until=function(e,n){return $n(this._ctx,(function(t,r,i){return!e(t.value)||(r(i),n)})),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){return $n(this._ctx,(function(n){return e(n.value)})),et(this._ctx,e),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 n=this._ctx;return n.keysOnly=!n.isMatch,this.each((function(n,t){e(t.key,t)}))},e.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},e.prototype.eachPrimaryKey=function(e){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each((function(n,t){e(t.primaryKey,t)}))},e.prototype.keys=function(e){var n=this._ctx;n.keysOnly=!n.isMatch;var t=[];return this.each((function(e,n){t.push(n.key)})).then((function(){return t})).then(e)},e.prototype.primaryKeys=function(e){var n=this._ctx;if("next"===n.dir&&Jn(n,!0)&&n.limit>0)return this._read((function(e){var t=nt(n,n.table.core.schema);return n.table.core.query({trans:e,values:!1,limit:n.limit,query:{index:t,range:n.range}})})).then((function(e){var n=e.result;return n})).then(e);n.keysOnly=!n.isMatch;var t=[];return this.each((function(e,n){t.push(n.primaryKey)})).then((function(){return t})).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,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var t={};return $n(this._ctx,(function(e){var n=e.primaryKey.toString(),r=l(t,n);return t[n]=!0,!r})),this},e.prototype.modify=function(e){var n=this,t=this._ctx;return this._write((function(r){var o;if("function"===typeof e)o=e;else{var u=i(e),a=u.length;o=function(n){for(var t=!1,r=0;r0&&s.mutate({trans:r,type:"add",values:a}).then((function(e){for(var n in e.failures)y.splice(parseInt(n),1);m(a.length,e)}))).then((function(e){return c.length>0&&s.mutate({trans:r,type:"put",keys:d,values:c}).then((function(e){return m(c.length,e)}))})).then((function(){return y.length>0&&s.mutate({trans:r,type:"delete",keys:y}).then((function(e){return m(y.length,e)}))})).then((function(){return e.length>t+i&&n(t+h)}))}))};return n(0).then((function(){if(d.length>0)throw new ne("Error modifying one or more objects",d,y,v);return e.length}))}))}))},e.prototype.delete=function(){var e=this._ctx,n=e.range;return Jn(e)&&(e.isPrimKey&&!Mn||3===n.type)?this._write((function(t){var r=e.table.core.schema.primaryKey,i=n;return e.table.core.count({trans:t,query:{index:r,range:i}}).then((function(n){return e.table.core.mutate({trans:t,type:"deleteRange",range:i}).then((function(e){var t=e.failures,r=(e.lastResult,e.results,e.numFailures);if(r)throw new ne("Could not delete some values",Object.keys(t).map((function(e){return t[e]})),n-r);return n-r}))}))})):this.modify((function(e,n){return n.value=null}))},e}();function ut(e){return Qn(ot.prototype,(function(n,t){this.db=e;var r=Ln,i=null;if(t)try{r=t()}catch(s){i=s}var o=n._ctx,u=o.table,a=u.hook.reading.fire;this._ctx={table:u,index:o.index,isPrimKey:!o.index||u.schema.primKey.keyPath&&o.index===u.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:i,or:o.or,valueMapper:a!==le?a:null}}))}function at(e,n){return en?-1:e===n?0:1}function ct(e,n,t){var r=e instanceof mt?new e.Collection(e):e;return r._ctx.error=t?new t(n):new TypeError(n),r}function lt(e){return new e.Collection(e,(function(){return vt("")})).limit(0)}function ft(e){return"next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}function ht(e){return"next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}function pt(e,n,t,r,i,o){for(var u=Math.min(e.length,r.length),a=-1,s=0;s=0?e.substr(0,a)+n[a]+t.substr(a+1):null;i(e[s],c)<0&&(a=s)}return u0)&&(p=v)}return t(null!==p?function(){e.continue(p+l)}:r),!1})),p}function yt(e,n,t,r){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:r}}function vt(e){return{type:1,lower:e,upper:e}}var mt=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,n,t,r){t=!1!==t,r=!0===r;try{return this._cmp(e,n)>0||0===this._cmp(e,n)&&(t||r)&&(!t||!r)?lt(this):new this.Collection(this,(function(){return yt(e,n,!t,!r)}))}catch(i){return ct(this,Bn)}},e.prototype.equals=function(e){return null==e?ct(this,Bn):new this.Collection(this,(function(){return vt(e)}))},e.prototype.above=function(e){return null==e?ct(this,Bn):new this.Collection(this,(function(){return yt(e,void 0,!0)}))},e.prototype.aboveOrEqual=function(e){return null==e?ct(this,Bn):new this.Collection(this,(function(){return yt(e,void 0,!1)}))},e.prototype.below=function(e){return null==e?ct(this,Bn):new this.Collection(this,(function(){return yt(void 0,e,!1,!0)}))},e.prototype.belowOrEqual=function(e){return null==e?ct(this,Bn):new this.Collection(this,(function(){return yt(void 0,e)}))},e.prototype.startsWith=function(e){return"string"!==typeof e?ct(this,Dn):this.between(e,e+In,!0,!0)},e.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):dt(this,(function(e,n){return 0===e.indexOf(n[0])}),[e],In)},e.prototype.equalsIgnoreCase=function(e){return dt(this,(function(e,n){return e===n[0]}),[e],"")},e.prototype.anyOfIgnoreCase=function(){var e=U.apply(N,arguments);return 0===e.length?lt(this):dt(this,(function(e,n){return-1!==n.indexOf(e)}),e,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=U.apply(N,arguments);return 0===e.length?lt(this):dt(this,(function(e,n){return n.some((function(n){return 0===e.indexOf(n)}))}),e,In)},e.prototype.anyOf=function(){var e=this,n=U.apply(N,arguments),t=this._cmp;try{n.sort(t)}catch(o){return ct(this,Bn)}if(0===n.length)return lt(this);var r=new this.Collection(this,(function(){return yt(n[0],n[n.length-1])}));r._ondirectionchange=function(r){t="next"===r?e._ascending:e._descending,n.sort(t)};var i=0;return r._addAlgorithm((function(e,r,o){var u=e.key;while(t(u,n[i])>0)if(++i,i===n.length)return r(o),!1;return 0===t(u,n[i])||(r((function(){e.continue(n[i])})),!1)})),r},e.prototype.notEqual=function(e){return this.inAnyRange([[Tn,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var e=U.apply(N,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(t){return ct(this,Bn)}var n=e.reduce((function(e,n){return e?e.concat([[e[e.length-1][1],n]]):[[Tn,n]]}),null);return n.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(e,n){var t=this,r=this._cmp,i=this._ascending,o=this._descending,u=this._min,a=this._max;if(0===e.length)return lt(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return ct(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",oe.InvalidArgument);var s=!n||!1!==n.includeLowers,c=n&&!0===n.includeUppers;function l(e,n){for(var t=0,i=e.length;t0){o[0]=u(o[0],n[0]),o[1]=a(o[1],n[1]);break}}return t===i&&e.push(n),e}var f,h=i;function p(e,n){return h(e[0],n[0])}try{f=e.reduce(l,[]),f.sort(p)}catch(w){return ct(this,Bn)}var d=0,y=c?function(e){return i(e,f[d][1])>0}:function(e){return i(e,f[d][1])>=0},v=s?function(e){return o(e,f[d][0])>0}:function(e){return o(e,f[d][0])>=0};function m(e){return!y(e)&&!v(e)}var g=y,b=new this.Collection(this,(function(){return yt(f[0][0],f[f.length-1][1],!s,!c)}));return b._ondirectionchange=function(e){"next"===e?(g=y,h=i):(g=v,h=o),f.sort(p)},b._addAlgorithm((function(e,n,r){var o=e.key;while(g(o))if(++d,d===f.length)return n(r),!1;return!!m(o)||(0===t._cmp(o,f[d][1])||0===t._cmp(o,f[d][0])||n((function(){h===i?e.continue(f[d][0]):e.continue(f[d][1])})),!1)})),b},e.prototype.startsWithAnyOf=function(){var e=U.apply(N,arguments);return e.every((function(e){return"string"===typeof e}))?0===e.length?lt(this):this.inAnyRange(e.map((function(e){return[e,e+In]}))):ct(this,"startsWithAnyOf() only works with strings")},e}();function gt(e){return Qn(mt.prototype,(function(n,t,r){this.db=e,this._ctx={table:n,index:":id"===t?null:t,or:r};var i=e._deps.indexedDB;if(!i)throw new oe.MissingAPI("indexedDB API missing");this._cmp=this._ascending=i.cmp.bind(i),this._descending=function(e,n){return i.cmp(n,e)},this._max=function(e,n){return i.cmp(e,n)>0?e:n},this._min=function(e,n){return i.cmp(e,n)<0?e:n},this._IDBKeyRange=e._deps.IDBKeyRange}))}function bt(e){return 1===e.length?e[0]:e}function wt(e){try{return e.only([[]]),[[]]}catch(n){return In}}function _t(e){return sn((function(n){return kt(n),e(n.target.error),!1}))}function kt(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var xt=function(){function e(){}return e.prototype._lock=function(){return w(!Me.global),++this._reculock,1!==this._reculock||Me.global||(Me.lockOwnerFor=this),this},e.prototype._unlock=function(){if(w(!Me.global),0===--this._reculock){Me.global||(Me.lockOwnerFor=null);while(this._blockedFuncs.length>0&&!this._locked()){var e=this._blockedFuncs.shift();try{xn(e[1],e[0])}catch(n){}}}return this},e.prototype._locked=function(){return this._reculock&&Me.lockOwnerFor!==this},e.prototype.create=function(e){var n=this;if(!this.mode)return this;var t=this.db.idbdb,r=this.db._state.dbOpenError;if(w(!this.idbtrans),!e&&!t)switch(r&&r.name){case"DatabaseClosedError":throw new oe.DatabaseClosed(r);case"MissingAPIError":throw new oe.MissingAPI(r.message,r);default:throw new oe.OpenFailed(r)}if(!this.active)throw new oe.TransactionInactive;return w(null===this._completion._state),e=this.idbtrans=e||t.transaction(bt(this.storeNames),this.mode),e.onerror=sn((function(t){kt(t),n._reject(e.error)})),e.onabort=sn((function(t){kt(t),n.active&&n._reject(new oe.Abort(e.error)),n.active=!1,n.on("abort").fire(t)})),e.oncomplete=sn((function(){n.active=!1,n._resolve()})),this},e.prototype._promise=function(e,n,t){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return An(new oe.ReadOnly("Transaction is readonly"));if(!this.active)return An(new oe.TransactionInactive);if(this._locked())return new We((function(i,o){r._blockedFuncs.push([function(){r._promise(e,n,t).then(i,o)},Me])}));if(t)return yn((function(){var e=new We((function(e,t){r._lock();var i=n(e,t,r);i&&i.then&&i.then(e,t)}));return e.finally((function(){return r._unlock()})),e._lib=!0,e}));var i=new We((function(e,t){var i=n(e,t,r);i&&i.then&&i.then(e,t)}));return i._lib=!0,i},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(e){var n=this._root(),t=We.resolve(e);if(n._waitingFor)n._waitingFor=n._waitingFor.then((function(){return t}));else{n._waitingFor=t,n._waitingQueue=[];var r=n.idbtrans.objectStore(n.storeNames[0]);(function e(){++n._spinCount;while(n._waitingQueue.length)n._waitingQueue.shift()();n._waitingFor&&(r.get(-1/0).onsuccess=e)})()}var i=n._waitingFor;return new We((function(e,r){t.then((function(t){return n._waitingQueue.push(sn(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(sn(r.bind(null,e)))})).finally((function(){n._waitingFor===i&&(n._waitingFor=null)}))}))},e.prototype.abort=function(){this.active&&this._reject(new oe.Abort),this.active=!1},e.prototype.table=function(e){var n=this._memoizedTables||(this._memoizedTables={});if(l(n,e))return n[e];var t=this.schema[e];if(!t)throw new oe.NotFound("Table "+e+" not part of transaction");var r=new this.db.Table(e,t,this);return r.core=this.db.core.table(e),n[e]=r,r},e}();function Pt(e){return Qn(xt.prototype,(function(n,t,r,i){var o=this;this.db=e,this.mode=n,this.storeNames=t,this.schema=r,this.idbtrans=null,this.on=Hn(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new We((function(e,n){o._resolve=e,o._reject=n})),this._completion.then((function(){o.active=!1,o.on.complete.fire()}),(function(e){var n=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):n&&o.idbtrans&&o.idbtrans.abort(),An(e)}))}))}function Et(e,n,t,r,i,o,u){return{name:e,keyPath:n,unique:t,multi:r,auto:i,compound:o,src:(t&&!u?"&":"")+(r?"*":"")+(i?"++":"")+Ot(n)}}function Ot(e){return"string"===typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function St(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:k(t,(function(e){return[e.name,e]}))}}function jt(e){return null==e?function(){}:"string"===typeof e?At(e):function(n){return P(n,e)}}function At(e){var n=e.split(".");return 1===n.length?function(n){return n[e]}:function(n){return P(n,e)}}function Kt(e,n){return"delete"===n.type?n.keys:n.keys||n.values.map(e.extractKey)}function Ct(e,n,t){return"add"===n.type?Promise.resolve(new Array(n.values.length)):e.getMany({trans:n.trans,keys:t})}function It(e){return[].slice.call(e)}var Tt=0;function Bt(e){return null==e?":id":"string"===typeof e?e:"["+e.join("+")+"]"}function Dt(e,n,t,i){var u=n.cmp.bind(n);function a(e,n){var t=It(e.objectStoreNames);return{schema:{name:e.name,tables:t.map((function(e){return n.objectStore(e)})).map((function(e){var n=e.keyPath,t=e.autoIncrement,r=o(n),i=null==n,u={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:n,autoIncrement:t,unique:!0,extractKey:jt(n)},indexes:It(e.indexNames).map((function(n){return e.index(n)})).map((function(e){var n=e.name,t=e.unique,r=e.multiEntry,i=e.keyPath,a=o(i),s={name:n,compound:a,keyPath:i,unique:t,multiEntry:r,extractKey:jt(i)};return u[Bt(i)]=s,s})),getIndexByKeyPath:function(e){return u[Bt(e)]}};return u[":id"]=a.primaryKey,null!=n&&(u[Bt(n)]=a.primaryKey),a}))},hasGetAll:t.length>0&&"getAll"in n.objectStore(t[0])&&!("undefined"!==typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen,o=e.upperOpen,u=void 0===n?void 0===r?null:t.upperBound(r,!!o):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!o);return u}function c(e){var n=e.name;function t(t){var i=t.trans,o=t.type,u=t.keys,a=t.values,c=t.range,l=t.wantResults;return new Promise((function(t,f){t=sn(t);var h=i.objectStore(n),p=null==h.keyPath,d="put"===o||"add"===o;if(!d&&"delete"!==o&&"deleteRange"!==o)throw new Error("Invalid operation type: "+o);var y=(u||a||{length:1}).length;if(u&&a&&u.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===y)return t({numFailures:0,failures:{},results:[],lastResult:void 0});var v,m=l&&r(u||Kt(e.primaryKey,{type:o,keys:u,values:a})),g=[],b=0,w=function(e){++b,kt(e),m&&(m[e.target._reqno]=void 0),g[e.target._reqno]=e.target.error},_=function(e){var n=e.target;m[n._reqno]=n.result};if("deleteRange"===o){if(4===c.type)return t({numFailures:b,failures:g,results:m,lastResult:void 0});v=3===c.type?h.clear():h.delete(s(c))}else{var k=d?p?[a,u]:[a,null]:[u,null],x=k[0],P=k[1];if(d)for(var E=0;E=n}));function l(){return o.length?We.resolve(o.shift()(t.idbtrans)).then(l):We.resolve()}return c.forEach((function(u){o.push((function(){var o=a,c=u._cfg.dbschema;$t(e,o,r),$t(e,c,r),a=e._dbSchema=c;var l=zt(o,c);l.add.forEach((function(e){Lt(r,e[0],e[1].primKey,e[1].indexes)})),l.change.forEach((function(e){if(e.recreate)throw new oe.Upgrade("Not yet support for changing primary key");var n=r.objectStore(e.name);e.add.forEach((function(e){return Ht(n,e)})),e.change.forEach((function(e){n.deleteIndex(e.name),Ht(n,e)})),e.del.forEach((function(e){return n.deleteIndex(e)}))}));var f=u._cfg.contentUpgrade;if(f&&u._cfg.version>n){qt(e,r),t._memoizedTables={},s=!0;var h=S(c);l.del.forEach((function(e){h[e]=o[e]})),Nt(e,[e.Transaction.prototype]),Mt(e,[e.Transaction.prototype],i(h),h),t.schema=h;var p,d=V(f);d&&vn();var y=We.follow((function(){if(p=f(t),p&&d){var e=mn.bind(null,null);p.then(e,e)}}));return p&&"function"===typeof p.then?We.resolve(p):y.then((function(){return p}))}})),o.push((function(n){if(!s||!qn){var r=u._cfg.dbschema;Gt(r,n)}Nt(e,[e.Transaction.prototype]),Mt(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),t.schema=e._dbSchema}))})),l().then((function(){Yt(a,r)}))}function zt(e,n){var t,r={del:[],add:[],change:[]};for(t in e)n[t]||r.del.push(t);for(t in n){var i=e[t],o=n[t];if(i){var u={name:t,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!==""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!Fn)u.recreate=!0,r.change.push(u);else{var a=i.idxByName,s=o.idxByName,c=void 0;for(c in a)s[c]||u.del.push(c);for(c in s){var l=a[c],f=s[c];l?l.src!==f.src&&u.change.push(f):u.add.push(f)}(u.del.length>0||u.add.length>0||u.change.length>0)&&r.change.push(u)}}else r.add.push([t,o])}return r}function Lt(e,n,t,r){var i=e.db.createObjectStore(n,t.keyPath?{keyPath:t.keyPath,autoIncrement:t.auto}:{autoIncrement:t.auto});return r.forEach((function(e){return Ht(i,e)})),i}function Yt(e,n){i(e).forEach((function(t){n.db.objectStoreNames.contains(t)||Lt(n,t,e[t].primKey,e[t].indexes)}))}function Gt(e,n){for(var t=0;tMath.pow(2,62)?0:r.oldVersion;e.idbdb=a.result,Vt(e,c/10,i,o)}}),o),a.onsuccess=sn((function(){i=null;var t=e.idbdb=a.result,o=g(t.objectStoreNames);if(o.length>0)try{var s=t.transaction(bt(o),"readonly");n.autoSchema?Xt(e,t,s):($t(e,e._dbSchema,s),Jt(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),qt(e,s)}catch(c){}Rn.push(e),t.onversionchange=sn((function(t){n.vcFired=!0,e.on("versionchange").fire(t)})),er.add(u),r()}),o)}))]).then((function(){return n.onReadyBeingFired=[],We.resolve(or(e.on.ready.fire)).then((function e(){if(n.onReadyBeingFired.length>0){var t=n.onReadyBeingFired.reduce(me,ce);return n.onReadyBeingFired=[],We.resolve(or(t)).then(e)}}))})).finally((function(){n.onReadyBeingFired=null})).then((function(){return n.isBeingOpened=!1,e})).catch((function(t){try{i&&i.abort()}catch(r){}return n.isBeingOpened=!1,e.close(),n.dbOpenError=t,An(n.dbOpenError)})).finally((function(){n.openComplete=!0,r()}))}function ar(e){var n=function(n){return e.next(n)},t=function(n){return e.throw(n)},r=u(n),i=u(t);function u(e){return function(n){var t=e(n),u=t.value;return t.done?u:u&&"function"===typeof u.then?u.then(r,i):o(u)?Promise.all(u).then(r,i):r(u)}}return u(n)()}function sr(e,n,t){var r=arguments.length;if(r<2)throw new oe.InvalidArgument("Too few arguments");var i=new Array(r-1);while(--r)i[r-1]=arguments[r];t=i.pop();var o=A(i);return[e,o,t]}function cr(e,n,t,r,i){return We.resolve().then((function(){var o=Me.transless||Me,u=e._createTransaction(n,t,e._dbSchema,r),a={trans:u,transless:o};r?u.idbtrans=r.idbtrans:u.create();var s,c=V(i);c&&vn();var l=We.follow((function(){if(s=i.call(u,u),s)if(c){var e=mn.bind(null,null);s.then(e,e)}else"function"===typeof s.next&&"function"===typeof s.throw&&(s=ar(s))}),a);return(s&&"function"===typeof s.then?We.resolve(s).then((function(e){return u.active?e:An(new oe.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),An(e)}))}))}function lr(e,n,t){for(var r=o(e)?e.slice():[e],i=0;i0,f=t(t({},r),{isVirtual:l,isPrimaryKey:!l&&r.isPrimaryKey,keyTail:n,keyLength:c,extractKey:jt(e),unique:!l&&r.unique});if(s.push(f),f.isPrimaryKey||u.push(f),c>1){var h=2===c?e[0]:e.slice(0,c-1);a(h,n+1,r)}return s.sort((function(e,n){return e.keyTail-n.keyTail})),f}var s=a(i.primaryKey.keyPath,0,i.primaryKey);o[":id"]=[s];for(var c=0,l=i.indexes;c0?Promise.reject(i.failures[0]):o.length0?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&&Rn.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(t){}this.idbdb=null}this._options.autoOpen=!1,n.dbOpenError=new oe.DatabaseClosed,n.isBeingOpened&&n.cancelOpen(n.dbOpenError),n.dbReadyPromise=new We((function(e){n.dbReadyResolve=e})),n.openCanceller=new We((function(e,t){n.cancelOpen=t}))},e.prototype.delete=function(){var e=this,n=arguments.length>0,t=this._state;return new We((function(r,i){var o=function(){e.close();var n=e._deps.indexedDB.deleteDatabase(e.name);n.onsuccess=sn((function(){er.remove(e.name),r()})),n.onerror=_t(i),n.onblocked=e._fireOnBlocked};if(n)throw new oe.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.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 i(this._allTables).map((function(n){return e._allTables[n]}))},enumerable:!0,configurable:!0}),e.prototype.transaction=function(){var e=sr.apply(this,arguments);return this._transaction.apply(this,e)},e.prototype._transaction=function(e,n,t){var r=this,i=Me.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,u,a=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(u=n.map((function(e){var n=e instanceof r.Table?e.name:e;if("string"!==typeof n)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return n})),"r"==e||e===Vn)o=Vn;else{if("rw"!=e&&e!=Wn)throw new oe.InvalidArgument("Invalid transaction mode: "+e);o=Wn}if(i){if(i.mode===Vn&&o===Wn){if(!a)throw new oe.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 oe.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,n){n(c)})):An(c)}var s=cr.bind(null,this,o,u,i,t);return i?i._promise(o,s,"lock"):Me.trans?xn(Me.transless,(function(){return r._whenReady(s)})):this._whenReady(s)},e.prototype.table=function(e){if(!l(this._allTables,e))throw new oe.InvalidTable("Table "+e+" does not exist");return this._allTables[e]},e}(),yr=dr;f(yr,t(t({},se),{delete:function(e){var n=new yr(e);return n.delete()},exists:function(e){return new yr(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){return er?er.getDatabaseNames().then(e):We.resolve([])},defineClass:function(){function e(e){a(this,e)}return e},ignoreTransaction:function(e){return Me.trans?xn(Me.transless,e):e()},vip:or,async:function(e){return function(){try{var n=ar(e.apply(this,arguments));return n&&"function"===typeof n.then?n:We.resolve(n)}catch(t){return An(t)}}},spawn:function(e,n,t){try{var r=ar(e.apply(t,n||[]));return r&&"function"===typeof r.then?r:We.resolve(r)}catch(i){return An(i)}},currentTransaction:{get:function(){return Me.trans||null}},waitFor:function(e,n){var t=We.resolve("function"===typeof e?yr.ignoreTransaction(e):e).timeout(n||6e4);return Me.trans?Me.trans.waitFor(t):t},Promise:We,debug:{get:function(){return W},set:function(e){z(e,"dexie"===e?function(){return!0}:Nn)}},derive:d,extend:a,props:f,override:b,Events:Hn,getByKeyPath:P,setByKeyPath:E,delByKeyPath:O,shallowClone:S,deepClone:T,getObjectDiff:F,asap:_,minKey:Tn,addons:[],connections:Rn,errnames:re,dependencies:function(){try{return{indexedDB:u.indexedDB||u.mozIndexedDB||u.webkitIndexedDB||u.msIndexedDB,IDBKeyRange:u.IDBKeyRange||u.webkitIDBKeyRange}}catch(e){return{indexedDB:null,IDBKeyRange:null}}}(),semVer:Cn,version:Cn.split(".").map((function(e){return parseInt(e)})).reduce((function(e,n,t){return e+n/Math.pow(10,2*t)})),default:yr,Dexie:yr})),yr.maxKey=wt(yr.dependencies.IDBKeyRange),ir(dr.dependencies.indexedDB),We.rejectionMapper=ae,z(W,Nn),n["a"]=dr}).call(this,t("c8ba"))}}]);