'use strict'; const MANIFEST = 'flutter-app-manifest'; const TEMP = 'flutter-temp-cache'; const CACHE_NAME = 'flutter-app-cache'; const RESOURCES = { "assets/AssetManifest.json": "7ceda6dd13738309d0b4d4d2702b3010", "assets/assets/animations/MDLF_animation.flr": "5151e91ce20a70dbc097f01a7ec97497", "assets/assets/files/session.json": "d41d8cd98f00b204e9800998ecf8427e", "assets/FontManifest.json": "dc3d03800ccca4601324923c0b1d6d57", "assets/fonts/MaterialIcons-Regular.otf": "4e6447691c9509f7acdbf8a931a85ca1", "assets/NOTICES": "838205c3fa2fbd0319ce48d7c8347af6", "assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "6d342eb68f170c97609e9da345464e5e", "favicon.png": "5dcef449791fa27946b3d35ad8803796", "icons/android-icon-144x144.png": "25849c1de85e1ac87dfde295a6c97dfe", "icons/android-icon-192x192.png": "2f38b513d97a00ddf494059260c193b5", "icons/android-icon-36x36.png": "5317b23569b5976037738ae5dec04859", "icons/android-icon-48x48.png": "1f7a48a32ed8b3d4c1e6fa7734534fc7", "icons/android-icon-72x72.png": "6db0636ec0c228480197e362f3f32fe5", "icons/android-icon-96x96.png": "d925090c0a2f6b1a24078a8640fb18e4", "icons/apple-icon-114x114.png": "ddd67f65d43fb30b64ebf7b3ff702427", "icons/apple-icon-120x120.png": "b6bee39cb32e80068c5e1e87c600ffbc", "icons/apple-icon-144x144.png": "25849c1de85e1ac87dfde295a6c97dfe", "icons/apple-icon-152x152.png": "42b1ae2dedce452961803388468d6eae", "icons/apple-icon-180x180.png": "17655db1c0eaff334ff6208d302a576a", "icons/apple-icon-57x57.png": "ffd9c2b4dfe93b5874edbef7a3829495", "icons/apple-icon-60x60.png": "5984c1c3aca2b357f604855446cf30f5", "icons/apple-icon-72x72.png": "6db0636ec0c228480197e362f3f32fe5", "icons/apple-icon-76x76.png": "45bb7aabc4d7211f0ee13c77e6300ec4", "icons/apple-icon-precomposed.png": "9cd7f52d632b4bb32f3b701eed4ec663", "icons/apple-icon.png": "9cd7f52d632b4bb32f3b701eed4ec663", "icons/browserconfig.xml": "653d077300a12f09a69caeea7a8947f8", "icons/favicon-16x16.png": "4fca1fd9f6c90305df787a99fe7abf62", "icons/favicon-32x32.png": "e78cf52bb5861c5829d6f2b63e0f703e", "icons/favicon-96x96.png": "91b367951bf21712259a3aa598456d29", "icons/favicon.ico": "941f61fe5dd76ff538f9fd9456705d7a", "icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1", "icons/Icon-512.png": "96e752610906ba2a93c65f8abe1645f1", "icons/manifest.json": "b58fcfa7628c9205cb11a1b2c3e8f99a", "icons/ms-icon-144x144.png": "7f185a22f8c85fb7ccd97cd7711214e5", "icons/ms-icon-150x150.png": "5e33aababf68472e0bcc89c752e33fec", "icons/ms-icon-310x310.png": "9eace62e32aec3853604ae2919eca0ea", "icons/ms-icon-70x70.png": "6720855c40d6a5ba6cd4a384605fc270", "index.html": "d386435290fa1bf936a03f5c3b21d6ea", "/": "d386435290fa1bf936a03f5c3b21d6ea", "main.dart.js": "275e04c7cdd9190987acc7778e27bf8c", "manifest.json": "2ea69ab3cf494be775c9c65d32512a45", "version.json": "c659aa18797537bf2ce076aa3126b86e" }; // The application shell files that are downloaded before a service worker can // start. const CORE = [ "/", "main.dart.js", "index.html", "assets/NOTICES", "assets/AssetManifest.json", "assets/FontManifest.json"]; // During install, the TEMP cache is populated with the application shell files. self.addEventListener("install", (event) => { self.skipWaiting(); return event.waitUntil( caches.open(TEMP).then((cache) => { return cache.addAll( CORE.map((value) => new Request(value, {'cache': 'reload'}))); }) ); }); // During activate, the cache is populated with the temp files downloaded in // install. If this service worker is upgrading from one with a saved // MANIFEST, then use this to retain unchanged resource files. self.addEventListener("activate", function(event) { return event.waitUntil(async function() { try { var contentCache = await caches.open(CACHE_NAME); var tempCache = await caches.open(TEMP); var manifestCache = await caches.open(MANIFEST); var manifest = await manifestCache.match('manifest'); // When there is no prior manifest, clear the entire cache. if (!manifest) { await caches.delete(CACHE_NAME); contentCache = await caches.open(CACHE_NAME); for (var request of await tempCache.keys()) { var response = await tempCache.match(request); await contentCache.put(request, response); } await caches.delete(TEMP); // Save the manifest to make future upgrades efficient. await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES))); return; } var oldManifest = await manifest.json(); var origin = self.location.origin; for (var request of await contentCache.keys()) { var key = request.url.substring(origin.length + 1); if (key == "") { key = "/"; } // If a resource from the old manifest is not in the new cache, or if // the MD5 sum has changed, delete it. Otherwise the resource is left // in the cache and can be reused by the new service worker. if (!RESOURCES[key] || RESOURCES[key] != oldManifest[key]) { await contentCache.delete(request); } } // Populate the cache with the app shell TEMP files, potentially overwriting // cache files preserved above. for (var request of await tempCache.keys()) { var response = await tempCache.match(request); await contentCache.put(request, response); } await caches.delete(TEMP); // Save the manifest to make future upgrades efficient. await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES))); return; } catch (err) { // On an unhandled exception the state of the cache cannot be guaranteed. console.error('Failed to upgrade service worker: ' + err); await caches.delete(CACHE_NAME); await caches.delete(TEMP); await caches.delete(MANIFEST); } }()); }); // The fetch handler redirects requests for RESOURCE files to the service // worker cache. self.addEventListener("fetch", (event) => { if (event.request.method !== 'GET') { return; } var origin = self.location.origin; var key = event.request.url.substring(origin.length + 1); // Redirect URLs to the index.html if (key.indexOf('?v=') != -1) { key = key.split('?v=')[0]; } if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') { key = '/'; } // If the URL is not the RESOURCE list then return to signal that the // browser should take over. if (!RESOURCES[key]) { return; } // If the URL is the index.html, perform an online-first request. if (key == '/') { return onlineFirst(event); } event.respondWith(caches.open(CACHE_NAME) .then((cache) => { return cache.match(event.request).then((response) => { // Either respond with the cached resource, or perform a fetch and // lazily populate the cache. return response || fetch(event.request).then((response) => { cache.put(event.request, response.clone()); return response; }); }) }) ); }); self.addEventListener('message', (event) => { // SkipWaiting can be used to immediately activate a waiting service worker. // This will also require a page refresh triggered by the main worker. if (event.data === 'skipWaiting') { self.skipWaiting(); return; } if (event.data === 'downloadOffline') { downloadOffline(); return; } }); // Download offline will check the RESOURCES for all files not in the cache // and populate them. async function downloadOffline() { var resources = []; var contentCache = await caches.open(CACHE_NAME); var currentContent = {}; for (var request of await contentCache.keys()) { var key = request.url.substring(origin.length + 1); if (key == "") { key = "/"; } currentContent[key] = true; } for (var resourceKey of Object.keys(RESOURCES)) { if (!currentContent[resourceKey]) { resources.push(resourceKey); } } return contentCache.addAll(resources); } // Attempt to download the resource online before falling back to // the offline cache. function onlineFirst(event) { return event.respondWith( fetch(event.request).then((response) => { return caches.open(CACHE_NAME).then((cache) => { cache.put(event.request, response.clone()); return response; }); }).catch((error) => { return caches.open(CACHE_NAME).then((cache) => { return cache.match(event.request).then((response) => { if (response != null) { return response; } throw error; }); }); }) ); }