Socket
Socket
Sign inDemoInstall

@intershare/hooks.indexdb

Package Overview
Dependencies
23
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.24 to 0.0.25

dist/preview-1706715089835.js

2

artifacts/preview/intershare_galacfetch_hooks_indexdb-component.js
/*! For license information please see intershare_galacfetch_hooks_indexdb-component.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["intershare.galacfetch/hooks/indexdb"]=t():e["intershare.galacfetch/hooks/indexdb"]=t()}(self,(()=>(()=>{"use strict";var e,t={4444:(e,t,r)=>{var n=r(7363),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useState,i=n.useEffect,c=n.useLayoutEffect,u=n.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!o(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=a({inst:{value:r,getSnapshot:t}}),o=n[0].inst,l=n[1];return c((function(){o.value=r,o.getSnapshot=t,s(o)&&l({inst:o})}),[e,r,t]),i((function(){return s(o)&&l({inst:o}),e((function(){s(o)&&l({inst:o})}))}),[e]),u(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:l},7593:(e,t,r)=>{var n=r(7363),o=r(4432),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=o.useSyncExternalStore,c=n.useRef,u=n.useEffect,s=n.useMemo,l=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var f=c(null);if(null===f.current){var p={hasValue:!1,value:null};f.current=p}else p=f.current;f=s((function(){function e(e){if(!u){if(u=!0,i=e,e=n(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return c=t}return c=e}if(t=c,a(i,e))return t;var r=n(e);return void 0!==o&&o(t,r)?t:(i=e,c=r)}var i,c,u=!1,s=void 0===r?null:r;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]}),[t,r,n,o]);var d=i(e,f[0],f[1]);return u((function(){p.hasValue=!0,p.value=d}),[d]),l(d),d}},4432:(e,t,r)=>{e.exports=r(4444)},591:(e,t,r)=>{e.exports=r(7593)},7363:e=>{e.exports=React},9538:(e,t,r)=>{r.r(t),r.d(t,{ObjectStoresEnum:()=>p,indexDbStore:()=>x});const n=e=>new Blob([JSON.stringify(e)]).size;n.__bit_component={id:"intershare.galacfetch/utils/general@0.0.19",homepage:"https://bit.cloud/intershare/galacfetch/utils/general",exported:!0};const o=e=>{let t;const r=new Set,n=(e,n)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach((r=>r(t,e)))}},o=()=>t,a={setState:n,getState:o,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},i=t=e(n,o,a);return a};var a=r(7363),i=r(591);const{useDebugValue:c}=a,{useSyncExternalStoreWithSelector:u}=i;let s=!1;const l=e=>e,f=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?o(e):o)(e):e,r=(e,r)=>function(e,t=l,r){r&&!s&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),s=!0);const n=u(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return c(n),n}(t,e,r);return Object.assign(r,t),r};var p;function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function h(){h=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof w?t:w,i=Object.create(a.prototype),c=new N(n||[]);return o(i,"_invoke",{value:P(e,r,c)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var p="suspendedStart",b="suspendedYield",v="executing",y="completed",g={};function w(){}function m(){}function x(){}var E={};s(E,i,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(z([])));O&&O!==r&&n.call(O,i)&&(E=O);var j=x.prototype=w.prototype=Object.create(E);function D(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(o,a,i,c){var u=f(e[o],e,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==d(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,c)}))}c(u.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,n){var o=p;return function(a,i){if(o===v)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=f(t,r,n);if("normal"===s.type){if(o=n.done?y:b,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function I(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,I(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function B(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(d(t)+" is not iterable")}return m.prototype=x,o(j,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:m,configurable:!0}),m.displayName=s(x,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,s(e,u,"GeneratorFunction")),e.prototype=Object.create(j),e},t.awrap=function(e){return{__await:e}},D(k.prototype),s(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new k(l(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},D(j),s(j,u,"Generator"),s(j,i,(function(){return this})),s(j,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=z,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(B),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),B(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;B(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function b(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){b(a,n,o,i,c,"next",e)}function c(e){b(a,n,o,i,c,"throw",e)}i(void 0)}))}}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){var n,o,a,i;n=e,o=t,a=r[t],i=function(e,t){if("object"!=d(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o),(o="symbol"==d(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.files="files",e.stats="stats"}(p||(p={}));var w,m=(w?f(w):f)((function(e){return{config:{maxSizeByTable:void 0,garbageCollector:{enabled:!0,interval:6e4,strategy:"lru"}},setConfig:function(t){e((function(e){return{config:g(g(g({},e.config),t),{},{garbageCollector:g(g({},e.config.garbageCollector),t.garbageCollector)})}}))},status:null,initIndexedDb:(u=v(h().mark((function t(r){var n,o,a;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=m.getState(),o=n.config,a=n.checkGarbageCollector,t.abrupt("return",new Promise((function(t,n){var i=indexedDB.open(r);i.onsuccess=function(){console.info("IndexedDB initialized");var r=i.result;e({iDb:r}),t(r),o.garbageCollector.enabled&&setInterval((function(){a()}),o.garbageCollector.interval)},i.onerror=function(e){console.error("Error initializing IndexedDB",e),n(e)},i.onupgradeneeded=function(e){var t=e.target.result;Object.values(p).forEach((function(e){t.objectStoreNames.contains(e)||t.createObjectStore(e)}))}})));case 2:case"end":return t.stop()}}),t)}))),function(e){return u.apply(this,arguments)}),iDb:null,saveData:(c=v(h().mark((function e(t,r,o){var a,i,c,u,s;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=m.getState(),i=a.iDb){e.next=4;break}return console.error("IndexedDB no está inicializado"),e.abrupt("return");case 4:if(t){e.next=7;break}return console.error("No se proporcionó ID"),e.abrupt("return");case 7:if(o){e.next=10;break}return console.error("No se proporcionó nombre de tabla"),e.abrupt("return");case 10:return o===p.stats&&console.error("No se puede guardar en la tabla stats"),e.prev=11,c=i.transaction([o,p.stats],"readwrite"),u=c.objectStore(o),s=c.objectStore(p.stats),e.next=17,new Promise((function(e,a){var i=u.put(r,t),c=s.get(o);c.onsuccess=function(){var e,t=((null===(e=c.result)||void 0===e?void 0:e.size)||0)+n(r);s.put({size:t},o).onsuccess=function(){console.log("stats updated")}},i.onsuccess=function(){return e()},i.onerror=function(){console.error("Error al guardar los datos en IndexedDB",i.error),a(i.error)}}));case 17:console.info("Datos guardados con éxito"),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(11),console.error("Error durante la transacción de IndexedDB",e.t0);case 23:case"end":return e.stop()}}),e,null,[[11,20]])}))),function(e,t,r){return c.apply(this,arguments)}),getData:(i=v(h().mark((function e(t,r){var n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=m.getState(),o=n.iDb){e.next=4;break}throw console.error("iDb not initialized"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("no id provided"),new Error("No se proporcionó ID");case 7:if(r){e.next=10;break}throw console.error("no tableName provided"),new Error("No se proporcionó nombre de tabla");case 10:return e.prev=10,a=o.transaction([r],"readonly"),i=a.objectStore(r),e.next=15,new Promise((function(e,r){var n=i.get(t);n.onsuccess=function(){return e(n.result)},n.onerror=function(){console.error("Error al obtener datos de IndexedDB",n.error),r(n.error)}}));case 15:return e.abrupt("return",e.sent);case 18:throw e.prev=18,e.t0=e.catch(10),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 22:case"end":return e.stop()}}),e,null,[[10,18]])}))),function(e,t){return i.apply(this,arguments)}),removeData:(a=v(h().mark((function e(t,r){var n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=m.getState(),o=n.iDb){e.next=4;break}throw console.error("IndexedDB no está inicializado"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("No se proporcionó ID"),new Error("No se proporcionó ID");case 7:if(r){e.next=10;break}throw console.error("No se proporcionó nombre de tabla"),new Error("No se proporcionó nombre de tabla");case 10:return e.prev=10,a=o.transaction([r],"readwrite"),i=a.objectStore(r),e.next=15,new Promise((function(e,r){var n=i.delete(t);n.onsuccess=function(){return e(n.result)},n.onerror=function(){console.error("Error al eliminar datos de IndexedDB",n.error),r(n.error)}}));case 15:return e.abrupt("return",e.sent);case 18:throw e.prev=18,e.t0=e.catch(10),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 22:case"end":return e.stop()}}),e,null,[[10,18]])}))),function(e,t){return a.apply(this,arguments)}),getAllKeys:(o=v(h().mark((function e(t){var r,n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=m.getState(),n=r.iDb){e.next=4;break}throw console.error("IndexedDB no está inicializado"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("No se proporcionó nombre de tabla"),new Error("No se proporcionó nombre de tabla");case 7:return e.prev=7,o=n.transaction([t],"readonly"),a=o.objectStore(t),i=a.getAllKeys(),e.next=13,new Promise((function(e,t){i.onsuccess=function(){return e(i.result)},i.onerror=function(){console.error("Error al obtener todas las claves de IndexedDB",i.error),t(i.error)}}));case 13:return e.abrupt("return",e.sent);case 16:throw e.prev=16,e.t0=e.catch(7),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 20:case"end":return e.stop()}}),e,null,[[7,16]])}))),function(e){return o.apply(this,arguments)}),getTableStats:(r=v(h().mark((function e(t){var r,n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=m.getState(),n=r.iDb){e.next=4;break}throw console.error("IndexedDB no está inicializado"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("No se proporcionó nombre de tabla"),new Error("No se proporcionó nombre de tabla");case 7:return e.prev=7,o=n.transaction([p.stats],"readonly"),a=o.objectStore(p.stats),i=a.get(t),e.next=13,new Promise((function(e,t){i.onsuccess=function(){return e(i.result)},i.onerror=function(){console.error("Error al obtener las estadísticas de la tabla de IndexedDB",i.error),t(i.error)}}));case 13:return e.abrupt("return",e.sent);case 16:throw e.prev=16,e.t0=e.catch(7),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 20:case"end":return e.stop()}}),e,null,[[7,16]])}))),function(e){return r.apply(this,arguments)}),checkGarbageCollector:(t=v(h().mark((function e(){var t,r,n,o,a,i,c,u,s,l,f,d;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=m.getState(),r=t.config,n=t.getAllKeys,o=t.removeData,a=t.getTableStats,r.garbageCollector.enabled){e.next=3;break}return e.abrupt("return");case 3:i=Object.values(p),c=0,u=i;case 5:if(!(c<u.length)){e.next=35;break}if((s=u[c])!==p.stats){e.next=9;break}return e.abrupt("continue",32);case 9:return e.next=11,a(s);case 11:if(l=e.sent){e.next=14;break}return e.abrupt("continue",32);case 14:if(e.t1=r.maxSizeByTable,e.t1){e.next=19;break}return e.next=18,navigator.storage.estimate().then((function(e){return e.quota}));case 18:e.t1=e.sent;case 19:if(e.t0=e.t1,e.t0){e.next=22;break}e.t0=1e9;case 22:if(!(e.t0<l.size)){e.next=32;break}return e.next=26,n(s);case 26:if(f=e.sent){e.next=29;break}return e.abrupt("continue",32);case 29:return d=f[0],e.next=32,o(d,s);case 32:c++,e.next=5;break;case 35:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})};var t,r,o,a,i,c,u}));const x=m}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,e=[],n.O=(t,r,o,a)=>{if(!r){var i=1/0;for(l=0;l<e.length;l++){for(var[r,o,a]=e[l],c=!0,u=0;u<r.length;u++)(!1&a||i>=a)&&Object.keys(n.O).every((e=>n.O[e](r[u])))?r.splice(u--,1):(c=!1,a<i&&(i=a));if(c){e.splice(l--,1);var s=o();void 0!==s&&(t=s)}}return t}a=a||0;for(var l=e.length;l>0&&e[l-1][2]>a;l--)e[l]=e[l-1];e[l]=[r,o,a]},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={891:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,a,[i,c,u]=r,s=0;if(i.some((t=>0!==e[t]))){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(u)var l=u(n)}for(t&&t(r);s<i.length;s++)a=i[s],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(l)},r=self.webpackChunk=self.webpackChunk||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var o=n(9538);return n.O(o)})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["intershare.galacfetch/hooks/indexdb"]=t():e["intershare.galacfetch/hooks/indexdb"]=t()}(self,(()=>(()=>{"use strict";var e,t={4444:(e,t,r)=>{var n=r(7363),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useState,i=n.useEffect,c=n.useLayoutEffect,u=n.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!o(e,r)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=a({inst:{value:r,getSnapshot:t}}),o=n[0].inst,l=n[1];return c((function(){o.value=r,o.getSnapshot=t,s(o)&&l({inst:o})}),[e,r,t]),i((function(){return s(o)&&l({inst:o}),e((function(){s(o)&&l({inst:o})}))}),[e]),u(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:l},7593:(e,t,r)=>{var n=r(7363),o=r(4432),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=o.useSyncExternalStore,c=n.useRef,u=n.useEffect,s=n.useMemo,l=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var f=c(null);if(null===f.current){var p={hasValue:!1,value:null};f.current=p}else p=f.current;f=s((function(){function e(e){if(!u){if(u=!0,i=e,e=n(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return c=t}return c=e}if(t=c,a(i,e))return t;var r=n(e);return void 0!==o&&o(t,r)?t:(i=e,c=r)}var i,c,u=!1,s=void 0===r?null:r;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]}),[t,r,n,o]);var d=i(e,f[0],f[1]);return u((function(){p.hasValue=!0,p.value=d}),[d]),l(d),d}},4432:(e,t,r)=>{e.exports=r(4444)},591:(e,t,r)=>{e.exports=r(7593)},7363:e=>{e.exports=React},1773:(e,t,r)=>{r.r(t),r.d(t,{ObjectStoresEnum:()=>p,indexDbStore:()=>x});const n=e=>new Blob([JSON.stringify(e)]).size;n.__bit_component={id:"intershare.galacfetch/utils/general@0.0.20",homepage:"https://bit.cloud/intershare/galacfetch/utils/general",exported:!0};const o=e=>{let t;const r=new Set,n=(e,n)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach((r=>r(t,e)))}},o=()=>t,a={setState:n,getState:o,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},i=t=e(n,o,a);return a};var a=r(7363),i=r(591);const{useDebugValue:c}=a,{useSyncExternalStoreWithSelector:u}=i;let s=!1;const l=e=>e,f=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?o(e):o)(e):e,r=(e,r)=>function(e,t=l,r){r&&!s&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),s=!0);const n=u(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return c(n),n}(t,e,r);return Object.assign(r,t),r};var p;function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function h(){h=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof w?t:w,i=Object.create(a.prototype),c=new N(n||[]);return o(i,"_invoke",{value:P(e,r,c)}),i}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var p="suspendedStart",b="suspendedYield",v="executing",y="completed",g={};function w(){}function m(){}function x(){}var E={};s(E,i,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(z([])));O&&O!==r&&n.call(O,i)&&(E=O);var j=x.prototype=w.prototype=Object.create(E);function D(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(o,a,i,c){var u=f(e[o],e,a);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==d(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,i,c)}),(function(e){r("throw",e,i,c)})):t.resolve(l).then((function(e){s.value=e,i(s)}),(function(e){return r("throw",e,i,c)}))}c(u.arg)}var a;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return a=a?a.then(o,o):o()}})}function P(t,r,n){var o=p;return function(a,i){if(o===v)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=f(t,r,n);if("normal"===s.type){if(o=n.done?y:b,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function I(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,I(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function B(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function z(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(d(t)+" is not iterable")}return m.prototype=x,o(j,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:m,configurable:!0}),m.displayName=s(x,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,s(e,u,"GeneratorFunction")),e.prototype=Object.create(j),e},t.awrap=function(e){return{__await:e}},D(k.prototype),s(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new k(l(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},D(j),s(j,u,"Generator"),s(j,i,(function(){return this})),s(j,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=z,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(B),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),B(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;B(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function b(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){b(a,n,o,i,c,"next",e)}function c(e){b(a,n,o,i,c,"throw",e)}i(void 0)}))}}function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){var n,o,a,i;n=e,o=t,a=r[t],i=function(e,t){if("object"!=d(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o),(o="symbol"==d(i)?i:String(i))in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.files="files",e.stats="stats"}(p||(p={}));var w,m=(w?f(w):f)((function(e){return{config:{maxSizeByTable:void 0,garbageCollector:{enabled:!0,interval:6e4,strategy:"lru"}},setConfig:function(t){e((function(e){return{config:g(g(g({},e.config),t),{},{garbageCollector:g(g({},e.config.garbageCollector),t.garbageCollector)})}}))},status:null,initIndexedDb:(u=v(h().mark((function t(r){var n,o,a;return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=m.getState(),o=n.config,a=n.checkGarbageCollector,t.abrupt("return",new Promise((function(t,n){var i=indexedDB.open(r);i.onsuccess=function(){console.info("IndexedDB initialized");var r=i.result;e({iDb:r}),t(r),o.garbageCollector.enabled&&setInterval((function(){a()}),o.garbageCollector.interval)},i.onerror=function(e){console.error("Error initializing IndexedDB",e),n(e)},i.onupgradeneeded=function(e){var t=e.target.result;Object.values(p).forEach((function(e){t.objectStoreNames.contains(e)||t.createObjectStore(e)}))}})));case 2:case"end":return t.stop()}}),t)}))),function(e){return u.apply(this,arguments)}),iDb:null,saveData:(c=v(h().mark((function e(t,r,o){var a,i,c,u,s;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=m.getState(),i=a.iDb){e.next=4;break}return console.error("IndexedDB no está inicializado"),e.abrupt("return");case 4:if(t){e.next=7;break}return console.error("No se proporcionó ID"),e.abrupt("return");case 7:if(o){e.next=10;break}return console.error("No se proporcionó nombre de tabla"),e.abrupt("return");case 10:return o===p.stats&&console.error("No se puede guardar en la tabla stats"),e.prev=11,c=i.transaction([o,p.stats],"readwrite"),u=c.objectStore(o),s=c.objectStore(p.stats),e.next=17,new Promise((function(e,a){var i=u.put(r,t),c=s.get(o);c.onsuccess=function(){var e,t=((null===(e=c.result)||void 0===e?void 0:e.size)||0)+n(r);s.put({size:t},o).onsuccess=function(){console.log("stats updated")}},i.onsuccess=function(){return e()},i.onerror=function(){console.error("Error al guardar los datos en IndexedDB",i.error),a(i.error)}}));case 17:console.info("Datos guardados con éxito"),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(11),console.error("Error durante la transacción de IndexedDB",e.t0);case 23:case"end":return e.stop()}}),e,null,[[11,20]])}))),function(e,t,r){return c.apply(this,arguments)}),getData:(i=v(h().mark((function e(t,r){var n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=m.getState(),o=n.iDb){e.next=4;break}throw console.error("iDb not initialized"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("no id provided"),new Error("No se proporcionó ID");case 7:if(r){e.next=10;break}throw console.error("no tableName provided"),new Error("No se proporcionó nombre de tabla");case 10:return e.prev=10,a=o.transaction([r],"readonly"),i=a.objectStore(r),e.next=15,new Promise((function(e,r){var n=i.get(t);n.onsuccess=function(){return e(n.result)},n.onerror=function(){console.error("Error al obtener datos de IndexedDB",n.error),r(n.error)}}));case 15:return e.abrupt("return",e.sent);case 18:throw e.prev=18,e.t0=e.catch(10),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 22:case"end":return e.stop()}}),e,null,[[10,18]])}))),function(e,t){return i.apply(this,arguments)}),removeData:(a=v(h().mark((function e(t,r){var n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=m.getState(),o=n.iDb){e.next=4;break}throw console.error("IndexedDB no está inicializado"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("No se proporcionó ID"),new Error("No se proporcionó ID");case 7:if(r){e.next=10;break}throw console.error("No se proporcionó nombre de tabla"),new Error("No se proporcionó nombre de tabla");case 10:return e.prev=10,a=o.transaction([r],"readwrite"),i=a.objectStore(r),e.next=15,new Promise((function(e,r){var n=i.delete(t);n.onsuccess=function(){return e(n.result)},n.onerror=function(){console.error("Error al eliminar datos de IndexedDB",n.error),r(n.error)}}));case 15:return e.abrupt("return",e.sent);case 18:throw e.prev=18,e.t0=e.catch(10),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 22:case"end":return e.stop()}}),e,null,[[10,18]])}))),function(e,t){return a.apply(this,arguments)}),getAllKeys:(o=v(h().mark((function e(t){var r,n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=m.getState(),n=r.iDb){e.next=4;break}throw console.error("IndexedDB no está inicializado"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("No se proporcionó nombre de tabla"),new Error("No se proporcionó nombre de tabla");case 7:return e.prev=7,o=n.transaction([t],"readonly"),a=o.objectStore(t),i=a.getAllKeys(),e.next=13,new Promise((function(e,t){i.onsuccess=function(){return e(i.result)},i.onerror=function(){console.error("Error al obtener todas las claves de IndexedDB",i.error),t(i.error)}}));case 13:return e.abrupt("return",e.sent);case 16:throw e.prev=16,e.t0=e.catch(7),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 20:case"end":return e.stop()}}),e,null,[[7,16]])}))),function(e){return o.apply(this,arguments)}),getTableStats:(r=v(h().mark((function e(t){var r,n,o,a,i;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=m.getState(),n=r.iDb){e.next=4;break}throw console.error("IndexedDB no está inicializado"),new Error("IndexedDB no está inicializado");case 4:if(t){e.next=7;break}throw console.error("No se proporcionó nombre de tabla"),new Error("No se proporcionó nombre de tabla");case 7:return e.prev=7,o=n.transaction([p.stats],"readonly"),a=o.objectStore(p.stats),i=a.get(t),e.next=13,new Promise((function(e,t){i.onsuccess=function(){return e(i.result)},i.onerror=function(){console.error("Error al obtener las estadísticas de la tabla de IndexedDB",i.error),t(i.error)}}));case 13:return e.abrupt("return",e.sent);case 16:throw e.prev=16,e.t0=e.catch(7),console.error("Error durante la transacción de IndexedDB",e.t0),e.t0;case 20:case"end":return e.stop()}}),e,null,[[7,16]])}))),function(e){return r.apply(this,arguments)}),checkGarbageCollector:(t=v(h().mark((function e(){var t,r,n,o,a,i,c,u,s,l,f,d;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=m.getState(),r=t.config,n=t.getAllKeys,o=t.removeData,a=t.getTableStats,r.garbageCollector.enabled){e.next=3;break}return e.abrupt("return");case 3:i=Object.values(p),c=0,u=i;case 5:if(!(c<u.length)){e.next=35;break}if((s=u[c])!==p.stats){e.next=9;break}return e.abrupt("continue",32);case 9:return e.next=11,a(s);case 11:if(l=e.sent){e.next=14;break}return e.abrupt("continue",32);case 14:if(e.t1=r.maxSizeByTable,e.t1){e.next=19;break}return e.next=18,navigator.storage.estimate().then((function(e){return e.quota}));case 18:e.t1=e.sent;case 19:if(e.t0=e.t1,e.t0){e.next=22;break}e.t0=1e9;case 22:if(!(e.t0<l.size)){e.next=32;break}return e.next=26,n(s);case 26:if(f=e.sent){e.next=29;break}return e.abrupt("continue",32);case 29:return d=f[0],e.next=32,o(d,s);case 32:c++,e.next=5;break;case 35:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})};var t,r,o,a,i,c,u}));const x=m}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,e=[],n.O=(t,r,o,a)=>{if(!r){var i=1/0;for(l=0;l<e.length;l++){for(var[r,o,a]=e[l],c=!0,u=0;u<r.length;u++)(!1&a||i>=a)&&Object.keys(n.O).every((e=>n.O[e](r[u])))?r.splice(u--,1):(c=!1,a<i&&(i=a));if(c){e.splice(l--,1);var s=o();void 0!==s&&(t=s)}}return t}a=a||0;for(var l=e.length;l>0&&e[l-1][2]>a;l--)e[l]=e[l-1];e[l]=[r,o,a]},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={891:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var o,a,[i,c,u]=r,s=0;if(i.some((t=>0!==e[t]))){for(o in c)n.o(c,o)&&(n.m[o]=c[o]);if(u)var l=u(n)}for(t&&t(r);s<i.length;s++)a=i[s],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(l)},r=self.webpackChunk=self.webpackChunk||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var o=n(1773);return n.O(o)})()));
/*! For license information please see intershare_galacfetch_hooks_indexdb-preview.js.LICENSE.txt */
"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["intershare.galacfetch/hooks/indexdb-preview"]=e():t["intershare.galacfetch/hooks/indexdb-preview"]=e()}(self,(()=>(self.webpackChunk=self.webpackChunk||[]).push([[890],{3354:(t,e,r)=>{var n=r(7363),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,r){var n,c={},u=null,s=null;for(n in void 0!==r&&(u=""+r),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(s=e.ref),e)a.call(e,n)&&!l.hasOwnProperty(n)&&(c[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===c[n]&&(c[n]=e[n]);return{$$typeof:o,type:t,key:u,ref:s,props:c,_owner:i.current}}e.jsx=c,e.jsxs=c},1527:(t,e,r)=>{t.exports=r(3354)},14:(t,e,r)=>{r.r(e),r.d(e,{compositions:()=>V,compositions_metadata:()=>X,overview:()=>W});var n={};r.r(n),r.d(n,{IndexDbInitiator:()=>m});var o={};r.r(o),r.d(o,{SaveDataExample:()=>S});var a={};r.r(a),r.d(a,{RetrieveKeysExample:()=>D});var i={};r.r(i),r.d(i,{RetrieveDataExample:()=>P});var l={};r.r(l),r.d(l,{RetrieveTableStatsExample:()=>K});var c={};r.r(c),r.d(c,{default:()=>$});var u=r(1527),s=r(7363),f=r(9538);function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function p(){p=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof b?e:b,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:D(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var d="suspendedStart",y="suspendedYield",m="executing",v="completed",g={};function b(){}function x(){}function w(){}var S={};u(S,i,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(C([])));j&&j!==r&&n.call(j,i)&&(S=j);var L=w.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==h(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function D(e,r,n){var o=d;return function(a,i){if(o===m)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=k(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=m;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?v:y,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(h(e)+" is not iterable")}return x.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=u(w,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(N.prototype),u(N.prototype,l,(function(){return this})),e.AsyncIterator=N,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new N(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},O(L),u(L,c,"Generator"),u(L,i,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function d(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var m=function(){var t,e,r=(t=(0,s.useState)("Inactive"),e=2,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=r[0],o=r[1],a=(0,f.indexDbStore)();return(0,s.useEffect)((function(){var t=function(){var t,e=(t=p().mark((function t(){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o("Initializing..."),t.next=5,a.initIndexedDb("myDatabase");case 5:o("Database successfully initialized."),t.next=12;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error initializing the database:",t.t0),o("Error initializing the database.");case 12:case"end":return t.stop()}}),t,null,[[0,8]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){d(a,n,o,i,l,"next",t)}function l(t){d(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();t()}),[]),(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"IndexedDB Initialization Status:"}),(0,u.jsx)("p",{children:n})]})};function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(){g=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof b?e:b,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:D(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function b(){}function x(){}function w(){}var S={};u(S,i,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(C([])));j&&j!==r&&n.call(j,i)&&(S=j);var L=w.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==v(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function D(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=k(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(v(e)+" is not iterable")}return x.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=u(w,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(N.prototype),u(N.prototype,l,(function(){return this})),e.AsyncIterator=N,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new N(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},O(L),u(L,c,"Generator"),u(L,i,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function b(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var S=function(){var t=x((0,s.useState)("Ready"),2),e=t[0],r=t[1],n=x((0,s.useState)(""),2),o=n[0],a=n[1],i=(0,f.indexDbStore)(),l=function(){var t,e=(t=g().mark((function t(){var e,n;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e="id_".concat((new Date).getTime()),n={data:o},t.next=5,i.saveData(e,n,f.ObjectStoresEnum.files);case 5:r("Data saved successfully with ID: ".concat(e)),t.next=12;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error saving data:",t.t0),r("Error saving data.");case 12:case"end":return t.stop()}}),t,null,[[0,8]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){b(a,n,o,i,l,"next",t)}function l(t){b(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Save Data to IndexedDB:"}),(0,u.jsx)("input",{type:"text",value:o,onChange:function(t){a(t.target.value)},placeholder:"Enter data to save"}),(0,u.jsx)("button",{onClick:l,children:"Save Data"}),(0,u.jsxs)("p",{children:["Status: ",e]})]})};function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function j(){j=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:D(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var x={};u(x,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(C([])));S&&S!==r&&n.call(S,i)&&(x=S);var L=b.prototype=v.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==E(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function D(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=k(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(E(e)+" is not iterable")}return g.prototype=b,o(L,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(N.prototype),u(N.prototype,l,(function(){return this})),e.AsyncIterator=N,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new N(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},O(L),u(L,c,"Generator"),u(L,i,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function L(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return N(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var D=function(){var t=O((0,s.useState)([]),2),e=t[0],r=t[1],n=O((0,s.useState)("Ready"),2),o=n[0],a=n[1],i=(0,f.indexDbStore)(),l=function(){var t,e=(t=j().mark((function t(){var e;return j().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.getAllKeys(f.ObjectStoresEnum.files);case 3:(e=t.sent)?(r(e),a("Keys loaded successfully.")):a("No keys found."),t.next=11;break;case 7:t.prev=7,t.t0=t.catch(0),console.error("Error loading keys:",t.t0),a("Error loading keys.");case 11:case"end":return t.stop()}}),t,null,[[0,7]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){L(a,n,o,i,l,"next",t)}function l(t){L(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Retrieve All Keys from IndexedDB:"}),(0,u.jsx)("button",{onClick:l,children:"Load Keys"}),(0,u.jsxs)("p",{children:["Status: ",o]}),e.length>0&&(0,u.jsx)("ul",{children:e.map((function(t,e){return(0,u.jsxs)("li",{children:["Key: ",t.toString()]},e)}))})]})};function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function _(){_=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:O(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var x={};u(x,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(C([])));S&&S!==r&&n.call(S,i)&&(x=S);var E=b.prototype=v.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==k(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function O(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=N(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(k(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},j(L.prototype),u(L.prototype,l,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new L(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(E),u(E,c,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function I(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function T(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var P=function(){var t=T((0,s.useState)(""),2),e=t[0],r=t[1],n=T((0,s.useState)(null),2),o=n[0],a=n[1],i=T((0,s.useState)("Ready"),2),l=i[0],c=i[1],h=(0,f.indexDbStore)(),p=function(){var t,r=(t=_().mark((function t(){var r;return _().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,h.getData(e,f.ObjectStoresEnum.files);case 3:(r=t.sent)?(a(r),c("Data retrieved successfully.")):(a(null),c("No data found for the provided ID.")),t.next=11;break;case 7:t.prev=7,t.t0=t.catch(0),console.error("Error retrieving data:",t.t0),c("Error retrieving data.");case 11:case"end":return t.stop()}}),t,null,[[0,7]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){I(a,n,o,i,l,"next",t)}function l(t){I(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return r.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Retrieve Data from IndexedDB by ID:"}),(0,u.jsx)("input",{type:"text",value:e,onChange:function(t){r(t.target.value)},placeholder:"Enter ID to retrieve data"}),(0,u.jsx)("button",{onClick:p,children:"Retrieve Data"}),(0,u.jsxs)("p",{children:["Status: ",l]}),o&&(0,u.jsxs)("div",{children:[(0,u.jsxs)("h3",{children:["Data for ID: ",e]}),(0,u.jsx)("pre",{children:JSON.stringify(o,null,2)})]})]})};function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function G(){G=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),l=new _(n||[]);return o(i,"_invoke",{value:O(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var x={};u(x,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==r&&n.call(S,i)&&(x=S);var E=b.prototype=v.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==A(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function O(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=N(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(A(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},j(L.prototype),u(L.prototype,l,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new L(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(E),u(E,c,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function R(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function F(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var K=function(){var t=F((0,s.useState)(""),2),e=t[0],r=t[1],n=F((0,s.useState)(null),2),o=n[0],a=n[1],i=F((0,s.useState)("Ready"),2),l=i[0],c=i[1],h=(0,f.indexDbStore)(),p=function(){var t,r=(t=G().mark((function t(){var r;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=3;break}return c("Please select a table first."),t.abrupt("return");case 3:return t.prev=3,t.next=6,h.getTableStats(e);case 6:(r=t.sent)?(a(r.size),c("Stats for table '".concat(e,"' loaded successfully."))):(a(null),c("No stats found for table '".concat(e,"'."))),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(3),console.error("Error loading table stats:",t.t0),c("Error loading table stats.");case 14:case"end":return t.stop()}}),t,null,[[3,10]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){R(a,n,o,i,l,"next",t)}function l(t){R(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return r.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Retrieve Table Stats from IndexedDB:"}),(0,u.jsxs)("select",{value:e,onChange:function(t){r(t.target.value)},children:[(0,u.jsx)("option",{value:"",children:"Select a Table"}),Object.values(f.ObjectStoresEnum).map((function(t,e){return(0,u.jsx)("option",{value:t,children:t},e)}))]}),(0,u.jsx)("button",{onClick:p,children:"Load Stats"}),(0,u.jsxs)("p",{children:["Status: ",l]}),null!==o&&(0,u.jsxs)("p",{children:["Size of '",e,"' table: ",o," bytes"]})]})};const B=MdxJsReact,M=TeambitMdxUiMdxScopeContext;var U=["components"];function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Y.apply(this,arguments)}var H={},q="wrapper";function $(t){var e=t.components,r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},a=Object.keys(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,U);return(0,B.mdx)(q,Y({},H,r,{components:e,mdxType:"MDXLayout"}),(0,B.mdx)(M.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,B.mdx)("p",null,(0,B.mdx)("a",{parentName:"p",href:"https://www.npmjs.com/package/@intershare/hooks.indexdb"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/npm/v/@intershare/hooks.indexdb.svg",alt:"npm version"})),"\n",(0,B.mdx)("a",{parentName:"p",href:"https://www.npmjs.com/package/@intershare/hooks.indexdb"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/npm/dm/@intershare/hooks.indexdb.svg",alt:"npm downloads"})),"\n",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/issues"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/github/issues/Interplanetary-Share/ipfs-client-galacfetch",alt:"GitHub issues"})),"\n",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/pulls"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/github/issues-pr/Interplanetary-Share/ipfs-client-galacfetch",alt:"GitHub pull requests"}))),(0,B.mdx)("h1",null,"indexDbStore Library Documentation"),(0,B.mdx)("h2",null,"Overview"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," is a comprehensive library designed to simplify interactions with IndexedDB in a React application. It provides an easy-to-use API for performing common database operations like initializing the database, CRUD operations, and managing data efficiently with an integrated garbage collector."),(0,B.mdx)("h2",null,"Installation"),(0,B.mdx)("p",null,"To install the ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," library, run the following command in your project directory:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-bash"},"npm install @intershare/hooks.indexdb\n")),(0,B.mdx)("p",null,"Or, if you are using ",(0,B.mdx)("inlineCode",{parentName:"p"},"yarn"),":"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-bash"},"yarn add @intershare/hooks.indexdb\n")),(0,B.mdx)("h2",null,"Initialization"),(0,B.mdx)("p",null,"Before using ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore"),", you need to initialize the IndexedDB database. Here's how you can do it:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"import { indexDbStore } from '@intershare/hooks.indexdb'\n\nconst dbStore = indexDbStore()\ndbStore.initIndexedDb('myDatabaseName')\n")),(0,B.mdx)("p",null,"This will create (or open, if it already exists) an IndexedDB database named ",(0,B.mdx)("inlineCode",{parentName:"p"},"'myDatabaseName'"),"."),(0,B.mdx)("h2",null,"Basic Usage"),(0,B.mdx)("h3",null,"Saving Data"),(0,B.mdx)("p",null,"To save data to a specific table:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"const id = 'uniqueId'\nconst data = { key: 'value' }\ndbStore.saveData(id, data, ObjectStoresEnum.files)\n")),(0,B.mdx)("h3",null,"Retrieving Data"),(0,B.mdx)("p",null,"To retrieve data by ID:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"const data = await dbStore.getData('uniqueId', ObjectStoresEnum.files)\n")),(0,B.mdx)("h3",null,"Removing Data"),(0,B.mdx)("p",null,"To remove data by ID:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"await dbStore.removeData('uniqueId', ObjectStoresEnum.files)\n")),(0,B.mdx)("h2",null,"Advanced Features"),(0,B.mdx)("h3",null,"Garbage Collector"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," comes with an integrated garbage collector to manage storage space efficiently. The garbage collector can be configured as follows:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"dbStore.setConfig({\n maxSizeByTable: 1000000, // Max size in bytes\n garbageCollector: {\n enabled: true,\n interval: 60000, // Interval in milliseconds\n strategy: 'lru', // Currently, only 'lru' (Least Recently Used) strategy is implemented\n },\n})\n")),(0,B.mdx)("p",null,"This configuration enables the garbage collector, which will run every 60 seconds and ensure that the size of each table does not exceed 1MB, based on the 'Least Recently Used' strategy."),(0,B.mdx)("h3",null,"Types"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," uses several TypeScript types for better code management and error handling:"),(0,B.mdx)("ul",null,(0,B.mdx)("li",{parentName:"ul"},(0,B.mdx)("inlineCode",{parentName:"li"},"TindexDbStore"),": Main store type."),(0,B.mdx)("li",{parentName:"ul"},(0,B.mdx)("inlineCode",{parentName:"li"},"ObjectStoresEnum"),": Enumeration type for table names."),(0,B.mdx)("li",{parentName:"ul"},(0,B.mdx)("inlineCode",{parentName:"li"},"TConfig"),": Configuration type for the store and garbage collector.")),(0,B.mdx)("h2",null,"Examples"),(0,B.mdx)("h3",null,"Initializing Database"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to initialize the IndexedDB\nimport React from 'react'\nimport { indexDbStore } from '@intershare/hooks.indexdb'\n\nconst DatabaseInitializer: React.FC = () => {\n const dbStore = indexDbStore()\n dbStore.initIndexedDb('myDatabase')\n\n return <div>Database Initialized</div>\n}\n\nexport default DatabaseInitializer\n")),(0,B.mdx)("h3",null,"Saving and Retrieving Data"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to save and retrieve data\nimport React, { useState } from 'react'\nimport { indexDbStore, ObjectStoresEnum } from '@intershare/hooks.indexdb'\n\nconst DataHandler: React.FC = () => {\n const [data, setData] = useState(null)\n const dbStore = indexDbStore()\n\n const saveData = async () => {\n await dbStore.saveData(\n 'myId',\n { sampleData: 'Hello' },\n ObjectStoresEnum.files\n )\n alert('Data Saved')\n }\n\n const loadData = async () => {\n const retrievedData = await dbStore.getData('myId', ObjectStoresEnum.files)\n setData(retrievedData)\n }\n\n return (\n <div>\n <button onClick={saveData}>Save Data</button>\n <button onClick={loadData}>Load Data</button>\n {data && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n )\n}\n\nexport default DataHandler\n")),(0,B.mdx)("h2",null,"Additional Methods in ",(0,B.mdx)("inlineCode",{parentName:"h2"},"indexDbStore")),(0,B.mdx)("h3",null,"Retrieving All Keys"),(0,B.mdx)("p",null,"The ",(0,B.mdx)("inlineCode",{parentName:"p"},"getAllKeys")," method allows you to retrieve all the keys from a specific table in the IndexedDB. This can be useful for scenarios where you need to list or iterate over all entries in a table."),(0,B.mdx)("h4",null,"Usage Example"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to retrieve all keys from a table\nimport React, { useState } from 'react'\nimport { indexDbStore, ObjectStoresEnum } from '@intershare/hooks.indexdb'\n\nconst AllKeysRetriever: React.FC = () => {\n const [keys, setKeys] = useState<IDBValidKey[]>([])\n const dbStore = indexDbStore()\n\n const loadAllKeys = async () => {\n const allKeys = await dbStore.getAllKeys(ObjectStoresEnum.files)\n setKeys(allKeys || [])\n }\n\n return (\n <div>\n <button onClick={loadAllKeys}>Load All Keys</button>\n <ul>\n {keys.map((key, index) => (\n <li key={index}>{key.toString()}</li>\n ))}\n </ul>\n </div>\n )\n}\n\nexport default AllKeysRetriever\n")),(0,B.mdx)("h3",null,"Getting Table Statistics"),(0,B.mdx)("p",null,"The ",(0,B.mdx)("inlineCode",{parentName:"p"},"getTableStats")," method provides statistics for a specified table in the database, such as the total size of the table in bytes. This can be particularly useful for monitoring the database's size and managing storage efficiently."),(0,B.mdx)("h4",null,"Usage Example"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to get stats of a table\nimport React, { useState } from 'react'\nimport { indexDbStore, ObjectStoresEnum } from '@intershare/hooks.indexdb'\n\nconst TableStatsViewer: React.FC = () => {\n const [stats, setStats] = useState<number | null>(null)\n const dbStore = indexDbStore()\n\n const loadStats = async () => {\n const tableStats = await dbStore.getTableStats(ObjectStoresEnum.files)\n setStats(tableStats?.size || null)\n }\n\n return (\n <div>\n <button onClick={loadStats}>Load Table Stats</button>\n {stats !== null && <p>Size of 'files' table: {stats} bytes</p>}\n </div>\n )\n}\n\nexport default TableStatsViewer\n")),(0,B.mdx)("h3",null,"Garbage Collection"),(0,B.mdx)("p",null,"The ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," library includes a garbage collection feature to help manage data storage efficiently. The garbage collector ensures that the size of each table does not exceed a specified limit, removing older entries based on a specified strategy."),(0,B.mdx)("h4",null,"Configuring the Garbage Collector"),(0,B.mdx)("p",null,"You can configure the garbage collector by setting the ",(0,B.mdx)("inlineCode",{parentName:"p"},"maxSizeByTable")," and ",(0,B.mdx)("inlineCode",{parentName:"p"},"garbageCollector")," properties in the configuration. The ",(0,B.mdx)("inlineCode",{parentName:"p"},"garbageCollector")," object includes properties such as ",(0,B.mdx)("inlineCode",{parentName:"p"},"enabled"),", ",(0,B.mdx)("inlineCode",{parentName:"p"},"interval"),", and ",(0,B.mdx)("inlineCode",{parentName:"p"},"strategy"),"."),(0,B.mdx)("h4",null,"Usage Example"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"dbStore.setConfig({\n maxSizeByTable: 500000, // Maximum size in bytes\n garbageCollector: {\n enabled: true,\n interval: 30000, // Interval in milliseconds\n strategy: 'lru', // 'lru' - Least Recently Used\n },\n})\n")),(0,B.mdx)("p",null,"This configuration will enable the garbage collector, which runs every 30 seconds and ensures the size of each table does not exceed 500KB, using the 'Least Recently Used' strategy."),(0,B.mdx)("h2",null,"Contributing to ",(0,B.mdx)("inlineCode",{parentName:"h2"},"indexDbStore")),(0,B.mdx)("p",null,"We welcome contributions to the ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," library! Whether it's improving the code, fixing bugs, or adding new features, your input is valuable. Here's how you can contribute:"),(0,B.mdx)("h3",null,"GitHub Repository"),(0,B.mdx)("p",null,"Our code is hosted on GitHub. Visit our repository to view the source code, fork the project, or submit a pull request:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch"},"ipfs-client-galacfetch on GitHub")),(0,B.mdx)("h3",null,"Submitting Pull Requests"),(0,B.mdx)("p",null,"Have a suggestion or a bug fix? We encourage you to submit a pull request:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/pulls"},"Submit a Pull Request")),(0,B.mdx)("p",null,"Please ensure your code adheres to the project's coding standards and include tests for new functionality."),(0,B.mdx)("h3",null,"Reporting Issues"),(0,B.mdx)("p",null,"Encountered a bug or have a feature request? Open an issue on our GitHub page:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/issues"},"Report an Issue")),(0,B.mdx)("p",null,"Provide as much information as possible, such as steps to reproduce the bug and the expected behavior."),(0,B.mdx)("h3",null,"npm Package"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," is available as an npm package. You can find it here for easy installation and updates:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://www.npmjs.com/package/@intershare/hooks.indexdb"},"indexDbStore on npm")),(0,B.mdx)("h3",null,"Contact"),(0,B.mdx)("p",null,"For direct inquiries or specific concerns, feel free to reach out via email at ",(0,B.mdx)("a",{parentName:"p",href:"mailto:kenneth@interplanetaryshare.com"},"kenneth@interplanetaryshare.com"),".")))}$.isMDXComponent=!0;var V=[n,o,a,i,l],W=[c],X={compositions:[{displayName:"Index db initiator",identifier:"IndexDbInitiator"},{displayName:"Save data example",identifier:"SaveDataExample"},{displayName:"Retrieve keys example",identifier:"RetrieveKeysExample"},{displayName:"Retrieve data example",identifier:"RetrieveDataExample"},{displayName:"Retrieve table stats example",identifier:"RetrieveTableStatsExample"}]}}},t=>(14,t(t.s=14))])));
"use strict";!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["intershare.galacfetch/hooks/indexdb-preview"]=e():t["intershare.galacfetch/hooks/indexdb-preview"]=e()}(self,(()=>(self.webpackChunk=self.webpackChunk||[]).push([[890],{3354:(t,e,r)=>{var n=r(7363),o=Symbol.for("react.element"),a=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,r){var n,c={},u=null,s=null;for(n in void 0!==r&&(u=""+r),void 0!==e.key&&(u=""+e.key),void 0!==e.ref&&(s=e.ref),e)a.call(e,n)&&!l.hasOwnProperty(n)&&(c[n]=e[n]);if(t&&t.defaultProps)for(n in e=t.defaultProps)void 0===c[n]&&(c[n]=e[n]);return{$$typeof:o,type:t,key:u,ref:s,props:c,_owner:i.current}}e.jsx=c,e.jsxs=c},1527:(t,e,r)=>{t.exports=r(3354)},3034:(t,e,r)=>{r.r(e),r.d(e,{compositions:()=>V,compositions_metadata:()=>X,overview:()=>W});var n={};r.r(n),r.d(n,{IndexDbInitiator:()=>m});var o={};r.r(o),r.d(o,{SaveDataExample:()=>S});var a={};r.r(a),r.d(a,{RetrieveKeysExample:()=>D});var i={};r.r(i),r.d(i,{RetrieveDataExample:()=>P});var l={};r.r(l),r.d(l,{RetrieveTableStatsExample:()=>K});var c={};r.r(c),r.d(c,{default:()=>$});var u=r(1527),s=r(7363),f=r(1773);function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function p(){p=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof b?e:b,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:D(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var d="suspendedStart",y="suspendedYield",m="executing",v="completed",g={};function b(){}function x(){}function w(){}var S={};u(S,i,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(C([])));j&&j!==r&&n.call(j,i)&&(S=j);var L=w.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==h(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function D(e,r,n){var o=d;return function(a,i){if(o===m)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=k(l,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=m;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?v:y,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(h(e)+" is not iterable")}return x.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=u(w,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(N.prototype),u(N.prototype,l,(function(){return this})),e.AsyncIterator=N,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new N(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},O(L),u(L,c,"Generator"),u(L,i,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function d(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var m=function(){var t,e,r=(t=(0,s.useState)("Inactive"),e=2,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=r[0],o=r[1],a=(0,f.indexDbStore)();return(0,s.useEffect)((function(){var t=function(){var t,e=(t=p().mark((function t(){return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o("Initializing..."),t.next=5,a.initIndexedDb("myDatabase");case 5:o("Database successfully initialized."),t.next=12;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error initializing the database:",t.t0),o("Error initializing the database.");case 12:case"end":return t.stop()}}),t,null,[[0,8]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){d(a,n,o,i,l,"next",t)}function l(t){d(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();t()}),[]),(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"IndexedDB Initialization Status:"}),(0,u.jsx)("p",{children:n})]})};function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function g(){g=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof b?e:b,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:D(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function b(){}function x(){}function w(){}var S={};u(S,i,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(C([])));j&&j!==r&&n.call(j,i)&&(S=j);var L=w.prototype=b.prototype=Object.create(S);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==v(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function D(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=k(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(v(e)+" is not iterable")}return x.prototype=w,o(L,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=u(w,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(N.prototype),u(N.prototype,l,(function(){return this})),e.AsyncIterator=N,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new N(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},O(L),u(L,c,"Generator"),u(L,i,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function b(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function x(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var S=function(){var t=x((0,s.useState)("Ready"),2),e=t[0],r=t[1],n=x((0,s.useState)(""),2),o=n[0],a=n[1],i=(0,f.indexDbStore)(),l=function(){var t,e=(t=g().mark((function t(){var e,n;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e="id_".concat((new Date).getTime()),n={data:o},t.next=5,i.saveData(e,n,f.ObjectStoresEnum.files);case 5:r("Data saved successfully with ID: ".concat(e)),t.next=12;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Error saving data:",t.t0),r("Error saving data.");case 12:case"end":return t.stop()}}),t,null,[[0,8]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){b(a,n,o,i,l,"next",t)}function l(t){b(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Save Data to IndexedDB:"}),(0,u.jsx)("input",{type:"text",value:o,onChange:function(t){a(t.target.value)},placeholder:"Enter data to save"}),(0,u.jsx)("button",{onClick:l,children:"Save Data"}),(0,u.jsxs)("p",{children:["Status: ",e]})]})};function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function j(){j=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:D(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var x={};u(x,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(C([])));S&&S!==r&&n.call(S,i)&&(x=S);var L=b.prototype=v.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function N(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==E(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function D(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=k(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(E(e)+" is not iterable")}return g.prototype=b,o(L,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(N.prototype),u(N.prototype,l,(function(){return this})),e.AsyncIterator=N,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new N(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},O(L),u(L,c,"Generator"),u(L,i,(function(){return this})),u(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function L(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return N(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var D=function(){var t=O((0,s.useState)([]),2),e=t[0],r=t[1],n=O((0,s.useState)("Ready"),2),o=n[0],a=n[1],i=(0,f.indexDbStore)(),l=function(){var t,e=(t=j().mark((function t(){var e;return j().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.getAllKeys(f.ObjectStoresEnum.files);case 3:(e=t.sent)?(r(e),a("Keys loaded successfully.")):a("No keys found."),t.next=11;break;case 7:t.prev=7,t.t0=t.catch(0),console.error("Error loading keys:",t.t0),a("Error loading keys.");case 11:case"end":return t.stop()}}),t,null,[[0,7]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){L(a,n,o,i,l,"next",t)}function l(t){L(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return e.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Retrieve All Keys from IndexedDB:"}),(0,u.jsx)("button",{onClick:l,children:"Load Keys"}),(0,u.jsxs)("p",{children:["Status: ",o]}),e.length>0&&(0,u.jsx)("ul",{children:e.map((function(t,e){return(0,u.jsxs)("li",{children:["Key: ",t.toString()]},e)}))})]})};function k(t){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function _(){_=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),l=new T(n||[]);return o(i,"_invoke",{value:O(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var x={};u(x,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(C([])));S&&S!==r&&n.call(S,i)&&(x=S);var E=b.prototype=v.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==k(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function O(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=N(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(k(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},j(L.prototype),u(L.prototype,l,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new L(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(E),u(E,c,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function I(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function T(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var P=function(){var t=T((0,s.useState)(""),2),e=t[0],r=t[1],n=T((0,s.useState)(null),2),o=n[0],a=n[1],i=T((0,s.useState)("Ready"),2),l=i[0],c=i[1],h=(0,f.indexDbStore)(),p=function(){var t,r=(t=_().mark((function t(){var r;return _().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,h.getData(e,f.ObjectStoresEnum.files);case 3:(r=t.sent)?(a(r),c("Data retrieved successfully.")):(a(null),c("No data found for the provided ID.")),t.next=11;break;case 7:t.prev=7,t.t0=t.catch(0),console.error("Error retrieving data:",t.t0),c("Error retrieving data.");case 11:case"end":return t.stop()}}),t,null,[[0,7]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){I(a,n,o,i,l,"next",t)}function l(t){I(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return r.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Retrieve Data from IndexedDB by ID:"}),(0,u.jsx)("input",{type:"text",value:e,onChange:function(t){r(t.target.value)},placeholder:"Enter ID to retrieve data"}),(0,u.jsx)("button",{onClick:p,children:"Retrieve Data"}),(0,u.jsxs)("p",{children:["Status: ",l]}),o&&(0,u.jsxs)("div",{children:[(0,u.jsxs)("h3",{children:["Data for ID: ",e]}),(0,u.jsx)("pre",{children:JSON.stringify(o,null,2)})]})]})};function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function G(){G=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",l=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,i=Object.create(a.prototype),l=new _(n||[]);return o(i,"_invoke",{value:O(t,r,l)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",p="suspendedYield",d="executing",y="completed",m={};function v(){}function g(){}function b(){}var x={};u(x,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==r&&n.call(S,i)&&(x=S);var E=b.prototype=v.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,a,i,l){var c=f(t[o],t,a);if("throw"!==c.type){var u=c.arg,s=u.value;return s&&"object"==A(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,l)}),(function(t){r("throw",t,i,l)})):e.resolve(s).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,l)}))}l(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function O(e,r,n){var o=h;return function(a,i){if(o===d)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var l=n.delegate;if(l){var c=N(l,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?y:p,u.arg===m)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=y,n.method="throw",n.arg=u.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=f(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(A(e)+" is not iterable")}return g.prototype=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=u(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,u(t,c,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},j(L.prototype),u(L.prototype,l,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new L(s(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(E),u(E,c,"Generator"),u(E,i,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return l.type="throw",l.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],l=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function R(t,e,r,n,o,a,i){try{var l=t[a](i),c=l.value}catch(t){return void r(t)}l.done?e(c):Promise.resolve(c).then(n,o)}function F(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],c=!0,u=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(t){u=!0,o=t}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var K=function(){var t=F((0,s.useState)(""),2),e=t[0],r=t[1],n=F((0,s.useState)(null),2),o=n[0],a=n[1],i=F((0,s.useState)("Ready"),2),l=i[0],c=i[1],h=(0,f.indexDbStore)(),p=function(){var t,r=(t=G().mark((function t(){var r;return G().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=3;break}return c("Please select a table first."),t.abrupt("return");case 3:return t.prev=3,t.next=6,h.getTableStats(e);case 6:(r=t.sent)?(a(r.size),c("Stats for table '".concat(e,"' loaded successfully."))):(a(null),c("No stats found for table '".concat(e,"'."))),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(3),console.error("Error loading table stats:",t.t0),c("Error loading table stats.");case 14:case"end":return t.stop()}}),t,null,[[3,10]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){R(a,n,o,i,l,"next",t)}function l(t){R(a,n,o,i,l,"throw",t)}i(void 0)}))});return function(){return r.apply(this,arguments)}}();return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{children:"Retrieve Table Stats from IndexedDB:"}),(0,u.jsxs)("select",{value:e,onChange:function(t){r(t.target.value)},children:[(0,u.jsx)("option",{value:"",children:"Select a Table"}),Object.values(f.ObjectStoresEnum).map((function(t,e){return(0,u.jsx)("option",{value:t,children:t},e)}))]}),(0,u.jsx)("button",{onClick:p,children:"Load Stats"}),(0,u.jsxs)("p",{children:["Status: ",l]}),null!==o&&(0,u.jsxs)("p",{children:["Size of '",e,"' table: ",o," bytes"]})]})};const B=MdxJsReact,M=TeambitMdxUiMdxScopeContext;var U=["components"];function Y(){return Y=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Y.apply(this,arguments)}var H={},q="wrapper";function $(t){var e=t.components,r=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},a=Object.keys(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,U);return(0,B.mdx)(q,Y({},H,r,{components:e,mdxType:"MDXLayout"}),(0,B.mdx)(M.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"},(0,B.mdx)("p",null,(0,B.mdx)("a",{parentName:"p",href:"https://www.npmjs.com/package/@intershare/hooks.indexdb"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/npm/v/@intershare/hooks.indexdb.svg",alt:"npm version"})),"\n",(0,B.mdx)("a",{parentName:"p",href:"https://www.npmjs.com/package/@intershare/hooks.indexdb"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/npm/dm/@intershare/hooks.indexdb.svg",alt:"npm downloads"})),"\n",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/issues"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/github/issues/Interplanetary-Share/ipfs-client-galacfetch",alt:"GitHub issues"})),"\n",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/pulls"},(0,B.mdx)("img",{parentName:"a",src:"https://img.shields.io/github/issues-pr/Interplanetary-Share/ipfs-client-galacfetch",alt:"GitHub pull requests"}))),(0,B.mdx)("h1",null,"indexDbStore Library Documentation"),(0,B.mdx)("h2",null,"Overview"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," is a comprehensive library designed to simplify interactions with IndexedDB in a React application. It provides an easy-to-use API for performing common database operations like initializing the database, CRUD operations, and managing data efficiently with an integrated garbage collector."),(0,B.mdx)("h2",null,"Installation"),(0,B.mdx)("p",null,"To install the ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," library, run the following command in your project directory:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-bash"},"npm install @intershare/hooks.indexdb\n")),(0,B.mdx)("p",null,"Or, if you are using ",(0,B.mdx)("inlineCode",{parentName:"p"},"yarn"),":"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-bash"},"yarn add @intershare/hooks.indexdb\n")),(0,B.mdx)("h2",null,"Initialization"),(0,B.mdx)("p",null,"Before using ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore"),", you need to initialize the IndexedDB database. Here's how you can do it:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"import { indexDbStore } from '@intershare/hooks.indexdb'\n\nconst dbStore = indexDbStore()\ndbStore.initIndexedDb('myDatabaseName')\n")),(0,B.mdx)("p",null,"This will create (or open, if it already exists) an IndexedDB database named ",(0,B.mdx)("inlineCode",{parentName:"p"},"'myDatabaseName'"),"."),(0,B.mdx)("h2",null,"Basic Usage"),(0,B.mdx)("h3",null,"Saving Data"),(0,B.mdx)("p",null,"To save data to a specific table:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"const id = 'uniqueId'\nconst data = { key: 'value' }\ndbStore.saveData(id, data, ObjectStoresEnum.files)\n")),(0,B.mdx)("h3",null,"Retrieving Data"),(0,B.mdx)("p",null,"To retrieve data by ID:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"const data = await dbStore.getData('uniqueId', ObjectStoresEnum.files)\n")),(0,B.mdx)("h3",null,"Removing Data"),(0,B.mdx)("p",null,"To remove data by ID:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"await dbStore.removeData('uniqueId', ObjectStoresEnum.files)\n")),(0,B.mdx)("h2",null,"Advanced Features"),(0,B.mdx)("h3",null,"Garbage Collector"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," comes with an integrated garbage collector to manage storage space efficiently. The garbage collector can be configured as follows:"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"dbStore.setConfig({\n maxSizeByTable: 1000000, // Max size in bytes\n garbageCollector: {\n enabled: true,\n interval: 60000, // Interval in milliseconds\n strategy: 'lru', // Currently, only 'lru' (Least Recently Used) strategy is implemented\n },\n})\n")),(0,B.mdx)("p",null,"This configuration enables the garbage collector, which will run every 60 seconds and ensure that the size of each table does not exceed 1MB, based on the 'Least Recently Used' strategy."),(0,B.mdx)("h3",null,"Types"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," uses several TypeScript types for better code management and error handling:"),(0,B.mdx)("ul",null,(0,B.mdx)("li",{parentName:"ul"},(0,B.mdx)("inlineCode",{parentName:"li"},"TindexDbStore"),": Main store type."),(0,B.mdx)("li",{parentName:"ul"},(0,B.mdx)("inlineCode",{parentName:"li"},"ObjectStoresEnum"),": Enumeration type for table names."),(0,B.mdx)("li",{parentName:"ul"},(0,B.mdx)("inlineCode",{parentName:"li"},"TConfig"),": Configuration type for the store and garbage collector.")),(0,B.mdx)("h2",null,"Examples"),(0,B.mdx)("h3",null,"Initializing Database"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to initialize the IndexedDB\nimport React from 'react'\nimport { indexDbStore } from '@intershare/hooks.indexdb'\n\nconst DatabaseInitializer: React.FC = () => {\n const dbStore = indexDbStore()\n dbStore.initIndexedDb('myDatabase')\n\n return <div>Database Initialized</div>\n}\n\nexport default DatabaseInitializer\n")),(0,B.mdx)("h3",null,"Saving and Retrieving Data"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to save and retrieve data\nimport React, { useState } from 'react'\nimport { indexDbStore, ObjectStoresEnum } from '@intershare/hooks.indexdb'\n\nconst DataHandler: React.FC = () => {\n const [data, setData] = useState(null)\n const dbStore = indexDbStore()\n\n const saveData = async () => {\n await dbStore.saveData(\n 'myId',\n { sampleData: 'Hello' },\n ObjectStoresEnum.files\n )\n alert('Data Saved')\n }\n\n const loadData = async () => {\n const retrievedData = await dbStore.getData('myId', ObjectStoresEnum.files)\n setData(retrievedData)\n }\n\n return (\n <div>\n <button onClick={saveData}>Save Data</button>\n <button onClick={loadData}>Load Data</button>\n {data && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n )\n}\n\nexport default DataHandler\n")),(0,B.mdx)("h2",null,"Additional Methods in ",(0,B.mdx)("inlineCode",{parentName:"h2"},"indexDbStore")),(0,B.mdx)("h3",null,"Retrieving All Keys"),(0,B.mdx)("p",null,"The ",(0,B.mdx)("inlineCode",{parentName:"p"},"getAllKeys")," method allows you to retrieve all the keys from a specific table in the IndexedDB. This can be useful for scenarios where you need to list or iterate over all entries in a table."),(0,B.mdx)("h4",null,"Usage Example"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to retrieve all keys from a table\nimport React, { useState } from 'react'\nimport { indexDbStore, ObjectStoresEnum } from '@intershare/hooks.indexdb'\n\nconst AllKeysRetriever: React.FC = () => {\n const [keys, setKeys] = useState<IDBValidKey[]>([])\n const dbStore = indexDbStore()\n\n const loadAllKeys = async () => {\n const allKeys = await dbStore.getAllKeys(ObjectStoresEnum.files)\n setKeys(allKeys || [])\n }\n\n return (\n <div>\n <button onClick={loadAllKeys}>Load All Keys</button>\n <ul>\n {keys.map((key, index) => (\n <li key={index}>{key.toString()}</li>\n ))}\n </ul>\n </div>\n )\n}\n\nexport default AllKeysRetriever\n")),(0,B.mdx)("h3",null,"Getting Table Statistics"),(0,B.mdx)("p",null,"The ",(0,B.mdx)("inlineCode",{parentName:"p"},"getTableStats")," method provides statistics for a specified table in the database, such as the total size of the table in bytes. This can be particularly useful for monitoring the database's size and managing storage efficiently."),(0,B.mdx)("h4",null,"Usage Example"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"// Example component to get stats of a table\nimport React, { useState } from 'react'\nimport { indexDbStore, ObjectStoresEnum } from '@intershare/hooks.indexdb'\n\nconst TableStatsViewer: React.FC = () => {\n const [stats, setStats] = useState<number | null>(null)\n const dbStore = indexDbStore()\n\n const loadStats = async () => {\n const tableStats = await dbStore.getTableStats(ObjectStoresEnum.files)\n setStats(tableStats?.size || null)\n }\n\n return (\n <div>\n <button onClick={loadStats}>Load Table Stats</button>\n {stats !== null && <p>Size of 'files' table: {stats} bytes</p>}\n </div>\n )\n}\n\nexport default TableStatsViewer\n")),(0,B.mdx)("h3",null,"Garbage Collection"),(0,B.mdx)("p",null,"The ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," library includes a garbage collection feature to help manage data storage efficiently. The garbage collector ensures that the size of each table does not exceed a specified limit, removing older entries based on a specified strategy."),(0,B.mdx)("h4",null,"Configuring the Garbage Collector"),(0,B.mdx)("p",null,"You can configure the garbage collector by setting the ",(0,B.mdx)("inlineCode",{parentName:"p"},"maxSizeByTable")," and ",(0,B.mdx)("inlineCode",{parentName:"p"},"garbageCollector")," properties in the configuration. The ",(0,B.mdx)("inlineCode",{parentName:"p"},"garbageCollector")," object includes properties such as ",(0,B.mdx)("inlineCode",{parentName:"p"},"enabled"),", ",(0,B.mdx)("inlineCode",{parentName:"p"},"interval"),", and ",(0,B.mdx)("inlineCode",{parentName:"p"},"strategy"),"."),(0,B.mdx)("h4",null,"Usage Example"),(0,B.mdx)("pre",null,(0,B.mdx)("code",{parentName:"pre",className:"language-tsx"},"dbStore.setConfig({\n maxSizeByTable: 500000, // Maximum size in bytes\n garbageCollector: {\n enabled: true,\n interval: 30000, // Interval in milliseconds\n strategy: 'lru', // 'lru' - Least Recently Used\n },\n})\n")),(0,B.mdx)("p",null,"This configuration will enable the garbage collector, which runs every 30 seconds and ensures the size of each table does not exceed 500KB, using the 'Least Recently Used' strategy."),(0,B.mdx)("h2",null,"Contributing to ",(0,B.mdx)("inlineCode",{parentName:"h2"},"indexDbStore")),(0,B.mdx)("p",null,"We welcome contributions to the ",(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," library! Whether it's improving the code, fixing bugs, or adding new features, your input is valuable. Here's how you can contribute:"),(0,B.mdx)("h3",null,"GitHub Repository"),(0,B.mdx)("p",null,"Our code is hosted on GitHub. Visit our repository to view the source code, fork the project, or submit a pull request:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch"},"ipfs-client-galacfetch on GitHub")),(0,B.mdx)("h3",null,"Submitting Pull Requests"),(0,B.mdx)("p",null,"Have a suggestion or a bug fix? We encourage you to submit a pull request:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/pulls"},"Submit a Pull Request")),(0,B.mdx)("p",null,"Please ensure your code adheres to the project's coding standards and include tests for new functionality."),(0,B.mdx)("h3",null,"Reporting Issues"),(0,B.mdx)("p",null,"Encountered a bug or have a feature request? Open an issue on our GitHub page:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://github.com/Interplanetary-Share/ipfs-client-galacfetch/issues"},"Report an Issue")),(0,B.mdx)("p",null,"Provide as much information as possible, such as steps to reproduce the bug and the expected behavior."),(0,B.mdx)("h3",null,"npm Package"),(0,B.mdx)("p",null,(0,B.mdx)("inlineCode",{parentName:"p"},"indexDbStore")," is available as an npm package. You can find it here for easy installation and updates:"),(0,B.mdx)("p",null,"🔗 ",(0,B.mdx)("a",{parentName:"p",href:"https://www.npmjs.com/package/@intershare/hooks.indexdb"},"indexDbStore on npm")),(0,B.mdx)("h3",null,"Contact"),(0,B.mdx)("p",null,"For direct inquiries or specific concerns, feel free to reach out via email at ",(0,B.mdx)("a",{parentName:"p",href:"mailto:kenneth@interplanetaryshare.com"},"kenneth@interplanetaryshare.com"),".")))}$.isMDXComponent=!0;var V=[n,o,a,i,l],W=[c],X={compositions:[{displayName:"Index db initiator",identifier:"IndexDbInitiator"},{displayName:"Save data example",identifier:"SaveDataExample"},{displayName:"Retrieve keys example",identifier:"RetrieveKeysExample"},{displayName:"Retrieve data example",identifier:"RetrieveDataExample"},{displayName:"Retrieve table stats example",identifier:"RetrieveTableStatsExample"}]}}},t=>(3034,t(t.s=3034))])));

@@ -991,5 +991,5 @@ {

"name": "hooks/indexdb",
"version": "0.0.24"
"version": "0.0.25"
},
"taggedModuleExports": []
}
{
"name": "@intershare/hooks.indexdb",
"version": "0.0.24",
"version": "0.0.25",
"homepage": "https://bit.cloud/intershare/galacfetch/hooks/indexdb",

@@ -9,7 +9,7 @@ "main": "dist/index.js",

"name": "hooks/indexdb",
"version": "0.0.24"
"version": "0.0.25"
},
"dependencies": {
"zustand": "^4.4.7",
"@intershare/utils.general": "0.0.19"
"@intershare/utils.general": "0.0.20"
},

@@ -20,3 +20,3 @@ "devDependencies": {

"@types/testing-library__jest-dom": "^5.9.5",
"@intershare/envs.intershare-react-env": "0.0.14"
"@intershare/envs.intershare-react-env": "0.0.15"
},

@@ -26,4 +26,4 @@ "peerDependencies": {

"fake-indexeddb": "^5.0.1",
"react": "^17.0.0 || ^18.3.0",
"@types/react": "^17.0.0 || ^18.3.0"
"react": ">=17.0.0",
"@types/react": ">=17.0.0"
},

@@ -30,0 +30,0 @@ "license": "GPL-3.0-or-later",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc