Plugin Directory

Changeset 3036551


Ignore:
Timestamp:
02/15/2024 08:36:55 PM (22 months ago)
Author:
PerS
Message:

Update to version 1.6.7 from GitHub

Location:
super-admin-all-sites-menu
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • super-admin-all-sites-menu/tags/1.6.7/build/index.asset.php

    r2986044 r3036551  
    1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => 'c2bbf763c2a9972c5535');
     1<?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '83258dff0f23c505ee1c');
  • super-admin-all-sites-menu/tags/1.6.7/build/index.js

    r2986044 r3036551  
    11/*!
    22 * super-admin-all-sites-menu
    3  * version: 1.6.6
     3 * version: 1.6.7
    44 * address: https://github.com/soderlind/super-admin-all-sites-menu#readme
    55 * author:  Per Søderlind
    66 * license: GPLv2
    7  */!function(){"use strict";var e={};e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},e.d=function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,n=Object.keys,r=Array.isArray;function s(e,t){return"object"!=typeof t||n(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||t.Promise||(t.Promise=Promise);const i=Object.getPrototypeOf,o={}.hasOwnProperty;function a(e,t){return o.call(e,t)}function l(e,t){"function"==typeof t&&(t=t(i(e))),("undefined"==typeof Reflect?n:Reflect.ownKeys)(t).forEach((n=>{c(e,n,t[n])}))}const u=Object.defineProperty;function c(e,t,n,r){u(e,t,s(n&&a(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),c(e.prototype,"constructor",e),{extend:l.bind(null,e.prototype)}}}}const d=Object.getOwnPropertyDescriptor;function f(e,t){let n;return d(e,t)||(n=i(e))&&f(n,t)}const p=[].slice;function y(e,t,n){return p.call(e,t,n)}function m(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function v(e){t.setImmediate?setImmediate(e):setTimeout(e,0)}function g(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function w(e,t){if(a(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,s=t.length;r<s;++r){var i=w(e,t[r]);n.push(i)}return n}var o=t.indexOf(".");if(-1!==o){var l=e[t.substr(0,o)];return void 0===l?void 0:w(l,t.substr(o+1))}}function _(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var s=0,i=t.length;s<i;++s)_(e,t[s],n[s])}else{var o=t.indexOf(".");if(-1!==o){var l=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===n?r(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=n;else{var c=e[l];c&&a(e,l)||(c=e[l]={}),_(c,u,n)}}else void 0===n?r(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)a(e,n)&&(t[n]=e[n]);return t}const k=[].concat;function E(e){return k.apply([],e)}const P="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(E([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>t[e])),S=P.map((e=>t[e]));g(P,(e=>[e,!0]));let K=null;function O(e){K="undefined"!=typeof WeakMap&&new WeakMap;const t=C(e);return K=null,t}function C(e){if(!e||"object"!=typeof e)return e;let t=K&&K.get(e);if(t)return t;if(r(e)){t=[],K&&K.set(e,t);for(var n=0,s=e.length;n<s;++n)t.push(C(e[n]))}else if(S.indexOf(e.constructor)>=0)t=e;else{const n=i(e);for(var o in t=n===Object.prototype?{}:Object.create(n),K&&K.set(e,t),e)a(e,o)&&(t[o]=C(e[o]))}return t}const{toString:A}={};function j(e){return A.call(e).slice(8,-1)}const B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof B?function(e){var t;return null!=e&&(t=e[B])&&t.apply(e)}:function(){return null},I={};function T(e){var t,n,s,i;if(1===arguments.length){if(r(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=D(e)){for(n=[];!(s=i.next()).done;)n.push(s.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}const R="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var M="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function N(e,t){M=e,F=t}var F=()=>!0;const q=!new Error("").stack;function $(){if(q)try{throw $.arguments,new Error}catch(e){return e}return new Error}function L(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(F).map((e=>"\n"+e)).join("")):""}var U=["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(U),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._e=$(),this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function H(e,t,n,r){this._e=$(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function G(e,t){this._e=$(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=z(e,t)}h(Y).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(H).from(Y),h(G).from(Y);var Q=V.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const X=Y;var J=V.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=$(),this.name=n,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=W[t]||n,this.inner=null)}return h(r).from(X),e[t]=r,e}),{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var Z=U.reduce(((e,t)=>(e[t+"Error"]=J[t],e)),{}),ee=V.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e)),{});function te(){}function ne(e){return e}function re(e,t){return null==e||e===ne?t:function(n){return t(e(n))}}function se(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ie(e,t){return e===te?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?se(r,this.onsuccess):r),s&&(this.onerror=this.onerror?se(s,this.onerror):s),void 0!==i?i:n}}function oe(e,t){return e===te?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?se(n,this.onsuccess):n),r&&(this.onerror=this.onerror?se(r,this.onerror):r)}}function ae(e,t){return e===te?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?se(i,this.onsuccess):i),o&&(this.onerror=this.onerror?se(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===te?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(e,t){return e===te?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}ee.ModifyError=H,ee.DexieError=Y,ee.BulkError=G;var ce={};const he=100,[de,fe,pe]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,i(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,i(t),e]})(),ye=fe&&fe.then,me=de&&de.constructor,be=!!pe;var ve=!1,ge=pe?()=>{pe.then(Le)}:t.setImmediate?setImmediate.bind(null,Le):t.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Le(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Le,0)},we=function(e,t){Ce.push([e,t]),xe&&(ge(),xe=!1)},_e=!0,xe=!0,ke=[],Ee=[],Pe=null,Se=ne,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ft,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{ft(e[0],e[1])}catch(e){}}))}},Oe=Ke,Ce=[],Ae=0,je=[];function Be(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=te,this._lib=!1;var t=this._PSD=Oe;if(M&&(this._stackHolder=$(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ce)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Te(this,e)}const De={get:function(){var e=Oe,t=Je;function n(n,r){var s=!e.global&&(e!==Oe||t!==Je);const i=s&&!nt();var o=new Be(((t,o)=>{Ne(this,new Ie(ct(n,e,s,i),ct(r,e,s,i),t,o,e))}));return M&&$e(o,this),o}return n.prototype=ce,n},set:function(e){c(this,"then",e&&e.prototype===ce?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,s){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=s}function Te(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Te(e,((e,n)=>{t instanceof Be?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(Ee.push(t),null===e._state){var n=e._lib&&Ue();t=Se(t),e._state=!1,e._value=t,M&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=f(t,"stack");t._promise=e,c(t,"stack",{get:()=>ve?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ke.some((t=>t._value===e._value))||ke.push(e)}(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Ne(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Ae&&(++Ae,we((()=>{0==--Ae&&We()}),[]))}function Ne(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,++Ae,we(Fe,[n,e,t])}else e._listeners.push(t)}function Fe(e,t,n){try{Pe=t;var r,s=t._value;t._state?r=e(s):(Ee.length&&(Ee=[]),r=e(s),-1===Ee.indexOf(s)&&function(e){for(var t=ke.length;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Pe=null,0==--Ae&&We(),--n.psd.ref||n.psd.finalize()}}function qe(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var s,i,o=e._value;null!=o?(s=o.name||"Error",i=o.message||o,r=L(o,0)):(s=o,i=""),t.push(s+(i?": "+i:"")+r)}return M&&((r=L(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&qe(e._prev,t,n)),t}function $e(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Le(){Ue()&&Ve()}function Ue(){var e=_e;return _e=!1,xe=!1,e}function Ve(){var e,t,n;do{for(;Ce.length>0;)for(e=Ce,Ce=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ce.length>0);_e=!0,xe=!0}function We(){var e=ke;ke=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=je.slice(0),n=t.length;n;)t[--n]()}function Ye(e){return new Be(ce,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),s=Oe;try{return ot(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{ot(s,!1),r&&Ve()}}}l(Be.prototype,{then:De,_then:function(e,t){Ne(this,new Ie(null,null,e,t,Oe))},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,(e=>e instanceof t?n(e):Ye(e))):this.then(null,(e=>e&&e.name===t?n(e):Ye(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Ye(t))))},stack:{get:function(){if(this._stack)return this._stack;try{ve=!0;var e=qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ve=!1}}},timeout:function(e,t){return e<1/0?new Be(((n,r)=>{var s=setTimeout((()=>r(new J.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=at(),l(Be,{all:function(){var e=T.apply(null,arguments).map(rt);return new Be((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Be.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Be)return e;if(e&&"function"==typeof e.then)return new Be(((t,n)=>{e.then(t,n)}));var t=new Be(ce,!0,e);return $e(t,Pe),t},reject:Ye,race:function(){var e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{e.map((e=>Be.resolve(e).then(t,n)))}))},PSD:{get:()=>Oe,set:e=>Oe=e},totalEchoes:{get:()=>Je},newPSD:et,usePSD:lt,scheduler:{get:()=>we,set:e=>{we=e}},rejectionMapper:{get:()=>Se,set:e=>{Se=e}},follow:(e,t)=>new Be(((n,r)=>et(((t,n)=>{var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=se((function(){!function(e){je.push((function t(){e(),je.splice(je.indexOf(t),1)})),++Ae,we((()=>{0==--Ae&&We()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),me&&(me.allSettled&&c(Be,"allSettled",(function(){const e=T.apply(null,arguments).map(rt);return new Be((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Be.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),me.any&&"undefined"!=typeof AggregateError&&c(Be,"any",(function(){const e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Be.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const He={awaits:0,echoes:0,id:0};var Ge=0,Qe=[],Xe=0,Je=0,Ze=0;function et(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ze;var a=Ke.env;o.env=be?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject,nthen:ht(a.nthen,o),gthen:ht(a.gthen,o)}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=lt(o,e,n,r);return 0===o.ref&&o.finalize(),l}function tt(){return He.id||(He.id=++Ge),++He.awaits,He.echoes+=he,He.id}function nt(){return!!He.awaits&&(0==--He.awaits&&(He.id=0),He.echoes=He.awaits*he,!0)}function rt(e){return He.echoes&&e&&e.constructor===me?(tt(),e.then((e=>(nt(),e)),(e=>(nt(),pt(e))))):e}function st(e){++Je,He.echoes&&0!=--He.echoes||(He.echoes=He.id=0),Qe.push(Oe),ot(e,!0)}function it(){var e=Qe[Qe.length-1];Qe.pop(),ot(e,!1)}function ot(e,n){var r=Oe;if((n?!He.echoes||Xe++&&e===Oe:!Xe||--Xe&&e===Oe)||ut(n?st.bind(null,e):it),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=at()),be)){var s=Ke.env.Promise,i=e.env;fe.then=i.nthen,s.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(t,"Promise",i.PromiseProp),s.all=i.all,s.race=i.race,s.resolve=i.resolve,s.reject=i.reject,i.allSettled&&(s.allSettled=i.allSettled),i.any&&(s.any=i.any))}}function at(){var e=t.Promise;return be?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function lt(e,t,n,r,s){var i=Oe;try{return ot(e,!0),t(n,r,s)}finally{ot(i,!1)}}function ut(e){ye.call(de,e)}function ct(e,t,n,r){return"function"!=typeof e?e:function(){var s=Oe;n&&tt(),ot(t,!0);try{return e.apply(this,arguments)}finally{ot(s,!1),r&&ut(nt)}}}function ht(e,t){return function(n,r){return e.call(this,ct(n,t),ct(r,t))}}-1===(""+ye).indexOf("[native code]")&&(tt=nt=te);const dt="unhandledrejection";function ft(e,n){var r;try{r=n.onuncatched(e)}catch(e){}if(!1!==r)try{var i,o={promise:n,reason:e};if(t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(dt,!0,!0),s(i,o)):t.CustomEvent&&s(i=new CustomEvent(dt,{detail:o}),o),i&&t.dispatchEvent&&(dispatchEvent(i),!t.PromiseRejectionEvent&&t.onunhandledrejection))try{t.onunhandledrejection(i)}catch(e){}M&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var pt=Be.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Oe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>yt(e,t,n,r)))):pt(s)}return s._promise(t,((e,t)=>et((()=>(Oe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return pt(new J.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return pt(new J.DatabaseClosed);e.open().catch(te)}return e._state.dbReadyPromise.then((()=>yt(e,t,n,r)))}const mt="3.2.4",bt=String.fromCharCode(65535),vt=-1/0,gt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wt="String expected.",_t=[],xt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),kt=xt,Et=xt,Pt=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),St="__dbnames",Kt="readonly",Ot="readwrite";function Ct(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const At={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jt(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=O(t))[e],t)}class Bt{_trans(e,t,n){const r=this._tx||Oe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new J.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const o=Ue();try{return r&&r.db===this.db?r===Oe.trans?r._promise(e,i,n):et((()=>r._promise(e,i,n)),{trans:r,transless:Oe.transless||Oe}):yt(this.db,e,[this.name],i)}finally{o&&Ve()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(r(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=n(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const s=this.schema.indexes.concat(this.schema.primKey).filter((e=>e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))&&e.keyPath.every((e=>t.indexOf(e)>=0))))[0];if(s&&this.db._maxKey!==bt)return this.where(s.name).equals(s.keyPath.map((t=>e[t])));!s&&M&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[l,u]=t.reduce((([t,n],s)=>{const o=i[s],l=e[s];return[t||o,t||!o?Ct(n,o&&o.multi?e=>{const t=w(e,s);return r(t)&&t.some((e=>a(l,e)))}:e=>a(l,w(e,s))):n]}),[null,null]);return l?this.where(l.name).equals(e[l.keyPath]).filter(u):s?this.filter(u):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,r(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(a(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){s(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||r(e))return this.where(":id").equals(e).modify(t);{const r=w(e,this.schema.primKey.keyPath);if(void 0===r)return pt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?n(t).forEach((n=>{_(e,n,t[n])})):t(e,{value:e,primKey:r})}catch(e){}return this.where(":id").equals(r).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:At}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function Dt(e){var t={},s=function(n,r){if(r){for(var s=arguments.length,i=new Array(s-1);--s;)i[s-1]=arguments[s];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};s.addEventType=a;for(var i=1,o=arguments.length;i<o;++i)a(arguments[i]);return s;function a(e,i,o){if("object"!=typeof e){var l;i||(i=le),o||(o=te);var u={subscribers:[],fire:o,subscribe:function(e){-1===u.subscribers.indexOf(e)&&(u.subscribers.push(e),u.fire=i(u.fire,e))},unsubscribe:function(e){u.subscribers=u.subscribers.filter((function(t){return t!==e})),u.fire=u.subscribers.reduce(i,o)}};return t[e]=s[e]=u,u}n(l=e).forEach((function(e){var t=l[e];if(r(t))a(e,l[e][0],l[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=a(e,ne,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){v((function(){e.apply(null,t)}))}))}))}}))}}function It(e,t){return h(t).from({prototype:e}),t}function Tt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Rt(e,t){e.filter=Ct(e.filter,t)}function Mt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>Ct(r(),t()):t,e.justLimit=n&&!r}function Nt(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Ft(e,t,n){const r=Nt(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){const s=e.replayFilter?Ct(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},o=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var o=n.primaryKey,l=""+o;"[object ArrayBuffer]"===l&&(l=""+new Uint8Array(o)),a(i,l)||(i[l]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),$t(Ft(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return $t(Ft(e,r,n),Ct(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function $t(e,t,n,r){var s=ze(r?(e,t,s)=>n(r(e),t,s):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=te}),(t=>{e.fail(t),n=te}))||s(e.value,e,(e=>n=e)),n()}))}))}function Lt(e,t){try{const n=Ut(e),r=Ut(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 function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(Vt(e),Vt(t));case"Array":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n){const r=Lt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ut(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=j(e);return"ArrayBuffer"===n?"binary":n}function Vt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Wt{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,pt.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,pt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=Ct(t.algorithm,e)}_iterate(e,t){return qt(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>qt(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(Tt(t,!0))return n.count({trans:e,query:{index:Nt(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return qt(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],s=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,s),r=i(t,s);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Nt(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return qt(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,Tt(t)?Mt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Mt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Mt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Rt(this._ctx,(function(n,r,s){return!e(n.value)||(r(s),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return Rt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=Ct(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(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)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0)return this._read((e=>{var n=Nt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Rt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=a(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((r=>{var s;if("function"==typeof e)s=e;else{var i=n(e),o=i.length;s=function(t){for(var n=!1,r=0;r<o;++r){var s=i[r],a=e[s];w(t,s)!==a&&(_(t,s,a),n=!0)}return n}}const a=t.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,h=[];let d=0;const f=[],p=(e,t)=>{const{failures:r,numFailures:s}=t;d+=e-s;for(let e of n(r))h.push(r[e])};return this.clone().primaryKeys().then((n=>{const i=o=>{const h=Math.min(c,n.length-o);return a.getMany({trans:r,keys:n.slice(o,o+h),cache:"immutable"}).then((d=>{const f=[],y=[],m=l?[]:null,b=[];for(let e=0;e<h;++e){const t=d[e],r={value:O(t),primKey:n[o+e]};!1!==s.call(r,r.value,r)&&(null==r.value?b.push(n[o+e]):l||0===Lt(u(t),u(r.value))?(y.push(r.value),l&&m.push(n[o+e])):(b.push(n[o+e]),f.push(r.value)))}const v=Tt(t)&&t.limit===1/0&&("function"!=typeof e||e===Yt)&&{index:t.index,range:t.range};return Promise.resolve(f.length>0&&a.mutate({trans:r,type:"add",values:f}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(f.length,e)}))).then((()=>(y.length>0||v&&"object"==typeof e)&&a.mutate({trans:r,type:"put",keys:m,values:y,criteria:v,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(b.length>0||v&&e===Yt)&&a.mutate({trans:r,type:"delete",keys:b,criteria:v}).then((e=>p(b.length,e))))).then((()=>n.length>o+h&&i(o+c)))}))};return i(0).then((()=>{if(h.length>0)throw new H("Error modifying one or more objects",h,d,f);return n.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Tt(e)&&(e.isPrimKey&&!Et||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,s=t;return e.table.core.count({trans:n,query:{index:r,range:s}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then((({failures:e,lastResult:n,results:r,numFailures:s})=>{if(s)throw new H("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(Yt)}}const Yt=(e,t)=>t.value=null;function zt(e,t){return e<t?-1:e===t?0:1}function Ht(e,t){return e>t?-1:e===t?0:1}function Gt(e,t,n){var r=e instanceof tn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Qt(e){return new e.Collection(e,(()=>en(""))).limit(0)}function Xt(e,t,n,r,s,i){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return s(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):s(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;s(e[l],u)<0&&(a=l)}return o<r.length&&"next"===i?e+n.substr(e.length):o<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Jt(e,t,n,r){var s,i,o,a,l,u,c,h=n.length;if(!n.every((e=>"string"==typeof e)))return Gt(e,wt);function d(e){s=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),o="next"===e?zt:Ht;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return o(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),l=t.map((function(e){return e.lower})),u=e,c="next"===e?"":r}d("next");var f=new e.Collection(e,(()=>Zt(a[0],l[h-1]+r)));f._ondirectionchange=function(e){d(e)};var p=0;return f._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var d=i(s);if(t(d,l,p))return!0;for(var f=null,y=p;y<h;++y){var m=Xt(s,d,a[y],l[y],o,u);null===m&&null===f?p=y+1:(null===f||o(f,m)>0)&&(f=m)}return n(null!==f?function(){e.continue(f+c)}:r),!1})),f}function Zt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function en(e){return{type:1,lower:e,upper:e}}class tn{get Collection(){return this._ctx.table.db.Collection}between(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)?Qt(this):new this.Collection(this,(()=>Zt(e,t,!n,!r)))}catch(e){return Gt(this,gt)}}equals(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>en(e)))}above(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(e,void 0,!0)))}aboveOrEqual(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(e,void 0,!1)))}below(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(void 0,e)))}startsWith(e){return"string"!=typeof e?Gt(this,wt):this.between(e,e+bt,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):Jt(this,((e,t)=>0===e.indexOf(t[0])),[e],bt)}equalsIgnoreCase(e){return Jt(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,bt)}anyOf(){const e=T.apply(I,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Gt(this,gt)}if(0===e.length)return Qt(this);const n=new this.Collection(this,(()=>Zt(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,s,i)=>{const o=n.key;for(;t(o,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(o,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[vt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=T.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Gt(this,gt)}const t=e.reduce(((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[vt,t]]),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,s=this._descending,i=this._min,o=this._max;if(0===e.length)return Qt(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Gt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);const a=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers;let u,c=r;function h(e,t){return c(e[0],t[0])}try{u=e.reduce((function(e,t){let r=0,s=e.length;for(;r<s;++r){const s=e[r];if(n(t[0],s[1])<0&&n(t[1],s[0])>0){s[0]=i(s[0],t[0]),s[1]=o(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),u.sort(h)}catch(e){return Gt(this,gt)}let d=0;const f=l?e=>r(e,u[d][1])>0:e=>r(e,u[d][1])>=0,p=a?e=>s(e,u[d][0])>0:e=>s(e,u[d][0])>=0;let y=f;const m=new this.Collection(this,(()=>Zt(u[0][0],u[u.length-1][1],!a,!l)));return m._ondirectionchange=e=>{"next"===e?(y=f,c=r):(y=p,c=s),u.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++d,d===u.length)return t(n),!1;return!!function(e){return!f(e)&&!p(e)}(s)||(0===this._cmp(s,u[d][1])||0===this._cmp(s,u[d][0])||t((()=>{c===r?e.continue(u[d][0]):e.continue(u[d][1])})),!1)})),m}startsWithAnyOf(){const e=T.apply(I,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Qt(this):this.inAnyRange(e.map((e=>[e,e+bt]))):Gt(this,"startsWithAnyOf() only works with strings")}}function nn(e){return ze((function(t){return rn(t),e(t.target.error),!1}))}function rn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const sn="storagemutated",on="x-storagemutated-1",an=Dt(null,sn);class ln{_lock(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this}_unlock(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Oe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new J.DatabaseClosed(n);case"MissingAPIError":throw new J.MissingAPI(n.message,n);default:throw new J.OpenFailed(n)}if(!this.active)throw new J.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ze((t=>{rn(t),this._reject(e.error)})),e.onabort=ze((t=>{rn(t),this.active&&this._reject(new J.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=ze((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&an.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return pt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return pt(new J.TransactionInactive);if(this._locked())return new Be(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Oe])}));if(n)return et((()=>{var e=new Be(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new Be(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=Be.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>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 s=t._waitingFor;return new Be(((e,r)=>{n.then((n=>t._waitingQueue.push(ze(e.bind(null,n)))),(e=>t._waitingQueue.push(ze(r.bind(null,e))))).finally((()=>{t._waitingFor===s&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(a(t,e))return t[e];const n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function un(e,t,n,r,s,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+cn(t)}}function cn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function hn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:g(n,(e=>[e.name,e]))}}let dn=e=>{try{return e.only([[]]),dn=()=>[[]],[[]]}catch(e){return dn=()=>bt,bt}};function fn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>w(t,e)}(e):t=>w(t,e)}function pn(e){return[].slice.call(e)}let yn=0;function mn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function bn(e,t,n){function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:s,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!s):t.bound(n,r,!!s,!!i)}const{schema:i,hasGetAll:o}=function(e,t){const n=pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,s=r(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:s,keyPath:t,autoIncrement:n,unique:!0,extractKey:fn(t)},indexes:pn(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:s,keyPath:i}=e,a={name:t,compound:r(i),keyPath:i,unique:n,multiEntry:s,extractKey:fn(i)};return o[mn(i)]=a,a})),getIndexByKeyPath:e=>o[mn(e)]};return o[":id"]=a.primaryKey,null!=t&&(o[mn(t)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,n),a=i.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:r,values:i,range:o}){return new Promise(((a,l)=>{a=ze(a);const u=e.objectStore(t),c=null==u.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:d}=r||i||{length:1};if(r&&i&&r.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let f;const p=[],y=[];let m=0;const b=e=>{++m,rn(e)};if("deleteRange"===n){if(4===o.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===o.type?p.push(f=u.clear()):p.push(f=u.delete(s(o)))}else{const[e,t]=h?c?[i,r]:[i,null]:[r,null];if(h)for(let r=0;r<d;++r)p.push(f=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),f.onerror=b;else for(let t=0;t<d;++t)p.push(f=u[n](e[t])),f.onerror=b}const v=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?r:p.map((e=>e.result)),lastResult:t})};f.onerror=e=>{b(e),v(e)},f.onsuccess=v}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t),o=n.length,a=new Array(o);let l,u=0,c=0;const h=e=>{const t=e.target;a[t._pos]=t.result,++c===u&&r(a)},d=nn(s);for(let e=0;e<o;++e)null!=n[e]&&(l=i.get(n[e]),l._pos=e,l.onsuccess=h,l.onerror=d,++u);0===u&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=nn(s)})),query:function(e){return n=>new Promise(((r,i)=>{r=ze(r);const{trans:o,values:a,limit:l,query:u}=n,c=l===1/0?void 0:l,{index:h,range:d}=u,f=o.objectStore(t),p=h.isPrimaryKey?f:f.index(h.name),y=s(d);if(0===l)return r({result:[]});if(e){const e=a?p.getAll(y,c):p.getAllKeys(y,c);e.onsuccess=e=>r({result:e.target.result}),e.onerror=nn(i)}else{let e=0;const t=a||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=s=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===l?r({result:n}):void i.continue()):r({result:n})},t.onerror=nn(i)}}))}(o),openCursor:function({trans:e,values:n,query:r,reverse:i,unique:o}){return new Promise(((a,l)=>{a=ze(a);const{index:u,range:c}=r,h=e.objectStore(t),d=u.isPrimaryKey?h:h.index(u.name),f=i?o?"prevunique":"prev":o?"nextunique":"next",p=n||!("openKeyCursor"in d)?d.openCursor(s(c),f):d.openKeyCursor(s(c),f);p.onerror=nn(l),p.onsuccess=ze((t=>{const n=p.result;if(!n)return void a(null);n.___id=++yn,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),o=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=ze(l),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=ze(e),p.onerror=nn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=o,e(t)}})),a=()=>{if(p.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return p.onsuccess=ze((e=>{p.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,a(),t},a(n)}),l)}))},count({query:e,trans:n}){const{index:r,range:i}=e;return new Promise(((e,o)=>{const a=n.objectStore(t),l=r.isPrimaryKey?a:a.index(r.name),u=s(i),c=u?l.count(u):l.count();c.onsuccess=ze((t=>e(t.target.result))),c.onerror=nn(o)}))}}}(e))),l={};return a.forEach((e=>l[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw new Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:dn(t),schema:i}}function vn({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},s){const i=function(e,t){return t.reduce(((e,{create:t})=>({...e,...t(e)})),e)}(bn(t,n,s),e.dbcore);return{dbcore:i}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function gn({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=f(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?c(t,n,{get(){return this.table(n)},set(e){u(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function wn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function _n(e,t){return e._cfg.version-t._cfg.version}function xn(e,t,r,s){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(s);const a=o._reject.bind(o),l=Oe.transless||Oe;et((()=>{Oe.trans=o,Oe.transless=l,0===t?(n(i).forEach((e=>{En(r,e,i[e].primKey,i[e].indexes)})),vn(e,r),Be.follow((()=>e.on.populate.fire(o))).catch(a)):function({_novip:e},t,r,s){const i=[],o=e._versions;let a=e._dbSchema=Sn(e,e.idbdb,s),l=!1;const u=o.filter((e=>e._cfg.version>=t));return u.forEach((o=>{i.push((()=>{const i=a,u=o._cfg.dbschema;Kn(e,i,s),Kn(e,u,s),a=e._dbSchema=u;const c=kn(i,u);c.add.forEach((e=>{En(s,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");{const t=s.objectStore(e.name);e.add.forEach((e=>Pn(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Pn(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const h=o._cfg.contentUpgrade;if(h&&o._cfg.version>t){vn(e,s),r._memoizedTables={},l=!0;let t=x(u);c.del.forEach((e=>{t[e]=i[e]})),wn(e,[e.Transaction.prototype]),gn(e,[e.Transaction.prototype],n(t),t),r.schema=t;const o=R(h);let a;o&&tt();const d=Be.follow((()=>{if(a=h(r),a&&o){var e=nt.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Be.resolve(a):d.then((()=>a))}})),i.push((t=>{l&&kt||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(o._cfg.dbschema,t),wn(e,[e.Transaction.prototype]),gn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),r.schema=e._dbSchema}))})),function e(){return i.length?Be.resolve(i.shift()(r.idbtrans)).then(e):Be.resolve()}().then((()=>{var e,t;t=s,n(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||En(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,o,r).catch(a)}))}function kn(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const s=e[r],i=t[r];if(s){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!xt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let o;for(o in t)r[o]||e.del.push(o);for(o in r){const n=t[o],s=r[o];n?n.src!==s.src&&e.change.push(s):e.add.push(s)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function En(e,t,n,r){const s=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Pn(s,e))),s}function Pn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sn(e,t,n){const r={};return y(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=un(cn(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var a=un(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(a)}r[e]=hn(e,i,o)})),r}function Kn({_novip:e},n,r){const s=r.db.objectStoreNames;for(let t=0;t<s.length;++t){const i=s[t],o=r.objectStore(i);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){const t=o.indexNames[e],r=o.index(t).keyPath,s="string"==typeof r?r:"["+y(r).join("+")+"]";if(n[i]){const e=n[i].idxByName[s];e&&(e.name=t,delete n[i].idxByName[s],n[i].idxByName[t]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class On{_parseStoresSpec(e,t){n(e).forEach((n=>{if(null!==e[n]){var s=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),s=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return un(n,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),r(s),0===t)})),i=s.shift();if(i.multi)throw new J.Schema("Primary key cannot be multi-valued");s.forEach((e=>{if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")})),t[n]=hn(n,i,s)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;const r=t._versions,i={};let o={};return r.forEach((e=>{s(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)})),t._dbSchema=o,wn(t,[t._allTables,t,t.Transaction.prototype]),gn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],n(o),o),t._storeNames=n(o),this}upgrade(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||te,e),this}}function Cn(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qn(St,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function An(e){return e&&"function"==typeof e.databases}function jn(e){return et((function(){return Oe.letThrough=!0,e()}))}function Bn(){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 Dn(e){var t=t=>e.next(t),n=i(t),s=i((t=>e.throw(t)));function i(e){return t=>{var i=e(t),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,s):r(o)?Promise.all(o).then(n,s):n(o)}}return i(t)()}function In(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[e,E(s),n]}function Tn(e,t,n,r,s){return Be.resolve().then((()=>{const i=Oe.transless||Oe,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Tn(e,t,n,null,s)))):pt(r)}const l=R(s);let u;l&&tt();const c=Be.follow((()=>{if(u=s.call(o,o),u)if(l){var e=nt.bind(null,null);u.then(e,e)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Dn(u))}),a);return(u&&"function"==typeof u.then?Be.resolve(u).then((e=>o.active?e:pt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):c.then((()=>u))).then((e=>(r&&o._resolve(),o._completion.then((()=>e))))).catch((e=>(o._reject(e),pt(e))))}))}function Rn(e,t,n){const s=r(e)?e.slice():[e];for(let e=0;e<n;++e)s.push(t);return s}const Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function o(e,t,n){const r=mn(e),a=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,u=t>0,c={...n,isVirtual:u,keyTail:t,keyLength:l,extractKey:fn(e),unique:!u&&n.unique};return a.push(c),c.isPrimaryKey||i.push(c),l>1&&o(2===l?e[0]:e.slice(0,l-1),t+1,n),a.sort(((e,t)=>e.keyTail-t.keyTail)),c}const a=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[a];for(const e of r.indexes)o(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?{...t,query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const u={...n,schema:{...r,primaryKey:a,indexes:i,getIndexByKeyPath:function(e){const t=s[mn(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;return s?n.openCursor(l(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Rn(s,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,s){n.continuePrimaryKey(Rn(t,e.MAX_KEY,r),s)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return s}(n))):n.openCursor(t)}};return u}}}};function Nn(e,t,r,s){return r=r||{},s=s||"",n(e).forEach((n=>{if(a(t,n)){var i=e[n],o=t[n];if("object"==typeof i&&"object"==typeof o&&i&&o){const e=j(i);e!==j(o)?r[s+n]=t[n]:"Object"===e?Nn(i,o,r,s+n+"."):i!==o&&(r[s+n]=t[n])}else i!==o&&(r[s+n]=t[n])}else r[s+n]=void 0})),n(t).forEach((n=>{a(e,n)||(r[s+n]=t[n])})),r}const Fn={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema,s={...n,mutate(e){const s=Oe.trans,{deleting:i,creating:o,updating:l}=s.table(t).hook;switch(e.type){case"add":if(o.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(o.fire===te&&l.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===te)break;return s._promise("readwrite",(()=>function(e){return c(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function u(e){const t=Oe.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:s}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((u=>{const c=s.map(((n,s)=>{const c=u[s],h={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(h,n,c,t);else if("add"===e.type||void 0===c){const i=o.fire.call(h,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||_(e.values[s],r.keyPath,n))}else{const r=Nn(c,e.values[s]),i=l.fire.call(h,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{a(t,e)?t[e]=i[e]:_(t,e,i[e])}))}}return h}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:i})=>{for(let r=0;r<s.length;++r){const i=n?n[r]:s[r],o=c[r];null==i?o.onerror&&o.onerror(t[r]):o.onsuccess&&o.onsuccess("put"===e.type&&u[r]?e.values[r]:i)}return{failures:t,results:n,numFailures:r,lastResult:i}})).catch((e=>(c.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function c(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>u({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:c(e,{...t,lower:n[n.length-1],lowerOpen:!0},s)))))}}};return s}})};function qn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let s=0,i=0;s<t.keys.length&&i<e.length;++s)0===Lt(t.keys[s],e[i])&&(r.push(n?O(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const $n={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);const t=qn(e.keys,e.trans._cache,"clone"===e.cache);return t?Be.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?O(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Ln(e){return!("from"in e)}const Un=function(e,t){if(!this){const t=new Un;return e&&"d"in e&&s(t,e),t}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Vn(e,t,n){const r=Lt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ln(e))return s(e,{from:t,to:n,d:1});const i=e.l,o=e.r;if(Lt(n,e.from)<0)return i?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},zn(e);if(Lt(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},zn(e);Lt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Lt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wn(e,i),o&&a&&Wn(e,o)}function Wn(e,t){Ln(t)||function e(t,{from:n,to:r,l:s,r:i}){Vn(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function Yn(e){let t=Ln(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Lt(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||Lt(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 zn(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const t="r"===s?"l":"r",n={...e},r=e[s];e.from=r.from,e.to=r.to,e[s]=r[s],n[s]=r[t],e[t]=n,n.d=Hn(n)}e.d=Hn(e)}function Hn({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l(Un.prototype,{add(e){return Wn(this,e),this},addKey(e){return Vn(this,e,e),this},addKeys(e){return e.forEach((e=>Vn(this,e,e))),this},[B](){return Yn(this)}});const Gn={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,s=new Un(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{const o=e.table(i),{schema:a}=o,{primaryKey:l}=a,{extractKey:u,outbound:c}=l,h={...o,mutate:e=>{const n=e.trans,l=n.mutatedParts||(n.mutatedParts={}),u=e=>{const n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Un)},c=u(""),h=u(":dels"),{type:d}=e;let[f,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return o.mutate(e).then((e=>{if(r(f)){"delete"!==d&&(f=e.results),c.addKeys(f);const t=qn(f,y);t||"add"===d||h.addKeys(f),(t||p)&&function(e,t,n,s){t.indexes.forEach((function(t){const i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&r(e)?e.forEach((e=>i.addKey(e))):i.addKey(e);(n||s).forEach(((e,t)=>{const r=n&&o(n[t]),i=s&&o(s[t]);0!==Lt(r,i)&&(null!=r&&a(r),null!=i&&a(i))}))}))}(u,a,t,p)}else if(f){const e={from:f.lower,to:f.upper};h.add(e),c.add(e)}else c.add(s),h.add(s),a.indexes.forEach((e=>u(e.name).add(s)));return e}))}},d=({query:{index:t,range:n}})=>{var r,s;return[t,new Un(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},f={get:e=>[l,new Un(e.key)],getMany:e=>[l,(new Un).addKeys(e.keys)],count:d,query:d,openCursor:d};return n(f).forEach((e=>{h[e]=function(n){const{subscr:r}=Oe;if(r){const a=e=>{const n=`idb://${t}/${i}/${e}`;return r[n]||(r[n]=new Un)},l=a(""),h=a(":dels"),[d,p]=f[e](n);if(a(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&c&&n.values&&o.query({...n,values:!1});return o[e].apply(this,arguments).then((r=>{if("query"===e){if(c&&n.values)return t.then((({result:e})=>(l.addKeys(e),r)));const e=n.values?r.result.map(u):r.result;n.values?l.addKeys(e):h.addKeys(e)}else if("openCursor"===e){const e=r,t=n.values;return e&&Object.create(e,{key:{get:()=>(h.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return h.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return r}))}h.add(s)}}return o[e].apply(this,arguments)}})),h}}}};class Qn{constructor(e,t){this._middlewares={},this.verno=0;const n=Qn.dependencies;this._options=t={addons:Qn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:te,dbReadyPromise:null,cancelOpen:te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new Be((e=>{s.dbReadyResolve=e})),s.openCanceller=new Be(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=Dt(this,"populate","blocked","versionchange","close",{ready:[ue,te]}),this.on.ready.subscribe=m(this.on.ready.subscribe,(e=>(t,n)=>{Qn.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Be.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);const r=this;n||e((function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))}}))})),this.Collection=(i=this,It(Wt.prototype,(function(e,t){this.db=i;let n=At,r=null;if(t)try{n=t()}catch(e){r=e}const s=e._ctx,o=s.table,a=o.hook.reading.fire;this._ctx={table:o,index:s.index,isPrimKey:!s.index||o.schema.primKey.keyPath&&s.index===o.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:s.or,valueMapper:a!==ne?a:null}}))),this.Table=function(e){return It(Bt.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:Dt(null,{creating:[ie,te],reading:[re,ne],updating:[ae,te],deleting:[oe,te]})}))}(this),this.Transaction=function(e){return It(ln.prototype,(function(t,n,r,s,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Dt(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Be(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),pt(e)}))}))}(this),this.Version=function(e){return It(On.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return It(tn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const s=e._deps.indexedDB;if(!s)throw new J.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(e,t)=>s.cmp(t,e),this._max=(e,t)=>s.cmp(e,t)>0?e:t,this._min=(e,t)=>s.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=dn(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),_t.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Mn),this.use(Fn),this.use(Gn),this.use($n),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new J.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(_n),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new Be(((e,t)=>{if(this._state.openComplete)return t(new J.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new J.DatabaseClosed);this.open().catch(te)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:t,level:null==n?10:n,name:r}),s.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?pt(t.dbOpenError):e));M&&(t.openCanceller._stackHolder=$()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const s=t.openCanceller;function i(){if(t.openCanceller!==s)throw new J.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,l=!1;return Be.race([s,("undefined"==typeof navigator?Be.resolve():Bn()).then((()=>new Be(((s,o)=>{if(i(),!r)throw new J.MissingAPI;const u=e.name,c=t.autoSchema?r.open(u):r.open(u,Math.round(10*e.verno));if(!c)throw new J.MissingAPI;c.onerror=nn(o),c.onblocked=ze(e._fireOnBlocked),c.onupgradeneeded=ze((n=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();const e=r.deleteDatabase(u);e.onsuccess=e.onerror=ze((()=>{o(new J.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=nn(o);var s=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;l=s<1,e._novip.idbdb=c.result,xn(e,s/10,a,o)}}),o),c.onsuccess=ze((()=>{a=null;const r=e._novip.idbdb=c.result,i=y(r.objectStoreNames);if(i.length>0)try{const s=r.transaction(1===(o=i).length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},t,r){e.verno=t.version/10;const s=e._dbSchema=Sn(0,t,r);e._storeNames=y(t.objectStoreNames,0),gn(e,[e._allTables],n(s),s)}(e,r,s):(Kn(e,e._dbSchema,s),function(e,t){const n=kn(Sn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),vn(e,s)}catch(e){}var o;_t.push(e),r.onversionchange=ze((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),r.onclose=ze((t=>{e.on("close").fire(t)})),l&&function({indexedDB:e,IDBKeyRange:t},n){!An(e)&&n!==St&&Cn(e,t).put({name:n}).catch(te)}(e._deps,u),s()}),o)}))))]).then((()=>(i(),t.onReadyBeingFired=[],Be.resolve(jn((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ue,te);return t.onReadyBeingFired=[],Be.resolve(jn((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{a&&a.abort()}catch(e){}return s===t.openCanceller&&e._close(),pt(n)})).finally((()=>{t.openComplete=!0,o()}))}(this)}_close(){const e=this._state,t=_t.indexOf(this);if(t>=0&&_t.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Be((t=>{e.dbReadyResolve=t})),e.openCanceller=new Be(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Be(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=ze((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!An(e)&&n!==St&&Cn(e,t).delete(n).catch(te)}(this._deps,this.name),n()})),e.onerror=nn(r),e.onblocked=this._fireOnBlocked};if(e)throw new J.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(s):s()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return n(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=In.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Oe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,o;e=e.replace("!","").replace("?","");try{if(o=t.map((e=>{var t=e instanceof this.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===Kt)i=Kt;else{if("rw"!=e&&e!=Ot)throw new J.InvalidArgument("Invalid transaction mode: "+e);i=Ot}if(r){if(r.mode===Kt&&i===Ot){if(!s)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),s&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):pt(e)}const a=Tn.bind(null,this,i,o,r,n);return r?r._promise(i,a,"lock"):Oe.trans?lt(Oe.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!a(this._allTables,e))throw new J.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Xn="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Jn{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[Xn](){return this}}function Zn(e,t){return n(t).forEach((n=>{Wn(e[n]||(e[n]=new Un),t[n])})),e}let er;try{er={indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(t){er={indexedDB:null,IDBKeyRange:null}}const tr=Qn;function nr(e){let t=rr;try{rr=!0,an.storagemutated.fire(e)}finally{rr=t}}l(tr,{...ee,delete:e=>new tr(e,{addons:[]}).delete(),exists:e=>new tr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return An(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==St)))):Cn(e,t).toCollection().primaryKeys()}(tr.dependencies).then(e)}catch(e){return pt(new J.MissingAPI)}},defineClass:()=>function(e){s(this,e)},ignoreTransaction:e=>Oe.trans?lt(Oe.transless,e):e(),vip:jn,async:function(e){return function(){try{var t=Dn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Be.resolve(t)}catch(e){return pt(e)}}},spawn:function(e,t,n){try{var r=Dn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Be.resolve(r)}catch(e){return pt(e)}},currentTransaction:{get:()=>Oe.trans||null},waitFor:function(e,t){const n=Be.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Be,debug:{get:()=>M,set:e=>{N(e,"dexie"===e?()=>!0:Pt)}},derive:h,extend:s,props:l,override:m,Events:Dt,on:an,liveQuery:function(e){let t,r=!1;const s=new Jn((s=>{const i=R(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,an.storagemutated.unsubscribe(f)}};s.start&&s.start(u);let c=!1,h=!1;function d(){return n(l).some((e=>a[e]&&function(e,t){const n=Yn(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=Yn(e);let o=i.next(s.from),a=o.value;for(;!r.done&&!o.done;){if(Lt(a.from,s.to)<=0&&Lt(a.to,s.from)>=0)return!0;Lt(s.from,a.from)<0?s=(r=n.next(a.from)).value:a=(o=i.next(s.from)).value}return!1}(a[e],l[e])))}const f=e=>{Zn(a,e),d()&&p()},p=()=>{if(c||o)return;a={};const n={},y=function(t){i&&tt();const n=()=>et(e,{subscr:t,trans:null}),r=Oe.trans?lt(Oe.transless,n):n();return i&&r.then(nt,nt),r}(n);h||(an(sn,f),h=!0),c=!0,Promise.resolve(y).then((e=>{r=!0,t=e,c=!1,o||(d()?p():(a={},l=n,s.next&&s.next(e)))}),(e=>{c=!1,r=!1,s.error&&s.error(e),u.unsubscribe()}))};return p(),u}));return s.hasValue=()=>r,s.getValue=()=>t,s},extendObservabilitySet:Zn,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,(function(t){_(e,t,void 0)}))},shallowClone:x,deepClone:O,getObjectDiff:Nn,cmp:Lt,asap:v,minKey:vt,addons:[],connections:_t,errnames:Q,dependencies:er,semVer:mt,version:mt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),tr.maxKey=dn(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(an(sn,(e=>{if(!rr){let t;xt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(on,!0,!0,e)):t=new CustomEvent(on,{detail:e}),rr=!0,dispatchEvent(t),rr=!1}})),addEventListener(on,(({detail:e})=>{rr||nr(e)})));let rr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(on);"function"==typeof e.unref&&e.unref(),an(sn,(t=>{rr||e.postMessage(t)})),e.onmessage=e=>{e.data&&nr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){an(sn,(e=>{try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(on,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:on,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===on){const t=JSON.parse(e.newValue);t&&nr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===on&&nr(e.changedParts)}))}Be.rejectionMapper=function(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Z[e.name])return e;var n=new Z[e.name](t||e.message,e);return"stack"in e&&c(n,"stack",{get:function(){return this.inner.stack}}),n},N(M,Pt);class sr{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new Qn(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"name";const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new Qn(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){const e=await new Qn(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}));return e}}var ir=window.wp.apiFetch,or=e.n(ir);async function ar(e,t){try{await or().use(or().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await or()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await ar(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function lr(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):cr(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function ur(e,t){let n,r;if(e||cr(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function cr(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}var hr=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new sr("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&ar(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,hr.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,hr.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,hr.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,hr.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,hr.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,hr.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,hr.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,hr.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&lr(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&ur(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))}();
     7 */(()=>{"use strict";var e={};e.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,n=Object.keys,r=Array.isArray;function s(e,t){return"object"!=typeof t||n(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||t.Promise||(t.Promise=Promise);const i=Object.getPrototypeOf,o={}.hasOwnProperty;function a(e,t){return o.call(e,t)}function l(e,t){"function"==typeof t&&(t=t(i(e))),("undefined"==typeof Reflect?n:Reflect.ownKeys)(t).forEach((n=>{c(e,n,t[n])}))}const u=Object.defineProperty;function c(e,t,n,r){u(e,t,s(n&&a(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),c(e.prototype,"constructor",e),{extend:l.bind(null,e.prototype)}}}}const d=Object.getOwnPropertyDescriptor;function f(e,t){let n;return d(e,t)||(n=i(e))&&f(n,t)}const p=[].slice;function y(e,t,n){return p.call(e,t,n)}function m(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function g(e){t.setImmediate?setImmediate(e):setTimeout(e,0)}function v(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function w(e,t){if("string"==typeof t&&a(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,s=t.length;r<s;++r){var i=w(e,t[r]);n.push(i)}return n}var o=t.indexOf(".");if(-1!==o){var l=e[t.substr(0,o)];return void 0===l?void 0:w(l,t.substr(o+1))}}function _(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var s=0,i=t.length;s<i;++s)_(e,t[s],n[s])}else{var o=t.indexOf(".");if(-1!==o){var l=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===n?r(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=n;else{var c=e[l];c&&a(e,l)||(c=e[l]={}),_(c,u,n)}}else void 0===n?r(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)a(e,n)&&(t[n]=e[n]);return t}const k=[].concat;function E(e){return k.apply([],e)}const P="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(E([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>t[e])),S=P.map((e=>t[e]));v(P,(e=>[e,!0]));let K=null;function O(e){K="undefined"!=typeof WeakMap&&new WeakMap;const t=A(e);return K=null,t}function A(e){if(!e||"object"!=typeof e)return e;let t=K&&K.get(e);if(t)return t;if(r(e)){t=[],K&&K.set(e,t);for(var n=0,s=e.length;n<s;++n)t.push(A(e[n]))}else if(S.indexOf(e.constructor)>=0)t=e;else{const n=i(e);for(var o in t=n===Object.prototype?{}:Object.create(n),K&&K.set(e,t),e)a(e,o)&&(t[o]=A(e[o]))}return t}const{toString:C}={};function j(e){return C.call(e).slice(8,-1)}const B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof B?function(e){var t;return null!=e&&(t=e[B])&&t.apply(e)}:function(){return null},I={};function T(e){var t,n,s,i;if(1===arguments.length){if(r(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=D(e)){for(n=[];!(s=i.next()).done;)n.push(s.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}const R="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var M="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function F(e,t){M=e,N=t}var N=()=>!0;const q=!new Error("").stack;function $(){if(q)try{throw $.arguments,new Error}catch(e){return e}return new Error}function L(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(N).map((e=>"\n"+e)).join("")):""}var U=["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(U),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._e=$(),this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function H(e,t,n,r){this._e=$(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function G(e,t){this._e=$(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=z(e,t)}h(Y).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(H).from(Y),h(G).from(Y);var Q=V.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const X=Y;var J=V.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=$(),this.name=n,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=W[t]||n,this.inner=null)}return h(r).from(X),e[t]=r,e}),{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var Z=U.reduce(((e,t)=>(e[t+"Error"]=J[t],e)),{}),ee=V.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e)),{});function te(){}function ne(e){return e}function re(e,t){return null==e||e===ne?t:function(n){return t(e(n))}}function se(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ie(e,t){return e===te?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?se(r,this.onsuccess):r),s&&(this.onerror=this.onerror?se(s,this.onerror):s),void 0!==i?i:n}}function oe(e,t){return e===te?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?se(n,this.onsuccess):n),r&&(this.onerror=this.onerror?se(r,this.onerror):r)}}function ae(e,t){return e===te?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?se(i,this.onsuccess):i),o&&(this.onerror=this.onerror?se(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===te?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(e,t){return e===te?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}ee.ModifyError=H,ee.DexieError=Y,ee.BulkError=G;var ce={};const he=100,[de,fe,pe]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,i(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,i(t),e]})(),ye=fe&&fe.then,me=de&&de.constructor,be=!!pe;var ge=!1,ve=pe?()=>{pe.then(Le)}:t.setImmediate?setImmediate.bind(null,Le):t.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Le(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Le,0)},we=function(e,t){Ae.push([e,t]),xe&&(ve(),xe=!1)},_e=!0,xe=!0,ke=[],Ee=[],Pe=null,Se=ne,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ft,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{ft(e[0],e[1])}catch(e){}}))}},Oe=Ke,Ae=[],Ce=0,je=[];function Be(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=te,this._lib=!1;var t=this._PSD=Oe;if(M&&(this._stackHolder=$(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ce)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Te(this,e)}const De={get:function(){var e=Oe,t=Je;function n(n,r){var s=!e.global&&(e!==Oe||t!==Je);const i=s&&!nt();var o=new Be(((t,o)=>{Fe(this,new Ie(ct(n,e,s,i),ct(r,e,s,i),t,o,e))}));return M&&$e(o,this),o}return n.prototype=ce,n},set:function(e){c(this,"then",e&&e.prototype===ce?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,s){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=s}function Te(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Te(e,((e,n)=>{t instanceof Be?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(Ee.push(t),null===e._state){var n=e._lib&&Ue();t=Se(t),e._state=!1,e._value=t,M&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=f(t,"stack");t._promise=e,c(t,"stack",{get:()=>ge?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ke.some((t=>t._value===e._value))||ke.push(e)}(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Fe(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Ce&&(++Ce,we((()=>{0==--Ce&&We()}),[]))}function Fe(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,++Ce,we(Ne,[n,e,t])}else e._listeners.push(t)}function Ne(e,t,n){try{Pe=t;var r,s=t._value;t._state?r=e(s):(Ee.length&&(Ee=[]),r=e(s),-1===Ee.indexOf(s)&&function(e){for(var t=ke.length;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Pe=null,0==--Ce&&We(),--n.psd.ref||n.psd.finalize()}}function qe(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var s,i,o=e._value;null!=o?(s=o.name||"Error",i=o.message||o,r=L(o,0)):(s=o,i=""),t.push(s+(i?": "+i:"")+r)}return M&&((r=L(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&qe(e._prev,t,n)),t}function $e(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Le(){Ue()&&Ve()}function Ue(){var e=_e;return _e=!1,xe=!1,e}function Ve(){var e,t,n;do{for(;Ae.length>0;)for(e=Ae,Ae=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ae.length>0);_e=!0,xe=!0}function We(){var e=ke;ke=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=je.slice(0),n=t.length;n;)t[--n]()}function Ye(e){return new Be(ce,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),s=Oe;try{return ot(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{ot(s,!1),r&&Ve()}}}l(Be.prototype,{then:De,_then:function(e,t){Fe(this,new Ie(null,null,e,t,Oe))},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,(e=>e instanceof t?n(e):Ye(e))):this.then(null,(e=>e&&e.name===t?n(e):Ye(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Ye(t))))},stack:{get:function(){if(this._stack)return this._stack;try{ge=!0;var e=qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ge=!1}}},timeout:function(e,t){return e<1/0?new Be(((n,r)=>{var s=setTimeout((()=>r(new J.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=at(),l(Be,{all:function(){var e=T.apply(null,arguments).map(rt);return new Be((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Be.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Be)return e;if(e&&"function"==typeof e.then)return new Be(((t,n)=>{e.then(t,n)}));var t=new Be(ce,!0,e);return $e(t,Pe),t},reject:Ye,race:function(){var e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{e.map((e=>Be.resolve(e).then(t,n)))}))},PSD:{get:()=>Oe,set:e=>Oe=e},totalEchoes:{get:()=>Je},newPSD:et,usePSD:lt,scheduler:{get:()=>we,set:e=>{we=e}},rejectionMapper:{get:()=>Se,set:e=>{Se=e}},follow:(e,t)=>new Be(((n,r)=>et(((t,n)=>{var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=se((function(){!function(e){je.push((function t(){e(),je.splice(je.indexOf(t),1)})),++Ce,we((()=>{0==--Ce&&We()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),me&&(me.allSettled&&c(Be,"allSettled",(function(){const e=T.apply(null,arguments).map(rt);return new Be((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Be.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),me.any&&"undefined"!=typeof AggregateError&&c(Be,"any",(function(){const e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Be.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const He={awaits:0,echoes:0,id:0};var Ge=0,Qe=[],Xe=0,Je=0,Ze=0;function et(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ze;var a=Ke.env;o.env=be?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject,nthen:ht(a.nthen,o),gthen:ht(a.gthen,o)}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=lt(o,e,n,r);return 0===o.ref&&o.finalize(),l}function tt(){return He.id||(He.id=++Ge),++He.awaits,He.echoes+=he,He.id}function nt(){return!!He.awaits&&(0==--He.awaits&&(He.id=0),He.echoes=He.awaits*he,!0)}function rt(e){return He.echoes&&e&&e.constructor===me?(tt(),e.then((e=>(nt(),e)),(e=>(nt(),pt(e))))):e}function st(e){++Je,He.echoes&&0!=--He.echoes||(He.echoes=He.id=0),Qe.push(Oe),ot(e,!0)}function it(){var e=Qe[Qe.length-1];Qe.pop(),ot(e,!1)}function ot(e,n){var r=Oe;if((n?!He.echoes||Xe++&&e===Oe:!Xe||--Xe&&e===Oe)||ut(n?st.bind(null,e):it),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=at()),be)){var s=Ke.env.Promise,i=e.env;fe.then=i.nthen,s.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(t,"Promise",i.PromiseProp),s.all=i.all,s.race=i.race,s.resolve=i.resolve,s.reject=i.reject,i.allSettled&&(s.allSettled=i.allSettled),i.any&&(s.any=i.any))}}function at(){var e=t.Promise;return be?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function lt(e,t,n,r,s){var i=Oe;try{return ot(e,!0),t(n,r,s)}finally{ot(i,!1)}}function ut(e){ye.call(de,e)}function ct(e,t,n,r){return"function"!=typeof e?e:function(){var s=Oe;n&&tt(),ot(t,!0);try{return e.apply(this,arguments)}finally{ot(s,!1),r&&ut(nt)}}}function ht(e,t){return function(n,r){return e.call(this,ct(n,t),ct(r,t))}}-1===(""+ye).indexOf("[native code]")&&(tt=nt=te);const dt="unhandledrejection";function ft(e,n){var r;try{r=n.onuncatched(e)}catch(e){}if(!1!==r)try{var i,o={promise:n,reason:e};if(t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(dt,!0,!0),s(i,o)):t.CustomEvent&&s(i=new CustomEvent(dt,{detail:o}),o),i&&t.dispatchEvent&&(dispatchEvent(i),!t.PromiseRejectionEvent&&t.onunhandledrejection))try{t.onunhandledrejection(i)}catch(e){}M&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var pt=Be.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Oe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>yt(e,t,n,r)))):pt(s)}return s._promise(t,((e,t)=>et((()=>(Oe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return pt(new J.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return pt(new J.DatabaseClosed);e.open().catch(te)}return e._state.dbReadyPromise.then((()=>yt(e,t,n,r)))}const mt="3.2.5",bt=String.fromCharCode(65535),gt=-1/0,vt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wt="String expected.",_t=[],xt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),kt=xt,Et=xt,Pt=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),St="__dbnames",Kt="readonly",Ot="readwrite";function At(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const Ct={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jt(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=O(t))[e],t)}class Bt{_trans(e,t,n){const r=this._tx||Oe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new J.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const o=Ue();try{return r&&r.db===this.db?r===Oe.trans?r._promise(e,i,n):et((()=>r._promise(e,i,n)),{trans:r,transless:Oe.transless||Oe}):yt(this.db,e,[this.name],i)}finally{o&&Ve()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(r(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=n(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const s=this.schema.indexes.concat(this.schema.primKey).filter((e=>{if(e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))){for(let n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort(((e,t)=>e.keyPath.length-t.keyPath.length))[0];if(s&&this.db._maxKey!==bt){const n=s.keyPath.slice(0,t.length);return this.where(n).equals(n.map((t=>e[t])))}!s&&M&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[l,u]=t.reduce((([t,n],s)=>{const o=i[s],l=e[s];return[t||o,t||!o?At(n,o&&o.multi?e=>{const t=w(e,s);return r(t)&&t.some((e=>a(l,e)))}:e=>a(l,w(e,s))):n]}),[null,null]);return l?this.where(l.name).equals(e[l.keyPath]).filter(u):s?this.filter(u):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,r(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(a(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){s(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||r(e))return this.where(":id").equals(e).modify(t);{const r=w(e,this.schema.primKey.keyPath);if(void 0===r)return pt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?n(t).forEach((n=>{_(e,n,t[n])})):t(e,{value:e,primKey:r})}catch(e){}return this.where(":id").equals(r).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:Ct}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function Dt(e){var t={},s=function(n,r){if(r){for(var s=arguments.length,i=new Array(s-1);--s;)i[s-1]=arguments[s];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};s.addEventType=a;for(var i=1,o=arguments.length;i<o;++i)a(arguments[i]);return s;function a(e,i,o){if("object"!=typeof e){var l;i||(i=le),o||(o=te);var u={subscribers:[],fire:o,subscribe:function(e){-1===u.subscribers.indexOf(e)&&(u.subscribers.push(e),u.fire=i(u.fire,e))},unsubscribe:function(e){u.subscribers=u.subscribers.filter((function(t){return t!==e})),u.fire=u.subscribers.reduce(i,o)}};return t[e]=s[e]=u,u}n(l=e).forEach((function(e){var t=l[e];if(r(t))a(e,l[e][0],l[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=a(e,ne,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){g((function(){e.apply(null,t)}))}))}))}}))}}function It(e,t){return h(t).from({prototype:e}),t}function Tt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Rt(e,t){e.filter=At(e.filter,t)}function Mt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>At(r(),t()):t,e.justLimit=n&&!r}function Ft(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Nt(e,t,n){const r=Ft(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){const s=e.replayFilter?At(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},o=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var o=n.primaryKey,l=""+o;"[object ArrayBuffer]"===l&&(l=""+new Uint8Array(o)),a(i,l)||(i[l]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),$t(Nt(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return $t(Nt(e,r,n),At(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function $t(e,t,n,r){var s=ze(r?(e,t,s)=>n(r(e),t,s):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=te}),(t=>{e.fail(t),n=te}))||s(e.value,e,(e=>n=e)),n()}))}))}function Lt(e,t){try{const n=Ut(e),r=Ut(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 function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(Vt(e),Vt(t));case"Array":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n){const r=Lt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ut(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=j(e);return"ArrayBuffer"===n?"binary":n}function Vt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Wt{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,pt.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,pt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=At(t.algorithm,e)}_iterate(e,t){return qt(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>qt(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(Tt(t,!0))return n.count({trans:e,query:{index:Ft(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return qt(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],s=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,s),r=i(t,s);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return qt(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,Tt(t)?Mt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Mt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Mt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Rt(this._ctx,(function(n,r,s){return!e(n.value)||(r(s),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return Rt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=At(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(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)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0)return this._read((e=>{var n=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Rt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=a(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((r=>{var s;if("function"==typeof e)s=e;else{var i=n(e),o=i.length;s=function(t){for(var n=!1,r=0;r<o;++r){var s=i[r],a=e[s];w(t,s)!==a&&(_(t,s,a),n=!0)}return n}}const a=t.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,h=[];let d=0;const f=[],p=(e,t)=>{const{failures:r,numFailures:s}=t;d+=e-s;for(let e of n(r))h.push(r[e])};return this.clone().primaryKeys().then((n=>{const i=o=>{const h=Math.min(c,n.length-o);return a.getMany({trans:r,keys:n.slice(o,o+h),cache:"immutable"}).then((d=>{const f=[],y=[],m=l?[]:null,b=[];for(let e=0;e<h;++e){const t=d[e],r={value:O(t),primKey:n[o+e]};!1!==s.call(r,r.value,r)&&(null==r.value?b.push(n[o+e]):l||0===Lt(u(t),u(r.value))?(y.push(r.value),l&&m.push(n[o+e])):(b.push(n[o+e]),f.push(r.value)))}const g=Tt(t)&&t.limit===1/0&&("function"!=typeof e||e===Yt)&&{index:t.index,range:t.range};return Promise.resolve(f.length>0&&a.mutate({trans:r,type:"add",values:f}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(f.length,e)}))).then((()=>(y.length>0||g&&"object"==typeof e)&&a.mutate({trans:r,type:"put",keys:m,values:y,criteria:g,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(b.length>0||g&&e===Yt)&&a.mutate({trans:r,type:"delete",keys:b,criteria:g}).then((e=>p(b.length,e))))).then((()=>n.length>o+h&&i(o+c)))}))};return i(0).then((()=>{if(h.length>0)throw new H("Error modifying one or more objects",h,d,f);return n.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Tt(e)&&(e.isPrimKey&&!Et||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,s=t;return e.table.core.count({trans:n,query:{index:r,range:s}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then((({failures:e,lastResult:n,results:r,numFailures:s})=>{if(s)throw new H("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(Yt)}}const Yt=(e,t)=>t.value=null;function zt(e,t){return e<t?-1:e===t?0:1}function Ht(e,t){return e>t?-1:e===t?0:1}function Gt(e,t,n){var r=e instanceof tn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Qt(e){return new e.Collection(e,(()=>en(""))).limit(0)}function Xt(e,t,n,r,s,i){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return s(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):s(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;s(e[l],u)<0&&(a=l)}return o<r.length&&"next"===i?e+n.substr(e.length):o<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Jt(e,t,n,r){var s,i,o,a,l,u,c,h=n.length;if(!n.every((e=>"string"==typeof e)))return Gt(e,wt);function d(e){s=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),o="next"===e?zt:Ht;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return o(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),l=t.map((function(e){return e.lower})),u=e,c="next"===e?"":r}d("next");var f=new e.Collection(e,(()=>Zt(a[0],l[h-1]+r)));f._ondirectionchange=function(e){d(e)};var p=0;return f._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var d=i(s);if(t(d,l,p))return!0;for(var f=null,y=p;y<h;++y){var m=Xt(s,d,a[y],l[y],o,u);null===m&&null===f?p=y+1:(null===f||o(f,m)>0)&&(f=m)}return n(null!==f?function(){e.continue(f+c)}:r),!1})),f}function Zt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function en(e){return{type:1,lower:e,upper:e}}class tn{get Collection(){return this._ctx.table.db.Collection}between(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)?Qt(this):new this.Collection(this,(()=>Zt(e,t,!n,!r)))}catch(e){return Gt(this,vt)}}equals(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>en(e)))}above(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!0)))}aboveOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!1)))}below(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e)))}startsWith(e){return"string"!=typeof e?Gt(this,wt):this.between(e,e+bt,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):Jt(this,((e,t)=>0===e.indexOf(t[0])),[e],bt)}equalsIgnoreCase(e){return Jt(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,bt)}anyOf(){const e=T.apply(I,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Gt(this,vt)}if(0===e.length)return Qt(this);const n=new this.Collection(this,(()=>Zt(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,s,i)=>{const o=n.key;for(;t(o,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(o,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[gt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=T.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Gt(this,vt)}const t=e.reduce(((e,t)=>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})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,s=this._descending,i=this._min,o=this._max;if(0===e.length)return Qt(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Gt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);const a=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers;let u,c=r;function h(e,t){return c(e[0],t[0])}try{u=e.reduce((function(e,t){let r=0,s=e.length;for(;r<s;++r){const s=e[r];if(n(t[0],s[1])<0&&n(t[1],s[0])>0){s[0]=i(s[0],t[0]),s[1]=o(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),u.sort(h)}catch(e){return Gt(this,vt)}let d=0;const f=l?e=>r(e,u[d][1])>0:e=>r(e,u[d][1])>=0,p=a?e=>s(e,u[d][0])>0:e=>s(e,u[d][0])>=0;let y=f;const m=new this.Collection(this,(()=>Zt(u[0][0],u[u.length-1][1],!a,!l)));return m._ondirectionchange=e=>{"next"===e?(y=f,c=r):(y=p,c=s),u.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++d,d===u.length)return t(n),!1;return!!function(e){return!f(e)&&!p(e)}(s)||(0===this._cmp(s,u[d][1])||0===this._cmp(s,u[d][0])||t((()=>{c===r?e.continue(u[d][0]):e.continue(u[d][1])})),!1)})),m}startsWithAnyOf(){const e=T.apply(I,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Qt(this):this.inAnyRange(e.map((e=>[e,e+bt]))):Gt(this,"startsWithAnyOf() only works with strings")}}function nn(e){return ze((function(t){return rn(t),e(t.target.error),!1}))}function rn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const sn="storagemutated",on="x-storagemutated-1",an=Dt(null,sn);class ln{_lock(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this}_unlock(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Oe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new J.DatabaseClosed(n);case"MissingAPIError":throw new J.MissingAPI(n.message,n);default:throw new J.OpenFailed(n)}if(!this.active)throw new J.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ze((t=>{rn(t),this._reject(e.error)})),e.onabort=ze((t=>{rn(t),this.active&&this._reject(new J.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=ze((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&an.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return pt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return pt(new J.TransactionInactive);if(this._locked())return new Be(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Oe])}));if(n)return et((()=>{var e=new Be(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new Be(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=Be.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>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 s=t._waitingFor;return new Be(((e,r)=>{n.then((n=>t._waitingQueue.push(ze(e.bind(null,n)))),(e=>t._waitingQueue.push(ze(r.bind(null,e))))).finally((()=>{t._waitingFor===s&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(a(t,e))return t[e];const n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function un(e,t,n,r,s,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+cn(t)}}function cn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function hn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:v(n,(e=>[e.name,e]))}}let dn=e=>{try{return e.only([[]]),dn=()=>[[]],[[]]}catch(e){return dn=()=>bt,bt}};function fn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>w(t,e)}(e):t=>w(t,e)}function pn(e){return[].slice.call(e)}let yn=0;function mn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function bn(e,t,n){function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:s,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!s):t.bound(n,r,!!s,!!i)}const{schema:i,hasGetAll:o}=function(e,t){const n=pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,s=r(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:s,keyPath:t,autoIncrement:n,unique:!0,extractKey:fn(t)},indexes:pn(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:s,keyPath:i}=e,a={name:t,compound:r(i),keyPath:i,unique:n,multiEntry:s,extractKey:fn(i)};return o[mn(i)]=a,a})),getIndexByKeyPath:e=>o[mn(e)]};return o[":id"]=a.primaryKey,null!=t&&(o[mn(t)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,n),a=i.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:r,values:i,range:o}){return new Promise(((a,l)=>{a=ze(a);const u=e.objectStore(t),c=null==u.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:d}=r||i||{length:1};if(r&&i&&r.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let f;const p=[],y=[];let m=0;const b=e=>{++m,rn(e)};if("deleteRange"===n){if(4===o.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===o.type?p.push(f=u.clear()):p.push(f=u.delete(s(o)))}else{const[e,t]=h?c?[i,r]:[i,null]:[r,null];if(h)for(let r=0;r<d;++r)p.push(f=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),f.onerror=b;else for(let t=0;t<d;++t)p.push(f=u[n](e[t])),f.onerror=b}const g=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?r:p.map((e=>e.result)),lastResult:t})};f.onerror=e=>{b(e),g(e)},f.onsuccess=g}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t),o=n.length,a=new Array(o);let l,u=0,c=0;const h=e=>{const t=e.target;a[t._pos]=t.result,++c===u&&r(a)},d=nn(s);for(let e=0;e<o;++e)null!=n[e]&&(l=i.get(n[e]),l._pos=e,l.onsuccess=h,l.onerror=d,++u);0===u&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=nn(s)})),query:function(e){return n=>new Promise(((r,i)=>{r=ze(r);const{trans:o,values:a,limit:l,query:u}=n,c=l===1/0?void 0:l,{index:h,range:d}=u,f=o.objectStore(t),p=h.isPrimaryKey?f:f.index(h.name),y=s(d);if(0===l)return r({result:[]});if(e){const e=a?p.getAll(y,c):p.getAllKeys(y,c);e.onsuccess=e=>r({result:e.target.result}),e.onerror=nn(i)}else{let e=0;const t=a||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=s=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===l?r({result:n}):void i.continue()):r({result:n})},t.onerror=nn(i)}}))}(o),openCursor:function({trans:e,values:n,query:r,reverse:i,unique:o}){return new Promise(((a,l)=>{a=ze(a);const{index:u,range:c}=r,h=e.objectStore(t),d=u.isPrimaryKey?h:h.index(u.name),f=i?o?"prevunique":"prev":o?"nextunique":"next",p=n||!("openKeyCursor"in d)?d.openCursor(s(c),f):d.openKeyCursor(s(c),f);p.onerror=nn(l),p.onsuccess=ze((t=>{const n=p.result;if(!n)return void a(null);n.___id=++yn,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),o=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=ze(l),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=ze(e),p.onerror=nn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=o,e(t)}})),a=()=>{if(p.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return p.onsuccess=ze((e=>{p.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,a(),t},a(n)}),l)}))},count({query:e,trans:n}){const{index:r,range:i}=e;return new Promise(((e,o)=>{const a=n.objectStore(t),l=r.isPrimaryKey?a:a.index(r.name),u=s(i),c=u?l.count(u):l.count();c.onsuccess=ze((t=>e(t.target.result))),c.onerror=nn(o)}))}}}(e))),l={};return a.forEach((e=>l[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw new Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:dn(t),schema:i}}function gn({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},s){const i=function(e,t){return t.reduce(((e,{create:t})=>({...e,...t(e)})),e)}(bn(t,n,s),e.dbcore);return{dbcore:i}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function vn({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=f(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?c(t,n,{get(){return this.table(n)},set(e){u(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function wn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function _n(e,t){return e._cfg.version-t._cfg.version}function xn(e,t,r,s){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(s);const a=o._reject.bind(o),l=Oe.transless||Oe;et((()=>{Oe.trans=o,Oe.transless=l,0===t?(n(i).forEach((e=>{En(r,e,i[e].primKey,i[e].indexes)})),gn(e,r),Be.follow((()=>e.on.populate.fire(o))).catch(a)):function({_novip:e},t,r,s){const i=[],o=e._versions;let a=e._dbSchema=Sn(e,e.idbdb,s),l=!1;const u=o.filter((e=>e._cfg.version>=t));return u.forEach((o=>{i.push((()=>{const i=a,u=o._cfg.dbschema;Kn(e,i,s),Kn(e,u,s),a=e._dbSchema=u;const c=kn(i,u);c.add.forEach((e=>{En(s,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");{const t=s.objectStore(e.name);e.add.forEach((e=>Pn(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Pn(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const h=o._cfg.contentUpgrade;if(h&&o._cfg.version>t){gn(e,s),r._memoizedTables={},l=!0;let t=x(u);c.del.forEach((e=>{t[e]=i[e]})),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],n(t),t),r.schema=t;const o=R(h);let a;o&&tt();const d=Be.follow((()=>{if(a=h(r),a&&o){var e=nt.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Be.resolve(a):d.then((()=>a))}})),i.push((t=>{l&&kt||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(o._cfg.dbschema,t),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),r.schema=e._dbSchema}))})),function e(){return i.length?Be.resolve(i.shift()(r.idbtrans)).then(e):Be.resolve()}().then((()=>{var e,t;t=s,n(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||En(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,o,r).catch(a)}))}function kn(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const s=e[r],i=t[r];if(s){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!xt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let o;for(o in t)r[o]||e.del.push(o);for(o in r){const n=t[o],s=r[o];n?n.src!==s.src&&e.change.push(s):e.add.push(s)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function En(e,t,n,r){const s=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Pn(s,e))),s}function Pn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sn(e,t,n){const r={};return y(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=un(cn(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var a=un(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(a)}r[e]=hn(e,i,o)})),r}function Kn({_novip:e},n,r){const s=r.db.objectStoreNames;for(let t=0;t<s.length;++t){const i=s[t],o=r.objectStore(i);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){const t=o.indexNames[e],r=o.index(t).keyPath,s="string"==typeof r?r:"["+y(r).join("+")+"]";if(n[i]){const e=n[i].idxByName[s];e&&(e.name=t,delete n[i].idxByName[s],n[i].idxByName[t]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class On{_parseStoresSpec(e,t){n(e).forEach((n=>{if(null!==e[n]){var s=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),s=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return un(n,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),r(s),0===t)})),i=s.shift();if(i.multi)throw new J.Schema("Primary key cannot be multi-valued");s.forEach((e=>{if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")})),t[n]=hn(n,i,s)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;const r=t._versions,i={};let o={};return r.forEach((e=>{s(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)})),t._dbSchema=o,wn(t,[t._allTables,t,t.Transaction.prototype]),vn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],n(o),o),t._storeNames=n(o),this}upgrade(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||te,e),this}}function An(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qn(St,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Cn(e){return e&&"function"==typeof e.databases}function jn(e){return et((function(){return Oe.letThrough=!0,e()}))}function Bn(){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 Dn(e){var t=t=>e.next(t),n=i(t),s=i((t=>e.throw(t)));function i(e){return t=>{var i=e(t),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,s):r(o)?Promise.all(o).then(n,s):n(o)}}return i(t)()}function In(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[e,E(s),n]}function Tn(e,t,n,r,s){return Be.resolve().then((()=>{const i=Oe.transless||Oe,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Tn(e,t,n,null,s)))):pt(r)}const l=R(s);let u;l&&tt();const c=Be.follow((()=>{if(u=s.call(o,o),u)if(l){var e=nt.bind(null,null);u.then(e,e)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Dn(u))}),a);return(u&&"function"==typeof u.then?Be.resolve(u).then((e=>o.active?e:pt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):c.then((()=>u))).then((e=>(r&&o._resolve(),o._completion.then((()=>e))))).catch((e=>(o._reject(e),pt(e))))}))}function Rn(e,t,n){const s=r(e)?e.slice():[e];for(let e=0;e<n;++e)s.push(t);return s}const Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function o(e,t,n){const r=mn(e),a=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,u=t>0,c={...n,isVirtual:u,keyTail:t,keyLength:l,extractKey:fn(e),unique:!u&&n.unique};return a.push(c),c.isPrimaryKey||i.push(c),l>1&&o(2===l?e[0]:e.slice(0,l-1),t+1,n),a.sort(((e,t)=>e.keyTail-t.keyTail)),c}const a=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[a];for(const e of r.indexes)o(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?{...t,query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const u={...n,schema:{...r,primaryKey:a,indexes:i,getIndexByKeyPath:function(e){const t=s[mn(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;return s?n.openCursor(l(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Rn(s,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,s){n.continuePrimaryKey(Rn(t,e.MAX_KEY,r),s)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return s}(n))):n.openCursor(t)}};return u}}}};function Fn(e,t,r,s){return r=r||{},s=s||"",n(e).forEach((n=>{if(a(t,n)){var i=e[n],o=t[n];if("object"==typeof i&&"object"==typeof o&&i&&o){const e=j(i);e!==j(o)?r[s+n]=t[n]:"Object"===e?Fn(i,o,r,s+n+"."):i!==o&&(r[s+n]=t[n])}else i!==o&&(r[s+n]=t[n])}else r[s+n]=void 0})),n(t).forEach((n=>{a(e,n)||(r[s+n]=t[n])})),r}const Nn={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema,s={...n,mutate(e){const s=Oe.trans,{deleting:i,creating:o,updating:l}=s.table(t).hook;switch(e.type){case"add":if(o.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(o.fire===te&&l.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===te)break;return s._promise("readwrite",(()=>function(e){return c(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function u(e){const t=Oe.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:s}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((u=>{const c=s.map(((n,s)=>{const c=u[s],h={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(h,n,c,t);else if("add"===e.type||void 0===c){const i=o.fire.call(h,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||_(e.values[s],r.keyPath,n))}else{const r=Fn(c,e.values[s]),i=l.fire.call(h,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{a(t,e)?t[e]=i[e]:_(t,e,i[e])}))}}return h}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:i})=>{for(let r=0;r<s.length;++r){const i=n?n[r]:s[r],o=c[r];null==i?o.onerror&&o.onerror(t[r]):o.onsuccess&&o.onsuccess("put"===e.type&&u[r]?e.values[r]:i)}return{failures:t,results:n,numFailures:r,lastResult:i}})).catch((e=>(c.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function c(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>u({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:c(e,{...t,lower:n[n.length-1],lowerOpen:!0},s)))))}}};return s}})};function qn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let s=0,i=0;s<t.keys.length&&i<e.length;++s)0===Lt(t.keys[s],e[i])&&(r.push(n?O(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const $n={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);const t=qn(e.keys,e.trans._cache,"clone"===e.cache);return t?Be.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?O(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Ln(e){return!("from"in e)}const Un=function(e,t){if(!this){const t=new Un;return e&&"d"in e&&s(t,e),t}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Vn(e,t,n){const r=Lt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ln(e))return s(e,{from:t,to:n,d:1});const i=e.l,o=e.r;if(Lt(n,e.from)<0)return i?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},zn(e);if(Lt(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},zn(e);Lt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Lt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wn(e,i),o&&a&&Wn(e,o)}function Wn(e,t){Ln(t)||function e(t,{from:n,to:r,l:s,r:i}){Vn(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function Yn(e){let t=Ln(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Lt(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||Lt(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 zn(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const t="r"===s?"l":"r",n={...e},r=e[s];e.from=r.from,e.to=r.to,e[s]=r[s],n[s]=r[t],e[t]=n,n.d=Hn(n)}e.d=Hn(e)}function Hn({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l(Un.prototype,{add(e){return Wn(this,e),this},addKey(e){return Vn(this,e,e),this},addKeys(e){return e.forEach((e=>Vn(this,e,e))),this},[B](){return Yn(this)}});const Gn={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,s=new Un(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{const o=e.table(i),{schema:a}=o,{primaryKey:l}=a,{extractKey:u,outbound:c}=l,h={...o,mutate:e=>{const n=e.trans,l=n.mutatedParts||(n.mutatedParts={}),u=e=>{const n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Un)},c=u(""),h=u(":dels"),{type:d}=e;let[f,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return o.mutate(e).then((e=>{if(r(f)){"delete"!==d&&(f=e.results),c.addKeys(f);const t=qn(f,y);t||"add"===d||h.addKeys(f),(t||p)&&function(e,t,n,s){t.indexes.forEach((function(t){const i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&r(e)?e.forEach((e=>i.addKey(e))):i.addKey(e);(n||s).forEach(((e,t)=>{const r=n&&o(n[t]),i=s&&o(s[t]);0!==Lt(r,i)&&(null!=r&&a(r),null!=i&&a(i))}))}))}(u,a,t,p)}else if(f){const e={from:f.lower,to:f.upper};h.add(e),c.add(e)}else c.add(s),h.add(s),a.indexes.forEach((e=>u(e.name).add(s)));return e}))}},d=({query:{index:t,range:n}})=>{var r,s;return[t,new Un(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},f={get:e=>[l,new Un(e.key)],getMany:e=>[l,(new Un).addKeys(e.keys)],count:d,query:d,openCursor:d};return n(f).forEach((e=>{h[e]=function(n){const{subscr:r}=Oe;if(r){const a=e=>{const n=`idb://${t}/${i}/${e}`;return r[n]||(r[n]=new Un)},l=a(""),h=a(":dels"),[d,p]=f[e](n);if(a(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&c&&n.values&&o.query({...n,values:!1});return o[e].apply(this,arguments).then((r=>{if("query"===e){if(c&&n.values)return t.then((({result:e})=>(l.addKeys(e),r)));const e=n.values?r.result.map(u):r.result;n.values?l.addKeys(e):h.addKeys(e)}else if("openCursor"===e){const e=r,t=n.values;return e&&Object.create(e,{key:{get:()=>(h.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return h.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return r}))}h.add(s)}}return o[e].apply(this,arguments)}})),h}}}};class Qn{constructor(e,t){this._middlewares={},this.verno=0;const n=Qn.dependencies;this._options=t={addons:Qn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:te,dbReadyPromise:null,cancelOpen:te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new Be((e=>{s.dbReadyResolve=e})),s.openCanceller=new Be(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=Dt(this,"populate","blocked","versionchange","close",{ready:[ue,te]}),this.on.ready.subscribe=m(this.on.ready.subscribe,(e=>(t,n)=>{Qn.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Be.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);const r=this;n||e((function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))}}))})),this.Collection=(i=this,It(Wt.prototype,(function(e,t){this.db=i;let n=Ct,r=null;if(t)try{n=t()}catch(e){r=e}const s=e._ctx,o=s.table,a=o.hook.reading.fire;this._ctx={table:o,index:s.index,isPrimKey:!s.index||o.schema.primKey.keyPath&&s.index===o.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:s.or,valueMapper:a!==ne?a:null}}))),this.Table=function(e){return It(Bt.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:Dt(null,{creating:[ie,te],reading:[re,ne],updating:[ae,te],deleting:[oe,te]})}))}(this),this.Transaction=function(e){return It(ln.prototype,(function(t,n,r,s,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Dt(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Be(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),pt(e)}))}))}(this),this.Version=function(e){return It(On.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return It(tn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const s=e._deps.indexedDB;if(!s)throw new J.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(e,t)=>s.cmp(t,e),this._max=(e,t)=>s.cmp(e,t)>0?e:t,this._min=(e,t)=>s.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=dn(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),_t.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Mn),this.use(Nn),this.use(Gn),this.use($n),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new J.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(_n),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new Be(((e,t)=>{if(this._state.openComplete)return t(new J.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new J.DatabaseClosed);this.open().catch(te)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:t,level:null==n?10:n,name:r}),s.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?pt(t.dbOpenError):e));M&&(t.openCanceller._stackHolder=$()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const s=t.openCanceller;function i(){if(t.openCanceller!==s)throw new J.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,l=!1;const u=()=>new Be(((s,o)=>{if(i(),!r)throw new J.MissingAPI;const u=e.name,c=t.autoSchema?r.open(u):r.open(u,Math.round(10*e.verno));if(!c)throw new J.MissingAPI;c.onerror=nn(o),c.onblocked=ze(e._fireOnBlocked),c.onupgradeneeded=ze((n=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();const e=r.deleteDatabase(u);e.onsuccess=e.onerror=ze((()=>{o(new J.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=nn(o);var s=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;l=s<1,e._novip.idbdb=c.result,xn(e,s/10,a,o)}}),o),c.onsuccess=ze((()=>{a=null;const r=e._novip.idbdb=c.result,i=y(r.objectStoreNames);if(i.length>0)try{const s=r.transaction(1===(o=i).length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},t,r){e.verno=t.version/10;const s=e._dbSchema=Sn(0,t,r);e._storeNames=y(t.objectStoreNames,0),vn(e,[e._allTables],n(s),s)}(e,r,s):(Kn(e,e._dbSchema,s),function(e,t){const n=kn(Sn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),gn(e,s)}catch(e){}var o;_t.push(e),r.onversionchange=ze((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),r.onclose=ze((t=>{e.on("close").fire(t)})),l&&function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).put({name:n}).catch(te)}(e._deps,u),s()}),o)})).catch((e=>e&&"UnknownError"===e.name&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),u()):Be.reject(e)));return Be.race([s,("undefined"==typeof navigator?Be.resolve():Bn()).then(u)]).then((()=>(i(),t.onReadyBeingFired=[],Be.resolve(jn((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ue,te);return t.onReadyBeingFired=[],Be.resolve(jn((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{a&&a.abort()}catch(e){}return s===t.openCanceller&&e._close(),pt(n)})).finally((()=>{t.openComplete=!0,o()}))}(this)}_close(){const e=this._state,t=_t.indexOf(this);if(t>=0&&_t.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Be((t=>{e.dbReadyResolve=t})),e.openCanceller=new Be(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Be(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=ze((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).delete(n).catch(te)}(this._deps,this.name),n()})),e.onerror=nn(r),e.onblocked=this._fireOnBlocked};if(e)throw new J.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(s):s()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return n(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=In.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Oe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,o;e=e.replace("!","").replace("?","");try{if(o=t.map((e=>{var t=e instanceof this.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===Kt)i=Kt;else{if("rw"!=e&&e!=Ot)throw new J.InvalidArgument("Invalid transaction mode: "+e);i=Ot}if(r){if(r.mode===Kt&&i===Ot){if(!s)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),s&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):pt(e)}const a=Tn.bind(null,this,i,o,r,n);return r?r._promise(i,a,"lock"):Oe.trans?lt(Oe.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!a(this._allTables,e))throw new J.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Xn="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Jn{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[Xn](){return this}}function Zn(e,t){return n(t).forEach((n=>{Wn(e[n]||(e[n]=new Un),t[n])})),e}let er;try{er={indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(t){er={indexedDB:null,IDBKeyRange:null}}const tr=Qn;function nr(e){let t=rr;try{rr=!0,an.storagemutated.fire(e)}finally{rr=t}}l(tr,{...ee,delete:e=>new tr(e,{addons:[]}).delete(),exists:e=>new tr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return Cn(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==St)))):An(e,t).toCollection().primaryKeys()}(tr.dependencies).then(e)}catch(e){return pt(new J.MissingAPI)}},defineClass:()=>function(e){s(this,e)},ignoreTransaction:e=>Oe.trans?lt(Oe.transless,e):e(),vip:jn,async:function(e){return function(){try{var t=Dn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Be.resolve(t)}catch(e){return pt(e)}}},spawn:function(e,t,n){try{var r=Dn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Be.resolve(r)}catch(e){return pt(e)}},currentTransaction:{get:()=>Oe.trans||null},waitFor:function(e,t){const n=Be.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Be,debug:{get:()=>M,set:e=>{F(e,"dexie"===e?()=>!0:Pt)}},derive:h,extend:s,props:l,override:m,Events:Dt,on:an,liveQuery:function(e){let t,r=!1;const s=new Jn((s=>{const i=R(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,an.storagemutated.unsubscribe(f)}};s.start&&s.start(u);let c=!1,h=!1;function d(){return n(l).some((e=>a[e]&&function(e,t){const n=Yn(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=Yn(e);let o=i.next(s.from),a=o.value;for(;!r.done&&!o.done;){if(Lt(a.from,s.to)<=0&&Lt(a.to,s.from)>=0)return!0;Lt(s.from,a.from)<0?s=(r=n.next(a.from)).value:a=(o=i.next(s.from)).value}return!1}(a[e],l[e])))}const f=e=>{Zn(a,e),d()&&p()},p=()=>{if(c||o)return;a={};const n={},y=function(t){i&&tt();const n=()=>et(e,{subscr:t,trans:null}),r=Oe.trans?lt(Oe.transless,n):n();return i&&r.then(nt,nt),r}(n);h||(an(sn,f),h=!0),c=!0,Promise.resolve(y).then((e=>{r=!0,t=e,c=!1,o||(d()?p():(a={},l=n,s.next&&s.next(e)))}),(e=>{c=!1,r=!1,s.error&&s.error(e),u.unsubscribe()}))};return p(),u}));return s.hasValue=()=>r,s.getValue=()=>t,s},extendObservabilitySet:Zn,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,(function(t){_(e,t,void 0)}))},shallowClone:x,deepClone:O,getObjectDiff:Fn,cmp:Lt,asap:g,minKey:gt,addons:[],connections:_t,errnames:Q,dependencies:er,semVer:mt,version:mt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),tr.maxKey=dn(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(an(sn,(e=>{if(!rr){let t;xt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(on,!0,!0,e)):t=new CustomEvent(on,{detail:e}),rr=!0,dispatchEvent(t),rr=!1}})),addEventListener(on,(({detail:e})=>{rr||nr(e)})));let rr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(on);"function"==typeof e.unref&&e.unref(),an(sn,(t=>{rr||e.postMessage(t)})),e.onmessage=e=>{e.data&&nr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){an(sn,(e=>{try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(on,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:on,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===on){const t=JSON.parse(e.newValue);t&&nr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===on&&nr(e.changedParts)}))}Be.rejectionMapper=function(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Z[e.name])return e;var n=new Z[e.name](t||e.message,e);return"stack"in e&&c(n,"stack",{get:function(){return this.inner.stack}}),n},F(M,Pt);class sr{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new Qn(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(e="name"){const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new Qn(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){const e=await new Qn(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}));return e}}const ir=window.wp.apiFetch;var or=e.n(ir);async function ar(e,t){try{await or().use(or().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await or()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await ar(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function lr(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):cr(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function ur(e,t){let n,r;if(e||cr(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function cr(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}const hr=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new sr("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&ar(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,hr.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,hr.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,hr.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,hr.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,hr.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,hr.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,hr.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,hr.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&lr(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&ur(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))})();
  • super-admin-all-sites-menu/tags/1.6.7/readme.txt

    r2986044 r3036551  
    11=== Super Admin All Sites Menu ===
    2 Stable tag: 1.6.6
     2Stable tag: 1.6.7
    33Requires at least: 5.6 
    44Tested up to: 6.4 
     
    101101== Changelog ==
    102102
     103= 1.6.7 =
     104
     105- Update dependencies
     106
    103107= 1.6.6 =
    104108
  • super-admin-all-sites-menu/tags/1.6.7/super-admin-all-sites-menu.php

    r2986044 r3036551  
    1313 * GitHub Plugin URI: https://github.com/soderlind/super-admin-all-sites-menu
    1414 * Description: For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.
    15  * Version:     1.6.6
     15 * Version:     1.6.7
    1616 * Author:      Per Soderlind
    1717 * Network:     true
  • super-admin-all-sites-menu/trunk/build/index.asset.php

    r2986044 r3036551  
    1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => 'c2bbf763c2a9972c5535');
     1<?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '83258dff0f23c505ee1c');
  • super-admin-all-sites-menu/trunk/build/index.js

    r2986044 r3036551  
    11/*!
    22 * super-admin-all-sites-menu
    3  * version: 1.6.6
     3 * version: 1.6.7
    44 * address: https://github.com/soderlind/super-admin-all-sites-menu#readme
    55 * author:  Per Søderlind
    66 * license: GPLv2
    7  */!function(){"use strict";var e={};e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},e.d=function(t,n){for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,n=Object.keys,r=Array.isArray;function s(e,t){return"object"!=typeof t||n(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||t.Promise||(t.Promise=Promise);const i=Object.getPrototypeOf,o={}.hasOwnProperty;function a(e,t){return o.call(e,t)}function l(e,t){"function"==typeof t&&(t=t(i(e))),("undefined"==typeof Reflect?n:Reflect.ownKeys)(t).forEach((n=>{c(e,n,t[n])}))}const u=Object.defineProperty;function c(e,t,n,r){u(e,t,s(n&&a(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),c(e.prototype,"constructor",e),{extend:l.bind(null,e.prototype)}}}}const d=Object.getOwnPropertyDescriptor;function f(e,t){let n;return d(e,t)||(n=i(e))&&f(n,t)}const p=[].slice;function y(e,t,n){return p.call(e,t,n)}function m(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function v(e){t.setImmediate?setImmediate(e):setTimeout(e,0)}function g(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function w(e,t){if(a(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,s=t.length;r<s;++r){var i=w(e,t[r]);n.push(i)}return n}var o=t.indexOf(".");if(-1!==o){var l=e[t.substr(0,o)];return void 0===l?void 0:w(l,t.substr(o+1))}}function _(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var s=0,i=t.length;s<i;++s)_(e,t[s],n[s])}else{var o=t.indexOf(".");if(-1!==o){var l=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===n?r(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=n;else{var c=e[l];c&&a(e,l)||(c=e[l]={}),_(c,u,n)}}else void 0===n?r(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)a(e,n)&&(t[n]=e[n]);return t}const k=[].concat;function E(e){return k.apply([],e)}const P="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(E([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>t[e])),S=P.map((e=>t[e]));g(P,(e=>[e,!0]));let K=null;function O(e){K="undefined"!=typeof WeakMap&&new WeakMap;const t=C(e);return K=null,t}function C(e){if(!e||"object"!=typeof e)return e;let t=K&&K.get(e);if(t)return t;if(r(e)){t=[],K&&K.set(e,t);for(var n=0,s=e.length;n<s;++n)t.push(C(e[n]))}else if(S.indexOf(e.constructor)>=0)t=e;else{const n=i(e);for(var o in t=n===Object.prototype?{}:Object.create(n),K&&K.set(e,t),e)a(e,o)&&(t[o]=C(e[o]))}return t}const{toString:A}={};function j(e){return A.call(e).slice(8,-1)}const B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof B?function(e){var t;return null!=e&&(t=e[B])&&t.apply(e)}:function(){return null},I={};function T(e){var t,n,s,i;if(1===arguments.length){if(r(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=D(e)){for(n=[];!(s=i.next()).done;)n.push(s.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}const R="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var M="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function N(e,t){M=e,F=t}var F=()=>!0;const q=!new Error("").stack;function $(){if(q)try{throw $.arguments,new Error}catch(e){return e}return new Error}function L(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(F).map((e=>"\n"+e)).join("")):""}var U=["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(U),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._e=$(),this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function H(e,t,n,r){this._e=$(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function G(e,t){this._e=$(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=z(e,t)}h(Y).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(H).from(Y),h(G).from(Y);var Q=V.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const X=Y;var J=V.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=$(),this.name=n,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=W[t]||n,this.inner=null)}return h(r).from(X),e[t]=r,e}),{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var Z=U.reduce(((e,t)=>(e[t+"Error"]=J[t],e)),{}),ee=V.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e)),{});function te(){}function ne(e){return e}function re(e,t){return null==e||e===ne?t:function(n){return t(e(n))}}function se(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ie(e,t){return e===te?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?se(r,this.onsuccess):r),s&&(this.onerror=this.onerror?se(s,this.onerror):s),void 0!==i?i:n}}function oe(e,t){return e===te?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?se(n,this.onsuccess):n),r&&(this.onerror=this.onerror?se(r,this.onerror):r)}}function ae(e,t){return e===te?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?se(i,this.onsuccess):i),o&&(this.onerror=this.onerror?se(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===te?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(e,t){return e===te?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}ee.ModifyError=H,ee.DexieError=Y,ee.BulkError=G;var ce={};const he=100,[de,fe,pe]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,i(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,i(t),e]})(),ye=fe&&fe.then,me=de&&de.constructor,be=!!pe;var ve=!1,ge=pe?()=>{pe.then(Le)}:t.setImmediate?setImmediate.bind(null,Le):t.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Le(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Le,0)},we=function(e,t){Ce.push([e,t]),xe&&(ge(),xe=!1)},_e=!0,xe=!0,ke=[],Ee=[],Pe=null,Se=ne,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ft,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{ft(e[0],e[1])}catch(e){}}))}},Oe=Ke,Ce=[],Ae=0,je=[];function Be(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=te,this._lib=!1;var t=this._PSD=Oe;if(M&&(this._stackHolder=$(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ce)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Te(this,e)}const De={get:function(){var e=Oe,t=Je;function n(n,r){var s=!e.global&&(e!==Oe||t!==Je);const i=s&&!nt();var o=new Be(((t,o)=>{Ne(this,new Ie(ct(n,e,s,i),ct(r,e,s,i),t,o,e))}));return M&&$e(o,this),o}return n.prototype=ce,n},set:function(e){c(this,"then",e&&e.prototype===ce?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,s){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=s}function Te(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Te(e,((e,n)=>{t instanceof Be?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(Ee.push(t),null===e._state){var n=e._lib&&Ue();t=Se(t),e._state=!1,e._value=t,M&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=f(t,"stack");t._promise=e,c(t,"stack",{get:()=>ve?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ke.some((t=>t._value===e._value))||ke.push(e)}(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Ne(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Ae&&(++Ae,we((()=>{0==--Ae&&We()}),[]))}function Ne(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,++Ae,we(Fe,[n,e,t])}else e._listeners.push(t)}function Fe(e,t,n){try{Pe=t;var r,s=t._value;t._state?r=e(s):(Ee.length&&(Ee=[]),r=e(s),-1===Ee.indexOf(s)&&function(e){for(var t=ke.length;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Pe=null,0==--Ae&&We(),--n.psd.ref||n.psd.finalize()}}function qe(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var s,i,o=e._value;null!=o?(s=o.name||"Error",i=o.message||o,r=L(o,0)):(s=o,i=""),t.push(s+(i?": "+i:"")+r)}return M&&((r=L(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&qe(e._prev,t,n)),t}function $e(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Le(){Ue()&&Ve()}function Ue(){var e=_e;return _e=!1,xe=!1,e}function Ve(){var e,t,n;do{for(;Ce.length>0;)for(e=Ce,Ce=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ce.length>0);_e=!0,xe=!0}function We(){var e=ke;ke=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=je.slice(0),n=t.length;n;)t[--n]()}function Ye(e){return new Be(ce,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),s=Oe;try{return ot(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{ot(s,!1),r&&Ve()}}}l(Be.prototype,{then:De,_then:function(e,t){Ne(this,new Ie(null,null,e,t,Oe))},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,(e=>e instanceof t?n(e):Ye(e))):this.then(null,(e=>e&&e.name===t?n(e):Ye(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Ye(t))))},stack:{get:function(){if(this._stack)return this._stack;try{ve=!0;var e=qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ve=!1}}},timeout:function(e,t){return e<1/0?new Be(((n,r)=>{var s=setTimeout((()=>r(new J.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=at(),l(Be,{all:function(){var e=T.apply(null,arguments).map(rt);return new Be((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Be.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Be)return e;if(e&&"function"==typeof e.then)return new Be(((t,n)=>{e.then(t,n)}));var t=new Be(ce,!0,e);return $e(t,Pe),t},reject:Ye,race:function(){var e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{e.map((e=>Be.resolve(e).then(t,n)))}))},PSD:{get:()=>Oe,set:e=>Oe=e},totalEchoes:{get:()=>Je},newPSD:et,usePSD:lt,scheduler:{get:()=>we,set:e=>{we=e}},rejectionMapper:{get:()=>Se,set:e=>{Se=e}},follow:(e,t)=>new Be(((n,r)=>et(((t,n)=>{var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=se((function(){!function(e){je.push((function t(){e(),je.splice(je.indexOf(t),1)})),++Ae,we((()=>{0==--Ae&&We()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),me&&(me.allSettled&&c(Be,"allSettled",(function(){const e=T.apply(null,arguments).map(rt);return new Be((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Be.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),me.any&&"undefined"!=typeof AggregateError&&c(Be,"any",(function(){const e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Be.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const He={awaits:0,echoes:0,id:0};var Ge=0,Qe=[],Xe=0,Je=0,Ze=0;function et(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ze;var a=Ke.env;o.env=be?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject,nthen:ht(a.nthen,o),gthen:ht(a.gthen,o)}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=lt(o,e,n,r);return 0===o.ref&&o.finalize(),l}function tt(){return He.id||(He.id=++Ge),++He.awaits,He.echoes+=he,He.id}function nt(){return!!He.awaits&&(0==--He.awaits&&(He.id=0),He.echoes=He.awaits*he,!0)}function rt(e){return He.echoes&&e&&e.constructor===me?(tt(),e.then((e=>(nt(),e)),(e=>(nt(),pt(e))))):e}function st(e){++Je,He.echoes&&0!=--He.echoes||(He.echoes=He.id=0),Qe.push(Oe),ot(e,!0)}function it(){var e=Qe[Qe.length-1];Qe.pop(),ot(e,!1)}function ot(e,n){var r=Oe;if((n?!He.echoes||Xe++&&e===Oe:!Xe||--Xe&&e===Oe)||ut(n?st.bind(null,e):it),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=at()),be)){var s=Ke.env.Promise,i=e.env;fe.then=i.nthen,s.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(t,"Promise",i.PromiseProp),s.all=i.all,s.race=i.race,s.resolve=i.resolve,s.reject=i.reject,i.allSettled&&(s.allSettled=i.allSettled),i.any&&(s.any=i.any))}}function at(){var e=t.Promise;return be?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function lt(e,t,n,r,s){var i=Oe;try{return ot(e,!0),t(n,r,s)}finally{ot(i,!1)}}function ut(e){ye.call(de,e)}function ct(e,t,n,r){return"function"!=typeof e?e:function(){var s=Oe;n&&tt(),ot(t,!0);try{return e.apply(this,arguments)}finally{ot(s,!1),r&&ut(nt)}}}function ht(e,t){return function(n,r){return e.call(this,ct(n,t),ct(r,t))}}-1===(""+ye).indexOf("[native code]")&&(tt=nt=te);const dt="unhandledrejection";function ft(e,n){var r;try{r=n.onuncatched(e)}catch(e){}if(!1!==r)try{var i,o={promise:n,reason:e};if(t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(dt,!0,!0),s(i,o)):t.CustomEvent&&s(i=new CustomEvent(dt,{detail:o}),o),i&&t.dispatchEvent&&(dispatchEvent(i),!t.PromiseRejectionEvent&&t.onunhandledrejection))try{t.onunhandledrejection(i)}catch(e){}M&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var pt=Be.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Oe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>yt(e,t,n,r)))):pt(s)}return s._promise(t,((e,t)=>et((()=>(Oe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return pt(new J.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return pt(new J.DatabaseClosed);e.open().catch(te)}return e._state.dbReadyPromise.then((()=>yt(e,t,n,r)))}const mt="3.2.4",bt=String.fromCharCode(65535),vt=-1/0,gt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wt="String expected.",_t=[],xt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),kt=xt,Et=xt,Pt=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),St="__dbnames",Kt="readonly",Ot="readwrite";function Ct(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const At={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jt(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=O(t))[e],t)}class Bt{_trans(e,t,n){const r=this._tx||Oe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new J.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const o=Ue();try{return r&&r.db===this.db?r===Oe.trans?r._promise(e,i,n):et((()=>r._promise(e,i,n)),{trans:r,transless:Oe.transless||Oe}):yt(this.db,e,[this.name],i)}finally{o&&Ve()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(r(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=n(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const s=this.schema.indexes.concat(this.schema.primKey).filter((e=>e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))&&e.keyPath.every((e=>t.indexOf(e)>=0))))[0];if(s&&this.db._maxKey!==bt)return this.where(s.name).equals(s.keyPath.map((t=>e[t])));!s&&M&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[l,u]=t.reduce((([t,n],s)=>{const o=i[s],l=e[s];return[t||o,t||!o?Ct(n,o&&o.multi?e=>{const t=w(e,s);return r(t)&&t.some((e=>a(l,e)))}:e=>a(l,w(e,s))):n]}),[null,null]);return l?this.where(l.name).equals(e[l.keyPath]).filter(u):s?this.filter(u):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,r(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(a(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){s(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||r(e))return this.where(":id").equals(e).modify(t);{const r=w(e,this.schema.primKey.keyPath);if(void 0===r)return pt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?n(t).forEach((n=>{_(e,n,t[n])})):t(e,{value:e,primKey:r})}catch(e){}return this.where(":id").equals(r).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:At}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function Dt(e){var t={},s=function(n,r){if(r){for(var s=arguments.length,i=new Array(s-1);--s;)i[s-1]=arguments[s];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};s.addEventType=a;for(var i=1,o=arguments.length;i<o;++i)a(arguments[i]);return s;function a(e,i,o){if("object"!=typeof e){var l;i||(i=le),o||(o=te);var u={subscribers:[],fire:o,subscribe:function(e){-1===u.subscribers.indexOf(e)&&(u.subscribers.push(e),u.fire=i(u.fire,e))},unsubscribe:function(e){u.subscribers=u.subscribers.filter((function(t){return t!==e})),u.fire=u.subscribers.reduce(i,o)}};return t[e]=s[e]=u,u}n(l=e).forEach((function(e){var t=l[e];if(r(t))a(e,l[e][0],l[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=a(e,ne,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){v((function(){e.apply(null,t)}))}))}))}}))}}function It(e,t){return h(t).from({prototype:e}),t}function Tt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Rt(e,t){e.filter=Ct(e.filter,t)}function Mt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>Ct(r(),t()):t,e.justLimit=n&&!r}function Nt(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Ft(e,t,n){const r=Nt(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){const s=e.replayFilter?Ct(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},o=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var o=n.primaryKey,l=""+o;"[object ArrayBuffer]"===l&&(l=""+new Uint8Array(o)),a(i,l)||(i[l]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),$t(Ft(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return $t(Ft(e,r,n),Ct(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function $t(e,t,n,r){var s=ze(r?(e,t,s)=>n(r(e),t,s):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=te}),(t=>{e.fail(t),n=te}))||s(e.value,e,(e=>n=e)),n()}))}))}function Lt(e,t){try{const n=Ut(e),r=Ut(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 function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(Vt(e),Vt(t));case"Array":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n){const r=Lt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ut(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=j(e);return"ArrayBuffer"===n?"binary":n}function Vt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Wt{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,pt.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,pt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=Ct(t.algorithm,e)}_iterate(e,t){return qt(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>qt(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(Tt(t,!0))return n.count({trans:e,query:{index:Nt(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return qt(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],s=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,s),r=i(t,s);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Nt(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return qt(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,Tt(t)?Mt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Mt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Mt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Rt(this._ctx,(function(n,r,s){return!e(n.value)||(r(s),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return Rt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=Ct(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(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)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0)return this._read((e=>{var n=Nt(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Rt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=a(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((r=>{var s;if("function"==typeof e)s=e;else{var i=n(e),o=i.length;s=function(t){for(var n=!1,r=0;r<o;++r){var s=i[r],a=e[s];w(t,s)!==a&&(_(t,s,a),n=!0)}return n}}const a=t.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,h=[];let d=0;const f=[],p=(e,t)=>{const{failures:r,numFailures:s}=t;d+=e-s;for(let e of n(r))h.push(r[e])};return this.clone().primaryKeys().then((n=>{const i=o=>{const h=Math.min(c,n.length-o);return a.getMany({trans:r,keys:n.slice(o,o+h),cache:"immutable"}).then((d=>{const f=[],y=[],m=l?[]:null,b=[];for(let e=0;e<h;++e){const t=d[e],r={value:O(t),primKey:n[o+e]};!1!==s.call(r,r.value,r)&&(null==r.value?b.push(n[o+e]):l||0===Lt(u(t),u(r.value))?(y.push(r.value),l&&m.push(n[o+e])):(b.push(n[o+e]),f.push(r.value)))}const v=Tt(t)&&t.limit===1/0&&("function"!=typeof e||e===Yt)&&{index:t.index,range:t.range};return Promise.resolve(f.length>0&&a.mutate({trans:r,type:"add",values:f}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(f.length,e)}))).then((()=>(y.length>0||v&&"object"==typeof e)&&a.mutate({trans:r,type:"put",keys:m,values:y,criteria:v,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(b.length>0||v&&e===Yt)&&a.mutate({trans:r,type:"delete",keys:b,criteria:v}).then((e=>p(b.length,e))))).then((()=>n.length>o+h&&i(o+c)))}))};return i(0).then((()=>{if(h.length>0)throw new H("Error modifying one or more objects",h,d,f);return n.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Tt(e)&&(e.isPrimKey&&!Et||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,s=t;return e.table.core.count({trans:n,query:{index:r,range:s}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then((({failures:e,lastResult:n,results:r,numFailures:s})=>{if(s)throw new H("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(Yt)}}const Yt=(e,t)=>t.value=null;function zt(e,t){return e<t?-1:e===t?0:1}function Ht(e,t){return e>t?-1:e===t?0:1}function Gt(e,t,n){var r=e instanceof tn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Qt(e){return new e.Collection(e,(()=>en(""))).limit(0)}function Xt(e,t,n,r,s,i){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return s(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):s(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;s(e[l],u)<0&&(a=l)}return o<r.length&&"next"===i?e+n.substr(e.length):o<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Jt(e,t,n,r){var s,i,o,a,l,u,c,h=n.length;if(!n.every((e=>"string"==typeof e)))return Gt(e,wt);function d(e){s=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),o="next"===e?zt:Ht;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return o(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),l=t.map((function(e){return e.lower})),u=e,c="next"===e?"":r}d("next");var f=new e.Collection(e,(()=>Zt(a[0],l[h-1]+r)));f._ondirectionchange=function(e){d(e)};var p=0;return f._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var d=i(s);if(t(d,l,p))return!0;for(var f=null,y=p;y<h;++y){var m=Xt(s,d,a[y],l[y],o,u);null===m&&null===f?p=y+1:(null===f||o(f,m)>0)&&(f=m)}return n(null!==f?function(){e.continue(f+c)}:r),!1})),f}function Zt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function en(e){return{type:1,lower:e,upper:e}}class tn{get Collection(){return this._ctx.table.db.Collection}between(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)?Qt(this):new this.Collection(this,(()=>Zt(e,t,!n,!r)))}catch(e){return Gt(this,gt)}}equals(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>en(e)))}above(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(e,void 0,!0)))}aboveOrEqual(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(e,void 0,!1)))}below(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Gt(this,gt):new this.Collection(this,(()=>Zt(void 0,e)))}startsWith(e){return"string"!=typeof e?Gt(this,wt):this.between(e,e+bt,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):Jt(this,((e,t)=>0===e.indexOf(t[0])),[e],bt)}equalsIgnoreCase(e){return Jt(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,bt)}anyOf(){const e=T.apply(I,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Gt(this,gt)}if(0===e.length)return Qt(this);const n=new this.Collection(this,(()=>Zt(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,s,i)=>{const o=n.key;for(;t(o,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(o,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[vt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=T.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Gt(this,gt)}const t=e.reduce(((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[vt,t]]),null);return t.push([e[e.length-1],this.db._maxKey]),this.inAnyRange(t,{includeLowers:!1,includeUppers:!1})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,s=this._descending,i=this._min,o=this._max;if(0===e.length)return Qt(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Gt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);const a=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers;let u,c=r;function h(e,t){return c(e[0],t[0])}try{u=e.reduce((function(e,t){let r=0,s=e.length;for(;r<s;++r){const s=e[r];if(n(t[0],s[1])<0&&n(t[1],s[0])>0){s[0]=i(s[0],t[0]),s[1]=o(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),u.sort(h)}catch(e){return Gt(this,gt)}let d=0;const f=l?e=>r(e,u[d][1])>0:e=>r(e,u[d][1])>=0,p=a?e=>s(e,u[d][0])>0:e=>s(e,u[d][0])>=0;let y=f;const m=new this.Collection(this,(()=>Zt(u[0][0],u[u.length-1][1],!a,!l)));return m._ondirectionchange=e=>{"next"===e?(y=f,c=r):(y=p,c=s),u.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++d,d===u.length)return t(n),!1;return!!function(e){return!f(e)&&!p(e)}(s)||(0===this._cmp(s,u[d][1])||0===this._cmp(s,u[d][0])||t((()=>{c===r?e.continue(u[d][0]):e.continue(u[d][1])})),!1)})),m}startsWithAnyOf(){const e=T.apply(I,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Qt(this):this.inAnyRange(e.map((e=>[e,e+bt]))):Gt(this,"startsWithAnyOf() only works with strings")}}function nn(e){return ze((function(t){return rn(t),e(t.target.error),!1}))}function rn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const sn="storagemutated",on="x-storagemutated-1",an=Dt(null,sn);class ln{_lock(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this}_unlock(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Oe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new J.DatabaseClosed(n);case"MissingAPIError":throw new J.MissingAPI(n.message,n);default:throw new J.OpenFailed(n)}if(!this.active)throw new J.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ze((t=>{rn(t),this._reject(e.error)})),e.onabort=ze((t=>{rn(t),this.active&&this._reject(new J.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=ze((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&an.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return pt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return pt(new J.TransactionInactive);if(this._locked())return new Be(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Oe])}));if(n)return et((()=>{var e=new Be(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new Be(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=Be.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>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 s=t._waitingFor;return new Be(((e,r)=>{n.then((n=>t._waitingQueue.push(ze(e.bind(null,n)))),(e=>t._waitingQueue.push(ze(r.bind(null,e))))).finally((()=>{t._waitingFor===s&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(a(t,e))return t[e];const n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function un(e,t,n,r,s,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+cn(t)}}function cn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function hn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:g(n,(e=>[e.name,e]))}}let dn=e=>{try{return e.only([[]]),dn=()=>[[]],[[]]}catch(e){return dn=()=>bt,bt}};function fn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>w(t,e)}(e):t=>w(t,e)}function pn(e){return[].slice.call(e)}let yn=0;function mn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function bn(e,t,n){function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:s,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!s):t.bound(n,r,!!s,!!i)}const{schema:i,hasGetAll:o}=function(e,t){const n=pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,s=r(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:s,keyPath:t,autoIncrement:n,unique:!0,extractKey:fn(t)},indexes:pn(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:s,keyPath:i}=e,a={name:t,compound:r(i),keyPath:i,unique:n,multiEntry:s,extractKey:fn(i)};return o[mn(i)]=a,a})),getIndexByKeyPath:e=>o[mn(e)]};return o[":id"]=a.primaryKey,null!=t&&(o[mn(t)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,n),a=i.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:r,values:i,range:o}){return new Promise(((a,l)=>{a=ze(a);const u=e.objectStore(t),c=null==u.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:d}=r||i||{length:1};if(r&&i&&r.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let f;const p=[],y=[];let m=0;const b=e=>{++m,rn(e)};if("deleteRange"===n){if(4===o.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===o.type?p.push(f=u.clear()):p.push(f=u.delete(s(o)))}else{const[e,t]=h?c?[i,r]:[i,null]:[r,null];if(h)for(let r=0;r<d;++r)p.push(f=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),f.onerror=b;else for(let t=0;t<d;++t)p.push(f=u[n](e[t])),f.onerror=b}const v=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?r:p.map((e=>e.result)),lastResult:t})};f.onerror=e=>{b(e),v(e)},f.onsuccess=v}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t),o=n.length,a=new Array(o);let l,u=0,c=0;const h=e=>{const t=e.target;a[t._pos]=t.result,++c===u&&r(a)},d=nn(s);for(let e=0;e<o;++e)null!=n[e]&&(l=i.get(n[e]),l._pos=e,l.onsuccess=h,l.onerror=d,++u);0===u&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=nn(s)})),query:function(e){return n=>new Promise(((r,i)=>{r=ze(r);const{trans:o,values:a,limit:l,query:u}=n,c=l===1/0?void 0:l,{index:h,range:d}=u,f=o.objectStore(t),p=h.isPrimaryKey?f:f.index(h.name),y=s(d);if(0===l)return r({result:[]});if(e){const e=a?p.getAll(y,c):p.getAllKeys(y,c);e.onsuccess=e=>r({result:e.target.result}),e.onerror=nn(i)}else{let e=0;const t=a||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=s=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===l?r({result:n}):void i.continue()):r({result:n})},t.onerror=nn(i)}}))}(o),openCursor:function({trans:e,values:n,query:r,reverse:i,unique:o}){return new Promise(((a,l)=>{a=ze(a);const{index:u,range:c}=r,h=e.objectStore(t),d=u.isPrimaryKey?h:h.index(u.name),f=i?o?"prevunique":"prev":o?"nextunique":"next",p=n||!("openKeyCursor"in d)?d.openCursor(s(c),f):d.openKeyCursor(s(c),f);p.onerror=nn(l),p.onsuccess=ze((t=>{const n=p.result;if(!n)return void a(null);n.___id=++yn,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),o=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=ze(l),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=ze(e),p.onerror=nn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=o,e(t)}})),a=()=>{if(p.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return p.onsuccess=ze((e=>{p.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,a(),t},a(n)}),l)}))},count({query:e,trans:n}){const{index:r,range:i}=e;return new Promise(((e,o)=>{const a=n.objectStore(t),l=r.isPrimaryKey?a:a.index(r.name),u=s(i),c=u?l.count(u):l.count();c.onsuccess=ze((t=>e(t.target.result))),c.onerror=nn(o)}))}}}(e))),l={};return a.forEach((e=>l[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw new Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:dn(t),schema:i}}function vn({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},s){const i=function(e,t){return t.reduce(((e,{create:t})=>({...e,...t(e)})),e)}(bn(t,n,s),e.dbcore);return{dbcore:i}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function gn({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=f(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?c(t,n,{get(){return this.table(n)},set(e){u(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function wn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function _n(e,t){return e._cfg.version-t._cfg.version}function xn(e,t,r,s){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(s);const a=o._reject.bind(o),l=Oe.transless||Oe;et((()=>{Oe.trans=o,Oe.transless=l,0===t?(n(i).forEach((e=>{En(r,e,i[e].primKey,i[e].indexes)})),vn(e,r),Be.follow((()=>e.on.populate.fire(o))).catch(a)):function({_novip:e},t,r,s){const i=[],o=e._versions;let a=e._dbSchema=Sn(e,e.idbdb,s),l=!1;const u=o.filter((e=>e._cfg.version>=t));return u.forEach((o=>{i.push((()=>{const i=a,u=o._cfg.dbschema;Kn(e,i,s),Kn(e,u,s),a=e._dbSchema=u;const c=kn(i,u);c.add.forEach((e=>{En(s,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");{const t=s.objectStore(e.name);e.add.forEach((e=>Pn(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Pn(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const h=o._cfg.contentUpgrade;if(h&&o._cfg.version>t){vn(e,s),r._memoizedTables={},l=!0;let t=x(u);c.del.forEach((e=>{t[e]=i[e]})),wn(e,[e.Transaction.prototype]),gn(e,[e.Transaction.prototype],n(t),t),r.schema=t;const o=R(h);let a;o&&tt();const d=Be.follow((()=>{if(a=h(r),a&&o){var e=nt.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Be.resolve(a):d.then((()=>a))}})),i.push((t=>{l&&kt||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(o._cfg.dbschema,t),wn(e,[e.Transaction.prototype]),gn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),r.schema=e._dbSchema}))})),function e(){return i.length?Be.resolve(i.shift()(r.idbtrans)).then(e):Be.resolve()}().then((()=>{var e,t;t=s,n(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||En(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,o,r).catch(a)}))}function kn(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const s=e[r],i=t[r];if(s){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!xt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let o;for(o in t)r[o]||e.del.push(o);for(o in r){const n=t[o],s=r[o];n?n.src!==s.src&&e.change.push(s):e.add.push(s)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function En(e,t,n,r){const s=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Pn(s,e))),s}function Pn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sn(e,t,n){const r={};return y(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=un(cn(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var a=un(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(a)}r[e]=hn(e,i,o)})),r}function Kn({_novip:e},n,r){const s=r.db.objectStoreNames;for(let t=0;t<s.length;++t){const i=s[t],o=r.objectStore(i);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){const t=o.indexNames[e],r=o.index(t).keyPath,s="string"==typeof r?r:"["+y(r).join("+")+"]";if(n[i]){const e=n[i].idxByName[s];e&&(e.name=t,delete n[i].idxByName[s],n[i].idxByName[t]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class On{_parseStoresSpec(e,t){n(e).forEach((n=>{if(null!==e[n]){var s=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),s=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return un(n,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),r(s),0===t)})),i=s.shift();if(i.multi)throw new J.Schema("Primary key cannot be multi-valued");s.forEach((e=>{if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")})),t[n]=hn(n,i,s)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;const r=t._versions,i={};let o={};return r.forEach((e=>{s(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)})),t._dbSchema=o,wn(t,[t._allTables,t,t.Transaction.prototype]),gn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],n(o),o),t._storeNames=n(o),this}upgrade(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||te,e),this}}function Cn(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qn(St,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function An(e){return e&&"function"==typeof e.databases}function jn(e){return et((function(){return Oe.letThrough=!0,e()}))}function Bn(){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 Dn(e){var t=t=>e.next(t),n=i(t),s=i((t=>e.throw(t)));function i(e){return t=>{var i=e(t),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,s):r(o)?Promise.all(o).then(n,s):n(o)}}return i(t)()}function In(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[e,E(s),n]}function Tn(e,t,n,r,s){return Be.resolve().then((()=>{const i=Oe.transless||Oe,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Tn(e,t,n,null,s)))):pt(r)}const l=R(s);let u;l&&tt();const c=Be.follow((()=>{if(u=s.call(o,o),u)if(l){var e=nt.bind(null,null);u.then(e,e)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Dn(u))}),a);return(u&&"function"==typeof u.then?Be.resolve(u).then((e=>o.active?e:pt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):c.then((()=>u))).then((e=>(r&&o._resolve(),o._completion.then((()=>e))))).catch((e=>(o._reject(e),pt(e))))}))}function Rn(e,t,n){const s=r(e)?e.slice():[e];for(let e=0;e<n;++e)s.push(t);return s}const Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function o(e,t,n){const r=mn(e),a=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,u=t>0,c={...n,isVirtual:u,keyTail:t,keyLength:l,extractKey:fn(e),unique:!u&&n.unique};return a.push(c),c.isPrimaryKey||i.push(c),l>1&&o(2===l?e[0]:e.slice(0,l-1),t+1,n),a.sort(((e,t)=>e.keyTail-t.keyTail)),c}const a=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[a];for(const e of r.indexes)o(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?{...t,query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const u={...n,schema:{...r,primaryKey:a,indexes:i,getIndexByKeyPath:function(e){const t=s[mn(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;return s?n.openCursor(l(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Rn(s,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,s){n.continuePrimaryKey(Rn(t,e.MAX_KEY,r),s)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return s}(n))):n.openCursor(t)}};return u}}}};function Nn(e,t,r,s){return r=r||{},s=s||"",n(e).forEach((n=>{if(a(t,n)){var i=e[n],o=t[n];if("object"==typeof i&&"object"==typeof o&&i&&o){const e=j(i);e!==j(o)?r[s+n]=t[n]:"Object"===e?Nn(i,o,r,s+n+"."):i!==o&&(r[s+n]=t[n])}else i!==o&&(r[s+n]=t[n])}else r[s+n]=void 0})),n(t).forEach((n=>{a(e,n)||(r[s+n]=t[n])})),r}const Fn={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema,s={...n,mutate(e){const s=Oe.trans,{deleting:i,creating:o,updating:l}=s.table(t).hook;switch(e.type){case"add":if(o.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(o.fire===te&&l.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===te)break;return s._promise("readwrite",(()=>function(e){return c(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function u(e){const t=Oe.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:s}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((u=>{const c=s.map(((n,s)=>{const c=u[s],h={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(h,n,c,t);else if("add"===e.type||void 0===c){const i=o.fire.call(h,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||_(e.values[s],r.keyPath,n))}else{const r=Nn(c,e.values[s]),i=l.fire.call(h,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{a(t,e)?t[e]=i[e]:_(t,e,i[e])}))}}return h}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:i})=>{for(let r=0;r<s.length;++r){const i=n?n[r]:s[r],o=c[r];null==i?o.onerror&&o.onerror(t[r]):o.onsuccess&&o.onsuccess("put"===e.type&&u[r]?e.values[r]:i)}return{failures:t,results:n,numFailures:r,lastResult:i}})).catch((e=>(c.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function c(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>u({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:c(e,{...t,lower:n[n.length-1],lowerOpen:!0},s)))))}}};return s}})};function qn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let s=0,i=0;s<t.keys.length&&i<e.length;++s)0===Lt(t.keys[s],e[i])&&(r.push(n?O(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const $n={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);const t=qn(e.keys,e.trans._cache,"clone"===e.cache);return t?Be.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?O(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Ln(e){return!("from"in e)}const Un=function(e,t){if(!this){const t=new Un;return e&&"d"in e&&s(t,e),t}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Vn(e,t,n){const r=Lt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ln(e))return s(e,{from:t,to:n,d:1});const i=e.l,o=e.r;if(Lt(n,e.from)<0)return i?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},zn(e);if(Lt(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},zn(e);Lt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Lt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wn(e,i),o&&a&&Wn(e,o)}function Wn(e,t){Ln(t)||function e(t,{from:n,to:r,l:s,r:i}){Vn(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function Yn(e){let t=Ln(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Lt(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||Lt(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 zn(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const t="r"===s?"l":"r",n={...e},r=e[s];e.from=r.from,e.to=r.to,e[s]=r[s],n[s]=r[t],e[t]=n,n.d=Hn(n)}e.d=Hn(e)}function Hn({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l(Un.prototype,{add(e){return Wn(this,e),this},addKey(e){return Vn(this,e,e),this},addKeys(e){return e.forEach((e=>Vn(this,e,e))),this},[B](){return Yn(this)}});const Gn={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,s=new Un(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{const o=e.table(i),{schema:a}=o,{primaryKey:l}=a,{extractKey:u,outbound:c}=l,h={...o,mutate:e=>{const n=e.trans,l=n.mutatedParts||(n.mutatedParts={}),u=e=>{const n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Un)},c=u(""),h=u(":dels"),{type:d}=e;let[f,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return o.mutate(e).then((e=>{if(r(f)){"delete"!==d&&(f=e.results),c.addKeys(f);const t=qn(f,y);t||"add"===d||h.addKeys(f),(t||p)&&function(e,t,n,s){t.indexes.forEach((function(t){const i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&r(e)?e.forEach((e=>i.addKey(e))):i.addKey(e);(n||s).forEach(((e,t)=>{const r=n&&o(n[t]),i=s&&o(s[t]);0!==Lt(r,i)&&(null!=r&&a(r),null!=i&&a(i))}))}))}(u,a,t,p)}else if(f){const e={from:f.lower,to:f.upper};h.add(e),c.add(e)}else c.add(s),h.add(s),a.indexes.forEach((e=>u(e.name).add(s)));return e}))}},d=({query:{index:t,range:n}})=>{var r,s;return[t,new Un(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},f={get:e=>[l,new Un(e.key)],getMany:e=>[l,(new Un).addKeys(e.keys)],count:d,query:d,openCursor:d};return n(f).forEach((e=>{h[e]=function(n){const{subscr:r}=Oe;if(r){const a=e=>{const n=`idb://${t}/${i}/${e}`;return r[n]||(r[n]=new Un)},l=a(""),h=a(":dels"),[d,p]=f[e](n);if(a(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&c&&n.values&&o.query({...n,values:!1});return o[e].apply(this,arguments).then((r=>{if("query"===e){if(c&&n.values)return t.then((({result:e})=>(l.addKeys(e),r)));const e=n.values?r.result.map(u):r.result;n.values?l.addKeys(e):h.addKeys(e)}else if("openCursor"===e){const e=r,t=n.values;return e&&Object.create(e,{key:{get:()=>(h.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return h.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return r}))}h.add(s)}}return o[e].apply(this,arguments)}})),h}}}};class Qn{constructor(e,t){this._middlewares={},this.verno=0;const n=Qn.dependencies;this._options=t={addons:Qn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:te,dbReadyPromise:null,cancelOpen:te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new Be((e=>{s.dbReadyResolve=e})),s.openCanceller=new Be(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=Dt(this,"populate","blocked","versionchange","close",{ready:[ue,te]}),this.on.ready.subscribe=m(this.on.ready.subscribe,(e=>(t,n)=>{Qn.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Be.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);const r=this;n||e((function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))}}))})),this.Collection=(i=this,It(Wt.prototype,(function(e,t){this.db=i;let n=At,r=null;if(t)try{n=t()}catch(e){r=e}const s=e._ctx,o=s.table,a=o.hook.reading.fire;this._ctx={table:o,index:s.index,isPrimKey:!s.index||o.schema.primKey.keyPath&&s.index===o.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:s.or,valueMapper:a!==ne?a:null}}))),this.Table=function(e){return It(Bt.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:Dt(null,{creating:[ie,te],reading:[re,ne],updating:[ae,te],deleting:[oe,te]})}))}(this),this.Transaction=function(e){return It(ln.prototype,(function(t,n,r,s,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Dt(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Be(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),pt(e)}))}))}(this),this.Version=function(e){return It(On.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return It(tn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const s=e._deps.indexedDB;if(!s)throw new J.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(e,t)=>s.cmp(t,e),this._max=(e,t)=>s.cmp(e,t)>0?e:t,this._min=(e,t)=>s.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=dn(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),_t.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Mn),this.use(Fn),this.use(Gn),this.use($n),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new J.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(_n),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new Be(((e,t)=>{if(this._state.openComplete)return t(new J.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new J.DatabaseClosed);this.open().catch(te)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:t,level:null==n?10:n,name:r}),s.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?pt(t.dbOpenError):e));M&&(t.openCanceller._stackHolder=$()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const s=t.openCanceller;function i(){if(t.openCanceller!==s)throw new J.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,l=!1;return Be.race([s,("undefined"==typeof navigator?Be.resolve():Bn()).then((()=>new Be(((s,o)=>{if(i(),!r)throw new J.MissingAPI;const u=e.name,c=t.autoSchema?r.open(u):r.open(u,Math.round(10*e.verno));if(!c)throw new J.MissingAPI;c.onerror=nn(o),c.onblocked=ze(e._fireOnBlocked),c.onupgradeneeded=ze((n=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();const e=r.deleteDatabase(u);e.onsuccess=e.onerror=ze((()=>{o(new J.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=nn(o);var s=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;l=s<1,e._novip.idbdb=c.result,xn(e,s/10,a,o)}}),o),c.onsuccess=ze((()=>{a=null;const r=e._novip.idbdb=c.result,i=y(r.objectStoreNames);if(i.length>0)try{const s=r.transaction(1===(o=i).length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},t,r){e.verno=t.version/10;const s=e._dbSchema=Sn(0,t,r);e._storeNames=y(t.objectStoreNames,0),gn(e,[e._allTables],n(s),s)}(e,r,s):(Kn(e,e._dbSchema,s),function(e,t){const n=kn(Sn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),vn(e,s)}catch(e){}var o;_t.push(e),r.onversionchange=ze((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),r.onclose=ze((t=>{e.on("close").fire(t)})),l&&function({indexedDB:e,IDBKeyRange:t},n){!An(e)&&n!==St&&Cn(e,t).put({name:n}).catch(te)}(e._deps,u),s()}),o)}))))]).then((()=>(i(),t.onReadyBeingFired=[],Be.resolve(jn((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ue,te);return t.onReadyBeingFired=[],Be.resolve(jn((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{a&&a.abort()}catch(e){}return s===t.openCanceller&&e._close(),pt(n)})).finally((()=>{t.openComplete=!0,o()}))}(this)}_close(){const e=this._state,t=_t.indexOf(this);if(t>=0&&_t.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Be((t=>{e.dbReadyResolve=t})),e.openCanceller=new Be(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Be(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=ze((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!An(e)&&n!==St&&Cn(e,t).delete(n).catch(te)}(this._deps,this.name),n()})),e.onerror=nn(r),e.onblocked=this._fireOnBlocked};if(e)throw new J.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(s):s()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return n(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=In.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Oe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,o;e=e.replace("!","").replace("?","");try{if(o=t.map((e=>{var t=e instanceof this.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===Kt)i=Kt;else{if("rw"!=e&&e!=Ot)throw new J.InvalidArgument("Invalid transaction mode: "+e);i=Ot}if(r){if(r.mode===Kt&&i===Ot){if(!s)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),s&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):pt(e)}const a=Tn.bind(null,this,i,o,r,n);return r?r._promise(i,a,"lock"):Oe.trans?lt(Oe.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!a(this._allTables,e))throw new J.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Xn="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Jn{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[Xn](){return this}}function Zn(e,t){return n(t).forEach((n=>{Wn(e[n]||(e[n]=new Un),t[n])})),e}let er;try{er={indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(t){er={indexedDB:null,IDBKeyRange:null}}const tr=Qn;function nr(e){let t=rr;try{rr=!0,an.storagemutated.fire(e)}finally{rr=t}}l(tr,{...ee,delete:e=>new tr(e,{addons:[]}).delete(),exists:e=>new tr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return An(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==St)))):Cn(e,t).toCollection().primaryKeys()}(tr.dependencies).then(e)}catch(e){return pt(new J.MissingAPI)}},defineClass:()=>function(e){s(this,e)},ignoreTransaction:e=>Oe.trans?lt(Oe.transless,e):e(),vip:jn,async:function(e){return function(){try{var t=Dn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Be.resolve(t)}catch(e){return pt(e)}}},spawn:function(e,t,n){try{var r=Dn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Be.resolve(r)}catch(e){return pt(e)}},currentTransaction:{get:()=>Oe.trans||null},waitFor:function(e,t){const n=Be.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Be,debug:{get:()=>M,set:e=>{N(e,"dexie"===e?()=>!0:Pt)}},derive:h,extend:s,props:l,override:m,Events:Dt,on:an,liveQuery:function(e){let t,r=!1;const s=new Jn((s=>{const i=R(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,an.storagemutated.unsubscribe(f)}};s.start&&s.start(u);let c=!1,h=!1;function d(){return n(l).some((e=>a[e]&&function(e,t){const n=Yn(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=Yn(e);let o=i.next(s.from),a=o.value;for(;!r.done&&!o.done;){if(Lt(a.from,s.to)<=0&&Lt(a.to,s.from)>=0)return!0;Lt(s.from,a.from)<0?s=(r=n.next(a.from)).value:a=(o=i.next(s.from)).value}return!1}(a[e],l[e])))}const f=e=>{Zn(a,e),d()&&p()},p=()=>{if(c||o)return;a={};const n={},y=function(t){i&&tt();const n=()=>et(e,{subscr:t,trans:null}),r=Oe.trans?lt(Oe.transless,n):n();return i&&r.then(nt,nt),r}(n);h||(an(sn,f),h=!0),c=!0,Promise.resolve(y).then((e=>{r=!0,t=e,c=!1,o||(d()?p():(a={},l=n,s.next&&s.next(e)))}),(e=>{c=!1,r=!1,s.error&&s.error(e),u.unsubscribe()}))};return p(),u}));return s.hasValue=()=>r,s.getValue=()=>t,s},extendObservabilitySet:Zn,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,(function(t){_(e,t,void 0)}))},shallowClone:x,deepClone:O,getObjectDiff:Nn,cmp:Lt,asap:v,minKey:vt,addons:[],connections:_t,errnames:Q,dependencies:er,semVer:mt,version:mt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),tr.maxKey=dn(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(an(sn,(e=>{if(!rr){let t;xt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(on,!0,!0,e)):t=new CustomEvent(on,{detail:e}),rr=!0,dispatchEvent(t),rr=!1}})),addEventListener(on,(({detail:e})=>{rr||nr(e)})));let rr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(on);"function"==typeof e.unref&&e.unref(),an(sn,(t=>{rr||e.postMessage(t)})),e.onmessage=e=>{e.data&&nr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){an(sn,(e=>{try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(on,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:on,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===on){const t=JSON.parse(e.newValue);t&&nr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===on&&nr(e.changedParts)}))}Be.rejectionMapper=function(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Z[e.name])return e;var n=new Z[e.name](t||e.message,e);return"stack"in e&&c(n,"stack",{get:function(){return this.inner.stack}}),n},N(M,Pt);class sr{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new Qn(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"name";const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new Qn(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){const e=await new Qn(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}));return e}}var ir=window.wp.apiFetch,or=e.n(ir);async function ar(e,t){try{await or().use(or().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await or()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await ar(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function lr(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):cr(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function ur(e,t){let n,r;if(e||cr(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function cr(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}var hr=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new sr("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&ar(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,hr.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,hr.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,hr.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,hr.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,hr.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,hr.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,hr.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,hr.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&lr(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&ur(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))}();
     7 */(()=>{"use strict";var e={};e.n=t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,n=Object.keys,r=Array.isArray;function s(e,t){return"object"!=typeof t||n(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||t.Promise||(t.Promise=Promise);const i=Object.getPrototypeOf,o={}.hasOwnProperty;function a(e,t){return o.call(e,t)}function l(e,t){"function"==typeof t&&(t=t(i(e))),("undefined"==typeof Reflect?n:Reflect.ownKeys)(t).forEach((n=>{c(e,n,t[n])}))}const u=Object.defineProperty;function c(e,t,n,r){u(e,t,s(n&&a(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function h(e){return{from:function(t){return e.prototype=Object.create(t.prototype),c(e.prototype,"constructor",e),{extend:l.bind(null,e.prototype)}}}}const d=Object.getOwnPropertyDescriptor;function f(e,t){let n;return d(e,t)||(n=i(e))&&f(n,t)}const p=[].slice;function y(e,t,n){return p.call(e,t,n)}function m(e,t){return t(e)}function b(e){if(!e)throw new Error("Assertion Failed")}function g(e){t.setImmediate?setImmediate(e):setTimeout(e,0)}function v(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function w(e,t){if("string"==typeof t&&a(e,t))return e[t];if(!t)return e;if("string"!=typeof t){for(var n=[],r=0,s=t.length;r<s;++r){var i=w(e,t[r]);n.push(i)}return n}var o=t.indexOf(".");if(-1!==o){var l=e[t.substr(0,o)];return void 0===l?void 0:w(l,t.substr(o+1))}}function _(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){b("string"!=typeof n&&"length"in n);for(var s=0,i=t.length;s<i;++s)_(e,t[s],n[s])}else{var o=t.indexOf(".");if(-1!==o){var l=t.substr(0,o),u=t.substr(o+1);if(""===u)void 0===n?r(e)&&!isNaN(parseInt(l))?e.splice(l,1):delete e[l]:e[l]=n;else{var c=e[l];c&&a(e,l)||(c=e[l]={}),_(c,u,n)}}else void 0===n?r(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function x(e){var t={};for(var n in e)a(e,n)&&(t[n]=e[n]);return t}const k=[].concat;function E(e){return k.apply([],e)}const P="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(E([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>t[e])),S=P.map((e=>t[e]));v(P,(e=>[e,!0]));let K=null;function O(e){K="undefined"!=typeof WeakMap&&new WeakMap;const t=A(e);return K=null,t}function A(e){if(!e||"object"!=typeof e)return e;let t=K&&K.get(e);if(t)return t;if(r(e)){t=[],K&&K.set(e,t);for(var n=0,s=e.length;n<s;++n)t.push(A(e[n]))}else if(S.indexOf(e.constructor)>=0)t=e;else{const n=i(e);for(var o in t=n===Object.prototype?{}:Object.create(n),K&&K.set(e,t),e)a(e,o)&&(t[o]=A(e[o]))}return t}const{toString:C}={};function j(e){return C.call(e).slice(8,-1)}const B="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",D="symbol"==typeof B?function(e){var t;return null!=e&&(t=e[B])&&t.apply(e)}:function(){return null},I={};function T(e){var t,n,s,i;if(1===arguments.length){if(r(e))return e.slice();if(this===I&&"string"==typeof e)return[e];if(i=D(e)){for(n=[];!(s=i.next()).done;)n.push(s.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}const R="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var M="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function F(e,t){M=e,N=t}var N=()=>!0;const q=!new Error("").stack;function $(){if(q)try{throw $.arguments,new Error}catch(e){return e}return new Error}function L(e,t){var n=e.stack;return n?(t=t||0,0===n.indexOf(e.name)&&(t+=(e.name+e.message).split("\n").length),n.split("\n").slice(t).filter(N).map((e=>"\n"+e)).join("")):""}var U=["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(U),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._e=$(),this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function H(e,t,n,r){this._e=$(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function G(e,t){this._e=$(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=z(e,t)}h(Y).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+L(this._e,2))}},toString:function(){return this.name+": "+this.message}}),h(H).from(Y),h(G).from(Y);var Q=V.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const X=Y;var J=V.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=$(),this.name=n,e?"string"==typeof e?(this.message=`${e}${r?"\n "+r:""}`,this.inner=r||null):"object"==typeof e&&(this.message=`${e.name} ${e.message}`,this.inner=e):(this.message=W[t]||n,this.inner=null)}return h(r).from(X),e[t]=r,e}),{});J.Syntax=SyntaxError,J.Type=TypeError,J.Range=RangeError;var Z=U.reduce(((e,t)=>(e[t+"Error"]=J[t],e)),{}),ee=V.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=J[t]),e)),{});function te(){}function ne(e){return e}function re(e,t){return null==e||e===ne?t:function(n){return t(e(n))}}function se(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function ie(e,t){return e===te?t:function(){var n=e.apply(this,arguments);void 0!==n&&(arguments[0]=n);var r=this.onsuccess,s=this.onerror;this.onsuccess=null,this.onerror=null;var i=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?se(r,this.onsuccess):r),s&&(this.onerror=this.onerror?se(s,this.onerror):s),void 0!==i?i:n}}function oe(e,t){return e===te?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?se(n,this.onsuccess):n),r&&(this.onerror=this.onerror?se(r,this.onerror):r)}}function ae(e,t){return e===te?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?se(i,this.onsuccess):i),o&&(this.onerror=this.onerror?se(o,this.onerror):o),void 0===r?void 0===a?void 0:a:s(r,a)}}function le(e,t){return e===te?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function ue(e,t){return e===te?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,s=arguments.length,i=new Array(s);s--;)i[s]=arguments[s];return n.then((function(){return t.apply(r,i)}))}return t.apply(this,arguments)}}ee.ModifyError=H,ee.DexieError=Y,ee.BulkError=G;var ce={};const he=100,[de,fe,pe]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,i(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,i(t),e]})(),ye=fe&&fe.then,me=de&&de.constructor,be=!!pe;var ge=!1,ve=pe?()=>{pe.then(Le)}:t.setImmediate?setImmediate.bind(null,Le):t.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Le(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Le,0)},we=function(e,t){Ae.push([e,t]),xe&&(ve(),xe=!1)},_e=!0,xe=!0,ke=[],Ee=[],Pe=null,Se=ne,Ke={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ft,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{ft(e[0],e[1])}catch(e){}}))}},Oe=Ke,Ae=[],Ce=0,je=[];function Be(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=te,this._lib=!1;var t=this._PSD=Oe;if(M&&(this._stackHolder=$(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==ce)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&Re(this,this._value))}this._state=null,this._value=null,++t.ref,Te(this,e)}const De={get:function(){var e=Oe,t=Je;function n(n,r){var s=!e.global&&(e!==Oe||t!==Je);const i=s&&!nt();var o=new Be(((t,o)=>{Fe(this,new Ie(ct(n,e,s,i),ct(r,e,s,i),t,o,e))}));return M&&$e(o,this),o}return n.prototype=ce,n},set:function(e){c(this,"then",e&&e.prototype===ce?De:{get:function(){return e},set:De.set})}};function Ie(e,t,n,r,s){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=s}function Te(e,t){try{t((t=>{if(null===e._state){if(t===e)throw new TypeError("A promise cannot be resolved with itself.");var n=e._lib&&Ue();t&&"function"==typeof t.then?Te(e,((e,n)=>{t instanceof Be?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Me(e)),n&&Ve()}}),Re.bind(null,e))}catch(t){Re(e,t)}}function Re(e,t){if(Ee.push(t),null===e._state){var n=e._lib&&Ue();t=Se(t),e._state=!1,e._value=t,M&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,void 0)}catch(e){}}((()=>{var n=f(t,"stack");t._promise=e,c(t,"stack",{get:()=>ge?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){ke.some((t=>t._value===e._value))||ke.push(e)}(e),Me(e),n&&Ve()}}function Me(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Fe(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Ce&&(++Ce,we((()=>{0==--Ce&&We()}),[]))}function Fe(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,++Ce,we(Ne,[n,e,t])}else e._listeners.push(t)}function Ne(e,t,n){try{Pe=t;var r,s=t._value;t._state?r=e(s):(Ee.length&&(Ee=[]),r=e(s),-1===Ee.indexOf(s)&&function(e){for(var t=ke.length;t;)if(ke[--t]._value===e._value)return void ke.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Pe=null,0==--Ce&&We(),--n.psd.ref||n.psd.finalize()}}function qe(e,t,n){if(t.length===n)return t;var r="";if(!1===e._state){var s,i,o=e._value;null!=o?(s=o.name||"Error",i=o.message||o,r=L(o,0)):(s=o,i=""),t.push(s+(i?": "+i:"")+r)}return M&&((r=L(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&qe(e._prev,t,n)),t}function $e(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Le(){Ue()&&Ve()}function Ue(){var e=_e;return _e=!1,xe=!1,e}function Ve(){var e,t,n;do{for(;Ae.length>0;)for(e=Ae,Ae=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(Ae.length>0);_e=!0,xe=!0}function We(){var e=ke;ke=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=je.slice(0),n=t.length;n;)t[--n]()}function Ye(e){return new Be(ce,!1,e)}function ze(e,t){var n=Oe;return function(){var r=Ue(),s=Oe;try{return ot(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{ot(s,!1),r&&Ve()}}}l(Be.prototype,{then:De,_then:function(e,t){Fe(this,new Ie(null,null,e,t,Oe))},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,(e=>e instanceof t?n(e):Ye(e))):this.then(null,(e=>e&&e.name===t?n(e):Ye(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),Ye(t))))},stack:{get:function(){if(this._stack)return this._stack;try{ge=!0;var e=qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{ge=!1}}},timeout:function(e,t){return e<1/0?new Be(((n,r)=>{var s=setTimeout((()=>r(new J.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&c(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Ke.env=at(),l(Be,{all:function(){var e=T.apply(null,arguments).map(rt);return new Be((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Be.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Be)return e;if(e&&"function"==typeof e.then)return new Be(((t,n)=>{e.then(t,n)}));var t=new Be(ce,!0,e);return $e(t,Pe),t},reject:Ye,race:function(){var e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{e.map((e=>Be.resolve(e).then(t,n)))}))},PSD:{get:()=>Oe,set:e=>Oe=e},totalEchoes:{get:()=>Je},newPSD:et,usePSD:lt,scheduler:{get:()=>we,set:e=>{we=e}},rejectionMapper:{get:()=>Se,set:e=>{Se=e}},follow:(e,t)=>new Be(((n,r)=>et(((t,n)=>{var r=Oe;r.unhandleds=[],r.onunhandled=n,r.finalize=se((function(){!function(e){je.push((function t(){e(),je.splice(je.indexOf(t),1)})),++Ce,we((()=>{0==--Ce&&We()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),me&&(me.allSettled&&c(Be,"allSettled",(function(){const e=T.apply(null,arguments).map(rt);return new Be((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Be.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),me.any&&"undefined"!=typeof AggregateError&&c(Be,"any",(function(){const e=T.apply(null,arguments).map(rt);return new Be(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Be.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const He={awaits:0,echoes:0,id:0};var Ge=0,Qe=[],Xe=0,Je=0,Ze=0;function et(e,t,n,r){var i=Oe,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ze;var a=Ke.env;o.env=be?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject,nthen:ht(a.nthen,o),gthen:ht(a.gthen,o)}:{},t&&s(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var l=lt(o,e,n,r);return 0===o.ref&&o.finalize(),l}function tt(){return He.id||(He.id=++Ge),++He.awaits,He.echoes+=he,He.id}function nt(){return!!He.awaits&&(0==--He.awaits&&(He.id=0),He.echoes=He.awaits*he,!0)}function rt(e){return He.echoes&&e&&e.constructor===me?(tt(),e.then((e=>(nt(),e)),(e=>(nt(),pt(e))))):e}function st(e){++Je,He.echoes&&0!=--He.echoes||(He.echoes=He.id=0),Qe.push(Oe),ot(e,!0)}function it(){var e=Qe[Qe.length-1];Qe.pop(),ot(e,!1)}function ot(e,n){var r=Oe;if((n?!He.echoes||Xe++&&e===Oe:!Xe||--Xe&&e===Oe)||ut(n?st.bind(null,e):it),e!==Oe&&(Oe=e,r===Ke&&(Ke.env=at()),be)){var s=Ke.env.Promise,i=e.env;fe.then=i.nthen,s.prototype.then=i.gthen,(r.global||e.global)&&(Object.defineProperty(t,"Promise",i.PromiseProp),s.all=i.all,s.race=i.race,s.resolve=i.resolve,s.reject=i.reject,i.allSettled&&(s.allSettled=i.allSettled),i.any&&(s.any=i.any))}}function at(){var e=t.Promise;return be?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(t,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:fe.then,gthen:e.prototype.then}:{}}function lt(e,t,n,r,s){var i=Oe;try{return ot(e,!0),t(n,r,s)}finally{ot(i,!1)}}function ut(e){ye.call(de,e)}function ct(e,t,n,r){return"function"!=typeof e?e:function(){var s=Oe;n&&tt(),ot(t,!0);try{return e.apply(this,arguments)}finally{ot(s,!1),r&&ut(nt)}}}function ht(e,t){return function(n,r){return e.call(this,ct(n,t),ct(r,t))}}-1===(""+ye).indexOf("[native code]")&&(tt=nt=te);const dt="unhandledrejection";function ft(e,n){var r;try{r=n.onuncatched(e)}catch(e){}if(!1!==r)try{var i,o={promise:n,reason:e};if(t.document&&document.createEvent?((i=document.createEvent("Event")).initEvent(dt,!0,!0),s(i,o)):t.CustomEvent&&s(i=new CustomEvent(dt,{detail:o}),o),i&&t.dispatchEvent&&(dispatchEvent(i),!t.PromiseRejectionEvent&&t.onunhandledrejection))try{t.onunhandledrejection(i)}catch(e){}M&&i&&!i.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var pt=Be.reject;function yt(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Oe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>yt(e,t,n,r)))):pt(s)}return s._promise(t,((e,t)=>et((()=>(Oe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return pt(new J.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return pt(new J.DatabaseClosed);e.open().catch(te)}return e._state.dbReadyPromise.then((()=>yt(e,t,n,r)))}const mt="3.2.5",bt=String.fromCharCode(65535),gt=-1/0,vt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",wt="String expected.",_t=[],xt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),kt=xt,Et=xt,Pt=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),St="__dbnames",Kt="readonly",Ot="readwrite";function At(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const Ct={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function jt(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=O(t))[e],t)}class Bt{_trans(e,t,n){const r=this._tx||Oe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new J.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const o=Ue();try{return r&&r.db===this.db?r===Oe.trans?r._promise(e,i,n):et((()=>r._promise(e,i,n)),{trans:r,transless:Oe.transless||Oe}):yt(this.db,e,[this.name],i)}finally{o&&Ve()}}get(e,t){return e&&e.constructor===Object?this.where(e).first(t):this._trans("readonly",(t=>this.core.get({trans:t,key:e}).then((e=>this.hook.reading.fire(e))))).then(t)}where(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(r(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=n(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const s=this.schema.indexes.concat(this.schema.primKey).filter((e=>{if(e.compound&&t.every((t=>e.keyPath.indexOf(t)>=0))){for(let n=0;n<t.length;++n)if(-1===t.indexOf(e.keyPath[n]))return!1;return!0}return!1})).sort(((e,t)=>e.keyPath.length-t.keyPath.length))[0];if(s&&this.db._maxKey!==bt){const n=s.keyPath.slice(0,t.length);return this.where(n).equals(n.map((t=>e[t])))}!s&&M&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:i}=this.schema,o=this.db._deps.indexedDB;function a(e,t){try{return 0===o.cmp(e,t)}catch(e){return!1}}const[l,u]=t.reduce((([t,n],s)=>{const o=i[s],l=e[s];return[t||o,t||!o?At(n,o&&o.multi?e=>{const t=w(e,s);return r(t)&&t.some((e=>a(l,e)))}:e=>a(l,w(e,s))):n]}),[null,null]);return l?this.where(l.name).equals(e[l.keyPath]).filter(u):s?this.filter(u):this.where(t).equals("")}filter(e){return this.toCollection().and(e)}count(e){return this.toCollection().count(e)}offset(e){return this.toCollection().offset(e)}limit(e){return this.toCollection().limit(e)}each(e){return this.toCollection().each(e)}toArray(e){return this.toCollection().toArray(e)}toCollection(){return new this.db.Collection(new this.db.WhereClause(this))}orderBy(e){return new this.db.Collection(new this.db.WhereClause(this,r(e)?`[${e.join("+")}]`:e))}reverse(){return this.toCollection().reverse()}mapToClass(e){this.schema.mappedClass=e;const t=t=>{if(!t)return t;const n=Object.create(e.prototype);for(var r in t)if(a(t,r))try{n[r]=t[r]}catch(e){}return n};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=t,this.hook("reading",t),e}defineClass(){return this.mapToClass((function(e){s(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||r(e))return this.where(":id").equals(e).modify(t);{const r=w(e,this.schema.primKey.keyPath);if(void 0===r)return pt(new J.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?n(t).forEach((n=>{_(e,n,t[n])})):t(e,{value:e,primKey:r})}catch(e){}return this.where(":id").equals(r).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=jt(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Be.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{_(e,r,t)}catch(e){}return t}))}delete(e){return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:[e]}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:Ct}))).then((e=>e.numFailures?Be.reject(e.failures[0]):void 0))}bulkGet(e){return this._trans("readonly",(t=>this.core.getMany({keys:e,trans:t}).then((e=>e.map((e=>this.hook.reading.fire(e)))))))}bulkAdd(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkAdd(): ${e} of ${o} operations failed`,r)}))}))}bulkPut(e,t,n){const r=Array.isArray(t)?t:void 0,s=(n=n||(r?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",(t=>{const{auto:n,keyPath:i}=this.schema.primKey;if(i&&r)throw new J.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new J.InvalidArgument("Arguments objects and keys must have the same length");const o=e.length;let a=i&&n?e.map(jt(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:a,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new G(`${this.name}.bulkPut(): ${e} of ${o} operations failed`,r)}))}))}bulkDelete(e){const t=e.length;return this._trans("readwrite",(t=>this.core.mutate({trans:t,type:"delete",keys:e}))).then((({numFailures:e,lastResult:n,failures:r})=>{if(0===e)return n;throw new G(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function Dt(e){var t={},s=function(n,r){if(r){for(var s=arguments.length,i=new Array(s-1);--s;)i[s-1]=arguments[s];return t[n].subscribe.apply(null,i),e}if("string"==typeof n)return t[n]};s.addEventType=a;for(var i=1,o=arguments.length;i<o;++i)a(arguments[i]);return s;function a(e,i,o){if("object"!=typeof e){var l;i||(i=le),o||(o=te);var u={subscribers:[],fire:o,subscribe:function(e){-1===u.subscribers.indexOf(e)&&(u.subscribers.push(e),u.fire=i(u.fire,e))},unsubscribe:function(e){u.subscribers=u.subscribers.filter((function(t){return t!==e})),u.fire=u.subscribers.reduce(i,o)}};return t[e]=s[e]=u,u}n(l=e).forEach((function(e){var t=l[e];if(r(t))a(e,l[e][0],l[e][1]);else{if("asap"!==t)throw new J.InvalidArgument("Invalid event config");var n=a(e,ne,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];n.subscribers.forEach((function(e){g((function(){e.apply(null,t)}))}))}))}}))}}function It(e,t){return h(t).from({prototype:e}),t}function Tt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Rt(e,t){e.filter=At(e.filter,t)}function Mt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>At(r(),t()):t,e.justLimit=n&&!r}function Ft(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new J.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Nt(e,t,n){const r=Ft(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){const s=e.replayFilter?At(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},o=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var o=n.primaryKey,l=""+o;"[object ArrayBuffer]"===l&&(l=""+new Uint8Array(o)),a(i,l)||(i[l]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(o,n),$t(Nt(e,r,n),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}return $t(Nt(e,r,n),At(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function $t(e,t,n,r){var s=ze(r?(e,t,s)=>n(r(e),t,s):n);return e.then((e=>{if(e)return e.start((()=>{var n=()=>e.continue();t&&!t(e,(e=>n=e),(t=>{e.stop(t),n=te}),(t=>{e.fail(t),n=te}))||s(e.value,e,(e=>n=e)),n()}))}))}function Lt(e,t){try{const n=Ut(e),r=Ut(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 function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return n===r?0:n<r?-1:1}(Vt(e),Vt(t));case"Array":return function(e,t){const n=e.length,r=t.length,s=n<r?n:r;for(let n=0;n<s;++n){const r=Lt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Ut(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=j(e);return"ArrayBuffer"===n?"binary":n}function Vt(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class Wt{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,pt.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,pt.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=At(t.algorithm,e)}_iterate(e,t){return qt(this._ctx,e,t,this._ctx.table.core)}clone(e){var t=Object.create(this.constructor.prototype),n=Object.create(this._ctx);return e&&s(n,e),t._ctx=n,t}raw(){return this._ctx.valueMapper=null,this}each(e){var t=this._ctx;return this._read((n=>qt(t,e,n,t.table.core)))}count(e){return this._read((e=>{const t=this._ctx,n=t.table.core;if(Tt(t,!0))return n.count({trans:e,query:{index:Ft(t,n.schema),range:t.range}}).then((e=>Math.min(e,t.limit)));var r=0;return qt(t,(()=>(++r,!1)),e,n).then((()=>r))})).then(e)}sortBy(e,t){const n=e.split(".").reverse(),r=n[0],s=n.length-1;function i(e,t){return t?i(e[n[t]],t-1):e[r]}var o="next"===this._ctx.dir?1:-1;function a(e,t){var n=i(e,s),r=i(t,s);return n<r?-o:n>r?o:0}return this.toArray((function(e){return e.sort(a)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:!0,query:{index:r,range:t.range}}).then((({result:e})=>n?e.map(n):e))}{const n=[];return qt(t,(e=>n.push(e)),e,t.table.core).then((()=>n))}}),e)}offset(e){var t=this._ctx;return e<=0||(t.offset+=e,Tt(t)?Mt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Mt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Mt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Rt(this._ctx,(function(n,r,s){return!e(n.value)||(r(s),t)})),this}first(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)}last(e){return this.reverse().first(e)}filter(e){var t,n;return Rt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=At(t.isMatch,n),this}and(e){return this.filter(e)}or(e){return new this.db.WhereClause(this._ctx.table,e,this)}reverse(){return this._ctx.dir="prev"===this._ctx.dir?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this}desc(){return this.reverse()}eachKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.key,n)}))}eachUniqueKey(e){return this._ctx.unique="unique",this.eachKey(e)}eachPrimaryKey(e){var t=this._ctx;return t.keysOnly=!t.isMatch,this.each((function(t,n){e(n.primaryKey,n)}))}keys(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)}primaryKeys(e){var t=this._ctx;if("next"===t.dir&&Tt(t,!0)&&t.limit>0)return this._read((e=>{var n=Ft(t,t.table.core.schema);return t.table.core.query({trans:e,values:!1,limit:t.limit,query:{index:n,range:t.range}})})).then((({result:e})=>e)).then(e);t.keysOnly=!t.isMatch;var n=[];return this.each((function(e,t){n.push(t.primaryKey)})).then((function(){return n})).then(e)}uniqueKeys(e){return this._ctx.unique="unique",this.keys(e)}firstKey(e){return this.limit(1).keys((function(e){return e[0]})).then(e)}lastKey(e){return this.reverse().firstKey(e)}distinct(){var e=this._ctx,t=e.index&&e.table.schema.idxByName[e.index];if(!t||!t.multi)return this;var n={};return Rt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=a(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((r=>{var s;if("function"==typeof e)s=e;else{var i=n(e),o=i.length;s=function(t){for(var n=!1,r=0;r<o;++r){var s=i[r],a=e[s];w(t,s)!==a&&(_(t,s,a),n=!0)}return n}}const a=t.table.core,{outbound:l,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,h=[];let d=0;const f=[],p=(e,t)=>{const{failures:r,numFailures:s}=t;d+=e-s;for(let e of n(r))h.push(r[e])};return this.clone().primaryKeys().then((n=>{const i=o=>{const h=Math.min(c,n.length-o);return a.getMany({trans:r,keys:n.slice(o,o+h),cache:"immutable"}).then((d=>{const f=[],y=[],m=l?[]:null,b=[];for(let e=0;e<h;++e){const t=d[e],r={value:O(t),primKey:n[o+e]};!1!==s.call(r,r.value,r)&&(null==r.value?b.push(n[o+e]):l||0===Lt(u(t),u(r.value))?(y.push(r.value),l&&m.push(n[o+e])):(b.push(n[o+e]),f.push(r.value)))}const g=Tt(t)&&t.limit===1/0&&("function"!=typeof e||e===Yt)&&{index:t.index,range:t.range};return Promise.resolve(f.length>0&&a.mutate({trans:r,type:"add",values:f}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(f.length,e)}))).then((()=>(y.length>0||g&&"object"==typeof e)&&a.mutate({trans:r,type:"put",keys:m,values:y,criteria:g,changeSpec:"function"!=typeof e&&e}).then((e=>p(y.length,e))))).then((()=>(b.length>0||g&&e===Yt)&&a.mutate({trans:r,type:"delete",keys:b,criteria:g}).then((e=>p(b.length,e))))).then((()=>n.length>o+h&&i(o+c)))}))};return i(0).then((()=>{if(h.length>0)throw new H("Error modifying one or more objects",h,d,f);return n.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Tt(e)&&(e.isPrimKey&&!Et||3===t.type)?this._write((n=>{const{primaryKey:r}=e.table.core.schema,s=t;return e.table.core.count({trans:n,query:{index:r,range:s}}).then((t=>e.table.core.mutate({trans:n,type:"deleteRange",range:s}).then((({failures:e,lastResult:n,results:r,numFailures:s})=>{if(s)throw new H("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(Yt)}}const Yt=(e,t)=>t.value=null;function zt(e,t){return e<t?-1:e===t?0:1}function Ht(e,t){return e>t?-1:e===t?0:1}function Gt(e,t,n){var r=e instanceof tn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Qt(e){return new e.Collection(e,(()=>en(""))).limit(0)}function Xt(e,t,n,r,s,i){for(var o=Math.min(e.length,r.length),a=-1,l=0;l<o;++l){var u=t[l];if(u!==r[l])return s(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):s(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):a>=0?e.substr(0,a)+t[a]+n.substr(a+1):null;s(e[l],u)<0&&(a=l)}return o<r.length&&"next"===i?e+n.substr(e.length):o<e.length&&"prev"===i?e.substr(0,n.length):a<0?null:e.substr(0,a)+r[a]+n.substr(a+1)}function Jt(e,t,n,r){var s,i,o,a,l,u,c,h=n.length;if(!n.every((e=>"string"==typeof e)))return Gt(e,wt);function d(e){s=function(e){return"next"===e?e=>e.toUpperCase():e=>e.toLowerCase()}(e),i=function(e){return"next"===e?e=>e.toLowerCase():e=>e.toUpperCase()}(e),o="next"===e?zt:Ht;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return o(e.lower,t.lower)}));a=t.map((function(e){return e.upper})),l=t.map((function(e){return e.lower})),u=e,c="next"===e?"":r}d("next");var f=new e.Collection(e,(()=>Zt(a[0],l[h-1]+r)));f._ondirectionchange=function(e){d(e)};var p=0;return f._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var d=i(s);if(t(d,l,p))return!0;for(var f=null,y=p;y<h;++y){var m=Xt(s,d,a[y],l[y],o,u);null===m&&null===f?p=y+1:(null===f||o(f,m)>0)&&(f=m)}return n(null!==f?function(){e.continue(f+c)}:r),!1})),f}function Zt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function en(e){return{type:1,lower:e,upper:e}}class tn{get Collection(){return this._ctx.table.db.Collection}between(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)?Qt(this):new this.Collection(this,(()=>Zt(e,t,!n,!r)))}catch(e){return Gt(this,vt)}}equals(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>en(e)))}above(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!0)))}aboveOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(e,void 0,!1)))}below(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?Gt(this,vt):new this.Collection(this,(()=>Zt(void 0,e)))}startsWith(e){return"string"!=typeof e?Gt(this,wt):this.between(e,e+bt,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):Jt(this,((e,t)=>0===e.indexOf(t[0])),[e],bt)}equalsIgnoreCase(e){return Jt(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=T.apply(I,arguments);return 0===e.length?Qt(this):Jt(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,bt)}anyOf(){const e=T.apply(I,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return Gt(this,vt)}if(0===e.length)return Qt(this);const n=new this.Collection(this,(()=>Zt(e[0],e[e.length-1])));n._ondirectionchange=n=>{t="next"===n?this._ascending:this._descending,e.sort(t)};let r=0;return n._addAlgorithm(((n,s,i)=>{const o=n.key;for(;t(o,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(o,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[gt,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=T.apply(I,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return Gt(this,vt)}const t=e.reduce(((e,t)=>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})}inAnyRange(e,t){const n=this._cmp,r=this._ascending,s=this._descending,i=this._min,o=this._max;if(0===e.length)return Qt(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return Gt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",J.InvalidArgument);const a=!t||!1!==t.includeLowers,l=t&&!0===t.includeUppers;let u,c=r;function h(e,t){return c(e[0],t[0])}try{u=e.reduce((function(e,t){let r=0,s=e.length;for(;r<s;++r){const s=e[r];if(n(t[0],s[1])<0&&n(t[1],s[0])>0){s[0]=i(s[0],t[0]),s[1]=o(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),u.sort(h)}catch(e){return Gt(this,vt)}let d=0;const f=l?e=>r(e,u[d][1])>0:e=>r(e,u[d][1])>=0,p=a?e=>s(e,u[d][0])>0:e=>s(e,u[d][0])>=0;let y=f;const m=new this.Collection(this,(()=>Zt(u[0][0],u[u.length-1][1],!a,!l)));return m._ondirectionchange=e=>{"next"===e?(y=f,c=r):(y=p,c=s),u.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++d,d===u.length)return t(n),!1;return!!function(e){return!f(e)&&!p(e)}(s)||(0===this._cmp(s,u[d][1])||0===this._cmp(s,u[d][0])||t((()=>{c===r?e.continue(u[d][0]):e.continue(u[d][1])})),!1)})),m}startsWithAnyOf(){const e=T.apply(I,arguments);return e.every((e=>"string"==typeof e))?0===e.length?Qt(this):this.inAnyRange(e.map((e=>[e,e+bt]))):Gt(this,"startsWithAnyOf() only works with strings")}}function nn(e){return ze((function(t){return rn(t),e(t.target.error),!1}))}function rn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const sn="storagemutated",on="x-storagemutated-1",an=Dt(null,sn);class ln{_lock(){return b(!Oe.global),++this._reculock,1!==this._reculock||Oe.global||(Oe.lockOwnerFor=this),this}_unlock(){if(b(!Oe.global),0==--this._reculock)for(Oe.global||(Oe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{lt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Oe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(b(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new J.DatabaseClosed(n);case"MissingAPIError":throw new J.MissingAPI(n.message,n);default:throw new J.OpenFailed(n)}if(!this.active)throw new J.TransactionInactive;return b(null===this._completion._state),(e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}))).onerror=ze((t=>{rn(t),this._reject(e.error)})),e.onabort=ze((t=>{rn(t),this.active&&this._reject(new J.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=ze((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&an.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return pt(new J.ReadOnly("Transaction is readonly"));if(!this.active)return pt(new J.TransactionInactive);if(this._locked())return new Be(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Oe])}));if(n)return et((()=>{var e=new Be(((e,n)=>{this._lock();const r=t(e,n,this);r&&r.then&&r.then(e,n)}));return e.finally((()=>this._unlock())),e._lib=!0,e}));var r=new Be(((e,n)=>{var r=t(e,n,this);r&&r.then&&r.then(e,n)}));return r._lib=!0,r}_root(){return this.parent?this.parent._root():this}waitFor(e){var t=this._root();const n=Be.resolve(e);if(t._waitingFor)t._waitingFor=t._waitingFor.then((()=>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 s=t._waitingFor;return new Be(((e,r)=>{n.then((n=>t._waitingQueue.push(ze(e.bind(null,n)))),(e=>t._waitingQueue.push(ze(r.bind(null,e))))).finally((()=>{t._waitingFor===s&&(t._waitingFor=null)}))}))}abort(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new J.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(a(t,e))return t[e];const n=this.schema[e];if(!n)throw new J.NotFound("Table "+e+" not part of transaction");const r=new this.db.Table(e,n,this);return r.core=this.db.core.table(e),t[e]=r,r}}function un(e,t,n,r,s,i,o){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!o?"&":"")+(r?"*":"")+(s?"++":"")+cn(t)}}function cn(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function hn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:v(n,(e=>[e.name,e]))}}let dn=e=>{try{return e.only([[]]),dn=()=>[[]],[[]]}catch(e){return dn=()=>bt,bt}};function fn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>w(t,e)}(e):t=>w(t,e)}function pn(e){return[].slice.call(e)}let yn=0;function mn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function bn(e,t,n){function s(e){if(3===e.type)return null;if(4===e.type)throw new Error("Cannot convert never type to IDBKeyRange");const{lower:n,upper:r,lowerOpen:s,upperOpen:i}=e;return void 0===n?void 0===r?null:t.upperBound(r,!!i):void 0===r?t.lowerBound(n,!!s):t.bound(n,r,!!s,!!i)}const{schema:i,hasGetAll:o}=function(e,t){const n=pn(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,s=r(t),i=null==t,o={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:i,compound:s,keyPath:t,autoIncrement:n,unique:!0,extractKey:fn(t)},indexes:pn(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:s,keyPath:i}=e,a={name:t,compound:r(i),keyPath:i,unique:n,multiEntry:s,extractKey:fn(i)};return o[mn(i)]=a,a})),getIndexByKeyPath:e=>o[mn(e)]};return o[":id"]=a.primaryKey,null!=t&&(o[mn(t)]=a.primaryKey),a}))},hasGetAll:n.length>0&&"getAll"in t.objectStore(n[0])&&!("undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}(e,n),a=i.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:r,values:i,range:o}){return new Promise(((a,l)=>{a=ze(a);const u=e.objectStore(t),c=null==u.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:d}=r||i||{length:1};if(r&&i&&r.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===d)return a({numFailures:0,failures:{},results:[],lastResult:void 0});let f;const p=[],y=[];let m=0;const b=e=>{++m,rn(e)};if("deleteRange"===n){if(4===o.type)return a({numFailures:m,failures:y,results:[],lastResult:void 0});3===o.type?p.push(f=u.clear()):p.push(f=u.delete(s(o)))}else{const[e,t]=h?c?[i,r]:[i,null]:[r,null];if(h)for(let r=0;r<d;++r)p.push(f=t&&void 0!==t[r]?u[n](e[r],t[r]):u[n](e[r])),f.onerror=b;else for(let t=0;t<d;++t)p.push(f=u[n](e[t])),f.onerror=b}const g=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),a({numFailures:m,failures:y,results:"delete"===n?r:p.map((e=>e.result)),lastResult:t})};f.onerror=e=>{b(e),g(e)},f.onsuccess=g}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t),o=n.length,a=new Array(o);let l,u=0,c=0;const h=e=>{const t=e.target;a[t._pos]=t.result,++c===u&&r(a)},d=nn(s);for(let e=0;e<o;++e)null!=n[e]&&(l=i.get(n[e]),l._pos=e,l.onsuccess=h,l.onerror=d,++u);0===u&&r(a)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=ze(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=nn(s)})),query:function(e){return n=>new Promise(((r,i)=>{r=ze(r);const{trans:o,values:a,limit:l,query:u}=n,c=l===1/0?void 0:l,{index:h,range:d}=u,f=o.objectStore(t),p=h.isPrimaryKey?f:f.index(h.name),y=s(d);if(0===l)return r({result:[]});if(e){const e=a?p.getAll(y,c):p.getAllKeys(y,c);e.onsuccess=e=>r({result:e.target.result}),e.onerror=nn(i)}else{let e=0;const t=a||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=s=>{const i=t.result;return i?(n.push(a?i.value:i.primaryKey),++e===l?r({result:n}):void i.continue()):r({result:n})},t.onerror=nn(i)}}))}(o),openCursor:function({trans:e,values:n,query:r,reverse:i,unique:o}){return new Promise(((a,l)=>{a=ze(a);const{index:u,range:c}=r,h=e.objectStore(t),d=u.isPrimaryKey?h:h.index(u.name),f=i?o?"prevunique":"prev":o?"nextunique":"next",p=n||!("openKeyCursor"in d)?d.openCursor(s(c),f):d.openKeyCursor(s(c),f);p.onerror=nn(l),p.onsuccess=ze((t=>{const n=p.result;if(!n)return void a(null);n.___id=++yn,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),o=()=>{throw new Error("Cursor not stopped")};n.trans=e,n.stop=n.continue=n.continuePrimaryKey=n.advance=()=>{throw new Error("Cursor not started")},n.fail=ze(l),n.next=function(){let e=1;return this.start((()=>e--?this.continue():this.stop())).then((()=>this))},n.start=e=>{const t=new Promise(((e,t)=>{e=ze(e),p.onerror=nn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=o,e(t)}})),a=()=>{if(p.result)try{e()}catch(e){n.fail(e)}else n.done=!0,n.start=()=>{throw new Error("Cursor behind last entry")},n.stop()};return p.onsuccess=ze((e=>{p.onsuccess=a,a()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,a(),t},a(n)}),l)}))},count({query:e,trans:n}){const{index:r,range:i}=e;return new Promise(((e,o)=>{const a=n.objectStore(t),l=r.isPrimaryKey?a:a.index(r.name),u=s(i),c=u?l.count(u):l.count();c.onsuccess=ze((t=>e(t.target.result))),c.onerror=nn(o)}))}}}(e))),l={};return a.forEach((e=>l[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!l[e])throw new Error(`Table '${e}' not found`);return l[e]},MIN_KEY:-1/0,MAX_KEY:dn(t),schema:i}}function gn({_novip:e},t){const n=t.db,r=function(e,t,{IDBKeyRange:n,indexedDB:r},s){const i=function(e,t){return t.reduce(((e,{create:t})=>({...e,...t(e)})),e)}(bn(t,n,s),e.dbcore);return{dbcore:i}}(e._middlewares,n,e._deps,t);e.core=r.dbcore,e.tables.forEach((t=>{const n=t.name;e.core.schema.tables.some((e=>e.name===n))&&(t.core=e.core.table(n),e[n]instanceof e.Table&&(e[n].core=t.core))}))}function vn({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=f(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?c(t,n,{get(){return this.table(n)},set(e){u(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function wn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function _n(e,t){return e._cfg.version-t._cfg.version}function xn(e,t,r,s){const i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(r),o._completion.catch(s);const a=o._reject.bind(o),l=Oe.transless||Oe;et((()=>{Oe.trans=o,Oe.transless=l,0===t?(n(i).forEach((e=>{En(r,e,i[e].primKey,i[e].indexes)})),gn(e,r),Be.follow((()=>e.on.populate.fire(o))).catch(a)):function({_novip:e},t,r,s){const i=[],o=e._versions;let a=e._dbSchema=Sn(e,e.idbdb,s),l=!1;const u=o.filter((e=>e._cfg.version>=t));return u.forEach((o=>{i.push((()=>{const i=a,u=o._cfg.dbschema;Kn(e,i,s),Kn(e,u,s),a=e._dbSchema=u;const c=kn(i,u);c.add.forEach((e=>{En(s,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new J.Upgrade("Not yet support for changing primary key");{const t=s.objectStore(e.name);e.add.forEach((e=>Pn(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),Pn(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const h=o._cfg.contentUpgrade;if(h&&o._cfg.version>t){gn(e,s),r._memoizedTables={},l=!0;let t=x(u);c.del.forEach((e=>{t[e]=i[e]})),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],n(t),t),r.schema=t;const o=R(h);let a;o&&tt();const d=Be.follow((()=>{if(a=h(r),a&&o){var e=nt.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Be.resolve(a):d.then((()=>a))}})),i.push((t=>{l&&kt||function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(o._cfg.dbschema,t),wn(e,[e.Transaction.prototype]),vn(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),r.schema=e._dbSchema}))})),function e(){return i.length?Be.resolve(i.shift()(r.idbtrans)).then(e):Be.resolve()}().then((()=>{var e,t;t=s,n(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||En(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,o,r).catch(a)}))}function kn(e,t){const n={del:[],add:[],change:[]};let r;for(r in e)t[r]||n.del.push(r);for(r in t){const s=e[r],i=t[r];if(s){const e={name:r,def:i,recreate:!1,del:[],add:[],change:[]};if(""+(s.primKey.keyPath||"")!=""+(i.primKey.keyPath||"")||s.primKey.auto!==i.primKey.auto&&!xt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let o;for(o in t)r[o]||e.del.push(o);for(o in r){const n=t[o],s=r[o];n?n.src!==s.src&&e.change.push(s):e.add.push(s)}(e.del.length>0||e.add.length>0||e.change.length>0)&&n.change.push(e)}}else n.add.push([r,i])}return n}function En(e,t,n,r){const s=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach((e=>Pn(s,e))),s}function Pn(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Sn(e,t,n){const r={};return y(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=un(cn(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),o=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var a=un(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);o.push(a)}r[e]=hn(e,i,o)})),r}function Kn({_novip:e},n,r){const s=r.db.objectStoreNames;for(let t=0;t<s.length;++t){const i=s[t],o=r.objectStore(i);e._hasGetAll="getAll"in o;for(let e=0;e<o.indexNames.length;++e){const t=o.indexNames[e],r=o.index(t).keyPath,s="string"==typeof r?r:"["+y(r).join("+")+"]";if(n[i]){const e=n[i].idxByName[s];e&&(e.name=t,delete n[i].idxByName[s],n[i].idxByName[t]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&t.WorkerGlobalScope&&t instanceof t.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class On{_parseStoresSpec(e,t){n(e).forEach((n=>{if(null!==e[n]){var s=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),s=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return un(n,s||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),r(s),0===t)})),i=s.shift();if(i.multi)throw new J.Schema("Primary key cannot be multi-valued");s.forEach((e=>{if(e.auto)throw new J.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new J.Schema("Index must have a name and cannot be an empty string")})),t[n]=hn(n,i,s)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?s(this._cfg.storesSource,e):e;const r=t._versions,i={};let o={};return r.forEach((e=>{s(i,e._cfg.storesSource),o=e._cfg.dbschema={},e._parseStoresSpec(i,o)})),t._dbSchema=o,wn(t,[t._allTables,t,t.Transaction.prototype]),vn(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],n(o),o),t._storeNames=n(o),this}upgrade(e){return this._cfg.contentUpgrade=ue(this._cfg.contentUpgrade||te,e),this}}function An(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qn(St,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Cn(e){return e&&"function"==typeof e.databases}function jn(e){return et((function(){return Oe.letThrough=!0,e()}))}function Bn(){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 Dn(e){var t=t=>e.next(t),n=i(t),s=i((t=>e.throw(t)));function i(e){return t=>{var i=e(t),o=i.value;return i.done?o:o&&"function"==typeof o.then?o.then(n,s):r(o)?Promise.all(o).then(n,s):n(o)}}return i(t)()}function In(e,t,n){var r=arguments.length;if(r<2)throw new J.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];return n=s.pop(),[e,E(s),n]}function Tn(e,t,n,r,s){return Be.resolve().then((()=>{const i=Oe.transless||Oe,o=e._createTransaction(t,n,e._dbSchema,r),a={trans:o,transless:i};if(r)o.idbtrans=r.idbtrans;else try{o.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===Q.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Tn(e,t,n,null,s)))):pt(r)}const l=R(s);let u;l&&tt();const c=Be.follow((()=>{if(u=s.call(o,o),u)if(l){var e=nt.bind(null,null);u.then(e,e)}else"function"==typeof u.next&&"function"==typeof u.throw&&(u=Dn(u))}),a);return(u&&"function"==typeof u.then?Be.resolve(u).then((e=>o.active?e:pt(new J.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):c.then((()=>u))).then((e=>(r&&o._resolve(),o._completion.then((()=>e))))).catch((e=>(o._reject(e),pt(e))))}))}function Rn(e,t,n){const s=r(e)?e.slice():[e];for(let e=0;e<n;++e)s.push(t);return s}const Mn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function o(e,t,n){const r=mn(e),a=s[r]=s[r]||[],l=null==e?0:"string"==typeof e?1:e.length,u=t>0,c={...n,isVirtual:u,keyTail:t,keyLength:l,extractKey:fn(e),unique:!u&&n.unique};return a.push(c),c.isPrimaryKey||i.push(c),l>1&&o(2===l?e[0]:e.slice(0,l-1),t+1,n),a.sort(((e,t)=>e.keyTail-t.keyTail)),c}const a=o(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[a];for(const e of r.indexes)o(e.keyPath,0,e);function l(t){const n=t.query.index;return n.isVirtual?{...t,query:{index:n,range:(r=t.query.range,s=n.keyTail,{type:1===r.type?2:r.type,lower:Rn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Rn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const u={...n,schema:{...r,primaryKey:a,indexes:i,getIndexByKeyPath:function(e){const t=s[mn(e)];return t&&t[0]}},count:e=>n.count(l(e)),query:e=>n.query(l(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;return s?n.openCursor(l(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Rn(s,t.reverse?e.MAX_KEY:e.MIN_KEY,r)):t.unique?n.continue(n.key.slice(0,i).concat(t.reverse?e.MIN_KEY:e.MAX_KEY,r)):n.continue()}},continuePrimaryKey:{value(t,s){n.continuePrimaryKey(Rn(t,e.MAX_KEY,r),s)}},primaryKey:{get:()=>n.primaryKey},key:{get(){const e=n.key;return 1===i?e[0]:e.slice(0,i)}},value:{get:()=>n.value}});return s}(n))):n.openCursor(t)}};return u}}}};function Fn(e,t,r,s){return r=r||{},s=s||"",n(e).forEach((n=>{if(a(t,n)){var i=e[n],o=t[n];if("object"==typeof i&&"object"==typeof o&&i&&o){const e=j(i);e!==j(o)?r[s+n]=t[n]:"Object"===e?Fn(i,o,r,s+n+"."):i!==o&&(r[s+n]=t[n])}else i!==o&&(r[s+n]=t[n])}else r[s+n]=void 0})),n(t).forEach((n=>{a(e,n)||(r[s+n]=t[n])})),r}const Nn={stack:"dbcore",name:"HooksMiddleware",level:2,create:e=>({...e,table(t){const n=e.table(t),{primaryKey:r}=n.schema,s={...n,mutate(e){const s=Oe.trans,{deleting:i,creating:o,updating:l}=s.table(t).hook;switch(e.type){case"add":if(o.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(o.fire===te&&l.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===te)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===te)break;return s._promise("readwrite",(()=>function(e){return c(e.trans,e.range,1e4)}(e)),!0)}return n.mutate(e);function u(e){const t=Oe.trans,s=e.keys||function(e,t){return"delete"===t.type?t.keys:t.keys||t.values.map(e.extractKey)}(r,e);if(!s)throw new Error("Keys missing");return"delete"!==(e="add"===e.type||"put"===e.type?{...e,keys:s}:{...e}).type&&(e.values=[...e.values]),e.keys&&(e.keys=[...e.keys]),function(e,t,n){return"add"===t.type?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}(n,e,s).then((u=>{const c=s.map(((n,s)=>{const c=u[s],h={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(h,n,c,t);else if("add"===e.type||void 0===c){const i=o.fire.call(h,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||_(e.values[s],r.keyPath,n))}else{const r=Fn(c,e.values[s]),i=l.fire.call(h,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{a(t,e)?t[e]=i[e]:_(t,e,i[e])}))}}return h}));return n.mutate(e).then((({failures:t,results:n,numFailures:r,lastResult:i})=>{for(let r=0;r<s.length;++r){const i=n?n[r]:s[r],o=c[r];null==i?o.onerror&&o.onerror(t[r]):o.onsuccess&&o.onsuccess("put"===e.type&&u[r]?e.values[r]:i)}return{failures:t,results:n,numFailures:r,lastResult:i}})).catch((e=>(c.forEach((t=>t.onerror&&t.onerror(e))),Promise.reject(e))))}))}function c(e,t,s){return n.query({trans:e,values:!1,query:{index:r,range:t},limit:s}).then((({result:n})=>u({type:"delete",keys:n,trans:e}).then((r=>r.numFailures>0?Promise.reject(r.failures[0]):n.length<s?{failures:[],numFailures:0,lastResult:void 0}:c(e,{...t,lower:n[n.length-1],lowerOpen:!0},s)))))}}};return s}})};function qn(e,t,n){try{if(!t)return null;if(t.keys.length<e.length)return null;const r=[];for(let s=0,i=0;s<t.keys.length&&i<e.length;++s)0===Lt(t.keys[s],e[i])&&(r.push(n?O(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const $n={stack:"dbcore",level:-1,create:e=>({table:t=>{const n=e.table(t);return{...n,getMany:e=>{if(!e.cache)return n.getMany(e);const t=qn(e.keys,e.trans._cache,"clone"===e.cache);return t?Be.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?O(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Ln(e){return!("from"in e)}const Un=function(e,t){if(!this){const t=new Un;return e&&"d"in e&&s(t,e),t}s(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function Vn(e,t,n){const r=Lt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Ln(e))return s(e,{from:t,to:n,d:1});const i=e.l,o=e.r;if(Lt(n,e.from)<0)return i?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},zn(e);if(Lt(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},zn(e);Lt(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Lt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;i&&!e.l&&Wn(e,i),o&&a&&Wn(e,o)}function Wn(e,t){Ln(t)||function e(t,{from:n,to:r,l:s,r:i}){Vn(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function Yn(e){let t=Ln(e)?null:{s:0,n:e};return{next(e){const n=arguments.length>0;for(;t;)switch(t.s){case 0:if(t.s=1,n)for(;t.n.l&&Lt(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||Lt(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 zn(e){var t,n;const r=((null===(t=e.r)||void 0===t?void 0:t.d)||0)-((null===(n=e.l)||void 0===n?void 0:n.d)||0),s=r>1?"r":r<-1?"l":"";if(s){const t="r"===s?"l":"r",n={...e},r=e[s];e.from=r.from,e.to=r.to,e[s]=r[s],n[s]=r[t],e[t]=n,n.d=Hn(n)}e.d=Hn(e)}function Hn({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}l(Un.prototype,{add(e){return Wn(this,e),this},addKey(e){return Vn(this,e,e),this},addKeys(e){return e.forEach((e=>Vn(this,e,e))),this},[B](){return Yn(this)}});const Gn={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,s=new Un(e.MIN_KEY,e.MAX_KEY);return{...e,table:i=>{const o=e.table(i),{schema:a}=o,{primaryKey:l}=a,{extractKey:u,outbound:c}=l,h={...o,mutate:e=>{const n=e.trans,l=n.mutatedParts||(n.mutatedParts={}),u=e=>{const n=`idb://${t}/${i}/${e}`;return l[n]||(l[n]=new Un)},c=u(""),h=u(":dels"),{type:d}=e;let[f,p]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return o.mutate(e).then((e=>{if(r(f)){"delete"!==d&&(f=e.results),c.addKeys(f);const t=qn(f,y);t||"add"===d||h.addKeys(f),(t||p)&&function(e,t,n,s){t.indexes.forEach((function(t){const i=e(t.name||"");function o(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&r(e)?e.forEach((e=>i.addKey(e))):i.addKey(e);(n||s).forEach(((e,t)=>{const r=n&&o(n[t]),i=s&&o(s[t]);0!==Lt(r,i)&&(null!=r&&a(r),null!=i&&a(i))}))}))}(u,a,t,p)}else if(f){const e={from:f.lower,to:f.upper};h.add(e),c.add(e)}else c.add(s),h.add(s),a.indexes.forEach((e=>u(e.name).add(s)));return e}))}},d=({query:{index:t,range:n}})=>{var r,s;return[t,new Un(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},f={get:e=>[l,new Un(e.key)],getMany:e=>[l,(new Un).addKeys(e.keys)],count:d,query:d,openCursor:d};return n(f).forEach((e=>{h[e]=function(n){const{subscr:r}=Oe;if(r){const a=e=>{const n=`idb://${t}/${i}/${e}`;return r[n]||(r[n]=new Un)},l=a(""),h=a(":dels"),[d,p]=f[e](n);if(a(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&c&&n.values&&o.query({...n,values:!1});return o[e].apply(this,arguments).then((r=>{if("query"===e){if(c&&n.values)return t.then((({result:e})=>(l.addKeys(e),r)));const e=n.values?r.result.map(u):r.result;n.values?l.addKeys(e):h.addKeys(e)}else if("openCursor"===e){const e=r,t=n.values;return e&&Object.create(e,{key:{get:()=>(h.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return h.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return r}))}h.add(s)}}return o[e].apply(this,arguments)}})),h}}}};class Qn{constructor(e,t){this._middlewares={},this.verno=0;const n=Qn.dependencies;this._options=t={addons:Qn.addons,autoOpen:!0,indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange,...t},this._deps={indexedDB:t.indexedDB,IDBKeyRange:t.IDBKeyRange};const{addons:r}=t;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;const s={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:te,dbReadyPromise:null,cancelOpen:te,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};var i;s.dbReadyPromise=new Be((e=>{s.dbReadyResolve=e})),s.openCanceller=new Be(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=Dt(this,"populate","blocked","versionchange","close",{ready:[ue,te]}),this.on.ready.subscribe=m(this.on.ready.subscribe,(e=>(t,n)=>{Qn.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Be.resolve().then(t),n&&e(t);else if(r.onReadyBeingFired)r.onReadyBeingFired.push(t),n&&e(t);else{e(t);const r=this;n||e((function e(){r.on.ready.unsubscribe(t),r.on.ready.unsubscribe(e)}))}}))})),this.Collection=(i=this,It(Wt.prototype,(function(e,t){this.db=i;let n=Ct,r=null;if(t)try{n=t()}catch(e){r=e}const s=e._ctx,o=s.table,a=o.hook.reading.fire;this._ctx={table:o,index:s.index,isPrimKey:!s.index||o.schema.primKey.keyPath&&s.index===o.schema.primKey.name,range:n,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:r,or:s.or,valueMapper:a!==ne?a:null}}))),this.Table=function(e){return It(Bt.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:Dt(null,{creating:[ie,te],reading:[re,ne],updating:[ae,te],deleting:[oe,te]})}))}(this),this.Transaction=function(e){return It(ln.prototype,(function(t,n,r,s,i){this.db=e,this.mode=t,this.storeNames=n,this.schema=r,this.chromeTransactionDurability=s,this.idbtrans=null,this.on=Dt(this,"complete","error","abort"),this.parent=i||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Be(((e,t)=>{this._resolve=e,this._reject=t})),this._completion.then((()=>{this.active=!1,this.on.complete.fire()}),(e=>{var t=this.active;return this.active=!1,this.on.error.fire(e),this.parent?this.parent._reject(e):t&&this.idbtrans&&this.idbtrans.abort(),pt(e)}))}))}(this),this.Version=function(e){return It(On.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return It(tn.prototype,(function(t,n,r){this.db=e,this._ctx={table:t,index:":id"===n?null:n,or:r};const s=e._deps.indexedDB;if(!s)throw new J.MissingAPI;this._cmp=this._ascending=s.cmp.bind(s),this._descending=(e,t)=>s.cmp(t,e),this._max=(e,t)=>s.cmp(e,t)>0?e:t,this._min=(e,t)=>s.cmp(e,t)<0?e:t,this._IDBKeyRange=e._deps.IDBKeyRange}))}(this),this.on("versionchange",(e=>{e.newVersion>0?console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`):console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`),this.close()})),this.on("blocked",(e=>{!e.newVersion||e.newVersion<e.oldVersion?console.warn(`Dexie.delete('${this.name}') was blocked`):console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e.oldVersion/10}`)})),this._maxKey=dn(t.IDBKeyRange),this._createTransaction=(e,t,n,r)=>new this.Transaction(e,t,n,this._options.chromeTransactionDurability,r),this._fireOnBlocked=e=>{this.on("blocked").fire(e),_t.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Mn),this.use(Nn),this.use(Gn),this.use($n),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new J.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new J.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);const t=this._versions;var n=t.filter((t=>t._cfg.version===e))[0];return n||(n=new this.Version(e),t.push(n),t.sort(_n),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Oe.letThrough||this._vip)?e():new Be(((e,t)=>{if(this._state.openComplete)return t(new J.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new J.DatabaseClosed);this.open().catch(te)}this._state.dbReadyPromise.then(e,t)})).then(e)}use({stack:e,create:t,level:n,name:r}){r&&this.unuse({stack:e,name:r});const s=this._middlewares[e]||(this._middlewares[e]=[]);return s.push({stack:e,create:t,level:null==n?10:n,name:r}),s.sort(((e,t)=>e.level-t.level)),this}unuse({stack:e,name:t,create:n}){return e&&this._middlewares[e]&&(this._middlewares[e]=this._middlewares[e].filter((e=>n?e.create!==n:!!t&&e.name!==t))),this}open(){return function(e){const t=e._state,{indexedDB:r}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?pt(t.dbOpenError):e));M&&(t.openCanceller._stackHolder=$()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const s=t.openCanceller;function i(){if(t.openCanceller!==s)throw new J.DatabaseClosed("db.open() was cancelled")}let o=t.dbReadyResolve,a=null,l=!1;const u=()=>new Be(((s,o)=>{if(i(),!r)throw new J.MissingAPI;const u=e.name,c=t.autoSchema?r.open(u):r.open(u,Math.round(10*e.verno));if(!c)throw new J.MissingAPI;c.onerror=nn(o),c.onblocked=ze(e._fireOnBlocked),c.onupgradeneeded=ze((n=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=rn,a.abort(),c.result.close();const e=r.deleteDatabase(u);e.onsuccess=e.onerror=ze((()=>{o(new J.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=nn(o);var s=n.oldVersion>Math.pow(2,62)?0:n.oldVersion;l=s<1,e._novip.idbdb=c.result,xn(e,s/10,a,o)}}),o),c.onsuccess=ze((()=>{a=null;const r=e._novip.idbdb=c.result,i=y(r.objectStoreNames);if(i.length>0)try{const s=r.transaction(1===(o=i).length?o[0]:o,"readonly");t.autoSchema?function({_novip:e},t,r){e.verno=t.version/10;const s=e._dbSchema=Sn(0,t,r);e._storeNames=y(t.objectStoreNames,0),vn(e,[e._allTables],n(s),s)}(e,r,s):(Kn(e,e._dbSchema,s),function(e,t){const n=kn(Sn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,s)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),gn(e,s)}catch(e){}var o;_t.push(e),r.onversionchange=ze((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),r.onclose=ze((t=>{e.on("close").fire(t)})),l&&function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).put({name:n}).catch(te)}(e._deps,u),s()}),o)})).catch((e=>e&&"UnknownError"===e.name&&t.PR1398_maxLoop>0?(t.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),u()):Be.reject(e)));return Be.race([s,("undefined"==typeof navigator?Be.resolve():Bn()).then(u)]).then((()=>(i(),t.onReadyBeingFired=[],Be.resolve(jn((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(ue,te);return t.onReadyBeingFired=[],Be.resolve(jn((()=>r(e.vip)))).then(n)}}))))).finally((()=>{t.onReadyBeingFired=null,t.isBeingOpened=!1})).then((()=>e)).catch((n=>{t.dbOpenError=n;try{a&&a.abort()}catch(e){}return s===t.openCanceller&&e._close(),pt(n)})).finally((()=>{t.openComplete=!0,o()}))}(this)}_close(){const e=this._state,t=_t.indexOf(this);if(t>=0&&_t.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Be((t=>{e.dbReadyResolve=t})),e.openCanceller=new Be(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new J.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Be(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=ze((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!Cn(e)&&n!==St&&An(e,t).delete(n).catch(te)}(this._deps,this.name),n()})),e.onerror=nn(r),e.onblocked=this._fireOnBlocked};if(e)throw new J.InvalidArgument("Arguments not allowed in db.delete()");t.isBeingOpened?t.dbReadyPromise.then(s):s()}))}backendDB(){return this.idbdb}isOpen(){return null!==this.idbdb}hasBeenClosed(){const e=this._state.dbOpenError;return e&&"DatabaseClosed"===e.name}hasFailed(){return null!==this._state.dbOpenError}dynamicallyOpened(){return this._state.autoSchema}get tables(){return n(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=In.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Oe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,o;e=e.replace("!","").replace("?","");try{if(o=t.map((e=>{var t=e instanceof this.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===Kt)i=Kt;else{if("rw"!=e&&e!=Ot)throw new J.InvalidArgument("Invalid transaction mode: "+e);i=Ot}if(r){if(r.mode===Kt&&i===Ot){if(!s)throw new J.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&o.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new J.SubTransaction("Table "+e+" not included in parent transaction.");r=null}})),s&&r&&!r.active&&(r=null)}}catch(e){return r?r._promise(null,((t,n)=>{n(e)})):pt(e)}const a=Tn.bind(null,this,i,o,r,n);return r?r._promise(i,a,"lock"):Oe.trans?lt(Oe.transless,(()=>this._whenReady(a))):this._whenReady(a)}table(e){if(!a(this._allTables,e))throw new J.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const Xn="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class Jn{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[Xn](){return this}}function Zn(e,t){return n(t).forEach((n=>{Wn(e[n]||(e[n]=new Un),t[n])})),e}let er;try{er={indexedDB:t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB,IDBKeyRange:t.IDBKeyRange||t.webkitIDBKeyRange}}catch(t){er={indexedDB:null,IDBKeyRange:null}}const tr=Qn;function nr(e){let t=rr;try{rr=!0,an.storagemutated.fire(e)}finally{rr=t}}l(tr,{...ee,delete:e=>new tr(e,{addons:[]}).delete(),exists:e=>new tr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return Cn(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==St)))):An(e,t).toCollection().primaryKeys()}(tr.dependencies).then(e)}catch(e){return pt(new J.MissingAPI)}},defineClass:()=>function(e){s(this,e)},ignoreTransaction:e=>Oe.trans?lt(Oe.transless,e):e(),vip:jn,async:function(e){return function(){try{var t=Dn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Be.resolve(t)}catch(e){return pt(e)}}},spawn:function(e,t,n){try{var r=Dn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Be.resolve(r)}catch(e){return pt(e)}},currentTransaction:{get:()=>Oe.trans||null},waitFor:function(e,t){const n=Be.resolve("function"==typeof e?tr.ignoreTransaction(e):e).timeout(t||6e4);return Oe.trans?Oe.trans.waitFor(n):n},Promise:Be,debug:{get:()=>M,set:e=>{F(e,"dexie"===e?()=>!0:Pt)}},derive:h,extend:s,props:l,override:m,Events:Dt,on:an,liveQuery:function(e){let t,r=!1;const s=new Jn((s=>{const i=R(e);let o=!1,a={},l={};const u={get closed(){return o},unsubscribe:()=>{o=!0,an.storagemutated.unsubscribe(f)}};s.start&&s.start(u);let c=!1,h=!1;function d(){return n(l).some((e=>a[e]&&function(e,t){const n=Yn(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=Yn(e);let o=i.next(s.from),a=o.value;for(;!r.done&&!o.done;){if(Lt(a.from,s.to)<=0&&Lt(a.to,s.from)>=0)return!0;Lt(s.from,a.from)<0?s=(r=n.next(a.from)).value:a=(o=i.next(s.from)).value}return!1}(a[e],l[e])))}const f=e=>{Zn(a,e),d()&&p()},p=()=>{if(c||o)return;a={};const n={},y=function(t){i&&tt();const n=()=>et(e,{subscr:t,trans:null}),r=Oe.trans?lt(Oe.transless,n):n();return i&&r.then(nt,nt),r}(n);h||(an(sn,f),h=!0),c=!0,Promise.resolve(y).then((e=>{r=!0,t=e,c=!1,o||(d()?p():(a={},l=n,s.next&&s.next(e)))}),(e=>{c=!1,r=!1,s.error&&s.error(e),u.unsubscribe()}))};return p(),u}));return s.hasValue=()=>r,s.getValue=()=>t,s},extendObservabilitySet:Zn,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,(function(t){_(e,t,void 0)}))},shallowClone:x,deepClone:O,getObjectDiff:Fn,cmp:Lt,asap:g,minKey:gt,addons:[],connections:_t,errnames:Q,dependencies:er,semVer:mt,version:mt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),tr.maxKey=dn(tr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(an(sn,(e=>{if(!rr){let t;xt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(on,!0,!0,e)):t=new CustomEvent(on,{detail:e}),rr=!0,dispatchEvent(t),rr=!1}})),addEventListener(on,(({detail:e})=>{rr||nr(e)})));let rr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(on);"function"==typeof e.unref&&e.unref(),an(sn,(t=>{rr||e.postMessage(t)})),e.onmessage=e=>{e.data&&nr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){an(sn,(e=>{try{rr||("undefined"!=typeof localStorage&&localStorage.setItem(on,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:on,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===on){const t=JSON.parse(e.newValue);t&&nr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===on&&nr(e.changedParts)}))}Be.rejectionMapper=function(e,t){if(!e||e instanceof Y||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Z[e.name])return e;var n=new Z[e.name](t||e.message,e);return"stack"in e&&c(n,"stack",{get:function(){return this.inner.stack}}),n},F(M,Pt);class sr{constructor(e,t,n){this.name=e,this.table=t,this.keys=n}database(){const e=new Qn(this.name);let t=1;for(let n of this.keys)e.version(t).stores({[this.table]:n}),t++;return e}async save(e){const t=this.database();await t[this.table].bulkPut(e).then((()=>{t.close()})).catch((e=>{throw console.error("Error in db.save",e),e}))}async read(e="name"){const t=this.database();return await t[this.table].orderBy(e).toArray().then((e=>(t.close(),e))).catch((e=>{throw console.error("Error in db.read",errerr),e}))}async getFirstRow(){const e=this.database();return await e[this.table].orderBy(":id").first().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.getFirstRow",e),e}))}async delete(){const e=new Qn(this.name);await e.delete().then((()=>{e.close()})).catch((e=>{throw console.warn("Error in db.delete",e),e}))}async count(){const e=this.database();return await e[this.table].count().then((t=>(e.close(),t))).catch((e=>{throw console.error("Error in db.count",e),e}))}async getVersion(){const e=await new Qn(this.name).open().then((e=>{const t=e.verno;return e.close(),t})).catch((e=>{throw console.error("Error in db.getVersion",e),e}));return e}}const ir=window.wp.apiFetch;var or=e.n(ir);async function ar(e,t){try{await or().use(or().createNonceMiddleware(pluginAllSitesMenu.nonce));const n=await or()({url:pluginAllSitesMenu.restURL,method:"POST",data:{offset:t}}).catch((e=>{throw console.error("Error in apiFetch",e),e}));"success"===n.response&&(t+=pluginAllSitesMenu.loadincrements,e.save(n.data),await ar(e,t))}catch(e){throw console.error("Error in loadSites",e),e}}function lr(e,t){if(!e)return;e.classList&&e.classList.add?e.classList.add(t):cr(e,t)||(e.className&&(e.className+=" "),e.className+=t);let n=e.getBoundingClientRect().top,r=e.querySelector(".ab-submenu");r.style.top=n-6+"px",r.getBoundingClientRect().bottom>window.innerHeight&&(r.style.top="auto",r.style.bottom="0")}function ur(e,t){let n,r;if(e||cr(e,t))if(e.classList&&e.classList.remove)e.classList.remove(t);else{for(n=` ${t} `,r=` ${e.className} `;r.indexOf(n)>-1;)r=r.replace(n,"");e.className=r.replace(/^[\s]+|[\s]+$/g,"")}}function cr(e,t){let n;return!!e&&(e.classList&&e.classList.contains?e.classList.contains(t):!!e.className&&(n=e.className.split(" "),n.indexOf(t)>-1))}const hr=window.wp.i18n;document.addEventListener("DOMContentLoaded",(async()=>{if(!document.getElementById("wpadminbar"))return;const e={load:document.querySelector("#wp-admin-bar-load-more"),menu:document.querySelector("#wp-admin-bar-my-sites-list"),timestamp:document.querySelector("#load-more-timestamp")};!0===pluginAllSitesMenu.displaySearch&&function(){const e=document.querySelector("#all-sites-search-text");null!==e&&e.addEventListener("keyup",(e=>{e.preventDefault();const t=e.target.value.toUpperCase(),n=document.querySelector("#wp-admin-bar-my-sites-list").getElementsByClassName("menupop");for(let e=0;e<n.length;e++){let r=n[e].querySelector(".ab-item");(r.textContent||r.innerText).toUpperCase().indexOf(t)>-1?n[e].style.display="":n[e].style.display="none"}}))}();const t=new sr("allsites","sites",["id,name,url","id,name,url,timestamp"]);var n;n=e.menu,new IntersectionObserver((e=>{e.forEach((e=>{const t=e.boundingClientRect,n=t.bottom<window.innerHeight&&t.bottom;if(window.matchMedia("(min-width: 783px)").matches){const e=document.querySelector("#wp-admin-bar-my-sites>.ab-sub-wrapper");n?(e.style.height="",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="0"):(e.style.height="calc(100vh - 32px)",e.querySelector("ul#wp-admin-bar-my-sites-list").style.paddingBottom="32px")}}))}),{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]}).observe(n),await async function(e){const t=await e.getFirstRow();void 0!==t&&void 0!==t.timestamp&&pluginAllSitesMenu.timestamp>t.timestamp&&await e.delete();0===await e.count()&&ar(e,0)}(t);const r=function(e,t){const n=new IntersectionObserver((n=>{n.forEach((e=>{const{isIntersecting:n}=e;n&&t()}),{root:e})}));return n.observe(e),n}(e.load,(async()=>{const n=(await t.read(pluginAllSitesMenu.orderBy)).reduce(((e,t)=>e+function(e){return`\n\t\t\t\t<li id="wp-admin-bar-${e.id}" class="menupop">\n\t\t\t\t<a class="ab-item" aria-haspopup="true" href="${e.admin}/"><span class="wp-admin-bar-arrow" aria-hidden="true"></span>\n\t\t\t\t\t${e.title}\n\t\t\t\t</a>\n\t\t\t\t<div class="ab-sub-wrapper">\n\t\t\t\t\t<ul id="wp-admin-bar-${e.id}-default" class="ab-submenu">\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-d"><a class="ab-item"\thref="${e.admin}">${(0,hr.__)("Dashboard","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-n"><a class="ab-item" href="${e.admin}/post-new.php">${(0,hr.__)("New Post","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-o"><a class="ab-item" href="${e.admin}/post-new.php?post_type=page">${(0,hr.__)("New Page","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-c"><a class="ab-item" href="${e.admin}/edit-comments.php">${(0,hr.__)("Manage Comments","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-u"><a class="ab-item" href="${e.admin}/users.php">${(0,hr.__)("Users","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-p"><a class="ab-item" href="${e.admin}/plugins.php">${(0,hr.__)("Plugins","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-s"><a class="ab-item" href="${e.admin}/options-general.php">${(0,hr.__)("Settings","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t\t<li id="wp-admin-bar-${e.id}-v"><a class="ab-item" href="${e.url}/">${(0,hr.__)("Visit","super-admin-all-sites-menu")}</a></li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t`}(t)),"");e.load.insertAdjacentHTML("beforeBegin",n),function(){const e=document.getElementById("wp-admin-bar-my-sites-list");e&&(e.addEventListener("mouseenter",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&lr(e.target,"hover")}),{capture:!0}),e.addEventListener("mouseleave",(e=>{e.stopPropagation(),e.target.classList.contains("menupop")&&ur(e.target,"hover")}),{capture:!0}),e.addEventListener("keydown",(e=>{"Tab"===e.key&&(e.preventDefault(),e.target.classList.contains("menupop")&&toggleClass(e.target,"hover"))}),{capture:!0}))}(),e.load.style.display="none",r.unobserve(e.load)}))}))})();
  • super-admin-all-sites-menu/trunk/readme.txt

    r2986044 r3036551  
    11=== Super Admin All Sites Menu ===
    2 Stable tag: 1.6.6
     2Stable tag: 1.6.7
    33Requires at least: 5.6 
    44Tested up to: 6.4 
     
    101101== Changelog ==
    102102
     103= 1.6.7 =
     104
     105- Update dependencies
     106
    103107= 1.6.6 =
    104108
  • super-admin-all-sites-menu/trunk/super-admin-all-sites-menu.php

    r2986044 r3036551  
    1313 * GitHub Plugin URI: https://github.com/soderlind/super-admin-all-sites-menu
    1414 * Description: For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.
    15  * Version:     1.6.6
     15 * Version:     1.6.7
    1616 * Author:      Per Soderlind
    1717 * Network:     true
Note: See TracChangeset for help on using the changeset viewer.