1var CACHE_VERSION = '0a37f415423689a79eb8474593474af7'; 2var CACHE_NAME = 'super-app-' + CACHE_VERSION; 3var API_CACHE_NAME = 'super-app-api-' + CACHE_VERSION; 4 5var BASE = new URL('./', self.location).href; 6var BASE_PATH = new URL(BASE).pathname; 7 8var ASSETS = ["api_context.json","favicon.ico","favicon.png","index.html","manifest.json","static/css/2.400b4122.chunk.css","static/css/main.fbecc941.chunk.css","static/js/2.5fbd0d37.chunk.js","static/js/main.93631fc2.chunk.js","static/js/runtime~main.d653cc00.js","static/media/AppStore.183780b4.png","static/media/GooglePlay.c5932540.png","static/media/Poppins-SemiBold.4cdacb8f.ttf","static/media/card-aluno.45aba4bf.png","static/media/card-b2c.61612f0e.png","static/media/card-cursos-livres.62e8d65c.png","static/media/card-duvidas.047e99f6.png","static/media/card-graduacao.642575be.png","static/media/card-login.33624cd0.png","static/media/card-pos-mba.70110dcc.png","static/media/card-publique-sua-obra.315a6e1a.png","static/media/closed-eye.14d6e5eb.svg","static/media/food-styling.c5995507.png","static/media/icon-attachment.9a1fd6ca.svg","static/media/icon-back-in-time.60a21ddf.svg","static/media/icon-back.65bd9caa.svg","static/media/icon-back.fc634e11.svg","static/media/icon-badge.6ad75a1d.png","static/media/icon-check.5a74be56.svg","static/media/icon-checked.3d8b6be0.svg","static/media/icon-coin.387eba39.png","static/media/icon-down.8dadb184.svg","static/media/icon-error.d59e58a7.svg","static/media/icon-info.4f5241fb.svg","static/media/icon-login.34584bd3.svg","static/media/icon-pdf.4c668605.svg","static/media/icon-play-active.52da6d4b.svg","static/media/icon-play.68dfde3f.svg","static/media/icon-remove.65b8d64b.svg","static/media/icon-right-enabled.ab17bdbb.svg","static/media/icon-right.5de2d392.svg","static/media/icon-right.c8047e9a.svg","static/media/icon-right.dd8aa579.svg","static/media/icon-search-right.c1695e1a.svg","static/media/icon-search.944f68ae.svg","static/media/icon-search.b639b113.svg","static/media/icon-send.737297b0.svg","static/media/icon-share.6681fada.svg","static/media/icon-summary.af85f635.svg","static/media/icon-talk.d5f12f03.svg","static/media/icon-text.620ad6aa.svg","static/media/icon-verified.17563b21.svg","static/media/icon-video.0aee0306.svg","static/media/icon-videos.8f44c463.svg","static/media/icon-warning.9c29034e.svg","static/media/icon-warning.e22a11d2.svg","static/media/icon-wifi-off.768be144.svg","static/media/icon-x.5527cf6a.svg","static/media/loader.9e0373c2.gif","static/media/logo.1cb6c83f.svg","static/media/logo.2905c021.png","static/media/logo.946ac76e.png","static/media/opened-eye.de1f4f69.svg","static/media/photo.7166c630.jpeg","static/media/slick.f97e3bbf.svg","static/media/unlock-icon.197d5a9d.svg","static/media/user-icon.9318a878.png"]; 9 10var API_CACHE_ROUTES = [ 11 '/cms/v1.1/user/data', 12 '/cms/v1.1/managed/content/group/', 13 '/cms/v1.1/managed/content/available', 14 '/cms/v1.1/managed/content/history', 15 '/cms/v1.1/managed/content/reference/', 16 '/cms/v1.1/learning/courses', 17 '/auth/v1.0/projects', 18 '/auth/v1.0/entity/schema/available', 19 '/auth/v1.1/entity/schema/available', 20]; 21 22function shouldCacheApi(url) { 23 if (url.pathname.indexOf('/token/') !== -1) return false; 24 if (url.pathname.indexOf('/interaction') !== -1) return false; 25 return API_CACHE_ROUTES.some(function(route) { 26 return url.pathname.indexOf(route) !== -1; 27 }); 28} 29 30function isImageRequest(url) { 31 return url.pathname.indexOf('/thumb') !== -1 || /\.(png|jpg|jpeg|gif|svg|ico|webp)/i.test(url.pathname); 32} 33 34function staleWhileRevalidate(request, cacheName) { 35 var cached = caches.match(request); 36 var fetched = fetch(request).then(function(response) { 37 if (response.ok) { 38 var r = response.clone(); 39 caches.open(cacheName).then(function(cache) { cache.put(request, r); }); 40 } 41 return response; 42 }).catch(function() {}); 43 return cached.then(function(cachedResponse) { 44 if (cachedResponse) return cachedResponse; 45 return fetched; 46 }); 47} 48 49self.addEventListener('install', function(event) { 50 event.waitUntil( 51 caches.open(CACHE_NAME).then(function(cache) { 52 return Promise.all( 53 ASSETS.map(function(url) { 54 return fetch(BASE + url).then(function(r) { 55 if (r.ok) cache.put(BASE + url, r); 56 }).catch(function() {}); 57 }) 58 ); 59 }).then(function() {
60 return self.skipWaiting(); 61 }) 62 ); 63}); 64 65self.addEventListener('activate', function(event) { 66 event.waitUntil( 67 caches.keys().then(function(keys) { 68 return Promise.all( 69 keys 70 .filter(function(k) { return k !== CACHE_NAME && k !== API_CACHE_NAME && k.indexOf('super-app-') === 0; }) 71 .map(function(k) { return caches.delete(k); }) 72 ); 73 }).then(function() { 74 return self.clients.claim(); 75 }) 76 ); 77}); 78 79self.addEventListener('fetch', function(event) { 80 if (event.request.method !== 'GET') return; 81 82 var url = new URL(event.request.url); 83 var path = url.pathname; 84 85 var isAsset = ASSETS.some(function(p) { return path === BASE_PATH + p; }); 86 var isHtml = path === BASE_PATH || path === BASE_PATH + 'index.html'; 87 88 if (isAsset || isHtml) { 89 event.respondWith( 90 caches.match(event.request).then(function(cached) { 91 if (cached) return cached; 92 return fetch(event.request).then(function(response) { 93 var r = response.clone(); 94 caches.open(CACHE_NAME).then(function(cache) { cache.put(event.request, r); }); 95 return response; 96 }); 97 }) 98 ); 99 return; 100 } 101 102 if (shouldCacheApi(url)) { 103 event.respondWith(staleWhileRevalidate(event.request, API_CACHE_NAME)); 104 return; 105 } 106 107 if (isImageRequest(url)) { 108 event.respondWith( 109 caches.match(event.request).then(function(cached) { 110 if (cached) return cached; 111 return fetch(event.request).then(function(response) { 112 if (response.ok) { 113 var r = response.clone(); 114 caches.open(API_CACHE_NAME).then(function(cache) { cache.put(event.request, r); }); 115 } 116 return response; 117 }); 118 }) 119 ); 120 } 121});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.