let fetching=!1,fetched=!1;function status(o){return o.status>=200&&o.status<300?Promise.resolve(o):Promise.reject(new Error(o.statusText))}export default o=>{var e,n;(o.config.analytics||o.config.automations)&&(null===(n=null===(e=null===window||void 0===window?void 0:window.wp)||void 0===e?void 0:e.hooks)||void 0===n||n.addAction("presto.playerPlaying","presto-player",(()=>{null===window||void 0===window||window.wp.hooks.doAction("presto.playerGetNonce")})),null===window||void 0===window||window.wp.hooks.addAction("presto.playerGetNonce","presto-player",(()=>{var o;fetching||fetched||(fetched=!0,fetch(`${null===(o=null===window||void 0===window?void 0:window.prestoPlayer)||void 0===o?void 0:o.ajaxurl}?action=presto_refresh_progress_nonce`).then(status).then((o=>o.json())).then((({data:o})=>{const e=o;null===window||void 0===window||window.wp.hooks.doAction("presto.nonceRefreshed",e),fetching=!0})).catch((function(o){console.log("Request failed",o)})).finally((()=>{fetched=!1})))})))};