: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Create and insert block.
const relativePosition = block.blockHooks[name];
insertBlockIntoDesignatedLocation((0,external_wp_blocks_namespaceObject.createBlock)(block.name), relativePosition);
removeBlock(hookedBlockClientIds[block.name], false);
/* harmony default export */ const block_hooks = ({
edit: BlockHooksControlPure,
attributeKeys: ['metadata'],
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-bindings-attributes.js
/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
* Given a binding of block attributes, returns a higher order component that
* overrides its `attributes` and `setAttributes` props to sync any changes needed.
* @return {WPHigherOrderComponent} Higher-order component.
const BLOCK_BINDINGS_ALLOWED_BLOCKS = {
'core/paragraph': ['content'],
'core/heading': ['content'],
'core/image': ['id', 'url', 'title', 'alt'],
'core/button': ['url', 'text', 'linkTarget', 'rel']
const DEFAULT_ATTRIBUTE = '__default';
* Returns the bindings with the `__default` binding for pattern overrides
* replaced with the full-set of supported attributes. e.g.:
* bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`
* bindings returned: `{ content: { source: 'core/pattern-overrides' } }`
* @param {string} blockName The block name (e.g. 'core/paragraph').
* @param {Object} bindings A block's bindings from the metadata attribute.
* @return {Object} The bindings with default replaced for pattern overrides.
function replacePatternOverrideDefaultBindings(blockName, bindings) {
// The `__default` binding currently only works for pattern overrides.
if (bindings?.[DEFAULT_ATTRIBUTE]?.source === 'core/pattern-overrides') {
const supportedAttributes = BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName];
const bindingsWithDefaults = {};
for (const attributeName of supportedAttributes) {
// If the block has mixed binding sources, retain any non pattern override bindings.
const bindingSource = bindings[attributeName] ? bindings[attributeName] : {
source: 'core/pattern-overrides'
bindingsWithDefaults[attributeName] = bindingSource;
return bindingsWithDefaults;
* Based on the given block name,
* check if it is possible to bind the block.
* @param {string} blockName - The block name.
* @return {boolean} Whether it is possible to bind the block to sources.
function canBindBlock(blockName) {
return blockName in BLOCK_BINDINGS_ALLOWED_BLOCKS;
* Based on the given block name and attribute name,
* check if it is possible to bind the block attribute.
* @param {string} blockName - The block name.
* @param {string} attributeName - The attribute name.
* @return {boolean} Whether it is possible to bind the block attribute.
function canBindAttribute(blockName, attributeName) {
return canBindBlock(blockName) && BLOCK_BINDINGS_ALLOWED_BLOCKS[blockName].includes(attributeName);
const withBlockBindingSupport = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
const sources = (0,external_wp_data_namespaceObject.useSelect)(select => unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources());
const hasParentPattern = !!props.context['pattern/overrides'];
const hasPatternOverridesDefaultBinding = props.attributes.metadata?.bindings?.[DEFAULT_ATTRIBUTE]?.source === 'core/pattern-overrides';
const bindings = (0,external_wp_element_namespaceObject.useMemo)(() => replacePatternOverrideDefaultBindings(name, props.attributes.metadata?.bindings), [props.attributes.metadata?.bindings, name]);
const boundAttributes = (0,external_wp_data_namespaceObject.useSelect)(() => {
for (const [attributeName, boundAttribute] of Object.entries(bindings)) {
const source = sources[boundAttribute.source];
if (!source?.getValue || !canBindAttribute(name, attributeName)) {
args: boundAttribute.args
attributes[attributeName] = source.getValue(args);
if (attributes[attributeName] === undefined) {
if (attributeName === 'url') {
attributes[attributeName] = null;
attributes[attributeName] = source.getPlaceholder?.(args);
}, [bindings, name, clientId, context, registry, sources]);
const _setAttributes = (0,external_wp_element_namespaceObject.useCallback)(nextAttributes => {
setAttributes(nextAttributes);
const updatesBySource = new Map();
// Loop only over the updated attributes to avoid modifying the bound ones that haven't changed.
for (const [attributeName, newValue] of Object.entries(keptAttributes)) {
if (!bindings[attributeName] || !canBindAttribute(name, attributeName)) {
const binding = bindings[attributeName];
const source = sources[binding?.source];
if (!source?.setValue && !source?.setValues) {
updatesBySource.set(source, {
...updatesBySource.get(source),
[attributeName]: newValue
delete keptAttributes[attributeName];
if (updatesBySource.size) {
for (const [source, attributes] of updatesBySource) {
for (const [attributeName, value] of Object.entries(attributes)) {
const binding = bindings[attributeName];
// Don't update non-connected attributes if the block is using pattern overrides
// and the editing is happening while overriding the pattern (not editing the original).
!(hasPatternOverridesDefaultBinding && hasParentPattern) && Object.keys(keptAttributes).length) {
// Don't update caption and href until they are supported.
if (hasPatternOverridesDefaultBinding) {
delete keptAttributes?.caption;
delete keptAttributes?.href;
setAttributes(keptAttributes);
}, [registry, bindings, name, clientId, context, setAttributes, sources, hasPatternOverridesDefaultBinding, hasParentPattern]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockEdit, {
setAttributes: _setAttributes
}, 'withBlockBindingSupport');
* Filters a registered block's settings to enhance a block's `edit` component
* to upgrade bound attributes.
* @param {WPBlockSettings} settings - Registered block settings.
* @param {string} name - Block name.
* @return {WPBlockSettings} Filtered block settings.
function shimAttributeSource(settings, name) {
if (!canBindBlock(name)) {
edit: withBlockBindingSupport(settings.edit)
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-bindings.js
const BlockBindingsPanel = ({
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const _sources = unlock(select(external_wp_blocks_namespaceObject.store)).getAllBlockBindingsSources();
// Don't show not allowed attributes.
// Don't show the bindings connected to pattern overrides in the inspectors panel.
// TODO: Explore if this should be abstracted to let other sources decide.
const filteredBindings = {
Object.keys(filteredBindings).forEach(key => {
if (!canBindAttribute(name, key) || filteredBindings[key].source === 'core/pattern-overrides') {
delete filteredBindings[key];
if (Object.keys(filteredBindings).length === 0) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.PanelBody, {
title: (0,external_wp_i18n_namespaceObject.__)('Attributes'),
className: "components-panel__block-bindings-panel",
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl, {
help: (0,external_wp_i18n_namespaceObject.__)('Attributes connected to various sources.'),
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
children: Object.keys(filteredBindings).map(key => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItem, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "components-item__block-bindings-source",
children: sources[filteredBindings[key].source] ? sources[filteredBindings[key].source].label : filteredBindings[key].source
/* harmony default export */ const block_bindings = ({
edit: BlockBindingsPanel,
attributeKeys: ['metadata'],
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/block-renaming.js
* Filters registered block settings, adding an `__experimentalLabel` callback if one does not already exist.
* @param {Object} settings Original block settings.
* @return {Object} Filtered block settings.
function addLabelCallback(settings) {
// If blocks provide their own label callback, do not override it.
if (settings.__experimentalLabel) {
const supportsBlockNaming = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'renaming', true // default value
// Check whether block metadata is supported before using it.
if (supportsBlockNaming) {
settings.__experimentalLabel = (attributes, {
// In the list view, use the block's name attribute as the label.
if (context === 'list-view' && metadata?.name) {
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/metadata/addLabelCallback', addLabelCallback);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-border-props.js
// This utility is intended to assist where the serialization of the border
// block support is being skipped for a block but the border related CSS classes
// & styles still need to be generated so they can be applied to inner elements.
* Provides the CSS class names and inline styles for a block's border support
* @param {Object} attributes Block attributes.
* @return {Object} Border block support derived CSS classes & styles.
function getBorderClassesAndStyles(attributes) {
const border = attributes.style?.border || {};
const className = getBorderClasses(attributes);
className: className || undefined,
* Derives the border related props for a block from its border block support
* Inline styles are forced for named colors to ensure these selections are
* reflected when themes do not load their color stylesheets in the editor.
* @param {Object} attributes Block attributes.
* @return {Object} ClassName & style props from border block support.
function useBorderProps(attributes) {
} = useMultipleOriginColorsAndGradients();
const borderProps = getBorderClassesAndStyles(attributes);
// Force inline styles to apply named border colors when themes do not load
// their color stylesheets in the editor.
const borderColorObject = getMultiOriginColor({
borderProps.style.borderColor = borderColorObject.color;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-shadow-props.js
// This utility is intended to assist where the serialization of the shadow
// block support is being skipped for a block but the shadow related CSS classes
// & styles still need to be generated so they can be applied to inner elements.
* Provides the CSS class names and inline styles for a block's shadow support
* @param {Object} attributes Block attributes.
* @return {Object} Shadow block support derived CSS classes & styles.
function getShadowClassesAndStyles(attributes) {
const shadow = attributes.style?.shadow || '';
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-color-props.js
// The code in this file has largely been lifted from the color block support
// This utility is intended to assist where the serialization of the colors
// block support is being skipped for a block but the color related CSS classes
// & styles still need to be generated so they can be applied to inner elements.
* Provides the CSS class names and inline styles for a block's color support
* @param {Object} attributes Block attributes.
* @return {Object} Color block support derived CSS classes & styles.
function getColorClassesAndStyles(attributes) {