(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["third_vendors_003dex~app"],{"4dec":function(e,t,n){"use strict";(function(e){var n=function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0)t=e;else for(var i in t=e.constructor?Object.create(e.constructor.prototype):{},e)l(e,i)&&(t[i]=T(e[i]));return t}var B={}.toString;function D(e){return B.call(e).slice(8,-1)}var R=function(e,t){return"Array"===t?""+e.map((function(e){return R(e,D(e))})):"ArrayBuffer"===t?""+new Uint8Array(e):"Date"===t?e.getTime():ArrayBuffer.isView(e)?""+new Uint8Array(e.buffer):e};function F(e,t,n,r){return n=n||{},r=r||"",i(e).forEach((function(i){if(l(t,i)){var o=e[i],u=t[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)&&(n[r+i]=t[i]):F(o,u,n,r+i+"."):n[r+i]=t[i]}else o!==u&&(n[r+i]=t[i])}else n[r+i]=void 0})),i(t).forEach((function(i){l(e,i)||(n[r+i]=t[i])})),n}var q="undefined"!==typeof Symbol&&Symbol.iterator,M=q?function(e){var t;return null!=e&&(t=e[q])&&t.apply(e)}:function(){return null},N={};function U(e){var t,n,r,i;if(1===arguments.length){if(o(e))return e.slice();if(this===N&&"string"===typeof e)return[e];if(i=M(e)){n=[];while(r=i.next(),!r.done)n.push(r.value);return n}if(null==e)return[e];if(t=e.length,"number"===typeof t){n=new Array(t);while(t--)n[t]=e[t];return n}return[e]}t=arguments.length,n=new Array(t);while(t--)n[t]=arguments[t];return n}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,t){W=e,L=t}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,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(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,t){this._e=G(),this.name=e,this.message=t}function ee(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 te(e,t,n,r){this._e=G(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=ee(e,t)}function ne(e,t){this._e=G(),this.name="BulkError",this.failures=t,this.message=ee(e,t)}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(te).from(Z),d(ne).from(Z);var re=J.reduce((function(e,t){return e[t]=t+"Error",e}),{}),ie=Z,oe=J.reduce((function(e,t){var n=t+"Error";function r(e,r){this._e=G(),this.name=n,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=$[t]||n,this.inner=null)}return d(r).from(ie),e[t]=r,e}),{});oe.Syntax=SyntaxError,oe.Type=TypeError,oe.Range=RangeError;var ue=X.reduce((function(e,t){return e[t+"Error"]=oe[t],e}),{});function ae(e,t){if(!e||e instanceof Z||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ue[e.name])return e;var n=new ue[e.name](t||e.message,e);return"stack"in e&&p(n,"stack",{get:function(){return this.inner.stack}}),n}var se=J.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=oe[t]),e}),{});function ce(){}function le(e){return e}function fe(e,t){return null==e||e===le?t:function(n){return t(e(n))}}function he(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function pe(e,t){return e===ce?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?he(r,this.onsuccess):r),i&&(this.onerror=this.onerror?he(i,this.onerror):i),void 0!==o?o:n}}function de(e,t){return e===ce?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?he(n,this.onsuccess):n),r&&(this.onerror=this.onerror?he(r,this.onerror):r)}}function ye(e,t){return e===ce?t:function(n){var r=e.apply(this,arguments);a(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?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,t){return e===ce?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function me(e,t){return e===ce?t:function(){var n=e.apply(this,arguments);if(n&&"function"===typeof n.then){var r=this,i=arguments.length,o=new Array(i);while(i--)o[i]=arguments[i];return n.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}se.ModifyError=te,se.DexieError=Z,se.BulkError=ne;var ge={},be=100,_e=20,we=100,ke="undefined"===typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"===typeof crypto||!crypto.subtle)return[e,e.__proto__,e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,t.__proto__,e]}(),xe=ke[0],Pe=ke[1],Ee=ke[2],Oe=Pe&&Pe.then,Ke=xe&&xe.constructor,je=!!Ee,Ae=!1,Se=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,t){Ne.push([e,t]),Te&&(Se(),Te=!1)},Ie=!0,Te=!0,Be=[],De=[],Re=null,Fe=le,qe={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Kt,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((function(e){try{Kt(e[0],e[1])}catch(t){}}))}},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 t=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,++t.ref,Ye(this,e)}var ze={get:function(){var e=Me,t=ht;function n(n,r){var i=this,o=!e.global&&(e!==Me||t!==ht),u=o&&!vt(),a=new We((function(t,a){Qe(i,new Le(Pt(n,e,o,u),Pt(r,e,o,u),t,a,e))}));return W&&$e(a,this),a}return n.prototype=ge,n},set:function(e){p(this,"then",e&&e.prototype===ge?ze:{get:function(){return e},set:ze.set})}};function Le(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 Ye(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&&et();t&&"function"===typeof t.then?Ye(e,(function(e,n){t instanceof We?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,He(e)),n&&tt()}}),Ge.bind(null,e))}catch(n){Ge(e,n)}}function Ge(e,t){if(De.push(t),null===e._state){var n=e._lib&&et();t=Fe(t),e._state=!1,e._value=t,W&&null!==t&&"object"===typeof t&&!t._promise&&x((function(){var n=v(t,"stack");t._promise=e,p(t,"stack",{get:function(){return Ae?n&&(n.get?n.get.apply(t):n.value):e.stack}})})),it(e),He(e),n&&tt()}}function He(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n0)for(e=Ne,Ne=[],n=e.length,t=0;t0);Ie=!0,Te=!0}function nt(){var e=Be;Be=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));var t=Ve.slice(0),n=t.length;while(n)t[--n]()}function rt(e){function t(){e(),Ve.splice(Ve.indexOf(t),1)}Ve.push(t),++Ue,Ce((function(){0===--Ue&&nt()}),[])}function it(e){Be.some((function(t){return t._value===e._value}))||Be.push(e)}function ot(e){var t=Be.length;while(t)if(Be[--t]._value===e._value)return void Be.splice(t,1)}function ut(e){return new We(ge,!1,e)}function at(e,t){var n=Me;return function(){var r=et(),i=Me;try{return _t(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{_t(i,!1),r&&tt()}}}f(We.prototype,{then:ze,_then:function(e,t){Qe(this,new Le(null,null,e,t,Me))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"===typeof t?this.then(null,(function(e){return e instanceof t?n(e):ut(e)})):this.then(null,(function(e){return e&&e.name===t?n(e):ut(e)}))},finally:function(e){return this.then((function(t){return e(),t}),(function(t){return e(),ut(t)}))},stack:{get:function(){if(this._stack)return this._stack;try{Ae=!0;var e=Je(this,[],_e),t=e.join("\nFrom previous: ");return null!==this._state&&(this._stack=t),t}finally{Ae=!1}}},timeout:function(e,t){var n=this;return e<1/0?new We((function(r,i){var o=setTimeout((function(){return i(new oe.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!==typeof Symbol&&Symbol.toStringTag&&p(We.prototype,Symbol.toStringTag,"Dexie.Promise"),qe.env=wt(),f(We,{all:function(){var e=U.apply(null,arguments).map(mt);return new We((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return We.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){if(e instanceof We)return e;if(e&&"function"===typeof e.then)return new We((function(t,n){e.then(t,n)}));var t=new We(ge,!0,e);return $e(t,Re),t},reject:ut,race:function(){var e=U.apply(null,arguments).map(mt);return new We((function(t,n){e.map((function(e){return We.resolve(e).then(t,n)}))}))},PSD:{get:function(){return Me},set:function(e){return Me=e}},totalEchoes:{get:function(){return ht}},newPSD:dt,usePSD:kt,scheduler:{get:function(){return Ce},set:function(e){Ce=e}},rejectionMapper:{get:function(){return Fe},set:function(e){Fe=e}},follow:function(e,t){return new We((function(n,r){return dt((function(t,n){var r=Me;r.unhandleds=[],r.onunhandled=n,r.finalize=he((function(){var e=this;rt((function(){0===e.unhandleds.length?t():n(e.unhandleds[0])}))}),r.finalize),e()}),t,n,r)}))}}),Ke&&(Ke.allSettled&&p(We,"allSettled",(function(){var e=U.apply(null,arguments).map(mt);return new We((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);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--n||t(r)}))}))}))})),Ke.any&&"undefined"!==typeof AggregateError&&p(We,"any",(function(){var e=U.apply(null,arguments).map(mt);return new We((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return We.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})));var st={awaits:0,echoes:0,id:0},ct=0,lt=[],ft=0,ht=0,pt=0;function dt(e,t,n,r){var i=Me,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++pt;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:Et(u.nthen,o),gthen:Et(u.gthen,o)}:{},t&&a(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=kt(o,e,n,r);return 0===o.ref&&o.finalize(),s}function yt(){return st.id||(st.id=++ct),++st.awaits,st.echoes+=we,st.id}function vt(){return!!st.awaits&&(0===--st.awaits&&(st.id=0),st.echoes=st.awaits*we,!0)}function mt(e){return st.echoes&&e&&e.constructor===Ke?(yt(),e.then((function(e){return vt(),e}),(function(e){return vt(),jt(e)}))):e}function gt(e){++ht,st.echoes&&0!==--st.echoes||(st.echoes=st.id=0),lt.push(Me),_t(e,!0)}function bt(){var e=lt[lt.length-1];lt.pop(),_t(e,!1)}function _t(e,t){var n=Me;if((t?!st.echoes||ft++&&e===Me:!ft||--ft&&e===Me)||xt(t?gt.bind(null,e):bt),e!==Me&&(Me=e,n===qe&&(qe.env=wt()),je)){var r=qe.env.Promise,i=e.env;Pe.then=i.nthen,r.prototype.then=i.gthen,(n.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 wt(){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 kt(e,t,n,r,i){var o=Me;try{return _t(e,!0),t(n,r,i)}finally{_t(o,!1)}}function xt(e){Oe.call(xe,e)}function Pt(e,t,n,r){return"function"!==typeof e?e:function(){var i=Me;n&&yt(),_t(t,!0);try{return e.apply(this,arguments)}finally{_t(i,!1),r&&xt(vt)}}}function Et(e,t){return function(n,r){return e.call(this,Pt(n,t),Pt(r,t))}}-1===(""+Oe).indexOf("[native code]")&&(yt=vt=ce);var Ot="unhandledrejection";function Kt(e,t){var n;try{n=t.onuncatched(e)}catch(o){}if(!1!==n)try{var r,i={promise:t,reason:e};if(u.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(Ot,!0,!0),a(r,i)):u.CustomEvent&&(r=new CustomEvent(Ot,{detail:i}),a(r,i)),r&&u.dispatchEvent&&(dispatchEvent(r),!u.PromiseRejectionEvent&&u.onunhandledrejection))try{u.onunhandledrejection(r)}catch(s){}W&&r&&r.defaultPrevented}catch(o){}}var jt=We.reject;function At(e,t,n,r){if(e._state.openComplete||Me.letThrough){var i=e._createTransaction(t,n,e._dbSchema);try{i.create()}catch(o){return jt(o)}return i._promise(t,(function(e,t){return dt((function(){return Me.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 jt(new oe.DatabaseClosed);e.open().catch(ce)}return e._state.dbReadyPromise.then((function(){return At(e,t,n,r)}))}var St="3.0.3",Ct=String.fromCharCode(65535),It=-1/0,Tt="Invalid key provided. Keys must be of type string, number, Date or Array.",Bt="String expected.",Dt=[],Rt="undefined"!==typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Ft=Rt,qt=Rt,Mt=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Nt="__dbnames",Ut="readonly",Vt="readwrite";function Wt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var zt={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Lt(e){return function(t){return void 0===P(t,e)&&(t=T(t),O(t,e)),t}}var Yt=function(){function e(){}return e.prototype._trans=function(e,t,n){var r=this._tx||Me.trans,i=this.name;function o(e,n,r){if(!r.schema[i])throw new oe.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=et();try{return r&&r.db===this.db?r===Me.trans?r._promise(e,o,n):dt((function(){return r._promise(e,o,n)}),{trans:r,transless:Me.transless||Me}):At(this.db,e,[this.name],o)}finally{u&&tt()}},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(o(e))return new this.db.WhereClause(this,"["+e.join("+")+"]");var t=i(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!==Ct)return this.where(n.name).equals(n.keyPath.map((function(t){return e[t]})));var r=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 i=t[0],u=t[1],s=r[n],c=e[n];return[i||s,i||!s?Wt(u,s&&s.multi?function(e){var t=P(e,n);return o(t)&&t.some((function(e){return a(c,e)}))}:function(e){return a(c,P(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,o(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(l(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(){function e(e){a(this,e)}return this.mapToClass(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=Lt(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?We.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{E(e,o,t)}catch(n){}return t}))},e.prototype.update=function(e,t){if("object"!==typeof t||o(t))throw new oe.InvalidArgument("Modifications must be an object.");if("object"!==typeof e||o(e))return this.where(":id").equals(e).modify(t);i(t).forEach((function(n){E(e,n,t[n])}));var n=P(e,this.schema.primKey.keyPath);return void 0===n?jt(new oe.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=Lt(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?We.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{E(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?We.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:zt})})).then((function(e){return e.numFailures?We.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;n=n||(i?void 0:t);var o=n?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 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(Lt(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,a=o?n:i;if(0===t)return a;throw new ne(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;n=n||(i?void 0:t);var o=n?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 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(Lt(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,a=o?n:i;if(0===t)return a;throw new ne(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 ne(t.name+".bulkDelete(): "+r+" of "+n+" operations failed",o)}))},e}();function Gt(e){var t={},n=function(n,r){if(r){var i=arguments.length,o=new Array(i-1);while(--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 r=1,u=arguments.length;rr?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&&Xt(n,!0)&&n.limit>0){var r=n.valueMapper,i=en(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 nn(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,Xt(t)?$t(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?(--t,!1):(n((function(){e.advance(t),t=0})),!1))}})):$t(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),$t(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 Jt(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){return Jt(this._ctx,(function(t){return e(t.value)})),Zt(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 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&&Xt(t,!0)&&t.limit>0)return this._read((function(e){var n=en(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){var t=e.result;return t})).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 Jt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=l(n,t);return n[t]=!0,!r})),this},e.prototype.modify=function(e){var t=this,n=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(t){for(var n=!1,r=0;r0&&s.mutate({trans:r,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: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>n+i&&t(n+h)}))}))};return t(0).then((function(){if(d.length>0)throw new te("Error modifying one or more objects",d,y,v);return e.length}))}))}))},e.prototype.delete=function(){var e=this._ctx,t=e.range;return Xt(e)&&(e.isPrimKey&&!qt||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,r=(e.lastResult,e.results,e.numFailures);if(r)throw new te("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}();function un(e){return Ht(on.prototype,(function(t,n){this.db=e;var r=zt,i=null;if(n)try{r=n()}catch(s){i=s}var o=t._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 an(e,t){return et?-1:e===t?0:1}function cn(e,t,n){var r=e instanceof mn?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 vn("")})).limit(0)}function fn(e){return"next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}function hn(e){return"next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}function pn(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 yn(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function vn(e){return{type:1,lower:e,upper:e}}var mn=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 yn(e,t,!n,!r)}))}catch(i){return cn(this,Tt)}},e.prototype.equals=function(e){return null==e?cn(this,Tt):new this.Collection(this,(function(){return vn(e)}))},e.prototype.above=function(e){return null==e?cn(this,Tt):new this.Collection(this,(function(){return yn(e,void 0,!0)}))},e.prototype.aboveOrEqual=function(e){return null==e?cn(this,Tt):new this.Collection(this,(function(){return yn(e,void 0,!1)}))},e.prototype.below=function(e){return null==e?cn(this,Tt):new this.Collection(this,(function(){return yn(void 0,e,!1,!0)}))},e.prototype.belowOrEqual=function(e){return null==e?cn(this,Tt):new this.Collection(this,(function(){return yn(void 0,e)}))},e.prototype.startsWith=function(e){return"string"!==typeof e?cn(this,Bt):this.between(e,e+Ct,!0,!0)},e.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):dn(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],Ct)},e.prototype.equalsIgnoreCase=function(e){return dn(this,(function(e,t){return e===t[0]}),[e],"")},e.prototype.anyOfIgnoreCase=function(){var e=U.apply(N,arguments);return 0===e.length?ln(this):dn(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=U.apply(N,arguments);return 0===e.length?ln(this):dn(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,Ct)},e.prototype.anyOf=function(){var e=this,t=U.apply(N,arguments),n=this._cmp;try{t.sort(n)}catch(o){return cn(this,Tt)}if(0===t.length)return ln(this);var r=new this.Collection(this,(function(){return yn(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){var u=e.key;while(n(u,t[i])>0)if(++i,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([[It,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(n){return cn(this,Tt)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[It,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",oe.InvalidArgument);var s=!t||!1!==t.includeLowers,c=t&&!0===t.includeUppers;function l(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}var f,h=i;function p(e,t){return h(e[0],t[0])}try{f=e.reduce(l,[]),f.sort(p)}catch(_){return cn(this,Tt)}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 yn(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,t,r){var o=e.key;while(g(o))if(++d,d===f.length)return t(r),!1;return!!m(o)||(0===n._cmp(o,f[d][1])||0===n._cmp(o,f[d][0])||t((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?ln(this):this.inAnyRange(e.map((function(e){return[e,e+Ct]}))):cn(this,"startsWithAnyOf() only works with strings")},e}();function gn(e){return Ht(mn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,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,t){return i.cmp(t,e)},this._max=function(e,t){return i.cmp(e,t)>0?e:t},this._min=function(e,t){return i.cmp(e,t)<0?e:t},this._IDBKeyRange=e._deps.IDBKeyRange}))}function bn(e){return 1===e.length?e[0]:e}function _n(e){try{return e.only([[]]),[[]]}catch(t){return Ct}}function wn(e){return at((function(t){return kn(t),e(t.target.error),!1}))}function kn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var xn=function(){function e(){}return e.prototype._lock=function(){return _(!Me.global),++this._reculock,1!==this._reculock||Me.global||(Me.lockOwnerFor=this),this},e.prototype._unlock=function(){if(_(!Me.global),0===--this._reculock){Me.global||(Me.lockOwnerFor=null);while(this._blockedFuncs.length>0&&!this._locked()){var e=this._blockedFuncs.shift();try{kt(e[1],e[0])}catch(t){}}}return this},e.prototype._locked=function(){return this._reculock&&Me.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(_(!this.idbtrans),!e&&!n)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 _(null===this._completion._state),e=this.idbtrans=e||n.transaction(bn(this.storeNames),this.mode),e.onerror=at((function(n){kn(n),t._reject(e.error)})),e.onabort=at((function(n){kn(n),t.active&&t._reject(new oe.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=at((function(){t.active=!1,t._resolve()})),this},e.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return jt(new oe.ReadOnly("Transaction is readonly"));if(!this.active)return jt(new oe.TransactionInactive);if(this._locked())return new We((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},Me])}));if(n)return dt((function(){var e=new We((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 We((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=We.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(){++t._spinCount;while(t._waitingQueue.length)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)})()}var i=t._waitingFor;return new We((function(e,r){n.then((function(n){return t._waitingQueue.push(at(e.bind(null,n)))}),(function(e){return t._waitingQueue.push(at(r.bind(null,e)))})).finally((function(){t._waitingFor===i&&(t._waitingFor=null)}))}))},e.prototype.abort=function(){this.active&&this._reject(new oe.Abort),this.active=!1},e.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(l(t,e))return t[e];var n=this.schema[e];if(!n)throw new oe.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}();function Pn(e){return Ht(xn.prototype,(function(t,n,r,i){var o=this;this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.idbtrans=null,this.on=Gt(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,t){o._resolve=e,o._reject=t})),this._completion.then((function(){o.active=!1,o.on.complete.fire()}),(function(e){var t=o.active;return o.active=!1,o.on.error.fire(e),o.parent?o.parent._reject(e):t&&o.idbtrans&&o.idbtrans.abort(),jt(e)}))}))}function En(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?"++":"")+On(t)}}function On(e){return"string"===typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function Kn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:k(n,(function(e){return[e.name,e]}))}}function jn(e){return null==e?function(){}:"string"===typeof e?An(e):function(t){return P(t,e)}}function An(e){var t=e.split(".");return 1===t.length?function(t){return t[e]}:function(t){return P(t,e)}}function Sn(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}function Cn(e,t,n){return"add"===t.type?Promise.resolve(new Array(t.values.length)):e.getMany({trans:t.trans,keys:n})}function In(e){return[].slice.call(e)}var Tn=0;function Bn(e){return null==e?":id":"string"===typeof e?e:"["+e.join("+")+"]"}function Dn(e,t,n,i){var u=t.cmp.bind(t);function a(e,t){var n=In(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=o(t),i=null==t,u={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:jn(t)},indexes:In(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry,i=e.keyPath,a=o(i),s={name:t,compound:a,keyPath:i,unique:n,multiEntry:r,extractKey:jn(i)};return u[Bn(i)]=s,s})),getIndexByKeyPath:function(e){return u[Bn(e)]}};return u[":id"]=a.primaryKey,null!=t&&(u[Bn(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)}}function s(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,u=void 0===t?void 0===r?null:n.upperBound(r,!!o):void 0===r?n.lowerBound(t,!!i):n.bound(t,r,!!i,!!o);return u}function c(e){var t=e.name;function n(n){var i=n.trans,o=n.type,u=n.keys,a=n.values,c=n.range,l=n.wantResults;return new Promise((function(n,f){n=at(n);var h=i.objectStore(t),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 n({numFailures:0,failures:{},results:[],lastResult:void 0});var v,m=l&&r(u||Sn(e.primaryKey,{type:o,keys:u,values:a})),g=[],b=0,_=function(e){++b,kn(e),m&&(m[e.target._reqno]=void 0),g[e.target._reqno]=e.target.error},w=function(e){var t=e.target;m[t._reqno]=t.result};if("deleteRange"===o){if(4===c.type)return n({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=t}));function l(){return o.length?We.resolve(o.shift()(n.idbtrans)).then(l):We.resolve()}return c.forEach((function(u){o.push((function(){var o=a,c=u._cfg.dbschema;$n(e,o,r),$n(e,c,r),a=e._dbSchema=c;var l=zn(o,c);l.add.forEach((function(e){Ln(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 t=r.objectStore(e.name);e.add.forEach((function(e){return Hn(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),Hn(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var f=u._cfg.contentUpgrade;if(f&&u._cfg.version>t){qn(e,r),n._memoizedTables={},s=!0;var h=K(c);l.del.forEach((function(e){h[e]=o[e]})),Nn(e,[e.Transaction.prototype]),Mn(e,[e.Transaction.prototype],i(h),h),n.schema=h;var p,d=V(f);d&&yt();var y=We.follow((function(){if(p=f(n),p&&d){var e=vt.bind(null,null);p.then(e,e)}}));return p&&"function"===typeof p.then?We.resolve(p):y.then((function(){return p}))}})),o.push((function(t){if(!s||!Ft){var r=u._cfg.dbschema;Gn(r,t)}Nn(e,[e.Transaction.prototype]),Mn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema}))})),l().then((function(){Yn(a,r)}))}function zn(e,t){var n,r={del:[],add:[],change:[]};for(n in e)t[n]||r.del.push(n);for(n in t){var i=e[n],o=t[n];if(i){var u={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!==""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!Rt)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([n,o])}return r}function Ln(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 Hn(i,e)})),i}function Yn(e,t){i(e).forEach((function(n){t.db.objectStoreNames.contains(n)||Ln(t,n,e[n].primKey,e[n].indexes)}))}function Gn(e,t){for(var n=0;nMath.pow(2,62)?0:r.oldVersion;e.idbdb=a.result,Vn(e,c/10,i,o)}}),o),a.onsuccess=at((function(){i=null;var n=e.idbdb=a.result,o=g(n.objectStoreNames);if(o.length>0)try{var s=n.transaction(bn(o),"readonly");t.autoSchema?Xn(e,n,s):($n(e,e._dbSchema,s),Jn(e,s)),qn(e,s)}catch(c){}Dt.push(e),n.onversionchange=at((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),er.add(u),r()}),o)}))]).then((function(){return t.onReadyBeingFired=[],We.resolve(or(e.on.ready.fire)).then((function e(){if(t.onReadyBeingFired.length>0){var n=t.onReadyBeingFired.reduce(me,ce);return t.onReadyBeingFired=[],We.resolve(or(n)).then(e)}}))})).finally((function(){t.onReadyBeingFired=null})).then((function(){return t.isBeingOpened=!1,e})).catch((function(n){try{i&&i.abort()}catch(r){}return t.isBeingOpened=!1,e.close(),t.dbOpenError=n,jt(t.dbOpenError)})).finally((function(){t.openComplete=!0,r()}))}function ar(e){var t=function(t){return e.next(t)},n=function(t){return e.throw(t)},r=u(t),i=u(n);function u(e){return function(t){var n=e(t),u=n.value;return n.done?u:u&&"function"===typeof u.then?u.then(r,i):o(u)?Promise.all(u).then(r,i):r(u)}}return u(t)()}function sr(e,t,n){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];n=i.pop();var o=A(i);return[e,o,n]}function cr(e,t,n,r,i){return We.resolve().then((function(){var o=Me.transless||Me,u=e._createTransaction(t,n,e._dbSchema,r),a={trans:u,transless:o};r?u.idbtrans=r.idbtrans:u.create();var s,c=V(i);c&&yt();var l=We.follow((function(){if(s=i.call(u,u),s)if(c){var e=vt.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:jt(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),jt(e)}))}))}function lr(e,t,n){for(var r=o(e)?e.slice():[e],i=0;i0,f=n(n({},r),{isVirtual:l,isPrimaryKey:!l&&r.isPrimaryKey,keyTail:t,keyLength:c,extractKey:jn(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,t+1,r)}return 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;c0?Promise.reject(i.failures[0]):o.length=0&&Dt.splice(e,1),this.idbdb){try{this.idbdb.close()}catch(n){}this.idbdb=null}this._options.autoOpen=!1,t.dbOpenError=new oe.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError),t.dbReadyPromise=new We((function(e){t.dbReadyResolve=e})),t.openCanceller=new We((function(e,n){t.cancelOpen=n}))},e.prototype.delete=function(){var e=this,t=arguments.length>0,n=this._state;return new We((function(r,i){var o=function(){e.close();var t=e._deps.indexedDB.deleteDatabase(e.name);t.onsuccess=at((function(){er.remove(e.name),r()})),t.onerror=wn(i),t.onblocked=e._fireOnBlocked};if(t)throw new oe.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 i(this._allTables).map((function(t){return e._allTables[t]}))},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,t,n){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=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===Ut)o=Ut;else{if("rw"!=e&&e!=Vt)throw new oe.InvalidArgument("Invalid transaction mode: "+e);o=Vt}if(i){if(i.mode===Ut&&o===Vt){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,t){t(c)})):jt(c)}var s=cr.bind(null,this,o,u,i,n);return i?i._promise(o,s,"lock"):Me.trans?kt(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,n(n({},se),{delete:function(e){var t=new yr(e);return t.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?kt(Me.transless,e):e()},vip:or,async:function(e){return function(){try{var t=ar(e.apply(this,arguments));return t&&"function"===typeof t.then?t:We.resolve(t)}catch(n){return jt(n)}}},spawn:function(e,t,n){try{var r=ar(e.apply(n,t||[]));return r&&"function"===typeof r.then?r:We.resolve(r)}catch(i){return jt(i)}},currentTransaction:{get:function(){return Me.trans||null}},waitFor:function(e,t){var n=We.resolve("function"===typeof e?yr.ignoreTransaction(e):e).timeout(t||6e4);return Me.trans?Me.trans.waitFor(n):n},Promise:We,debug:{get:function(){return W},set:function(e){z(e,"dexie"===e?function(){return!0}:Mt)}},derive:d,extend:a,props:f,override:b,Events:Gt,getByKeyPath:P,setByKeyPath:E,delByKeyPath:O,shallowClone:K,deepClone:T,getObjectDiff:F,asap:w,minKey:It,addons:[],connections:Dt,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:St,version:St.split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)})),default:yr,Dexie:yr})),yr.maxKey=_n(yr.dependencies.IDBKeyRange),ir(dr.dependencies.indexedDB),We.rejectionMapper=ae,z(W,Mt),t["a"]=dr}).call(this,n("c8ba"))}}]);