(() => {
    const ns = window.MiracleBatchStorage = window.MiracleBatchStorage || {};

    ns.get = key => {
        if (typeof key !== "string" || key.length === 0) {
            return null;
        }

        try {
            return window.localStorage.getItem(key);
        } catch {
            return null;
        }
    };

    ns.set = (key, value) => {
        if (typeof key !== "string" || key.length === 0) {
            return;
        }

        try {
            window.localStorage.setItem(key, value ?? "");
        } catch {
        }
    };

    ns.remove = key => {
        if (typeof key !== "string" || key.length === 0) {
            return;
        }

        try {
            window.localStorage.removeItem(key);
        } catch {
        }
    };
})();
