import{c as a}from"./chunk-66JIRD73.js";import{i as t}from"./chunk-OYAVQN5W.js";var l=class extends a{constructor(){super(...arguments),this.group="CapacitorStorage"}configure(s){return t(this,arguments,function*({group:e}){typeof e=="string"&&(this.group=e)})}get(e){return t(this,null,function*(){return{value:this.impl.getItem(this.applyPrefix(e.key))}})}set(e){return t(this,null,function*(){this.impl.setItem(this.applyPrefix(e.key),e.value)})}remove(e){return t(this,null,function*(){this.impl.removeItem(this.applyPrefix(e.key))})}keys(){return t(this,null,function*(){return{keys:this.rawKeys().map(s=>s.substring(this.prefix.length))}})}clear(){return t(this,null,function*(){for(let e of this.rawKeys())this.impl.removeItem(e)})}migrate(){return t(this,null,function*(){var e;let s=[],i=[],o="_cap_",p=Object.keys(this.impl).filter(r=>r.indexOf(o)===0);for(let r of p){let n=r.substring(o.length),c=(e=this.impl.getItem(r))!==null&&e!==void 0?e:"",{value:y}=yield this.get({key:n});typeof y=="string"?i.push(n):(yield this.set({key:n,value:c}),s.push(n))}return{migrated:s,existing:i}})}removeOld(){return t(this,null,function*(){let e="_cap_",s=Object.keys(this.impl).filter(i=>i.indexOf(e)===0);for(let i of s)this.impl.removeItem(i)})}get impl(){return window.localStorage}get prefix(){return this.group==="NativeStorage"?"":`${this.group}.`}rawKeys(){return Object.keys(this.impl).filter(e=>e.indexOf(this.prefix)===0)}applyPrefix(e){return this.prefix+e}};export{l as PreferencesWeb};
