import { useMemo, useState } from "react";
export function useRuntimePermissions(initial) {
    const [permissions, setPermissions] = useState(initial);
    return useMemo(() => ({
        permissions,
        setShell(value) {
            setPermissions((previous) => ({ ...previous, allowShell: value, profile: "custom" }));
        },
        setBrowser(value) {
            setPermissions((previous) => ({ ...previous, allowBrowser: value, profile: "custom" }));
        },
        toggleShell() {
            setPermissions((previous) => ({ ...previous, allowShell: !previous.allowShell, profile: "custom" }));
        },
        toggleBrowser() {
            setPermissions((previous) => ({ ...previous, allowBrowser: !previous.allowBrowser, profile: "custom" }));
        },
    }), [permissions]);
}
