: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
var execResult = groupsRegex.exec(path.source);
// Use parenthesized substring match if available, index otherwise
name: execResult[1] || index++,
execResult = groupsRegex.exec(path.source);
* Transform an array into a regexp.
function arrayToRegexp(paths, keys, options) {
var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
* Create a path regexp from string input.
function stringToRegexp(path, keys, options) {
return tokensToRegexp(dist_es2015_parse(path, options), keys, options);
* Expose a function for taking tokens and returning a RegExp.
function tokensToRegexp(tokens, keys, options) {
if (options === void 0) { options = {}; }
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
var delimiterRe = "[".concat(escapeString(delimiter), "]");
var route = start ? "^" : "";
// Iterate over the tokens and create our regexp string.
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
var token = tokens_1[_i];
if (typeof token === "string") {
route += escapeString(encode(token));
var prefix = escapeString(encode(token.prefix));
var suffix = escapeString(encode(token.suffix));
if (token.modifier === "+" || token.modifier === "*") {
var mod = token.modifier === "*" ? "?" : "";
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
if (token.modifier === "+" || token.modifier === "*") {
route += "((?:".concat(token.pattern, ")").concat(token.modifier, ")");
route += "(".concat(token.pattern, ")").concat(token.modifier);
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
route += "".concat(delimiterRe, "?");
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
var endToken = tokens[tokens.length - 1];
var isEndDelimited = typeof endToken === "string"
? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1
: endToken === undefined;
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
return new RegExp(route, flags(options));
* Normalize the given path string, returning a regular expression.
* An empty array can be passed in for the keys, which will hold the
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
function pathToRegexp(path, keys, options) {
if (path instanceof RegExp)
return regexpToRegexp(path, keys);
return arrayToRegexp(path, keys, options);
return stringToRegexp(path, keys, options);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/utils/router.js
function matchPath(path, pattern) {
const matchingFunction = dist_es2015_match(pattern, {
decode: decodeURIComponent
return matchingFunction(path);
function patternMatch(path, screens) {
for (const screen of screens) {
const matched = matchPath(path, screen.path);
function findParent(path, screens) {
if (!path.startsWith('/')) {
const pathParts = path.split('/');
while (pathParts.length > 1 && parentPath === undefined) {
const potentialParentPath = pathParts.join('/') === '' ? '/' : pathParts.join('/');
if (screens.find(screen => {
return matchPath(potentialParentPath, screen.path) !== false;
parentPath = potentialParentPath;
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/context.js
const context_initialContextValue = {
const NavigatorContext = (0,external_wp_element_namespaceObject.createContext)(context_initialContextValue);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/styles.js
function navigator_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const navigatorProviderWrapper = true ? {
styles: "overflow-x:hidden;contain:content"
const fadeInFromRight = emotion_react_browser_esm_keyframes({
transform: `translateX( 50px )`
const fadeInFromLeft = emotion_react_browser_esm_keyframes({
transform: `translateX( -50px )`
const navigatorScreenAnimation = ({
if (isInitial && !isBack) {
const animationName = isRTL && isBack || !isRTL && !isBack ? fadeInFromRight : fadeInFromLeft;
return /*#__PURE__*/emotion_react_browser_esm_css("animation-duration:0.14s;animation-timing-function:ease-in-out;will-change:transform,opacity;animation-name:", animationName, ";@media ( prefers-reduced-motion ){animation-duration:0s;}" + ( true ? "" : 0), true ? "" : 0);
const navigatorScreen = props => /*#__PURE__*/emotion_react_browser_esm_css("overflow-x:auto;max-height:100%;", navigatorScreenAnimation(props), ";" + ( true ? "" : 0), true ? "" : 0);
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-provider/component.js
const MAX_HISTORY_LENGTH = 50;
return [...screens, screen];
return screens.filter(s => s.id !== screen.id);
if (locationHistory.length <= 1) {
return [...locationHistory.slice(0, -2), {
...locationHistory[locationHistory.length - 2],
function goTo(state, path, options = {}) {
const isNavigatingToSamePath = locationHistory.length > 0 && locationHistory[locationHistory.length - 1].path === path;
if (isNavigatingToSamePath) {
const isNavigatingToPreviousPath = isBack && locationHistory.length > 1 && locationHistory[locationHistory.length - 2].path === path;
if (isNavigatingToPreviousPath) {
if (locationHistory.length === 0) {
return replace ? [] : [newLocation];
const newLocationHistory = locationHistory.slice(locationHistory.length > MAX_HISTORY_LENGTH - 1 ? 1 : 0, -1);
// Assign `focusTargetSelector` to the previous location in history
// (the one we just navigated from).
...locationHistory[locationHistory.length - 1],
newLocationHistory.push(newLocation);
return newLocationHistory;
function goToParent(state, options = {}) {
const currentPath = locationHistory[locationHistory.length - 1].path;
if (currentPath === undefined) {
const parentPath = findParent(currentPath, screens);
if (parentPath === undefined) {
return goTo(state, parentPath, {
function routerReducer(state, action) {
screens = addScreen(state, action.screen);
screens = removeScreen(state, action.screen);
locationHistory = goBack(state);
locationHistory = goTo(state, action.path, action.options);
locationHistory = goToParent(state, action.options);
// Return early in case there is no change
if (screens === state.screens && locationHistory === state.locationHistory) {
// Compute the matchedPath
const currentPath = locationHistory.length > 0 ? locationHistory[locationHistory.length - 1].path : undefined;
matchedPath = currentPath !== undefined ? patternMatch(currentPath, screens) : undefined;
// If the new match is the same as the previous match,
// return the previous one to keep immutability.
if (matchedPath && state.matchedPath && matchedPath.id === state.matchedPath.id && external_wp_isShallowEqual_default()(matchedPath.params, state.matchedPath.params)) {
matchedPath = state.matchedPath;
function UnconnectedNavigatorProvider(props, forwardedRef) {
} = useContextSystem(props, 'NavigatorProvider');
const [routerState, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(routerReducer, initialPath, path => ({
// The methods are constant forever, create stable references to them.
const methods = (0,external_wp_element_namespaceObject.useMemo)(() => ({
goTo: (path, options) => dispatch({
goToParent: options => dispatch({
addScreen: screen => dispatch({
removeScreen: screen => dispatch({
const navigatorContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
...locationHistory[locationHistory.length - 1],
isInitial: locationHistory.length === 1
params: (_matchedPath$params = matchedPath?.params) !== null && _matchedPath$params !== void 0 ? _matchedPath$params : {},
}, [locationHistory, matchedPath, methods]);
const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigatorProviderWrapper, className), [className, cx]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(component, {
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NavigatorContext.Provider, {
value: navigatorContextValue,
* The `NavigatorProvider` component allows rendering nested views/panels/menus
* (via the `NavigatorScreen` component and navigate between these different
* view (via the `NavigatorButton` and `NavigatorBackButton` components or the
* __experimentalNavigatorProvider as NavigatorProvider,
* __experimentalNavigatorScreen as NavigatorScreen,
* __experimentalNavigatorButton as NavigatorButton,
* __experimentalNavigatorBackButton as NavigatorBackButton,
* } from '@wordpress/components';
* const MyNavigation = () => (
* <NavigatorProvider initialPath="/">
* <NavigatorScreen path="/">
* <p>This is the home screen.</p>
* <NavigatorButton path="/child">
* Navigate to child screen.
* <NavigatorScreen path="/child">
* <p>This is the child screen.</p>
const NavigatorProvider = contextConnect(UnconnectedNavigatorProvider, 'NavigatorProvider');
/* harmony default export */ const navigator_provider_component = (NavigatorProvider);
;// CONCATENATED MODULE: external ["wp","escapeHtml"]
const external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-screen/component.js
function UnconnectedNavigatorScreen(props, forwardedRef) {
const screenId = (0,external_wp_element_namespaceObject.useId)();