const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./yEH0RGHP.js","./DXb0ZbaM.js"])))=>i.map(i=>d[i]);
import{at as e,it as t}from"./AtxYAA_D.js";import"./CaWxcOZO.js";import{t as n}from"./DXb0ZbaM.js";var r={supported:!1,offlineReady:!1,updateAvailable:!1,updating:!1,error:null,installPromptAvailable:!1,offlineReadyDismissed:!1,updateDismissed:!1},i=3600*1e3,a=!1,o=null,s=null,c=e(r);function l(){if(a)return()=>void 0;a=!0,c.update(e=>({...e,supported:`serviceWorker`in navigator,error:null}));let e=[],t=e=>{e.preventDefault(),s=e,c.update(e=>({...e,installPromptAvailable:!0}))},r=()=>{s=null,c.update(e=>({...e,installPromptAvailable:!1}))};return window.addEventListener(`beforeinstallprompt`,t),window.addEventListener(`appinstalled`,r),e.push(()=>{window.removeEventListener(`beforeinstallprompt`,t),window.removeEventListener(`appinstalled`,r)}),`serviceWorker`in navigator&&n(async()=>{let{registerSW:e}=await import(`./yEH0RGHP.js`);return{registerSW:e}},__vite__mapDeps([0,1]),import.meta.url).then(({registerSW:t})=>{o=t({immediate:!0,onNeedRefresh(){c.update(e=>({...e,updateAvailable:!0,updateDismissed:!1,error:null}))},onOfflineReady(){c.update(e=>({...e,offlineReady:!0,offlineReadyDismissed:!1,error:null}))},onRegisteredSW(t,n){if(!n)return;let r=()=>{document.visibilityState===`visible`&&n.update()},a=window.setInterval(r,i),o=()=>r(),s=()=>r();window.addEventListener(`focus`,o),document.addEventListener(`visibilitychange`,s),e.push(()=>{window.clearInterval(a),window.removeEventListener(`focus`,o),document.removeEventListener(`visibilitychange`,s)})},onRegisterError(e){c.update(t=>({...t,error:h(e)}))}})}).catch(e=>{c.update(t=>({...t,error:h(e)}))}),()=>m(e)}async function u(){if(!(!o||t(c).updating)){c.update(e=>({...e,updating:!0,error:null}));try{await o(!0)}catch(e){c.update(t=>({...t,updating:!1,error:h(e)}))}}}function d(){c.update(e=>({...e,updateDismissed:!0}))}function f(){c.update(e=>({...e,offlineReadyDismissed:!0}))}async function p(){if(!s)return;let e=s;s=null,c.update(e=>({...e,installPromptAvailable:!1})),await e.prompt(),await e.userChoice.catch(()=>void 0)}function m(e){for(let t of e.splice(0))t();a=!1,o=null}function h(e){return e instanceof Error?e.message:`Service worker registration failed`}export{p as a,l as i,f as n,c as o,d as r,u as t};