WordPress/wp-includes/js/dist/api-fetch.min.js
noisysocks c2d0fb2040 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Navigation: Fix click-button size, submenu directions, scrollbars.
- Group - Fix overzealous regex when restoring inner containers
- Babel Preset: Update Babel packages to 7.16 version
- theme.json: adds a setting property that enables some other ones
- Polish metabox container.
- Fix submenu justification and spacer orientation.
- Fix Gutenberg 11.8.2 in WordPress trunk
- Strip meta tags from pasted links in Chromium
- Hide visilibility and status for navigation posts
- Navigation: Refactor and simplify setup state.
- Nav block menu switcher - decode HTML entities and utilise accessible markup pattern
- Rename fse_navigation_area to wp_navigation_area
- theme.json: adds a setting property that enables some other ones
- Revert "theme.json: adds a setting property that enables some other ones"
- Skip flaky image block test
- WordPress/gutenberg@3c935c4
- React to any errors coming up in gutenberg_migrate_menu_to_navigation_post
- Return wp error from wp_insert_post
- Fix not transforming logical assignments for packages

See #54337.

Built from https://develop.svn.wordpress.org/trunk@52161


git-svn-id: http://core.svn.wordpress.org/trunk@51753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-15 12:50:17 +00:00

2 lines
5.9 KiB
JavaScript

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.apiFetch=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="jqrR")}({Mmq9:function(e,t){e.exports=window.wp.url},jqrR:function(e,t,r){"use strict";r.r(t);var n=r("l3Sj");var o=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const o in n)if("x-wp-nonce"===o.toLowerCase()&&n[o]===t.nonce)return r(e);return r({...e,headers:{...n,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t};var a=(e,t)=>{let r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),o=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:o})};var s=e=>(t,r)=>a(t,t=>{let n,o=t.url,a=t.path;return"string"==typeof a&&(n=e,-1!==e.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r({...t,url:o})}),c=r("Mmq9");var i=function(e){const t=Object.keys(e).reduce((t,r)=>(t[Object(c.normalizePath)(r)]=e[r],t),{});return(e,r)=>{const{parse:n=!0}=e;let o=e.path;if(!o&&e.url){const t=Object(c.getQueryArg)(e.url,"rest_route");"string"==typeof t&&(o=t)}if("string"==typeof o){const r=e.method||"GET",a=Object(c.normalizePath)(o);if("GET"===r&&t[a]){const e=t[a];return delete t[a],Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}if("OPTIONS"===r&&t[r]&&t[r][a]){const e=t[r][a];return delete t[r][a],Promise.resolve(n?e.body:e)}}return r(e)}};const u=(e,t)=>{let{path:r,url:n,...o}=e;return{...o,url:n&&Object(c.addQueryArgs)(n,t),path:r&&Object(c.addQueryArgs)(r,t)}},d=e=>e.json?e.json():Promise.reject(e),l=e=>{const{next:t}=(e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}})(e.headers.get("link"));return t};var p=async(e,t)=>{if(!1===e.parse)return t(e);if(!(e=>{const t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r})(e))return t(e);const r=await T({...u(e,{per_page:100}),parse:!1}),n=await d(r);if(!Array.isArray(n))return n;let o=l(r);if(!o)return n;let a=[].concat(n);for(;o;){const t=await T({...e,path:void 0,url:o,parse:!1}),r=await d(t);a=a.concat(r),o=l(t)}return a};const h=new Set(["PATCH","PUT","DELETE"]),f="GET";const w=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t?204===e.status?null:e.json?e.json():Promise.reject(e):e},m=e=>{const t={code:"invalid_json",message:Object(n.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch(()=>{throw t})},g=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Promise.resolve(w(e,t)).catch(e=>y(e,t))};function y(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!t)throw e;return m(e).then(e=>{const t={code:"unknown_error",message:Object(n.__)("An unknown error occurred.")};throw e||t})}var j=(e,t)=>{if(!function(e){const t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);let r=0;const o=e=>(r++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>r<5?o(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject())));return t({...e,parse:!1}).catch(t=>{const r=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&r?o(r).catch(()=>!1!==e.parse?Promise.reject({code:"post_process",message:Object(n.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t)):y(t,e.parse)}).then(t=>g(t,e.parse))};const O={Accept:"application/json, */*;q=0.1"},b={credentials:"include"},v=[(e,t)=>("string"!=typeof e.url||Object(c.hasQueryArg)(e.url,"_locale")||(e.url=Object(c.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||Object(c.hasQueryArg)(e.path,"_locale")||(e.path=Object(c.addQueryArgs)(e.path,{_locale:"user"})),t(e)),a,(e,t)=>{const{method:r=f}=e;return h.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},p];const _=e=>{if(e.status>=200&&e.status<300)return e;throw e};let P=e=>{const{url:t,path:r,data:o,parse:a=!0,...s}=e;let{body:c,headers:i}=e;i={...O,...i},o&&(c=JSON.stringify(o),i["Content-Type"]="application/json");return window.fetch(t||r||window.location.href,{...b,...s,body:c,headers:i}).then(e=>Promise.resolve(e).then(_).catch(e=>y(e,a)).then(e=>g(e,a)),e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:Object(n.__)("You are probably offline.")}})};function x(e){return v.reduceRight((e,t)=>r=>t(r,e),P)(e).catch(t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(x.nonceEndpoint).then(_).then(e=>e.text()).then(t=>(x.nonceMiddleware.nonce=t,x(e))))}x.use=function(e){v.unshift(e)},x.setFetchHandler=function(e){P=e},x.createNonceMiddleware=o,x.createPreloadingMiddleware=i,x.createRootURLMiddleware=s,x.fetchAllMiddleware=p,x.mediaUploadMiddleware=j;var T=t.default=x},l3Sj:function(e,t){e.exports=window.wp.i18n}}).default;