@iss-ai/easy-web-store 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +311 -0
- package/lib/index.cjs.js +1 -0
- package/lib/index.esm.js +1 -0
- package/lib/index.min.js +1 -0
- package/lib/index.umd.js +1 -0
- package/lib/src/easy/DexieStore.d.ts +127 -0
- package/lib/src/index.d.ts +2 -0
- package/lib/src/interface/types.d.ts +121 -0
- package/package.json +86 -0
package/lib/index.esm.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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])},e(t,n)};var 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},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a={exports:{}};a.exports=function(){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])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new 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)}var n=function(){return n=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},n.apply(this,arguments)};function r(e,t,n){for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:i,a=Object.keys,u=Array.isArray;function s(e,t){return"object"!=typeof t||a(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||o.Promise||(o.Promise=Promise);var c=Object.getPrototypeOf,l={}.hasOwnProperty;function f(e,t){return l.call(e,t)}function h(e,t){"function"==typeof t&&(t=t(c(e))),("undefined"==typeof Reflect?a:Reflect.ownKeys)(t).forEach((function(n){p(e,n,t[n])}))}var d=Object.defineProperty;function p(e,t,n,r){d(e,t,s(n&&f(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function v(e){return{from:function(t){return e.prototype=Object.create(t.prototype),p(e.prototype,"constructor",e),{extend:h.bind(null,e.prototype)}}}}var y=Object.getOwnPropertyDescriptor;function m(e,t){var n;return y(e,t)||(n=c(e))&&m(n,t)}var b=[].slice;function g(e,t,n){return b.call(e,t,n)}function w(e,t){return t(e)}function _(e){if(!e)throw new Error("Assertion Failed")}function x(e){o.setImmediate?setImmediate(e):setTimeout(e,0)}function k(e,t){return e.reduce((function(e,n,r){var i=t(n,r);return i&&(e[i[0]]=i[1]),e}),{})}function O(e,t){if("string"==typeof t&&f(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=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:O(u,t.substr(a+1))}}function P(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){_("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)P(e,t[r],n[r])}else{var o=t.indexOf(".");if(-1!==o){var a=t.substr(0,o),s=t.substr(o+1);if(""===s)void 0===n?u(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var c=e[a];c&&f(e,a)||(c=e[a]={}),P(c,s,n)}}else void 0===n?u(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function E(e,t){"string"==typeof t?P(e,t,void 0):"length"in t&&[].map.call(t,(function(t){P(e,t,void 0)}))}function S(e){var t={};for(var n in e)f(e,n)&&(t[n]=e[n]);return t}var K=[].concat;function A(e){return K.apply([],e)}var j="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(A([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return o[e]})),C=new Set(j.map((function(e){return o[e]})));function T(e){var t={};for(var n in e)if(f(e,n)){var r=e[n];t[n]=!r||"object"!=typeof r||C.has(r.constructor)?r:T(r)}return t}var I=null;function D(e){I=new WeakMap;var t=q(e);return I=null,t}function q(e){if(!e||"object"!=typeof e)return e;var t=I.get(e);if(t)return t;if(u(e)){t=[],I.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(q(e[n]))}else if(C.has(e.constructor))t=e;else{var i=c(e);for(var o in t=i===Object.prototype?{}:Object.create(i),I.set(e,t),e)f(e,o)&&(t[o]=q(e[o]))}return t}var R={}.toString;function B(e){return R.call(e).slice(8,-1)}var F="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",N="symbol"==typeof F?function(e){var t;return null!=e&&(t=e[F])&&t.apply(e)}:function(){return null};function M(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n>=0}var L={};function $(e){var t,n,r,i;if(1===arguments.length){if(u(e))return e.slice();if(this===L&&"string"==typeof e)return[e];if(i=N(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var U="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},z=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],V=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(z),W={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 Y(e,t){this.name=e,this.message=t}function Q(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 G(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Q(e,t)}function X(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=Q(e,this.failures)}v(Y).from(Error).extend({toString:function(){return this.name+": "+this.message}}),v(G).from(Y),v(X).from(Y);var H=V.reduce((function(e,t){return e[t]=t+"Error",e}),{}),J=Y,Z=V.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=W[t]||n,this.inner=null)}return v(r).from(J),e[t]=r,e}),{});Z.Syntax=SyntaxError,Z.Type=TypeError,Z.Range=RangeError;var ee=z.reduce((function(e,t){return e[t+"Error"]=Z[t],e}),{});function te(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ee[e.name])return e;var n=new ee[e.name](t||e.message,e);return"stack"in e&&p(n,"stack",{get:function(){return this.inner.stack}}),n}var ne=V.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=Z[t]),e}),{});function re(){}function ie(e){return e}function oe(e,t){return null==e||e===ie?t:function(n){return t(e(n))}}function ae(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ue(e,t){return e===re?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?ae(r,this.onsuccess):r),i&&(this.onerror=this.onerror?ae(i,this.onerror):i),void 0!==o?o:n}}function se(e,t){return e===re?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?ae(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ae(r,this.onerror):r)}}function ce(e,t){return e===re?t:function(n){var r=e.apply(this,arguments);s(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?ae(i,this.onsuccess):i),o&&(this.onerror=this.onerror?ae(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===re?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function fe(e,t){return e===re?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}ne.ModifyError=G,ne.DexieError=Y,ne.BulkError=X;var he="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function de(e,t){he=e}var pe={},ve=100,ye="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,c(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,c(t),e]}(),me=ye[0],be=ye[1],ge=ye[2],we=be&&be.then,_e=me&&me.constructor,xe=!!ge;function ke(){queueMicrotask(Ue)}var Oe=function(e,t){Te.push([e,t]),Ee&&(ke(),Ee=!1)},Pe=!0,Ee=!0,Se=[],Ke=[],Ae=ie,je={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:re,pgp:!1,env:{},finalize:re},Ce=je,Te=[],Ie=0,De=[];function qe(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=Ce;if("function"!=typeof e){if(e!==pe)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Ne(this,this._value))}this._state=null,this._value=null,++t.ref,Fe(this,e)}var Re={get:function(){var e=Ce,t=nt;function n(n,r){var i=this,o=!e.global&&(e!==Ce||t!==nt),a=o&&!at(),u=new qe((function(t,u){Le(i,new Be(dt(n,e,o,a),dt(r,e,o,a),t,u,e))}));return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=pe,n},set:function(e){p(this,"then",e&&e.prototype===pe?Re:{get:function(){return e},set:Re.set})}};function Be(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 Fe(e,t){try{t((function(t){if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&ze();t&&"function"==typeof t.then?Fe(e,(function(e,n){t instanceof qe?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Ne.bind(null,e))}catch(t){Ne(e,t)}}function Ne(e,t){if(Ke.push(t),null===e._state){var n=e._lib&&ze();t=Ae(t),e._state=!1,e._value=t,Qe(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Le(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===Ie&&(++Ie,Oe((function(){0==--Ie&&We()}),[]))}function Le(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,++Ie,Oe($e,[n,e,t])}else e._listeners.push(t)}function $e(e,t,n){try{var r,i=t._value;!t._state&&Ke.length&&(Ke=[]),r=he&&t._consoleTask?t._consoleTask.run((function(){return e(i)})):e(i),t._state||-1!==Ke.indexOf(i)||Ge(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--Ie&&We(),--n.psd.ref||n.psd.finalize()}}function Ue(){ht(je,(function(){ze()&&Ve()}))}function ze(){var e=Pe;return Pe=!1,Ee=!1,e}function Ve(){var e,t,n;do{for(;Te.length>0;)for(e=Te,Te=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Te.length>0);Pe=!0,Ee=!0}function We(){var e=Se;Se=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=De.slice(0),n=t.length;n;)t[--n]()}function Ye(e){function t(){e(),De.splice(De.indexOf(t),1)}De.push(t),++Ie,Oe((function(){0==--Ie&&We()}),[])}function Qe(e){Se.some((function(t){return t._value===e._value}))||Se.push(e)}function Ge(e){for(var t=Se.length;t;)if(Se[--t]._value===e._value)return void Se.splice(t,1)}function Xe(e){return new qe(pe,!1,e)}function He(e,t){var n=Ce;return function(){var r=ze(),i=Ce;try{return lt(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{lt(i,!1),r&&Ve()}}}h(qe.prototype,{then:Re,_then:function(e,t){Le(this,new Be(null,null,e,t,Ce))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return e instanceof t?n(e):Xe(e)})):this.then(null,(function(e){return e&&e.name===t?n(e):Xe(e)}))},finally:function(e){return this.then((function(t){return qe.resolve(e()).then((function(){return t}))}),(function(t){return qe.resolve(e()).then((function(){return Xe(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new qe((function(r,i){var o=setTimeout((function(){return i(new Z.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&p(qe.prototype,Symbol.toStringTag,"Dexie.Promise"),je.env=ft(),h(qe,{all:function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return qe.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof qe?e:e&&"function"==typeof e.then?new qe((function(t,n){e.then(t,n)})):new qe(pe,!0,e)},reject:Xe,race:function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t,n){e.map((function(e){return qe.resolve(e).then(t,n)}))}))},PSD:{get:function(){return Ce},set:function(e){return Ce=e}},totalEchoes:{get:function(){return nt}},newPSD:it,usePSD:ht,scheduler:{get:function(){return Oe},set:function(e){Oe=e}},rejectionMapper:{get:function(){return Ae},set:function(e){Ae=e}},follow:function(e,t){return new qe((function(n,r){return it((function(t,n){var r=Ce;r.unhandleds=[],r.onunhandled=n,r.finalize=ae((function(){var e=this;Ye((function(){0===e.unhandleds.length?t():n(e.unhandleds[0])}))}),r.finalize),e()}),t,n,r)}))}}),_e&&(_e.allSettled&&p(qe,"allSettled",(function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,i){return qe.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)}))}))}))})),_e.any&&"undefined"!=typeof AggregateError&&p(qe,"any",(function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return qe.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})),_e.withResolvers&&(qe.withResolvers=_e.withResolvers));var Je={awaits:0,echoes:0,id:0},Ze=0,et=[],tt=0,nt=0,rt=0;function it(e,t,n,r){var i=Ce,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++rt,je.env,o.env=xe?{Promise:qe,PromiseProp:{value:qe,configurable:!0,writable:!0},all:qe.all,race:qe.race,allSettled:qe.allSettled,any:qe.any,resolve:qe.resolve,reject:qe.reject}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=ht(o,e,n,r);return 0===o.ref&&o.finalize(),a}function ot(){return Je.id||(Je.id=++Ze),++Je.awaits,Je.echoes+=ve,Je.id}function at(){return!!Je.awaits&&(0==--Je.awaits&&(Je.id=0),Je.echoes=Je.awaits*ve,!0)}function ut(e){return Je.echoes&&e&&e.constructor===_e?(ot(),e.then((function(e){return at(),e}),(function(e){return at(),vt(e)}))):e}function st(e){++nt,Je.echoes&&0!=--Je.echoes||(Je.echoes=Je.awaits=Je.id=0),et.push(Ce),lt(e,!0)}function ct(){var e=et[et.length-1];et.pop(),lt(e,!1)}function lt(e,t){var n=Ce;if((t?!Je.echoes||tt++&&e===Ce:!tt||--tt&&e===Ce)||queueMicrotask(t?st.bind(null,e):ct),e!==Ce&&(Ce=e,n===je&&(je.env=ft()),xe)){var r=je.env.Promise,i=e.env;(n.global||e.global)&&(Object.defineProperty(o,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function ft(){var e=o.Promise;return xe?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function ht(e,t,n,r,i){var o=Ce;try{return lt(e,!0),t(n,r,i)}finally{lt(o,!1)}}function dt(e,t,n,r){return"function"!=typeof e?e:function(){var i=Ce;n&&ot(),lt(t,!0);try{return e.apply(this,arguments)}finally{lt(i,!1),r&&queueMicrotask(at)}}}function pt(e){Promise===_e&&0===Je.echoes?0===tt?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+we).indexOf("[native code]")&&(ot=at=re);var vt=qe.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Ce.letThrough||e._vip)){var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(i){return i.name===H.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e.close({disableAutoOpen:!1}),e.open().then((function(){return yt(e,t,n,r)}))):vt(i)}return i._promise(t,(function(e,t){return it((function(){return Ce.trans=i,r(e,t,i)}))})).then((function(e){if("readwrite"===t)try{i.idbtrans.commit()}catch(e){}return"readonly"===t?e:i._completion.then((function(){return e}))}))}if(e._state.openComplete)return vt(new Z.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._state.autoOpen)return vt(new Z.DatabaseClosed);e.open().catch(re)}return e._state.dbReadyPromise.then((function(){return yt(e,t,n,r)}))}var mt="4.4.2",bt=String.fromCharCode(65535),gt=-1/0,wt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",_t="String expected.",xt=1e3,kt="__dbnames",Ot="readonly",Pt="readwrite";function Et(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var St={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Kt(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=D(t))[e],t}}function At(){throw Z.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function jt(e,t){try{var n=It(e),r=It(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 e>t?1:e<t?-1:0;case"binary":return Tt(Dt(e),Dt(t));case"Array":return Ct(e,t)}}catch(e){}return NaN}function Ct(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=jt(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}function Tt(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}function It(e){var t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";var n=B(e);return"ArrayBuffer"===n?"binary":n}function Dt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function qt(e,t,n){var r=e.schema.yProps;return r?(t&&n.numFailures>0&&(t=t.filter((function(e,t){return!n.failures[t]}))),Promise.all(r.map((function(n){var r=n.updatesTable;return t?e.db.table(r).where("k").anyOf(t).delete():e.db.table(r).clear()}))).then((function(){return n}))):n}var Rt=function(){function e(e){this["@@propmod"]=e}return e.prototype.execute=function(e){var t,n=this["@@propmod"];if(void 0!==n.add){var i=n.add;if(u(i))return r(r([],u(e)?e:[],!0),i).sort();if("number"==typeof i)return(Number(e)||0)+i;if("bigint"==typeof i)try{return BigInt(e)+i}catch(e){return BigInt(0)+i}throw new TypeError("Invalid term ".concat(i))}if(void 0!==n.remove){var o=n.remove;if(u(o))return u(e)?e.filter((function(e){return!o.includes(e)})).sort():[];if("number"==typeof o)return Number(e)-o;if("bigint"==typeof o)try{return BigInt(e)-o}catch(e){return BigInt(0)-o}throw new TypeError("Invalid subtrahend ".concat(o))}var a=null===(t=n.replacePrefix)||void 0===t?void 0:t[0];return a&&"string"==typeof e&&e.startsWith(a)?n.replacePrefix[1]+e.substring(a.length):e},e}();function Bt(e,t){for(var n=a(t),r=n.length,i=!1,o=0;o<r;++o){var u=n[o],s=t[u],c=O(e,u);s instanceof Rt?(P(e,u,s.execute(c)),i=!0):c!==s&&(P(e,u,s),i=!0)}return i}var Ft=function(){function e(){}return e.prototype._trans=function(e,t,n){var r=this._tx||Ce.trans,i=this.name,o=he&&"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 Z.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=ze();try{var s=r&&r.db._novip===this.db._novip?r===Ce.trans?r._promise(e,a,n):it((function(){return r._promise(e,a,n)}),{trans:r,transless:Ce.transless||Ce}):yt(this.db,e,[this.name],a);return o&&(s._consoleTask=o,s=s.catch((function(e){return console.trace(e),vt(e)}))),s}finally{u&&Ve()}},e.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?vt(new Z.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)},e.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(u(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=a(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 e.keyPath.indexOf(t)>=0}))){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!==bt){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}!n&&he&&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;function o(e,t){return 0===jt(e,t)}var s=t.reduce((function(t,n){var r=t[0],a=t[1],s=i[n],c=e[n];return[r||s,r||!s?Et(a,s&&s.multi?function(e){var t=O(e,n);return u(t)&&t.some((function(e){return o(c,e)}))}:function(e){return o(c,O(e,n))}):a]}),[null,null]),c=s[0],l=s[1];return c?this.where(c.name).equals(e[c.keyPath]).filter(l):n?this.filter(l):this.where(t).equals("")},e.prototype.filter=function(e){return this.toCollection().and(e)},e.prototype.count=function(e){return this.toCollection().count(e)},e.prototype.offset=function(e){return this.toCollection().offset(e)},e.prototype.limit=function(e){return this.toCollection().limit(e)},e.prototype.each=function(e){return this.toCollection().each(e)},e.prototype.toArray=function(e){return this.toCollection().toArray(e)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,u(e)?"[".concat(e.join("+"),"]"):e))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(e){var n=this,r=n.db,i=n.name;this.schema.mappedClass=e,e.prototype instanceof At&&(e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),Object.defineProperty(n.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),n.prototype.table=function(){return i},n}(e));for(var o=new Set,a=e.prototype;a;a=c(a))Object.getOwnPropertyNames(a).forEach((function(e){return o.add(e)}));var u=function(t){if(!t)return t;var n=Object.create(e.prototype);for(var r in t)if(!o.has(r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=u,this.hook("reading",u),e},e.prototype.defineClass=function(){function e(e){s(this,e)}return this.mapToClass(e)},e.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=Kt(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?qe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{P(e,o,t)}catch(e){}return t}))},e.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans("readwrite",(function(i){return n.core.get({trans:i,key:e}).then((function(o){var a=null!=o?o:{};return Bt(a,t),r&&P(a,r,e),n.core.mutate({trans:i,type:"put",values:[a],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then((function(e){return e.numFailures?qe.reject(e.failures[0]):!!o}))}))}))},e.prototype.update=function(e,t){if("object"!=typeof e||u(e))return this.where(":id").equals(e).modify(t);var n=O(e,this.schema.primKey.keyPath);return void 0===n?vt(new Z.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(n).modify(t)},e.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=Kt(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?qe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{P(e,o,t)}catch(e){}return t}))},e.prototype.delete=function(e){var t=this;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]}).then((function(n){return qt(t,[e],n)})).then((function(e){return e.numFailures?qe.reject(e.failures[0]):void 0}))}))},e.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:St}).then((function(t){return qt(e,null,t)}))})).then((function(e){return e.numFailures?qe.reject(e.failures[0]):void 0}))},e.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},e.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=r.schema.primKey,a=n.auto,u=n.keyPath;if(u&&i)throw new Z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new Z.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=u&&a?e.map(Kt(u)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:c,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult,a=e.failures;if(0===t)return o?n:i;throw new X("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(s," operations failed"),a)}))}))},e.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=r.schema.primKey,a=n.auto,u=n.keyPath;if(u&&i)throw new Z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new Z.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=u&&a?e.map(Kt(u)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:c,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult,a=e.failures;if(0===t)return o?n:i;throw new X("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(s," operations failed"),a)}))}))},e.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!==jt(d,r))throw new Z.Constraint("Cannot update primary key in bulkUpdate()")}else P(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=a[i],s=o[Number(u)];if(null!=s){var c=r[u];delete r[u],r[s]=c}}throw new X("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},e.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e}).then((function(n){return qt(t,e,n)}))})).then((function(e){var r=e.numFailures,i=e.lastResult,o=e.failures;if(0===r)return i;throw new X("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),o)}))},e}();function Nt(e){var t={},n=function(n,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(e,r,i){if("object"==typeof e)return s(e);r||(r=le),i||(i=re);var o={subscribers:[],fire:i,subscribe:function(e){-1===o.subscribers.indexOf(e)&&(o.subscribers.push(e),o.fire=r(o.fire,e))},unsubscribe:function(e){o.subscribers=o.subscribers.filter((function(t){return t!==e})),o.fire=o.subscribers.reduce(r,i)}};return t[e]=n[e]=o,o}function s(e){a(e).forEach((function(t){var n=e[t];if(u(n))o(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new Z.InvalidArgument("Invalid event config");var r=o(t,ie,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach((function(e){x((function(){e.apply(null,t)}))}))}))}}))}}function Mt(e,t){return v(t).from({prototype:e}),t}function Lt(e){return Mt(Ft.prototype,(function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:Nt(null,{creating:[ue,re],reading:[oe,ie],updating:[ce,re],deleting:[se,re]})}))}function $t(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Ut(e,t){e.filter=Et(e.filter,t)}function zt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Et(r(),t())}:t,e.justLimit=n&&!r}function Vt(e,t){e.isMatch=Et(e.isMatch,t)}function Wt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new Z.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Yt(e,t,n){var r=Wt(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 Qt(e,t,n,r){var i=e.replayFilter?Et(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){if(!i||i(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))){var a=n.primaryKey,u=""+a;"[object ArrayBuffer]"===u&&(u=""+new Uint8Array(a)),f(o,u)||(o[u]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(a,n),Gt(Yt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return Gt(Yt(e,r,n),Et(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Gt(e,t,n,r){var i=He(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=re}),(function(t){e.fail(t),n=re}))||i(e.value,e,(function(e){return n=e})),n()}))}))}var Xt=function(){function e(){}return e.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,vt.bind(null,n.error)):n.table._trans("readonly",e).then(t)},e.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,vt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},e.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Et(t.algorithm,e)},e.prototype._iterate=function(e,t){return Qt(this._ctx,e,t,this._ctx.table.core)},e.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return Qt(t,e,n,t.table.core)}))},e.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if($t(n,!0))return r.count({trans:e,query:{index:Wt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var i=0;return Qt(n,(function(){return++i,!1}),e,r).then((function(){return i}))})).then(e)},e.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function u(e,t){return jt(o(e,i),o(t,i))*a}return this.toArray((function(e){return e.sort(u)})).then(t)},e.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if($t(n,!0)&&n.limit>0){var r=n.valueMapper,i=Wt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,direction:"prev"===n.dir?"prev":void 0,query:{index:i,range:n.range}}).then((function(e){var t=e.result;return r?t.map(r):t}))}var o=[];return Qt(n,(function(e){return o.push(e)}),e,n.table.core).then((function(){return o}))}),e)},e.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,$t(t)?zt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?(--t,!1):(n((function(){e.advance(t),t=0})),!1))}})):zt(t,(function(){var t=e;return function(){return--t<0}}))),this},e.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),zt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this},e.prototype.until=function(e,t){return Ut(this._ctx,(function(n,r,i){return!e(n.value)||(r(i),t)})),this},e.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},e.prototype.last=function(e){return this.reverse().first(e)},e.prototype.filter=function(e){return Ut(this._ctx,(function(t){return e(t.value)})),Vt(this._ctx,e),this},e.prototype.and=function(e){return this.filter(e)},e.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},e.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},e.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},e.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},e.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},e.prototype.primaryKeys=function(e){var t=this._ctx;if($t(t,!0)&&t.limit>0)return this._read((function(e){var n=Wt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,direction:"prev"===t.dir?"prev":void 0,query:{index:n,range:t.range}})})).then((function(e){return e.result})).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)},e.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},e.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},e.prototype.lastKey=function(e){return this.reverse().firstKey(e)},e.prototype.distinct=function(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Ut(this._ctx,(function(e){var t=e.primaryKey.toString(),r=f(n,t);return n[t]=!0,!r})),this},e.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var i;i="function"==typeof e?e:function(t){return Bt(t,e)};var o=n.table.core,u=o.schema.primaryKey,s=u.outbound,c=u.extractKey,l=200,f=t.db._options.modifyChunkSize;f&&(l="object"==typeof f?f[o.name]||f["*"]||200:f);var h=[],d=0,p=[],v=function(e,t){var n=t.failures,r=t.numFailures;d+=e-r;for(var i=0,o=a(n);i<o.length;i++){var u=o[i];h.push(n[u])}},y=e===Ht;return t.clone().primaryKeys().then((function(t){var a=$t(n)&&n.limit===1/0&&("function"!=typeof e||y)&&{index:n.index,range:n.range},u=function(f){var h=Math.min(l,t.length-f),d=t.slice(f,f+h);return(y?Promise.resolve([]):o.getMany({trans:r,keys:d,cache:"immutable"})).then((function(p){var m=[],b=[],g=s?[]:null,w=y?d:[];if(!y)for(var _=0;_<h;++_){var x=p[_],k={value:D(x),primKey:t[f+_]};!1!==i.call(k,k.value,k)&&(null==k.value?w.push(t[f+_]):s||0===jt(c(x),c(k.value))?(b.push(k.value),s&&g.push(t[f+_])):(w.push(t[f+_]),m.push(k.value)))}return Promise.resolve(m.length>0&&o.mutate({trans:r,type:"add",values:m}).then((function(e){for(var t in e.failures)w.splice(parseInt(t),1);v(m.length,e)}))).then((function(){return(b.length>0||a&&"object"==typeof e)&&o.mutate({trans:r,type:"put",keys:g,values:b,criteria:a,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:f>0}).then((function(e){return v(b.length,e)}))})).then((function(){return(w.length>0||a&&y)&&o.mutate({trans:r,type:"delete",keys:w,criteria:a,isAdditionalChunk:f>0}).then((function(e){return qt(n.table,w,e)})).then((function(e){return v(w.length,e)}))})).then((function(){return t.length>f+h&&u(f+l)}))}))};return u(0).then((function(){if(h.length>0)throw new G("Error modifying one or more objects",h,d,p);return t.length}))}))}))},e.prototype.delete=function(){var e=this._ctx,t=e.range;return!$t(e)||e.table.schema.yProps||!e.isPrimKey&&3!==t.type?this.modify(Ht):this._write((function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then((function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:i}).then((function(e){var n=e.failures,r=e.numFailures;if(r)throw new G("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-r);return t-r}))}))}))},e}(),Ht=function(e,t){return t.value=null};function Jt(e){return Mt(Xt.prototype,(function(t,n){this.db=e;var r=St,i=null;if(n)try{r=n()}catch(e){i=e}var o=t._ctx,a=o.table,u=a.hook.reading.fire;this._ctx={table:a,index:o.index,isPrimKey:!o.index||a.schema.primKey.keyPath&&o.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:i,or:o.or,valueMapper:u!==ie?u:null}}))}function Zt(e,t){return e<t?-1:e===t?0:1}function en(e,t){return e>t?-1:e===t?0:1}function tn(e,t,n){var r=e instanceof ln?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function nn(e){return new e.Collection(e,(function(){return cn("")})).limit(0)}function rn(e){return"next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}function on(e){return"next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}function an(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 i(e[s],n[s])<0?e.substr(0,s)+n[s]+n.substr(s+1):i(e[s],r[s])<0?e.substr(0,s)+r[s]+n.substr(s+1):u>=0?e.substr(0,u)+t[u]+n.substr(u+1):null;i(e[s],c)<0&&(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)}function un(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 tn(e,_t);function h(e){i=rn(e),o=on(e),a="next"===e?Zt:en;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})),c=e,l="next"===e?"":r}h("next");var d=new e.Collection(e,(function(){return sn(u[0],s[f-1]+r)}));d._ondirectionchange=function(e){h(e)};var p=0;return d._addAlgorithm((function(e,n,r){var i=e.key;if("string"!=typeof i)return!1;var h=o(i);if(t(h,s,p))return!0;for(var d=null,v=p;v<f;++v){var y=an(i,h,u[v],s[v],a,c);null===y&&null===d?p=v+1:(null===d||a(d,y)>0)&&(d=y)}return n(null!==d?function(){e.continue(d+l)}:r),!1})),d}function sn(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function cn(e){return{type:1,lower:e,upper:e}}var ln=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?nn(this):new this.Collection(this,(function(){return sn(e,t,!n,!r)}))}catch(e){return tn(this,wt)}},e.prototype.equals=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return cn(e)}))},e.prototype.above=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(e,void 0,!0)}))},e.prototype.aboveOrEqual=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(e,void 0,!1)}))},e.prototype.below=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(void 0,e,!1,!0)}))},e.prototype.belowOrEqual=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(void 0,e)}))},e.prototype.startsWith=function(e){return"string"!=typeof e?tn(this,_t):this.between(e,e+bt,!0,!0)},e.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):un(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],bt)},e.prototype.equalsIgnoreCase=function(e){return un(this,(function(e,t){return e===t[0]}),[e],"")},e.prototype.anyOfIgnoreCase=function(){var e=$.apply(L,arguments);return 0===e.length?nn(this):un(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=$.apply(L,arguments);return 0===e.length?nn(this):un(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,bt)},e.prototype.anyOf=function(){var e=this,t=$.apply(L,arguments),n=this._cmp;try{t.sort(n)}catch(e){return tn(this,wt)}if(0===t.length)return nn(this);var r=new this.Collection(this,(function(){return sn(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;n(a,t[i])>0;)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r((function(){e.continue(t[i])})),!1)})),r},e.prototype.notEqual=function(e){return this.inAnyRange([[gt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var e=$.apply(L,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return tn(this,wt)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[gt,t]]}),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,u=this._max;if(0===e.length)return nn(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return tn(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Z.InvalidArgument);var s=!t||!1!==t.includeLowers,c=t&&!0===t.includeUppers;function l(e,t){for(var n=0,i=e.length;n<i;++n){var o=e[n];if(r(t[0],o[1])<0&&r(t[1],o[0])>0){o[0]=a(o[0],t[0]),o[1]=u(o[1],t[1]);break}}return n===i&&e.push(t),e}var f,h=i;function d(e,t){return h(e[0],t[0])}try{(f=e.reduce(l,[])).sort(d)}catch(e){return tn(this,wt)}var p=0,v=c?function(e){return i(e,f[p][1])>0}:function(e){return i(e,f[p][1])>=0},y=s?function(e){return o(e,f[p][0])>0}:function(e){return o(e,f[p][0])>=0};function m(e){return!v(e)&&!y(e)}var b=v,g=new this.Collection(this,(function(){return sn(f[0][0],f[f.length-1][1],!s,!c)}));return g._ondirectionchange=function(e){"next"===e?(b=v,h=i):(b=y,h=o),f.sort(d)},g._addAlgorithm((function(e,t,r){for(var o=e.key;b(o);)if(++p===f.length)return t(r),!1;return!!m(o)||(0===n._cmp(o,f[p][1])||0===n._cmp(o,f[p][0])||t((function(){h===i?e.continue(f[p][0]):e.continue(f[p][1])})),!1)})),g},e.prototype.startsWithAnyOf=function(){var e=$.apply(L,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?nn(this):this.inAnyRange(e.map((function(e){return[e,e+bt]}))):tn(this,"startsWithAnyOf() only works with strings")},e}();function fn(e){return Mt(ln.prototype,(function(t,n,r){if(this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r},this._cmp=this._ascending=jt,this._descending=function(e,t){return jt(t,e)},this._max=function(e,t){return jt(e,t)>0?e:t},this._min=function(e,t){return jt(e,t)<0?e:t},this._IDBKeyRange=e._deps.IDBKeyRange,!this._IDBKeyRange)throw new Z.MissingAPI}))}function hn(e){return He((function(t){return dn(t),e(t.target.error),!1}))}function dn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var pn="storagemutated",vn="x-storagemutated-1",yn=Nt(null,pn),mn=function(){function e(){}return e.prototype._lock=function(){return _(!Ce.global),++this._reculock,1!==this._reculock||Ce.global||(Ce.lockOwnerFor=this),this},e.prototype._unlock=function(){if(_(!Ce.global),0==--this._reculock)for(Ce.global||(Ce.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{ht(e[1],e[0])}catch(e){}}return this},e.prototype._locked=function(){return this._reculock&&Ce.lockOwnerFor!==this},e.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(_(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new Z.DatabaseClosed(r);case"MissingAPIError":throw new Z.MissingAPI(r.message,r);default:throw new Z.OpenFailed(r)}if(!this.active)throw new Z.TransactionInactive;return _(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=He((function(n){dn(n),t._reject(e.error)})),e.onabort=He((function(n){dn(n),t.active&&t._reject(new Z.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=He((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&yn.storagemutated.fire(e.mutatedParts)})),this},e.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return vt(new Z.ReadOnly("Transaction is readonly"));if(!this.active)return vt(new Z.TransactionInactive);if(this._locked())return new qe((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},Ce])}));if(n)return it((function(){var e=new qe((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 qe((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(e){var t=this._root(),n=qe.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((function(){return n}));else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var i=t._waitingFor;return new qe((function(e,r){n.then((function(n){return t._waitingQueue.push(He(e.bind(null,n)))}),(function(e){return t._waitingQueue.push(He(r.bind(null,e)))})).finally((function(){t._waitingFor===i&&(t._waitingFor=null)}))}))},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new Z.Abort))},e.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(f(t,e))return t[e];var n=this.schema[e];if(!n)throw new Z.NotFound("Table "+e+" not part of transaction");var r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r},e}();function bn(e){return Mt(mn.prototype,(function(t,n,r,i,o){var a=this;"readonly"!==t&&n.forEach((function(e){var t,i=null===(t=r[e])||void 0===t?void 0:t.yProps;i&&(n=n.concat(i.map((function(e){return e.updatesTable}))))})),this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=Nt(this,"complete","error","abort"),this.parent=o||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 qe((function(e,t){a._resolve=e,a._reject=t})),this._completion.then((function(){a.active=!1,a.on.complete.fire()}),(function(e){var t=a.active;return a.active=!1,a.on.error.fire(e),a.parent?a.parent._reject(e):t&&a.idbtrans&&a.idbtrans.abort(),vt(e)}))}))}function gn(e,t,n,r,i,o,a,u){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+wn(t),type:u}}function wn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function _n(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:k(n,(function(e){return[e.name,e]}))}}function xn(e){return 1===e.length?e[0]:e}var kn=function(e){try{return e.only([[]]),kn=function(){return[[]]},[[]]}catch(e){return kn=function(){return bt},bt}};function On(e){return null==e?function(){}:"string"==typeof e?Pn(e):function(t){return O(t,e)}}function Pn(e){return 1===e.split(".").length?function(t){return t[e]}:function(t){return O(t,e)}}function En(e){return[].slice.call(e)}var Sn=0;function Kn(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function An(e,t,n){function r(e,t){var n=En(e.objectStoreNames),r=n.length>0?t.objectStore(n[0]):{};return{schema:{name:e.name,tables:n.map((function(e){return t.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=u(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:On(t)},indexes:En(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry,i=e.keyPath,a={name:t,compound:u(i),keyPath:i,unique:n,multiEntry:r,extractKey:On(i)};return o[Kn(i)]=a,a})),getIndexByKeyPath:function(e){return o[Kn(e)]}};return o[":id"]=a.primaryKey,null!=t&&(o[Kn(t)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in r&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604),hasIdb3Features:"getAllRecords"in r}}function i(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen,o=e.upperOpen;return void 0===n?void 0===r?null:t.upperBound(r,!!o):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!o)}function o(e){var t=e.name;function n(e){var n=e.trans,r=e.type,o=e.keys,a=e.values,u=e.range;return new Promise((function(e,s){e=He(e);var c=n.objectStore(t),l=null==c.keyPath,f="put"===r||"add"===r;if(!f&&"delete"!==r&&"deleteRange"!==r)throw new Error("Invalid operation type: "+r);var h,d=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return e({numFailures:0,failures:{},results:[],lastResult:void 0});var p=[],v=[],y=0,m=function(e){++y,dn(e)};if("deleteRange"===r){if(4===u.type)return e({numFailures:y,failures:v,results:[],lastResult:void 0});3===u.type?p.push(h=c.clear()):p.push(h=c.delete(i(u)))}else{var b=f?l?[a,o]:[a,null]:[o,null],g=b[0],w=b[1];if(f)for(var _=0;_<d;++_)p.push(h=w&&void 0!==w[_]?c[r](g[_],w[_]):c[r](g[_])),h.onerror=m;else for(_=0;_<d;++_)p.push(h=c[r](g[_])),h.onerror=m}var x=function(t){var n=t.target.result;p.forEach((function(e,t){return null!=e.error&&(v[t]=e.error)})),e({numFailures:y,failures:v,results:"delete"===r?o:p.map((function(e){return e.result})),lastResult:n})};h.onerror=function(e){m(e),x(e)},h.onsuccess=x}))}function r(e){var n=e.trans,r=e.values,o=e.query,a=e.reverse,u=e.unique;return new Promise((function(e,s){e=He(e);var c=o.index,l=o.range,f=n.objectStore(t),h=c.isPrimaryKey?f:f.index(c.name),d=a?u?"prevunique":"prev":u?"nextunique":"next",p=r||!("openKeyCursor"in h)?h.openCursor(i(l),d):h.openKeyCursor(i(l),d);p.onerror=hn(s),p.onsuccess=He((function(t){var r=p.result;if(r){r.___id=++Sn,r.done=!1;var i=r.continue.bind(r),o=r.continuePrimaryKey;o&&(o=o.bind(r));var a=r.advance.bind(r),u=function(){throw new Error("Cursor not started")},c=function(){throw new Error("Cursor not stopped")};r.trans=n,r.stop=r.continue=r.continuePrimaryKey=r.advance=u,r.fail=He(s),r.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},r.start=function(e){var t=new Promise((function(e,t){e=He(e),p.onerror=hn(t),r.fail=t,r.stop=function(t){r.stop=r.continue=r.continuePrimaryKey=r.advance=c,e(t)}})),n=function(){if(p.result)try{e()}catch(e){r.fail(e)}else r.done=!0,r.start=function(){throw new Error("Cursor behind last entry")},r.stop()};return p.onsuccess=He((function(e){p.onsuccess=n,n()})),r.continue=i,r.continuePrimaryKey=o,r.advance=a,n(),t},e(r)}else e(null)}),s)}))}function o(e,n){return function(r){return new Promise((function(o,a){var u;o=He(o);var s=r.trans,c=r.values,l=r.limit,f=r.query,h=null!==(u=r.direction)&&void 0!==u?u:"next",d=l===1/0?void 0:l,p=f.index,v=f.range,y=s.objectStore(t),m=p.isPrimaryKey?y:y.index(p.name),b=i(v);if(0===l)return o({result:[]});if(n){var g={query:b,count:d,direction:h};(w=c?m.getAll(g):m.getAllKeys(g)).onsuccess=function(e){return o({result:e.target.result})},w.onerror=hn(a)}else if(e&&"next"===h){var w;(w=c?m.getAll(b,d):m.getAllKeys(b,d)).onsuccess=function(e){return o({result:e.target.result})},w.onerror=hn(a)}else{var _=0,x=c||!("openKeyCursor"in m)?m.openCursor(b,h):m.openKeyCursor(b,h),k=[];x.onsuccess=function(){var e=x.result;return e?(k.push(c?e.value:e.primaryKey),++_===l?o({result:k}):void e.continue()):o({result:k})},x.onerror=hn(a)}}))}}return{name:t,schema:e,mutate:n,getMany:function(e){var n=e.trans,r=e.keys;return new Promise((function(e,i){e=He(e);for(var o,a=n.objectStore(t),u=r.length,s=new Array(u),c=0,l=0,f=function(t){var n=t.target;s[n._pos]=n.result,++l===c&&e(s)},h=hn(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=He(e);var o=n.objectStore(t).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=hn(i)}))},query:o(c,l),openCursor:r,count:function(e){var n=e.query,r=e.trans,o=n.index,a=n.range;return new Promise((function(e,n){var u=r.objectStore(t),s=o.isPrimaryKey?u:u.index(o.name),c=i(a),l=c?s.count(c):s.count();l.onsuccess=He((function(t){return e(t.target.result)})),l.onerror=hn(n)}))}}}var a=r(e,n),s=a.schema,c=a.hasGetAll,l=a.hasIdb3Features,f=s.tables.map((function(e){return o(e)})),h={};return f.forEach((function(e){return h[e.name]=e})),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!h[e])throw new Error("Table '".concat(e,"' not found"));return h[e]},MIN_KEY:-1/0,MAX_KEY:kn(t),schema:s}}function jn(e,t){return t.reduce((function(e,t){var r=t.create;return n(n({},e),r(e))}),e)}function Cn(e,t,n,r){var i=n.IDBKeyRange;return n.indexedDB,{dbcore:jn(An(t,i,r),e.dbcore)}}function Tn(e,t){var n=t.db,r=Cn(e._middlewares,n,e._deps,t);e.core=r.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 In(e,t,n,r){n.forEach((function(n){var i=r[n];t.forEach((function(t){var r=m(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?p(t,n,{get:function(){return this.table(n)},set:function(e){d(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))}))}))}function Dn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function qn(e,t){return e._cfg.version-t._cfg.version}function Rn(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains("$meta")&&!i.$meta&&(i.$meta=_n("$meta",Gn("")[0],[]),e._storeNames.push("$meta"));var o=e._createTransaction("readwrite",e._storeNames,i);o.create(n),o._completion.catch(r);var u=o._reject.bind(o),s=Ce.transless||Ce;it((function(){if(Ce.trans=o,Ce.transless=s,0!==t)return Tn(e,n),Fn(e,o,t).then((function(t){return Nn(e,t,o,n)})).catch(u);a(i).forEach((function(e){Ln(n,e,i[e].primKey,i[e].indexes)})),Tn(e,n),qe.follow((function(){return e.on.populate.fire(o)})).catch(u)}))}function Bn(e,t){$n(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=Vn(e,e.idbdb,t);Qn(e,e._dbSchema,t);for(var r=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){he&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),zn(n,t)}))},i=0,o=Mn(n,e._dbSchema).change;i<o.length;i++){var a=r(o[i]);if("object"==typeof a)return a.value}}function Fn(e,t,n){return t.storeNames.includes("$meta")?t.table("$meta").get("version").then((function(e){return null!=e?e:n})):qe.resolve(n)}function Nn(e,t,n,r){var i=[],o=e._versions,u=e._dbSchema=Vn(e,e.idbdb,r),s=o.filter((function(e){return e._cfg.version>=t}));if(0===s.length)return qe.resolve();function c(){return i.length?qe.resolve(i.shift()(n.idbtrans)).then(c):qe.resolve()}return s.forEach((function(o){i.push((function(){var i=u,s=o._cfg.dbschema;Qn(e,i,r),Qn(e,s,r),u=e._dbSchema=s;var c=Mn(i,s);c.add.forEach((function(e){Ln(r,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((function(e){if(e.recreate)throw new Z.Upgrade("Not yet support for changing primary key");var t=r.objectStore(e.name);e.add.forEach((function(e){return zn(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),zn(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var l=o._cfg.contentUpgrade;if(l&&o._cfg.version>t){Tn(e,r),n._memoizedTables={};var f=S(s);c.del.forEach((function(e){f[e]=i[e]})),Dn(e,[e.Transaction.prototype]),In(e,[e.Transaction.prototype],a(f),f),n.schema=f;var h,d=U(l);d&&ot();var p=qe.follow((function(){if((h=l(n))&&d){var e=at.bind(null,null);h.then(e,e)}}));return h&&"function"==typeof h.then?qe.resolve(h):p.then((function(){return h}))}})),i.push((function(t){Un(o._cfg.dbschema,t),Dn(e,[e.Transaction.prototype]),In(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema})),i.push((function(t){e.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(e.idbdb.version/10)===o._cfg.version?(e.idbdb.deleteObjectStore("$meta"),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(o._cfg.version,"version"))}))})),c().then((function(){$n(u,r)}))}function Mn(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)}(a.del.length>0||a.add.length>0||a.change.length>0)&&r.change.push(a)}}else r.add.push([n,o])}return r}function Ln(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){return zn(i,e)})),i}function $n(e,t){a(e).forEach((function(n){t.db.objectStoreNames.contains(n)||(he&&console.debug("Dexie: Creating missing table",n),Ln(t,n,e[n].primKey,e[n].indexes))}))}function Un(e,t){[].slice.call(t.db.objectStoreNames).forEach((function(n){return null==e[n]&&t.db.deleteObjectStore(n)}))}function zn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Vn(e,t,n){var r={};return g(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),i=t.keyPath,o=gn(wn(i),i||"",!0,!1,!!t.autoIncrement,i&&"string"!=typeof i,!0),a=[],u=0;u<t.indexNames.length;++u){var s=t.index(t.indexNames[u]);i=s.keyPath;var c=gn(s.name,i,!!s.unique,!!s.multiEntry,!1,i&&"string"!=typeof i,!1);a.push(c)}r[e]=_n(e,o,a)})),r}function Wn(e,t,n){e.verno=t.version/10;var r=e._dbSchema=Vn(e,t,n);e._storeNames=g(t.objectStoreNames,0),In(e,[e._allTables],a(r),r)}function Yn(e,t){var n=Mn(Vn(e,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((function(e){return e.add.length||e.change.length})))}function Qn(e,t,n){for(var r=n.db.objectStoreNames,i=0;i<r.length;++i){var a=r[i],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:"["+g(l).join("+")+"]";if(t[a]){var h=t[a].idxByName[f];h&&(h.name=c,delete t[a].idxByName[f],t[a].idxByName[c]=h)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&o.WorkerGlobalScope&&o instanceof o.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function Gn(e){return e.split(",").map((function(e,t){var n,r=e.split(":"),i=null===(n=r[1])||void 0===n?void 0:n.trim(),o=(e=r[0].trim()).replace(/([&*]|\+\+)/g,""),a=/^\[/.test(o)?o.match(/^\[(.*)\]$/)[1].split("+"):o;return gn(o,a||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),u(a),0===t,i)}))}var Xn=function(){function e(){}return e.prototype._createTableSchema=function(e,t,n){return _n(e,t,n)},e.prototype._parseIndexSyntax=function(e){return Gn(e)},e.prototype._parseStoresSpec=function(e,t){var n=this;a(e).forEach((function(r){if(null!==e[r]){var i=n._parseIndexSyntax(e[r]),o=i.shift();if(!o)throw new Z.Schema("Invalid schema for table "+r+": "+e[r]);if(o.unique=!0,o.multi)throw new Z.Schema("Primary key cannot be multiEntry*");i.forEach((function(e){if(e.auto)throw new Z.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new Z.Schema("Index must have a name and cannot be an empty string")}));var a=n._createTableSchema(r,o,i);t[r]=a}}))},e.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;var n=t._versions,r={},i={};return n.forEach((function(e){s(r,e._cfg.storesSource),i=e._cfg.dbschema={},e._parseStoresSpec(r,i)})),t._dbSchema=i,Dn(t,[t._allTables,t,t.Transaction.prototype]),In(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],a(i),i),t._storeNames=a(i),this},e.prototype.upgrade=function(e){return this._cfg.contentUpgrade=fe(this._cfg.contentUpgrade||re,e),this},e}();function Hn(e){return Mt(Xn.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}var Jn,Zn=er();function er(){if("undefined"!=typeof FinalizationRegistry&&"undefined"!=typeof WeakRef){var e=new Set,t=new FinalizationRegistry((function(t){e.delete(t)}));return{toArray:function(){return Array.from(e).map((function(e){return e.deref()})).filter((function(e){return void 0!==e}))},add:function(n){var r=new WeakRef(n._novip);if(e.add(r),t.register(n._novip,r,r),e.size>n._options.maxConnections){var i=e.values().next().value;e.delete(i),t.unregister(i)}},remove:function(n){if(n)for(var r=e.values(),i=r.next();!i.done;){var o=i.value;if(o.deref()===n._novip)return e.delete(o),void t.unregister(o);i=r.next()}}}}var n=[];return{toArray:function(){return n},add:function(e){n.push(e._novip)},remove:function(e){if(e){var t=n.indexOf(e._novip);-1!==t&&n.splice(t,1)}}}}function tr(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ni(kt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function nr(e){return e&&"function"==typeof e.databases}function rr(e){var t=e.indexedDB,n=e.IDBKeyRange;return nr(t)?Promise.resolve(t.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==kt}))})):tr(t,n).toCollection().primaryKeys()}function ir(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!nr(n)&&t!==kt&&tr(n,r).put({name:t}).catch(re)}function or(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!nr(n)&&t!==kt&&tr(n,r).delete(t).catch(re)}function ar(e){return it((function(){return Ce.letThrough=!0,e()}))}function ur(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()})).finally((function(){return clearInterval(e)})):Promise.resolve()}function sr(e){return!("from"in e)}var cr=function(e,t){if(!this){var n=new cr;return e&&"d"in e&&s(n,e),n}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function lr(e,t,n){var r=jt(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(sr(e))return s(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(jt(n,e.from)<0)return i?lr(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},pr(e);if(jt(t,e.to)>0)return o?lr(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},pr(e);jt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),jt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var a=!e.r;i&&!e.l&&fr(e,i),o&&a&&fr(e,o)}}function fr(e,t){function n(e,t){var r=t.from,i=t.to,o=t.l,a=t.r;lr(e,r,i),o&&n(e,o),a&&n(e,a)}sr(t)||n(e,t)}function hr(e,t){var n=dr(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=dr(e),a=o.next(i.from),u=a.value;!r.done&&!a.done;){if(jt(u.from,i.to)<=0&&jt(u.to,i.from)>=0)return!0;jt(i.from,u.from)<0?i=(r=n.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function dr(e){var t=sr(e)?null:{s:0,n:e};return{next:function(e){for(var n=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&jt(e,t.n.from)<0;)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||jt(e,t.n.to)<=0)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 pr(e){var t,r,i=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=i>1?"r":i<-1?"l":"";if(o){var a="r"===o?"l":"r",u=n({},e),s=e[o];e.from=s.from,e.to=s.to,e[o]=s[o],u[o]=s[a],e[a]=u,u.d=vr(u)}e.d=vr(e)}function vr(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}function yr(e,t){return a(t).forEach((function(n){e[n]?fr(e[n],t[n]):e[n]=T(t[n])})),e}function mr(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&hr(t[n],e[n])}))}h(cr.prototype,(Jn={add:function(e){return fr(this,e),this},addKey:function(e){return lr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return lr(t,e,e)})),this},hasKey:function(e){var t=dr(this).next(e).value;return t&&jt(t.from,e)<=0&&jt(t.to,e)>=0}},Jn[F]=function(){return dr(this)},Jn));var br={},gr={},wr=!1;function _r(e,t){yr(gr,e),wr||(wr=!0,setTimeout((function(){wr=!1;var e=gr;gr={},xr(e,!1)}),0))}function xr(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(br);r<i.length;r++)kr(u=i[r],e,n,t);else for(var o in e){var a=/^idb\:\/\/(.*)\/(.*)\//.exec(o);if(a){var u,s=a[1],c=a[2];(u=br["idb://".concat(s,"/").concat(c)])&&kr(u,e,n,t)}}n.forEach((function(e){return e()}))}function kr(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];mr(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,p=i;d<p.length;d++){var v=p[d];s=v[0],c=v[1],e.queries.query[s]=c}}function Or(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?vt(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),o=!1;function a(){if(t.openCanceller!==r)throw new Z.DatabaseClosed("db.open() was cancelled")}var u=t.dbReadyResolve,s=null,c=!1,l=function(){return new qe((function(r,u){if(a(),!n)throw new Z.MissingAPI;var f=e.name,h=t.autoSchema||!i?n.open(f):n.open(f,i);if(!h)throw new Z.MissingAPI;h.onerror=hn(u),h.onblocked=He(e._fireOnBlocked),h.onupgradeneeded=He((function(r){if(s=h.transaction,t.autoSchema&&!e._options.allowEmptyDB){h.onerror=dn,s.abort(),h.result.close();var i=n.deleteDatabase(f);i.onsuccess=i.onerror=He((function(){u(new Z.NoSuchDatabase("Database ".concat(f," doesnt exist")))}))}else{s.onerror=hn(u);var a=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;c=a<1,e.idbdb=h.result,o&&Bn(e,s),Rn(e,a/10,s,u)}}),u),h.onsuccess=He((function(){s=null;var n=e.idbdb=h.result,a=g(n.objectStoreNames);if(a.length>0)try{var u=n.transaction(xn(a),"readonly");if(t.autoSchema)Wn(e,n,u);else if(Qn(e,e._dbSchema,u),!Yn(e,u)&&!o)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."),n.close(),i=n.version+1,o=!0,r(l());Tn(e,u)}catch(e){}Zn.add(e),n.onversionchange=He((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),n.onclose=He((function(){e.close({disableAutoOpen:!1})})),c&&ir(e._deps,f),r()}),u)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(t.PR1398_maxLoop>0)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),l();break;case"VersionError":if(i>0)return i=0,l()}return qe.reject(e)}))};return qe.race([r,("undefined"==typeof navigator?qe.resolve():ur()).then(l)]).then((function(){return a(),t.onReadyBeingFired=[],qe.resolve(ar((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(t.onReadyBeingFired.length>0){var r=t.onReadyBeingFired.reduce(fe,re);return t.onReadyBeingFired=[],qe.resolve(ar((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{s&&s.abort()}catch(e){}return r===t.openCanceller&&e._close(),vt(n)})).finally((function(){t.openComplete=!0,u()})).then((function(){if(c){var 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 cr(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new cr(-1/0,[[[]]])})),yn(pn).fire(t),xr(t,!0)}return e}))}function Pr(e){var t=function(t){return e.next(t)},n=function(t){return e.throw(t)},r=o(t),i=o(n);function o(e){return function(t){var n=e(t),o=n.value;return n.done?o:o&&"function"==typeof o.then?o.then(r,i):u(o)?Promise.all(o).then(r,i):r(o)}}return o(t)()}function Er(e,t,n){var r=arguments.length;if(r<2)throw new Z.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,A(i),n]}function Sr(e,t,n,r,i){return qe.resolve().then((function(){var o=Ce.transless||Ce,a=e._createTransaction(t,n,e._dbSchema,r);a.explicit=!0;var u={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),a.idbtrans._explicit=!0,e._state.PR1398_maxLoop=3}catch(r){return r.name===H.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e.close({disableAutoOpen:!1}),e.open().then((function(){return Sr(e,t,n,null,i)}))):vt(r)}var s,c=U(i);c&&ot();var l=qe.follow((function(){if(s=i.call(a,a))if(c){var e=at.bind(null,null);s.then(e,e)}else"function"==typeof s.next&&"function"==typeof s.throw&&(s=Pr(s))}),u);return(s&&"function"==typeof s.then?qe.resolve(s).then((function(e){return a.active?e:vt(new Z.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):l.then((function(){return s}))).then((function(e){return r&&a._resolve(),a._completion.then((function(){return e}))})).catch((function(e){return a._reject(e),vt(e)}))}))}function Kr(e,t,n){for(var r=u(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function Ar(e){return n(n({},e),{table:function(t){var r=e.table(t),i=r.schema,o={},a=[];function u(e,t,r){var i=Kn(e),s=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=t>0,f=n(n({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:t,keyLength:c,extractKey:On(e),unique:!l&&r.unique});return s.push(f),f.isPrimaryKey||a.push(f),c>1&&u(2===c?e[0]:e.slice(0,c-1),t+1,r),s.sort((function(e,t){return e.keyTail-t.keyTail})),f}var s=u(i.primaryKey.keyPath,0,i.primaryKey);o[":id"]=[s];for(var c=0,l=i.indexes;c<l.length;c++){var f=l[c];u(f.keyPath,0,f)}function h(e){var t=o[Kn(e)];return t&&t[0]}function d(t,n){return{type:1===t.type?2:t.type,lower:Kr(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,n),lowerOpen:!0,upper:Kr(t.upper,t.upperOpen?e.MIN_KEY:e.MAX_KEY,n),upperOpen:!0}}function p(e){var t=e.query.index;return t.isVirtual?n(n({},e),{query:{index:t.lowLevelIndex,range:d(e.query.range,t.keyTail)}}):e}var v=n(n({},r),{schema:n(n({},i),{primaryKey:s,indexes:a,getIndexByKeyPath:h}),count:function(e){return r.count(p(e))},query:function(e){return r.query(p(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;if(!o)return r.openCursor(t);function u(n){function r(r){null!=r?n.continue(Kr(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()}var o=Object.create(n,{continue:{value:r},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Kr(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}}});return o}return r.openCursor(p(t)).then((function(e){return e&&u(e)}))}});return v}})}var jr={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Ar};function Cr(e,t,n,r){return n=n||{},r=r||"",a(e).forEach((function(i){if(f(t,i)){var o=e[i],a=t[i];if("object"==typeof o&&"object"==typeof a&&o&&a){var u=B(o);u!==B(a)?n[r+i]=t[i]:"Object"===u?Cr(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}else n[r+i]=void 0})),a(t).forEach((function(i){f(e,i)||(n[r+i]=t[i])})),n}function Tr(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Ir={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return n(n({},e),{table:function(t){var i=e.table(t),o=i.schema.primaryKey,a=n(n({},i),{mutate:function(e){var a=Ce.trans,u=a.table(t).hook,s=u.deleting,c=u.creating,l=u.updating;switch(e.type){case"add":if(c.fire===re)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(c.fire===re&&l.fire===re)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(s.fire===re)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(s.fire===re)break;return a._promise("readwrite",(function(){return d(e)}),!0)}return i.mutate(e);function h(e){var t=Ce.trans,a=e.keys||Tr(o,e);if(!a)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?n(n({},e),{keys:a}):n({},e)).type&&(e.values=r([],e.values)),e.keys&&(e.keys=r([],e.keys)),Dr(i,e,a).then((function(n){var r=a.map((function(r,i){var a=n[i],u={onerror:null,onsuccess:null};if("delete"===e.type)s.fire.call(u,r,a,t);else if("add"===e.type||void 0===a){var h=c.fire.call(u,r,e.values[i],t);null==r&&null!=h&&(r=h,e.keys[i]=r,o.outbound||P(e.values[i],o.keyPath,r))}else{var d=Cr(a,e.values[i]),p=l.fire.call(u,d,r,a,t);if(p){var v=e.values[i];Object.keys(p).forEach((function(e){f(v,e)?v[e]=p[e]:P(v,e,p[e])}))}}return u}));return i.mutate(e).then((function(t){for(var i=t.failures,o=t.results,u=t.numFailures,s=t.lastResult,c=0;c<a.length;++c){var l=o?o[c]:a[c],f=r[c];null==l?f.onerror&&f.onerror(i[c]):f.onsuccess&&f.onsuccess("put"===e.type&&n[c]?e.values[c]:l)}return{failures:i,results:o,numFailures:u,lastResult:s}})).catch((function(e){return r.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}function d(e){return p(e.trans,e.range,1e4)}function p(e,t,r){return i.query({trans:e,values:!1,query:{index:o,range:t},limit:r}).then((function(i){var o=i.result;return h({type:"delete",keys:o,trans:e}).then((function(i){return i.numFailures>0?Promise.reject(i.failures[0]):o.length<r?{failures:[],numFailures:0,lastResult:void 0}:p(e,n(n({},t),{lower:o[o.length-1],lowerOpen:!0}),r)}))}))}}});return a}})}};function Dr(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function qr(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===jt(t.keys[i],e[o])&&(r.push(n?D(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var Rr={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var r=e.table(t);return n(n({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=qr(e.keys,e.trans._cache,"clone"===e.cache);return t?qe.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?D(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Br(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function Fr(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Nr={stack:"dbcore",level:0,name:"Observability",create:function(e){var t=e.schema.name,r=new cr(e.MIN_KEY,e.MAX_KEY);return n(n({},e),{transaction:function(t,n,r){if(Ce.subscr&&"readonly"!==n)throw new Z.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Ce.querier));return e.transaction(t,n,r)},table:function(i){var o=e.table(i),s=o.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=n(n({},o),{mutate:function(n){var a,l,f=n.trans,h=n.mutatedParts||(n.mutatedParts={}),p=function(e){var n="idb://".concat(t,"/").concat(i,"/").concat(e);return h[n]||(h[n]=new cr)},v=p(""),y=p(":dels"),m=n.type,b="deleteRange"===n.type?[n.range]:"delete"===n.type?[n.keys]:n.values.length<50?[Tr(c,n).filter((function(e){return e})),n.values]:[],g=b[0],w=b[1],_=n.trans._cache;if(u(g)){v.addKeys(g);var x="delete"===m||g.length===w.length?qr(g,_):null;x||y.addKeys(g),(x||w)&&Mr(p,s,x,w)}else if(g){var k={from:null!==(a=g.lower)&&void 0!==a?a:e.MIN_KEY,to:null!==(l=g.upper)&&void 0!==l?l:e.MAX_KEY};y.add(k),v.add(k)}else v.add(r),y.add(r),s.indexes.forEach((function(e){return p(e.name).add(r)}));return o.mutate(n).then((function(e){return!g||"add"!==n.type&&"put"!==n.type||(v.addKeys(e.results),d&&d.forEach((function(t){for(var r=n.values.map((function(e){return t.extractKey(e)})),i=t.keyPath.findIndex((function(e){return e===c.keyPath})),o=0,a=e.results.length;o<a;++o)r[o][i]=e.results[o];p(t.name).addKeys(r)}))),f.mutatedParts=yr(f.mutatedParts||{},h),e}))}}),v=function(t){var n,r,i=t.query,o=i.index,a=i.range;return[o,new cr(null!==(n=a.lower)&&void 0!==n?n:e.MIN_KEY,null!==(r=a.upper)&&void 0!==r?r:e.MAX_KEY)]},y={get:function(e){return[c,new cr(e.key)]},getMany:function(e){return[c,(new cr).addKeys(e.keys)]},count:v,query:v,openCursor:v};return a(y).forEach((function(e){p[e]=function(a){var u=Ce.subscr,s=!!u,c=Br(Ce,o)&&Fr(e,a)?a.obsSet={}:u;if(s){var l=function(e){var n="idb://".concat(t,"/").concat(i,"/").concat(e);return c[n]||(c[n]=new cr)},d=l(""),p=l(":dels"),v=y[e](a),m=v[0],b=v[1];if("query"===e&&m.isPrimaryKey&&!a.values?p.add(b):l(m.name||"").add(b),!m.isPrimaryKey){if("count"!==e){var g="query"===e&&h&&a.values&&o.query(n(n({},a),{values:!1}));return o[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&a.values)return g.then((function(e){var n=e.result;return d.addKeys(n),t}));var n=a.values?t.result.map(f):t.result;a.values?d.addKeys(n):p.addKeys(n)}else if("openCursor"===e){var r=t,i=a.values;return r&&Object.create(r,{key:{get:function(){return p.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return p.addKey(e),e}},value:{get:function(){return i&&d.addKey(r.primaryKey),r.value}}})}return t}))}p.add(r)}}return o[e].apply(this,arguments)}})),p}})}};function Mr(e,t,n,r){function i(t){var i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}var a=function(e){return t.multiEntry&&u(e)?e.forEach((function(e){return i.addKey(e)})):i.addKey(e)};(n||r).forEach((function(e,t){var i=n&&o(n[t]),u=r&&o(r[t]);0!==jt(i,u)&&(null!=i&&a(i),null!=u&&a(u))}))}t.indexes.forEach(i)}function Lr(e,t,r){if(0===r.numFailures)return t;if("deleteRange"===t.type)return null;var i=t.keys?t.keys.length:"values"in t&&t.values?t.values.length:1;if(r.numFailures===i)return null;var o=n({},t);return u(o.keys)&&(o.keys=o.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in o&&u(o.values)&&(o.values=o.values.filter((function(e,t){return!(t in r.failures)}))),o}function $r(e,t){return void 0===t.lower||(t.lowerOpen?jt(e,t.lower)>0:jt(e,t.lower)>=0)}function Ur(e,t){return void 0===t.upper||(t.upperOpen?jt(e,t.upper)<0:jt(e,t.upper)<=0)}function zr(e,t){return $r(e,t)&&Ur(e,t)}function Vr(e,t,n,r,i,o){if(!n||0===n.length)return e;var a=t.query.index,s=a.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,f=a.extractKey,h=(a.lowLevelIndex||a).extractKey,d=n.reduce((function(e,n){var r=e,i=[];if("add"===n.type||"put"===n.type)for(var o=new cr,a=n.values.length-1;a>=0;--a){var h=n.values[a],d=l(h);if(!o.hasKey(d)){var p=f(h);(s&&u(p)?p.some((function(e){return zr(e,c)})):zr(p,c))&&(o.addKey(d),i.push(h))}}switch(n.type){case"add":var v=(new cr).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?i.filter((function(e){var t=l(e);return!v.hasKey(t)&&(v.addKey(t),!0)})):i.map((function(e){return l(e)})).filter((function(e){return!v.hasKey(e)&&(v.addKey(e),!0)})));break;case"put":var y=(new cr).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!y.hasKey(t.values?l(e):e)})).concat(t.values?i:i.map((function(e){return l(e)})));break;case"delete":var m=(new cr).addKeys(n.keys);r=e.filter((function(e){return!m.hasKey(t.values?l(e):e)}));break;case"deleteRange":var b=n.range;r=e.filter((function(e){return!zr(l(e),b)}))}return r}),e);if(d===e)return e;var p=function(e,t){return jt(h(e),h(t))||jt(l(e),l(t))};return d.sort("prev"===t.direction||"prevunique"===t.direction?function(e,t){return p(t,e)}:p),t.limit&&t.limit<1/0&&(d.length>t.limit?d.length=t.limit:e.length===t.limit&&d.length<t.limit&&(i.dirty=!0)),o?Object.freeze(d):d}function Wr(e,t){return 0===jt(e.lower,t.lower)&&0===jt(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Yr(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;var i=jt(e,t);if(0===i){if(n&&r)return 0;if(n)return 1;if(r)return-1}return i}function Qr(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;var i=jt(e,t);if(0===i){if(n&&r)return 0;if(n)return-1;if(r)return 1}return i}function Gr(e,t){return Yr(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&Qr(e.upper,t.upper,e.upperOpen,t.upperOpen)>=0}function Xr(e,t,n,r){var i,o=br["idb://".concat(e,"/").concat(t)];if(!o)return[];var a=o.queries[n];if(!a)return[null,!1,o,null];var u=a[(r.query?r.query.index.name:null)||""];if(!u)return[null,!1,o,null];switch(n){case"query":var s=null!==(i=r.direction)&&void 0!==i?i:"next",c=u.find((function(e){var t;return e.req.limit===r.limit&&e.req.values===r.values&&(null!==(t=e.req.direction)&&void 0!==t?t:"next")===s&&Wr(e.req.query.range,r.query.range)}));if(c)return[c,!0,o,u];var l=u.find((function(e){var t;return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(null!==(t=e.req.direction)&&void 0!==t?t:"next")===s&&(!r.values||e.req.values)&&Gr(e.req.query.range,r.query.range)}));return[l,!1,o,u];case"count":var f=u.find((function(e){return Wr(e.req.query.range,r.query.range)}));return[f,!!f,o,u]}}function Hr(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){e.subscribers.delete(n),0===e.subscribers.size&&Jr(e,t)}))}function Jr(e,t){setTimeout((function(){0===e.subscribers.size&&M(t,e)}),3e3)}var Zr={stack:"dbcore",level:0,name:"Cache",create:function(e){var t=e.schema.name,r=n(n({},e),{transaction:function(n,r,i){var o=e.transaction(n,r,i);if("readwrite"===r){var a=new AbortController,u=a.signal,s=function(i){return function(){if(a.abort(),"readwrite"===r){for(var u=new Set,s=0,c=n;s<c.length;s++){var l=c[s],f=br["idb://".concat(t,"/").concat(l)];if(f){var h=e.table(l),d=f.optimisticOps.filter((function(e){return e.trans===o}));if(o._explicit&&i&&o.mutatedParts)for(var p=0,v=Object.values(f.queries.query);p<v.length;p++)for(var y=0,m=(w=v[p]).slice();y<m.length;y++)mr((k=m[y]).obsSet,o.mutatedParts)&&(M(w,k),k.subscribers.forEach((function(e){return u.add(e)})));else if(d.length>0){f.optimisticOps=f.optimisticOps.filter((function(e){return e.trans!==o}));for(var b=0,g=Object.values(f.queries.query);b<g.length;b++)for(var w,_=0,x=(w=g[b]).slice();_<x.length;_++){var k;if(null!=(k=x[_]).res&&o.mutatedParts)if(i&&!k.dirty){var O=Object.isFrozen(k.res),P=Vr(k.res,k.req,d,h,k,O);k.dirty?(M(w,k),k.subscribers.forEach((function(e){return u.add(e)}))):P!==k.res&&(k.res=P,k.promise=qe.resolve({result:P}))}else k.dirty&&M(w,k),k.subscribers.forEach((function(e){return u.add(e)}))}}}}u.forEach((function(e){return e()}))}}};o.addEventListener("abort",s(!1),{signal:u}),o.addEventListener("error",s(!1),{signal:u}),o.addEventListener("complete",s(!0),{signal:u})}return o},table:function(r){var i=e.table(r),o=i.schema.primaryKey,a=n(n({},i),{mutate:function(e){var a=Ce.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return i.mutate(e);var u=br["idb://".concat(t,"/").concat(r)];if(!u)return i.mutate(e);var s=i.mutate(e);return"add"!==e.type&&"put"!==e.type||!(e.values.length>=50||Tr(o,e).some((function(e){return null==e})))?(u.optimisticOps.push(e),e.mutatedParts&&_r(e.mutatedParts),s.then((function(t){if(t.numFailures>0){M(u.optimisticOps,e);var n=Lr(u,e,t);n&&u.optimisticOps.push(n),e.mutatedParts&&_r(e.mutatedParts)}})),s.catch((function(){M(u.optimisticOps,e),e.mutatedParts&&_r(e.mutatedParts)}))):s.then((function(t){var r=n(n({},e),{values:e.values.map((function(e,r){var i;if(t.failures[r])return e;var a=(null===(i=o.keyPath)||void 0===i?void 0:i.includes("."))?D(e):n({},e);return P(a,o.keyPath,t.results[r]),a}))}),i=Lr(u,r,t);u.optimisticOps.push(i),queueMicrotask((function(){return e.mutatedParts&&_r(e.mutatedParts)}))})),s},query:function(e){var n;if(!Br(Ce,i)||!Fr("query",e))return i.query(e);var o="immutable"===(null===(n=Ce.trans)||void 0===n?void 0:n.db._options.cache),a=Ce,u=a.requery,s=a.signal,c=Xr(t,r,"query",e),l=c[0],f=c[1],h=c[2],d=c[3];if(l&&f)l.obsSet=e.obsSet;else{var p=i.query(e).then((function(e){var t=e.result;if(l&&(l.res=t),o){for(var n=0,r=t.length;n<r;++n)Object.freeze(t[n]);Object.freeze(t)}else e.result=D(t);return e})).catch((function(e){return d&&l&&M(d,l),Promise.reject(e)}));l={obsSet:e.obsSet,promise:p,subscribers:new Set,type:"query",req:e,dirty:!1},d?d.push(l):(d=[l],h||(h=br["idb://".concat(t,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}}),h.queries.query[e.query.index.name||""]=d)}return Hr(l,d,u,s),l.promise.then((function(t){return{result:Vr(t.result,e,null==h?void 0:h.optimisticOps,i,l,o)}}))}});return a}});return r}};function ei(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var ti,ni=function(){function e(t,r){var i=this;this._middlewares={},this.verno=0;var o=e.dependencies;this._options=r=n({addons:e.addons,autoOpen:!0,indexedDB:o.indexedDB,IDBKeyRange:o.IDBKeyRange,cache:"cloned",maxConnections:xt},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};var a=r.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var u={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:re,dbReadyPromise:null,cancelOpen:re,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:r.autoOpen};u.dbReadyPromise=new qe((function(e){u.dbReadyResolve=e})),u.openCanceller=new qe((function(e,t){u.cancelOpen=t})),this._state=u,this.name=t,this.on=Nt(this,"populate","blocked","versionchange","close",{ready:[fe,re]}),this.once=function(e,t){var n=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i.on(e).unsubscribe(n),t.apply(i,r)};return i.on(e,n)},this.on.ready.subscribe=w(this.on.ready.subscribe,(function(t){return function(n,r){e.vip((function(){var e=i._state;if(e.openComplete)e.dbOpenError||qe.resolve().then(n),r&&t(n);else if(e.onReadyBeingFired)e.onReadyBeingFired.push(n),r&&t(n);else{t(n);var o=i;r||t((function e(){o.on.ready.unsubscribe(n),o.on.ready.unsubscribe(e)}))}}))}})),this.Collection=Jt(this),this.Table=Lt(this),this.Transaction=bn(this),this.Version=Hn(this),this.WhereClause=fn(this),this.on("versionchange",(function(e){e.newVersion>0?console.warn("Another connection wants to upgrade database '".concat(i.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(i.name,"'. Closing db now to resume the delete request.")),i.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(i.name,"') was blocked")):console.warn("Upgrade '".concat(i.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))})),this._maxKey=kn(r.IDBKeyRange),this._createTransaction=function(e,t,n,r){return new i.Transaction(e,t,n,i._options.chromeTransactionDurability,r)},this._fireOnBlocked=function(e){i.on("blocked").fire(e),Zn.toArray().filter((function(e){return e.name===i.name&&e!==i&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Rr),this.use(Zr),this.use(Nr),this.use(jr),this.use(Ir);var s=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return ei(i.table(e),s)};var r=Reflect.get(e,t,n);return r instanceof Ft?ei(r,s):"tables"===t?r.map((function(e){return ei(e,s)})):"_createTransaction"===t?function(){return ei(r.apply(this,arguments),s)}:r}});this.vip=s,a.forEach((function(e){return e(i)}))}return e.prototype.version=function(e){if(isNaN(e)||e<.1)throw new Z.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new Z.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(qn),n.stores({}),this._state.autoSchema=!1,n)},e.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||Ce.letThrough||this._vip)?e():new qe((function(e,n){if(t._state.openComplete)return n(new Z.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new Z.DatabaseClosed);t.open().catch(re)}t._state.dbReadyPromise.then(e,n)})).then(e)},e.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;i&&this.unuse({stack:t,name:i});var o=this._middlewares[t]||(this._middlewares[t]=[]);return o.push({stack:t,create:n,level:null==r?10:r,name:i}),o.sort((function(e,t){return e.level-t.level})),this},e.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},e.prototype.open=function(){var e=this;return ht(je,(function(){return Or(e)}))},e.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var e=this._state;if(Zn.remove(this),this.idbdb){try{this.idbdb.close()}catch(e){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new qe((function(t){e.dbReadyResolve=t})),e.openCanceller=new qe((function(t,n){e.cancelOpen=n})))},e.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen,n=this._state;t?(n.isBeingOpened&&n.cancelOpen(new Z.DatabaseClosed),this._close(),n.autoOpen=!1,n.dbOpenError=new Z.DatabaseClosed):(this._close(),n.autoOpen=this._options.autoOpen||n.isBeingOpened,n.openComplete=!1,n.dbOpenError=null)},e.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=arguments.length>0&&"object"!=typeof arguments[0],r=this._state;return new qe((function(i,o){var a=function(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=He((function(){or(t._deps,t.name),i()})),n.onerror=hn(o),n.onblocked=t._fireOnBlocked};if(n)throw new Z.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return null!==this.idbdb},e.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},e.prototype.hasFailed=function(){return null!==this._state.dbOpenError},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var e=this;return a(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var e=Er.apply(this,arguments);return this._transaction.apply(this,e)},e.prototype._transaction=function(e,t,n){var r=this,i=Ce.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){var t=e instanceof r.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t})),"r"==e||e===Ot)o=Ot;else{if("rw"!=e&&e!=Pt)throw new Z.InvalidArgument("Invalid transaction mode: "+e);o=Pt}if(i){if(i.mode===Ot&&o===Pt){if(!u)throw new Z.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 Z.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)})):vt(e)}var s=Sr.bind(null,this,o,a,i,n);return i?i._promise(o,s,"lock"):Ce.trans?ht(Ce.transless,(function(){return r._whenReady(s)})):this._whenReady(s)},e.prototype.table=function(e){if(!f(this._allTables,e))throw new Z.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},e}(),ri="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",ii=function(){function e(e){this._subscribe=e}return e.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},e.prototype[ri]=function(){return this},e}();try{ti={indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch(e){ti={indexedDB:null,IDBKeyRange:null}}function oi(e){var t,n=!1,r=new ii((function(r){var i=U(e);function o(t){var n=ze();try{i&&ot();var r=it(e,t);return i&&(r=r.finally(at)),r}finally{n&&Ve()}}var a,u=!1,s={},c={},l={get closed(){return u},unsubscribe:function(){u||(u=!0,a&&a.abort(),f&&yn.storagemutated.unsubscribe(p))}};r.start&&r.start(l);var f=!1,h=function(){return pt(v)};function d(){return mr(c,s)}var p=function(e){yr(s,e),d()&&h()},v=function(){if(!u&&ti.indexedDB){s={};var i={};a&&a.abort(),a=new AbortController;var l={subscr:i,signal:a.signal,requery:h,querier:e,trans:null},v=o(l);f||(yn(pn,p),f=!0),Promise.resolve(v).then((function(e){n=!0,t=e,u||l.signal.aborted||(d()?h():(c=i,d()?h():(s={},pt((function(){return!u&&r.next&&r.next(e)})))))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||u||pt((function(){u||r.error&&r.error(e)}))}))}};return setTimeout(h,0),l}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var ai=ni;function ui(e){var t=ci;try{ci=!0,yn.storagemutated.fire(e),xr(e,!0)}finally{ci=t}}h(ai,n(n({},ne),{delete:function(e){return new ai(e,{addons:[]}).delete()},exists:function(e){return new ai(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return rr(ai.dependencies).then(e)}catch(e){return vt(new Z.MissingAPI)}},defineClass:function(){function e(e){s(this,e)}return e},ignoreTransaction:function(e){return Ce.trans?ht(Ce.transless||je,e):e()},vip:ar,async:function(e){return function(){try{var t=Pr(e.apply(this,arguments));return t&&"function"==typeof t.then?t:qe.resolve(t)}catch(e){return vt(e)}}},spawn:function(e,t,n){try{var r=Pr(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:qe.resolve(r)}catch(e){return vt(e)}},currentTransaction:{get:function(){return Ce.trans||null}},waitFor:function(e,t){var n=qe.resolve("function"==typeof e?ai.ignoreTransaction(e):e).timeout(t||6e4);return Ce.trans?Ce.trans.waitFor(n):n},Promise:qe,debug:{get:function(){return he},set:function(e){de(e)}},derive:v,extend:s,props:h,override:w,Events:Nt,on:yn,liveQuery:oi,extendObservabilitySet:yr,getByKeyPath:O,setByKeyPath:P,delByKeyPath:E,shallowClone:S,deepClone:D,getObjectDiff:Cr,cmp:jt,asap:x,minKey:gt,addons:[],connections:{get:Zn.toArray},errnames:H,dependencies:ti,cache:br,semVer:mt,version:mt.split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),ai.maxKey=kn(ai.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(yn(pn,(function(e){var t;ci||(t=new CustomEvent(vn,{detail:e}),ci=!0,dispatchEvent(t),ci=!1)})),addEventListener(vn,(function(e){var t=e.detail;ci||ui(t)})));var si,ci=!1,li=function(){};function fi(e){return new Rt({add:e})}function hi(e){return new Rt({remove:e})}function di(e,t){return new Rt({replacePrefix:[e,t]})}"undefined"!=typeof BroadcastChannel&&((li=function(){(si=new BroadcastChannel(vn)).onmessage=function(e){return e.data&&ui(e.data)}})(),"function"==typeof si.unref&&si.unref(),yn(pn,(function(e){ci||si.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!ni.disableBfCache&&e.persisted){he&&console.debug("Dexie: handling persisted pagehide"),null==si||si.close();for(var t=0,n=Zn.toArray();t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!ni.disableBfCache&&e.persisted&&(he&&console.debug("Dexie: handling persisted pageshow"),li(),ui({all:new cr(-1/0,[[]])}))}))),qe.rejectionMapper=te,de(he);var pi=Object.freeze({__proto__:null,DEFAULT_MAX_CONNECTIONS:xt,Dexie:ni,Entity:At,PropModification:Rt,RangeSet:cr,add:fi,cmp:jt,default:ni,liveQuery:oi,mergeRanges:fr,rangesOverlap:hr,remove:hi,replacePrefix:di});return n(ni,pi,{default:ni}),ni}();var u=o(a.exports);const s=Symbol.for("Dexie"),c=globalThis[s]||(globalThis[s]=u);if(u.semVer!==c.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${u.semVer} and ${c.semVer}`);const{liveQuery:l,mergeRanges:f,rangesOverlap:h,RangeSet:d,cmp:p,Entity:v,PropModification:y,replacePrefix:m,add:b,remove:g,DexieYProvider:w}=c;var _=function(t){function n(e,n,r){var i=t.call(this,e)||this,o={};return o["".concat(n)]=r||"id, createTime, updateTime",i.version(1).stores(o),i.store=i.table(n),i}return function(t,n){if("function"!=typeof n&&null!==n)throw new 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)}(n,t),n}(c),x=function(){function e(e,t,n){void 0===e&&(e="store"),void 0===t&&(t="easy-store"),this.db=new _(t||"easy-store",e,n),this.tableName=e}return e.prototype.getTable=function(){return this.db.table(this.tableName)},e.prototype.generateId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.save=function(e){return n(this,void 0,void 0,(function(){var n,i,o,a,u,s;return r(this,(function(r){switch(r.label){case 0:return n=this.getTable(),i=new Date,o=t({},e),a=t(t({},o),{createTime:o.createTime||i,updateTime:i}),void 0===o.id||null===o.id?[3,3]:[4,n.put(a,o.id)];case 1:return r.sent(),[4,n.get(o.id)];case 2:return u=r.sent(),[3,6];case 3:return s=this.generateId(),a.id=s,[4,n.add(a,s)];case 4:return r.sent(),[4,n.get(s)];case 5:u=r.sent(),r.label=6;case 6:return[2,u]}}))}))},e.prototype.saveList=function(e){return n(this,void 0,void 0,(function(){var t,n,i,o,a;return r(this,(function(r){switch(r.label){case 0:t=[],n=0,i=e,r.label=1;case 1:return n<i.length?(o=i[n],[4,this.save(o)]):[3,4];case 2:a=r.sent(),t.push(a),r.label=3;case 3:return n++,[3,1];case 4:return[2,t]}}))}))},e.prototype.getList=function(e){return n(this,void 0,void 0,(function(){var t,n,i=this;return r(this,(function(r){switch(r.label){case 0:return[4,this.getTable().toArray()];case 1:return t=r.sent(),(null==e?void 0:e.where)&&(n=e.where,t=t.filter((function(e){return i.matchesConditionSimple(e,n)}))),t.sort((function(e,t){var n,r,i=(null===(n=e.updateTime)||void 0===n?void 0:n.getTime())||0;return((null===(r=t.updateTime)||void 0===r?void 0:r.getTime())||0)-i})),(null==e?void 0:e.sort)&&(t=this.applySort(t,e.sort)),(null==e?void 0:e.fields)&&(t=t.map((function(t){return i.selectFields(t,e.fields)}))),[2,t]}}))}))},e.prototype.delete=function(e){return n(this,void 0,void 0,(function(){var t,n,i,o,a,u;return r(this,(function(r){switch(r.label){case 0:return[4,(t=this.getTable()).toArray()];case 1:for(n=r.sent(),i=[],o=0,a=n;o<a.length;o++)u=a[o],this.matchesConditionSimple(u,e)&&i.push(u.id);return i.length>0?[4,t.bulkDelete(i)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,i.length]}}))}))},e.prototype.getInfo=function(e){return n(this,void 0,void 0,(function(){var t;return r(this,(function(n){switch(n.label){case 0:return[4,this.getList({where:e})];case 1:return[2,(t=n.sent()).length>0?t[0]:null]}}))}))},e.prototype.update=function(e,i){return n(this,void 0,void 0,(function(){var n,o,a;return r(this,(function(r){switch(r.label){case 0:return n=this.getTable(),[4,this.getInfo(i)];case 1:return(o=r.sent())?(a=t(t(t({},o),e),{updateTime:new Date}),[4,n.put(a,o.id)]):[2,null];case 2:return r.sent(),[2,a]}}))}))},e.prototype.count=function(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.getList({where:e})];case 1:return[2,t.sent().length]}}))}))},e.prototype.clear=function(){return n(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,this.getTable().clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.getPage=function(e){return n(this,void 0,void 0,(function(){var t,n,i,o,a,u,s;return r(this,(function(r){switch(r.label){case 0:return t=e.page||1,n=e.pageSize||10,[4,this.getList(e)];case 1:return i=r.sent(),o=i.length,a=Math.ceil(o/n),s=(u=(t-1)*n)+n,[2,{list:i.slice(u,s),total:o,page:t,size:n,totalPages:a}]}}))}))},e.prototype.applySort=function(e,t){return function(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)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0).sort((function(e,n){for(var r=0,i=Object.entries(t);r<i.length;r++){var o=i[r],a=o[0],u=o[1],s=e[a],c=n[a];if(s<c)return 1===u?-1:1;if(s>c)return 1===u?1:-1}return 0}))},e.prototype.selectFields=function(e,t){for(var n={},r=0,i=Object.keys(t);r<i.length;r++){var o=i[r];n[o]=e[o]}return void 0!==e.id&&(n.id=e.id),n},e.prototype.matchesCondition=function(e,t,n){var r=e[t];return void 0!==n.$ne?r!==n.$ne:void 0!==n.$gt?r>n.$gt:void 0!==n.$gte?r>=n.$gte:void 0!==n.$lt?r<n.$lt:void 0!==n.$lte?r<=n.$lte:void 0!==n.$in?n.$in.includes(r):void 0!==n.$nin?!n.$nin.includes(r):void 0!==n.$like?String(r).includes(n.$like):r===n},e.prototype.matchesConditionSimple=function(e,t){for(var n=0,r=Object.entries(t);n<r.length;n++){var i=r[n],o=i[0],a=i[1];if(void 0!==a)if("object"==typeof a&&null!==a){if(!this.matchesCondition(e,o,a))return!1}else if(e[o]!==a)return!1}return!0},e.prototype.close=function(){this.db.close()},e}();export{_ as EasyDexieDatabase,x as EasyDexieStore};
|
package/lib/index.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e){"use strict";var t=function(e,n){return t=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(e,n)};var n=function(){return n=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},n.apply(this,arguments)};function r(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(s){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u={exports:{}};u.exports=function(){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])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new 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)}var n=function(){return n=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},n.apply(this,arguments)};function r(e,t,n){for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:o,a=Object.keys,u=Array.isArray;function s(e,t){return"object"!=typeof t||a(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||i.Promise||(i.Promise=Promise);var c=Object.getPrototypeOf,l={}.hasOwnProperty;function f(e,t){return l.call(e,t)}function h(e,t){"function"==typeof t&&(t=t(c(e))),("undefined"==typeof Reflect?a:Reflect.ownKeys)(t).forEach((function(n){p(e,n,t[n])}))}var d=Object.defineProperty;function p(e,t,n,r){d(e,t,s(n&&f(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function v(e){return{from:function(t){return e.prototype=Object.create(t.prototype),p(e.prototype,"constructor",e),{extend:h.bind(null,e.prototype)}}}}var y=Object.getOwnPropertyDescriptor;function m(e,t){var n;return y(e,t)||(n=c(e))&&m(n,t)}var b=[].slice;function g(e,t,n){return b.call(e,t,n)}function w(e,t){return t(e)}function _(e){if(!e)throw new Error("Assertion Failed")}function x(e){i.setImmediate?setImmediate(e):setTimeout(e,0)}function k(e,t){return e.reduce((function(e,n,r){var i=t(n,r);return i&&(e[i[0]]=i[1]),e}),{})}function O(e,t){if("string"==typeof t&&f(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=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:O(u,t.substr(a+1))}}function P(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){_("string"!=typeof n&&"length"in n);for(var r=0,i=t.length;r<i;++r)P(e,t[r],n[r])}else{var o=t.indexOf(".");if(-1!==o){var a=t.substr(0,o),s=t.substr(o+1);if(""===s)void 0===n?u(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var c=e[a];c&&f(e,a)||(c=e[a]={}),P(c,s,n)}}else void 0===n?u(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function E(e,t){"string"==typeof t?P(e,t,void 0):"length"in t&&[].map.call(t,(function(t){P(e,t,void 0)}))}function S(e){var t={};for(var n in e)f(e,n)&&(t[n]=e[n]);return t}var K=[].concat;function A(e){return K.apply([],e)}var j="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(A([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(t){return t+e+"Array"}))})))).filter((function(e){return i[e]})),C=new Set(j.map((function(e){return i[e]})));function T(e){var t={};for(var n in e)if(f(e,n)){var r=e[n];t[n]=!r||"object"!=typeof r||C.has(r.constructor)?r:T(r)}return t}var I=null;function D(e){I=new WeakMap;var t=q(e);return I=null,t}function q(e){if(!e||"object"!=typeof e)return e;var t=I.get(e);if(t)return t;if(u(e)){t=[],I.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(q(e[n]))}else if(C.has(e.constructor))t=e;else{var i=c(e);for(var o in t=i===Object.prototype?{}:Object.create(i),I.set(e,t),e)f(e,o)&&(t[o]=q(e[o]))}return t}var R={}.toString;function B(e){return R.call(e).slice(8,-1)}var F="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",N="symbol"==typeof F?function(e){var t;return null!=e&&(t=e[F])&&t.apply(e)}:function(){return null};function M(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n>=0}var L={};function $(e){var t,n,r,i;if(1===arguments.length){if(u(e))return e.slice();if(this===L&&"string"==typeof e)return[e];if(i=N(e)){for(n=[];!(r=i.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var U="undefined"!=typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},z=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],V=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(z),W={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 Y(e,t){this.name=e,this.message=t}function Q(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 G(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Q(e,t)}function X(e,t){this.name="BulkError",this.failures=Object.keys(t).map((function(e){return t[e]})),this.failuresByPos=t,this.message=Q(e,this.failures)}v(Y).from(Error).extend({toString:function(){return this.name+": "+this.message}}),v(G).from(Y),v(X).from(Y);var H=V.reduce((function(e,t){return e[t]=t+"Error",e}),{}),J=Y,Z=V.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=W[t]||n,this.inner=null)}return v(r).from(J),e[t]=r,e}),{});Z.Syntax=SyntaxError,Z.Type=TypeError,Z.Range=RangeError;var ee=z.reduce((function(e,t){return e[t+"Error"]=Z[t],e}),{});function te(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ee[e.name])return e;var n=new ee[e.name](t||e.message,e);return"stack"in e&&p(n,"stack",{get:function(){return this.inner.stack}}),n}var ne=V.reduce((function(e,t){return-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=Z[t]),e}),{});function re(){}function ie(e){return e}function oe(e,t){return null==e||e===ie?t:function(n){return t(e(n))}}function ae(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ue(e,t){return e===re?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?ae(r,this.onsuccess):r),i&&(this.onerror=this.onerror?ae(i,this.onerror):i),void 0!==o?o:n}}function se(e,t){return e===re?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?ae(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ae(r,this.onerror):r)}}function ce(e,t){return e===re?t:function(n){var r=e.apply(this,arguments);s(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?ae(i,this.onsuccess):i),o&&(this.onerror=this.onerror?ae(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===re?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function fe(e,t){return e===re?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then((function(){return t.apply(r,o)}))}return t.apply(this,arguments)}}ne.ModifyError=G,ne.DexieError=Y,ne.BulkError=X;var he="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function de(e,t){he=e}var pe={},ve=100,ye="undefined"==typeof Promise?[]:function(){var e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,c(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,c(t),e]}(),me=ye[0],be=ye[1],ge=ye[2],we=be&&be.then,_e=me&&me.constructor,xe=!!ge;function ke(){queueMicrotask(Ue)}var Oe=function(e,t){Te.push([e,t]),Ee&&(ke(),Ee=!1)},Pe=!0,Ee=!0,Se=[],Ke=[],Ae=ie,je={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:re,pgp:!1,env:{},finalize:re},Ce=je,Te=[],Ie=0,De=[];function qe(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=Ce;if("function"!=typeof e){if(e!==pe)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Ne(this,this._value))}this._state=null,this._value=null,++t.ref,Fe(this,e)}var Re={get:function(){var e=Ce,t=nt;function n(n,r){var i=this,o=!e.global&&(e!==Ce||t!==nt),a=o&&!at(),u=new qe((function(t,u){Le(i,new Be(dt(n,e,o,a),dt(r,e,o,a),t,u,e))}));return this._consoleTask&&(u._consoleTask=this._consoleTask),u}return n.prototype=pe,n},set:function(e){p(this,"then",e&&e.prototype===pe?Re:{get:function(){return e},set:Re.set})}};function Be(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 Fe(e,t){try{t((function(t){if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&ze();t&&"function"==typeof t.then?Fe(e,(function(e,n){t instanceof qe?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Ne.bind(null,e))}catch(t){Ne(e,t)}}function Ne(e,t){if(Ke.push(t),null===e._state){var n=e._lib&&ze();t=Ae(t),e._state=!1,e._value=t,Qe(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Le(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),0===Ie&&(++Ie,Oe((function(){0==--Ie&&We()}),[]))}function Le(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,++Ie,Oe($e,[n,e,t])}else e._listeners.push(t)}function $e(e,t,n){try{var r,i=t._value;!t._state&&Ke.length&&(Ke=[]),r=he&&t._consoleTask?t._consoleTask.run((function(){return e(i)})):e(i),t._state||-1!==Ke.indexOf(i)||Ge(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--Ie&&We(),--n.psd.ref||n.psd.finalize()}}function Ue(){ht(je,(function(){ze()&&Ve()}))}function ze(){var e=Pe;return Pe=!1,Ee=!1,e}function Ve(){var e,t,n;do{for(;Te.length>0;)for(e=Te,Te=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Te.length>0);Pe=!0,Ee=!0}function We(){var e=Se;Se=[],e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));for(var t=De.slice(0),n=t.length;n;)t[--n]()}function Ye(e){function t(){e(),De.splice(De.indexOf(t),1)}De.push(t),++Ie,Oe((function(){0==--Ie&&We()}),[])}function Qe(e){Se.some((function(t){return t._value===e._value}))||Se.push(e)}function Ge(e){for(var t=Se.length;t;)if(Se[--t]._value===e._value)return void Se.splice(t,1)}function Xe(e){return new qe(pe,!1,e)}function He(e,t){var n=Ce;return function(){var r=ze(),i=Ce;try{return lt(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{lt(i,!1),r&&Ve()}}}h(qe.prototype,{then:Re,_then:function(e,t){Le(this,new Be(null,null,e,t,Ce))},catch:function(e){if(1===arguments.length)return this.then(null,e);var t=arguments[0],n=arguments[1];return"function"==typeof t?this.then(null,(function(e){return e instanceof t?n(e):Xe(e)})):this.then(null,(function(e){return e&&e.name===t?n(e):Xe(e)}))},finally:function(e){return this.then((function(t){return qe.resolve(e()).then((function(){return t}))}),(function(t){return qe.resolve(e()).then((function(){return Xe(t)}))}))},timeout:function(e,t){var n=this;return e<1/0?new qe((function(r,i){var o=setTimeout((function(){return i(new Z.Timeout(t))}),e);n.then(r,i).finally(clearTimeout.bind(null,o))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&p(qe.prototype,Symbol.toStringTag,"Dexie.Promise"),je.env=ft(),h(qe,{all:function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach((function(i,o){return qe.resolve(i).then((function(n){e[o]=n,--r||t(e)}),n)}))}))},resolve:function(e){return e instanceof qe?e:e&&"function"==typeof e.then?new qe((function(t,n){e.then(t,n)})):new qe(pe,!0,e)},reject:Xe,race:function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t,n){e.map((function(e){return qe.resolve(e).then(t,n)}))}))},PSD:{get:function(){return Ce},set:function(e){return Ce=e}},totalEchoes:{get:function(){return nt}},newPSD:it,usePSD:ht,scheduler:{get:function(){return Oe},set:function(e){Oe=e}},rejectionMapper:{get:function(){return Ae},set:function(e){Ae=e}},follow:function(e,t){return new qe((function(n,r){return it((function(t,n){var r=Ce;r.unhandleds=[],r.onunhandled=n,r.finalize=ae((function(){var e=this;Ye((function(){0===e.unhandleds.length?t():n(e.unhandleds[0])}))}),r.finalize),e()}),t,n,r)}))}}),_e&&(_e.allSettled&&p(qe,"allSettled",(function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t){0===e.length&&t([]);var n=e.length,r=new Array(n);e.forEach((function(e,i){return qe.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)}))}))}))})),_e.any&&"undefined"!=typeof AggregateError&&p(qe,"any",(function(){var e=$.apply(null,arguments).map(ut);return new qe((function(t,n){0===e.length&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach((function(e,o){return qe.resolve(e).then((function(e){return t(e)}),(function(e){i[o]=e,--r||n(new AggregateError(i))}))}))}))})),_e.withResolvers&&(qe.withResolvers=_e.withResolvers));var Je={awaits:0,echoes:0,id:0},Ze=0,et=[],tt=0,nt=0,rt=0;function it(e,t,n,r){var i=Ce,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++rt,je.env,o.env=xe?{Promise:qe,PromiseProp:{value:qe,configurable:!0,writable:!0},all:qe.all,race:qe.race,allSettled:qe.allSettled,any:qe.any,resolve:qe.resolve,reject:qe.reject}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var a=ht(o,e,n,r);return 0===o.ref&&o.finalize(),a}function ot(){return Je.id||(Je.id=++Ze),++Je.awaits,Je.echoes+=ve,Je.id}function at(){return!!Je.awaits&&(0==--Je.awaits&&(Je.id=0),Je.echoes=Je.awaits*ve,!0)}function ut(e){return Je.echoes&&e&&e.constructor===_e?(ot(),e.then((function(e){return at(),e}),(function(e){return at(),vt(e)}))):e}function st(e){++nt,Je.echoes&&0!=--Je.echoes||(Je.echoes=Je.awaits=Je.id=0),et.push(Ce),lt(e,!0)}function ct(){var e=et[et.length-1];et.pop(),lt(e,!1)}function lt(e,t){var n=Ce;if((t?!Je.echoes||tt++&&e===Ce:!tt||--tt&&e===Ce)||queueMicrotask(t?st.bind(null,e):ct),e!==Ce&&(Ce=e,n===je&&(je.env=ft()),xe)){var r=je.env.Promise,o=e.env;(n.global||e.global)&&(Object.defineProperty(i,"Promise",o.PromiseProp),r.all=o.all,r.race=o.race,r.resolve=o.resolve,r.reject=o.reject,o.allSettled&&(r.allSettled=o.allSettled),o.any&&(r.any=o.any))}}function ft(){var e=i.Promise;return xe?{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 ht(e,t,n,r,i){var o=Ce;try{return lt(e,!0),t(n,r,i)}finally{lt(o,!1)}}function dt(e,t,n,r){return"function"!=typeof e?e:function(){var i=Ce;n&&ot(),lt(t,!0);try{return e.apply(this,arguments)}finally{lt(i,!1),r&&queueMicrotask(at)}}}function pt(e){Promise===_e&&0===Je.echoes?0===tt?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+we).indexOf("[native code]")&&(ot=at=re);var vt=qe.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Ce.letThrough||e._vip)){var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(i){return i.name===H.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e.close({disableAutoOpen:!1}),e.open().then((function(){return yt(e,t,n,r)}))):vt(i)}return i._promise(t,(function(e,t){return it((function(){return Ce.trans=i,r(e,t,i)}))})).then((function(e){if("readwrite"===t)try{i.idbtrans.commit()}catch(e){}return"readonly"===t?e:i._completion.then((function(){return e}))}))}if(e._state.openComplete)return vt(new Z.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._state.autoOpen)return vt(new Z.DatabaseClosed);e.open().catch(re)}return e._state.dbReadyPromise.then((function(){return yt(e,t,n,r)}))}var mt="4.4.2",bt=String.fromCharCode(65535),gt=-1/0,wt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",_t="String expected.",xt=1e3,kt="__dbnames",Ot="readonly",Pt="readwrite";function Et(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var St={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Kt(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=D(t))[e],t}}function At(){throw Z.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function jt(e,t){try{var n=It(e),r=It(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 e>t?1:e<t?-1:0;case"binary":return Tt(Dt(e),Dt(t));case"Array":return Ct(e,t)}}catch(e){}return NaN}function Ct(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=jt(e[o],t[o]);if(0!==a)return a}return n===r?0:n<r?-1:1}function Tt(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}function It(e){var t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";var n=B(e);return"ArrayBuffer"===n?"binary":n}function Dt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function qt(e,t,n){var r=e.schema.yProps;return r?(t&&n.numFailures>0&&(t=t.filter((function(e,t){return!n.failures[t]}))),Promise.all(r.map((function(n){var r=n.updatesTable;return t?e.db.table(r).where("k").anyOf(t).delete():e.db.table(r).clear()}))).then((function(){return n}))):n}var Rt=function(){function e(e){this["@@propmod"]=e}return e.prototype.execute=function(e){var t,n=this["@@propmod"];if(void 0!==n.add){var i=n.add;if(u(i))return r(r([],u(e)?e:[],!0),i).sort();if("number"==typeof i)return(Number(e)||0)+i;if("bigint"==typeof i)try{return BigInt(e)+i}catch(e){return BigInt(0)+i}throw new TypeError("Invalid term ".concat(i))}if(void 0!==n.remove){var o=n.remove;if(u(o))return u(e)?e.filter((function(e){return!o.includes(e)})).sort():[];if("number"==typeof o)return Number(e)-o;if("bigint"==typeof o)try{return BigInt(e)-o}catch(e){return BigInt(0)-o}throw new TypeError("Invalid subtrahend ".concat(o))}var a=null===(t=n.replacePrefix)||void 0===t?void 0:t[0];return a&&"string"==typeof e&&e.startsWith(a)?n.replacePrefix[1]+e.substring(a.length):e},e}();function Bt(e,t){for(var n=a(t),r=n.length,i=!1,o=0;o<r;++o){var u=n[o],s=t[u],c=O(e,u);s instanceof Rt?(P(e,u,s.execute(c)),i=!0):c!==s&&(P(e,u,s),i=!0)}return i}var Ft=function(){function e(){}return e.prototype._trans=function(e,t,n){var r=this._tx||Ce.trans,i=this.name,o=he&&"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 Z.NotFound("Table "+i+" not part of transaction");return t(r.idbtrans,r)}var u=ze();try{var s=r&&r.db._novip===this.db._novip?r===Ce.trans?r._promise(e,a,n):it((function(){return r._promise(e,a,n)}),{trans:r,transless:Ce.transless||Ce}):yt(this.db,e,[this.name],a);return o&&(s._consoleTask=o,s=s.catch((function(e){return console.trace(e),vt(e)}))),s}finally{u&&Ve()}},e.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?vt(new Z.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)},e.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(u(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=a(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 e.keyPath.indexOf(t)>=0}))){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!==bt){var r=n.keyPath.slice(0,t.length);return this.where(r).equals(r.map((function(t){return e[t]})))}!n&&he&&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;function o(e,t){return 0===jt(e,t)}var s=t.reduce((function(t,n){var r=t[0],a=t[1],s=i[n],c=e[n];return[r||s,r||!s?Et(a,s&&s.multi?function(e){var t=O(e,n);return u(t)&&t.some((function(e){return o(c,e)}))}:function(e){return o(c,O(e,n))}):a]}),[null,null]),c=s[0],l=s[1];return c?this.where(c.name).equals(e[c.keyPath]).filter(l):n?this.filter(l):this.where(t).equals("")},e.prototype.filter=function(e){return this.toCollection().and(e)},e.prototype.count=function(e){return this.toCollection().count(e)},e.prototype.offset=function(e){return this.toCollection().offset(e)},e.prototype.limit=function(e){return this.toCollection().limit(e)},e.prototype.each=function(e){return this.toCollection().each(e)},e.prototype.toArray=function(e){return this.toCollection().toArray(e)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,u(e)?"[".concat(e.join("+"),"]"):e))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(e){var n=this,r=n.db,i=n.name;this.schema.mappedClass=e,e.prototype instanceof At&&(e=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),Object.defineProperty(n.prototype,"db",{get:function(){return r},enumerable:!1,configurable:!0}),n.prototype.table=function(){return i},n}(e));for(var o=new Set,a=e.prototype;a;a=c(a))Object.getOwnPropertyNames(a).forEach((function(e){return o.add(e)}));var u=function(t){if(!t)return t;var n=Object.create(e.prototype);for(var r in t)if(!o.has(r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=u,this.hook("reading",u),e},e.prototype.defineClass=function(){function e(e){s(this,e)}return this.mapToClass(e)},e.prototype.add=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=Kt(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?qe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{P(e,o,t)}catch(e){}return t}))},e.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans("readwrite",(function(i){return n.core.get({trans:i,key:e}).then((function(o){var a=null!=o?o:{};return Bt(a,t),r&&P(a,r,e),n.core.mutate({trans:i,type:"put",values:[a],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then((function(e){return e.numFailures?qe.reject(e.failures[0]):!!o}))}))}))},e.prototype.update=function(e,t){if("object"!=typeof e||u(e))return this.where(":id").equals(e).modify(t);var n=O(e,this.schema.primKey.keyPath);return void 0===n?vt(new Z.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(n).modify(t)},e.prototype.put=function(e,t){var n=this,r=this.schema.primKey,i=r.auto,o=r.keyPath,a=e;return o&&i&&(a=Kt(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?qe.reject(e.failures[0]):e.lastResult})).then((function(t){if(o)try{P(e,o,t)}catch(e){}return t}))},e.prototype.delete=function(e){var t=this;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]}).then((function(n){return qt(t,[e],n)})).then((function(e){return e.numFailures?qe.reject(e.failures[0]):void 0}))}))},e.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(t){return e.core.mutate({trans:t,type:"deleteRange",range:St}).then((function(t){return qt(e,null,t)}))})).then((function(e){return e.numFailures?qe.reject(e.failures[0]):void 0}))},e.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",(function(n){return t.core.getMany({keys:e,trans:n}).then((function(e){return e.map((function(e){return t.hook.reading.fire(e)}))}))}))},e.prototype.bulkAdd=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=r.schema.primKey,a=n.auto,u=n.keyPath;if(u&&i)throw new Z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new Z.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=u&&a?e.map(Kt(u)):e;return r.core.mutate({trans:t,type:"add",keys:i,values:c,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult,a=e.failures;if(0===t)return o?n:i;throw new X("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(s," operations failed"),a)}))}))},e.prototype.bulkPut=function(e,t,n){var r=this,i=Array.isArray(t)?t:void 0,o=(n=n||(i?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(function(t){var n=r.schema.primKey,a=n.auto,u=n.keyPath;if(u&&i)throw new Z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new Z.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length,c=u&&a?e.map(Kt(u)):e;return r.core.mutate({trans:t,type:"put",keys:i,values:c,wantResults:o}).then((function(e){var t=e.numFailures,n=e.results,i=e.lastResult,a=e.failures;if(0===t)return o?n:i;throw new X("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(s," operations failed"),a)}))}))},e.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!==jt(d,r))throw new Z.Constraint("Cannot update primary key in bulkUpdate()")}else P(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=a[i],s=o[Number(u)];if(null!=s){var c=r[u];delete r[u],r[s]=c}}throw new X("".concat(t.name,".bulkUpdate(): ").concat(n," of ").concat(l," operations failed"),r)}))}))}))},e.prototype.bulkDelete=function(e){var t=this,n=e.length;return this._trans("readwrite",(function(n){return t.core.mutate({trans:n,type:"delete",keys:e}).then((function(n){return qt(t,e,n)}))})).then((function(e){var r=e.numFailures,i=e.lastResult,o=e.failures;if(0===r)return i;throw new X("".concat(t.name,".bulkDelete(): ").concat(r," of ").concat(n," operations failed"),o)}))},e}();function Nt(e){var t={},n=function(n,r){if(r){for(var i=arguments.length,o=new Array(i-1);--i;)o[i-1]=arguments[i];return t[n].subscribe.apply(null,o),e}if("string"==typeof n)return t[n]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(e,r,i){if("object"==typeof e)return s(e);r||(r=le),i||(i=re);var o={subscribers:[],fire:i,subscribe:function(e){-1===o.subscribers.indexOf(e)&&(o.subscribers.push(e),o.fire=r(o.fire,e))},unsubscribe:function(e){o.subscribers=o.subscribers.filter((function(t){return t!==e})),o.fire=o.subscribers.reduce(r,i)}};return t[e]=n[e]=o,o}function s(e){a(e).forEach((function(t){var n=e[t];if(u(n))o(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new Z.InvalidArgument("Invalid event config");var r=o(t,ie,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach((function(e){x((function(){e.apply(null,t)}))}))}))}}))}}function Mt(e,t){return v(t).from({prototype:e}),t}function Lt(e){return Mt(Ft.prototype,(function(t,n,r){this.db=e,this._tx=r,this.name=t,this.schema=n,this.hook=e._allTables[t]?e._allTables[t].hook:Nt(null,{creating:[ue,re],reading:[oe,ie],updating:[ce,re],deleting:[se,re]})}))}function $t(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Ut(e,t){e.filter=Et(e.filter,t)}function zt(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Et(r(),t())}:t,e.justLimit=n&&!r}function Vt(e,t){e.isMatch=Et(e.isMatch,t)}function Wt(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new Z.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Yt(e,t,n){var r=Wt(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 Qt(e,t,n,r){var i=e.replayFilter?Et(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(e,n,r){if(!i||i(n,r,(function(e){return n.stop(e)}),(function(e){return n.fail(e)}))){var a=n.primaryKey,u=""+a;"[object ArrayBuffer]"===u&&(u=""+new Uint8Array(a)),f(o,u)||(o[u]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(a,n),Gt(Yt(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return Gt(Yt(e,r,n),Et(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Gt(e,t,n,r){var i=He(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=re}),(function(t){e.fail(t),n=re}))||i(e.value,e,(function(e){return n=e})),n()}))}))}var Xt=function(){function e(){}return e.prototype._read=function(e,t){var n=this._ctx;return n.error?n.table._trans(null,vt.bind(null,n.error)):n.table._trans("readonly",e).then(t)},e.prototype._write=function(e){var t=this._ctx;return t.error?t.table._trans(null,vt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")},e.prototype._addAlgorithm=function(e){var t=this._ctx;t.algorithm=Et(t.algorithm,e)},e.prototype._iterate=function(e,t){return Qt(this._ctx,e,t,this._ctx.table.core)},e.prototype.clone=function(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(e){var t=this._ctx;return this._read((function(n){return Qt(t,e,n,t.table.core)}))},e.prototype.count=function(e){var t=this;return this._read((function(e){var n=t._ctx,r=n.table.core;if($t(n,!0))return r.count({trans:e,query:{index:Wt(n,r.schema),range:n.range}}).then((function(e){return Math.min(e,n.limit)}));var i=0;return Qt(n,(function(){return++i,!1}),e,r).then((function(){return i}))})).then(e)},e.prototype.sortBy=function(e,t){var n=e.split(".").reverse(),r=n[0],i=n.length-1;function o(e,t){return t?o(e[n[t]],t-1):e[r]}var a="next"===this._ctx.dir?1:-1;function u(e,t){return jt(o(e,i),o(t,i))*a}return this.toArray((function(e){return e.sort(u)})).then(t)},e.prototype.toArray=function(e){var t=this;return this._read((function(e){var n=t._ctx;if($t(n,!0)&&n.limit>0){var r=n.valueMapper,i=Wt(n,n.table.core.schema);return n.table.core.query({trans:e,limit:n.limit,values:!0,direction:"prev"===n.dir?"prev":void 0,query:{index:i,range:n.range}}).then((function(e){var t=e.result;return r?t.map(r):t}))}var o=[];return Qt(n,(function(e){return o.push(e)}),e,n.table.core).then((function(){return o}))}),e)},e.prototype.offset=function(e){var t=this._ctx;return e<=0||(t.offset+=e,$t(t)?zt(t,(function(){var t=e;return function(e,n){return 0===t||(1===t?(--t,!1):(n((function(){e.advance(t),t=0})),!1))}})):zt(t,(function(){var t=e;return function(){return--t<0}}))),this},e.prototype.limit=function(e){return this._ctx.limit=Math.min(this._ctx.limit,e),zt(this._ctx,(function(){var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this},e.prototype.until=function(e,t){return Ut(this._ctx,(function(n,r,i){return!e(n.value)||(r(i),t)})),this},e.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)},e.prototype.last=function(e){return this.reverse().first(e)},e.prototype.filter=function(e){return Ut(this._ctx,(function(t){return e(t.value)})),Vt(this._ctx,e),this},e.prototype.and=function(e){return this.filter(e)},e.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)},e.prototype.reverse=function(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))},e.prototype.eachUniqueKey=function(e){return this._ctx.unique="unique",this.eachKey(e)},e.prototype.eachPrimaryKey=function(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))},e.prototype.keys=function(e){var t=this._ctx;t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.key)})).then((function(){return n})).then(e)},e.prototype.primaryKeys=function(e){var t=this._ctx;if($t(t,!0)&&t.limit>0)return this._read((function(e){var n=Wt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,direction:"prev"===t.dir?"prev":void 0,query:{index:n,range:t.range}})})).then((function(e){return e.result})).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)},e.prototype.uniqueKeys=function(e){return this._ctx.unique="unique",this.keys(e)},e.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)},e.prototype.lastKey=function(e){return this.reverse().firstKey(e)},e.prototype.distinct=function(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Ut(this._ctx,(function(e){var t=e.primaryKey.toString(),r=f(n,t);return n[t]=!0,!r})),this},e.prototype.modify=function(e){var t=this,n=this._ctx;return this._write((function(r){var i;i="function"==typeof e?e:function(t){return Bt(t,e)};var o=n.table.core,u=o.schema.primaryKey,s=u.outbound,c=u.extractKey,l=200,f=t.db._options.modifyChunkSize;f&&(l="object"==typeof f?f[o.name]||f["*"]||200:f);var h=[],d=0,p=[],v=function(e,t){var n=t.failures,r=t.numFailures;d+=e-r;for(var i=0,o=a(n);i<o.length;i++){var u=o[i];h.push(n[u])}},y=e===Ht;return t.clone().primaryKeys().then((function(t){var a=$t(n)&&n.limit===1/0&&("function"!=typeof e||y)&&{index:n.index,range:n.range},u=function(f){var h=Math.min(l,t.length-f),d=t.slice(f,f+h);return(y?Promise.resolve([]):o.getMany({trans:r,keys:d,cache:"immutable"})).then((function(p){var m=[],b=[],g=s?[]:null,w=y?d:[];if(!y)for(var _=0;_<h;++_){var x=p[_],k={value:D(x),primKey:t[f+_]};!1!==i.call(k,k.value,k)&&(null==k.value?w.push(t[f+_]):s||0===jt(c(x),c(k.value))?(b.push(k.value),s&&g.push(t[f+_])):(w.push(t[f+_]),m.push(k.value)))}return Promise.resolve(m.length>0&&o.mutate({trans:r,type:"add",values:m}).then((function(e){for(var t in e.failures)w.splice(parseInt(t),1);v(m.length,e)}))).then((function(){return(b.length>0||a&&"object"==typeof e)&&o.mutate({trans:r,type:"put",keys:g,values:b,criteria:a,changeSpec:"function"!=typeof e&&e,isAdditionalChunk:f>0}).then((function(e){return v(b.length,e)}))})).then((function(){return(w.length>0||a&&y)&&o.mutate({trans:r,type:"delete",keys:w,criteria:a,isAdditionalChunk:f>0}).then((function(e){return qt(n.table,w,e)})).then((function(e){return v(w.length,e)}))})).then((function(){return t.length>f+h&&u(f+l)}))}))};return u(0).then((function(){if(h.length>0)throw new G("Error modifying one or more objects",h,d,p);return t.length}))}))}))},e.prototype.delete=function(){var e=this._ctx,t=e.range;return!$t(e)||e.table.schema.yProps||!e.isPrimKey&&3!==t.type?this.modify(Ht):this._write((function(n){var r=e.table.core.schema.primaryKey,i=t;return e.table.core.count({trans:n,query:{index:r,range:i}}).then((function(t){return e.table.core.mutate({trans:n,type:"deleteRange",range:i}).then((function(e){var n=e.failures,r=e.numFailures;if(r)throw new G("Could not delete some values",Object.keys(n).map((function(e){return n[e]})),t-r);return t-r}))}))}))},e}(),Ht=function(e,t){return t.value=null};function Jt(e){return Mt(Xt.prototype,(function(t,n){this.db=e;var r=St,i=null;if(n)try{r=n()}catch(e){i=e}var o=t._ctx,a=o.table,u=a.hook.reading.fire;this._ctx={table:a,index:o.index,isPrimKey:!o.index||a.schema.primKey.keyPath&&o.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:i,or:o.or,valueMapper:u!==ie?u:null}}))}function Zt(e,t){return e<t?-1:e===t?0:1}function en(e,t){return e>t?-1:e===t?0:1}function tn(e,t,n){var r=e instanceof ln?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function nn(e){return new e.Collection(e,(function(){return cn("")})).limit(0)}function rn(e){return"next"===e?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}function on(e){return"next"===e?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}function an(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 i(e[s],n[s])<0?e.substr(0,s)+n[s]+n.substr(s+1):i(e[s],r[s])<0?e.substr(0,s)+r[s]+n.substr(s+1):u>=0?e.substr(0,u)+t[u]+n.substr(u+1):null;i(e[s],c)<0&&(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)}function un(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 tn(e,_t);function h(e){i=rn(e),o=on(e),a="next"===e?Zt:en;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})),c=e,l="next"===e?"":r}h("next");var d=new e.Collection(e,(function(){return sn(u[0],s[f-1]+r)}));d._ondirectionchange=function(e){h(e)};var p=0;return d._addAlgorithm((function(e,n,r){var i=e.key;if("string"!=typeof i)return!1;var h=o(i);if(t(h,s,p))return!0;for(var d=null,v=p;v<f;++v){var y=an(i,h,u[v],s[v],a,c);null===y&&null===d?p=v+1:(null===d||a(d,y)>0)&&(d=y)}return n(null!==d?function(){e.continue(d+l)}:r),!1})),d}function sn(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function cn(e){return{type:1,lower:e,upper:e}}var ln=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(e,t,n,r){n=!1!==n,r=!0===r;try{return this._cmp(e,t)>0||0===this._cmp(e,t)&&(n||r)&&(!n||!r)?nn(this):new this.Collection(this,(function(){return sn(e,t,!n,!r)}))}catch(e){return tn(this,wt)}},e.prototype.equals=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return cn(e)}))},e.prototype.above=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(e,void 0,!0)}))},e.prototype.aboveOrEqual=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(e,void 0,!1)}))},e.prototype.below=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(void 0,e,!1,!0)}))},e.prototype.belowOrEqual=function(e){return null==e?tn(this,wt):new this.Collection(this,(function(){return sn(void 0,e)}))},e.prototype.startsWith=function(e){return"string"!=typeof e?tn(this,_t):this.between(e,e+bt,!0,!0)},e.prototype.startsWithIgnoreCase=function(e){return""===e?this.startsWith(e):un(this,(function(e,t){return 0===e.indexOf(t[0])}),[e],bt)},e.prototype.equalsIgnoreCase=function(e){return un(this,(function(e,t){return e===t[0]}),[e],"")},e.prototype.anyOfIgnoreCase=function(){var e=$.apply(L,arguments);return 0===e.length?nn(this):un(this,(function(e,t){return-1!==t.indexOf(e)}),e,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var e=$.apply(L,arguments);return 0===e.length?nn(this):un(this,(function(e,t){return t.some((function(t){return 0===e.indexOf(t)}))}),e,bt)},e.prototype.anyOf=function(){var e=this,t=$.apply(L,arguments),n=this._cmp;try{t.sort(n)}catch(e){return tn(this,wt)}if(0===t.length)return nn(this);var r=new this.Collection(this,(function(){return sn(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;n(a,t[i])>0;)if(++i===t.length)return r(o),!1;return 0===n(a,t[i])||(r((function(){e.continue(t[i])})),!1)})),r},e.prototype.notEqual=function(e){return this.inAnyRange([[gt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var e=$.apply(L,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return tn(this,wt)}var t=e.reduce((function(e,t){return e?e.concat([[e[e.length-1][1],t]]):[[gt,t]]}),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(e,t){var n=this,r=this._cmp,i=this._ascending,o=this._descending,a=this._min,u=this._max;if(0===e.length)return nn(this);if(!e.every((function(e){return void 0!==e[0]&&void 0!==e[1]&&i(e[0],e[1])<=0})))return tn(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",Z.InvalidArgument);var s=!t||!1!==t.includeLowers,c=t&&!0===t.includeUppers;function l(e,t){for(var n=0,i=e.length;n<i;++n){var o=e[n];if(r(t[0],o[1])<0&&r(t[1],o[0])>0){o[0]=a(o[0],t[0]),o[1]=u(o[1],t[1]);break}}return n===i&&e.push(t),e}var f,h=i;function d(e,t){return h(e[0],t[0])}try{(f=e.reduce(l,[])).sort(d)}catch(e){return tn(this,wt)}var p=0,v=c?function(e){return i(e,f[p][1])>0}:function(e){return i(e,f[p][1])>=0},y=s?function(e){return o(e,f[p][0])>0}:function(e){return o(e,f[p][0])>=0};function m(e){return!v(e)&&!y(e)}var b=v,g=new this.Collection(this,(function(){return sn(f[0][0],f[f.length-1][1],!s,!c)}));return g._ondirectionchange=function(e){"next"===e?(b=v,h=i):(b=y,h=o),f.sort(d)},g._addAlgorithm((function(e,t,r){for(var o=e.key;b(o);)if(++p===f.length)return t(r),!1;return!!m(o)||(0===n._cmp(o,f[p][1])||0===n._cmp(o,f[p][0])||t((function(){h===i?e.continue(f[p][0]):e.continue(f[p][1])})),!1)})),g},e.prototype.startsWithAnyOf=function(){var e=$.apply(L,arguments);return e.every((function(e){return"string"==typeof e}))?0===e.length?nn(this):this.inAnyRange(e.map((function(e){return[e,e+bt]}))):tn(this,"startsWithAnyOf() only works with strings")},e}();function fn(e){return Mt(ln.prototype,(function(t,n,r){if(this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r},this._cmp=this._ascending=jt,this._descending=function(e,t){return jt(t,e)},this._max=function(e,t){return jt(e,t)>0?e:t},this._min=function(e,t){return jt(e,t)<0?e:t},this._IDBKeyRange=e._deps.IDBKeyRange,!this._IDBKeyRange)throw new Z.MissingAPI}))}function hn(e){return He((function(t){return dn(t),e(t.target.error),!1}))}function dn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var pn="storagemutated",vn="x-storagemutated-1",yn=Nt(null,pn),mn=function(){function e(){}return e.prototype._lock=function(){return _(!Ce.global),++this._reculock,1!==this._reculock||Ce.global||(Ce.lockOwnerFor=this),this},e.prototype._unlock=function(){if(_(!Ce.global),0==--this._reculock)for(Ce.global||(Ce.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{ht(e[1],e[0])}catch(e){}}return this},e.prototype._locked=function(){return this._reculock&&Ce.lockOwnerFor!==this},e.prototype.create=function(e){var t=this;if(!this.mode)return this;var n=this.db.idbdb,r=this.db._state.dbOpenError;if(_(!this.idbtrans),!e&&!n)switch(r&&r.name){case"DatabaseClosedError":throw new Z.DatabaseClosed(r);case"MissingAPIError":throw new Z.MissingAPI(r.message,r);default:throw new Z.OpenFailed(r)}if(!this.active)throw new Z.TransactionInactive;return _(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):n.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=He((function(n){dn(n),t._reject(e.error)})),e.onabort=He((function(n){dn(n),t.active&&t._reject(new Z.Abort(e.error)),t.active=!1,t.on("abort").fire(n)})),e.oncomplete=He((function(){t.active=!1,t._resolve(),"mutatedParts"in e&&yn.storagemutated.fire(e.mutatedParts)})),this},e.prototype._promise=function(e,t,n){var r=this;if("readwrite"===e&&"readwrite"!==this.mode)return vt(new Z.ReadOnly("Transaction is readonly"));if(!this.active)return vt(new Z.TransactionInactive);if(this._locked())return new qe((function(i,o){r._blockedFuncs.push([function(){r._promise(e,t,n).then(i,o)},Ce])}));if(n)return it((function(){var e=new qe((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 qe((function(e,n){var i=t(e,n,r);i&&i.then&&i.then(e,n)}));return i._lib=!0,i},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(e){var t=this._root(),n=qe.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((function(){return n}));else{t._waitingFor=n,t._waitingQueue=[];var r=t.idbtrans.objectStore(t.storeNames[0]);!function e(){for(++t._spinCount;t._waitingQueue.length;)t._waitingQueue.shift()();t._waitingFor&&(r.get(-1/0).onsuccess=e)}()}var i=t._waitingFor;return new qe((function(e,r){n.then((function(n){return t._waitingQueue.push(He(e.bind(null,n)))}),(function(e){return t._waitingQueue.push(He(r.bind(null,e)))})).finally((function(){t._waitingFor===i&&(t._waitingFor=null)}))}))},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new Z.Abort))},e.prototype.table=function(e){var t=this._memoizedTables||(this._memoizedTables={});if(f(t,e))return t[e];var n=this.schema[e];if(!n)throw new Z.NotFound("Table "+e+" not part of transaction");var r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r},e}();function bn(e){return Mt(mn.prototype,(function(t,n,r,i,o){var a=this;"readonly"!==t&&n.forEach((function(e){var t,i=null===(t=r[e])||void 0===t?void 0:t.yProps;i&&(n=n.concat(i.map((function(e){return e.updatesTable}))))})),this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=i,this.idbtrans=null,this.on=Nt(this,"complete","error","abort"),this.parent=o||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 qe((function(e,t){a._resolve=e,a._reject=t})),this._completion.then((function(){a.active=!1,a.on.complete.fire()}),(function(e){var t=a.active;return a.active=!1,a.on.error.fire(e),a.parent?a.parent._reject(e):t&&a.idbtrans&&a.idbtrans.abort(),vt(e)}))}))}function gn(e,t,n,r,i,o,a,u){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+wn(t),type:u}}function wn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function _n(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:k(n,(function(e){return[e.name,e]}))}}function xn(e){return 1===e.length?e[0]:e}var kn=function(e){try{return e.only([[]]),kn=function(){return[[]]},[[]]}catch(e){return kn=function(){return bt},bt}};function On(e){return null==e?function(){}:"string"==typeof e?Pn(e):function(t){return O(t,e)}}function Pn(e){return 1===e.split(".").length?function(t){return t[e]}:function(t){return O(t,e)}}function En(e){return[].slice.call(e)}var Sn=0;function Kn(e){return null==e?":id":"string"==typeof e?e:"[".concat(e.join("+"),"]")}function An(e,t,n){function r(e,t){var n=En(e.objectStoreNames),r=n.length>0?t.objectStore(n[0]):{};return{schema:{name:e.name,tables:n.map((function(e){return t.objectStore(e)})).map((function(e){var t=e.keyPath,n=e.autoIncrement,r=u(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:On(t)},indexes:En(e.indexNames).map((function(t){return e.index(t)})).map((function(e){var t=e.name,n=e.unique,r=e.multiEntry,i=e.keyPath,a={name:t,compound:u(i),keyPath:i,unique:n,multiEntry:r,extractKey:On(i)};return o[Kn(i)]=a,a})),getIndexByKeyPath:function(e){return o[Kn(e)]}};return o[":id"]=a.primaryKey,null!=t&&(o[Kn(t)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in r&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604),hasIdb3Features:"getAllRecords"in r}}function i(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");var n=e.lower,r=e.upper,i=e.lowerOpen,o=e.upperOpen;return void 0===n?void 0===r?null:t.upperBound(r,!!o):void 0===r?t.lowerBound(n,!!i):t.bound(n,r,!!i,!!o)}function o(e){var t=e.name;function n(e){var n=e.trans,r=e.type,o=e.keys,a=e.values,u=e.range;return new Promise((function(e,s){e=He(e);var c=n.objectStore(t),l=null==c.keyPath,f="put"===r||"add"===r;if(!f&&"delete"!==r&&"deleteRange"!==r)throw new Error("Invalid operation type: "+r);var h,d=(o||a||{length:1}).length;if(o&&a&&o.length!==a.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return e({numFailures:0,failures:{},results:[],lastResult:void 0});var p=[],v=[],y=0,m=function(e){++y,dn(e)};if("deleteRange"===r){if(4===u.type)return e({numFailures:y,failures:v,results:[],lastResult:void 0});3===u.type?p.push(h=c.clear()):p.push(h=c.delete(i(u)))}else{var b=f?l?[a,o]:[a,null]:[o,null],g=b[0],w=b[1];if(f)for(var _=0;_<d;++_)p.push(h=w&&void 0!==w[_]?c[r](g[_],w[_]):c[r](g[_])),h.onerror=m;else for(_=0;_<d;++_)p.push(h=c[r](g[_])),h.onerror=m}var x=function(t){var n=t.target.result;p.forEach((function(e,t){return null!=e.error&&(v[t]=e.error)})),e({numFailures:y,failures:v,results:"delete"===r?o:p.map((function(e){return e.result})),lastResult:n})};h.onerror=function(e){m(e),x(e)},h.onsuccess=x}))}function r(e){var n=e.trans,r=e.values,o=e.query,a=e.reverse,u=e.unique;return new Promise((function(e,s){e=He(e);var c=o.index,l=o.range,f=n.objectStore(t),h=c.isPrimaryKey?f:f.index(c.name),d=a?u?"prevunique":"prev":u?"nextunique":"next",p=r||!("openKeyCursor"in h)?h.openCursor(i(l),d):h.openKeyCursor(i(l),d);p.onerror=hn(s),p.onsuccess=He((function(t){var r=p.result;if(r){r.___id=++Sn,r.done=!1;var i=r.continue.bind(r),o=r.continuePrimaryKey;o&&(o=o.bind(r));var a=r.advance.bind(r),u=function(){throw new Error("Cursor not started")},c=function(){throw new Error("Cursor not stopped")};r.trans=n,r.stop=r.continue=r.continuePrimaryKey=r.advance=u,r.fail=He(s),r.next=function(){var e=this,t=1;return this.start((function(){return t--?e.continue():e.stop()})).then((function(){return e}))},r.start=function(e){var t=new Promise((function(e,t){e=He(e),p.onerror=hn(t),r.fail=t,r.stop=function(t){r.stop=r.continue=r.continuePrimaryKey=r.advance=c,e(t)}})),n=function(){if(p.result)try{e()}catch(e){r.fail(e)}else r.done=!0,r.start=function(){throw new Error("Cursor behind last entry")},r.stop()};return p.onsuccess=He((function(e){p.onsuccess=n,n()})),r.continue=i,r.continuePrimaryKey=o,r.advance=a,n(),t},e(r)}else e(null)}),s)}))}function o(e,n){return function(r){return new Promise((function(o,a){var u;o=He(o);var s=r.trans,c=r.values,l=r.limit,f=r.query,h=null!==(u=r.direction)&&void 0!==u?u:"next",d=l===1/0?void 0:l,p=f.index,v=f.range,y=s.objectStore(t),m=p.isPrimaryKey?y:y.index(p.name),b=i(v);if(0===l)return o({result:[]});if(n){var g={query:b,count:d,direction:h};(w=c?m.getAll(g):m.getAllKeys(g)).onsuccess=function(e){return o({result:e.target.result})},w.onerror=hn(a)}else if(e&&"next"===h){var w;(w=c?m.getAll(b,d):m.getAllKeys(b,d)).onsuccess=function(e){return o({result:e.target.result})},w.onerror=hn(a)}else{var _=0,x=c||!("openKeyCursor"in m)?m.openCursor(b,h):m.openKeyCursor(b,h),k=[];x.onsuccess=function(){var e=x.result;return e?(k.push(c?e.value:e.primaryKey),++_===l?o({result:k}):void e.continue()):o({result:k})},x.onerror=hn(a)}}))}}return{name:t,schema:e,mutate:n,getMany:function(e){var n=e.trans,r=e.keys;return new Promise((function(e,i){e=He(e);for(var o,a=n.objectStore(t),u=r.length,s=new Array(u),c=0,l=0,f=function(t){var n=t.target;s[n._pos]=n.result,++l===c&&e(s)},h=hn(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=He(e);var o=n.objectStore(t).get(r);o.onsuccess=function(t){return e(t.target.result)},o.onerror=hn(i)}))},query:o(c,l),openCursor:r,count:function(e){var n=e.query,r=e.trans,o=n.index,a=n.range;return new Promise((function(e,n){var u=r.objectStore(t),s=o.isPrimaryKey?u:u.index(o.name),c=i(a),l=c?s.count(c):s.count();l.onsuccess=He((function(t){return e(t.target.result)})),l.onerror=hn(n)}))}}}var a=r(e,n),s=a.schema,c=a.hasGetAll,l=a.hasIdb3Features,f=s.tables.map((function(e){return o(e)})),h={};return f.forEach((function(e){return h[e.name]=e})),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(e){if(!h[e])throw new Error("Table '".concat(e,"' not found"));return h[e]},MIN_KEY:-1/0,MAX_KEY:kn(t),schema:s}}function jn(e,t){return t.reduce((function(e,t){var r=t.create;return n(n({},e),r(e))}),e)}function Cn(e,t,n,r){var i=n.IDBKeyRange;return n.indexedDB,{dbcore:jn(An(t,i,r),e.dbcore)}}function Tn(e,t){var n=t.db,r=Cn(e._middlewares,n,e._deps,t);e.core=r.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 In(e,t,n,r){n.forEach((function(n){var i=r[n];t.forEach((function(t){var r=m(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?p(t,n,{get:function(){return this.table(n)},set:function(e){d(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,i))}))}))}function Dn(e,t){t.forEach((function(t){for(var n in t)t[n]instanceof e.Table&&delete t[n]}))}function qn(e,t){return e._cfg.version-t._cfg.version}function Rn(e,t,n,r){var i=e._dbSchema;n.objectStoreNames.contains("$meta")&&!i.$meta&&(i.$meta=_n("$meta",Gn("")[0],[]),e._storeNames.push("$meta"));var o=e._createTransaction("readwrite",e._storeNames,i);o.create(n),o._completion.catch(r);var u=o._reject.bind(o),s=Ce.transless||Ce;it((function(){if(Ce.trans=o,Ce.transless=s,0!==t)return Tn(e,n),Fn(e,o,t).then((function(t){return Nn(e,t,o,n)})).catch(u);a(i).forEach((function(e){Ln(n,e,i[e].primKey,i[e].indexes)})),Tn(e,n),qe.follow((function(){return e.on.populate.fire(o)})).catch(u)}))}function Bn(e,t){$n(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=Vn(e,e.idbdb,t);Qn(e,e._dbSchema,t);for(var r=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){he&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),zn(n,t)}))},i=0,o=Mn(n,e._dbSchema).change;i<o.length;i++){var a=r(o[i]);if("object"==typeof a)return a.value}}function Fn(e,t,n){return t.storeNames.includes("$meta")?t.table("$meta").get("version").then((function(e){return null!=e?e:n})):qe.resolve(n)}function Nn(e,t,n,r){var i=[],o=e._versions,u=e._dbSchema=Vn(e,e.idbdb,r),s=o.filter((function(e){return e._cfg.version>=t}));if(0===s.length)return qe.resolve();function c(){return i.length?qe.resolve(i.shift()(n.idbtrans)).then(c):qe.resolve()}return s.forEach((function(o){i.push((function(){var i=u,s=o._cfg.dbschema;Qn(e,i,r),Qn(e,s,r),u=e._dbSchema=s;var c=Mn(i,s);c.add.forEach((function(e){Ln(r,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((function(e){if(e.recreate)throw new Z.Upgrade("Not yet support for changing primary key");var t=r.objectStore(e.name);e.add.forEach((function(e){return zn(t,e)})),e.change.forEach((function(e){t.deleteIndex(e.name),zn(t,e)})),e.del.forEach((function(e){return t.deleteIndex(e)}))}));var l=o._cfg.contentUpgrade;if(l&&o._cfg.version>t){Tn(e,r),n._memoizedTables={};var f=S(s);c.del.forEach((function(e){f[e]=i[e]})),Dn(e,[e.Transaction.prototype]),In(e,[e.Transaction.prototype],a(f),f),n.schema=f;var h,d=U(l);d&&ot();var p=qe.follow((function(){if((h=l(n))&&d){var e=at.bind(null,null);h.then(e,e)}}));return h&&"function"==typeof h.then?qe.resolve(h):p.then((function(){return h}))}})),i.push((function(t){Un(o._cfg.dbschema,t),Dn(e,[e.Transaction.prototype]),In(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema})),i.push((function(t){e.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(e.idbdb.version/10)===o._cfg.version?(e.idbdb.deleteObjectStore("$meta"),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter((function(e){return"$meta"!==e}))):t.objectStore("$meta").put(o._cfg.version,"version"))}))})),c().then((function(){$n(u,r)}))}function Mn(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)}(a.del.length>0||a.add.length>0||a.change.length>0)&&r.change.push(a)}}else r.add.push([n,o])}return r}function Ln(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((function(e){return zn(i,e)})),i}function $n(e,t){a(e).forEach((function(n){t.db.objectStoreNames.contains(n)||(he&&console.debug("Dexie: Creating missing table",n),Ln(t,n,e[n].primKey,e[n].indexes))}))}function Un(e,t){[].slice.call(t.db.objectStoreNames).forEach((function(n){return null==e[n]&&t.db.deleteObjectStore(n)}))}function zn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Vn(e,t,n){var r={};return g(t.objectStoreNames,0).forEach((function(e){for(var t=n.objectStore(e),i=t.keyPath,o=gn(wn(i),i||"",!0,!1,!!t.autoIncrement,i&&"string"!=typeof i,!0),a=[],u=0;u<t.indexNames.length;++u){var s=t.index(t.indexNames[u]);i=s.keyPath;var c=gn(s.name,i,!!s.unique,!!s.multiEntry,!1,i&&"string"!=typeof i,!1);a.push(c)}r[e]=_n(e,o,a)})),r}function Wn(e,t,n){e.verno=t.version/10;var r=e._dbSchema=Vn(e,t,n);e._storeNames=g(t.objectStoreNames,0),In(e,[e._allTables],a(r),r)}function Yn(e,t){var n=Mn(Vn(e,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((function(e){return e.add.length||e.change.length})))}function Qn(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:"["+g(l).join("+")+"]";if(t[a]){var h=t[a].idxByName[f];h&&(h.name=c,delete t[a].idxByName[f],t[a].idxByName[c]=h)}}}"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 Gn(e){return e.split(",").map((function(e,t){var n,r=e.split(":"),i=null===(n=r[1])||void 0===n?void 0:n.trim(),o=(e=r[0].trim()).replace(/([&*]|\+\+)/g,""),a=/^\[/.test(o)?o.match(/^\[(.*)\]$/)[1].split("+"):o;return gn(o,a||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),u(a),0===t,i)}))}var Xn=function(){function e(){}return e.prototype._createTableSchema=function(e,t,n){return _n(e,t,n)},e.prototype._parseIndexSyntax=function(e){return Gn(e)},e.prototype._parseStoresSpec=function(e,t){var n=this;a(e).forEach((function(r){if(null!==e[r]){var i=n._parseIndexSyntax(e[r]),o=i.shift();if(!o)throw new Z.Schema("Invalid schema for table "+r+": "+e[r]);if(o.unique=!0,o.multi)throw new Z.Schema("Primary key cannot be multiEntry*");i.forEach((function(e){if(e.auto)throw new Z.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new Z.Schema("Index must have a name and cannot be an empty string")}));var a=n._createTableSchema(r,o,i);t[r]=a}}))},e.prototype.stores=function(e){var t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;var n=t._versions,r={},i={};return n.forEach((function(e){s(r,e._cfg.storesSource),i=e._cfg.dbschema={},e._parseStoresSpec(r,i)})),t._dbSchema=i,Dn(t,[t._allTables,t,t.Transaction.prototype]),In(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],a(i),i),t._storeNames=a(i),this},e.prototype.upgrade=function(e){return this._cfg.contentUpgrade=fe(this._cfg.contentUpgrade||re,e),this},e}();function Hn(e){return Mt(Xn.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}var Jn,Zn=er();function er(){if("undefined"!=typeof FinalizationRegistry&&"undefined"!=typeof WeakRef){var e=new Set,t=new FinalizationRegistry((function(t){e.delete(t)}));return{toArray:function(){return Array.from(e).map((function(e){return e.deref()})).filter((function(e){return void 0!==e}))},add:function(n){var r=new WeakRef(n._novip);if(e.add(r),t.register(n._novip,r,r),e.size>n._options.maxConnections){var i=e.values().next().value;e.delete(i),t.unregister(i)}},remove:function(n){if(n)for(var r=e.values(),i=r.next();!i.done;){var o=i.value;if(o.deref()===n._novip)return e.delete(o),void t.unregister(o);i=r.next()}}}}var n=[];return{toArray:function(){return n},add:function(e){n.push(e._novip)},remove:function(e){if(e){var t=n.indexOf(e._novip);-1!==t&&n.splice(t,1)}}}}function tr(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ni(kt,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function nr(e){return e&&"function"==typeof e.databases}function rr(e){var t=e.indexedDB,n=e.IDBKeyRange;return nr(t)?Promise.resolve(t.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==kt}))})):tr(t,n).toCollection().primaryKeys()}function ir(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!nr(n)&&t!==kt&&tr(n,r).put({name:t}).catch(re)}function or(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!nr(n)&&t!==kt&&tr(n,r).delete(t).catch(re)}function ar(e){return it((function(){return Ce.letThrough=!0,e()}))}function ur(){var e;return!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise((function(t){var n=function(){return indexedDB.databases().finally(t)};e=setInterval(n,100),n()})).finally((function(){return clearInterval(e)})):Promise.resolve()}function sr(e){return!("from"in e)}var cr=function(e,t){if(!this){var n=new cr;return e&&"d"in e&&s(n,e),n}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function lr(e,t,n){var r=jt(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(sr(e))return s(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(jt(n,e.from)<0)return i?lr(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},pr(e);if(jt(t,e.to)>0)return o?lr(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},pr(e);jt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),jt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var a=!e.r;i&&!e.l&&fr(e,i),o&&a&&fr(e,o)}}function fr(e,t){function n(e,t){var r=t.from,i=t.to,o=t.l,a=t.r;lr(e,r,i),o&&n(e,o),a&&n(e,a)}sr(t)||n(e,t)}function hr(e,t){var n=dr(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=dr(e),a=o.next(i.from),u=a.value;!r.done&&!a.done;){if(jt(u.from,i.to)<=0&&jt(u.to,i.from)>=0)return!0;jt(i.from,u.from)<0?i=(r=n.next(u.from)).value:u=(a=o.next(i.from)).value}return!1}function dr(e){var t=sr(e)?null:{s:0,n:e};return{next:function(e){for(var n=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&jt(e,t.n.from)<0;)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||jt(e,t.n.to)<=0)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 pr(e){var t,r,i=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(r=e.l)||void 0===r?void 0:r.d)||0),o=i>1?"r":i<-1?"l":"";if(o){var a="r"===o?"l":"r",u=n({},e),s=e[o];e.from=s.from,e.to=s.to,e[o]=s[o],u[o]=s[a],e[a]=u,u.d=vr(u)}e.d=vr(e)}function vr(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}function yr(e,t){return a(t).forEach((function(n){e[n]?fr(e[n],t[n]):e[n]=T(t[n])})),e}function mr(e,t){return e.all||t.all||Object.keys(e).some((function(n){return t[n]&&hr(t[n],e[n])}))}h(cr.prototype,(Jn={add:function(e){return fr(this,e),this},addKey:function(e){return lr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach((function(e){return lr(t,e,e)})),this},hasKey:function(e){var t=dr(this).next(e).value;return t&&jt(t.from,e)<=0&&jt(t.to,e)>=0}},Jn[F]=function(){return dr(this)},Jn));var br={},gr={},wr=!1;function _r(e,t){yr(gr,e),wr||(wr=!0,setTimeout((function(){wr=!1;var e=gr;gr={},xr(e,!1)}),0))}function xr(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,i=Object.values(br);r<i.length;r++)kr(u=i[r],e,n,t);else for(var o in e){var a=/^idb\:\/\/(.*)\/(.*)\//.exec(o);if(a){var u,s=a[1],c=a[2];(u=br["idb://".concat(s,"/").concat(c)])&&kr(u,e,n,t)}}n.forEach((function(e){return e()}))}function kr(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];mr(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,p=i;d<p.length;d++){var v=p[d];s=v[0],c=v[1],e.queries.query[s]=c}}function Or(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((function(){return t.dbOpenError?vt(t.dbOpenError):e}));t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller,i=Math.round(10*e.verno),o=!1;function a(){if(t.openCanceller!==r)throw new Z.DatabaseClosed("db.open() was cancelled")}var u=t.dbReadyResolve,s=null,c=!1,l=function(){return new qe((function(r,u){if(a(),!n)throw new Z.MissingAPI;var f=e.name,h=t.autoSchema||!i?n.open(f):n.open(f,i);if(!h)throw new Z.MissingAPI;h.onerror=hn(u),h.onblocked=He(e._fireOnBlocked),h.onupgradeneeded=He((function(r){if(s=h.transaction,t.autoSchema&&!e._options.allowEmptyDB){h.onerror=dn,s.abort(),h.result.close();var i=n.deleteDatabase(f);i.onsuccess=i.onerror=He((function(){u(new Z.NoSuchDatabase("Database ".concat(f," doesnt exist")))}))}else{s.onerror=hn(u);var a=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;c=a<1,e.idbdb=h.result,o&&Bn(e,s),Rn(e,a/10,s,u)}}),u),h.onsuccess=He((function(){s=null;var n=e.idbdb=h.result,a=g(n.objectStoreNames);if(a.length>0)try{var u=n.transaction(xn(a),"readonly");if(t.autoSchema)Wn(e,n,u);else if(Qn(e,e._dbSchema,u),!Yn(e,u)&&!o)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."),n.close(),i=n.version+1,o=!0,r(l());Tn(e,u)}catch(e){}Zn.add(e),n.onversionchange=He((function(n){t.vcFired=!0,e.on("versionchange").fire(n)})),n.onclose=He((function(){e.close({disableAutoOpen:!1})})),c&&ir(e._deps,f),r()}),u)})).catch((function(e){switch(null==e?void 0:e.name){case"UnknownError":if(t.PR1398_maxLoop>0)return t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),l();break;case"VersionError":if(i>0)return i=0,l()}return qe.reject(e)}))};return qe.race([r,("undefined"==typeof navigator?qe.resolve():ur()).then(l)]).then((function(){return a(),t.onReadyBeingFired=[],qe.resolve(ar((function(){return e.on.ready.fire(e.vip)}))).then((function n(){if(t.onReadyBeingFired.length>0){var r=t.onReadyBeingFired.reduce(fe,re);return t.onReadyBeingFired=[],qe.resolve(ar((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{s&&s.abort()}catch(e){}return r===t.openCanceller&&e._close(),vt(n)})).finally((function(){t.openComplete=!0,u()})).then((function(){if(c){var 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 cr(-1/0,[[[]]]))})),t["idb://".concat(e.name,"/").concat(n.name,"/")]=t["idb://".concat(e.name,"/").concat(n.name,"/:dels")]=new cr(-1/0,[[[]]])})),yn(pn).fire(t),xr(t,!0)}return e}))}function Pr(e){var t=function(t){return e.next(t)},n=function(t){return e.throw(t)},r=o(t),i=o(n);function o(e){return function(t){var n=e(t),o=n.value;return n.done?o:o&&"function"==typeof o.then?o.then(r,i):u(o)?Promise.all(o).then(r,i):r(o)}}return o(t)()}function Er(e,t,n){var r=arguments.length;if(r<2)throw new Z.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];return n=i.pop(),[e,A(i),n]}function Sr(e,t,n,r,i){return qe.resolve().then((function(){var o=Ce.transless||Ce,a=e._createTransaction(t,n,e._dbSchema,r);a.explicit=!0;var u={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),a.idbtrans._explicit=!0,e._state.PR1398_maxLoop=3}catch(r){return r.name===H.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e.close({disableAutoOpen:!1}),e.open().then((function(){return Sr(e,t,n,null,i)}))):vt(r)}var s,c=U(i);c&&ot();var l=qe.follow((function(){if(s=i.call(a,a))if(c){var e=at.bind(null,null);s.then(e,e)}else"function"==typeof s.next&&"function"==typeof s.throw&&(s=Pr(s))}),u);return(s&&"function"==typeof s.then?qe.resolve(s).then((function(e){return a.active?e:vt(new Z.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):l.then((function(){return s}))).then((function(e){return r&&a._resolve(),a._completion.then((function(){return e}))})).catch((function(e){return a._reject(e),vt(e)}))}))}function Kr(e,t,n){for(var r=u(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function Ar(e){return n(n({},e),{table:function(t){var r=e.table(t),i=r.schema,o={},a=[];function u(e,t,r){var i=Kn(e),s=o[i]=o[i]||[],c=null==e?0:"string"==typeof e?1:e.length,l=t>0,f=n(n({},r),{name:l?"".concat(i,"(virtual-from:").concat(r.name,")"):r.name,lowLevelIndex:r,isVirtual:l,keyTail:t,keyLength:c,extractKey:On(e),unique:!l&&r.unique});return s.push(f),f.isPrimaryKey||a.push(f),c>1&&u(2===c?e[0]:e.slice(0,c-1),t+1,r),s.sort((function(e,t){return e.keyTail-t.keyTail})),f}var s=u(i.primaryKey.keyPath,0,i.primaryKey);o[":id"]=[s];for(var c=0,l=i.indexes;c<l.length;c++){var f=l[c];u(f.keyPath,0,f)}function h(e){var t=o[Kn(e)];return t&&t[0]}function d(t,n){return{type:1===t.type?2:t.type,lower:Kr(t.lower,t.lowerOpen?e.MAX_KEY:e.MIN_KEY,n),lowerOpen:!0,upper:Kr(t.upper,t.upperOpen?e.MIN_KEY:e.MAX_KEY,n),upperOpen:!0}}function p(e){var t=e.query.index;return t.isVirtual?n(n({},e),{query:{index:t.lowLevelIndex,range:d(e.query.range,t.keyTail)}}):e}var v=n(n({},r),{schema:n(n({},i),{primaryKey:s,indexes:a,getIndexByKeyPath:h}),count:function(e){return r.count(p(e))},query:function(e){return r.query(p(e))},openCursor:function(t){var n=t.query.index,i=n.keyTail,o=n.isVirtual,a=n.keyLength;if(!o)return r.openCursor(t);function u(n){function r(r){null!=r?n.continue(Kr(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()}var o=Object.create(n,{continue:{value:r},continuePrimaryKey:{value:function(t,r){n.continuePrimaryKey(Kr(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}}});return o}return r.openCursor(p(t)).then((function(e){return e&&u(e)}))}});return v}})}var jr={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Ar};function Cr(e,t,n,r){return n=n||{},r=r||"",a(e).forEach((function(i){if(f(t,i)){var o=e[i],a=t[i];if("object"==typeof o&&"object"==typeof a&&o&&a){var u=B(o);u!==B(a)?n[r+i]=t[i]:"Object"===u?Cr(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}else n[r+i]=void 0})),a(t).forEach((function(i){f(e,i)||(n[r+i]=t[i])})),n}function Tr(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}var Ir={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return n(n({},e),{table:function(t){var i=e.table(t),o=i.schema.primaryKey,a=n(n({},i),{mutate:function(e){var a=Ce.trans,u=a.table(t).hook,s=u.deleting,c=u.creating,l=u.updating;switch(e.type){case"add":if(c.fire===re)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"put":if(c.fire===re&&l.fire===re)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"delete":if(s.fire===re)break;return a._promise("readwrite",(function(){return h(e)}),!0);case"deleteRange":if(s.fire===re)break;return a._promise("readwrite",(function(){return d(e)}),!0)}return i.mutate(e);function h(e){var t=Ce.trans,a=e.keys||Tr(o,e);if(!a)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?n(n({},e),{keys:a}):n({},e)).type&&(e.values=r([],e.values)),e.keys&&(e.keys=r([],e.keys)),Dr(i,e,a).then((function(n){var r=a.map((function(r,i){var a=n[i],u={onerror:null,onsuccess:null};if("delete"===e.type)s.fire.call(u,r,a,t);else if("add"===e.type||void 0===a){var h=c.fire.call(u,r,e.values[i],t);null==r&&null!=h&&(r=h,e.keys[i]=r,o.outbound||P(e.values[i],o.keyPath,r))}else{var d=Cr(a,e.values[i]),p=l.fire.call(u,d,r,a,t);if(p){var v=e.values[i];Object.keys(p).forEach((function(e){f(v,e)?v[e]=p[e]:P(v,e,p[e])}))}}return u}));return i.mutate(e).then((function(t){for(var i=t.failures,o=t.results,u=t.numFailures,s=t.lastResult,c=0;c<a.length;++c){var l=o?o[c]:a[c],f=r[c];null==l?f.onerror&&f.onerror(i[c]):f.onsuccess&&f.onsuccess("put"===e.type&&n[c]?e.values[c]:l)}return{failures:i,results:o,numFailures:u,lastResult:s}})).catch((function(e){return r.forEach((function(t){return t.onerror&&t.onerror(e)})),Promise.reject(e)}))}))}function d(e){return p(e.trans,e.range,1e4)}function p(e,t,r){return i.query({trans:e,values:!1,query:{index:o,range:t},limit:r}).then((function(i){var o=i.result;return h({type:"delete",keys:o,trans:e}).then((function(i){return i.numFailures>0?Promise.reject(i.failures[0]):o.length<r?{failures:[],numFailures:0,lastResult:void 0}:p(e,n(n({},t),{lower:o[o.length-1],lowerOpen:!0}),r)}))}))}}});return a}})}};function Dr(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function qr(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)0===jt(t.keys[i],e[o])&&(r.push(n?D(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch(e){return null}}var Rr={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var r=e.table(t);return n(n({},r),{getMany:function(e){if(!e.cache)return r.getMany(e);var t=qr(e.keys,e.trans._cache,"clone"===e.cache);return t?qe.resolve(t):r.getMany(e).then((function(t){return e.trans._cache={keys:e.keys,values:"clone"===e.cache?D(t):t},t}))},mutate:function(e){return"add"!==e.type&&(e.trans._cache=null),r.mutate(e)}})}}}};function Br(e,t){return"readonly"===e.trans.mode&&!!e.subscr&&!e.trans.explicit&&"disabled"!==e.trans.db._options.cache&&!t.schema.primaryKey.outbound}function Fr(e,t){switch(e){case"query":return t.values&&!t.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var Nr={stack:"dbcore",level:0,name:"Observability",create:function(e){var t=e.schema.name,r=new cr(e.MIN_KEY,e.MAX_KEY);return n(n({},e),{transaction:function(t,n,r){if(Ce.subscr&&"readonly"!==n)throw new Z.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Ce.querier));return e.transaction(t,n,r)},table:function(i){var o=e.table(i),s=o.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=n(n({},o),{mutate:function(n){var a,l,f=n.trans,h=n.mutatedParts||(n.mutatedParts={}),p=function(e){var n="idb://".concat(t,"/").concat(i,"/").concat(e);return h[n]||(h[n]=new cr)},v=p(""),y=p(":dels"),m=n.type,b="deleteRange"===n.type?[n.range]:"delete"===n.type?[n.keys]:n.values.length<50?[Tr(c,n).filter((function(e){return e})),n.values]:[],g=b[0],w=b[1],_=n.trans._cache;if(u(g)){v.addKeys(g);var x="delete"===m||g.length===w.length?qr(g,_):null;x||y.addKeys(g),(x||w)&&Mr(p,s,x,w)}else if(g){var k={from:null!==(a=g.lower)&&void 0!==a?a:e.MIN_KEY,to:null!==(l=g.upper)&&void 0!==l?l:e.MAX_KEY};y.add(k),v.add(k)}else v.add(r),y.add(r),s.indexes.forEach((function(e){return p(e.name).add(r)}));return o.mutate(n).then((function(e){return!g||"add"!==n.type&&"put"!==n.type||(v.addKeys(e.results),d&&d.forEach((function(t){for(var r=n.values.map((function(e){return t.extractKey(e)})),i=t.keyPath.findIndex((function(e){return e===c.keyPath})),o=0,a=e.results.length;o<a;++o)r[o][i]=e.results[o];p(t.name).addKeys(r)}))),f.mutatedParts=yr(f.mutatedParts||{},h),e}))}}),v=function(t){var n,r,i=t.query,o=i.index,a=i.range;return[o,new cr(null!==(n=a.lower)&&void 0!==n?n:e.MIN_KEY,null!==(r=a.upper)&&void 0!==r?r:e.MAX_KEY)]},y={get:function(e){return[c,new cr(e.key)]},getMany:function(e){return[c,(new cr).addKeys(e.keys)]},count:v,query:v,openCursor:v};return a(y).forEach((function(e){p[e]=function(a){var u=Ce.subscr,s=!!u,c=Br(Ce,o)&&Fr(e,a)?a.obsSet={}:u;if(s){var l=function(e){var n="idb://".concat(t,"/").concat(i,"/").concat(e);return c[n]||(c[n]=new cr)},d=l(""),p=l(":dels"),v=y[e](a),m=v[0],b=v[1];if("query"===e&&m.isPrimaryKey&&!a.values?p.add(b):l(m.name||"").add(b),!m.isPrimaryKey){if("count"!==e){var g="query"===e&&h&&a.values&&o.query(n(n({},a),{values:!1}));return o[e].apply(this,arguments).then((function(t){if("query"===e){if(h&&a.values)return g.then((function(e){var n=e.result;return d.addKeys(n),t}));var n=a.values?t.result.map(f):t.result;a.values?d.addKeys(n):p.addKeys(n)}else if("openCursor"===e){var r=t,i=a.values;return r&&Object.create(r,{key:{get:function(){return p.addKey(r.primaryKey),r.key}},primaryKey:{get:function(){var e=r.primaryKey;return p.addKey(e),e}},value:{get:function(){return i&&d.addKey(r.primaryKey),r.value}}})}return t}))}p.add(r)}}return o[e].apply(this,arguments)}})),p}})}};function Mr(e,t,n,r){function i(t){var i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}var a=function(e){return t.multiEntry&&u(e)?e.forEach((function(e){return i.addKey(e)})):i.addKey(e)};(n||r).forEach((function(e,t){var i=n&&o(n[t]),u=r&&o(r[t]);0!==jt(i,u)&&(null!=i&&a(i),null!=u&&a(u))}))}t.indexes.forEach(i)}function Lr(e,t,r){if(0===r.numFailures)return t;if("deleteRange"===t.type)return null;var i=t.keys?t.keys.length:"values"in t&&t.values?t.values.length:1;if(r.numFailures===i)return null;var o=n({},t);return u(o.keys)&&(o.keys=o.keys.filter((function(e,t){return!(t in r.failures)}))),"values"in o&&u(o.values)&&(o.values=o.values.filter((function(e,t){return!(t in r.failures)}))),o}function $r(e,t){return void 0===t.lower||(t.lowerOpen?jt(e,t.lower)>0:jt(e,t.lower)>=0)}function Ur(e,t){return void 0===t.upper||(t.upperOpen?jt(e,t.upper)<0:jt(e,t.upper)<=0)}function zr(e,t){return $r(e,t)&&Ur(e,t)}function Vr(e,t,n,r,i,o){if(!n||0===n.length)return e;var a=t.query.index,s=a.multiEntry,c=t.query.range,l=r.schema.primaryKey.extractKey,f=a.extractKey,h=(a.lowLevelIndex||a).extractKey,d=n.reduce((function(e,n){var r=e,i=[];if("add"===n.type||"put"===n.type)for(var o=new cr,a=n.values.length-1;a>=0;--a){var h=n.values[a],d=l(h);if(!o.hasKey(d)){var p=f(h);(s&&u(p)?p.some((function(e){return zr(e,c)})):zr(p,c))&&(o.addKey(d),i.push(h))}}switch(n.type){case"add":var v=(new cr).addKeys(t.values?e.map((function(e){return l(e)})):e);r=e.concat(t.values?i.filter((function(e){var t=l(e);return!v.hasKey(t)&&(v.addKey(t),!0)})):i.map((function(e){return l(e)})).filter((function(e){return!v.hasKey(e)&&(v.addKey(e),!0)})));break;case"put":var y=(new cr).addKeys(n.values.map((function(e){return l(e)})));r=e.filter((function(e){return!y.hasKey(t.values?l(e):e)})).concat(t.values?i:i.map((function(e){return l(e)})));break;case"delete":var m=(new cr).addKeys(n.keys);r=e.filter((function(e){return!m.hasKey(t.values?l(e):e)}));break;case"deleteRange":var b=n.range;r=e.filter((function(e){return!zr(l(e),b)}))}return r}),e);if(d===e)return e;var p=function(e,t){return jt(h(e),h(t))||jt(l(e),l(t))};return d.sort("prev"===t.direction||"prevunique"===t.direction?function(e,t){return p(t,e)}:p),t.limit&&t.limit<1/0&&(d.length>t.limit?d.length=t.limit:e.length===t.limit&&d.length<t.limit&&(i.dirty=!0)),o?Object.freeze(d):d}function Wr(e,t){return 0===jt(e.lower,t.lower)&&0===jt(e.upper,t.upper)&&!!e.lowerOpen==!!t.lowerOpen&&!!e.upperOpen==!!t.upperOpen}function Yr(e,t,n,r){if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;var i=jt(e,t);if(0===i){if(n&&r)return 0;if(n)return 1;if(r)return-1}return i}function Qr(e,t,n,r){if(void 0===e)return void 0!==t?1:0;if(void 0===t)return-1;var i=jt(e,t);if(0===i){if(n&&r)return 0;if(n)return-1;if(r)return 1}return i}function Gr(e,t){return Yr(e.lower,t.lower,e.lowerOpen,t.lowerOpen)<=0&&Qr(e.upper,t.upper,e.upperOpen,t.upperOpen)>=0}function Xr(e,t,n,r){var i,o=br["idb://".concat(e,"/").concat(t)];if(!o)return[];var a=o.queries[n];if(!a)return[null,!1,o,null];var u=a[(r.query?r.query.index.name:null)||""];if(!u)return[null,!1,o,null];switch(n){case"query":var s=null!==(i=r.direction)&&void 0!==i?i:"next",c=u.find((function(e){var t;return e.req.limit===r.limit&&e.req.values===r.values&&(null!==(t=e.req.direction)&&void 0!==t?t:"next")===s&&Wr(e.req.query.range,r.query.range)}));if(c)return[c,!0,o,u];var l=u.find((function(e){var t;return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(null!==(t=e.req.direction)&&void 0!==t?t:"next")===s&&(!r.values||e.req.values)&&Gr(e.req.query.range,r.query.range)}));return[l,!1,o,u];case"count":var f=u.find((function(e){return Wr(e.req.query.range,r.query.range)}));return[f,!!f,o,u]}}function Hr(e,t,n,r){e.subscribers.add(n),r.addEventListener("abort",(function(){e.subscribers.delete(n),0===e.subscribers.size&&Jr(e,t)}))}function Jr(e,t){setTimeout((function(){0===e.subscribers.size&&M(t,e)}),3e3)}var Zr={stack:"dbcore",level:0,name:"Cache",create:function(e){var t=e.schema.name,r=n(n({},e),{transaction:function(n,r,i){var o=e.transaction(n,r,i);if("readwrite"===r){var a=new AbortController,u=a.signal,s=function(i){return function(){if(a.abort(),"readwrite"===r){for(var u=new Set,s=0,c=n;s<c.length;s++){var l=c[s],f=br["idb://".concat(t,"/").concat(l)];if(f){var h=e.table(l),d=f.optimisticOps.filter((function(e){return e.trans===o}));if(o._explicit&&i&&o.mutatedParts)for(var p=0,v=Object.values(f.queries.query);p<v.length;p++)for(var y=0,m=(w=v[p]).slice();y<m.length;y++)mr((k=m[y]).obsSet,o.mutatedParts)&&(M(w,k),k.subscribers.forEach((function(e){return u.add(e)})));else if(d.length>0){f.optimisticOps=f.optimisticOps.filter((function(e){return e.trans!==o}));for(var b=0,g=Object.values(f.queries.query);b<g.length;b++)for(var w,_=0,x=(w=g[b]).slice();_<x.length;_++){var k;if(null!=(k=x[_]).res&&o.mutatedParts)if(i&&!k.dirty){var O=Object.isFrozen(k.res),P=Vr(k.res,k.req,d,h,k,O);k.dirty?(M(w,k),k.subscribers.forEach((function(e){return u.add(e)}))):P!==k.res&&(k.res=P,k.promise=qe.resolve({result:P}))}else k.dirty&&M(w,k),k.subscribers.forEach((function(e){return u.add(e)}))}}}}u.forEach((function(e){return e()}))}}};o.addEventListener("abort",s(!1),{signal:u}),o.addEventListener("error",s(!1),{signal:u}),o.addEventListener("complete",s(!0),{signal:u})}return o},table:function(r){var i=e.table(r),o=i.schema.primaryKey,a=n(n({},i),{mutate:function(e){var a=Ce.trans;if(o.outbound||"disabled"===a.db._options.cache||a.explicit||"readwrite"!==a.idbtrans.mode)return i.mutate(e);var u=br["idb://".concat(t,"/").concat(r)];if(!u)return i.mutate(e);var s=i.mutate(e);return"add"!==e.type&&"put"!==e.type||!(e.values.length>=50||Tr(o,e).some((function(e){return null==e})))?(u.optimisticOps.push(e),e.mutatedParts&&_r(e.mutatedParts),s.then((function(t){if(t.numFailures>0){M(u.optimisticOps,e);var n=Lr(u,e,t);n&&u.optimisticOps.push(n),e.mutatedParts&&_r(e.mutatedParts)}})),s.catch((function(){M(u.optimisticOps,e),e.mutatedParts&&_r(e.mutatedParts)}))):s.then((function(t){var r=n(n({},e),{values:e.values.map((function(e,r){var i;if(t.failures[r])return e;var a=(null===(i=o.keyPath)||void 0===i?void 0:i.includes("."))?D(e):n({},e);return P(a,o.keyPath,t.results[r]),a}))}),i=Lr(u,r,t);u.optimisticOps.push(i),queueMicrotask((function(){return e.mutatedParts&&_r(e.mutatedParts)}))})),s},query:function(e){var n;if(!Br(Ce,i)||!Fr("query",e))return i.query(e);var o="immutable"===(null===(n=Ce.trans)||void 0===n?void 0:n.db._options.cache),a=Ce,u=a.requery,s=a.signal,c=Xr(t,r,"query",e),l=c[0],f=c[1],h=c[2],d=c[3];if(l&&f)l.obsSet=e.obsSet;else{var p=i.query(e).then((function(e){var t=e.result;if(l&&(l.res=t),o){for(var n=0,r=t.length;n<r;++n)Object.freeze(t[n]);Object.freeze(t)}else e.result=D(t);return e})).catch((function(e){return d&&l&&M(d,l),Promise.reject(e)}));l={obsSet:e.obsSet,promise:p,subscribers:new Set,type:"query",req:e,dirty:!1},d?d.push(l):(d=[l],h||(h=br["idb://".concat(t,"/").concat(r)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}}),h.queries.query[e.query.index.name||""]=d)}return Hr(l,d,u,s),l.promise.then((function(t){return{result:Vr(t.result,e,null==h?void 0:h.optimisticOps,i,l,o)}}))}});return a}});return r}};function ei(e,t){return new Proxy(e,{get:function(e,n,r){return"db"===n?t:Reflect.get(e,n,r)}})}var ti,ni=function(){function e(t,r){var i=this;this._middlewares={},this.verno=0;var o=e.dependencies;this._options=r=n({addons:e.addons,autoOpen:!0,indexedDB:o.indexedDB,IDBKeyRange:o.IDBKeyRange,cache:"cloned",maxConnections:xt},r),this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};var a=r.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var u={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:re,dbReadyPromise:null,cancelOpen:re,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:r.autoOpen};u.dbReadyPromise=new qe((function(e){u.dbReadyResolve=e})),u.openCanceller=new qe((function(e,t){u.cancelOpen=t})),this._state=u,this.name=t,this.on=Nt(this,"populate","blocked","versionchange","close",{ready:[fe,re]}),this.once=function(e,t){var n=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];i.on(e).unsubscribe(n),t.apply(i,r)};return i.on(e,n)},this.on.ready.subscribe=w(this.on.ready.subscribe,(function(t){return function(n,r){e.vip((function(){var e=i._state;if(e.openComplete)e.dbOpenError||qe.resolve().then(n),r&&t(n);else if(e.onReadyBeingFired)e.onReadyBeingFired.push(n),r&&t(n);else{t(n);var o=i;r||t((function e(){o.on.ready.unsubscribe(n),o.on.ready.unsubscribe(e)}))}}))}})),this.Collection=Jt(this),this.Table=Lt(this),this.Transaction=bn(this),this.Version=Hn(this),this.WhereClause=fn(this),this.on("versionchange",(function(e){e.newVersion>0?console.warn("Another connection wants to upgrade database '".concat(i.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(i.name,"'. Closing db now to resume the delete request.")),i.close({disableAutoOpen:!1})})),this.on("blocked",(function(e){!e.newVersion||e.newVersion<e.oldVersion?console.warn("Dexie.delete('".concat(i.name,"') was blocked")):console.warn("Upgrade '".concat(i.name,"' blocked by other connection holding version ").concat(e.oldVersion/10))})),this._maxKey=kn(r.IDBKeyRange),this._createTransaction=function(e,t,n,r){return new i.Transaction(e,t,n,i._options.chromeTransactionDurability,r)},this._fireOnBlocked=function(e){i.on("blocked").fire(e),Zn.toArray().filter((function(e){return e.name===i.name&&e!==i&&!e._state.vcFired})).map((function(t){return t.on("versionchange").fire(e)}))},this.use(Rr),this.use(Zr),this.use(Nr),this.use(jr),this.use(Ir);var s=new Proxy(this,{get:function(e,t,n){if("_vip"===t)return!0;if("table"===t)return function(e){return ei(i.table(e),s)};var r=Reflect.get(e,t,n);return r instanceof Ft?ei(r,s):"tables"===t?r.map((function(e){return ei(e,s)})):"_createTransaction"===t?function(){return ei(r.apply(this,arguments),s)}:r}});this.vip=s,a.forEach((function(e){return e(i)}))}return e.prototype.version=function(e){if(isNaN(e)||e<.1)throw new Z.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new Z.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(qn),n.stores({}),this._state.autoSchema=!1,n)},e.prototype._whenReady=function(e){var t=this;return this.idbdb&&(this._state.openComplete||Ce.letThrough||this._vip)?e():new qe((function(e,n){if(t._state.openComplete)return n(new Z.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return void n(new Z.DatabaseClosed);t.open().catch(re)}t._state.dbReadyPromise.then(e,n)})).then(e)},e.prototype.use=function(e){var t=e.stack,n=e.create,r=e.level,i=e.name;i&&this.unuse({stack:t,name:i});var o=this._middlewares[t]||(this._middlewares[t]=[]);return o.push({stack:t,create:n,level:null==r?10:r,name:i}),o.sort((function(e,t){return e.level-t.level})),this},e.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},e.prototype.open=function(){var e=this;return ht(je,(function(){return Or(e)}))},e.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var e=this._state;if(Zn.remove(this),this.idbdb){try{this.idbdb.close()}catch(e){}this.idbdb=null}e.isBeingOpened||(e.dbReadyPromise=new qe((function(t){e.dbReadyResolve=t})),e.openCanceller=new qe((function(t,n){e.cancelOpen=n})))},e.prototype.close=function(e){var t=(void 0===e?{disableAutoOpen:!0}:e).disableAutoOpen,n=this._state;t?(n.isBeingOpened&&n.cancelOpen(new Z.DatabaseClosed),this._close(),n.autoOpen=!1,n.dbOpenError=new Z.DatabaseClosed):(this._close(),n.autoOpen=this._options.autoOpen||n.isBeingOpened,n.openComplete=!1,n.dbOpenError=null)},e.prototype.delete=function(e){var t=this;void 0===e&&(e={disableAutoOpen:!0});var n=arguments.length>0&&"object"!=typeof arguments[0],r=this._state;return new qe((function(i,o){var a=function(){t.close(e);var n=t._deps.indexedDB.deleteDatabase(t.name);n.onsuccess=He((function(){or(t._deps,t.name),i()})),n.onerror=hn(o),n.onblocked=t._fireOnBlocked};if(n)throw new Z.InvalidArgument("Invalid closeOptions argument to db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()}))},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return null!==this.idbdb},e.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name},e.prototype.hasFailed=function(){return null!==this._state.dbOpenError},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var e=this;return a(this._allTables).map((function(t){return e._allTables[t]}))},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var e=Er.apply(this,arguments);return this._transaction.apply(this,e)},e.prototype._transaction=function(e,t,n){var r=this,i=Ce.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){var t=e instanceof r.Table?e.name:e;if("string"!=typeof t)throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return t})),"r"==e||e===Ot)o=Ot;else{if("rw"!=e&&e!=Pt)throw new Z.InvalidArgument("Invalid transaction mode: "+e);o=Pt}if(i){if(i.mode===Ot&&o===Pt){if(!u)throw new Z.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 Z.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)})):vt(e)}var s=Sr.bind(null,this,o,a,i,n);return i?i._promise(o,s,"lock"):Ce.trans?ht(Ce.transless,(function(){return r._whenReady(s)})):this._whenReady(s)},e.prototype.table=function(e){if(!f(this._allTables,e))throw new Z.InvalidTable("Table ".concat(e," does not exist"));return this._allTables[e]},e}(),ri="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",ii=function(){function e(e){this._subscribe=e}return e.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},e.prototype[ri]=function(){return this},e}();try{ti={indexedDB:i.indexedDB||i.mozIndexedDB||i.webkitIndexedDB||i.msIndexedDB,IDBKeyRange:i.IDBKeyRange||i.webkitIDBKeyRange}}catch(e){ti={indexedDB:null,IDBKeyRange:null}}function oi(e){var t,n=!1,r=new ii((function(r){var i=U(e);function o(t){var n=ze();try{i&&ot();var r=it(e,t);return i&&(r=r.finally(at)),r}finally{n&&Ve()}}var a,u=!1,s={},c={},l={get closed(){return u},unsubscribe:function(){u||(u=!0,a&&a.abort(),f&&yn.storagemutated.unsubscribe(p))}};r.start&&r.start(l);var f=!1,h=function(){return pt(v)};function d(){return mr(c,s)}var p=function(e){yr(s,e),d()&&h()},v=function(){if(!u&&ti.indexedDB){s={};var i={};a&&a.abort(),a=new AbortController;var l={subscr:i,signal:a.signal,requery:h,querier:e,trans:null},v=o(l);f||(yn(pn,p),f=!0),Promise.resolve(v).then((function(e){n=!0,t=e,u||l.signal.aborted||(d()?h():(c=i,d()?h():(s={},pt((function(){return!u&&r.next&&r.next(e)})))))}),(function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||u||pt((function(){u||r.error&&r.error(e)}))}))}};return setTimeout(h,0),l}));return r.hasValue=function(){return n},r.getValue=function(){return t},r}var ai=ni;function ui(e){var t=ci;try{ci=!0,yn.storagemutated.fire(e),xr(e,!0)}finally{ci=t}}h(ai,n(n({},ne),{delete:function(e){return new ai(e,{addons:[]}).delete()},exists:function(e){return new ai(e,{addons:[]}).open().then((function(e){return e.close(),!0})).catch("NoSuchDatabaseError",(function(){return!1}))},getDatabaseNames:function(e){try{return rr(ai.dependencies).then(e)}catch(e){return vt(new Z.MissingAPI)}},defineClass:function(){function e(e){s(this,e)}return e},ignoreTransaction:function(e){return Ce.trans?ht(Ce.transless||je,e):e()},vip:ar,async:function(e){return function(){try{var t=Pr(e.apply(this,arguments));return t&&"function"==typeof t.then?t:qe.resolve(t)}catch(e){return vt(e)}}},spawn:function(e,t,n){try{var r=Pr(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:qe.resolve(r)}catch(e){return vt(e)}},currentTransaction:{get:function(){return Ce.trans||null}},waitFor:function(e,t){var n=qe.resolve("function"==typeof e?ai.ignoreTransaction(e):e).timeout(t||6e4);return Ce.trans?Ce.trans.waitFor(n):n},Promise:qe,debug:{get:function(){return he},set:function(e){de(e)}},derive:v,extend:s,props:h,override:w,Events:Nt,on:yn,liveQuery:oi,extendObservabilitySet:yr,getByKeyPath:O,setByKeyPath:P,delByKeyPath:E,shallowClone:S,deepClone:D,getObjectDiff:Cr,cmp:jt,asap:x,minKey:gt,addons:[],connections:{get:Zn.toArray},errnames:H,dependencies:ti,cache:br,semVer:mt,version:mt.split(".").map((function(e){return parseInt(e)})).reduce((function(e,t,n){return e+t/Math.pow(10,2*n)}))})),ai.maxKey=kn(ai.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(yn(pn,(function(e){var t;ci||(t=new CustomEvent(vn,{detail:e}),ci=!0,dispatchEvent(t),ci=!1)})),addEventListener(vn,(function(e){var t=e.detail;ci||ui(t)})));var si,ci=!1,li=function(){};function fi(e){return new Rt({add:e})}function hi(e){return new Rt({remove:e})}function di(e,t){return new Rt({replacePrefix:[e,t]})}"undefined"!=typeof BroadcastChannel&&((li=function(){(si=new BroadcastChannel(vn)).onmessage=function(e){return e.data&&ui(e.data)}})(),"function"==typeof si.unref&&si.unref(),yn(pn,(function(e){ci||si.postMessage(e)}))),"undefined"!=typeof addEventListener&&(addEventListener("pagehide",(function(e){if(!ni.disableBfCache&&e.persisted){he&&console.debug("Dexie: handling persisted pagehide"),null==si||si.close();for(var t=0,n=Zn.toArray();t<n.length;t++)n[t].close({disableAutoOpen:!1})}})),addEventListener("pageshow",(function(e){!ni.disableBfCache&&e.persisted&&(he&&console.debug("Dexie: handling persisted pageshow"),li(),ui({all:new cr(-1/0,[[]])}))}))),qe.rejectionMapper=te,de(he);var pi=Object.freeze({__proto__:null,DEFAULT_MAX_CONNECTIONS:xt,Dexie:ni,Entity:At,PropModification:Rt,RangeSet:cr,add:fi,cmp:jt,default:ni,liveQuery:oi,mergeRanges:fr,rangesOverlap:hr,remove:hi,replacePrefix:di});return n(ni,pi,{default:ni}),ni}();var s=a(u.exports);const c=Symbol.for("Dexie"),l=globalThis[c]||(globalThis[c]=s);if(s.semVer!==l.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${s.semVer} and ${l.semVer}`);const{liveQuery:f,mergeRanges:h,rangesOverlap:d,RangeSet:p,cmp:v,Entity:y,PropModification:m,replacePrefix:b,add:g,remove:w,DexieYProvider:_}=l;var x=function(e){function n(t,n,r){var i=e.call(this,t)||this,o={};return o["".concat(n)]=r||"id, createTime, updateTime",i.version(1).stores(o),i.store=i.table(n),i}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}(n,e),n}(l),k=function(){function e(e,t,n){void 0===e&&(e="store"),void 0===t&&(t="easy-store"),this.db=new x(t||"easy-store",e,n),this.tableName=e}return e.prototype.getTable=function(){return this.db.table(this.tableName)},e.prototype.generateId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.save=function(e){return r(this,void 0,void 0,(function(){var t,r,o,a,u,s;return i(this,(function(i){switch(i.label){case 0:return t=this.getTable(),r=new Date,o=n({},e),a=n(n({},o),{createTime:o.createTime||r,updateTime:r}),void 0===o.id||null===o.id?[3,3]:[4,t.put(a,o.id)];case 1:return i.sent(),[4,t.get(o.id)];case 2:return u=i.sent(),[3,6];case 3:return s=this.generateId(),a.id=s,[4,t.add(a,s)];case 4:return i.sent(),[4,t.get(s)];case 5:u=i.sent(),i.label=6;case 6:return[2,u]}}))}))},e.prototype.saveList=function(e){return r(this,void 0,void 0,(function(){var t,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:t=[],n=0,r=e,i.label=1;case 1:return n<r.length?(o=r[n],[4,this.save(o)]):[3,4];case 2:a=i.sent(),t.push(a),i.label=3;case 3:return n++,[3,1];case 4:return[2,t]}}))}))},e.prototype.getList=function(e){return r(this,void 0,void 0,(function(){var t,n,r=this;return i(this,(function(i){switch(i.label){case 0:return[4,this.getTable().toArray()];case 1:return t=i.sent(),(null==e?void 0:e.where)&&(n=e.where,t=t.filter((function(e){return r.matchesConditionSimple(e,n)}))),t.sort((function(e,t){var n,r,i=(null===(n=e.updateTime)||void 0===n?void 0:n.getTime())||0;return((null===(r=t.updateTime)||void 0===r?void 0:r.getTime())||0)-i})),(null==e?void 0:e.sort)&&(t=this.applySort(t,e.sort)),(null==e?void 0:e.fields)&&(t=t.map((function(t){return r.selectFields(t,e.fields)}))),[2,t]}}))}))},e.prototype.delete=function(e){return r(this,void 0,void 0,(function(){var t,n,r,o,a,u;return i(this,(function(i){switch(i.label){case 0:return[4,(t=this.getTable()).toArray()];case 1:for(n=i.sent(),r=[],o=0,a=n;o<a.length;o++)u=a[o],this.matchesConditionSimple(u,e)&&r.push(u.id);return r.length>0?[4,t.bulkDelete(r)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2,r.length]}}))}))},e.prototype.getInfo=function(e){return r(this,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return[4,this.getList({where:e})];case 1:return[2,(t=n.sent()).length>0?t[0]:null]}}))}))},e.prototype.update=function(e,t){return r(this,void 0,void 0,(function(){var r,o,a;return i(this,(function(i){switch(i.label){case 0:return r=this.getTable(),[4,this.getInfo(t)];case 1:return(o=i.sent())?(a=n(n(n({},o),e),{updateTime:new Date}),[4,r.put(a,o.id)]):[2,null];case 2:return i.sent(),[2,a]}}))}))},e.prototype.count=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getList({where:e})];case 1:return[2,t.sent().length]}}))}))},e.prototype.clear=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return[4,this.getTable().clear()];case 1:return e.sent(),[2]}}))}))},e.prototype.getPage=function(e){return r(this,void 0,void 0,(function(){var t,n,r,o,a,u,s;return i(this,(function(i){switch(i.label){case 0:return t=e.page||1,n=e.pageSize||10,[4,this.getList(e)];case 1:return r=i.sent(),o=r.length,a=Math.ceil(o/n),s=(u=(t-1)*n)+n,[2,{list:r.slice(u,s),total:o,page:t,size:n,totalPages:a}]}}))}))},e.prototype.applySort=function(e,t){return function(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)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0).sort((function(e,n){for(var r=0,i=Object.entries(t);r<i.length;r++){var o=i[r],a=o[0],u=o[1],s=e[a],c=n[a];if(s<c)return 1===u?-1:1;if(s>c)return 1===u?1:-1}return 0}))},e.prototype.selectFields=function(e,t){for(var n={},r=0,i=Object.keys(t);r<i.length;r++){var o=i[r];n[o]=e[o]}return void 0!==e.id&&(n.id=e.id),n},e.prototype.matchesCondition=function(e,t,n){var r=e[t];return void 0!==n.$ne?r!==n.$ne:void 0!==n.$gt?r>n.$gt:void 0!==n.$gte?r>=n.$gte:void 0!==n.$lt?r<n.$lt:void 0!==n.$lte?r<=n.$lte:void 0!==n.$in?n.$in.includes(r):void 0!==n.$nin?!n.$nin.includes(r):void 0!==n.$like?String(r).includes(n.$like):r===n},e.prototype.matchesConditionSimple=function(e,t){for(var n=0,r=Object.entries(t);n<r.length;n++){var i=r[n],o=i[0],a=i[1];if(void 0!==a)if("object"==typeof a&&null!==a){if(!this.matchesCondition(e,o,a))return!1}else if(e[o]!==a)return!1}return!0},e.prototype.close=function(){this.db.close()},e}();e.EasyDexieDatabase=x,e.EasyDexieStore=k}({});
|