: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @param {string} name The entity name.
* @param {string} prop The property name.
* @param {string} [_id] An entity ID to use instead of the context-provided one.
* @return {[*, Function, *]} An array where the first item is the
* property value, the second is the
* setter and the third is the full value
* object from REST API containing more
* information like `raw`, `rendered` and
function useEntityProp(kind, name, prop, _id) {
const providerId = useEntityId(kind, name);
const id = _id !== null && _id !== void 0 ? _id : providerId;
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const record = getEntityRecord(kind, name, id); // Trigger resolver.
const editedRecord = getEditedEntityRecord(kind, name, id);
return record && editedRecord ? {
value: editedRecord[prop],
}, [kind, name, id, prop]);
} = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME);
const setValue = (0,external_wp_element_namespaceObject.useCallback)(newValue => {
editEntityRecord(kind, name, id, {
}, [editEntityRecord, kind, name, id, prop]);
return [value, setValue, fullValue];
const parsedBlocksCache = new WeakMap();
* Hook that returns block content getters and setters for
* the nearest provided entity of the specified type.
* The return value has the shape `[ blocks, onInput, onChange ]`.
* `onInput` is for block changes that don't create undo levels
* or dirty the post, non-persistent changes, and `onChange` is for
* persistent changes. They map directly to the props of a
* `BlockEditorProvider` and are intended to be used with it,
* or similar components or hooks.
* @param {string} kind The entity kind.
* @param {string} name The entity name.
* @param {Object} options
* @param {string} [options.id] An entity ID to use instead of the context-provided one.
* @return {[WPBlock[], Function, Function]} The block array and setters.
function useEntityBlockEditor(kind, name, {
const providerId = useEntityId(kind, name);
const id = _id !== null && _id !== void 0 ? _id : providerId;
} = (0,external_wp_data_namespaceObject.useSelect)(STORE_NAME);
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const editedRecord = getEditedEntityRecord(kind, name, id);
editedBlocks: editedRecord.blocks,
content: editedRecord.content,
__unstableCreateUndoLevel,
} = (0,external_wp_data_namespaceObject.useDispatch)(STORE_NAME);
const blocks = (0,external_wp_element_namespaceObject.useMemo)(() => {
if (!content || typeof content !== 'string') {
// If there's an edit, cache the parsed blocks by the edit.
// If not, cache by the original enity record.
const edits = getEntityRecordEdits(kind, name, id);
const isUnedited = !edits || !Object.keys(edits).length;
const cackeKey = isUnedited ? getEntityRecord(kind, name, id) : edits;
let _blocks = parsedBlocksCache.get(cackeKey);
_blocks = (0,external_wp_blocks_namespaceObject.parse)(content);
parsedBlocksCache.set(cackeKey, _blocks);
}, [kind, name, id, editedBlocks, content, getEntityRecord, getEntityRecordEdits]);
const updateFootnotes = (0,external_wp_element_namespaceObject.useCallback)(_blocks => updateFootnotesFromMeta(_blocks, meta), [meta]);
const onChange = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => {
const noChange = blocks === newBlocks;
return __unstableCreateUndoLevel(kind, name, id);
// We create a new function here on every persistent edit
// to make sure the edit makes the post dirty and creates
blocks: blocksForSerialization = []
}) => (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization),
...updateFootnotes(newBlocks)
editEntityRecord(kind, name, id, edits, {
}, [kind, name, id, blocks, updateFootnotes, __unstableCreateUndoLevel, editEntityRecord]);
const onInput = (0,external_wp_element_namespaceObject.useCallback)((newBlocks, options) => {
const footnotesChanges = updateFootnotes(newBlocks);
editEntityRecord(kind, name, id, edits, {
}, [kind, name, id, updateFootnotes, editEntityRecord]);
return [blocks, onInput, onChange];
;// CONCATENATED MODULE: ./node_modules/memize/dist/index.js
* @property {number} [maxSize] Maximum size of the cache.
* @typedef MemizeCacheNode
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
* @property {?MemizeCacheNode|undefined} [next] Next node.
* @property {Array<*>} args Function arguments for cache
* @property {*} val Function result.
* Properties of the enhanced function for controlling cache.
* @typedef MemizeMemoizedFunction
* @property {()=>void} clear Clear the cache.
* Accepts a function to be memoized, and returns a new memoized function, with
* @template {(...args: any[]) => any} F
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
* @return {((...args: Parameters<F>) => ReturnType<F>) & MemizeMemoizedFunction} Memoized function.
function memize(fn, options) {
/** @type {?MemizeCacheNode|undefined} */
/** @type {?MemizeCacheNode|undefined} */
function memoized(/* ...args */) {
searchCache: while (node) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if (node.args.length !== arguments.length) {
// Check whether node arguments match arguments values
for (i = 0; i < len; i++) {
if (node.args[i] !== arguments[i]) {
// At this point we can assume we've found a match
// Surface matched node to head if not already
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
/** @type {MemizeCacheNode} */ (node.prev).next = node.next;
node.next.prev = node.prev;
/** @type {MemizeCacheNode} */ (head).prev = node;
// No cached value found. Continue to insertion phase:
// Create a copy of arguments (avoid leaking deoptimization)
for (i = 0; i < len; i++) {
// Generate the result from original function
val: fn.apply(null, args),
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
// If no head, follows that there's no tail (at initial or reset)
// Trim tail if we're reached max size and are pending cache insertion
if (size === /** @type {MemizeOptions} */ (options).maxSize) {
tail = /** @type {MemizeCacheNode} */ (tail).prev;
/** @type {MemizeCacheNode} */ (tail).next = null;
memoized.clear = function () {
// Ignore reason: There's not a clear solution to create an intersection of
// the function with additional properties, where the goal is to retain the
// function signature of the incoming argument and add control properties
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/memoize.js
// re-export due to restrictive esModuleInterop setting
/* harmony default export */ const memoize = (memize);
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/constants.js
let Status = /*#__PURE__*/function (Status) {
Status["Resolving"] = "RESOLVING";
Status["Error"] = "ERROR";
Status["Success"] = "SUCCESS";
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-query-select.js
const META_SELECTORS = ['getIsResolving', 'hasStartedResolution', 'hasFinishedResolution', 'isResolving', 'getCachedResolvers'];
* Like useSelect, but the selectors return objects containing
* both the original data AND the resolution info.
* @since 6.1.0 Introduced in WordPress core.
* @param {Function} mapQuerySelect see useSelect
* @param {Array} deps see useSelect
* import { useQuerySelect } from '@wordpress/data';
* import { store as coreDataStore } from '@wordpress/core-data';
* function PageTitleDisplay( { id } ) {
* const { data: page, isResolving } = useQuerySelect( ( query ) => {
* return query( coreDataStore ).getEntityRecord( 'postType', 'page', id )
* // Rendered in the application:
* // <PageTitleDisplay id={ 10 } />
* In the above example, when `PageTitleDisplay` is rendered into an
* application, the page and the resolution details will be retrieved from
* the store state using the `mapSelect` callback on `useQuerySelect`.
* If the id prop changes then any page in the state for that id is
* retrieved. If the id prop doesn't change and other props are passed in
* that do change, the title will not change because the dependency is just
* @return {QuerySelectResponse} Queried data.
function useQuerySelect(mapQuerySelect, deps) {
return (0,external_wp_data_namespaceObject.useSelect)((select, registry) => {
const resolve = store => enrichSelectors(select(store));
return mapQuerySelect(resolve, registry);
* Transform simple selectors into ones that return an object with the
* original return value AND the resolution info.
* @param {Object} selectors Selectors to enrich
* @return {EnrichedSelectors} Enriched selectors
const enrichSelectors = memoize(selectors => {
for (const selectorName in selectors) {
if (META_SELECTORS.includes(selectorName)) {
Object.defineProperty(resolvers, selectorName, {
get: () => (...args) => {
const data = selectors[selectorName](...args);
const resolutionStatus = selectors.getResolutionState(selectorName, args)?.status;
switch (resolutionStatus) {
status = Status.Resolving;
isResolving: status === Status.Resolving,
hasStarted: status !== Status.Idle,
hasResolved: status === Status.Success || status === Status.Error
;// CONCATENATED MODULE: ./node_modules/@wordpress/core-data/build-module/hooks/use-entity-record.js
const use_entity_record_EMPTY_OBJECT = {};
* Resolves the specified entity record.
* @since 6.1.0 Introduced in WordPress core.
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
* @param recordId ID of the requested entity record.
* @param options Optional hook options.
* import { useEntityRecord } from '@wordpress/core-data';
* function PageTitleDisplay( { id } ) {
* const { record, isResolving } = useEntityRecord( 'postType', 'page', id );
* // Rendered in the application:
* // <PageTitleDisplay id={ 1 } />
* In the above example, when `PageTitleDisplay` is rendered into an
* application, the page and the resolution details will be retrieved from
* the store state using `getEntityRecord()`, or resolved if missing.
* import { useCallback } from 'react';
* import { useDispatch } from '@wordpress/data';
* import { __ } from '@wordpress/i18n';
* import { TextControl } from '@wordpress/components';
* import { store as noticeStore } from '@wordpress/notices';
* import { useEntityRecord } from '@wordpress/core-data';
* function PageRenameForm( { id } ) {
* const page = useEntityRecord( 'postType', 'page', id );