const i="vibefilter-kv";function s(){return new Promise((n,o)=>{const e=indexedDB.open(i,1);e.onupgradeneeded=()=>{e.result.objectStoreNames.contains("kv")||e.result.createObjectStore("kv")},e.onsuccess=()=>n(e.result),e.onerror=()=>o(e.error)})}async function a(n){const o=await s();return new Promise((e,c)=>{const t=o.transaction("kv","readonly"),r=t.objectStore("kv").get(n);r.onsuccess=()=>e(r.result),r.onerror=()=>c(r.error),t.oncomplete=()=>o.close()})}async function S(n,o){const e=await s();return new Promise((c,t)=>{const r=e.transaction("kv","readwrite");r.objectStore("kv").put(o,n),r.oncomplete=()=>{e.close(),c()},r.onerror=()=>{e.close(),t(r.error)}})}async function l(n){const o=await s();return new Promise((e,c)=>{const t=o.transaction("kv","readwrite");t.objectStore("kv").delete(n),t.oncomplete=()=>{o.close(),e()},t.onerror=()=>{o.close(),c(t.error)}})}export{l as idbDelete,a as idbGet,S as idbSet};
