<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover" />

    <title>Nexara Super App</title>
    <meta name="description" content="Nexara Super App - Fast Internet, Marketplace, Cloud Gaming, OTT Entertainment & Smart Home." />

    <!-- Web App Manifest -->
    <link rel="manifest" href="/manifest.json" />

    <!-- Theme & Status Bar Colors -->
    <meta name="theme-color" content="#6D3DF5" />
    <meta name="msapplication-TileColor" content="#020617" />
    <meta name="msapplication-navbutton-color" content="#6D3DF5" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="Nexara" />

    <!-- High-Resolution PWA & Browser Icons -->
    <link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32.png" />
    <link rel="icon" type="image/png" sizes="48x48" href="/icons/favicon-48.png" />
    <link rel="icon" type="image/png" sizes="192x192" href="/icons/icon-192.png" />
    <link rel="icon" type="image/png" sizes="512x512" href="/icons/icon-512.png" />
    <link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png" />
    <link rel="shortcut icon" href="/icons/favicon-32.png" />

    <!-- Early PWA beforeinstallprompt capture & Service Worker registration -->
    <script>
      (function() {
        // Automatic chunk mismatch & deployment sync auto-recovery
        window.addEventListener('error', function(event) {
          var msg = (event && (event.message || '')) + '';
          var file = (event && (event.filename || '')) + '';
          var isChunkMismatch = 
            msg.indexOf("Unexpected token '<'") !== -1 ||
            msg.indexOf("Requiring unknown module") !== -1 ||
            msg.indexOf("Loading chunk") !== -1 ||
            (msg.indexOf("failed to fetch") !== -1 && file.indexOf('.js') !== -1);

          if (isChunkMismatch) {
            var reloadKey = 'nexara_stale_reload_' + (file || 'bundle');
            if (!sessionStorage.getItem(reloadKey)) {
              sessionStorage.setItem(reloadKey, 'true');
              console.warn('[Nexara Recovery] Stale bundle or chunk mismatch detected. Auto-recovering...', msg);
              if ('serviceWorker' in navigator) {
                navigator.serviceWorker.getRegistrations().then(function(registrations) {
                  for (var i = 0; i < registrations.length; i++) {
                    registrations[i].unregister();
                  }
                }).finally(function() {
                  if ('caches' in window) {
                    caches.keys().then(function(keys) {
                      return Promise.all(keys.map(function(k) { return caches.delete(k); }));
                    }).finally(function() {
                      window.location.reload();
                    });
                  } else {
                    window.location.reload();
                  }
                });
              } else {
                window.location.reload();
              }
            }
          }
        });

        window.__pwaInstallPrompt = null;
        window.addEventListener('beforeinstallprompt', function(e) {
          e.preventDefault();
          window.__pwaInstallPrompt = e;
          window.dispatchEvent(new CustomEvent('nexara-install-ready', { detail: e }));
        });
        if ('serviceWorker' in navigator) {
          window.addEventListener('load', function() {
            navigator.serviceWorker.register('/sw.js').catch(function(err) {
              console.warn('Nexara SW registration:', err);
            });
          });
        }
      })();
    </script>

    <!-- The `react-native-web` recommended style reset: https://necolas.github.io/react-native-web/docs/setup/#root-element -->
    <style id="expo-reset">
      /* These styles make the body full-height */
      html,
      body {
        height: 100%;
        background-color: #020617;
      }
      /* These styles disable body scrolling if you are using <ScrollView> */
      body {
        overflow: hidden;
      }
      /* These styles make the root element full-height */
      #root {
        display: flex;
        height: 100%;
        flex: 1;
        background-color: #020617;
      }
    </style>
  <link rel="preload" href="/_expo/static/css/web-eb16faf8e35ced506cd2e609cfc3834a.css" as="style"><link rel="stylesheet" href="/_expo/static/css/web-eb16faf8e35ced506cd2e609cfc3834a.css"><link rel="preload" href="/_expo/static/css/NexaraLoader-5d1c2c926358e8c8c0448feff52020bf.css" as="style"><link rel="stylesheet" href="/_expo/static/css/NexaraLoader-5d1c2c926358e8c8c0448feff52020bf.css"></head>

  <body style="background-color: #020617;">
    <!-- Use static rendering with Expo Router to support running without JavaScript. -->
    <noscript>
      <div style="background-color: #020617; color: #ffffff; padding: 20px; font-family: system-ui, sans-serif; text-align: center;">
        Please enable JavaScript to experience Nexara Super App.
      </div>
    </noscript>
    <!-- The root element for your Expo app. -->
    <div id="root"></div>
  <script src="/_expo/static/js/web/entry-423357ca527e0e9c75ec84ee151bc262.js" defer></script>
</body>
</html>
