[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> core-data.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["coreData"] =
   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 = 428);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 10:
  98  /***/ (function(module, exports) {
  99  
 100  (function() { module.exports = this["wp"]["blocks"]; }());
 101  
 102  /***/ }),
 103  
 104  /***/ 18:
 105  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 106  
 107  "use strict";
 108  
 109  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 110  var arrayLikeToArray = __webpack_require__(25);
 111  
 112  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 113  
 114  function _arrayWithoutHoles(arr) {
 115    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 116  }
 117  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 118  var iterableToArray = __webpack_require__(35);
 119  
 120  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 121  var unsupportedIterableToArray = __webpack_require__(27);
 122  
 123  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 124  function _nonIterableSpread() {
 125    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 126  }
 127  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 128  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
 129  
 130  
 131  
 132  
 133  function _toConsumableArray(arr) {
 134    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 135  }
 136  
 137  /***/ }),
 138  
 139  /***/ 2:
 140  /***/ (function(module, exports) {
 141  
 142  (function() { module.exports = this["lodash"]; }());
 143  
 144  /***/ }),
 145  
 146  /***/ 20:
 147  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 148  
 149  "use strict";
 150  
 151  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 152  var arrayWithHoles = __webpack_require__(38);
 153  
 154  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 155  function _iterableToArrayLimit(arr, i) {
 156    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 157    var _arr = [];
 158    var _n = true;
 159    var _d = false;
 160    var _e = undefined;
 161  
 162    try {
 163      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 164        _arr.push(_s.value);
 165  
 166        if (i && _arr.length === i) break;
 167      }
 168    } catch (err) {
 169      _d = true;
 170      _e = err;
 171    } finally {
 172      try {
 173        if (!_n && _i["return"] != null) _i["return"]();
 174      } finally {
 175        if (_d) throw _e;
 176      }
 177    }
 178  
 179    return _arr;
 180  }
 181  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 182  var unsupportedIterableToArray = __webpack_require__(27);
 183  
 184  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 185  var nonIterableRest = __webpack_require__(39);
 186  
 187  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 188  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
 189  
 190  
 191  
 192  
 193  function _slicedToArray(arr, i) {
 194    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 195  }
 196  
 197  /***/ }),
 198  
 199  /***/ 23:
 200  /***/ (function(module, exports) {
 201  
 202  (function() { module.exports = this["regeneratorRuntime"]; }());
 203  
 204  /***/ }),
 205  
 206  /***/ 25:
 207  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 208  
 209  "use strict";
 210  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 211  function _arrayLikeToArray(arr, len) {
 212    if (len == null || len > arr.length) len = arr.length;
 213  
 214    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 215      arr2[i] = arr[i];
 216    }
 217  
 218    return arr2;
 219  }
 220  
 221  /***/ }),
 222  
 223  /***/ 27:
 224  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 225  
 226  "use strict";
 227  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
 228  /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
 229  
 230  function _unsupportedIterableToArray(o, minLen) {
 231    if (!o) return;
 232    if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 233    var n = Object.prototype.toString.call(o).slice(8, -1);
 234    if (n === "Object" && o.constructor) n = o.constructor.name;
 235    if (n === "Map" || n === "Set") return Array.from(n);
 236    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
 237  }
 238  
 239  /***/ }),
 240  
 241  /***/ 30:
 242  /***/ (function(module, exports) {
 243  
 244  (function() { module.exports = this["wp"]["url"]; }());
 245  
 246  /***/ }),
 247  
 248  /***/ 35:
 249  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 250  
 251  "use strict";
 252  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
 253  function _iterableToArray(iter) {
 254    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
 255  }
 256  
 257  /***/ }),
 258  
 259  /***/ 37:
 260  /***/ (function(module, exports) {
 261  
 262  (function() { module.exports = this["wp"]["deprecated"]; }());
 263  
 264  /***/ }),
 265  
 266  /***/ 38:
 267  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 268  
 269  "use strict";
 270  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
 271  function _arrayWithHoles(arr) {
 272    if (Array.isArray(arr)) return arr;
 273  }
 274  
 275  /***/ }),
 276  
 277  /***/ 39:
 278  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 279  
 280  "use strict";
 281  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
 282  function _nonIterableRest() {
 283    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 284  }
 285  
 286  /***/ }),
 287  
 288  /***/ 4:
 289  /***/ (function(module, exports) {
 290  
 291  (function() { module.exports = this["wp"]["data"]; }());
 292  
 293  /***/ }),
 294  
 295  /***/ 40:
 296  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 297  
 298  "use strict";
 299  
 300  
 301  var LEAF_KEY, hasWeakMap;
 302  
 303  /**
 304   * Arbitrary value used as key for referencing cache object in WeakMap tree.
 305   *
 306   * @type {Object}
 307   */
 308  LEAF_KEY = {};
 309  
 310  /**
 311   * Whether environment supports WeakMap.
 312   *
 313   * @type {boolean}
 314   */
 315  hasWeakMap = typeof WeakMap !== 'undefined';
 316  
 317  /**
 318   * Returns the first argument as the sole entry in an array.
 319   *
 320   * @param {*} value Value to return.
 321   *
 322   * @return {Array} Value returned as entry in array.
 323   */
 324  function arrayOf( value ) {
 325      return [ value ];
 326  }
 327  
 328  /**
 329   * Returns true if the value passed is object-like, or false otherwise. A value
 330   * is object-like if it can support property assignment, e.g. object or array.
 331   *
 332   * @param {*} value Value to test.
 333   *
 334   * @return {boolean} Whether value is object-like.
 335   */
 336  function isObjectLike( value ) {
 337      return !! value && 'object' === typeof value;
 338  }
 339  
 340  /**
 341   * Creates and returns a new cache object.
 342   *
 343   * @return {Object} Cache object.
 344   */
 345  function createCache() {
 346      var cache = {
 347          clear: function() {
 348              cache.head = null;
 349          },
 350      };
 351  
 352      return cache;
 353  }
 354  
 355  /**
 356   * Returns true if entries within the two arrays are strictly equal by
 357   * reference from a starting index.
 358   *
 359   * @param {Array}  a         First array.
 360   * @param {Array}  b         Second array.
 361   * @param {number} fromIndex Index from which to start comparison.
 362   *
 363   * @return {boolean} Whether arrays are shallowly equal.
 364   */
 365  function isShallowEqual( a, b, fromIndex ) {
 366      var i;
 367  
 368      if ( a.length !== b.length ) {
 369          return false;
 370      }
 371  
 372      for ( i = fromIndex; i < a.length; i++ ) {
 373          if ( a[ i ] !== b[ i ] ) {
 374              return false;
 375          }
 376      }
 377  
 378      return true;
 379  }
 380  
 381  /**
 382   * Returns a memoized selector function. The getDependants function argument is
 383   * called before the memoized selector and is expected to return an immutable
 384   * reference or array of references on which the selector depends for computing
 385   * its own return value. The memoize cache is preserved only as long as those
 386   * dependant references remain the same. If getDependants returns a different
 387   * reference(s), the cache is cleared and the selector value regenerated.
 388   *
 389   * @param {Function} selector      Selector function.
 390   * @param {Function} getDependants Dependant getter returning an immutable
 391   *                                 reference or array of reference used in
 392   *                                 cache bust consideration.
 393   *
 394   * @return {Function} Memoized selector.
 395   */
 396  /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
 397      var rootCache, getCache;
 398  
 399      // Use object source as dependant if getter not provided
 400      if ( ! getDependants ) {
 401          getDependants = arrayOf;
 402      }
 403  
 404      /**
 405       * Returns the root cache. If WeakMap is supported, this is assigned to the
 406       * root WeakMap cache set, otherwise it is a shared instance of the default
 407       * cache object.
 408       *
 409       * @return {(WeakMap|Object)} Root cache object.
 410       */
 411  	function getRootCache() {
 412          return rootCache;
 413      }
 414  
 415      /**
 416       * Returns the cache for a given dependants array. When possible, a WeakMap
 417       * will be used to create a unique cache for each set of dependants. This
 418       * is feasible due to the nature of WeakMap in allowing garbage collection
 419       * to occur on entries where the key object is no longer referenced. Since
 420       * WeakMap requires the key to be an object, this is only possible when the
 421       * dependant is object-like. The root cache is created as a hierarchy where
 422       * each top-level key is the first entry in a dependants set, the value a
 423       * WeakMap where each key is the next dependant, and so on. This continues
 424       * so long as the dependants are object-like. If no dependants are object-
 425       * like, then the cache is shared across all invocations.
 426       *
 427       * @see isObjectLike
 428       *
 429       * @param {Array} dependants Selector dependants.
 430       *
 431       * @return {Object} Cache object.
 432       */
 433  	function getWeakMapCache( dependants ) {
 434          var caches = rootCache,
 435              isUniqueByDependants = true,
 436              i, dependant, map, cache;
 437  
 438          for ( i = 0; i < dependants.length; i++ ) {
 439              dependant = dependants[ i ];
 440  
 441              // Can only compose WeakMap from object-like key.
 442              if ( ! isObjectLike( dependant ) ) {
 443                  isUniqueByDependants = false;
 444                  break;
 445              }
 446  
 447              // Does current segment of cache already have a WeakMap?
 448              if ( caches.has( dependant ) ) {
 449                  // Traverse into nested WeakMap.
 450                  caches = caches.get( dependant );
 451              } else {
 452                  // Create, set, and traverse into a new one.
 453                  map = new WeakMap();
 454                  caches.set( dependant, map );
 455                  caches = map;
 456              }
 457          }
 458  
 459          // We use an arbitrary (but consistent) object as key for the last item
 460          // in the WeakMap to serve as our running cache.
 461          if ( ! caches.has( LEAF_KEY ) ) {
 462              cache = createCache();
 463              cache.isUniqueByDependants = isUniqueByDependants;
 464              caches.set( LEAF_KEY, cache );
 465          }
 466  
 467          return caches.get( LEAF_KEY );
 468      }
 469  
 470      // Assign cache handler by availability of WeakMap
 471      getCache = hasWeakMap ? getWeakMapCache : getRootCache;
 472  
 473      /**
 474       * Resets root memoization cache.
 475       */
 476  	function clear() {
 477          rootCache = hasWeakMap ? new WeakMap() : createCache();
 478      }
 479  
 480      // eslint-disable-next-line jsdoc/check-param-names
 481      /**
 482       * The augmented selector call, considering first whether dependants have
 483       * changed before passing it to underlying memoize function.
 484       *
 485       * @param {Object} source    Source object for derivation.
 486       * @param {...*}   extraArgs Additional arguments to pass to selector.
 487       *
 488       * @return {*} Selector result.
 489       */
 490  	function callSelector( /* source, ...extraArgs */ ) {
 491          var len = arguments.length,
 492              cache, node, i, args, dependants;
 493  
 494          // Create copy of arguments (avoid leaking deoptimization).
 495          args = new Array( len );
 496          for ( i = 0; i < len; i++ ) {
 497              args[ i ] = arguments[ i ];
 498          }
 499  
 500          dependants = getDependants.apply( null, args );
 501          cache = getCache( dependants );
 502  
 503          // If not guaranteed uniqueness by dependants (primitive type or lack
 504          // of WeakMap support), shallow compare against last dependants and, if
 505          // references have changed, destroy cache to recalculate result.
 506          if ( ! cache.isUniqueByDependants ) {
 507              if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
 508                  cache.clear();
 509              }
 510  
 511              cache.lastDependants = dependants;
 512          }
 513  
 514          node = cache.head;
 515          while ( node ) {
 516              // Check whether node arguments match arguments
 517              if ( ! isShallowEqual( node.args, args, 1 ) ) {
 518                  node = node.next;
 519                  continue;
 520              }
 521  
 522              // At this point we can assume we've found a match
 523  
 524              // Surface matched node to head if not already
 525              if ( node !== cache.head ) {
 526                  // Adjust siblings to point to each other.
 527                  node.prev.next = node.next;
 528                  if ( node.next ) {
 529                      node.next.prev = node.prev;
 530                  }
 531  
 532                  node.next = cache.head;
 533                  node.prev = null;
 534                  cache.head.prev = node;
 535                  cache.head = node;
 536              }
 537  
 538              // Return immediately
 539              return node.val;
 540          }
 541  
 542          // No cached value found. Continue to insertion phase:
 543  
 544          node = {
 545              // Generate the result from original function
 546              val: selector.apply( null, args ),
 547          };
 548  
 549          // Avoid including the source object in the cache.
 550          args[ 0 ] = null;
 551          node.args = args;
 552  
 553          // Don't need to check whether node is already head, since it would
 554          // have been returned above already if it was
 555  
 556          // Shift existing head down list
 557          if ( cache.head ) {
 558              cache.head.prev = node;
 559              node.next = cache.head;
 560          }
 561  
 562          cache.head = node;
 563  
 564          return node.val;
 565      }
 566  
 567      callSelector.getDependants = getDependants;
 568      callSelector.clear = clear;
 569      clear();
 570  
 571      return callSelector;
 572  });
 573  
 574  
 575  /***/ }),
 576  
 577  /***/ 42:
 578  /***/ (function(module, exports) {
 579  
 580  (function() { module.exports = this["wp"]["apiFetch"]; }());
 581  
 582  /***/ }),
 583  
 584  /***/ 428:
 585  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 586  
 587  "use strict";
 588  __webpack_require__.r(__webpack_exports__);
 589  var build_module_actions_namespaceObject = {};
 590  __webpack_require__.r(build_module_actions_namespaceObject);
 591  __webpack_require__.d(build_module_actions_namespaceObject, "receiveUserQuery", function() { return receiveUserQuery; });
 592  __webpack_require__.d(build_module_actions_namespaceObject, "receiveCurrentUser", function() { return receiveCurrentUser; });
 593  __webpack_require__.d(build_module_actions_namespaceObject, "addEntities", function() { return addEntities; });
 594  __webpack_require__.d(build_module_actions_namespaceObject, "receiveEntityRecords", function() { return receiveEntityRecords; });
 595  __webpack_require__.d(build_module_actions_namespaceObject, "receiveThemeSupports", function() { return receiveThemeSupports; });
 596  __webpack_require__.d(build_module_actions_namespaceObject, "receiveEmbedPreview", function() { return receiveEmbedPreview; });
 597  __webpack_require__.d(build_module_actions_namespaceObject, "editEntityRecord", function() { return actions_editEntityRecord; });
 598  __webpack_require__.d(build_module_actions_namespaceObject, "undo", function() { return undo; });
 599  __webpack_require__.d(build_module_actions_namespaceObject, "redo", function() { return redo; });
 600  __webpack_require__.d(build_module_actions_namespaceObject, "__unstableCreateUndoLevel", function() { return __unstableCreateUndoLevel; });
 601  __webpack_require__.d(build_module_actions_namespaceObject, "saveEntityRecord", function() { return saveEntityRecord; });
 602  __webpack_require__.d(build_module_actions_namespaceObject, "saveEditedEntityRecord", function() { return saveEditedEntityRecord; });
 603  __webpack_require__.d(build_module_actions_namespaceObject, "receiveUploadPermissions", function() { return receiveUploadPermissions; });
 604  __webpack_require__.d(build_module_actions_namespaceObject, "receiveUserPermission", function() { return receiveUserPermission; });
 605  __webpack_require__.d(build_module_actions_namespaceObject, "receiveAutosaves", function() { return receiveAutosaves; });
 606  var build_module_selectors_namespaceObject = {};
 607  __webpack_require__.r(build_module_selectors_namespaceObject);
 608  __webpack_require__.d(build_module_selectors_namespaceObject, "isRequestingEmbedPreview", function() { return isRequestingEmbedPreview; });
 609  __webpack_require__.d(build_module_selectors_namespaceObject, "getAuthors", function() { return getAuthors; });
 610  __webpack_require__.d(build_module_selectors_namespaceObject, "getCurrentUser", function() { return getCurrentUser; });
 611  __webpack_require__.d(build_module_selectors_namespaceObject, "getUserQueryResults", function() { return getUserQueryResults; });
 612  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntitiesByKind", function() { return getEntitiesByKind; });
 613  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntity", function() { return selectors_getEntity; });
 614  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecord", function() { return getEntityRecord; });
 615  __webpack_require__.d(build_module_selectors_namespaceObject, "__experimentalGetEntityRecordNoResolver", function() { return __experimentalGetEntityRecordNoResolver; });
 616  __webpack_require__.d(build_module_selectors_namespaceObject, "getRawEntityRecord", function() { return getRawEntityRecord; });
 617  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecords", function() { return getEntityRecords; });
 618  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecordChangesByRecord", function() { return getEntityRecordChangesByRecord; });
 619  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecordEdits", function() { return getEntityRecordEdits; });
 620  __webpack_require__.d(build_module_selectors_namespaceObject, "getEntityRecordNonTransientEdits", function() { return getEntityRecordNonTransientEdits; });
 621  __webpack_require__.d(build_module_selectors_namespaceObject, "hasEditsForEntityRecord", function() { return hasEditsForEntityRecord; });
 622  __webpack_require__.d(build_module_selectors_namespaceObject, "getEditedEntityRecord", function() { return getEditedEntityRecord; });
 623  __webpack_require__.d(build_module_selectors_namespaceObject, "isAutosavingEntityRecord", function() { return isAutosavingEntityRecord; });
 624  __webpack_require__.d(build_module_selectors_namespaceObject, "isSavingEntityRecord", function() { return isSavingEntityRecord; });
 625  __webpack_require__.d(build_module_selectors_namespaceObject, "getLastEntitySaveError", function() { return getLastEntitySaveError; });
 626  __webpack_require__.d(build_module_selectors_namespaceObject, "getUndoEdit", function() { return getUndoEdit; });
 627  __webpack_require__.d(build_module_selectors_namespaceObject, "getRedoEdit", function() { return getRedoEdit; });
 628  __webpack_require__.d(build_module_selectors_namespaceObject, "hasUndo", function() { return hasUndo; });
 629  __webpack_require__.d(build_module_selectors_namespaceObject, "hasRedo", function() { return hasRedo; });
 630  __webpack_require__.d(build_module_selectors_namespaceObject, "getThemeSupports", function() { return getThemeSupports; });
 631  __webpack_require__.d(build_module_selectors_namespaceObject, "getEmbedPreview", function() { return getEmbedPreview; });
 632  __webpack_require__.d(build_module_selectors_namespaceObject, "isPreviewEmbedFallback", function() { return isPreviewEmbedFallback; });
 633  __webpack_require__.d(build_module_selectors_namespaceObject, "hasUploadPermissions", function() { return hasUploadPermissions; });
 634  __webpack_require__.d(build_module_selectors_namespaceObject, "canUser", function() { return canUser; });
 635  __webpack_require__.d(build_module_selectors_namespaceObject, "getAutosaves", function() { return getAutosaves; });
 636  __webpack_require__.d(build_module_selectors_namespaceObject, "getAutosave", function() { return getAutosave; });
 637  __webpack_require__.d(build_module_selectors_namespaceObject, "hasFetchedAutosaves", function() { return hasFetchedAutosaves; });
 638  __webpack_require__.d(build_module_selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; });
 639  var resolvers_namespaceObject = {};
 640  __webpack_require__.r(resolvers_namespaceObject);
 641  __webpack_require__.d(resolvers_namespaceObject, "getAuthors", function() { return resolvers_getAuthors; });
 642  __webpack_require__.d(resolvers_namespaceObject, "getCurrentUser", function() { return resolvers_getCurrentUser; });
 643  __webpack_require__.d(resolvers_namespaceObject, "getEntityRecord", function() { return resolvers_getEntityRecord; });
 644  __webpack_require__.d(resolvers_namespaceObject, "getEntityRecords", function() { return resolvers_getEntityRecords; });
 645  __webpack_require__.d(resolvers_namespaceObject, "getThemeSupports", function() { return resolvers_getThemeSupports; });
 646  __webpack_require__.d(resolvers_namespaceObject, "getEmbedPreview", function() { return resolvers_getEmbedPreview; });
 647  __webpack_require__.d(resolvers_namespaceObject, "hasUploadPermissions", function() { return resolvers_hasUploadPermissions; });
 648  __webpack_require__.d(resolvers_namespaceObject, "canUser", function() { return resolvers_canUser; });
 649  __webpack_require__.d(resolvers_namespaceObject, "getAutosaves", function() { return resolvers_getAutosaves; });
 650  __webpack_require__.d(resolvers_namespaceObject, "getAutosave", function() { return resolvers_getAutosave; });
 651  
 652  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
 653  var defineProperty = __webpack_require__(5);
 654  
 655  // EXTERNAL MODULE: external {"this":["wp","data"]}
 656  var external_this_wp_data_ = __webpack_require__(4);
 657  
 658  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
 659  var slicedToArray = __webpack_require__(20);
 660  
 661  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
 662  var toConsumableArray = __webpack_require__(18);
 663  
 664  // EXTERNAL MODULE: external {"this":"lodash"}
 665  var external_this_lodash_ = __webpack_require__(2);
 666  
 667  // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
 668  var external_this_wp_isShallowEqual_ = __webpack_require__(51);
 669  var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
 670  
 671  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/conservative-map-item.js
 672  /**
 673   * External dependencies
 674   */
 675  
 676  /**
 677   * Given the current and next item entity, returns the minimally "modified"
 678   * result of the next item, preferring value references from the original item
 679   * if equal. If all values match, the original item is returned.
 680   *
 681   * @param {Object} item     Original item.
 682   * @param {Object} nextItem Next item.
 683   *
 684   * @return {Object} Minimally modified merged item.
 685   */
 686  
 687  function conservativeMapItem(item, nextItem) {
 688    // Return next item in its entirety if there is no original item.
 689    if (!item) {
 690      return nextItem;
 691    }
 692  
 693    var hasChanges = false;
 694    var result = {};
 695  
 696    for (var key in nextItem) {
 697      if (Object(external_this_lodash_["isEqual"])(item[key], nextItem[key])) {
 698        result[key] = item[key];
 699      } else {
 700        hasChanges = true;
 701        result[key] = nextItem[key];
 702      }
 703    }
 704  
 705    if (!hasChanges) {
 706      return item;
 707    }
 708  
 709    return result;
 710  }
 711  
 712  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/if-matching-action.js
 713  /**
 714   * A higher-order reducer creator which invokes the original reducer only if
 715   * the dispatching action matches the given predicate, **OR** if state is
 716   * initializing (undefined).
 717   *
 718   * @param {Function} isMatch Function predicate for allowing reducer call.
 719   *
 720   * @return {Function} Higher-order reducer.
 721   */
 722  var ifMatchingAction = function ifMatchingAction(isMatch) {
 723    return function (reducer) {
 724      return function (state, action) {
 725        if (state === undefined || isMatch(action)) {
 726          return reducer(state, action);
 727        }
 728  
 729        return state;
 730      };
 731    };
 732  };
 733  
 734  /* harmony default export */ var if_matching_action = (ifMatchingAction);
 735  
 736  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/on-sub-key.js
 737  
 738  
 739  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; }
 740  
 741  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; }
 742  
 743  /**
 744   * Higher-order reducer creator which creates a combined reducer object, keyed
 745   * by a property on the action object.
 746   *
 747   * @param {string} actionProperty Action property by which to key object.
 748   *
 749   * @return {Function} Higher-order reducer.
 750   */
 751  var on_sub_key_onSubKey = function onSubKey(actionProperty) {
 752    return function (reducer) {
 753      return function () {
 754        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 755        var action = arguments.length > 1 ? arguments[1] : undefined;
 756        // Retrieve subkey from action. Do not track if undefined; useful for cases
 757        // where reducer is scoped by action shape.
 758        var key = action[actionProperty];
 759  
 760        if (key === undefined) {
 761          return state;
 762        } // Avoid updating state if unchanged. Note that this also accounts for a
 763        // reducer which returns undefined on a key which is not yet tracked.
 764  
 765  
 766        var nextKeyState = reducer(state[key], action);
 767  
 768        if (nextKeyState === state[key]) {
 769          return state;
 770        }
 771  
 772        return _objectSpread({}, state, Object(defineProperty["a" /* default */])({}, key, nextKeyState));
 773      };
 774    };
 775  };
 776  /* harmony default export */ var on_sub_key = (on_sub_key_onSubKey);
 777  
 778  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/replace-action.js
 779  /**
 780   * Higher-order reducer creator which substitutes the action object before
 781   * passing to the original reducer.
 782   *
 783   * @param {Function} replacer Function mapping original action to replacement.
 784   *
 785   * @return {Function} Higher-order reducer.
 786   */
 787  var replaceAction = function replaceAction(replacer) {
 788    return function (reducer) {
 789      return function (state, action) {
 790        return reducer(state, replacer(action));
 791      };
 792    };
 793  };
 794  
 795  /* harmony default export */ var replace_action = (replaceAction);
 796  
 797  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/with-weak-map-cache.js
 798  /**
 799   * External dependencies
 800   */
 801  
 802  /**
 803   * Given a function, returns an enhanced function which caches the result and
 804   * tracks in WeakMap. The result is only cached if the original function is
 805   * passed a valid object-like argument (requirement for WeakMap key).
 806   *
 807   * @param {Function} fn Original function.
 808   *
 809   * @return {Function} Enhanced caching function.
 810   */
 811  
 812  function withWeakMapCache(fn) {
 813    var cache = new WeakMap();
 814    return function (key) {
 815      var value;
 816  
 817      if (cache.has(key)) {
 818        value = cache.get(key);
 819      } else {
 820        value = fn(key); // Can reach here if key is not valid for WeakMap, since `has`
 821        // will return false for invalid key. Since `set` will throw,
 822        // ensure that key is valid before setting into cache.
 823  
 824        if (Object(external_this_lodash_["isObjectLike"])(key)) {
 825          cache.set(key, value);
 826        }
 827      }
 828  
 829      return value;
 830    };
 831  }
 832  
 833  /* harmony default export */ var with_weak_map_cache = (withWeakMapCache);
 834  
 835  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/index.js
 836  
 837  
 838  
 839  
 840  
 841  
 842  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/actions.js
 843  
 844  
 845  function actions_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; }
 846  
 847  function actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { actions_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 { actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 848  
 849  /**
 850   * External dependencies
 851   */
 852  
 853  /**
 854   * Returns an action object used in signalling that items have been received.
 855   *
 856   * @param {Array} items Items received.
 857   *
 858   * @return {Object} Action object.
 859   */
 860  
 861  function receiveItems(items) {
 862    return {
 863      type: 'RECEIVE_ITEMS',
 864      items: Object(external_this_lodash_["castArray"])(items)
 865    };
 866  }
 867  /**
 868   * Returns an action object used in signalling that queried data has been
 869   * received.
 870   *
 871   * @param {Array}   items Queried items received.
 872   * @param {?Object} query Optional query object.
 873   *
 874   * @return {Object} Action object.
 875   */
 876  
 877  function receiveQueriedItems(items) {
 878    var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
 879    return actions_objectSpread({}, receiveItems(items), {
 880      query: query
 881    });
 882  }
 883  
 884  // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
 885  var rememo = __webpack_require__(40);
 886  
 887  // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
 888  var equivalent_key_map = __webpack_require__(64);
 889  var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map);
 890  
 891  // EXTERNAL MODULE: external {"this":["wp","url"]}
 892  var external_this_wp_url_ = __webpack_require__(30);
 893  
 894  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js
 895  
 896  
 897  /**
 898   * WordPress dependencies
 899   */
 900  
 901  /**
 902   * Internal dependencies
 903   */
 904  
 905  
 906  /**
 907   * An object of properties describing a specific query.
 908   *
 909   * @typedef {Object} WPQueriedDataQueryParts
 910   *
 911   * @property {number} page      The query page (1-based index, default 1).
 912   * @property {number} perPage   Items per page for query (default 10).
 913   * @property {string} stableKey An encoded stable string of all non-pagination
 914   *                              query parameters.
 915   */
 916  
 917  /**
 918   * Given a query object, returns an object of parts, including pagination
 919   * details (`page` and `perPage`, or default values). All other properties are
 920   * encoded into a stable (idempotent) `stableKey` value.
 921   *
 922   * @param {Object} query Optional query object.
 923   *
 924   * @return {WPQueriedDataQueryParts} Query parts.
 925   */
 926  
 927  function getQueryParts(query) {
 928    /**
 929     * @type {WPQueriedDataQueryParts}
 930     */
 931    var parts = {
 932      stableKey: '',
 933      page: 1,
 934      perPage: 10
 935    }; // Ensure stable key by sorting keys. Also more efficient for iterating.
 936  
 937    var keys = Object.keys(query).sort();
 938  
 939    for (var i = 0; i < keys.length; i++) {
 940      var key = keys[i];
 941      var value = query[key];
 942  
 943      switch (key) {
 944        case 'page':
 945          parts[key] = Number(value);
 946          break;
 947  
 948        case 'per_page':
 949          parts.perPage = Number(value);
 950          break;
 951  
 952        default:
 953          // While it could be any deterministic string, for simplicity's
 954          // sake mimic querystring encoding for stable key.
 955          //
 956          // TODO: For consistency with PHP implementation, addQueryArgs
 957          // should accept a key value pair, which may optimize its
 958          // implementation for our use here, vs. iterating an object
 959          // with only a single key.
 960          parts.stableKey += (parts.stableKey ? '&' : '') + Object(external_this_wp_url_["addQueryArgs"])('', Object(defineProperty["a" /* default */])({}, key, value)).slice(1);
 961      }
 962    }
 963  
 964    return parts;
 965  }
 966  /* harmony default export */ var get_query_parts = (with_weak_map_cache(getQueryParts));
 967  
 968  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/selectors.js
 969  /**
 970   * External dependencies
 971   */
 972  
 973  
 974  /**
 975   * Internal dependencies
 976   */
 977  
 978  
 979  /**
 980   * Cache of state keys to EquivalentKeyMap where the inner map tracks queries
 981   * to their resulting items set. WeakMap allows garbage collection on expired
 982   * state references.
 983   *
 984   * @type {WeakMap<Object,EquivalentKeyMap>}
 985   */
 986  
 987  var queriedItemsCacheByState = new WeakMap();
 988  /**
 989   * Returns items for a given query, or null if the items are not known.
 990   *
 991   * @param {Object}  state State object.
 992   * @param {?Object} query Optional query.
 993   *
 994   * @return {?Array} Query items.
 995   */
 996  
 997  function getQueriedItemsUncached(state, query) {
 998    var _getQueryParts = get_query_parts(query),
 999        stableKey = _getQueryParts.stableKey,
1000        page = _getQueryParts.page,
1001        perPage = _getQueryParts.perPage;
1002  
1003    if (!state.queries[stableKey]) {
1004      return null;
1005    }
1006  
1007    var itemIds = state.queries[stableKey];
1008  
1009    if (!itemIds) {
1010      return null;
1011    }
1012  
1013    var startOffset = perPage === -1 ? 0 : (page - 1) * perPage;
1014    var endOffset = perPage === -1 ? itemIds.length : Math.min(startOffset + perPage, itemIds.length);
1015    var items = [];
1016  
1017    for (var i = startOffset; i < endOffset; i++) {
1018      var itemId = itemIds[i];
1019      items.push(state.items[itemId]);
1020    }
1021  
1022    return items;
1023  }
1024  /**
1025   * Returns items for a given query, or null if the items are not known. Caches
1026   * result both per state (by reference) and per query (by deep equality).
1027   * The caching approach is intended to be durable to query objects which are
1028   * deeply but not referentially equal, since otherwise:
1029   *
1030   * `getQueriedItems( state, {} ) !== getQueriedItems( state, {} )`
1031   *
1032   * @param {Object}  state State object.
1033   * @param {?Object} query Optional query.
1034   *
1035   * @return {?Array} Query items.
1036   */
1037  
1038  
1039  var getQueriedItems = Object(rememo["a" /* default */])(function (state) {
1040    var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1041    var queriedItemsCache = queriedItemsCacheByState.get(state);
1042  
1043    if (queriedItemsCache) {
1044      var queriedItems = queriedItemsCache.get(query);
1045  
1046      if (queriedItems !== undefined) {
1047        return queriedItems;
1048      }
1049    } else {
1050      queriedItemsCache = new equivalent_key_map_default.a();
1051      queriedItemsCacheByState.set(state, queriedItemsCache);
1052    }
1053  
1054    var items = getQueriedItemsUncached(state, query);
1055    queriedItemsCache.set(query, items);
1056    return items;
1057  });
1058  
1059  // EXTERNAL MODULE: external {"this":"regeneratorRuntime"}
1060  var external_this_regeneratorRuntime_ = __webpack_require__(23);
1061  var external_this_regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(external_this_regeneratorRuntime_);
1062  
1063  // EXTERNAL MODULE: external {"this":["wp","apiFetch"]}
1064  var external_this_wp_apiFetch_ = __webpack_require__(42);
1065  var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_);
1066  
1067  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/controls.js
1068  
1069  
1070  /**
1071   * WordPress dependencies
1072   */
1073  
1074  
1075  /**
1076   * Trigger an API Fetch request.
1077   *
1078   * @param {Object} request API Fetch Request Object.
1079   * @return {Object} control descriptor.
1080   */
1081  
1082  function apiFetch(request) {
1083    return {
1084      type: 'API_FETCH',
1085      request: request
1086    };
1087  }
1088  /**
1089   * Calls a selector using the current state.
1090   *
1091   * @param {string} selectorName Selector name.
1092   * @param  {Array} args         Selector arguments.
1093   *
1094   * @return {Object} control descriptor.
1095   */
1096  
1097  function controls_select(selectorName) {
1098    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1099      args[_key - 1] = arguments[_key];
1100    }
1101  
1102    return {
1103      type: 'SELECT',
1104      selectorName: selectorName,
1105      args: args
1106    };
1107  }
1108  /**
1109   * Dispatches a control action for triggering a registry select that has a
1110   * resolver.
1111   *
1112   * @param {string}  selectorName
1113   * @param {Array}   args  Arguments for the select.
1114   *
1115   * @return {Object} control descriptor.
1116   */
1117  
1118  function resolveSelect(selectorName) {
1119    for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1120      args[_key2 - 1] = arguments[_key2];
1121    }
1122  
1123    return {
1124      type: 'RESOLVE_SELECT',
1125      selectorName: selectorName,
1126      args: args
1127    };
1128  }
1129  var controls = {
1130    API_FETCH: function API_FETCH(_ref) {
1131      var request = _ref.request;
1132      return external_this_wp_apiFetch_default()(request);
1133    },
1134    SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
1135      return function (_ref2) {
1136        var _registry$select;
1137  
1138        var selectorName = _ref2.selectorName,
1139            args = _ref2.args;
1140        return (_registry$select = registry.select('core'))[selectorName].apply(_registry$select, Object(toConsumableArray["a" /* default */])(args));
1141      };
1142    }),
1143    RESOLVE_SELECT: Object(external_this_wp_data_["createRegistryControl"])(function (registry) {
1144      return function (_ref3) {
1145        var _registry$__experimen;
1146  
1147        var selectorName = _ref3.selectorName,
1148            args = _ref3.args;
1149        return (_registry$__experimen = registry.__experimentalResolveSelect('core'))[selectorName].apply(_registry$__experimen, Object(toConsumableArray["a" /* default */])(args));
1150      };
1151    })
1152  };
1153  /* harmony default export */ var build_module_controls = (controls);
1154  
1155  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/actions.js
1156  
1157  
1158  
1159  
1160  var _marked =
1161  /*#__PURE__*/
1162  external_this_regeneratorRuntime_default.a.mark(actions_editEntityRecord),
1163      _marked2 =
1164  /*#__PURE__*/
1165  external_this_regeneratorRuntime_default.a.mark(undo),
1166      _marked3 =
1167  /*#__PURE__*/
1168  external_this_regeneratorRuntime_default.a.mark(redo),
1169      _marked4 =
1170  /*#__PURE__*/
1171  external_this_regeneratorRuntime_default.a.mark(saveEntityRecord),
1172      _marked5 =
1173  /*#__PURE__*/
1174  external_this_regeneratorRuntime_default.a.mark(saveEditedEntityRecord);
1175  
1176  function build_module_actions_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; }
1177  
1178  function build_module_actions_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { build_module_actions_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 { build_module_actions_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1179  
1180  /**
1181   * External dependencies
1182   */
1183  
1184  /**
1185   * Internal dependencies
1186   */
1187  
1188  
1189  
1190  
1191  /**
1192   * Returns an action object used in signalling that authors have been received.
1193   *
1194   * @param {string}       queryID Query ID.
1195   * @param {Array|Object} users   Users received.
1196   *
1197   * @return {Object} Action object.
1198   */
1199  
1200  function receiveUserQuery(queryID, users) {
1201    return {
1202      type: 'RECEIVE_USER_QUERY',
1203      users: Object(external_this_lodash_["castArray"])(users),
1204      queryID: queryID
1205    };
1206  }
1207  /**
1208   * Returns an action used in signalling that the current user has been received.
1209   *
1210   * @param {Object} currentUser Current user object.
1211   *
1212   * @return {Object} Action object.
1213   */
1214  
1215  function receiveCurrentUser(currentUser) {
1216    return {
1217      type: 'RECEIVE_CURRENT_USER',
1218      currentUser: currentUser
1219    };
1220  }
1221  /**
1222   * Returns an action object used in adding new entities.
1223   *
1224   * @param {Array} entities  Entities received.
1225   *
1226   * @return {Object} Action object.
1227   */
1228  
1229  function addEntities(entities) {
1230    return {
1231      type: 'ADD_ENTITIES',
1232      entities: entities
1233    };
1234  }
1235  /**
1236   * Returns an action object used in signalling that entity records have been received.
1237   *
1238   * @param {string}       kind            Kind of the received entity.
1239   * @param {string}       name            Name of the received entity.
1240   * @param {Array|Object} records         Records received.
1241   * @param {?Object}      query           Query Object.
1242   * @param {?boolean}     invalidateCache Should invalidate query caches
1243   *
1244   * @return {Object} Action object.
1245   */
1246  
1247  function receiveEntityRecords(kind, name, records, query) {
1248    var invalidateCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1249  
1250    // Auto drafts should not have titles, but some plugins rely on them so we can't filter this
1251    // on the server.
1252    if (kind === 'postType') {
1253      records = Object(external_this_lodash_["castArray"])(records).map(function (record) {
1254        return record.status === 'auto-draft' ? build_module_actions_objectSpread({}, record, {
1255          title: ''
1256        }) : record;
1257      });
1258    }
1259  
1260    var action;
1261  
1262    if (query) {
1263      action = receiveQueriedItems(records, query);
1264    } else {
1265      action = receiveItems(records);
1266    }
1267  
1268    return build_module_actions_objectSpread({}, action, {
1269      kind: kind,
1270      name: name,
1271      invalidateCache: invalidateCache
1272    });
1273  }
1274  /**
1275   * Returns an action object used in signalling that the index has been received.
1276   *
1277   * @param {Object} themeSupports Theme support for the current theme.
1278   *
1279   * @return {Object} Action object.
1280   */
1281  
1282  function receiveThemeSupports(themeSupports) {
1283    return {
1284      type: 'RECEIVE_THEME_SUPPORTS',
1285      themeSupports: themeSupports
1286    };
1287  }
1288  /**
1289   * Returns an action object used in signalling that the preview data for
1290   * a given URl has been received.
1291   *
1292   * @param {string}  url     URL to preview the embed for.
1293   * @param {*}       preview Preview data.
1294   *
1295   * @return {Object} Action object.
1296   */
1297  
1298  function receiveEmbedPreview(url, preview) {
1299    return {
1300      type: 'RECEIVE_EMBED_PREVIEW',
1301      url: url,
1302      preview: preview
1303    };
1304  }
1305  /**
1306   * Returns an action object that triggers an
1307   * edit to an entity record.
1308   *
1309   * @param {string} kind     Kind of the edited entity record.
1310   * @param {string} name     Name of the edited entity record.
1311   * @param {number} recordId Record ID of the edited entity record.
1312   * @param {Object} edits    The edits.
1313   * @param {Object} options  Options for the edit.
1314   * @param {boolean} options.undoIgnore Whether to ignore the edit in undo history or not.
1315   *
1316   * @return {Object} Action object.
1317   */
1318  
1319  function actions_editEntityRecord(kind, name, recordId, edits) {
1320    var options,
1321        entity,
1322        _entity$transientEdit,
1323        transientEdits,
1324        _entity$mergedEdits,
1325        mergedEdits,
1326        record,
1327        editedRecord,
1328        edit,
1329        _args = arguments;
1330  
1331    return external_this_regeneratorRuntime_default.a.wrap(function editEntityRecord$(_context) {
1332      while (1) {
1333        switch (_context.prev = _context.next) {
1334          case 0:
1335            options = _args.length > 4 && _args[4] !== undefined ? _args[4] : {};
1336            _context.next = 3;
1337            return controls_select('getEntity', kind, name);
1338  
1339          case 3:
1340            entity = _context.sent;
1341  
1342            if (entity) {
1343              _context.next = 6;
1344              break;
1345            }
1346  
1347            throw new Error("The entity being edited (".concat(kind, ", ").concat(name, ") does not have a loaded config."));
1348  
1349          case 6:
1350            _entity$transientEdit = entity.transientEdits, transientEdits = _entity$transientEdit === void 0 ? {} : _entity$transientEdit, _entity$mergedEdits = entity.mergedEdits, mergedEdits = _entity$mergedEdits === void 0 ? {} : _entity$mergedEdits;
1351            _context.next = 9;
1352            return controls_select('getRawEntityRecord', kind, name, recordId);
1353  
1354          case 9:
1355            record = _context.sent;
1356            _context.next = 12;
1357            return controls_select('getEditedEntityRecord', kind, name, recordId);
1358  
1359          case 12:
1360            editedRecord = _context.sent;
1361            edit = {
1362              kind: kind,
1363              name: name,
1364              recordId: recordId,
1365              // Clear edits when they are equal to their persisted counterparts
1366              // so that the property is not considered dirty.
1367              edits: Object.keys(edits).reduce(function (acc, key) {
1368                var recordValue = record[key];
1369                var editedRecordValue = editedRecord[key];
1370                var value = mergedEdits[key] ? build_module_actions_objectSpread({}, editedRecordValue, {}, edits[key]) : edits[key];
1371                acc[key] = Object(external_this_lodash_["isEqual"])(recordValue, value) ? undefined : value;
1372                return acc;
1373              }, {}),
1374              transientEdits: transientEdits
1375            };
1376            return _context.abrupt("return", build_module_actions_objectSpread({
1377              type: 'EDIT_ENTITY_RECORD'
1378            }, edit, {
1379              meta: {
1380                undo: !options.undoIgnore && build_module_actions_objectSpread({}, edit, {
1381                  // Send the current values for things like the first undo stack entry.
1382                  edits: Object.keys(edits).reduce(function (acc, key) {
1383                    acc[key] = editedRecord[key];
1384                    return acc;
1385                  }, {})
1386                })
1387              }
1388            }));
1389  
1390          case 15:
1391          case "end":
1392            return _context.stop();
1393        }
1394      }
1395    }, _marked);
1396  }
1397  /**
1398   * Action triggered to undo the last edit to
1399   * an entity record, if any.
1400   */
1401  
1402  function undo() {
1403    var undoEdit;
1404    return external_this_regeneratorRuntime_default.a.wrap(function undo$(_context2) {
1405      while (1) {
1406        switch (_context2.prev = _context2.next) {
1407          case 0:
1408            _context2.next = 2;
1409            return controls_select('getUndoEdit');
1410  
1411          case 2:
1412            undoEdit = _context2.sent;
1413  
1414            if (undoEdit) {
1415              _context2.next = 5;
1416              break;
1417            }
1418  
1419            return _context2.abrupt("return");
1420  
1421          case 5:
1422            _context2.next = 7;
1423            return build_module_actions_objectSpread({
1424              type: 'EDIT_ENTITY_RECORD'
1425            }, undoEdit, {
1426              meta: {
1427                isUndo: true
1428              }
1429            });
1430  
1431          case 7:
1432          case "end":
1433            return _context2.stop();
1434        }
1435      }
1436    }, _marked2);
1437  }
1438  /**
1439   * Action triggered to redo the last undoed
1440   * edit to an entity record, if any.
1441   */
1442  
1443  function redo() {
1444    var redoEdit;
1445    return external_this_regeneratorRuntime_default.a.wrap(function redo$(_context3) {
1446      while (1) {
1447        switch (_context3.prev = _context3.next) {
1448          case 0:
1449            _context3.next = 2;
1450            return controls_select('getRedoEdit');
1451  
1452          case 2:
1453            redoEdit = _context3.sent;
1454  
1455            if (redoEdit) {
1456              _context3.next = 5;
1457              break;
1458            }
1459  
1460            return _context3.abrupt("return");
1461  
1462          case 5:
1463            _context3.next = 7;
1464            return build_module_actions_objectSpread({
1465              type: 'EDIT_ENTITY_RECORD'
1466            }, redoEdit, {
1467              meta: {
1468                isRedo: true
1469              }
1470            });
1471  
1472          case 7:
1473          case "end":
1474            return _context3.stop();
1475        }
1476      }
1477    }, _marked3);
1478  }
1479  /**
1480   * Forces the creation of a new undo level.
1481   *
1482   * @return {Object} Action object.
1483   */
1484  
1485  function __unstableCreateUndoLevel() {
1486    return {
1487      type: 'CREATE_UNDO_LEVEL'
1488    };
1489  }
1490  /**
1491   * Action triggered to save an entity record.
1492   *
1493   * @param {string} kind    Kind of the received entity.
1494   * @param {string} name    Name of the received entity.
1495   * @param {Object} record  Record to be saved.
1496   * @param {Object} options Saving options.
1497   */
1498  
1499  function saveEntityRecord(kind, name, record) {
1500    var _ref,
1501        _ref$isAutosave,
1502        isAutosave,
1503        entities,
1504        entity,
1505        entityIdKey,
1506        recordId,
1507        _i,
1508        _Object$entries,
1509        _Object$entries$_i,
1510        key,
1511        value,
1512        evaluatedValue,
1513        updatedRecord,
1514        error,
1515        persistedEntity,
1516        currentEdits,
1517        path,
1518        persistedRecord,
1519        currentUser,
1520        currentUserId,
1521        autosavePost,
1522        data,
1523        newRecord,
1524        _data,
1525        _args4 = arguments;
1526  
1527    return external_this_regeneratorRuntime_default.a.wrap(function saveEntityRecord$(_context4) {
1528      while (1) {
1529        switch (_context4.prev = _context4.next) {
1530          case 0:
1531            _ref = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : {
1532              isAutosave: false
1533            }, _ref$isAutosave = _ref.isAutosave, isAutosave = _ref$isAutosave === void 0 ? false : _ref$isAutosave;
1534            _context4.next = 3;
1535            return getKindEntities(kind);
1536  
1537          case 3:
1538            entities = _context4.sent;
1539            entity = Object(external_this_lodash_["find"])(entities, {
1540              kind: kind,
1541              name: name
1542            });
1543  
1544            if (entity) {
1545              _context4.next = 7;
1546              break;
1547            }
1548  
1549            return _context4.abrupt("return");
1550  
1551          case 7:
1552            entityIdKey = entity.key || DEFAULT_ENTITY_KEY;
1553            recordId = record[entityIdKey]; // Evaluate optimized edits.
1554            // (Function edits that should be evaluated on save to avoid expensive computations on every edit.)
1555  
1556            _i = 0, _Object$entries = Object.entries(record);
1557  
1558          case 10:
1559            if (!(_i < _Object$entries.length)) {
1560              _context4.next = 24;
1561              break;
1562            }
1563  
1564            _Object$entries$_i = Object(slicedToArray["a" /* default */])(_Object$entries[_i], 2), key = _Object$entries$_i[0], value = _Object$entries$_i[1];
1565  
1566            if (!(typeof value === 'function')) {
1567              _context4.next = 21;
1568              break;
1569            }
1570  
1571            _context4.t0 = value;
1572            _context4.next = 16;
1573            return controls_select('getEditedEntityRecord', kind, name, recordId);
1574  
1575          case 16:
1576            _context4.t1 = _context4.sent;
1577            evaluatedValue = (0, _context4.t0)(_context4.t1);
1578            _context4.next = 20;
1579            return actions_editEntityRecord(kind, name, recordId, Object(defineProperty["a" /* default */])({}, key, evaluatedValue), {
1580              undoIgnore: true
1581            });
1582  
1583          case 20:
1584            record[key] = evaluatedValue;
1585  
1586          case 21:
1587            _i++;
1588            _context4.next = 10;
1589            break;
1590  
1591          case 24:
1592            _context4.next = 26;
1593            return {
1594              type: 'SAVE_ENTITY_RECORD_START',
1595              kind: kind,
1596              name: name,
1597              recordId: recordId,
1598              isAutosave: isAutosave
1599            };
1600  
1601          case 26:
1602            _context4.prev = 26;
1603            path = "".concat(entity.baseURL).concat(recordId ? '/' + recordId : '');
1604            _context4.next = 30;
1605            return controls_select('getRawEntityRecord', kind, name, recordId);
1606  
1607          case 30:
1608            persistedRecord = _context4.sent;
1609  
1610            if (!isAutosave) {
1611              _context4.next = 55;
1612              break;
1613            }
1614  
1615            _context4.next = 34;
1616            return controls_select('getCurrentUser');
1617  
1618          case 34:
1619            currentUser = _context4.sent;
1620            currentUserId = currentUser ? currentUser.id : undefined;
1621            _context4.next = 38;
1622            return controls_select('getAutosave', persistedRecord.type, persistedRecord.id, currentUserId);
1623  
1624          case 38:
1625            autosavePost = _context4.sent;
1626            // Autosaves need all expected fields to be present.
1627            // So we fallback to the previous autosave and then
1628            // to the actual persisted entity if the edits don't
1629            // have a value.
1630            data = build_module_actions_objectSpread({}, persistedRecord, {}, autosavePost, {}, record);
1631            data = Object.keys(data).reduce(function (acc, key) {
1632              if (['title', 'excerpt', 'content'].includes(key)) {
1633                // Edits should be the "raw" attribute values.
1634                acc[key] = Object(external_this_lodash_["get"])(data[key], 'raw', data[key]);
1635              }
1636  
1637              return acc;
1638            }, {
1639              status: data.status === 'auto-draft' ? 'draft' : data.status
1640            });
1641            _context4.next = 43;
1642            return apiFetch({
1643              path: "".concat(path, "/autosaves"),
1644              method: 'POST',
1645              data: data
1646            });
1647  
1648          case 43:
1649            updatedRecord = _context4.sent;
1650  
1651            if (!(persistedRecord.id === updatedRecord.id)) {
1652              _context4.next = 51;
1653              break;
1654            }
1655  
1656            newRecord = build_module_actions_objectSpread({}, persistedRecord, {}, data, {}, updatedRecord);
1657            newRecord = Object.keys(newRecord).reduce(function (acc, key) {
1658              // These properties are persisted in autosaves.
1659              if (['title', 'excerpt', 'content'].includes(key)) {
1660                // Edits should be the "raw" attribute values.
1661                acc[key] = Object(external_this_lodash_["get"])(newRecord[key], 'raw', newRecord[key]);
1662              } else if (key === 'status') {
1663                // Status is only persisted in autosaves when going from
1664                // "auto-draft" to "draft".
1665                acc[key] = persistedRecord.status === 'auto-draft' && newRecord.status === 'draft' ? newRecord.status : persistedRecord.status;
1666              } else {
1667                // These properties are not persisted in autosaves.
1668                acc[key] = Object(external_this_lodash_["get"])(persistedRecord[key], 'raw', persistedRecord[key]);
1669              }
1670  
1671              return acc;
1672            }, {});
1673            _context4.next = 49;
1674            return receiveEntityRecords(kind, name, newRecord, undefined, true);
1675  
1676          case 49:
1677            _context4.next = 53;
1678            break;
1679  
1680          case 51:
1681            _context4.next = 53;
1682            return receiveAutosaves(persistedRecord.id, updatedRecord);
1683  
1684          case 53:
1685            _context4.next = 70;
1686            break;
1687  
1688          case 55:
1689            // Auto drafts should be converted to drafts on explicit saves and we should not respect their default title,
1690            // but some plugins break with this behavior so we can't filter it on the server.
1691            _data = record;
1692  
1693            if (kind === 'postType' && persistedRecord && persistedRecord.status === 'auto-draft') {
1694              if (!_data.status) {
1695                _data = build_module_actions_objectSpread({}, _data, {
1696                  status: 'draft'
1697                });
1698              }
1699  
1700              if (!_data.title || _data.title === 'Auto Draft') {
1701                _data = build_module_actions_objectSpread({}, _data, {
1702                  title: ''
1703                });
1704              }
1705            } // Get the full local version of the record before the update,
1706            // to merge it with the edits and then propagate it to subscribers
1707  
1708  
1709            _context4.next = 59;
1710            return controls_select('__experimentalGetEntityRecordNoResolver', kind, name, recordId);
1711  
1712          case 59:
1713            persistedEntity = _context4.sent;
1714            _context4.next = 62;
1715            return controls_select('getEntityRecordEdits', kind, name, recordId);
1716  
1717          case 62:
1718            currentEdits = _context4.sent;
1719            _context4.next = 65;
1720            return receiveEntityRecords(kind, name, build_module_actions_objectSpread({}, persistedEntity, {}, _data), undefined, true);
1721  
1722          case 65:
1723            _context4.next = 67;
1724            return apiFetch({
1725              path: path,
1726              method: recordId ? 'PUT' : 'POST',
1727              data: _data
1728            });
1729  
1730          case 67:
1731            updatedRecord = _context4.sent;
1732            _context4.next = 70;
1733            return receiveEntityRecords(kind, name, updatedRecord, undefined, true);
1734  
1735          case 70:
1736            _context4.next = 93;
1737            break;
1738  
1739          case 72:
1740            _context4.prev = 72;
1741            _context4.t2 = _context4["catch"](26);
1742            error = _context4.t2; // If we got to the point in the try block where we made an optimistic update,
1743            // we need to roll it back here.
1744  
1745            if (!(persistedEntity && currentEdits)) {
1746              _context4.next = 93;
1747              break;
1748            }
1749  
1750            _context4.next = 78;
1751            return receiveEntityRecords(kind, name, persistedEntity, undefined, true);
1752  
1753          case 78:
1754            _context4.t3 = actions_editEntityRecord;
1755            _context4.t4 = kind;
1756            _context4.t5 = name;
1757            _context4.t6 = recordId;
1758            _context4.t7 = build_module_actions_objectSpread;
1759            _context4.t8 = {};
1760            _context4.t9 = currentEdits;
1761            _context4.t10 = {};
1762            _context4.next = 88;
1763            return controls_select('getEntityRecordEdits', kind, name, recordId);
1764  
1765          case 88:
1766            _context4.t11 = _context4.sent;
1767            _context4.t12 = (0, _context4.t7)(_context4.t8, _context4.t9, _context4.t10, _context4.t11);
1768            _context4.t13 = {
1769              undoIgnore: true
1770            };
1771            _context4.next = 93;
1772            return (0, _context4.t3)(_context4.t4, _context4.t5, _context4.t6, _context4.t12, _context4.t13);
1773  
1774          case 93:
1775            _context4.next = 95;
1776            return {
1777              type: 'SAVE_ENTITY_RECORD_FINISH',
1778              kind: kind,
1779              name: name,
1780              recordId: recordId,
1781              error: error,
1782              isAutosave: isAutosave
1783            };
1784  
1785          case 95:
1786            return _context4.abrupt("return", updatedRecord);
1787  
1788          case 96:
1789          case "end":
1790            return _context4.stop();
1791        }
1792      }
1793    }, _marked4, null, [[26, 72]]);
1794  }
1795  /**
1796   * Action triggered to save an entity record's edits.
1797   *
1798   * @param {string} kind     Kind of the entity.
1799   * @param {string} name     Name of the entity.
1800   * @param {Object} recordId ID of the record.
1801   * @param {Object} options  Saving options.
1802   */
1803  
1804  function saveEditedEntityRecord(kind, name, recordId, options) {
1805    var edits, record;
1806    return external_this_regeneratorRuntime_default.a.wrap(function saveEditedEntityRecord$(_context5) {
1807      while (1) {
1808        switch (_context5.prev = _context5.next) {
1809          case 0:
1810            _context5.next = 2;
1811            return controls_select('hasEditsForEntityRecord', kind, name, recordId);
1812  
1813          case 2:
1814            if (_context5.sent) {
1815              _context5.next = 4;
1816              break;
1817            }
1818  
1819            return _context5.abrupt("return");
1820  
1821          case 4:
1822            _context5.next = 6;
1823            return controls_select('getEntityRecordNonTransientEdits', kind, name, recordId);
1824  
1825          case 6:
1826            edits = _context5.sent;
1827            record = build_module_actions_objectSpread({
1828              id: recordId
1829            }, edits);
1830            return _context5.delegateYield(saveEntityRecord(kind, name, record, options), "t0", 9);
1831  
1832          case 9:
1833          case "end":
1834            return _context5.stop();
1835        }
1836      }
1837    }, _marked5);
1838  }
1839  /**
1840   * Returns an action object used in signalling that Upload permissions have been received.
1841   *
1842   * @param {boolean} hasUploadPermissions Does the user have permission to upload files?
1843   *
1844   * @return {Object} Action object.
1845   */
1846  
1847  function receiveUploadPermissions(hasUploadPermissions) {
1848    return {
1849      type: 'RECEIVE_USER_PERMISSION',
1850      key: 'create/media',
1851      isAllowed: hasUploadPermissions
1852    };
1853  }
1854  /**
1855   * Returns an action object used in signalling that the current user has
1856   * permission to perform an action on a REST resource.
1857   *
1858   * @param {string}  key       A key that represents the action and REST resource.
1859   * @param {boolean} isAllowed Whether or not the user can perform the action.
1860   *
1861   * @return {Object} Action object.
1862   */
1863  
1864  function receiveUserPermission(key, isAllowed) {
1865    return {
1866      type: 'RECEIVE_USER_PERMISSION',
1867      key: key,
1868      isAllowed: isAllowed
1869    };
1870  }
1871  /**
1872   * Returns an action object used in signalling that the autosaves for a
1873   * post have been received.
1874   *
1875   * @param {number}       postId    The id of the post that is parent to the autosave.
1876   * @param {Array|Object} autosaves An array of autosaves or singular autosave object.
1877   *
1878   * @return {Object} Action object.
1879   */
1880  
1881  function receiveAutosaves(postId, autosaves) {
1882    return {
1883      type: 'RECEIVE_AUTOSAVES',
1884      postId: postId,
1885      autosaves: Object(external_this_lodash_["castArray"])(autosaves)
1886    };
1887  }
1888  
1889  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/entities.js
1890  
1891  
1892  var entities_marked =
1893  /*#__PURE__*/
1894  external_this_regeneratorRuntime_default.a.mark(loadPostTypeEntities),
1895      entities_marked2 =
1896  /*#__PURE__*/
1897  external_this_regeneratorRuntime_default.a.mark(loadTaxonomyEntities),
1898      entities_marked3 =
1899  /*#__PURE__*/
1900  external_this_regeneratorRuntime_default.a.mark(getKindEntities);
1901  
1902  /**
1903   * External dependencies
1904   */
1905  
1906  /**
1907   * Internal dependencies
1908   */
1909  
1910  
1911  
1912  var DEFAULT_ENTITY_KEY = 'id';
1913  var defaultEntities = [{
1914    name: 'site',
1915    kind: 'root',
1916    baseURL: '/wp/v2/settings'
1917  }, {
1918    name: 'postType',
1919    kind: 'root',
1920    key: 'slug',
1921    baseURL: '/wp/v2/types'
1922  }, {
1923    name: 'media',
1924    kind: 'root',
1925    baseURL: '/wp/v2/media',
1926    plural: 'mediaItems'
1927  }, {
1928    name: 'taxonomy',
1929    kind: 'root',
1930    key: 'slug',
1931    baseURL: '/wp/v2/taxonomies',
1932    plural: 'taxonomies'
1933  }, {
1934    name: 'widgetArea',
1935    kind: 'root',
1936    baseURL: '/__experimental/widget-areas',
1937    plural: 'widgetAreas',
1938    transientEdits: {
1939      blocks: true
1940    }
1941  }, {
1942    name: 'user',
1943    kind: 'root',
1944    baseURL: '/wp/v2/users',
1945    plural: 'users'
1946  }];
1947  var kinds = [{
1948    name: 'postType',
1949    loadEntities: loadPostTypeEntities
1950  }, {
1951    name: 'taxonomy',
1952    loadEntities: loadTaxonomyEntities
1953  }];
1954  /**
1955   * Returns the list of post type entities.
1956   *
1957   * @return {Promise} Entities promise
1958   */
1959  
1960  function loadPostTypeEntities() {
1961    var postTypes;
1962    return external_this_regeneratorRuntime_default.a.wrap(function loadPostTypeEntities$(_context) {
1963      while (1) {
1964        switch (_context.prev = _context.next) {
1965          case 0:
1966            _context.next = 2;
1967            return apiFetch({
1968              path: '/wp/v2/types?context=edit'
1969            });
1970  
1971          case 2:
1972            postTypes = _context.sent;
1973            return _context.abrupt("return", Object(external_this_lodash_["map"])(postTypes, function (postType, name) {
1974              return {
1975                kind: 'postType',
1976                baseURL: '/wp/v2/' + postType.rest_base,
1977                name: name,
1978                transientEdits: {
1979                  blocks: true,
1980                  selectionStart: true,
1981                  selectionEnd: true
1982                },
1983                mergedEdits: {
1984                  meta: true
1985                }
1986              };
1987            }));
1988  
1989          case 4:
1990          case "end":
1991            return _context.stop();
1992        }
1993      }
1994    }, entities_marked);
1995  }
1996  /**
1997   * Returns the list of the taxonomies entities.
1998   *
1999   * @return {Promise} Entities promise
2000   */
2001  
2002  
2003  function loadTaxonomyEntities() {
2004    var taxonomies;
2005    return external_this_regeneratorRuntime_default.a.wrap(function loadTaxonomyEntities$(_context2) {
2006      while (1) {
2007        switch (_context2.prev = _context2.next) {
2008          case 0:
2009            _context2.next = 2;
2010            return apiFetch({
2011              path: '/wp/v2/taxonomies?context=edit'
2012            });
2013  
2014          case 2:
2015            taxonomies = _context2.sent;
2016            return _context2.abrupt("return", Object(external_this_lodash_["map"])(taxonomies, function (taxonomy, name) {
2017              return {
2018                kind: 'taxonomy',
2019                baseURL: '/wp/v2/' + taxonomy.rest_base,
2020                name: name
2021              };
2022            }));
2023  
2024          case 4:
2025          case "end":
2026            return _context2.stop();
2027        }
2028      }
2029    }, entities_marked2);
2030  }
2031  /**
2032   * Returns the entity's getter method name given its kind and name.
2033   *
2034   * @param {string}  kind      Entity kind.
2035   * @param {string}  name      Entity name.
2036   * @param {string}  prefix    Function prefix.
2037   * @param {boolean} usePlural Whether to use the plural form or not.
2038   *
2039   * @return {string} Method name
2040   */
2041  
2042  
2043  var entities_getMethodName = function getMethodName(kind, name) {
2044    var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'get';
2045    var usePlural = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2046    var entity = Object(external_this_lodash_["find"])(defaultEntities, {
2047      kind: kind,
2048      name: name
2049    });
2050    var kindPrefix = kind === 'root' ? '' : Object(external_this_lodash_["upperFirst"])(Object(external_this_lodash_["camelCase"])(kind));
2051    var nameSuffix = Object(external_this_lodash_["upperFirst"])(Object(external_this_lodash_["camelCase"])(name)) + (usePlural ? 's' : '');
2052    var suffix = usePlural && entity.plural ? Object(external_this_lodash_["upperFirst"])(Object(external_this_lodash_["camelCase"])(entity.plural)) : nameSuffix;
2053    return "".concat(prefix).concat(kindPrefix).concat(suffix);
2054  };
2055  /**
2056   * Loads the kind entities into the store.
2057   *
2058   * @param {string} kind  Kind
2059   *
2060   * @return {Array} Entities
2061   */
2062  
2063  function getKindEntities(kind) {
2064    var entities, kindConfig;
2065    return external_this_regeneratorRuntime_default.a.wrap(function getKindEntities$(_context3) {
2066      while (1) {
2067        switch (_context3.prev = _context3.next) {
2068          case 0:
2069            _context3.next = 2;
2070            return controls_select('getEntitiesByKind', kind);
2071  
2072          case 2:
2073            entities = _context3.sent;
2074  
2075            if (!(entities && entities.length !== 0)) {
2076              _context3.next = 5;
2077              break;
2078            }
2079  
2080            return _context3.abrupt("return", entities);
2081  
2082          case 5:
2083            kindConfig = Object(external_this_lodash_["find"])(kinds, {
2084              name: kind
2085            });
2086  
2087            if (kindConfig) {
2088              _context3.next = 8;
2089              break;
2090            }
2091  
2092            return _context3.abrupt("return", []);
2093  
2094          case 8:
2095            _context3.next = 10;
2096            return kindConfig.loadEntities();
2097  
2098          case 10:
2099            entities = _context3.sent;
2100            _context3.next = 13;
2101            return addEntities(entities);
2102  
2103          case 13:
2104            return _context3.abrupt("return", entities);
2105  
2106          case 14:
2107          case "end":
2108            return _context3.stop();
2109        }
2110      }
2111    }, entities_marked3);
2112  }
2113  
2114  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/reducer.js
2115  
2116  
2117  function reducer_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; }
2118  
2119  function reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { reducer_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 { reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2120  
2121  /**
2122   * External dependencies
2123   */
2124  
2125  /**
2126   * WordPress dependencies
2127   */
2128  
2129  
2130  /**
2131   * Internal dependencies
2132   */
2133  
2134  
2135  
2136  
2137  /**
2138   * Returns a merged array of item IDs, given details of the received paginated
2139   * items. The array is sparse-like with `undefined` entries where holes exist.
2140   *
2141   * @param {?Array<number>} itemIds     Original item IDs (default empty array).
2142   * @param {number[]}       nextItemIds Item IDs to merge.
2143   * @param {number}         page        Page of items merged.
2144   * @param {number}         perPage     Number of items per page.
2145   *
2146   * @return {number[]} Merged array of item IDs.
2147   */
2148  
2149  function getMergedItemIds(itemIds, nextItemIds, page, perPage) {
2150    var nextItemIdsStartIndex = (page - 1) * perPage; // If later page has already been received, default to the larger known
2151    // size of the existing array, else calculate as extending the existing.
2152  
2153    var size = Math.max(itemIds.length, nextItemIdsStartIndex + nextItemIds.length); // Preallocate array since size is known.
2154  
2155    var mergedItemIds = new Array(size);
2156  
2157    for (var i = 0; i < size; i++) {
2158      // Preserve existing item ID except for subset of range of next items.
2159      var isInNextItemsRange = i >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + nextItemIds.length;
2160      mergedItemIds[i] = isInNextItemsRange ? nextItemIds[i - nextItemIdsStartIndex] : itemIds[i];
2161    }
2162  
2163    return mergedItemIds;
2164  }
2165  /**
2166   * Reducer tracking items state, keyed by ID. Items are assumed to be normal,
2167   * where identifiers are common across all queries.
2168   *
2169   * @param {Object} state  Current state.
2170   * @param {Object} action Dispatched action.
2171   *
2172   * @return {Object} Next state.
2173   */
2174  
2175  function reducer_items() {
2176    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2177    var action = arguments.length > 1 ? arguments[1] : undefined;
2178  
2179    switch (action.type) {
2180      case 'RECEIVE_ITEMS':
2181        var key = action.key || DEFAULT_ENTITY_KEY;
2182        return reducer_objectSpread({}, state, {}, action.items.reduce(function (accumulator, value) {
2183          var itemId = value[key];
2184          accumulator[itemId] = conservativeMapItem(state[itemId], value);
2185          return accumulator;
2186        }, {}));
2187    }
2188  
2189    return state;
2190  }
2191  /**
2192   * Reducer tracking queries state, keyed by stable query key. Each reducer
2193   * query object includes `itemIds` and `requestingPageByPerPage`.
2194   *
2195   * @param {Object} state  Current state.
2196   * @param {Object} action Dispatched action.
2197   *
2198   * @return {Object} Next state.
2199   */
2200  
2201  
2202  var queries = Object(external_this_lodash_["flowRight"])([// Limit to matching action type so we don't attempt to replace action on
2203  // an unhandled action.
2204  if_matching_action(function (action) {
2205    return 'query' in action;
2206  }), // Inject query parts into action for use both in `onSubKey` and reducer.
2207  replace_action(function (action) {
2208    // `ifMatchingAction` still passes on initialization, where state is
2209    // undefined and a query is not assigned. Avoid attempting to parse
2210    // parts. `onSubKey` will omit by lack of `stableKey`.
2211    if (action.query) {
2212      return reducer_objectSpread({}, action, {}, get_query_parts(action.query));
2213    }
2214  
2215    return action;
2216  }), // Queries shape is shared, but keyed by query `stableKey` part. Original
2217  // reducer tracks only a single query object.
2218  on_sub_key('stableKey')])(function () {
2219    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2220    var action = arguments.length > 1 ? arguments[1] : undefined;
2221    var type = action.type,
2222        page = action.page,
2223        perPage = action.perPage,
2224        _action$key = action.key,
2225        key = _action$key === void 0 ? DEFAULT_ENTITY_KEY : _action$key;
2226  
2227    if (type !== 'RECEIVE_ITEMS') {
2228      return state;
2229    }
2230  
2231    return getMergedItemIds(state || [], Object(external_this_lodash_["map"])(action.items, key), page, perPage);
2232  });
2233  /* harmony default export */ var queried_data_reducer = (Object(external_this_wp_data_["combineReducers"])({
2234    items: reducer_items,
2235    queries: queries
2236  }));
2237  
2238  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/index.js
2239  
2240  
2241  
2242  
2243  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/reducer.js
2244  
2245  
2246  
2247  
2248  function build_module_reducer_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; }
2249  
2250  function build_module_reducer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { build_module_reducer_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 { build_module_reducer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2251  
2252  /**
2253   * External dependencies
2254   */
2255  
2256  /**
2257   * WordPress dependencies
2258   */
2259  
2260  
2261  
2262  /**
2263   * Internal dependencies
2264   */
2265  
2266  
2267  
2268  
2269  /**
2270   * Reducer managing terms state. Keyed by taxonomy slug, the value is either
2271   * undefined (if no request has been made for given taxonomy), null (if a
2272   * request is in-flight for given taxonomy), or the array of terms for the
2273   * taxonomy.
2274   *
2275   * @param {Object} state  Current state.
2276   * @param {Object} action Dispatched action.
2277   *
2278   * @return {Object} Updated state.
2279   */
2280  
2281  function terms() {
2282    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2283    var action = arguments.length > 1 ? arguments[1] : undefined;
2284  
2285    switch (action.type) {
2286      case 'RECEIVE_TERMS':
2287        return build_module_reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.taxonomy, action.terms));
2288    }
2289  
2290    return state;
2291  }
2292  /**
2293   * Reducer managing authors state. Keyed by id.
2294   *
2295   * @param {Object} state  Current state.
2296   * @param {Object} action Dispatched action.
2297   *
2298   * @return {Object} Updated state.
2299   */
2300  
2301  function reducer_users() {
2302    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
2303      byId: {},
2304      queries: {}
2305    };
2306    var action = arguments.length > 1 ? arguments[1] : undefined;
2307  
2308    switch (action.type) {
2309      case 'RECEIVE_USER_QUERY':
2310        return {
2311          byId: build_module_reducer_objectSpread({}, state.byId, {}, Object(external_this_lodash_["keyBy"])(action.users, 'id')),
2312          queries: build_module_reducer_objectSpread({}, state.queries, Object(defineProperty["a" /* default */])({}, action.queryID, Object(external_this_lodash_["map"])(action.users, function (user) {
2313            return user.id;
2314          })))
2315        };
2316    }
2317  
2318    return state;
2319  }
2320  /**
2321   * Reducer managing current user state.
2322   *
2323   * @param {Object} state  Current state.
2324   * @param {Object} action Dispatched action.
2325   *
2326   * @return {Object} Updated state.
2327   */
2328  
2329  function reducer_currentUser() {
2330    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2331    var action = arguments.length > 1 ? arguments[1] : undefined;
2332  
2333    switch (action.type) {
2334      case 'RECEIVE_CURRENT_USER':
2335        return action.currentUser;
2336    }
2337  
2338    return state;
2339  }
2340  /**
2341   * Reducer managing taxonomies.
2342   *
2343   * @param {Object} state  Current state.
2344   * @param {Object} action Dispatched action.
2345   *
2346   * @return {Object} Updated state.
2347   */
2348  
2349  function reducer_taxonomies() {
2350    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2351    var action = arguments.length > 1 ? arguments[1] : undefined;
2352  
2353    switch (action.type) {
2354      case 'RECEIVE_TAXONOMIES':
2355        return action.taxonomies;
2356    }
2357  
2358    return state;
2359  }
2360  /**
2361   * Reducer managing theme supports data.
2362   *
2363   * @param {Object} state  Current state.
2364   * @param {Object} action Dispatched action.
2365   *
2366   * @return {Object} Updated state.
2367   */
2368  
2369  function themeSupports() {
2370    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2371    var action = arguments.length > 1 ? arguments[1] : undefined;
2372  
2373    switch (action.type) {
2374      case 'RECEIVE_THEME_SUPPORTS':
2375        return build_module_reducer_objectSpread({}, state, {}, action.themeSupports);
2376    }
2377  
2378    return state;
2379  }
2380  /**
2381   * Higher Order Reducer for a given entity config. It supports:
2382   *
2383   *  - Fetching
2384   *  - Editing
2385   *  - Saving
2386   *
2387   * @param {Object} entityConfig  Entity config.
2388   *
2389   * @return {Function} Reducer.
2390   */
2391  
2392  function reducer_entity(entityConfig) {
2393    return Object(external_this_lodash_["flowRight"])([// Limit to matching action type so we don't attempt to replace action on
2394    // an unhandled action.
2395    if_matching_action(function (action) {
2396      return action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind;
2397    }), // Inject the entity config into the action.
2398    replace_action(function (action) {
2399      return build_module_reducer_objectSpread({}, action, {
2400        key: entityConfig.key || DEFAULT_ENTITY_KEY
2401      });
2402    })])(Object(external_this_wp_data_["combineReducers"])({
2403      queriedData: queried_data_reducer,
2404      edits: function edits() {
2405        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2406        var action = arguments.length > 1 ? arguments[1] : undefined;
2407  
2408        switch (action.type) {
2409          case 'RECEIVE_ITEMS':
2410            var nextState = build_module_reducer_objectSpread({}, state);
2411  
2412            var _iteratorNormalCompletion = true;
2413            var _didIteratorError = false;
2414            var _iteratorError = undefined;
2415  
2416            try {
2417              var _loop = function _loop() {
2418                var record = _step.value;
2419                var recordId = record[action.key];
2420                var edits = nextState[recordId];
2421  
2422                if (!edits) {
2423                  return "continue";
2424                }
2425  
2426                var nextEdits = Object.keys(edits).reduce(function (acc, key) {
2427                  // If the edited value is still different to the persisted value,
2428                  // keep the edited value in edits.
2429                  if ( // Edits are the "raw" attribute values, but records may have
2430                  // objects with more properties, so we use `get` here for the
2431                  // comparison.
2432                  !Object(external_this_lodash_["isEqual"])(edits[key], Object(external_this_lodash_["get"])(record[key], 'raw', record[key]))) {
2433                    acc[key] = edits[key];
2434                  }
2435  
2436                  return acc;
2437                }, {});
2438  
2439                if (Object.keys(nextEdits).length) {
2440                  nextState[recordId] = nextEdits;
2441                } else {
2442                  delete nextState[recordId];
2443                }
2444              };
2445  
2446              for (var _iterator = action.items[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
2447                var _ret = _loop();
2448  
2449                if (_ret === "continue") continue;
2450              }
2451            } catch (err) {
2452              _didIteratorError = true;
2453              _iteratorError = err;
2454            } finally {
2455              try {
2456                if (!_iteratorNormalCompletion && _iterator.return != null) {
2457                  _iterator.return();
2458                }
2459              } finally {
2460                if (_didIteratorError) {
2461                  throw _iteratorError;
2462                }
2463              }
2464            }
2465  
2466            return nextState;
2467  
2468          case 'EDIT_ENTITY_RECORD':
2469            var nextEdits = build_module_reducer_objectSpread({}, state[action.recordId], {}, action.edits);
2470  
2471            Object.keys(nextEdits).forEach(function (key) {
2472              // Delete cleared edits so that the properties
2473              // are not considered dirty.
2474              if (nextEdits[key] === undefined) {
2475                delete nextEdits[key];
2476              }
2477            });
2478            return build_module_reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.recordId, nextEdits));
2479        }
2480  
2481        return state;
2482      },
2483      saving: function saving() {
2484        var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2485        var action = arguments.length > 1 ? arguments[1] : undefined;
2486  
2487        switch (action.type) {
2488          case 'SAVE_ENTITY_RECORD_START':
2489          case 'SAVE_ENTITY_RECORD_FINISH':
2490            return build_module_reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.recordId, {
2491              pending: action.type === 'SAVE_ENTITY_RECORD_START',
2492              error: action.error,
2493              isAutosave: action.isAutosave
2494            }));
2495        }
2496  
2497        return state;
2498      }
2499    }));
2500  }
2501  /**
2502   * Reducer keeping track of the registered entities.
2503   *
2504   * @param {Object} state  Current state.
2505   * @param {Object} action Dispatched action.
2506   *
2507   * @return {Object} Updated state.
2508   */
2509  
2510  
2511  function entitiesConfig() {
2512    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultEntities;
2513    var action = arguments.length > 1 ? arguments[1] : undefined;
2514  
2515    switch (action.type) {
2516      case 'ADD_ENTITIES':
2517        return [].concat(Object(toConsumableArray["a" /* default */])(state), Object(toConsumableArray["a" /* default */])(action.entities));
2518    }
2519  
2520    return state;
2521  }
2522  /**
2523   * Reducer keeping track of the registered entities config and data.
2524   *
2525   * @param {Object} state  Current state.
2526   * @param {Object} action Dispatched action.
2527   *
2528   * @return {Object} Updated state.
2529   */
2530  
2531  var reducer_entities = function entities() {
2532    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2533    var action = arguments.length > 1 ? arguments[1] : undefined;
2534    var newConfig = entitiesConfig(state.config, action); // Generates a dynamic reducer for the entities
2535  
2536    var entitiesDataReducer = state.reducer;
2537  
2538    if (!entitiesDataReducer || newConfig !== state.config) {
2539      var entitiesByKind = Object(external_this_lodash_["groupBy"])(newConfig, 'kind');
2540      entitiesDataReducer = Object(external_this_wp_data_["combineReducers"])(Object.entries(entitiesByKind).reduce(function (memo, _ref) {
2541        var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
2542            kind = _ref2[0],
2543            subEntities = _ref2[1];
2544  
2545        var kindReducer = Object(external_this_wp_data_["combineReducers"])(subEntities.reduce(function (kindMemo, entityConfig) {
2546          return build_module_reducer_objectSpread({}, kindMemo, Object(defineProperty["a" /* default */])({}, entityConfig.name, reducer_entity(entityConfig)));
2547        }, {}));
2548        memo[kind] = kindReducer;
2549        return memo;
2550      }, {}));
2551    }
2552  
2553    var newData = entitiesDataReducer(state.data, action);
2554  
2555    if (newData === state.data && newConfig === state.config && entitiesDataReducer === state.reducer) {
2556      return state;
2557    }
2558  
2559    return {
2560      reducer: entitiesDataReducer,
2561      data: newData,
2562      config: newConfig
2563    };
2564  };
2565  /**
2566   * Reducer keeping track of entity edit undo history.
2567   *
2568   * @param {Object} state  Current state.
2569   * @param {Object} action Dispatched action.
2570   *
2571   * @return {Object} Updated state.
2572   */
2573  
2574  var UNDO_INITIAL_STATE = [];
2575  UNDO_INITIAL_STATE.offset = 0;
2576  var lastEditAction;
2577  function reducer_undo() {
2578    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : UNDO_INITIAL_STATE;
2579    var action = arguments.length > 1 ? arguments[1] : undefined;
2580  
2581    switch (action.type) {
2582      case 'EDIT_ENTITY_RECORD':
2583      case 'CREATE_UNDO_LEVEL':
2584        var isCreateUndoLevel = action.type === 'CREATE_UNDO_LEVEL';
2585        var isUndoOrRedo = !isCreateUndoLevel && (action.meta.isUndo || action.meta.isRedo);
2586  
2587        if (isCreateUndoLevel) {
2588          action = lastEditAction;
2589        } else if (!isUndoOrRedo) {
2590          // Don't lose the last edit cache if the new one only has transient edits.
2591          // Transient edits don't create new levels so updating the cache would make
2592          // us skip an edit later when creating levels explicitly.
2593          if (Object.keys(action.edits).some(function (key) {
2594            return !action.transientEdits[key];
2595          })) {
2596            lastEditAction = action;
2597          } else {
2598            lastEditAction = build_module_reducer_objectSpread({}, action, {
2599              edits: build_module_reducer_objectSpread({}, lastEditAction && lastEditAction.edits, {}, action.edits)
2600            });
2601          }
2602        }
2603  
2604        var nextState;
2605  
2606        if (isUndoOrRedo) {
2607          nextState = Object(toConsumableArray["a" /* default */])(state);
2608          nextState.offset = state.offset + (action.meta.isUndo ? -1 : 1);
2609  
2610          if (state.flattenedUndo) {
2611            // The first undo in a sequence of undos might happen while we have
2612            // flattened undos in state. If this is the case, we want execution
2613            // to continue as if we were creating an explicit undo level. This
2614            // will result in an extra undo level being appended with the flattened
2615            // undo values.
2616            isCreateUndoLevel = true;
2617            action = lastEditAction;
2618          } else {
2619            return nextState;
2620          }
2621        }
2622  
2623        if (!action.meta.undo) {
2624          return state;
2625        } // Transient edits don't create an undo level, but are
2626        // reachable in the next meaningful edit to which they
2627        // are merged. They are defined in the entity's config.
2628  
2629  
2630        if (!isCreateUndoLevel && !Object.keys(action.edits).some(function (key) {
2631          return !action.transientEdits[key];
2632        })) {
2633          nextState = Object(toConsumableArray["a" /* default */])(state);
2634          nextState.flattenedUndo = build_module_reducer_objectSpread({}, state.flattenedUndo, {}, action.edits);
2635          nextState.offset = state.offset;
2636          return nextState;
2637        } // Clear potential redos, because this only supports linear history.
2638  
2639  
2640        nextState = nextState || state.slice(0, state.offset || undefined);
2641        nextState.offset = nextState.offset || 0;
2642        nextState.pop();
2643  
2644        if (!isCreateUndoLevel) {
2645          nextState.push({
2646            kind: action.meta.undo.kind,
2647            name: action.meta.undo.name,
2648            recordId: action.meta.undo.recordId,
2649            edits: build_module_reducer_objectSpread({}, state.flattenedUndo, {}, action.meta.undo.edits)
2650          });
2651        } // When an edit is a function it's an optimization to avoid running some expensive operation.
2652        // We can't rely on the function references being the same so we opt out of comparing them here.
2653  
2654  
2655        var comparisonUndoEdits = Object.values(action.meta.undo.edits).filter(function (edit) {
2656          return typeof edit !== 'function';
2657        });
2658        var comparisonEdits = Object.values(action.edits).filter(function (edit) {
2659          return typeof edit !== 'function';
2660        });
2661  
2662        if (!external_this_wp_isShallowEqual_default()(comparisonUndoEdits, comparisonEdits)) {
2663          nextState.push({
2664            kind: action.kind,
2665            name: action.name,
2666            recordId: action.recordId,
2667            edits: isCreateUndoLevel ? build_module_reducer_objectSpread({}, state.flattenedUndo, {}, action.edits) : action.edits
2668          });
2669        }
2670  
2671        return nextState;
2672    }
2673  
2674    return state;
2675  }
2676  /**
2677   * Reducer managing embed preview data.
2678   *
2679   * @param {Object} state  Current state.
2680   * @param {Object} action Dispatched action.
2681   *
2682   * @return {Object} Updated state.
2683   */
2684  
2685  function embedPreviews() {
2686    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2687    var action = arguments.length > 1 ? arguments[1] : undefined;
2688  
2689    switch (action.type) {
2690      case 'RECEIVE_EMBED_PREVIEW':
2691        var url = action.url,
2692            preview = action.preview;
2693        return build_module_reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, url, preview));
2694    }
2695  
2696    return state;
2697  }
2698  /**
2699   * State which tracks whether the user can perform an action on a REST
2700   * resource.
2701   *
2702   * @param  {Object} state  Current state.
2703   * @param  {Object} action Dispatched action.
2704   *
2705   * @return {Object} Updated state.
2706   */
2707  
2708  function userPermissions() {
2709    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2710    var action = arguments.length > 1 ? arguments[1] : undefined;
2711  
2712    switch (action.type) {
2713      case 'RECEIVE_USER_PERMISSION':
2714        return build_module_reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, action.key, action.isAllowed));
2715    }
2716  
2717    return state;
2718  }
2719  /**
2720   * Reducer returning autosaves keyed by their parent's post id.
2721   *
2722   * @param  {Object} state  Current state.
2723   * @param  {Object} action Dispatched action.
2724   *
2725   * @return {Object} Updated state.
2726   */
2727  
2728  function reducer_autosaves() {
2729    var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2730    var action = arguments.length > 1 ? arguments[1] : undefined;
2731  
2732    switch (action.type) {
2733      case 'RECEIVE_AUTOSAVES':
2734        var postId = action.postId,
2735            autosavesData = action.autosaves;
2736        return build_module_reducer_objectSpread({}, state, Object(defineProperty["a" /* default */])({}, postId, autosavesData));
2737    }
2738  
2739    return state;
2740  }
2741  /* harmony default export */ var build_module_reducer = (Object(external_this_wp_data_["combineReducers"])({
2742    terms: terms,
2743    users: reducer_users,
2744    currentUser: reducer_currentUser,
2745    taxonomies: reducer_taxonomies,
2746    themeSupports: themeSupports,
2747    entities: reducer_entities,
2748    undo: reducer_undo,
2749    embedPreviews: embedPreviews,
2750    userPermissions: userPermissions,
2751    autosaves: reducer_autosaves
2752  }));
2753  
2754  // EXTERNAL MODULE: external {"this":["wp","deprecated"]}
2755  var external_this_wp_deprecated_ = __webpack_require__(37);
2756  var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_);
2757  
2758  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/name.js
2759  /**
2760   * The reducer key used by core data in store registration.
2761   * This is defined in a separate file to avoid cycle-dependency
2762   *
2763   * @type {string}
2764   */
2765  var REDUCER_KEY = 'core';
2766  
2767  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/selectors.js
2768  
2769  
2770  function selectors_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; }
2771  
2772  function selectors_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selectors_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 { selectors_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
2773  
2774  /**
2775   * External dependencies
2776   */
2777  
2778  
2779  /**
2780   * WordPress dependencies
2781   */
2782  
2783  
2784  
2785  /**
2786   * Internal dependencies
2787   */
2788  
2789  
2790  
2791  /**
2792   * Returns true if a request is in progress for embed preview data, or false
2793   * otherwise.
2794   *
2795   * @param {Object} state Data state.
2796   * @param {string} url   URL the preview would be for.
2797   *
2798   * @return {boolean} Whether a request is in progress for an embed preview.
2799   */
2800  
2801  var isRequestingEmbedPreview = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
2802    return function (state, url) {
2803      return select('core/data').isResolving(REDUCER_KEY, 'getEmbedPreview', [url]);
2804    };
2805  });
2806  /**
2807   * Returns all available authors.
2808   *
2809   * @param {Object} state Data state.
2810   *
2811   * @return {Array} Authors list.
2812   */
2813  
2814  function getAuthors(state) {
2815    return getUserQueryResults(state, 'authors');
2816  }
2817  /**
2818   * Returns the current user.
2819   *
2820   * @param {Object} state Data state.
2821   *
2822   * @return {Object} Current user object.
2823   */
2824  
2825  function getCurrentUser(state) {
2826    return state.currentUser;
2827  }
2828  /**
2829   * Returns all the users returned by a query ID.
2830   *
2831   * @param {Object} state   Data state.
2832   * @param {string} queryID Query ID.
2833   *
2834   * @return {Array} Users list.
2835   */
2836  
2837  var getUserQueryResults = Object(rememo["a" /* default */])(function (state, queryID) {
2838    var queryResults = state.users.queries[queryID];
2839    return Object(external_this_lodash_["map"])(queryResults, function (id) {
2840      return state.users.byId[id];
2841    });
2842  }, function (state, queryID) {
2843    return [state.users.queries[queryID], state.users.byId];
2844  });
2845  /**
2846   * Returns whether the entities for the give kind are loaded.
2847   *
2848   * @param {Object} state   Data state.
2849   * @param {string} kind  Entity kind.
2850   *
2851   * @return {boolean} Whether the entities are loaded
2852   */
2853  
2854  function getEntitiesByKind(state, kind) {
2855    return Object(external_this_lodash_["filter"])(state.entities.config, {
2856      kind: kind
2857    });
2858  }
2859  /**
2860   * Returns the entity object given its kind and name.
2861   *
2862   * @param {Object} state   Data state.
2863   * @param {string} kind  Entity kind.
2864   * @param {string} name  Entity name.
2865   *
2866   * @return {Object} Entity
2867   */
2868  
2869  function selectors_getEntity(state, kind, name) {
2870    return Object(external_this_lodash_["find"])(state.entities.config, {
2871      kind: kind,
2872      name: name
2873    });
2874  }
2875  /**
2876   * Returns the Entity's record object by key.
2877   *
2878   * @param {Object} state  State tree
2879   * @param {string} kind   Entity kind.
2880   * @param {string} name   Entity name.
2881   * @param {number} key    Record's key
2882   *
2883   * @return {Object?} Record.
2884   */
2885  
2886  function getEntityRecord(state, kind, name, key) {
2887    return Object(external_this_lodash_["get"])(state.entities.data, [kind, name, 'queriedData', 'items', key]);
2888  }
2889  /**
2890   * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.
2891   *
2892   * @param {Object} state  State tree
2893   * @param {string} kind   Entity kind.
2894   * @param {string} name   Entity name.
2895   * @param {number} key    Record's key
2896   *
2897   * @return {Object?} Record.
2898   */
2899  
2900  function __experimentalGetEntityRecordNoResolver(state, kind, name, key) {
2901    return getEntityRecord(state, kind, name, key);
2902  }
2903  /**
2904   * Returns the entity's record object by key,
2905   * with its attributes mapped to their raw values.
2906   *
2907   * @param {Object} state  State tree.
2908   * @param {string} kind   Entity kind.
2909   * @param {string} name   Entity name.
2910   * @param {number} key    Record's key.
2911   *
2912   * @return {Object?} Object with the entity's raw attributes.
2913   */
2914  
2915  var getRawEntityRecord = Object(rememo["a" /* default */])(function (state, kind, name, key) {
2916    var record = getEntityRecord(state, kind, name, key);
2917    return record && Object.keys(record).reduce(function (accumulator, _key) {
2918      // Because edits are the "raw" attribute values,
2919      // we return those from record selectors to make rendering,
2920      // comparisons, and joins with edits easier.
2921      accumulator[_key] = Object(external_this_lodash_["get"])(record[_key], 'raw', record[_key]);
2922      return accumulator;
2923    }, {});
2924  }, function (state) {
2925    return [state.entities.data];
2926  });
2927  /**
2928   * Returns the Entity's records.
2929   *
2930   * @param {Object}  state  State tree
2931   * @param {string}  kind   Entity kind.
2932   * @param {string}  name   Entity name.
2933   * @param {?Object} query  Optional terms query.
2934   *
2935   * @return {Array} Records.
2936   */
2937  
2938  function getEntityRecords(state, kind, name, query) {
2939    var queriedState = Object(external_this_lodash_["get"])(state.entities.data, [kind, name, 'queriedData']);
2940  
2941    if (!queriedState) {
2942      return [];
2943    }
2944  
2945    return getQueriedItems(queriedState, query);
2946  }
2947  /**
2948   * Returns a map of objects with each edited
2949   * raw entity record and its corresponding edits.
2950   *
2951   * The map is keyed by entity `kind => name => key => { rawRecord, edits }`.
2952   *
2953   * @param {Object} state State tree.
2954   *
2955   * @return {{ [kind: string]: { [name: string]: { [key: string]: { rawRecord: Object<string,*>, edits: Object<string,*> } } } }} The map of edited records with their edits.
2956   */
2957  
2958  var getEntityRecordChangesByRecord = Object(rememo["a" /* default */])(function (state) {
2959    var data = state.entities.data;
2960    return Object.keys(data).reduce(function (acc, kind) {
2961      Object.keys(data[kind]).forEach(function (name) {
2962        var editsKeys = Object.keys(data[kind][name].edits).filter(function (editsKey) {
2963          return hasEditsForEntityRecord(state, kind, name, editsKey);
2964        });
2965  
2966        if (editsKeys.length) {
2967          if (!acc[kind]) {
2968            acc[kind] = {};
2969          }
2970  
2971          if (!acc[kind][name]) {
2972            acc[kind][name] = {};
2973          }
2974  
2975          editsKeys.forEach(function (editsKey) {
2976            return acc[kind][name][editsKey] = {
2977              rawRecord: getRawEntityRecord(state, kind, name, editsKey),
2978              edits: getEntityRecordNonTransientEdits(state, kind, name, editsKey)
2979            };
2980          });
2981        }
2982      });
2983      return acc;
2984    }, {});
2985  }, function (state) {
2986    return [state.entities.data];
2987  });
2988  /**
2989   * Returns the specified entity record's edits.
2990   *
2991   * @param {Object} state    State tree.
2992   * @param {string} kind     Entity kind.
2993   * @param {string} name     Entity name.
2994   * @param {number} recordId Record ID.
2995   *
2996   * @return {Object?} The entity record's edits.
2997   */
2998  
2999  function getEntityRecordEdits(state, kind, name, recordId) {
3000    return Object(external_this_lodash_["get"])(state.entities.data, [kind, name, 'edits', recordId]);
3001  }
3002  /**
3003   * Returns the specified entity record's non transient edits.
3004   *
3005   * Transient edits don't create an undo level, and
3006   * are not considered for change detection.
3007   * They are defined in the entity's config.
3008   *
3009   * @param {Object} state    State tree.
3010   * @param {string} kind     Entity kind.
3011   * @param {string} name     Entity name.
3012   * @param {number} recordId Record ID.
3013   *
3014   * @return {Object?} The entity record's non transient edits.
3015   */
3016  
3017  var getEntityRecordNonTransientEdits = Object(rememo["a" /* default */])(function (state, kind, name, recordId) {
3018    var _ref = selectors_getEntity(state, kind, name) || {},
3019        transientEdits = _ref.transientEdits;
3020  
3021    var edits = getEntityRecordEdits(state, kind, name, recordId) || {};
3022  
3023    if (!transientEdits) {
3024      return edits;
3025    }
3026  
3027    return Object.keys(edits).reduce(function (acc, key) {
3028      if (!transientEdits[key]) {
3029        acc[key] = edits[key];
3030      }
3031  
3032      return acc;
3033    }, {});
3034  }, function (state) {
3035    return [state.entities.config, state.entities.data];
3036  });
3037  /**
3038   * Returns true if the specified entity record has edits,
3039   * and false otherwise.
3040   *
3041   * @param {Object} state    State tree.
3042   * @param {string} kind     Entity kind.
3043   * @param {string} name     Entity name.
3044   * @param {number} recordId Record ID.
3045   *
3046   * @return {boolean} Whether the entity record has edits or not.
3047   */
3048  
3049  function hasEditsForEntityRecord(state, kind, name, recordId) {
3050    return isSavingEntityRecord(state, kind, name, recordId) || Object.keys(getEntityRecordNonTransientEdits(state, kind, name, recordId)).length > 0;
3051  }
3052  /**
3053   * Returns the specified entity record, merged with its edits.
3054   *
3055   * @param {Object} state    State tree.
3056   * @param {string} kind     Entity kind.
3057   * @param {string} name     Entity name.
3058   * @param {number} recordId Record ID.
3059   *
3060   * @return {Object?} The entity record, merged with its edits.
3061   */
3062  
3063  var getEditedEntityRecord = Object(rememo["a" /* default */])(function (state, kind, name, recordId) {
3064    return selectors_objectSpread({}, getRawEntityRecord(state, kind, name, recordId), {}, getEntityRecordEdits(state, kind, name, recordId));
3065  }, function (state) {
3066    return [state.entities.data];
3067  });
3068  /**
3069   * Returns true if the specified entity record is autosaving, and false otherwise.
3070   *
3071   * @param {Object} state    State tree.
3072   * @param {string} kind     Entity kind.
3073   * @param {string} name     Entity name.
3074   * @param {number} recordId Record ID.
3075   *
3076   * @return {boolean} Whether the entity record is autosaving or not.
3077   */
3078  
3079  function isAutosavingEntityRecord(state, kind, name, recordId) {
3080    var _get = Object(external_this_lodash_["get"])(state.entities.data, [kind, name, 'saving', recordId], {}),
3081        pending = _get.pending,
3082        isAutosave = _get.isAutosave;
3083  
3084    return Boolean(pending && isAutosave);
3085  }
3086  /**
3087   * Returns true if the specified entity record is saving, and false otherwise.
3088   *
3089   * @param {Object} state    State tree.
3090   * @param {string} kind     Entity kind.
3091   * @param {string} name     Entity name.
3092   * @param {number} recordId Record ID.
3093   *
3094   * @return {boolean} Whether the entity record is saving or not.
3095   */
3096  
3097  function isSavingEntityRecord(state, kind, name, recordId) {
3098    return Object(external_this_lodash_["get"])(state.entities.data, [kind, name, 'saving', recordId, 'pending'], false);
3099  }
3100  /**
3101   * Returns the specified entity record's last save error.
3102   *
3103   * @param {Object} state    State tree.
3104   * @param {string} kind     Entity kind.
3105   * @param {string} name     Entity name.
3106   * @param {number} recordId Record ID.
3107   *
3108   * @return {Object?} The entity record's save error.
3109   */
3110  
3111  function getLastEntitySaveError(state, kind, name, recordId) {
3112    return Object(external_this_lodash_["get"])(state.entities.data, [kind, name, 'saving', recordId, 'error']);
3113  }
3114  /**
3115   * Returns the current undo offset for the
3116   * entity records edits history. The offset
3117   * represents how many items from the end
3118   * of the history stack we are at. 0 is the
3119   * last edit, -1 is the second last, and so on.
3120   *
3121   * @param {Object} state State tree.
3122   *
3123   * @return {number} The current undo offset.
3124   */
3125  
3126  function getCurrentUndoOffset(state) {
3127    return state.undo.offset;
3128  }
3129  /**
3130   * Returns the previous edit from the current undo offset
3131   * for the entity records edits history, if any.
3132   *
3133   * @param {Object} state State tree.
3134   *
3135   * @return {Object?} The edit.
3136   */
3137  
3138  
3139  function getUndoEdit(state) {
3140    return state.undo[state.undo.length - 2 + getCurrentUndoOffset(state)];
3141  }
3142  /**
3143   * Returns the next edit from the current undo offset
3144   * for the entity records edits history, if any.
3145   *
3146   * @param {Object} state State tree.
3147   *
3148   * @return {Object?} The edit.
3149   */
3150  
3151  function getRedoEdit(state) {
3152    return state.undo[state.undo.length + getCurrentUndoOffset(state)];
3153  }
3154  /**
3155   * Returns true if there is a previous edit from the current undo offset
3156   * for the entity records edits history, and false otherwise.
3157   *
3158   * @param {Object} state State tree.
3159   *
3160   * @return {boolean} Whether there is a previous edit or not.
3161   */
3162  
3163  function hasUndo(state) {
3164    return Boolean(getUndoEdit(state));
3165  }
3166  /**
3167   * Returns true if there is a next edit from the current undo offset
3168   * for the entity records edits history, and false otherwise.
3169   *
3170   * @param {Object} state State tree.
3171   *
3172   * @return {boolean} Whether there is a next edit or not.
3173   */
3174  
3175  function hasRedo(state) {
3176    return Boolean(getRedoEdit(state));
3177  }
3178  /**
3179   * Return theme supports data in the index.
3180   *
3181   * @param {Object} state Data state.
3182   *
3183   * @return {*}           Index data.
3184   */
3185  
3186  function getThemeSupports(state) {
3187    return state.themeSupports;
3188  }
3189  /**
3190   * Returns the embed preview for the given URL.
3191   *
3192   * @param {Object} state    Data state.
3193   * @param {string} url      Embedded URL.
3194   *
3195   * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.
3196   */
3197  
3198  function getEmbedPreview(state, url) {
3199    return state.embedPreviews[url];
3200  }
3201  /**
3202   * Determines if the returned preview is an oEmbed link fallback.
3203   *
3204   * WordPress can be configured to return a simple link to a URL if it is not embeddable.
3205   * We need to be able to determine if a URL is embeddable or not, based on what we
3206   * get back from the oEmbed preview API.
3207   *
3208   * @param {Object} state    Data state.
3209   * @param {string} url      Embedded URL.
3210   *
3211   * @return {boolean} Is the preview for the URL an oEmbed link fallback.
3212   */
3213  
3214  function isPreviewEmbedFallback(state, url) {
3215    var preview = state.embedPreviews[url];
3216    var oEmbedLinkCheck = '<a href="' + url + '">' + url + '</a>';
3217  
3218    if (!preview) {
3219      return false;
3220    }
3221  
3222    return preview.html === oEmbedLinkCheck;
3223  }
3224  /**
3225   * Returns whether the current user can upload media.
3226   *
3227   * Calling this may trigger an OPTIONS request to the REST API via the
3228   * `canUser()` resolver.
3229   *
3230   * https://developer.wordpress.org/rest-api/reference/
3231   *
3232   * @deprecated since 5.0. Callers should use the more generic `canUser()` selector instead of
3233   *             `hasUploadPermissions()`, e.g. `canUser( 'create', 'media' )`.
3234   *
3235   * @param {Object} state Data state.
3236   *
3237   * @return {boolean} Whether or not the user can upload media. Defaults to `true` if the OPTIONS
3238   *                   request is being made.
3239   */
3240  
3241  function hasUploadPermissions(state) {
3242    external_this_wp_deprecated_default()("select( 'core' ).hasUploadPermissions()", {
3243      alternative: "select( 'core' ).canUser( 'create', 'media' )"
3244    });
3245    return Object(external_this_lodash_["defaultTo"])(canUser(state, 'create', 'media'), true);
3246  }
3247  /**
3248   * Returns whether the current user can perform the given action on the given
3249   * REST resource.
3250   *
3251   * Calling this may trigger an OPTIONS request to the REST API via the
3252   * `canUser()` resolver.
3253   *
3254   * https://developer.wordpress.org/rest-api/reference/
3255   *
3256   * @param {Object}   state            Data state.
3257   * @param {string}   action           Action to check. One of: 'create', 'read', 'update', 'delete'.
3258   * @param {string}   resource         REST resource to check, e.g. 'media' or 'posts'.
3259   * @param {string=}  id               Optional ID of the rest resource to check.
3260   *
3261   * @return {boolean|undefined} Whether or not the user can perform the action,
3262   *                             or `undefined` if the OPTIONS request is still being made.
3263   */
3264  
3265  function canUser(state, action, resource, id) {
3266    var key = Object(external_this_lodash_["compact"])([action, resource, id]).join('/');
3267    return Object(external_this_lodash_["get"])(state, ['userPermissions', key]);
3268  }
3269  /**
3270   * Returns the latest autosaves for the post.
3271   *
3272   * May return multiple autosaves since the backend stores one autosave per
3273   * author for each post.
3274   *
3275   * @param {Object} state    State tree.
3276   * @param {string} postType The type of the parent post.
3277   * @param {number} postId   The id of the parent post.
3278   *
3279   * @return {?Array} An array of autosaves for the post, or undefined if there is none.
3280   */
3281  
3282  function getAutosaves(state, postType, postId) {
3283    return state.autosaves[postId];
3284  }
3285  /**
3286   * Returns the autosave for the post and author.
3287   *
3288   * @param {Object} state    State tree.
3289   * @param {string} postType The type of the parent post.
3290   * @param {number} postId   The id of the parent post.
3291   * @param {number} authorId The id of the author.
3292   *
3293   * @return {?Object} The autosave for the post and author.
3294   */
3295  
3296  function getAutosave(state, postType, postId, authorId) {
3297    if (authorId === undefined) {
3298      return;
3299    }
3300  
3301    var autosaves = state.autosaves[postId];
3302    return Object(external_this_lodash_["find"])(autosaves, {
3303      author: authorId
3304    });
3305  }
3306  /**
3307   * Returns true if the REST request for autosaves has completed.
3308   *
3309   * @param {Object} state State tree.
3310   * @param {string} postType The type of the parent post.
3311   * @param {number} postId   The id of the parent post.
3312   *
3313   * @return {boolean} True if the REST request was completed. False otherwise.
3314   */
3315  
3316  var hasFetchedAutosaves = Object(external_this_wp_data_["createRegistrySelector"])(function (select) {
3317    return function (state, postType, postId) {
3318      return select(REDUCER_KEY).hasFinishedResolution('getAutosaves', [postType, postId]);
3319    };
3320  });
3321  /**
3322   * Returns a new reference when edited values have changed. This is useful in
3323   * inferring where an edit has been made between states by comparison of the
3324   * return values using strict equality.
3325   *
3326   * @example
3327   *
3328   * ```
3329   * const hasEditOccurred = (
3330   *    getReferenceByDistinctEdits( beforeState ) !==
3331   *    getReferenceByDistinctEdits( afterState )
3332   * );
3333   * ```
3334   *
3335   * @param {Object} state Editor state.
3336   *
3337   * @return {*} A value whose reference will change only when an edit occurs.
3338   */
3339  
3340  var getReferenceByDistinctEdits = Object(rememo["a" /* default */])(function () {
3341    return [];
3342  }, function (state) {
3343    return [state.undo.length, state.undo.offset];
3344  });
3345  
3346  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/resolvers.js
3347  
3348  
3349  
3350  function resolvers_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; }
3351  
3352  function resolvers_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { resolvers_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 { resolvers_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3353  
3354  var resolvers_marked =
3355  /*#__PURE__*/
3356  external_this_regeneratorRuntime_default.a.mark(resolvers_getAuthors),
3357      resolvers_marked2 =
3358  /*#__PURE__*/
3359  external_this_regeneratorRuntime_default.a.mark(resolvers_getCurrentUser),
3360      resolvers_marked3 =
3361  /*#__PURE__*/
3362  external_this_regeneratorRuntime_default.a.mark(resolvers_getEntityRecord),
3363      resolvers_marked4 =
3364  /*#__PURE__*/
3365  external_this_regeneratorRuntime_default.a.mark(resolvers_getEntityRecords),
3366      resolvers_marked5 =
3367  /*#__PURE__*/
3368  external_this_regeneratorRuntime_default.a.mark(resolvers_getThemeSupports),
3369      _marked6 =
3370  /*#__PURE__*/
3371  external_this_regeneratorRuntime_default.a.mark(resolvers_getEmbedPreview),
3372      _marked7 =
3373  /*#__PURE__*/
3374  external_this_regeneratorRuntime_default.a.mark(resolvers_hasUploadPermissions),
3375      _marked8 =
3376  /*#__PURE__*/
3377  external_this_regeneratorRuntime_default.a.mark(resolvers_canUser),
3378      _marked9 =
3379  /*#__PURE__*/
3380  external_this_regeneratorRuntime_default.a.mark(resolvers_getAutosaves),
3381      _marked10 =
3382  /*#__PURE__*/
3383  external_this_regeneratorRuntime_default.a.mark(resolvers_getAutosave);
3384  
3385  /**
3386   * External dependencies
3387   */
3388  
3389  /**
3390   * WordPress dependencies
3391   */
3392  
3393  
3394  
3395  /**
3396   * Internal dependencies
3397   */
3398  
3399  
3400  
3401  
3402  /**
3403   * Requests authors from the REST API.
3404   */
3405  
3406  function resolvers_getAuthors() {
3407    var users;
3408    return external_this_regeneratorRuntime_default.a.wrap(function getAuthors$(_context) {
3409      while (1) {
3410        switch (_context.prev = _context.next) {
3411          case 0:
3412            _context.next = 2;
3413            return apiFetch({
3414              path: '/wp/v2/users/?who=authors&per_page=-1'
3415            });
3416  
3417          case 2:
3418            users = _context.sent;
3419            _context.next = 5;
3420            return receiveUserQuery('authors', users);
3421  
3422          case 5:
3423          case "end":
3424            return _context.stop();
3425        }
3426      }
3427    }, resolvers_marked);
3428  }
3429  /**
3430   * Requests the current user from the REST API.
3431   */
3432  
3433  function resolvers_getCurrentUser() {
3434    var currentUser;
3435    return external_this_regeneratorRuntime_default.a.wrap(function getCurrentUser$(_context2) {
3436      while (1) {
3437        switch (_context2.prev = _context2.next) {
3438          case 0:
3439            _context2.next = 2;
3440            return apiFetch({
3441              path: '/wp/v2/users/me'
3442            });
3443  
3444          case 2:
3445            currentUser = _context2.sent;
3446            _context2.next = 5;
3447            return receiveCurrentUser(currentUser);
3448  
3449          case 5:
3450          case "end":
3451            return _context2.stop();
3452        }
3453      }
3454    }, resolvers_marked2);
3455  }
3456  /**
3457   * Requests an entity's record from the REST API.
3458   *
3459   * @param {string} kind   Entity kind.
3460   * @param {string} name   Entity name.
3461   * @param {number} key    Record's key
3462   */
3463  
3464  function resolvers_getEntityRecord(kind, name) {
3465    var key,
3466        entities,
3467        entity,
3468        record,
3469        _args3 = arguments;
3470    return external_this_regeneratorRuntime_default.a.wrap(function getEntityRecord$(_context3) {
3471      while (1) {
3472        switch (_context3.prev = _context3.next) {
3473          case 0:
3474            key = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : '';
3475            _context3.next = 3;
3476            return getKindEntities(kind);
3477  
3478          case 3:
3479            entities = _context3.sent;
3480            entity = Object(external_this_lodash_["find"])(entities, {
3481              kind: kind,
3482              name: name
3483            });
3484  
3485            if (entity) {
3486              _context3.next = 7;
3487              break;
3488            }
3489  
3490            return _context3.abrupt("return");
3491  
3492          case 7:
3493            _context3.next = 9;
3494            return apiFetch({
3495              path: "".concat(entity.baseURL, "/").concat(key, "?context=edit")
3496            });
3497  
3498          case 9:
3499            record = _context3.sent;
3500            _context3.next = 12;
3501            return receiveEntityRecords(kind, name, record);
3502  
3503          case 12:
3504          case "end":
3505            return _context3.stop();
3506        }
3507      }
3508    }, resolvers_marked3);
3509  }
3510  /**
3511   * Requests the entity's records from the REST API.
3512   *
3513   * @param {string}  kind   Entity kind.
3514   * @param {string}  name   Entity name.
3515   * @param {Object?} query  Query Object.
3516   */
3517  
3518  function resolvers_getEntityRecords(kind, name) {
3519    var query,
3520        entities,
3521        entity,
3522        path,
3523        records,
3524        _args4 = arguments;
3525    return external_this_regeneratorRuntime_default.a.wrap(function getEntityRecords$(_context4) {
3526      while (1) {
3527        switch (_context4.prev = _context4.next) {
3528          case 0:
3529            query = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
3530            _context4.next = 3;
3531            return getKindEntities(kind);
3532  
3533          case 3:
3534            entities = _context4.sent;
3535            entity = Object(external_this_lodash_["find"])(entities, {
3536              kind: kind,
3537              name: name
3538            });
3539  
3540            if (entity) {
3541              _context4.next = 7;
3542              break;
3543            }
3544  
3545            return _context4.abrupt("return");
3546  
3547          case 7:
3548            path = Object(external_this_wp_url_["addQueryArgs"])(entity.baseURL, resolvers_objectSpread({}, query, {
3549              context: 'edit'
3550            }));
3551            _context4.next = 10;
3552            return apiFetch({
3553              path: path
3554            });
3555  
3556          case 10:
3557            records = _context4.sent;
3558            _context4.next = 13;
3559            return receiveEntityRecords(kind, name, Object.values(records), query);
3560  
3561          case 13:
3562          case "end":
3563            return _context4.stop();
3564        }
3565      }
3566    }, resolvers_marked4);
3567  }
3568  
3569  resolvers_getEntityRecords.shouldInvalidate = function (action, kind, name) {
3570    return action.type === 'RECEIVE_ITEMS' && action.invalidateCache && kind === action.kind && name === action.name;
3571  };
3572  /**
3573   * Requests theme supports data from the index.
3574   */
3575  
3576  
3577  function resolvers_getThemeSupports() {
3578    var activeThemes;
3579    return external_this_regeneratorRuntime_default.a.wrap(function getThemeSupports$(_context5) {
3580      while (1) {
3581        switch (_context5.prev = _context5.next) {
3582          case 0:
3583            _context5.next = 2;
3584            return apiFetch({
3585              path: '/wp/v2/themes?status=active'
3586            });
3587  
3588          case 2:
3589            activeThemes = _context5.sent;
3590            _context5.next = 5;
3591            return receiveThemeSupports(activeThemes[0].theme_supports);
3592  
3593          case 5:
3594          case "end":
3595            return _context5.stop();
3596        }
3597      }
3598    }, resolvers_marked5);
3599  }
3600  /**
3601   * Requests a preview from the from the Embed API.
3602   *
3603   * @param {string} url   URL to get the preview for.
3604   */
3605  
3606  function resolvers_getEmbedPreview(url) {
3607    var embedProxyResponse;
3608    return external_this_regeneratorRuntime_default.a.wrap(function getEmbedPreview$(_context6) {
3609      while (1) {
3610        switch (_context6.prev = _context6.next) {
3611          case 0:
3612            _context6.prev = 0;
3613            _context6.next = 3;
3614            return apiFetch({
3615              path: Object(external_this_wp_url_["addQueryArgs"])('/oembed/1.0/proxy', {
3616                url: url
3617              })
3618            });
3619  
3620          case 3:
3621            embedProxyResponse = _context6.sent;
3622            _context6.next = 6;
3623            return receiveEmbedPreview(url, embedProxyResponse);
3624  
3625          case 6:
3626            _context6.next = 12;
3627            break;
3628  
3629          case 8:
3630            _context6.prev = 8;
3631            _context6.t0 = _context6["catch"](0);
3632            _context6.next = 12;
3633            return receiveEmbedPreview(url, false);
3634  
3635          case 12:
3636          case "end":
3637            return _context6.stop();
3638        }
3639      }
3640    }, _marked6, null, [[0, 8]]);
3641  }
3642  /**
3643   * Requests Upload Permissions from the REST API.
3644   *
3645   * @deprecated since 5.0. Callers should use the more generic `canUser()` selector instead of
3646   *            `hasUploadPermissions()`, e.g. `canUser( 'create', 'media' )`.
3647   */
3648  
3649  function resolvers_hasUploadPermissions() {
3650    return external_this_regeneratorRuntime_default.a.wrap(function hasUploadPermissions$(_context7) {
3651      while (1) {
3652        switch (_context7.prev = _context7.next) {
3653          case 0:
3654            external_this_wp_deprecated_default()("select( 'core' ).hasUploadPermissions()", {
3655              alternative: "select( 'core' ).canUser( 'create', 'media' )"
3656            });
3657            return _context7.delegateYield(resolvers_canUser('create', 'media'), "t0", 2);
3658  
3659          case 2:
3660          case "end":
3661            return _context7.stop();
3662        }
3663      }
3664    }, _marked7);
3665  }
3666  /**
3667   * Checks whether the current user can perform the given action on the given
3668   * REST resource.
3669   *
3670   * @param {string}  action   Action to check. One of: 'create', 'read', 'update',
3671   *                           'delete'.
3672   * @param {string}  resource REST resource to check, e.g. 'media' or 'posts'.
3673   * @param {?string} id       ID of the rest resource to check.
3674   */
3675  
3676  function resolvers_canUser(action, resource, id) {
3677    var methods, method, path, response, allowHeader, key, isAllowed;
3678    return external_this_regeneratorRuntime_default.a.wrap(function canUser$(_context8) {
3679      while (1) {
3680        switch (_context8.prev = _context8.next) {
3681          case 0:
3682            methods = {
3683              create: 'POST',
3684              read: 'GET',
3685              update: 'PUT',
3686              delete: 'DELETE'
3687            };
3688            method = methods[action];
3689  
3690            if (method) {
3691              _context8.next = 4;
3692              break;
3693            }
3694  
3695            throw new Error("'".concat(action, "' is not a valid action."));
3696  
3697          case 4:
3698            path = id ? "/wp/v2/".concat(resource, "/").concat(id) : "/wp/v2/".concat(resource);
3699            _context8.prev = 5;
3700            _context8.next = 8;
3701            return apiFetch({
3702              path: path,
3703              // Ideally this would always be an OPTIONS request, but unfortunately there's
3704              // a bug in the REST API which causes the Allow header to not be sent on
3705              // OPTIONS requests to /posts/:id routes.
3706              // https://core.trac.wordpress.org/ticket/45753
3707              method: id ? 'GET' : 'OPTIONS',
3708              parse: false
3709            });
3710  
3711          case 8:
3712            response = _context8.sent;
3713            _context8.next = 14;
3714            break;
3715  
3716          case 11:
3717            _context8.prev = 11;
3718            _context8.t0 = _context8["catch"](5);
3719            return _context8.abrupt("return");
3720  
3721          case 14:
3722            if (Object(external_this_lodash_["hasIn"])(response, ['headers', 'get'])) {
3723              // If the request is fetched using the fetch api, the header can be
3724              // retrieved using the 'get' method.
3725              allowHeader = response.headers.get('allow');
3726            } else {
3727              // If the request was preloaded server-side and is returned by the
3728              // preloading middleware, the header will be a simple property.
3729              allowHeader = Object(external_this_lodash_["get"])(response, ['headers', 'Allow'], '');
3730            }
3731  
3732            key = Object(external_this_lodash_["compact"])([action, resource, id]).join('/');
3733            isAllowed = Object(external_this_lodash_["includes"])(allowHeader, method);
3734            _context8.next = 19;
3735            return receiveUserPermission(key, isAllowed);
3736  
3737          case 19:
3738          case "end":
3739            return _context8.stop();
3740        }
3741      }
3742    }, _marked8, null, [[5, 11]]);
3743  }
3744  /**
3745   * Request autosave data from the REST API.
3746   *
3747   * @param {string} postType The type of the parent post.
3748   * @param {number} postId   The id of the parent post.
3749   */
3750  
3751  function resolvers_getAutosaves(postType, postId) {
3752    var _ref, restBase, autosaves;
3753  
3754    return external_this_regeneratorRuntime_default.a.wrap(function getAutosaves$(_context9) {
3755      while (1) {
3756        switch (_context9.prev = _context9.next) {
3757          case 0:
3758            _context9.next = 2;
3759            return resolveSelect('getPostType', postType);
3760  
3761          case 2:
3762            _ref = _context9.sent;
3763            restBase = _ref.rest_base;
3764            _context9.next = 6;
3765            return apiFetch({
3766              path: "/wp/v2/".concat(restBase, "/").concat(postId, "/autosaves?context=edit")
3767            });
3768  
3769          case 6:
3770            autosaves = _context9.sent;
3771  
3772            if (!(autosaves && autosaves.length)) {
3773              _context9.next = 10;
3774              break;
3775            }
3776  
3777            _context9.next = 10;
3778            return receiveAutosaves(postId, autosaves);
3779  
3780          case 10:
3781          case "end":
3782            return _context9.stop();
3783        }
3784      }
3785    }, _marked9);
3786  }
3787  /**
3788   * Request autosave data from the REST API.
3789   *
3790   * This resolver exists to ensure the underlying autosaves are fetched via
3791   * `getAutosaves` when a call to the `getAutosave` selector is made.
3792   *
3793   * @param {string} postType The type of the parent post.
3794   * @param {number} postId   The id of the parent post.
3795   */
3796  
3797  function resolvers_getAutosave(postType, postId) {
3798    return external_this_regeneratorRuntime_default.a.wrap(function getAutosave$(_context10) {
3799      while (1) {
3800        switch (_context10.prev = _context10.next) {
3801          case 0:
3802            _context10.next = 2;
3803            return resolveSelect('getAutosaves', postType, postId);
3804  
3805          case 2:
3806          case "end":
3807            return _context10.stop();
3808        }
3809      }
3810    }, _marked10);
3811  }
3812  
3813  // EXTERNAL MODULE: external {"this":["wp","element"]}
3814  var external_this_wp_element_ = __webpack_require__(0);
3815  
3816  // EXTERNAL MODULE: external {"this":["wp","blocks"]}
3817  var external_this_wp_blocks_ = __webpack_require__(10);
3818  
3819  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/entity-provider.js
3820  
3821  
3822  
3823  
3824  function entity_provider_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; }
3825  
3826  function entity_provider_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { entity_provider_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 { entity_provider_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3827  
3828  /**
3829   * WordPress dependencies
3830   */
3831  
3832  
3833  
3834  /**
3835   * Internal dependencies
3836   */
3837  
3838  
3839  
3840  var entity_provider_entities = entity_provider_objectSpread({}, defaultEntities.reduce(function (acc, entity) {
3841    if (!acc[entity.kind]) {
3842      acc[entity.kind] = {};
3843    }
3844  
3845    acc[entity.kind][entity.name] = {
3846      context: Object(external_this_wp_element_["createContext"])()
3847    };
3848    return acc;
3849  }, {}), {}, kinds.reduce(function (acc, kind) {
3850    acc[kind.name] = {};
3851    return acc;
3852  }, {}));
3853  
3854  var entity_provider_getEntity = function getEntity(kind, type) {
3855    if (!entity_provider_entities[kind]) {
3856      throw new Error("Missing entity config for kind: ".concat(kind, "."));
3857    }
3858  
3859    if (!entity_provider_entities[kind][type]) {
3860      entity_provider_entities[kind][type] = {
3861        context: Object(external_this_wp_element_["createContext"])()
3862      };
3863    }
3864  
3865    return entity_provider_entities[kind][type];
3866  };
3867  /**
3868   * Context provider component for providing
3869   * an entity for a specific entity type.
3870   *
3871   * @param {Object} props          The component's props.
3872   * @param {string} props.kind     The entity kind.
3873   * @param {string} props.type     The entity type.
3874   * @param {number} props.id       The entity ID.
3875   * @param {*}      props.children The children to wrap.
3876   *
3877   * @return {Object} The provided children, wrapped with
3878   *                   the entity's context provider.
3879   */
3880  
3881  
3882  function EntityProvider(_ref) {
3883    var kind = _ref.kind,
3884        type = _ref.type,
3885        id = _ref.id,
3886        children = _ref.children;
3887    var Provider = entity_provider_getEntity(kind, type).context.Provider;
3888    return Object(external_this_wp_element_["createElement"])(Provider, {
3889      value: id
3890    }, children);
3891  }
3892  /**
3893   * Hook that returns the ID for the nearest
3894   * provided entity of the specified type.
3895   *
3896   * @param {string} kind The entity kind.
3897   * @param {string} type The entity type.
3898   */
3899  
3900  function useEntityId(kind, type) {
3901    return Object(external_this_wp_element_["useContext"])(entity_provider_getEntity(kind, type).context);
3902  }
3903  /**
3904   * Hook that returns the value and a setter for the
3905   * specified property of the nearest provided
3906   * entity of the specified type.
3907   *
3908   * @param {string} kind The entity kind.
3909   * @param {string} type The entity type.
3910   * @param {string} prop The property name.
3911   *
3912   * @return {[*, Function]} A tuple where the first item is the
3913   *                          property value and the second is the
3914   *                          setter.
3915   */
3916  
3917  function useEntityProp(kind, type, prop) {
3918    var id = useEntityId(kind, type);
3919    var value = Object(external_this_wp_data_["useSelect"])(function (select) {
3920      var _select = select('core'),
3921          getEntityRecord = _select.getEntityRecord,
3922          getEditedEntityRecord = _select.getEditedEntityRecord;
3923  
3924      getEntityRecord(kind, type, id); // Trigger resolver.
3925  
3926      var entity = getEditedEntityRecord(kind, type, id);
3927      return entity && entity[prop];
3928    }, [kind, type, id, prop]);
3929  
3930    var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core'),
3931        editEntityRecord = _useDispatch.editEntityRecord;
3932  
3933    var setValue = Object(external_this_wp_element_["useCallback"])(function (newValue) {
3934      editEntityRecord(kind, type, id, Object(defineProperty["a" /* default */])({}, prop, newValue));
3935    }, [kind, type, id, prop]);
3936    return [value, setValue];
3937  }
3938  /**
3939   * Hook that returns block content getters and setters for
3940   * the nearest provided entity of the specified type.
3941   *
3942   * The return value has the shape `[ blocks, onInput, onChange ]`.
3943   * `onInput` is for block changes that don't create undo levels
3944   * or dirty the post, non-persistent changes, and `onChange` is for
3945   * peristent changes. They map directly to the props of a
3946   * `BlockEditorProvider` and are intended to be used with it,
3947   * or similar components or hooks.
3948   *
3949   * @param {string} kind                            The entity kind.
3950   * @param {string} type                            The entity type.
3951   * @param {Object} options
3952   * @param {Object} [options.initialEdits]          Initial edits object for the entity record.
3953   * @param {string} [options.blocksProp='blocks']   The name of the entity prop that holds the blocks array.
3954   * @param {string} [options.contentProp='content'] The name of the entity prop that holds the serialized blocks.
3955   *
3956   * @return {[WPBlock[], Function, Function]} The block array and setters.
3957   */
3958  
3959  function useEntityBlockEditor(kind, type) {
3960    var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
3961        initialEdits = _ref2.initialEdits,
3962        _ref2$blocksProp = _ref2.blocksProp,
3963        blocksProp = _ref2$blocksProp === void 0 ? 'blocks' : _ref2$blocksProp,
3964        _ref2$contentProp = _ref2.contentProp,
3965        contentProp = _ref2$contentProp === void 0 ? 'content' : _ref2$contentProp;
3966  
3967    var _useEntityProp = useEntityProp(kind, type, contentProp),
3968        _useEntityProp2 = Object(slicedToArray["a" /* default */])(_useEntityProp, 2),
3969        content = _useEntityProp2[0],
3970        setContent = _useEntityProp2[1];
3971  
3972    var _useDispatch2 = Object(external_this_wp_data_["useDispatch"])('core'),
3973        editEntityRecord = _useDispatch2.editEntityRecord;
3974  
3975    var id = useEntityId(kind, type);
3976    var initialBlocks = Object(external_this_wp_element_["useMemo"])(function () {
3977      if (initialEdits) {
3978        editEntityRecord(kind, type, id, initialEdits, {
3979          undoIgnore: true
3980        });
3981      } // Guard against other instances that might have
3982      // set content to a function already.
3983  
3984  
3985      if (typeof content !== 'function') {
3986        var parsedContent = Object(external_this_wp_blocks_["parse"])(content);
3987        return parsedContent.length ? parsedContent : [];
3988      }
3989    }, [id]); // Reset when the provided entity record changes.
3990  
3991    var _useEntityProp3 = useEntityProp(kind, type, blocksProp),
3992        _useEntityProp4 = Object(slicedToArray["a" /* default */])(_useEntityProp3, 2),
3993        _useEntityProp4$ = _useEntityProp4[0],
3994        blocks = _useEntityProp4$ === void 0 ? initialBlocks : _useEntityProp4$,
3995        onInput = _useEntityProp4[1];
3996  
3997    var onChange = Object(external_this_wp_element_["useCallback"])(function (nextBlocks) {
3998      onInput(nextBlocks); // Use a function edit to avoid serializing often.
3999  
4000      setContent(function (_ref3) {
4001        var blocksToSerialize = _ref3.blocks;
4002        return Object(external_this_wp_blocks_["serialize"])(blocksToSerialize);
4003      });
4004    }, [onInput, setContent]);
4005    return [blocks, onInput, onChange];
4006  }
4007  
4008  // CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/index.js
4009  /* concated harmony reexport EntityProvider */__webpack_require__.d(__webpack_exports__, "EntityProvider", function() { return EntityProvider; });
4010  /* concated harmony reexport useEntityId */__webpack_require__.d(__webpack_exports__, "useEntityId", function() { return useEntityId; });
4011  /* concated harmony reexport useEntityProp */__webpack_require__.d(__webpack_exports__, "useEntityProp", function() { return useEntityProp; });
4012  /* concated harmony reexport useEntityBlockEditor */__webpack_require__.d(__webpack_exports__, "useEntityBlockEditor", function() { return useEntityBlockEditor; });
4013  
4014  
4015  function build_module_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; }
4016  
4017  function build_module_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { build_module_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 { build_module_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4018  
4019  /**
4020   * WordPress dependencies
4021   */
4022  
4023  /**
4024   * Internal dependencies
4025   */
4026  
4027  
4028  
4029  
4030  
4031  
4032  
4033   // The entity selectors/resolvers and actions are shortcuts to their generic equivalents
4034  // (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecordss)
4035  // Instead of getEntityRecord, the consumer could use more user-frieldly named selector: getPostType, getTaxonomy...
4036  // The "kind" and the "name" of the entity are combined to generate these shortcuts.
4037  
4038  var entitySelectors = defaultEntities.reduce(function (result, entity) {
4039    var kind = entity.kind,
4040        name = entity.name;
4041  
4042    result[entities_getMethodName(kind, name)] = function (state, key) {
4043      return getEntityRecord(state, kind, name, key);
4044    };
4045  
4046    result[entities_getMethodName(kind, name, 'get', true)] = function (state) {
4047      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
4048        args[_key - 1] = arguments[_key];
4049      }
4050  
4051      return getEntityRecords.apply(build_module_selectors_namespaceObject, [state, kind, name].concat(args));
4052    };
4053  
4054    return result;
4055  }, {});
4056  var entityResolvers = defaultEntities.reduce(function (result, entity) {
4057    var kind = entity.kind,
4058        name = entity.name;
4059  
4060    result[entities_getMethodName(kind, name)] = function (key) {
4061      return resolvers_getEntityRecord(kind, name, key);
4062    };
4063  
4064    var pluralMethodName = entities_getMethodName(kind, name, 'get', true);
4065  
4066    result[pluralMethodName] = function () {
4067      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
4068        args[_key2] = arguments[_key2];
4069      }
4070  
4071      return resolvers_getEntityRecords.apply(resolvers_namespaceObject, [kind, name].concat(args));
4072    };
4073  
4074    result[pluralMethodName].shouldInvalidate = function (action) {
4075      var _resolvers$getEntityR;
4076  
4077      for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
4078        args[_key3 - 1] = arguments[_key3];
4079      }
4080  
4081      return (_resolvers$getEntityR = resolvers_getEntityRecords).shouldInvalidate.apply(_resolvers$getEntityR, [action, kind, name].concat(args));
4082    };
4083  
4084    return result;
4085  }, {});
4086  var entityActions = defaultEntities.reduce(function (result, entity) {
4087    var kind = entity.kind,
4088        name = entity.name;
4089  
4090    result[entities_getMethodName(kind, name, 'save')] = function (key) {
4091      return saveEntityRecord(kind, name, key);
4092    };
4093  
4094    return result;
4095  }, {});
4096  Object(external_this_wp_data_["registerStore"])(REDUCER_KEY, {
4097    reducer: build_module_reducer,
4098    controls: build_module_controls,
4099    actions: build_module_objectSpread({}, build_module_actions_namespaceObject, {}, entityActions),
4100    selectors: build_module_objectSpread({}, build_module_selectors_namespaceObject, {}, entitySelectors),
4101    resolvers: build_module_objectSpread({}, resolvers_namespaceObject, {}, entityResolvers)
4102  });
4103  
4104  
4105  
4106  
4107  /***/ }),
4108  
4109  /***/ 5:
4110  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4111  
4112  "use strict";
4113  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
4114  function _defineProperty(obj, key, value) {
4115    if (key in obj) {
4116      Object.defineProperty(obj, key, {
4117        value: value,
4118        enumerable: true,
4119        configurable: true,
4120        writable: true
4121      });
4122    } else {
4123      obj[key] = value;
4124    }
4125  
4126    return obj;
4127  }
4128  
4129  /***/ }),
4130  
4131  /***/ 51:
4132  /***/ (function(module, exports) {
4133  
4134  (function() { module.exports = this["wp"]["isShallowEqual"]; }());
4135  
4136  /***/ }),
4137  
4138  /***/ 64:
4139  /***/ (function(module, exports, __webpack_require__) {
4140  
4141  "use strict";
4142  
4143  
4144  function _typeof(obj) {
4145    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
4146      _typeof = function (obj) {
4147        return typeof obj;
4148      };
4149    } else {
4150      _typeof = function (obj) {
4151        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
4152      };
4153    }
4154  
4155    return _typeof(obj);
4156  }
4157  
4158  function _classCallCheck(instance, Constructor) {
4159    if (!(instance instanceof Constructor)) {
4160      throw new TypeError("Cannot call a class as a function");
4161    }
4162  }
4163  
4164  function _defineProperties(target, props) {
4165    for (var i = 0; i < props.length; i++) {
4166      var descriptor = props[i];
4167      descriptor.enumerable = descriptor.enumerable || false;
4168      descriptor.configurable = true;
4169      if ("value" in descriptor) descriptor.writable = true;
4170      Object.defineProperty(target, descriptor.key, descriptor);
4171    }
4172  }
4173  
4174  function _createClass(Constructor, protoProps, staticProps) {
4175    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
4176    if (staticProps) _defineProperties(Constructor, staticProps);
4177    return Constructor;
4178  }
4179  
4180  /**
4181   * Given an instance of EquivalentKeyMap, returns its internal value pair tuple
4182   * for a key, if one exists. The tuple members consist of the last reference
4183   * value for the key (used in efficient subsequent lookups) and the value
4184   * assigned for the key at the leaf node.
4185   *
4186   * @param {EquivalentKeyMap} instance EquivalentKeyMap instance.
4187   * @param {*} key                     The key for which to return value pair.
4188   *
4189   * @return {?Array} Value pair, if exists.
4190   */
4191  function getValuePair(instance, key) {
4192    var _map = instance._map,
4193        _arrayTreeMap = instance._arrayTreeMap,
4194        _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the
4195    // value, which can be used to shortcut immediately to the value.
4196  
4197    if (_map.has(key)) {
4198      return _map.get(key);
4199    } // Sort keys to ensure stable retrieval from tree.
4200  
4201  
4202    var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value.
4203  
4204    var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap;
4205  
4206    for (var i = 0; i < properties.length; i++) {
4207      var property = properties[i];
4208      map = map.get(property);
4209  
4210      if (map === undefined) {
4211        return;
4212      }
4213  
4214      var propertyValue = key[property];
4215      map = map.get(propertyValue);
4216  
4217      if (map === undefined) {
4218        return;
4219      }
4220    }
4221  
4222    var valuePair = map.get('_ekm_value');
4223  
4224    if (!valuePair) {
4225      return;
4226    } // If reached, it implies that an object-like key was set with another
4227    // reference, so delete the reference and replace with the current.
4228  
4229  
4230    _map.delete(valuePair[0]);
4231  
4232    valuePair[0] = key;
4233    map.set('_ekm_value', valuePair);
4234  
4235    _map.set(key, valuePair);
4236  
4237    return valuePair;
4238  }
4239  /**
4240   * Variant of a Map object which enables lookup by equivalent (deeply equal)
4241   * object and array keys.
4242   */
4243  
4244  
4245  var EquivalentKeyMap =
4246  /*#__PURE__*/
4247  function () {
4248    /**
4249     * Constructs a new instance of EquivalentKeyMap.
4250     *
4251     * @param {Iterable.<*>} iterable Initial pair of key, value for map.
4252     */
4253    function EquivalentKeyMap(iterable) {
4254      _classCallCheck(this, EquivalentKeyMap);
4255  
4256      this.clear();
4257  
4258      if (iterable instanceof EquivalentKeyMap) {
4259        // Map#forEach is only means of iterating with support for IE11.
4260        var iterablePairs = [];
4261        iterable.forEach(function (value, key) {
4262          iterablePairs.push([key, value]);
4263        });
4264        iterable = iterablePairs;
4265      }
4266  
4267      if (iterable != null) {
4268        for (var i = 0; i < iterable.length; i++) {
4269          this.set(iterable[i][0], iterable[i][1]);
4270        }
4271      }
4272    }
4273    /**
4274     * Accessor property returning the number of elements.
4275     *
4276     * @return {number} Number of elements.
4277     */
4278  
4279  
4280    _createClass(EquivalentKeyMap, [{
4281      key: "set",
4282  
4283      /**
4284       * Add or update an element with a specified key and value.
4285       *
4286       * @param {*} key   The key of the element to add.
4287       * @param {*} value The value of the element to add.
4288       *
4289       * @return {EquivalentKeyMap} Map instance.
4290       */
4291      value: function set(key, value) {
4292        // Shortcut non-object-like to set on internal Map.
4293        if (key === null || _typeof(key) !== 'object') {
4294          this._map.set(key, value);
4295  
4296          return this;
4297        } // Sort keys to ensure stable assignment into tree.
4298  
4299  
4300        var properties = Object.keys(key).sort();
4301        var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value.
4302  
4303        var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap;
4304  
4305        for (var i = 0; i < properties.length; i++) {
4306          var property = properties[i];
4307  
4308          if (!map.has(property)) {
4309            map.set(property, new EquivalentKeyMap());
4310          }
4311  
4312          map = map.get(property);
4313          var propertyValue = key[property];
4314  
4315          if (!map.has(propertyValue)) {
4316            map.set(propertyValue, new EquivalentKeyMap());
4317          }
4318  
4319          map = map.get(propertyValue);
4320        } // If an _ekm_value exists, there was already an equivalent key. Before
4321        // overriding, ensure that the old key reference is removed from map to
4322        // avoid memory leak of accumulating equivalent keys. This is, in a
4323        // sense, a poor man's WeakMap, while still enabling iterability.
4324  
4325  
4326        var previousValuePair = map.get('_ekm_value');
4327  
4328        if (previousValuePair) {
4329          this._map.delete(previousValuePair[0]);
4330        }
4331  
4332        map.set('_ekm_value', valuePair);
4333  
4334        this._map.set(key, valuePair);
4335  
4336        return this;
4337      }
4338      /**
4339       * Returns a specified element.
4340       *
4341       * @param {*} key The key of the element to return.
4342       *
4343       * @return {?*} The element associated with the specified key or undefined
4344       *              if the key can't be found.
4345       */
4346  
4347    }, {
4348      key: "get",
4349      value: function get(key) {
4350        // Shortcut non-object-like to get from internal Map.
4351        if (key === null || _typeof(key) !== 'object') {
4352          return this._map.get(key);
4353        }
4354  
4355        var valuePair = getValuePair(this, key);
4356  
4357        if (valuePair) {
4358          return valuePair[1];
4359        }
4360      }
4361      /**
4362       * Returns a boolean indicating whether an element with the specified key
4363       * exists or not.
4364       *
4365       * @param {*} key The key of the element to test for presence.
4366       *
4367       * @return {boolean} Whether an element with the specified key exists.
4368       */
4369  
4370    }, {
4371      key: "has",
4372      value: function has(key) {
4373        if (key === null || _typeof(key) !== 'object') {
4374          return this._map.has(key);
4375        } // Test on the _presence_ of the pair, not its value, as even undefined
4376        // can be a valid member value for a key.
4377  
4378  
4379        return getValuePair(this, key) !== undefined;
4380      }
4381      /**
4382       * Removes the specified element.
4383       *
4384       * @param {*} key The key of the element to remove.
4385       *
4386       * @return {boolean} Returns true if an element existed and has been
4387       *                   removed, or false if the element does not exist.
4388       */
4389  
4390    }, {
4391      key: "delete",
4392      value: function _delete(key) {
4393        if (!this.has(key)) {
4394          return false;
4395        } // This naive implementation will leave orphaned child trees. A better
4396        // implementation should traverse and remove orphans.
4397  
4398  
4399        this.set(key, undefined);
4400        return true;
4401      }
4402      /**
4403       * Executes a provided function once per each key/value pair, in insertion
4404       * order.
4405       *
4406       * @param {Function} callback Function to execute for each element.
4407       * @param {*}        thisArg  Value to use as `this` when executing
4408       *                            `callback`.
4409       */
4410  
4411    }, {
4412      key: "forEach",
4413      value: function forEach(callback) {
4414        var _this = this;
4415  
4416        var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
4417  
4418        this._map.forEach(function (value, key) {
4419          // Unwrap value from object-like value pair.
4420          if (key !== null && _typeof(key) === 'object') {
4421            value = value[1];
4422          }
4423  
4424          callback.call(thisArg, value, key, _this);
4425        });
4426      }
4427      /**
4428       * Removes all elements.
4429       */
4430  
4431    }, {
4432      key: "clear",
4433      value: function clear() {
4434        this._map = new Map();
4435        this._arrayTreeMap = new Map();
4436        this._objectTreeMap = new Map();
4437      }
4438    }, {
4439      key: "size",
4440      get: function get() {
4441        return this._map.size;
4442      }
4443    }]);
4444  
4445    return EquivalentKeyMap;
4446  }();
4447  
4448  module.exports = EquivalentKeyMap;
4449  
4450  
4451  /***/ })
4452  
4453  /******/ });


Generated: Fri Apr 10 01:00:03 2020 Cross-referenced by PHPXref 0.7.1