var _a, _b, _c;
import apiFetch from '@wordpress/api-fetch';
if (window === null || window === void 0 ? void 0 : window.scData) {
  apiFetch.use(apiFetch.createRootURLMiddleware((_a = window === null || window === void 0 ? void 0 : window.scData) === null || _a === void 0 ? void 0 : _a.root_url));
  // @ts-ignore
  apiFetch.nonceMiddleware = apiFetch.createNonceMiddleware((_b = window === null || window === void 0 ? void 0 : window.scData) === null || _b === void 0 ? void 0 : _b.nonce);
  // @ts-ignore
  apiFetch.use(apiFetch.nonceMiddleware);
  // @ts-ignore
  apiFetch.nonceEndpoint = (_c = window === null || window === void 0 ? void 0 : window.scData) === null || _c === void 0 ? void 0 : _c.nonce_endpoint;
}
export default apiFetch;
