function isLocalStorageAvailable() {
    try {
        const testKey = '__storage_test__';
        localStorage.setItem(testKey, testKey);
        localStorage.removeItem(testKey);
        return true;
    }
    catch (error) {
        return false;
    }
}

class LocalStorageService {
    available;
    constructor() {
        this.available = isLocalStorageAvailable();
    }
    get(key) {
        if (!this.available)
            return null;
        try {
            const item = localStorage.getItem(key);
            return item ? JSON.parse(item) : null;
        }
        catch (error) {
            console.warn(`Error getting item ${key} from localStorage:`, error);
            return null;
        }
    }
    set(key, value) {
        if (!this.available)
            return;
        try {
            localStorage.setItem(key, JSON.stringify(value));
        }
        catch (error) {
            console.warn(`Error setting item ${key} in localStorage:`, error);
        }
    }
    remove(key) {
        if (!this.available)
            return;
        try {
            localStorage.removeItem(key);
        }
        catch (error) {
            console.warn(`Error removing item ${key} from localStorage:`, error);
        }
    }
    clear() {
        if (!this.available)
            return;
        try {
            localStorage.clear();
        }
        catch (error) {
            console.warn('Error clearing localStorage:', error);
        }
    }
}

export { LocalStorageService as L };

//# sourceMappingURL=LocalStorageService-78b1794d.js.map