import type { KbsInternalShortcut } from '../types.ts'; import { shortcutToKeys } from './make_key.ts'; export function combineShortcuts( shortcuts: readonly KbsInternalShortcut[], ): Record { const result: Record = {}; for (const shortcut of shortcuts) { const keys = shortcutToKeys(shortcut); for (const key of keys) { if (result[key] !== undefined) { // eslint-disable-next-line no-console console.warn( `A global shortcut was already defined for key the combination ${key}. It will be overridden.`, ); } result[key] = shortcut; } } return result; }