: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
innerBlocks: makeBlocksSerializable(innerBlocks)
* Returns the list of post type entities.
* @return {Promise} Entities promise
async function loadPostTypeEntities() {
const postTypes = await external_wp_apiFetch_default()({
path: '/wp/v2/types?context=view'
return Object.entries(postTypes !== null && postTypes !== void 0 ? postTypes : {}).map(([name, postType]) => {
var _postType$rest_namesp;
const isTemplate = ['wp_template', 'wp_template_part'].includes(name);
const namespace = (_postType$rest_namesp = postType?.rest_namespace) !== null && _postType$rest_namesp !== void 0 ? _postType$rest_namesp : 'wp/v2';
baseURL: `/${namespace}/${postType.rest_base}`,
rawAttributes: POST_RAW_ATTRIBUTES,
return record?.title?.rendered || record?.title || (isTemplate ? capitalCase((_record$slug = record.slug) !== null && _record$slug !== void 0 ? _record$slug : '') : String(record.id));
__unstablePrePersist: isTemplate ? undefined : prePersistPostType,
__unstable_rest_base: postType.rest_base,
return external_wp_apiFetch_default()({
path: `/${namespace}/${postType.rest_base}/${id}?context=edit`
applyChangesToDoc: (doc, changes) => {
const document = doc.getMap('document');
Object.entries(changes).forEach(([key, value]) => {
if (typeof value !== 'function') {
if (!serialisableBlocksCache.has(value)) {
serialisableBlocksCache.set(value, makeBlocksSerializable(value));
value = serialisableBlocksCache.get(value);
if (document.get(key) !== value) {
document.set(key, value);
return doc.getMap('document').toJSON();
syncObjectType: 'postType/' + postType.name,
getSyncObjectId: id => id,
supportsPagination: true,
getRevisionsUrl: (parentId, revisionId) => `/${namespace}/${postType.rest_base}/${parentId}/revisions${revisionId ? '/' + revisionId : ''}`,
revisionKey: isTemplate ? 'wp_id' : DEFAULT_ENTITY_KEY
* Returns the list of the taxonomies entities.
* @return {Promise} Entities promise
async function loadTaxonomyEntities() {
const taxonomies = await external_wp_apiFetch_default()({
path: '/wp/v2/taxonomies?context=view'
return Object.entries(taxonomies !== null && taxonomies !== void 0 ? taxonomies : {}).map(([name, taxonomy]) => {
var _taxonomy$rest_namesp;
const namespace = (_taxonomy$rest_namesp = taxonomy?.rest_namespace) !== null && _taxonomy$rest_namesp !== void 0 ? _taxonomy$rest_namesp : 'wp/v2';
baseURL: `/${namespace}/${taxonomy.rest_base}`,
* Returns the Site entity.
* @return {Promise} Entity promise
async function loadSiteEntity() {
var _site$schema$properti;
label: (0,external_wp_i18n_namespaceObject.__)('Site'),
baseURL: '/wp/v2/settings',
return external_wp_apiFetch_default()({
applyChangesToDoc: (doc, changes) => {
const document = doc.getMap('document');
Object.entries(changes).forEach(([key, value]) => {
if (document.get(key) !== value) {
document.set(key, value);
return doc.getMap('document').toJSON();
syncObjectType: 'root/site',
getSyncObjectId: () => 'index',
const site = await external_wp_apiFetch_default()({
Object.entries((_site$schema$properti = site?.schema?.properties) !== null && _site$schema$properti !== void 0 ? _site$schema$properti : {}).forEach(([key, value]) => {
// Ignore properties `title` and `type` keys.
if (typeof value === 'object' && value.title) {
labels[key] = value.title;
* Returns the entity's getter method name given its kind and name or plural name.
* const nameSingular = getMethodName( 'root', 'theme', 'get' );
* // nameSingular is getRootTheme
* const namePlural = getMethodName( 'root', 'themes', 'set' );
* // namePlural is setRootThemes
* @param {string} kind Entity kind.
* @param {string} name Entity name or plural name.
* @param {string} prefix Function prefix.
* @return {string} Method name
const getMethodName = (kind, name, prefix = 'get') => {
const kindPrefix = kind === 'root' ? '' : pascalCase(kind);
const suffix = pascalCase(name);
return `${prefix}${kindPrefix}${suffix}`;
function registerSyncConfigs(configs) {
getSyncProvider().register(syncObjectType, syncConfig);
delete editSyncConfig.fetch;
getSyncProvider().register(syncObjectType + '--edit', editSyncConfig);
* Loads the entities into the store.
* Note: The `name` argument is used for `root` entities requiring additional server data.
* @param {string} kind Kind
* @param {string} name Name
* @return {(thunkArgs: object) => Promise<Array>} Entities
const getOrLoadEntitiesConfig = (kind, name) => async ({
let configs = select.getEntitiesConfig(kind);
const hasConfig = !!select.getEntityConfig(kind, name);
if (configs?.length > 0 && hasConfig) {
if (window.__experimentalEnableSync) {
const loader = additionalEntityConfigLoaders.find(l => {
return l.kind === kind && l.name === name;
configs = await loader.loadEntities();
if (window.__experimentalEnableSync) {
dispatch(addEntities(configs));
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/get-normalized-comma-separable.js
* Given a value which can be specified as one or the other of a comma-separated
* string or an array, returns a value normalized to an array of strings, or
* null if the value cannot be interpreted as either.
* @param {string|string[]|*} value
* @return {?(string[])} Normalized field value.
function getNormalizedCommaSeparable(value) {
if (typeof value === 'string') {
} else if (Array.isArray(value)) {
/* harmony default export */ const get_normalized_comma_separable = (getNormalizedCommaSeparable);
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/utils/with-weak-map-cache.js
* Given a function, returns an enhanced function which caches the result and
* tracks in WeakMap. The result is only cached if the original function is
* passed a valid object-like argument (requirement for WeakMap key).
* @param {Function} fn Original function.
* @return {Function} Enhanced caching function.
function withWeakMapCache(fn) {
const cache = new WeakMap();
// Can reach here if key is not valid for WeakMap, since `has`
// will return false for invalid key. Since `set` will throw,
// ensure that key is valid before setting into cache.
if (key !== null && typeof key === 'object') {
/* harmony default export */ const with_weak_map_cache = (withWeakMapCache);
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/get-query-parts.js
* An object of properties describing a specific query.
* @typedef {Object} WPQueriedDataQueryParts
* @property {number} page The query page (1-based index, default 1).
* @property {number} perPage Items per page for query (default 10).
* @property {string} stableKey An encoded stable string of all non-
* pagination, non-fields query parameters.
* @property {?(string[])} fields Target subset of fields to derive from
* @property {?(number[])} include Specific item IDs to include.
* @property {string} context Scope under which the request is made;
* determines returned fields in response.
* Given a query object, returns an object of parts, including pagination
* details (`page` and `perPage`, or default values). All other properties are
* encoded into a stable (idempotent) `stableKey` value.
* @param {Object} query Optional query object.
* @return {WPQueriedDataQueryParts} Query parts.
function getQueryParts(query) {
* @type {WPQueriedDataQueryParts}
// Ensure stable key by sorting keys. Also more efficient for iterating.
const keys = Object.keys(query).sort();
for (let i = 0; i < keys.length; i++) {
parts[key] = Number(value);
parts.perPage = Number(value);
// While in theory, we could exclude "_fields" from the stableKey
// because two request with different fields have the same results
// We're not able to ensure that because the server can decide to omit
// fields from the response even if we explicitly asked for it.
// Example: Asking for titles in posts without title support.
var _getNormalizedCommaSe;
parts.fields = (_getNormalizedCommaSe = get_normalized_comma_separable(value)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : [];
// Make sure to normalize value for `stableKey`
value = parts.fields.join();
// Two requests with different include values cannot have same results.
var _getNormalizedCommaSe2;
if (typeof value === 'number') {
value = value.toString();
parts.include = ((_getNormalizedCommaSe2 = get_normalized_comma_separable(value)) !== null && _getNormalizedCommaSe2 !== void 0 ? _getNormalizedCommaSe2 : []).map(Number);
// Normalize value for `stableKey`.
value = parts.include.join();
// While it could be any deterministic string, for simplicity's
// sake mimic querystring encoding for stable key.
// TODO: For consistency with PHP implementation, addQueryArgs
// should accept a key value pair, which may optimize its
// implementation for our use here, vs. iterating an object
// with only a single key.
parts.stableKey += (parts.stableKey ? '&' : '') + (0,external_wp_url_namespaceObject.addQueryArgs)('', {
/* harmony default export */ const get_query_parts = (with_weak_map_cache(getQueryParts));
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/queried-data/reducer.js
function getContextFromAction(action) {
const queryParts = get_query_parts(query);
return queryParts.context;
* Returns a merged array of item IDs, given details of the received paginated
* items. The array is sparse-like with `undefined` entries where holes exist.
* @param {?Array<number>} itemIds Original item IDs (default empty array).
* @param {number[]} nextItemIds Item IDs to merge.
* @param {number} page Page of items merged.
* @param {number} perPage Number of items per page.
* @return {number[]} Merged array of item IDs.
function getMergedItemIds(itemIds, nextItemIds, page, perPage) {
const receivedAllIds = page === 1 && perPage === -1;
const nextItemIdsStartIndex = (page - 1) * perPage;
// If later page has already been received, default to the larger known
// size of the existing array, else calculate as extending the existing.
const size = Math.max((_itemIds$length = itemIds?.length) !== null && _itemIds$length !== void 0 ? _itemIds$length : 0, nextItemIdsStartIndex + nextItemIds.length);
// Preallocate array since size is known.
const mergedItemIds = new Array(size);
for (let i = 0; i < size; i++) {
// Preserve existing item ID except for subset of range of next items.
// We need to check against the possible maximum upper boundary because
// a page could receive fewer than what was previously stored.
const isInNextItemsRange = i >= nextItemIdsStartIndex && i < nextItemIdsStartIndex + perPage;
mergedItemIds[i] = isInNextItemsRange ? nextItemIds[i - nextItemIdsStartIndex] : itemIds?.[i];
* Helper function to filter out entities with certain IDs.
* Entities are keyed by their ID.
* @param {Object} entities Entity objects, keyed by entity ID.
* @param {Array} ids Entity IDs to filter out.
* @return {Object} Filtered entities.
function removeEntitiesById(entities, ids) {
return Object.fromEntries(Object.entries(entities).filter(([id]) => !ids.some(itemId => {
if (Number.isInteger(itemId)) {
* Reducer tracking items state, keyed by ID. Items are assumed to be normal,
* where identifiers are common across all queries.
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
* @return {Object} Next state.
function items(state = {}, action) {
const context = getContextFromAction(action);
const key = action.key || DEFAULT_ENTITY_KEY;
...action.items.reduce((accumulator, value) => {
const itemId = value?.[key];
accumulator[itemId] = conservativeMapItem(state?.[context]?.[itemId], value);
return Object.fromEntries(Object.entries(state).map(([itemId, contextState]) => [itemId, removeEntitiesById(contextState, action.itemIds)]));
* Reducer tracking item completeness, keyed by ID. A complete item is one for
* which all fields are known. This is used in supporting `_fields` queries,
* where not all properties associated with an entity are necessarily returned.
* In such cases, completeness is used as an indication of whether it would be
* safe to use queried data for a non-`_fields`-limited request.
* @param {Object<string,Object<string,boolean>>} state Current state.