: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
PrivatePublishDateTimePicker
} = unlock(external_wp_blockEditor_namespaceObject.privateApis);
* Renders the PostSchedule component. It allows the user to schedule a post.
* @param {Object} props Props.
* @param {Function} props.onClose Function to close the component.
* @return {Component} The component to be rendered.
function PostSchedule(props) {
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePostSchedule, {
showPopoverHeaderActions: true,
function PrivatePostSchedule({
showPopoverHeaderActions,
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
postDate: select(store_store).getEditedPostAttribute('date'),
postType: select(store_store).getCurrentPostType()
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
const onUpdateDate = date => editPost({
const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(startOfMonth(new Date(postDate)));
// Pick up published and schduled site posts.
const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, {
status: 'publish,future',
after: startOfMonth(previewedMonth).toISOString(),
before: endOfMonth(previewedMonth).toISOString(),
exclude: [select(store_store).getCurrentPostId()],
}), [previewedMonth, postType]);
const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(({
date: new Date(eventDate)
})), [eventsByPostType]);
const settings = (0,external_wp_date_namespaceObject.getSettings)();
// To know if the current timezone is a 12 hour time with look for "a" in the time format
// We also make sure this a is not escaped by a "/"
const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a.
.replace(/\\\\/g, '') // Replace "//" with empty strings.
.split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash.
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PrivatePublishDateTimePicker, {
onMonthPreviewed: date => setPreviewedMonth(parseISO(date)),
showPopoverHeaderActions: showPopoverHeaderActions
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js
* Renders the PostScheduleLabel component.
* @param {Object} props Props.
* @return {Component} The component to be rendered.
function PostScheduleLabel(props) {
return usePostScheduleLabel(props);
* Custom hook to get the label for post schedule.
* @param {Object} options Options for the hook.
* @param {boolean} options.full Whether to get the full label or not. Default is false.
* @return {string} The label for post schedule.
function usePostScheduleLabel({
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
date: select(store_store).getEditedPostAttribute('date'),
isFloating: select(store_store).isEditedPostDateFloating()
return full ? getFullPostScheduleLabel(date) : getPostScheduleLabel(date, {
function getFullPostScheduleLabel(dateAttribute) {
const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute);
const timezoneAbbreviation = getTimezoneAbbreviation();
const formattedDate = (0,external_wp_date_namespaceObject.dateI18n)(
// translators: If using a space between 'g:i' and 'a', use a non-breaking space.
(0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
return (0,external_wp_i18n_namespaceObject.isRTL)() ? `${timezoneAbbreviation} ${formattedDate}` : `${formattedDate} ${timezoneAbbreviation}`;
function getPostScheduleLabel(dateAttribute, {
if (!dateAttribute || isFloating) {
return (0,external_wp_i18n_namespaceObject.__)('Immediately');
// If the user timezone does not equal the site timezone then using words
// like 'tomorrow' is confusing, so show the full date.
if (!isTimezoneSameAsSiteTimezone(now)) {
return getFullPostScheduleLabel(dateAttribute);
const date = (0,external_wp_date_namespaceObject.getDate)(dateAttribute);
if (isSameDay(date, now)) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Time of day the post is scheduled for.
(0,external_wp_i18n_namespaceObject.__)('Today at %s'),
// translators: If using a space between 'g:i' and 'a', use a non-breaking space.
(0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date));
const tomorrow = new Date(now);
tomorrow.setDate(tomorrow.getDate() + 1);
if (isSameDay(date, tomorrow)) {
return (0,external_wp_i18n_namespaceObject.sprintf)(
// translators: %s: Time of day the post is scheduled for.
(0,external_wp_i18n_namespaceObject.__)('Tomorrow at %s'),
// translators: If using a space between 'g:i' and 'a', use a non-breaking space.
(0,external_wp_date_namespaceObject.dateI18n)((0,external_wp_i18n_namespaceObject._x)('g:i\xa0a', 'post schedule time format'), date));
if (date.getFullYear() === now.getFullYear()) {
return (0,external_wp_date_namespaceObject.dateI18n)(
// translators: If using a space between 'g:i' and 'a', use a non-breaking space.
(0,external_wp_i18n_namespaceObject._x)('F j g:i\xa0a', 'post schedule date format without year'), date);
return (0,external_wp_date_namespaceObject.dateI18n)(
// translators: Use a non-breaking space between 'g:i' and 'a' if appropriate.
(0,external_wp_i18n_namespaceObject._x)('F j, Y g:i\xa0a', 'post schedule full date format'), date);
function getTimezoneAbbreviation() {
} = (0,external_wp_date_namespaceObject.getSettings)();
if (timezone.abbr && isNaN(Number(timezone.abbr))) {
const symbol = timezone.offset < 0 ? '' : '+';
return `UTC${symbol}${timezone.offsetFormatted}`;
function isTimezoneSameAsSiteTimezone(date) {
} = (0,external_wp_date_namespaceObject.getSettings)();
const siteOffset = Number(timezone.offset);
const dateOffset = -1 * (date.getTimezoneOffset() / 60);
return siteOffset === dateOffset;
function isSameDay(left, right) {
return left.getDate() === right.getDate() && left.getMonth() === right.getMonth() && left.getFullYear() === right.getFullYear();
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js
const MIN_MOST_USED_TERMS = 3;
_fields: 'id,name,count',
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY);
showTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS
const terms = unescapeTerms(_terms);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
className: "editor-post-taxonomies__flat-term-most-used",
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.BaseControl.VisualLabel, {
className: "editor-post-taxonomies__flat-term-most-used-label",
children: taxonomy.labels.most_used
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("ul", {
className: "editor-post-taxonomies__flat-term-most-used-list",
children: terms.map(term => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("li", {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
onClick: () => onSelect(term),
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
* Shared reference to an empty array for cases where it is important to avoid
* returning a new array reference on every invocation.
const flat_term_selector_EMPTY_ARRAY = [];
const MAX_TERMS_SUGGESTIONS = 20;
const flat_term_selector_DEFAULT_QUERY = {
per_page: MAX_TERMS_SUGGESTIONS,
const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
const termNamesToIds = (names, terms) => {
return names.map(termName => terms.find(term => isSameTermName(term.name, termName))?.id).filter(id => id !== undefined);
function FlatTermSelector({
var _taxonomy$labels$add_, _taxonomy$labels$sing2;
const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]);
const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)('');
const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500);
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
var _post$_links, _post$_links2;
} = select(external_wp_coreData_namespaceObject.store);
const post = getCurrentPost();
const _taxonomy = getTaxonomy(slug);
const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY;
...flat_term_selector_DEFAULT_QUERY,
include: _termIds.join(','),
hasCreateAction: _taxonomy ? (_post$_links = post._links?.['wp:action-create-' + _taxonomy.rest_base]) !== null && _post$_links !== void 0 ? _post$_links : false : false,
hasAssignAction: _taxonomy ? (_post$_links2 = post._links?.['wp:action-assign-' + _taxonomy.rest_base]) !== null && _post$_links2 !== void 0 ? _post$_links2 : false : false,
terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY,
hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query])
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
} = select(external_wp_coreData_namespaceObject.store);
searchResults: !!search ? getEntityRecords('taxonomy', slug, {
...flat_term_selector_DEFAULT_QUERY,
}) : flat_term_selector_EMPTY_ARRAY
// Update terms state only after the selectors are resolved.
// We're using this to avoid terms temporarily disappearing on slow networks
// while core data makes REST API requests.
(0,external_wp_element_namespaceObject.useEffect)(() => {
const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name));
}, [terms, hasResolvedTerms]);
const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name));
} = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
async function findOrCreateTerm(term) {
const newTerm = await saveEntityRecord('taxonomy', slug, term, {
return unescapeTerm(newTerm);
if (error.code !== 'term_exists') {
function onUpdateTerms(newTermIds) {
[taxonomy.rest_base]: newTermIds
function onChange(termNames) {
const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])];
const uniqueTerms = termNames.reduce((acc, name) => {
if (!acc.some(n => n.toLowerCase() === name.toLowerCase())) {
const newTermNames = uniqueTerms.filter(termName => !availableTerms.find(term => isSameTermName(term.name, termName)));
// Optimistically update term values.
// The selector will always re-fetch terms later.
if (newTermNames.length === 0) {
onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
Promise.all(newTermNames.map(termName => findOrCreateTerm({
const newAvailableTerms = availableTerms.concat(newTerms);
onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms));
createErrorNotice(error.message, {
// In case of a failure, try assigning available terms.
// This will invalidate the optimistic update.
onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms));
function appendTerm(newTerm) {
var _taxonomy$labels$sing;
if (termIds.includes(newTerm.id)) {
const newTermIds = [...termIds, newTerm.id];
const defaultName = slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term');
const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
(0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (_taxonomy$labels$sing = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing !== void 0 ? _taxonomy$labels$sing : defaultName);
(0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive');
onUpdateTerms(newTermIds);
const newTermLabel = (_taxonomy$labels$add_ = taxonomy?.labels?.add_new_item) !== null && _taxonomy$labels$add_ !== void 0 ? _taxonomy$labels$add_ : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term');
const singularName = (_taxonomy$labels$sing2 = taxonomy?.labels?.singular_name) !== null && _taxonomy$labels$sing2 !== void 0 ? _taxonomy$labels$sing2 : slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term');
const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
(0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName);
const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
(0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName);
const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: term name. */
(0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FormTokenField, {
__next40pxDefaultSize: true,
suggestions: suggestions,
onInputChange: debouncedSearch,
maxSuggestions: MAX_TERMS_SUGGESTIONS,
removed: termRemovedLabel,
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MostUsedTerms, {
/* harmony default export */ const flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector));
;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
const TagsPanel = () => {
const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
className: "editor-post-publish-panel__link",