PageSourceSearch

https://kingjamesbiblereader.com/assets/RefreshCache-CiVBhpWp.js

js kingjamesbiblereader.com collected 2026-09-24 14:46:21 UTC 3,630 bytes, 1 lines download raw bytes

1import{r as o,j as e,aw as h,J as m,V as p,I as g,b as w,i as v,a9 as j}from"./index-Cshou3OC.js";function y(){const[l,c]=o.useState("checking"),[d,u]=o.useState(0),x=async()=>{try{if(typeof navigator<"u"&&navigator.onLine===!1){window.location.href="/";return}let a=!1,n=!1;if("serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistration();t&&(await t.update().catch(()=>{}),t.waiting?(a=!0,t.waiting.postMessage({type:"SKIP_WAITING"})):t.installing&&(t.installing.state==="installed"||t.installing.state==="activating"||t.installing.state==="activated"?(a=!0,t.installing.postMessage({type:"SKIP_WAITING"})):a=await new Promise(s=>{let r=!1;const i=t.installing,f=()=>{i.state==="installed"||i.state==="activating"||i.state==="activated"?r||(r=!0,i.postMessage({type:"SKIP_WAITING"}),s(!0)):i.state==="redundant"&&(r||(r=!0,s(!1)))};i.addEventListener("statechange",f),setTimeout(()=>{r||(r=!0,i.removeEventListener("statechange",f),s(!1))},6e3)})))}if(n=await w(),await v()||(n=!0),!a&&!n){c("no_update"),setTimeout(()=>{window.location.href="/"},1200);return}if(c("updating"),n){const t=await caches.keys();await Promise.all(t.map(s=>caches.delete(s))),localStorage.removeItem("bible_cache_version"),localStorage.removeItem("bible_last_refresh"),localStorage.removeItem("kjb-daily-verse-cache"),await j(s=>u(s))}c("success");try{sessionStorage.setItem("kjb_sw_updated",a&&n?"both":n?"bible":a?"app":"forced_update")}catch{}setTimeout(()=>{window.location.href="/"},1200)}catch(a){console.error("Cache refresh failed:",a),setTimeout(()=>{window.location.href="/"},2e3)}};return o.useEffect(()=>{x()},[]),e.jsx("div",{className:"fixed inset-0 z-[9999] bg-background flex flex-col items-center justify-center opacity-100",children:e.jsxs("div",{className:"flex flex-col items-center justify-center -mt-16 w-full max-w-sm px-6",children:[e.jsxs("div",{className:"relative mb-12",children:[e.jsx("div",{className:"absolute inset-0 bg-primary/20 blur-3xl rounded-full scale-150 animate-pulse"}),e.jsx(h,{alt:"KJB Reader",className:"relative w-32 h-32 object-contain drop-shadow-xl"})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6 w-full",children:[l==="checking"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(m,{className:"w-6 h-6 animate-spin text-primary/70",style:{animationDuration:"2s"}}),e.jsx("span",{className:"font-sans text-xs text-foreground/70 font-medium tracking-[0.2em] uppercase",children:"Checking for updates..."})]}),l==="updating"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 w-full text-center",children:[e.jsx(m,{className:"w-6 h-6 animate-spin text-primary/70",style:{animationDuration:"2s"}}),e.jsx("span",{className:"font-sans text-xs text-foreground/70 font-medium tracking-[0.2em] uppercase",children:"Updating cache..."}),d>0&&e.jsx("div",{className:"w-48 max-w-full bg-secondary rounded-full h-1 mt-1",children:e.jsx("div",{className:"bg-primary h-1 rounded-full transition-all duration-300",style:{width:`${d}%`}})})]}),l==="success"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(p,{className:"w-6 h-6 text-green-600"}),e.jsx("span",{className:"font-sans text-xs text-foreground/70 font-medium tracking-[0.2em] uppercase",children:"Cache updated..."})]}),l==="no_update"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(g,{className:"w-6 h-6 text-blue-500"}),e.jsx("span",{className:"font-sans text-xs text-foreground/70 font-medium tracking-[0.2em] uppercase",children:"App is up to date..."})]})]})]})})}export{y as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.