if (activeMenu !== menu) {
return Object(external_wp_element_["createElement"])(NavigationMenuContext.Provider, {
var isControlledSearch = !!setControlledSearch;
var search = isControlledSearch ? controlledSearch : uncontrolledSearch;
var onSearch = isControlledSearch ? setControlledSearch : setUncontrolledSearch;
var menuTitleId = "components-navigation__menu-title-".concat(menu);
var classes = classnames_default()('components-navigation__menu', className);
return Object(external_wp_element_["createElement"])(NavigationMenuContext.Provider, {
}, Object(external_wp_element_["createElement"])(MenuUI, {
}, (parentMenu || onBackButtonClick) && Object(external_wp_element_["createElement"])(back_button, {
backButtonLabel: backButtonLabel,
onClick: onBackButtonClick
}), Object(external_wp_element_["createElement"])(NavigationMenuTitle, {
}), Object(external_wp_element_["createElement"])(navigable_container_menu, null, Object(external_wp_element_["createElement"])("ul", {
"aria-labelledby": menuTitleId
}, children, search && !isSearchDebouncing && Object(external_wp_element_["createElement"])(NavigationSearchNoResultsFound, {
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/index.js
/** @typedef {import('@wordpress/element').WPElement} WPElement */
* Custom hook which announces the message with the given politeness, if a
* valid message is provided.
* @param {string|WPElement} [message] Message to announce.
* @param {'polite'|'assertive'} politeness Politeness to announce.
function useSpokenMessage(message, politeness) {
var spokenMessage = typeof message === 'string' ? message : Object(external_wp_element_["renderToString"])(message);
Object(external_wp_element_["useEffect"])(function () {
Object(external_wp_a11y_["speak"])(spokenMessage, politeness);
}, [spokenMessage, politeness]);
* Given a notice status, returns an assumed default politeness for the status.
* Defaults to 'assertive'.
* @param {string} [status] Notice status.
* @return {'polite'|'assertive'} Notice politeness.
function getDefaultPoliteness(status) {
var className = _ref.className,
_ref$status = _ref.status,
status = _ref$status === void 0 ? 'info' : _ref$status,
children = _ref.children,
_ref$spokenMessage = _ref.spokenMessage,
spokenMessage = _ref$spokenMessage === void 0 ? children : _ref$spokenMessage,
_ref$onRemove = _ref.onRemove,
onRemove = _ref$onRemove === void 0 ? external_lodash_["noop"] : _ref$onRemove,
_ref$isDismissible = _ref.isDismissible,
isDismissible = _ref$isDismissible === void 0 ? true : _ref$isDismissible,
_ref$actions = _ref.actions,
actions = _ref$actions === void 0 ? [] : _ref$actions,
_ref$politeness = _ref.politeness,
politeness = _ref$politeness === void 0 ? getDefaultPoliteness(status) : _ref$politeness,
__unstableHTML = _ref.__unstableHTML;
useSpokenMessage(spokenMessage, politeness);
var classes = classnames_default()(className, 'components-notice', 'is-' + status, {
'is-dismissible': isDismissible
children = Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, children);
return Object(external_wp_element_["createElement"])("div", {
}, Object(external_wp_element_["createElement"])("div", {
className: "components-notice__content"
}, children, actions.map(function (_ref2, index) {
var buttonCustomClasses = _ref2.className,
isPrimary = _ref2.isPrimary,
_ref2$noDefaultClasse = _ref2.noDefaultClasses,
noDefaultClasses = _ref2$noDefaultClasse === void 0 ? false : _ref2$noDefaultClasse,
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
isSecondary: !noDefaultClasses && !url,
isLink: !noDefaultClasses && !!url,
onClick: url ? undefined : onClick,
className: classnames_default()('components-notice__action', buttonCustomClasses)
})), isDismissible && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-notice__dismiss",
icon: library_close["a" /* default */],
label: Object(external_wp_i18n_["__"])('Dismiss this notice'),
/* harmony default export */ var build_module_notice = (Notice);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/list.js
* Renders a list of notices.
* @param {Object} $0 Props passed to the component.
* @param {Array} $0.notices Array of notices to render.
* @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
* @param {Object} $0.className Name of the class used by the component.
* @param {Object} $0.children Array of children to be rendered inside the notice list.
* @return {Object} The rendered notices list.
function NoticeList(_ref) {
var notices = _ref.notices,
_ref$onRemove = _ref.onRemove,
onRemove = _ref$onRemove === void 0 ? external_lodash_["noop"] : _ref$onRemove,
className = _ref.className,
children = _ref.children;
var removeNotice = function removeNotice(id) {
className = classnames_default()('components-notice-list', className);
return Object(external_wp_element_["createElement"])("div", {
}, children, Object(toConsumableArray["a" /* default */])(notices).reverse().map(function (notice) {
return Object(external_wp_element_["createElement"])(build_module_notice, Object(esm_extends["a" /* default */])({}, Object(external_lodash_["omit"])(notice, ['content']), {
onRemove: removeNotice(notice.id)
/* harmony default export */ var list = (NoticeList);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/header.js
function PanelHeader(_ref) {
children = _ref.children;
return Object(external_wp_element_["createElement"])("div", {
className: "components-panel__header"
}, label && Object(external_wp_element_["createElement"])("h2", null, label), children);
/* harmony default export */ var panel_header = (PanelHeader);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/index.js
function Panel(_ref, ref) {
var header = _ref.header,
className = _ref.className,
children = _ref.children;
var classNames = classnames_default()(className, 'components-panel');
return Object(external_wp_element_["createElement"])("div", {
}, header && Object(external_wp_element_["createElement"])(panel_header, {
/* harmony default export */ var panel = (Object(external_wp_element_["forwardRef"])(Panel));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/body.js
function PanelBody(_ref, ref) {
var _ref$buttonProps = _ref.buttonProps,
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
children = _ref.children,
className = _ref.className,
initialOpen = _ref.initialOpen,
_ref$onToggle = _ref.onToggle,
onToggle = _ref$onToggle === void 0 ? external_lodash_["noop"] : _ref$onToggle,
_ref$scrollAfterOpen = _ref.scrollAfterOpen,
scrollAfterOpen = _ref$scrollAfterOpen === void 0 ? true : _ref$scrollAfterOpen;
var _useControlledState = use_controlled_state(opened, {
initial: initialOpen === undefined ? true : initialOpen
_useControlledState2 = Object(slicedToArray["a" /* default */])(_useControlledState, 2),
isOpened = _useControlledState2[0],
setIsOpened = _useControlledState2[1];
var nodeRef = Object(external_wp_element_["useRef"])(); // Defaults to 'smooth' scrolling
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
var scrollBehavior = Object(external_wp_compose_["useReducedMotion"])() ? 'auto' : 'smooth';
var handleOnToggle = function handleOnToggle(event) {
}; // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value
var scrollAfterOpenRef = Object(external_wp_element_["useRef"])();
scrollAfterOpenRef.current = scrollAfterOpen; // Runs after initial render
use_update_effect(function () {
if (isOpened && scrollAfterOpenRef.current && (_nodeRef$current = nodeRef.current) !== null && _nodeRef$current !== void 0 && _nodeRef$current.scrollIntoView) {
* Scrolls the content into view when visible.
* This improves the UX when there are multiple stacking <PanelBody />
* components in a scrollable container.
nodeRef.current.scrollIntoView({
}, [isOpened, scrollBehavior]);
var classes = classnames_default()('components-panel__body', className, {
return Object(external_wp_element_["createElement"])("div", {
ref: Object(react_merge_refs_esm["a" /* default */])([nodeRef, ref])
}, Object(external_wp_element_["createElement"])(PanelBodyTitle, Object(esm_extends["a" /* default */])({
}, buttonProps)), typeof children === 'function' ? children({
}) : isOpened && children);
var PanelBodyTitle = Object(external_wp_element_["forwardRef"])(function (_ref2, ref) {
var isOpened = _ref2.isOpened,
props = Object(objectWithoutProperties["a" /* default */])(_ref2, ["isOpened", "icon", "title"]);
return Object(external_wp_element_["createElement"])("h2", {
className: "components-panel__body-title"
}, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
className: "components-panel__body-toggle",
"aria-expanded": isOpened,
}, props), Object(external_wp_element_["createElement"])("span", {
}, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
className: "components-panel__arrow",
icon: isOpened ? chevron_up["a" /* default */] : chevron_down["a" /* default */]
})), title, icon && Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
className: "components-panel__icon",
var body_ForwardedComponent = Object(external_wp_element_["forwardRef"])(PanelBody);
body_ForwardedComponent.displayName = 'PanelBody';
/* harmony default export */ var panel_body = (body_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/row.js
function PanelRow(_ref) {
var className = _ref.className,
children = _ref.children;
var classes = classnames_default()('components-panel__row', className);
return Object(external_wp_element_["createElement"])("div", {
/* harmony default export */ var panel_row = (PanelRow);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/placeholder/index.js
* Renders a placeholder. Normally used by blocks to render their empty state.
* @param {Object} props The component props.
* @param {WPIcon} props.icon An icon rendered before the label.
* @param {WPElement} props.children Children to be rendered.
* @param {string} props.label Title of the placeholder.
* @param {string} props.instructions Instructions of the placeholder.
* @param {string} props.className Class to set on the container div.
* @param {Object} props.notices A rendered notices list.
* @param {Object} props.preview Preview to be rendered in the placeholder.
* @param {boolean} props.isColumnLayout Whether a column layout should be used.
* @return {Object} The rendered placeholder.
function Placeholder(_ref) {
children = _ref.children,
instructions = _ref.instructions,
className = _ref.className,
isColumnLayout = _ref.isColumnLayout,
additionalProps = Object(objectWithoutProperties["a" /* default */])(_ref, ["icon", "children", "label", "instructions", "className", "notices", "preview", "isColumnLayout"]);
var _useResizeObserver = Object(external_wp_compose_["useResizeObserver"])(),
_useResizeObserver2 = Object(slicedToArray["a" /* default */])(_useResizeObserver, 2),
resizeListener = _useResizeObserver2[0],
width = _useResizeObserver2[1].width; // Since `useResizeObserver` will report a width of `null` until after the
// first render, avoid applying any modifier classes until width is known.
if (typeof width === 'number') {
'is-large': width >= 320,
'is-medium': width >= 160 && width < 320,
var classes = classnames_default()('components-placeholder', className, modifierClassNames);
var fieldsetClasses = classnames_default()('components-placeholder__fieldset', {
'is-column-layout': isColumnLayout
return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, additionalProps, {
}), resizeListener, notices, preview && Object(external_wp_element_["createElement"])("div", {
className: "components-placeholder__preview"
}, preview), Object(external_wp_element_["createElement"])("div", {
className: "components-placeholder__label"
}, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
}), label), !!instructions && Object(external_wp_element_["createElement"])("div", {
className: "components-placeholder__instructions"
}, instructions), Object(external_wp_element_["createElement"])("div", {
className: fieldsetClasses
/* harmony default export */ var build_module_placeholder = (Placeholder);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/terms.js
function terms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function terms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { terms_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { terms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
* Returns terms in a tree form.
* @param {Array} flatTerms Array of terms in flat format.
* @return {Array} Array of terms in tree format.
function buildTermsTree(flatTerms) {
var flatTermsWithParentAndChildren = flatTerms.map(function (term) {
return terms_objectSpread({