search-index
Version:
A network resilient, persistent full-text search library for the browser and Node.js
2 lines • 212 kB
JavaScript
/*! For license information please see search-index-6.0.1.js.LICENSE.txt */
var SearchIndex;(()=>{var t={796:(t,e,r)=>{"use strict";const n=r(9121),i=r(266),{getOptions:o,emptyOptions:s,noop:a}=r(1343),{prefixDescendantKey:c,isDescendant:u}=r(1450),{PrewriteBatch:l}=r(9767),h=Symbol("status"),f=Symbol("publicOperations"),p=Symbol("legacyOperations"),y=Symbol("privateOperations"),d=Symbol("closePromise"),g=Symbol("length"),m=Symbol("prewriteRun"),v=Symbol("prewriteBatch"),b=Symbol("prewriteData"),E=Symbol("addMode"),w=function(t){let e;return t[d]=new Promise(((r,n)=>{e=()=>{A(t).then(r,n)}})),e},A=async function(t){t[h]="closing",await t._close(),t.db.detachResource(t)};class S{constructor(t,e){this[y]=t,this[f]=e}get length(){return this[y].length}clear(){for(const t of[f,y]){const e=this[t];null!==e&&e.splice(0,e.length)}}}const T=function(t){if("open"!==t[h])throw new i("Batch is not open: cannot change operations after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});if("open"!==t.db.status)throw new i("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})};e.AbstractChainedBatch=class{constructor(t,e){if("object"!=typeof t||null===t)throw new TypeError("The first argument must be an abstract-level database, received "+(null===t?"null":typeof t));const r=t.listenerCount("write")>0,n=!t.hooks.prewrite.noop;if(this[f]=r?[]:null,this[p]=r||n?null:[],this[g]=0,this[h]="open",this[d]=null,this[E]=!0===o(e,s).add,n){const e=new S([],r?[]:null);this[b]=e,this[v]=new l(t,e[y],e[f]),this[m]=t.hooks.prewrite.run}else this[b]=null,this[v]=null,this[m]=null;this.db=t,this.db.attachResource(this)}get length(){return null!==this[b]?this[g]+this[b].length:this[g]}put(t,e,r){T(this);const n=null!=(r=o(r,s)).sublevel,a=n?r.sublevel:this.db,l=r,h=a._checkKey(t),y=a._checkValue(e);if(null!=h)throw h;if(null!=y)throw y;const d=Object.assign({},r,{type:"put",key:t,value:e,keyEncoding:a.keyEncoding(r.keyEncoding),valueEncoding:a.valueEncoding(r.valueEncoding)});if(null!==this[m])try{this[m](d,this[v]),d.keyEncoding=a.keyEncoding(d.keyEncoding),d.valueEncoding=a.valueEncoding(d.valueEncoding)}catch(t){throw new i("The prewrite hook failed on batch.put()",{code:"LEVEL_HOOK_ERROR",cause:t})}const b=d.keyEncoding,w=b.encode(d.key),A=b.format,S=n&&!u(d.sublevel,this.db)&&d.sublevel!==this.db,O=n&&!S?c(w,A,a,this.db):w,I=d.valueEncoding,_=I.encode(d.value),L=I.format;if(n&&!S&&(d.sublevel=null),null===this[f]||S){if(null!==this[p]&&!S){const r=Object.assign({},l);r.type="put",r.key=t,r.value=e,this[p].push(r)}}else{const t=Object.assign({},d);t.encodedKey=O,t.encodedValue=_,n&&(t.key=O,t.value=_,t.keyEncoding=this.db.keyEncoding(A),t.valueEncoding=this.db.valueEncoding(L)),this[f].push(t)}return d.key=S?O:this.db.prefixKey(O,A,!0),d.value=_,d.keyEncoding=A,d.valueEncoding=L,this[E]?this._add(d):this._put(d.key,_,d),this[g]++,this}_put(t,e,r){}del(t,e){T(this);const r=null!=(e=o(e,s)).sublevel,n=r?e.sublevel:this.db,a=e,u=n._checkKey(t);if(null!=u)throw u;const l=Object.assign({},e,{type:"del",key:t,keyEncoding:n.keyEncoding(e.keyEncoding)});if(null!==this[m])try{this[m](l,this[v]),l.keyEncoding=n.keyEncoding(l.keyEncoding)}catch(t){throw new i("The prewrite hook failed on batch.del()",{code:"LEVEL_HOOK_ERROR",cause:t})}const h=l.keyEncoding,y=h.encode(l.key),d=h.format,b=r?c(y,d,n,this.db):y;if(r&&(l.sublevel=null),null!==this[f]){const t=Object.assign({},l);t.encodedKey=b,r&&(t.key=b,t.keyEncoding=this.db.keyEncoding(d)),this[f].push(t)}else if(null!==this[p]){const e=Object.assign({},a);e.type="del",e.key=t,this[p].push(e)}return l.key=this.db.prefixKey(b,d,!0),l.keyEncoding=d,this[E]?this._add(l):this._del(l.key,l),this[g]++,this}_del(t,e){}_add(t){}clear(){return T(this),this._clear(),null!==this[f]&&(this[f]=[]),null!==this[p]&&(this[p]=[]),null!==this[b]&&this[b].clear(),this[g]=0,this}_clear(){}async write(t){if(T(this),t=o(t),0===this[g])return this.close();{this[h]="writing";const e=w(this);try{if(null!==this[b]){const t=this[b][f],e=this[b][y],r=this[b].length;for(let t=0;t<r;t++){const r=e[t];this[E]?this._add(r):"put"===r.type?this._put(r.key,r.value,r):this._del(r.key,r)}null!==t&&0!==r&&(this[f]=this[f].concat(t))}await this._write(t)}catch(t){e();try{await this[d]}catch(e){t=n([t,e])}throw t}return e(),null!==this[f]?this.db.emit("write",this[f]):null!==this[p]&&this.db.emit("batch",this[p]),this[d]}}async _write(t){}async close(){return null!==this[d]?this[d].catch(a):(w(this)(),this[d])}async _close(){}}},3527:(t,e,r)=>{"use strict";const n=r(266),i=r(9121),{getOptions:o,emptyOptions:s,noop:a}=r(1343),{AbortError:c}=r(597),u=Symbol("working"),l=Symbol("decodeOne"),h=Symbol("decodeMany"),f=Symbol("signal"),p=Symbol("pendingClose"),y=Symbol("closingPromise"),d=Symbol("keyEncoding"),g=Symbol("valueEncoding"),m=Symbol("keys"),v=Symbol("values"),b=Symbol("limit"),E=Symbol("count"),w=Symbol("ended");class A{constructor(t,e){if("object"!=typeof t||null===t)throw new TypeError("The first argument must be an abstract-level database, received "+(null===t?"null":typeof t));if("object"!=typeof e||null===e)throw new TypeError("The second argument must be an options object");this[u]=!1,this[p]=null,this[y]=null,this[d]=e[d],this[g]=e[g],this[b]=Number.isInteger(e.limit)&&e.limit>=0?e.limit:1/0,this[E]=0,this[f]=null!=e.signal?e.signal:null,this[w]=!1,this.db=t,this.db.attachResource(this)}get count(){return this[E]}get limit(){return this[b]}async next(){O(this);try{if(this[w]||this[E]>=this[b])return void(this[w]=!0);let t=await this._next();if(void 0===t)return void(this[w]=!0);try{t=this[l](t)}catch(t){throw new T(t)}return this[E]++,t}finally{I(this)}}async _next(){}async nextv(t,e){if(!Number.isInteger(t))throw new TypeError("The first argument 'size' must be an integer");e=o(e,s),t<1&&(t=1),this[b]<1/0&&(t=Math.min(t,this[b]-this[E])),O(this);try{if(this[w]||t<=0)return this[w]=!0,[];const r=await this._nextv(t,e);if(0===r.length)return this[w]=!0,r;try{this[h](r)}catch(t){throw new T(t)}return this[E]+=r.length,r}finally{I(this)}}async _nextv(t,e){const r=[];for(;r.length<t;){const t=await this._next(e);if(void 0===t){this[w]=!0;break}r.push(t)}return r}async all(t){t=o(t,s),O(this);try{if(this[w]||this[E]>=this[b])return[];const e=await this._all(t);try{this[h](e)}catch(t){throw new T(t)}return this[E]+=e.length,e}catch(t){I(this),await L(this,t)}finally{this[w]=!0,this[u]&&(I(this),await this.close())}}async _all(t){let e=this[E];const r=[];for(;;){const n=this[b]<1/0?Math.min(1e3,this[b]-e):1e3;if(n<=0)return r;const i=await this._nextv(n,t);if(0===i.length)return r;r.push.apply(r,i),e+=i.length}}seek(t,e){if(e=o(e,s),null!==this[y]);else{if(this[u])throw new n("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{const r=this.db.keyEncoding(e.keyEncoding||this[d]),n=r.format;e.keyEncoding!==n&&(e={...e,keyEncoding:n});const i=this.db.prefixKey(r.encode(t),n,!1);this._seek(i,e),this[w]=!1}}}_seek(t,e){throw new n("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}async close(){return null!==this[y]?this[y].catch(a):(this[y]=new Promise(((t,e)=>{this[p]=()=>{this[p]=null,_(this).then(t,e)}})),this[u]||this[p](),this[y])}async _close(){}async*[Symbol.asyncIterator](){try{let t;for(;void 0!==(t=await this.next());)yield t}catch(t){await L(this,t)}finally{await this.close()}}}class S extends A{constructor(t,e){super(t,e),this[m]=!1!==e.keys,this[v]=!1!==e.values}[l](t){const e=t[0],r=t[1];return void 0!==e&&(t[0]=this[m]?this[d].decode(e):void 0),void 0!==r&&(t[1]=this[v]?this[g].decode(r):void 0),t}[h](t){const e=this[d],r=this[g];for(const n of t){const t=n[0],i=n[1];void 0!==t&&(n[0]=this[m]?e.decode(t):void 0),void 0!==i&&(n[1]=this[v]?r.decode(i):void 0)}}}class T extends n{constructor(t){super("Iterator could not decode data",{code:"LEVEL_DECODE_ERROR",cause:t})}}const O=function(t){if(null!==t[y])throw new n("Iterator is not open: cannot read after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"});if(t[u])throw new n("Iterator is busy: cannot read until previous read has completed",{code:"LEVEL_ITERATOR_BUSY"});if(null!==t[f]&&t[f].aborted)throw new c;t[u]=!0},I=function(t){t[u]=!1,null!==t[p]&&t[p]()},_=async function(t){await t._close(),t.db.detachResource(t)},L=async function(t,e){try{await t.close()}catch(t){throw i([e,t])}throw e};S.keyEncoding=d,S.valueEncoding=g,e.AbstractIterator=S,e.AbstractKeyIterator=class extends A{[l](t){return this[d].decode(t)}[h](t){const e=this[d];for(let r=0;r<t.length;r++){const n=t[r];void 0!==n&&(t[r]=e.decode(n))}}},e.AbstractValueIterator=class extends A{[l](t){return this[g].decode(t)}[h](t){const e=this[g];for(let r=0;r<t.length;r++){const n=t[r];void 0!==n&&(t[r]=e.decode(n))}}}},1983:(t,e,r)=>{"use strict";const{supports:n}=r(5356),{Transcoder:i}=r(6035),{EventEmitter:o}=r(7007),s=r(266),a=r(9121),{AbstractIterator:c}=r(3527),{DefaultKeyIterator:u,DefaultValueIterator:l}=r(5682),{DeferredIterator:h,DeferredKeyIterator:f,DeferredValueIterator:p}=r(4416),{DefaultChainedBatch:y}=r(4669),{DatabaseHooks:d}=r(3172),{PrewriteBatch:g}=r(9767),{EventMonitor:m}=r(2107),{getOptions:v,noop:b,emptyOptions:E,resolvedPromise:w}=r(1343),{prefixDescendantKey:A,isDescendant:S}=r(1450),{DeferredQueue:T}=r(971),O=r(386),I=Symbol("resources"),_=Symbol("closeResources"),L=Symbol("queue"),x=Symbol("deferOpen"),U=Symbol("options"),R=Symbol("status"),k=Symbol("statusChange"),N=Symbol("statusLocked"),C=Symbol("defaultOptions"),D=Symbol("transcoder"),B=Symbol("keyEncoding"),F=Symbol("valueEncoding"),j=Symbol("eventMonitor"),P=Symbol("arrayBatch");class M extends o{constructor(t,e){if(super(),"object"!=typeof t||null===t)throw new TypeError("The first argument 'manifest' must be an object");e=v(e);const{keyEncoding:r,valueEncoding:o,passive:s,...a}=e;this[I]=new Set,this[L]=new T,this[x]=!0,this[U]=a,this[R]="opening",this[k]=null,this[N]=!1,this.hooks=new d,this.supports=n(t,{deferredOpen:!0,snapshots:!1!==t.snapshots,permanence:!1!==t.permanence,encodings:t.encodings||{},events:Object.assign({},t.events,{opening:!0,open:!0,closing:!0,closed:!0,write:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[j]=new m(this,[{name:"write"},{name:"put",deprecated:!0,alt:"write"},{name:"del",deprecated:!0,alt:"write"},{name:"batch",deprecated:!0,alt:"write"}]),this[D]=new i(G(this)),this[B]=this[D].encoding(r||"utf8"),this[F]=this[D].encoding(o||"utf8");for(const t of this[D].encodings())this.supports.encodings[t.commonName]||(this.supports.encodings[t.commonName]=!0);this[C]={empty:E,entry:Object.freeze({keyEncoding:this[B].commonName,valueEncoding:this[F].commonName}),entryFormat:Object.freeze({keyEncoding:this[B].format,valueEncoding:this[F].format}),key:Object.freeze({keyEncoding:this[B].commonName}),keyFormat:Object.freeze({keyEncoding:this[B].format})},queueMicrotask((()=>{this[x]&&this.open({passive:!1}).catch(b)}))}get status(){return this[R]}get parent(){return null}keyEncoding(t){return this[D].encoding(null!=t?t:this[B])}valueEncoding(t){return this[D].encoding(null!=t?t:this[F])}async open(t){(t={...this[U],...v(t)}).createIfMissing=!1!==t.createIfMissing,t.errorIfExists=!!t.errorIfExists;const e=this.hooks.postopen.noop?null:this.hooks.postopen.run,r=t.passive;for(r&&this[x]&&await void 0,z(this);null!==this[k];)await this[k].catch(b);if(z(this),r){if("open"!==this[R])throw new H}else if("closed"===this[R]||this[x]){this[x]=!1,this[k]=w,this[k]=(async()=>{this[R]="opening";try{this.emit("opening"),await this._open(t)}catch(t){this[R]="closed",this[L].drain();try{await this[_]()}catch(e){t=a([t,e])}throw new H(t)}if(this[R]="open",null!==e){let r;try{this[N]=!0,await e(t)}catch(t){r=K(t)}finally{this[N]=!1}if(r){this[R]="closing",this[L].drain();try{await this[_](),await this._close()}catch(t){this[N]=!0,r=a([r,t])}throw this[R]="closed",new s("The postopen hook failed on open()",{code:"LEVEL_HOOK_ERROR",cause:r})}}this[L].drain(),this.emit("open")})();try{await this[k]}finally{this[k]=null}}else if("open"!==this[R])throw new H}async _open(t){}async close(){for(z(this);null!==this[k];)await this[k].catch(b);if(z(this),"open"===this[R]||this[x]){const t=this[x];this[x]=!1,this[k]=w,this[k]=(async()=>{this[R]="closing",this[L].drain();try{this.emit("closing"),await this[_](),t||await this._close()}catch(t){throw this[R]="open",this[L].drain(),new q(t)}this[R]="closed",this[L].drain(),this.emit("closed")})();try{await this[k]}finally{this[k]=null}}else if("closed"!==this[R])throw new q}async[_](){if(0===this[I].size)return;const t=Array.from(this[I]),e=t.map(W);return Promise.allSettled(e).then((async e=>{const r=[];for(let n=0;n<e.length;n++)"fulfilled"===e[n].status?this[I].delete(t[n]):r.push(K(e[n].reason));if(r.length>0)throw a(r)}))}async _close(){}async get(t,e){if(e=v(e,this[C].entry),"opening"===this[R])return this.deferAsync((()=>this.get(t,e)));$(this);const r=this._checkKey(t);if(r)throw r;const n=this.keyEncoding(e.keyEncoding),i=this.valueEncoding(e.valueEncoding),o=n.format,a=i.format;e.keyEncoding===o&&e.valueEncoding===a||(e=Object.assign({},e,{keyEncoding:o,valueEncoding:a}));const c=n.encode(t),u=await this._get(this.prefixKey(c,o,!0),e);try{return void 0===u?u:i.decode(u)}catch(r){throw new s("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:r})}}async _get(t,e){}async getMany(t,e){if(e=v(e,this[C].entry),"opening"===this[R])return this.deferAsync((()=>this.getMany(t,e)));if($(this),!Array.isArray(t))throw new TypeError("The first argument 'keys' must be an array");if(0===t.length)return[];const r=this.keyEncoding(e.keyEncoding),n=this.valueEncoding(e.valueEncoding),i=r.format,o=n.format;e.keyEncoding===i&&e.valueEncoding===o||(e=Object.assign({},e,{keyEncoding:i,valueEncoding:o}));const a=new Array(t.length);for(let e=0;e<t.length;e++){const n=t[e],o=this._checkKey(n);if(o)throw o;a[e]=this.prefixKey(r.encode(n),i,!0)}const c=await this._getMany(a,e);try{for(let t=0;t<c.length;t++)void 0!==c[t]&&(c[t]=n.decode(c[t]))}catch(t){throw new s(`Could not decode one or more of ${c.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:t})}return c}async _getMany(t,e){return new Array(t.length).fill(void 0)}async put(t,e,r){if(!this.hooks.prewrite.noop)return this.batch([{type:"put",key:t,value:e}],r);if(r=v(r,this[C].entry),"opening"===this[R])return this.deferAsync((()=>this.put(t,e,r)));$(this);const n=this._checkKey(t)||this._checkValue(e);if(n)throw n;const i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,a=o.format,c=this[j].write,u=r;r===this[C].entry?r=this[C].entryFormat:r.keyEncoding===s&&r.valueEncoding===a||(r=Object.assign({},r,{keyEncoding:s,valueEncoding:a}));const l=i.encode(t),h=this.prefixKey(l,s,!0),f=o.encode(e);if(await this._put(h,f,r),c){const r=Object.assign({},u,{type:"put",key:t,value:e,keyEncoding:i,valueEncoding:o,encodedKey:l,encodedValue:f});this.emit("write",[r])}else this.emit("put",t,e)}async _put(t,e,r){}async del(t,e){if(!this.hooks.prewrite.noop)return this.batch([{type:"del",key:t}],e);if(e=v(e,this[C].key),"opening"===this[R])return this.deferAsync((()=>this.del(t,e)));$(this);const r=this._checkKey(t);if(r)throw r;const n=this.keyEncoding(e.keyEncoding),i=n.format,o=this[j].write,s=e;e===this[C].key?e=this[C].keyFormat:e.keyEncoding!==i&&(e=Object.assign({},e,{keyEncoding:i}));const a=n.encode(t),c=this.prefixKey(a,i,!0);if(await this._del(c,e),o){const e=Object.assign({},s,{type:"del",key:t,keyEncoding:n,encodedKey:a});this.emit("write",[e])}else this.emit("del",t)}async _del(t,e){}batch(t,e){return arguments.length?(e=v(e,this[C].empty),this[P](t,e)):($(this),this._chainedBatch())}async[P](t,e){if("opening"===this[R])return this.deferAsync((()=>this[P](t,e)));if($(this),!Array.isArray(t))throw new TypeError("The first argument 'operations' must be an array");if(0===t.length)return;const r=t.length,n=!this.hooks.prewrite.noop,i=this[j].write,o=i?new Array(r):null,a=new Array(r),c=n?new g(this,a,o):null;for(let u=0;u<r;u++){const r=Object.assign({},e,t[u]),l="put"===r.type,h=null!=r.sublevel,f=h?r.sublevel:this,p=f._checkKey(r.key);if(null!=p)throw p;if(r.keyEncoding=f.keyEncoding(r.keyEncoding),l){const t=f._checkValue(r.value);if(null!=t)throw t;r.valueEncoding=f.valueEncoding(r.valueEncoding)}else if("del"!==r.type)throw new TypeError("A batch operation must have a type property that is 'put' or 'del'");if(n)try{this.hooks.prewrite.run(r,c),r.keyEncoding=f.keyEncoding(r.keyEncoding),l&&(r.valueEncoding=f.valueEncoding(r.valueEncoding))}catch(t){throw new s("The prewrite hook failed on batch()",{code:"LEVEL_HOOK_ERROR",cause:t})}const y=r.keyEncoding,d=y.encode(r.key),g=y.format,m=h&&!S(r.sublevel,this)&&r.sublevel!==this,v=h&&!m?A(d,g,f,this):d;h&&!m&&(r.sublevel=null);let b=null;if(i&&!m&&(b=Object.assign({},r),b.encodedKey=v,h&&(b.key=v,b.keyEncoding=this.keyEncoding(g)),o[u]=b),r.key=m?v:this.prefixKey(v,g,!0),r.keyEncoding=g,l){const t=r.valueEncoding,e=t.encode(r.value),n=t.format;r.value=e,r.valueEncoding=n,i&&!m&&(b.encodedValue=e,h&&(b.value=e,b.valueEncoding=this.valueEncoding(n)))}a[u]=r}await this._batch(a,e),i?this.emit("write",o):n||this.emit("batch",t)}async _batch(t,e){}sublevel(t,e){const r=V.defaults(e),n=this._sublevel(t,r);if(!this.hooks.newsub.noop)try{this.hooks.newsub.run(n,r)}catch(t){throw new s("The newsub hook failed on sublevel()",{code:"LEVEL_HOOK_ERROR",cause:t})}return n}_sublevel(t,e){return new V(this,t,e)}prefixKey(t,e,r){return t}async clear(t){if(t=v(t,this[C].empty),"opening"===this[R])return this.deferAsync((()=>this.clear(t)));$(this);const e=t,r=this.keyEncoding(t.keyEncoding);(t=O(t,r)).keyEncoding=r.format,0!==t.limit&&(await this._clear(t),this.emit("clear",e))}async _clear(t){}iterator(t){const e=this.keyEncoding(t&&t.keyEncoding),r=this.valueEncoding(t&&t.valueEncoding);return(t=O(t,e)).keys=!1!==t.keys,t.values=!1!==t.values,t[c.keyEncoding]=e,t[c.valueEncoding]=r,t.keyEncoding=e.format,t.valueEncoding=r.format,"opening"===this[R]?new h(this,t):($(this),this._iterator(t))}_iterator(t){return new c(this,t)}keys(t){const e=this.keyEncoding(t&&t.keyEncoding),r=this.valueEncoding(t&&t.valueEncoding);return(t=O(t,e))[c.keyEncoding]=e,t[c.valueEncoding]=r,t.keyEncoding=e.format,t.valueEncoding=r.format,"opening"===this[R]?new f(this,t):($(this),this._keys(t))}_keys(t){return new u(this,t)}values(t){const e=this.keyEncoding(t&&t.keyEncoding),r=this.valueEncoding(t&&t.valueEncoding);return(t=O(t,e))[c.keyEncoding]=e,t[c.valueEncoding]=r,t.keyEncoding=e.format,t.valueEncoding=r.format,"opening"===this[R]?new p(this,t):($(this),this._values(t))}_values(t){return new l(this,t)}defer(t,e){if("function"!=typeof t)throw new TypeError("The first argument must be a function");this[L].add((function(e){e||t()}),e)}deferAsync(t,e){if("function"!=typeof t)throw new TypeError("The first argument must be a function");return new Promise(((r,n)=>{this[L].add((function(e){e?n(e):t().then(r,n)}),e)}))}attachResource(t){if("object"!=typeof t||null===t||"function"!=typeof t.close)throw new TypeError("The first argument must be a resource object");this[I].add(t)}detachResource(t){this[I].delete(t)}_chainedBatch(){return new y(this)}_checkKey(t){if(null==t)return new s("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(t){if(null==t)return new s("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}}const{AbstractSublevel:V}=r(9933)({AbstractLevel:M});e.AbstractLevel=M,e.AbstractSublevel=V;const $=function(t){if("open"!==t[R])throw new s("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})},z=function(t){if(t[N])throw new s("Database status is locked",{code:"LEVEL_STATUS_LOCKED"})},G=function(t){return Object.keys(t.supports.encodings).filter((e=>!!t.supports.encodings[e]))},W=function(t){return t.close()},K=function(t){return t instanceof Error||"[object Error]"===Object.prototype.toString.call(t)?t:new TypeError("Promise rejection reason must be an Error, received "+(null===t?"null":typeof t))};class H extends s{constructor(t){super("Database failed to open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:t})}}class q extends s{constructor(t){super("Database failed to close",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:t})}}},5e3:(t,e,r)=>{"use strict";e.AbstractLevel=r(1983).AbstractLevel,e.AbstractSublevel=r(1983).AbstractSublevel,e.AbstractIterator=r(3527).AbstractIterator,e.AbstractKeyIterator=r(3527).AbstractKeyIterator,e.AbstractValueIterator=r(3527).AbstractValueIterator,e.AbstractChainedBatch=r(796).AbstractChainedBatch},4716:(t,e,r)=>{"use strict";const{AbstractIterator:n,AbstractKeyIterator:i,AbstractValueIterator:o}=r(3527),s=Symbol("unfix"),a=Symbol("iterator");class c extends n{constructor(t,e,r,n){super(t,e),this[a]=r,this[s]=n}async _next(){const t=await this[a].next();if(void 0!==t){const e=t[0];void 0!==e&&(t[0]=this[s](e))}return t}async _nextv(t,e){const r=await this[a].nextv(t,e),n=this[s];for(const t of r){const e=t[0];void 0!==e&&(t[0]=n(e))}return r}async _all(t){const e=await this[a].all(t),r=this[s];for(const t of e){const e=t[0];void 0!==e&&(t[0]=r(e))}return e}}class u extends i{constructor(t,e,r,n){super(t,e),this[a]=r,this[s]=n}async _next(){const t=await this[a].next();return void 0===t?t:this[s](t)}async _nextv(t,e){const r=await this[a].nextv(t,e),n=this[s];for(let t=0;t<r.length;t++){const e=r[t];void 0!==e&&(r[t]=n(e))}return r}async _all(t){const e=await this[a].all(t),r=this[s];for(let t=0;t<e.length;t++){const n=e[t];void 0!==n&&(e[t]=r(n))}return e}}class l extends o{constructor(t,e,r){super(t,e),this[a]=r}async _next(){return this[a].next()}async _nextv(t,e){return this[a].nextv(t,e)}async _all(t){return this[a].all(t)}}for(const t of[c,u,l])t.prototype._seek=function(t,e){this[a].seek(t,e)},t.prototype._close=async function(){return this[a].close()};e.AbstractSublevelIterator=c,e.AbstractSublevelKeyIterator=u,e.AbstractSublevelValueIterator=l},9933:(t,e,r)=>{"use strict";const n=r(266),{Buffer:i}=r(8287)||{},{AbstractSublevelIterator:o,AbstractSublevelKeyIterator:s,AbstractSublevelValueIterator:a}=r(4716),c=Symbol("prefix"),u=Symbol("localPrefix"),l=Symbol("localPath"),h=Symbol("globalPath"),f=Symbol("upperBound"),p=Symbol("prefixRange"),y=Symbol("root"),d=Symbol("parent"),g=Symbol("unfix"),m=new TextEncoder,v={separator:"!"};t.exports=function({AbstractLevel:t}){class e extends t{static defaults(t){return null==t?v:t.separator?t:{...t,separator:"!"}}constructor(t,r,i){const{separator:o,manifest:s,...a}=e.defaults(i),p=[].concat(r).map((t=>S(t,o))),v=o.charCodeAt(0)+1,E=t[y]||t;if(!p.every((t=>m.encode(t).every((t=>t>v&&t<127)))))throw new n(`Sublevel name must use bytes > ${v} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(b(t,s),a);const T=p.map((t=>o+t+o)).join(""),O=(t.prefix||"")+T,I=O.slice(0,-1)+String.fromCharCode(v);this[y]=E,this[d]=t,this[l]=p,this[h]=t.prefix?t.path().concat(p):p,this[c]=new w(O),this[f]=new w(I),this[u]=new w(T),this[g]=new A}prefixKey(t,e,r){const n=r?this[u]:this[c];if("utf8"===e)return n.utf8+t;if(0===t.byteLength)return n[e];if("view"===e){const e=n.view,r=new Uint8Array(e.byteLength+t.byteLength);return r.set(e,0),r.set(t,e.byteLength),r}{const e=n.buffer;return i.concat([e,t],e.byteLength+t.byteLength)}}[p](t,e){void 0!==t.gte?t.gte=this.prefixKey(t.gte,e,!1):void 0!==t.gt?t.gt=this.prefixKey(t.gt,e,!1):t.gte=this[c][e],void 0!==t.lte?t.lte=this.prefixKey(t.lte,e,!1):void 0!==t.lt?t.lt=this.prefixKey(t.lt,e,!1):t.lte=this[f][e]}get prefix(){return this[c].utf8}get db(){return this[y]}get parent(){return this[d]}path(t=!1){return t?this[l]:this[h]}async _open(t){return this[d].open({passive:!0})}async _put(t,e,r){return this[d].put(t,e,r)}async _get(t,e){return this[d].get(t,e)}async _getMany(t,e){return this[d].getMany(t,e)}async _del(t,e){return this[d].del(t,e)}async _batch(t,e){return this[d].batch(t,e)}async _clear(t){return this[p](t,t.keyEncoding),this[y].clear(t)}_iterator(t){this[p](t,t.keyEncoding);const e=this[y].iterator(t),r=this[g].get(this[c].utf8.length,t.keyEncoding);return new o(this,t,e,r)}_keys(t){this[p](t,t.keyEncoding);const e=this[y].keys(t),r=this[g].get(this[c].utf8.length,t.keyEncoding);return new s(this,t,e,r)}_values(t){this[p](t,t.keyEncoding);const e=this[y].values(t);return new a(this,t,e)}}return{AbstractSublevel:e}};const b=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:E(t,"utf8"),buffer:E(t,"buffer"),view:E(t,"view")}}},E=function(t,e){return!!t.supports.encodings[e]&&t.keyEncoding(e).name===e};class w{constructor(t){this.utf8=t,this.view=m.encode(t),this.buffer=i?i.from(this.view.buffer,0,this.view.byteLength):{}}}class A{constructor(){this.cache=new Map}get(t,e){let r=this.cache.get(e);return void 0===r&&(r="view"===e?function(t,e){return e.subarray(t)}.bind(null,t):function(t,e){return e.slice(t)}.bind(null,t),this.cache.set(e,r)),r}}const S=function(t,e){let r=0,n=t.length;for(;r<n&&t[r]===e;)r++;for(;n>r&&t[n-1]===e;)n--;return t.slice(r,n)}},1343:(t,e,r)=>{"use strict";const n=r(266),i=new Set;e.getOptions=function(t,e){return"object"==typeof t&&null!==t?t:void 0!==e?e:{}},e.emptyOptions=Object.freeze({}),e.noop=function(){},e.resolvedPromise=Promise.resolve(),e.deprecate=function(t){if(!i.has(t)){i.add(t);const e=globalThis.console;void 0!==e&&"function"==typeof e.warn&&e.warn(new n(t,{code:"LEVEL_LEGACY"}))}}},4669:(t,e,r)=>{"use strict";const{AbstractChainedBatch:n}=r(796),i=Symbol("encoded");e.DefaultChainedBatch=class extends n{constructor(t){super(t,{add:!0}),this[i]=[]}_add(t){this[i].push(t)}_clear(){this[i]=[]}async _write(t){return this.db._batch(this[i],t)}}},5682:(t,e,r)=>{"use strict";const{AbstractKeyIterator:n,AbstractValueIterator:i}=r(3527),o=Symbol("iterator"),s=Symbol("handleOne"),a=Symbol("handleMany");class c extends n{constructor(t,e){super(t,e),this[o]=t.iterator({...e,keys:!0,values:!1})}[s](t){return t[0]}[a](t){for(let e=0;e<t.length;e++)t[e]=t[e][0]}}class u extends i{constructor(t,e){super(t,e),this[o]=t.iterator({...e,keys:!1,values:!0})}[s](t){return t[1]}[a](t){for(let e=0;e<t.length;e++)t[e]=t[e][1]}}for(const t of[c,u])t.prototype._next=async function(){const t=await this[o].next();return void 0===t?t:this[s](t)},t.prototype._nextv=async function(t,e){const r=await this[o].nextv(t,e);return this[a](r),r},t.prototype._all=async function(t){const e=await this[o].all(t);return this[a](e),e},t.prototype._seek=function(t,e){this[o].seek(t,e)},t.prototype._close=async function(){return this[o].close()};e.DefaultKeyIterator=c,e.DefaultValueIterator=u},4416:(t,e,r)=>{"use strict";const{AbstractIterator:n,AbstractKeyIterator:i,AbstractValueIterator:o}=r(3527),s=r(266),a=Symbol("nut"),c=Symbol("undefer"),u=Symbol("factory"),l=Symbol("signalOptions");class h extends n{constructor(t,e){super(t,e),this[a]=null,this[u]=()=>t.iterator(e),this[l]={signal:e.signal},this.db.defer((()=>this[c]()),this[l])}}class f extends i{constructor(t,e){super(t,e),this[a]=null,this[u]=()=>t.keys(e),this[l]={signal:e.signal},this.db.defer((()=>this[c]()),this[l])}}class p extends o{constructor(t,e){super(t,e),this[a]=null,this[u]=()=>t.values(e),this[l]={signal:e.signal},this.db.defer((()=>this[c]()),this[l])}}for(const t of[h,f,p])t.prototype[c]=function(){"open"===this.db.status&&(this[a]=this[u]())},t.prototype._next=async function(){if(null!==this[a])return this[a].next();if("opening"===this.db.status)return this.db.deferAsync((()=>this._next()),this[l]);throw new s("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})},t.prototype._nextv=async function(t,e){if(null!==this[a])return this[a].nextv(t,e);if("opening"===this.db.status)return this.db.deferAsync((()=>this._nextv(t,e)),this[l]);throw new s("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})},t.prototype._all=async function(t){if(null!==this[a])return this[a].all();if("opening"===this.db.status)return this.db.deferAsync((()=>this._all(t)),this[l]);throw new s("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})},t.prototype._seek=function(t,e){null!==this[a]?this[a]._seek(t,e):"opening"===this.db.status&&this.db.defer((()=>this._seek(t,e)),this[l])},t.prototype._close=async function(){return null!==this[a]?this[a].close():"opening"===this.db.status?this.db.deferAsync((()=>this._close())):void 0};e.DeferredIterator=h,e.DeferredKeyIterator=f,e.DeferredValueIterator=p},971:(t,e,r)=>{"use strict";const{getOptions:n,emptyOptions:i}=r(1343),{AbortError:o}=r(597),s=Symbol("operations"),a=Symbol("signals"),c=Symbol("handleAbort");class u{constructor(t,e){this.fn=t,this.signal=e}}e.DeferredQueue=class{constructor(){this[s]=[],this[a]=new Set,this[c]=this[c].bind(this)}add(t,e){const r=(e=n(e,i)).signal;null!=r?r.aborted?t(new o):(this[a].has(r)||(this[a].add(r),r.addEventListener("abort",this[c],{once:!0})),this[s].push(new u(t,r))):this[s].push(new u(t,null))}drain(){const t=this[s],e=this[a];this[s]=[],this[a]=new Set;for(const t of e)t.removeEventListener("abort",this[c]);for(const e of t)e.fn.call(null)}[c](t){const e=t.target,r=new o,n=[];this[s]=this[s].filter((function(t){return null===t.signal||t.signal!==e||(n.push(t),!1)})),this[a].delete(e);for(const t of n)t.fn.call(null,r)}}},597:(t,e,r)=>{"use strict";const n=r(266);e.AbortError=class extends n{constructor(t){super("Operation has been aborted",{code:"LEVEL_ABORTED",cause:t})}get name(){return"AbortError"}}},2107:(t,e,r)=>{"use strict";const{deprecate:n}=r(1343);e.EventMonitor=class{constructor(t,e){for(const t of e)this[t.name]=!1,t.deprecated&&(t.message=`The '${t.name}' event is deprecated in favor of '${t.alt}' and will be removed in a future version of abstract-level`);const r=new Map(e.map((t=>[t.name,t]))),i=this;t.on("newListener",(function(t){const e=r.get(t);void 0!==e&&(i[t]=!0,e.deprecated&&n(e.message))})),t.on("removeListener",(function(t){r.has(t)&&(i[t]=this.listenerCount(t)>0)}))}}},3172:(t,e,r)=>{"use strict";const{noop:n}=r(1343),i=Symbol("functions"),o=Symbol("async");class s{constructor(t){this[o]=t.async,this[i]=new Set,this.noop=!0,this.run=c(this)}add(t){a(t),this[i].add(t),this.noop=!1,this.run=c(this)}delete(t){a(t),this[i].delete(t),this.noop=0===this[i].size,this.run=c(this)}}const a=function(t){if("function"!=typeof t)throw new TypeError("The first argument must be a function, received "+(null===t?"null":typeof t))},c=function(t){if(t.noop)return n;if(1===t[i].size){const[e]=t[i];return e}return t[o]?async function(t,...e){for(const r of t)await r(...e)}.bind(null,Array.from(t[i])):function(t,...e){for(const r of t)r(...e)}.bind(null,Array.from(t[i]))};e.DatabaseHooks=class{constructor(){this.postopen=new s({async:!0}),this.prewrite=new s({async:!1}),this.newsub=new s({async:!1})}}},1450:(t,e)=>{"use strict";e.prefixDescendantKey=function(t,e,r,n){for(;null!==r&&r!==n;)t=r.prefixKey(t,e,!0),r=r.parent;return t},e.isDescendant=function(t,e){for(;;){if(null==t.parent)return!1;if(t.parent===e)return!0;t=t.parent}}},9767:(t,e,r)=>{"use strict";const{prefixDescendantKey:n,isDescendant:i}=r(1450),o=Symbol("db"),s=Symbol("privateOperations"),a=Symbol("publicOperations");e.PrewriteBatch=class{constructor(t,e,r){this[o]=t,this[s]=e,this[a]=r}add(t){const e="put"===t.type,r=null!=t.sublevel,c=r?t.sublevel:this[o],u=c._checkKey(t.key);if(null!=u)throw u;if(t.keyEncoding=c.keyEncoding(t.keyEncoding),e){const e=c._checkValue(t.value);if(null!=e)throw e;t.valueEncoding=c.valueEncoding(t.valueEncoding)}else if("del"!==t.type)throw new TypeError("A batch operation must have a type property that is 'put' or 'del'");const l=t.keyEncoding,h=l.encode(t.key),f=l.format,p=r&&!i(t.sublevel,this[o])&&t.sublevel!==this[o],y=r&&!p?n(h,f,c,this[o]):h;r&&!p&&(t.sublevel=null);let d=null;if(null===this[a]||p||(d=Object.assign({},t),d.encodedKey=y,r&&(d.key=y,d.keyEncoding=this[o].keyEncoding(f)),this[a].push(d)),t.key=p?y:this[o].prefixKey(y,f,!0),t.keyEncoding=f,e){const e=t.valueEncoding,n=e.encode(t.value),i=e.format;t.value=n,t.valueEncoding=i,null!==d&&(d.encodedValue=n,r&&(d.value=n,d.valueEncoding=this[o].valueEncoding(i)))}return this[s].push(t),this}}},386:t=>{"use strict";const e=Object.prototype.hasOwnProperty,r=new Set(["lt","lte","gt","gte"]);t.exports=function(t,n){const i={};for(const o in t)e.call(t,o)&&"keyEncoding"!==o&&"valueEncoding"!==o&&(r.has(o)?i[o]=n.encode(t[o]):i[o]=t[o]);return i.reverse=!!i.reverse,i.limit=Number.isInteger(i.limit)&&i.limit>=0?i.limit:-1,i}},9511:(t,e,r)=>{"use strict";var n=r(6556)("ArrayBuffer.prototype.byteLength",!0),i=r(4670);t.exports=function(t){return i(t)?n?n(t):t.byteLength:NaN}},3870:t=>{"use strict";const e=async function(){}.constructor;t.exports=()=>e},7526:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=a(t),s=o[0],c=o[1],u=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,c)),l=0,h=c>0?s-4:s;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===c&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[l++]=255&e),1===c&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,a=0,u=n-i;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));return 1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,n){for(var i,o,s=[],a=e;a<n;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},9148:(t,e,r)=>{"use strict";const{AbstractLevel:n}=r(5e3),{Iterator:i}=r(6296),o=r(5222),s=r(3452),a=r(7766),c="level-js-",u=Symbol("idb"),l=Symbol("namePrefix"),h=Symbol("location"),f=Symbol("version"),p=Symbol("store"),y=Symbol("onComplete");class d extends n{constructor(t,e){const{prefix:r,version:n,...i}=e||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},i),"string"!=typeof t||""===t)throw new TypeError("The first argument 'location' must be a non-empty string");this[h]=t,this[l]=null==r?c:r,this[f]=parseInt(n||1,10),this[u]=null}get location(){return this[h]}get namePrefix(){return this[l]}get version(){return this[f]}get db(){return this[u]}get type(){return"browser-level"}async _open(t){const e=indexedDB.open(this[l]+this[h],this[f]);return e.onupgradeneeded=t=>{const e=t.target.result;e.objectStoreNames.contains(this[h])||e.createObjectStore(this[h])},new Promise(((t,r)=>{e.onerror=function(){r(e.error||new Error("unknown error"))},e.onsuccess=()=>{this[u]=e.result,t()}}))}[p](t){return this[u].transaction([this[h]],t).objectStore(this[h])}[y](t){const e=t.transaction;return new Promise((function(r,n){e.onabort=function(){n(e.error||new Error("aborted by user"))},e.oncomplete=function(){r(t.result)}}))}async _get(t,e){const r=this[p]("readonly").get(t),n=await this[y](r);return o(n)}async _getMany(t,e){const r=this[p]("readonly"),n=t.values(),i=Math.min(16,t.length),s=new Array(i),a=new Array(t.length);let c=0,u=!1;const l=async function(){try{for(const t of n){if(u)break;const e=c++,n=r.get(t);await new Promise((function(t,r){n.onsuccess=()=>{a[e]=o(n.result),t()},n.onerror=t=>{t.stopPropagation(),r(n.error)}}))}}catch(t){throw u=!0,t}};for(let t=0;t<i;t++)s[t]=l();return await Promise.allSettled(s),a}async _del(t,e){const r=this[p]("readwrite").delete(t);return this[y](r)}async _put(t,e,r){const n=this[p]("readwrite").put(e,t);return this[y](n)}_iterator(t){return new i(this,this[h],t)}async _batch(t,e){const r=this[p]("readwrite"),n=r.transaction;let i,o=0;const s=new Promise((function(t,e){n.onabort=function(){e(i||n.error||new Error("aborted by user"))},n.oncomplete=t}));return function e(){const s=t[o++],a=s.key;let c;try{c="del"===s.type?r.delete(a):r.put(s.value,a)}catch(t){return i=t,void n.abort()}o<t.length?c.onsuccess=e:"function"==typeof n.commit&&n.commit()}(),s}async _clear(t){let e;try{e=a(t)}catch(t){return}if(t.limit>=0)return s(this,this[h],e,t);const r=this[p]("readwrite"),n=e?r.delete(e):r.clear();return this[y](n)}async _close(){this[u].close()}}d.destroy=async function(t,e){null==e&&(e=c);const r=indexedDB.deleteDatabase(e+t);return new Promise((function(t,e){r.onsuccess=t,r.onerror=e}))},e.Z=d},6296:(t,e,r)=>{"use strict";const{AbstractIterator:n}=r(5e3),i=r(7766),o=r(5222),s=Symbol("cache"),a=Symbol("finished"),c=Symbol("options"),u=Symbol("currentOptions"),l=Symbol("position"),h=Symbol("location"),f=Symbol("first"),p={};function y(t){"function"==typeof t.commit&&t.commit()}e.Iterator=class extends n{constructor(t,e,r){super(t,r),this[s]=[],this[a]=0===this.limit,this[c]=r,this[u]={...r},this[l]=void 0,this[h]=e,this[f]=!0}async _nextv(t,e){if(this[f]=!1,this[a])return[];if(this[s].length>0)return t=Math.min(t,this[s].length),this[s].splice(0,t);let r;void 0!==this[l]&&(this[c].reverse?(this[u].lt=this[l],this[u].lte=void 0):(this[u].gt=this[l],this[u].gte=void 0));try{r=i(this[u])}catch(t){return this[a]=!0,[]}const n=this.db.db.transaction([this[h]],"readonly"),p=n.objectStore(this[h]),d=[],g=new Promise((function(t,e){n.onabort=()=>{e(n.error||new Error("aborted by user"))},n.oncomplete=()=>{t(d)}}));if(this[c].reverse)p[!this[c].values&&p.openKeyCursor?"openKeyCursor":"openCursor"](r,"prev").onsuccess=e=>{const r=e.target.result;if(r){const{key:e,value:i}=r;this[l]=e,d.push([this[c].keys&&void 0!==e?o(e):void 0,this[c].values&&void 0!==i?o(i):void 0]),d.length<t?r.continue():y(n)}else this[a]=!0};else{let e,i;const s=()=>{if(void 0===e||void 0===i)return;const r=Math.max(e.length,i.length);0===r||t===1/0?this[a]=!0:this[l]=e[r-1],d.length=r;for(let t=0;t<r;t++){const r=e[t],n=i[t];d[t]=[this[c].keys?o(r):void 0,this[c].values?o(n):void 0]}y(n)};this[c].keys||t<1/0?p.getAllKeys(r,t<1/0?t:void 0).onsuccess=t=>{e=t.target.result,s()}:(e=[],s()),this[c].values?p.getAll(r,t<1/0?t:void 0).onsuccess=t=>{i=t.target.result,s()}:(i=[],s())}return g}async _next(){if(this[s].length>0)return this[s].shift();if(!this[a]){let t=Math.min(100,this.limit-this.count);return this[f]&&(this[f]=!1,t=1),this[s]=await this._nextv(t,p),this[s].shift()}}async _all(t){this[f]=!1;const e=this[s].splice(0,this[s].length),r=this.limit-this.count-e.length;if(r<=0)return e;let n=await this._nextv(r,p);return e.length>0&&(n=e.concat(n)),n}_seek(t,e){let r;this[f]=!0,this[s]=[],this[a]=!1,this[l]=void 0,this[u]={...this[c]};try{r=i(this[c])}catch(t){return void(this[a]=!0)}null===r||r.includes(t)?this[c].reverse?this[u].lte=t:this[u].gte=t:this[a]=!0}}},3452:t=>{"use strict";t.exports=async function(t,e,r,n){if(0===n.limit)return;const i=t.db.transaction([e],"readwrite"),o=i.objectStore(e);let s=0;const a=new Promise((function(t,e){i.oncomplete=t,i.onabort=function(){e(i.error||new Error("aborted by user"))}})),c=o.openKeyCursor?"openKeyCursor":"openCursor",u=n.reverse?"prev":"next";return o[c](r,u).onsuccess=function(t){const e=t.target.result;e&&(o.delete(e.key).onsuccess=function(){(n.limit<=0||++s<n.limit)&&e.continue()})},a}},5222:t=>{"use strict";const e=new TextEncoder;t.exports=function(t){return void 0===t||t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):e.encode(t)}},7766:t=>{"use strict";t.exports=function(t){const e=void 0!==t.gte?t.gte:void 0!==t.gt?t.gt:void 0,r=void 0!==t.lte?t.lte:void 0!==t.lt?t.lt:void 0,n=void 0===t.gte,i=void 0===t.lte;return void 0!==e&&void 0!==r?IDBKeyRange.bound(e,r,n,i):void 0!==e?IDBKeyRange.lowerBound(e,n):void 0!==r?IDBKeyRange.upperBound(r,i):null}},8287:(t,e,r)=>{"use strict";const n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){return+t!=t&&(t=0),c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|d(t,e);let n=a(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return c.from(n,e,r);const i=function(t){if(c.isBuffer(t)){const e=0|y(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return l(t),a(t<0?0:0|y(t))}function f(t){const e=t.length<0?0:0|y(t.length),r=a(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,c.prototype),n}function y(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function d(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(i)return n?-1:K(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return U(this,e,r);case"utf8":case"utf-8":return I(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return x(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function v(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=c.from(e,n)),c.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){let o,s=1,a=t.length,c=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(t,o)===u(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(t,o+n)!==u(e,n)){r=!1;break}if(r)return o}return-1}function E(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(J(n))return s;t[r+s]=n}return s}function w(t,e,r,n){return q(K(e,t.length-r),t,r,n)}function A(t,e,r,n){return q(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return q(H(e),t,r,n)}function T(t,e,r,n){return q(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function I(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(o=c));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(c=(15&e)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=t[i+1],n=t[i+2],a=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=_)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=_));return r}(n)}e.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)}(t,e,r)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=c.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))i+e.length>n.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},c.byteLength=d,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?I(this,0,t):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return th