export const normalizeKey = (code: string): string => {
    // Remove 'Key' prefix from letter keys
    if (code.startsWith("Key")) {
        return code.slice(3);
    }
    // Remove 'Digit' prefix from number keys
    if (code.startsWith("Digit")) {
        return code.slice(5);
    }
    // Handle special keys
    const specialKeys: Record<string, string> = {
        ControlLeft: "Control",
        ControlRight: "Control",
        ShiftLeft: "Shift",
        ShiftRight: "Shift",
        AltLeft: "Alt",
        AltRight: "Alt",
        MetaLeft: "Command",
        MetaRight: "Command",
        ArrowLeft: "ArrowLeft",
        ArrowRight: "ArrowRight",
        ArrowUp: "ArrowUp",
        ArrowDown: "ArrowDown",
        Enter: "Enter",
        Space: "Space",
        Escape: "Escape",
        Backspace: "Backspace",
        Delete: "Delete",
        Tab: "Tab",
        CapsLock: "CapsLock",
    };
    return specialKeys[code] || code;
};
