import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; import ErrorBoundary from "./ErrorBoundary"; import "./styles.css"; const root = document.getElementById("root"); if (root) { ReactDOM.createRoot(root).render( , ); } else { document.body.innerHTML = 'Capture by OzCrypt could not startThe app root was not found.'; } if (typeof navigator !== "undefined" && "serviceWorker" in navigator && import.meta.env.PROD) { let refreshing = false; navigator.serviceWorker.addEventListener("controllerchange", () => { if (refreshing) { return; } refreshing = true; window.location.reload(); }); window.addEventListener("load", () => { navigator.serviceWorker .register("/sw.js") .then((registration) => { const notifyUpdateReady = () => { window.dispatchEvent(new CustomEvent("capture:pwa-update-ready")); }; if (registration.waiting && navigator.serviceWorker.controller) { notifyUpdateReady(); } registration.addEventListener("updatefound", () => { const worker = registration.installing; worker?.addEventListener("statechange", () => { if (worker.state === "installed" && navigator.serviceWorker.controller) { notifyUpdateReady(); } }); }); }) .catch(() => { // The app remains usable without offline support. }); }); }
The app root was not found.