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