: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
parsedPattern = parsePattern(pattern);
parsedPatternCache.set(pattern, parsedPattern);
const checkAllowList = (list, item, defaultResult = null) => {
if (typeof list === 'boolean') {
if (Array.isArray(list)) {
// TODO: when there is a canonical way to detect that we are editing a post
// the following check should be changed to something like:
// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )
if (list.includes('core/post-content') && item === null) {
return list.includes(item);
const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
if (typeof allowedBlockTypes === 'boolean') {
return allowedBlockTypes;
const blocksQueue = [...blocks];
while (blocksQueue.length > 0) {
const block = blocksQueue.shift();
const isAllowed = checkAllowList(allowedBlockTypes, block.name || block.blockName, true);
block.innerBlocks?.forEach(innerBlock => {
blocksQueue.push(innerBlock);
const getAllPatternsDependants = select => state => {
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns, unlock(select(STORE_NAME)).getReusableBlocks()];
function getInsertBlockTypeDependants(state, rootClientId) {
return [state.blockListSettings[rootClientId], state.blocks.byClientId.get(rootClientId), state.settings.allowedBlockTypes, state.settings.templateLock, state.blockEditingModes];
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/sorting.js
* Recursive stable sorting comparator function.
* @param {string|Function} field Field to sort by.
* @param {Array} items Items to sort.
* @param {string} order Order, 'asc' or 'desc'.
* @return {Function} Comparison function to be used in a `.sort()`.
const comparator = (field, items, order) => {
if (typeof field === 'function') {
return order === 'asc' ? 1 : -1;
} else if (cmpB > cmpA) {
return order === 'asc' ? -1 : 1;
const orderA = items.findIndex(item => item === a);
const orderB = items.findIndex(item => item === b);
// Stable sort: maintaining original array order
} else if (orderB > orderA) {
* Order items by a certain key.
* Supports decorator functions that allow complex picking of a comparison field.
* Sorts in ascending order by default, but supports descending as well.
* Stable sort - maintains original order of equal items.
* @param {Array} items Items to order.
* @param {string|Function} field Field to order by.
* @param {string} order Sorting order, `asc` or `desc`.
* @return {Array} Sorted items.
function orderBy(items, field, order = 'asc') {
return items.concat().sort(comparator(field, items, order));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/inserter/block-patterns-tab/utils.js
const INSERTER_PATTERN_TYPES = {
const INSERTER_SYNC_TYPES = {
const allPatternsCategory = {
label: (0,external_wp_i18n_namespaceObject._x)('All', 'patterns')
const myPatternsCategory = {
label: (0,external_wp_i18n_namespaceObject.__)('My patterns')
function isPatternFiltered(pattern, sourceFilter, syncFilter) {
const isUserPattern = pattern.name.startsWith('core/block');
const isDirectoryPattern = pattern.source === 'core' || pattern.source?.startsWith('pattern-directory');
// If theme source selected, filter out user created patterns and those from
// the core patterns directory.
if (sourceFilter === INSERTER_PATTERN_TYPES.theme && (isUserPattern || isDirectoryPattern)) {
// If the directory source is selected, filter out user created patterns
// and those bundled with the theme.
if (sourceFilter === INSERTER_PATTERN_TYPES.directory && (isUserPattern || !isDirectoryPattern)) {
// If user source selected, filter out theme patterns.
if (sourceFilter === INSERTER_PATTERN_TYPES.user && pattern.type !== INSERTER_PATTERN_TYPES.user) {
// Filter by sync status.
if (syncFilter === INSERTER_SYNC_TYPES.full && pattern.syncStatus !== '') {
if (syncFilter === INSERTER_SYNC_TYPES.unsynced && pattern.syncStatus !== 'unsynced' && isUserPattern) {
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/utils/object.js
* Immutably sets a value inside an object. Like `lodash#set`, but returning a
* new object. Treats nullish initial values as empty objects. Clones any
* nested objects. Supports arrays, too.
* @param {Object} object Object to set a value in.
* @param {number|string|Array} path Path in the object to modify.
* @param {*} value New value to set.
* @return {Object} Cloned object with the new value set.
function setImmutably(object, path, value) {
path = Array.isArray(path) ? [...path] : [path];
// Shallowly clone the base of the object
object = Array.isArray(object) ? [...object] : {
// Traverse object from root to leaf, shallowly cloning at each level
for (const key of path) {
prev = prev[key] = Array.isArray(lvl) ? [...lvl] : {
* Helper util to return a value from a certain path of the object.
* Path is specified as either:
* - a string of properties, separated by dots, for example: "x.y".
* - an array of properties, for example `[ 'x', 'y' ]`.
* You can also specify a default value in case the result is nullish.
* @param {Object} object Input object.
* @param {string|Array} path Path to the object property.
* @param {*} defaultValue Default value if the value at the specified path is nullish.
* @return {*} Value of the object property at the specified path.
const getValueFromObjectPath = (object, path, defaultValue) => {
const arrayPath = Array.isArray(path) ? path : path.split('.');
arrayPath.forEach(fieldName => {
value = value?.[fieldName];
return (_value = value) !== null && _value !== void 0 ? _value : defaultValue;
* Helper util to filter out objects with duplicate values for a given property.
* @param {Object[]} array Array of objects to filter.
* @param {string} property Property to filter unique values by.
* @return {Object[]} Array of objects with unique values for the specified property.
function uniqByProperty(array, property) {
return array.filter(item => {
const value = item[property];
return seen.has(value) ? false : seen.add(value);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/get-block-settings.js
const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing'];
const deprecatedFlags = {
'color.palette': settings => settings.colors,
'color.gradients': settings => settings.gradients,
'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors,
'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
'typography.fontSizes': settings => settings.fontSizes,
'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
'typography.lineHeight': settings => settings.enableCustomLineHeight,
'spacing.units': settings => {
if (settings.enableCustomUnits === undefined) {
if (settings.enableCustomUnits === true) {
return ['px', 'em', 'rem', 'vh', 'vw', '%'];
return settings.enableCustomUnits;
'spacing.padding': settings => settings.enableCustomSpacing
* These were only available in the plugin
* and can be removed when the minimum WordPress version
'border.customColor': 'border.color',
'border.customStyle': 'border.style',
'border.customWidth': 'border.width',
'typography.customFontStyle': 'typography.fontStyle',
'typography.customFontWeight': 'typography.fontWeight',
'typography.customLetterSpacing': 'typography.letterSpacing',
'typography.customTextDecorations': 'typography.textDecoration',
'typography.customTextTransforms': 'typography.textTransform',
* These were part of WordPress 5.8 and we need to keep them.
'border.customRadius': 'border.radius',
'spacing.customMargin': 'spacing.margin',
'spacing.customPadding': 'spacing.padding',
'typography.customLineHeight': 'typography.lineHeight'
* Remove `custom` prefixes for flags that did not land in 5.8.
* This provides continued support for `custom` prefixed properties. It will
* be removed once third party devs have had sufficient time to update themes,
* @see https://github.com/WordPress/gutenberg/pull/34485
* @param {string} path Path to desired value in settings.
* @return {string} The value for defined setting.
const removeCustomPrefixes = path => {
return prefixedFlags[path] || path;
function getBlockSettings(state, clientId, ...paths) {
const blockName = getBlockName(state, clientId);
const name = getBlockName(state, id);
if ((0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, '__experimentalSettings', false)) {
} while (id = state.blocks.parents.get(id));
return paths.map(path => {
if (blockedPaths.includes(path)) {
// eslint-disable-next-line no-console
console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.');
// 0. Allow third parties to filter the block's settings at runtime.
let result = (0,external_wp_hooks_namespaceObject.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName);
if (undefined !== result) {
const normalizedPath = removeCustomPrefixes(path);
// 1. Take settings from the block instance or its ancestors.
// Start from the current block and work our way up the ancestors.
for (const candidateClientId of candidates) {
var _getValueFromObjectPa;
const candidateAtts = getBlockAttributes(state, candidateClientId);
result = (_getValueFromObjectPa = getValueFromObjectPath(candidateAtts.settings?.blocks?.[blockName], normalizedPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(candidateAtts.settings, normalizedPath);
if (result !== undefined) {
// Stop the search for more distant ancestors and move on.
// 2. Fall back to the settings from the block editor store (__experimentalFeatures).
const settings = getSettings(state);
if (result === undefined && blockName) {
result = getValueFromObjectPath(settings.__experimentalFeatures?.blocks?.[blockName], normalizedPath);
if (result === undefined) {
result = getValueFromObjectPath(settings.__experimentalFeatures, normalizedPath);
// Return if the setting was found in either the block instance or the store.
if (result !== undefined) {
if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_OVERRIDE[normalizedPath]) {
var _ref, _result$custom;
return (_ref = (_result$custom = result.custom) !== null && _result$custom !== void 0 ? _result$custom : result.theme) !== null && _ref !== void 0 ? _ref : result.default;
// 3. Otherwise, use deprecated settings.
const deprecatedSettingsValue = deprecatedFlags[normalizedPath]?.(settings);
if (deprecatedSettingsValue !== undefined) {
return deprecatedSettingsValue;
// 4. Fallback for typography.dropCap:
// This is only necessary to support typography.dropCap.
// when __experimentalFeatures are not present (core without plugin).
// To remove when __experimentalFeatures are ported to core.
return normalizedPath === 'typography.dropCap' ? true : undefined;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/store/private-selectors.js
* Returns true if the block interface is hidden, or false otherwise.
* @param {Object} state Global application state.
* @return {boolean} Whether the block toolbar is hidden.
function private_selectors_isBlockInterfaceHidden(state) {
return state.isBlockInterfaceHidden;
* Gets the client ids of the last inserted blocks.
* @param {Object} state Global application state.
* @return {Array|undefined} Client Ids of the last inserted block(s).
function getLastInsertedBlocksClientIds(state) {
return state?.lastBlockInserted?.clientIds;
function getBlockWithoutAttributes(state, clientId) {
return state.blocks.byClientId.get(clientId);
* Returns true if all of the descendants of a block with the given client ID
* have an editing mode of 'disabled', or false otherwise.
* @param {Object} state Global application state.
* @param {string} clientId The block client ID.
* @return {boolean} Whether the block descendants are disabled.
const isBlockSubtreeDisabled = (state, clientId) => {
const isChildSubtreeDisabled = childClientId => {
return getBlockEditingMode(state, childClientId) === 'disabled' && getBlockOrder(state, childClientId).every(isChildSubtreeDisabled);
return getBlockOrder(state, clientId).every(isChildSubtreeDisabled);
function getEnabledClientIdsTreeUnmemoized(state, rootClientId) {
const blockOrder = getBlockOrder(state, rootClientId);
for (const clientId of blockOrder) {
const innerBlocks = getEnabledClientIdsTreeUnmemoized(state, clientId);
if (getBlockEditingMode(state, clientId) !== 'disabled') {
result.push(...innerBlocks);
* Returns a tree of block objects with only clientID and innerBlocks set.
* Blocks with a 'disabled' editing mode are not included.
* @param {Object} state Global application state.
* @param {?string} rootClientId Optional root client ID of block list.
* @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
const getEnabledClientIdsTree = (0,external_wp_data_namespaceObject.createSelector)(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
* Returns a list of a given block's ancestors, from top to bottom. Blocks with
* a 'disabled' editing mode are excluded.
* @param {Object} state Global application state.
* @param {string} clientId The block client ID.
* @param {boolean} ascending Order results from bottom to top (true) or top
const getEnabledBlockParents = (0,external_wp_data_namespaceObject.createSelector)((state, clientId, ascending = false) => {
return getBlockParents(state, clientId, ascending).filter(parent => getBlockEditingMode(state, parent) !== 'disabled');
}, state => [state.blocks.parents, state.blockEditingModes, state.settings.templateLock, state.blockListSettings]);
* Selector that returns the data needed to display a prompt when certain
* blocks are removed, or `false` if no such prompt is requested.
* @param {Object} state Global application state.
* @return {Object|false} Data for removal prompt display, if any.
function getRemovalPromptData(state) {
return state.removalPromptData;
* Returns true if removal prompt exists, or false otherwise.
* @param {Object} state Global application state.
* @return {boolean} Whether removal prompt exists.
function getBlockRemovalRules(state) {
return state.blockRemovalRules;
* Returns the client ID of the block settings menu that is currently open.
* @param {Object} state Global application state.
* @return {string|null} The client ID of the block menu that is currently open.
function getOpenedBlockSettingsMenu(state) {
return state.openedBlockSettingsMenu;
* Returns all style overrides, intended to be merged with global editor styles.
* Overrides are sorted to match the order of the blocks they relate to. This
* is useful to maintain correct CSS cascade order.