function e(e){return async function(t,n={}){let r=await fetch(e.apiUrl+t,{...n,headers:{"Content-Type":`application/json`,"X-WP-Nonce":e.nonce,...n.headers||{}},credentials:`same-origin`}),i=await r.json().catch(()=>({}));if(!r.ok)throw Error(i.message||e.i18n&&e.i18n.error||`Request failed`);return i}}export{e as t};