index.min.js
1 lines
| 1 | (()=>{var T=/^[^/]+\/widgets\//,u;function p(){return{manifests:new Map(),downloads:new Map(),active:0,queue:[]};}function h(e){let t=e;return!!t&&t.manifests instanceof Map&&t.downloads instanceof Map&&typeof t.active=="number"&&Array.isArray(t.queue);}function y(){let e=window,t=e.__jetpackWpBuildI18nCatalogs;if(t===void 0){let n=p();return e.__jetpackWpBuildI18nCatalogs=n,n;}return h(t)?t:(u||(d("Shared catalog state on window has an unrecognized shape; downloads will not be deduped across module copies."),u=p()),u);}function C(e,t,n){return new Promise(a=>{let o=()=>{e.active++;let s=!1,l=()=>{s||(s=!0,clearTimeout(r),I(e));},r=setTimeout(()=>{d(`Catalog download for ${t} has held a slot for 30000ms; releasing it so queued downloads can proceed.`),l();},3e4);r.unref?.(),a(n().finally(l));};e.active<6?o():e.queue.push(o);});}function I(e){e.active--;let t=e.queue.shift();t&&t();}function _(e,t,n,a){let o=`${n}|${a}`,s=t.downloads.get(o);return s||(s=C(t,a,()=>e.downloadI18n(a,n,"plugin")).catch(l=>{let r=f(l);m(r)||d(`Failed to load "${n}" catalog (${a}): ${r}`);}),t.downloads.set(o,s)),s;}function d(e){console.warn(`[jetpack-i18n] ${e}`);}function f(e){return e instanceof Error?e.message:String(e);}function m(e){let t=/^HTTP request failed: (\d+)\b/.exec(e);return t!==null&&t[1]==="404";}async function $(e){let t=new URL("../../i18n-manifest.json",e);t.search=new URL(e).search;let n=await fetch(t,{cache:"no-cache"});if(!n.ok)throw new Error(`HTTP request failed: ${n.status} ${n.statusText}`);let a=await n.json();return Array.isArray(a?.bundles)?a.bundles.filter(o=>typeof o=="string"):[];}async function S(e,t,n=5e3){let a=window.wp?.jpI18nLoader;if(!a||typeof a.downloadI18n!="function"){d(`wp.jpI18nLoader unavailable; "${e}" strings will render untranslated.`);return;}if(a.state?.locale==="en_US")return;let o=y(),s=async()=>{let i=o.manifests.get(e);i||(i=$(t).catch(c=>{let w=f(c);return m(w)||d(`Failed to load the i18n manifest for "${e}": ${w}`),[];}).then(c=>new Set(c)),o.manifests.set(e,i));let g=[];for(let c of await i)T.test(c)||g.push(_(a,o,e,c));await Promise.all(g);},l,r=!1;try{await Promise.race([s().finally(()=>{r=!0;}),new Promise(i=>{l=setTimeout(i,n);})]);}catch(i){d(`Unexpected failure loading "${e}" catalogs: ${f(i)}`);return;}finally{clearTimeout(l);}r||d(`"${e}" catalog downloads still pending after ${n}ms; rendering may start untranslated.`);}var v={};async function O(){await S("jetpack-backup-pkg",v.url);}})();//# sourceMappingURL=index.min.js.map |