: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
let entityLabel = entityConfig.label;
if (firstRecord?.name === 'wp_template_part') {
entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.PanelBody, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityDescription, {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityRecordItem, {
checked: !unselectedEntities.some(elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
onChange: value => setUnselectedEntities(record, value)
}, record.key || record.property);
}), 'globalStyles' === firstRecord?.name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(GlobalStylesDescription, {
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/hooks/use-is-dirty.js
const useIsDirty = () => {
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
__experimentalGetDirtyEntityRecords,
} = select(external_wp_coreData_namespaceObject.store);
editedEntities: __experimentalGetDirtyEntityRecords(),
siteEdits: getEntityRecordEdits('root', 'site'),
siteEntityConfig: getEntityConfig('root', 'site')
const dirtyEntityRecords = (0,external_wp_element_namespaceObject.useMemo)(() => {
var _siteEntityConfig$met;
// Remove site object and decouple into its edited pieces.
const editedEntitiesWithoutSite = editedEntities.filter(record => !(record.kind === 'root' && record.name === 'site'));
const siteEntityLabels = (_siteEntityConfig$met = siteEntityConfig?.meta?.labels) !== null && _siteEntityConfig$met !== void 0 ? _siteEntityConfig$met : {};
const editedSiteEntities = [];
for (const property in siteEdits) {
editedSiteEntities.push({
title: siteEntityLabels[property] || property,
return [...editedEntitiesWithoutSite, ...editedSiteEntities];
}, [editedEntities, siteEdits, siteEntityConfig]);
// Unchecked entities to be ignored by save function.
const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]);
const setUnselectedEntities = ({
_setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
_setUnselectedEntities([...unselectedEntities, {
const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
function identity(values) {
function EntitiesSavedStates({
const isDirtyProps = useIsDirty();
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntitiesSavedStatesExtensible, {
renderDialog: renderDialog,
function EntitiesSavedStatesExtensible({
additionalPrompt = undefined,
saveEnabled: saveEnabledProp = undefined,
saveLabel = (0,external_wp_i18n_namespaceObject.__)('Save'),
renderDialog = undefined,
const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)();
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store_store));
// To group entities by type.
const partitionedSavables = dirtyEntityRecords.reduce((acc, record) => {
wp_template: templateSavables,
wp_template_part: templatePartSavables,
const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray);
const saveEnabled = saveEnabledProp !== null && saveEnabledProp !== void 0 ? saveEnabledProp : isDirty;
// Explicitly define this with no argument passed. Using `close` on
// its own will use the event object in place of the expected saved entities.
const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]);
const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
onClose: () => dismissPanel()
const dialogLabel = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'label');
const dialogDescription = (0,external_wp_compose_namespaceObject.useInstanceId)(EntitiesSavedStatesExtensible, 'description');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "entities-saved-states__panel",
role: renderDialog ? 'dialog' : undefined,
"aria-labelledby": renderDialog ? dialogLabel : undefined,
"aria-describedby": renderDialog ? dialogDescription : undefined,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.Flex, {
className: "entities-saved-states__panel-header",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
as: external_wp_components_namespaceObject.Button,
__experimentalIsFocusable: true,
onClick: () => saveDirtyEntities({
entitiesToSkip: unselectedEntities,
className: "editor-entities-saved-states__save-button",
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexItem, {
as: external_wp_components_namespaceObject.Button,
children: (0,external_wp_i18n_namespaceObject.__)('Cancel')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "entities-saved-states__text-prompt",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "entities-saved-states__text-prompt--header-wrapper",
id: renderDialog ? dialogLabel : undefined,
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {
className: "entities-saved-states__text-prompt--header",
children: (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
id: renderDialog ? dialogDescription : undefined,
children: isDirty ? (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of site changes waiting to be saved. */
(0,external_wp_i18n_namespaceObject._n)('There is <strong>%d site change</strong> waiting to be saved.', 'There are <strong>%d site changes</strong> waiting to be saved.', sortedPartitionedSavables.length), sortedPartitionedSavables.length), {
strong: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("strong", {})
}) : (0,external_wp_i18n_namespaceObject.__)('Select the items you want to save.')
}), sortedPartitionedSavables.map(list => {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EntityTypeList, {
unselectedEntities: unselectedEntities,
setUnselectedEntities: setUnselectedEntities
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
// While `select` in a component is generally discouraged, it is
// used here because it (a) reduces the chance of data loss in the
// case of additional errors by performing a direct retrieval and
// (b) avoids the performance cost associated with unnecessary
// content serialization throughout the lifetime of a non-erroring
return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent();
const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
class ErrorBoundary extends external_wp_element_namespaceObject.Component {
componentDidCatch(error) {
(0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
static getDerivedStateFromError(error) {
return this.props.children;
const actions = [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
children: (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')
}, "copy-post"), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CopyButton, {
children: (0,external_wp_i18n_namespaceObject.__)('Copy Error')
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.Warning, {
className: "editor-error-boundary",
children: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')
* ErrorBoundary is used to catch JavaScript errors anywhere in a child component tree, log those errors, and display a fallback UI.
* It uses the lifecycle methods getDerivedStateFromError and componentDidCatch to catch errors in a child component tree.
* getDerivedStateFromError is used to render a fallback UI after an error has been thrown, and componentDidCatch is used to log error information.
/* harmony default export */ const error_boundary = (ErrorBoundary);
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
* Function which returns true if the current environment supports browser
* sessionStorage, or false otherwise. The result of this function is cached and
* reused in subsequent invocations.
const hasSessionStorageSupport = () => {
if (hasStorageSupport !== undefined) {
return hasStorageSupport;
// Private Browsing in Safari 10 and earlier will throw an error when
// attempting to set into sessionStorage. The test here is intentional in
// causing a thrown error as condition bailing from local autosave.
window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
hasStorageSupport = true;
hasStorageSupport = false;
return hasStorageSupport;
* Custom hook which manages the creation of a notice prompting the user to
* restore a local autosave, if one exists.
function useAutosaveNotice() {
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
postId: select(store_store).getCurrentPostId(),
isEditedPostNew: select(store_store).isEditedPostNew(),
hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave
} = (0,external_wp_data_namespaceObject.useSelect)(store_store);
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
(0,external_wp_element_namespaceObject.useEffect)(() => {
let localAutosave = localAutosaveGet(postId, isEditedPostNew);
localAutosave = JSON.parse(localAutosave);
// Not usable if it can't be parsed.
// Only display a notice if there is a difference between what has been
// saved and that which is stored in sessionStorage.
const hasDifference = Object.keys(edits).some(key => {
return edits[key] !== getEditedPostAttribute(key);
// If there is no difference, it can be safely ejected from storage.
localAutosaveClear(postId, isEditedPostNew);
const id = 'wpEditorAutosaveRestore';
createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), {
label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'),
editPost(editsWithoutContent);
resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content));
}, [isEditedPostNew, postId]);
* Custom hook which ejects a local autosave after a successful save occurs.
function useAutosavePurge() {
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
postId: select(store_store).getCurrentPostId(),
isEditedPostNew: select(store_store).isEditedPostNew(),
isDirty: select(store_store).isEditedPostDirty(),
isAutosaving: select(store_store).isAutosavingPost(),
didError: select(store_store).didPostSaveRequestFail()
const lastIsDirty = (0,external_wp_element_namespaceObject.useRef)(isDirty);
const lastIsAutosaving = (0,external_wp_element_namespaceObject.useRef)(isAutosaving);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
localAutosaveClear(postId, isEditedPostNew);
lastIsDirty.current = isDirty;
lastIsAutosaving.current = isAutosaving;
}, [isDirty, isAutosaving, didError]);
// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew);
const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId);
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
localAutosaveClear(postId, true);
}, [isEditedPostNew, postId]);
function LocalAutosaveMonitor() {
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => {
requestIdleCallback(() => autosave({
const localAutosaveInterval = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditorSettings().localAutosaveInterval, []);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(autosave_monitor, {
interval: localAutosaveInterval,
autosave: deferredAutosave
* Monitors local autosaves of a post in the editor.
* It uses several hooks and functions to manage autosave behavior:
* - `useAutosaveNotice` hook: Manages the creation of a notice prompting the user to restore a local autosave, if one exists.
* - `useAutosavePurge` hook: Ejects a local autosave after a successful save occurs.
* - `hasSessionStorageSupport` function: Checks if the current environment supports browser sessionStorage.
* - `LocalAutosaveMonitor` component: Uses the `AutosaveMonitor` component to perform autosaves at a specified interval.