mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 16:45:31 +01:00
3c8457e747
This updates the following npm dependencies: - `autoprefixer` to version `10.4.16`. - `grunt-contrib-qunit` to version `8.0.1`. - `postcss` to version `8.4.30`. - `react-refresh` to version `0.14.0`. - `sass` to version `1.68.0`. - `sinon` to version `16.0.0`. - `uuid` to version `9.0.1`. - `tslib` to version `2.6.2`. This change accompanies a similar one in the Gutenberg repository: https://github.com/WordPress/gutenberg/pull/54657. Props gziolo, desrosj. Fixes #58863. Built from https://develop.svn.wordpress.org/trunk@56647 git-svn-id: http://core.svn.wordpress.org/trunk@56159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
/*! This file is auto-generated */
|
|
!function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{default:function(){return T}});var r=window.wp.i18n;var n=function(e){const t=(e,r)=>{const{headers:n={}}=e;for(const a in n)if("x-wp-nonce"===a.toLowerCase()&&n[a]===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,a=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),n=e.endpoint.replace(/^\//,""),a=n?r+"/"+n:r),delete e.namespace,delete e.endpoint,t({...e,path:a})};var o=e=>(t,r)=>a(t,(t=>{let n,a=t.url,o=t.path;return"string"==typeof o&&(n=e,-1!==e.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(o=o.replace("?","&")),a=n+o),r({...t,url:a})})),s=window.wp.url;function i(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var c=function(e){const t=Object.fromEntries(Object.entries(e).map((([e,t])=>[(0,s.normalizePath)(e),t])));return(e,r)=>{const{parse:n=!0}=e;let a=e.path;if(!a&&e.url){const{rest_route:t,...r}=(0,s.getQueryArgs)(e.url);"string"==typeof t&&(a=(0,s.addQueryArgs)(t,r))}if("string"!=typeof a)return r(e);const o=e.method||"GET",c=(0,s.normalizePath)(a);if("GET"===o&&t[c]){const e=t[c];return delete t[c],i(e,!!n)}if("OPTIONS"===o&&t[o]&&t[o][c]){const e=t[o][c];return delete t[o][c],i(e,!!n)}return r(e)}};const d=({path:e,url:t,...r},n)=>({...r,url:t&&(0,s.addQueryArgs)(t,n),path:e&&(0,s.addQueryArgs)(e,n)}),p=e=>e.json?e.json():Promise.reject(e),u=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 h=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({...d(e,{per_page:100}),parse:!1}),n=await p(r);if(!Array.isArray(n))return n;let a=u(r);if(!a)return n;let o=[].concat(n);for(;a;){const t=await T({...e,path:void 0,url:a,parse:!1}),r=await p(t);o=o.concat(r),a=u(t)}return o};const l=new Set(["PATCH","PUT","DELETE"]),f="GET";const w=(e,t=!0)=>Promise.resolve(((e,t=!0)=>t?204===e.status?null:e.json?e.json():Promise.reject(e):e)(e,t)).catch((e=>m(e,t)));function m(e,t=!0){if(!t)throw e;return(e=>{const t={code:"invalid_json",message:(0,r.__)("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((()=>{throw t}))})(e).then((e=>{const t={code:"unknown_error",message:(0,r.__)("An unknown error occurred.")};throw e||t}))}var g=(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 n=0;const a=e=>(n++,t({path:`/wp/v2/media/${e}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((()=>n<5?a(e):(t({path:`/wp/v2/media/${e}?force=true`,method:"DELETE"}),Promise.reject()))));return t({...e,parse:!1}).catch((t=>{const n=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&n?a(n).catch((()=>!1!==e.parse?Promise.reject({code:"post_process",message:(0,r.__)("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t))):m(t,e.parse)})).then((t=>w(t,e.parse)))};var y=e=>(t,r)=>("string"!=typeof t.url||(0,s.hasQueryArg)(t.url,"wp_theme_preview")||(t.url=(0,s.addQueryArgs)(t.url,{wp_theme_preview:e})),"string"!=typeof t.path||(0,s.hasQueryArg)(t.path,"wp_theme_preview")||(t.path=(0,s.addQueryArgs)(t.path,{wp_theme_preview:e})),r(t));const _={Accept:"application/json, */*;q=0.1"},v={credentials:"include"},P=[(e,t)=>("string"!=typeof e.url||(0,s.hasQueryArg)(e.url,"_locale")||(e.url=(0,s.addQueryArgs)(e.url,{_locale:"user"})),"string"!=typeof e.path||(0,s.hasQueryArg)(e.path,"_locale")||(e.path=(0,s.addQueryArgs)(e.path,{_locale:"user"})),t(e)),a,(e,t)=>{const{method:r=f}=e;return l.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},h];const O=e=>{if(e.status>=200&&e.status<300)return e;throw e};let j=e=>{const{url:t,path:n,data:a,parse:o=!0,...s}=e;let{body:i,headers:c}=e;c={..._,...c},a&&(i=JSON.stringify(a),c["Content-Type"]="application/json");return window.fetch(t||n||window.location.href,{...v,...s,body:i,headers:c}).then((e=>Promise.resolve(e).then(O).catch((e=>m(e,o))).then((e=>w(e,o)))),(e=>{if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:(0,r.__)("You are probably offline.")}}))};function A(e){return P.reduceRight(((e,t)=>r=>t(r,e)),j)(e).catch((t=>"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(A.nonceEndpoint).then(O).then((e=>e.text())).then((t=>(A.nonceMiddleware.nonce=t,A(e))))))}A.use=function(e){P.unshift(e)},A.setFetchHandler=function(e){j=e},A.createNonceMiddleware=n,A.createPreloadingMiddleware=c,A.createRootURLMiddleware=o,A.fetchAllMiddleware=h,A.mediaUploadMiddleware=g,A.createThemePreviewMiddleware=y;var T=A;(window.wp=window.wp||{}).apiFetch=t.default}(); |