[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  /******/ (() => { // webpackBootstrap
   2  /******/     "use strict";
   3  /******/     var __webpack_modules__ = ({
   4  
   5  /***/ 6689:
   6  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
   7  
   8  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
   9  /* harmony export */   createUndoManager: () => (/* binding */ createUndoManager)
  10  /* harmony export */ });
  11  /* harmony import */ var _wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(923);
  12  /* harmony import */ var _wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_0__);
  13  /**
  14   * WordPress dependencies
  15   */
  16  
  17  
  18  /** @typedef {import('./types').HistoryRecord}  HistoryRecord */
  19  /** @typedef {import('./types').HistoryChange}  HistoryChange */
  20  /** @typedef {import('./types').HistoryChanges} HistoryChanges */
  21  /** @typedef {import('./types').UndoManager} UndoManager */
  22  
  23  /**
  24   * Merge changes for a single item into a record of changes.
  25   *
  26   * @param {Record< string, HistoryChange >} changes1 Previous changes
  27   * @param {Record< string, HistoryChange >} changes2 NextChanges
  28   *
  29   * @return {Record< string, HistoryChange >} Merged changes
  30   */
  31  function mergeHistoryChanges(changes1, changes2) {
  32    /**
  33     * @type {Record< string, HistoryChange >}
  34     */
  35    const newChanges = {
  36      ...changes1
  37    };
  38    Object.entries(changes2).forEach(([key, value]) => {
  39      if (newChanges[key]) {
  40        newChanges[key] = {
  41          ...newChanges[key],
  42          to: value.to
  43        };
  44      } else {
  45        newChanges[key] = value;
  46      }
  47    });
  48    return newChanges;
  49  }
  50  
  51  /**
  52   * Adds history changes for a single item into a record of changes.
  53   *
  54   * @param {HistoryRecord}  record  The record to merge into.
  55   * @param {HistoryChanges} changes The changes to merge.
  56   */
  57  const addHistoryChangesIntoRecord = (record, changes) => {
  58    const existingChangesIndex = record?.findIndex(({
  59      id: recordIdentifier
  60    }) => {
  61      return typeof recordIdentifier === 'string' ? recordIdentifier === changes.id : _wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_0___default()(recordIdentifier, changes.id);
  62    });
  63    const nextRecord = [...record];
  64    if (existingChangesIndex !== -1) {
  65      // If the edit is already in the stack leave the initial "from" value.
  66      nextRecord[existingChangesIndex] = {
  67        id: changes.id,
  68        changes: mergeHistoryChanges(nextRecord[existingChangesIndex].changes, changes.changes)
  69      };
  70    } else {
  71      nextRecord.push(changes);
  72    }
  73    return nextRecord;
  74  };
  75  
  76  /**
  77   * Creates an undo manager.
  78   *
  79   * @return {UndoManager} Undo manager.
  80   */
  81  function createUndoManager() {
  82    /**
  83     * @type {HistoryRecord[]}
  84     */
  85    let history = [];
  86    /**
  87     * @type {HistoryRecord}
  88     */
  89    let stagedRecord = [];
  90    /**
  91     * @type {number}
  92     */
  93    let offset = 0;
  94    const dropPendingRedos = () => {
  95      history = history.slice(0, offset || undefined);
  96      offset = 0;
  97    };
  98    const appendStagedRecordToLatestHistoryRecord = () => {
  99      var _history$index;
 100      const index = history.length === 0 ? 0 : history.length - 1;
 101      let latestRecord = (_history$index = history[index]) !== null && _history$index !== void 0 ? _history$index : [];
 102      stagedRecord.forEach(changes => {
 103        latestRecord = addHistoryChangesIntoRecord(latestRecord, changes);
 104      });
 105      stagedRecord = [];
 106      history[index] = latestRecord;
 107    };
 108  
 109    /**
 110     * Checks whether a record is empty.
 111     * A record is considered empty if it the changes keep the same values.
 112     * Also updates to function values are ignored.
 113     *
 114     * @param {HistoryRecord} record
 115     * @return {boolean} Whether the record is empty.
 116     */
 117    const isRecordEmpty = record => {
 118      const filteredRecord = record.filter(({
 119        changes
 120      }) => {
 121        return Object.values(changes).some(({
 122          from,
 123          to
 124        }) => typeof from !== 'function' && typeof to !== 'function' && !_wordpress_is_shallow_equal__WEBPACK_IMPORTED_MODULE_0___default()(from, to));
 125      });
 126      return !filteredRecord.length;
 127    };
 128    return {
 129      /**
 130       * Record changes into the history.
 131       *
 132       * @param {HistoryRecord=} record   A record of changes to record.
 133       * @param {boolean}        isStaged Whether to immediately create an undo point or not.
 134       */
 135      addRecord(record, isStaged = false) {
 136        const isEmpty = !record || isRecordEmpty(record);
 137        if (isStaged) {
 138          if (isEmpty) {
 139            return;
 140          }
 141          record.forEach(changes => {
 142            stagedRecord = addHistoryChangesIntoRecord(stagedRecord, changes);
 143          });
 144        } else {
 145          dropPendingRedos();
 146          if (stagedRecord.length) {
 147            appendStagedRecordToLatestHistoryRecord();
 148          }
 149          if (isEmpty) {
 150            return;
 151          }
 152          history.push(record);
 153        }
 154      },
 155      undo() {
 156        if (stagedRecord.length) {
 157          dropPendingRedos();
 158          appendStagedRecordToLatestHistoryRecord();
 159        }
 160        const undoRecord = history[history.length - 1 + offset];
 161        if (!undoRecord) {
 162          return;
 163        }
 164        offset -= 1;
 165        return undoRecord;
 166      },
 167      redo() {
 168        const redoRecord = history[history.length + offset];
 169        if (!redoRecord) {
 170          return;
 171        }
 172        offset += 1;
 173        return redoRecord;
 174      },
 175      hasUndo() {
 176        return !!history[history.length - 1 + offset];
 177      },
 178      hasRedo() {
 179        return !!history[history.length + offset];
 180      }
 181    };
 182  }
 183  
 184  
 185  /***/ }),
 186  
 187  /***/ 3249:
 188  /***/ ((module) => {
 189  
 190  
 191  
 192  function _typeof(obj) {
 193    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
 194      _typeof = function (obj) {
 195        return typeof obj;
 196      };
 197    } else {
 198      _typeof = function (obj) {
 199        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
 200      };
 201    }
 202  
 203    return _typeof(obj);
 204  }
 205  
 206  function _classCallCheck(instance, Constructor) {
 207    if (!(instance instanceof Constructor)) {
 208      throw new TypeError("Cannot call a class as a function");
 209    }
 210  }
 211  
 212  function _defineProperties(target, props) {
 213    for (var i = 0; i < props.length; i++) {
 214      var descriptor = props[i];
 215      descriptor.enumerable = descriptor.enumerable || false;
 216      descriptor.configurable = true;
 217      if ("value" in descriptor) descriptor.writable = true;
 218      Object.defineProperty(target, descriptor.key, descriptor);
 219    }
 220  }
 221  
 222  function _createClass(Constructor, protoProps, staticProps) {
 223    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 224    if (staticProps) _defineProperties(Constructor, staticProps);
 225    return Constructor;
 226  }
 227  
 228  /**
 229   * Given an instance of EquivalentKeyMap, returns its internal value pair tuple
 230   * for a key, if one exists. The tuple members consist of the last reference
 231   * value for the key (used in efficient subsequent lookups) and the value
 232   * assigned for the key at the leaf node.
 233   *
 234   * @param {EquivalentKeyMap} instance EquivalentKeyMap instance.
 235   * @param {*} key                     The key for which to return value pair.
 236   *
 237   * @return {?Array} Value pair, if exists.
 238   */
 239  function getValuePair(instance, key) {
 240    var _map = instance._map,
 241        _arrayTreeMap = instance._arrayTreeMap,
 242        _objectTreeMap = instance._objectTreeMap; // Map keeps a reference to the last object-like key used to set the
 243    // value, which can be used to shortcut immediately to the value.
 244  
 245    if (_map.has(key)) {
 246      return _map.get(key);
 247    } // Sort keys to ensure stable retrieval from tree.
 248  
 249  
 250    var properties = Object.keys(key).sort(); // Tree by type to avoid conflicts on numeric object keys, empty value.
 251  
 252    var map = Array.isArray(key) ? _arrayTreeMap : _objectTreeMap;
 253  
 254    for (var i = 0; i < properties.length; i++) {
 255      var property = properties[i];
 256      map = map.get(property);
 257  
 258      if (map === undefined) {
 259        return;
 260      }
 261  
 262      var propertyValue = key[property];
 263      map = map.get(propertyValue);
 264  
 265      if (map === undefined) {
 266        return;
 267      }
 268    }
 269  
 270    var valuePair = map.get('_ekm_value');
 271  
 272    if (!valuePair) {
 273      return;
 274    } // If reached, it implies that an object-like key was set with another
 275    // reference, so delete the reference and replace with the current.
 276  
 277  
 278    _map.delete(valuePair[0]);
 279  
 280    valuePair[0] = key;
 281    map.set('_ekm_value', valuePair);
 282  
 283    _map.set(key, valuePair);
 284  
 285    return valuePair;
 286  }
 287  /**
 288   * Variant of a Map object which enables lookup by equivalent (deeply equal)
 289   * object and array keys.
 290   */
 291  
 292  
 293  var EquivalentKeyMap =
 294  /*#__PURE__*/
 295  function () {
 296    /**
 297     * Constructs a new instance of EquivalentKeyMap.
 298     *
 299     * @param {Iterable.<*>} iterable Initial pair of key, value for map.
 300     */
 301    function EquivalentKeyMap(iterable) {
 302      _classCallCheck(this, EquivalentKeyMap);
 303  
 304      this.clear();
 305  
 306      if (iterable instanceof EquivalentKeyMap) {
 307        // Map#forEach is only means of iterating with support for IE11.
 308        var iterablePairs = [];
 309        iterable.forEach(function (value, key) {
 310          iterablePairs.push([key, value]);
 311        });
 312        iterable = iterablePairs;
 313      }
 314  
 315      if (iterable != null) {
 316        for (var i = 0; i < iterable.length; i++) {
 317          this.set(iterable[i][0], iterable[i][1]);
 318        }
 319      }
 320    }
 321    /**
 322     * Accessor property returning the number of elements.
 323     *
 324     * @return {number} Number of elements.
 325     */
 326  
 327  
 328    _createClass(EquivalentKeyMap, [{
 329      key: "set",
 330  
 331      /**
 332       * Add or update an element with a specified key and value.
 333       *
 334       * @param {*} key   The key of the element to add.
 335       * @param {*} value The value of the element to add.
 336       *
 337       * @return {EquivalentKeyMap} Map instance.
 338       */
 339      value: function set(key, value) {
 340        // Shortcut non-object-like to set on internal Map.
 341        if (key === null || _typeof(key) !== 'object') {
 342          this._map.set(key, value);
 343  
 344          return this;
 345        } // Sort keys to ensure stable assignment into tree.
 346  
 347  
 348        var properties = Object.keys(key).sort();
 349        var valuePair = [key, value]; // Tree by type to avoid conflicts on numeric object keys, empty value.
 350  
 351        var map = Array.isArray(key) ? this._arrayTreeMap : this._objectTreeMap;
 352  
 353        for (var i = 0; i < properties.length; i++) {
 354          var property = properties[i];
 355  
 356          if (!map.has(property)) {
 357            map.set(property, new EquivalentKeyMap());
 358          }
 359  
 360          map = map.get(property);
 361          var propertyValue = key[property];
 362  
 363          if (!map.has(propertyValue)) {
 364            map.set(propertyValue, new EquivalentKeyMap());
 365          }
 366  
 367          map = map.get(propertyValue);
 368        } // If an _ekm_value exists, there was already an equivalent key. Before
 369        // overriding, ensure that the old key reference is removed from map to
 370        // avoid memory leak of accumulating equivalent keys. This is, in a
 371        // sense, a poor man's WeakMap, while still enabling iterability.
 372  
 373  
 374        var previousValuePair = map.get('_ekm_value');
 375  
 376        if (previousValuePair) {
 377          this._map.delete(previousValuePair[0]);
 378        }
 379  
 380        map.set('_ekm_value', valuePair);
 381  
 382        this._map.set(key, valuePair);
 383  
 384        return this;
 385      }
 386      /**
 387       * Returns a specified element.
 388       *
 389       * @param {*} key The key of the element to return.
 390       *
 391       * @return {?*} The element associated with the specified key or undefined
 392       *              if the key can't be found.
 393       */
 394  
 395    }, {
 396      key: "get",
 397      value: function get(key) {
 398        // Shortcut non-object-like to get from internal Map.
 399        if (key === null || _typeof(key) !== 'object') {
 400          return this._map.get(key);
 401        }
 402  
 403        var valuePair = getValuePair(this, key);
 404  
 405        if (valuePair) {
 406          return valuePair[1];
 407        }
 408      }
 409      /**
 410       * Returns a boolean indicating whether an element with the specified key
 411       * exists or not.
 412       *
 413       * @param {*} key The key of the element to test for presence.
 414       *
 415       * @return {boolean} Whether an element with the specified key exists.
 416       */
 417  
 418    }, {
 419      key: "has",
 420      value: function has(key) {
 421        if (key === null || _typeof(key) !== 'object') {
 422          return this._map.has(key);
 423        } // Test on the _presence_ of the pair, not its value, as even undefined
 424        // can be a valid member value for a key.
 425  
 426  
 427        return getValuePair(this, key) !== undefined;
 428      }
 429      /**
 430       * Removes the specified element.
 431       *
 432       * @param {*} key The key of the element to remove.
 433       *
 434       * @return {boolean} Returns true if an element existed and has been
 435       *                   removed, or false if the element does not exist.
 436       */
 437  
 438    }, {
 439      key: "delete",
 440      value: function _delete(key) {
 441        if (!this.has(key)) {
 442          return false;
 443        } // This naive implementation will leave orphaned child trees. A better
 444        // implementation should traverse and remove orphans.
 445  
 446  
 447        this.set(key, undefined);
 448        return true;
 449      }
 450      /**
 451       * Executes a provided function once per each key/value pair, in insertion
 452       * order.
 453       *
 454       * @param {Function} callback Function to execute for each element.
 455       * @param {*}        thisArg  Value to use as `this` when executing
 456       *                            `callback`.
 457       */
 458  
 459    }, {
 460      key: "forEach",
 461      value: function forEach(callback) {
 462        var _this = this;
 463  
 464        var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
 465  
 466        this._map.forEach(function (value, key) {
 467          // Unwrap value from object-like value pair.
 468          if (key !== null && _typeof(key) === 'object') {
 469            value = value[1];
 470          }
 471  
 472          callback.call(thisArg, value, key, _this);
 473        });
 474      }
 475      /**
 476       * Removes all elements.
 477       */
 478  
 479    }, {
 480      key: "clear",
 481      value: function clear() {
 482        this._map = new Map();
 483        this._arrayTreeMap = new Map();
 484        this._objectTreeMap = new Map();
 485      }
 486    }, {
 487      key: "size",
 488      get: function get() {
 489        return this._map.size;
 490      }
 491    }]);
 492  
 493    return EquivalentKeyMap;
 494  }();
 495  
 496  module.exports = EquivalentKeyMap;
 497  
 498  
 499  /***/ }),
 500  
 501  /***/ 7734:
 502  /***/ ((module) => {
 503  
 504  
 505  
 506  // do not edit .js files directly - edit src/index.jst
 507  
 508  
 509    var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
 510  
 511  
 512  module.exports = function equal(a, b) {
 513    if (a === b) return true;
 514  
 515    if (a && b && typeof a == 'object' && typeof b == 'object') {
 516      if (a.constructor !== b.constructor) return false;
 517  
 518      var length, i, keys;
 519      if (Array.isArray(a)) {
 520        length = a.length;
 521        if (length != b.length) return false;
 522        for (i = length; i-- !== 0;)
 523          if (!equal(a[i], b[i])) return false;
 524        return true;
 525      }
 526  
 527  
 528      if ((a instanceof Map) && (b instanceof Map)) {
 529        if (a.size !== b.size) return false;
 530        for (i of a.entries())
 531          if (!b.has(i[0])) return false;
 532        for (i of a.entries())
 533          if (!equal(i[1], b.get(i[0]))) return false;
 534        return true;
 535      }
 536  
 537      if ((a instanceof Set) && (b instanceof Set)) {
 538        if (a.size !== b.size) return false;
 539        for (i of a.entries())
 540          if (!b.has(i[0])) return false;
 541        return true;
 542      }
 543  
 544      if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
 545        length = a.length;
 546        if (length != b.length) return false;
 547        for (i = length; i-- !== 0;)
 548          if (a[i] !== b[i]) return false;
 549        return true;
 550      }
 551  
 552  
 553      if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
 554      if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
 555      if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
 556  
 557      keys = Object.keys(a);
 558      length = keys.length;
 559      if (length !== Object.keys(b).length) return false;
 560  
 561      for (i = length; i-- !== 0;)
 562        if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
 563  
 564      for (i = length; i-- !== 0;) {
 565        var key = keys[i];
 566  
 567        if (!equal(a[key], b[key])) return false;
 568      }
 569  
 570      return true;
 571    }
 572  
 573    // true if both NaN, false otherwise
 574    return a!==a && b!==b;
 575  };
 576  
 577  
 578  /***/ }),
 579  
 580  /***/ 923:
 581  /***/ ((module) => {
 582  
 583  module.exports = window["wp"]["isShallowEqual"];
 584  
 585  /***/ })
 586  
 587  /******/     });
 588  /************************************************************************/
 589  /******/     // The module cache
 590  /******/     var __webpack_module_cache__ = {};
 591  /******/     
 592  /******/     // The require function
 593  /******/ 	function __webpack_require__(moduleId) {
 594  /******/         // Check if module is in cache
 595  /******/         var cachedModule = __webpack_module_cache__[moduleId];
 596  /******/         if (cachedModule !== undefined) {
 597  /******/             return cachedModule.exports;
 598  /******/         }
 599  /******/         // Create a new module (and put it into the cache)
 600  /******/         var module = __webpack_module_cache__[moduleId] = {
 601  /******/             // no module.id needed
 602  /******/             // no module.loaded needed
 603  /******/             exports: {}
 604  /******/         };
 605  /******/     
 606  /******/         // Execute the module function
 607  /******/         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 608  /******/     
 609  /******/         // Return the exports of the module
 610  /******/         return module.exports;
 611  /******/     }
 612  /******/     
 613  /************************************************************************/
 614  /******/     /* webpack/runtime/compat get default export */
 615  /******/     (() => {
 616  /******/         // getDefaultExport function for compatibility with non-harmony modules
 617  /******/         __webpack_require__.n = (module) => {
 618  /******/             var getter = module && module.__esModule ?
 619  /******/                 () => (module['default']) :
 620  /******/                 () => (module);
 621  /******/             __webpack_require__.d(getter, { a: getter });
 622  /******/             return getter;
 623  /******/         };
 624  /******/     })();
 625  /******/     
 626  /******/     /* webpack/runtime/define property getters */
 627  /******/     (() => {
 628  /******/         // define getter functions for harmony exports
 629  /******/         __webpack_require__.d = (exports, definition) => {
 630  /******/             for(var key in definition) {
 631  /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
 632  /******/                     Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
 633  /******/                 }
 634  /******/             }
 635  /******/         };
 636  /******/     })();
 637  /******/     
 638  /******/     /* webpack/runtime/hasOwnProperty shorthand */
 639  /******/     (() => {
 640  /******/         __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
 641  /******/     })();
 642  /******/     
 643  /******/     /* webpack/runtime/make namespace object */
 644  /******/     (() => {
 645  /******/         // define __esModule on exports
 646  /******/         __webpack_require__.r = (exports) => {
 647  /******/             if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 648  /******/                 Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 649  /******/             }
 650  /******/             Object.defineProperty(exports, '__esModule', { value: true });
 651  /******/         };
 652  /******/     })();
 653  /******/     
 654  /************************************************************************/
 655  var __webpack_exports__ = {};
 656  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
 657  (() => {
 658  // ESM COMPAT FLAG
 659  __webpack_require__.r(__webpack_exports__);
 660  
 661  // EXPORTS
 662  __webpack_require__.d(__webpack_exports__, {
 663    EntityProvider: () => (/* reexport */ EntityProvider),
 664    __experimentalFetchLinkSuggestions: () => (/* reexport */ fetchLinkSuggestions),
 665    __experimentalFetchUrlData: () => (/* reexport */ _experimental_fetch_url_data),
 666    __experimentalUseEntityRecord: () => (/* reexport */ __experimentalUseEntityRecord),
 667    __experimentalUseEntityRecords: () => (/* reexport */ __experimentalUseEntityRecords),
 668    __experimentalUseResourcePermissions: () => (/* reexport */ __experimentalUseResourcePermissions),
 669    fetchBlockPatterns: () => (/* reexport */ fetchBlockPatterns),
 670    privateApis: () => (/* reexport */ privateApis),
 671    store: () => (/* binding */ store),
 672    useEntityBlockEditor: () => (/* reexport */ useEntityBlockEditor),
 673    useEntityId: () => (/* reexport */ useEntityId),
 674    useEntityProp: () => (/* reexport */ useEntityProp),
 675    useEntityRecord: () => (/* reexport */ useEntityRecord),
 676    useEntityRecords: () => (/* reexport */ useEntityRecords),
 677    useResourcePermissions: () => (/* reexport */ use_resource_permissions)
 678  });
 679  
 680  // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/actions.js
 681  var build_module_actions_namespaceObject = {};
 682  __webpack_require__.r(build_module_actions_namespaceObject);
 683  __webpack_require__.d(build_module_actions_namespaceObject, {
 684    __experimentalBatch: () => (__experimentalBatch),
 685    __experimentalReceiveCurrentGlobalStylesId: () => (__experimentalReceiveCurrentGlobalStylesId),
 686    __experimentalReceiveThemeBaseGlobalStyles: () => (__experimentalReceiveThemeBaseGlobalStyles),
 687    __experimentalReceiveThemeGlobalStyleVariations: () => (__experimentalReceiveThemeGlobalStyleVariations),
 688    __experimentalSaveSpecifiedEntityEdits: () => (__experimentalSaveSpecifiedEntityEdits),
 689    __unstableCreateUndoLevel: () => (__unstableCreateUndoLevel),
 690    addEntities: () => (addEntities),
 691    deleteEntityRecord: () => (deleteEntityRecord),
 692    editEntityRecord: () => (editEntityRecord),
 693    receiveAutosaves: () => (receiveAutosaves),
 694    receiveCurrentTheme: () => (receiveCurrentTheme),
 695    receiveCurrentUser: () => (receiveCurrentUser),
 696    receiveDefaultTemplateId: () => (receiveDefaultTemplateId),
 697    receiveEmbedPreview: () => (receiveEmbedPreview),
 698    receiveEntityRecords: () => (receiveEntityRecords),
 699    receiveNavigationFallbackId: () => (receiveNavigationFallbackId),
 700    receiveRevisions: () => (receiveRevisions),
 701    receiveThemeGlobalStyleRevisions: () => (receiveThemeGlobalStyleRevisions),
 702    receiveThemeSupports: () => (receiveThemeSupports),
 703    receiveUploadPermissions: () => (receiveUploadPermissions),
 704    receiveUserPermission: () => (receiveUserPermission),
 705    receiveUserPermissions: () => (receiveUserPermissions),
 706    receiveUserQuery: () => (receiveUserQuery),
 707    redo: () => (redo),
 708    saveEditedEntityRecord: () => (saveEditedEntityRecord),
 709    saveEntityRecord: () => (saveEntityRecord),
 710    undo: () => (undo)
 711  });
 712  
 713  // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/selectors.js
 714  var build_module_selectors_namespaceObject = {};
 715  __webpack_require__.r(build_module_selectors_namespaceObject);
 716  __webpack_require__.d(build_module_selectors_namespaceObject, {
 717    __experimentalGetCurrentGlobalStylesId: () => (__experimentalGetCurrentGlobalStylesId),
 718    __experimentalGetCurrentThemeBaseGlobalStyles: () => (__experimentalGetCurrentThemeBaseGlobalStyles),
 719    __experimentalGetCurrentThemeGlobalStylesVariations: () => (__experimentalGetCurrentThemeGlobalStylesVariations),
 720    __experimentalGetDirtyEntityRecords: () => (__experimentalGetDirtyEntityRecords),
 721    __experimentalGetEntitiesBeingSaved: () => (__experimentalGetEntitiesBeingSaved),
 722    __experimentalGetEntityRecordNoResolver: () => (__experimentalGetEntityRecordNoResolver),
 723    __experimentalGetTemplateForLink: () => (__experimentalGetTemplateForLink),
 724    canUser: () => (canUser),
 725    canUserEditEntityRecord: () => (canUserEditEntityRecord),
 726    getAuthors: () => (getAuthors),
 727    getAutosave: () => (getAutosave),
 728    getAutosaves: () => (getAutosaves),
 729    getBlockPatternCategories: () => (getBlockPatternCategories),
 730    getBlockPatterns: () => (getBlockPatterns),
 731    getCurrentTheme: () => (getCurrentTheme),
 732    getCurrentThemeGlobalStylesRevisions: () => (getCurrentThemeGlobalStylesRevisions),
 733    getCurrentUser: () => (getCurrentUser),
 734    getDefaultTemplateId: () => (getDefaultTemplateId),
 735    getEditedEntityRecord: () => (getEditedEntityRecord),
 736    getEmbedPreview: () => (getEmbedPreview),
 737    getEntitiesByKind: () => (getEntitiesByKind),
 738    getEntitiesConfig: () => (getEntitiesConfig),
 739    getEntity: () => (getEntity),
 740    getEntityConfig: () => (getEntityConfig),
 741    getEntityRecord: () => (getEntityRecord),
 742    getEntityRecordEdits: () => (getEntityRecordEdits),
 743    getEntityRecordNonTransientEdits: () => (getEntityRecordNonTransientEdits),
 744    getEntityRecords: () => (getEntityRecords),
 745    getEntityRecordsTotalItems: () => (getEntityRecordsTotalItems),
 746    getEntityRecordsTotalPages: () => (getEntityRecordsTotalPages),
 747    getLastEntityDeleteError: () => (getLastEntityDeleteError),
 748    getLastEntitySaveError: () => (getLastEntitySaveError),
 749    getRawEntityRecord: () => (getRawEntityRecord),
 750    getRedoEdit: () => (getRedoEdit),
 751    getReferenceByDistinctEdits: () => (getReferenceByDistinctEdits),
 752    getRevision: () => (getRevision),
 753    getRevisions: () => (getRevisions),
 754    getThemeSupports: () => (getThemeSupports),
 755    getUndoEdit: () => (getUndoEdit),
 756    getUserPatternCategories: () => (getUserPatternCategories),
 757    getUserQueryResults: () => (getUserQueryResults),
 758    hasEditsForEntityRecord: () => (hasEditsForEntityRecord),
 759    hasEntityRecords: () => (hasEntityRecords),
 760    hasFetchedAutosaves: () => (hasFetchedAutosaves),
 761    hasRedo: () => (hasRedo),
 762    hasUndo: () => (hasUndo),
 763    isAutosavingEntityRecord: () => (isAutosavingEntityRecord),
 764    isDeletingEntityRecord: () => (isDeletingEntityRecord),
 765    isPreviewEmbedFallback: () => (isPreviewEmbedFallback),
 766    isRequestingEmbedPreview: () => (isRequestingEmbedPreview),
 767    isSavingEntityRecord: () => (isSavingEntityRecord)
 768  });
 769  
 770  // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/private-selectors.js
 771  var private_selectors_namespaceObject = {};
 772  __webpack_require__.r(private_selectors_namespaceObject);
 773  __webpack_require__.d(private_selectors_namespaceObject, {
 774    getBlockPatternsForPostType: () => (getBlockPatternsForPostType),
 775    getEntityRecordPermissions: () => (getEntityRecordPermissions),
 776    getEntityRecordsPermissions: () => (getEntityRecordsPermissions),
 777    getNavigationFallbackId: () => (getNavigationFallbackId),
 778    getRegisteredPostMeta: () => (getRegisteredPostMeta),
 779    getUndoManager: () => (getUndoManager)
 780  });
 781  
 782  // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/private-actions.js
 783  var private_actions_namespaceObject = {};
 784  __webpack_require__.r(private_actions_namespaceObject);
 785  __webpack_require__.d(private_actions_namespaceObject, {
 786    receiveRegisteredPostMeta: () => (receiveRegisteredPostMeta)
 787  });
 788  
 789  // NAMESPACE OBJECT: ./node_modules/@wordpress/core-data/build-module/resolvers.js
 790  var resolvers_namespaceObject = {};
 791  __webpack_require__.r(resolvers_namespaceObject);
 792  __webpack_require__.d(resolvers_namespaceObject, {
 793    __experimentalGetCurrentGlobalStylesId: () => (resolvers_experimentalGetCurrentGlobalStylesId),
 794    __experimentalGetCurrentThemeBaseGlobalStyles: () => (resolvers_experimentalGetCurrentThemeBaseGlobalStyles),
 795    __experimentalGetCurrentThemeGlobalStylesVariations: () => (resolvers_experimentalGetCurrentThemeGlobalStylesVariations),
 796    __experimentalGetTemplateForLink: () => (resolvers_experimentalGetTemplateForLink),
 797    canUser: () => (resolvers_canUser),
 798    canUserEditEntityRecord: () => (resolvers_canUserEditEntityRecord),
 799    getAuthors: () => (resolvers_getAuthors),
 800    getAutosave: () => (resolvers_getAutosave),
 801    getAutosaves: () => (resolvers_getAutosaves),
 802    getBlockPatternCategories: () => (resolvers_getBlockPatternCategories),
 803    getBlockPatterns: () => (resolvers_getBlockPatterns),
 804    getCurrentTheme: () => (resolvers_getCurrentTheme),
 805    getCurrentThemeGlobalStylesRevisions: () => (resolvers_getCurrentThemeGlobalStylesRevisions),
 806    getCurrentUser: () => (resolvers_getCurrentUser),
 807    getDefaultTemplateId: () => (resolvers_getDefaultTemplateId),
 808    getEditedEntityRecord: () => (resolvers_getEditedEntityRecord),
 809    getEmbedPreview: () => (resolvers_getEmbedPreview),
 810    getEntityRecord: () => (resolvers_getEntityRecord),
 811    getEntityRecords: () => (resolvers_getEntityRecords),
 812    getNavigationFallbackId: () => (resolvers_getNavigationFallbackId),
 813    getRawEntityRecord: () => (resolvers_getRawEntityRecord),
 814    getRegisteredPostMeta: () => (resolvers_getRegisteredPostMeta),
 815    getRevision: () => (resolvers_getRevision),
 816    getRevisions: () => (resolvers_getRevisions),
 817    getThemeSupports: () => (resolvers_getThemeSupports),
 818    getUserPatternCategories: () => (resolvers_getUserPatternCategories)
 819  });
 820  
 821  ;// CONCATENATED MODULE: external ["wp","data"]
 822  const external_wp_data_namespaceObject = window["wp"]["data"];
 823  // EXTERNAL MODULE: ./node_modules/fast-deep-equal/es6/index.js
 824  var es6 = __webpack_require__(7734);
 825  var es6_default = /*#__PURE__*/__webpack_require__.n(es6);
 826  ;// CONCATENATED MODULE: external ["wp","compose"]
 827  const external_wp_compose_namespaceObject = window["wp"]["compose"];
 828  // EXTERNAL MODULE: ./node_modules/@wordpress/undo-manager/build-module/index.js
 829  var build_module = __webpack_require__(6689);
 830  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/if-matching-action.js
 831  /** @typedef {import('../types').AnyFunction} AnyFunction */
 832  
 833  /**
 834   * A higher-order reducer creator which invokes the original reducer only if
 835   * the dispatching action matches the given predicate, **OR** if state is
 836   * initializing (undefined).
 837   *
 838   * @param {AnyFunction} isMatch Function predicate for allowing reducer call.
 839   *
 840   * @return {AnyFunction} Higher-order reducer.
 841   */
 842  const ifMatchingAction = isMatch => reducer => (state, action) => {
 843    if (state === undefined || isMatch(action)) {
 844      return reducer(state, action);
 845    }
 846    return state;
 847  };
 848  /* harmony default export */ const if_matching_action = (ifMatchingAction);
 849  
 850  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/replace-action.js
 851  /** @typedef {import('../types').AnyFunction} AnyFunction */
 852  
 853  /**
 854   * Higher-order reducer creator which substitutes the action object before
 855   * passing to the original reducer.
 856   *
 857   * @param {AnyFunction} replacer Function mapping original action to replacement.
 858   *
 859   * @return {AnyFunction} Higher-order reducer.
 860   */
 861  const replaceAction = replacer => reducer => (state, action) => {
 862    return reducer(state, replacer(action));
 863  };
 864  /* harmony default export */ const replace_action = (replaceAction);
 865  
 866  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/conservative-map-item.js
 867  /**
 868   * External dependencies
 869   */
 870  
 871  
 872  /**
 873   * Given the current and next item entity record, returns the minimally "modified"
 874   * result of the next item, preferring value references from the original item
 875   * if equal. If all values match, the original item is returned.
 876   *
 877   * @param {Object} item     Original item.
 878   * @param {Object} nextItem Next item.
 879   *
 880   * @return {Object} Minimally modified merged item.
 881   */
 882  function conservativeMapItem(item, nextItem) {
 883    // Return next item in its entirety if there is no original item.
 884    if (!item) {
 885      return nextItem;
 886    }
 887    let hasChanges = false;
 888    const result = {};
 889    for (const key in nextItem) {
 890      if (es6_default()(item[key], nextItem[key])) {
 891        result[key] = item[key];
 892      } else {
 893        hasChanges = true;
 894        result[key] = nextItem[key];
 895      }
 896    }
 897    if (!hasChanges) {
 898      return item;
 899    }
 900  
 901    // Only at this point, backfill properties from the original item which
 902    // weren't explicitly set into the result above. This is an optimization
 903    // to allow `hasChanges` to return early.
 904    for (const key in item) {
 905      if (!result.hasOwnProperty(key)) {
 906        result[key] = item[key];
 907      }
 908    }
 909    return result;
 910  }
 911  
 912  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/on-sub-key.js
 913  /** @typedef {import('../types').AnyFunction} AnyFunction */
 914  
 915  /**
 916   * Higher-order reducer creator which creates a combined reducer object, keyed
 917   * by a property on the action object.
 918   *
 919   * @param {string} actionProperty Action property by which to key object.
 920   *
 921   * @return {AnyFunction} Higher-order reducer.
 922   */
 923  const onSubKey = actionProperty => reducer => (state = {}, action) => {
 924    // Retrieve subkey from action. Do not track if undefined; useful for cases
 925    // where reducer is scoped by action shape.
 926    const key = action[actionProperty];
 927    if (key === undefined) {
 928      return state;
 929    }
 930  
 931    // Avoid updating state if unchanged. Note that this also accounts for a
 932    // reducer which returns undefined on a key which is not yet tracked.
 933    const nextKeyState = reducer(state[key], action);
 934    if (nextKeyState === state[key]) {
 935      return state;
 936    }
 937    return {
 938      ...state,
 939      [key]: nextKeyState
 940    };
 941  };
 942  /* harmony default export */ const on_sub_key = (onSubKey);
 943  
 944  ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.mjs
 945  /******************************************************************************
 946  Copyright (c) Microsoft Corporation.
 947  
 948  Permission to use, copy, modify, and/or distribute this software for any
 949  purpose with or without fee is hereby granted.
 950  
 951  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 952  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 953  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 954  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 955  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 956  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 957  PERFORMANCE OF THIS SOFTWARE.
 958  ***************************************************************************** */
 959  /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
 960  
 961  var extendStatics = function(d, b) {
 962    extendStatics = Object.setPrototypeOf ||
 963        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
 964        function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
 965    return extendStatics(d, b);
 966  };
 967  
 968  function __extends(d, b) {
 969    if (typeof b !== "function" && b !== null)
 970        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
 971    extendStatics(d, b);
 972    function __() { this.constructor = d; }
 973    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
 974  }
 975  
 976  var __assign = function() {
 977    __assign = Object.assign || function __assign(t) {
 978        for (var s, i = 1, n = arguments.length; i < n; i++) {
 979            s = arguments[i];
 980            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
 981        }
 982        return t;
 983    }
 984    return __assign.apply(this, arguments);
 985  }
 986  
 987  function __rest(s, e) {
 988    var t = {};
 989    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
 990        t[p] = s[p];
 991    if (s != null && typeof Object.getOwnPropertySymbols === "function")
 992        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
 993            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
 994                t[p[i]] = s[p[i]];
 995        }
 996    return t;
 997  }
 998  
 999  function __decorate(decorators, target, key, desc) {
1000    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1001    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1002    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1003    return c > 3 && r && Object.defineProperty(target, key, r), r;
1004  }
1005  
1006  function __param(paramIndex, decorator) {
1007    return function (target, key) { decorator(target, key, paramIndex); }
1008  }
1009  
1010  function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
1011    function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
1012    var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
1013    var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
1014    var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
1015    var _, done = false;
1016    for (var i = decorators.length - 1; i >= 0; i--) {
1017        var context = {};
1018        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
1019        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
1020        context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
1021        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
1022        if (kind === "accessor") {
1023            if (result === void 0) continue;
1024            if (result === null || typeof result !== "object") throw new TypeError("Object expected");
1025            if (_ = accept(result.get)) descriptor.get = _;
1026            if (_ = accept(result.set)) descriptor.set = _;
1027            if (_ = accept(result.init)) initializers.unshift(_);
1028        }
1029        else if (_ = accept(result)) {
1030            if (kind === "field") initializers.unshift(_);
1031            else descriptor[key] = _;
1032        }
1033    }
1034    if (target) Object.defineProperty(target, contextIn.name, descriptor);
1035    done = true;
1036  };
1037  
1038  function __runInitializers(thisArg, initializers, value) {
1039    var useValue = arguments.length > 2;
1040    for (var i = 0; i < initializers.length; i++) {
1041        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
1042    }
1043    return useValue ? value : void 0;
1044  };
1045  
1046  function __propKey(x) {
1047    return typeof x === "symbol" ? x : "".concat(x);
1048  };
1049  
1050  function __setFunctionName(f, name, prefix) {
1051    if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
1052    return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
1053  };
1054  
1055  function __metadata(metadataKey, metadataValue) {
1056    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
1057  }
1058  
1059  function __awaiter(thisArg, _arguments, P, generator) {
1060    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1061    return new (P || (P = Promise))(function (resolve, reject) {
1062        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1063        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1064        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1065        step((generator = generator.apply(thisArg, _arguments || [])).next());
1066    });
1067  }
1068  
1069  function __generator(thisArg, body) {
1070    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
1071    return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1072    function verb(n) { return function (v) { return step([n, v]); }; }
1073    function step(op) {
1074        if (f) throw new TypeError("Generator is already executing.");
1075        while (g && (g = 0, op[0] && (_ = 0)), _) try {
1076            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1077            if (y = 0, t) op = [op[0] & 2, t.value];
1078            switch (op[0]) {
1079                case 0: case 1: t = op; break;
1080                case 4: _.label++; return { value: op[1], done: false };
1081                case 5: _.label++; y = op[1]; op = [0]; continue;
1082                case 7: op = _.ops.pop(); _.trys.pop(); continue;
1083                default:
1084                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1085                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1086                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1087                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1088                    if (t[2]) _.ops.pop();
1089                    _.trys.pop(); continue;
1090            }
1091            op = body.call(thisArg, _);
1092        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1093        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1094    }
1095  }
1096  
1097  var __createBinding = Object.create ? (function(o, m, k, k2) {
1098    if (k2 === undefined) k2 = k;
1099    var desc = Object.getOwnPropertyDescriptor(m, k);
1100    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1101        desc = { enumerable: true, get: function() { return m[k]; } };
1102    }
1103    Object.defineProperty(o, k2, desc);
1104  }) : (function(o, m, k, k2) {
1105    if (k2 === undefined) k2 = k;
1106    o[k2] = m[k];
1107  });
1108  
1109  function __exportStar(m, o) {
1110    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
1111  }
1112  
1113  function __values(o) {
1114    var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1115    if (m) return m.call(o);
1116    if (o && typeof o.length === "number") return {
1117        next: function () {
1118            if (o && i >= o.length) o = void 0;
1119            return { value: o && o[i++], done: !o };
1120        }
1121    };
1122    throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1123  }
1124  
1125  function __read(o, n) {
1126    var m = typeof Symbol === "function" && o[Symbol.iterator];
1127    if (!m) return o;
1128    var i = m.call(o), r, ar = [], e;
1129    try {
1130        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1131    }
1132    catch (error) { e = { error: error }; }
1133    finally {
1134        try {
1135            if (r && !r.done && (m = i["return"])) m.call(i);
1136        }
1137        finally { if (e) throw e.error; }
1138    }
1139    return ar;
1140  }
1141  
1142  /** @deprecated */
1143  function __spread() {
1144    for (var ar = [], i = 0; i < arguments.length; i++)
1145        ar = ar.concat(__read(arguments[i]));
1146    return ar;
1147  }
1148  
1149  /** @deprecated */
1150  function __spreadArrays() {
1151    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
1152    for (var r = Array(s), k = 0, i = 0; i < il; i++)
1153        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
1154            r[k] = a[j];
1155    return r;
1156  }
1157  
1158  function __spreadArray(to, from, pack) {
1159    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1160        if (ar || !(i in from)) {
1161            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1162            ar[i] = from[i];
1163        }
1164    }
1165    return to.concat(ar || Array.prototype.slice.call(from));
1166  }
1167  
1168  function __await(v) {
1169    return this instanceof __await ? (this.v = v, this) : new __await(v);
1170  }
1171  
1172  function __asyncGenerator(thisArg, _arguments, generator) {
1173    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1174    var g = generator.apply(thisArg, _arguments || []), i, q = [];
1175    return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
1176    function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
1177    function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
1178    function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
1179    function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
1180    function fulfill(value) { resume("next", value); }
1181    function reject(value) { resume("throw", value); }
1182    function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
1183  }
1184  
1185  function __asyncDelegator(o) {
1186    var i, p;
1187    return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
1188    function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
1189  }
1190  
1191  function __asyncValues(o) {
1192    if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
1193    var m = o[Symbol.asyncIterator], i;
1194    return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
1195    function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
1196    function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
1197  }
1198  
1199  function __makeTemplateObject(cooked, raw) {
1200    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
1201    return cooked;
1202  };
1203  
1204  var __setModuleDefault = Object.create ? (function(o, v) {
1205    Object.defineProperty(o, "default", { enumerable: true, value: v });
1206  }) : function(o, v) {
1207    o["default"] = v;
1208  };
1209  
1210  function __importStar(mod) {
1211    if (mod && mod.__esModule) return mod;
1212    var result = {};
1213    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1214    __setModuleDefault(result, mod);
1215    return result;
1216  }
1217  
1218  function __importDefault(mod) {
1219    return (mod && mod.__esModule) ? mod : { default: mod };
1220  }
1221  
1222  function __classPrivateFieldGet(receiver, state, kind, f) {
1223    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1224    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1225    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1226  }
1227  
1228  function __classPrivateFieldSet(receiver, state, value, kind, f) {
1229    if (kind === "m") throw new TypeError("Private method is not writable");
1230    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1231    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1232    return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1233  }
1234  
1235  function __classPrivateFieldIn(state, receiver) {
1236    if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
1237    return typeof state === "function" ? receiver === state : state.has(receiver);
1238  }
1239  
1240  function __addDisposableResource(env, value, async) {
1241    if (value !== null && value !== void 0) {
1242      if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
1243      var dispose, inner;
1244      if (async) {
1245        if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
1246        dispose = value[Symbol.asyncDispose];
1247      }
1248      if (dispose === void 0) {
1249        if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
1250        dispose = value[Symbol.dispose];
1251        if (async) inner = dispose;
1252      }
1253      if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
1254      if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
1255      env.stack.push({ value: value, dispose: dispose, async: async });
1256    }
1257    else if (async) {
1258      env.stack.push({ async: true });
1259    }
1260    return value;
1261  }
1262  
1263  var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1264    var e = new Error(message);
1265    return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1266  };
1267  
1268  function __disposeResources(env) {
1269    function fail(e) {
1270      env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
1271      env.hasError = true;
1272    }
1273    var r, s = 0;
1274    function next() {
1275      while (r = env.stack.pop()) {
1276        try {
1277          if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
1278          if (r.dispose) {
1279            var result = r.dispose.call(r.value);
1280            if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
1281          }
1282          else s |= 1;
1283        }
1284        catch (e) {
1285          fail(e);
1286        }
1287      }
1288      if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
1289      if (env.hasError) throw env.error;
1290    }
1291    return next();
1292  }
1293  
1294  /* harmony default export */ const tslib_es6 = ({
1295    __extends,
1296    __assign,
1297    __rest,
1298    __decorate,
1299    __param,
1300    __metadata,
1301    __awaiter,
1302    __generator,
1303    __createBinding,
1304    __exportStar,
1305    __values,
1306    __read,
1307    __spread,
1308    __spreadArrays,
1309    __spreadArray,
1310    __await,
1311    __asyncGenerator,
1312    __asyncDelegator,
1313    __asyncValues,
1314    __makeTemplateObject,
1315    __importStar,
1316    __importDefault,
1317    __classPrivateFieldGet,
1318    __classPrivateFieldSet,
1319    __classPrivateFieldIn,
1320    __addDisposableResource,
1321    __disposeResources,
1322  });
1323  
1324  ;// CONCATENATED MODULE: ./node_modules/lower-case/dist.es2015/index.js
1325  /**
1326   * Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
1327   */
1328  var SUPPORTED_LOCALE = {
1329      tr: {
1330          regexp: /\u0130|\u0049|\u0049\u0307/g,
1331          map: {
1332              İ: "\u0069",
1333              I: "\u0131",
1334              İ: "\u0069",
1335          },
1336      },
1337      az: {
1338          regexp: /\u0130/g,
1339          map: {
1340              İ: "\u0069",
1341              I: "\u0131",
1342              İ: "\u0069",
1343          },
1344      },
1345      lt: {
1346          regexp: /\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,
1347          map: {
1348              I: "\u0069\u0307",
1349              J: "\u006A\u0307",
1350              Į: "\u012F\u0307",
1351              Ì: "\u0069\u0307\u0300",
1352              Í: "\u0069\u0307\u0301",
1353              Ĩ: "\u0069\u0307\u0303",
1354          },
1355      },
1356  };
1357  /**
1358   * Localized lower case.
1359   */
1360  function localeLowerCase(str, locale) {
1361      var lang = SUPPORTED_LOCALE[locale.toLowerCase()];
1362      if (lang)
1363          return lowerCase(str.replace(lang.regexp, function (m) { return lang.map[m]; }));
1364      return lowerCase(str);
1365  }
1366  /**
1367   * Lower case as a function.
1368   */
1369  function lowerCase(str) {
1370      return str.toLowerCase();
1371  }
1372  
1373  ;// CONCATENATED MODULE: ./node_modules/no-case/dist.es2015/index.js
1374  
1375  // Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
1376  var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
1377  // Remove all non-word characters.
1378  var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
1379  /**
1380   * Normalize the string into something other libraries can manipulate easier.
1381   */
1382  function noCase(input, options) {
1383      if (options === void 0) { options = {}; }
1384      var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
1385      var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
1386      var start = 0;
1387      var end = result.length;
1388      // Trim the delimiter from around the output string.
1389      while (result.charAt(start) === "\0")
1390          start++;
1391      while (result.charAt(end - 1) === "\0")
1392          end--;
1393      // Transform each token independently.
1394      return result.slice(start, end).split("\0").map(transform).join(delimiter);
1395  }
1396  /**
1397   * Replace `re` in the input string with the replacement value.
1398   */
1399  function replace(input, re, value) {
1400      if (re instanceof RegExp)
1401          return input.replace(re, value);
1402      return re.reduce(function (input, re) { return input.replace(re, value); }, input);
1403  }
1404  
1405  ;// CONCATENATED MODULE: ./node_modules/upper-case-first/dist.es2015/index.js
1406  /**
1407   * Upper case the first character of an input string.
1408   */
1409  function upperCaseFirst(input) {
1410      return input.charAt(0).toUpperCase() + input.substr(1);
1411  }
1412  
1413  ;// CONCATENATED MODULE: ./node_modules/capital-case/dist.es2015/index.js
1414  
1415  
1416  
1417  function capitalCaseTransform(input) {
1418      return upperCaseFirst(input.toLowerCase());
1419  }
1420  function capitalCase(input, options) {
1421      if (options === void 0) { options = {}; }
1422      return noCase(input, __assign({ delimiter: " ", transform: capitalCaseTransform }, options));
1423  }
1424  
1425  ;// CONCATENATED MODULE: ./node_modules/pascal-case/dist.es2015/index.js
1426  
1427  
1428  function pascalCaseTransform(input, index) {
1429      var firstChar = input.charAt(0);
1430      var lowerChars = input.substr(1).toLowerCase();
1431      if (index > 0 && firstChar >= "0" && firstChar <= "9") {
1432          return "_" + firstChar + lowerChars;
1433      }
1434      return "" + firstChar.toUpperCase() + lowerChars;
1435  }
1436  function dist_es2015_pascalCaseTransformMerge(input) {
1437      return input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();
1438  }
1439  function pascalCase(input, options) {
1440      if (options === void 0) { options = {}; }
1441      return noCase(input, __assign({ delimiter: "", transform: pascalCaseTransform }, options));
1442  }
1443  
1444  ;// CONCATENATED MODULE: external ["wp","apiFetch"]
1445  const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
1446  var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
1447  ;// CONCATENATED MODULE: external ["wp","i18n"]
1448  const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
1449  ;// CONCATENATED MODULE: external ["wp","richText"]
1450  const external_wp_richText_namespaceObject = window["wp"]["richText"];
1451  ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/native.js
1452  const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1453  /* harmony default export */ const esm_browser_native = ({
1454    randomUUID
1455  });
1456  ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
1457  // Unique ID creation requires a high quality random # generator. In the browser we therefore
1458  // require the crypto API and do not support built-in fallback to lower quality random number
1459  // generators (like Math.random()).
1460  let getRandomValues;
1461  const rnds8 = new Uint8Array(16);
1462  function rng() {
1463    // lazy load so that environments that need to polyfill have a chance to do so
1464    if (!getRandomValues) {
1465      // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
1466      getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
1467  
1468      if (!getRandomValues) {
1469        throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
1470      }
1471    }
1472  
1473    return getRandomValues(rnds8);
1474  }
1475  ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
1476  
1477  /**
1478   * Convert array of 16 byte values to UUID string format of the form:
1479   * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
1480   */
1481  
1482  const byteToHex = [];
1483  
1484  for (let i = 0; i < 256; ++i) {
1485    byteToHex.push((i + 0x100).toString(16).slice(1));
1486  }
1487  
1488  function unsafeStringify(arr, offset = 0) {
1489    // Note: Be careful editing this code!  It's been tuned for performance
1490    // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
1491    return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
1492  }
1493  
1494  function stringify(arr, offset = 0) {
1495    const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID.  If this throws, it's likely due to one
1496    // of the following:
1497    // - One or more input array values don't map to a hex octet (leading to
1498    // "undefined" in the uuid)
1499    // - Invalid input values for the RFC `version` or `variant` fields
1500  
1501    if (!validate(uuid)) {
1502      throw TypeError('Stringified UUID is invalid');
1503    }
1504  
1505    return uuid;
1506  }
1507  
1508  /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
1509  ;// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
1510  
1511  
1512  
1513  
1514  function v4(options, buf, offset) {
1515    if (esm_browser_native.randomUUID && !buf && !options) {
1516      return esm_browser_native.randomUUID();
1517    }
1518  
1519    options = options || {};
1520    const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
1521  
1522    rnds[6] = rnds[6] & 0x0f | 0x40;
1523    rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
1524  
1525    if (buf) {
1526      offset = offset || 0;
1527  
1528      for (let i = 0; i < 16; ++i) {
1529        buf[offset + i] = rnds[i];
1530      }
1531  
1532      return buf;
1533    }
1534  
1535    return unsafeStringify(rnds);
1536  }
1537  
1538  /* harmony default export */ const esm_browser_v4 = (v4);
1539  ;// CONCATENATED MODULE: external ["wp","url"]
1540  const external_wp_url_namespaceObject = window["wp"]["url"];
1541  ;// CONCATENATED MODULE: external ["wp","deprecated"]
1542  const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
1543  var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
1544  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/set-nested-value.js
1545  /**
1546   * Sets the value at path of object.
1547   * If a portion of path doesn’t exist, it’s created.
1548   * Arrays are created for missing index properties while objects are created
1549   * for all other missing properties.
1550   *
1551   * Path is specified as either:
1552   * - a string of properties, separated by dots, for example: "x.y".
1553   * - an array of properties, for example `[ 'x', 'y' ]`.
1554   *
1555   * This function intentionally mutates the input object.
1556   *
1557   * Inspired by _.set().
1558   *
1559   * @see https://lodash.com/docs/4.17.15#set
1560   *
1561   * @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`.
1562   *
1563   * @param {Object}       object Object to modify
1564   * @param {Array|string} path   Path of the property to set.
1565   * @param {*}            value  Value to set.
1566   */
1567  function setNestedValue(object, path, value) {
1568    if (!object || typeof object !== 'object') {
1569      return object;
1570    }
1571    const normalizedPath = Array.isArray(path) ? path : path.split('.');
1572    normalizedPath.reduce((acc, key, idx) => {
1573      if (acc[key] === undefined) {
1574        if (Number.isInteger(normalizedPath[idx + 1])) {
1575          acc[key] = [];
1576        } else {
1577          acc[key] = {};
1578        }
1579      }
1580      if (idx === normalizedPath.length - 1) {
1581        acc[key] = value;
1582      }
1583      return acc[key];
1584    }, object);
1585    return object;
1586  }
1587  
1588  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/get-nested-value.js
1589  /**
1590   * Helper util to return a value from a certain path of the object.
1591   * Path is specified as either:
1592   * - a string of properties, separated by dots, for example: "x.y".
1593   * - an array of properties, for example `[ 'x', 'y' ]`.
1594   * You can also specify a default value in case the result is nullish.
1595   *
1596   * @param {Object}       object       Input object.
1597   * @param {string|Array} path         Path to the object property.
1598   * @param {*}            defaultValue Default value if the value at the specified path is undefined.
1599   * @return {*} Value of the object property at the specified path.
1600   */
1601  function getNestedValue(object, path, defaultValue) {
1602    if (!object || typeof object !== 'object' || typeof path !== 'string' && !Array.isArray(path)) {
1603      return object;
1604    }
1605    const normalizedPath = Array.isArray(path) ? path : path.split('.');
1606    let value = object;
1607    normalizedPath.forEach(fieldName => {
1608      value = value?.[fieldName];
1609    });
1610    return value !== undefined ? value : defaultValue;
1611  }
1612  
1613  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/actions.js
1614  /**
1615   * Returns an action object used in signalling that items have been received.
1616   *
1617   * @param {Array}   items Items received.
1618   * @param {?Object} edits Optional edits to reset.
1619   * @param {?Object} meta  Meta information about pagination.
1620   *
1621   * @return {Object} Action object.
1622   */
1623  function receiveItems(items, edits, meta) {
1624    return {
1625      type: 'RECEIVE_ITEMS',
1626      items: Array.isArray(items) ? items : [items],
1627      persistedEdits: edits,
1628      meta
1629    };
1630  }
1631  
1632  /**
1633   * Returns an action object used in signalling that entity records have been
1634   * deleted and they need to be removed from entities state.
1635   *
1636   * @param {string}              kind            Kind of the removed entities.
1637   * @param {string}              name            Name of the removed entities.
1638   * @param {Array|number|string} records         Record IDs of the removed entities.
1639   * @param {boolean}             invalidateCache Controls whether we want to invalidate the cache.
1640   * @return {Object} Action object.
1641   */
1642  function removeItems(kind, name, records, invalidateCache = false) {
1643    return {
1644      type: 'REMOVE_ITEMS',
1645      itemIds: Array.isArray(records) ? records : [records],
1646      kind,
1647      name,
1648      invalidateCache
1649    };
1650  }
1651  
1652  /**
1653   * Returns an action object used in signalling that queried data has been
1654   * received.
1655   *
1656   * @param {Array}   items Queried items received.
1657   * @param {?Object} query Optional query object.
1658   * @param {?Object} edits Optional edits to reset.
1659   * @param {?Object} meta  Meta information about pagination.
1660   *
1661   * @return {Object} Action object.
1662   */
1663  function receiveQueriedItems(items, query = {}, edits, meta) {
1664    return {
1665      ...receiveItems(items, edits, meta),
1666      query
1667    };
1668  }
1669  
1670  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/batch/default-processor.js
1671  /**
1672   * WordPress dependencies
1673   */
1674  
1675  
1676  /**
1677   * Maximum number of requests to place in a single batch request. Obtained by
1678   * sending a preflight OPTIONS request to /batch/v1/.
1679   *
1680   * @type {number?}
1681   */
1682  let maxItems = null;
1683  function chunk(arr, chunkSize) {
1684    const tmp = [...arr];
1685    const cache = [];
1686    while (tmp.length) {
1687      cache.push(tmp.splice(0, chunkSize));
1688    }
1689    return cache;
1690  }
1691  
1692  /**
1693   * Default batch processor. Sends its input requests to /batch/v1.
1694   *
1695   * @param {Array} requests List of API requests to perform at once.
1696   *
1697   * @return {Promise} Promise that resolves to a list of objects containing
1698   *                   either `output` (if that request was successful) or `error`
1699   *                   (if not ).
1700   */
1701  async function defaultProcessor(requests) {
1702    if (maxItems === null) {
1703      const preflightResponse = await external_wp_apiFetch_default()({
1704        path: '/batch/v1',
1705        method: 'OPTIONS'
1706      });
1707      maxItems = preflightResponse.endpoints[0].args.requests.maxItems;
1708    }
1709    const results = [];
1710  
1711    // @ts-ignore We would have crashed or never gotten to this point if we hadn't received the maxItems count.
1712    for (const batchRequests of chunk(requests, maxItems)) {
1713      const batchResponse = await external_wp_apiFetch_default()({
1714        path: '/batch/v1',
1715        method: 'POST',
1716        data: {
1717          validation: 'require-all-validate',
1718          requests: batchRequests.map(request => ({
1719            path: request.path,
1720            body: request.data,
1721            // Rename 'data' to 'body'.
1722            method: request.method,
1723            headers: request.headers
1724          }))
1725        }
1726      });
1727      let batchResults;
1728      if (batchResponse.failed) {
1729        batchResults = batchResponse.responses.map(response => ({
1730          error: response?.body
1731        }));
1732      } else {
1733        batchResults = batchResponse.responses.map(response => {
1734          const result = {};
1735          if (response.status >= 200 && response.status < 300) {
1736            result.output = response.body;
1737          } else {
1738            result.error = response.body;
1739          }
1740          return result;
1741        });
1742      }
1743      results.push(...batchResults);
1744    }
1745    return results;
1746  }
1747  
1748  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/batch/create-batch.js
1749  /**
1750   * Internal dependencies
1751   */
1752  
1753  
1754  /**
1755   * Creates a batch, which can be used to combine multiple API requests into one
1756   * API request using the WordPress batch processing API (/v1/batch).
1757   *
1758   * ```
1759   * const batch = createBatch();
1760   * const dunePromise = batch.add( {
1761   *   path: '/v1/books',
1762   *   method: 'POST',
1763   *   data: { title: 'Dune' }
1764   * } );
1765   * const lotrPromise = batch.add( {
1766   *   path: '/v1/books',
1767   *   method: 'POST',
1768   *   data: { title: 'Lord of the Rings' }
1769   * } );
1770   * const isSuccess = await batch.run(); // Sends one POST to /v1/batch.
1771   * if ( isSuccess ) {
1772   *   console.log(
1773   *     'Saved two books:',
1774   *     await dunePromise,
1775   *     await lotrPromise
1776   *   );
1777   * }
1778   * ```
1779   *
1780   * @param {Function} [processor] Processor function. Can be used to replace the
1781   *                               default functionality which is to send an API
1782   *                               request to /v1/batch. Is given an array of
1783   *                               inputs and must return a promise that
1784   *                               resolves to an array of objects containing
1785   *                               either `output` or `error`.
1786   */
1787  function createBatch(processor = defaultProcessor) {
1788    let lastId = 0;
1789    /** @type {Array<{ input: any; resolve: ( value: any ) => void; reject: ( error: any ) => void }>} */
1790    let queue = [];
1791    const pending = new ObservableSet();
1792    return {
1793      /**
1794       * Adds an input to the batch and returns a promise that is resolved or
1795       * rejected when the input is processed by `batch.run()`.
1796       *
1797       * You may also pass a thunk which allows inputs to be added
1798       * asychronously.
1799       *
1800       * ```
1801       * // Both are allowed:
1802       * batch.add( { path: '/v1/books', ... } );
1803       * batch.add( ( add ) => add( { path: '/v1/books', ... } ) );
1804       * ```
1805       *
1806       * If a thunk is passed, `batch.run()` will pause until either:
1807       *
1808       * - The thunk calls its `add` argument, or;
1809       * - The thunk returns a promise and that promise resolves, or;
1810       * - The thunk returns a non-promise.
1811       *
1812       * @param {any|Function} inputOrThunk Input to add or thunk to execute.
1813       *
1814       * @return {Promise|any} If given an input, returns a promise that
1815       *                       is resolved or rejected when the batch is
1816       *                       processed. If given a thunk, returns the return
1817       *                       value of that thunk.
1818       */
1819      add(inputOrThunk) {
1820        const id = ++lastId;
1821        pending.add(id);
1822        const add = input => new Promise((resolve, reject) => {
1823          queue.push({
1824            input,
1825            resolve,
1826            reject
1827          });
1828          pending.delete(id);
1829        });
1830        if (typeof inputOrThunk === 'function') {
1831          return Promise.resolve(inputOrThunk(add)).finally(() => {
1832            pending.delete(id);
1833          });
1834        }
1835        return add(inputOrThunk);
1836      },
1837      /**
1838       * Runs the batch. This calls `batchProcessor` and resolves or rejects
1839       * all promises returned by `add()`.
1840       *
1841       * @return {Promise<boolean>} A promise that resolves to a boolean that is true
1842       *                   if the processor returned no errors.
1843       */
1844      async run() {
1845        if (pending.size) {
1846          await new Promise(resolve => {
1847            const unsubscribe = pending.subscribe(() => {
1848              if (!pending.size) {
1849                unsubscribe();
1850                resolve(undefined);
1851              }
1852            });
1853          });
1854        }
1855        let results;
1856        try {
1857          results = await processor(queue.map(({
1858            input
1859          }) => input));
1860          if (results.length !== queue.length) {
1861            throw new Error('run: Array returned by processor must be same size as input array.');
1862          }
1863        } catch (error) {
1864          for (const {
1865            reject
1866          } of queue) {
1867            reject(error);
1868          }
1869          throw error;
1870        }
1871        let isSuccess = true;
1872        results.forEach((result, key) => {
1873          const queueItem = queue[key];
1874          if (result?.error) {
1875            queueItem?.reject(result.error);
1876            isSuccess = false;
1877          } else {
1878            var _result$output;
1879            queueItem?.resolve((_result$output = result?.output) !== null && _result$output !== void 0 ? _result$output : result);
1880          }
1881        });
1882        queue = [];
1883        return isSuccess;
1884      }
1885    };
1886  }
1887  class ObservableSet {
1888    constructor(...args) {
1889      this.set = new Set(...args);
1890      this.subscribers = new Set();
1891    }
1892    get size() {
1893      return this.set.size;
1894    }
1895    add(value) {
1896      this.set.add(value);
1897      this.subscribers.forEach(subscriber => subscriber());
1898      return this;
1899    }
1900    delete(value) {
1901      const isSuccess = this.set.delete(value);
1902      this.subscribers.forEach(subscriber => subscriber());
1903      return isSuccess;
1904    }
1905    subscribe(subscriber) {
1906      this.subscribers.add(subscriber);
1907      return () => {
1908        this.subscribers.delete(subscriber);
1909      };
1910    }
1911  }
1912  
1913  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/name.js
1914  /**
1915   * The reducer key used by core data in store registration.
1916   * This is defined in a separate file to avoid cycle-dependency
1917   *
1918   * @type {string}
1919   */
1920  const STORE_NAME = 'core';
1921  
1922  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/actions.js
1923  /**
1924   * External dependencies
1925   */
1926  
1927  
1928  
1929  /**
1930   * WordPress dependencies
1931   */
1932  
1933  
1934  
1935  
1936  /**
1937   * Internal dependencies
1938   */
1939  
1940  
1941  
1942  
1943  
1944  
1945  
1946  /**
1947   * Returns an action object used in signalling that authors have been received.
1948   * Ignored from documentation as it's internal to the data store.
1949   *
1950   * @ignore
1951   *
1952   * @param {string}       queryID Query ID.
1953   * @param {Array|Object} users   Users received.
1954   *
1955   * @return {Object} Action object.
1956   */
1957  function receiveUserQuery(queryID, users) {
1958    return {
1959      type: 'RECEIVE_USER_QUERY',
1960      users: Array.isArray(users) ? users : [users],
1961      queryID
1962    };
1963  }
1964  
1965  /**
1966   * Returns an action used in signalling that the current user has been received.
1967   * Ignored from documentation as it's internal to the data store.
1968   *
1969   * @ignore
1970   *
1971   * @param {Object} currentUser Current user object.
1972   *
1973   * @return {Object} Action object.
1974   */
1975  function receiveCurrentUser(currentUser) {
1976    return {
1977      type: 'RECEIVE_CURRENT_USER',
1978      currentUser
1979    };
1980  }
1981  
1982  /**
1983   * Returns an action object used in adding new entities.
1984   *
1985   * @param {Array} entities Entities received.
1986   *
1987   * @return {Object} Action object.
1988   */
1989  function addEntities(entities) {
1990    return {
1991      type: 'ADD_ENTITIES',
1992      entities
1993    };
1994  }
1995  
1996  /**
1997   * Returns an action object used in signalling that entity records have been received.
1998   *
1999   * @param {string}       kind            Kind of the received entity record.
2000   * @param {string}       name            Name of the received entity record.
2001   * @param {Array|Object} records         Records received.
2002   * @param {?Object}      query           Query Object.
2003   * @param {?boolean}     invalidateCache Should invalidate query caches.
2004   * @param {?Object}      edits           Edits to reset.
2005   * @param {?Object}      meta            Meta information about pagination.
2006   * @return {Object} Action object.
2007   */
2008  function receiveEntityRecords(kind, name, records, query, invalidateCache = false, edits, meta) {
2009    // Auto drafts should not have titles, but some plugins rely on them so we can't filter this
2010    // on the server.
2011    if (kind === 'postType') {
2012      records = (Array.isArray(records) ? records : [records]).map(record => record.status === 'auto-draft' ? {
2013        ...record,
2014        title: ''
2015      } : record);
2016    }
2017    let action;
2018    if (query) {
2019      action = receiveQueriedItems(records, query, edits, meta);
2020    } else {
2021      action = receiveItems(records, edits, meta);
2022    }
2023    return {
2024      ...action,
2025      kind,
2026      name,
2027      invalidateCache
2028    };
2029  }
2030  
2031  /**
2032   * Returns an action object used in signalling that the current theme has been received.
2033   * Ignored from documentation as it's internal to the data store.
2034   *
2035   * @ignore
2036   *
2037   * @param {Object} currentTheme The current theme.
2038   *
2039   * @return {Object} Action object.
2040   */
2041  function receiveCurrentTheme(currentTheme) {
2042    return {
2043      type: 'RECEIVE_CURRENT_THEME',
2044      currentTheme
2045    };
2046  }
2047  
2048  /**
2049   * Returns an action object used in signalling that the current global styles id has been received.
2050   * Ignored from documentation as it's internal to the data store.
2051   *
2052   * @ignore
2053   *
2054   * @param {string} currentGlobalStylesId The current global styles id.
2055   *
2056   * @return {Object} Action object.
2057   */
2058  function __experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId) {
2059    return {
2060      type: 'RECEIVE_CURRENT_GLOBAL_STYLES_ID',
2061      id: currentGlobalStylesId
2062    };
2063  }
2064  
2065  /**
2066   * Returns an action object used in signalling that the theme base global styles have been received
2067   * Ignored from documentation as it's internal to the data store.
2068   *
2069   * @ignore
2070   *
2071   * @param {string} stylesheet   The theme's identifier
2072   * @param {Object} globalStyles The global styles object.
2073   *
2074   * @return {Object} Action object.
2075   */
2076  function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) {
2077    return {
2078      type: 'RECEIVE_THEME_GLOBAL_STYLES',
2079      stylesheet,
2080      globalStyles
2081    };
2082  }
2083  
2084  /**
2085   * Returns an action object used in signalling that the theme global styles variations have been received.
2086   * Ignored from documentation as it's internal to the data store.
2087   *
2088   * @ignore
2089   *
2090   * @param {string} stylesheet The theme's identifier
2091   * @param {Array}  variations The global styles variations.
2092   *
2093   * @return {Object} Action object.
2094   */
2095  function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations) {
2096    return {
2097      type: 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS',
2098      stylesheet,
2099      variations
2100    };
2101  }
2102  
2103  /**
2104   * Returns an action object used in signalling that the index has been received.
2105   *
2106   * @deprecated since WP 5.9, this is not useful anymore, use the selector directly.
2107   *
2108   * @return {Object} Action object.
2109   */
2110  function receiveThemeSupports() {
2111    external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveThemeSupports", {
2112      since: '5.9'
2113    });
2114    return {
2115      type: 'DO_NOTHING'
2116    };
2117  }
2118  
2119  /**
2120   * Returns an action object used in signalling that the theme global styles CPT post revisions have been received.
2121   * Ignored from documentation as it's internal to the data store.
2122   *
2123   * @deprecated since WordPress 6.5.0. Callers should use `dispatch( 'core' ).receiveRevision` instead.
2124   *
2125   * @ignore
2126   *
2127   * @param {number} currentId The post id.
2128   * @param {Array}  revisions The global styles revisions.
2129   *
2130   * @return {Object} Action object.
2131   */
2132  function receiveThemeGlobalStyleRevisions(currentId, revisions) {
2133    external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()", {
2134      since: '6.5.0',
2135      alternative: "wp.data.dispatch( 'core' ).receiveRevisions"
2136    });
2137    return {
2138      type: 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS',
2139      currentId,
2140      revisions
2141    };
2142  }
2143  
2144  /**
2145   * Returns an action object used in signalling that the preview data for
2146   * a given URl has been received.
2147   * Ignored from documentation as it's internal to the data store.
2148   *
2149   * @ignore
2150   *
2151   * @param {string} url     URL to preview the embed for.
2152   * @param {*}      preview Preview data.
2153   *
2154   * @return {Object} Action object.
2155   */
2156  function receiveEmbedPreview(url, preview) {
2157    return {
2158      type: 'RECEIVE_EMBED_PREVIEW',
2159      url,
2160      preview
2161    };
2162  }
2163  
2164  /**
2165   * Action triggered to delete an entity record.
2166   *
2167   * @param {string}        kind                         Kind of the deleted entity.
2168   * @param {string}        name                         Name of the deleted entity.
2169   * @param {number|string} recordId                     Record ID of the deleted entity.
2170   * @param {?Object}       query                        Special query parameters for the
2171   *                                                     DELETE API call.
2172   * @param {Object}        [options]                    Delete options.
2173   * @param {Function}      [options.__unstableFetch]    Internal use only. Function to
2174   *                                                     call instead of `apiFetch()`.
2175   *                                                     Must return a promise.
2176   * @param {boolean}       [options.throwOnError=false] If false, this action suppresses all
2177   *                                                     the exceptions. Defaults to false.
2178   */
2179  const deleteEntityRecord = (kind, name, recordId, query, {
2180    __unstableFetch = (external_wp_apiFetch_default()),
2181    throwOnError = false
2182  } = {}) => async ({
2183    dispatch
2184  }) => {
2185    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
2186    const entityConfig = configs.find(config => config.kind === kind && config.name === name);
2187    let error;
2188    let deletedRecord = false;
2189    if (!entityConfig) {
2190      return;
2191    }
2192    const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name, recordId], {
2193      exclusive: true
2194    });
2195    try {
2196      dispatch({
2197        type: 'DELETE_ENTITY_RECORD_START',
2198        kind,
2199        name,
2200        recordId
2201      });
2202      let hasError = false;
2203      try {
2204        let path = `$entityConfig.baseURL}/$recordId}`;
2205        if (query) {
2206          path = (0,external_wp_url_namespaceObject.addQueryArgs)(path, query);
2207        }
2208        deletedRecord = await __unstableFetch({
2209          path,
2210          method: 'DELETE'
2211        });
2212        await dispatch(removeItems(kind, name, recordId, true));
2213      } catch (_error) {
2214        hasError = true;
2215        error = _error;
2216      }
2217      dispatch({
2218        type: 'DELETE_ENTITY_RECORD_FINISH',
2219        kind,
2220        name,
2221        recordId,
2222        error
2223      });
2224      if (hasError && throwOnError) {
2225        throw error;
2226      }
2227      return deletedRecord;
2228    } finally {
2229      dispatch.__unstableReleaseStoreLock(lock);
2230    }
2231  };
2232  
2233  /**
2234   * Returns an action object that triggers an
2235   * edit to an entity record.
2236   *
2237   * @param {string}        kind                 Kind of the edited entity record.
2238   * @param {string}        name                 Name of the edited entity record.
2239   * @param {number|string} recordId             Record ID of the edited entity record.
2240   * @param {Object}        edits                The edits.
2241   * @param {Object}        options              Options for the edit.
2242   * @param {boolean}       [options.undoIgnore] Whether to ignore the edit in undo history or not.
2243   *
2244   * @return {Object} Action object.
2245   */
2246  const editEntityRecord = (kind, name, recordId, edits, options = {}) => ({
2247    select,
2248    dispatch
2249  }) => {
2250    const entityConfig = select.getEntityConfig(kind, name);
2251    if (!entityConfig) {
2252      throw new Error(`The entity being edited ($kind}, $name}) does not have a loaded config.`);
2253    }
2254    const {
2255      mergedEdits = {}
2256    } = entityConfig;
2257    const record = select.getRawEntityRecord(kind, name, recordId);
2258    const editedRecord = select.getEditedEntityRecord(kind, name, recordId);
2259    const edit = {
2260      kind,
2261      name,
2262      recordId,
2263      // Clear edits when they are equal to their persisted counterparts
2264      // so that the property is not considered dirty.
2265      edits: Object.keys(edits).reduce((acc, key) => {
2266        const recordValue = record[key];
2267        const editedRecordValue = editedRecord[key];
2268        const value = mergedEdits[key] ? {
2269          ...editedRecordValue,
2270          ...edits[key]
2271        } : edits[key];
2272        acc[key] = es6_default()(recordValue, value) ? undefined : value;
2273        return acc;
2274      }, {})
2275    };
2276    if (window.__experimentalEnableSync && entityConfig.syncConfig) {
2277      if (false) {}
2278    } else {
2279      if (!options.undoIgnore) {
2280        select.getUndoManager().addRecord([{
2281          id: {
2282            kind,
2283            name,
2284            recordId
2285          },
2286          changes: Object.keys(edits).reduce((acc, key) => {
2287            acc[key] = {
2288              from: editedRecord[key],
2289              to: edits[key]
2290            };
2291            return acc;
2292          }, {})
2293        }], options.isCached);
2294      }
2295      dispatch({
2296        type: 'EDIT_ENTITY_RECORD',
2297        ...edit
2298      });
2299    }
2300  };
2301  
2302  /**
2303   * Action triggered to undo the last edit to
2304   * an entity record, if any.
2305   */
2306  const undo = () => ({
2307    select,
2308    dispatch
2309  }) => {
2310    const undoRecord = select.getUndoManager().undo();
2311    if (!undoRecord) {
2312      return;
2313    }
2314    dispatch({
2315      type: 'UNDO',
2316      record: undoRecord
2317    });
2318  };
2319  
2320  /**
2321   * Action triggered to redo the last undoed
2322   * edit to an entity record, if any.
2323   */
2324  const redo = () => ({
2325    select,
2326    dispatch
2327  }) => {
2328    const redoRecord = select.getUndoManager().redo();
2329    if (!redoRecord) {
2330      return;
2331    }
2332    dispatch({
2333      type: 'REDO',
2334      record: redoRecord
2335    });
2336  };
2337  
2338  /**
2339   * Forces the creation of a new undo level.
2340   *
2341   * @return {Object} Action object.
2342   */
2343  const __unstableCreateUndoLevel = () => ({
2344    select
2345  }) => {
2346    select.getUndoManager().addRecord();
2347  };
2348  
2349  /**
2350   * Action triggered to save an entity record.
2351   *
2352   * @param {string}   kind                         Kind of the received entity.
2353   * @param {string}   name                         Name of the received entity.
2354   * @param {Object}   record                       Record to be saved.
2355   * @param {Object}   options                      Saving options.
2356   * @param {boolean}  [options.isAutosave=false]   Whether this is an autosave.
2357   * @param {Function} [options.__unstableFetch]    Internal use only. Function to
2358   *                                                call instead of `apiFetch()`.
2359   *                                                Must return a promise.
2360   * @param {boolean}  [options.throwOnError=false] If false, this action suppresses all
2361   *                                                the exceptions. Defaults to false.
2362   */
2363  const saveEntityRecord = (kind, name, record, {
2364    isAutosave = false,
2365    __unstableFetch = (external_wp_apiFetch_default()),
2366    throwOnError = false
2367  } = {}) => async ({
2368    select,
2369    resolveSelect,
2370    dispatch
2371  }) => {
2372    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
2373    const entityConfig = configs.find(config => config.kind === kind && config.name === name);
2374    if (!entityConfig) {
2375      return;
2376    }
2377    const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;
2378    const recordId = record[entityIdKey];
2379    const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name, recordId || esm_browser_v4()], {
2380      exclusive: true
2381    });
2382    try {
2383      // Evaluate optimized edits.
2384      // (Function edits that should be evaluated on save to avoid expensive computations on every edit.)
2385      for (const [key, value] of Object.entries(record)) {
2386        if (typeof value === 'function') {
2387          const evaluatedValue = value(select.getEditedEntityRecord(kind, name, recordId));
2388          dispatch.editEntityRecord(kind, name, recordId, {
2389            [key]: evaluatedValue
2390          }, {
2391            undoIgnore: true
2392          });
2393          record[key] = evaluatedValue;
2394        }
2395      }
2396      dispatch({
2397        type: 'SAVE_ENTITY_RECORD_START',
2398        kind,
2399        name,
2400        recordId,
2401        isAutosave
2402      });
2403      let updatedRecord;
2404      let error;
2405      let hasError = false;
2406      try {
2407        const path = `$entityConfig.baseURL}$recordId ? '/' + recordId : ''}`;
2408        const persistedRecord = select.getRawEntityRecord(kind, name, recordId);
2409        if (isAutosave) {
2410          // Most of this autosave logic is very specific to posts.
2411          // This is fine for now as it is the only supported autosave,
2412          // but ideally this should all be handled in the back end,
2413          // so the client just sends and receives objects.
2414          const currentUser = select.getCurrentUser();
2415          const currentUserId = currentUser ? currentUser.id : undefined;
2416          const autosavePost = await resolveSelect.getAutosave(persistedRecord.type, persistedRecord.id, currentUserId);
2417          // Autosaves need all expected fields to be present.
2418          // So we fallback to the previous autosave and then
2419          // to the actual persisted entity if the edits don't
2420          // have a value.
2421          let data = {
2422            ...persistedRecord,
2423            ...autosavePost,
2424            ...record
2425          };
2426          data = Object.keys(data).reduce((acc, key) => {
2427            if (['title', 'excerpt', 'content', 'meta'].includes(key)) {
2428              acc[key] = data[key];
2429            }
2430            return acc;
2431          }, {
2432            // Do not update the `status` if we have edited it when auto saving.
2433            // It's very important to let the user explicitly save this change,
2434            // because it can lead to unexpected results. An example would be to
2435            // have a draft post and change the status to publish.
2436            status: data.status === 'auto-draft' ? 'draft' : undefined
2437          });
2438          updatedRecord = await __unstableFetch({
2439            path: `$path}/autosaves`,
2440            method: 'POST',
2441            data
2442          });
2443  
2444          // An autosave may be processed by the server as a regular save
2445          // when its update is requested by the author and the post had
2446          // draft or auto-draft status.
2447          if (persistedRecord.id === updatedRecord.id) {
2448            let newRecord = {
2449              ...persistedRecord,
2450              ...data,
2451              ...updatedRecord
2452            };
2453            newRecord = Object.keys(newRecord).reduce((acc, key) => {
2454              // These properties are persisted in autosaves.
2455              if (['title', 'excerpt', 'content'].includes(key)) {
2456                acc[key] = newRecord[key];
2457              } else if (key === 'status') {
2458                // Status is only persisted in autosaves when going from
2459                // "auto-draft" to "draft".
2460                acc[key] = persistedRecord.status === 'auto-draft' && newRecord.status === 'draft' ? newRecord.status : persistedRecord.status;
2461              } else {
2462                // These properties are not persisted in autosaves.
2463                acc[key] = persistedRecord[key];
2464              }
2465              return acc;
2466            }, {});
2467            dispatch.receiveEntityRecords(kind, name, newRecord, undefined, true);
2468          } else {
2469            dispatch.receiveAutosaves(persistedRecord.id, updatedRecord);
2470          }
2471        } else {
2472          let edits = record;
2473          if (entityConfig.__unstablePrePersist) {
2474            edits = {
2475              ...edits,
2476              ...entityConfig.__unstablePrePersist(persistedRecord, edits)
2477            };
2478          }
2479          updatedRecord = await __unstableFetch({
2480            path,
2481            method: recordId ? 'PUT' : 'POST',
2482            data: edits
2483          });
2484          dispatch.receiveEntityRecords(kind, name, updatedRecord, undefined, true, edits);
2485        }
2486      } catch (_error) {
2487        hasError = true;
2488        error = _error;
2489      }
2490      dispatch({
2491        type: 'SAVE_ENTITY_RECORD_FINISH',
2492        kind,
2493        name,
2494        recordId,
2495        error,
2496        isAutosave
2497      });
2498      if (hasError && throwOnError) {
2499        throw error;
2500      }
2501      return updatedRecord;
2502    } finally {
2503      dispatch.__unstableReleaseStoreLock(lock);
2504    }
2505  };
2506  
2507  /**
2508   * Runs multiple core-data actions at the same time using one API request.
2509   *
2510   * Example:
2511   *
2512   * ```
2513   * const [ savedRecord, updatedRecord, deletedRecord ] =
2514   *   await dispatch( 'core' ).__experimentalBatch( [
2515   *     ( { saveEntityRecord } ) => saveEntityRecord( 'root', 'widget', widget ),
2516   *     ( { saveEditedEntityRecord } ) => saveEntityRecord( 'root', 'widget', 123 ),
2517   *     ( { deleteEntityRecord } ) => deleteEntityRecord( 'root', 'widget', 123, null ),
2518   *   ] );
2519   * ```
2520   *
2521   * @param {Array} requests Array of functions which are invoked simultaneously.
2522   *                         Each function is passed an object containing
2523   *                         `saveEntityRecord`, `saveEditedEntityRecord`, and
2524   *                         `deleteEntityRecord`.
2525   *
2526   * @return {(thunkArgs: Object) => Promise} A promise that resolves to an array containing the return
2527   *                                          values of each function given in `requests`.
2528   */
2529  const __experimentalBatch = requests => async ({
2530    dispatch
2531  }) => {
2532    const batch = createBatch();
2533    const api = {
2534      saveEntityRecord(kind, name, record, options) {
2535        return batch.add(add => dispatch.saveEntityRecord(kind, name, record, {
2536          ...options,
2537          __unstableFetch: add
2538        }));
2539      },
2540      saveEditedEntityRecord(kind, name, recordId, options) {
2541        return batch.add(add => dispatch.saveEditedEntityRecord(kind, name, recordId, {
2542          ...options,
2543          __unstableFetch: add
2544        }));
2545      },
2546      deleteEntityRecord(kind, name, recordId, query, options) {
2547        return batch.add(add => dispatch.deleteEntityRecord(kind, name, recordId, query, {
2548          ...options,
2549          __unstableFetch: add
2550        }));
2551      }
2552    };
2553    const resultPromises = requests.map(request => request(api));
2554    const [, ...results] = await Promise.all([batch.run(), ...resultPromises]);
2555    return results;
2556  };
2557  
2558  /**
2559   * Action triggered to save an entity record's edits.
2560   *
2561   * @param {string}  kind     Kind of the entity.
2562   * @param {string}  name     Name of the entity.
2563   * @param {Object}  recordId ID of the record.
2564   * @param {Object=} options  Saving options.
2565   */
2566  const saveEditedEntityRecord = (kind, name, recordId, options) => async ({
2567    select,
2568    dispatch
2569  }) => {
2570    if (!select.hasEditsForEntityRecord(kind, name, recordId)) {
2571      return;
2572    }
2573    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
2574    const entityConfig = configs.find(config => config.kind === kind && config.name === name);
2575    if (!entityConfig) {
2576      return;
2577    }
2578    const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;
2579    const edits = select.getEntityRecordNonTransientEdits(kind, name, recordId);
2580    const record = {
2581      [entityIdKey]: recordId,
2582      ...edits
2583    };
2584    return await dispatch.saveEntityRecord(kind, name, record, options);
2585  };
2586  
2587  /**
2588   * Action triggered to save only specified properties for the entity.
2589   *
2590   * @param {string}        kind        Kind of the entity.
2591   * @param {string}        name        Name of the entity.
2592   * @param {number|string} recordId    ID of the record.
2593   * @param {Array}         itemsToSave List of entity properties or property paths to save.
2594   * @param {Object}        options     Saving options.
2595   */
2596  const __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSave, options) => async ({
2597    select,
2598    dispatch
2599  }) => {
2600    if (!select.hasEditsForEntityRecord(kind, name, recordId)) {
2601      return;
2602    }
2603    const edits = select.getEntityRecordNonTransientEdits(kind, name, recordId);
2604    const editsToSave = {};
2605    for (const item of itemsToSave) {
2606      setNestedValue(editsToSave, item, getNestedValue(edits, item));
2607    }
2608    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
2609    const entityConfig = configs.find(config => config.kind === kind && config.name === name);
2610    const entityIdKey = entityConfig?.key || DEFAULT_ENTITY_KEY;
2611  
2612    // If a record key is provided then update the existing record.
2613    // This necessitates providing `recordKey` to saveEntityRecord as part of the
2614    // `record` argument (here called `editsToSave`) to stop that action creating
2615    // a new record and instead cause it to update the existing record.
2616    if (recordId) {
2617      editsToSave[entityIdKey] = recordId;
2618    }
2619    return await dispatch.saveEntityRecord(kind, name, editsToSave, options);
2620  };
2621  
2622  /**
2623   * Returns an action object used in signalling that Upload permissions have been received.
2624   *
2625   * @deprecated since WP 5.9, use receiveUserPermission instead.
2626   *
2627   * @param {boolean} hasUploadPermissions Does the user have permission to upload files?
2628   *
2629   * @return {Object} Action object.
2630   */
2631  function receiveUploadPermissions(hasUploadPermissions) {
2632    external_wp_deprecated_default()("wp.data.dispatch( 'core' ).receiveUploadPermissions", {
2633      since: '5.9',
2634      alternative: 'receiveUserPermission'
2635    });
2636    return receiveUserPermission('create/media', hasUploadPermissions);
2637  }
2638  
2639  /**
2640   * Returns an action object used in signalling that the current user has
2641   * permission to perform an action on a REST resource.
2642   * Ignored from documentation as it's internal to the data store.
2643   *
2644   * @ignore
2645   *
2646   * @param {string}  key       A key that represents the action and REST resource.
2647   * @param {boolean} isAllowed Whether or not the user can perform the action.
2648   *
2649   * @return {Object} Action object.
2650   */
2651  function receiveUserPermission(key, isAllowed) {
2652    return {
2653      type: 'RECEIVE_USER_PERMISSION',
2654      key,
2655      isAllowed
2656    };
2657  }
2658  
2659  /**
2660   * Returns an action object used in signalling that the current user has
2661   * permission to perform an action on a REST resource. Ignored from
2662   * documentation as it's internal to the data store.
2663   *
2664   * @ignore
2665   *
2666   * @param {Object<string, boolean>} permissions An object where keys represent
2667   *                                              actions and REST resources, and
2668   *                                              values indicate whether the user
2669   *                                              is allowed to perform the
2670   *                                              action.
2671   *
2672   * @return {Object} Action object.
2673   */
2674  function receiveUserPermissions(permissions) {
2675    return {
2676      type: 'RECEIVE_USER_PERMISSIONS',
2677      permissions
2678    };
2679  }
2680  
2681  /**
2682   * Returns an action object used in signalling that the autosaves for a
2683   * post have been received.
2684   * Ignored from documentation as it's internal to the data store.
2685   *
2686   * @ignore
2687   *
2688   * @param {number}       postId    The id of the post that is parent to the autosave.
2689   * @param {Array|Object} autosaves An array of autosaves or singular autosave object.
2690   *
2691   * @return {Object} Action object.
2692   */
2693  function receiveAutosaves(postId, autosaves) {
2694    return {
2695      type: 'RECEIVE_AUTOSAVES',
2696      postId,
2697      autosaves: Array.isArray(autosaves) ? autosaves : [autosaves]
2698    };
2699  }
2700  
2701  /**
2702   * Returns an action object signalling that the fallback Navigation
2703   * Menu id has been received.
2704   *
2705   * @param {integer} fallbackId the id of the fallback Navigation Menu
2706   * @return {Object} Action object.
2707   */
2708  function receiveNavigationFallbackId(fallbackId) {
2709    return {
2710      type: 'RECEIVE_NAVIGATION_FALLBACK_ID',
2711      fallbackId
2712    };
2713  }
2714  
2715  /**
2716   * Returns an action object used to set the template for a given query.
2717   *
2718   * @param {Object} query      The lookup query.
2719   * @param {string} templateId The resolved template id.
2720   *
2721   * @return {Object} Action object.
2722   */
2723  function receiveDefaultTemplateId(query, templateId) {
2724    return {
2725      type: 'RECEIVE_DEFAULT_TEMPLATE',
2726      query,
2727      templateId
2728    };
2729  }
2730  
2731  /**
2732   * Action triggered to receive revision items.
2733   *
2734   * @param {string}        kind            Kind of the received entity record revisions.
2735   * @param {string}        name            Name of the received entity record revisions.
2736   * @param {number|string} recordKey       The key of the entity record whose revisions you want to fetch.
2737   * @param {Array|Object}  records         Revisions received.
2738   * @param {?Object}       query           Query Object.
2739   * @param {?boolean}      invalidateCache Should invalidate query caches.
2740   * @param {?Object}       meta            Meta information about pagination.
2741   */
2742  const receiveRevisions = (kind, name, recordKey, records, query, invalidateCache = false, meta) => async ({
2743    dispatch
2744  }) => {
2745    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
2746    const entityConfig = configs.find(config => config.kind === kind && config.name === name);
2747    const key = entityConfig && entityConfig?.revisionKey ? entityConfig.revisionKey : DEFAULT_ENTITY_KEY;
2748    dispatch({
2749      type: 'RECEIVE_ITEM_REVISIONS',
2750      key,
2751      items: Array.isArray(records) ? records : [records],
2752      recordKey,
2753      meta,
2754      query,
2755      kind,
2756      name,
2757      invalidateCache
2758    });
2759  };
2760  
2761  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/entities.js
2762  /**
2763   * External dependencies
2764   */
2765  
2766  
2767  /**
2768   * WordPress dependencies
2769   */
2770  
2771  
2772  
2773  
2774  /**
2775   * Internal dependencies
2776   */
2777  
2778  
2779  const DEFAULT_ENTITY_KEY = 'id';
2780  const POST_RAW_ATTRIBUTES = ['title', 'excerpt', 'content'];
2781  const rootEntitiesConfig = [{
2782    label: (0,external_wp_i18n_namespaceObject.__)('Base'),
2783    kind: 'root',
2784    name: '__unstableBase',
2785    baseURL: '/',
2786    baseURLParams: {
2787      _fields: ['description', 'gmt_offset', 'home', 'name', 'site_icon', 'site_icon_url', 'site_logo', 'timezone_string', 'url'].join(',')
2788    },
2789    // The entity doesn't support selecting multiple records.
2790    // The property is maintained for backward compatibility.
2791    plural: '__unstableBases',
2792    syncConfig: {
2793      fetch: async () => {
2794        return external_wp_apiFetch_default()({
2795          path: '/'
2796        });
2797      },
2798      applyChangesToDoc: (doc, changes) => {
2799        const document = doc.getMap('document');
2800        Object.entries(changes).forEach(([key, value]) => {
2801          if (document.get(key) !== value) {
2802            document.set(key, value);
2803          }
2804        });
2805      },
2806      fromCRDTDoc: doc => {
2807        return doc.getMap('document').toJSON();
2808      }
2809    },
2810    syncObjectType: 'root/base',
2811    getSyncObjectId: () => 'index'
2812  }, {
2813    label: (0,external_wp_i18n_namespaceObject.__)('Post Type'),
2814    name: 'postType',
2815    kind: 'root',
2816    key: 'slug',
2817    baseURL: '/wp/v2/types',
2818    baseURLParams: {
2819      context: 'edit'
2820    },
2821    plural: 'postTypes',
2822    syncConfig: {
2823      fetch: async id => {
2824        return external_wp_apiFetch_default()({
2825          path: `/wp/v2/types/$id}?context=edit`
2826        });
2827      },
2828      applyChangesToDoc: (doc, changes) => {
2829        const document = doc.getMap('document');
2830        Object.entries(changes).forEach(([key, value]) => {
2831          if (document.get(key) !== value) {
2832            document.set(key, value);
2833          }
2834        });
2835      },
2836      fromCRDTDoc: doc => {
2837        return doc.getMap('document').toJSON();
2838      }
2839    },
2840    syncObjectType: 'root/postType',
2841    getSyncObjectId: id => id
2842  }, {
2843    name: 'media',
2844    kind: 'root',
2845    baseURL: '/wp/v2/media',
2846    baseURLParams: {
2847      context: 'edit'
2848    },
2849    plural: 'mediaItems',
2850    label: (0,external_wp_i18n_namespaceObject.__)('Media'),
2851    rawAttributes: ['caption', 'title', 'description'],
2852    supportsPagination: true
2853  }, {
2854    name: 'taxonomy',
2855    kind: 'root',
2856    key: 'slug',
2857    baseURL: '/wp/v2/taxonomies',
2858    baseURLParams: {
2859      context: 'edit'
2860    },
2861    plural: 'taxonomies',
2862    label: (0,external_wp_i18n_namespaceObject.__)('Taxonomy')
2863  }, {
2864    name: 'sidebar',
2865    kind: 'root',
2866    baseURL: '/wp/v2/sidebars',
2867    baseURLParams: {
2868      context: 'edit'
2869    },
2870    plural: 'sidebars',
2871    transientEdits: {
2872      blocks: true
2873    },
2874    label: (0,external_wp_i18n_namespaceObject.__)('Widget areas')
2875  }, {
2876    name: 'widget',
2877    kind: 'root',
2878    baseURL: '/wp/v2/widgets',
2879    baseURLParams: {
2880      context: 'edit'
2881    },
2882    plural: 'widgets',
2883    transientEdits: {
2884      blocks: true
2885    },
2886    label: (0,external_wp_i18n_namespaceObject.__)('Widgets')
2887  }, {
2888    name: 'widgetType',
2889    kind: 'root',
2890    baseURL: '/wp/v2/widget-types',
2891    baseURLParams: {
2892      context: 'edit'
2893    },
2894    plural: 'widgetTypes',
2895    label: (0,external_wp_i18n_namespaceObject.__)('Widget types')
2896  }, {
2897    label: (0,external_wp_i18n_namespaceObject.__)('User'),
2898    name: 'user',
2899    kind: 'root',
2900    baseURL: '/wp/v2/users',
2901    baseURLParams: {
2902      context: 'edit'
2903    },
2904    plural: 'users'
2905  }, {
2906    name: 'comment',
2907    kind: 'root',
2908    baseURL: '/wp/v2/comments',
2909    baseURLParams: {
2910      context: 'edit'
2911    },
2912    plural: 'comments',
2913    label: (0,external_wp_i18n_namespaceObject.__)('Comment')
2914  }, {
2915    name: 'menu',
2916    kind: 'root',
2917    baseURL: '/wp/v2/menus',
2918    baseURLParams: {
2919      context: 'edit'
2920    },
2921    plural: 'menus',
2922    label: (0,external_wp_i18n_namespaceObject.__)('Menu')
2923  }, {
2924    name: 'menuItem',
2925    kind: 'root',
2926    baseURL: '/wp/v2/menu-items',
2927    baseURLParams: {
2928      context: 'edit'
2929    },
2930    plural: 'menuItems',
2931    label: (0,external_wp_i18n_namespaceObject.__)('Menu Item'),
2932    rawAttributes: ['title']
2933  }, {
2934    name: 'menuLocation',
2935    kind: 'root',
2936    baseURL: '/wp/v2/menu-locations',
2937    baseURLParams: {
2938      context: 'edit'
2939    },
2940    plural: 'menuLocations',
2941    label: (0,external_wp_i18n_namespaceObject.__)('Menu Location'),
2942    key: 'name'
2943  }, {
2944    label: (0,external_wp_i18n_namespaceObject.__)('Global Styles'),
2945    name: 'globalStyles',
2946    kind: 'root',
2947    baseURL: '/wp/v2/global-styles',
2948    baseURLParams: {
2949      context: 'edit'
2950    },
2951    plural: 'globalStylesVariations',
2952    // Should be different from name.
2953    getTitle: record => record?.title?.rendered || record?.title,
2954    getRevisionsUrl: (parentId, revisionId) => `/wp/v2/global-styles/$parentId}/revisions$revisionId ? '/' + revisionId : ''}`,
2955    supportsPagination: true
2956  }, {
2957    label: (0,external_wp_i18n_namespaceObject.__)('Themes'),
2958    name: 'theme',
2959    kind: 'root',
2960    baseURL: '/wp/v2/themes',
2961    baseURLParams: {
2962      context: 'edit'
2963    },
2964    plural: 'themes',
2965    key: 'stylesheet'
2966  }, {
2967    label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
2968    name: 'plugin',
2969    kind: 'root',
2970    baseURL: '/wp/v2/plugins',
2971    baseURLParams: {
2972      context: 'edit'
2973    },
2974    plural: 'plugins',
2975    key: 'plugin'
2976  }, {
2977    label: (0,external_wp_i18n_namespaceObject.__)('Status'),
2978    name: 'status',
2979    kind: 'root',
2980    baseURL: '/wp/v2/statuses',
2981    baseURLParams: {
2982      context: 'edit'
2983    },
2984    plural: 'statuses',
2985    key: 'slug'
2986  }];
2987  const additionalEntityConfigLoaders = [{
2988    kind: 'postType',
2989    loadEntities: loadPostTypeEntities
2990  }, {
2991    kind: 'taxonomy',
2992    loadEntities: loadTaxonomyEntities
2993  }, {
2994    kind: 'root',
2995    name: 'site',
2996    plural: 'sites',
2997    loadEntities: loadSiteEntity
2998  }];
2999  
3000  /**
3001   * Returns a function to be used to retrieve extra edits to apply before persisting a post type.
3002   *
3003   * @param {Object} persistedRecord Already persisted Post
3004   * @param {Object} edits           Edits.
3005   * @return {Object} Updated edits.
3006   */
3007  const prePersistPostType = (persistedRecord, edits) => {
3008    const newEdits = {};
3009    if (persistedRecord?.status === 'auto-draft') {
3010      // Saving an auto-draft should create a draft by default.
3011      if (!edits.status && !newEdits.status) {
3012        newEdits.status = 'draft';
3013      }
3014  
3015      // Fix the auto-draft default title.
3016      if ((!edits.title || edits.title === 'Auto Draft') && !newEdits.title && (!persistedRecord?.title || persistedRecord?.title === 'Auto Draft')) {
3017        newEdits.title = '';
3018      }
3019    }
3020    return newEdits;
3021  };
3022  const serialisableBlocksCache = new WeakMap();
3023  function makeBlockAttributesSerializable(attributes) {
3024    const newAttributes = {
3025      ...attributes
3026    };
3027    for (const [key, value] of Object.entries(attributes)) {
3028      if (value instanceof external_wp_richText_namespaceObject.RichTextData) {
3029        newAttributes[key] = value.valueOf();
3030      }
3031    }
3032    return newAttributes;
3033  }
3034  function makeBlocksSerializable(blocks) {
3035    return blocks.map(block => {
3036      const {
3037        innerBlocks,
3038        attributes,
3039        ...rest
3040      } = block;
3041      return {
3042        ...rest,
3043        attributes: makeBlockAttributesSerializable(attributes),
3044        innerBlocks: makeBlocksSerializable(innerBlocks)
3045      };
3046    });
3047  }
3048  
3049  /**
3050   * Returns the list of post type entities.
3051   *
3052   * @return {Promise} Entities promise
3053   */
3054  async function loadPostTypeEntities() {
3055    const postTypes = await external_wp_apiFetch_default()({
3056      path: '/wp/v2/types?context=view'
3057    });
3058    return Object.entries(postTypes !== null && postTypes !== void 0 ? postTypes : {}).map(([name, postType]) => {
3059      var _postType$rest_namesp;
3060      const isTemplate = ['wp_template', 'wp_template_part'].includes(name);
3061      const namespace = (_postType$rest_namesp = postType?.rest_namespace) !== null && _postType$rest_namesp !== void 0 ? _postType$rest_namesp : 'wp/v2';
3062      return {
3063        kind: 'postType',
3064        baseURL: `/$namespace}/$postType.rest_base}`,
3065        baseURLParams: {
3066          context: 'edit'
3067        },
3068        name,
3069        label: postType.name,
3070        transientEdits: {
3071          blocks: true,
3072          selection: true
3073        },
3074        mergedEdits: {
3075          meta: true
3076        },
3077        rawAttributes: POST_RAW_ATTRIBUTES,
3078        getTitle: record => {
3079          var _record$slug;
3080          return record?.title?.rendered || record?.title || (isTemplate ? capitalCase((_record$slug = record.slug) !== null && _record$slug !== void 0 ? _record$slug : '') : String(record.id));
3081        },
3082        __unstablePrePersist: isTemplate ? undefined : prePersistPostType,
3083        __unstable_rest_base: postType.rest_base,
3084        syncConfig: {
3085          fetch: async id => {
3086            return external_wp_apiFetch_default()({
3087              path: `/$namespace}/$postType.rest_base}/$id}?context=edit`
3088            });
3089          },
3090          applyChangesToDoc: (doc, changes) => {
3091            const document = doc.getMap('document');
3092            Object.entries(changes).forEach(([key, value]) => {
3093              if (typeof value !== 'function') {
3094                if (key === 'blocks') {
3095                  if (!serialisableBlocksCache.has(value)) {
3096                    serialisableBlocksCache.set(value, makeBlocksSerializable(value));
3097                  }
3098                  value = serialisableBlocksCache.get(value);
3099                }
3100                if (document.get(key) !== value) {
3101                  document.set(key, value);
3102                }
3103              }
3104            });
3105          },
3106          fromCRDTDoc: doc => {
3107            return doc.getMap('document').toJSON();
3108          }
3109        },
3110        syncObjectType: 'postType/' + postType.name,
3111        getSyncObjectId: id => id,
3112        supportsPagination: true,
3113        getRevisionsUrl: (parentId, revisionId) => `/$namespace}/$postType.rest_base}/$parentId}/revisions$revisionId ? '/' + revisionId : ''}`,
3114        revisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY
3115      };
3116    });
3117  }
3118  
3119  /**
3120   * Returns the list of the taxonomies entities.
3121   *
3122   * @return {Promise} Entities promise
3123   */
3124  async function loadTaxonomyEntities() {
3125    const taxonomies = await external_wp_apiFetch_default()({
3126      path: '/wp/v2/taxonomies?context=view'
3127    });
3128    return Object.entries(taxonomies !== null && taxonomies !== void 0 ? taxonomies : {}).map(([name, taxonomy]) => {
3129      var _taxonomy$rest_namesp;
3130      const namespace = (_taxonomy$rest_namesp = taxonomy?.rest_namespace) !== null && _taxonomy$rest_namesp !== void 0 ? _taxonomy$rest_namesp : 'wp/v2';
3131      return {
3132        kind: 'taxonomy',
3133        baseURL: `/$namespace}/$taxonomy.rest_base}`,
3134        baseURLParams: {
3135          context: 'edit'
3136        },
3137        name,
3138        label: taxonomy.name
3139      };
3140    });
3141  }
3142  
3143  /**
3144   * Returns the Site entity.
3145   *
3146   * @return {Promise} Entity promise
3147   */
3148  async function loadSiteEntity() {
3149    var _site$schema$properti;
3150    const entity = {
3151      label: (0,external_wp_i18n_namespaceObject.__)('Site'),
3152      name: 'site',
3153      kind: 'root',
3154      baseURL: '/wp/v2/settings',
3155      syncConfig: {
3156        fetch: async () => {
3157          return external_wp_apiFetch_default()({
3158            path: '/wp/v2/settings'
3159          });
3160        },
3161        applyChangesToDoc: (doc, changes) => {
3162          const document = doc.getMap('document');
3163          Object.entries(changes).forEach(([key, value]) => {
3164            if (document.get(key) !== value) {
3165              document.set(key, value);
3166            }
3167          });
3168        },
3169        fromCRDTDoc: doc => {
3170          return doc.getMap('document').toJSON();
3171        }
3172      },
3173      syncObjectType: 'root/site',
3174      getSyncObjectId: () => 'index',
3175      meta: {}
3176    };
3177    const site = await external_wp_apiFetch_default()({
3178      path: entity.baseURL,
3179      method: 'OPTIONS'
3180    });
3181    const labels = {};
3182    Object.entries((_site$schema$properti = site?.schema?.properties) !== null && _site$schema$properti !== void 0 ? _site$schema$properti : {}).forEach(([key, value]) => {
3183      // Ignore properties `title` and `type` keys.
3184      if (typeof value === 'object' && value.title) {
3185        labels[key] = value.title;
3186      }
3187    });
3188    return [{
3189      ...entity,
3190      meta: {
3191        labels
3192      }
3193    }];
3194  }
3195  
3196  /**
3197   * Returns the entity's getter method name given its kind and name or plural name.
3198   *
3199   * @example
3200   * ```js
3201   * const nameSingular = getMethodName( 'root', 'theme', 'get' );
3202   * // nameSingular is getRootTheme
3203   *
3204   * const namePlural = getMethodName( 'root', 'themes', 'set' );
3205   * // namePlural is setRootThemes
3206   * ```
3207   *
3208   * @param {string} kind   Entity kind.
3209   * @param {string} name   Entity name or plural name.
3210   * @param {string} prefix Function prefix.
3211   *
3212   * @return {string} Method name
3213   */
3214  const getMethodName = (kind, name, prefix = 'get') => {
3215    const kindPrefix = kind === 'root' ? '' : pascalCase(kind);
3216    const suffix = pascalCase(name);
3217    return `$prefix}$kindPrefix}$suffix}`;
3218  };
3219  function registerSyncConfigs(configs) {
3220    configs.forEach(({
3221      syncObjectType,
3222      syncConfig
3223    }) => {
3224      getSyncProvider().register(syncObjectType, syncConfig);
3225      const editSyncConfig = {
3226        ...syncConfig
3227      };
3228      delete editSyncConfig.fetch;
3229      getSyncProvider().register(syncObjectType + '--edit', editSyncConfig);
3230    });
3231  }
3232  
3233  /**
3234   * Loads the entities into the store.
3235   *
3236   * Note: The `name` argument is used for `root` entities requiring additional server data.
3237   *
3238   * @param {string} kind Kind
3239   * @param {string} name Name
3240   * @return {(thunkArgs: object) => Promise<Array>} Entities
3241   */
3242  const getOrLoadEntitiesConfig = (kind, name) => async ({
3243    select,
3244    dispatch
3245  }) => {
3246    let configs = select.getEntitiesConfig(kind);
3247    const hasConfig = !!select.getEntityConfig(kind, name);
3248    if (configs?.length > 0 && hasConfig) {
3249      if (window.__experimentalEnableSync) {
3250        if (false) {}
3251      }
3252      return configs;
3253    }
3254    const loader = additionalEntityConfigLoaders.find(l => {
3255      if (!name || !l.name) {
3256        return l.kind === kind;
3257      }
3258      return l.kind === kind && l.name === name;
3259    });
3260    if (!loader) {
3261      return [];
3262    }
3263    configs = await loader.loadEntities();
3264    if (window.__experimentalEnableSync) {
3265      if (false) {}
3266    }
3267    dispatch(addEntities(configs));
3268    return configs;
3269  };
3270  
3271  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/get-normalized-comma-separable.js
3272  /**
3273   * Given a value which can be specified as one or the other of a comma-separated
3274   * string or an array, returns a value normalized to an array of strings, or
3275   * null if the value cannot be interpreted as either.
3276   *
3277   * @param {string|string[]|*} value
3278   *
3279   * @return {?(string[])} Normalized field value.
3280   */
3281  function getNormalizedCommaSeparable(value) {
3282    if (typeof value === 'string') {
3283      return value.split(',');
3284    } else if (Array.isArray(value)) {
3285      return value;
3286    }
3287    return null;
3288  }
3289  /* harmony default export */ const get_normalized_comma_separable = (getNormalizedCommaSeparable);
3290  
3291  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/with-weak-map-cache.js
3292  /**
3293   * Given a function, returns an enhanced function which caches the result and
3294   * tracks in WeakMap. The result is only cached if the original function is
3295   * passed a valid object-like argument (requirement for WeakMap key).
3296   *
3297   * @param {Function} fn Original function.
3298   *
3299   * @return {Function} Enhanced caching function.
3300   */
3301  function withWeakMapCache(fn) {
3302    const cache = new WeakMap();
3303    return key => {
3304      let value;
3305      if (cache.has(key)) {
3306        value = cache.get(key);
3307      } else {
3308        value = fn(key);
3309  
3310        // Can reach here if key is not valid for WeakMap, since `has`
3311        // will return false for invalid key. Since `set` will throw,
3312        // ensure that key is valid before setting into cache.
3313        if (key !== null && typeof key === 'object') {
3314          cache.set(key, value);
3315        }
3316      }
3317      return value;
3318    };
3319  }
3320  /* harmony default export */ const with_weak_map_cache = (withWeakMapCache);
3321  
3322  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js
3323  /**
3324   * WordPress dependencies
3325   */
3326  
3327  
3328  /**
3329   * Internal dependencies
3330   */
3331  
3332  
3333  /**
3334   * An object of properties describing a specific query.
3335   *
3336   * @typedef {Object} WPQueriedDataQueryParts
3337   *
3338   * @property {number}      page      The query page (1-based index, default 1).
3339   * @property {number}      perPage   Items per page for query (default 10).
3340   * @property {string}      stableKey An encoded stable string of all non-
3341   *                                   pagination, non-fields query parameters.
3342   * @property {?(string[])} fields    Target subset of fields to derive from
3343   *                                   item objects.
3344   * @property {?(number[])} include   Specific item IDs to include.
3345   * @property {string}      context   Scope under which the request is made;
3346   *                                   determines returned fields in response.
3347   */
3348  
3349  /**
3350   * Given a query object, returns an object of parts, including pagination
3351   * details (`page` and `perPage`, or default values). All other properties are
3352   * encoded into a stable (idempotent) `stableKey` value.
3353   *
3354   * @param {Object} query Optional query object.
3355   *
3356   * @return {WPQueriedDataQueryParts} Query parts.
3357   */
3358  function getQueryParts(query) {
3359    /**
3360     * @type {WPQueriedDataQueryParts}
3361     */
3362    const parts = {
3363      stableKey: '',
3364      page: 1,
3365      perPage: 10,
3366      fields: null,
3367      include: null,
3368      context: 'default'
3369    };
3370  
3371    // Ensure stable key by sorting keys. Also more efficient for iterating.
3372    const keys = Object.keys(query).sort();
3373    for (let i = 0; i < keys.length; i++) {
3374      const key = keys[i];
3375      let value = query[key];
3376      switch (key) {
3377        case 'page':
3378          parts[key] = Number(value);
3379          break;
3380        case 'per_page':
3381          parts.perPage = Number(value);
3382          break;
3383        case 'context':
3384          parts.context = value;
3385          break;
3386        default:
3387          // While in theory, we could exclude "_fields" from the stableKey
3388          // because two request with different fields have the same results
3389          // We're not able to ensure that because the server can decide to omit
3390          // fields from the response even if we explicitly asked for it.
3391          // Example: Asking for titles in posts without title support.
3392          if (key === '_fields') {
3393            var _getNormalizedCommaSe;
3394            parts.fields = (_getNormalizedCommaSe = get_normalized_comma_separable(value)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : [];
3395            // Make sure to normalize value for `stableKey`
3396            value = parts.fields.join();
3397          }
3398  
3399          // Two requests with different include values cannot have same results.
3400          if (key === 'include') {
3401            var _getNormalizedCommaSe2;
3402            if (typeof value === 'number') {
3403              value = value.toString();
3404            }
3405            parts.include = ((_getNormalizedCommaSe2 = get_normalized_comma_separable(value)) !== null && _getNormalizedCommaSe2 !== void 0 ? _getNormalizedCommaSe2 : []).map(Number);
3406            // Normalize value for `stableKey`.
3407            value = parts.include.join();
3408          }
3409  
3410          // While it could be any deterministic string, for simplicity's
3411          // sake mimic querystring encoding for stable key.
3412          //
3413          // TODO: For consistency with PHP implementation, addQueryArgs
3414          // should accept a key value pair, which may optimize its
3415          // implementation for our use here, vs. iterating an object
3416          // with only a single key.
3417          parts.stableKey += (parts.stableKey ? '&' : '') + (0,external_wp_url_namespaceObject.addQueryArgs)('', {
3418            [key]: value
3419          }).slice(1);
3420      }
3421    }
3422    return parts;
3423  }
3424  /* harmony default export */ const get_query_parts = (with_weak_map_cache(getQueryParts));
3425  
3426  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/reducer.js
3427  /**
3428   * WordPress dependencies
3429   */
3430  
3431  
3432  
3433  /**
3434   * Internal dependencies
3435   */
3436  
3437  
3438  
3439  function getContextFromAction(action) {
3440    const {
3441      query
3442    } = action;
3443    if (!query) {
3444      return 'default';
3445    }
3446    const queryParts = get_query_parts(query);
3447    return queryParts.context;
3448  }
3449  
3450  /**
3451   * Returns a merged array of item IDs, given details of the received paginated
3452   * items. The array is sparse-like with `undefined` entries where holes exist.
3453   *
3454   * @param {?Array<number>} itemIds     Original item IDs (default empty array).
3455   * @param {number[]}       nextItemIds Item IDs to merge.
3456   * @param {number}         page        Page of items merged.
3457   * @param {number}         perPage     Number of items per page.
3458   *
3459   * @return {number[]} Merged array of item IDs.
3460   */
3461  function getMergedItemIds(itemIds, nextItemIds, page, perPage) {
3462    var _itemIds$length;
3463    const receivedAllIds = page === 1 && perPage === -1;
3464    if (receivedAllIds) {
3465      return nextItemIds;
3466    }
3467    const nextItemIdsStartIndex = (page - 1) * perPage;
3468  
3469    // If later page has already been received, default to the larger known
3470    // size of the existing array, else calculate as extending the existing.
3471    const size = Math.max((_itemIds$length = itemIds?.length) !== null && _itemIds$length !== void 0 ? _itemIds$length : 0, nextItemIdsStartIndex + nextItemIds.length);
3472  
3473    // Preallocate array since size is known.
3474    const mergedItemIds = new Array(size);
3475    for (let i = 0; i < size; i++) {
3476      // Preserve existing item ID except for subset of range of next items.
3477      // We need to check against the possible maximum upper boundary because
3478      // a page could receive fewer than what was previously stored.
3479      const isInNextItemsRange = i >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;
3480      mergedItemIds[i] = isInNextItemsRange ? nextItemIds[i - nextItemIdsStartIndex] : itemIds?.[i];
3481    }
3482    return mergedItemIds;
3483  }
3484  
3485  /**
3486   * Helper function to filter out entities with certain IDs.
3487   * Entities are keyed by their ID.
3488   *
3489   * @param {Object} entities Entity objects, keyed by entity ID.
3490   * @param {Array}  ids      Entity IDs to filter out.
3491   *
3492   * @return {Object} Filtered entities.
3493   */
3494  function removeEntitiesById(entities, ids) {
3495    return Object.fromEntries(Object.entries(entities).filter(([id]) => !ids.some(itemId => {
3496      if (Number.isInteger(itemId)) {
3497        return itemId === +id;
3498      }
3499      return itemId === id;
3500    })));
3501  }
3502  
3503  /**
3504   * Reducer tracking items state, keyed by ID. Items are assumed to be normal,
3505   * where identifiers are common across all queries.
3506   *
3507   * @param {Object} state  Current state.
3508   * @param {Object} action Dispatched action.
3509   *
3510   * @return {Object} Next state.
3511   */
3512  function items(state = {}, action) {
3513    switch (action.type) {
3514      case 'RECEIVE_ITEMS':
3515        {
3516          const context = getContextFromAction(action);
3517          const key = action.key || DEFAULT_ENTITY_KEY;
3518          return {
3519            ...state,
3520            [context]: {
3521              ...state[context],
3522              ...action.items.reduce((accumulator, value) => {
3523                const itemId = value?.[key];
3524                accumulator[itemId] = conservativeMapItem(state?.[context]?.[itemId], value);
3525                return accumulator;
3526              }, {})
3527            }
3528          };
3529        }
3530      case 'REMOVE_ITEMS':
3531        return Object.fromEntries(Object.entries(state).map(([itemId, contextState]) => [itemId, removeEntitiesById(contextState, action.itemIds)]));
3532    }
3533    return state;
3534  }
3535  
3536  /**
3537   * Reducer tracking item completeness, keyed by ID. A complete item is one for
3538   * which all fields are known. This is used in supporting `_fields` queries,
3539   * where not all properties associated with an entity are necessarily returned.
3540   * In such cases, completeness is used as an indication of whether it would be
3541   * safe to use queried data for a non-`_fields`-limited request.
3542   *
3543   * @param {Object<string,Object<string,boolean>>} state  Current state.
3544   * @param {Object}                                action Dispatched action.
3545   *
3546   * @return {Object<string,Object<string,boolean>>} Next state.
3547   */
3548  function itemIsComplete(state = {}, action) {
3549    switch (action.type) {
3550      case 'RECEIVE_ITEMS':
3551        {
3552          const context = getContextFromAction(action);
3553          const {
3554            query,
3555            key = DEFAULT_ENTITY_KEY
3556          } = action;
3557  
3558          // An item is considered complete if it is received without an associated
3559          // fields query. Ideally, this would be implemented in such a way where the
3560          // complete aggregate of all fields would satisfy completeness. Since the
3561          // fields are not consistent across all entities, this would require
3562          // introspection on the REST schema for each entity to know which fields
3563          // compose a complete item for that entity.
3564          const queryParts = query ? get_query_parts(query) : {};
3565          const isCompleteQuery = !query || !Array.isArray(queryParts.fields);
3566          return {
3567            ...state,
3568            [context]: {
3569              ...state[context],
3570              ...action.items.reduce((result, item) => {
3571                const itemId = item?.[key];
3572  
3573                // Defer to completeness if already assigned. Technically the
3574                // data may be outdated if receiving items for a field subset.
3575                result[itemId] = state?.[context]?.[itemId] || isCompleteQuery;
3576                return result;
3577              }, {})
3578            }
3579          };
3580        }
3581      case 'REMOVE_ITEMS':
3582        return Object.fromEntries(Object.entries(state).map(([itemId, contextState]) => [itemId, removeEntitiesById(contextState, action.itemIds)]));
3583    }
3584    return state;
3585  }
3586  
3587  /**
3588   * Reducer tracking queries state, keyed by stable query key. Each reducer
3589   * query object includes `itemIds` and `requestingPageByPerPage`.
3590   *
3591   * @param {Object} state  Current state.
3592   * @param {Object} action Dispatched action.
3593   *
3594   * @return {Object} Next state.
3595   */
3596  const receiveQueries = (0,external_wp_compose_namespaceObject.compose)([
3597  // Limit to matching action type so we don't attempt to replace action on
3598  // an unhandled action.
3599  if_matching_action(action => 'query' in action),
3600  // Inject query parts into action for use both in `onSubKey` and reducer.
3601  replace_action(action => {
3602    // `ifMatchingAction` still passes on initialization, where state is
3603    // undefined and a query is not assigned. Avoid attempting to parse
3604    // parts. `onSubKey` will omit by lack of `stableKey`.
3605    if (action.query) {
3606      return {
3607        ...action,
3608        ...get_query_parts(action.query)
3609      };
3610    }
3611    return action;
3612  }), on_sub_key('context'),
3613  // Queries shape is shared, but keyed by query `stableKey` part. Original
3614  // reducer tracks only a single query object.
3615  on_sub_key('stableKey')])((state = {}, action) => {
3616    const {
3617      type,
3618      page,
3619      perPage,
3620      key = DEFAULT_ENTITY_KEY
3621    } = action;
3622    if (type !== 'RECEIVE_ITEMS') {
3623      return state;
3624    }
3625    return {
3626      itemIds: getMergedItemIds(state?.itemIds || [], action.items.map(item => item?.[key]).filter(Boolean), page, perPage),
3627      meta: action.meta
3628    };
3629  });
3630  
3631  /**
3632   * Reducer tracking queries state.
3633   *
3634   * @param {Object} state  Current state.
3635   * @param {Object} action Dispatched action.
3636   *
3637   * @return {Object} Next state.
3638   */
3639  const queries = (state = {}, action) => {
3640    switch (action.type) {
3641      case 'RECEIVE_ITEMS':
3642        return receiveQueries(state, action);
3643      case 'REMOVE_ITEMS':
3644        const removedItems = action.itemIds.reduce((result, itemId) => {
3645          result[itemId] = true;
3646          return result;
3647        }, {});
3648        return Object.fromEntries(Object.entries(state).map(([queryGroup, contextQueries]) => [queryGroup, Object.fromEntries(Object.entries(contextQueries).map(([query, queryItems]) => [query, {
3649          ...queryItems,
3650          itemIds: queryItems.itemIds.filter(queryId => !removedItems[queryId])
3651        }]))]));
3652      default:
3653        return state;
3654    }
3655  };
3656  /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
3657    items,
3658    itemIsComplete,
3659    queries
3660  }));
3661  
3662  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/reducer.js
3663  /**
3664   * External dependencies
3665   */
3666  
3667  
3668  /**
3669   * WordPress dependencies
3670   */
3671  
3672  
3673  
3674  
3675  /**
3676   * Internal dependencies
3677   */
3678  
3679  
3680  
3681  
3682  /** @typedef {import('./types').AnyFunction} AnyFunction */
3683  
3684  /**
3685   * Reducer managing terms state. Keyed by taxonomy slug, the value is either
3686   * undefined (if no request has been made for given taxonomy), null (if a
3687   * request is in-flight for given taxonomy), or the array of terms for the
3688   * taxonomy.
3689   *
3690   * @param {Object} state  Current state.
3691   * @param {Object} action Dispatched action.
3692   *
3693   * @return {Object} Updated state.
3694   */
3695  function terms(state = {}, action) {
3696    switch (action.type) {
3697      case 'RECEIVE_TERMS':
3698        return {
3699          ...state,
3700          [action.taxonomy]: action.terms
3701        };
3702    }
3703    return state;
3704  }
3705  
3706  /**
3707   * Reducer managing authors state. Keyed by id.
3708   *
3709   * @param {Object} state  Current state.
3710   * @param {Object} action Dispatched action.
3711   *
3712   * @return {Object} Updated state.
3713   */
3714  function users(state = {
3715    byId: {},
3716    queries: {}
3717  }, action) {
3718    switch (action.type) {
3719      case 'RECEIVE_USER_QUERY':
3720        return {
3721          byId: {
3722            ...state.byId,
3723            // Key users by their ID.
3724            ...action.users.reduce((newUsers, user) => ({
3725              ...newUsers,
3726              [user.id]: user
3727            }), {})
3728          },
3729          queries: {
3730            ...state.queries,
3731            [action.queryID]: action.users.map(user => user.id)
3732          }
3733        };
3734    }
3735    return state;
3736  }
3737  
3738  /**
3739   * Reducer managing current user state.
3740   *
3741   * @param {Object} state  Current state.
3742   * @param {Object} action Dispatched action.
3743   *
3744   * @return {Object} Updated state.
3745   */
3746  function currentUser(state = {}, action) {
3747    switch (action.type) {
3748      case 'RECEIVE_CURRENT_USER':
3749        return action.currentUser;
3750    }
3751    return state;
3752  }
3753  
3754  /**
3755   * Reducer managing taxonomies.
3756   *
3757   * @param {Object} state  Current state.
3758   * @param {Object} action Dispatched action.
3759   *
3760   * @return {Object} Updated state.
3761   */
3762  function taxonomies(state = [], action) {
3763    switch (action.type) {
3764      case 'RECEIVE_TAXONOMIES':
3765        return action.taxonomies;
3766    }
3767    return state;
3768  }
3769  
3770  /**
3771   * Reducer managing the current theme.
3772   *
3773   * @param {string|undefined} state  Current state.
3774   * @param {Object}           action Dispatched action.
3775   *
3776   * @return {string|undefined} Updated state.
3777   */
3778  function currentTheme(state = undefined, action) {
3779    switch (action.type) {
3780      case 'RECEIVE_CURRENT_THEME':
3781        return action.currentTheme.stylesheet;
3782    }
3783    return state;
3784  }
3785  
3786  /**
3787   * Reducer managing the current global styles id.
3788   *
3789   * @param {string|undefined} state  Current state.
3790   * @param {Object}           action Dispatched action.
3791   *
3792   * @return {string|undefined} Updated state.
3793   */
3794  function currentGlobalStylesId(state = undefined, action) {
3795    switch (action.type) {
3796      case 'RECEIVE_CURRENT_GLOBAL_STYLES_ID':
3797        return action.id;
3798    }
3799    return state;
3800  }
3801  
3802  /**
3803   * Reducer managing the theme base global styles.
3804   *
3805   * @param {Record<string, object>} state  Current state.
3806   * @param {Object}                 action Dispatched action.
3807   *
3808   * @return {Record<string, object>} Updated state.
3809   */
3810  function themeBaseGlobalStyles(state = {}, action) {
3811    switch (action.type) {
3812      case 'RECEIVE_THEME_GLOBAL_STYLES':
3813        return {
3814          ...state,
3815          [action.stylesheet]: action.globalStyles
3816        };
3817    }
3818    return state;
3819  }
3820  
3821  /**
3822   * Reducer managing the theme global styles variations.
3823   *
3824   * @param {Record<string, object>} state  Current state.
3825   * @param {Object}                 action Dispatched action.
3826   *
3827   * @return {Record<string, object>} Updated state.
3828   */
3829  function themeGlobalStyleVariations(state = {}, action) {
3830    switch (action.type) {
3831      case 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS':
3832        return {
3833          ...state,
3834          [action.stylesheet]: action.variations
3835        };
3836    }
3837    return state;
3838  }
3839  const withMultiEntityRecordEdits = reducer => (state, action) => {
3840    if (action.type === 'UNDO' || action.type === 'REDO') {
3841      const {
3842        record
3843      } = action;
3844      let newState = state;
3845      record.forEach(({
3846        id: {
3847          kind,
3848          name,
3849          recordId
3850        },
3851        changes
3852      }) => {
3853        newState = reducer(newState, {
3854          type: 'EDIT_ENTITY_RECORD',
3855          kind,
3856          name,
3857          recordId,
3858          edits: Object.entries(changes).reduce((acc, [key, value]) => {
3859            acc[key] = action.type === 'UNDO' ? value.from : value.to;
3860            return acc;
3861          }, {})
3862        });
3863      });
3864      return newState;
3865    }
3866    return reducer(state, action);
3867  };
3868  
3869  /**
3870   * Higher Order Reducer for a given entity config. It supports:
3871   *
3872   *  - Fetching
3873   *  - Editing
3874   *  - Saving
3875   *
3876   * @param {Object} entityConfig Entity config.
3877   *
3878   * @return {AnyFunction} Reducer.
3879   */
3880  function entity(entityConfig) {
3881    return (0,external_wp_compose_namespaceObject.compose)([withMultiEntityRecordEdits,
3882    // Limit to matching action type so we don't attempt to replace action on
3883    // an unhandled action.
3884    if_matching_action(action => action.name && action.kind && action.name === entityConfig.name && action.kind === entityConfig.kind),
3885    // Inject the entity config into the action.
3886    replace_action(action => {
3887      return {
3888        key: entityConfig.key || DEFAULT_ENTITY_KEY,
3889        ...action
3890      };
3891    })])((0,external_wp_data_namespaceObject.combineReducers)({
3892      queriedData: reducer,
3893      edits: (state = {}, action) => {
3894        var _action$query$context;
3895        switch (action.type) {
3896          case 'RECEIVE_ITEMS':
3897            const context = (_action$query$context = action?.query?.context) !== null && _action$query$context !== void 0 ? _action$query$context : 'default';
3898            if (context !== 'default') {
3899              return state;
3900            }
3901            const nextState = {
3902              ...state
3903            };
3904            for (const record of action.items) {
3905              const recordId = record?.[action.key];
3906              const edits = nextState[recordId];
3907              if (!edits) {
3908                continue;
3909              }
3910              const nextEdits = Object.keys(edits).reduce((acc, key) => {
3911                var _record$key$raw;
3912                // If the edited value is still different to the persisted value,
3913                // keep the edited value in edits.
3914                if (
3915                // Edits are the "raw" attribute values, but records may have
3916                // objects with more properties, so we use `get` here for the
3917                // comparison.
3918                !es6_default()(edits[key], (_record$key$raw = record[key]?.raw) !== null && _record$key$raw !== void 0 ? _record$key$raw : record[key]) && (
3919                // Sometimes the server alters the sent value which means
3920                // we need to also remove the edits before the api request.
3921                !action.persistedEdits || !es6_default()(edits[key], action.persistedEdits[key]))) {
3922                  acc[key] = edits[key];
3923                }
3924                return acc;
3925              }, {});
3926              if (Object.keys(nextEdits).length) {
3927                nextState[recordId] = nextEdits;
3928              } else {
3929                delete nextState[recordId];
3930              }
3931            }
3932            return nextState;
3933          case 'EDIT_ENTITY_RECORD':
3934            const nextEdits = {
3935              ...state[action.recordId],
3936              ...action.edits
3937            };
3938            Object.keys(nextEdits).forEach(key => {
3939              // Delete cleared edits so that the properties
3940              // are not considered dirty.
3941              if (nextEdits[key] === undefined) {
3942                delete nextEdits[key];
3943              }
3944            });
3945            return {
3946              ...state,
3947              [action.recordId]: nextEdits
3948            };
3949        }
3950        return state;
3951      },
3952      saving: (state = {}, action) => {
3953        switch (action.type) {
3954          case 'SAVE_ENTITY_RECORD_START':
3955          case 'SAVE_ENTITY_RECORD_FINISH':
3956            return {
3957              ...state,
3958              [action.recordId]: {
3959                pending: action.type === 'SAVE_ENTITY_RECORD_START',
3960                error: action.error,
3961                isAutosave: action.isAutosave
3962              }
3963            };
3964        }
3965        return state;
3966      },
3967      deleting: (state = {}, action) => {
3968        switch (action.type) {
3969          case 'DELETE_ENTITY_RECORD_START':
3970          case 'DELETE_ENTITY_RECORD_FINISH':
3971            return {
3972              ...state,
3973              [action.recordId]: {
3974                pending: action.type === 'DELETE_ENTITY_RECORD_START',
3975                error: action.error
3976              }
3977            };
3978        }
3979        return state;
3980      },
3981      revisions: (state = {}, action) => {
3982        // Use the same queriedDataReducer shape for revisions.
3983        if (action.type === 'RECEIVE_ITEM_REVISIONS') {
3984          const recordKey = action.recordKey;
3985          delete action.recordKey;
3986          const newState = reducer(state[recordKey], {
3987            ...action,
3988            type: 'RECEIVE_ITEMS'
3989          });
3990          return {
3991            ...state,
3992            [recordKey]: newState
3993          };
3994        }
3995        if (action.type === 'REMOVE_ITEMS') {
3996          return Object.fromEntries(Object.entries(state).filter(([id]) => !action.itemIds.some(itemId => {
3997            if (Number.isInteger(itemId)) {
3998              return itemId === +id;
3999            }
4000            return itemId === id;
4001          })));
4002        }
4003        return state;
4004      }
4005    }));
4006  }
4007  
4008  /**
4009   * Reducer keeping track of the registered entities.
4010   *
4011   * @param {Object} state  Current state.
4012   * @param {Object} action Dispatched action.
4013   *
4014   * @return {Object} Updated state.
4015   */
4016  function entitiesConfig(state = rootEntitiesConfig, action) {
4017    switch (action.type) {
4018      case 'ADD_ENTITIES':
4019        return [...state, ...action.entities];
4020    }
4021    return state;
4022  }
4023  
4024  /**
4025   * Reducer keeping track of the registered entities config and data.
4026   *
4027   * @param {Object} state  Current state.
4028   * @param {Object} action Dispatched action.
4029   *
4030   * @return {Object} Updated state.
4031   */
4032  const entities = (state = {}, action) => {
4033    const newConfig = entitiesConfig(state.config, action);
4034  
4035    // Generates a dynamic reducer for the entities.
4036    let entitiesDataReducer = state.reducer;
4037    if (!entitiesDataReducer || newConfig !== state.config) {
4038      const entitiesByKind = newConfig.reduce((acc, record) => {
4039        const {
4040          kind
4041        } = record;
4042        if (!acc[kind]) {
4043          acc[kind] = [];
4044        }
4045        acc[kind].push(record);
4046        return acc;
4047      }, {});
4048      entitiesDataReducer = (0,external_wp_data_namespaceObject.combineReducers)(Object.entries(entitiesByKind).reduce((memo, [kind, subEntities]) => {
4049        const kindReducer = (0,external_wp_data_namespaceObject.combineReducers)(subEntities.reduce((kindMemo, entityConfig) => ({
4050          ...kindMemo,
4051          [entityConfig.name]: entity(entityConfig)
4052        }), {}));
4053        memo[kind] = kindReducer;
4054        return memo;
4055      }, {}));
4056    }
4057    const newData = entitiesDataReducer(state.records, action);
4058    if (newData === state.records && newConfig === state.config && entitiesDataReducer === state.reducer) {
4059      return state;
4060    }
4061    return {
4062      reducer: entitiesDataReducer,
4063      records: newData,
4064      config: newConfig
4065    };
4066  };
4067  
4068  /**
4069   * @type {UndoManager}
4070   */
4071  function undoManager(state = (0,build_module.createUndoManager)()) {
4072    return state;
4073  }
4074  function editsReference(state = {}, action) {
4075    switch (action.type) {
4076      case 'EDIT_ENTITY_RECORD':
4077      case 'UNDO':
4078      case 'REDO':
4079        return {};
4080    }
4081    return state;
4082  }
4083  
4084  /**
4085   * Reducer managing embed preview data.
4086   *
4087   * @param {Object} state  Current state.
4088   * @param {Object} action Dispatched action.
4089   *
4090   * @return {Object} Updated state.
4091   */
4092  function embedPreviews(state = {}, action) {
4093    switch (action.type) {
4094      case 'RECEIVE_EMBED_PREVIEW':
4095        const {
4096          url,
4097          preview
4098        } = action;
4099        return {
4100          ...state,
4101          [url]: preview
4102        };
4103    }
4104    return state;
4105  }
4106  
4107  /**
4108   * State which tracks whether the user can perform an action on a REST
4109   * resource.
4110   *
4111   * @param {Object} state  Current state.
4112   * @param {Object} action Dispatched action.
4113   *
4114   * @return {Object} Updated state.
4115   */
4116  function userPermissions(state = {}, action) {
4117    switch (action.type) {
4118      case 'RECEIVE_USER_PERMISSION':
4119        return {
4120          ...state,
4121          [action.key]: action.isAllowed
4122        };
4123      case 'RECEIVE_USER_PERMISSIONS':
4124        return {
4125          ...state,
4126          ...action.permissions
4127        };
4128    }
4129    return state;
4130  }
4131  
4132  /**
4133   * Reducer returning autosaves keyed by their parent's post id.
4134   *
4135   * @param {Object} state  Current state.
4136   * @param {Object} action Dispatched action.
4137   *
4138   * @return {Object} Updated state.
4139   */
4140  function autosaves(state = {}, action) {
4141    switch (action.type) {
4142      case 'RECEIVE_AUTOSAVES':
4143        const {
4144          postId,
4145          autosaves: autosavesData
4146        } = action;
4147        return {
4148          ...state,
4149          [postId]: autosavesData
4150        };
4151    }
4152    return state;
4153  }
4154  function blockPatterns(state = [], action) {
4155    switch (action.type) {
4156      case 'RECEIVE_BLOCK_PATTERNS':
4157        return action.patterns;
4158    }
4159    return state;
4160  }
4161  function blockPatternCategories(state = [], action) {
4162    switch (action.type) {
4163      case 'RECEIVE_BLOCK_PATTERN_CATEGORIES':
4164        return action.categories;
4165    }
4166    return state;
4167  }
4168  function userPatternCategories(state = [], action) {
4169    switch (action.type) {
4170      case 'RECEIVE_USER_PATTERN_CATEGORIES':
4171        return action.patternCategories;
4172    }
4173    return state;
4174  }
4175  function navigationFallbackId(state = null, action) {
4176    switch (action.type) {
4177      case 'RECEIVE_NAVIGATION_FALLBACK_ID':
4178        return action.fallbackId;
4179    }
4180    return state;
4181  }
4182  
4183  /**
4184   * Reducer managing the theme global styles revisions.
4185   *
4186   * @param {Record<string, object>} state  Current state.
4187   * @param {Object}                 action Dispatched action.
4188   *
4189   * @return {Record<string, object>} Updated state.
4190   */
4191  function themeGlobalStyleRevisions(state = {}, action) {
4192    switch (action.type) {
4193      case 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':
4194        return {
4195          ...state,
4196          [action.currentId]: action.revisions
4197        };
4198    }
4199    return state;
4200  }
4201  
4202  /**
4203   * Reducer managing the template lookup per query.
4204   *
4205   * @param {Record<string, string>} state  Current state.
4206   * @param {Object}                 action Dispatched action.
4207   *
4208   * @return {Record<string, string>} Updated state.
4209   */
4210  function defaultTemplates(state = {}, action) {
4211    switch (action.type) {
4212      case 'RECEIVE_DEFAULT_TEMPLATE':
4213        return {
4214          ...state,
4215          [JSON.stringify(action.query)]: action.templateId
4216        };
4217    }
4218    return state;
4219  }
4220  
4221  /**
4222   * Reducer returning an object of registered post meta.
4223   *
4224   * @param {Object} state  Current state.
4225   * @param {Object} action Dispatched action.
4226   *
4227   * @return {Object} Updated state.
4228   */
4229  function registeredPostMeta(state = {}, action) {
4230    switch (action.type) {
4231      case 'RECEIVE_REGISTERED_POST_META':
4232        return {
4233          ...state,
4234          [action.postType]: action.registeredPostMeta
4235        };
4236    }
4237    return state;
4238  }
4239  /* harmony default export */ const build_module_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
4240    terms,
4241    users,
4242    currentTheme,
4243    currentGlobalStylesId,
4244    currentUser,
4245    themeGlobalStyleVariations,
4246    themeBaseGlobalStyles,
4247    themeGlobalStyleRevisions,
4248    taxonomies,
4249    entities,
4250    editsReference,
4251    undoManager,
4252    embedPreviews,
4253    userPermissions,
4254    autosaves,
4255    blockPatterns,
4256    blockPatternCategories,
4257    userPatternCategories,
4258    navigationFallbackId,
4259    defaultTemplates,
4260    registeredPostMeta
4261  }));
4262  
4263  // EXTERNAL MODULE: ./node_modules/equivalent-key-map/equivalent-key-map.js
4264  var equivalent_key_map = __webpack_require__(3249);
4265  var equivalent_key_map_default = /*#__PURE__*/__webpack_require__.n(equivalent_key_map);
4266  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/selectors.js
4267  /**
4268   * External dependencies
4269   */
4270  
4271  
4272  /**
4273   * WordPress dependencies
4274   */
4275  
4276  
4277  /**
4278   * Internal dependencies
4279   */
4280  
4281  
4282  
4283  /**
4284   * Cache of state keys to EquivalentKeyMap where the inner map tracks queries
4285   * to their resulting items set. WeakMap allows garbage collection on expired
4286   * state references.
4287   *
4288   * @type {WeakMap<Object,EquivalentKeyMap>}
4289   */
4290  const queriedItemsCacheByState = new WeakMap();
4291  
4292  /**
4293   * Returns items for a given query, or null if the items are not known.
4294   *
4295   * @param {Object}  state State object.
4296   * @param {?Object} query Optional query.
4297   *
4298   * @return {?Array} Query items.
4299   */
4300  function getQueriedItemsUncached(state, query) {
4301    const {
4302      stableKey,
4303      page,
4304      perPage,
4305      include,
4306      fields,
4307      context
4308    } = get_query_parts(query);
4309    let itemIds;
4310    if (state.queries?.[context]?.[stableKey]) {
4311      itemIds = state.queries[context][stableKey].itemIds;
4312    }
4313    if (!itemIds) {
4314      return null;
4315    }
4316    const startOffset = perPage === -1 ? 0 : (page - 1) * perPage;
4317    const endOffset = perPage === -1 ? itemIds.length : Math.min(startOffset + perPage, itemIds.length);
4318    const items = [];
4319    for (let i = startOffset; i < endOffset; i++) {
4320      const itemId = itemIds[i];
4321      if (Array.isArray(include) && !include.includes(itemId)) {
4322        continue;
4323      }
4324      if (itemId === undefined) {
4325        continue;
4326      }
4327      // Having a target item ID doesn't guarantee that this object has been queried.
4328      if (!state.items[context]?.hasOwnProperty(itemId)) {
4329        return null;
4330      }
4331      const item = state.items[context][itemId];
4332      let filteredItem;
4333      if (Array.isArray(fields)) {
4334        filteredItem = {};
4335        for (let f = 0; f < fields.length; f++) {
4336          const field = fields[f].split('.');
4337          let value = item;
4338          field.forEach(fieldName => {
4339            value = value?.[fieldName];
4340          });
4341          setNestedValue(filteredItem, field, value);
4342        }
4343      } else {
4344        // If expecting a complete item, validate that completeness, or
4345        // otherwise abort.
4346        if (!state.itemIsComplete[context]?.[itemId]) {
4347          return null;
4348        }
4349        filteredItem = item;
4350      }
4351      items.push(filteredItem);
4352    }
4353    return items;
4354  }
4355  
4356  /**
4357   * Returns items for a given query, or null if the items are not known. Caches
4358   * result both per state (by reference) and per query (by deep equality).
4359   * The caching approach is intended to be durable to query objects which are
4360   * deeply but not referentially equal, since otherwise:
4361   *
4362   * `getQueriedItems( state, {} ) !== getQueriedItems( state, {} )`
4363   *
4364   * @param {Object}  state State object.
4365   * @param {?Object} query Optional query.
4366   *
4367   * @return {?Array} Query items.
4368   */
4369  const getQueriedItems = (0,external_wp_data_namespaceObject.createSelector)((state, query = {}) => {
4370    let queriedItemsCache = queriedItemsCacheByState.get(state);
4371    if (queriedItemsCache) {
4372      const queriedItems = queriedItemsCache.get(query);
4373      if (queriedItems !== undefined) {
4374        return queriedItems;
4375      }
4376    } else {
4377      queriedItemsCache = new (equivalent_key_map_default())();
4378      queriedItemsCacheByState.set(state, queriedItemsCache);
4379    }
4380    const items = getQueriedItemsUncached(state, query);
4381    queriedItemsCache.set(query, items);
4382    return items;
4383  });
4384  function getQueriedTotalItems(state, query = {}) {
4385    var _state$queries$contex;
4386    const {
4387      stableKey,
4388      context
4389    } = get_query_parts(query);
4390    return (_state$queries$contex = state.queries?.[context]?.[stableKey]?.meta?.totalItems) !== null && _state$queries$contex !== void 0 ? _state$queries$contex : null;
4391  }
4392  function getQueriedTotalPages(state, query = {}) {
4393    var _state$queries$contex2;
4394    const {
4395      stableKey,
4396      context
4397    } = get_query_parts(query);
4398    return (_state$queries$contex2 = state.queries?.[context]?.[stableKey]?.meta?.totalPages) !== null && _state$queries$contex2 !== void 0 ? _state$queries$contex2 : null;
4399  }
4400  
4401  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/is-numeric-id.js
4402  /**
4403   * Checks argument to determine if it's a numeric ID.
4404   * For example, '123' is a numeric ID, but '123abc' is not.
4405   *
4406   * @param {any} id the argument to determine if it's a numeric ID.
4407   * @return {boolean} true if the string is a numeric ID, false otherwise.
4408   */
4409  function isNumericID(id) {
4410    return /^\s*\d+\s*$/.test(id);
4411  }
4412  
4413  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/is-raw-attribute.js
4414  /**
4415   * Checks whether the attribute is a "raw" attribute or not.
4416   *
4417   * @param {Object} entity    Entity record.
4418   * @param {string} attribute Attribute name.
4419   *
4420   * @return {boolean} Is the attribute raw
4421   */
4422  function isRawAttribute(entity, attribute) {
4423    return (entity.rawAttributes || []).includes(attribute);
4424  }
4425  
4426  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/user-permissions.js
4427  const ALLOWED_RESOURCE_ACTIONS = ['create', 'read', 'update', 'delete'];
4428  function getUserPermissionsFromAllowHeader(allowedMethods) {
4429    const permissions = {};
4430    if (!allowedMethods) {
4431      return permissions;
4432    }
4433    const methods = {
4434      create: 'POST',
4435      read: 'GET',
4436      update: 'PUT',
4437      delete: 'DELETE'
4438    };
4439    for (const [actionName, methodName] of Object.entries(methods)) {
4440      permissions[actionName] = allowedMethods.includes(methodName);
4441    }
4442    return permissions;
4443  }
4444  function getUserPermissionCacheKey(action, resource, id) {
4445    const key = (typeof resource === 'object' ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join('/');
4446    return key;
4447  }
4448  
4449  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/selectors.js
4450  /**
4451   * WordPress dependencies
4452   */
4453  
4454  
4455  
4456  
4457  /**
4458   * Internal dependencies
4459   */
4460  
4461  
4462  
4463  
4464  
4465  // This is an incomplete, high-level approximation of the State type.
4466  // It makes the selectors slightly more safe, but is intended to evolve
4467  // into a more detailed representation over time.
4468  // See https://github.com/WordPress/gutenberg/pull/40025#discussion_r865410589 for more context.
4469  
4470  /**
4471   * HTTP Query parameters sent with the API request to fetch the entity records.
4472   */
4473  
4474  /**
4475   * Arguments for EntityRecord selectors.
4476   */
4477  
4478  /**
4479   * Shared reference to an empty object for cases where it is important to avoid
4480   * returning a new object reference on every invocation, as in a connected or
4481   * other pure component which performs `shouldComponentUpdate` check on props.
4482   * This should be used as a last resort, since the normalized data should be
4483   * maintained by the reducer result in state.
4484   */
4485  const EMPTY_OBJECT = {};
4486  
4487  /**
4488   * Returns true if a request is in progress for embed preview data, or false
4489   * otherwise.
4490   *
4491   * @param state Data state.
4492   * @param url   URL the preview would be for.
4493   *
4494   * @return Whether a request is in progress for an embed preview.
4495   */
4496  const isRequestingEmbedPreview = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, url) => {
4497    return select(STORE_NAME).isResolving('getEmbedPreview', [url]);
4498  });
4499  
4500  /**
4501   * Returns all available authors.
4502   *
4503   * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.
4504   *
4505   * @param      state Data state.
4506   * @param      query Optional object of query parameters to
4507   *                   include with request. For valid query parameters see the [Users page](https://developer.wordpress.org/rest-api/reference/users/) in the REST API Handbook and see the arguments for [List Users](https://developer.wordpress.org/rest-api/reference/users/#list-users) and [Retrieve a User](https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user).
4508   * @return Authors list.
4509   */
4510  function getAuthors(state, query) {
4511    external_wp_deprecated_default()("select( 'core' ).getAuthors()", {
4512      since: '5.9',
4513      alternative: "select( 'core' ).getUsers({ who: 'authors' })"
4514    });
4515    const path = (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/users/?who=authors&per_page=100', query);
4516    return getUserQueryResults(state, path);
4517  }
4518  
4519  /**
4520   * Returns the current user.
4521   *
4522   * @param state Data state.
4523   *
4524   * @return Current user object.
4525   */
4526  function getCurrentUser(state) {
4527    return state.currentUser;
4528  }
4529  
4530  /**
4531   * Returns all the users returned by a query ID.
4532   *
4533   * @param state   Data state.
4534   * @param queryID Query ID.
4535   *
4536   * @return Users list.
4537   */
4538  const getUserQueryResults = (0,external_wp_data_namespaceObject.createSelector)((state, queryID) => {
4539    var _state$users$queries$;
4540    const queryResults = (_state$users$queries$ = state.users.queries[queryID]) !== null && _state$users$queries$ !== void 0 ? _state$users$queries$ : [];
4541    return queryResults.map(id => state.users.byId[id]);
4542  }, (state, queryID) => [state.users.queries[queryID], state.users.byId]);
4543  
4544  /**
4545   * Returns the loaded entities for the given kind.
4546   *
4547   * @deprecated since WordPress 6.0. Use getEntitiesConfig instead
4548   * @param      state Data state.
4549   * @param      kind  Entity kind.
4550   *
4551   * @return Array of entities with config matching kind.
4552   */
4553  function getEntitiesByKind(state, kind) {
4554    external_wp_deprecated_default()("wp.data.select( 'core' ).getEntitiesByKind()", {
4555      since: '6.0',
4556      alternative: "wp.data.select( 'core' ).getEntitiesConfig()"
4557    });
4558    return getEntitiesConfig(state, kind);
4559  }
4560  
4561  /**
4562   * Returns the loaded entities for the given kind.
4563   *
4564   * @param state Data state.
4565   * @param kind  Entity kind.
4566   *
4567   * @return Array of entities with config matching kind.
4568   */
4569  const getEntitiesConfig = (0,external_wp_data_namespaceObject.createSelector)((state, kind) => state.entities.config.filter(entity => entity.kind === kind), /* eslint-disable @typescript-eslint/no-unused-vars */
4570  (state, kind) => state.entities.config
4571  /* eslint-enable @typescript-eslint/no-unused-vars */);
4572  /**
4573   * Returns the entity config given its kind and name.
4574   *
4575   * @deprecated since WordPress 6.0. Use getEntityConfig instead
4576   * @param      state Data state.
4577   * @param      kind  Entity kind.
4578   * @param      name  Entity name.
4579   *
4580   * @return Entity config
4581   */
4582  function getEntity(state, kind, name) {
4583    external_wp_deprecated_default()("wp.data.select( 'core' ).getEntity()", {
4584      since: '6.0',
4585      alternative: "wp.data.select( 'core' ).getEntityConfig()"
4586    });
4587    return getEntityConfig(state, kind, name);
4588  }
4589  
4590  /**
4591   * Returns the entity config given its kind and name.
4592   *
4593   * @param state Data state.
4594   * @param kind  Entity kind.
4595   * @param name  Entity name.
4596   *
4597   * @return Entity config
4598   */
4599  function getEntityConfig(state, kind, name) {
4600    return state.entities.config?.find(config => config.kind === kind && config.name === name);
4601  }
4602  
4603  /**
4604   * GetEntityRecord is declared as a *callable interface* with
4605   * two signatures to work around the fact that TypeScript doesn't
4606   * allow currying generic functions:
4607   *
4608   * ```ts
4609   *         type CurriedState = F extends ( state: any, ...args: infer P ) => infer R
4610   *             ? ( ...args: P ) => R
4611   *             : F;
4612   *         type Selector = <K extends string | number>(
4613   *         state: any,
4614   *         kind: K,
4615   *         key: K extends string ? 'string value' : false
4616   *    ) => K;
4617   *         type BadlyInferredSignature = CurriedState< Selector >
4618   *    // BadlyInferredSignature evaluates to:
4619   *    // (kind: string number, key: false | "string value") => string number
4620   * ```
4621   *
4622   * The signature without the state parameter shipped as CurriedSignature
4623   * is used in the return value of `select( coreStore )`.
4624   *
4625   * See https://github.com/WordPress/gutenberg/pull/41578 for more details.
4626   */
4627  
4628  /**
4629   * Returns the Entity's record object by key. Returns `null` if the value is not
4630   * yet received, undefined if the value entity is known to not exist, or the
4631   * entity object if it exists and is received.
4632   *
4633   * @param state State tree
4634   * @param kind  Entity kind.
4635   * @param name  Entity name.
4636   * @param key   Record's key
4637   * @param query Optional query. If requesting specific
4638   *              fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]".
4639   *
4640   * @return Record.
4641   */
4642  const getEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, key, query) => {
4643    var _query$context;
4644    const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
4645    if (!queriedState) {
4646      return undefined;
4647    }
4648    const context = (_query$context = query?.context) !== null && _query$context !== void 0 ? _query$context : 'default';
4649    if (query === undefined) {
4650      // If expecting a complete item, validate that completeness.
4651      if (!queriedState.itemIsComplete[context]?.[key]) {
4652        return undefined;
4653      }
4654      return queriedState.items[context][key];
4655    }
4656    const item = queriedState.items[context]?.[key];
4657    if (item && query._fields) {
4658      var _getNormalizedCommaSe;
4659      const filteredItem = {};
4660      const fields = (_getNormalizedCommaSe = get_normalized_comma_separable(query._fields)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : [];
4661      for (let f = 0; f < fields.length; f++) {
4662        const field = fields[f].split('.');
4663        let value = item;
4664        field.forEach(fieldName => {
4665          value = value?.[fieldName];
4666        });
4667        setNestedValue(filteredItem, field, value);
4668      }
4669      return filteredItem;
4670    }
4671    return item;
4672  }, (state, kind, name, recordId, query) => {
4673    var _query$context2;
4674    const context = (_query$context2 = query?.context) !== null && _query$context2 !== void 0 ? _query$context2 : 'default';
4675    return [state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]];
4676  });
4677  
4678  /**
4679   * Normalizes `recordKey`s that look like numeric IDs to numbers.
4680   *
4681   * @param args EntityRecordArgs the selector arguments.
4682   * @return EntityRecordArgs the normalized arguments.
4683   */
4684  getEntityRecord.__unstableNormalizeArgs = args => {
4685    const newArgs = [...args];
4686    const recordKey = newArgs?.[2];
4687  
4688    // If recordKey looks to be a numeric ID then coerce to number.
4689    newArgs[2] = isNumericID(recordKey) ? Number(recordKey) : recordKey;
4690    return newArgs;
4691  };
4692  
4693  /**
4694   * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.
4695   *
4696   * @param state State tree
4697   * @param kind  Entity kind.
4698   * @param name  Entity name.
4699   * @param key   Record's key
4700   *
4701   * @return Record.
4702   */
4703  function __experimentalGetEntityRecordNoResolver(state, kind, name, key) {
4704    return getEntityRecord(state, kind, name, key);
4705  }
4706  
4707  /**
4708   * Returns the entity's record object by key,
4709   * with its attributes mapped to their raw values.
4710   *
4711   * @param state State tree.
4712   * @param kind  Entity kind.
4713   * @param name  Entity name.
4714   * @param key   Record's key.
4715   *
4716   * @return Object with the entity's raw attributes.
4717   */
4718  const getRawEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, key) => {
4719    const record = getEntityRecord(state, kind, name, key);
4720    return record && Object.keys(record).reduce((accumulator, _key) => {
4721      if (isRawAttribute(getEntityConfig(state, kind, name), _key)) {
4722        var _record$_key$raw;
4723        // Because edits are the "raw" attribute values,
4724        // we return those from record selectors to make rendering,
4725        // comparisons, and joins with edits easier.
4726        accumulator[_key] = (_record$_key$raw = record[_key]?.raw) !== null && _record$_key$raw !== void 0 ? _record$_key$raw : record[_key];
4727      } else {
4728        accumulator[_key] = record[_key];
4729      }
4730      return accumulator;
4731    }, {});
4732  }, (state, kind, name, recordId, query) => {
4733    var _query$context3;
4734    const context = (_query$context3 = query?.context) !== null && _query$context3 !== void 0 ? _query$context3 : 'default';
4735    return [state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData?.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData?.itemIsComplete[context]?.[recordId]];
4736  });
4737  
4738  /**
4739   * Returns true if records have been received for the given set of parameters,
4740   * or false otherwise.
4741   *
4742   * @param state State tree
4743   * @param kind  Entity kind.
4744   * @param name  Entity name.
4745   * @param query Optional terms query. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
4746   *
4747   * @return  Whether entity records have been received.
4748   */
4749  function hasEntityRecords(state, kind, name, query) {
4750    return Array.isArray(getEntityRecords(state, kind, name, query));
4751  }
4752  
4753  /**
4754   * GetEntityRecord is declared as a *callable interface* with
4755   * two signatures to work around the fact that TypeScript doesn't
4756   * allow currying generic functions.
4757   *
4758   * @see GetEntityRecord
4759   * @see https://github.com/WordPress/gutenberg/pull/41578
4760   */
4761  
4762  /**
4763   * Returns the Entity's records.
4764   *
4765   * @param state State tree
4766   * @param kind  Entity kind.
4767   * @param name  Entity name.
4768   * @param query Optional terms query. If requesting specific
4769   *              fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
4770   *
4771   * @return Records.
4772   */
4773  const getEntityRecords = (state, kind, name, query) => {
4774    // Queried data state is prepopulated for all known entities. If this is not
4775    // assigned for the given parameters, then it is known to not exist.
4776    const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
4777    if (!queriedState) {
4778      return null;
4779    }
4780    return getQueriedItems(queriedState, query);
4781  };
4782  
4783  /**
4784   * Returns the Entity's total available records for a given query (ignoring pagination).
4785   *
4786   * @param state State tree
4787   * @param kind  Entity kind.
4788   * @param name  Entity name.
4789   * @param query Optional terms query. If requesting specific
4790   *              fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
4791   *
4792   * @return number | null.
4793   */
4794  const getEntityRecordsTotalItems = (state, kind, name, query) => {
4795    // Queried data state is prepopulated for all known entities. If this is not
4796    // assigned for the given parameters, then it is known to not exist.
4797    const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
4798    if (!queriedState) {
4799      return null;
4800    }
4801    return getQueriedTotalItems(queriedState, query);
4802  };
4803  
4804  /**
4805   * Returns the number of available pages for the given query.
4806   *
4807   * @param state State tree
4808   * @param kind  Entity kind.
4809   * @param name  Entity name.
4810   * @param query Optional terms query. If requesting specific
4811   *              fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available for "List [Entity kind]s".
4812   *
4813   * @return number | null.
4814   */
4815  const getEntityRecordsTotalPages = (state, kind, name, query) => {
4816    // Queried data state is prepopulated for all known entities. If this is not
4817    // assigned for the given parameters, then it is known to not exist.
4818    const queriedState = state.entities.records?.[kind]?.[name]?.queriedData;
4819    if (!queriedState) {
4820      return null;
4821    }
4822    if (query.per_page === -1) {
4823      return 1;
4824    }
4825    const totalItems = getQueriedTotalItems(queriedState, query);
4826    if (!totalItems) {
4827      return totalItems;
4828    }
4829    // If `per_page` is not set and the query relies on the defaults of the
4830    // REST endpoint, get the info from query's meta.
4831    if (!query.per_page) {
4832      return getQueriedTotalPages(queriedState, query);
4833    }
4834    return Math.ceil(totalItems / query.per_page);
4835  };
4836  /**
4837   * Returns the list of dirty entity records.
4838   *
4839   * @param state State tree.
4840   *
4841   * @return The list of updated records
4842   */
4843  const __experimentalGetDirtyEntityRecords = (0,external_wp_data_namespaceObject.createSelector)(state => {
4844    const {
4845      entities: {
4846        records
4847      }
4848    } = state;
4849    const dirtyRecords = [];
4850    Object.keys(records).forEach(kind => {
4851      Object.keys(records[kind]).forEach(name => {
4852        const primaryKeys = Object.keys(records[kind][name].edits).filter(primaryKey =>
4853        // The entity record must exist (not be deleted),
4854        // and it must have edits.
4855        getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey));
4856        if (primaryKeys.length) {
4857          const entityConfig = getEntityConfig(state, kind, name);
4858          primaryKeys.forEach(primaryKey => {
4859            const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
4860            dirtyRecords.push({
4861              // We avoid using primaryKey because it's transformed into a string
4862              // when it's used as an object key.
4863              key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : undefined,
4864              title: entityConfig?.getTitle?.(entityRecord) || '',
4865              name,
4866              kind
4867            });
4868          });
4869        }
4870      });
4871    });
4872    return dirtyRecords;
4873  }, state => [state.entities.records]);
4874  
4875  /**
4876   * Returns the list of entities currently being saved.
4877   *
4878   * @param state State tree.
4879   *
4880   * @return The list of records being saved.
4881   */
4882  const __experimentalGetEntitiesBeingSaved = (0,external_wp_data_namespaceObject.createSelector)(state => {
4883    const {
4884      entities: {
4885        records
4886      }
4887    } = state;
4888    const recordsBeingSaved = [];
4889    Object.keys(records).forEach(kind => {
4890      Object.keys(records[kind]).forEach(name => {
4891        const primaryKeys = Object.keys(records[kind][name].saving).filter(primaryKey => isSavingEntityRecord(state, kind, name, primaryKey));
4892        if (primaryKeys.length) {
4893          const entityConfig = getEntityConfig(state, kind, name);
4894          primaryKeys.forEach(primaryKey => {
4895            const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
4896            recordsBeingSaved.push({
4897              // We avoid using primaryKey because it's transformed into a string
4898              // when it's used as an object key.
4899              key: entityRecord ? entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY] : undefined,
4900              title: entityConfig?.getTitle?.(entityRecord) || '',
4901              name,
4902              kind
4903            });
4904          });
4905        }
4906      });
4907    });
4908    return recordsBeingSaved;
4909  }, state => [state.entities.records]);
4910  
4911  /**
4912   * Returns the specified entity record's edits.
4913   *
4914   * @param state    State tree.
4915   * @param kind     Entity kind.
4916   * @param name     Entity name.
4917   * @param recordId Record ID.
4918   *
4919   * @return The entity record's edits.
4920   */
4921  function getEntityRecordEdits(state, kind, name, recordId) {
4922    return state.entities.records?.[kind]?.[name]?.edits?.[recordId];
4923  }
4924  
4925  /**
4926   * Returns the specified entity record's non transient edits.
4927   *
4928   * Transient edits don't create an undo level, and
4929   * are not considered for change detection.
4930   * They are defined in the entity's config.
4931   *
4932   * @param state    State tree.
4933   * @param kind     Entity kind.
4934   * @param name     Entity name.
4935   * @param recordId Record ID.
4936   *
4937   * @return The entity record's non transient edits.
4938   */
4939  const getEntityRecordNonTransientEdits = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordId) => {
4940    const {
4941      transientEdits
4942    } = getEntityConfig(state, kind, name) || {};
4943    const edits = getEntityRecordEdits(state, kind, name, recordId) || {};
4944    if (!transientEdits) {
4945      return edits;
4946    }
4947    return Object.keys(edits).reduce((acc, key) => {
4948      if (!transientEdits[key]) {
4949        acc[key] = edits[key];
4950      }
4951      return acc;
4952    }, {});
4953  }, (state, kind, name, recordId) => [state.entities.config, state.entities.records?.[kind]?.[name]?.edits?.[recordId]]);
4954  
4955  /**
4956   * Returns true if the specified entity record has edits,
4957   * and false otherwise.
4958   *
4959   * @param state    State tree.
4960   * @param kind     Entity kind.
4961   * @param name     Entity name.
4962   * @param recordId Record ID.
4963   *
4964   * @return Whether the entity record has edits or not.
4965   */
4966  function hasEditsForEntityRecord(state, kind, name, recordId) {
4967    return isSavingEntityRecord(state, kind, name, recordId) || Object.keys(getEntityRecordNonTransientEdits(state, kind, name, recordId)).length > 0;
4968  }
4969  
4970  /**
4971   * Returns the specified entity record, merged with its edits.
4972   *
4973   * @param state    State tree.
4974   * @param kind     Entity kind.
4975   * @param name     Entity name.
4976   * @param recordId Record ID.
4977   *
4978   * @return The entity record, merged with its edits.
4979   */
4980  const getEditedEntityRecord = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordId) => {
4981    const raw = getRawEntityRecord(state, kind, name, recordId);
4982    const edited = getEntityRecordEdits(state, kind, name, recordId);
4983    // Never return a non-falsy empty object. Unfortunately we can't return
4984    // undefined or null because we were previously returning an empty
4985    // object, so trying to read properties from the result would throw.
4986    // Using false here is a workaround to avoid breaking changes.
4987    if (!raw && !edited) {
4988      return false;
4989    }
4990    return {
4991      ...raw,
4992      ...edited
4993    };
4994  }, (state, kind, name, recordId, query) => {
4995    var _query$context4;
4996    const context = (_query$context4 = query?.context) !== null && _query$context4 !== void 0 ? _query$context4 : 'default';
4997    return [state.entities.config, state.entities.records?.[kind]?.[name]?.queriedData.items[context]?.[recordId], state.entities.records?.[kind]?.[name]?.queriedData.itemIsComplete[context]?.[recordId], state.entities.records?.[kind]?.[name]?.edits?.[recordId]];
4998  });
4999  
5000  /**
5001   * Returns true if the specified entity record is autosaving, and false otherwise.
5002   *
5003   * @param state    State tree.
5004   * @param kind     Entity kind.
5005   * @param name     Entity name.
5006   * @param recordId Record ID.
5007   *
5008   * @return Whether the entity record is autosaving or not.
5009   */
5010  function isAutosavingEntityRecord(state, kind, name, recordId) {
5011    var _state$entities$recor;
5012    const {
5013      pending,
5014      isAutosave
5015    } = (_state$entities$recor = state.entities.records?.[kind]?.[name]?.saving?.[recordId]) !== null && _state$entities$recor !== void 0 ? _state$entities$recor : {};
5016    return Boolean(pending && isAutosave);
5017  }
5018  
5019  /**
5020   * Returns true if the specified entity record is saving, and false otherwise.
5021   *
5022   * @param state    State tree.
5023   * @param kind     Entity kind.
5024   * @param name     Entity name.
5025   * @param recordId Record ID.
5026   *
5027   * @return Whether the entity record is saving or not.
5028   */
5029  function isSavingEntityRecord(state, kind, name, recordId) {
5030    var _state$entities$recor2;
5031    return (_state$entities$recor2 = state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.pending) !== null && _state$entities$recor2 !== void 0 ? _state$entities$recor2 : false;
5032  }
5033  
5034  /**
5035   * Returns true if the specified entity record is deleting, and false otherwise.
5036   *
5037   * @param state    State tree.
5038   * @param kind     Entity kind.
5039   * @param name     Entity name.
5040   * @param recordId Record ID.
5041   *
5042   * @return Whether the entity record is deleting or not.
5043   */
5044  function isDeletingEntityRecord(state, kind, name, recordId) {
5045    var _state$entities$recor3;
5046    return (_state$entities$recor3 = state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.pending) !== null && _state$entities$recor3 !== void 0 ? _state$entities$recor3 : false;
5047  }
5048  
5049  /**
5050   * Returns the specified entity record's last save error.
5051   *
5052   * @param state    State tree.
5053   * @param kind     Entity kind.
5054   * @param name     Entity name.
5055   * @param recordId Record ID.
5056   *
5057   * @return The entity record's save error.
5058   */
5059  function getLastEntitySaveError(state, kind, name, recordId) {
5060    return state.entities.records?.[kind]?.[name]?.saving?.[recordId]?.error;
5061  }
5062  
5063  /**
5064   * Returns the specified entity record's last delete error.
5065   *
5066   * @param state    State tree.
5067   * @param kind     Entity kind.
5068   * @param name     Entity name.
5069   * @param recordId Record ID.
5070   *
5071   * @return The entity record's save error.
5072   */
5073  function getLastEntityDeleteError(state, kind, name, recordId) {
5074    return state.entities.records?.[kind]?.[name]?.deleting?.[recordId]?.error;
5075  }
5076  
5077  /* eslint-disable @typescript-eslint/no-unused-vars */
5078  /**
5079   * Returns the previous edit from the current undo offset
5080   * for the entity records edits history, if any.
5081   *
5082   * @deprecated since 6.3
5083   *
5084   * @param      state State tree.
5085   *
5086   * @return The edit.
5087   */
5088  function getUndoEdit(state) {
5089    external_wp_deprecated_default()("select( 'core' ).getUndoEdit()", {
5090      since: '6.3'
5091    });
5092    return undefined;
5093  }
5094  /* eslint-enable @typescript-eslint/no-unused-vars */
5095  
5096  /* eslint-disable @typescript-eslint/no-unused-vars */
5097  /**
5098   * Returns the next edit from the current undo offset
5099   * for the entity records edits history, if any.
5100   *
5101   * @deprecated since 6.3
5102   *
5103   * @param      state State tree.
5104   *
5105   * @return The edit.
5106   */
5107  function getRedoEdit(state) {
5108    external_wp_deprecated_default()("select( 'core' ).getRedoEdit()", {
5109      since: '6.3'
5110    });
5111    return undefined;
5112  }
5113  /* eslint-enable @typescript-eslint/no-unused-vars */
5114  
5115  /**
5116   * Returns true if there is a previous edit from the current undo offset
5117   * for the entity records edits history, and false otherwise.
5118   *
5119   * @param state State tree.
5120   *
5121   * @return Whether there is a previous edit or not.
5122   */
5123  function hasUndo(state) {
5124    return state.undoManager.hasUndo();
5125  }
5126  
5127  /**
5128   * Returns true if there is a next edit from the current undo offset
5129   * for the entity records edits history, and false otherwise.
5130   *
5131   * @param state State tree.
5132   *
5133   * @return Whether there is a next edit or not.
5134   */
5135  function hasRedo(state) {
5136    return state.undoManager.hasRedo();
5137  }
5138  
5139  /**
5140   * Return the current theme.
5141   *
5142   * @param state Data state.
5143   *
5144   * @return The current theme.
5145   */
5146  function getCurrentTheme(state) {
5147    if (!state.currentTheme) {
5148      return null;
5149    }
5150    return getEntityRecord(state, 'root', 'theme', state.currentTheme);
5151  }
5152  
5153  /**
5154   * Return the ID of the current global styles object.
5155   *
5156   * @param state Data state.
5157   *
5158   * @return The current global styles ID.
5159   */
5160  function __experimentalGetCurrentGlobalStylesId(state) {
5161    return state.currentGlobalStylesId;
5162  }
5163  
5164  /**
5165   * Return theme supports data in the index.
5166   *
5167   * @param state Data state.
5168   *
5169   * @return Index data.
5170   */
5171  function getThemeSupports(state) {
5172    var _getCurrentTheme$them;
5173    return (_getCurrentTheme$them = getCurrentTheme(state)?.theme_supports) !== null && _getCurrentTheme$them !== void 0 ? _getCurrentTheme$them : EMPTY_OBJECT;
5174  }
5175  
5176  /**
5177   * Returns the embed preview for the given URL.
5178   *
5179   * @param state Data state.
5180   * @param url   Embedded URL.
5181   *
5182   * @return Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.
5183   */
5184  function getEmbedPreview(state, url) {
5185    return state.embedPreviews[url];
5186  }
5187  
5188  /**
5189   * Determines if the returned preview is an oEmbed link fallback.
5190   *
5191   * WordPress can be configured to return a simple link to a URL if it is not embeddable.
5192   * We need to be able to determine if a URL is embeddable or not, based on what we
5193   * get back from the oEmbed preview API.
5194   *
5195   * @param state Data state.
5196   * @param url   Embedded URL.
5197   *
5198   * @return Is the preview for the URL an oEmbed link fallback.
5199   */
5200  function isPreviewEmbedFallback(state, url) {
5201    const preview = state.embedPreviews[url];
5202    const oEmbedLinkCheck = '<a href="' + url + '">' + url + '</a>';
5203    if (!preview) {
5204      return false;
5205    }
5206    return preview.html === oEmbedLinkCheck;
5207  }
5208  
5209  /**
5210   * Returns whether the current user can perform the given action on the given
5211   * REST resource.
5212   *
5213   * Calling this may trigger an OPTIONS request to the REST API via the
5214   * `canUser()` resolver.
5215   *
5216   * https://developer.wordpress.org/rest-api/reference/
5217   *
5218   * @param state    Data state.
5219   * @param action   Action to check. One of: 'create', 'read', 'update', 'delete'.
5220   * @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`
5221   *                 or REST base as a string - `media`.
5222   * @param id       Optional ID of the rest resource to check.
5223   *
5224   * @return Whether or not the user can perform the action,
5225   *                             or `undefined` if the OPTIONS request is still being made.
5226   */
5227  function canUser(state, action, resource, id) {
5228    const isEntity = typeof resource === 'object';
5229    if (isEntity && (!resource.kind || !resource.name)) {
5230      return false;
5231    }
5232    const key = getUserPermissionCacheKey(action, resource, id);
5233    return state.userPermissions[key];
5234  }
5235  
5236  /**
5237   * Returns whether the current user can edit the given entity.
5238   *
5239   * Calling this may trigger an OPTIONS request to the REST API via the
5240   * `canUser()` resolver.
5241   *
5242   * https://developer.wordpress.org/rest-api/reference/
5243   *
5244   * @param state    Data state.
5245   * @param kind     Entity kind.
5246   * @param name     Entity name.
5247   * @param recordId Record's id.
5248   * @return Whether or not the user can edit,
5249   * or `undefined` if the OPTIONS request is still being made.
5250   */
5251  function canUserEditEntityRecord(state, kind, name, recordId) {
5252    external_wp_deprecated_default()(`wp.data.select( 'core' ).canUserEditEntityRecord()`, {
5253      since: '6.7',
5254      alternative: `wp.data.select( 'core' ).canUser( 'update', { kind, name, id } )`
5255    });
5256    return canUser(state, 'update', {
5257      kind,
5258      name,
5259      id: recordId
5260    });
5261  }
5262  
5263  /**
5264   * Returns the latest autosaves for the post.
5265   *
5266   * May return multiple autosaves since the backend stores one autosave per
5267   * author for each post.
5268   *
5269   * @param state    State tree.
5270   * @param postType The type of the parent post.
5271   * @param postId   The id of the parent post.
5272   *
5273   * @return An array of autosaves for the post, or undefined if there is none.
5274   */
5275  function getAutosaves(state, postType, postId) {
5276    return state.autosaves[postId];
5277  }
5278  
5279  /**
5280   * Returns the autosave for the post and author.
5281   *
5282   * @param state    State tree.
5283   * @param postType The type of the parent post.
5284   * @param postId   The id of the parent post.
5285   * @param authorId The id of the author.
5286   *
5287   * @return The autosave for the post and author.
5288   */
5289  function getAutosave(state, postType, postId, authorId) {
5290    if (authorId === undefined) {
5291      return;
5292    }
5293    const autosaves = state.autosaves[postId];
5294    return autosaves?.find(autosave => autosave.author === authorId);
5295  }
5296  
5297  /**
5298   * Returns true if the REST request for autosaves has completed.
5299   *
5300   * @param state    State tree.
5301   * @param postType The type of the parent post.
5302   * @param postId   The id of the parent post.
5303   *
5304   * @return True if the REST request was completed. False otherwise.
5305   */
5306  const hasFetchedAutosaves = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, postType, postId) => {
5307    return select(STORE_NAME).hasFinishedResolution('getAutosaves', [postType, postId]);
5308  });
5309  
5310  /**
5311   * Returns a new reference when edited values have changed. This is useful in
5312   * inferring where an edit has been made between states by comparison of the
5313   * return values using strict equality.
5314   *
5315   * @example
5316   *
5317   * ```
5318   * const hasEditOccurred = (
5319   *    getReferenceByDistinctEdits( beforeState ) !==
5320   *    getReferenceByDistinctEdits( afterState )
5321   * );
5322   * ```
5323   *
5324   * @param state Editor state.
5325   *
5326   * @return A value whose reference will change only when an edit occurs.
5327   */
5328  function getReferenceByDistinctEdits(state) {
5329    return state.editsReference;
5330  }
5331  
5332  /**
5333   * Retrieve the frontend template used for a given link.
5334   *
5335   * @param state Editor state.
5336   * @param link  Link.
5337   *
5338   * @return The template record.
5339   */
5340  function __experimentalGetTemplateForLink(state, link) {
5341    const records = getEntityRecords(state, 'postType', 'wp_template', {
5342      'find-template': link
5343    });
5344    if (records?.length) {
5345      return getEditedEntityRecord(state, 'postType', 'wp_template', records[0].id);
5346    }
5347    return null;
5348  }
5349  
5350  /**
5351   * Retrieve the current theme's base global styles
5352   *
5353   * @param state Editor state.
5354   *
5355   * @return The Global Styles object.
5356   */
5357  function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
5358    const currentTheme = getCurrentTheme(state);
5359    if (!currentTheme) {
5360      return null;
5361    }
5362    return state.themeBaseGlobalStyles[currentTheme.stylesheet];
5363  }
5364  
5365  /**
5366   * Return the ID of the current global styles object.
5367   *
5368   * @param state Data state.
5369   *
5370   * @return The current global styles ID.
5371   */
5372  function __experimentalGetCurrentThemeGlobalStylesVariations(state) {
5373    const currentTheme = getCurrentTheme(state);
5374    if (!currentTheme) {
5375      return null;
5376    }
5377    return state.themeGlobalStyleVariations[currentTheme.stylesheet];
5378  }
5379  
5380  /**
5381   * Retrieve the list of registered block patterns.
5382   *
5383   * @param state Data state.
5384   *
5385   * @return Block pattern list.
5386   */
5387  function getBlockPatterns(state) {
5388    return state.blockPatterns;
5389  }
5390  
5391  /**
5392   * Retrieve the list of registered block pattern categories.
5393   *
5394   * @param state Data state.
5395   *
5396   * @return Block pattern category list.
5397   */
5398  function getBlockPatternCategories(state) {
5399    return state.blockPatternCategories;
5400  }
5401  
5402  /**
5403   * Retrieve the registered user pattern categories.
5404   *
5405   * @param state Data state.
5406   *
5407   * @return User patterns category array.
5408   */
5409  
5410  function getUserPatternCategories(state) {
5411    return state.userPatternCategories;
5412  }
5413  
5414  /**
5415   * Returns the revisions of the current global styles theme.
5416   *
5417   * @deprecated since WordPress 6.5.0. Callers should use `select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )` instead, where `recordKey` is the id of the global styles parent post.
5418   *
5419   * @param      state Data state.
5420   *
5421   * @return The current global styles.
5422   */
5423  function getCurrentThemeGlobalStylesRevisions(state) {
5424    external_wp_deprecated_default()("select( 'core' ).getCurrentThemeGlobalStylesRevisions()", {
5425      since: '6.5.0',
5426      alternative: "select( 'core' ).getRevisions( 'root', 'globalStyles', ${ recordKey } )"
5427    });
5428    const currentGlobalStylesId = __experimentalGetCurrentGlobalStylesId(state);
5429    if (!currentGlobalStylesId) {
5430      return null;
5431    }
5432    return state.themeGlobalStyleRevisions[currentGlobalStylesId];
5433  }
5434  
5435  /**
5436   * Returns the default template use to render a given query.
5437   *
5438   * @param state Data state.
5439   * @param query Query.
5440   *
5441   * @return The default template id for the given query.
5442   */
5443  function getDefaultTemplateId(state, query) {
5444    return state.defaultTemplates[JSON.stringify(query)];
5445  }
5446  
5447  /**
5448   * Returns an entity's revisions.
5449   *
5450   * @param state     State tree
5451   * @param kind      Entity kind.
5452   * @param name      Entity name.
5453   * @param recordKey The key of the entity record whose revisions you want to fetch.
5454   * @param query     Optional query. If requesting specific
5455   *                  fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available "Retrieve a [Entity kind]".
5456   *
5457   * @return Record.
5458   */
5459  const getRevisions = (state, kind, name, recordKey, query) => {
5460    const queriedStateRevisions = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
5461    if (!queriedStateRevisions) {
5462      return null;
5463    }
5464    return getQueriedItems(queriedStateRevisions, query);
5465  };
5466  
5467  /**
5468   * Returns a single, specific revision of a parent entity.
5469   *
5470   * @param state       State tree
5471   * @param kind        Entity kind.
5472   * @param name        Entity name.
5473   * @param recordKey   The key of the entity record whose revisions you want to fetch.
5474   * @param revisionKey The revision's key.
5475   * @param query       Optional query. If requesting specific
5476   *                    fields, fields must always include the ID. For valid query parameters see revisions schema in [the REST API Handbook](https://developer.wordpress.org/rest-api/reference/). Then see the arguments available "Retrieve a [entity kind]".
5477   *
5478   * @return Record.
5479   */
5480  const getRevision = (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, recordKey, revisionKey, query) => {
5481    var _query$context5;
5482    const queriedState = state.entities.records?.[kind]?.[name]?.revisions?.[recordKey];
5483    if (!queriedState) {
5484      return undefined;
5485    }
5486    const context = (_query$context5 = query?.context) !== null && _query$context5 !== void 0 ? _query$context5 : 'default';
5487    if (query === undefined) {
5488      // If expecting a complete item, validate that completeness.
5489      if (!queriedState.itemIsComplete[context]?.[revisionKey]) {
5490        return undefined;
5491      }
5492      return queriedState.items[context][revisionKey];
5493    }
5494    const item = queriedState.items[context]?.[revisionKey];
5495    if (item && query._fields) {
5496      var _getNormalizedCommaSe2;
5497      const filteredItem = {};
5498      const fields = (_getNormalizedCommaSe2 = get_normalized_comma_separable(query._fields)) !== null && _getNormalizedCommaSe2 !== void 0 ? _getNormalizedCommaSe2 : [];
5499      for (let f = 0; f < fields.length; f++) {
5500        const field = fields[f].split('.');
5501        let value = item;
5502        field.forEach(fieldName => {
5503          value = value?.[fieldName];
5504        });
5505        setNestedValue(filteredItem, field, value);
5506      }
5507      return filteredItem;
5508    }
5509    return item;
5510  }, (state, kind, name, recordKey, revisionKey, query) => {
5511    var _query$context6;
5512    const context = (_query$context6 = query?.context) !== null && _query$context6 !== void 0 ? _query$context6 : 'default';
5513    return [state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]?.items?.[context]?.[revisionKey], state.entities.records?.[kind]?.[name]?.revisions?.[recordKey]?.itemIsComplete?.[context]?.[revisionKey]];
5514  });
5515  
5516  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/private-selectors.js
5517  /**
5518   * WordPress dependencies
5519   */
5520  
5521  
5522  /**
5523   * Internal dependencies
5524   */
5525  
5526  
5527  /**
5528   * Returns the previous edit from the current undo offset
5529   * for the entity records edits history, if any.
5530   *
5531   * @param state State tree.
5532   *
5533   * @return The undo manager.
5534   */
5535  function getUndoManager(state) {
5536    return state.undoManager;
5537  }
5538  
5539  /**
5540   * Retrieve the fallback Navigation.
5541   *
5542   * @param state Data state.
5543   * @return The ID for the fallback Navigation post.
5544   */
5545  function getNavigationFallbackId(state) {
5546    return state.navigationFallbackId;
5547  }
5548  const getBlockPatternsForPostType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, postType) => select(STORE_NAME).getBlockPatterns().filter(({
5549    postTypes
5550  }) => !postTypes || Array.isArray(postTypes) && postTypes.includes(postType)), () => [select(STORE_NAME).getBlockPatterns()]));
5551  
5552  /**
5553   * Returns the entity records permissions for the given entity record ids.
5554   */
5555  const getEntityRecordsPermissions = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (0,external_wp_data_namespaceObject.createSelector)((state, kind, name, ids) => {
5556    const normalizedIds = Array.isArray(ids) ? ids : [ids];
5557    return normalizedIds.map(id => ({
5558      delete: select(STORE_NAME).canUser('delete', {
5559        kind,
5560        name,
5561        id
5562      }),
5563      update: select(STORE_NAME).canUser('update', {
5564        kind,
5565        name,
5566        id
5567      })
5568    }));
5569  }, state => [state.userPermissions]));
5570  
5571  /**
5572   * Returns the entity record permissions for the given entity record id.
5573   *
5574   * @param state Data state.
5575   * @param kind  Entity kind.
5576   * @param name  Entity name.
5577   * @param id    Entity record id.
5578   *
5579   * @return The entity record permissions.
5580   */
5581  function getEntityRecordPermissions(state, kind, name, id) {
5582    return getEntityRecordsPermissions(state, kind, name, id)[0];
5583  }
5584  
5585  /**
5586   * Returns the registered post meta fields for a given post type.
5587   *
5588   * @param state    Data state.
5589   * @param postType Post type.
5590   *
5591   * @return Registered post meta fields.
5592   */
5593  function getRegisteredPostMeta(state, postType) {
5594    var _state$registeredPost;
5595    return (_state$registeredPost = state.registeredPostMeta?.[postType]) !== null && _state$registeredPost !== void 0 ? _state$registeredPost : {};
5596  }
5597  
5598  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/private-actions.js
5599  /**
5600   * Returns an action object used in signalling that the registered post meta
5601   * fields for a post type have been received.
5602   *
5603   * @param {string} postType           Post type slug.
5604   * @param {Object} registeredPostMeta Registered post meta.
5605   *
5606   * @return {Object} Action object.
5607   */
5608  function receiveRegisteredPostMeta(postType, registeredPostMeta) {
5609    return {
5610      type: 'RECEIVE_REGISTERED_POST_META',
5611      postType,
5612      registeredPostMeta
5613    };
5614  }
5615  
5616  ;// CONCATENATED MODULE: ./node_modules/camel-case/dist.es2015/index.js
5617  
5618  
5619  function camelCaseTransform(input, index) {
5620      if (index === 0)
5621          return input.toLowerCase();
5622      return pascalCaseTransform(input, index);
5623  }
5624  function camelCaseTransformMerge(input, index) {
5625      if (index === 0)
5626          return input.toLowerCase();
5627      return pascalCaseTransformMerge(input);
5628  }
5629  function camelCase(input, options) {
5630      if (options === void 0) { options = {}; }
5631      return pascalCase(input, __assign({ transform: camelCaseTransform }, options));
5632  }
5633  
5634  ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
5635  const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
5636  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/forward-resolver.js
5637  /**
5638   * Higher-order function which forward the resolution to another resolver with the same arguments.
5639   *
5640   * @param {string} resolverName forwarded resolver.
5641   *
5642   * @return {Function} Enhanced resolver.
5643   */
5644  const forwardResolver = resolverName => (...args) => async ({
5645    resolveSelect
5646  }) => {
5647    await resolveSelect[resolverName](...args);
5648  };
5649  /* harmony default export */ const forward_resolver = (forwardResolver);
5650  
5651  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/fetch/__experimental-fetch-link-suggestions.js
5652  /**
5653   * WordPress dependencies
5654   */
5655  
5656  
5657  
5658  
5659  /**
5660   * Fetches link suggestions from the WordPress API.
5661   *
5662   * WordPress does not support searching multiple tables at once, e.g. posts and terms, so we
5663   * perform multiple queries at the same time and then merge the results together.
5664   *
5665   * @param search
5666   * @param searchOptions
5667   * @param editorSettings
5668   *
5669   * @example
5670   * ```js
5671   * import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';
5672   *
5673   * //...
5674   *
5675   * export function initialize( id, settings ) {
5676   *
5677   * settings.__experimentalFetchLinkSuggestions = (
5678   *     search,
5679   *     searchOptions
5680   * ) => fetchLinkSuggestions( search, searchOptions, settings );
5681   * ```
5682   */
5683  async function fetchLinkSuggestions(search, searchOptions = {}, editorSettings = {}) {
5684    const searchOptionsToUse = searchOptions.isInitialSuggestions && searchOptions.initialSuggestionsSearchOptions ? {
5685      ...searchOptions,
5686      ...searchOptions.initialSuggestionsSearchOptions
5687    } : searchOptions;
5688    const {
5689      type,
5690      subtype,
5691      page,
5692      perPage = searchOptions.isInitialSuggestions ? 3 : 20
5693    } = searchOptionsToUse;
5694    const {
5695      disablePostFormats = false
5696    } = editorSettings;
5697    const queries = [];
5698    if (!type || type === 'post') {
5699      queries.push(external_wp_apiFetch_default()({
5700        path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', {
5701          search,
5702          page,
5703          per_page: perPage,
5704          type: 'post',
5705          subtype
5706        })
5707      }).then(results => {
5708        return results.map(result => {
5709          return {
5710            id: result.id,
5711            url: result.url,
5712            title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
5713            type: result.subtype || result.type,
5714            kind: 'post-type'
5715          };
5716        });
5717      }).catch(() => []) // Fail by returning no results.
5718      );
5719    }
5720    if (!type || type === 'term') {
5721      queries.push(external_wp_apiFetch_default()({
5722        path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', {
5723          search,
5724          page,
5725          per_page: perPage,
5726          type: 'term',
5727          subtype
5728        })
5729      }).then(results => {
5730        return results.map(result => {
5731          return {
5732            id: result.id,
5733            url: result.url,
5734            title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
5735            type: result.subtype || result.type,
5736            kind: 'taxonomy'
5737          };
5738        });
5739      }).catch(() => []) // Fail by returning no results.
5740      );
5741    }
5742    if (!disablePostFormats && (!type || type === 'post-format')) {
5743      queries.push(external_wp_apiFetch_default()({
5744        path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/search', {
5745          search,
5746          page,
5747          per_page: perPage,
5748          type: 'post-format',
5749          subtype
5750        })
5751      }).then(results => {
5752        return results.map(result => {
5753          return {
5754            id: result.id,
5755            url: result.url,
5756            title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
5757            type: result.subtype || result.type,
5758            kind: 'taxonomy'
5759          };
5760        });
5761      }).catch(() => []) // Fail by returning no results.
5762      );
5763    }
5764    if (!type || type === 'attachment') {
5765      queries.push(external_wp_apiFetch_default()({
5766        path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/media', {
5767          search,
5768          page,
5769          per_page: perPage
5770        })
5771      }).then(results => {
5772        return results.map(result => {
5773          return {
5774            id: result.id,
5775            url: result.source_url,
5776            title: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(result.title.rendered || '') || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
5777            type: result.type,
5778            kind: 'media'
5779          };
5780        });
5781      }).catch(() => []) // Fail by returning no results.
5782      );
5783    }
5784    const responses = await Promise.all(queries);
5785    let results = responses.flat();
5786    results = results.filter(result => !!result.id);
5787    results = sortResults(results, search);
5788    results = results.slice(0, perPage);
5789    return results;
5790  }
5791  
5792  /**
5793   * Sort search results by relevance to the given query.
5794   *
5795   * Sorting is necessary as we're querying multiple endpoints and merging the results. For example
5796   * a taxonomy title might be more relevant than a post title, but by default taxonomy results will
5797   * be ordered after all the (potentially irrelevant) post results.
5798   *
5799   * We sort by scoring each result, where the score is the number of tokens in the title that are
5800   * also in the search query, divided by the total number of tokens in the title. This gives us a
5801   * score between 0 and 1, where 1 is a perfect match.
5802   *
5803   * @param results
5804   * @param search
5805   */
5806  function sortResults(results, search) {
5807    const searchTokens = tokenize(search);
5808    const scores = {};
5809    for (const result of results) {
5810      if (result.title) {
5811        const titleTokens = tokenize(result.title);
5812        const matchingTokens = titleTokens.filter(titleToken => searchTokens.some(searchToken => titleToken.includes(searchToken)));
5813        scores[result.id] = matchingTokens.length / titleTokens.length;
5814      } else {
5815        scores[result.id] = 0;
5816      }
5817    }
5818    return results.sort((a, b) => scores[b.id] - scores[a.id]);
5819  }
5820  
5821  /**
5822   * Turns text into an array of tokens, with whitespace and punctuation removed.
5823   *
5824   * For example, `"I'm having a ball."` becomes `[ "im", "having", "a", "ball" ]`.
5825   *
5826   * @param text
5827   */
5828  function tokenize(text) {
5829    // \p{L} matches any kind of letter from any language.
5830    // \p{N} matches any kind of numeric character.
5831    return text.toLowerCase().match(/[\p{L}\p{N}]+/gu) || [];
5832  }
5833  
5834  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/fetch/__experimental-fetch-url-data.js
5835  /**
5836   * WordPress dependencies
5837   */
5838  
5839  
5840  
5841  /**
5842   * A simple in-memory cache for requests.
5843   * This avoids repeat HTTP requests which may be beneficial
5844   * for those wishing to preserve low-bandwidth.
5845   */
5846  const CACHE = new Map();
5847  
5848  /**
5849   * @typedef WPRemoteUrlData
5850   *
5851   * @property {string} title contents of the remote URL's `<title>` tag.
5852   */
5853  
5854  /**
5855   * Fetches data about a remote URL.
5856   * eg: <title> tag, favicon...etc.
5857   *
5858   * @async
5859   * @param {string}  url     the URL to request details from.
5860   * @param {Object?} options any options to pass to the underlying fetch.
5861   * @example
5862   * ```js
5863   * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
5864   *
5865   * //...
5866   *
5867   * export function initialize( id, settings ) {
5868   *
5869   * settings.__experimentalFetchUrlData = (
5870   * url
5871   * ) => fetchUrlData( url );
5872   * ```
5873   * @return {Promise< WPRemoteUrlData[] >} Remote URL data.
5874   */
5875  const fetchUrlData = async (url, options = {}) => {
5876    const endpoint = '/wp-block-editor/v1/url-details';
5877    const args = {
5878      url: (0,external_wp_url_namespaceObject.prependHTTP)(url)
5879    };
5880    if (!(0,external_wp_url_namespaceObject.isURL)(url)) {
5881      return Promise.reject(`$url} is not a valid URL.`);
5882    }
5883  
5884    // Test for "http" based URL as it is possible for valid
5885    // yet unusable URLs such as `tel:123456` to be passed.
5886    const protocol = (0,external_wp_url_namespaceObject.getProtocol)(url);
5887    if (!protocol || !(0,external_wp_url_namespaceObject.isValidProtocol)(protocol) || !protocol.startsWith('http') || !/^https?:\/\/[^\/\s]/i.test(url)) {
5888      return Promise.reject(`$url} does not have a valid protocol. URLs must be "http" based`);
5889    }
5890    if (CACHE.has(url)) {
5891      return CACHE.get(url);
5892    }
5893    return external_wp_apiFetch_default()({
5894      path: (0,external_wp_url_namespaceObject.addQueryArgs)(endpoint, args),
5895      ...options
5896    }).then(res => {
5897      CACHE.set(url, res);
5898      return res;
5899    });
5900  };
5901  /* harmony default export */ const _experimental_fetch_url_data = (fetchUrlData);
5902  
5903  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/fetch/index.js
5904  /**
5905   * External dependencies
5906   */
5907  
5908  
5909  /**
5910   * WordPress dependencies
5911   */
5912  
5913  
5914  
5915  async function fetchBlockPatterns() {
5916    const restPatterns = await external_wp_apiFetch_default()({
5917      path: '/wp/v2/block-patterns/patterns'
5918    });
5919    if (!restPatterns) {
5920      return [];
5921    }
5922    return restPatterns.map(pattern => Object.fromEntries(Object.entries(pattern).map(([key, value]) => [camelCase(key), value])));
5923  }
5924  
5925  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/resolvers.js
5926  /**
5927   * External dependencies
5928   */
5929  
5930  
5931  /**
5932   * WordPress dependencies
5933   */
5934  
5935  
5936  
5937  
5938  /**
5939   * Internal dependencies
5940   */
5941  
5942  
5943  
5944  
5945  
5946  
5947  /**
5948   * Requests authors from the REST API.
5949   *
5950   * @param {Object|undefined} query Optional object of query parameters to
5951   *                                 include with request.
5952   */
5953  const resolvers_getAuthors = query => async ({
5954    dispatch
5955  }) => {
5956    const path = (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/users/?who=authors&per_page=100', query);
5957    const users = await external_wp_apiFetch_default()({
5958      path
5959    });
5960    dispatch.receiveUserQuery(path, users);
5961  };
5962  
5963  /**
5964   * Requests the current user from the REST API.
5965   */
5966  const resolvers_getCurrentUser = () => async ({
5967    dispatch
5968  }) => {
5969    const currentUser = await external_wp_apiFetch_default()({
5970      path: '/wp/v2/users/me'
5971    });
5972    dispatch.receiveCurrentUser(currentUser);
5973  };
5974  
5975  /**
5976   * Requests an entity's record from the REST API.
5977   *
5978   * @param {string}           kind  Entity kind.
5979   * @param {string}           name  Entity name.
5980   * @param {number|string}    key   Record's key
5981   * @param {Object|undefined} query Optional object of query parameters to
5982   *                                 include with request. If requesting specific
5983   *                                 fields, fields must always include the ID.
5984   */
5985  const resolvers_getEntityRecord = (kind, name, key = '', query) => async ({
5986    select,
5987    dispatch,
5988    registry
5989  }) => {
5990    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
5991    const entityConfig = configs.find(config => config.name === name && config.kind === kind);
5992    if (!entityConfig) {
5993      return;
5994    }
5995    const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name, key], {
5996      exclusive: false
5997    });
5998    try {
5999      // Entity supports configs,
6000      // use the sync algorithm instead of the old fetch behavior.
6001      if (window.__experimentalEnableSync && entityConfig.syncConfig && !query) {
6002        if (false) {}
6003      } else {
6004        if (query !== undefined && query._fields) {
6005          // If requesting specific fields, items and query association to said
6006          // records are stored by ID reference. Thus, fields must always include
6007          // the ID.
6008          query = {
6009            ...query,
6010            _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.key || DEFAULT_ENTITY_KEY])].join()
6011          };
6012        }
6013  
6014        // Disable reason: While true that an early return could leave `path`
6015        // unused, it's important that path is derived using the query prior to
6016        // additional query modifications in the condition below, since those
6017        // modifications are relevant to how the data is tracked in state, and not
6018        // for how the request is made to the REST API.
6019  
6020        // eslint-disable-next-line @wordpress/no-unused-vars-before-return
6021        const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.baseURL + (key ? '/' + key : ''), {
6022          ...entityConfig.baseURLParams,
6023          ...query
6024        });
6025        if (query !== undefined && query._fields) {
6026          query = {
6027            ...query,
6028            include: [key]
6029          };
6030  
6031          // The resolution cache won't consider query as reusable based on the
6032          // fields, so it's tested here, prior to initiating the REST request,
6033          // and without causing `getEntityRecords` resolution to occur.
6034          const hasRecords = select.hasEntityRecords(kind, name, query);
6035          if (hasRecords) {
6036            return;
6037          }
6038        }
6039        const response = await external_wp_apiFetch_default()({
6040          path,
6041          parse: false
6042        });
6043        const record = await response.json();
6044        const permissions = getUserPermissionsFromAllowHeader(response.headers?.get('allow'));
6045        const canUserResolutionsArgs = [];
6046        const receiveUserPermissionArgs = {};
6047        for (const action of ALLOWED_RESOURCE_ACTIONS) {
6048          receiveUserPermissionArgs[getUserPermissionCacheKey(action, {
6049            kind,
6050            name,
6051            id: key
6052          })] = permissions[action];
6053          canUserResolutionsArgs.push([action, {
6054            kind,
6055            name,
6056            id: key
6057          }]);
6058        }
6059        registry.batch(() => {
6060          dispatch.receiveEntityRecords(kind, name, record, query);
6061          dispatch.receiveUserPermissions(receiveUserPermissionArgs);
6062          dispatch.finishResolutions('canUser', canUserResolutionsArgs);
6063        });
6064      }
6065    } finally {
6066      dispatch.__unstableReleaseStoreLock(lock);
6067    }
6068  };
6069  
6070  /**
6071   * Requests an entity's record from the REST API.
6072   */
6073  const resolvers_getRawEntityRecord = forward_resolver('getEntityRecord');
6074  
6075  /**
6076   * Requests an entity's record from the REST API.
6077   */
6078  const resolvers_getEditedEntityRecord = forward_resolver('getEntityRecord');
6079  
6080  /**
6081   * Requests the entity's records from the REST API.
6082   *
6083   * @param {string}  kind  Entity kind.
6084   * @param {string}  name  Entity name.
6085   * @param {Object?} query Query Object. If requesting specific fields, fields
6086   *                        must always include the ID.
6087   */
6088  const resolvers_getEntityRecords = (kind, name, query = {}) => async ({
6089    dispatch,
6090    registry
6091  }) => {
6092    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
6093    const entityConfig = configs.find(config => config.name === name && config.kind === kind);
6094    if (!entityConfig) {
6095      return;
6096    }
6097    const lock = await dispatch.__unstableAcquireStoreLock(STORE_NAME, ['entities', 'records', kind, name], {
6098      exclusive: false
6099    });
6100    try {
6101      if (query._fields) {
6102        // If requesting specific fields, items and query association to said
6103        // records are stored by ID reference. Thus, fields must always include
6104        // the ID.
6105        query = {
6106          ...query,
6107          _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.key || DEFAULT_ENTITY_KEY])].join()
6108        };
6109      }
6110      const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.baseURL, {
6111        ...entityConfig.baseURLParams,
6112        ...query
6113      });
6114      let records, meta;
6115      if (entityConfig.supportsPagination && query.per_page !== -1) {
6116        const response = await external_wp_apiFetch_default()({
6117          path,
6118          parse: false
6119        });
6120        records = Object.values(await response.json());
6121        meta = {
6122          totalItems: parseInt(response.headers.get('X-WP-Total')),
6123          totalPages: parseInt(response.headers.get('X-WP-TotalPages'))
6124        };
6125      } else {
6126        records = Object.values(await external_wp_apiFetch_default()({
6127          path
6128        }));
6129        meta = {
6130          totalItems: records.length,
6131          totalPages: 1
6132        };
6133      }
6134  
6135      // If we request fields but the result doesn't contain the fields,
6136      // explicitly set these fields as "undefined"
6137      // that way we consider the query "fulfilled".
6138      if (query._fields) {
6139        records = records.map(record => {
6140          query._fields.split(',').forEach(field => {
6141            if (!record.hasOwnProperty(field)) {
6142              record[field] = undefined;
6143            }
6144          });
6145          return record;
6146        });
6147      }
6148      registry.batch(() => {
6149        dispatch.receiveEntityRecords(kind, name, records, query, false, undefined, meta);
6150  
6151        // When requesting all fields, the list of results can be used to resolve
6152        // the `getEntityRecord` and `canUser` selectors in addition to `getEntityRecords`.
6153        // See https://github.com/WordPress/gutenberg/pull/26575
6154        // See https://github.com/WordPress/gutenberg/pull/64504
6155        if (!query?._fields && !query.context) {
6156          const key = entityConfig.key || DEFAULT_ENTITY_KEY;
6157          const resolutionsArgs = records.filter(record => record?.[key]).map(record => [kind, name, record[key]]);
6158          const targetHints = records.filter(record => record?.[key]).map(record => ({
6159            id: record[key],
6160            permissions: getUserPermissionsFromAllowHeader(record?._links?.self?.[0].targetHints.allow)
6161          }));
6162          const canUserResolutionsArgs = [];
6163          const receiveUserPermissionArgs = {};
6164          for (const targetHint of targetHints) {
6165            for (const action of ALLOWED_RESOURCE_ACTIONS) {
6166              canUserResolutionsArgs.push([action, {
6167                kind,
6168                name,
6169                id: targetHint.id
6170              }]);
6171              receiveUserPermissionArgs[getUserPermissionCacheKey(action, {
6172                kind,
6173                name,
6174                id: targetHint.id
6175              })] = targetHint.permissions[action];
6176            }
6177          }
6178          dispatch.receiveUserPermissions(receiveUserPermissionArgs);
6179          dispatch.finishResolutions('getEntityRecord', resolutionsArgs);
6180          dispatch.finishResolutions('canUser', canUserResolutionsArgs);
6181        }
6182        dispatch.__unstableReleaseStoreLock(lock);
6183      });
6184    } catch (e) {
6185      dispatch.__unstableReleaseStoreLock(lock);
6186    }
6187  };
6188  resolvers_getEntityRecords.shouldInvalidate = (action, kind, name) => {
6189    return (action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS') && action.invalidateCache && kind === action.kind && name === action.name;
6190  };
6191  
6192  /**
6193   * Requests the current theme.
6194   */
6195  const resolvers_getCurrentTheme = () => async ({
6196    dispatch,
6197    resolveSelect
6198  }) => {
6199    const activeThemes = await resolveSelect.getEntityRecords('root', 'theme', {
6200      status: 'active'
6201    });
6202    dispatch.receiveCurrentTheme(activeThemes[0]);
6203  };
6204  
6205  /**
6206   * Requests theme supports data from the index.
6207   */
6208  const resolvers_getThemeSupports = forward_resolver('getCurrentTheme');
6209  
6210  /**
6211   * Requests a preview from the Embed API.
6212   *
6213   * @param {string} url URL to get the preview for.
6214   */
6215  const resolvers_getEmbedPreview = url => async ({
6216    dispatch
6217  }) => {
6218    try {
6219      const embedProxyResponse = await external_wp_apiFetch_default()({
6220        path: (0,external_wp_url_namespaceObject.addQueryArgs)('/oembed/1.0/proxy', {
6221          url
6222        })
6223      });
6224      dispatch.receiveEmbedPreview(url, embedProxyResponse);
6225    } catch (error) {
6226      // Embed API 404s if the URL cannot be embedded, so we have to catch the error from the apiRequest here.
6227      dispatch.receiveEmbedPreview(url, false);
6228    }
6229  };
6230  
6231  /**
6232   * Checks whether the current user can perform the given action on the given
6233   * REST resource.
6234   *
6235   * @param {string}        requestedAction Action to check. One of: 'create', 'read', 'update',
6236   *                                        'delete'.
6237   * @param {string|Object} resource        Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`
6238   *                                        or REST base as a string - `media`.
6239   * @param {?string}       id              ID of the rest resource to check.
6240   */
6241  const resolvers_canUser = (requestedAction, resource, id) => async ({
6242    dispatch,
6243    registry
6244  }) => {
6245    if (!ALLOWED_RESOURCE_ACTIONS.includes(requestedAction)) {
6246      throw new Error(`'$requestedAction}' is not a valid action.`);
6247    }
6248    let resourcePath = null;
6249    if (typeof resource === 'object') {
6250      if (!resource.kind || !resource.name) {
6251        throw new Error('The entity resource object is not valid.');
6252      }
6253      const configs = await dispatch(getOrLoadEntitiesConfig(resource.kind, resource.name));
6254      const entityConfig = configs.find(config => config.name === resource.name && config.kind === resource.kind);
6255      if (!entityConfig) {
6256        return;
6257      }
6258      resourcePath = entityConfig.baseURL + (resource.id ? '/' + resource.id : '');
6259    } else {
6260      resourcePath = `/wp/v2/$resource}` + (id ? '/' + id : '');
6261    }
6262    const {
6263      hasStartedResolution
6264    } = registry.select(STORE_NAME);
6265  
6266    // Prevent resolving the same resource twice.
6267    for (const relatedAction of ALLOWED_RESOURCE_ACTIONS) {
6268      if (relatedAction === requestedAction) {
6269        continue;
6270      }
6271      const isAlreadyResolving = hasStartedResolution('canUser', [relatedAction, resource, id]);
6272      if (isAlreadyResolving) {
6273        return;
6274      }
6275    }
6276    let response;
6277    try {
6278      response = await external_wp_apiFetch_default()({
6279        path: resourcePath,
6280        method: 'OPTIONS',
6281        parse: false
6282      });
6283    } catch (error) {
6284      // Do nothing if our OPTIONS request comes back with an API error (4xx or
6285      // 5xx). The previously determined isAllowed value will remain in the store.
6286      return;
6287    }
6288  
6289    // Optional chaining operator is used here because the API requests don't
6290    // return the expected result in the React native version. Instead, API requests
6291    // only return the result, without including response properties like the headers.
6292    const permissions = getUserPermissionsFromAllowHeader(response.headers?.get('allow'));
6293    registry.batch(() => {
6294      for (const action of ALLOWED_RESOURCE_ACTIONS) {
6295        const key = getUserPermissionCacheKey(action, resource, id);
6296        dispatch.receiveUserPermission(key, permissions[action]);
6297  
6298        // Mark related action resolutions as finished.
6299        if (action !== requestedAction) {
6300          dispatch.finishResolution('canUser', [action, resource, id]);
6301        }
6302      }
6303    });
6304  };
6305  
6306  /**
6307   * Checks whether the current user can perform the given action on the given
6308   * REST resource.
6309   *
6310   * @param {string}        kind     Entity kind.
6311   * @param {string}        name     Entity name.
6312   * @param {number|string} recordId Record's id.
6313   */
6314  const resolvers_canUserEditEntityRecord = (kind, name, recordId) => async ({
6315    dispatch
6316  }) => {
6317    await dispatch(resolvers_canUser('update', {
6318      kind,
6319      name,
6320      id: recordId
6321    }));
6322  };
6323  
6324  /**
6325   * Request autosave data from the REST API.
6326   *
6327   * @param {string} postType The type of the parent post.
6328   * @param {number} postId   The id of the parent post.
6329   */
6330  const resolvers_getAutosaves = (postType, postId) => async ({
6331    dispatch,
6332    resolveSelect
6333  }) => {
6334    const {
6335      rest_base: restBase,
6336      rest_namespace: restNamespace = 'wp/v2'
6337    } = await resolveSelect.getPostType(postType);
6338    const autosaves = await external_wp_apiFetch_default()({
6339      path: `/$restNamespace}/$restBase}/$postId}/autosaves?context=edit`
6340    });
6341    if (autosaves && autosaves.length) {
6342      dispatch.receiveAutosaves(postId, autosaves);
6343    }
6344  };
6345  
6346  /**
6347   * Request autosave data from the REST API.
6348   *
6349   * This resolver exists to ensure the underlying autosaves are fetched via
6350   * `getAutosaves` when a call to the `getAutosave` selector is made.
6351   *
6352   * @param {string} postType The type of the parent post.
6353   * @param {number} postId   The id of the parent post.
6354   */
6355  const resolvers_getAutosave = (postType, postId) => async ({
6356    resolveSelect
6357  }) => {
6358    await resolveSelect.getAutosaves(postType, postId);
6359  };
6360  
6361  /**
6362   * Retrieve the frontend template used for a given link.
6363   *
6364   * @param {string} link Link.
6365   */
6366  const resolvers_experimentalGetTemplateForLink = link => async ({
6367    dispatch,
6368    resolveSelect
6369  }) => {
6370    let template;
6371    try {
6372      // This is NOT calling a REST endpoint but rather ends up with a response from
6373      // an Ajax function which has a different shape from a WP_REST_Response.
6374      template = await external_wp_apiFetch_default()({
6375        url: (0,external_wp_url_namespaceObject.addQueryArgs)(link, {
6376          '_wp-find-template': true
6377        })
6378      }).then(({
6379        data
6380      }) => data);
6381    } catch (e) {
6382      // For non-FSE themes, it is possible that this request returns an error.
6383    }
6384    if (!template) {
6385      return;
6386    }
6387    const record = await resolveSelect.getEntityRecord('postType', 'wp_template', template.id);
6388    if (record) {
6389      dispatch.receiveEntityRecords('postType', 'wp_template', [record], {
6390        'find-template': link
6391      });
6392    }
6393  };
6394  resolvers_experimentalGetTemplateForLink.shouldInvalidate = action => {
6395    return (action.type === 'RECEIVE_ITEMS' || action.type === 'REMOVE_ITEMS') && action.invalidateCache && action.kind === 'postType' && action.name === 'wp_template';
6396  };
6397  const resolvers_experimentalGetCurrentGlobalStylesId = () => async ({
6398    dispatch,
6399    resolveSelect
6400  }) => {
6401    const activeThemes = await resolveSelect.getEntityRecords('root', 'theme', {
6402      status: 'active'
6403    });
6404    const globalStylesURL = activeThemes?.[0]?._links?.['wp:user-global-styles']?.[0]?.href;
6405    if (!globalStylesURL) {
6406      return;
6407    }
6408  
6409    // Regex matches the ID at the end of a URL or immediately before
6410    // the query string.
6411    const matches = globalStylesURL.match(/\/(\d+)(?:\?|$)/);
6412    const id = matches ? Number(matches[1]) : null;
6413    if (id) {
6414      dispatch.__experimentalReceiveCurrentGlobalStylesId(id);
6415    }
6416  };
6417  const resolvers_experimentalGetCurrentThemeBaseGlobalStyles = () => async ({
6418    resolveSelect,
6419    dispatch
6420  }) => {
6421    const currentTheme = await resolveSelect.getCurrentTheme();
6422    // Please adjust the preloaded requests if this changes!
6423    const themeGlobalStyles = await external_wp_apiFetch_default()({
6424      path: `/wp/v2/global-styles/themes/$currentTheme.stylesheet}?context=view`
6425    });
6426    dispatch.__experimentalReceiveThemeBaseGlobalStyles(currentTheme.stylesheet, themeGlobalStyles);
6427  };
6428  const resolvers_experimentalGetCurrentThemeGlobalStylesVariations = () => async ({
6429    resolveSelect,
6430    dispatch
6431  }) => {
6432    const currentTheme = await resolveSelect.getCurrentTheme();
6433    // Please adjust the preloaded requests if this changes!
6434    const variations = await external_wp_apiFetch_default()({
6435      path: `/wp/v2/global-styles/themes/$currentTheme.stylesheet}/variations?context=view`
6436    });
6437    dispatch.__experimentalReceiveThemeGlobalStyleVariations(currentTheme.stylesheet, variations);
6438  };
6439  
6440  /**
6441   * Fetches and returns the revisions of the current global styles theme.
6442   */
6443  const resolvers_getCurrentThemeGlobalStylesRevisions = () => async ({
6444    resolveSelect,
6445    dispatch
6446  }) => {
6447    const globalStylesId = await resolveSelect.__experimentalGetCurrentGlobalStylesId();
6448    const record = globalStylesId ? await resolveSelect.getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
6449    const revisionsURL = record?._links?.['version-history']?.[0]?.href;
6450    if (revisionsURL) {
6451      const resetRevisions = await external_wp_apiFetch_default()({
6452        url: revisionsURL
6453      });
6454      const revisions = resetRevisions?.map(revision => Object.fromEntries(Object.entries(revision).map(([key, value]) => [camelCase(key), value])));
6455      dispatch.receiveThemeGlobalStyleRevisions(globalStylesId, revisions);
6456    }
6457  };
6458  resolvers_getCurrentThemeGlobalStylesRevisions.shouldInvalidate = action => {
6459    return action.type === 'SAVE_ENTITY_RECORD_FINISH' && action.kind === 'root' && !action.error && action.name === 'globalStyles';
6460  };
6461  const resolvers_getBlockPatterns = () => async ({
6462    dispatch
6463  }) => {
6464    const patterns = await fetchBlockPatterns();
6465    dispatch({
6466      type: 'RECEIVE_BLOCK_PATTERNS',
6467      patterns
6468    });
6469  };
6470  const resolvers_getBlockPatternCategories = () => async ({
6471    dispatch
6472  }) => {
6473    const categories = await external_wp_apiFetch_default()({
6474      path: '/wp/v2/block-patterns/categories'
6475    });
6476    dispatch({
6477      type: 'RECEIVE_BLOCK_PATTERN_CATEGORIES',
6478      categories
6479    });
6480  };
6481  const resolvers_getUserPatternCategories = () => async ({
6482    dispatch,
6483    resolveSelect
6484  }) => {
6485    const patternCategories = await resolveSelect.getEntityRecords('taxonomy', 'wp_pattern_category', {
6486      per_page: -1,
6487      _fields: 'id,name,description,slug',
6488      context: 'view'
6489    });
6490    const mappedPatternCategories = patternCategories?.map(userCategory => ({
6491      ...userCategory,
6492      label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(userCategory.name),
6493      name: userCategory.slug
6494    })) || [];
6495    dispatch({
6496      type: 'RECEIVE_USER_PATTERN_CATEGORIES',
6497      patternCategories: mappedPatternCategories
6498    });
6499  };
6500  const resolvers_getNavigationFallbackId = () => async ({
6501    dispatch,
6502    select,
6503    registry
6504  }) => {
6505    const fallback = await external_wp_apiFetch_default()({
6506      path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp-block-editor/v1/navigation-fallback', {
6507        _embed: true
6508      })
6509    });
6510    const record = fallback?._embedded?.self;
6511    registry.batch(() => {
6512      dispatch.receiveNavigationFallbackId(fallback?.id);
6513      if (!record) {
6514        return;
6515      }
6516  
6517      // If the fallback is already in the store, don't invalidate navigation queries.
6518      // Otherwise, invalidate the cache for the scenario where there were no Navigation
6519      // posts in the state and the fallback created one.
6520      const existingFallbackEntityRecord = select.getEntityRecord('postType', 'wp_navigation', fallback.id);
6521      const invalidateNavigationQueries = !existingFallbackEntityRecord;
6522      dispatch.receiveEntityRecords('postType', 'wp_navigation', record, undefined, invalidateNavigationQueries);
6523  
6524      // Resolve to avoid further network requests.
6525      dispatch.finishResolution('getEntityRecord', ['postType', 'wp_navigation', fallback.id]);
6526    });
6527  };
6528  const resolvers_getDefaultTemplateId = query => async ({
6529    dispatch
6530  }) => {
6531    const template = await external_wp_apiFetch_default()({
6532      path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/templates/lookup', query)
6533    });
6534    // Endpoint may return an empty object if no template is found.
6535    if (template?.id) {
6536      dispatch.receiveDefaultTemplateId(query, template.id);
6537    }
6538  };
6539  
6540  /**
6541   * Requests an entity's revisions from the REST API.
6542   *
6543   * @param {string}           kind      Entity kind.
6544   * @param {string}           name      Entity name.
6545   * @param {number|string}    recordKey The key of the entity record whose revisions you want to fetch.
6546   * @param {Object|undefined} query     Optional object of query parameters to
6547   *                                     include with request. If requesting specific
6548   *                                     fields, fields must always include the ID.
6549   */
6550  const resolvers_getRevisions = (kind, name, recordKey, query = {}) => async ({
6551    dispatch,
6552    registry
6553  }) => {
6554    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
6555    const entityConfig = configs.find(config => config.name === name && config.kind === kind);
6556    if (!entityConfig) {
6557      return;
6558    }
6559    if (query._fields) {
6560      // If requesting specific fields, items and query association to said
6561      // records are stored by ID reference. Thus, fields must always include
6562      // the ID.
6563      query = {
6564        ...query,
6565        _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.revisionKey || DEFAULT_ENTITY_KEY])].join()
6566      };
6567    }
6568    const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.getRevisionsUrl(recordKey), query);
6569    let records, response;
6570    const meta = {};
6571    const isPaginated = entityConfig.supportsPagination && query.per_page !== -1;
6572    try {
6573      response = await external_wp_apiFetch_default()({
6574        path,
6575        parse: !isPaginated
6576      });
6577    } catch (error) {
6578      // Do nothing if our request comes back with an API error.
6579      return;
6580    }
6581    if (response) {
6582      if (isPaginated) {
6583        records = Object.values(await response.json());
6584        meta.totalItems = parseInt(response.headers.get('X-WP-Total'));
6585      } else {
6586        records = Object.values(response);
6587      }
6588  
6589      // If we request fields but the result doesn't contain the fields,
6590      // explicitly set these fields as "undefined"
6591      // that way we consider the query "fulfilled".
6592      if (query._fields) {
6593        records = records.map(record => {
6594          query._fields.split(',').forEach(field => {
6595            if (!record.hasOwnProperty(field)) {
6596              record[field] = undefined;
6597            }
6598          });
6599          return record;
6600        });
6601      }
6602      registry.batch(() => {
6603        dispatch.receiveRevisions(kind, name, recordKey, records, query, false, meta);
6604  
6605        // When requesting all fields, the list of results can be used to
6606        // resolve the `getRevision` selector in addition to `getRevisions`.
6607        if (!query?._fields && !query.context) {
6608          const key = entityConfig.key || DEFAULT_ENTITY_KEY;
6609          const resolutionsArgs = records.filter(record => record[key]).map(record => [kind, name, recordKey, record[key]]);
6610          dispatch.finishResolutions('getRevision', resolutionsArgs);
6611        }
6612      });
6613    }
6614  };
6615  
6616  // Invalidate cache when a new revision is created.
6617  resolvers_getRevisions.shouldInvalidate = (action, kind, name, recordKey) => action.type === 'SAVE_ENTITY_RECORD_FINISH' && name === action.name && kind === action.kind && !action.error && recordKey === action.recordId;
6618  
6619  /**
6620   * Requests a specific Entity revision from the REST API.
6621   *
6622   * @param {string}           kind        Entity kind.
6623   * @param {string}           name        Entity name.
6624   * @param {number|string}    recordKey   The key of the entity record whose revisions you want to fetch.
6625   * @param {number|string}    revisionKey The revision's key.
6626   * @param {Object|undefined} query       Optional object of query parameters to
6627   *                                       include with request. If requesting specific
6628   *                                       fields, fields must always include the ID.
6629   */
6630  const resolvers_getRevision = (kind, name, recordKey, revisionKey, query) => async ({
6631    dispatch
6632  }) => {
6633    const configs = await dispatch(getOrLoadEntitiesConfig(kind, name));
6634    const entityConfig = configs.find(config => config.name === name && config.kind === kind);
6635    if (!entityConfig) {
6636      return;
6637    }
6638    if (query !== undefined && query._fields) {
6639      // If requesting specific fields, items and query association to said
6640      // records are stored by ID reference. Thus, fields must always include
6641      // the ID.
6642      query = {
6643        ...query,
6644        _fields: [...new Set([...(get_normalized_comma_separable(query._fields) || []), entityConfig.revisionKey || DEFAULT_ENTITY_KEY])].join()
6645      };
6646    }
6647    const path = (0,external_wp_url_namespaceObject.addQueryArgs)(entityConfig.getRevisionsUrl(recordKey, revisionKey), query);
6648    let record;
6649    try {
6650      record = await external_wp_apiFetch_default()({
6651        path
6652      });
6653    } catch (error) {
6654      // Do nothing if our request comes back with an API error.
6655      return;
6656    }
6657    if (record) {
6658      dispatch.receiveRevisions(kind, name, recordKey, record, query);
6659    }
6660  };
6661  
6662  /**
6663   * Requests a specific post type options from the REST API.
6664   *
6665   * @param {string} postType Post type slug.
6666   */
6667  const resolvers_getRegisteredPostMeta = postType => async ({
6668    dispatch,
6669    resolveSelect
6670  }) => {
6671    let options;
6672    try {
6673      const {
6674        rest_namespace: restNamespace = 'wp/v2',
6675        rest_base: restBase
6676      } = (await resolveSelect.getPostType(postType)) || {};
6677      options = await external_wp_apiFetch_default()({
6678        path: `$restNamespace}/$restBase}/?context=edit`,
6679        method: 'OPTIONS'
6680      });
6681    } catch (error) {
6682      // Do nothing if the request comes back with an API error.
6683      return;
6684    }
6685    if (options) {
6686      dispatch.receiveRegisteredPostMeta(postType, options?.schema?.properties?.meta?.properties);
6687    }
6688  };
6689  
6690  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/locks/utils.js
6691  function deepCopyLocksTreePath(tree, path) {
6692    const newTree = {
6693      ...tree
6694    };
6695    let currentNode = newTree;
6696    for (const branchName of path) {
6697      currentNode.children = {
6698        ...currentNode.children,
6699        [branchName]: {
6700          locks: [],
6701          children: {},
6702          ...currentNode.children[branchName]
6703        }
6704      };
6705      currentNode = currentNode.children[branchName];
6706    }
6707    return newTree;
6708  }
6709  function getNode(tree, path) {
6710    let currentNode = tree;
6711    for (const branchName of path) {
6712      const nextNode = currentNode.children[branchName];
6713      if (!nextNode) {
6714        return null;
6715      }
6716      currentNode = nextNode;
6717    }
6718    return currentNode;
6719  }
6720  function* iteratePath(tree, path) {
6721    let currentNode = tree;
6722    yield currentNode;
6723    for (const branchName of path) {
6724      const nextNode = currentNode.children[branchName];
6725      if (!nextNode) {
6726        break;
6727      }
6728      yield nextNode;
6729      currentNode = nextNode;
6730    }
6731  }
6732  function* iterateDescendants(node) {
6733    const stack = Object.values(node.children);
6734    while (stack.length) {
6735      const childNode = stack.pop();
6736      yield childNode;
6737      stack.push(...Object.values(childNode.children));
6738    }
6739  }
6740  function hasConflictingLock({
6741    exclusive
6742  }, locks) {
6743    if (exclusive && locks.length) {
6744      return true;
6745    }
6746    if (!exclusive && locks.filter(lock => lock.exclusive).length) {
6747      return true;
6748    }
6749    return false;
6750  }
6751  
6752  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/locks/reducer.js
6753  /**
6754   * Internal dependencies
6755   */
6756  
6757  const DEFAULT_STATE = {
6758    requests: [],
6759    tree: {
6760      locks: [],
6761      children: {}
6762    }
6763  };
6764  
6765  /**
6766   * Reducer returning locks.
6767   *
6768   * @param {Object} state  Current state.
6769   * @param {Object} action Dispatched action.
6770   *
6771   * @return {Object} Updated state.
6772   */
6773  function locks(state = DEFAULT_STATE, action) {
6774    switch (action.type) {
6775      case 'ENQUEUE_LOCK_REQUEST':
6776        {
6777          const {
6778            request
6779          } = action;
6780          return {
6781            ...state,
6782            requests: [request, ...state.requests]
6783          };
6784        }
6785      case 'GRANT_LOCK_REQUEST':
6786        {
6787          const {
6788            lock,
6789            request
6790          } = action;
6791          const {
6792            store,
6793            path
6794          } = request;
6795          const storePath = [store, ...path];
6796          const newTree = deepCopyLocksTreePath(state.tree, storePath);
6797          const node = getNode(newTree, storePath);
6798          node.locks = [...node.locks, lock];
6799          return {
6800            ...state,
6801            requests: state.requests.filter(r => r !== request),
6802            tree: newTree
6803          };
6804        }
6805      case 'RELEASE_LOCK':
6806        {
6807          const {
6808            lock
6809          } = action;
6810          const storePath = [lock.store, ...lock.path];
6811          const newTree = deepCopyLocksTreePath(state.tree, storePath);
6812          const node = getNode(newTree, storePath);
6813          node.locks = node.locks.filter(l => l !== lock);
6814          return {
6815            ...state,
6816            tree: newTree
6817          };
6818        }
6819    }
6820    return state;
6821  }
6822  
6823  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/locks/selectors.js
6824  /**
6825   * Internal dependencies
6826   */
6827  
6828  function getPendingLockRequests(state) {
6829    return state.requests;
6830  }
6831  function isLockAvailable(state, store, path, {
6832    exclusive
6833  }) {
6834    const storePath = [store, ...path];
6835    const locks = state.tree;
6836  
6837    // Validate all parents and the node itself
6838    for (const node of iteratePath(locks, storePath)) {
6839      if (hasConflictingLock({
6840        exclusive
6841      }, node.locks)) {
6842        return false;
6843      }
6844    }
6845  
6846    // iteratePath terminates early if path is unreachable, let's
6847    // re-fetch the node and check it exists in the tree.
6848    const node = getNode(locks, storePath);
6849    if (!node) {
6850      return true;
6851    }
6852  
6853    // Validate all nested nodes
6854    for (const descendant of iterateDescendants(node)) {
6855      if (hasConflictingLock({
6856        exclusive
6857      }, descendant.locks)) {
6858        return false;
6859      }
6860    }
6861    return true;
6862  }
6863  
6864  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/locks/engine.js
6865  /**
6866   * Internal dependencies
6867   */
6868  
6869  
6870  function createLocks() {
6871    let state = locks(undefined, {
6872      type: '@@INIT'
6873    });
6874    function processPendingLockRequests() {
6875      for (const request of getPendingLockRequests(state)) {
6876        const {
6877          store,
6878          path,
6879          exclusive,
6880          notifyAcquired
6881        } = request;
6882        if (isLockAvailable(state, store, path, {
6883          exclusive
6884        })) {
6885          const lock = {
6886            store,
6887            path,
6888            exclusive
6889          };
6890          state = locks(state, {
6891            type: 'GRANT_LOCK_REQUEST',
6892            lock,
6893            request
6894          });
6895          notifyAcquired(lock);
6896        }
6897      }
6898    }
6899    function acquire(store, path, exclusive) {
6900      return new Promise(resolve => {
6901        state = locks(state, {
6902          type: 'ENQUEUE_LOCK_REQUEST',
6903          request: {
6904            store,
6905            path,
6906            exclusive,
6907            notifyAcquired: resolve
6908          }
6909        });
6910        processPendingLockRequests();
6911      });
6912    }
6913    function release(lock) {
6914      state = locks(state, {
6915        type: 'RELEASE_LOCK',
6916        lock
6917      });
6918      processPendingLockRequests();
6919    }
6920    return {
6921      acquire,
6922      release
6923    };
6924  }
6925  
6926  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/locks/actions.js
6927  /**
6928   * Internal dependencies
6929   */
6930  
6931  function createLocksActions() {
6932    const locks = createLocks();
6933    function __unstableAcquireStoreLock(store, path, {
6934      exclusive
6935    }) {
6936      return () => locks.acquire(store, path, exclusive);
6937    }
6938    function __unstableReleaseStoreLock(lock) {
6939      return () => locks.release(lock);
6940    }
6941    return {
6942      __unstableAcquireStoreLock,
6943      __unstableReleaseStoreLock
6944    };
6945  }
6946  
6947  ;// CONCATENATED MODULE: external ["wp","privateApis"]
6948  const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"];
6949  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/lock-unlock.js
6950  /**
6951   * WordPress dependencies
6952   */
6953  
6954  const {
6955    lock,
6956    unlock
6957  } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/core-data');
6958  
6959  ;// CONCATENATED MODULE: external ["wp","element"]
6960  const external_wp_element_namespaceObject = window["wp"]["element"];
6961  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/entity-context.js
6962  /**
6963   * WordPress dependencies
6964   */
6965  
6966  const EntityContext = (0,external_wp_element_namespaceObject.createContext)({});
6967  
6968  ;// CONCATENATED MODULE: external "ReactJSXRuntime"
6969  const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
6970  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/entity-provider.js
6971  /**
6972   * WordPress dependencies
6973   */
6974  
6975  
6976  /**
6977   * Internal dependencies
6978   */
6979  
6980  
6981  /**
6982   * Context provider component for providing
6983   * an entity for a specific entity.
6984   *
6985   * @param {Object} props          The component's props.
6986   * @param {string} props.kind     The entity kind.
6987   * @param {string} props.type     The entity name.
6988   * @param {number} props.id       The entity ID.
6989   * @param {*}      props.children The children to wrap.
6990   *
6991   * @return {Object} The provided children, wrapped with
6992   *                   the entity's context provider.
6993   */
6994  
6995  function EntityProvider({
6996    kind,
6997    type: name,
6998    id,
6999    children
7000  }) {
7001    const parent = (0,external_wp_element_namespaceObject.useContext)(EntityContext);
7002    const childContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({
7003      ...parent,
7004      [kind]: {
7005        ...parent?.[kind],
7006        [name]: id
7007      }
7008    }), [parent, kind, name, id]);
7009    return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityContext.Provider, {
7010      value: childContext,
7011      children: children
7012    });
7013  }
7014  
7015  ;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
7016  /**
7017   * Memize options object.
7018   *
7019   * @typedef MemizeOptions
7020   *
7021   * @property {number} [maxSize] Maximum size of the cache.
7022   */
7023  
7024  /**
7025   * Internal cache entry.
7026   *
7027   * @typedef MemizeCacheNode
7028   *
7029   * @property {?MemizeCacheNode|undefined} [prev] Previous node.
7030   * @property {?MemizeCacheNode|undefined} [next] Next node.
7031   * @property {Array<*>}                   args   Function arguments for cache
7032   *                                               entry.
7033   * @property {*}                          val    Function result.
7034   */
7035  
7036  /**
7037   * Properties of the enhanced function for controlling cache.
7038   *
7039   * @typedef MemizeMemoizedFunction
7040   *
7041   * @property {()=>void} clear Clear the cache.
7042   */
7043  
7044  /**
7045   * Accepts a function to be memoized, and returns a new memoized function, with
7046   * optional options.
7047   *
7048   * @template {(...args: any[]) => any} F
7049   *
7050   * @param {F}             fn        Function to memoize.
7051   * @param {MemizeOptions} [options] Options object.
7052   *
7053   * @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
7054   */
7055  function memize(fn, options) {
7056      var size = 0;
7057  
7058      /** @type {?MemizeCacheNode|undefined} */
7059      var head;
7060  
7061      /** @type {?MemizeCacheNode|undefined} */
7062      var tail;
7063  
7064      options = options || {};
7065  
7066  	function memoized(/* ...args */) {
7067          var node = head,
7068              len = arguments.length,
7069              args,
7070              i;
7071  
7072          searchCache: while (node) {
7073              // Perform a shallow equality test to confirm that whether the node
7074              // under test is a candidate for the arguments passed. Two arrays
7075              // are shallowly equal if their length matches and each entry is
7076              // strictly equal between the two sets. Avoid abstracting to a
7077              // function which could incur an arguments leaking deoptimization.
7078  
7079              // Check whether node arguments match arguments length
7080              if (node.args.length !== arguments.length) {
7081                  node = node.next;
7082                  continue;
7083              }
7084  
7085              // Check whether node arguments match arguments values
7086              for (i = 0; i < len; i++) {
7087                  if (node.args[i] !== arguments[i]) {
7088                      node = node.next;
7089                      continue searchCache;
7090                  }
7091              }
7092  
7093              // At this point we can assume we've found a match
7094  
7095              // Surface matched node to head if not already
7096              if (node !== head) {
7097                  // As tail, shift to previous. Must only shift if not also
7098                  // head, since if both head and tail, there is no previous.
7099                  if (node === tail) {
7100                      tail = node.prev;
7101                  }
7102  
7103                  // Adjust siblings to point to each other. If node was tail,
7104                  // this also handles new tail's empty `next` assignment.
7105                  /** @type {MemizeCacheNode} */ (node.prev).next = node.next;
7106                  if (node.next) {
7107                      node.next.prev = node.prev;
7108                  }
7109  
7110                  node.next = head;
7111                  node.prev = null;
7112                  /** @type {MemizeCacheNode} */ (head).prev = node;
7113                  head = node;
7114              }
7115  
7116              // Return immediately
7117              return node.val;
7118          }
7119  
7120          // No cached value found. Continue to insertion phase:
7121  
7122          // Create a copy of arguments (avoid leaking deoptimization)
7123          args = new Array(len);
7124          for (i = 0; i < len; i++) {
7125              args[i] = arguments[i];
7126          }
7127  
7128          node = {
7129              args: args,
7130  
7131              // Generate the result from original function
7132              val: fn.apply(null, args),
7133          };
7134  
7135          // Don't need to check whether node is already head, since it would
7136          // have been returned above already if it was
7137  
7138          // Shift existing head down list
7139          if (head) {
7140              head.prev = node;
7141              node.next = head;
7142          } else {
7143              // If no head, follows that there's no tail (at initial or reset)
7144              tail = node;
7145          }
7146  
7147          // Trim tail if we're reached max size and are pending cache insertion
7148          if (size === /** @type {MemizeOptions} */ (options).maxSize) {
7149              tail = /** @type {MemizeCacheNode} */ (tail).prev;
7150              /** @type {MemizeCacheNode} */ (tail).next = null;
7151          } else {
7152              size++;
7153          }
7154  
7155          head = node;
7156  
7157          return node.val;
7158      }
7159  
7160      memoized.clear = function () {
7161          head = null;
7162          tail = null;
7163          size = 0;
7164      };
7165  
7166      // Ignore reason: There's not a clear solution to create an intersection of
7167      // the function with additional properties, where the goal is to retain the
7168      // function signature of the incoming argument and add control properties
7169      // on the return value.
7170  
7171      // @ts-ignore
7172      return memoized;
7173  }
7174  
7175  
7176  
7177  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/memoize.js
7178  /**
7179   * External dependencies
7180   */
7181  
7182  
7183  // re-export due to restrictive esModuleInterop setting
7184  /* harmony default export */ const memoize = (memize);
7185  
7186  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/constants.js
7187  let Status = /*#__PURE__*/function (Status) {
7188    Status["Idle"] = "IDLE";
7189    Status["Resolving"] = "RESOLVING";
7190    Status["Error"] = "ERROR";
7191    Status["Success"] = "SUCCESS";
7192    return Status;
7193  }({});
7194  
7195  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-query-select.js
7196  /**
7197   * WordPress dependencies
7198   */
7199  
7200  
7201  /**
7202   * Internal dependencies
7203   */
7204  
7205  
7206  const META_SELECTORS = ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'];
7207  /**
7208   * Like useSelect, but the selectors return objects containing
7209   * both the original data AND the resolution info.
7210   *
7211   * @since 6.1.0 Introduced in WordPress core.
7212   * @private
7213   *
7214   * @param {Function} mapQuerySelect see useSelect
7215   * @param {Array}    deps           see useSelect
7216   *
7217   * @example
7218   * ```js
7219   * import { useQuerySelect } from '@wordpress/data';
7220   * import { store as coreDataStore } from '@wordpress/core-data';
7221   *
7222   * function PageTitleDisplay( { id } ) {
7223   *   const { data: page, isResolving } = useQuerySelect( ( query ) => {
7224   *     return query( coreDataStore ).getEntityRecord( 'postType', 'page', id )
7225   *   }, [ id ] );
7226   *
7227   *   if ( isResolving ) {
7228   *     return 'Loading...';
7229   *   }
7230   *
7231   *   return page.title;
7232   * }
7233   *
7234   * // Rendered in the application:
7235   * // <PageTitleDisplay id={ 10 } />
7236   * ```
7237   *
7238   * In the above example, when `PageTitleDisplay` is rendered into an
7239   * application, the page and the resolution details will be retrieved from
7240   * the store state using the `mapSelect` callback on `useQuerySelect`.
7241   *
7242   * If the id prop changes then any page in the state for that id is
7243   * retrieved. If the id prop doesn't change and other props are passed in
7244   * that do change, the title will not change because the dependency is just
7245   * the id.
7246   * @see useSelect
7247   *
7248   * @return {QuerySelectResponse} Queried data.
7249   */
7250  function useQuerySelect(mapQuerySelect, deps) {
7251    return (0,external_wp_data_namespaceObject.useSelect)((select, registry) => {
7252      const resolve = store => enrichSelectors(select(store));
7253      return mapQuerySelect(resolve, registry);
7254    }, deps);
7255  }
7256  /**
7257   * Transform simple selectors into ones that return an object with the
7258   * original return value AND the resolution info.
7259   *
7260   * @param {Object} selectors Selectors to enrich
7261   * @return {EnrichedSelectors} Enriched selectors
7262   */
7263  const enrichSelectors = memoize(selectors => {
7264    const resolvers = {};
7265    for (const selectorName in selectors) {
7266      if (META_SELECTORS.includes(selectorName)) {
7267        continue;
7268      }
7269      Object.defineProperty(resolvers, selectorName, {
7270        get: () => (...args) => {
7271          const data = selectors[selectorName](...args);
7272          const resolutionStatus = selectors.getResolutionState(selectorName, args)?.status;
7273          let status;
7274          switch (resolutionStatus) {
7275            case 'resolving':
7276              status = Status.Resolving;
7277              break;
7278            case 'finished':
7279              status = Status.Success;
7280              break;
7281            case 'error':
7282              status = Status.Error;
7283              break;
7284            case undefined:
7285              status = Status.Idle;
7286              break;
7287          }
7288          return {
7289            data,
7290            status,
7291            isResolving: status === Status.Resolving,
7292            hasStarted: status !== Status.Idle,
7293            hasResolved: status === Status.Success || status === Status.Error
7294          };
7295        }
7296      });
7297    }
7298    return resolvers;
7299  });
7300  
7301  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-record.js
7302  /**
7303   * WordPress dependencies
7304   */
7305  
7306  
7307  
7308  
7309  /**
7310   * Internal dependencies
7311   */
7312  
7313  
7314  const use_entity_record_EMPTY_OBJECT = {};
7315  
7316  /**
7317   * Resolves the specified entity record.
7318   *
7319   * @since 6.1.0 Introduced in WordPress core.
7320   *
7321   * @param    kind     Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
7322   * @param    name     Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
7323   * @param    recordId ID of the requested entity record.
7324   * @param    options  Optional hook options.
7325   * @example
7326   * ```js
7327   * import { useEntityRecord } from '@wordpress/core-data';
7328   *
7329   * function PageTitleDisplay( { id } ) {
7330   *   const { record, isResolving } = useEntityRecord( 'postType', 'page', id );
7331   *
7332   *   if ( isResolving ) {
7333   *     return 'Loading...';
7334   *   }
7335   *
7336   *   return record.title;
7337   * }
7338   *
7339   * // Rendered in the application:
7340   * // <PageTitleDisplay id={ 1 } />
7341   * ```
7342   *
7343   * In the above example, when `PageTitleDisplay` is rendered into an
7344   * application, the page and the resolution details will be retrieved from
7345   * the store state using `getEntityRecord()`, or resolved if missing.
7346   *
7347   * @example
7348   * ```js
7349   * import { useCallback } from 'react';
7350   * import { useDispatch } from '@wordpress/data';
7351   * import { __ } from '@wordpress/i18n';
7352   * import { TextControl } from '@wordpress/components';
7353   * import { store as noticeStore } from '@wordpress/notices';
7354   * import { useEntityRecord } from '@wordpress/core-data';
7355   *
7356   * function PageRenameForm( { id } ) {
7357   *     const page = useEntityRecord( 'postType', 'page', id );
7358   *     const { createSuccessNotice, createErrorNotice } =
7359   *         useDispatch( noticeStore );
7360   *
7361   *     const setTitle = useCallback( ( title ) => {
7362   *         page.edit( { title } );
7363   *     }, [ page.edit ] );
7364   *
7365   *     if ( page.isResolving ) {
7366   *         return 'Loading...';
7367   *     }
7368   *
7369   *     async function onRename( event ) {
7370   *         event.preventDefault();
7371   *         try {
7372   *             await page.save();
7373   *             createSuccessNotice( __( 'Page renamed.' ), {
7374   *                 type: 'snackbar',
7375   *             } );
7376   *         } catch ( error ) {
7377   *             createErrorNotice( error.message, { type: 'snackbar' } );
7378   *         }
7379   *     }
7380   *
7381   *     return (
7382   *         <form onSubmit={ onRename }>
7383   *             <TextControl
7384   *                 label={ __( 'Name' ) }
7385   *                 value={ page.editedRecord.title }
7386   *                 onChange={ setTitle }
7387   *             />
7388   *             <button type="submit">{ __( 'Save' ) }</button>
7389   *         </form>
7390   *     );
7391   * }
7392   *
7393   * // Rendered in the application:
7394   * // <PageRenameForm id={ 1 } />
7395   * ```
7396   *
7397   * In the above example, updating and saving the page title is handled
7398   * via the `edit()` and `save()` mutation helpers provided by
7399   * `useEntityRecord()`;
7400   *
7401   * @return Entity record data.
7402   * @template RecordType
7403   */
7404  function useEntityRecord(kind, name, recordId, options = {
7405    enabled: true
7406  }) {
7407    const {
7408      editEntityRecord,
7409      saveEditedEntityRecord
7410    } = (0,external_wp_data_namespaceObject.useDispatch)(store);
7411    const mutations = (0,external_wp_element_namespaceObject.useMemo)(() => ({
7412      edit: (record, editOptions = {}) => editEntityRecord(kind, name, recordId, record, editOptions),
7413      save: (saveOptions = {}) => saveEditedEntityRecord(kind, name, recordId, {
7414        throwOnError: true,
7415        ...saveOptions
7416      })
7417    }), [editEntityRecord, kind, name, recordId, saveEditedEntityRecord]);
7418    const {
7419      editedRecord,
7420      hasEdits,
7421      edits
7422    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7423      if (!options.enabled) {
7424        return {
7425          editedRecord: use_entity_record_EMPTY_OBJECT,
7426          hasEdits: false,
7427          edits: use_entity_record_EMPTY_OBJECT
7428        };
7429      }
7430      return {
7431        editedRecord: select(store).getEditedEntityRecord(kind, name, recordId),
7432        hasEdits: select(store).hasEditsForEntityRecord(kind, name, recordId),
7433        edits: select(store).getEntityRecordNonTransientEdits(kind, name, recordId)
7434      };
7435    }, [kind, name, recordId, options.enabled]);
7436    const {
7437      data: record,
7438      ...querySelectRest
7439    } = useQuerySelect(query => {
7440      if (!options.enabled) {
7441        return {
7442          data: null
7443        };
7444      }
7445      return query(store).getEntityRecord(kind, name, recordId);
7446    }, [kind, name, recordId, options.enabled]);
7447    return {
7448      record,
7449      editedRecord,
7450      hasEdits,
7451      edits,
7452      ...querySelectRest,
7453      ...mutations
7454    };
7455  }
7456  function __experimentalUseEntityRecord(kind, name, recordId, options) {
7457    external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecord`, {
7458      alternative: 'wp.data.useEntityRecord',
7459      since: '6.1'
7460    });
7461    return useEntityRecord(kind, name, recordId, options);
7462  }
7463  
7464  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-records.js
7465  /**
7466   * WordPress dependencies
7467   */
7468  
7469  
7470  
7471  
7472  
7473  /**
7474   * Internal dependencies
7475   */
7476  
7477  
7478  
7479  const EMPTY_ARRAY = [];
7480  
7481  /**
7482   * Resolves the specified entity records.
7483   *
7484   * @since 6.1.0 Introduced in WordPress core.
7485   *
7486   * @param    kind      Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
7487   * @param    name      Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
7488   * @param    queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.
7489   * @param    options   Optional hook options.
7490   * @example
7491   * ```js
7492   * import { useEntityRecords } from '@wordpress/core-data';
7493   *
7494   * function PageTitlesList() {
7495   *   const { records, isResolving } = useEntityRecords( 'postType', 'page' );
7496   *
7497   *   if ( isResolving ) {
7498   *     return 'Loading...';
7499   *   }
7500   *
7501   *   return (
7502   *     <ul>
7503   *       {records.map(( page ) => (
7504   *         <li>{ page.title }</li>
7505   *       ))}
7506   *     </ul>
7507   *   );
7508   * }
7509   *
7510   * // Rendered in the application:
7511   * // <PageTitlesList />
7512   * ```
7513   *
7514   * In the above example, when `PageTitlesList` is rendered into an
7515   * application, the list of records and the resolution details will be retrieved from
7516   * the store state using `getEntityRecords()`, or resolved if missing.
7517   *
7518   * @return Entity records data.
7519   * @template RecordType
7520   */
7521  function useEntityRecords(kind, name, queryArgs = {}, options = {
7522    enabled: true
7523  }) {
7524    // Serialize queryArgs to a string that can be safely used as a React dep.
7525    // We can't just pass queryArgs as one of the deps, because if it is passed
7526    // as an object literal, then it will be a different object on each call even
7527    // if the values remain the same.
7528    const queryAsString = (0,external_wp_url_namespaceObject.addQueryArgs)('', queryArgs);
7529    const {
7530      data: records,
7531      ...rest
7532    } = useQuerySelect(query => {
7533      if (!options.enabled) {
7534        return {
7535          // Avoiding returning a new reference on every execution.
7536          data: EMPTY_ARRAY
7537        };
7538      }
7539      return query(store).getEntityRecords(kind, name, queryArgs);
7540    }, [kind, name, queryAsString, options.enabled]);
7541    const {
7542      totalItems,
7543      totalPages
7544    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7545      if (!options.enabled) {
7546        return {
7547          totalItems: null,
7548          totalPages: null
7549        };
7550      }
7551      return {
7552        totalItems: select(store).getEntityRecordsTotalItems(kind, name, queryArgs),
7553        totalPages: select(store).getEntityRecordsTotalPages(kind, name, queryArgs)
7554      };
7555    }, [kind, name, queryAsString, options.enabled]);
7556    return {
7557      records,
7558      totalItems,
7559      totalPages,
7560      ...rest
7561    };
7562  }
7563  function __experimentalUseEntityRecords(kind, name, queryArgs, options) {
7564    external_wp_deprecated_default()(`wp.data.__experimentalUseEntityRecords`, {
7565      alternative: 'wp.data.useEntityRecords',
7566      since: '6.1'
7567    });
7568    return useEntityRecords(kind, name, queryArgs, options);
7569  }
7570  function useEntityRecordsWithPermissions(kind, name, queryArgs = {}, options = {
7571    enabled: true
7572  }) {
7573    const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getEntityConfig(kind, name), [kind, name]);
7574    const {
7575      records: data,
7576      ...ret
7577    } = useEntityRecords(kind, name, queryArgs, options);
7578    const ids = (0,external_wp_element_namespaceObject.useMemo)(() => {
7579      var _data$map;
7580      return (_data$map = data?.map(
7581      // @ts-ignore
7582      record => {
7583        var _entityConfig$key;
7584        return record[(_entityConfig$key = entityConfig?.key) !== null && _entityConfig$key !== void 0 ? _entityConfig$key : 'id'];
7585      })) !== null && _data$map !== void 0 ? _data$map : [];
7586    }, [data, entityConfig?.key]);
7587    const permissions = (0,external_wp_data_namespaceObject.useSelect)(select => {
7588      const {
7589        getEntityRecordsPermissions
7590      } = unlock(select(store));
7591      return getEntityRecordsPermissions(kind, name, ids);
7592    }, [ids, kind, name]);
7593    const dataWithPermissions = (0,external_wp_element_namespaceObject.useMemo)(() => {
7594      var _data$map2;
7595      return (_data$map2 = data?.map((record, index) => ({
7596        // @ts-ignore
7597        ...record,
7598        permissions: permissions[index]
7599      }))) !== null && _data$map2 !== void 0 ? _data$map2 : [];
7600    }, [data, permissions]);
7601    return {
7602      records: dataWithPermissions,
7603      ...ret
7604    };
7605  }
7606  
7607  ;// CONCATENATED MODULE: external ["wp","warning"]
7608  const external_wp_warning_namespaceObject = window["wp"]["warning"];
7609  var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
7610  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-resource-permissions.js
7611  /**
7612   * WordPress dependencies
7613   */
7614  
7615  
7616  
7617  /**
7618   * Internal dependencies
7619   */
7620  
7621  
7622  
7623  
7624  /**
7625   * Is the data resolved by now?
7626   */
7627  
7628  /**
7629   * Resolves resource permissions.
7630   *
7631   * @since 6.1.0 Introduced in WordPress core.
7632   *
7633   * @param    resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`
7634   *                    or REST base as a string - `media`.
7635   * @param    id       Optional ID of the resource to check, e.g. 10. Note: This argument is discouraged
7636   *                    when using an entity object as a resource to check permissions and will be ignored.
7637   *
7638   * @example
7639   * ```js
7640   * import { useResourcePermissions } from '@wordpress/core-data';
7641   *
7642   * function PagesList() {
7643   *   const { canCreate, isResolving } = useResourcePermissions( { kind: 'postType', name: 'page' } );
7644   *
7645   *   if ( isResolving ) {
7646   *     return 'Loading ...';
7647   *   }
7648   *
7649   *   return (
7650   *     <div>
7651   *       {canCreate ? (<button>+ Create a new page</button>) : false}
7652   *       // ...
7653   *     </div>
7654   *   );
7655   * }
7656   *
7657   * // Rendered in the application:
7658   * // <PagesList />
7659   * ```
7660   *
7661   * @example
7662   * ```js
7663   * import { useResourcePermissions } from '@wordpress/core-data';
7664   *
7665   * function Page({ pageId }) {
7666   *   const {
7667   *     canCreate,
7668   *     canUpdate,
7669   *     canDelete,
7670   *     isResolving
7671   *   } = useResourcePermissions( { kind: 'postType', name: 'page', id: pageId } );
7672   *
7673   *   if ( isResolving ) {
7674   *     return 'Loading ...';
7675   *   }
7676   *
7677   *   return (
7678   *     <div>
7679   *       {canCreate ? (<button>+ Create a new page</button>) : false}
7680   *       {canUpdate ? (<button>Edit page</button>) : false}
7681   *       {canDelete ? (<button>Delete page</button>) : false}
7682   *       // ...
7683   *     </div>
7684   *   );
7685   * }
7686   *
7687   * // Rendered in the application:
7688   * // <Page pageId={ 15 } />
7689   * ```
7690   *
7691   * In the above example, when `PagesList` is rendered into an
7692   * application, the appropriate permissions and the resolution details will be retrieved from
7693   * the store state using `canUser()`, or resolved if missing.
7694   *
7695   * @return Entity records data.
7696   * @template IdType
7697   */
7698  function useResourcePermissions(resource, id) {
7699    // Serialize `resource` to a string that can be safely used as a React dep.
7700    // We can't just pass `resource` as one of the deps, because if it is passed
7701    // as an object literal, then it will be a different object on each call even
7702    // if the values remain the same.
7703    const isEntity = typeof resource === 'object';
7704    const resourceAsString = isEntity ? JSON.stringify(resource) : resource;
7705    if (isEntity && typeof id !== 'undefined') {
7706       true ? external_wp_warning_default()(`When 'resource' is an entity object, passing 'id' as a separate argument isn't supported.`) : 0;
7707    }
7708    return useQuerySelect(resolve => {
7709      const hasId = isEntity ? !!resource.id : !!id;
7710      const {
7711        canUser
7712      } = resolve(store);
7713      const create = canUser('create', isEntity ? {
7714        kind: resource.kind,
7715        name: resource.name
7716      } : resource);
7717      if (!hasId) {
7718        const read = canUser('read', resource);
7719        const isResolving = create.isResolving || read.isResolving;
7720        const hasResolved = create.hasResolved && read.hasResolved;
7721        let status = Status.Idle;
7722        if (isResolving) {
7723          status = Status.Resolving;
7724        } else if (hasResolved) {
7725          status = Status.Success;
7726        }
7727        return {
7728          status,
7729          isResolving,
7730          hasResolved,
7731          canCreate: create.hasResolved && create.data,
7732          canRead: read.hasResolved && read.data
7733        };
7734      }
7735      const read = canUser('read', resource, id);
7736      const update = canUser('update', resource, id);
7737      const _delete = canUser('delete', resource, id);
7738      const isResolving = read.isResolving || create.isResolving || update.isResolving || _delete.isResolving;
7739      const hasResolved = read.hasResolved && create.hasResolved && update.hasResolved && _delete.hasResolved;
7740      let status = Status.Idle;
7741      if (isResolving) {
7742        status = Status.Resolving;
7743      } else if (hasResolved) {
7744        status = Status.Success;
7745      }
7746      return {
7747        status,
7748        isResolving,
7749        hasResolved,
7750        canRead: hasResolved && read.data,
7751        canCreate: hasResolved && create.data,
7752        canUpdate: hasResolved && update.data,
7753        canDelete: hasResolved && _delete.data
7754      };
7755    }, [resourceAsString, id]);
7756  }
7757  /* harmony default export */ const use_resource_permissions = (useResourcePermissions);
7758  function __experimentalUseResourcePermissions(resource, id) {
7759    external_wp_deprecated_default()(`wp.data.__experimentalUseResourcePermissions`, {
7760      alternative: 'wp.data.useResourcePermissions',
7761      since: '6.1'
7762    });
7763    return useResourcePermissions(resource, id);
7764  }
7765  
7766  ;// CONCATENATED MODULE: external ["wp","blocks"]
7767  const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
7768  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-id.js
7769  /**
7770   * WordPress dependencies
7771   */
7772  
7773  
7774  /**
7775   * Internal dependencies
7776   */
7777  
7778  
7779  /**
7780   * Hook that returns the ID for the nearest
7781   * provided entity of the specified type.
7782   *
7783   * @param {string} kind The entity kind.
7784   * @param {string} name The entity name.
7785   */
7786  function useEntityId(kind, name) {
7787    const context = (0,external_wp_element_namespaceObject.useContext)(EntityContext);
7788    return context?.[kind]?.[name];
7789  }
7790  
7791  ;// CONCATENATED MODULE: external ["wp","blockEditor"]
7792  const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
7793  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/footnotes/get-rich-text-values-cached.js
7794  /**
7795   * WordPress dependencies
7796   */
7797  
7798  
7799  /**
7800   * Internal dependencies
7801   */
7802  
7803  
7804  // TODO: The following line should have been:
7805  //
7806  //   const unlockedApis = unlock( blockEditorPrivateApis );
7807  //
7808  // But there are hidden circular dependencies in RNMobile code, specifically in
7809  // certain native components in the `components` package that depend on
7810  // `block-editor`. What follows is a workaround that defers the `unlock` call
7811  // to prevent native code from failing.
7812  //
7813  // Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed.
7814  let unlockedApis;
7815  const cache = new WeakMap();
7816  function getRichTextValuesCached(block) {
7817    if (!unlockedApis) {
7818      unlockedApis = unlock(external_wp_blockEditor_namespaceObject.privateApis);
7819    }
7820    if (!cache.has(block)) {
7821      const values = unlockedApis.getRichTextValues([block]);
7822      cache.set(block, values);
7823    }
7824    return cache.get(block);
7825  }
7826  
7827  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/footnotes/get-footnotes-order.js
7828  /**
7829   * Internal dependencies
7830   */
7831  
7832  const get_footnotes_order_cache = new WeakMap();
7833  function getBlockFootnotesOrder(block) {
7834    if (!get_footnotes_order_cache.has(block)) {
7835      const order = [];
7836      for (const value of getRichTextValuesCached(block)) {
7837        if (!value) {
7838          continue;
7839        }
7840  
7841        // replacements is a sparse array, use forEach to skip empty slots.
7842        value.replacements.forEach(({
7843          type,
7844          attributes
7845        }) => {
7846          if (type === 'core/footnote') {
7847            order.push(attributes['data-fn']);
7848          }
7849        });
7850      }
7851      get_footnotes_order_cache.set(block, order);
7852    }
7853    return get_footnotes_order_cache.get(block);
7854  }
7855  function getFootnotesOrder(blocks) {
7856    // We can only separate getting order from blocks at the root level. For
7857    // deeper inner blocks, this will not work since it's possible to have both
7858    // inner blocks and block attributes, so order needs to be computed from the
7859    // Edit functions as a whole.
7860    return blocks.flatMap(getBlockFootnotesOrder);
7861  }
7862  
7863  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/footnotes/index.js
7864  /**
7865   * WordPress dependencies
7866   */
7867  
7868  
7869  /**
7870   * Internal dependencies
7871   */
7872  
7873  let oldFootnotes = {};
7874  function updateFootnotesFromMeta(blocks, meta) {
7875    const output = {
7876      blocks
7877    };
7878    if (!meta) {
7879      return output;
7880    }
7881  
7882    // If meta.footnotes is empty, it means the meta is not registered.
7883    if (meta.footnotes === undefined) {
7884      return output;
7885    }
7886    const newOrder = getFootnotesOrder(blocks);
7887    const footnotes = meta.footnotes ? JSON.parse(meta.footnotes) : [];
7888    const currentOrder = footnotes.map(fn => fn.id);
7889    if (currentOrder.join('') === newOrder.join('')) {
7890      return output;
7891    }
7892    const newFootnotes = newOrder.map(fnId => footnotes.find(fn => fn.id === fnId) || oldFootnotes[fnId] || {
7893      id: fnId,
7894      content: ''
7895    });
7896    function updateAttributes(attributes) {
7897      // Only attempt to update attributes, if attributes is an object.
7898      if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') {
7899        return attributes;
7900      }
7901      attributes = {
7902        ...attributes
7903      };
7904      for (const key in attributes) {
7905        const value = attributes[key];
7906        if (Array.isArray(value)) {
7907          attributes[key] = value.map(updateAttributes);
7908          continue;
7909        }
7910  
7911        // To do, remove support for string values?
7912        if (typeof value !== 'string' && !(value instanceof external_wp_richText_namespaceObject.RichTextData)) {
7913          continue;
7914        }
7915        const richTextValue = typeof value === 'string' ? external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value) : new external_wp_richText_namespaceObject.RichTextData(value);
7916        let hasFootnotes = false;
7917        richTextValue.replacements.forEach(replacement => {
7918          if (replacement.type === 'core/footnote') {
7919            const id = replacement.attributes['data-fn'];
7920            const index = newOrder.indexOf(id);
7921            // The innerHTML contains the count wrapped in a link.
7922            const countValue = (0,external_wp_richText_namespaceObject.create)({
7923              html: replacement.innerHTML
7924            });
7925            countValue.text = String(index + 1);
7926            countValue.formats = Array.from({
7927              length: countValue.text.length
7928            }, () => countValue.formats[0]);
7929            countValue.replacements = Array.from({
7930              length: countValue.text.length
7931            }, () => countValue.replacements[0]);
7932            replacement.innerHTML = (0,external_wp_richText_namespaceObject.toHTMLString)({
7933              value: countValue
7934            });
7935            hasFootnotes = true;
7936          }
7937        });
7938        if (hasFootnotes) {
7939          attributes[key] = typeof value === 'string' ? richTextValue.toHTMLString() : richTextValue;
7940        }
7941      }
7942      return attributes;
7943    }
7944    function updateBlocksAttributes(__blocks) {
7945      return __blocks.map(block => {
7946        return {
7947          ...block,
7948          attributes: updateAttributes(block.attributes),
7949          innerBlocks: updateBlocksAttributes(block.innerBlocks)
7950        };
7951      });
7952    }
7953  
7954    // We need to go through all block attributes deeply and update the
7955    // footnote anchor numbering (textContent) to match the new order.
7956    const newBlocks = updateBlocksAttributes(blocks);
7957    oldFootnotes = {
7958      ...oldFootnotes,
7959      ...footnotes.reduce((acc, fn) => {
7960        if (!newOrder.includes(fn.id)) {
7961          acc[fn.id] = fn;
7962        }
7963        return acc;
7964      }, {})
7965    };
7966    return {
7967      meta: {
7968        ...meta,
7969        footnotes: JSON.stringify(newFootnotes)
7970      },
7971      blocks: newBlocks
7972    };
7973  }
7974  
7975  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-block-editor.js
7976  /**
7977   * WordPress dependencies
7978   */
7979  
7980  
7981  
7982  
7983  /**
7984   * Internal dependencies
7985   */
7986  
7987  
7988  
7989  const use_entity_block_editor_EMPTY_ARRAY = [];
7990  const parsedBlocksCache = new WeakMap();
7991  
7992  /**
7993   * Hook that returns block content getters and setters for
7994   * the nearest provided entity of the specified type.
7995   *
7996   * The return value has the shape `[ blocks, onInput, onChange ]`.
7997   * `onInput` is for block changes that don't create undo levels
7998   * or dirty the post, non-persistent changes, and `onChange` is for
7999   * persistent changes. They map directly to the props of a
8000   * `BlockEditorProvider` and are intended to be used with it,
8001   * or similar components or hooks.
8002   *
8003   * @param {string} kind         The entity kind.
8004   * @param {string} name         The entity name.
8005   * @param {Object} options
8006   * @param {string} [options.id] An entity ID to use instead of the context-provided one.
8007   *
8008   * @return {[unknown[], Function, Function]} The block array and setters.
8009   */
8010  function useEntityBlockEditor(kind, name, {
8011    id: _id
8012  } = {}) {
8013    const providerId = useEntityId(kind, name);
8014    const id = _id !== null && _id !== void 0 ? _id : providerId;
8015    const {
8016      getEntityRecord,
8017      getEntityRecordEdits
8018    } = (0,external_wp_data_namespaceObject.useSelect)(STORE_NAME);
8019    const {
8020      content,
8021      editedBlocks,
8022      meta
8023    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8024      if (!id) {
8025        return {};
8026      }
8027      const {
8028        getEditedEntityRecord
8029      } = select(STORE_NAME);
8030      const editedRecord = getEditedEntityRecord(kind, name, id);
8031      return {
8032        editedBlocks: editedRecord.blocks,
8033        content: editedRecord.content,
8034        meta: editedRecord.meta
8035      };
8036    }, [kind, name, id]);
8037    const {
8038      __unstableCreateUndoLevel,
8039      editEntityRecord
8040    } = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME);
8041    const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
8042      if (!id) {
8043        return undefined;
8044      }
8045      if (editedBlocks) {
8046        return editedBlocks;
8047      }
8048      if (!content || typeof content !== 'string') {
8049        return use_entity_block_editor_EMPTY_ARRAY;
8050      }
8051  
8052      // If there's an edit, cache the parsed blocks by the edit.
8053      // If not, cache by the original enity record.
8054      const edits = getEntityRecordEdits(kind, name, id);
8055      const isUnedited = !edits || !Object.keys(edits).length;
8056      const cackeKey = isUnedited ? getEntityRecord(kind, name, id) : edits;
8057      let _blocks = parsedBlocksCache.get(cackeKey);
8058      if (!_blocks) {
8059        _blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
8060        parsedBlocksCache.set(cackeKey, _blocks);
8061      }
8062      return _blocks;
8063    }, [kind, name, id, editedBlocks, content, getEntityRecord, getEntityRecordEdits]);
8064    const updateFootnotes = (0,external_wp_element_namespaceObject.useCallback)(_blocks => updateFootnotesFromMeta(_blocks, meta), [meta]);
8065    const onChange = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => {
8066      const noChange = blocks === newBlocks;
8067      if (noChange) {
8068        return __unstableCreateUndoLevel(kind, name, id);
8069      }
8070      const {
8071        selection,
8072        ...rest
8073      } = options;
8074  
8075      // We create a new function here on every persistent edit
8076      // to make sure the edit makes the post dirty and creates
8077      // a new undo level.
8078      const edits = {
8079        selection,
8080        content: ({
8081          blocks: blocksForSerialization = []
8082        }) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization),
8083        ...updateFootnotes(newBlocks)
8084      };
8085      editEntityRecord(kind, name, id, edits, {
8086        isCached: false,
8087        ...rest
8088      });
8089    }, [kind, name, id, blocks, updateFootnotes, __unstableCreateUndoLevel, editEntityRecord]);
8090    const onInput = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => {
8091      const {
8092        selection,
8093        ...rest
8094      } = options;
8095      const footnotesChanges = updateFootnotes(newBlocks);
8096      const edits = {
8097        selection,
8098        ...footnotesChanges
8099      };
8100      editEntityRecord(kind, name, id, edits, {
8101        isCached: true,
8102        ...rest
8103      });
8104    }, [kind, name, id, updateFootnotes, editEntityRecord]);
8105    return [blocks, onInput, onChange];
8106  }
8107  
8108  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-prop.js
8109  /**
8110   * WordPress dependencies
8111   */
8112  
8113  
8114  
8115  /**
8116   * Internal dependencies
8117   */
8118  
8119  
8120  
8121  /**
8122   * Hook that returns the value and a setter for the
8123   * specified property of the nearest provided
8124   * entity of the specified type.
8125   *
8126   * @param {string}        kind  The entity kind.
8127   * @param {string}        name  The entity name.
8128   * @param {string}        prop  The property name.
8129   * @param {number|string} [_id] An entity ID to use instead of the context-provided one.
8130   *
8131   * @return {[*, Function, *]} An array where the first item is the
8132   *                            property value, the second is the
8133   *                            setter and the third is the full value
8134   *                               object from REST API containing more
8135   *                               information like `raw`, `rendered` and
8136   *                               `protected` props.
8137   */
8138  function useEntityProp(kind, name, prop, _id) {
8139    const providerId = useEntityId(kind, name);
8140    const id = _id !== null && _id !== void 0 ? _id : providerId;
8141    const {
8142      value,
8143      fullValue
8144    } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8145      const {
8146        getEntityRecord,
8147        getEditedEntityRecord
8148      } = select(STORE_NAME);
8149      const record = getEntityRecord(kind, name, id); // Trigger resolver.
8150      const editedRecord = getEditedEntityRecord(kind, name, id);
8151      return record && editedRecord ? {
8152        value: editedRecord[prop],
8153        fullValue: record[prop]
8154      } : {};
8155    }, [kind, name, id, prop]);
8156    const {
8157      editEntityRecord
8158    } = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME);
8159    const setValue = (0,external_wp_element_namespaceObject.useCallback)(newValue => {
8160      editEntityRecord(kind, name, id, {
8161        [prop]: newValue
8162      });
8163    }, [editEntityRecord, kind, name, id, prop]);
8164    return [value, setValue, fullValue];
8165  }
8166  
8167  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/index.js
8168  
8169  
8170  
8171  
8172  
8173  
8174  
8175  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/private-apis.js
8176  /**
8177   * Internal dependencies
8178   */
8179  
8180  
8181  const privateApis = {};
8182  lock(privateApis, {
8183    useEntityRecordsWithPermissions: useEntityRecordsWithPermissions
8184  });
8185  
8186  ;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/index.js
8187  /**
8188   * WordPress dependencies
8189   */
8190  
8191  
8192  /**
8193   * Internal dependencies
8194   */
8195  
8196  
8197  
8198  
8199  
8200  
8201  
8202  
8203  
8204  
8205  
8206  // The entity selectors/resolvers and actions are shortcuts to their generic equivalents
8207  // (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)
8208  // Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...
8209  // The "kind" and the "name" of the entity are combined to generate these shortcuts.
8210  const build_module_entitiesConfig = [...rootEntitiesConfig, ...additionalEntityConfigLoaders.filter(config => !!config.name)];
8211  const entitySelectors = build_module_entitiesConfig.reduce((result, entity) => {
8212    const {
8213      kind,
8214      name,
8215      plural
8216    } = entity;
8217    result[getMethodName(kind, name)] = (state, key, query) => getEntityRecord(state, kind, name, key, query);
8218    if (plural) {
8219      result[getMethodName(kind, plural, 'get')] = (state, query) => getEntityRecords(state, kind, name, query);
8220    }
8221    return result;
8222  }, {});
8223  const entityResolvers = build_module_entitiesConfig.reduce((result, entity) => {
8224    const {
8225      kind,
8226      name,
8227      plural
8228    } = entity;
8229    result[getMethodName(kind, name)] = (key, query) => resolvers_getEntityRecord(kind, name, key, query);
8230    if (plural) {
8231      const pluralMethodName = getMethodName(kind, plural, 'get');
8232      result[pluralMethodName] = (...args) => resolvers_getEntityRecords(kind, name, ...args);
8233      result[pluralMethodName].shouldInvalidate = action => resolvers_getEntityRecords.shouldInvalidate(action, kind, name);
8234    }
8235    return result;
8236  }, {});
8237  const entityActions = build_module_entitiesConfig.reduce((result, entity) => {
8238    const {
8239      kind,
8240      name
8241    } = entity;
8242    result[getMethodName(kind, name, 'save')] = (record, options) => saveEntityRecord(kind, name, record, options);
8243    result[getMethodName(kind, name, 'delete')] = (key, query, options) => deleteEntityRecord(kind, name, key, query, options);
8244    return result;
8245  }, {});
8246  const storeConfig = () => ({
8247    reducer: build_module_reducer,
8248    actions: {
8249      ...build_module_actions_namespaceObject,
8250      ...entityActions,
8251      ...createLocksActions()
8252    },
8253    selectors: {
8254      ...build_module_selectors_namespaceObject,
8255      ...entitySelectors
8256    },
8257    resolvers: {
8258      ...resolvers_namespaceObject,
8259      ...entityResolvers
8260    }
8261  });
8262  
8263  /**
8264   * Store definition for the code data namespace.
8265   *
8266   * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
8267   */
8268  const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, storeConfig());
8269  unlock(store).registerPrivateSelectors(private_selectors_namespaceObject);
8270  unlock(store).registerPrivateActions(private_actions_namespaceObject);
8271  (0,external_wp_data_namespaceObject.register)(store); // Register store after unlocking private selectors to allow resolvers to use them.
8272  
8273  
8274  
8275  
8276  
8277  
8278  
8279  
8280  })();
8281  
8282  (window.wp = window.wp || {}).coreData = __webpack_exports__;
8283  /******/ })()
8284  ;


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