UNPKG

106 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/helpers/defineProperty"),require("@babel/runtime/regenerator"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/assertThisInitialized"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("@babel/runtime/helpers/typeof")):"function"==typeof define&&define.amd?define(["@babel/runtime/helpers/asyncToGenerator","@babel/runtime/helpers/defineProperty","@babel/runtime/regenerator","@babel/runtime/helpers/createClass","@babel/runtime/helpers/classCallCheck","@babel/runtime/helpers/assertThisInitialized","@babel/runtime/helpers/inherits","@babel/runtime/helpers/possibleConstructorReturn","@babel/runtime/helpers/getPrototypeOf","@babel/runtime/helpers/typeof"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).createFileUploader=t(e._asyncToGenerator,e._defineProperty,e._regeneratorRuntime,e._createClass,e._classCallCheck,e._assertThisInitialized,e._inherits,e._possibleConstructorReturn,e._getPrototypeOf,e._typeof)}(this,(function(e,t,n,r,s,i,a,o,u,c){"use strict";var l={exports:{}};!function(e,t){e.exports=function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],s=e[2],i=e[3];r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&s)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|s>>>15)+i|0)&i|~s&n)+t[3]-1044525330|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&s)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|s>>>15)+i|0)&i|~s&n)+t[7]-45705983|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&s)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|s>>>15)+i|0)&i|~s&n)+t[11]-1990404162|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&s)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|s>>>15)+i|0)&i|~s&n)+t[15]+1236535329|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&s|r&~s)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|s>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&s|r&~s)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|s>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&s|r&~s)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|s>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&s|r&~s)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|s>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^s)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|s>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^s)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|s>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^s)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|s>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^s)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|s>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~s))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[14]-1416354905|0)<<15|s>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~s))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[10]-1051523|0)<<15|s>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~s))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[6]-1560198380|0)<<15|s>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~s))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[2]+718787259|0)<<15|s>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+s|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=s+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,s,i,a,o,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,r(e.substring(t-64,t)));for(s=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<s;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(a[2],16),u=parseInt(a[1],16)||0,i[14]=o,i[15]=u,n(l,i),l}function a(e){var t,r,i,a,o,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,s(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(a[2],16),u=parseInt(a[1],16)||0,i[14]=o,i[15]=u,n(l,i),l}function o(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function u(e){var t;for(t=0;t<e.length;t+=1)e[t]=o(e[t]);return e.join("")}function c(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e,t){var n,r=e.length,s=new ArrayBuffer(r),i=new Uint8Array(s);for(n=0;n<r;n+=1)i[n]=e.charCodeAt(n);return t?i:s}function h(e){return String.fromCharCode.apply(null,new Uint8Array(e))}function f(e,t,n){var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e)),r.set(new Uint8Array(t),e.byteLength),n?r:r.buffer}function d(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function p(){this.reset()}return u(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var s,i,a,o,u=this.byteLength,c=t(n,u),l=u;return r!==e&&(l=t(r,u)),c>l?new ArrayBuffer(0):(s=l-c,i=new ArrayBuffer(s),a=new Uint8Array(i),o=new Uint8Array(this,c,s),a.set(o),i)}}(),p.prototype.append=function(e){return this.appendBinary(c(e)),this},p.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,s=this._buff.length;for(t=64;t<=s;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},p.prototype.end=function(e){var t,n,r=this._buff,s=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<s;t+=1)i[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,s),n=u(this._hash),e&&(n=d(n)),this.reset(),n},p.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},p.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},p.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},p.prototype._finish=function(e,t){var r,s,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=s,e[15]=i,n(this._hash,e)},p.hash=function(e,t){return p.hashBinary(c(e),t)},p.hashBinary=function(e,t){var n=u(i(e));return t?d(n):n},p.ArrayBuffer=function(){this.reset()},p.ArrayBuffer.prototype.append=function(e){var t,r=f(this._buff.buffer,e,!0),i=r.length;for(this._length+=e.byteLength,t=64;t<=i;t+=64)n(this._hash,s(r.subarray(t-64,t)));return this._buff=t-64<i?new Uint8Array(r.buffer.slice(t-64)):new Uint8Array(0),this},p.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,s=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<s;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,s),n=u(this._hash),e&&(n=d(n)),this.reset(),n},p.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},p.ArrayBuffer.prototype.getState=function(){var e=p.prototype.getState.call(this);return e.buff=h(e.buff),e},p.ArrayBuffer.prototype.setState=function(e){return e.buff=l(e.buff,!0),p.prototype.setState.call(this,e)},p.ArrayBuffer.prototype.destroy=p.prototype.destroy,p.ArrayBuffer.prototype._finish=p.prototype._finish,p.ArrayBuffer.hash=function(e,t){var n=u(a(new Uint8Array(e)));return t?d(n):n},p}()}(l);var h=l.exports;const f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,d=Object.keys,p=Array.isArray;function y(e,t){return"object"!=typeof t||d(t).forEach((function(n){e[n]=t[n]})),e}"undefined"==typeof Promise||f.Promise||(f.Promise=Promise);const m=Object.getPrototypeOf,b={}.hasOwnProperty;function g(e,t){return b.call(e,t)}function v(e,t){"function"==typeof t&&(t=t(m(e))),("undefined"==typeof Reflect?d:Reflect.ownKeys)(t).forEach((n=>{w(e,n,t[n])}))}const _=Object.defineProperty;function w(e,t,n,r){_(e,t,y(n&&g(n,"get")&&"function"==typeof n.get?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function x(e){return{from:function(t){return e.prototype=Object.create(t.prototype),w(e.prototype,"constructor",e),{extend:v.bind(null,e.prototype)}}}}const k=Object.getOwnPropertyDescriptor;function A(e,t){let n;return k(e,t)||(n=m(e))&&A(n,t)}const O=[].slice;function P(e,t,n){return O.call(e,t,n)}function C(e,t){return t(e)}function S(e){if(!e)throw new Error("Assertion Failed")}function E(e){f.setImmediate?setImmediate(e):setTimeout(e,0)}function R(e,t){return e.reduce(((e,n,r)=>{var s=t(n,r);return s&&(e[s[0]]=s[1]),e}),{})}function j(e,t){if(g(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=j(e,t[r]);n.push(i)}return n}var a=t.indexOf(".");if(-1!==a){var o=e[t.substr(0,a)];return void 0===o?void 0:j(o,t.substr(a+1))}}function K(e,t,n){if(e&&void 0!==t&&(!("isFrozen"in Object)||!Object.isFrozen(e)))if("string"!=typeof t&&"length"in t){S("string"!=typeof n&&"length"in n);for(var r=0,s=t.length;r<s;++r)K(e,t[r],n[r])}else{var i=t.indexOf(".");if(-1!==i){var a=t.substr(0,i),o=t.substr(i+1);if(""===o)void 0===n?p(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var u=e[a];u&&g(e,a)||(u=e[a]={}),K(u,o,n)}}else void 0===n?p(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function B(e){var t={};for(var n in e)g(e,n)&&(t[n]=e[n]);return t}const D=[].concat;function I(e){return D.apply([],e)}const T="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(I([8,16,32,64].map((e=>["Int","Uint","Float"].map((t=>t+e+"Array")))))).filter((e=>f[e])),N=T.map((e=>f[e]));R(T,(e=>[e,!0]));let F=null;function q(e){F="undefined"!=typeof WeakMap&&new WeakMap;const t=M(e);return F=null,t}function M(e){if(!e||"object"!=typeof e)return e;let t=F&&F.get(e);if(t)return t;if(p(e)){t=[],F&&F.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(M(e[n]))}else if(N.indexOf(e.constructor)>=0)t=e;else{const n=m(e);for(var s in t=n===Object.prototype?{}:Object.create(n),F&&F.set(e,t),e)g(e,s)&&(t[s]=M(e[s]))}return t}const{toString:U}={};function L(e){return U.call(e).slice(8,-1)}const $="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",z="symbol"==typeof $?function(e){var t;return null!=e&&(t=e[$])&&t.apply(e)}:function(){return null},V={};function W(e){var t,n,r,s;if(1===arguments.length){if(p(e))return e.slice();if(this===V&&"string"==typeof e)return[e];if(s=z(e)){for(n=[];!(r=s.next()).done;)n.push(r.value);return n}if(null==e)return[e];if("number"==typeof(t=e.length)){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}const Y="undefined"!=typeof Symbol?e=>"AsyncFunction"===e[Symbol.toStringTag]:()=>!1;var G="undefined"!=typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function H(e,t){G=e,Q=t}var Q=()=>!0;const X=!new Error("").stack;function J(){if(X)try{throw J.arguments,new Error}catch(e){return e}return new Error}function Z(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(Q).map((e=>"\n"+e)).join("")):""}var ee=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],te=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(ee),ne={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 re(e,t){this._e=J(),this.name=e,this.message=t}function se(e,t){return e+". Errors: "+Object.keys(t).map((e=>t[e].toString())).filter(((e,t,n)=>n.indexOf(e)===t)).join("\n")}function ie(e,t,n,r){this._e=J(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=se(e,t)}function ae(e,t){this._e=J(),this.name="BulkError",this.failures=Object.keys(t).map((e=>t[e])),this.failuresByPos=t,this.message=se(e,t)}x(re).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Z(this._e,2))}},toString:function(){return this.name+": "+this.message}}),x(ie).from(re),x(ae).from(re);var oe=te.reduce(((e,t)=>(e[t]=t+"Error",e)),{});const ue=re;var ce=te.reduce(((e,t)=>{var n=t+"Error";function r(e,r){this._e=J(),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=ne[t]||n,this.inner=null)}return x(r).from(ue),e[t]=r,e}),{});ce.Syntax=SyntaxError,ce.Type=TypeError,ce.Range=RangeError;var le=ee.reduce(((e,t)=>(e[t+"Error"]=ce[t],e)),{});var he=te.reduce(((e,t)=>(-1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=ce[t]),e)),{});function fe(){}function de(e){return e}function pe(e,t){return null==e||e===de?t:function(n){return t(e(n))}}function ye(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function me(e,t){return e===fe?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?ye(r,this.onsuccess):r),s&&(this.onerror=this.onerror?ye(s,this.onerror):s),void 0!==i?i:n}}function be(e,t){return e===fe?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?ye(n,this.onsuccess):n),r&&(this.onerror=this.onerror?ye(r,this.onerror):r)}}function ge(e,t){return e===fe?t:function(n){var r=e.apply(this,arguments);y(n,r);var s=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return s&&(this.onsuccess=this.onsuccess?ye(s,this.onsuccess):s),i&&(this.onerror=this.onerror?ye(i,this.onerror):i),void 0===r?void 0===a?void 0:a:y(r,a)}}function ve(e,t){return e===fe?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function _e(e,t){return e===fe?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)}}he.ModifyError=ie,he.DexieError=re,he.BulkError=ae;var we={};const[xe,ke,Ae]="undefined"==typeof Promise?[]:(()=>{let e=Promise.resolve();if("undefined"==typeof crypto||!crypto.subtle)return[e,m(e),e];const t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,m(t),e]})(),Oe=ke&&ke.then,Pe=xe&&xe.constructor,Ce=!!Ae;var Se=!1,Ee=Ae?()=>{Ae.then(Je)}:f.setImmediate?setImmediate.bind(null,Je):f.MutationObserver?()=>{var e=document.createElement("div");new MutationObserver((()=>{Je(),e=null})).observe(e,{attributes:!0}),e.setAttribute("i","1")}:()=>{setTimeout(Je,0)},Re=function(e,t){qe.push([e,t]),Ke&&(Ee(),Ke=!1)},je=!0,Ke=!0,Be=[],De=[],Ie=null,Te=de,Ne={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:kt,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach((e=>{try{kt(e[0],e[1])}catch(e){}}))}},Fe=Ne,qe=[],Me=0,Ue=[];function Le(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=fe,this._lib=!1;var t=this._PSD=Fe;if(G&&(this._stackHolder=J(),this._prev=null,this._numPrev=0),"function"!=typeof e){if(e!==we)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(!1===this._state&&We(this,this._value))}this._state=null,this._value=null,++t.ref,Ve(this,e)}const $e={get:function(){var e=Fe,t=ut;function n(n,r){var s=!e.global&&(e!==Fe||t!==ut);const i=s&&!ft();var a=new Le(((t,a)=>{Ge(this,new ze(_t(n,e,s,i),_t(r,e,s,i),t,a,e))}));return G&&Xe(a,this),a}return n.prototype=we,n},set:function(e){w(this,"then",e&&e.prototype===we?$e:{get:function(){return e},set:$e.set})}};function ze(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 Ve(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&&Ze();t&&"function"==typeof t.then?Ve(e,((e,n)=>{t instanceof Le?t._then(e,n):t.then(e,n)})):(e._state=!0,e._value=t,Ye(e)),n&&et()}}),We.bind(null,e))}catch(t){We(e,t)}}function We(e,t){if(De.push(t),null===e._state){var n=e._lib&&Ze();t=Te(t),e._state=!1,e._value=t,G&&null!==t&&"object"==typeof t&&!t._promise&&function(e,t,n){try{e.apply(null,n)}catch(e){t&&t(e)}}((()=>{var n=A(t,"stack");t._promise=e,w(t,"stack",{get:()=>Se?n&&(n.get?n.get.apply(t):n.value):e.stack})})),function(e){Be.some((t=>t._value===e._value))||Be.push(e)}(e),Ye(e),n&&et()}}function Ye(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Ge(e,t[n]);var s=e._PSD;--s.ref||s.finalize(),0===Me&&(++Me,Re((()=>{0==--Me&&tt()}),[]))}function Ge(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,++Me,Re(He,[n,e,t])}else e._listeners.push(t)}function He(e,t,n){try{Ie=t;var r,s=t._value;t._state?r=e(s):(De.length&&(De=[]),r=e(s),-1===De.indexOf(s)&&function(e){var t=Be.length;for(;t;)if(Be[--t]._value===e._value)return void Be.splice(t,1)}(t)),n.resolve(r)}catch(e){n.reject(e)}finally{Ie=null,0==--Me&&tt(),--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,a=e._value;null!=a?(s=a.name||"Error",i=a.message||a,r=Z(a,0)):(s=a,i=""),t.push(s+(i?": "+i:"")+r)}return G&&((r=Z(e._stackHolder,2))&&-1===t.indexOf(r)&&t.push(r),e._prev&&Qe(e._prev,t,n)),t}function Xe(e,t){var n=t?t._numPrev+1:0;n<100&&(e._prev=t,e._numPrev=n)}function Je(){Ze()&&et()}function Ze(){var e=je;return je=!1,Ke=!1,e}function et(){var e,t,n;do{for(;qe.length>0;)for(e=qe,qe=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}}while(qe.length>0);je=!0,Ke=!0}function tt(){var e=Be;Be=[],e.forEach((e=>{e._PSD.onunhandled.call(null,e._value,e)}));for(var t=Ue.slice(0),n=t.length;n;)t[--n]()}function nt(e){return new Le(we,!1,e)}function rt(e,t){var n=Fe;return function(){var r=Ze(),s=Fe;try{return mt(n,!0),e.apply(this,arguments)}catch(e){t&&t(e)}finally{mt(s,!1),r&&et()}}}v(Le.prototype,{then:$e,_then:function(e,t){Ge(this,new ze(null,null,e,t,Fe))},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):nt(e))):this.then(null,(e=>e&&e.name===t?n(e):nt(e)))},finally:function(e){return this.then((t=>(e(),t)),(t=>(e(),nt(t))))},stack:{get:function(){if(this._stack)return this._stack;try{Se=!0;var e=Qe(this,[],20).join("\nFrom previous: ");return null!==this._state&&(this._stack=e),e}finally{Se=!1}}},timeout:function(e,t){return e<1/0?new Le(((n,r)=>{var s=setTimeout((()=>r(new ce.Timeout(t))),e);this.then(n,r).finally(clearTimeout.bind(null,s))})):this}}),"undefined"!=typeof Symbol&&Symbol.toStringTag&&w(Le.prototype,Symbol.toStringTag,"Dexie.Promise"),Ne.env=bt(),v(Le,{all:function(){var e=W.apply(null,arguments).map(dt);return new Le((function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(((s,i)=>Le.resolve(s).then((n=>{e[i]=n,--r||t(e)}),n)))}))},resolve:e=>{if(e instanceof Le)return e;if(e&&"function"==typeof e.then)return new Le(((t,n)=>{e.then(t,n)}));var t=new Le(we,!0,e);return Xe(t,Ie),t},reject:nt,race:function(){var e=W.apply(null,arguments).map(dt);return new Le(((t,n)=>{e.map((e=>Le.resolve(e).then(t,n)))}))},PSD:{get:()=>Fe,set:e=>Fe=e},totalEchoes:{get:()=>ut},newPSD:lt,usePSD:gt,scheduler:{get:()=>Re,set:e=>{Re=e}},rejectionMapper:{get:()=>Te,set:e=>{Te=e}},follow:(e,t)=>new Le(((n,r)=>lt(((t,n)=>{var r=Fe;r.unhandleds=[],r.onunhandled=n,r.finalize=ye((function(){!function(e){function t(){e(),Ue.splice(Ue.indexOf(t),1)}Ue.push(t),++Me,Re((()=>{0==--Me&&tt()}),[])}((()=>{0===this.unhandleds.length?t():n(this.unhandleds[0])}))}),r.finalize),e()}),t,n,r)))}),Pe&&(Pe.allSettled&&w(Le,"allSettled",(function(){const e=W.apply(null,arguments).map(dt);return new Le((t=>{0===e.length&&t([]);let n=e.length;const r=new Array(n);e.forEach(((e,s)=>Le.resolve(e).then((e=>r[s]={status:"fulfilled",value:e}),(e=>r[s]={status:"rejected",reason:e})).then((()=>--n||t(r)))))}))})),Pe.any&&"undefined"!=typeof AggregateError&&w(Le,"any",(function(){const e=W.apply(null,arguments).map(dt);return new Le(((t,n)=>{0===e.length&&n(new AggregateError([]));let r=e.length;const s=new Array(r);e.forEach(((e,i)=>Le.resolve(e).then((e=>t(e)),(e=>{s[i]=e,--r||n(new AggregateError(s))}))))}))})));const st={awaits:0,echoes:0,id:0};var it=0,at=[],ot=0,ut=0,ct=0;function lt(e,t,n,r){var s=Fe,i=Object.create(s);i.parent=s,i.ref=0,i.global=!1,i.id=++ct;var a=Ne.env;i.env=Ce?{Promise:Le,PromiseProp:{value:Le,configurable:!0,writable:!0},all:Le.all,race:Le.race,allSettled:Le.allSettled,any:Le.any,resolve:Le.resolve,reject:Le.reject,nthen:wt(a.nthen,i),gthen:wt(a.gthen,i)}:{},t&&y(i,t),++s.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()};var o=gt(i,e,n,r);return 0===i.ref&&i.finalize(),o}function ht(){return st.id||(st.id=++it),++st.awaits,st.echoes+=100,st.id}function ft(){return!!st.awaits&&(0==--st.awaits&&(st.id=0),st.echoes=100*st.awaits,!0)}function dt(e){return st.echoes&&e&&e.constructor===Pe?(ht(),e.then((e=>(ft(),e)),(e=>(ft(),At(e))))):e}function pt(e){++ut,st.echoes&&0!=--st.echoes||(st.echoes=st.id=0),at.push(Fe),mt(e,!0)}function yt(){var e=at[at.length-1];at.pop(),mt(e,!1)}function mt(e,t){var n=Fe;if((t?!st.echoes||ot++&&e===Fe:!ot||--ot&&e===Fe)||vt(t?pt.bind(null,e):yt),e!==Fe&&(Fe=e,n===Ne&&(Ne.env=bt()),Ce)){var r=Ne.env.Promise,s=e.env;ke.then=s.nthen,r.prototype.then=s.gthen,(n.global||e.global)&&(Object.defineProperty(f,"Promise",s.PromiseProp),r.all=s.all,r.race=s.race,r.resolve=s.resolve,r.reject=s.reject,s.allSettled&&(r.allSettled=s.allSettled),s.any&&(r.any=s.any))}}function bt(){var e=f.Promise;return Ce?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(f,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:ke.then,gthen:e.prototype.then}:{}}function gt(e,t,n,r,s){var i=Fe;try{return mt(e,!0),t(n,r,s)}finally{mt(i,!1)}}function vt(e){Oe.call(xe,e)}function _t(e,t,n,r){return"function"!=typeof e?e:function(){var s=Fe;n&&ht(),mt(t,!0);try{return e.apply(this,arguments)}finally{mt(s,!1),r&&vt(ft)}}}function wt(e,t){return function(n,r){return e.call(this,_t(n,t),_t(r,t))}}-1===(""+Oe).indexOf("[native code]")&&(ht=ft=fe);const xt="unhandledrejection";function kt(e,t){var n;try{n=t.onuncatched(e)}catch(e){}if(!1!==n)try{var r,s={promise:t,reason:e};if(f.document&&document.createEvent?((r=document.createEvent("Event")).initEvent(xt,!0,!0),y(r,s)):f.CustomEvent&&y(r=new CustomEvent(xt,{detail:s}),s),r&&f.dispatchEvent&&(dispatchEvent(r),!f.PromiseRejectionEvent&&f.onunhandledrejection))try{f.onunhandledrejection(r)}catch(e){}G&&r&&!r.defaultPrevented&&console.warn(`Unhandled rejection: ${e.stack||e}`)}catch(e){}}var At=Le.reject;function Ot(e,t,n,r){if(e.idbdb&&(e._state.openComplete||Fe.letThrough||e._vip)){var s=e._createTransaction(t,n,e._dbSchema);try{s.create(),e._state.PR1398_maxLoop=3}catch(s){return s.name===oe.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Ot(e,t,n,r)))):At(s)}return s._promise(t,((e,t)=>lt((()=>(Fe.trans=s,r(e,t,s)))))).then((e=>s._completion.then((()=>e))))}if(e._state.openComplete)return At(new ce.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return At(new ce.DatabaseClosed);e.open().catch(fe)}return e._state.dbReadyPromise.then((()=>Ot(e,t,n,r)))}const Pt="3.2.2",Ct=String.fromCharCode(65535),St=-1/0,Et="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Rt="String expected.",jt=[],Kt="undefined"!=typeof navigator&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Bt=Kt,Dt=Kt,It=e=>!/(dexie\.js|dexie\.min\.js)/.test(e),Tt="__dbnames",Nt="readonly",Ft="readwrite";function qt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}const Mt={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Ut(e){return"string"!=typeof e||/\./.test(e)?e=>e:t=>(void 0===t[e]&&e in t&&delete(t=q(t))[e],t)}class Lt{_trans(e,t,n){const r=this._tx||Fe.trans,s=this.name;function i(e,n,r){if(!r.schema[s])throw new ce.NotFound("Table "+s+" not part of transaction");return t(r.idbtrans,r)}const a=Ze();try{return r&&r.db===this.db?r===Fe.trans?r._promise(e,i,n):lt((()=>r._promise(e,i,n)),{trans:r,transless:Fe.transless||Fe}):Ot(this.db,e,[this.name],i)}finally{a&&et()}}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(p(e))return new this.db.WhereClause(this,`[${e.join("+")}]`);const t=d(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);const n=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(n&&this.db._maxKey!==Ct)return this.where(n.name).equals(n.keyPath.map((t=>e[t])));!n&&G&&console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${t.join("+")}]`);const{idxByName:r}=this.schema,s=this.db._deps.indexedDB;function i(e,t){try{return 0===s.cmp(e,t)}catch(e){return!1}}const[a,o]=t.reduce((([t,n],s)=>{const a=r[s],o=e[s];return[t||a,t||!a?qt(n,a&&a.multi?e=>{const t=j(e,s);return p(t)&&t.some((e=>i(o,e)))}:e=>i(o,j(e,s))):n]}),[null,null]);return a?this.where(a.name).equals(e[a.keyPath]).filter(o):n?this.filter(o):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,p(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(g(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){y(this,e)}))}add(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=Ut(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]}))).then((e=>e.numFailures?Le.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{K(e,r,t)}catch(e){}return t}))}update(e,t){if("object"!=typeof e||p(e))return this.where(":id").equals(e).modify(t);{const n=j(e,this.schema.primKey.keyPath);if(void 0===n)return At(new ce.InvalidArgument("Given object does not contain its primary key"));try{"function"!=typeof t?d(t).forEach((n=>{K(e,n,t[n])})):t(e,{value:e,primKey:n})}catch(e){}return this.where(":id").equals(n).modify(t)}}put(e,t){const{auto:n,keyPath:r}=this.schema.primKey;let s=e;return r&&n&&(s=Ut(r)(e)),this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null}))).then((e=>e.numFailures?Le.reject(e.failures[0]):e.lastResult)).then((t=>{if(r)try{K(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?Le.reject(e.failures[0]):void 0))}clear(){return this._trans("readwrite",(e=>this.core.mutate({trans:e,type:"deleteRange",range:Mt}))).then((e=>e.numFailures?Le.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 ce.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new ce.InvalidArgument("Arguments objects and keys must have the same length");const a=e.length;let o=i&&n?e.map(Ut(i)):e;return this.core.mutate({trans:t,type:"add",keys:r,values:o,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new ae(`${this.name}.bulkAdd(): ${e} of ${a} 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 ce.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(r&&r.length!==e.length)throw new ce.InvalidArgument("Arguments objects and keys must have the same length");const a=e.length;let o=i&&n?e.map(Ut(i)):e;return this.core.mutate({trans:t,type:"put",keys:r,values:o,wantResults:s}).then((({numFailures:e,results:t,lastResult:n,failures:r})=>{if(0===e)return s?t:n;throw new ae(`${this.name}.bulkPut(): ${e} of ${a} 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 ae(`${this.name}.bulkDelete(): ${e} of ${t} operations failed`,r)}))}}function $t(e){var t={},n=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]};n.addEventType=i;for(var r=1,s=arguments.length;r<s;++r)i(arguments[r]);return n;function i(e,r,s){if("object"==typeof e)return a(e);r||(r=ve),s||(s=fe);var i={subscribers:[],fire:s,subscribe:function(e){-1===i.subscribers.indexOf(e)&&(i.subscribers.push(e),i.fire=r(i.fire,e))},unsubscribe:function(e){i.subscribers=i.subscribers.filter((function(t){return t!==e})),i.fire=i.subscribers.reduce(r,s)}};return t[e]=n[e]=i,i}function a(e){d(e).forEach((function(t){var n=e[t];if(p(n))i(t,e[t][0],e[t][1]);else{if("asap"!==n)throw new ce.InvalidArgument("Invalid event config");var r=i(t,de,(function(){for(var e=arguments.length,t=new Array(e);e--;)t[e]=arguments[e];r.subscribers.forEach((function(e){E((function(){e.apply(null,t)}))}))}))}}))}}function zt(e,t){return x(t).from({prototype:e}),t}function Vt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function Wt(e,t){e.filter=qt(e.filter,t)}function Yt(e,t,n){var r=e.replayFilter;e.replayFilter=r?()=>qt(r(),t()):t,e.justLimit=n&&!r}function Gt(e,t){if(e.isPrimKey)return t.primaryKey;const n=t.getIndexByKeyPath(e.index);if(!n)throw new ce.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Ht(e,t,n){const r=Gt(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?qt(e.filter,e.replayFilter()):e.filter;if(e.or){const i={},a=(e,n,r)=>{if(!s||s(n,r,(e=>n.stop(e)),(e=>n.fail(e)))){var a=n.primaryKey,o=""+a;"[object ArrayBuffer]"===o&&(o=""+new Uint8Array(a)),g(i,o)||(i[o]=!0,t(e,n,r))}};return Promise.all([e.or._iterate(a,n),Xt(Ht(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}return Xt(Ht(e,r,n),qt(e.algorithm,s),t,!e.keysOnly&&e.valueMapper)}function Xt(e,t,n,r){var s=rt(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=fe}),(t=>{e.fail(t),n=fe}))||s(e.value,e,(e=>n=e)),n()}))}))}function Jt(e,t){try{const n=Zt(e),r=Zt(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}(en(e),en(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=Jt(e[n],t[n]);if(0!==r)return r}return n===r?0:n<r?-1:1}(e,t)}}catch(e){}return NaN}function Zt(e){const t=typeof e;if("object"!==t)return t;if(ArrayBuffer.isView(e))return"binary";const n=L(e);return"ArrayBuffer"===n?"binary":n}function en(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}class tn{_read(e,t){var n=this._ctx;return n.error?n.table._trans(null,At.bind(null,n.error)):n.table._trans("readonly",e).then(t)}_write(e){var t=this._ctx;return t.error?t.table._trans(null,At.bind(null,t.error)):t.table._trans("readwrite",e,"locked")}_addAlgorithm(e){var t=this._ctx;t.algorithm=qt(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&&y(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(Vt(t,!0))return n.count({trans:e,query:{index:Gt(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 a="next"===this._ctx.dir?1:-1;function o(e,t){var n=i(e,s),r=i(t,s);return n<r?-a:n>r?a:0}return this.toArray((function(e){return e.sort(o)})).then(t)}toArray(e){return this._read((e=>{var t=this._ctx;if("next"===t.dir&&Vt(t,!0)&&t.limit>0){const{valueMapper:n}=t,r=Gt(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,Vt(t)?Yt(t,(()=>{var t=e;return(e,n)=>0===t||(1===t?(--t,!1):(n((()=>{e.advance(t),t=0})),!1))})):Yt(t,(()=>{var t=e;return()=>--t<0}))),this}limit(e){return this._ctx.limit=Math.min(this._ctx.limit,e),Yt(this._ctx,(()=>{var t=e;return function(e,n,r){return--t<=0&&n(r),t>=0}}),!0),this}until(e,t){return Wt(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 Wt(this._ctx,(function(t){return e(t.value)})),t=this._ctx,n=e,t.isMatch=qt(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&&Vt(t,!0)&&t.limit>0)return this._read((e=>{var n=Gt(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 Wt(this._ctx,(function(e){var t=e.primaryKey.toString(),r=g(n,t);return n[t]=!0,!r})),this}modify(e){var t=this._ctx;return this._write((n=>{var r;if("function"==typeof e)r=e;else{var s=d(e),i=s.length;r=function(t){for(var n=!1,r=0;r<i;++r){var a=s[r],o=e[a];j(t,a)!==o&&(K(t,a,o),n=!0)}return n}}const a=t.table.core,{outbound:o,extractKey:u}=a.schema.primaryKey,c=this.db._options.modifyChunkSize||200,l=[];let h=0;const f=[],p=(e,t)=>{const{failures:n,numFailures:r}=t;h+=e-r;for(let e of d(n))l.push(n[e])};return this.clone().primaryKeys().then((s=>{const i=l=>{const h=Math.min(c,s.length-l);return a.getMany({trans:n,keys:s.slice(l,l+h),cache:"immutable"}).then((f=>{const d=[],y=[],m=o?[]:null,b=[];for(let e=0;e<h;++e){const t=f[e],n={value:q(t),primKey:s[l+e]};!1!==r.call(n,n.value,n)&&(null==n.value?b.push(s[l+e]):o||0===Jt(u(t),u(n.value))?(y.push(n.value),o&&m.push(s[l+e])):(b.push(s[l+e]),d.push(n.value)))}const g=Vt(t)&&t.limit===1/0&&("function"!=typeof e||e===nn)&&{index:t.index,range:t.range};return Promise.resolve(d.length>0&&a.mutate({trans:n,type:"add",values:d}).then((e=>{for(let t in e.failures)b.splice(parseInt(t),1);p(d.length,e)}))).then((()=>(y.length>0||g&&"object"==typeof e)&&a.mutate({trans:n,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===nn)&&a.mutate({trans:n,type:"delete",keys:b,criteria:g}).then((e=>p(b.length,e))))).then((()=>s.length>l+h&&i(l+c)))}))};return i(0).then((()=>{if(l.length>0)throw new ie("Error modifying one or more objects",l,h,f);return s.length}))}))}))}delete(){var e=this._ctx,t=e.range;return Vt(e)&&(e.isPrimKey&&!Dt||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 ie("Could not delete some values",Object.keys(e).map((t=>e[t])),t-s);return t-s}))))})):this.modify(nn)}}const nn=(e,t)=>t.value=null;function rn(e,t){return e<t?-1:e===t?0:1}function sn(e,t){return e>t?-1:e===t?0:1}function an(e,t,n){var r=e instanceof fn?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function on(e){return new e.Collection(e,(()=>hn(""))).limit(0)}function un(e,t,n,r,s,i){for(var a=Math.min(e.length,r.length),o=-1,u=0;u<a;++u){var c=t[u];if(c!==r[u])return s(e[u],n[u])<0?e.substr(0,u)+n[u]+n.substr(u+1):s(e[u],r[u])<0?e.substr(0,u)+r[u]+n.substr(u+1):o>=0?e.substr(0,o)+t[o]+n.substr(o+1):null;s(e[u],c)<0&&(o=u)}return a<r.length&&"next"===i?e+n.substr(e.length):a<e.length&&"prev"===i?e.substr(0,n.length):o<0?null:e.substr(0,o)+r[o]+n.substr(o+1)}function cn(e,t,n,r){var s,i,a,o,u,c,l,h=n.length;if(!n.every((e=>"string"==typeof e)))return an(e,Rt);function f(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),a="next"===e?rn:sn;var t=n.map((function(e){return{lower:i(e),upper:s(e)}})).sort((function(e,t){return a(e.lower,t.lower)}));o=t.map((function(e){return e.upper})),u=t.map((function(e){return e.lower})),c=e,l="next"===e?"":r}f("next");var d=new e.Collection(e,(()=>ln(o[0],u[h-1]+r)));d._ondirectionchange=function(e){f(e)};var p=0;return d._addAlgorithm((function(e,n,r){var s=e.key;if("string"!=typeof s)return!1;var f=i(s);if(t(f,u,p))return!0;for(var d=null,y=p;y<h;++y){var m=un(s,f,o[y],u[y],a,c);null===m&&null===d?p=y+1:(null===d||a(d,m)>0)&&(d=m)}return n(null!==d?function(){e.continue(d+l)}:r),!1})),d}function ln(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function hn(e){return{type:1,lower:e,upper:e}}class fn{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)?on(this):new this.Collection(this,(()=>ln(e,t,!n,!r)))}catch(e){return an(this,Et)}}equals(e){return null==e?an(this,Et):new this.Collection(this,(()=>hn(e)))}above(e){return null==e?an(this,Et):new this.Collection(this,(()=>ln(e,void 0,!0)))}aboveOrEqual(e){return null==e?an(this,Et):new this.Collection(this,(()=>ln(e,void 0,!1)))}below(e){return null==e?an(this,Et):new this.Collection(this,(()=>ln(void 0,e,!1,!0)))}belowOrEqual(e){return null==e?an(this,Et):new this.Collection(this,(()=>ln(void 0,e)))}startsWith(e){return"string"!=typeof e?an(this,Rt):this.between(e,e+Ct,!0,!0)}startsWithIgnoreCase(e){return""===e?this.startsWith(e):cn(this,((e,t)=>0===e.indexOf(t[0])),[e],Ct)}equalsIgnoreCase(e){return cn(this,((e,t)=>e===t[0]),[e],"")}anyOfIgnoreCase(){var e=W.apply(V,arguments);return 0===e.length?on(this):cn(this,((e,t)=>-1!==t.indexOf(e)),e,"")}startsWithAnyOfIgnoreCase(){var e=W.apply(V,arguments);return 0===e.length?on(this):cn(this,((e,t)=>t.some((t=>0===e.indexOf(t)))),e,Ct)}anyOf(){const e=W.apply(V,arguments);let t=this._cmp;try{e.sort(t)}catch(e){return an(this,Et)}if(0===e.length)return on(this);const n=new this.Collection(this,(()=>ln(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 a=n.key;for(;t(a,e[r])>0;)if(++r,r===e.length)return s(i),!1;return 0===t(a,e[r])||(s((()=>{n.continue(e[r])})),!1)})),n}notEqual(e){return this.inAnyRange([[St,e],[e,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})}noneOf(){const e=W.apply(V,arguments);if(0===e.length)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return an(this,Et)}const t=e.reduce(((e,t)=>e?e.concat([[e[e.length-1][1],t]]):[[St,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,a=this._max;if(0===e.length)return on(this);if(!e.every((e=>void 0!==e[0]&&void 0!==e[1]&&r(e[0],e[1])<=0)))return an(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",ce.InvalidArgument);const o=!t||!1!==t.includeLowers,u=t&&!0===t.includeUppers;let c,l=r;function h(e,t){return l(e[0],t[0])}try{c=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]=a(s[1],t[1]);break}}return r===s&&e.push(t),e}),[]),c.sort(h)}catch(e){return an(this,Et)}let f=0;const d=u?e=>r(e,c[f][1])>0:e=>r(e,c[f][1])>=0,p=o?e=>s(e,c[f][0])>0:e=>s(e,c[f][0])>=0;let y=d;const m=new this.Collection(this,(()=>ln(c[0][0],c[c.length-1][1],!o,!u)));return m._ondirectionchange=e=>{"next"===e?(y=d,l=r):(y=p,l=s),c.sort(h)},m._addAlgorithm(((e,t,n)=>{for(var s=e.key;y(s);)if(++f,f===c.length)return t(n),!1;return!!function(e){return!d(e)&&!p(e)}(s)||(0===this._cmp(s,c[f][1])||0===this._cmp(s,c[f][0])||t((()=>{l===r?e.continue(c[f][0]):e.continue(c[f][1])})),!1)})),m}startsWithAnyOf(){const e=W.apply(V,arguments);return e.every((e=>"string"==typeof e))?0===e.length?on(this):this.inAnyRange(e.map((e=>[e,e+Ct]))):an(this,"startsWithAnyOf() only works with strings")}}function dn(e){return rt((function(t){return pn(t),e(t.target.error),!1}))}function pn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}const yn="storagemutated",mn="x-storagemutated-1",bn=$t(null,yn);class gn{_lock(){return S(!Fe.global),++this._reculock,1!==this._reculock||Fe.global||(Fe.lockOwnerFor=this),this}_unlock(){if(S(!Fe.global),0==--this._reculock)for(Fe.global||(Fe.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var e=this._blockedFuncs.shift();try{gt(e[1],e[0])}catch(e){}}return this}_locked(){return this._reculock&&Fe.lockOwnerFor!==this}create(e){if(!this.mode)return this;const t=this.db.idbdb,n=this.db._state.dbOpenError;if(S(!this.idbtrans),!e&&!t)switch(n&&n.name){case"DatabaseClosedError":throw new ce.DatabaseClosed(n);case"MissingAPIError":throw new ce.MissingAPI(n.message,n);default:throw new ce.OpenFailed(n)}if(!this.active)throw new ce.TransactionInactive;return S(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=rt((t=>{pn(t),this._reject(e.error)})),e.onabort=rt((t=>{pn(t),this.active&&this._reject(new ce.Abort(e.error)),this.active=!1,this.on("abort").fire(t)})),e.oncomplete=rt((()=>{this.active=!1,this._resolve(),"mutatedParts"in e&&bn.storagemutated.fire(e.mutatedParts)})),this}_promise(e,t,n){if("readwrite"===e&&"readwrite"!==this.mode)return At(new ce.ReadOnly("Transaction is readonly"));if(!this.active)return At(new ce.TransactionInactive);if(this._locked())return new Le(((r,s)=>{this._blockedFuncs.push([()=>{this._promise(e,t,n).then(r,s)},Fe])}));if(n)return lt((()=>{var e=new Le(((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 Le(((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=Le.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 Le(((e,r)=>{n.then((n=>t._waitingQueue.push(rt(e.bind(null,n)))),(e=>t._waitingQueue.push(rt(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 ce.Abort))}table(e){const t=this._memoizedTables||(this._memoizedTables={});if(g(t,e))return t[e];const n=this.schema[e];if(!n)throw new ce.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 vn(e,t,n,r,s,i,a){return{name:e,keyPath:t,unique:n,multi:r,auto:s,compound:i,src:(n&&!a?"&":"")+(r?"*":"")+(s?"++":"")+_n(t)}}function _n(e){return"string"==typeof e?e:e?"["+[].join.call(e,"+")+"]":""}function wn(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:R(n,(e=>[e.name,e]))}}let xn=e=>{try{return e.only([[]]),xn=()=>[[]],[[]]}catch(e){return xn=()=>Ct,Ct}};function kn(e){return null==e?()=>{}:"string"==typeof e?function(e){return 1===e.split(".").length?t=>t[e]:t=>j(t,e)}(e):t=>j(t,e)}function An(e){return[].slice.call(e)}let On=0;function Pn(e){return null==e?":id":"string"==typeof e?e:`[${e.join("+")}]`}function Cn(e,t,n){function r(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:s,hasGetAll:i}=function(e,t){const n=An(e.objectStoreNames);return{schema:{name:e.name,tables:n.map((e=>t.objectStore(e))).map((e=>{const{keyPath:t,autoIncrement:n}=e,r=p(t),s=null==t,i={},a={name:e.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:s,compound:r,keyPath:t,autoIncrement:n,unique:!0,extractKey:kn(t)},indexes:An(e.indexNames).map((t=>e.index(t))).map((e=>{const{name:t,unique:n,multiEntry:r,keyPath:s}=e,a={name:t,compound:p(s),keyPath:s,unique:n,multiEntry:r,extractKey:kn(s)};return i[Pn(s)]=a,a})),getIndexByKeyPath:e=>i[Pn(e)]};return i[":id"]=a.primaryKey,null!=t&&(i[Pn(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=s.tables.map((e=>function(e){const t=e.name;return{name:t,schema:e,mutate:function({trans:e,type:n,keys:s,values:i,range:a}){return new Promise(((o,u)=>{o=rt(o);const c=e.objectStore(t),l=null==c.keyPath,h="put"===n||"add"===n;if(!h&&"delete"!==n&&"deleteRange"!==n)throw new Error("Invalid operation type: "+n);const{length:f}=s||i||{length:1};if(s&&i&&s.length!==i.length)throw new Error("Given keys array must have same length as given values array.");if(0===f)return o({numFailures:0,failures:{},results:[],lastResult:void 0});let d;const p=[],y=[];let m=0;const b=e=>{++m,pn(e)};if("deleteRange"===n){if(4===a.type)return o({numFailures:m,failures:y,results:[],lastResult:void 0});3===a.type?p.push(d=c.clear()):p.push(d=c.delete(r(a)))}else{const[e,t]=h?l?[i,s]:[i,null]:[s,null];if(h)for(let r=0;r<f;++r)p.push(d=t&&void 0!==t[r]?c[n](e[r],t[r]):c[n](e[r])),d.onerror=b;else for(let t=0;t<f;++t)p.push(d=c[n](e[t])),d.onerror=b}const g=e=>{const t=e.target.result;p.forEach(((e,t)=>null!=e.error&&(y[t]=e.error))),o({numFailures:m,failures:y,results:"delete"===n?s:p.map((e=>e.result)),lastResult:t})};d.onerror=e=>{b(e),g(e)},d.onsuccess=g}))},getMany:({trans:e,keys:n})=>new Promise(((r,s)=>{r=rt(r);const i=e.objectStore(t),a=n.length,o=new Array(a);let u,c=0,l=0;const h=e=>{const t=e.target;o[t._pos]=t.result,++l===c&&r(o)},f=dn(s);for(let e=0;e<a;++e)null!=n[e]&&(u=i.get(n[e]),u._pos=e,u.onsuccess=h,u.onerror=f,++c);0===c&&r(o)})),get:({trans:e,key:n})=>new Promise(((r,s)=>{r=rt(r);const i=e.objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=dn(s)})),query:function(e){return n=>new Promise(((s,i)=>{s=rt(s);const{trans:a,values:o,limit:u,query:c}=n,l=u===1/0?void 0:u,{index:h,range:f}=c,d=a.objectStore(t),p=h.isPrimaryKey?d:d.index(h.name),y=r(f);if(0===u)return s({result:[]});if(e){const e=o?p.getAll(y,l):p.getAllKeys(y,l);e.onsuccess=e=>s({result:e.target.result}),e.onerror=dn(i)}else{let e=0;const t=o||!("openKeyCursor"in p)?p.openCursor(y):p.openKeyCursor(y),n=[];t.onsuccess=r=>{const i=t.result;return i?(n.push(o?i.value:i.primaryKey),++e===u?s({result:n}):void i.continue()):s({result:n})},t.onerror=dn(i)}}))}(i),openCursor:function({trans:e,values:n,query:s,reverse:i,unique:a}){return new Promise(((o,u)=>{o=rt(o);const{index:c,range:l}=s,h=e.objectStore(t),f=c.isPrimaryKey?h:h.index(c.name),d=i?a?"prevunique":"prev":a?"nextunique":"next",p=n||!("openKeyCursor"in f)?f.openCursor(r(l),d):f.openKeyCursor(r(l),d);p.onerror=dn(u),p.onsuccess=rt((t=>{const n=p.result;if(!n)return void o(null);n.___id=++On,n.done=!1;const r=n.continue.bind(n);let s=n.continuePrimaryKey;s&&(s=s.bind(n));const i=n.advance.bind(n),a=()=>{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=rt(u),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=rt(e),p.onerror=dn(t),n.fail=t,n.stop=t=>{n.stop=n.continue=n.continuePrimaryKey=n.advance=a,e(t)}})),o=()=>{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=rt((e=>{p.onsuccess=o,o()})),n.continue=r,n.continuePrimaryKey=s,n.advance=i,o(),t},o(n)}),u)}))},count({query:e,trans:n}){const{index:s,range:i}=e;return new Promise(((e,a)=>{const o=n.objectStore(t),u=s.isPrimaryKey?o:o.index(s.name),c=r(i),l=c?u.count(c):u.count();l.onsuccess=rt((t=>e(t.target.result))),l.onerror=dn(a)}))}}}(e))),o={};return a.forEach((e=>o[e.name]=e)),{stack:"dbcore",transaction:e.transaction.bind(e),table(e){if(!o[e])throw new Error(`Table '${e}' not found`);return o[e]},MIN_KEY:-1/0,MAX_KEY:xn(t),schema:s}}function Sn({_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)}(Cn(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 En({_novip:e},t,n,r){n.forEach((n=>{const s=r[n];t.forEach((t=>{const r=A(t,n);(!r||"value"in r&&void 0===r.value)&&(t===e.Transaction.prototype||t instanceof e.Transaction?w(t,n,{get(){return this.table(n)},set(e){_(this,n,{value:e,writable:!0,configurable:!0,enumerable:!0})}}):t[n]=new e.Table(n,s))}))}))}function Rn({_novip:e},t){t.forEach((t=>{for(let n in t)t[n]instanceof e.Table&&delete t[n]}))}function jn(e,t){return e._cfg.version-t._cfg.version}function Kn(e,t,n,r){const s=e._dbSchema,i=e._createTransaction("readwrite",e._storeNames,s);i.create(n),i._completion.catch(r);const a=i._reject.bind(i),o=Fe.transless||Fe;lt((()=>{Fe.trans=i,Fe.transless=o,0===t?(d(s).forEach((e=>{Dn(n,e,s[e].primKey,s[e].indexes)})),Sn(e,n),Le.follow((()=>e.on.populate.fire(i))).catch(a)):function({_novip:e},t,n,r){const s=[],i=e._versions;let a=e._dbSchema=Tn(e,e.idbdb,r),o=!1;function u(){return s.length?Le.resolve(s.shift()(n.idbtrans)).then(u):Le.resolve()}return i.filter((e=>e._cfg.version>=t)).forEach((i=>{s.push((()=>{const s=a,u=i._cfg.dbschema;Nn(e,s,r),Nn(e,u,r),a=e._dbSchema=u;const c=Bn(s,u);c.add.forEach((e=>{Dn(r,e[0],e[1].primKey,e[1].indexes)})),c.change.forEach((e=>{if(e.recreate)throw new ce.Upgrade("Not yet support for changing primary key");{const t=r.objectStore(e.name);e.add.forEach((e=>In(t,e))),e.change.forEach((e=>{t.deleteIndex(e.name),In(t,e)})),e.del.forEach((e=>t.deleteIndex(e)))}}));const l=i._cfg.contentUpgrade;if(l&&i._cfg.version>t){Sn(e,r),n._memoizedTables={},o=!0;let t=B(u);c.del.forEach((e=>{t[e]=s[e]})),Rn(e,[e.Transaction.prototype]),En(e,[e.Transaction.prototype],d(t),t),n.schema=t;const i=Y(l);let a;i&&ht();const h=Le.follow((()=>{if(a=l(n),a&&i){var e=ft.bind(null,null);a.then(e,e)}}));return a&&"function"==typeof a.then?Le.resolve(a):h.then((()=>a))}})),s.push((t=>{if(!o||!Bt){!function(e,t){[].slice.call(t.db.objectStoreNames).forEach((n=>null==e[n]&&t.db.deleteObjectStore(n)))}(i._cfg.dbschema,t)}Rn(e,[e.Transaction.prototype]),En(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),n.schema=e._dbSchema}))})),u().then((()=>{var e,t;t=r,d(e=a).forEach((n=>{t.db.objectStoreNames.contains(n)||Dn(t,n,e[n].primKey,e[n].indexes)}))}))}(e,t,i,n).catch(a)}))}function Bn(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&&!Kt)e.recreate=!0,n.change.push(e);else{const t=s.idxByName,r=i.idxByName;let a;for(a in t)r[a]||e.del.push(a);for(a in r){const n=t[a],s=r[a];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 Dn(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=>In(s,e))),s}function In(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Tn(e,t,n){const r={};return P(t.objectStoreNames,0).forEach((e=>{const t=n.objectStore(e);let s=t.keyPath;const i=vn(_n(s),s||"",!1,!1,!!t.autoIncrement,s&&"string"!=typeof s,!0),a=[];for(let e=0;e<t.indexNames.length;++e){const n=t.index(t.indexNames[e]);s=n.keyPath;var o=vn(n.name,s,!!n.unique,!!n.multiEntry,!1,s&&"string"!=typeof s,!1);a.push(o)}r[e]=wn(e,i,a)})),r}function Nn({_novip:e},t,n){const r=n.db.objectStoreNames;for(let s=0;s<r.length;++s){const i=r[s],a=n.objectStore(i);e._hasGetAll="getAll"in a;for(let e=0;e<a.indexNames.length;++e){const n=a.indexNames[e],r=a.index(n).keyPath,s="string"==typeof r?r:"["+P(r).join("+")+"]";if(t[i]){const e=t[i].idxByName[s];e&&(e.name=n,delete t[i].idxByName[s],t[i].idxByName[n]=e)}}}"undefined"!=typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&f.WorkerGlobalScope&&f instanceof f.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}class Fn{_parseStoresSpec(e,t){d(e).forEach((n=>{if(null!==e[n]){var r=e[n].split(",").map(((e,t)=>{const n=(e=e.trim()).replace(/([&*]|\+\+)/g,""),r=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return vn(n,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),p(r),0===t)})),s=r.shift();if(s.multi)throw new ce.Schema("Primary key cannot be multi-valued");r.forEach((e=>{if(e.auto)throw new ce.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new ce.Schema("Index must have a name and cannot be an empty string")})),t[n]=wn(n,s,r)}}))}stores(e){const t=this.db;this._cfg.storesSource=this._cfg.storesSource?y(this._cfg.storesSource,e):e;const n=t._versions,r={};let s={};return n.forEach((e=>{y(r,e._cfg.storesSource),s=e._cfg.dbschema={},e._parseStoresSpec(r,s)})),t._dbSchema=s,Rn(t,[t._allTables,t,t.Transaction.prototype]),En(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],d(s),s),t._storeNames=d(s),this}upgrade(e){return this._cfg.contentUpgrade=_e(this._cfg.contentUpgrade||fe,e),this}}function qn(e,t){let n=e._dbNamesDB;return n||(n=e._dbNamesDB=new or(Tt,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Mn(e){return e&&"function"==typeof e.databases}function Un(e){return lt((function(){return Fe.letThrough=!0,e()}))}function Ln(){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 $n(e){const t=e._state,{indexedDB:n}=e._deps;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then((()=>t.dbOpenError?At(t.dbOpenError):e));G&&(t.openCanceller._stackHolder=J()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;const r=t.openCanceller;function s(){if(t.openCanceller!==r)throw new ce.DatabaseClosed("db.open() was cancelled")}let i=t.dbReadyResolve,a=null,o=!1;return Le.race([r,("undefined"==typeof navigator?Le.resolve():Ln()).then((()=>new Le(((r,i)=>{if(s(),!n)throw new ce.MissingAPI;const u=e.name,c=t.autoSchema?n.open(u):n.open(u,Math.round(10*e.verno));if(!c)throw new ce.MissingAPI;c.onerror=dn(i),c.onblocked=rt(e._fireOnBlocked),c.onupgradeneeded=rt((r=>{if(a=c.transaction,t.autoSchema&&!e._options.allowEmptyDB){c.onerror=pn,a.abort(),c.result.close();const e=n.deleteDatabase(u);e.onsuccess=e.onerror=rt((()=>{i(new ce.NoSuchDatabase(`Database ${u} doesnt exist`))}))}else{a.onerror=dn(i);var s=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;o=s<1,e._novip.idbdb=c.result,Kn(e,s/10,a,i)}}),i),c.onsuccess=rt((()=>{a=null;const n=e._novip.idbdb=c.result,s=P(n.objectStoreNames);if(s.length>0)try{const r=n.transaction(1===(i=s).length?i[0]:i,"readonly");t.autoSchema?function({_novip:e},t,n){e.verno=t.version/10;const r=e._dbSchema=Tn(0,t,n);e._storeNames=P(t.objectStoreNames,0),En(e,[e._allTables],d(r),r)}(e,n,r):(Nn(e,e._dbSchema,r),function(e,t){const n=Bn(Tn(0,e.idbdb,t),e._dbSchema);return!(n.add.length||n.change.some((e=>e.add.length||e.change.length)))}(e,r)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Sn(e,r)}catch(e){}var i;jt.push(e),n.onversionchange=rt((n=>{t.vcFired=!0,e.on("versionchange").fire(n)})),n.onclose=rt((t=>{e.on("close").fire(t)})),o&&function({indexedDB:e,IDBKeyRange:t},n){!Mn(e)&&n!==Tt&&qn(e,t).put({name:n}).catch(fe)}(e._deps,u),r()}),i)}))))]).then((()=>(s(),t.onReadyBeingFired=[],Le.resolve(Un((()=>e.on.ready.fire(e.vip)))).then((function n(){if(t.onReadyBeingFired.length>0){let r=t.onReadyBeingFired.reduce(_e,fe);return t.onReadyBeingFired=[],Le.resolve(Un((()=>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 r===t.openCanceller&&e._close(),At(n)})).finally((()=>{t.openComplete=!0,i()}))}function zn(e){var t=t=>e.next(t),n=s(t),r=s((t=>e.throw(t)));function s(e){return t=>{var s=e(t),i=s.value;return s.done?i:i&&"function"==typeof i.then?i.then(n,r):p(i)?Promise.all(i).then(n,r):n(i)}}return s(t)()}function Vn(e,t,n){var r=arguments.length;if(r<2)throw new ce.InvalidArgument("Too few arguments");for(var s=new Array(r-1);--r;)s[r-1]=arguments[r];n=s.pop();var i=I(s);return[e,i,n]}function Wn(e,t,n,r,s){return Le.resolve().then((()=>{const i=Fe.transless||Fe,a=e._createTransaction(t,n,e._dbSchema,r),o={trans:a,transless:i};if(r)a.idbtrans=r.idbtrans;else try{a.create(),e._state.PR1398_maxLoop=3}catch(r){return r.name===oe.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then((()=>Wn(e,t,n,null,s)))):At(r)}const u=Y(s);let c;u&&ht();const l=Le.follow((()=>{if(c=s.call(a,a),c)if(u){var e=ft.bind(null,null);c.then(e,e)}else"function"==typeof c.next&&"function"==typeof c.throw&&(c=zn(c))}),o);return(c&&"function"==typeof c.then?Le.resolve(c).then((e=>a.active?e:At(new ce.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn")))):l.then((()=>c))).then((e=>(r&&a._resolve(),a._completion.then((()=>e))))).catch((e=>(a._reject(e),At(e))))}))}function Yn(e,t,n){const r=p(e)?e.slice():[e];for(let e=0;e<n;++e)r.push(t);return r}const Gn={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(e){return{...e,table(t){const n=e.table(t),{schema:r}=n,s={},i=[];function a(e,t,n){const r=Pn(e),o=s[r]=s[r]||[],u=null==e?0:"string"==typeof e?1:e.length,c=t>0,l={...n,isVirtual:c,keyTail:t,keyLength:u,extractKey:kn(e),unique:!c&&n.unique};if(o.push(l),l.isPrimaryKey||i.push(l),u>1){a(2===u?e[0]:e.slice(0,u-1),t+1,n)}return o.sort(((e,t)=>e.keyTail-t.keyTail)),l}const o=a(r.primaryKey.keyPath,0,r.primaryKey);s[":id"]=[o];for(const e of r.indexes)a(e.keyPath,0,e);function u(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:Yn(r.lower,r.lowerOpen?e.MAX_KEY:e.MIN_KEY,s),lowerOpen:!0,upper:Yn(r.upper,r.upperOpen?e.MIN_KEY:e.MAX_KEY,s),upperOpen:!0})}}:t;var r,s}const c={...n,schema:{...r,primaryKey:o,indexes:i,getIndexByKeyPath:function(e){const t=s[Pn(e)];return t&&t[0]}},count:e=>n.count(u(e)),query:e=>n.query(u(e)),openCursor(t){const{keyTail:r,isVirtual:s,keyLength:i}=t.query.index;if(!s)return n.openCursor(t);return n.openCursor(u(t)).then((n=>n&&function(n){const s=Object.create(n,{continue:{value:function(s){null!=s?n.continue(Yn(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(Yn(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)))}};return c}}}};function Hn(e,t,n,r){return n=n||{},r=r||"",d(e).forEach((s=>{if(g(t,s)){var i=e[s],a=t[s];if("object"==typeof i&&"object"==typeof a&&i&&a){const e=L(i);e!==L(a)?n[r+s]=t[s]:"Object"===e?Hn(i,a,n,r+s+"."):i!==a&&(n[r+s]=t[s])}else i!==a&&(n[r+s]=t[s])}else n[r+s]=void 0})),d(t).forEach((s=>{g(e,s)||(n[r+s]=t[s])})),n}const Qn={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=Fe.trans,{deleting:i,creating:a,updating:o}=s.table(t).hook;switch(e.type){case"add":if(a.fire===fe)break;return s._promise("readwrite",(()=>u(e)),!0);case"put":if(a.fire===fe&&o.fire===fe)break;return s._promise("readwrite",(()=>u(e)),!0);case"delete":if(i.fire===fe)break;return s._promise("readwrite",(()=>u(e)),!0);case"deleteRange":if(i.fire===fe)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=Fe.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],l={onerror:null,onsuccess:null};if("delete"===e.type)i.fire.call(l,n,c,t);else if("add"===e.type||void 0===c){const i=a.fire.call(l,n,e.values[s],t);null==n&&null!=i&&(n=i,e.keys[s]=n,r.outbound||K(e.values[s],r.keyPath,n))}else{const r=Hn(c,e.values[s]),i=o.fire.call(l,r,n,c,t);if(i){const t=e.values[s];Object.keys(i).forEach((e=>{g(t,e)?t[e]=i[e]:K(t,e,i[e])}))}}return l}));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],a=c[r];null==i?a.onerror&&a.onerror(t[r]):a.onsuccess&&a.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 Xn(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===Jt(t.keys[s],e[i])&&(r.push(n?q(t.values[s]):t.values[s]),++i);return r.length===e.length?r:null}catch(e){return null}}const Jn={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=Xn(e.keys,e.trans._cache,"clone"===e.cache);return t?Le.resolve(t):n.getMany(e).then((t=>(e.trans._cache={keys:e.keys,values:"clone"===e.cache?q(t):t},t)))},mutate:e=>("add"!==e.type&&(e.trans._cache=null),n.mutate(e))}}})};function Zn(e){return!("from"in e)}const er=function(e,t){if(!this){const t=new er;return e&&"d"in e&&y(t,e),t}y(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0})};function tr(e,t,n){const r=Jt(t,n);if(isNaN(r))return;if(r>0)throw RangeError();if(Zn(e))return y(e,{from:t,to:n,d:1});const s=e.l,i=e.r;if(Jt(n,e.from)<0)return s?tr(s,t,n):e.l={from:t,to:n,d:1,l:null,r:null},sr(e);if(Jt(t,e.to)>0)return i?tr(i,t,n):e.r={from:t,to:n,d:1,l:null,r:null},sr(e);Jt(t,e.from)<0&&(e.from=t,e.l=null,e.d=i?i.d+1:1),Jt(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);const a=!e.r;s&&!e.l&&nr(e,s),i&&a&&nr(e,i)}function nr(e,t){Zn(t)||function e(t,{from:n,to:r,l:s,r:i}){tr(t,n,r),s&&e(t,s),i&&e(t,i)}(e,t)}function rr(e){let t=Zn(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&&Jt(e,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||Jt(e,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function sr(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=ir(n)}e.d=ir(e)}function ir({r:e,l:t}){return(e?t?Math.max(e.d,t.d):e.d:t?t.d:0)+1}v(er.prototype,{add(e){return nr(this,e),this},addKey(e){return tr(this,e,e),this},addKeys(e){return e.forEach((e=>tr(this,e,e))),this},[$](){return rr(this)}});const ar={stack:"dbcore",level:0,create:e=>{const t=e.schema.name,n=new er(e.MIN_KEY,e.MAX_KEY);return{...e,table:r=>{const s=e.table(r),{schema:i}=s,{primaryKey:a}=i,{extractKey:o,outbound:u}=a,c={...s,mutate:e=>{const a=e.trans,o=a.mutatedParts||(a.mutatedParts={}),u=e=>{const n=`idb://${t}/${r}/${e}`;return o[n]||(o[n]=new er)},c=u(""),l=u(":dels"),{type:h}=e;let[f,d]="deleteRange"===e.type?[e.range]:"delete"===e.type?[e.keys]:e.values.length<50?[[],e.values]:[];const y=e.trans._cache;return s.mutate(e).then((e=>{if(p(f)){"delete"!==h&&(f=e.results),c.addKeys(f);const t=Xn(f,y);t||"add"===h||l.addKeys(f),(t||d)&&function(e,t,n,r){function s(t){const s=e(t.name||"");function i(e){return null!=e?t.extractKey(e):null}const a=e=>t.multiEntry&&p(e)?e.forEach((e=>s.addKey(e))):s.addKey(e);(n||r).forEach(((e,t)=>{const s=n&&i(n[t]),o=r&&i(r[t]);0!==Jt(s,o)&&(null!=s&&a(s),null!=o&&a(o))}))}t.indexes.forEach(s)}(u,i,t,d)}else if(f){const e={from:f.lower,to:f.upper};l.add(e),c.add(e)}else c.add(n),l.add(n),i.indexes.forEach((e=>u(e.name).add(n)));return e}))}},l=({query:{index:t,range:n}})=>{var r,s;return[t,new er(null!==(r=n.lower)&&void 0!==r?r:e.MIN_KEY,null!==(s=n.upper)&&void 0!==s?s:e.MAX_KEY)]},h={get:e=>[a,new er(e.key)],getMany:e=>[a,(new er).addKeys(e.keys)],count:l,query:l,openCursor:l};return d(h).forEach((e=>{c[e]=function(i){const{subscr:a}=Fe;if(a){const c=e=>{const n=`idb://${t}/${r}/${e}`;return a[n]||(a[n]=new er)},l=c(""),f=c(":dels"),[d,p]=h[e](i);if(c(d.name||"").add(p),!d.isPrimaryKey){if("count"!==e){const t="query"===e&&u&&i.values&&s.query({...i,values:!1});return s[e].apply(this,arguments).then((n=>{if("query"===e){if(u&&i.values)return t.then((({result:e})=>(l.addKeys(e),n)));const e=i.values?n.result.map(o):n.result;i.values?l.addKeys(e):f.addKeys(e)}else if("openCursor"===e){const e=n,t=i.values;return e&&Object.create(e,{key:{get:()=>(f.addKey(e.primaryKey),e.key)},primaryKey:{get(){const t=e.primaryKey;return f.addKey(t),t}},value:{get:()=>(t&&l.addKey(e.primaryKey),e.value)}})}return n}))}f.add(n)}}return s[e].apply(this,arguments)}})),c}}}};class or{constructor(e,t){this._middlewares={},this.verno=0;const n=or.dependencies;this._options=t={addons:or.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:fe,dbReadyPromise:null,cancelOpen:fe,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};s.dbReadyPromise=new Le((e=>{s.dbReadyResolve=e})),s.openCanceller=new Le(((e,t)=>{s.cancelOpen=t})),this._state=s,this.name=e,this.on=$t(this,"populate","blocked","versionchange","close",{ready:[_e,fe]}),this.on.ready.subscribe=C(this.on.ready.subscribe,(e=>(t,n)=>{or.vip((()=>{const r=this._state;if(r.openComplete)r.dbOpenError||Le.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=function(e){return zt(tn.prototype,(function(t,n){this.db=e;let r=Mt,s=null;if(n)try{r=n()}catch(e){s=e}const i=t._ctx,a=i.table,o=a.hook.reading.fire;this._ctx={table:a,index:i.index,isPrimKey:!i.index||a.schema.primKey.keyPath&&i.index===a.schema.primKey.name,range:r,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:s,or:i.or,valueMapper:o!==de?o:null}}))}(this),this.Table=function(e){return zt(Lt.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:$t(null,{creating:[me,fe],reading:[pe,de],updating:[ge,fe],deleting:[be,fe]})}))}(this),this.Transaction=function(e){return zt(gn.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=$t(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 Le(((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(),At(e)}))}))}(this),this.Version=function(e){return zt(Fn.prototype,(function(t){this.db=e,this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}(this),this.WhereClause=function(e){return zt(fn.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 ce.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=xn(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),jt.filter((e=>e.name===this.name&&e!==this&&!e._state.vcFired)).map((t=>t.on("versionchange").fire(e)))},this.use(Gn),this.use(Qn),this.use(ar),this.use(Jn),this.vip=Object.create(this,{_vip:{value:!0}}),r.forEach((e=>e(this)))}version(e){if(isNaN(e)||e<.1)throw new ce.Type("Given version is not a positive number");if(e=Math.round(10*e)/10,this.idbdb||this._state.isBeingOpened)throw new ce.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(jn),n.stores({}),this._state.autoSchema=!1,n)}_whenReady(e){return this.idbdb&&(this._state.openComplete||Fe.letThrough||this._vip)?e():new Le(((e,t)=>{if(this._state.openComplete)return t(new ce.DatabaseClosed(this._state.dbOpenError));if(!this._state.isBeingOpened){if(!this._options.autoOpen)return void t(new ce.DatabaseClosed);this.open().catch(fe)}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 $n(this)}_close(){const e=this._state,t=jt.indexOf(this);if(t>=0&&jt.splice(t,1),this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Le((t=>{e.dbReadyResolve=t})),e.openCanceller=new Le(((t,n)=>{e.cancelOpen=n}))}close(){this._close();const e=this._state;this._options.autoOpen=!1,e.dbOpenError=new ce.DatabaseClosed,e.isBeingOpened&&e.cancelOpen(e.dbOpenError)}delete(){const e=arguments.length>0,t=this._state;return new Le(((n,r)=>{const s=()=>{this.close();var e=this._deps.indexedDB.deleteDatabase(this.name);e.onsuccess=rt((()=>{!function({indexedDB:e,IDBKeyRange:t},n){!Mn(e)&&n!==Tt&&qn(e,t).delete(n).catch(fe)}(this._deps,this.name),n()})),e.onerror=dn(r),e.onblocked=this._fireOnBlocked};if(e)throw new ce.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 d(this._allTables).map((e=>this._allTables[e]))}transaction(){const e=Vn.apply(this,arguments);return this._transaction.apply(this,e)}_transaction(e,t,n){let r=Fe.trans;r&&r.db===this&&-1===e.indexOf("!")||(r=null);const s=-1!==e.indexOf("?");let i,a;e=e.replace("!","").replace("?","");try{if(a=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===Nt)i=Nt;else{if("rw"!=e&&e!=Ft)throw new ce.InvalidArgument("Invalid transaction mode: "+e);i=Ft}if(r){if(r.mode===Nt&&i===Ft){if(!s)throw new ce.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");r=null}r&&a.forEach((e=>{if(r&&-1===r.storeNames.indexOf(e)){if(!s)throw new ce.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)})):At(e)}const o=Wn.bind(null,this,i,a,r,n);return r?r._promise(i,o,"lock"):Fe.trans?gt(Fe.transless,(()=>this._whenReady(o))):this._whenReady(o)}table(e){if(!g(this._allTables,e))throw new ce.InvalidTable(`Table ${e} does not exist`);return this._allTables[e]}}const ur="undefined"!=typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable";class cr{constructor(e){this._subscribe=e}subscribe(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})}[ur](){return this}}function lr(e,t){return d(t).forEach((n=>{nr(e[n]||(e[n]=new er),t[n])})),e}let hr;try{hr={indexedDB:f.indexedDB||f.mozIndexedDB||f.webkitIndexedDB||f.msIndexedDB,IDBKeyRange:f.IDBKeyRange||f.webkitIDBKeyRange}}catch(e){hr={indexedDB:null,IDBKeyRange:null}}const fr=or;function dr(e){let t=pr;try{pr=!0,bn.storagemutated.fire(e)}finally{pr=t}}v(fr,{...he,delete:e=>new fr(e,{addons:[]}).delete(),exists:e=>new fr(e,{addons:[]}).open().then((e=>(e.close(),!0))).catch("NoSuchDatabaseError",(()=>!1)),getDatabaseNames(e){try{return function({indexedDB:e,IDBKeyRange:t}){return Mn(e)?Promise.resolve(e.databases()).then((e=>e.map((e=>e.name)).filter((e=>e!==Tt)))):qn(e,t).toCollection().primaryKeys()}(fr.dependencies).then(e)}catch(e){return At(new ce.MissingAPI)}},defineClass:()=>function(e){y(this,e)},ignoreTransaction:e=>Fe.trans?gt(Fe.transless,e):e(),vip:Un,async:function(e){return function(){try{var t=zn(e.apply(this,arguments));return t&&"function"==typeof t.then?t:Le.resolve(t)}catch(e){return At(e)}}},spawn:function(e,t,n){try{var r=zn(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:Le.resolve(r)}catch(e){return At(e)}},currentTransaction:{get:()=>Fe.trans||null},waitFor:function(e,t){const n=Le.resolve("function"==typeof e?fr.ignoreTransaction(e):e).timeout(t||6e4);return Fe.trans?Fe.trans.waitFor(n):n},Promise:Le,debug:{get:()=>G,set:e=>{H(e,"dexie"===e?()=>!0:It)}},derive:x,extend:y,props:v,override:C,Events:$t,on:bn,liveQuery:function(e){return new cr((t=>{const n=Y(e);let r=!1,s={},i={};const a={get closed(){return r},unsubscribe:()=>{r=!0,bn.storagemutated.unsubscribe(l)}};t.start&&t.start(a);let o=!1,u=!1;function c(){return d(i).some((e=>s[e]&&function(e,t){const n=rr(t);let r=n.next();if(r.done)return!1;let s=r.value;const i=rr(e);let a=i.next(s.from),o=a.value;for(;!r.done&&!a.done;){if(Jt(o.from,s.to)<=0&&Jt(o.to,s.from)>=0)return!0;Jt(s.from,o.from)<0?s=(r=n.next(o.from)).value:o=(a=i.next(s.from)).value}return!1}(s[e],i[e])))}const l=e=>{lr(s,e),c()&&h()},h=()=>{if(o||r)return;s={};const f={},d=function(t){n&&ht();const r=()=>lt(e,{subscr:t,trans:null}),s=Fe.trans?gt(Fe.transless,r):r();return n&&s.then(ft,ft),s}(f);u||(bn(yn,l),u=!0),o=!0,Promise.resolve(d).then((e=>{o=!1,r||(c()?h():(s={},i=f,t.next&&t.next(e)))}),(e=>{o=!1,t.error&&t.error(e),a.unsubscribe()}))};return h(),a}))},extendObservabilitySet:lr,getByKeyPath:j,setByKeyPath:K,delByKeyPath:function(e,t){"string"==typeof t?K(e,t,void 0):"length"in t&&[].map.call(t,(function(t){K(e,t,void 0)}))},shallowClone:B,deepClone:q,getObjectDiff:Hn,cmp:Jt,asap:E,minKey:St,addons:[],connections:jt,errnames:oe,dependencies:hr,semVer:Pt,version:Pt.split(".").map((e=>parseInt(e))).reduce(((e,t,n)=>e+t/Math.pow(10,2*n)))}),fr.maxKey=xn(fr.dependencies.IDBKeyRange),"undefined"!=typeof dispatchEvent&&"undefined"!=typeof addEventListener&&(bn(yn,(e=>{if(!pr){let t;Kt?(t=document.createEvent("CustomEvent"),t.initCustomEvent(mn,!0,!0,e)):t=new CustomEvent(mn,{detail:e}),pr=!0,dispatchEvent(t),pr=!1}})),addEventListener(mn,(({detail:e})=>{pr||dr(e)})));let pr=!1;if("undefined"!=typeof BroadcastChannel){const e=new BroadcastChannel(mn);bn(yn,(t=>{pr||e.postMessage(t)})),e.onmessage=e=>{e.data&&dr(e.data)}}else if("undefined"!=typeof self&&"undefined"!=typeof navigator){bn(yn,(e=>{try{pr||("undefined"!=typeof localStorage&&localStorage.setItem(mn,JSON.stringify({trig:Math.random(),changedParts:e})),"object"==typeof self.clients&&[...self.clients.matchAll({includeUncontrolled:!0})].forEach((t=>t.postMessage({type:mn,changedParts:e}))))}catch(e){}})),"undefined"!=typeof addEventListener&&addEventListener("storage",(e=>{if(e.key===mn){const t=JSON.parse(e.newValue);t&&dr(t.changedParts)}}));const e=self.document&&navigator.serviceWorker;e&&e.addEventListener("message",(function({data:e}){e&&e.type===mn&&dr(e.changedParts)}))}function yr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=u(e);if(t){var s=u(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return o(this,n)}}Le.rejectionMapper=function(e,t){if(!e||e instanceof re||e instanceof TypeError||e instanceof SyntaxError||!e.name||!le[e.name])return e;var n=new le[e.name](t||e.message,e);return"stack"in e&&w(n,"stack",{get:function(){return this.inner.stack}}),n},H(G,It);var mr=new(function(e){a(o,e);var n=yr(o);function o(){var e;return s(this,o),e=n.call(this,"fileDataBase"),t(i(e),"files",void 0),e.version(2).stores({files:"++id, spaceName"}),e}return r(o)}(or)),br=function(){self.onmessage=function(e){!function(e){if("object"===("undefined"==typeof exports?"undefined":c(exports)))module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var t;try{t=window}catch(e){t=self}t.SparkMD5=e()}}((function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(e,t){var n=e[0],r=e[1],s=e[2],i=e[3];r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&s)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|s>>>15)+i|0)&i|~s&n)+t[3]-1044525330|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&s)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|s>>>15)+i|0)&i|~s&n)+t[7]-45705983|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&s)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|s>>>15)+i|0)&i|~s&n)+t[11]-1990404162|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&s|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&s)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|s>>>15)+i|0)&i|~s&n)+t[15]+1236535329|0)<<22|r>>>10)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&s|r&~s)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|s>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&s|r&~s)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|s>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&s|r&~s)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|s>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r&i|s&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&s|r&~s)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|s>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^s)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|s>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^s)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|s>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^s)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|s>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+s|0,r=((r+=((s=((s+=((i=((i+=((n=((n+=(r^s^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^s)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|s>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~s))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[14]-1416354905|0)<<15|s>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~s))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[10]-1051523|0)<<15|s>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~s))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[6]-1560198380|0)<<15|s>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+s|0,r=((r+=((i=((i+=(r^((n=((n+=(s^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~s))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((s=((s+=(n^(i|~r))+t[2]+718787259|0)<<15|s>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+s|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=s+e[2]|0,e[3]=i+e[3]|0}function r(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function s(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function i(e){var t,s,i,a,o,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,r(e.substring(t-64,t)));for(s=(e=e.substring(t-64)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<s;t+=1)i[t>>2]|=e.charCodeAt(t)<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(a[2],16),u=parseInt(a[1],16)||0,i[14]=o,i[15]=u,n(l,i),l}function a(e){var n,r="";for(n=0;n<4;n+=1)r+=t[e>>8*n+4&15]+t[e>>8*n&15];return r}function o(e){var t;for(t=0;t<e.length;t+=1)e[t]=a(e[t]);return e.join("")}function u(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function c(e){var t,n=[],r=e.length;for(t=0;t<r-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function l(){this.reset()}return o(i("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function t(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(n,r){var s,i,a,o,u=this.byteLength,c=t(n,u),l=u;return r!==e&&(l=t(r,u)),c>l?new ArrayBuffer(0):(s=l-c,i=new ArrayBuffer(s),a=new Uint8Array(i),o=new Uint8Array(this,c,s),a.set(o),i)}}(),l.prototype.append=function(e){return this.appendBinary(u(e)),this},l.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,s=this._buff.length;for(t=64;t<=s;t+=64)n(this._hash,r(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},l.prototype.end=function(e){var t,n,r=this._buff,s=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<s;t+=1)i[t>>2]|=r.charCodeAt(t)<<(t%4<<3);return this._finish(i,s),n=o(this._hash),e&&(n=c(n)),this.reset(),n},l.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},l.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l.prototype._finish=function(e,t){var r,s,i,a=t;if(e[a>>2]|=128<<(a%4<<3),a>55)for(n(this._hash,e),a=0;a<16;a+=1)e[a]=0;r=(r=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(r[2],16),i=parseInt(r[1],16)||0,e[14]=s,e[15]=i,n(this._hash,e)},l.hash=function(e,t){return l.hashBinary(u(e),t)},l.hashBinary=function(e,t){var n=o(i(e));return t?c(n):n},l.ArrayBuffer=function(){this.reset()},l.ArrayBuffer.prototype.append=function(e){var t,r,i,a,o,u=(r=this._buff.buffer,i=e,a=!0,(o=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r)),o.set(new Uint8Array(i),r.byteLength),a?o:o.buffer),c=u.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)n(this._hash,s(u.subarray(t-64,t)));return this._buff=t-64<c?new Uint8Array(u.buffer.slice(t-64)):new Uint8Array(0),this},l.ArrayBuffer.prototype.end=function(e){var t,n,r=this._buff,s=r.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<s;t+=1)i[t>>2]|=r[t]<<(t%4<<3);return this._finish(i,s),n=o(this._hash),e&&(n=c(n)),this.reset(),n},l.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.ArrayBuffer.prototype.getState=function(){var e,t=l.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},l.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,r=e.length,s=new ArrayBuffer(r),i=new Uint8Array(s);for(n=0;n<r;n+=1)i[n]=e.charCodeAt(n);return t?i:s}(e.buff,!0),l.prototype.setState.call(this,e)},l.ArrayBuffer.prototype.destroy=l.prototype.destroy,l.ArrayBuffer.prototype._finish=l.prototype._finish,l.ArrayBuffer.hash=function(e,t){var r=o(function(e){var t,r,i,a,o,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)n(l,s(e.subarray(t-64,t)));for(r=(e=t-64<c?e.subarray(t-64):new Uint8Array(0)).length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t<r;t+=1)i[t>>2]|=e[t]<<(t%4<<3);if(i[t>>2]|=128<<(t%4<<3),t>55)for(n(l,i),t=0;t<16;t+=1)i[t]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(a[2],16),u=parseInt(a[1],16)||0,i[14]=o,i[15]=u,n(l,i),l}(new Uint8Array(e)));return t?c(r):r},l}));var t=e.data,n=t.data;try{var r=SparkMD5.hash(n);postMessage({result:!0,data:r,index:t.index,task:t.task})}catch(e){postMessage({result:!1,data:e,index:t.index,task:t.task})}}},gr={},vr=[],_r=function(e,t){var n,r,s=0,i=0,a=function(e){var t=e.data;t.result?gr[t.task][t.index].resolve(t.data):gr[t.task][t.index].reject(t.data)};return n=e,r=vr,Array.isArray(n)&&Array.isArray(r)&&n.length===r.length&&n.every((function(e,t){return e===r[t]}))||(e.forEach((function(e){e.addEventListener("message",a)})),vr=e),function(n){var r=function(){},a=function(){},o=new Promise((function(o,u){r=o,a=u;var c=e.length;e[i].postMessage({data:n,index:s,task:t}),i>=c-1?i=0:i++}));return gr[t]||(gr[t]=[]),gr[t][s]={resolve:r,reject:a},s++,o.finally((function(){gr[t][s]=void 0}))}},wr=function(e){var t=-1;return e.some((function(e,n){return t=n,"waiting"===e.status}))?e[t]:void 0};function xr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kr(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?xr(Object(r),!0).forEach((function(n){t(e,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ar=function(e){return e.filter((function(e){return"cancel"!==e.status})).reverse()},Or=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,r=n.idRef,s=n.upload,i=n.updateUploadDataList,a=n.computeProgress,o=n.update,u=n.resolve,c=n.reject,l=n.sliceStartRef,h=n.length,f=n.index,d=n.numberOfChunks,p=n.chunks,y=n.customParamsRef,m=n.retryCountLimit,b=n._retryCountRef,g=n.suspendedRef,v=n.canceledRef,_=n.currentUploadListRef,w=n.offlineStorage,x=n.spaceName,k=n.file,A=n.currentUpdateDataRef,O=n.hashSum,P=n.currentNumberOfRequestRef,C=n.maxNumberOfRequest,S=arguments.length>2?arguments[2]:void 0;if(!v.current){var E=function(t){b.current<m?(b.current++,e(t,{idRef:r,upload:s,updateUploadDataList:i,computeProgress:a,update:o,resolve:u,reject:c,sliceStartRef:l,length:h,index:f,numberOfChunks:d,chunks:p,customParamsRef:y,retryCountLimit:m,_retryCountRef:b,suspendedRef:g,canceledRef:v,currentUploadListRef:_,offlineStorage:w,spaceName:x,file:k,currentUpdateDataRef:A,hashSum:O,currentNumberOfRequestRef:P,maxNumberOfRequest:C})):(l.current=t,i(f,{status:"failure",progress:a(t)}),o(Ar(_.current)),c(t))};if(S&&P.current<C)i(f,{status:"uploading"}),o(Ar(_.current)),void 0!==r.current&&("number"==typeof r.current?mr.files.update(r.current,{status:"uploading"}):r.current.then((function(e){mr.files.update(e,{status:"uploading"})}))),P.current++;else if(S&&P.current>=C)return i(f,{status:"waiting"}),o(Ar(_.current)),void(void 0!==r.current&&("number"==typeof r.current?mr.files.update(r.current,{status:"waiting"}):r.current.then((function(e){mr.files.update(e,{status:"waiting"})}))));var R=t+d;s({chunks:p.slice(t,R),start:t,end:R-1,size:h,hashSum:O},y.current,(function(e){e&&(i(f,kr({},e)),o(Ar(_.current)))})).then((function(t){if(!g.current&&!v.current)if(w&&void 0!==r.current&&("number"==typeof r.current?mr.files.update(r.current,{status:"uploading",start:R,end:R+d,customParams:y.current}):A.current={status:"uploading",start:R,end:R+d,customParams:y.current}),b.current=0,y.current=t,l.current=R,i(f,{status:"uploading",progress:a(R)}),o(Ar(_.current)),R>=h){P.current--,l.current=h,i(f,{status:"completed",progress:a(h),result:t}),o(Ar(_.current)),u(!0),void 0!==r.current&&("number"==typeof r.current?mr.files.delete(r.current):r.current.then((function(e){mr.files.delete(e)})));var n=wr(_.current);n&&n.resume()}else e(R,{idRef:r,upload:s,updateUploadDataList:i,computeProgress:a,update:o,resolve:u,reject:c,sliceStartRef:l,length:h,index:f,numberOfChunks:d,chunks:p,customParamsRef:y,retryCountLimit:m,_retryCountRef:b,suspendedRef:g,canceledRef:v,currentUploadListRef:_,offlineStorage:w,spaceName:x,file:k,currentUpdateDataRef:A,hashSum:O,currentNumberOfRequestRef:P,maxNumberOfRequest:C})})).catch((function(){g.current||v.current||(w&&void 0!==r.current&&("number"==typeof r.current?mr.files.update(r.current,{status:"failure",start:t,end:t+d}):A.current={status:"failure",start:t,end:t+d}),E(t))}))}},Pr=function(t){var r,s,i=new Blob(["(".concat(br,")()")],{type:"application/javascript"}),a=URL.createObjectURL(i);return function(i,o,u,c){var l,f=i.slice,d=i.sliceSize,p=i.minSlicedFileSize,y=i.numberOfChunks,m=i.retryCountLimit,b=i.multiple,g=i.accept,v=i.offlineStorage,_=i.spaceName,w=i.immediately,x=i.sizeLimit,k=i.numberOfThreads,A=i.openHash,O=i.maxNumberOfRequest,P=i.upload,C=i.update,S=i.checkHash,E=k>1?(l=a,new Array(k).fill(!0).map((function(){return new Worker(l)}))):[];if(s=function(){var t=e(n.mark((function t(r,s){var i,a,l,b,g,R,j,K;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!s&&!r.target){t.next=13;break}if(!(i=s?Array.isArray(r)?r:Array.from(r):Array.from(r.target.files).filter((function(e){return!x||e.size>=x[0]&&e.size<=x[1]})))){t.next=13;break}return a={current:0},l=function(e){return{status:"initialization",progress:0,file:i[e],result:null,createTimestamp:(new Date).getTime(),total:0}},b=i.map((function(e,t){var n=l(t),r=o.length;return o[r]=n,n})),g=function(e,t){return Reflect.ownKeys(t).forEach((function(n){b[e][n]=t[n]})),b},C(Ar(o)),R=i.map(function(){var t=e(n.mark((function t(r,s){var u,c,l,x,R,j,K,B,D,I,T,N,F,q,M,U,L,$,z,V,W,Y;return n.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(u=new h,c=[],l=r.size,x={current:0},R=0,j="",K=function(e){return e/R},!(f&&l>=p)){t.next=51;break}B=Math.ceil(l/d),D=_r(E,"".concat(Math.random().toFixed(6),"-").concat(s)),I=[],T=0;case 12:if(!(T<B)){t.next=30;break}if(N=r.slice(T*d,(T+1)*d),c.push(N),!(A&&k>1)){t.next=22;break}return t.next=18,N.text();case 18:F=t.sent,I[T]=D(F),t.next=27;break;case 22:if(!(A&&k<=1)){t.next=27;break}return t.next=25,N.text();case 25:q=t.sent,u.append(q);case 27:T++,t.next=12;break;case 30:if(R=c.length,!A){t.next=47;break}if(!(k>1)){t.next=39;break}return t.next=35,Promise.all(I);case 35:M=t.sent,j=M.reduce((function(e,t){return e+t}),""),t.next=40;break;case 39:j=u.end();case 40:if(!S){t.next=45;break}return t.next=43,S(j);case 43:!0===(U=t.sent)?(x.current=R,g(s,{status:"completed",progress:1}),C(Ar(o))):"number"==typeof U&&(x.current=U,g(s,{status:"suspended",progress:K(U)}),C(Ar(o)));case 45:t.next=49;break;case 47:g(s,{status:"suspended"}),C(Ar(o));case 49:t.next=53;break;case 51:c.push(r),R=c.length;case 53:return g(s,{total:R}),C(Ar(o)),L={current:0},$={current:!1},z={current:!1},V={current:void 0},W={current:o},Y={current:void 0},t.abrupt("return",new Promise(function(){var t=e(n.mark((function e(t,r){var u,l,h,f;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u={current:void 0},l=function(){if($.current=!0,"uploading"===b[s].status){a.current--,g(s,{status:"suspended",progress:K(x.current)}),C(Ar(o));var e=wr(W.current);e&&e.resume(),void 0!==u.current&&"number"!=typeof u.current?u.current.then((function(e){mr.files.update(e,{status:"suspended",start:x.current,end:x.current+y})})):"number"==typeof u.current&&mr.files.update(u.current,{status:"suspended",start:x.current,end:x.current+y})}},f=function(){a.current--,z.current=!0,g(s,{status:"cancel"}),C(Ar(o)),void 0!==u.current&&"number"!=typeof u.current?u.current.then((function(e){mr.files.delete(e)})):"number"==typeof u.current&&mr.files.delete(u.current),t(!0)},g(s,{pause:l,resume:h=function(){if("initialization"===b[s].status||"suspended"===b[s].status||"failure"===b[s].status){L.current=0,$.current=!1;var e=x.current;Or(e,{idRef:u,upload:P,updateUploadDataList:g,computeProgress:K,update:C,resolve:t,reject:r,sliceStartRef:x,length:R,index:s,numberOfChunks:y,chunks:c,customParamsRef:V,retryCountLimit:m,_retryCountRef:L,suspendedRef:$,canceledRef:z,currentUploadListRef:W,offlineStorage:v,spaceName:_,file:i[s],currentUpdateDataRef:Y,hashSum:j,currentNumberOfRequestRef:a,maxNumberOfRequest:O},!0)}},remove:f}),v&&x.current<R&&(u.current=mr.files.add({file:i[s],chunks:c,status:"suspended",start:0,end:y,customParams:V.current,spaceName:_||"",hashSum:j,createTimestamp:b[s].createTimestamp}),u.current.then((function(e){Y.current&&(mr.files.update(e,Y.current),u.current=e)}))),w&&x.current<R&&h();case 7:case"end":return e.stop()}}),e)})));return function(e,n){return t.apply(this,arguments)}}()));case 62:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()),t.next=11,Promise.all(R);case 11:(j=t.sent).every((function(e){return!0===e}))?u():(K=j.reduce((function(e,t,n){return!0!==t&&e.push(n),e}),[]).map((function(e){return i[e]})),c(K));case 13:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),!t)return r?(r.value="",r):((r=document.createElement("input")).style.display="none",r.type="file",r.multiple=!!b,r.accept=g,r.addEventListener("change",(function(e){return s(e)})),r);s(t,!0)}},Cr=function(e){return kr(kr({},{slice:!0,sliceSize:1e5,minSlicedFileSize:1e6,numberOfChunks:1,retryCountLimit:3,multiple:!0,accept:"",offlineStorage:!1,spaceName:"",immediately:!0,sizeLimit:null,numberOfThreads:3,openHash:!0,maxNumberOfRequest:6,gotCache:function(){},update:function(){},error:function(e){console.error("Large-File-Uploader occurred errors, error detail:"),console.error(e)},success:function(){},checkHash:void 0}),e)},Sr=function(){var t=e(n.mark((function e(t,r){var s,i,a,o,u;return n.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=r.spaceName,e.next=3,mr.files.where("spaceName").equals(s).toArray();case 3:if(i=e.sent,a=i.length,o=t.length,a&&o)for(u=o-1;u>=0;u--)t[u+a]=t[u];return e.abrupt("return",i.map((function(e,n){return t[n]={status:"suspended",progress:e.start/e.chunks.length,isCache:!0,file:e.file,result:null,createTimestamp:e.createTimestamp,total:e.chunks.length},{name:e.file.name,file:e.file,status:"suspended",progress:e.start/e.chunks.length,result:null,createTimestamp:e.createTimestamp,total:e.chunks.length,fileObject:e}})));case 8:case"end":return e.stop()}}),e)})));return function(e,n){return t.apply(this,arguments)}}();return function(e){var t,n,r,s,i=Cr(e),a=[],o=new Promise((function(e,r){t=e,n=r})),u=new Promise((function(e,t){r=e,s=t}));return Promise.all([o,u]).then((function(){i.success({result:!0,data:a})})).catch((function(e){i.error(e)})),i.offlineStorage?Sr(a,i).then((function(e){var t={current:0},n=Promise.all(e.map((function(e,n){return new Promise((function(r,s){var o={current:!1},u={current:!1},c={current:e.fileObject.start},l={current:0},h={current:e.fileObject.customParams},f={current:a},d=function(e,t){return a[e]=kr(kr({},a[e]),t),a},p=function(t){return t/e.fileObject.chunks.length};a[n].pause=function(){if(o.current=!0,"uploading"===a[n].status){t.current--,d(n,{status:"suspended",progress:p(c.current)}),i.update(Ar(a));var r=wr(f.current);r&&r.resume(),mr.files.update(e.fileObject.id,{status:"suspended",start:c.current,end:c.current+i.numberOfChunks})}},a[n].resume=function(){"initialization"!==a[n].status&&"suspended"!==a[n].status&&"failure"!==a[n].status||(l.current=0,o.current=!1,Or(c.current,{idRef:{current:e.fileObject.id},upload:i.upload,updateUploadDataList:d,computeProgress:p,update:i.update,resolve:r,reject:s,sliceStartRef:c,length:e.fileObject.chunks.length,index:n,numberOfChunks:i.numberOfChunks,chunks:e.fileObject.chunks,customParamsRef:h,retryCountLimit:i.retryCountLimit,_retryCountRef:l,suspendedRef:o,canceledRef:u,currentUploadListRef:f,offlineStorage:i.offlineStorage,spaceName:i.spaceName,file:e.fileObject.file,hashSum:e.fileObject.hashSum,currentNumberOfRequestRef:t,maxNumberOfRequest:i.maxNumberOfRequest},!0))},a[n].remove=function(){t.current--,u.current=!0,a[n].status="cancel",i.update(Ar(a)),mr.files.delete(e.fileObject.id),r(!0)}}))})));return i.gotCache(a.slice(0,e.length),a),i.update(Ar(a)),n})).then((function(){t()})).catch((function(e){n(e)})):t(),{uploadFile:function(){return function(e,t,n,r){var s=Cr(t),i=document.body,a=Pr()(s,e,n,r);(function(e,t){for(var n=e.children.length-1;n>=0;n--)if(e.children[n]===t)return!0})(i,a)||document.body.appendChild(a),a.click()}(a,e,r,s)},giveFilesToUpload:function(e){Pr(e)(i,a,r,s)}}}}));//# sourceMappingURL=index.min.js.map
2
\No newline at end of file