File size: 93,422 Bytes
7c89823 |
1 |
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[635],{53185:function(e,t,n){var r;r=function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)},t=function(){return(t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function r(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,o=Object.keys,a=Array.isArray;function u(e,t){return"object"!=typeof t||o(t).forEach(function(n){e[n]=t[n]}),e}"undefined"==typeof Promise||i.Promise||(i.Promise=Promise);var s=Object.getPrototypeOf,c={}.hasOwnProperty;function l(e,t){return c.call(e,t)}function f(e,t){"function"==typeof t&&(t=t(s(e))),("undefined"==typeof Reflect?o:Reflect.ownKeys)(t).forEach(function(n){d(e,n,t[n])})}var h=Object.defineProperty;function d(e,t,n,r){h(e,t,u(n&&l(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function p(e){return{from:function(t){return e.prototype=Object.create(t.prototype),d(e.prototype,"constructor",e),{extend:f.bind(null,e.prototype)}}}}var y=Object.getOwnPropertyDescriptor,v=[].slice;function m(e,t,n){return v.call(e,t,n)}function b(e,t){return t(e)}function g(e){if(!e)throw Error("Assertion Failed")}function w(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function _(e,t){if("string"==typeof t&&l(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,i=t.length;r<i;++r){var o=_(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(-1!==a){var u=e[t.substr(0,a)];return null==u?void 0:_(u,t.substr(a+1))}}function x(e,t,n){if(e&&void 0!==t&&!("isFrozen"in Object&&Object.isFrozen(e))){if("string"!=typeof t&&"length"in t){g("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)x(e,t[r],n[r])}else{var o,u,s=t.indexOf(".");-1!==s?(o=t.substr(0,s),""===(u=t.substr(s+1))?void 0===n?a(e)&&!isNaN(parseInt(o))?e.splice(o,1):delete e[o]:e[o]=n:x(s=(s=e[o])&&l(e,o)?s:e[o]={},u,n)):void 0===n?a(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}}function k(e){var t,n={};for(t in e)l(e,t)&&(n[t]=e[t]);return n}var O=[].concat;function P(e){return O.apply([],e)}var E="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(P([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return i[e]}),K=new Set(E.map(function(e){return i[e]})),S=null;function j(e){return S=new WeakMap,e=function e(t){if(!t||"object"!=typeof t)return t;var n=S.get(t);if(n)return n;if(a(t)){n=[],S.set(t,n);for(var r=0,i=t.length;r<i;++r)n.push(e(t[r]))}else if(K.has(t.constructor))n=t;else{var o,u=s(t);for(o in n=u===Object.prototype?{}:Object.create(u),S.set(t,n),t)l(t,o)&&(n[o]=e(t[o]))}return n}(e),S=null,e}var C={}.toString;function A(e){return C.call(e).slice(8,-1)}var D="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",T="symbol"==typeof D?function(e){var t;return null!=e&&(t=e[D])&&t.apply(e)}:function(){return null};function q(e,t){return 0<=(t=e.indexOf(t))&&e.splice(t,1),0<=t}var I={};function B(e){var t,n,r,i;if(1==arguments.length){if(a(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=T(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e||"number"!=typeof(t=e.length))return[e];for(n=Array(t);t--;)n[t]=e[t];return n}for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}var R="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},N=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],F=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(N),M={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function L(e,t){this.name=e,this.message=t}function U(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 V(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=U(e,t)}function z(e,t){this.name="BulkError",this.failures=Object.keys(t).map(function(e){return t[e]}),this.failuresByPos=t,this.message=U(e,this.failures)}p(L).from(Error).extend({toString:function(){return this.name+": "+this.message}}),p(V).from(L),p(z).from(L);var W=F.reduce(function(e,t){return e[t]=t+"Error",e},{}),$=F.reduce(function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=M[t]||n,this.inner=null)}return p(r).from(L),e[t]=r,e},{});$.Syntax=SyntaxError,$.Type=TypeError,$.Range=RangeError;var Y=N.reduce(function(e,t){return e[t+"Error"]=$[t],e},{}),Q=F.reduce(function(e,t){return -1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=$[t]),e},{});function G(){}function X(e){return e}function H(e,t){return null==e||e===X?t:function(n){return t(e(n))}}function J(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Z(e,t){return e===G?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?J(r,this.onsuccess):r),i&&(this.onerror=this.onerror?J(i,this.onerror):i),void 0!==o?o:n}}function ee(e,t){return e===G?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?J(n,this.onsuccess):n),r&&(this.onerror=this.onerror?J(r,this.onerror):r)}}function et(e,t){return e===G?t:function(n){var r=e.apply(this,arguments);u(n,r);var i=this.onsuccess,o=this.onerror;return this.onsuccess=null,this.onerror=null,n=t.apply(this,arguments),i&&(this.onsuccess=this.onsuccess?J(i,this.onsuccess):i),o&&(this.onerror=this.onerror?J(o,this.onerror):o),void 0===r?void 0===n?void 0:n:u(r,n)}}function en(e,t){return e===G?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function er(e,t){return e===G?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=Array(i);i--;)o[i]=arguments[i];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}Q.ModifyError=V,Q.DexieError=L,Q.BulkError=z;var ei="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),eo={},E="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,s(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,s(t),e]}(),N=E[0],F=E[1],E=E[2],F=F&&F.then,ea=N&&N.constructor,eu=!!E,es=function(e,t){ev.push([e,t]),el&&(queueMicrotask(eE),el=!1)},ec=!0,el=!0,ef=[],eh=[],ed=X,ep={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:G,pgp:!1,env:{},finalize:G},ey=ep,ev=[],em=0,eb=[];function eg(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ey;if("function"!=typeof e){if(e!==eo)throw TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&ex(this,this._value))}this._state=null,this._value=null,++t.ref,function e(t,n){try{n(function(n){if(null===t._state){if(n===t)throw TypeError("A promise cannot be resolved with itself.");var r=t._lib&&eK();n&&"function"==typeof n.then?e(t,function(e,t){n instanceof eg?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,ek(t)),r&&eS()}},ex.bind(null,t))}catch(e){ex(t,e)}}(this,e)}var ew={get:function(){var e=ey,t=eB;function n(n,r){var i=this,o=!e.global&&(e!==ey||t!==eB),a=o&&!eM(),u=new eg(function(t,u){eO(i,new e_(e$(n,e,o,a),e$(r,e,o,a),t,u,e))});return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=eo,n},set:function(e){d(this,"then",e&&e.prototype===eo?ew:{get:function(){return e},set:ew.set})}};function e_(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 ex(e,t){var n;eh.push(t),null===e._state&&(n=e._lib&&eK(),t=ed(t),e._state=!1,e._value=t,ef.some(function(t){return t._value===e._value})||ef.push(e),ek(e),n&&eS())}function ek(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)eO(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===em&&(++em,es(function(){0==--em&&ej()},[]))}function eO(e,t){if(null!==e._state){var n=e._state?t.onFulfilled:t.onRejected;if(null===n)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++em,es(eP,[n,e,t])}else e._listeners.push(t)}function eP(e,t,n){try{var r,i=t._value;!t._state&&eh.length&&(eh=[]),r=ei&&t._consoleTask?t._consoleTask.run(function(){return e(i)}):e(i),t._state||-1!==eh.indexOf(i)||function(e){for(var t=ef.length;t;)if(ef[--t]._value===e._value)return ef.splice(t,1)}(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--em&&ej(),--n.psd.ref||n.psd.finalize()}}function eE(){eW(ep,function(){eK()&&eS()})}function eK(){var e=ec;return el=ec=!1,e}function eS(){var e,t,n;do for(;0<ev.length;)for(e=ev,ev=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(0<ev.length);el=ec=!0}function ej(){var e=ef;ef=[],e.forEach(function(e){e._PSD.onunhandled.call(null,e._value,e)});for(var t=eb.slice(0),n=t.length;n;)t[--n]()}function eC(e){return new eg(eo,!1,e)}function eA(e,t){var n=ey;return function(){var r=eK(),i=ey;try{return eV(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{eV(i,!1),r&&eS()}}}f(eg.prototype,{then:ew,_then:function(e,t){eO(this,new e_(null,null,e,t,ey))},catch:function(e){if(1==arguments.length)return this.then(null,e);var t=arguments[1];return"function"==typeof e?this.then(null,function(n){return(n instanceof e?t:eC)(n)}):this.then(null,function(n){return(n&&n.name===e?t:eC)(n)})},finally:function(e){return this.then(function(t){return eg.resolve(e()).then(function(){return t})},function(t){return eg.resolve(e()).then(function(){return eC(t)})})},timeout:function(e,t){var n=this;return e<1/0?new eg(function(r,i){var o=setTimeout(function(){return i(new $.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&d(eg.prototype,Symbol.toStringTag,"Dexie.Promise"),ep.env=ez(),f(eg,{all:function(){var e=B.apply(null,arguments).map(eL);return new eg(function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(function(i,o){return eg.resolve(i).then(function(n){e[o]=n,--r||t(e)},n)})})},resolve:function(e){return e instanceof eg?e:e&&"function"==typeof e.then?new eg(function(t,n){e.then(t,n)}):new eg(eo,!0,e)},reject:eC,race:function(){var e=B.apply(null,arguments).map(eL);return new eg(function(t,n){e.map(function(e){return eg.resolve(e).then(t,n)})})},PSD:{get:function(){return ey},set:function(e){return ey=e}},totalEchoes:{get:function(){return eB}},newPSD:eN,usePSD:eW,scheduler:{get:function(){return es},set:function(e){es=e}},rejectionMapper:{get:function(){return ed},set:function(e){ed=e}},follow:function(e,t){return new eg(function(n,r){return eN(function(t,n){var r=ey;r.unhandleds=[],r.onunhandled=n,r.finalize=J(function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},eb.push(function t(){e(),eb.splice(eb.indexOf(t),1)}),++em,es(function(){0==--em&&ej()},[])},r.finalize),e()},t,n,r)})}}),ea&&(ea.allSettled&&d(eg,"allSettled",function(){var e=B.apply(null,arguments).map(eL);return new eg(function(t){0===e.length&&t([]);var n=e.length,r=Array(n);e.forEach(function(e,i){return eg.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)})})})}),ea.any&&"undefined"!=typeof AggregateError&&d(eg,"any",function(){var e=B.apply(null,arguments).map(eL);return new eg(function(t,n){0===e.length&&n(AggregateError([]));var r=e.length,i=Array(r);e.forEach(function(e,o){return eg.resolve(e).then(function(e){return t(e)},function(e){i[o]=e,--r||n(AggregateError(i))})})})}));var eD={awaits:0,echoes:0,id:0},eT=0,eq=[],eI=0,eB=0,eR=0;function eN(e,t,n,r){var i=ey,o=Object.create(i);return o.parent=i,o.ref=0,o.global=!1,o.id=++eR,ep.env,o.env=eu?{Promise:eg,PromiseProp:{value:eg,configurable:!0,writable:!0},all:eg.all,race:eg.race,allSettled:eg.allSettled,any:eg.any,resolve:eg.resolve,reject:eg.reject}:{},t&&u(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()},r=eW(o,e,n,r),0===o.ref&&o.finalize(),r}function eF(){return eD.id||(eD.id=++eT),++eD.awaits,eD.echoes+=100,eD.id}function eM(){return!!eD.awaits&&(0==--eD.awaits&&(eD.id=0),eD.echoes=100*eD.awaits,!0)}function eL(e){return eD.echoes&&e&&e.constructor===ea?(eF(),e.then(function(e){return eM(),e},function(e){return eM(),eQ(e)})):e}function eU(){var e=eq[eq.length-1];eq.pop(),eV(e,!1)}function eV(e,t){var n,r=ey;(t?!eD.echoes||eI++&&e===ey:!eI||--eI&&e===ey)||queueMicrotask(t?(function(e){++eB,eD.echoes&&0!=--eD.echoes||(eD.echoes=eD.awaits=eD.id=0),eq.push(ey),eV(e,!0)}).bind(null,e):eU),e!==ey&&(ey=e,r===ep&&(ep.env=ez()),eu&&(n=ep.env.Promise,t=e.env,(r.global||e.global)&&(Object.defineProperty(i,"Promise",t.PromiseProp),n.all=t.all,n.race=t.race,n.resolve=t.resolve,n.reject=t.reject,t.allSettled&&(n.allSettled=t.allSettled),t.any&&(n.any=t.any))))}function ez(){var e=i.Promise;return eu?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(i,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function eW(e,t,n,r,i){var o=ey;try{return eV(e,!0),t(n,r,i)}finally{eV(o,!1)}}function e$(e,t,n,r){return"function"!=typeof e?e:function(){var i=ey;n&&eF(),eV(t,!0);try{return e.apply(this,arguments)}finally{eV(i,!1),r&&queueMicrotask(eM)}}}function eY(e){Promise===ea&&0===eD.echoes?0===eI?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+F).indexOf("[native code]")&&(eF=eM=G);var eQ=eg.reject,eG=String.fromCharCode(65535),eX="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",eH="String expected.",eJ=[],eZ="__dbnames",e0="readonly",e1="readwrite";function e3(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var e2={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function e8(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=j(t))[e],t}}function e4(){throw $.Type()}function e5(e,t){try{var n=e6(e),r=e6(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return t<e?1:e<t?-1:0;case"binary":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}(e9(e),e9(t));case"Array":return function(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=e5(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function e6(e){var t=typeof e;return"object"!=t?t:ArrayBuffer.isView(e)?"binary":"ArrayBuffer"===(e=A(e))?"binary":e}function e9(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var e7=(te.prototype._trans=function(e,t,n){var r=this._tx||ey.trans,i=this.name,o=ei&&"undefined"!=typeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function a(e,n,r){if(!r.schema[i])throw new $.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=eK();try{var s=r&&r.db._novip===this.db._novip?r===ey.trans?r._promise(e,a,n):eN(function(){return r._promise(e,a,n)},{trans:r,transless:ey.transless||ey}):function e(t,n,r,i){if(t.idbdb&&(t._state.openComplete||ey.letThrough||t._vip)){var o=t._createTransaction(n,r,t._dbSchema);try{o.create(),t._state.PR1398_maxLoop=3}catch(o){return o.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then(function(){return e(t,n,r,i)})):eQ(o)}return o._promise(n,function(e,t){return eN(function(){return ey.trans=o,i(e,t,o)})}).then(function(e){if("readwrite"===n)try{o.idbtrans.commit()}catch(e){}return"readonly"===n?e:o._completion.then(function(){return e})})}if(t._state.openComplete)return eQ(new $.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return eQ(new $.DatabaseClosed);t.open().catch(G)}return t._state.dbReadyPromise.then(function(){return e(t,n,r,i)})}(this.db,e,[this.name],a);return o&&(s._consoleTask=o,s=s.catch(function(e){return console.trace(e),eQ(e)})),s}finally{u&&eS()}},te.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?eQ(new $.Type("Invalid argument to Table.get()")):this._trans("readonly",function(t){return n.core.get({trans:t,key:e}).then(function(e){return n.hook.reading.fire(e)})}).then(t)},te.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=o(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){if(e.compound&&t.every(function(t){return 0<=e.keyPath.indexOf(t)})){for(var n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1}).sort(function(e,t){return e.keyPath.length-t.keyPath.length})[0];if(n&&this.db._maxKey!==eG){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map(function(t){return e[t]}))}!n&&ei&&console.warn("The query ".concat(JSON.stringify(e)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(t.join("+"),"]"));var i=this.schema.idxByName,u=this.db._deps.indexedDB;function s(e,t){return 0===u.cmp(e,t)}var c=t.reduce(function(t,n){var r=t[0],o=t[1],t=i[n],u=e[n];return[r||t,r||!t?e3(o,t&&t.multi?function(e){return a(e=_(e,n))&&e.some(function(e){return s(u,e)})}:function(e){return s(u,_(e,n))}):o]},[null,null]),r=c[0],c=c[1];return r?this.where(r.name).equals(e[r.keyPath]).filter(c):n?this.filter(c):this.where(t).equals("")},te.prototype.filter=function(e){return this.toCollection().and(e)},te.prototype.count=function(e){return this.toCollection().count(e)},te.prototype.offset=function(e){return this.toCollection().offset(e)},te.prototype.limit=function(e){return this.toCollection().limit(e)},te.prototype.each=function(e){return this.toCollection().each(e)},te.prototype.toArray=function(e){return this.toCollection().toArray(e)},te.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},te.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,a(e)?"[".concat(e.join("+"),"]"):e))},te.prototype.reverse=function(){return this.toCollection().reverse()},te.prototype.mapToClass=function(t){var n,r=this.db,i=this.name;function o(){return null!==n&&n.apply(this,arguments)||this}(this.schema.mappedClass=t).prototype instanceof e4&&(function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(o,n=t),Object.defineProperty(o.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),o.prototype.table=function(){return i},t=o);for(var a=new Set,u=t.prototype;u;u=s(u))Object.getOwnPropertyNames(u).forEach(function(e){return a.add(e)});function c(e){if(!e)return e;var n,r=Object.create(t.prototype);for(n in e)if(!a.has(n))try{r[n]=e[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=c,this.hook("reading",c),t},te.prototype.defineClass=function(){return this.mapToClass(function(e){u(this,e)})},te.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=e8(o)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[a]})}).then(function(e){return e.numFailures?eg.reject(e.failures[0]):e.lastResult}).then(function(t){if(o)try{x(e,o,t)}catch(e){}return t})},te.prototype.update=function(e,t){return"object"!=typeof e||a(e)?this.where(":id").equals(e).modify(t):void 0===(e=_(e,this.schema.primKey.keyPath))?eQ(new $.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},te.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=e8(o)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"put",values:[a],keys:null!=t?[t]:null})}).then(function(e){return e.numFailures?eg.reject(e.failures[0]):e.lastResult}).then(function(t){if(o)try{x(e,o,t)}catch(e){}return t})},te.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?eg.reject(e.failures[0]):void 0})},te.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:e2})}).then(function(e){return e.numFailures?eg.reject(e.failures[0]):void 0})},te.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)})})})},te.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,a=n.auto,n=n.keyPath;if(n&&i)throw new $.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new $.InvalidArgument("Arguments objects and keys must have the same length");var u=e.length,n=n&&a?e.map(e8(n)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:n,wantResults:o}).then(function(e){var t=e.numFailures,n=e.results,i=e.lastResult,e=e.failures;if(0===t)return o?n:i;throw new z("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(u," operations failed"),e)})})},te.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,a=n.auto,n=n.keyPath;if(n&&i)throw new $.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new $.InvalidArgument("Arguments objects and keys must have the same length");var u=e.length,n=n&&a?e.map(e8(n)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:n,wantResults:o}).then(function(e){var t=e.numFailures,n=e.results,i=e.lastResult,e=e.failures;if(0===t)return o?n:i;throw new z("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(u," operations failed"),e)})})},te.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map(function(e){return e.key}),i=e.map(function(e){return e.changes}),o=[];return this._trans("readwrite",function(a){return n.getMany({trans:a,keys:r,cache:"clone"}).then(function(u){var s=[],c=[];e.forEach(function(e,n){var r=e.key,i=e.changes,a=u[n];if(a){for(var l=0,f=Object.keys(i);l<f.length;l++){var h=f[l],d=i[h];if(h===t.schema.primKey.keyPath){if(0!==e5(d,r))throw new $.Constraint("Cannot update primary key in bulkUpdate()")}else x(a,h,d)}o.push(n),s.push(r),c.push(a)}});var l=s.length;return n.mutate({trans:a,type:"put",keys:s,values:c,updates:{keys:r,changeSpecs:i}}).then(function(e){var n=e.numFailures,r=e.failures;if(0===n)return l;for(var i=0,a=Object.keys(r);i<a.length;i++){var u,s=a[i],c=o[Number(s)];null!=c&&(u=r[s],delete r[s],r[c]=u)}throw new z("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)})})})},te.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,e=e.failures;if(0===r)return i;throw new z("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),e)})},te);function te(){}function tt(e){function t(t,r){if(r){for(var i=arguments.length,o=Array(i-1);--i;)o[i-1]=arguments[i];return n[t].subscribe.apply(null,o),e}if("string"==typeof t)return n[t]}var n={};t.addEventType=u;for(var r=1,i=arguments.length;r<i;++r)u(arguments[r]);return t;function u(e,r,i){if("object"!=typeof e){r=r||en;var s={subscribers:[],fire:i=i||G,subscribe:function(e){-1===s.subscribers.indexOf(e)&&(s.subscribers.push(e),s.fire=r(s.fire,e))},unsubscribe:function(e){s.subscribers=s.subscribers.filter(function(t){return t!==e}),s.fire=s.subscribers.reduce(r,i)}};return n[e]=t[e]=s}o(e).forEach(function(t){var n=e[t];if(a(n))u(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new $.InvalidArgument("Invalid event config");var r=u(t,X,function(){for(var e=arguments.length,t=Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach(function(e){w(function(){e.apply(null,t)})})})}})}}function tn(e,t){return p(t).from({prototype:e}),t}function tr(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ti(e,t){e.filter=e3(e.filter,t)}function to(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return e3(r(),t())}:t,e.justLimit=n&&!r}function ta(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new $.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function tu(e,t,n){var r=ta(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:"prev"===e.dir,unique:!!e.unique,query:{index:r,range:e.range}})}function ts(e,t,n,r){var i=e.replayFilter?e3(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){var a,u;i&&!i(n,r,function(e){return n.stop(e)},function(e){return n.fail(e)})||("[object ArrayBuffer]"==(u=""+(a=n.primaryKey))&&(u=""+new Uint8Array(a)),l(o,u)||(o[u]=!0,t(e,n,r)))};return Promise.all([e.or._iterate(a,n),tc(tu(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return tc(tu(e,r,n),e3(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function tc(e,t,n,r){var i=eA(r?function(e,t,i){return n(r(e),t,i)}:n);return e.then(function(e){if(e)return e.start(function(){var n=function(){return e.continue()};t&&!t(e,function(e){return n=e},function(t){e.stop(t),n=G},function(t){e.fail(t),n=G})||i(e.value,e,function(e){return n=e}),n()})})}var E=Symbol(),tl=(tf.prototype.execute=function(e){if(void 0!==this.add){var t=this.add;if(a(t))return r(r([],a(e)?e:[],!0),t,!0).sort();if("number"==typeof t)return(Number(e)||0)+t;if("bigint"==typeof t)try{return BigInt(e)+t}catch(e){return BigInt(0)+t}throw TypeError("Invalid term ".concat(t))}if(void 0!==this.remove){var n=this.remove;if(a(n))return a(e)?e.filter(function(e){return!n.includes(e)}).sort():[];if("number"==typeof n)return Number(e)-n;if("bigint"==typeof n)try{return BigInt(e)-n}catch(e){return BigInt(0)-n}throw TypeError("Invalid subtrahend ".concat(n))}return(t=null===(t=this.replacePrefix)||void 0===t?void 0:t[0])&&"string"==typeof e&&e.startsWith(t)?this.replacePrefix[1]+e.substring(t.length):e},tf);function tf(e){Object.assign(this,e)}var th=(td.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,eQ.bind(null,n.error)):n.table._trans("readonly",e).then(t)},td.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,eQ.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},td.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=e3(t.algorithm,e)},td.prototype._iterate=function(e,t){return ts(this._ctx,e,t,this._ctx.table.core)},td.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&u(n,e),t._ctx=n,t},td.prototype.raw=function(){return this._ctx.valueMapper=null,this},td.prototype.each=function(e){var t=this._ctx;return this._read(function(n){return ts(t,e,n,t.table.core)})},td.prototype.count=function(e){var t=this;return this._read(function(e){var n=t._ctx,r=n.table.core;if(tr(n,!0))return r.count({trans:e,query:{index:ta(n,r.schema),range:n.range}}).then(function(e){return Math.min(e,n.limit)});var i=0;return ts(n,function(){return++i,!1},e,r).then(function(){return i})}).then(e)},td.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function u(e,t){return(e=o(e,i))<(t=o(t,i))?-a:t<e?a:0}return this.toArray(function(e){return e.sort(u)}).then(t)},td.prototype.toArray=function(e){var t=this;return this._read(function(e){var n=t._ctx;if("next"===n.dir&&tr(n,!0)&&0<n.limit){var r=n.valueMapper,i=ta(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){return e=e.result,r?e.map(r):e})}var o=[];return ts(n,function(e){return o.push(e)},e,n.table.core).then(function(){return o})},e)},td.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,tr(t)?to(t,function(){var t=e;return function(e,n){return 0===t||(1===t?--t:n(function(){e.advance(t),t=0}),!1)}}):to(t,function(){var t=e;return function(){return--t<0}})),this},td.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),to(this._ctx,function(){var t=e;return function(e,n,r){return--t<=0&&n(r),0<=t}},!0),this},td.prototype.until=function(e,t){return ti(this._ctx,function(n,r,i){return!e(n.value)||(r(i),t)}),this},td.prototype.first=function(e){return this.limit(1).toArray(function(e){return e[0]}).then(e)},td.prototype.last=function(e){return this.reverse().first(e)},td.prototype.filter=function(e){var t;return ti(this._ctx,function(t){return e(t.value)}),(t=this._ctx).isMatch=e3(t.isMatch,e),this},td.prototype.and=function(e){return this.filter(e)},td.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},td.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},td.prototype.desc=function(){return this.reverse()},td.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.key,n)})},td.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},td.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each(function(t,n){e(n.primaryKey,n)})},td.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)},td.prototype.primaryKeys=function(e){var t=this._ctx;if("next"===t.dir&&tr(t,!0)&&0<t.limit)return this._read(function(e){var n=ta(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})}).then(function(e){return e.result}).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each(function(e,t){n.push(t.primaryKey)}).then(function(){return n}).then(e)},td.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},td.prototype.firstKey=function(e){return this.limit(1).keys(function(e){return e[0]}).then(e)},td.prototype.lastKey=function(e){return this.reverse().firstKey(e)},td.prototype.distinct=function(){var e=this._ctx,e=e.index&&e.table.schema.idxByName[e.index];if(!e||!e.multi)return this;var t={};return ti(this._ctx,function(e){var n=e.primaryKey.toString(),e=l(t,n);return t[n]=!0,!e}),this},td.prototype.modify=function(e){var t=this,n=this._ctx;return this._write(function(r){function i(e,t){var n=t.failures,t=t.numFailures;y+=e-t;for(var r=0,i=o(n);r<i.length;r++){var a=i[r];p.push(n[a])}}s="function"==typeof e?e:(u=(a=o(e)).length,function(t){for(var n=!1,r=0;r<u;++r){var i=a[r],o=e[i],s=_(t,i);o instanceof tl?(x(t,i,o.execute(s)),n=!0):s!==o&&(x(t,i,o),n=!0)}return n});var a,u,s,c=n.table.core,l=c.schema.primaryKey,f=l.outbound,h=l.extractKey,d=t.db._options.modifyChunkSize||200,p=[],y=0,v=[];return t.clone().primaryKeys().then(function(t){var o=tr(n)&&n.limit===1/0&&("function"!=typeof e||e===tp)&&{index:n.index,range:n.range};return(function n(a){var u=Math.min(d,t.length-a);return c.getMany({trans:r,keys:t.slice(a,a+u),cache:"immutable"}).then(function(l){for(var p=[],y=[],v=f?[]:null,m=[],b=0;b<u;++b){var g=l[b],w={value:j(g),primKey:t[a+b]};!1!==s.call(w,w.value,w)&&(null==w.value?m.push(t[a+b]):f||0===e5(h(g),h(w.value))?(y.push(w.value),f&&v.push(t[a+b])):(m.push(t[a+b]),p.push(w.value)))}return Promise.resolve(0<p.length&&c.mutate({trans:r,type:"add",values:p}).then(function(e){for(var t in e.failures)m.splice(parseInt(t),1);i(p.length,e)})).then(function(){return(0<y.length||o&&"object"==typeof e)&&c.mutate({trans:r,type:"put",keys:v,values:y,criteria:o,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:0<a}).then(function(e){return i(y.length,e)})}).then(function(){return(0<m.length||o&&e===tp)&&c.mutate({trans:r,type:"delete",keys:m,criteria:o,isAdditionalChunk:0<a}).then(function(e){return i(m.length,e)})}).then(function(){return t.length>a+u&&n(a+d)})})})(0).then(function(){if(0<p.length)throw new V("Error modifying one or more objects",p,y,v);return t.length})})})},td.prototype.delete=function(){var e=this._ctx,t=e.range;return tr(e)&&(e.isPrimKey||3===t.type)?this._write(function(n){var r=e.table.core.schema.primaryKey;return e.table.core.count({trans:n,query:{index:r,range:t}}).then(function(r){return e.table.core.mutate({trans:n,type:"deleteRange",range:t}).then(function(e){var t=e.failures;if(e.lastResult,e.results,e=e.numFailures)throw new V("Could not delete some values",Object.keys(t).map(function(e){return t[e]}),r-e);return r-e})})}):this.modify(tp)},td);function td(){}var tp=function(e,t){return t.value=null};function ty(e,t){return e<t?-1:e===t?0:1}function tv(e,t){return t<e?-1:e===t?0:1}function tm(e,t,n){return(e=e instanceof tx?new e.Collection(e):e)._ctx.error=new(n||TypeError)(t),e}function tb(e){return new e.Collection(e,function(){return t_("")}).limit(0)}function tg(e,t,n,r){var i,o,a,u,s,c,l,f=n.length;if(!n.every(function(e){return"string"==typeof e}))return tm(e,eH);function h(e){i="next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()},o="next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()},a="next"===e?ty:tv;var t=n.map(function(e){return{lower:o(e),upper:i(e)}}).sort(function(e,t){return a(e.lower,t.lower)});u=t.map(function(e){return e.upper}),s=t.map(function(e){return e.lower}),l="next"===(c=e)?"":r}h("next"),(e=new e.Collection(e,function(){return tw(u[0],s[f-1]+r)}))._ondirectionchange=function(e){h(e)};var d=0;return e._addAlgorithm(function(e,n,r){var i=e.key;if("string"!=typeof i)return!1;var h=o(i);if(t(h,s,d))return!0;for(var p=null,y=d;y<f;++y){var v=function(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),u=-1,s=0;s<a;++s){var c=t[s];if(c!==r[s])return 0>i(e[s],n[s])?e.substr(0,s)+n[s]+n.substr(s+1):0>i(e[s],r[s])?e.substr(0,s)+r[s]+n.substr(s+1):0<=u?e.substr(0,u)+t[u]+n.substr(u+1):null;0>i(e[s],c)&&(u=s)}return a<r.length&&"next"===o?e+n.substr(e.length):a<e.length&&"prev"===o?e.substr(0,n.length):u<0?null:e.substr(0,u)+r[u]+n.substr(u+1)}(i,h,u[y],s[y],a,c);null===v&&null===p?d=y+1:(null===p||0<a(p,v))&&(p=v)}return n(null!==p?function(){e.continue(p+l)}:r),!1}),e}function tw(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function t_(e){return{type:1,lower:e,upper:e}}var tx=(Object.defineProperty(tk.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),tk.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return 0<this._cmp(e,t)||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?tb(this):new this.Collection(this,function(){return tw(e,t,!n,!r)})}catch(e){return tm(this,eX)}},tk.prototype.equals=function(e){return null==e?tm(this,eX):new this.Collection(this,function(){return t_(e)})},tk.prototype.above=function(e){return null==e?tm(this,eX):new this.Collection(this,function(){return tw(e,void 0,!0)})},tk.prototype.aboveOrEqual=function(e){return null==e?tm(this,eX):new this.Collection(this,function(){return tw(e,void 0,!1)})},tk.prototype.below=function(e){return null==e?tm(this,eX):new this.Collection(this,function(){return tw(void 0,e,!1,!0)})},tk.prototype.belowOrEqual=function(e){return null==e?tm(this,eX):new this.Collection(this,function(){return tw(void 0,e)})},tk.prototype.startsWith=function(e){return"string"!=typeof e?tm(this,eH):this.between(e,e+eG,!0,!0)},tk.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):tg(this,function(e,t){return 0===e.indexOf(t[0])},[e],eG)},tk.prototype.equalsIgnoreCase=function(e){return tg(this,function(e,t){return e===t[0]},[e],"")},tk.prototype.anyOfIgnoreCase=function(){var e=B.apply(I,arguments);return 0===e.length?tb(this):tg(this,function(e,t){return -1!==t.indexOf(e)},e,"")},tk.prototype.startsWithAnyOfIgnoreCase=function(){var e=B.apply(I,arguments);return 0===e.length?tb(this):tg(this,function(e,t){return t.some(function(t){return 0===e.indexOf(t)})},e,eG)},tk.prototype.anyOf=function(){var e=this,t=B.apply(I,arguments),n=this._cmp;try{t.sort(n)}catch(e){return tm(this,eX)}if(0===t.length)return tb(this);var r=new this.Collection(this,function(){return tw(t[0],t[t.length-1])});r._ondirectionchange=function(r){n="next"===r?e._ascending:e._descending,t.sort(n)};var i=0;return r._addAlgorithm(function(e,r,o){for(var a=e.key;0<n(a,t[i]);)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r(function(){e.continue(t[i])}),!1)}),r},tk.prototype.notEqual=function(e){return this.inAnyRange([[-1/0,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},tk.prototype.noneOf=function(){var e=B.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return tm(this,eX)}var t=e.reduce(function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[-1/0,t]]},null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},tk.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,u=this._max;if(0===e.length)return tb(this);if(!e.every(function(e){return void 0!==e[0]&&void 0!==e[1]&&0>=i(e[0],e[1])}))return tm(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",$.InvalidArgument);var s,c=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers,f=i;function h(e,t){return f(e[0],t[0])}try{(s=e.reduce(function(e,t){for(var n=0,i=e.length;n<i;++n){var o=e[n];if(0>r(t[0],o[1])&&0<r(t[1],o[0])){o[0]=a(o[0],t[0]),o[1]=u(o[1],t[1]);break}}return n===i&&e.push(t),e},[])).sort(h)}catch(e){return tm(this,eX)}var d=0,p=l?function(e){return 0<i(e,s[d][1])}:function(e){return 0<=i(e,s[d][1])},y=c?function(e){return 0<o(e,s[d][0])}:function(e){return 0<=o(e,s[d][0])},v=p,e=new this.Collection(this,function(){return tw(s[0][0],s[s.length-1][1],!c,!l)});return e._ondirectionchange=function(e){f="next"===e?(v=p,i):(v=y,o),s.sort(h)},e._addAlgorithm(function(e,t,r){for(var o=e.key;v(o);)if(++d===s.length)return t(r),!1;return!p(o)&&!y(o)||(0===n._cmp(o,s[d][1])||0===n._cmp(o,s[d][0])||t(function(){f===i?e.continue(s[d][0]):e.continue(s[d][1])}),!1)}),e},tk.prototype.startsWithAnyOf=function(){var e=B.apply(I,arguments);return e.every(function(e){return"string"==typeof e})?0===e.length?tb(this):this.inAnyRange(e.map(function(e){return[e,e+eG]})):tm(this,"startsWithAnyOf() only works with strings")},tk);function tk(){}function tO(e){return eA(function(t){return tP(t),e(t.target.error),!1})}function tP(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var tE="storagemutated",tK="x-storagemutated-1",tS=tt(null,tE),tj=(tC.prototype._lock=function(){return g(!ey.global),++this._reculock,1!==this._reculock||ey.global||(ey.lockOwnerFor=this),this},tC.prototype._unlock=function(){if(g(!ey.global),0==--this._reculock)for(ey.global||(ey.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var e=this._blockedFuncs.shift();try{eW(e[1],e[0])}catch(e){}}return this},tC.prototype._locked=function(){return this._reculock&&ey.lockOwnerFor!==this},tC.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(g(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new $.DatabaseClosed(r);case"MissingAPIError":throw new $.MissingAPI(r.message,r);default:throw new $.OpenFailed(r)}if(!this.active)throw new $.TransactionInactive;return g(null===this._completion._state),(e=this.idbtrans=e||(this.db.core||n).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=eA(function(n){tP(n),t._reject(e.error)}),e.onabort=eA(function(n){tP(n),t.active&&t._reject(new $.Abort(e.error)),t.active=!1,t.on("abort").fire(n)}),e.oncomplete=eA(function(){t.active=!1,t._resolve(),"mutatedParts"in e&&tS.storagemutated.fire(e.mutatedParts)}),this},tC.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return eQ(new $.ReadOnly("Transaction is readonly"));if(!this.active)return eQ(new $.TransactionInactive);if(this._locked())return new eg(function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},ey])});if(n)return eN(function(){var e=new eg(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 eg(function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)});return i._lib=!0,i},tC.prototype._root=function(){return this.parent?this.parent._root():this},tC.prototype.waitFor=function(e){var t,n=this._root(),r=eg.resolve(e);n._waitingFor?n._waitingFor=n._waitingFor.then(function(){return r}):(n._waitingFor=r,n._waitingQueue=[],t=n.idbtrans.objectStore(n.storeNames[0]),function e(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(t.get(-1/0).onsuccess=e)}());var i=n._waitingFor;return new eg(function(e,t){r.then(function(t){return n._waitingQueue.push(eA(e.bind(null,t)))},function(e){return n._waitingQueue.push(eA(t.bind(null,e)))}).finally(function(){n._waitingFor===i&&(n._waitingFor=null)})})},tC.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new $.Abort))},tC.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 $.NotFound("Table "+e+" not part of transaction");return(n=new this.db.Table(e,n,this)).core=this.db.core.table(e),t[e]=n},tC);function tC(){}function tA(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+tD(t)}}function tD(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function tT(e,t,n){var r;return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:(r=function(e){return[e.name,e]},n.reduce(function(e,t,n){return(n=r(t,n))&&(e[n[0]]=n[1]),e},{}))}}var tq=function(e){try{return e.only([[]]),tq=function(){return[[]]},[[]]}catch(e){return tq=function(){return eG},eG}};function tI(e){return null==e?function(){}:"string"==typeof e?1===e.split(".").length?function(t){return t[e]}:function(t){return _(t,e)}:function(t){return _(t,e)}}function tB(e){return[].slice.call(e)}var tR=0;function tN(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function tF(e,n){var r,i,o,u,s=n.db,n=(r=e._middlewares,i=e._deps,o=n,u=i.IDBKeyRange,i.indexedDB,{dbcore:(o=function(e,t,n){function r(e){if(3===e.type)return null;if(4===e.type)throw Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen,e=e.upperOpen;return void 0===n?void 0===r?null:t.upperBound(r,!!e):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!e)}var i,o,u=(i=n,o=tB(e.objectStoreNames),{schema:{name:e.name,tables:o.map(function(e){return i.objectStore(e)}).map(function(e){var t=e.keyPath,n=e.autoIncrement,r=a(t),i={},n={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:null==t,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:tI(t)},indexes:tB(e.indexNames).map(function(t){return e.index(t)}).map(function(e){var t=e.name,n=e.unique,r=e.multiEntry,e=e.keyPath,r={name:t,compound:a(e),keyPath:e,unique:n,multiEntry:r,extractKey:tI(e)};return i[tN(e)]=r}),getIndexByKeyPath:function(e){return i[tN(e)]}};return i[":id"]=n.primaryKey,null!=t&&(i[tN(t)]=n.primaryKey),n})},hasGetAll:0<o.length&&"getAll"in i.objectStore(o[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),n=u.schema,s=u.hasGetAll,u=n.tables.map(function(e){var t=e.name;return{name:t,schema:e,mutate:function(e){var n=e.trans,i=e.type,o=e.keys,a=e.values,u=e.range;return new Promise(function(e,s){e=eA(e);var c=n.objectStore(t),l=null==c.keyPath,f="put"===i||"add"===i;if(!f&&"delete"!==i&&"deleteRange"!==i)throw Error("Invalid operation type: "+i);var h,d=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw Error("Given keys array must have same length as given values array.");if(0===d)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function p(e){++m,tP(e)}var y=[],v=[],m=0;if("deleteRange"===i){if(4===u.type)return e({numFailures:m,failures:v,results:[],lastResult:void 0});3===u.type?y.push(h=c.clear()):y.push(h=c.delete(r(u)))}else{var l=f?l?[a,o]:[a,null]:[o,null],b=l[0],g=l[1];if(f)for(var w=0;w<d;++w)y.push(h=g&&void 0!==g[w]?c[i](b[w],g[w]):c[i](b[w])),h.onerror=p;else for(w=0;w<d;++w)y.push(h=c[i](b[w])),h.onerror=p}function _(t){t=t.target.result,y.forEach(function(e,t){return null!=e.error&&(v[t]=e.error)}),e({numFailures:m,failures:v,results:"delete"===i?o:y.map(function(e){return e.result}),lastResult:t})}h.onerror=function(e){p(e),_(e)},h.onsuccess=_})},getMany:function(e){var n=e.trans,r=e.keys;return new Promise(function(e,i){e=eA(e);for(var o,a=n.objectStore(t),u=r.length,s=Array(u),c=0,l=0,f=function(t){s[(t=t.target)._pos]=t.result,++l===c&&e(s)},h=tO(i),d=0;d<u;++d)null!=r[d]&&((o=a.get(r[d]))._pos=d,o.onsuccess=f,o.onerror=h,++c);0===c&&e(s)})},get:function(e){var n=e.trans,r=e.key;return new Promise(function(e,i){e=eA(e);var o=n.objectStore(t).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=tO(i)})},query:function(e){return new Promise(function(n,i){n=eA(n);var o,a,u,c=e.trans,l=e.values,f=e.limit,h=e.query,d=f===1/0?void 0:f,p=h.index,h=h.range,c=c.objectStore(t),p=p.isPrimaryKey?c:c.index(p.name),h=r(h);if(0===f)return n({result:[]});s?((d=l?p.getAll(h,d):p.getAllKeys(h,d)).onsuccess=function(e){return n({result:e.target.result})},d.onerror=tO(i)):(o=0,a=!l&&"openKeyCursor"in p?p.openKeyCursor(h):p.openCursor(h),u=[],a.onsuccess=function(e){var t=a.result;return t?(u.push(l?t.value:t.primaryKey),++o===f?n({result:u}):void t.continue()):n({result:u})},a.onerror=tO(i))})},openCursor:function(e){var n=e.trans,i=e.values,o=e.query,a=e.reverse,u=e.unique;return new Promise(function(e,s){e=eA(e);var c=o.index,l=o.range,f=n.objectStore(t),f=c.isPrimaryKey?f:f.index(c.name),c=a?u?"prevunique":"prev":u?"nextunique":"next",h=!i&&"openKeyCursor"in f?f.openKeyCursor(r(l),c):f.openCursor(r(l),c);h.onerror=tO(s),h.onsuccess=eA(function(t){var r,i,o,a,u=h.result;u?(u.___id=++tR,u.done=!1,r=u.continue.bind(u),i=(i=u.continuePrimaryKey)&&i.bind(u),o=u.advance.bind(u),a=function(){throw Error("Cursor not stopped")},u.trans=n,u.stop=u.continue=u.continuePrimaryKey=u.advance=function(){throw Error("Cursor not started")},u.fail=eA(s),u.next=function(){var e=this,t=1;return this.start(function(){return t--?e.continue():e.stop()}).then(function(){return e})},u.start=function(e){function t(){if(h.result)try{e()}catch(e){u.fail(e)}else u.done=!0,u.start=function(){throw Error("Cursor behind last entry")},u.stop()}var n=new Promise(function(e,t){e=eA(e),h.onerror=tO(t),u.fail=t,u.stop=function(t){u.stop=u.continue=u.continuePrimaryKey=u.advance=a,e(t)}});return h.onsuccess=eA(function(e){h.onsuccess=t,t()}),u.continue=r,u.continuePrimaryKey=i,u.advance=o,t(),n},e(u)):e(null)},s)})},count:function(e){var n=e.query,i=e.trans,o=n.index,a=n.range;return new Promise(function(e,n){var u=i.objectStore(t),s=o.isPrimaryKey?u:u.index(o.name),u=r(a),s=u?s.count(u):s.count();s.onsuccess=eA(function(t){return e(t.target.result)}),s.onerror=tO(n)})}}}),c={};return u.forEach(function(e){return c[e.name]=e}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!c[e])throw Error("Table '".concat(e,"' not found"));return c[e]},MIN_KEY:-1/0,MAX_KEY:tq(t),schema:n}}(s,u,o),r.dbcore.reduce(function(e,n){return n=n.create,t(t({},e),n(e))},o))});e.core=n.dbcore,e.tables.forEach(function(t){var n=t.name;e.core.schema.tables.some(function(e){return e.name===n})&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))})}function tM(e,t,n,r){n.forEach(function(n){var i=r[n];t.forEach(function(t){var r=function e(t,n){return y(t,n)||(t=s(t))&&e(t,n)}(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?d(t,n,{get:function(){return this.table(n)},set:function(e){h(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))})})}function tL(e,t){t.forEach(function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]})}function tU(e,t){return e._cfg.version-t._cfg.version}function tV(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 a={name:n,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto)a.recreate=!0,r.change.push(a);else{var u=i.idxByName,s=o.idxByName,c=void 0;for(c in u)s[c]||a.del.push(c);for(c in s){var l=u[c],f=s[c];l?l.src!==f.src&&a.change.push(f):a.add.push(f)}(0<a.del.length||0<a.add.length||0<a.change.length)&&r.change.push(a)}}else r.add.push([n,o])}return r}function tz(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 t$(i,e)}),i}function tW(e,t){o(e).forEach(function(n){t.db.objectStoreNames.contains(n)||(ei&&console.debug("Dexie: Creating missing table",n),tz(t,n,e[n].primKey,e[n].indexes))})}function t$(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function tY(e,t,n){var r={};return m(t.objectStoreNames,0).forEach(function(e){for(var t=n.objectStore(e),i=tA(tD(s=t.keyPath),s||"",!0,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[],a=0;a<t.indexNames.length;++a){var u=t.index(t.indexNames[a]),s=u.keyPath,u=tA(u.name,s,!!u.unique,!!u.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(u)}r[e]=tT(e,i,o)}),r}function tQ(e,t,n){for(var r=n.db.objectStoreNames,o=0;o<r.length;++o){var a=r[o],u=n.objectStore(a);e._hasGetAll="getAll"in u;for(var s=0;s<u.indexNames.length;++s){var c=u.indexNames[s],l=u.index(c).keyPath,f="string"==typeof l?l:"["+m(l).join("+")+"]";!t[a]||(l=t[a].idxByName[f])&&(l.name=c,delete t[a].idxByName[f],t[a].idxByName[c]=l)}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&i.WorkerGlobalScope&&i instanceof i.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function tG(e){return e.split(",").map(function(e,t){var n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return tA(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(r),0===t)})}var tX=(tH.prototype._parseStoresSpec=function(e,t){o(e).forEach(function(n){if(null!==e[n]){var r=tG(e[n]),i=r.shift();if(i.unique=!0,i.multi)throw new $.Schema("Primary key cannot be multi-valued");r.forEach(function(e){if(e.auto)throw new $.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new $.Schema("Index must have a name and cannot be an empty string")}),t[n]=tT(n,i,r)}})},tH.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,e):e;var e=t._versions,n={},r={};return e.forEach(function(e){u(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)}),t._dbSchema=r,tL(t,[t._allTables,t,t.Transaction.prototype]),tM(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],o(r),r),t._storeNames=o(r),this},tH.prototype.upgrade=function(e){return this._cfg.contentUpgrade=er(this._cfg.contentUpgrade||G,e),this},tH);function tH(){}function tJ(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new nO(eZ,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function tZ(e){return e&&"function"==typeof e.databases}function t0(e){return eN(function(){return ey.letThrough=!0,e()})}function t1(e){return!("from"in e)}var t3=function(e,t){if(!this){var n=new t3;return e&&"d"in e&&u(n,e),n}u(this,arguments.length?{d:1,from:e,to:1<arguments.length?t:e}:{d:0})};function t2(e,t,n){var r=e5(t,n);if(!isNaN(r)){if(0<r)throw RangeError();if(t1(e))return u(e,{from:t,to:n,d:1});var i=e.l,r=e.r;if(0>e5(n,e.from))return i?t2(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},t6(e);if(0<e5(t,e.to))return r?t2(r,t,n):e.r={from:t,to:n,d:1,l:null,r:null},t6(e);0>e5(t,e.from)&&(e.from=t,e.l=null,e.d=r?r.d+1:1),0<e5(n,e.to)&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1),n=!e.r,i&&!e.l&&t8(e,i),r&&n&&t8(e,r)}}function t8(e,t){t1(t)||function e(t,n){var r=n.from,i=n.to,o=n.l,n=n.r;t2(t,r,i),o&&e(t,o),n&&e(t,n)}(e,t)}function t4(e,t){var n=t5(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=t5(e),a=o.next(i.from),u=a.value;!r.done&&!a.done;){if(0>=e5(u.from,i.to)&&0<=e5(u.to,i.from))return!0;0>e5(i.from,u.from)?i=(r=n.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function t5(e){var t=t1(e)?null:{s:0,n:e};return{next:function(e){for(var n=0<arguments.length;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&0>e5(e,t.n.from);)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||0>=e5(e,t.n.to))return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function t6(e){var n,r,i=((null===(n=e.r)||void 0===n?void 0:n.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=1<i?"r":i<-1?"l":"";o&&(n="r"==o?"l":"r",r=t({},e),i=e[o],e.from=i.from,e.to=i.to,e[o]=i[o],r[o]=i[n],(e[n]=r).d=t9(r)),e.d=t9(e)}function t9(e){var t=e.r,e=e.l;return(t?e?Math.max(t.d,e.d):t.d:e?e.d:0)+1}function t7(e,t){return o(t).forEach(function(n){e[n]?t8(e[n],t[n]):e[n]=function e(t){var n,r,i={};for(n in t)l(t,n)&&(r=t[n],i[n]=!r||"object"!=typeof r||K.has(r.constructor)?r:e(r));return i}(t[n])}),e}function ne(e,t){return e.all||t.all||Object.keys(e).some(function(n){return t[n]&&t4(t[n],e[n])})}f(t3.prototype,((F={add:function(e){return t8(this,e),this},addKey:function(e){return t2(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(e){return t2(t,e,e)}),this}})[D]=function(){return t5(this)},F));var nt={},nn={},nr=!1;function ni(e){t7(nn,e),nr||(nr=!0,setTimeout(function(){nr=!1,no(nn,(nn={},!1))},0))}function no(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(nt);r<i.length;r++)na(a=i[r],e,n,t);else for(var o in e){var a,u=/^idb\:\/\/(.*)\/(.*)\//.exec(o);u&&(o=u[1],u=u[2],(a=nt["idb://".concat(o,"/").concat(u)])&&na(a,e,n,t))}n.forEach(function(e){return e()})}function na(e,t,n,r){for(var i=[],o=0,a=Object.entries(e.queries.query);o<a.length;o++){for(var u=a[o],s=u[0],c=[],l=0,f=u[1];l<f.length;l++){var h=f[l];ne(t,h.obsSet)?h.subscribers.forEach(function(e){return n.add(e)}):r&&c.push(h)}r&&i.push([s,c])}if(r)for(var d=0;d<i.length;d++){var p=i[d],s=p[0],c=p[1];e.queries.query[s]=c}}function nu(e){function t(t){return e.next(t)}var n=i(t),r=i(function(t){return e.throw(t)});function i(e){return function(t){var i=e(t),t=i.value;return i.done?t:t&&"function"==typeof t.then?t.then(n,r):a(t)?Promise.all(t).then(n,r):n(t)}}return i(t)()}function ns(e,t,n){for(var r=a(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}var nc={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return t(t({},e),{table:function(n){var r=e.table(n),i=r.schema,o={},a=[];function u(e,n,r){var i=tN(e),s=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=0<n,l=t(t({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:n,keyLength:c,extractKey:tI(e),unique:!l&&r.unique});return s.push(l),l.isPrimaryKey||a.push(l),1<c&&u(2===c?e[0]:e.slice(0,c-1),n+1,r),s.sort(function(e,t){return e.keyTail-t.keyTail}),l}n=u(i.primaryKey.keyPath,0,i.primaryKey),o[":id"]=[n];for(var s=0,c=i.indexes;s<c.length;s++){var l=c[s];u(l.keyPath,0,l)}function f(n){var r,i=n.query.index;return i.isVirtual?t(t({},n),{query:{index:i.lowLevelIndex,range:(r=n.query.range,i=i.keyTail,{type:1===r.type?2:r.type,lower:ns(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,i),lowerOpen:!0,upper:ns(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,i),upperOpen:!0})}}):n}return t(t({},r),{schema:t(t({},i),{primaryKey:n,indexes:a,getIndexByKeyPath:function(e){return(e=o[tN(e)])&&e[0]}}),count:function(e){return r.count(f(e))},query:function(e){return r.query(f(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;return o?r.openCursor(f(t)).then(function(n){return n&&Object.create(n,{continue:{value:function(r){null!=r?n.continue(ns(r,t.reverse?e.MAX_KEY:e.MIN_KEY,i)):t.unique?n.continue(n.key.slice(0,a).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,i)):n.continue()}},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(ns(t,e.MAX_KEY,i),r)}},primaryKey:{get:function(){return n.primaryKey}},key:{get:function(){var e=n.key;return 1===a?e[0]:e.slice(0,a)}},value:{get:function(){return n.value}}})}):r.openCursor(t)}})}})}};function nl(e,t,n,r){return n=n||{},r=r||"",o(e).forEach(function(i){var o,a,u;l(t,i)?(o=e[i],a=t[i],"object"==typeof o&&"object"==typeof a&&o&&a?(u=A(o))!==A(a)?n[r+i]=t[i]:"Object"===u?nl(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i]):o!==a&&(n[r+i]=t[i])):n[r+i]=void 0}),o(t).forEach(function(i){l(e,i)||(n[r+i]=t[i])}),n}function nf(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var nh={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return t(t({},e),{table:function(n){var i=e.table(n),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=ey.trans,u=a.table(n).hook,s=u.deleting,c=u.creating,f=u.updating;switch(e.type){case"add":if(c.fire===G)break;return a._promise("readwrite",function(){return h(e)},!0);case"put":if(c.fire===G&&f.fire===G)break;return a._promise("readwrite",function(){return h(e)},!0);case"delete":if(s.fire===G)break;return a._promise("readwrite",function(){return h(e)},!0);case"deleteRange":if(s.fire===G)break;return a._promise("readwrite",function(){return function e(n,r,a){return i.query({trans:n,values:!1,query:{index:o,range:r},limit:a}).then(function(i){var o=i.result;return h({type:"delete",keys:o,trans:n}).then(function(i){return 0<i.numFailures?Promise.reject(i.failures[0]):o.length<a?{failures:[],numFailures:0,lastResult:void 0}:e(n,t(t({},r),{lower:o[o.length-1],lowerOpen:!0}),a)})})}(e.trans,e.range,1e4)},!0)}return i.mutate(e);function h(e){var n,a=ey.trans,u=e.keys||nf(o,e);if(!u)throw Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?t(t({},e),{keys:u}):t({},e)).type&&(e.values=r([],e.values,!0)),e.keys&&(e.keys=r([],e.keys,!0)),("add"===(n=e).type?Promise.resolve([]):i.getMany({trans:n.trans,keys:u,cache:"immutable"})).then(function(t){var n=u.map(function(n,r){var i,u,h,d=t[r],p={onerror:null,onsuccess:null};return"delete"===e.type?s.fire.call(p,n,d,a):"add"===e.type||void 0===d?(i=c.fire.call(p,n,e.values[r],a),null==n&&null!=i&&(e.keys[r]=n=i,o.outbound||x(e.values[r],o.keyPath,n))):(i=nl(d,e.values[r]),(u=f.fire.call(p,i,n,d,a))&&(h=e.values[r],Object.keys(u).forEach(function(e){l(h,e)?h[e]=u[e]:x(h,e,u[e])}))),p});return i.mutate(e).then(function(r){for(var i=r.failures,o=r.results,a=r.numFailures,r=r.lastResult,s=0;s<u.length;++s){var c=(o||u)[s],l=n[s];null==c?l.onerror&&l.onerror(i[s]):l.onsuccess&&l.onsuccess("put"===e.type&&t[s]?e.values[s]:c)}return{failures:i,results:o,numFailures:a,lastResult:r}}).catch(function(e){return n.forEach(function(t){return t.onerror&&t.onerror(e)}),Promise.reject(e)})})}}})}})}};function nd(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===e5(t.keys[i],e[o])&&(r.push(n?j(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var np={stack:"dbcore",level:-1,create:function(e){return{table:function(n){var r=e.table(n);return t(t({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=nd(e.keys,e.trans._cache,"clone"===e.cache);return t?eg.resolve(t):r.getMany(e).then(function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?j(t):t},t})},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function ny(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function nv(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var nm={stack:"dbcore",level:0,name:"Observability",create:function(e){var n=e.schema.name,r=new t3(e.MIN_KEY,e.MAX_KEY);return t(t({},e),{transaction:function(t,n,r){if(ey.subscr&&"readonly"!==n)throw new $.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(ey.querier));return e.transaction(t,n,r)},table:function(i){var u=e.table(i),s=u.schema,c=s.primaryKey,l=s.indexes,f=c.extractKey,h=c.outbound,d=c.autoIncrement&&l.filter(function(e){return e.compound&&e.keyPath.includes(c.keyPath)}),p=t(t({},u),{mutate:function(e){function t(e){return h[e="idb://".concat(n,"/").concat(i,"/").concat(e)]||(h[e]=new t3)}var o,l,f=e.trans,h=e.mutatedParts||(e.mutatedParts={}),p=t(""),y=t(":dels"),v=e.type,m="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[nf(c,e).filter(function(e){return e}),e.values]:[],b=m[0],g=m[1],m=e.trans._cache;return a(b)?(p.addKeys(b),(m="delete"===v||b.length===g.length?nd(b,m):null)||y.addKeys(b),(m||g)&&(o=m,l=g,s.indexes.forEach(function(e){var n=t(e.name||"");function r(t){return null!=t?e.extractKey(t):null}function i(t){return e.multiEntry&&a(t)?t.forEach(function(e){return n.addKey(e)}):n.addKey(t)}(o||l).forEach(function(e,t){var n=o&&r(o[t]),t=l&&r(l[t]);0!==e5(n,t)&&(null!=n&&i(n),null!=t&&i(t))})}))):b?(g={from:b.lower,to:b.upper},y.add(g),p.add(g)):(p.add(r),y.add(r),s.indexes.forEach(function(e){return t(e.name).add(r)})),u.mutate(e).then(function(n){return!b||"add"!==e.type&&"put"!==e.type||(p.addKeys(n.results),d&&d.forEach(function(r){var i=e.values.map(function(e){return r.extractKey(e)}),o=r.keyPath.findIndex(function(e){return e===c.keyPath});n.results.forEach(function(e){return i[o]=e}),t(r.name).addKeys(i)})),f.mutatedParts=t7(f.mutatedParts||{},h),n})}}),l=function(t){var n=t.query,t=n.index,n=n.range;return[t,new t3(null!==(t=n.lower)&&void 0!==t?t:e.MIN_KEY,null!==(n=n.upper)&&void 0!==n?n:e.MAX_KEY)]},y={get:function(e){return[c,new t3(e.key)]},getMany:function(e){return[c,(new t3).addKeys(e.keys)]},count:l,query:l,openCursor:l};return o(y).forEach(function(e){p[e]=function(o){var a=ey.subscr,s=!!a,c=ny(ey,u)&&nv(e,o)?o.obsSet={}:a;if(s){var l=function(e){return c[e="idb://".concat(n,"/").concat(i,"/").concat(e)]||(c[e]=new t3)},d=l(""),p=l(":dels"),a=y[e](o),s=a[0],a=a[1];if(("query"===e&&s.isPrimaryKey&&!o.values?p:l(s.name||"")).add(a),!s.isPrimaryKey){if("count"!==e){var v="query"===e&&h&&o.values&&u.query(t(t({},o),{values:!1}));return u[e].apply(this,arguments).then(function(t){if("query"===e){if(h&&o.values)return v.then(function(e){return e=e.result,d.addKeys(e),t});var n=o.values?t.result.map(f):t.result;(o.values?d:p).addKeys(n)}else if("openCursor"===e){var r=o.values;return t&&Object.create(t,{key:{get:function(){return p.addKey(t.primaryKey),t.key}},primaryKey:{get:function(){var e=t.primaryKey;return p.addKey(e),e}},value:{get:function(){return r&&d.addKey(t.primaryKey),t.value}}})}return t})}p.add(r)}}return u[e].apply(this,arguments)}}),p}})}};function nb(e,n,r){if(0===r.numFailures)return n;if("deleteRange"===n.type)return null;var i=n.keys?n.keys.length:"values"in n&&n.values?n.values.length:1;return r.numFailures===i?null:(a((n=t({},n)).keys)&&(n.keys=n.keys.filter(function(e,t){return!(t in r.failures)})),"values"in n&&a(n.values)&&(n.values=n.values.filter(function(e,t){return!(t in r.failures)})),n)}function ng(e,t){return(void 0===t.lower||(t.lowerOpen?0<e5(e,t.lower):0<=e5(e,t.lower)))&&(void 0===t.upper||(t.upperOpen?0>e5(e,t.upper):0>=e5(e,t.upper)))}function nw(e,t,n,r,i,o){if(!n||0===n.length)return e;var u=t.query.index,s=u.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,f=u.extractKey,h=(u.lowLevelIndex||u).extractKey,n=n.reduce(function(e,n){var r=e,i="add"===n.type||"put"===n.type?n.values.filter(function(e){return e=f(e),s&&a(e)?e.some(function(e){return ng(e,c)}):ng(e,c)}).map(function(e){return e=j(e),o&&Object.freeze(e),e}):[];switch(n.type){case"add":r=e.concat(t.values?i:i.map(function(e){return l(e)}));break;case"put":var u=(new t3).addKeys(n.values.map(function(e){return l(e)})),r=e.filter(function(e){return!t4(new t3(e=t.values?l(e):e),u)}).concat(t.values?i:i.map(function(e){return l(e)}));break;case"delete":var h=(new t3).addKeys(n.keys);r=e.filter(function(e){return!t4(new t3(e=t.values?l(e):e),h)});break;case"deleteRange":var d=n.range;r=e.filter(function(e){return!ng(l(e),d)})}return r},e);return n===e?e:(n.sort(function(e,t){return e5(h(e),h(t))||e5(l(e),l(t))}),t.limit&&t.limit<1/0&&(n.length>t.limit?n.length=t.limit:e.length===t.limit&&n.length<t.limit&&(i.dirty=!0)),o?Object.freeze(n):n)}function n_(e,t){return 0===e5(e.lower,t.lower)&&0===e5(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}var nx={stack:"dbcore",level:0,name:"Cache",create:function(e){var n=e.schema.name;return t(t({},e),{transaction:function(t,r,i){var o,a,u=e.transaction(t,r,i);return"readwrite"===r&&(a=(o=new AbortController).signal,i=function(i){return function(){if(o.abort(),"readwrite"===r){for(var a=new Set,s=0;s<t.length;s++){var c=t[s],l=nt["idb://".concat(n,"/").concat(c)];if(l){var f=e.table(c),h=l.optimisticOps.filter(function(e){return e.trans===u});if(u._explicit&&i&&u.mutatedParts)for(var d=0,p=Object.values(l.queries.query);d<p.length;d++)for(var y=0,v=(g=p[d]).slice();y<v.length;y++)ne((w=v[y]).obsSet,u.mutatedParts)&&(q(g,w),w.subscribers.forEach(function(e){return a.add(e)}));else if(0<h.length){l.optimisticOps=l.optimisticOps.filter(function(e){return e.trans!==u});for(var m=0,b=Object.values(l.queries.query);m<b.length;m++)for(var g,w,_,x=0,k=(g=b[m]).slice();x<k.length;x++)null!=(w=k[x]).res&&u.mutatedParts&&(i&&!w.dirty?(_=Object.isFrozen(w.res),_=nw(w.res,w.req,h,f,w,_),w.dirty?(q(g,w),w.subscribers.forEach(function(e){return a.add(e)})):_!==w.res&&(w.res=_,w.promise=eg.resolve({result:_}))):(w.dirty&&q(g,w),w.subscribers.forEach(function(e){return a.add(e)})))}}}a.forEach(function(e){return e()})}}},u.addEventListener("abort",i(!1),{signal:a}),u.addEventListener("error",i(!1),{signal:a}),u.addEventListener("complete",i(!0),{signal:a})),u},table:function(r){var i=e.table(r),o=i.schema.primaryKey;return t(t({},i),{mutate:function(e){var a=ey.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit)return i.mutate(e);var u=nt["idb://".concat(n,"/").concat(r)];return u?(a=i.mutate(e),("add"===e.type||"put"===e.type)&&(50<=e.values.length||nf(o,e).some(function(e){return null==e}))?a.then(function(n){var r=nb(0,t(t({},e),{values:e.values.map(function(e,r){var i,e=null!==(i=o.keyPath)&&void 0!==i&&i.includes(".")?j(e):t({},e);return x(e,o.keyPath,n.results[r]),e})}),n);u.optimisticOps.push(r),queueMicrotask(function(){return e.mutatedParts&&ni(e.mutatedParts)})}):(u.optimisticOps.push(e),e.mutatedParts&&ni(e.mutatedParts),a.then(function(t){0<t.numFailures&&(q(u.optimisticOps,e),(t=nb(0,e,t))&&u.optimisticOps.push(t),e.mutatedParts&&ni(e.mutatedParts))}),a.catch(function(){q(u.optimisticOps,e),e.mutatedParts&&ni(e.mutatedParts)})),a):i.mutate(e)},query:function(e){if(!ny(ey,i)||!nv("query",e))return i.query(e);var t,o,a="immutable"===(null===(l=ey.trans)||void 0===l?void 0:l.db._options.cache),u=ey,s=u.requery,c=u.signal,l=function(e,t,n,r){var i=nt["idb://".concat(e,"/").concat(t)];if(!i)return[];if(!(t=i.queries[n]))return[null,!1,i,null];var o=t[(r.query?r.query.index.name:null)||""];if(!o)return[null,!1,i,null];switch(n){case"query":var a=o.find(function(e){return e.req.limit===r.limit&&e.req.values===r.values&&n_(e.req.query.range,r.query.range)});return a?[a,!0,i,o]:[o.find(function(e){var t,n;return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&(t=e.req.query.range,n=r.query.range,0>=function(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(t=e5(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return -1}return t}(t.lower,n.lower,t.lowerOpen,n.lowerOpen)&&0<=function(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return -1;if(0===(t=e5(e,t))){if(n&&r)return 0;if(n)return -1;if(r)return 1}return t}(t.upper,n.upper,t.upperOpen,n.upperOpen))}),!1,i,o];case"count":return[a=o.find(function(e){return n_(e.req.query.range,r.query.range)}),!!a,i,o]}}(n,r,"query",e),f=l[0],u=l[1],h=l[2],d=l[3];return f&&u?f.obsSet=e.obsSet:(u=i.query(e).then(function(e){var t=e.result;if(f&&(f.res=t),a){for(var n=0,r=t.length;n<r;++n)Object.freeze(t[n]);Object.freeze(t)}else e.result=j(t);return e}).catch(function(e){return d&&f&&q(d,f),Promise.reject(e)}),f={obsSet:e.obsSet,promise:u,subscribers:new Set,type:"query",req:e,dirty:!1},d?d.push(f):(d=[f],(h=h||(nt["idb://".concat(n,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[e.query.index.name||""]=d)),t=f,o=d,t.subscribers.add(s),c.addEventListener("abort",function(){t.subscribers.delete(s),0===t.subscribers.size&&setTimeout(function(){0===t.subscribers.size&&q(o,t)},3e3)}),f.promise.then(function(t){return{result:nw(t.result,e,null==h?void 0:h.optimisticOps,i,f,a)}})}})}})}};function nk(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var nO=(nP.prototype.version=function(e){if(isNaN(e)||e<.1)throw new $.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new $.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var t=this._versions,n=t.filter(function(t){return t._cfg.version===e})[0];return n||(n=new this.Version(e),t.push(n),t.sort(tU),n.stores({}),this._state.autoSchema=!1,n)},nP.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||ey.letThrough||this._vip)?e():new eg(function(e,n){if(t._state.openComplete)return n(new $.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new $.DatabaseClosed);t.open().catch(G)}t._state.dbReadyPromise.then(e,n)}).then(e)},nP.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;return i&&this.unuse({stack:t,name:i}),(e=this._middlewares[t]||(this._middlewares[t]=[])).push({stack:t,create:n,level:null==r?10:r,name:i}),e.sort(function(e,t){return e.level-t.level}),this},nP.prototype.unuse=function(e){var t=e.stack,n=e.name,r=e.create;return t&&this._middlewares[t]&&(this._middlewares[t]=this._middlewares[t].filter(function(e){return r?e.create!==r:!!n&&e.name!==n})),this},nP.prototype.open=function(){var e=this;return eW(ep,function(){return function(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?eQ(t.dbOpenError):e});t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),a=!1;function u(){if(t.openCanceller!==r)throw new $.DatabaseClosed("db.open() was cancelled")}var s,c=t.dbReadyResolve,l=null,f=!1;return eg.race([r,("undefined"==typeof navigator?eg.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(e){function t(){return indexedDB.databases().finally(e)}s=setInterval(t,100),t()}).finally(function(){return clearInterval(s)}):Promise.resolve()).then(function r(){return new eg(function(s,c){if(u(),!n)throw new $.MissingAPI;var h=e.name,d=t.autoSchema||!i?n.open(h):n.open(h,i);if(!d)throw new $.MissingAPI;d.onerror=tO(c),d.onblocked=eA(e._fireOnBlocked),d.onupgradeneeded=eA(function(r){var i,u,s,p,y,v,m;l=d.transaction,t.autoSchema&&!e._options.allowEmptyDB?(d.onerror=tP,l.abort(),d.result.close(),(i=n.deleteDatabase(h)).onsuccess=i.onerror=eA(function(){c(new $.NoSuchDatabase("Database ".concat(h," doesnt exist")))})):(l.onerror=tO(c),f=(r=r.oldVersion>0x4000000000000000?0:r.oldVersion)<1,e.idbdb=d.result,a&&function(e,t){tW(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=tY(0,e.idbdb,t);tQ(e,e._dbSchema,t);for(var r=0,i=tV(n,e._dbSchema).change;r<i.length;r++){var o=function(e){if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach(function(t){ei&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),t$(n,t)})}(i[r]);if("object"==typeof o)return o.value}}(e,l),u=r/10,s=l,p=e._dbSchema,s.objectStoreNames.contains("$meta")&&!p.$meta&&(p.$meta=tT("$meta",tG("")[0],[]),e._storeNames.push("$meta")),(y=e._createTransaction("readwrite",e._storeNames,p)).create(s),y._completion.catch(c),v=y._reject.bind(y),m=ey.transless||ey,eN(function(){return ey.trans=y,ey.transless=m,0!==u?(tF(e,s),(y.storeNames.includes("$meta")?y.table("$meta").get("version").then(function(e){return null!=e?e:u}):eg.resolve(u)).then(function(t){var n,r,i;return n=t,r=[],t=e._versions,i=e._dbSchema=tY(0,e.idbdb,s),0!==(t=t.filter(function(e){return e._cfg.version>=n})).length?(t.forEach(function(t){r.push(function(){var r=i,a=t._cfg.dbschema;tQ(e,r,s),tQ(e,a,s),i=e._dbSchema=a;var u=tV(r,a);u.add.forEach(function(e){tz(s,e[0],e[1].primKey,e[1].indexes)}),u.change.forEach(function(e){if(e.recreate)throw new $.Upgrade("Not yet support for changing primary key");var t=s.objectStore(e.name);e.add.forEach(function(e){return t$(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),t$(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})});var c=t._cfg.contentUpgrade;if(c&&t._cfg.version>n){tF(e,s),y._memoizedTables={};var l=k(a);u.del.forEach(function(e){l[e]=r[e]}),tL(e,[e.Transaction.prototype]),tM(e,[e.Transaction.prototype],o(l),l),y.schema=l;var f,h=R(c);return h&&eF(),u=eg.follow(function(){var e;(f=c(y))&&h&&(e=eM.bind(null,null),f.then(e,e))}),f&&"function"==typeof f.then?eg.resolve(f):u.then(function(){return f})}}),r.push(function(n){var r=t._cfg.dbschema;[].slice.call(n.db.objectStoreNames).forEach(function(e){return null==r[e]&&n.db.deleteObjectStore(e)}),tL(e,[e.Transaction.prototype]),tM(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),y.schema=e._dbSchema}),r.push(function(n){e.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(e.idbdb.version/10)===t._cfg.version?(e.idbdb.deleteObjectStore("$meta"),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter(function(e){return"$meta"!==e})):n.objectStore("$meta").put(t._cfg.version,"version"))})}),(function e(){return r.length?eg.resolve(r.shift()(y.idbtrans)).then(e):eg.resolve()})().then(function(){tW(i,s)})):eg.resolve()}).catch(v)):(o(p).forEach(function(e){tz(s,e,p[e].primKey,p[e].indexes)}),tF(e,s),void eg.follow(function(){return e.on.populate.fire(y)}).catch(v))}))},c),d.onsuccess=eA(function(){l=null;var n,u,c,p=e.idbdb=d.result,y=m(p.objectStoreNames);if(0<y.length)try{var v=p.transaction(1===y.length?y[0]:y,"readonly");if(t.autoSchema)n=p,u=v,e.verno=n.version/10,u=e._dbSchema=tY(0,n,u),e._storeNames=m(n.objectStoreNames,0),tM(e,[e._allTables],o(u),u);else if(tQ(e,e._dbSchema,v),((c=tV(tY(0,(c=e).idbdb,v),c._dbSchema)).add.length||c.change.some(function(e){return e.add.length||e.change.length}))&&!a)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),p.close(),i=p.version+1,a=!0,s(r());tF(e,v)}catch(e){}eJ.push(e),p.onversionchange=eA(function(n){t.vcFired=!0,e.on("versionchange").fire(n)}),p.onclose=eA(function(t){e.on("close").fire(t)}),f&&(c=e._deps,v=h,p=c.indexedDB,c=c.IDBKeyRange,tZ(p)||v===eZ||tJ(p,c).put({name:v}).catch(G)),s()},c)}).catch(function(e){switch(null==e?void 0:e.name){case"UnknownError":if(0<t.PR1398_maxLoop)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),r();break;case"VersionError":if(0<i)return i=0,r()}return eg.reject(e)})})]).then(function(){return u(),t.onReadyBeingFired=[],eg.resolve(t0(function(){return e.on.ready.fire(e.vip)})).then(function n(){if(0<t.onReadyBeingFired.length){var r=t.onReadyBeingFired.reduce(er,G);return t.onReadyBeingFired=[],eg.resolve(t0(function(){return r(e.vip)})).then(n)}})}).finally(function(){t.openCanceller===r&&(t.onReadyBeingFired=null,t.isBeingOpened=!1)}).catch(function(n){t.dbOpenError=n;try{l&&l.abort()}catch(e){}return r===t.openCanceller&&e._close(),eQ(n)}).finally(function(){t.openComplete=!0,c()}).then(function(){var t;return f&&(t={},e.tables.forEach(function(n){n.schema.indexes.forEach(function(r){r.name&&(t["idb://".concat(e.name,"/").concat(n.name,"/").concat(r.name)]=new t3(-1/0,[[[]]]))}),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new t3(-1/0,[[[]]])}),tS(tE).fire(t),no(t,!0)),e})}(e)})},nP.prototype._close=function(){var e=this._state,t=eJ.indexOf(this);if(0<=t&&eJ.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new eg(function(t){e.dbReadyResolve=t}),e.openCanceller=new eg(function(t,n){e.cancelOpen=n}))},nP.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen,e=this._state;t?(e.isBeingOpened&&e.cancelOpen(new $.DatabaseClosed),this._close(),e.autoOpen=!1,e.dbOpenError=new $.DatabaseClosed):(this._close(),e.autoOpen=this._options.autoOpen||e.isBeingOpened,e.openComplete=!1,e.dbOpenError=null)},nP.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=0<arguments.length&&"object"!=typeof arguments[0],r=this._state;return new eg(function(i,o){function a(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=eA(function(){var e,n,r;e=t._deps,n=t.name,r=e.indexedDB,e=e.IDBKeyRange,tZ(r)||n===eZ||tJ(r,e).delete(n).catch(G),i()}),n.onerror=tO(o),n.onblocked=t._fireOnBlocked}if(n)throw new $.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()})},nP.prototype.backendDB=function(){return this.idbdb},nP.prototype.isOpen=function(){return null!==this.idbdb},nP.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},nP.prototype.hasFailed=function(){return null!==this._state.dbOpenError},nP.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(nP.prototype,"tables",{get:function(){var e=this;return o(this._allTables).map(function(t){return e._allTables[t]})},enumerable:!1,configurable:!0}),nP.prototype.transaction=function(){var e=(function(e,t,n){var r=arguments.length;if(r<2)throw new $.InvalidArgument("Too few arguments");for(var i=Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,P(i),n]}).apply(this,arguments);return this._transaction.apply(this,e)},nP.prototype._transaction=function(e,t,n){var r=this,i=ey.trans;i&&i.db===this&&-1===e.indexOf("!")||(i=null);var o,a,u=-1!==e.indexOf("?");e=e.replace("!","").replace("?","");try{if(a=t.map(function(e){if(e=e instanceof r.Table?e.name:e,"string"!=typeof e)throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return e}),"r"==e||e===e0)o=e0;else{if("rw"!=e&&e!=e1)throw new $.InvalidArgument("Invalid transaction mode: "+e);o=e1}if(i){if(i.mode===e0&&o===e1){if(!u)throw new $.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");i=null}i&&a.forEach(function(e){if(i&&-1===i.storeNames.indexOf(e)){if(!u)throw new $.SubTransaction("Table "+e+" not included in parent transaction.");i=null}}),u&&i&&!i.active&&(i=null)}}catch(e){return i?i._promise(null,function(t,n){n(e)}):eQ(e)}var s=(function e(t,n,r,i,o){return eg.resolve().then(function(){var a=ey.transless||ey,u=t._createTransaction(n,r,t._dbSchema,i);if(u.explicit=!0,a={trans:u,transless:a},i)u.idbtrans=i.idbtrans;else try{u.create(),u.idbtrans._explicit=!0,t._state.PR1398_maxLoop=3}catch(i){return i.name===W.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then(function(){return e(t,n,r,null,o)})):eQ(i)}var s,c=R(o);return c&&eF(),a=eg.follow(function(){var e;(s=o.call(u,u))&&(c?(e=eM.bind(null,null),s.then(e,e)):"function"==typeof s.next&&"function"==typeof s.throw&&(s=nu(s)))},a),(s&&"function"==typeof s.then?eg.resolve(s).then(function(e){return u.active?e:eQ(new $.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):a.then(function(){return s})).then(function(e){return i&&u._resolve(),u._completion.then(function(){return e})}).catch(function(e){return u._reject(e),eQ(e)})})}).bind(null,this,o,a,i,n);return i?i._promise(o,s,"lock"):ey.trans?eW(ey.transless,function(){return r._whenReady(s)}):this._whenReady(s)},nP.prototype.table=function(e){if(!l(this._allTables,e))throw new $.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},nP);function nP(e,n){var r=this;this._middlewares={},this.verno=0;var i=nP.dependencies;this._options=n=t({addons:nP.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange,cache:"cloned"},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange},i=n.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var o,a,u,s,c,l={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:G,dbReadyPromise:null,cancelOpen:G,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:n.autoOpen};l.dbReadyPromise=new eg(function(e){l.dbReadyResolve=e}),l.openCanceller=new eg(function(e,t){l.cancelOpen=t}),this._state=l,this.name=e,this.on=tt(this,"populate","blocked","versionchange","close",{ready:[er,G]}),this.on.ready.subscribe=b(this.on.ready.subscribe,function(e){return function(t,n){nP.vip(function(){var i=r._state;i.openComplete?(i.dbOpenError||eg.resolve().then(t),n&&e(t)):i.onReadyBeingFired?(i.onReadyBeingFired.push(t),n&&e(t)):(e(t),n||e(function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))})}}),this.Collection=(o=this,tn(th.prototype,function(e,t){this.db=o;var n=e2,r=null;if(t)try{n=t()}catch(e){r=e}var i=e._ctx,t=i.table,e=t.hook.reading.fire;this._ctx={table:t,index:i.index,isPrimKey:!i.index||t.schema.primKey.keyPath&&i.index===t.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:i.or,valueMapper:e!==X?e:null}})),this.Table=(a=this,tn(e7.prototype,function(e,t,n){this.db=a,this._tx=n,this.name=e,this.schema=t,this.hook=a._allTables[e]?a._allTables[e].hook:tt(null,{creating:[Z,G],reading:[H,X],updating:[et,G],deleting:[ee,G]})})),this.Transaction=(u=this,tn(tj.prototype,function(e,t,n,r,i){var o=this;this.db=u,this.mode=e,this.storeNames=t,this.schema=n,this.chromeTransactionDurability=r,this.idbtrans=null,this.on=tt(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 eg(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(),eQ(e)})})),this.Version=(s=this,tn(tX.prototype,function(e){this.db=s,this._cfg={version:e,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(c=this,tn(tx.prototype,function(e,t,n){if(this.db=c,this._ctx={table:e,index:":id"===t?null:t,or:n},this._cmp=this._ascending=e5,this._descending=function(e,t){return e5(t,e)},this._max=function(e,t){return 0<e5(e,t)?e:t},this._min=function(e,t){return 0>e5(e,t)?e:t},this._IDBKeyRange=c._deps.IDBKeyRange,!this._IDBKeyRange)throw new $.MissingAPI})),this.on("versionchange",function(e){0<e.newVersion?console.warn("Another connection wants to upgrade database '".concat(r.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(r.name,"'. Closing db now to resume the delete request.")),r.close({disableAutoOpen:!1})}),this.on("blocked",function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(r.name,"') was blocked")):console.warn("Upgrade '".concat(r.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))}),this._maxKey=tq(n.IDBKeyRange),this._createTransaction=function(e,t,n,i){return new r.Transaction(e,t,n,r._options.chromeTransactionDurability,i)},this._fireOnBlocked=function(e){r.on("blocked").fire(e),eJ.filter(function(e){return e.name===r.name&&e!==r&&!e._state.vcFired}).map(function(t){return t.on("versionchange").fire(e)})},this.use(np),this.use(nx),this.use(nm),this.use(nc),this.use(nh);var f=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return nk(r.table(e),f)};var i=Reflect.get(e,t,n);return i instanceof e7?nk(i,f):"tables"===t?i.map(function(e){return nk(e,f)}):"_createTransaction"===t?function(){return nk(i.apply(this,arguments),f)}:i}});this.vip=f,i.forEach(function(e){return e(r)})}var nE,F="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",nK=(nS.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},nS.prototype[F]=function(){return this},nS);function nS(e){this._subscribe=e}try{nE={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(e){nE={indexedDB:null,IDBKeyRange:null}}function nj(e){var t,n=!1,r=new nK(function(r){var i,o=R(e),a=!1,u={},s={},c={get closed(){return a},unsubscribe:function(){a||(a=!0,i&&i.abort(),f&&tS.storagemutated.unsubscribe(d))}};r.start&&r.start(c);var f=!1,h=function(){return eY(p)},d=function(e){t7(u,e),ne(s,u)&&h()},p=function(){var c,p;!a&&nE.indexedDB&&(u={},c={},i&&i.abort(),Promise.resolve(function(t){var n=eK();try{o&&eF();var r=eN(e,t);return r=o?r.finally(eM):r}finally{n&&eS()}}(p={subscr:c,signal:(i=new AbortController).signal,requery:h,querier:e,trans:null})).then(function(e){n=!0,t=e,a||p.signal.aborted||(u={},function(e){for(var t in e)if(l(e,t))return;return 1}(s=c)||f||(tS(tE,d),f=!0),eY(function(){return!a&&r.next&&r.next(e)}))},function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||a||eY(function(){a||r.error&&r.error(e)})}))};return setTimeout(h,0),c});return r.hasValue=function(){return n},r.getValue=function(){return t},r}function nC(e){var t=nD;try{nD=!0,tS.storagemutated.fire(e),no(e,!0)}finally{nD=t}}f(nO,t(t({},Q),{delete:function(e){return new nO(e,{addons:[]}).delete()},exists:function(e){return new nO(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){var t,n;try{return n=(t=nO.dependencies).indexedDB,t=t.IDBKeyRange,(tZ(n)?Promise.resolve(n.databases()).then(function(e){return e.map(function(e){return e.name}).filter(function(e){return e!==eZ})}):tJ(n,t).toCollection().primaryKeys()).then(e)}catch(e){return eQ(new $.MissingAPI)}},defineClass:function(){return function(e){u(this,e)}},ignoreTransaction:function(e){return ey.trans?eW(ey.transless,e):e()},vip:t0,async:function(e){return function(){try{var t=nu(e.apply(this,arguments));return t&&"function"==typeof t.then?t:eg.resolve(t)}catch(e){return eQ(e)}}},spawn:function(e,t,n){try{var r=nu(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:eg.resolve(r)}catch(e){return eQ(e)}},currentTransaction:{get:function(){return ey.trans||null}},waitFor:function(e,t){return t=eg.resolve("function"==typeof e?nO.ignoreTransaction(e):e).timeout(t||6e4),ey.trans?ey.trans.waitFor(t):t},Promise:eg,debug:{get:function(){return ei},set:function(e){ei=e}},derive:p,extend:u,props:f,override:b,Events:tt,on:tS,liveQuery:nj,extendObservabilitySet:t7,getByKeyPath:_,setByKeyPath:x,delByKeyPath:function(e,t){"string"==typeof t?x(e,t,void 0):"length"in t&&[].map.call(t,function(t){x(e,t,void 0)})},shallowClone:k,deepClone:j,getObjectDiff:nl,cmp:e5,asap:w,minKey:-1/0,addons:[],connections:eJ,errnames:W,dependencies:nE,cache:nt,semVer:"4.0.7",version:"4.0.7".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),nO.maxKey=tq(nO.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(tS(tE,function(e){nD||(e=new CustomEvent(tK,{detail:e}),nD=!0,dispatchEvent(e),nD=!1)}),addEventListener(tK,function(e){e=e.detail,nD||nC(e)}));var nA,nD=!1,nT=function(){};return"undefined"!=typeof BroadcastChannel&&((nT=function(){(nA=new BroadcastChannel(tK)).onmessage=function(e){return e.data&&nC(e.data)}})(),"function"==typeof nA.unref&&nA.unref(),tS(tE,function(e){nD||nA.postMessage(e)})),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",function(e){if(!nO.disableBfCache&&e.persisted){ei&&console.debug("Dexie: handling persisted pagehide"),null!=nA&&nA.close();for(var t=0;t<eJ.length;t++)eJ[t].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(e){!nO.disableBfCache&&e.persisted&&(ei&&console.debug("Dexie: handling persisted pageshow"),nT(),nC({all:new t3(-1/0,[[]])}))})),eg.rejectionMapper=function(e,t){return!e||e instanceof L||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Y[e.name]?e:(t=new Y[e.name](t||e.message,e),"stack"in e&&d(t,"stack",{get:function(){return this.inner.stack}}),t)},t(nO,Object.freeze({__proto__:null,Dexie:nO,liveQuery:nj,Entity:e4,cmp:e5,PropModSymbol:E,PropModification:tl,replacePrefix:function(e,t){return new tl({replacePrefix:[e,t]})},add:function(e){return new tl({add:e})},remove:function(e){return new tl({remove:e})},default:nO,RangeSet:t3,mergeRanges:t8,rangesOverlap:t4}),{default:nO}),nO},e.exports=r()},14635:function(e,t,n){"use strict";var r=n(53185);let i=Symbol.for("Dexie"),o=globalThis[i]||(globalThis[i]=r);if(r.semVer!==o.semVer)throw Error(`Two different versions of Dexie loaded in the same app: ${r.semVer} and ${o.semVer}`);let{liveQuery:a,mergeRanges:u,rangesOverlap:s,RangeSet:c,cmp:l,Entity:f,PropModSymbol:h,PropModification:d,replacePrefix:p,add:y,remove:v}=o;t.ZP=o}}]); |