import { CLIENT_LS_KEYS, safeLocalStorage } from "@scalar/helpers/object/local-storage";
//#region src/views/Request/RequestSection/helpers/update-scheme.ts
/** Update the security scheme with side effects */
var updateScheme = (uid, path, value, { securitySchemeMutators, securitySchemes }, persistAuth = false) => {
	securitySchemeMutators.edit(uid, path, value);
	if (!persistAuth) return;
	try {
		const auth = JSON.parse(safeLocalStorage().getItem(CLIENT_LS_KEYS.AUTH) ?? "{}");
		const scheme = securitySchemes[uid];
		if (auth && scheme?.nameKey) {
			const nameScheme = auth[scheme.nameKey] ||= {};
			nameScheme[path] = value;
			safeLocalStorage().setItem(CLIENT_LS_KEYS.AUTH, JSON.stringify(auth));
		}
	} catch (e) {
		console.error(e);
	}
};
//#endregion
export { updateScheme };

//# sourceMappingURL=update-scheme.js.map