"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const utils = require("./utils.js");
const setLocalStorage = (k, v) => {
  try {
    window.localStorage.setItem(k, utils.JSONStringify(v));
  } catch (error) {
    return false;
  }
};
const getLocalStorage = (k) => {
  const item = window.localStorage.getItem(k);
  try {
    return item ? utils.JSONParse(item) : item;
  } catch (err) {
    return item;
  }
};
const clearLocalStorage = (name) => {
  window.localStorage.removeItem(name);
};
const setSessionStorage = (k, v) => {
  try {
    window.sessionStorage.setItem(k, utils.JSONStringify(v));
  } catch (error) {
    return false;
  }
};
const getSessionStorage = (k) => {
  const item = window.sessionStorage.getItem(k);
  try {
    return item ? utils.JSONParse(item) : item;
  } catch (err) {
    return item;
  }
};
exports.clearLocalStorage = clearLocalStorage;
exports.getLocalStorage = getLocalStorage;
exports.getSessionStorage = getSessionStorage;
exports.setLocalStorage = setLocalStorage;
exports.setSessionStorage = setSessionStorage;
