const CACHE = 'fm-backflash-v486c-live-overlay';
const CORE = [
  './','./index.html','./public-config.js','./styles.css','./js/engine/tactics-v42.js','./data.js','./data/embedded-data.js','./app.js',
  './js/engine/events-v43.js','./js/engine/contracts-v44.js',
  './js/stadium-and-report.js','./js/v22-global-leagues-training.js','./js/v23-cups-deposit.js',
  './js/v32-history.js','./js/core/data-loader.js','./js/engine/player-dna.js','./js/core/pwa.js',
  './js/engine/match-scenes-v48.js',
  './videos/90mingoal.mp4',
  './videos/classicgoal.mp4',
  './videos/headergoal.mp4',
  './videos/freekickgoal.mp4',
  './videos/penaltygoal.mp4',
  './videos/defongoal.mp4',
  './videos/countergoal.mp4',
  './videos/conternogoal.mp4',
  './videos/bigsave.mp4',
  './videos/lastminutesave.mp4',
  './videos/penaltymiss.mp4',
  './videos/bigchance.mp4',
  './videos/cornerchance.mp4',
  './videos/redcard.mp4',
  './videos/yellowcard.mp4',
  './videos/foul.mp4',
  './js/ui/donation-v483.js',
  
  './assets/match-scenes/toooor.png',
  './assets/background-stadium.jpg','./assets/background-match.jpg','./assets/matchday.jpg','./assets/kits.jpg','./assets/crests.jpg',
  './manifest.webmanifest','./assets/retro-logo.jpg','./assets/icons/icon-192.png','./assets/icons/icon-512.png','./assets/icons/apple-touch-icon.png',
  './js/ui/tactical-board.js','./js/engine/tactics-v42.js','./js/engine/events-v43.js','./js/engine/contracts-v44.js','./js/engine/career-world-v45.js','./js/engine/player-search-v46.js'
];
self.addEventListener('install', event => event.waitUntil(caches.open(CACHE).then(cache => cache.addAll(CORE)).then(() => self.skipWaiting())));
self.addEventListener('activate', event => event.waitUntil(caches.keys().then(keys => Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))).then(() => self.clients.claim())));
self.addEventListener('fetch', event => {
  if (event.request.method !== 'GET') return;
  event.respondWith(caches.match(event.request).then(cached => cached || fetch(event.request).then(response => {
    const copy = response.clone();
    caches.open(CACHE).then(cache => cache.put(event.request, copy));
    return response;
  }).catch(() => caches.match('./index.html'))));
});
