File "api-fetch.js"
Full Path: /home2/sdektunc/cepali.edu.mx/wp-includes/blocks/query/api-fetch.js
File size: 4 KB
MIME-type: text/plain
Charset: utf-8
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // 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__ = {};
// 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
/**
* @param {string} nonce
* @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) => {
const {
headers = {}
} = options;
// 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) {
return next(options);
}
}
return next({
...options,
headers: {
...headers,
'X-WP-Nonce': middleware.nonce
}
});
};
middleware.nonce = nonce;
return middleware;
}
/* 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 path = options.path;
let namespaceTrimmed, endpointTrimmed;
if (typeof options.namespace === 'string' && typeof options.endpoint === 'string') {
namespaceTrimmed = options.namespace.replace(/^\/|\/$/g, '');
endpointTrimmed = options.endpoint.replace(/^\//, '');
if (endpointTrimmed) {
path = namespaceTrimmed + '/' + endpointTrimmed;
} else {
path = namespaceTrimmed;
}
}
delete options.namespace;
delete options.endpoint;
return next({
...options,
path
});
};
/* harmony default export */ const namespace_endpoint = (namespaceAndEndpointMiddleware);
;// CONCATENATED MODULE: ./node_modules/@wordpress/api-fetch/build-module/middlewares/root-url.js
/**
* Internal dependencies
*/
/**
* @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;
let apiRoot;
if (typeof path === 'string') {
apiRoot = rootURL;
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('?', '&');
}
url = apiRoot + path;
}
return next({
...optionsWithPath,
url
});
});
};
/* ha