: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
function DuotoneControl({
toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, {
className: "block-editor-duotone-control__unset-indicator"
toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, {
toolbarIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(build_module_icon, {
const actionLabel = (0,external_wp_i18n_namespaceObject.__)('Apply duotone filter');
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(DuotoneControl, 'duotone-control', idProp);
const descriptionId = `${id}__description`;
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
className: 'block-editor-duotone-control__popover',
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
const openOnArrowDown = event => {
if (!isOpen && event.keyCode === external_wp_keycodes_namespaceObject.DOWN) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
onKeyDown: openOnArrowDown,
renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone'),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, {
"aria-label": actionLabel,
"aria-describedby": descriptionId,
colorPalette: colorPalette,
duotonePalette: duotonePalette,
disableCustomColors: disableCustomColors,
disableCustomDuotone: disableCustomDuotone,
/* harmony default export */ const duotone_control = (DuotoneControl);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/duotone/utils.js
* Convert a list of colors to an object of R, G, and B values.
* @param {string[]} colors Array of RBG color strings.
* @return {Object} R, G, and B values.
function getValuesFromColors(colors = []) {
colors.forEach(color => {
const rgbColor = w(color).toRgb();
values.r.push(rgbColor.r / 255);
values.g.push(rgbColor.g / 255);
values.b.push(rgbColor.b / 255);
values.a.push(rgbColor.a);
* Stylesheet for disabling a global styles duotone filter.
* @param {string} selector Selector to disable the filter for.
* @return {string} Filter none style.
function getDuotoneUnsetStylesheet(selector) {
return `${selector}{filter:none}`;
* SVG and stylesheet needed for rendering the duotone filter.
* @param {string} selector Selector to apply the filter to.
* @param {string} id Unique id for this duotone filter.
* @return {string} Duotone filter style.
function getDuotoneStylesheet(selector, id) {
return `${selector}{filter:url(#${id})}`;
* The SVG part of the duotone filter.
* @param {string} id Unique id for this duotone filter.
* @param {string[]} colors Color strings from dark to light.
* @return {string} Duotone SVG.
function getDuotoneFilter(id, colors) {
const values = getValuesFromColors(colors);
xmlns:xlink="http://www.w3.org/1999/xlink"
style="visibility: hidden; position: absolute; left: -9999px; overflow: hidden;"
Use sRGB instead of linearRGB so transparency looks correct.
Use perceptual brightness to convert to grayscale.
<feColorMatrix color-interpolation-filters="sRGB" type="matrix" values=" .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "></feColorMatrix>
<!-- Use sRGB instead of linearRGB to be consistent with how CSS gradients work. -->
<feComponentTransfer color-interpolation-filters="sRGB">
<feFuncR type="table" tableValues="${values.r.join(' ')}"></feFuncR>
<feFuncG type="table" tableValues="${values.g.join(' ')}"></feFuncG>
<feFuncB type="table" tableValues="${values.b.join(' ')}"></feFuncB>
<feFuncA type="table" tableValues="${values.a.join(' ')}"></feFuncA>
<!-- Re-mask the image with the original transparency since the feColorMatrix above loses that information. -->
<feComposite in2="SourceGraphic" operator="in"></feComposite>
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/get-block-css-selector.js
* Determine the CSS selector for the block type and target provided, returning
* @param {import('@wordpress/blocks').Block} blockType The block's type.
* @param {string|string[]} target The desired selector's target e.g. `root`, delimited string, or array path.
* @param {Object} options Options object.
* @param {boolean} options.fallback Whether or not to fallback to broader selector.
* @return {?string} The CSS selector or `null` if no selector available.
function getBlockCSSSelector(blockType, target = 'root', options = {}) {
const hasSelectors = selectors && Object.keys(selectors).length > 0;
const path = Array.isArray(target) ? target.join('.') : target;
// Calculated before returning as it can be used as a fallback for feature
if (hasSelectors && selectors.root) {
// Use the selectors API if available.
rootSelector = selectors?.root;
} else if (supports?.__experimentalSelector) {
// Use the old experimental selector supports property if set.
rootSelector = supports.__experimentalSelector;
// If no root selector found, generate default block class selector.
rootSelector = '.wp-block-' + name.replace('core/', '').replace('/', '-');
// Return selector if it's the root target we are looking for.
// If target is not `root` or `duotone` we have a feature or subfeature
// as the target. If the target is a string convert to an array.
const pathArray = Array.isArray(target) ? target : target.split('.');
// Feature selectors ( may fallback to root selector );
if (pathArray.length === 1) {
const fallbackSelector = fallback ? rootSelector : null;
// Prefer the selectors API if available.
// Get selector from either `feature.root` or shorthand path.
const featureSelector = getValueFromObjectPath(selectors, `${path}.root`, null) || getValueFromObjectPath(selectors, path, null);
// Return feature selector if found or any available fallback.
return featureSelector || fallbackSelector;
// Try getting old experimental supports selector value.
const featureSelector = getValueFromObjectPath(supports, `${path}.__experimentalSelector`, null);
// If nothing to work with, provide fallback selector if available.
// Scope the feature selector by the block's root selector.
return scopeSelector(rootSelector, featureSelector);
// This may fallback either to parent feature or root selector.
// Use selectors API if available.
subfeatureSelector = getValueFromObjectPath(selectors, path, null);
// Only return if we have a subfeature selector.
if (subfeatureSelector) {
return subfeatureSelector;
// To this point we don't have a subfeature selector. If a fallback has been
// requested, remove subfeature from target path and return results of a
// call for the parent feature's selector.
return getBlockCSSSelector(blockType, pathArray[0], options);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/filters-panel.js
const filters_panel_EMPTY_ARRAY = [];
function useMultiOriginColorPresets(settings, {
const disableDefault = !settings?.color?.[defaultSetting];
const userPresets = settings?.color?.[presetSetting]?.custom || filters_panel_EMPTY_ARRAY;
const themePresets = settings?.color?.[presetSetting]?.theme || filters_panel_EMPTY_ARRAY;
const defaultPresets = settings?.color?.[presetSetting]?.default || filters_panel_EMPTY_ARRAY;
return (0,external_wp_element_namespaceObject.useMemo)(() => [...userPresets, ...themePresets, ...(disableDefault ? filters_panel_EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]);
function useHasFiltersPanel(settings) {
return useHasDuotoneControl(settings);
function useHasDuotoneControl(settings) {
return settings.color.customDuotone || settings.color.defaultDuotone || settings.color.duotone.length > 0;
function FiltersToolsPanel({
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
const updatedValue = resetAllFilter(value);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
label: (0,external_wp_i18n_namespaceObject._x)('Filters', 'Name for applying graphical effects'),
dropdownMenuProps: dropdownMenuProps,
const filters_panel_DEFAULT_CONTROLS = {
const filters_panel_popoverProps = {
className: 'block-editor-duotone-control__popover',
headerTitle: (0,external_wp_i18n_namespaceObject.__)('Duotone')
const LabeledColorIndicator = ({
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalHStack, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalZStack, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
children: indicator === 'unset' || !indicator ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ColorIndicator, {
className: "block-editor-duotone-control__unset-indicator"
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotoneSwatch, {
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
as: Wrapper = FiltersToolsPanel,
defaultControls = filters_panel_DEFAULT_CONTROLS
const decodeValue = rawValue => getValueFromVariable({
const hasDuotoneEnabled = useHasDuotoneControl(settings);
const duotonePalette = useMultiOriginColorPresets(settings, {
presetSetting: 'duotone',
defaultSetting: 'defaultDuotone'
const colorPalette = useMultiOriginColorPresets(settings, {
presetSetting: 'palette',
defaultSetting: 'defaultPalette'
const duotone = decodeValue(inheritedValue?.filter?.duotone);
const setDuotone = newValue => {
const duotonePreset = duotonePalette.find(({
return colors === newValue;
const settedValue = duotonePreset ? `var:preset|duotone|${duotonePreset.slug}` : newValue;
onChange(setImmutably(value, ['filter', 'duotone'], settedValue));
const hasDuotone = () => !!value?.filter?.duotone;
const resetDuotone = () => setDuotone(undefined);
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Wrapper, {
resetAllFilter: resetAllFilter,
children: hasDuotoneEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone'),
onDeselect: resetDuotone,
isShownByDefault: defaultControls.duotone,
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
popoverProps: filters_panel_popoverProps,
className: "block-editor-global-styles-filters-panel__dropdown",
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalItemGroup, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabeledColorIndicator, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone')
renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.MenuGroup, {
label: (0,external_wp_i18n_namespaceObject.__)('Duotone'),
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
children: (0,external_wp_i18n_namespaceObject.__)('Create a two-tone color effect without losing your original image.')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DuotonePicker, {
colorPalette: colorPalette,
duotonePalette: duotonePalette
// TODO: Re-enable both when custom colors are supported for block-level styles.
disableCustomColors: true,
disableCustomDuotone: true,
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/duotone.js
const duotone_EMPTY_ARRAY = [];