wp/wp-includes/js/dist/keyboard-shortcuts.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
     1 this["wp"] = this["wp"] || {}; this["wp"]["keyboardShortcuts"] =
     1 /******/ (function() { // webpackBootstrap
     2 /******/ (function(modules) { // webpackBootstrap
     2 /******/ 	"use strict";
     3 /******/ 	// The module cache
     3 /******/ 	// The require scope
     4 /******/ 	var installedModules = {};
     4 /******/ 	var __webpack_require__ = {};
     5 /******/
     5 /******/ 	
     6 /******/ 	// The require function
     6 /************************************************************************/
     7 /******/ 	function __webpack_require__(moduleId) {
     7 /******/ 	/* webpack/runtime/define property getters */
     8 /******/
     8 /******/ 	!function() {
     9 /******/ 		// Check if module is in cache
     9 /******/ 		// define getter functions for harmony exports
    10 /******/ 		if(installedModules[moduleId]) {
    10 /******/ 		__webpack_require__.d = function(exports, definition) {
    11 /******/ 			return installedModules[moduleId].exports;
    11 /******/ 			for(var key in definition) {
    12 /******/ 		}
    12 /******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
    13 /******/ 		// Create a new module (and put it into the cache)
    13 /******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
    14 /******/ 		var module = installedModules[moduleId] = {
    14 /******/ 				}
    15 /******/ 			i: moduleId,
    15 /******/ 			}
    16 /******/ 			l: false,
       
    17 /******/ 			exports: {}
       
    18 /******/ 		};
    16 /******/ 		};
    19 /******/
    17 /******/ 	}();
    20 /******/ 		// Execute the module function
    18 /******/ 	
    21 /******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    19 /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
    22 /******/
    20 /******/ 	!function() {
    23 /******/ 		// Flag the module as loaded
    21 /******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
    24 /******/ 		module.l = true;
    22 /******/ 	}();
    25 /******/
    23 /******/ 	
    26 /******/ 		// Return the exports of the module
    24 /******/ 	/* webpack/runtime/make namespace object */
    27 /******/ 		return module.exports;
    25 /******/ 	!function() {
    28 /******/ 	}
    26 /******/ 		// define __esModule on exports
    29 /******/
    27 /******/ 		__webpack_require__.r = function(exports) {
    30 /******/
    28 /******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
    31 /******/ 	// expose the modules object (__webpack_modules__)
    29 /******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
    32 /******/ 	__webpack_require__.m = modules;
    30 /******/ 			}
    33 /******/
    31 /******/ 			Object.defineProperty(exports, '__esModule', { value: true });
    34 /******/ 	// expose the module cache
    32 /******/ 		};
    35 /******/ 	__webpack_require__.c = installedModules;
    33 /******/ 	}();
    36 /******/
    34 /******/ 	
    37 /******/ 	// define getter function for harmony exports
       
    38 /******/ 	__webpack_require__.d = function(exports, name, getter) {
       
    39 /******/ 		if(!__webpack_require__.o(exports, name)) {
       
    40 /******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
       
    41 /******/ 		}
       
    42 /******/ 	};
       
    43 /******/
       
    44 /******/ 	// define __esModule on exports
       
    45 /******/ 	__webpack_require__.r = function(exports) {
       
    46 /******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
       
    47 /******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
       
    48 /******/ 		}
       
    49 /******/ 		Object.defineProperty(exports, '__esModule', { value: true });
       
    50 /******/ 	};
       
    51 /******/
       
    52 /******/ 	// create a fake namespace object
       
    53 /******/ 	// mode & 1: value is a module id, require it
       
    54 /******/ 	// mode & 2: merge all properties of value into the ns
       
    55 /******/ 	// mode & 4: return value when already ns object
       
    56 /******/ 	// mode & 8|1: behave like require
       
    57 /******/ 	__webpack_require__.t = function(value, mode) {
       
    58 /******/ 		if(mode & 1) value = __webpack_require__(value);
       
    59 /******/ 		if(mode & 8) return value;
       
    60 /******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
       
    61 /******/ 		var ns = Object.create(null);
       
    62 /******/ 		__webpack_require__.r(ns);
       
    63 /******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
       
    64 /******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
       
    65 /******/ 		return ns;
       
    66 /******/ 	};
       
    67 /******/
       
    68 /******/ 	// getDefaultExport function for compatibility with non-harmony modules
       
    69 /******/ 	__webpack_require__.n = function(module) {
       
    70 /******/ 		var getter = module && module.__esModule ?
       
    71 /******/ 			function getDefault() { return module['default']; } :
       
    72 /******/ 			function getModuleExports() { return module; };
       
    73 /******/ 		__webpack_require__.d(getter, 'a', getter);
       
    74 /******/ 		return getter;
       
    75 /******/ 	};
       
    76 /******/
       
    77 /******/ 	// Object.prototype.hasOwnProperty.call
       
    78 /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
       
    79 /******/
       
    80 /******/ 	// __webpack_public_path__
       
    81 /******/ 	__webpack_require__.p = "";
       
    82 /******/
       
    83 /******/
       
    84 /******/ 	// Load entry module and return exports
       
    85 /******/ 	return __webpack_require__(__webpack_require__.s = "cFS5");
       
    86 /******/ })
       
    87 /************************************************************************/
    35 /************************************************************************/
    88 /******/ ({
    36 var __webpack_exports__ = {};
    89 
       
    90 /***/ "1ZqX":
       
    91 /***/ (function(module, exports) {
       
    92 
       
    93 (function() { module.exports = window["wp"]["data"]; }());
       
    94 
       
    95 /***/ }),
       
    96 
       
    97 /***/ "K9lf":
       
    98 /***/ (function(module, exports) {
       
    99 
       
   100 (function() { module.exports = window["wp"]["compose"]; }());
       
   101 
       
   102 /***/ }),
       
   103 
       
   104 /***/ "RxS6":
       
   105 /***/ (function(module, exports) {
       
   106 
       
   107 (function() { module.exports = window["wp"]["keycodes"]; }());
       
   108 
       
   109 /***/ }),
       
   110 
       
   111 /***/ "YLtl":
       
   112 /***/ (function(module, exports) {
       
   113 
       
   114 (function() { module.exports = window["lodash"]; }());
       
   115 
       
   116 /***/ }),
       
   117 
       
   118 /***/ "cFS5":
       
   119 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   120 
       
   121 "use strict";
       
   122 // ESM COMPAT FLAG
    37 // ESM COMPAT FLAG
   123 __webpack_require__.r(__webpack_exports__);
    38 __webpack_require__.r(__webpack_exports__);
   124 
    39 
   125 // EXPORTS
    40 // EXPORTS
   126 __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
    41 __webpack_require__.d(__webpack_exports__, {
   127 __webpack_require__.d(__webpack_exports__, "useShortcut", function() { return /* reexport */ use_shortcut; });
    42   "ShortcutProvider": function() { return /* reexport */ ShortcutProvider; },
   128 __webpack_require__.d(__webpack_exports__, "__unstableUseShortcutEventMatch", function() { return /* reexport */ useShortcutEventMatch; });
    43   "__unstableUseShortcutEventMatch": function() { return /* reexport */ useShortcutEventMatch; },
       
    44   "store": function() { return /* reexport */ store; },
       
    45   "useShortcut": function() { return /* reexport */ useShortcut; }
       
    46 });
   129 
    47 
   130 // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
    48 // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
   131 var actions_namespaceObject = {};
    49 var actions_namespaceObject = {};
   132 __webpack_require__.r(actions_namespaceObject);
    50 __webpack_require__.r(actions_namespaceObject);
   133 __webpack_require__.d(actions_namespaceObject, "registerShortcut", function() { return registerShortcut; });
    51 __webpack_require__.d(actions_namespaceObject, {
   134 __webpack_require__.d(actions_namespaceObject, "unregisterShortcut", function() { return unregisterShortcut; });
    52   "registerShortcut": function() { return registerShortcut; },
       
    53   "unregisterShortcut": function() { return unregisterShortcut; }
       
    54 });
   135 
    55 
   136 // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
    56 // NAMESPACE OBJECT: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
   137 var selectors_namespaceObject = {};
    57 var selectors_namespaceObject = {};
   138 __webpack_require__.r(selectors_namespaceObject);
    58 __webpack_require__.r(selectors_namespaceObject);
   139 __webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", function() { return getShortcutKeyCombination; });
    59 __webpack_require__.d(selectors_namespaceObject, {
   140 __webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
    60   "getAllShortcutKeyCombinations": function() { return getAllShortcutKeyCombinations; },
   141 __webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
    61   "getAllShortcutRawKeyCombinations": function() { return getAllShortcutRawKeyCombinations; },
   142 __webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
    62   "getCategoryShortcuts": function() { return getCategoryShortcuts; },
   143 __webpack_require__.d(selectors_namespaceObject, "getAllShortcutKeyCombinations", function() { return selectors_getAllShortcutKeyCombinations; });
    63   "getShortcutAliases": function() { return getShortcutAliases; },
   144 __webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
    64   "getShortcutDescription": function() { return getShortcutDescription; },
   145 __webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
    65   "getShortcutKeyCombination": function() { return getShortcutKeyCombination; },
   146 
    66   "getShortcutRepresentation": function() { return getShortcutRepresentation; }
   147 // EXTERNAL MODULE: external ["wp","data"]
    67 });
   148 var external_wp_data_ = __webpack_require__("1ZqX");
    68 
   149 
    69 ;// CONCATENATED MODULE: external ["wp","data"]
   150 // EXTERNAL MODULE: external "lodash"
    70 var external_wp_data_namespaceObject = window["wp"]["data"];
   151 var external_lodash_ = __webpack_require__("YLtl");
    71 ;// CONCATENATED MODULE: external "lodash"
   152 
    72 var external_lodash_namespaceObject = window["lodash"];
   153 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
    73 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
   154 /**
    74 /**
   155  * External dependencies
    75  * External dependencies
   156  */
    76  */
   157 
    77 
   158 /**
    78 /**
   162  * @param {Object} action Dispatched action.
    82  * @param {Object} action Dispatched action.
   163  *
    83  *
   164  * @return {Object} Updated state.
    84  * @return {Object} Updated state.
   165  */
    85  */
   166 
    86 
   167 function reducer(state = {}, action) {
    87 function reducer() {
       
    88   let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
       
    89   let action = arguments.length > 1 ? arguments[1] : undefined;
       
    90 
   168   switch (action.type) {
    91   switch (action.type) {
   169     case 'REGISTER_SHORTCUT':
    92     case 'REGISTER_SHORTCUT':
   170       return { ...state,
    93       return { ...state,
   171         [action.name]: {
    94         [action.name]: {
   172           category: action.category,
    95           category: action.category,
   175           description: action.description
    98           description: action.description
   176         }
    99         }
   177       };
   100       };
   178 
   101 
   179     case 'UNREGISTER_SHORTCUT':
   102     case 'UNREGISTER_SHORTCUT':
   180       return Object(external_lodash_["omit"])(state, action.name);
   103       return (0,external_lodash_namespaceObject.omit)(state, action.name);
   181   }
   104   }
   182 
   105 
   183   return state;
   106   return state;
   184 }
   107 }
   185 
   108 
   186 /* harmony default export */ var store_reducer = (reducer);
   109 /* harmony default export */ var store_reducer = (reducer);
   187 
   110 
   188 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
   111 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
   189 /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
   112 /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
   190 
   113 
   191 /**
   114 /**
   192  * Keyboard key combination.
   115  * Keyboard key combination.
   193  *
   116  *
   214  *
   137  *
   215  * @param {WPShortcutConfig} config Shortcut config.
   138  * @param {WPShortcutConfig} config Shortcut config.
   216  *
   139  *
   217  * @return {Object} action.
   140  * @return {Object} action.
   218  */
   141  */
   219 function registerShortcut({
   142 function registerShortcut(_ref) {
   220   name,
   143   let {
   221   category,
   144     name,
   222   description,
   145     category,
   223   keyCombination,
   146     description,
   224   aliases
   147     keyCombination,
   225 }) {
   148     aliases
       
   149   } = _ref;
   226   return {
   150   return {
   227     type: 'REGISTER_SHORTCUT',
   151     type: 'REGISTER_SHORTCUT',
   228     name,
   152     name,
   229     category,
   153     category,
   230     keyCombination,
   154     keyCombination,
   245     type: 'UNREGISTER_SHORTCUT',
   169     type: 'UNREGISTER_SHORTCUT',
   246     name
   170     name
   247   };
   171   };
   248 }
   172 }
   249 
   173 
   250 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
   174 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
   251 var rememo = __webpack_require__("pPDe");
       
   252 
       
   253 // EXTERNAL MODULE: external ["wp","keycodes"]
       
   254 var external_wp_keycodes_ = __webpack_require__("RxS6");
       
   255 
       
   256 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
       
   257 /**
       
   258  * External dependencies
       
   259  */
       
   260 
       
   261 
       
   262 /**
       
   263  * WordPress dependencies
       
   264  */
       
   265 
       
   266 
       
   267 /** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
       
   268 
       
   269 /** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
       
   270 
       
   271 /**
       
   272  * Shared reference to an empty array for cases where it is important to avoid
       
   273  * returning a new array reference on every invocation.
       
   274  *
       
   275  * @type {Array<any>}
       
   276  */
       
   277 
       
   278 const EMPTY_ARRAY = [];
       
   279 /**
       
   280  * Shortcut formatting methods.
       
   281  *
       
   282  * @property {WPKeycodeHandlerByModifier} display     Display formatting.
       
   283  * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
       
   284  * @property {WPKeycodeHandlerByModifier} ariaLabel   ARIA label formatting.
       
   285  */
       
   286 
       
   287 const FORMATTING_METHODS = {
       
   288   display: external_wp_keycodes_["displayShortcut"],
       
   289   raw: external_wp_keycodes_["rawShortcut"],
       
   290   ariaLabel: external_wp_keycodes_["shortcutAriaLabel"]
       
   291 };
       
   292 /**
       
   293  * Returns a string representing the key combination.
       
   294  *
       
   295  * @param {?WPShortcutKeyCombination} shortcut       Key combination.
       
   296  * @param {keyof FORMATTING_METHODS}  representation Type of representation
       
   297  *                                                   (display, raw, ariaLabel).
       
   298  *
       
   299  * @return {string?} Shortcut representation.
       
   300  */
       
   301 
       
   302 function getKeyCombinationRepresentation(shortcut, representation) {
       
   303   if (!shortcut) {
       
   304     return null;
       
   305   }
       
   306 
       
   307   return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
       
   308 }
       
   309 /**
       
   310  * Returns the main key combination for a given shortcut name.
       
   311  *
       
   312  * @param {Object} state Global state.
       
   313  * @param {string} name  Shortcut name.
       
   314  *
       
   315  * @return {WPShortcutKeyCombination?} Key combination.
       
   316  */
       
   317 
       
   318 
       
   319 function getShortcutKeyCombination(state, name) {
       
   320   return state[name] ? state[name].keyCombination : null;
       
   321 }
       
   322 /**
       
   323  * Returns a string representing the main key combination for a given shortcut name.
       
   324  *
       
   325  * @param {Object}                   state          Global state.
       
   326  * @param {string}                   name           Shortcut name.
       
   327  * @param {keyof FORMATTING_METHODS} representation Type of representation
       
   328  *                                                  (display, raw, ariaLabel).
       
   329  *
       
   330  * @return {string?} Shortcut representation.
       
   331  */
       
   332 
       
   333 function getShortcutRepresentation(state, name, representation = 'display') {
       
   334   const shortcut = getShortcutKeyCombination(state, name);
       
   335   return getKeyCombinationRepresentation(shortcut, representation);
       
   336 }
       
   337 /**
       
   338  * Returns the shortcut description given its name.
       
   339  *
       
   340  * @param {Object} state Global state.
       
   341  * @param {string} name  Shortcut name.
       
   342  *
       
   343  * @return {string?} Shortcut description.
       
   344  */
       
   345 
       
   346 function getShortcutDescription(state, name) {
       
   347   return state[name] ? state[name].description : null;
       
   348 }
       
   349 /**
       
   350  * Returns the aliases for a given shortcut name.
       
   351  *
       
   352  * @param {Object} state Global state.
       
   353  * @param {string} name  Shortcut name.
       
   354  *
       
   355  * @return {WPShortcutKeyCombination[]} Key combinations.
       
   356  */
       
   357 
       
   358 function getShortcutAliases(state, name) {
       
   359   return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
       
   360 }
       
   361 const selectors_getAllShortcutKeyCombinations = Object(rememo["a" /* default */])((state, name) => {
       
   362   return Object(external_lodash_["compact"])([getShortcutKeyCombination(state, name), ...getShortcutAliases(state, name)]);
       
   363 }, (state, name) => [state[name]]);
       
   364 /**
       
   365  * Returns the raw representation of all the keyboard combinations of a given shortcut name.
       
   366  *
       
   367  * @param {Object} state Global state.
       
   368  * @param {string} name  Shortcut name.
       
   369  *
       
   370  * @return {string[]} Shortcuts.
       
   371  */
       
   372 
       
   373 const getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])((state, name) => {
       
   374   return selectors_getAllShortcutKeyCombinations(state, name).map(combination => getKeyCombinationRepresentation(combination, 'raw'));
       
   375 }, (state, name) => [state[name]]);
       
   376 /**
       
   377  * Returns the shortcut names list for a given category name.
       
   378  *
       
   379  * @param {Object} state Global state.
       
   380  * @param {string} name  Category name.
       
   381  *
       
   382  * @return {string[]} Shortcut names.
       
   383  */
       
   384 
       
   385 const getCategoryShortcuts = Object(rememo["a" /* default */])((state, categoryName) => {
       
   386   return Object.entries(state).filter(([, shortcut]) => shortcut.category === categoryName).map(([name]) => name);
       
   387 }, state => [state]);
       
   388 
       
   389 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
       
   390 /**
       
   391  * WordPress dependencies
       
   392  */
       
   393 
       
   394 /**
       
   395  * Internal dependencies
       
   396  */
       
   397 
       
   398 
       
   399 
       
   400 
       
   401 const STORE_NAME = 'core/keyboard-shortcuts';
       
   402 /**
       
   403  * Store definition for the keyboard shortcuts namespace.
       
   404  *
       
   405  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
       
   406  *
       
   407  * @type {Object}
       
   408  */
       
   409 
       
   410 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, {
       
   411   reducer: store_reducer,
       
   412   actions: actions_namespaceObject,
       
   413   selectors: selectors_namespaceObject
       
   414 });
       
   415 Object(external_wp_data_["register"])(store);
       
   416 
       
   417 // EXTERNAL MODULE: external ["wp","compose"]
       
   418 var external_wp_compose_ = __webpack_require__("K9lf");
       
   419 
       
   420 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
       
   421 /**
       
   422  * WordPress dependencies
       
   423  */
       
   424 
       
   425 
       
   426 /**
       
   427  * Internal dependencies
       
   428  */
       
   429 
       
   430 
       
   431 /**
       
   432  * Attach a keyboard shortcut handler.
       
   433  *
       
   434  * @param {string} name       Shortcut name.
       
   435  * @param {Function} callback Shortcut callback.
       
   436  * @param {Object} options    Shortcut options.
       
   437  */
       
   438 
       
   439 function useShortcut(name, callback, options) {
       
   440   const shortcuts = Object(external_wp_data_["useSelect"])(select => {
       
   441     return select(store).getAllShortcutRawKeyCombinations(name);
       
   442   }, [name]);
       
   443   Object(external_wp_compose_["useKeyboardShortcut"])(shortcuts, callback, options);
       
   444 }
       
   445 
       
   446 /* harmony default export */ var use_shortcut = (useShortcut);
       
   447 
       
   448 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js
       
   449 /**
       
   450  * WordPress dependencies
       
   451  */
       
   452 
       
   453 
       
   454 /**
       
   455  * Internal dependencies
       
   456  */
       
   457 
       
   458 
       
   459 /**
       
   460  * Returns a function to check if a keyboard event matches a shortcut name.
       
   461  *
       
   462  * @return {Function} A function to to check if a keyboard event matches a
       
   463  *                    predefined shortcut combination.
       
   464  */
       
   465 
       
   466 function useShortcutEventMatch() {
       
   467   const {
       
   468     getAllShortcutKeyCombinations
       
   469   } = Object(external_wp_data_["useSelect"])(store);
       
   470   /**
       
   471    * A function to check if a keyboard event matches a predefined shortcut
       
   472    * combination.
       
   473    *
       
   474    * @param {string}        name  Shortcut name.
       
   475    * @param {KeyboardEvent} event Event to check.
       
   476    *
       
   477    * @return {boolean} True if the event matches any shortcuts, false if not.
       
   478    */
       
   479 
       
   480   function isMatch(name, event) {
       
   481     return getAllShortcutKeyCombinations(name).some(({
       
   482       modifier,
       
   483       character
       
   484     }) => {
       
   485       return external_wp_keycodes_["isKeyboardEvent"][modifier](event, character);
       
   486     });
       
   487   }
       
   488 
       
   489   return isMatch;
       
   490 }
       
   491 
       
   492 // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
       
   493 
       
   494 
       
   495 
       
   496 
       
   497 
       
   498 /***/ }),
       
   499 
       
   500 /***/ "pPDe":
       
   501 /***/ (function(module, __webpack_exports__, __webpack_require__) {
       
   502 
       
   503 "use strict";
       
   504 
   175 
   505 
   176 
   506 var LEAF_KEY, hasWeakMap;
   177 var LEAF_KEY, hasWeakMap;
   507 
   178 
   508 /**
   179 /**
   596  *                                 reference or array of reference used in
   267  *                                 reference or array of reference used in
   597  *                                 cache bust consideration.
   268  *                                 cache bust consideration.
   598  *
   269  *
   599  * @return {Function} Memoized selector.
   270  * @return {Function} Memoized selector.
   600  */
   271  */
   601 /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
   272 /* harmony default export */ function rememo(selector, getDependants ) {
   602 	var rootCache, getCache;
   273 	var rootCache, getCache;
   603 
   274 
   604 	// Use object source as dependant if getter not provided
   275 	// Use object source as dependant if getter not provided
   605 	if ( ! getDependants ) {
   276 	if ( ! getDependants ) {
   606 		getDependants = arrayOf;
   277 		getDependants = arrayOf;
   772 	callSelector.getDependants = getDependants;
   443 	callSelector.getDependants = getDependants;
   773 	callSelector.clear = clear;
   444 	callSelector.clear = clear;
   774 	clear();
   445 	clear();
   775 
   446 
   776 	return callSelector;
   447 	return callSelector;
       
   448 }
       
   449 
       
   450 ;// CONCATENATED MODULE: external ["wp","keycodes"]
       
   451 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
       
   452 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
       
   453 /**
       
   454  * External dependencies
       
   455  */
       
   456 
       
   457 
       
   458 /**
       
   459  * WordPress dependencies
       
   460  */
       
   461 
       
   462 
       
   463 /** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
       
   464 
       
   465 /** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
       
   466 
       
   467 /**
       
   468  * Shared reference to an empty array for cases where it is important to avoid
       
   469  * returning a new array reference on every invocation.
       
   470  *
       
   471  * @type {Array<any>}
       
   472  */
       
   473 
       
   474 const EMPTY_ARRAY = [];
       
   475 /**
       
   476  * Shortcut formatting methods.
       
   477  *
       
   478  * @property {WPKeycodeHandlerByModifier} display     Display formatting.
       
   479  * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
       
   480  * @property {WPKeycodeHandlerByModifier} ariaLabel   ARIA label formatting.
       
   481  */
       
   482 
       
   483 const FORMATTING_METHODS = {
       
   484   display: external_wp_keycodes_namespaceObject.displayShortcut,
       
   485   raw: external_wp_keycodes_namespaceObject.rawShortcut,
       
   486   ariaLabel: external_wp_keycodes_namespaceObject.shortcutAriaLabel
       
   487 };
       
   488 /**
       
   489  * Returns a string representing the key combination.
       
   490  *
       
   491  * @param {?WPShortcutKeyCombination} shortcut       Key combination.
       
   492  * @param {keyof FORMATTING_METHODS}  representation Type of representation
       
   493  *                                                   (display, raw, ariaLabel).
       
   494  *
       
   495  * @return {string?} Shortcut representation.
       
   496  */
       
   497 
       
   498 function getKeyCombinationRepresentation(shortcut, representation) {
       
   499   if (!shortcut) {
       
   500     return null;
       
   501   }
       
   502 
       
   503   return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
       
   504 }
       
   505 /**
       
   506  * Returns the main key combination for a given shortcut name.
       
   507  *
       
   508  * @param {Object} state Global state.
       
   509  * @param {string} name  Shortcut name.
       
   510  *
       
   511  * @return {WPShortcutKeyCombination?} Key combination.
       
   512  */
       
   513 
       
   514 
       
   515 function getShortcutKeyCombination(state, name) {
       
   516   return state[name] ? state[name].keyCombination : null;
       
   517 }
       
   518 /**
       
   519  * Returns a string representing the main key combination for a given shortcut name.
       
   520  *
       
   521  * @param {Object}                   state          Global state.
       
   522  * @param {string}                   name           Shortcut name.
       
   523  * @param {keyof FORMATTING_METHODS} representation Type of representation
       
   524  *                                                  (display, raw, ariaLabel).
       
   525  *
       
   526  * @return {string?} Shortcut representation.
       
   527  */
       
   528 
       
   529 function getShortcutRepresentation(state, name) {
       
   530   let representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
       
   531   const shortcut = getShortcutKeyCombination(state, name);
       
   532   return getKeyCombinationRepresentation(shortcut, representation);
       
   533 }
       
   534 /**
       
   535  * Returns the shortcut description given its name.
       
   536  *
       
   537  * @param {Object} state Global state.
       
   538  * @param {string} name  Shortcut name.
       
   539  *
       
   540  * @return {string?} Shortcut description.
       
   541  */
       
   542 
       
   543 function getShortcutDescription(state, name) {
       
   544   return state[name] ? state[name].description : null;
       
   545 }
       
   546 /**
       
   547  * Returns the aliases for a given shortcut name.
       
   548  *
       
   549  * @param {Object} state Global state.
       
   550  * @param {string} name  Shortcut name.
       
   551  *
       
   552  * @return {WPShortcutKeyCombination[]} Key combinations.
       
   553  */
       
   554 
       
   555 function getShortcutAliases(state, name) {
       
   556   return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
       
   557 }
       
   558 const getAllShortcutKeyCombinations = rememo((state, name) => {
       
   559   return (0,external_lodash_namespaceObject.compact)([getShortcutKeyCombination(state, name), ...getShortcutAliases(state, name)]);
       
   560 }, (state, name) => [state[name]]);
       
   561 /**
       
   562  * Returns the raw representation of all the keyboard combinations of a given shortcut name.
       
   563  *
       
   564  * @param {Object} state Global state.
       
   565  * @param {string} name  Shortcut name.
       
   566  *
       
   567  * @return {string[]} Shortcuts.
       
   568  */
       
   569 
       
   570 const getAllShortcutRawKeyCombinations = rememo((state, name) => {
       
   571   return getAllShortcutKeyCombinations(state, name).map(combination => getKeyCombinationRepresentation(combination, 'raw'));
       
   572 }, (state, name) => [state[name]]);
       
   573 /**
       
   574  * Returns the shortcut names list for a given category name.
       
   575  *
       
   576  * @param {Object} state Global state.
       
   577  * @param {string} name  Category name.
       
   578  *
       
   579  * @return {string[]} Shortcut names.
       
   580  */
       
   581 
       
   582 const getCategoryShortcuts = rememo((state, categoryName) => {
       
   583   return Object.entries(state).filter(_ref => {
       
   584     let [, shortcut] = _ref;
       
   585     return shortcut.category === categoryName;
       
   586   }).map(_ref2 => {
       
   587     let [name] = _ref2;
       
   588     return name;
       
   589   });
       
   590 }, state => [state]);
       
   591 
       
   592 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
       
   593 /**
       
   594  * WordPress dependencies
       
   595  */
       
   596 
       
   597 /**
       
   598  * Internal dependencies
       
   599  */
       
   600 
       
   601 
       
   602 
       
   603 
       
   604 const STORE_NAME = 'core/keyboard-shortcuts';
       
   605 /**
       
   606  * Store definition for the keyboard shortcuts namespace.
       
   607  *
       
   608  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
       
   609  *
       
   610  * @type {Object}
       
   611  */
       
   612 
       
   613 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
       
   614   reducer: store_reducer,
       
   615   actions: actions_namespaceObject,
       
   616   selectors: selectors_namespaceObject
   777 });
   617 });
   778 
   618 (0,external_wp_data_namespaceObject.register)(store);
   779 
   619 
   780 /***/ })
   620 ;// CONCATENATED MODULE: external ["wp","element"]
   781 
   621 var external_wp_element_namespaceObject = window["wp"]["element"];
   782 /******/ });
   622 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut-event-match.js
       
   623 /**
       
   624  * WordPress dependencies
       
   625  */
       
   626 
       
   627 
       
   628 /**
       
   629  * Internal dependencies
       
   630  */
       
   631 
       
   632 
       
   633 /**
       
   634  * Returns a function to check if a keyboard event matches a shortcut name.
       
   635  *
       
   636  * @return {Function} A function to to check if a keyboard event matches a
       
   637  *                    predefined shortcut combination.
       
   638  */
       
   639 
       
   640 function useShortcutEventMatch() {
       
   641   const {
       
   642     getAllShortcutKeyCombinations
       
   643   } = (0,external_wp_data_namespaceObject.useSelect)(store);
       
   644   /**
       
   645    * A function to check if a keyboard event matches a predefined shortcut
       
   646    * combination.
       
   647    *
       
   648    * @param {string}        name  Shortcut name.
       
   649    * @param {KeyboardEvent} event Event to check.
       
   650    *
       
   651    * @return {boolean} True if the event matches any shortcuts, false if not.
       
   652    */
       
   653 
       
   654   function isMatch(name, event) {
       
   655     return getAllShortcutKeyCombinations(name).some(_ref => {
       
   656       let {
       
   657         modifier,
       
   658         character
       
   659       } = _ref;
       
   660       return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
       
   661     });
       
   662   }
       
   663 
       
   664   return isMatch;
       
   665 }
       
   666 
       
   667 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/context.js
       
   668 /**
       
   669  * WordPress dependencies
       
   670  */
       
   671 
       
   672 const context = (0,external_wp_element_namespaceObject.createContext)();
       
   673 
       
   674 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
       
   675 /**
       
   676  * WordPress dependencies
       
   677  */
       
   678 
       
   679 /**
       
   680  * Internal dependencies
       
   681  */
       
   682 
       
   683 
       
   684 
       
   685 /**
       
   686  * Attach a keyboard shortcut handler.
       
   687  *
       
   688  * @param {string}   name               Shortcut name.
       
   689  * @param {Function} callback           Shortcut callback.
       
   690  * @param {Object}   options            Shortcut options.
       
   691  * @param {boolean}  options.isDisabled Whether to disable to shortut.
       
   692  */
       
   693 
       
   694 function useShortcut(name, callback) {
       
   695   let {
       
   696     isDisabled
       
   697   } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
       
   698   const shortcuts = (0,external_wp_element_namespaceObject.useContext)(context);
       
   699   const isMatch = useShortcutEventMatch();
       
   700   const callbackRef = (0,external_wp_element_namespaceObject.useRef)();
       
   701   callbackRef.current = callback;
       
   702   (0,external_wp_element_namespaceObject.useEffect)(() => {
       
   703     if (isDisabled) {
       
   704       return;
       
   705     }
       
   706 
       
   707     function _callback(event) {
       
   708       if (isMatch(name, event)) {
       
   709         callbackRef.current(event);
       
   710       }
       
   711     }
       
   712 
       
   713     shortcuts.current.add(_callback);
       
   714     return () => {
       
   715       shortcuts.current.delete(_callback);
       
   716     };
       
   717   }, [name, isDisabled]);
       
   718 }
       
   719 
       
   720 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
       
   721 function _extends() {
       
   722   _extends = Object.assign ? Object.assign.bind() : function (target) {
       
   723     for (var i = 1; i < arguments.length; i++) {
       
   724       var source = arguments[i];
       
   725 
       
   726       for (var key in source) {
       
   727         if (Object.prototype.hasOwnProperty.call(source, key)) {
       
   728           target[key] = source[key];
       
   729         }
       
   730       }
       
   731     }
       
   732 
       
   733     return target;
       
   734   };
       
   735   return _extends.apply(this, arguments);
       
   736 }
       
   737 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/components/shortcut-provider.js
       
   738 
       
   739 
       
   740 
       
   741 /**
       
   742  * WordPress dependencies
       
   743  */
       
   744 
       
   745 /**
       
   746  * Internal dependencies
       
   747  */
       
   748 
       
   749 
       
   750 const {
       
   751   Provider
       
   752 } = context;
       
   753 /**
       
   754  * Handles callbacks added to context by `useShortcut`.
       
   755  *
       
   756  * @param {Object} props Props to pass to `div`.
       
   757  *
       
   758  * @return {import('@wordpress/element').WPElement} Component.
       
   759  */
       
   760 
       
   761 function ShortcutProvider(props) {
       
   762   const keyboardShortcuts = (0,external_wp_element_namespaceObject.useRef)(new Set());
       
   763 
       
   764   function onKeyDown(event) {
       
   765     if (props.onKeyDown) props.onKeyDown(event);
       
   766 
       
   767     for (const keyboardShortcut of keyboardShortcuts.current) {
       
   768       keyboardShortcut(event);
       
   769     }
       
   770   }
       
   771   /* eslint-disable jsx-a11y/no-static-element-interactions */
       
   772 
       
   773 
       
   774   return (0,external_wp_element_namespaceObject.createElement)(Provider, {
       
   775     value: keyboardShortcuts
       
   776   }, (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, props, {
       
   777     onKeyDown: onKeyDown
       
   778   })));
       
   779   /* eslint-enable jsx-a11y/no-static-element-interactions */
       
   780 }
       
   781 
       
   782 ;// CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
       
   783 
       
   784 
       
   785 
       
   786 
       
   787 
       
   788 (window.wp = window.wp || {}).keyboardShortcuts = __webpack_exports__;
       
   789 /******/ })()
       
   790 ;