[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> keyboard-shortcuts.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["keyboardShortcuts"] =
   2  /******/ (function(modules) { // webpackBootstrap
   3  /******/     // The module cache
   4  /******/     var installedModules = {};
   5  /******/
   6  /******/     // The require function
   7  /******/ 	function __webpack_require__(moduleId) {
   8  /******/
   9  /******/         // Check if module is in cache
  10  /******/         if(installedModules[moduleId]) {
  11  /******/             return installedModules[moduleId].exports;
  12  /******/         }
  13  /******/         // Create a new module (and put it into the cache)
  14  /******/         var module = installedModules[moduleId] = {
  15  /******/             i: moduleId,
  16  /******/             l: false,
  17  /******/             exports: {}
  18  /******/         };
  19  /******/
  20  /******/         // Execute the module function
  21  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22  /******/
  23  /******/         // Flag the module as loaded
  24  /******/         module.l = true;
  25  /******/
  26  /******/         // Return the exports of the module
  27  /******/         return module.exports;
  28  /******/     }
  29  /******/
  30  /******/
  31  /******/     // expose the modules object (__webpack_modules__)
  32  /******/     __webpack_require__.m = modules;
  33  /******/
  34  /******/     // expose the module cache
  35  /******/     __webpack_require__.c = installedModules;
  36  /******/
  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 = 439);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 18:
  91  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  92  
  93  "use strict";
  94  
  95  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
  96  function _arrayWithoutHoles(arr) {
  97    if (Array.isArray(arr)) {
  98      for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
  99        arr2[i] = arr[i];
 100      }
 101  
 102      return arr2;
 103    }
 104  }
 105  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 106  var iterableToArray = __webpack_require__(32);
 107  
 108  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 109  function _nonIterableSpread() {
 110    throw new TypeError("Invalid attempt to spread non-iterable instance");
 111  }
 112  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 113  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
 114  
 115  
 116  
 117  function _toConsumableArray(arr) {
 118    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 119  }
 120  
 121  /***/ }),
 122  
 123  /***/ 2:
 124  /***/ (function(module, exports) {
 125  
 126  (function() { module.exports = this["lodash"]; }());
 127  
 128  /***/ }),
 129  
 130  /***/ 21:
 131  /***/ (function(module, exports) {
 132  
 133  (function() { module.exports = this["wp"]["keycodes"]; }());
 134  
 135  /***/ }),
 136  
 137  /***/ 22:
 138  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 139  
 140  "use strict";
 141  
 142  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 143  var arrayWithHoles = __webpack_require__(36);
 144  
 145  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 146  function _iterableToArrayLimit(arr, i) {
 147    if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
 148      return;
 149    }
 150  
 151    var _arr = [];
 152    var _n = true;
 153    var _d = false;
 154    var _e = undefined;
 155  
 156    try {
 157      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 158        _arr.push(_s.value);
 159  
 160        if (i && _arr.length === i) break;
 161      }
 162    } catch (err) {
 163      _d = true;
 164      _e = err;
 165    } finally {
 166      try {
 167        if (!_n && _i["return"] != null) _i["return"]();
 168      } finally {
 169        if (_d) throw _e;
 170      }
 171    }
 172  
 173    return _arr;
 174  }
 175  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 176  var nonIterableRest = __webpack_require__(37);
 177  
 178  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 179  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
 180  
 181  
 182  
 183  function _slicedToArray(arr, i) {
 184    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(nonIterableRest["a" /* default */])();
 185  }
 186  
 187  /***/ }),
 188  
 189  /***/ 32:
 190  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 191  
 192  "use strict";
 193  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 194  function _iterableToArray(iter) {
 195    if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
 196  }
 197  
 198  /***/ }),
 199  
 200  /***/ 36:
 201  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 202  
 203  "use strict";
 204  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 205  function _arrayWithHoles(arr) {
 206    if (Array.isArray(arr)) return arr;
 207  }
 208  
 209  /***/ }),
 210  
 211  /***/ 37:
 212  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 213  
 214  "use strict";
 215  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 216  function _nonIterableRest() {
 217    throw new TypeError("Invalid attempt to destructure non-iterable instance");
 218  }
 219  
 220  /***/ }),
 221  
 222  /***/ 38:
 223  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 224  
 225  "use strict";
 226  
 227  
 228  var LEAF_KEY, hasWeakMap;
 229  
 230  /**
 231   * Arbitrary value used as key for referencing cache object in WeakMap tree.
 232   *
 233   * @type {Object}
 234   */
 235  LEAF_KEY = {};
 236  
 237  /**
 238   * Whether environment supports WeakMap.
 239   *
 240   * @type {boolean}
 241   */
 242  hasWeakMap = typeof WeakMap !== 'undefined';
 243  
 244  /**
 245   * Returns the first argument as the sole entry in an array.
 246   *
 247   * @param {*} value Value to return.
 248   *
 249   * @return {Array} Value returned as entry in array.
 250   */
 251  function arrayOf( value ) {
 252      return [ value ];
 253  }
 254  
 255  /**
 256   * Returns true if the value passed is object-like, or false otherwise. A value
 257   * is object-like if it can support property assignment, e.g. object or array.
 258   *
 259   * @param {*} value Value to test.
 260   *
 261   * @return {boolean} Whether value is object-like.
 262   */
 263  function isObjectLike( value ) {
 264      return !! value && 'object' === typeof value;
 265  }
 266  
 267  /**
 268   * Creates and returns a new cache object.
 269   *
 270   * @return {Object} Cache object.
 271   */
 272  function createCache() {
 273      var cache = {
 274          clear: function() {
 275              cache.head = null;
 276          },
 277      };
 278  
 279      return cache;
 280  }
 281  
 282  /**
 283   * Returns true if entries within the two arrays are strictly equal by
 284   * reference from a starting index.
 285   *
 286   * @param {Array}  a         First array.
 287   * @param {Array}  b         Second array.
 288   * @param {number} fromIndex Index from which to start comparison.
 289   *
 290   * @return {boolean} Whether arrays are shallowly equal.
 291   */
 292  function isShallowEqual( a, b, fromIndex ) {
 293      var i;
 294  
 295      if ( a.length !== b.length ) {
 296          return false;
 297      }
 298  
 299      for ( i = fromIndex; i < a.length; i++ ) {
 300          if ( a[ i ] !== b[ i ] ) {
 301              return false;
 302          }
 303      }
 304  
 305      return true;
 306  }
 307  
 308  /**
 309   * Returns a memoized selector function. The getDependants function argument is
 310   * called before the memoized selector and is expected to return an immutable
 311   * reference or array of references on which the selector depends for computing
 312   * its own return value. The memoize cache is preserved only as long as those
 313   * dependant references remain the same. If getDependants returns a different
 314   * reference(s), the cache is cleared and the selector value regenerated.
 315   *
 316   * @param {Function} selector      Selector function.
 317   * @param {Function} getDependants Dependant getter returning an immutable
 318   *                                 reference or array of reference used in
 319   *                                 cache bust consideration.
 320   *
 321   * @return {Function} Memoized selector.
 322   */
 323  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
 324      var rootCache, getCache;
 325  
 326      // Use object source as dependant if getter not provided
 327      if ( ! getDependants ) {
 328          getDependants = arrayOf;
 329      }
 330  
 331      /**
 332       * Returns the root cache. If WeakMap is supported, this is assigned to the
 333       * root WeakMap cache set, otherwise it is a shared instance of the default
 334       * cache object.
 335       *
 336       * @return {(WeakMap|Object)} Root cache object.
 337       */
 338  	function getRootCache() {
 339          return rootCache;
 340      }
 341  
 342      /**
 343       * Returns the cache for a given dependants array. When possible, a WeakMap
 344       * will be used to create a unique cache for each set of dependants. This
 345       * is feasible due to the nature of WeakMap in allowing garbage collection
 346       * to occur on entries where the key object is no longer referenced. Since
 347       * WeakMap requires the key to be an object, this is only possible when the
 348       * dependant is object-like. The root cache is created as a hierarchy where
 349       * each top-level key is the first entry in a dependants set, the value a
 350       * WeakMap where each key is the next dependant, and so on. This continues
 351       * so long as the dependants are object-like. If no dependants are object-
 352       * like, then the cache is shared across all invocations.
 353       *
 354       * @see isObjectLike
 355       *
 356       * @param {Array} dependants Selector dependants.
 357       *
 358       * @return {Object} Cache object.
 359       */
 360  	function getWeakMapCache( dependants ) {
 361          var caches = rootCache,
 362              isUniqueByDependants = true,
 363              i, dependant, map, cache;
 364  
 365          for ( i = 0; i < dependants.length; i++ ) {
 366              dependant = dependants[ i ];
 367  
 368              // Can only compose WeakMap from object-like key.
 369              if ( ! isObjectLike( dependant ) ) {
 370                  isUniqueByDependants = false;
 371                  break;
 372              }
 373  
 374              // Does current segment of cache already have a WeakMap?
 375              if ( caches.has( dependant ) ) {
 376                  // Traverse into nested WeakMap.
 377                  caches = caches.get( dependant );
 378              } else {
 379                  // Create, set, and traverse into a new one.
 380                  map = new WeakMap();
 381                  caches.set( dependant, map );
 382                  caches = map;
 383              }
 384          }
 385  
 386          // We use an arbitrary (but consistent) object as key for the last item
 387          // in the WeakMap to serve as our running cache.
 388          if ( ! caches.has( LEAF_KEY ) ) {
 389              cache = createCache();
 390              cache.isUniqueByDependants = isUniqueByDependants;
 391              caches.set( LEAF_KEY, cache );
 392          }
 393  
 394          return caches.get( LEAF_KEY );
 395      }
 396  
 397      // Assign cache handler by availability of WeakMap
 398      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
 399  
 400      /**
 401       * Resets root memoization cache.
 402       */
 403  	function clear() {
 404          rootCache = hasWeakMap ? new WeakMap() : createCache();
 405      }
 406  
 407      // eslint-disable-next-line jsdoc/check-param-names
 408      /**
 409       * The augmented selector call, considering first whether dependants have
 410       * changed before passing it to underlying memoize function.
 411       *
 412       * @param {Object} source    Source object for derivation.
 413       * @param {...*}   extraArgs Additional arguments to pass to selector.
 414       *
 415       * @return {*} Selector result.
 416       */
 417  	function callSelector( /* source, ...extraArgs */ ) {
 418          var len = arguments.length,
 419              cache, node, i, args, dependants;
 420  
 421          // Create copy of arguments (avoid leaking deoptimization).
 422          args = new Array( len );
 423          for ( i = 0; i < len; i++ ) {
 424              args[ i ] = arguments[ i ];
 425          }
 426  
 427          dependants = getDependants.apply( null, args );
 428          cache = getCache( dependants );
 429  
 430          // If not guaranteed uniqueness by dependants (primitive type or lack
 431          // of WeakMap support), shallow compare against last dependants and, if
 432          // references have changed, destroy cache to recalculate result.
 433          if ( ! cache.isUniqueByDependants ) {
 434              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
 435                  cache.clear();
 436              }
 437  
 438              cache.lastDependants = dependants;
 439          }
 440  
 441          node = cache.head;
 442          while ( node ) {
 443              // Check whether node arguments match arguments
 444              if ( ! isShallowEqual( node.args, args, 1 ) ) {
 445                  node = node.next;
 446                  continue;
 447              }
 448  
 449              // At this point we can assume we've found a match
 450  
 451              // Surface matched node to head if not already
 452              if ( node !== cache.head ) {
 453                  // Adjust siblings to point to each other.
 454                  node.prev.next = node.next;
 455                  if ( node.next ) {
 456                      node.next.prev = node.prev;
 457                  }
 458  
 459                  node.next = cache.head;
 460                  node.prev = null;
 461                  cache.head.prev = node;
 462                  cache.head = node;
 463              }
 464  
 465              // Return immediately
 466              return node.val;
 467          }
 468  
 469          // No cached value found. Continue to insertion phase:
 470  
 471          node = {
 472              // Generate the result from original function
 473              val: selector.apply( null, args ),
 474          };
 475  
 476          // Avoid including the source object in the cache.
 477          args[ 0 ] = null;
 478          node.args = args;
 479  
 480          // Don't need to check whether node is already head, since it would
 481          // have been returned above already if it was
 482  
 483          // Shift existing head down list
 484          if ( cache.head ) {
 485              cache.head.prev = node;
 486              node.next = cache.head;
 487          }
 488  
 489          cache.head = node;
 490  
 491          return node.val;
 492      }
 493  
 494      callSelector.getDependants = getDependants;
 495      callSelector.clear = clear;
 496      clear();
 497  
 498      return callSelector;
 499  });
 500  
 501  
 502  /***/ }),
 503  
 504  /***/ 4:
 505  /***/ (function(module, exports) {
 506  
 507  (function() { module.exports = this["wp"]["data"]; }());
 508  
 509  /***/ }),
 510  
 511  /***/ 439:
 512  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 513  
 514  "use strict";
 515  __webpack_require__.r(__webpack_exports__);
 516  var actions_namespaceObject = {};
 517  __webpack_require__.r(actions_namespaceObject);
 518  __webpack_require__.d(actions_namespaceObject, "registerShortcut", function() { return registerShortcut; });
 519  __webpack_require__.d(actions_namespaceObject, "unregisterShortcut", function() { return unregisterShortcut; });
 520  var selectors_namespaceObject = {};
 521  __webpack_require__.r(selectors_namespaceObject);
 522  __webpack_require__.d(selectors_namespaceObject, "getShortcutKeyCombination", function() { return getShortcutKeyCombination; });
 523  __webpack_require__.d(selectors_namespaceObject, "getShortcutRepresentation", function() { return getShortcutRepresentation; });
 524  __webpack_require__.d(selectors_namespaceObject, "getShortcutDescription", function() { return getShortcutDescription; });
 525  __webpack_require__.d(selectors_namespaceObject, "getShortcutAliases", function() { return getShortcutAliases; });
 526  __webpack_require__.d(selectors_namespaceObject, "getAllShortcutRawKeyCombinations", function() { return getAllShortcutRawKeyCombinations; });
 527  __webpack_require__.d(selectors_namespaceObject, "getCategoryShortcuts", function() { return getCategoryShortcuts; });
 528  
 529  // EXTERNAL MODULE: external {"this":["wp","data"]}
 530  var external_this_wp_data_ = __webpack_require__(4);
 531  
 532  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 533  var defineProperty = __webpack_require__(5);
 534  
 535  // EXTERNAL MODULE: external {"this":"lodash"}
 536  var external_this_lodash_ = __webpack_require__(2);
 537  
 538  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/reducer.js
 539  
 540  
 541  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 542  
 543  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 544  
 545  /**
 546   * External dependencies
 547   */
 548  
 549  /**
 550   * Reducer returning the registered shortcuts
 551   *
 552   * @param {Object} state  Current state.
 553   * @param {Object} action Dispatched action.
 554   *
 555   * @return {Object} Updated state.
 556   */
 557  
 558  function reducer() {
 559    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 560    var action = arguments.length > 1 ? arguments[1] : undefined;
 561  
 562    switch (action.type) {
 563      case 'REGISTER_SHORTCUT':
 564        return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.name, {
 565          category: action.category,
 566          keyCombination: action.keyCombination,
 567          aliases: action.aliases,
 568          description: action.description
 569        }));
 570  
 571      case 'UNREGISTER_SHORTCUT':
 572        return Object(external_this_lodash_["omit"])(state, action.name);
 573    }
 574  
 575    return state;
 576  }
 577  
 578  /* harmony default export */ var store_reducer = (reducer);
 579  
 580  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/actions.js
 581  /** @typedef {import('@wordpress/keycodes').WPKeycodeModifier} WPKeycodeModifier */
 582  
 583  /**
 584   * Keyboard key combination.
 585   *
 586   * @typedef {Object} WPShortcutKeyCombination
 587   *
 588   * @property {string}                      character Character.
 589   * @property {WPKeycodeModifier|undefined} modifier  Modifier.
 590   */
 591  
 592  /**
 593   * Configuration of a registered keyboard shortcut.
 594   *
 595   * @typedef {Object} WPShortcutConfig
 596   *
 597   * @property {string}                     name           Shortcut name.
 598   * @property {string}                     category       Shortcut category.
 599   * @property {string}                     description    Shortcut description.
 600   * @property {WPShortcutKeyCombination}   keyCombination Shortcut key combination.
 601   * @property {WPShortcutKeyCombination[]} [aliases]      Shortcut aliases.
 602   */
 603  
 604  /**
 605   * Returns an action object used to register a new keyboard shortcut.
 606   *
 607   * @param {WPShortcutConfig} config Shortcut config.
 608   *
 609   * @return {Object} action.
 610   */
 611  function registerShortcut(_ref) {
 612    var name = _ref.name,
 613        category = _ref.category,
 614        description = _ref.description,
 615        keyCombination = _ref.keyCombination,
 616        aliases = _ref.aliases;
 617    return {
 618      type: 'REGISTER_SHORTCUT',
 619      name: name,
 620      category: category,
 621      keyCombination: keyCombination,
 622      aliases: aliases,
 623      description: description
 624    };
 625  }
 626  /**
 627   * Returns an action object used to unregister a keyboard shortcut.
 628   *
 629   * @param {string} name Shortcut name.
 630   *
 631   * @return {Object} action.
 632   */
 633  
 634  function unregisterShortcut(name) {
 635    return {
 636      type: 'UNREGISTER_SHORTCUT',
 637      name: name
 638    };
 639  }
 640  
 641  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
 642  var slicedToArray = __webpack_require__(22);
 643  
 644  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 645  var toConsumableArray = __webpack_require__(18);
 646  
 647  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
 648  var rememo = __webpack_require__(38);
 649  
 650  // EXTERNAL MODULE: external {"this":["wp","keycodes"]}
 651  var external_this_wp_keycodes_ = __webpack_require__(21);
 652  
 653  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/selectors.js
 654  
 655  
 656  
 657  /**
 658   * External dependencies
 659   */
 660  
 661  
 662  /**
 663   * WordPress dependencies
 664   */
 665  
 666  
 667  /** @typedef {import('./actions').WPShortcutKeyCombination} WPShortcutKeyCombination */
 668  
 669  /** @typedef {import('@wordpress/keycodes').WPKeycodeHandlerByModifier} WPKeycodeHandlerByModifier */
 670  
 671  /**
 672   * Shared reference to an empty array for cases where it is important to avoid
 673   * returning a new array reference on every invocation.
 674   *
 675   * @type {Array<any>}
 676   */
 677  
 678  var EMPTY_ARRAY = [];
 679  /**
 680   * Shortcut formatting methods.
 681   *
 682   * @property {WPKeycodeHandlerByModifier} display     Display formatting.
 683   * @property {WPKeycodeHandlerByModifier} rawShortcut Raw shortcut formatting.
 684   * @property {WPKeycodeHandlerByModifier} ariaLabel   ARIA label formatting.
 685   */
 686  
 687  var FORMATTING_METHODS = {
 688    display: external_this_wp_keycodes_["displayShortcut"],
 689    raw: external_this_wp_keycodes_["rawShortcut"],
 690    ariaLabel: external_this_wp_keycodes_["shortcutAriaLabel"]
 691  };
 692  /**
 693   * Returns a string representing the key combination.
 694   *
 695   * @param {?WPShortcutKeyCombination} shortcut       Key combination.
 696   * @param {keyof FORMATTING_METHODS}  representation Type of representation
 697   *                                                   (display, raw, ariaLabel).
 698   *
 699   * @return {string?} Shortcut representation.
 700   */
 701  
 702  function getKeyCombinationRepresentation(shortcut, representation) {
 703    if (!shortcut) {
 704      return null;
 705    }
 706  
 707    return shortcut.modifier ? FORMATTING_METHODS[representation][shortcut.modifier](shortcut.character) : shortcut.character;
 708  }
 709  /**
 710   * Returns the main key combination for a given shortcut name.
 711   *
 712   * @param {Object} state Global state.
 713   * @param {string} name  Shortcut name.
 714   *
 715   * @return {WPShortcutKeyCombination?} Key combination.
 716   */
 717  
 718  
 719  function getShortcutKeyCombination(state, name) {
 720    return state[name] ? state[name].keyCombination : null;
 721  }
 722  /**
 723   * Returns a string representing the main key combination for a given shortcut name.
 724   *
 725   * @param {Object}                   state          Global state.
 726   * @param {string}                   name           Shortcut name.
 727   * @param {keyof FORMATTING_METHODS} representation Type of representation
 728   *                                                  (display, raw, ariaLabel).
 729   *
 730   * @return {string?} Shortcut representation.
 731   */
 732  
 733  function getShortcutRepresentation(state, name) {
 734    var representation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'display';
 735    var shortcut = getShortcutKeyCombination(state, name);
 736    return getKeyCombinationRepresentation(shortcut, representation);
 737  }
 738  /**
 739   * Returns the shortcut description given its name.
 740   *
 741   * @param {Object} state Global state.
 742   * @param {string} name  Shortcut name.
 743   *
 744   * @return {string?} Shortcut description.
 745   */
 746  
 747  function getShortcutDescription(state, name) {
 748    return state[name] ? state[name].description : null;
 749  }
 750  /**
 751   * Returns the aliases for a given shortcut name.
 752   *
 753   * @param {Object} state Global state.
 754   * @param {string} name  Shortcut name.
 755   *
 756   * @return {WPShortcutKeyCombination[]} Key combinations.
 757   */
 758  
 759  function getShortcutAliases(state, name) {
 760    return state[name] && state[name].aliases ? state[name].aliases : EMPTY_ARRAY;
 761  }
 762  /**
 763   * Returns the raw representation of all the keyboard combinations of a given shortcut name.
 764   *
 765   * @param {Object} state Global state.
 766   * @param {string} name  Shortcut name.
 767   *
 768   * @return {string[]} Shortcuts.
 769   */
 770  
 771  var getAllShortcutRawKeyCombinations = Object(rememo["a" /* default */])(function (state, name) {
 772    return Object(external_this_lodash_["compact"])([getKeyCombinationRepresentation(getShortcutKeyCombination(state, name), 'raw')].concat(Object(toConsumableArray["a" /* default */])(getShortcutAliases(state, name).map(function (combination) {
 773      return getKeyCombinationRepresentation(combination, 'raw');
 774    }))));
 775  }, function (state, name) {
 776    return [state[name]];
 777  });
 778  /**
 779   * Returns the shortcut names list for a given category name.
 780   *
 781   * @param {Object} state Global state.
 782   * @param {string} name  Category name.
 783   *
 784   * @return {string[]} Shortcut names.
 785   */
 786  
 787  var getCategoryShortcuts = Object(rememo["a" /* default */])(function (state, categoryName) {
 788    return Object.entries(state).filter(function (_ref) {
 789      var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
 790          shortcut = _ref2[1];
 791  
 792      return shortcut.category === categoryName;
 793    }).map(function (_ref3) {
 794      var _ref4 = Object(slicedToArray["a" /* default */])(_ref3, 1),
 795          name = _ref4[0];
 796  
 797      return name;
 798    });
 799  }, function (state) {
 800    return [state];
 801  });
 802  
 803  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/store/index.js
 804  /**
 805   * WordPress dependencies
 806   */
 807  
 808  /**
 809   * Internal dependencies
 810   */
 811  
 812  
 813  
 814  
 815  /* harmony default export */ var store = (Object(external_this_wp_data_["registerStore"])('core/keyboard-shortcuts', {
 816    reducer: store_reducer,
 817    actions: actions_namespaceObject,
 818    selectors: selectors_namespaceObject
 819  }));
 820  
 821  // EXTERNAL MODULE: external {"this":["wp","compose"]}
 822  var external_this_wp_compose_ = __webpack_require__(8);
 823  
 824  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/hooks/use-shortcut.js
 825  /**
 826   * WordPress dependencies
 827   */
 828  
 829  
 830  /**
 831   * Attach a keyboard shortcut handler.
 832   *
 833   * @param {string} name       Shortcut name.
 834   * @param {Function} callback Shortcut callback.
 835   * @param {Object} options    Shortcut options.
 836   */
 837  
 838  function useShortcut(name, callback, options) {
 839    var shortcuts = Object(external_this_wp_data_["useSelect"])(function (select) {
 840      return select('core/keyboard-shortcuts').getAllShortcutRawKeyCombinations(name);
 841    }, [name]);
 842    Object(external_this_wp_compose_["useKeyboardShortcut"])(shortcuts, callback, options);
 843  }
 844  
 845  /* harmony default export */ var use_shortcut = (useShortcut);
 846  
 847  // CONCATENATED MODULE: ./node_modules/@wordpress/keyboard-shortcuts/build-module/index.js
 848  /* concated harmony reexport useShortcut */__webpack_require__.d(__webpack_exports__, "useShortcut", function() { return use_shortcut; });
 849  /**
 850   * Internal dependencies
 851   */
 852  
 853  
 854  
 855  
 856  /***/ }),
 857  
 858  /***/ 5:
 859  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 860  
 861  "use strict";
 862  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
 863  function _defineProperty(obj, key, value) {
 864    if (key in obj) {
 865      Object.defineProperty(obj, key, {
 866        value: value,
 867        enumerable: true,
 868        configurable: true,
 869        writable: true
 870      });
 871    } else {
 872      obj[key] = value;
 873    }
 874  
 875    return obj;
 876  }
 877  
 878  /***/ }),
 879  
 880  /***/ 8:
 881  /***/ (function(module, exports) {
 882  
 883  (function() { module.exports = this["wp"]["compose"]; }());
 884  
 885  /***/ })
 886  
 887  /******/ });


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref