import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{_t as t,vt as n}from"./control-ui-core-Br5DB0Zj.js";function r(e){return e.state===`activated`||e.state===`redundant`?Promise.resolve(e.state===`activated`):new Promise(t=>{let n=()=>{(e.state===`activated`||e.state===`redundant`)&&(e.removeEventListener(`statechange`,n),t(e.state===`activated`))};e.addEventListener(`statechange`,n),n()})}async function i(){let e=typeof navigator<`u`&&`serviceWorker`in navigator?navigator.serviceWorker:null;if(!e)return!1;let t=await e.getRegistration();if(!t)return!1;let n=e.controller??t.active,r=t.installing??t.waiting??(t.active&&t.active!==n?t.active:null);if(r)return a(e,r);await t.update();let i=t.installing??t.waiting??(t.active===n?null:t.active);return i?a(e,i):!1}async function a(e,n){let i=!1,a=e=>{i||=t(e.data)};e.addEventListener(`message`,a);try{return await r(n)&&i}finally{e.removeEventListener(`message`,a)}}function o(){return(o=e((()=>{n()})))()}o();export{i as refreshControlUiServiceWorker};
//# sourceMappingURL=sw-refresh.runtime-DzfKF8m3.js.map