function resolveStorage(storageType) {
    if ('string' == typeof storageType) switch(storageType){
        case 'localStorage':
            return localStorage;
        case 'sessionStorage':
            return sessionStorage;
        default:
            throw new Error(`Unsupported storage type: ${storageType}`);
    }
    return storageType;
}
function getStoredValue(key, storageType = 'localStorage', prefix = 'ui') {
    const storage = resolveStorage(storageType);
    const prefixedKey = `${prefix}-${key}`;
    try {
        const storedValue = storage?.getItem(prefixedKey);
        return storedValue ? JSON.parse(storedValue) : void 0;
    } catch (error) {
        console.warn(`Failed to parse stored value for key "${prefixedKey}":`, error);
        return;
    }
}
function setStoredValue(key, value, storageType = 'localStorage', prefix = 'ui') {
    const storage = resolveStorage(storageType);
    const prefixedKey = `${prefix}-${key}`;
    try {
        storage?.setItem(prefixedKey, JSON.stringify(value));
    } catch (error) {
        console.error(`Failed to store value for key "${prefixedKey}":`, error);
    }
}
export { getStoredValue, setStoredValue };
