: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
/******/ (() => { // webpackBootstrap
/******/ // The require scope
/******/ var __webpack_require__ = {};
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ build_module)
;// CONCATENATED MODULE: external ["wp","i18n"]
const external_wp_i18n_namespaceObject = window["wp"]["i18n"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/nonce.js
* @return {import('../types').APIFetchMiddleware & { nonce: string }} A middleware to enhance a request with a nonce.
function createNonceMiddleware(nonce) {
* @type {import('../types').APIFetchMiddleware & { nonce: string }}
const middleware = (options, next) => {
// If an 'X-WP-Nonce' header (or any case-insensitive variation
// thereof) was specified, no need to add a nonce header.
for (const headerName in headers) {
if (headerName.toLowerCase() === 'x-wp-nonce' && headers[headerName] === middleware.nonce) {
'X-WP-Nonce': middleware.nonce
middleware.nonce = nonce;
/* harmony default export */ const nonce = (createNonceMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/namespace-endpoint.js
* @type {import('../types').APIFetchMiddleware}
const namespaceAndEndpointMiddleware = (options, next) => {
let namespaceTrimmed, endpointTrimmed;
if (typeof options.namespace === 'string' && typeof options.endpoint === 'string') {
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, '');
endpointTrimmed = options.endpoint.replace(/^\//, '');
path = namespaceTrimmed + '/' + endpointTrimmed;
delete options.namespace;
/* harmony default export */ const namespace_endpoint = (namespaceAndEndpointMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js
* @param {string} rootURL
* @return {import('../types').APIFetchMiddleware} Root URL middleware.
const createRootURLMiddleware = rootURL => (options, next) => {
return namespace_endpoint(options, optionsWithPath => {
let url = optionsWithPath.url;
let path = optionsWithPath.path;
if (typeof path === 'string') {
if (-1 !== rootURL.indexOf('?')) {
path = path.replace('?', '&');
path = path.replace(/^\//, '');
// API root may already include query parameter prefix if site is
// configured to use plain permalinks.
if ('string' === typeof apiRoot && -1 !== apiRoot.indexOf('?')) {
path = path.replace('?', '&');
/* harmony default export */ const root_url = (createRootURLMiddleware);
;// CONCATENATED MODULE: external ["wp","url"]
const external_wp_url_namespaceObject = window["wp"]["url"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/preloading.js
* @param {Record<string, any>} preloadedData
* @return {import('../types').APIFetchMiddleware} Preloading middleware.
function createPreloadingMiddleware(preloadedData) {
const cache = Object.fromEntries(Object.entries(preloadedData).map(([path, data]) => [(0,external_wp_url_namespaceObject.normalizePath)(path), data]));
return (options, next) => {
/** @type {string | void} */
let rawPath = options.path;
if (!rawPath && options.url) {
rest_route: pathFromQuery,
} = (0,external_wp_url_namespaceObject.getQueryArgs)(options.url);
if (typeof pathFromQuery === 'string') {
rawPath = (0,external_wp_url_namespaceObject.addQueryArgs)(pathFromQuery, queryArgs);
if (typeof rawPath !== 'string') {
const method = options.method || 'GET';
const path = (0,external_wp_url_namespaceObject.normalizePath)(rawPath);
if ('GET' === method && cache[path]) {
const cacheData = cache[path];
// Unsetting the cache key ensures that the data is only used a single time.
return prepareResponse(cacheData, !!parse);
} else if ('OPTIONS' === method && cache[method] && cache[method][path]) {
const cacheData = cache[method][path];
// Unsetting the cache key ensures that the data is only used a single time.
delete cache[method][path];
return prepareResponse(cacheData, !!parse);
* This is a helper function that sends a success response.
* @param {Record<string, any>} responseData
* @return {Promise<any>} Promise with the response.
function prepareResponse(responseData, parse) {
return Promise.resolve(parse ? responseData.body : new window.Response(JSON.stringify(responseData.body), {
headers: responseData.headers
/* harmony default export */ const preloading = (createPreloadingMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/fetch-all-middleware.js
* Apply query arguments to both URL and Path, whichever is present.
* @param {import('../types').APIFetchOptions} props
* @param {Record<string, string | number>} queryArgs
* @return {import('../types').APIFetchOptions} The request with the modified query args
url: url && (0,external_wp_url_namespaceObject.addQueryArgs)(url, queryArgs),
path: path && (0,external_wp_url_namespaceObject.addQueryArgs)(path, queryArgs)
* Duplicates parsing functionality from apiFetch.
* @param {Response} response
* @return {Promise<any>} Parsed response json.
const parseResponse = response => response.json ? response.json() : Promise.reject(response);
* @param {string | null} linkHeader
* @return {{ next?: string }} The parsed link header.
const parseLinkHeader = linkHeader => {
const match = linkHeader.match(/<([^>]+)>; rel="next"/);
* @param {Response} response
* @return {string | undefined} The next page URL.
const getNextPageUrl = response => {
} = parseLinkHeader(response.headers.get('link'));
* @param {import('../types').APIFetchOptions} options
* @return {boolean} True if the request contains an unbounded query.
const requestContainsUnboundedQuery = options => {
const pathIsUnbounded = !!options.path && options.path.indexOf('per_page=-1') !== -1;
const urlIsUnbounded = !!options.url && options.url.indexOf('per_page=-1') !== -1;
return pathIsUnbounded || urlIsUnbounded;
* The REST API enforces an upper limit on the per_page option. To handle large
* collections, apiFetch consumers can pass `per_page=-1`; this middleware will
* then recursively assemble a full response array from all available pages.
* @type {import('../types').APIFetchMiddleware}
const fetchAllMiddleware = async (options, next) => {
if (options.parse === false) {
// If a consumer has opted out of parsing, do not apply middleware.
if (!requestContainsUnboundedQuery(options)) {
// If neither url nor path is requesting all items, do not apply middleware.
// Retrieve requested page of results.
const response = await build_module({
...modifyQuery(options, {
// Ensure headers are returned for page 1.
const results = await parseResponse(response);
if (!Array.isArray(results)) {
// We have no reliable way of merging non-array results.
let nextPage = getNextPageUrl(response);
// There are no further pages to request.
// Iteratively fetch all remaining pages until no "next" header is found.
let mergedResults = /** @type {any[]} */[].concat(results);
const nextResponse = await build_module({
// Ensure the URL for the next page is used instead of any provided path.
// Ensure we still get headers so we can identify the next page.
const nextResults = await parseResponse(nextResponse);
mergedResults = mergedResults.concat(nextResults);
nextPage = getNextPageUrl(nextResponse);
/* harmony default export */ const fetch_all_middleware = (fetchAllMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/http-v1.js
* Set of HTTP methods which are eligible to be overridden.
const OVERRIDE_METHODS = new Set(['PATCH', 'PUT', 'DELETE']);
* Default request method.
* "A request has an associated method (a method). Unless stated otherwise it
* @see https://fetch.spec.whatwg.org/#requests
const DEFAULT_METHOD = 'GET';
* API Fetch middleware which overrides the request method for HTTP v1
* compatibility leveraging the REST API X-HTTP-Method-Override header.
* @type {import('../types').APIFetchMiddleware}
const httpV1Middleware = (options, next) => {
if (OVERRIDE_METHODS.has(method.toUpperCase())) {
'X-HTTP-Method-Override': method,
'Content-Type': 'application/json'
/* harmony default export */ const http_v1 = (httpV1Middleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/user-locale.js
* @type {import('../types').APIFetchMiddleware}
const userLocaleMiddleware = (options, next) => {
if (typeof options.url === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.url, '_locale')) {
options.url = (0,external_wp_url_namespaceObject.addQueryArgs)(options.url, {
if (typeof options.path === 'string' && !(0,external_wp_url_namespaceObject.hasQueryArg)(options.path, '_locale')) {
options.path = (0,external_wp_url_namespaceObject.addQueryArgs)(options.path, {
/* harmony default export */ const user_locale = (userLocaleMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/utils/response.js
* Parses the apiFetch response.
* @param {Response} response
* @param {boolean} shouldParseResponse
* @return {Promise<any> | null | Response} Parsed response.
const response_parseResponse = (response, shouldParseResponse = true) => {
if (shouldParseResponse) {
if (response.status === 204) {
return response.json ? response.json() : Promise.reject(response);
* Calls the `json` function on the Response, throwing an error if the response
* doesn't have a json function or if parsing the json itself fails.
* @param {Response} response
* @return {Promise<any>} Parsed response.
const parseJsonAndNormalizeError = response => {
const invalidJsonError = {
message: (0,external_wp_i18n_namespaceObject.__)('The response is not a valid JSON response.')
if (!response || !response.json) {
return response.json().catch(() => {
* Parses the apiFetch response properly and normalize response errors.
* @param {Response} response
* @param {boolean} shouldParseResponse
* @return {Promise<any>} Parsed response.
const parseResponseAndNormalizeError = (response, shouldParseResponse = true) => {
return Promise.resolve(response_parseResponse(response, shouldParseResponse)).catch(res => parseAndThrowError(res, shouldParseResponse));
* Parses a response, throwing an error if parsing the response fails.
* @param {Response} response
* @param {boolean} shouldParseResponse
* @return {Promise<any>} Parsed response.
function parseAndThrowError(response, shouldParseResponse = true) {
if (!shouldParseResponse) {
return parseJsonAndNormalizeError(response).then(error => {
message: (0,external_wp_i18n_namespaceObject.__)('An unknown error occurred.')
throw error || unknownError;
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/media-upload.js
* @param {import('../types').APIFetchOptions} options
* @return {boolean} True if the request is for media upload.
function isMediaUploadRequest(options) {
const isCreateMethod = !!options.method && options.method === 'POST';
const isMediaEndpoint = !!options.path && options.path.indexOf('/wp/v2/media') !== -1 || !!options.url && options.url.indexOf('/wp/v2/media') !== -1;
return isMediaEndpoint && isCreateMethod;
* Middleware handling media upload failures and retries.
* @type {import('../types').APIFetchMiddleware}
const mediaUploadMiddleware = (options, next) => {
if (!isMediaUploadRequest(options)) {