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AGV,MAAO,IAAK,EAAU,GAAY,GAChC,KAAO,GACP,yBAA0B,EAAmB,IAAS,KAEtD,KAAM,EAAU,IAAM,MAAM,IAYjC,SAAS,kBACR,GAEA,MAAS,CAAE,IAAK,KAAM,QAAS,OAAmB,QAC/C,GACC,EACD,GAAI,SAGR,CAeO,IAAM,gBAEZ,UAAW,WAAa,GAChB,CAAE,EAAO,EAAW,EAAW,gBAAA,aACrC,MAAM,EAAO,EAAc,GACrB,EAAY,kBAAmB,GAE/B,EAAuD,CAC5D,MAAO,IACP,UAAW,KAEX,OAAQ,KACR,QAAS,MAGJ,EAAW,EAAK,QACnB,IAAW,EAAU,SAAU,KAE5B,EAAgB,EAAU,QAC7B,IAAW,EAAK,SAAU,KAG7B,GAAK,EAAS,OAAS,GAAK,EAAc,OAAS,EAClD,OAAO,EAGR,IAAI,EAAM,EAAM,IAAI,cAEpB,OAAO,GAIF,EAAM,QAA+B,IAArB,EAAU,SAC9B,EAAM,OAAO,aAAc,EAAM,SAAU,eAS3C,EAAM,UACe,IAArB,EAAU,QACV,EAA4B,EAAM,QAElC,EAAM,EAA4B,EAAM,OAItB,QAAd,IACJ,EAAY,UAGN,IAAQ,EAAU,eAzBjB,EAAK,SAAU,EAyBc","file":"/npm/@wordpress/keycodes@4.37.0/build/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@wordpress/keycodes@4.37.0/build/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Note: The order of the modifier keys in many of the [foo]Shortcut()\n * functions in this file are intentional and should not be changed. They're\n * designed to fit with the standard menu keyboard shortcuts shown in the\n * user's platform.\n *\n * For example, on MacOS menu shortcuts will place Shift before Command, but\n * on Windows Control will usually come first. So don't provide your own\n * shortcut combos directly to keyboardShortcut().\n */\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { isAppleOS } from './platform';\n\n/**\n * External dependencies\n */\nimport type { KeyboardEvent as ReactKeyboardEvent } from 'react';\n\nexport type WPModifierPart =\n\t| typeof ALT\n\t| typeof CTRL\n\t| typeof COMMAND\n\t| typeof SHIFT;\n\nexport type WPKeycodeModifier =\n\t| 'primary'\n\t| 'primaryShift'\n\t| 'primaryAlt'\n\t| 'secondary'\n\t| 'access'\n\t| 'ctrl'\n\t| 'alt'\n\t| 'ctrlShift'\n\t| 'shift'\n\t| 'shiftAlt'\n\t| 'undefined';\n\n/**\n * An object of handler functions for each of the possible modifier\n * combinations. A handler will return a value for a given key.\n */\nexport type WPModifierHandler< T > = Record< WPKeycodeModifier, T >;\n\nexport type WPKeyHandler< T > = (\n\tcharacter: string,\n\tisApple?: () => boolean\n) => T;\n\nexport type WPEventKeyHandler = (\n\tevent: ReactKeyboardEvent< HTMLElement > | KeyboardEvent,\n\tcharacter: string,\n\tisApple?: () => boolean\n) => boolean;\n\nexport type WPModifier = ( isApple: () => boolean ) => WPModifierPart[];\n\n/**\n * Keycode for BACKSPACE key.\n */\nexport const BACKSPACE = 8;\n\n/**\n * Keycode for TAB key.\n */\nexport const TAB = 9;\n\n/**\n * Keycode for ENTER key.\n */\nexport const ENTER = 13;\n\n/**\n * Keycode for ESCAPE key.\n */\nexport const ESCAPE = 27;\n\n/**\n * Keycode for SPACE key.\n */\nexport const SPACE = 32;\n\n/**\n * Keycode for PAGEUP key.\n */\nexport const PAGEUP = 33;\n\n/**\n * Keycode for PAGEDOWN key.\n */\nexport const PAGEDOWN = 34;\n\n/**\n * Keycode for END key.\n */\nexport const END = 35;\n\n/**\n * Keycode for HOME key.\n */\nexport const HOME = 36;\n\n/**\n * Keycode for LEFT key.\n */\nexport const LEFT = 37;\n\n/**\n * Keycode for UP key.\n */\nexport const UP = 38;\n\n/**\n * Keycode for RIGHT key.\n */\nexport const RIGHT = 39;\n\n/**\n * Keycode for DOWN key.\n */\nexport const DOWN = 40;\n\n/**\n * Keycode for DELETE key.\n */\nexport const DELETE = 46;\n\n/**\n * Keycode for F10 key.\n */\nexport const F10 = 121;\n\n/**\n * Keycode for ALT key.\n */\nexport const ALT = 'alt';\n\n/**\n * Keycode for CTRL key.\n */\nexport const CTRL = 'ctrl';\n\n/**\n * Keycode for COMMAND/META key.\n */\nexport const COMMAND = 'meta';\n\n/**\n * Keycode for SHIFT key.\n */\nexport const SHIFT = 'shift';\n\n/**\n * Keycode for ZERO key.\n */\nexport const ZERO = 48;\n\nexport { isAppleOS };\n\n/**\n * Capitalise the first character of a string.\n * @param string String to capitalise.\n * @return Capitalised string.\n */\nfunction capitaliseFirstCharacter( string: string ): string {\n\treturn string.length < 2\n\t\t? string.toUpperCase()\n\t\t: string.charAt( 0 ).toUpperCase() + string.slice( 1 );\n}\n\n/**\n * Map the values of an object with a specified callback and return the result object.\n *\n * @template T The object type\n * @template R The return type of the mapping function\n *\n * @param    object Object to map values of.\n * @param    mapFn  Mapping function to apply to each value.\n * @return Object with the same keys and transformed values.\n */\nfunction mapValues< T extends Record< string, any >, R >(\n\tobject: T,\n\tmapFn: ( value: T[ keyof T ] ) => R\n): Record< keyof T, R > {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\tkey,\n\t\t\tmapFn( value ),\n\t\t] )\n\t) as Record< keyof T, R >;\n}\n\n/**\n * Object that contains functions that return the available modifier\n * depending on platform.\n */\nexport const modifiers: WPModifierHandler< WPModifier > = {\n\tprimary: ( _isApple ) => ( _isApple() ? [ COMMAND ] : [ CTRL ] ),\n\tprimaryShift: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],\n\tprimaryAlt: ( _isApple ) =>\n\t\t_isApple() ? [ ALT, COMMAND ] : [ CTRL, ALT ],\n\tsecondary: ( _isApple ) =>\n\t\t_isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],\n\taccess: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ),\n\tctrl: () => [ CTRL ],\n\talt: () => [ ALT ],\n\tctrlShift: () => [ CTRL, SHIFT ],\n\tshift: () => [ SHIFT ],\n\tshiftAlt: () => [ SHIFT, ALT ],\n\tundefined: () => [],\n};\n\n/**\n * An object that contains functions to get raw shortcuts.\n *\n * These are intended for user with the KeyboardShortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * rawShortcut.primary( 'm' )\n * // \"meta+m\"\"\n * ```\n */\nexport const rawShortcut: WPModifierHandler< WPKeyHandler< string > > =\n\t/* @__PURE__ */\n\tmapValues( modifiers, ( modifier: WPModifier ) => {\n\t\treturn ( character: string, _isApple = isAppleOS ) => {\n\t\t\treturn [ ...modifier( _isApple ), character.toLowerCase() ].join(\n\t\t\t\t'+'\n\t\t\t);\n\t\t};\n\t} );\n\n/**\n * Return an array of the parts of a keyboard shortcut chord for display.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcutList.primary( 'm' );\n * // [ \"⌘\", \"M\" ]\n * ```\n *\n * Keyed map of functions to shortcut sequences.\n */\nexport const displayShortcutList: WPModifierHandler<\n\tWPKeyHandler< string[] >\n> =\n\t/* @__PURE__ */\n\tmapValues(\n\t\tmodifiers,\n\t\t( modifier: WPModifier ): WPKeyHandler< string[] > => {\n\t\t\treturn ( character: string, _isApple = isAppleOS ) => {\n\t\t\t\tconst isApple = _isApple();\n\t\t\t\tconst replacementKeyMap = {\n\t\t\t\t\t[ ALT ]: isApple ? '⌥' : 'Alt',\n\t\t\t\t\t[ CTRL ]: isApple ? '⌃' : 'Ctrl', // Make sure ⌃ is the U+2303 UP ARROWHEAD unicode character and not the caret character.\n\t\t\t\t\t[ COMMAND ]: '⌘',\n\t\t\t\t\t[ SHIFT ]: isApple ? '⇧' : 'Shift',\n\t\t\t\t};\n\n\t\t\t\tconst modifierKeys = modifier( _isApple ).reduce< string[] >(\n\t\t\t\t\t( accumulator, key ) => {\n\t\t\t\t\t\tconst replacementKey = replacementKeyMap[ key ] ?? key;\n\t\t\t\t\t\t// If on the Mac, adhere to platform convention and don't show plus between keys.\n\t\t\t\t\t\tif ( isApple ) {\n\t\t\t\t\t\t\treturn [ ...accumulator, replacementKey ];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn [ ...accumulator, replacementKey, '+' ];\n\t\t\t\t\t},\n\t\t\t\t\t[]\n\t\t\t\t);\n\n\t\t\t\treturn [\n\t\t\t\t\t...modifierKeys,\n\t\t\t\t\tcapitaliseFirstCharacter( character ),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\t);\n\n/**\n * An object that contains functions to display shortcuts.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * displayShortcut.primary( 'm' );\n * // \"⌘M\"\n * ```\n *\n * Keyed map of functions to display shortcuts.\n */\nexport const displayShortcut: WPModifierHandler< WPKeyHandler< string > > =\n\t/* @__PURE__ */\n\tmapValues(\n\t\tdisplayShortcutList,\n\t\t( shortcutList: WPKeyHandler< string[] > ): WPKeyHandler< string > => {\n\t\t\treturn ( character: string, _isApple = isAppleOS ) =>\n\t\t\t\tshortcutList( character, _isApple ).join( '' );\n\t\t}\n\t);\n\n/**\n * An object that contains functions to return an aria label for a keyboard\n * shortcut.\n *\n * @example\n * ```js\n * // Assuming macOS:\n * shortcutAriaLabel.primary( '.' );\n * // \"Command + Period\"\n * ```\n *\n * Keyed map of functions to shortcut ARIA labels.\n */\nexport const shortcutAriaLabel: WPModifierHandler< WPKeyHandler< string > > =\n\t/* @__PURE__ */\n\tmapValues( modifiers, ( modifier: WPModifier ): WPKeyHandler< string > => {\n\t\treturn ( character: string, _isApple = isAppleOS ) => {\n\t\t\tconst isApple = _isApple();\n\t\t\tconst replacementKeyMap: Record< string, string > = {\n\t\t\t\t[ SHIFT ]: 'Shift',\n\t\t\t\t[ COMMAND ]: isApple ? 'Command' : 'Control',\n\t\t\t\t[ CTRL ]: 'Control',\n\t\t\t\t[ ALT ]: isApple ? 'Option' : 'Alt',\n\t\t\t\t/* translators: comma as in the character ',' */\n\t\t\t\t',': __( 'Comma' ),\n\t\t\t\t/* translators: period as in the character '.' */\n\t\t\t\t'.': __( 'Period' ),\n\t\t\t\t/* translators: backtick as in the character '`' */\n\t\t\t\t'`': __( 'Backtick' ),\n\t\t\t\t/* translators: tilde as in the character '~' */\n\t\t\t\t'~': __( 'Tilde' ),\n\t\t\t};\n\n\t\t\treturn [ ...modifier( _isApple ), character ]\n\t\t\t\t.map( ( key ) =>\n\t\t\t\t\tcapitaliseFirstCharacter( replacementKeyMap[ key ] ?? key )\n\t\t\t\t)\n\t\t\t\t.join( isApple ? ' ' : ' + ' );\n\t\t};\n\t} );\n\n/**\n * From a given KeyboardEvent, returns an array of active modifier constants for\n * the event.\n *\n * @param event Keyboard event.\n *\n * @return Active modifier constants.\n */\nfunction getEventModifiers(\n\tevent: ReactKeyboardEvent< HTMLElement > | KeyboardEvent\n): WPModifierPart[] {\n\treturn ( [ ALT, CTRL, COMMAND, SHIFT ] as const ).filter(\n\t\t( key ) =>\n\t\t\t( event as KeyboardEvent )[\n\t\t\t\t`${ key }Key` as 'altKey' | 'ctrlKey' | 'metaKey' | 'shiftKey'\n\t\t\t]\n\t);\n}\n\n/**\n * An object that contains functions to check if a keyboard event matches a\n * predefined shortcut combination.\n *\n * @example\n * ```js\n * // Assuming an event for ⌘M key press:\n * isKeyboardEvent.primary( event, 'm' );\n * // true\n * ```\n *\n * Keyed map of functions to match events.\n */\nexport const isKeyboardEvent: WPModifierHandler< WPEventKeyHandler > =\n\t/* @__PURE__ */\n\tmapValues( modifiers, ( getModifiers: WPModifier ): WPEventKeyHandler => {\n\t\treturn ( event, character, _isApple = isAppleOS ) => {\n\t\t\tconst mods = getModifiers( _isApple );\n\t\t\tconst eventMods = getEventModifiers( event );\n\n\t\t\tconst replacementWithShiftKeyMap: Record< string, string > = {\n\t\t\t\tComma: ',',\n\t\t\t\tBackslash: '\\\\',\n\t\t\t\t// Windows returns `\\` for both IntlRo and IntlYen.\n\t\t\t\tIntlRo: '\\\\',\n\t\t\t\tIntlYen: '\\\\',\n\t\t\t};\n\n\t\t\tconst modsDiff = mods.filter(\n\t\t\t\t( mod ) => ! eventMods.includes( mod )\n\t\t\t);\n\t\t\tconst eventModsDiff = eventMods.filter(\n\t\t\t\t( mod ) => ! mods.includes( mod )\n\t\t\t);\n\n\t\t\tif ( modsDiff.length > 0 || eventModsDiff.length > 0 ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tlet key = event.key.toLowerCase();\n\n\t\t\tif ( ! character ) {\n\t\t\t\treturn mods.includes( key as WPModifierPart );\n\t\t\t}\n\n\t\t\tif ( event.altKey && character.length === 1 ) {\n\t\t\t\tkey = String.fromCharCode( event.keyCode ).toLowerCase();\n\t\t\t}\n\n\t\t\t// `event.key` returns the value of the key pressed, taking into the state of\n\t\t\t// modifier keys such as `Shift`. If the shift key is pressed, a different\n\t\t\t// value may be returned depending on the keyboard layout. It is necessary to\n\t\t\t// convert to the physical key value that don't take into account keyboard\n\t\t\t// layout or modifier key state.\n\t\t\tif (\n\t\t\t\tevent.shiftKey &&\n\t\t\t\tcharacter.length === 1 &&\n\t\t\t\treplacementWithShiftKeyMap[ event.code ]\n\t\t\t) {\n\t\t\t\tkey = replacementWithShiftKeyMap[ event.code ];\n\t\t\t}\n\n\t\t\t// For backwards compatibility.\n\t\t\tif ( character === 'del' ) {\n\t\t\t\tcharacter = 'delete';\n\t\t\t}\n\n\t\t\treturn key === character.toLowerCase();\n\t\t};\n\t} );\n"]}