import { SSRHelper as S } from "./accelbyte-widgets242.mjs";
var o = /* @__PURE__ */ ((t) => (t.USER = "USER", t.ACCESS_TOKEN = "ACCESS_TOKEN", t.REFRESH_TOKEN = "REFRESH_TOKEN", t.SETTINGS = "SETTINGS", t.IS_WINDOW_MAXIMIZED = "IS_WINDOW_MAXIMIZED", t.FEATURE_FLAGS = "FEATURE_FLAGS", t.APP_CONFIG = "APP_CONFIG", t.DOWNLOAD_STATE = "DOWNLOAD_STATE", t.LAST_VISITED_GAME = "LAST_VISITED_GAME", t.LAST_VISITED_PAGE = "LAST_VISITED_PAGE", t.IS_LAUNCHER_UPDATE_CHECKED = "IS_LAUNCHER_UPDATE_CHECKED", t))(o || {});
class s {
  clear() {
    S.isSSR() || localStorage.clear();
  }
  delete(e) {
    S.isSSR() || localStorage.removeItem(e);
  }
  get(e) {
    if (S.isSSR())
      return;
    const r = localStorage.getItem(e);
    try {
      return JSON.parse(r);
    } catch (E) {
      return console.warn(`WebDB.get: Error ${E.message}. Falling back to ${r}.`), r;
    }
  }
  set(e, r) {
    S.isSSR() || localStorage.setItem(e, JSON.stringify(r));
  }
  getUser() {
    return null;
  }
  getAccessToken() {
    return null;
  }
  getRefreshToken() {
    return null;
  }
  getDownloadState(e) {
    return null;
  }
  getLastVisitedGame() {
    return null;
  }
  getLastVisitedPage() {
    return null;
  }
  getIsLauncherUpdateChecked() {
    return null;
  }
}
class g {
  constructor(e) {
    this.desktopStorage = e;
  }
  clear() {
    this.desktopStorage.clear();
  }
  delete(e) {
    this.desktopStorage.remove(e);
  }
  get(e) {
    return this.desktopStorage.get(e);
  }
  set(e, r) {
    this.desktopStorage.set(e, r);
  }
  getUser() {
    return this.desktopStorage.get("USER");
  }
  getAccessToken() {
    return this.desktopStorage.get("ACCESS_TOKEN");
  }
  getRefreshToken() {
    return this.desktopStorage.get("REFRESH_TOKEN");
  }
  getDownloadState(e) {
    var r;
    return (r = this.desktopStorage.get("DOWNLOAD_STATE")) == null ? void 0 : r.find((E) => E.appId === e);
  }
  getLastVisitedGame() {
    return this.desktopStorage.get("LAST_VISITED_GAME");
  }
  getLastVisitedPage() {
    return this.desktopStorage.get("LAST_VISITED_PAGE");
  }
  getIsLauncherUpdateChecked() {
    return !!this.desktopStorage.get("IS_LAUNCHER_UPDATE_CHECKED");
  }
}
export {
  o as DBKeys,
  g as DesktopDB,
  s as WebDB
};
