"use strict";var m=Object.create;var a=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var f=Object.getPrototypeOf;var h=Object.prototype.hasOwnProperty;var l=(t,e)=>a(t,"name",{value:e,configurable:true});var y=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:true})};var g=(t,e,r,i)=>{if(e&&typeof e==="object"||typeof e==="function"){for(let s of S(e))if(!h.call(t,s)&&s!==r)a(t,s,{get:()=>e[s],enumerable:!(i=A(e,s))||i.enumerable})}return t};var v=(t,e,r)=>(r=t!=null?m(f(t)):{},g(e||!t||!t.__esModule?a(r,"default",{value:t,enumerable:true}):r,t));var x=t=>g(a({},"__esModule",{value:true}),t);var b={};y(b,{default:()=>p});module.exports=x(b);var n=require("electron");var d=v(require("fast-folder-size"));var u=require("../../helpers/service-helpers");const o=require("../../preload-safe-debug")("Ferdium:LocalApi");class p{getAppSettings(e){return new Promise(r=>{n.ipcRenderer.once("appSettings",(i,s)=>{o("LocalApi::getAppSettings resolves",s.type,s.data);r(s)});n.ipcRenderer.send("getAppSettings",e)})}async updateAppSettings(e,r){o("LocalApi::updateAppSettings resolves",e,r);n.ipcRenderer.send("updateAppSettings",{type:e,data:r})}async getAppCacheSize(){const e=(0,u.getServicePartitionsDirectory)();return new Promise((r,i)=>{(0,d.default)(e,(s,c)=>{if(s){i(s)}o("LocalApi::getAppCacheSize resolves",c);r(c)})})}async clearCache(e=null){const r={storages:["appcache","filesystem","indexdb","shadercache","websql","serviceworkers","cachestorage"],quotas:["temporary","persistent","syncable"]};n.ipcRenderer.send("clear-storage-data",{serviceId:e,targetsToClear:r});return n.ipcRenderer.invoke("clear-cache",{serviceId:e})}}l(p,"LocalApi");
