| 93 | } |
| 94 | |
| 95 | function normalizeStep(step: string): string { |
| 96 | const parts = step.split('+') |
| 97 | const modifiers: string[] = [] |
| 98 | let mainKey = '' |
| 99 | |
| 100 | for (const part of parts) { |
| 101 | const lower = part.trim().toLowerCase() |
| 102 | if ( |
| 103 | [ |
| 104 | 'ctrl', |
| 105 | 'control', |
| 106 | 'alt', |
| 107 | 'opt', |
| 108 | 'option', |
| 109 | 'meta', |
| 110 | 'cmd', |
| 111 | 'command', |
| 112 | 'shift', |
| 113 | ].includes(lower) |
| 114 | ) { |
| 115 | // Normalize modifier names |
| 116 | if (lower === 'control') modifiers.push('ctrl') |
| 117 | else if (lower === 'option' || lower === 'opt') modifiers.push('alt') |
| 118 | else if (lower === 'command' || lower === 'cmd') modifiers.push('cmd') |
| 119 | else modifiers.push(lower) |
| 120 | } else { |
| 121 | mainKey = lower |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | modifiers.sort() |
| 126 | return [...modifiers, mainKey].join('+') |
| 127 | } |
| 128 | |