/* Minimal JS for auto-refreshing the status page every 60 seconds */
(function () {
    const REFRESH_INTERVAL = 60000;

    function autoRefresh() {
        setTimeout(function () {
            fetch(window.location.href, { headers: { "X-Requested-With": "XMLHttpRequest" } })
                .then(function () {
                    window.location.reload();
                })
                .catch(function () {
                    // Silently fail — the page will try again next interval
                });
        }, REFRESH_INTERVAL);
    }

    if (document.readyState === "loading") {
        document.addEventListener("DOMContentLoaded", autoRefresh);
    } else {
        autoRefresh();
    }
})();