const storageKey = 'playSettings';
export const defaultSettings = {
    openConsole: false,
    remoteRuntimeOrigin: 'http://localhost:7788',
    runtimeDebugLogging: false,
    sandboxApp: false,
    useExperimentalBlocks: false,
    useLocalRuntime: true,
    useRemoteRuntime: false,
    useUIRequest: false,
    version: 1
};
export function loadSettings(storage) {
    return settingsFromJSON(storage.getItem(storageKey) ?? '');
}
export function saveSettings(storage, settings) {
    storage.setItem(storageKey, JSON.stringify(settings));
}
function settingsFromJSON(json) {
    let settings;
    try {
        settings = JSON.parse(json);
    }
    catch {
        return;
    }
    if (!settings || settings.version !== 1)
        return;
    return settings; // Assume LocalStorage is valid.
}
//# sourceMappingURL=settings-save.js.map