1/** 2 * Welcome to your Workbox-powered service worker! 3 * 4 * You'll need to register this file in your web app and you should 5 * disable HTTP caching for this file too. 6 * See https://goo.gl/nhQhGp 7 * 8 * The rest of the code is auto-generated. Please don't update this file 9 * directly; instead, make changes to your Workbox build configuration 10 * and re-run your build process. 11 * See https://goo.gl/2aRDsh 12 */ 13 14importScripts("workbox-v4.3.1/workbox-sw.js"); 15workbox.setConfig({modulePathPrefix: "workbox-v4.3.1"}); 16 17workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"}); 18 19workbox.core.skipWaiting(); 20 21workbox.core.clientsClaim(); 22 23/** 24 * The workboxSW.precacheAndRoute() method efficiently caches and responds to 25 * requests for URLs in the manifest. 26 * See https://goo.gl/S9QRab 27 */ 28self.__precacheManifest = [ 29 { 30 "url": "assets/icons/zicasso-favicon.png", 31 "revision": "6505c3788ffdb5dab96d405b9e051fdc" 32 }, 33 { 34 "url": "icons/icon-144x144.png", 35 "revision": "fa344b18b61bd0b2f09d0edb57153777" 36 }, 37 { 38 "url": "icons/icon-192x192.png", 39 "revision": "d8bd1b674ddd937176bb064efa7bf354" 40 }, 41 { 42 "url": "icons/icon-256x256.png", 43 "revision": "9206c1f4c9c3702c4444042f6897c4b5" 44 }, 45 { 46 "url": "icons/icon-384x384.png", 47 "revision": "2eb4ed45021a130a74f50d0a9e45d8d9" 48 }, 49 { 50 "url": "icons/icon-48x48.png", 51 "revision": "eefc706e2ecef3610ec9a33f0d9d7559" 52 }, 53 { 54 "url": "icons/icon-512x512.png", 55 "revision": "7d129b06973a44a314e8c8625b5e7f15" 56 }, 57 { 58 "url": "icons/icon-72x72.png", 59 "revision": "6505c3788ffdb5dab96d405b9e051fdc" 60 }, 61 { 62 "url": "icons/icon-96x96.png", 63 "revision": "94431c39c3304b0369ec11a2cd220c12" 64 }, 65 { 66 "url": "framework-923917f2793193454a61.js" 67 }, 68 { 69 "url": "styles.52da2b1ee3fde988a49e.css" 70 }, 71 { 72 "url": "styles-26dab28f5045967cb62b.js" 73 }, 74 { 75 "url": "284e557b-a76d0867ed5552281347.js" 76 }, 77 { 78 "url": "app-a16fd179237ffcab0d7b.js" 79 }, 80 { 81 "url": "offline-plugin-app-shell-fallback/index.html", 82 "revision": "6a4a3192d919000de6251ee516440787" 83 }, 84 { 85 "url": "webpack-runtime-479ecd2f708684a09252.js" 86 }, 87 { 88 "url": "manifest.webmanifest", 89 "revision": "480acec680a0398e132fb861a282baa7" 90 } 91].concat(self.__precacheManifest || []); 92workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); 93 94workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, new workbox.strategies.CacheFirst(), 'GET'); 95workbox.routing.registerRoute(/^https?:.*\/page-data\/.*\.json/, new workbox.strategies.StaleWhileRevalidate(), 'GET'); 96workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|avif|svg|gif|tiff|js|woff|woff2|json|css)$/, new workbox.strategies.StaleWhileRevalidate(), 'GET'); 97workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, new workbox.strategies.StaleWhileRevalidate(), 'GET'); 98 99/* global importScripts, workbox, idbKeyval */ 100importScripts(`idb-keyval-3.2.0-iife.min.js`) 101 102const { NavigationRoute } = workbox.routing 103 104let lastNavigationRequest = null 105let offlineShellEnabled = true 106 107// prefer standard object syntax to support more browsers 108const MessageAPI = { 109 setPathResources: (event, { path, resources }) => { 110 event.waitUntil(idbKeyval.set(`resources:${path}`, resources)) 111 }, 112 113 clearPathResources: event => { 114 event.waitUntil(idbKeyval.clear()) 115 116 // We detected compilation hash mismatch 117 // we should clear runtime cache as data 118 // files might be out of sync and we should 119 // do fresh fetches for them 120 event.waitUntil( 121 caches.keys().then(function (keyList) { 122 return Promise.all( 123 keyList.map(function (key) { 124 if (key && key.includes(`runtime`)) { 125 return caches.delete(key) 126 } 127 128 return Promise.resolve() 129 }) 130 ) 131 }) 132 ) 133 }, 134 135 enableOfflineShell: () => { 136 offlineShellEnabled = true 137 }, 138 139 disableOfflineShell: () => { 140 offlineShellEnabled = false 141 }, 142} 143 144self.addEventListener(`message`, event => { 145 const { gatsbyApi: api } = event.data 146 if (api) MessageAPI[api](event, event.data) 147}) 148 149function handleAPIRequest({ event }) { 150 const { pathname } = new URL(event.request.url) 151
152 const params = pathname.match(/:(.+)/)[1] 153 const data = {} 154 155 if (params.includes(`=`)) { 156 params.split(`&`).forEach(param => { 157 const [key, val] = param.split(`=`) 158 data[key] = val 159 }) 160 } else { 161 data.api = params 162 } 163 164 if (MessageAPI[data.api] !== undefined) { 165 MessageAPI[data.api]() 166 } 167 168 if (!data.redirect) { 169 return new Response() 170 } 171 172 return new Response(null, { 173 status: 302, 174 headers: { 175 Location: lastNavigationRequest, 176 }, 177 }) 178} 179 180const navigationRoute = new NavigationRoute(async ({ event }) => { 181 // handle API requests separately to normal navigation requests, so do this 182 // check first 183 if (event.request.url.match(/\/.gatsby-plugin-offline:.+/)) { 184 return handleAPIRequest({ event }) 185 } 186 187 if (!offlineShellEnabled) { 188 return await fetch(event.request) 189 } 190 191 lastNavigationRequest = event.request.url 192 193 let { pathname } = new URL(event.request.url) 194 pathname = pathname.replace(new RegExp(`^`), ``) 195 196 // Check for resources + the app bundle 197 // The latter may not exist if the SW is updating to a new version 198 const resources = await idbKeyval.get(`resources:${pathname}`) 199 if (!resources || !(await caches.match(`/app-a16fd179237ffcab0d7b.js`))) { 200 return await fetch(event.request) 201 } 202 203 for (const resource of resources) { 204 // As soon as we detect a failed resource, fetch the entire page from 205 // network - that way we won't risk being in an inconsistent state with 206 // some parts of the page failing. 207 if (!(await caches.match(resource))) { 208 return await fetch(event.request) 209 } 210 } 211 212 const offlineShell = `/offline-plugin-app-shell-fallback/index.html` 213 const offlineShellWithKey = workbox.precaching.getCacheKeyForURL(offlineShell) 214 return await caches.match(offlineShellWithKey) 215}) 216 217workbox.routing.registerRoute(navigationRoute) 218 219// this route is used when performing a non-navigation request (e.g. fetch) 220workbox.routing.registerRoute(/\/.gatsby-plugin-offline:.+/, handleAPIRequest)
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.