jekyll-pwa-workbox 0.0.6 → 0.0.7.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll-pwa-workbox.rb +1 -1
  3. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.dev.js +819 -0
  4. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js +486 -0
  8. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.dev.js +192 -0
  12. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.dev.js +1643 -0
  16. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.dev.js +652 -0
  20. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.dev.js +103 -0
  24. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js +2 -0
  26. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.dev.js +236 -0
  28. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.dev.js +994 -0
  32. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.dev.js +263 -0
  36. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.dev.js +1026 -0
  40. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.dev.js +1127 -0
  44. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.dev.js +333 -0
  48. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-sw.js.map +1 -0
  53. data/lib/vendor/{workbox-v4.3.1 → workbox-v5.0.0.alpha1}/workbox-window.dev.es5.mjs +248 -262
  54. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/{workbox-v4.3.1 → workbox-v5.0.0.alpha1}/workbox-window.dev.mjs +234 -242
  56. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.umd.js +882 -0
  58. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.0.0.alpha1/workbox-window.prod.umd.js.map +1 -0
  65. metadata +75 -80
  66. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js +0 -822
  67. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js +0 -2
  69. data/lib/vendor/workbox-v4.3.1/workbox-background-sync.prod.js.map +0 -1
  70. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js +0 -496
  71. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.dev.js.map +0 -1
  72. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js +0 -2
  73. data/lib/vendor/workbox-v4.3.1/workbox-broadcast-update.prod.js.map +0 -1
  74. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js +0 -200
  75. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.dev.js.map +0 -1
  76. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js +0 -2
  77. data/lib/vendor/workbox-v4.3.1/workbox-cacheable-response.prod.js.map +0 -1
  78. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js +0 -1712
  79. data/lib/vendor/workbox-v4.3.1/workbox-core.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js +0 -2
  81. data/lib/vendor/workbox-v4.3.1/workbox-core.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js +0 -652
  83. data/lib/vendor/workbox-v4.3.1/workbox-expiration.dev.js.map +0 -1
  84. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js +0 -2
  85. data/lib/vendor/workbox-v4.3.1/workbox-expiration.prod.js.map +0 -1
  86. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js +0 -110
  87. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.dev.js.map +0 -1
  88. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js +0 -2
  89. data/lib/vendor/workbox-v4.3.1/workbox-navigation-preload.prod.js.map +0 -1
  90. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js +0 -243
  91. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.dev.js.map +0 -1
  92. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js +0 -2
  93. data/lib/vendor/workbox-v4.3.1/workbox-offline-ga.prod.js.map +0 -1
  94. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js +0 -989
  95. data/lib/vendor/workbox-v4.3.1/workbox-precaching.dev.js.map +0 -1
  96. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js +0 -2
  97. data/lib/vendor/workbox-v4.3.1/workbox-precaching.prod.js.map +0 -1
  98. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js +0 -268
  99. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.dev.js.map +0 -1
  100. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js +0 -2
  101. data/lib/vendor/workbox-v4.3.1/workbox-range-requests.prod.js.map +0 -1
  102. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js +0 -1020
  103. data/lib/vendor/workbox-v4.3.1/workbox-routing.dev.js.map +0 -1
  104. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js +0 -2
  105. data/lib/vendor/workbox-v4.3.1/workbox-routing.prod.js.map +0 -1
  106. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js +0 -1138
  107. data/lib/vendor/workbox-v4.3.1/workbox-strategies.dev.js.map +0 -1
  108. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js +0 -2
  109. data/lib/vendor/workbox-v4.3.1/workbox-strategies.prod.js.map +0 -1
  110. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js +0 -337
  111. data/lib/vendor/workbox-v4.3.1/workbox-streams.dev.js.map +0 -1
  112. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js +0 -2
  113. data/lib/vendor/workbox-v4.3.1/workbox-streams.prod.js.map +0 -1
  114. data/lib/vendor/workbox-v4.3.1/workbox-sw.js +0 -2
  115. data/lib/vendor/workbox-v4.3.1/workbox-sw.js.map +0 -1
  116. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.es5.mjs.map +0 -1
  117. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.mjs.map +0 -1
  118. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js +0 -896
  119. data/lib/vendor/workbox-v4.3.1/workbox-window.dev.umd.js.map +0 -1
  120. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs +0 -2
  121. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.es5.mjs.map +0 -1
  122. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs +0 -2
  123. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.mjs.map +0 -1
  124. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js +0 -2
  125. data/lib/vendor/workbox-v4.3.1/workbox-window.prod.umd.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"workbox-precaching.dev.js","sources":["../_version.mjs","../utils/precachePlugins.mjs","../addPlugins.mjs","../utils/cleanRedirect.mjs","../utils/createCacheKey.mjs","../utils/printCleanupDetails.mjs","../utils/printInstallDetails.mjs","../PrecacheController.mjs","../utils/getOrCreatePrecacheController.mjs","../utils/removeIgnoredSearchParams.mjs","../utils/generateURLVariations.mjs","../utils/getCacheKeyForURL.mjs","../utils/addFetchListener.mjs","../addRoute.mjs","../utils/deleteOutdatedCaches.mjs","../cleanupOutdatedCaches.mjs","../getCacheKeyForURL.mjs","../precache.mjs","../precacheAndRoute.mjs","../index.mjs"],"sourcesContent":["try{self['workbox:precaching:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n\nconst plugins = [];\n\nexport const precachePlugins = {\n /*\n * @return {Array}\n * @private\n */\n get() {\n return plugins;\n },\n\n /*\n * @param {Array} newPlugins\n * @private\n */\n add(newPlugins) {\n plugins.push(...newPlugins);\n },\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {precachePlugins} from './utils/precachePlugins.mjs';\nimport './_version.mjs';\n\n\n/**\n * Adds plugins to precaching.\n *\n * @param {Array<Object>} newPlugins\n *\n * @alias workbox.precaching.addPlugins\n */\nconst addPlugins = (newPlugins) => {\n precachePlugins.add(newPlugins);\n};\n\nexport {addPlugins};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n/**\n * @param {Response} response\n * @return {Response}\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport async function cleanRedirect(response) {\n const clonedResponse = response.clone();\n\n // Not all browsers support the Response.body stream, so fall back\n // to reading the entire body into memory as a blob.\n const bodyPromise = 'body' in clonedResponse ?\n Promise.resolve(clonedResponse.body) :\n clonedResponse.blob();\n\n const body = await bodyPromise;\n\n // new Response() is happy when passed either a stream or a Blob.\n return new Response(body, {\n headers: clonedResponse.headers,\n status: clonedResponse.status,\n statusText: clonedResponse.statusText,\n });\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\n\nimport '../_version.mjs';\n\n// Name of the search parameter used to store revision info.\nconst REVISION_SEARCH_PARAM = '__WB_REVISION__';\n\n/**\n * Converts a manifest entry into a versioned URL suitable for precaching.\n *\n * @param {Object} entry\n * @return {string} A URL with versioning info.\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function createCacheKey(entry) {\n if (!entry) {\n throw new WorkboxError('add-to-cache-list-unexpected-type', {entry});\n }\n\n // If a precache manifest entry is a string, it's assumed to be a versioned\n // URL, like '/app.abcd1234.js'. Return as-is.\n if (typeof entry === 'string') {\n const urlObject = new URL(entry, location);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href,\n };\n }\n\n const {revision, url} = entry;\n if (!url) {\n throw new WorkboxError('add-to-cache-list-unexpected-type', {entry});\n }\n\n // If there's just a URL and no revision, then it's also assumed to be a\n // versioned URL.\n if (!revision) {\n const urlObject = new URL(url, location);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href,\n };\n }\n\n // Otherwise, construct a properly versioned URL using the custom Workbox\n // search parameter along with the revision info.\n const originalURL = new URL(url, location);\n const cacheKeyURL = new URL(url, location);\n cacheKeyURL.searchParams.set(REVISION_SEARCH_PARAM, revision);\n return {\n cacheKey: cacheKeyURL.href,\n url: originalURL.href,\n };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {logger} from 'workbox-core/_private/logger.mjs';\n\nimport '../_version.mjs';\n\nconst logGroup = (groupTitle, deletedURLs) => {\n logger.groupCollapsed(groupTitle);\n\n for (const url of deletedURLs) {\n logger.log(url);\n }\n\n logger.groupEnd();\n};\n\n/**\n * @param {Array<string>} deletedURLs\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function printCleanupDetails(deletedURLs) {\n const deletionCount = deletedURLs.length;\n if (deletionCount > 0) {\n logger.groupCollapsed(`During precaching cleanup, ` +\n `${deletionCount} cached ` +\n `request${deletionCount === 1 ? ' was' : 's were'} deleted.`);\n logGroup('Deleted Cache Requests', deletedURLs);\n logger.groupEnd();\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {logger} from 'workbox-core/_private/logger.mjs';\n\nimport '../_version.mjs';\n\n/**\n * @param {string} groupTitle\n * @param {Array<string>} urls\n *\n * @private\n */\nfunction _nestedGroup(groupTitle, urls) {\n if (urls.length === 0) {\n return;\n }\n\n logger.groupCollapsed(groupTitle);\n\n for (const url of urls) {\n logger.log(url);\n }\n\n logger.groupEnd();\n}\n\n/**\n * @param {Array<string>} urlsToPrecache\n * @param {Array<string>} urlsAlreadyPrecached\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function printInstallDetails(urlsToPrecache, urlsAlreadyPrecached) {\n const precachedCount = urlsToPrecache.length;\n const alreadyPrecachedCount = urlsAlreadyPrecached.length;\n\n if (precachedCount || alreadyPrecachedCount) {\n let message =\n `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;\n\n if (alreadyPrecachedCount > 0) {\n message += ` ${alreadyPrecachedCount} ` +\n `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;\n }\n\n logger.groupCollapsed(message);\n\n _nestedGroup(`View newly precached URLs.`, urlsToPrecache);\n _nestedGroup(`View previously precached URLs.`, urlsAlreadyPrecached);\n logger.groupEnd();\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {cacheNames} from 'workbox-core/_private/cacheNames.mjs';\nimport {cacheWrapper} from 'workbox-core/_private/cacheWrapper.mjs';\nimport {fetchWrapper} from 'workbox-core/_private/fetchWrapper.mjs';\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\n\nimport {cleanRedirect} from './utils/cleanRedirect.mjs';\nimport {createCacheKey} from './utils/createCacheKey.mjs';\nimport {printCleanupDetails} from './utils/printCleanupDetails.mjs';\nimport {printInstallDetails} from './utils/printInstallDetails.mjs';\n\nimport './_version.mjs';\n\n\n/**\n * Performs efficient precaching of assets.\n *\n * @memberof module:workbox-precaching\n */\nclass PrecacheController {\n /**\n * Create a new PrecacheController.\n *\n * @param {string} [cacheName] An optional name for the cache, to override\n * the default precache name.\n */\n constructor(cacheName) {\n this._cacheName = cacheNames.getPrecacheName(cacheName);\n this._urlsToCacheKeys = new Map();\n }\n\n /**\n * This method will add items to the precache list, removing duplicates\n * and ensuring the information is valid.\n *\n * @param {\n * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>\n * } entries Array of entries to precache.\n */\n addToCacheList(entries) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isArray(entries, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'addToCacheList',\n paramName: 'entries',\n });\n }\n\n for (const entry of entries) {\n const {cacheKey, url} = createCacheKey(entry);\n if (this._urlsToCacheKeys.has(url) &&\n this._urlsToCacheKeys.get(url) !== cacheKey) {\n throw new WorkboxError('add-to-cache-list-conflicting-entries', {\n firstEntry: this._urlsToCacheKeys.get(url),\n secondEntry: cacheKey,\n });\n }\n this._urlsToCacheKeys.set(url, cacheKey);\n }\n }\n\n /**\n * Precaches new and updated assets. Call this method from the service worker\n * install event.\n *\n * @param {Object} options\n * @param {Event} [options.event] The install event (if needed).\n * @param {Array<Object>} [options.plugins] Plugins to be used for fetching\n * and caching during install.\n * @return {Promise<workbox.precaching.InstallResult>}\n */\n async install({event, plugins} = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (plugins) {\n assert.isArray(plugins, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'install',\n paramName: 'plugins',\n });\n }\n }\n\n const urlsToPrecache = [];\n const urlsAlreadyPrecached = [];\n\n const cache = await caches.open(this._cacheName);\n const alreadyCachedRequests = await cache.keys();\n const alreadyCachedURLs = new Set(alreadyCachedRequests.map(\n (request) => request.url));\n\n for (const cacheKey of this._urlsToCacheKeys.values()) {\n if (alreadyCachedURLs.has(cacheKey)) {\n urlsAlreadyPrecached.push(cacheKey);\n } else {\n urlsToPrecache.push(cacheKey);\n }\n }\n\n const precacheRequests = urlsToPrecache.map((url) => {\n return this._addURLToCache({event, plugins, url});\n });\n await Promise.all(precacheRequests);\n\n if (process.env.NODE_ENV !== 'production') {\n printInstallDetails(urlsToPrecache, urlsAlreadyPrecached);\n }\n\n return {\n updatedURLs: urlsToPrecache,\n notUpdatedURLs: urlsAlreadyPrecached,\n };\n }\n\n /**\n * Deletes assets that are no longer present in the current precache manifest.\n * Call this method from the service worker activate event.\n *\n * @return {Promise<workbox.precaching.CleanupResult>}\n */\n async activate() {\n const cache = await caches.open(this._cacheName);\n const currentlyCachedRequests = await cache.keys();\n const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());\n\n const deletedURLs = [];\n for (const request of currentlyCachedRequests) {\n if (!expectedCacheKeys.has(request.url)) {\n await cache.delete(request);\n deletedURLs.push(request.url);\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n printCleanupDetails(deletedURLs);\n }\n\n return {deletedURLs};\n }\n\n /**\n * Requests the entry and saves it to the cache if the response is valid.\n * By default, any response with a status code of less than 400 (including\n * opaque responses) is considered valid.\n *\n * If you need to use custom criteria to determine what's valid and what\n * isn't, then pass in an item in `options.plugins` that implements the\n * `cacheWillUpdate()` lifecycle event.\n *\n * @private\n * @param {Object} options\n * @param {string} options.url The URL to fetch and cache.\n * @param {Event} [options.event] The install event (if passed).\n * @param {Array<Object>} [options.plugins] An array of plugins to apply to\n * fetch and caching.\n */\n async _addURLToCache({url, event, plugins}) {\n const request = new Request(url, {credentials: 'same-origin'});\n let response = await fetchWrapper.fetch({\n event,\n plugins,\n request,\n });\n\n // Allow developers to override the default logic about what is and isn't\n // valid by passing in a plugin implementing cacheWillUpdate(), e.g.\n // a workbox.cacheableResponse.Plugin instance.\n let cacheWillUpdateCallback;\n for (const plugin of (plugins || [])) {\n if ('cacheWillUpdate' in plugin) {\n cacheWillUpdateCallback = plugin.cacheWillUpdate.bind(plugin);\n }\n }\n\n const isValidResponse = cacheWillUpdateCallback ?\n // Use a callback if provided. It returns a truthy value if valid.\n cacheWillUpdateCallback({event, request, response}) :\n // Otherwise, default to considering any response status under 400 valid.\n // This includes, by default, considering opaque responses valid.\n response.status < 400;\n\n // Consider this a failure, leading to the `install` handler failing, if\n // we get back an invalid response.\n if (!isValidResponse) {\n throw new WorkboxError('bad-precaching-response', {\n url,\n status: response.status,\n });\n }\n\n if (response.redirected) {\n response = await cleanRedirect(response);\n }\n\n await cacheWrapper.put({\n event,\n plugins,\n request,\n response,\n cacheName: this._cacheName,\n matchOptions: {\n ignoreSearch: true,\n },\n });\n }\n\n /**\n * Returns a mapping of a precached URL to the corresponding cache key, taking\n * into account the revision information for the URL.\n *\n * @return {Map<string, string>} A URL to cache key mapping.\n */\n getURLsToCacheKeys() {\n return this._urlsToCacheKeys;\n }\n\n /**\n * Returns a list of all the URLs that have been precached by the current\n * service worker.\n *\n * @return {Array<string>} The precached URLs.\n */\n getCachedURLs() {\n return [...this._urlsToCacheKeys.keys()];\n }\n\n /**\n * Returns the cache key used for storing a given URL. If that URL is\n * unversioned, like `/index.html', then the cache key will be the original\n * URL with a search parameter appended to it.\n *\n * @param {string} url A URL whose cache key you want to look up.\n * @return {string} The versioned URL that corresponds to a cache key\n * for the original URL, or undefined if that URL isn't precached.\n */\n getCacheKeyForURL(url) {\n const urlObject = new URL(url, location);\n return this._urlsToCacheKeys.get(urlObject.href);\n }\n}\n\nexport {PrecacheController};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {PrecacheController} from '../PrecacheController.mjs';\nimport '../_version.mjs';\n\n\nlet precacheController;\n\n/**\n * @return {PrecacheController}\n * @private\n */\nexport const getOrCreatePrecacheController = () => {\n if (!precacheController) {\n precacheController = new PrecacheController();\n }\n return precacheController;\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n/**\n * Removes any URL search parameters that should be ignored.\n *\n * @param {URL} urlObject The original URL.\n * @param {Array<RegExp>} ignoreURLParametersMatching RegExps to test against\n * each search parameter name. Matches mean that the search parameter should be\n * ignored.\n * @return {URL} The URL with any ignored search parameters removed.\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function removeIgnoredSearchParams(urlObject,\n ignoreURLParametersMatching) {\n // Convert the iterable into an array at the start of the loop to make sure\n // deletion doesn't mess up iteration.\n for (const paramName of [...urlObject.searchParams.keys()]) {\n if (ignoreURLParametersMatching.some((regExp) => regExp.test(paramName))) {\n urlObject.searchParams.delete(paramName);\n }\n }\n\n return urlObject;\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {removeIgnoredSearchParams} from './removeIgnoredSearchParams.mjs';\n\nimport '../_version.mjs';\n\n/**\n * Generator function that yields possible variations on the original URL to\n * check, one at a time.\n *\n * @param {string} url\n * @param {Object} options\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function* generateURLVariations(url, {\n ignoreURLParametersMatching,\n directoryIndex,\n cleanURLs,\n urlManipulation,\n} = {}) {\n const urlObject = new URL(url, location);\n urlObject.hash = '';\n yield urlObject.href;\n\n const urlWithoutIgnoredParams = removeIgnoredSearchParams(\n urlObject, ignoreURLParametersMatching);\n yield urlWithoutIgnoredParams.href;\n\n if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {\n const directoryURL = new URL(urlWithoutIgnoredParams);\n directoryURL.pathname += directoryIndex;\n yield directoryURL.href;\n }\n\n if (cleanURLs) {\n const cleanURL = new URL(urlWithoutIgnoredParams);\n cleanURL.pathname += '.html';\n yield cleanURL.href;\n }\n\n if (urlManipulation) {\n const additionalURLs = urlManipulation({url: urlObject});\n for (const urlToAttempt of additionalURLs) {\n yield urlToAttempt.href;\n }\n }\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {getOrCreatePrecacheController}\n from './getOrCreatePrecacheController.mjs';\nimport {generateURLVariations} from './generateURLVariations.mjs';\nimport '../_version.mjs';\n\n/**\n * This function will take the request URL and manipulate it based on the\n * configuration options.\n *\n * @param {string} url\n * @param {Object} options\n * @return {string} Returns the URL in the cache that matches the request,\n * if possible.\n *\n * @private\n */\nexport const getCacheKeyForURL = (url, options) => {\n const precacheController = getOrCreatePrecacheController();\n\n const urlsToCacheKeys = precacheController.getURLsToCacheKeys();\n for (const possibleURL of generateURLVariations(url, options)) {\n const possibleCacheKey = urlsToCacheKeys.get(possibleURL);\n if (possibleCacheKey) {\n return possibleCacheKey;\n }\n }\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {cacheNames} from 'workbox-core/_private/cacheNames.mjs';\nimport {getFriendlyURL} from 'workbox-core/_private/getFriendlyURL.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {getCacheKeyForURL} from './getCacheKeyForURL.mjs';\nimport '../_version.mjs';\n\n\n/**\n * Adds a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * NOTE: when called more than once this method will replace the previously set\n * configuration options. Calling it more than once is not recommended outside\n * of tests.\n *\n * @private\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n */\nexport const addFetchListener = ({\n ignoreURLParametersMatching = [/^utm_/],\n directoryIndex = 'index.html',\n cleanURLs = true,\n urlManipulation = null,\n} = {}) => {\n const cacheName = cacheNames.getPrecacheName();\n\n addEventListener('fetch', (event) => {\n const precachedURL = getCacheKeyForURL(event.request.url, {\n cleanURLs,\n directoryIndex,\n ignoreURLParametersMatching,\n urlManipulation,\n });\n if (!precachedURL) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Precaching did not find a match for ` +\n getFriendlyURL(event.request.url));\n }\n return;\n }\n\n let responsePromise = caches.open(cacheName).then((cache) => {\n return cache.match(precachedURL);\n }).then((cachedResponse) => {\n if (cachedResponse) {\n return cachedResponse;\n }\n\n // Fall back to the network if we don't have a cached response\n // (perhaps due to manual cache cleanup).\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`The precached response for ` +\n `${getFriendlyURL(precachedURL)} in ${cacheName} was not found. ` +\n `Falling back to the network instead.`);\n }\n\n return fetch(precachedURL);\n });\n\n if (process.env.NODE_ENV !== 'production') {\n responsePromise = responsePromise.then((response) => {\n // Workbox is going to handle the route.\n // print the routing details to the console.\n logger.groupCollapsed(`Precaching is responding to: ` +\n getFriendlyURL(event.request.url));\n logger.log(`Serving the precached url: ${precachedURL}`);\n\n logger.groupCollapsed(`View request details here.`);\n logger.log(event.request);\n logger.groupEnd();\n\n logger.groupCollapsed(`View response details here.`);\n logger.log(response);\n logger.groupEnd();\n\n logger.groupEnd();\n return response;\n });\n }\n\n event.respondWith(responsePromise);\n });\n};\n","\n/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {addFetchListener} from './utils/addFetchListener.mjs';\nimport './_version.mjs';\n\n\nlet listenerAdded = false;\n\n/**\n * Add a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n *\n * @alias workbox.precaching.addRoute\n */\nexport const addRoute = (options) => {\n if (!listenerAdded) {\n addFetchListener(options);\n listenerAdded = true;\n }\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\nconst SUBSTRING_TO_FIND = '-precache-';\n\n/**\n * Cleans up incompatible precaches that were created by older versions of\n * Workbox, by a service worker registered under the current scope.\n *\n * This is meant to be called as part of the `activate` event.\n *\n * This should be safe to use as long as you don't include `substringToFind`\n * (defaulting to `-precache-`) in your non-precache cache names.\n *\n * @param {string} currentPrecacheName The cache name currently in use for\n * precaching. This cache won't be deleted.\n * @param {string} [substringToFind='-precache-'] Cache names which include this\n * substring will be deleted (excluding `currentPrecacheName`).\n * @return {Array<string>} A list of all the cache names that were deleted.\n *\n * @private\n * @memberof module:workbox-precaching\n */\nconst deleteOutdatedCaches = async (\n currentPrecacheName,\n substringToFind = SUBSTRING_TO_FIND) => {\n const cacheNames = await caches.keys();\n\n const cacheNamesToDelete = cacheNames.filter((cacheName) => {\n return cacheName.includes(substringToFind) &&\n cacheName.includes(self.registration.scope) &&\n cacheName !== currentPrecacheName;\n });\n\n await Promise.all(\n cacheNamesToDelete.map((cacheName) => caches.delete(cacheName)));\n\n return cacheNamesToDelete;\n};\n\nexport {deleteOutdatedCaches};\n\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {cacheNames} from 'workbox-core/_private/cacheNames.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {deleteOutdatedCaches} from './utils/deleteOutdatedCaches.mjs';\nimport './_version.mjs';\n\n\n/**\n * Adds an `activate` event listener which will clean up incompatible\n * precaches that were created by older versions of Workbox.\n *\n * @alias workbox.precaching.cleanupOutdatedCaches\n */\nexport const cleanupOutdatedCaches = () => {\n addEventListener('activate', (event) => {\n const cacheName = cacheNames.getPrecacheName();\n\n event.waitUntil(deleteOutdatedCaches(cacheName).then((cachesDeleted) => {\n if (process.env.NODE_ENV !== 'production') {\n if (cachesDeleted.length > 0) {\n logger.log(`The following out-of-date precaches were cleaned up ` +\n `automatically:`, cachesDeleted);\n }\n }\n }));\n });\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {getOrCreatePrecacheController}\n from './utils/getOrCreatePrecacheController.mjs';\nimport './_version.mjs';\n\n\n/**\n * Takes in a URL, and returns the corresponding URL that could be used to\n * lookup the entry in the precache.\n *\n * If a relative URL is provided, the location of the service worker file will\n * be used as the base.\n *\n * For precached entries without revision information, the cache key will be the\n * same as the original URL.\n *\n * For precached entries with revision information, the cache key will be the\n * original URL with the addition of a query parameter used for keeping track of\n * the revision info.\n *\n * @param {string} url The URL whose cache key to look up.\n * @return {string} The cache key that corresponds to that URL.\n *\n * @alias workbox.precaching.getCacheKeyForURL\n */\nexport const getCacheKeyForURL = (url) => {\n const precacheController = getOrCreatePrecacheController();\n return precacheController.getCacheKeyForURL(url);\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {getOrCreatePrecacheController} from './utils/getOrCreatePrecacheController.mjs';\nimport {precachePlugins} from './utils/precachePlugins.mjs';\nimport './_version.mjs';\n\n\nconst installListener = (event) => {\n const precacheController = getOrCreatePrecacheController();\n const plugins = precachePlugins.get();\n\n event.waitUntil(\n precacheController.install({event, plugins})\n .catch((error) => {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(`Service worker installation failed. It will ` +\n `be retried automatically during the next navigation.`);\n }\n // Re-throw the error to ensure installation fails.\n throw error;\n })\n );\n};\n\nconst activateListener = (event) => {\n const precacheController = getOrCreatePrecacheController();\n const plugins = precachePlugins.get();\n\n event.waitUntil(precacheController.activate({event, plugins}));\n};\n\n/**\n * Adds items to the precache list, removing any duplicates and\n * stores the files in the\n * [\"precache cache\"]{@link module:workbox-core.cacheNames} when the service\n * worker installs.\n *\n * This method can be called multiple times.\n *\n * Please note: This method **will not** serve any of the cached files for you.\n * It only precaches files. To respond to a network request you call\n * [addRoute()]{@link module:workbox-precaching.addRoute}.\n *\n * If you have a single array of files to precache, you can just call\n * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n *\n * @alias workbox.precaching.precache\n */\nexport const precache = (entries) => {\n const precacheController = getOrCreatePrecacheController();\n precacheController.addToCacheList(entries);\n\n if (entries.length > 0) {\n // NOTE: these listeners will only be added once (even if the `precache()`\n // method is called multiple times) because event listeners are implemented\n // as a set, where each listener must be unique.\n addEventListener('install', installListener);\n addEventListener('activate', activateListener);\n }\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {addRoute} from './addRoute.mjs';\nimport {precache} from './precache.mjs';\nimport './_version.mjs';\n\n\n/**\n * This method will add entries to the precache list and add a route to\n * respond to fetch events.\n *\n * This is a convenience method that will call\n * [precache()]{@link module:workbox-precaching.precache} and\n * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n * @param {Object} options See\n * [addRoute() options]{@link module:workbox-precaching.addRoute}.\n *\n * @alias workbox.precaching.precacheAndRoute\n */\nexport const precacheAndRoute = (entries, options) => {\n precache(entries);\n addRoute(options);\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {addPlugins} from './addPlugins.mjs';\nimport {addRoute} from './addRoute.mjs';\nimport {cleanupOutdatedCaches} from './cleanupOutdatedCaches.mjs';\nimport {getCacheKeyForURL} from './getCacheKeyForURL.mjs';\nimport {precache} from './precache.mjs';\nimport {precacheAndRoute} from './precacheAndRoute.mjs';\nimport {PrecacheController} from './PrecacheController.mjs';\nimport './_version.mjs';\n\n\nif (process.env.NODE_ENV !== 'production') {\n assert.isSWEnv('workbox-precaching');\n}\n\n/**\n * Most consumers of this module will want to use the\n * [precacheAndRoute()]{@link workbox.precaching.precacheAndRoute}\n * method to add assets to the Cache and respond to network requests with these\n * cached assets.\n *\n * If you require finer grained control, you can use the\n * [PrecacheController]{@link workbox.precaching.PrecacheController}\n * to determine when performed.\n *\n * @namespace workbox.precaching\n */\n\nexport {\n addPlugins,\n addRoute,\n cleanupOutdatedCaches,\n getCacheKeyForURL,\n precache,\n precacheAndRoute,\n PrecacheController,\n};\n"],"names":["self","_","e","plugins","precachePlugins","get","add","newPlugins","push","addPlugins","cleanRedirect","response","clonedResponse","clone","bodyPromise","Promise","resolve","body","blob","Response","headers","status","statusText","REVISION_SEARCH_PARAM","createCacheKey","entry","WorkboxError","urlObject","URL","location","cacheKey","href","url","revision","originalURL","cacheKeyURL","searchParams","set","logGroup","groupTitle","deletedURLs","logger","groupCollapsed","log","groupEnd","printCleanupDetails","deletionCount","length","_nestedGroup","urls","printInstallDetails","urlsToPrecache","urlsAlreadyPrecached","precachedCount","alreadyPrecachedCount","message","PrecacheController","constructor","cacheName","_cacheName","cacheNames","getPrecacheName","_urlsToCacheKeys","Map","addToCacheList","entries","assert","isArray","moduleName","className","funcName","paramName","has","firstEntry","secondEntry","install","event","cache","caches","open","alreadyCachedRequests","keys","alreadyCachedURLs","Set","map","request","values","precacheRequests","_addURLToCache","all","updatedURLs","notUpdatedURLs","activate","currentlyCachedRequests","expectedCacheKeys","delete","Request","credentials","fetchWrapper","fetch","cacheWillUpdateCallback","plugin","cacheWillUpdate","bind","isValidResponse","redirected","cacheWrapper","put","matchOptions","ignoreSearch","getURLsToCacheKeys","getCachedURLs","getCacheKeyForURL","precacheController","getOrCreatePrecacheController","removeIgnoredSearchParams","ignoreURLParametersMatching","some","regExp","test","generateURLVariations","directoryIndex","cleanURLs","urlManipulation","hash","urlWithoutIgnoredParams","pathname","endsWith","directoryURL","cleanURL","additionalURLs","urlToAttempt","options","urlsToCacheKeys","possibleURL","possibleCacheKey","addFetchListener","addEventListener","precachedURL","debug","getFriendlyURL","responsePromise","then","match","cachedResponse","warn","respondWith","listenerAdded","addRoute","SUBSTRING_TO_FIND","deleteOutdatedCaches","currentPrecacheName","substringToFind","cacheNamesToDelete","filter","includes","registration","scope","cleanupOutdatedCaches","waitUntil","cachesDeleted","installListener","catch","error","activateListener","precache","precacheAndRoute","isSWEnv"],"mappings":";;;;EAAA,IAAG;EAACA,EAAAA,IAAI,CAAC,0BAAD,CAAJ,IAAkCC,CAAC,EAAnC;EAAsC,CAA1C,CAA0C,OAAMC,CAAN,EAAQ;;ECAlD;;;;;;;AAQA,EAGA,MAAMC,OAAO,GAAG,EAAhB;AAEA,EAAO,MAAMC,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iBAAM,CAAC0H,KAAP,CAAc,8CAAD,GACZ,sDADD;EAED,KAJe;;;EAMhB,UAAMA,KAAN;EACD,GARL,CADJ;EAWD,CAfD;;EAiBA,MAAMC,gBAAgB,GAAIxF,KAAD,IAAW;EAClC,QAAMqC,kBAAkB,GAAGC,6BAA6B,EAAxD;EACA,QAAM/G,OAAO,GAAGC,eAAe,CAACC,GAAhB,EAAhB;EAEAuE,EAAAA,KAAK,CAACmF,SAAN,CAAgB9C,kBAAkB,CAACrB,QAAnB,CAA4B;EAAChB,IAAAA,KAAD;EAAQzE,IAAAA;EAAR,GAA5B,CAAhB;EACD,CALD;EAOA;;;;;;;;;;;;;;;;;;;;;AAmBA,QAAakK,QAAQ,GAAIpG,OAAD,IAAa;EACnC,QAAMgD,kBAAkB,GAAGC,6BAA6B,EAAxD;EACAD,EAAAA,kBAAkB,CAACjD,cAAnB,CAAkCC,OAAlC;;EAEA,MAAIA,OAAO,CAAClB,MAAR,GAAiB,CAArB,EAAwB;EACtB;EACA;EACA;EACA0F,IAAAA,gBAAgB,CAAC,SAAD,EAAYwB,eAAZ,CAAhB;EACAxB,IAAAA,gBAAgB,CAAC,UAAD,EAAa2B,gBAAb,CAAhB;EACD;EACF,CAXM;;ECzDP;;;;;;;AAQA,EAKA;;;;;;;;;;;;;;;AAcA,QAAaE,gBAAgB,GAAG,CAACrG,OAAD,EAAUmE,OAAV,KAAsB;EACpDiC,EAAAA,QAAQ,CAACpG,OAAD,CAAR;EACAmF,EAAAA,QAAQ,CAAChB,OAAD,CAAR;EACD,CAHM;;EC3BP;;;;;;;AAQA;AAWA,EAA2C;EACzClE,EAAAA,iBAAM,CAACqG,OAAP,CAAe,oBAAf;EACD;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.precaching=function(t,e,n,s,c){"use strict";try{self["workbox:precaching:4.3.1"]&&_()}catch(t){}const o=[],i={get:()=>o,add(t){o.push(...t)}};const a="__WB_REVISION__";function r(t){if(!t)throw new c.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if("string"==typeof t){const e=new URL(t,location);return{cacheKey:e.href,url:e.href}}const{revision:e,url:n}=t;if(!n)throw new c.WorkboxError("add-to-cache-list-unexpected-type",{entry:t});if(!e){const t=new URL(n,location);return{cacheKey:t.href,url:t.href}}const s=new URL(n,location),o=new URL(n,location);return o.searchParams.set(a,e),{cacheKey:o.href,url:s.href}}class l{constructor(t){this.t=e.cacheNames.getPrecacheName(t),this.s=new Map}addToCacheList(t){for(const e of t){const{cacheKey:t,url:n}=r(e);if(this.s.has(n)&&this.s.get(n)!==t)throw new c.WorkboxError("add-to-cache-list-conflicting-entries",{firstEntry:this.s.get(n),secondEntry:t});this.s.set(n,t)}}async install({event:t,plugins:e}={}){const n=[],s=[],c=await caches.open(this.t),o=await c.keys(),i=new Set(o.map(t=>t.url));for(const t of this.s.values())i.has(t)?s.push(t):n.push(t);const a=n.map(n=>this.o({event:t,plugins:e,url:n}));return await Promise.all(a),{updatedURLs:n,notUpdatedURLs:s}}async activate(){const t=await caches.open(this.t),e=await t.keys(),n=new Set(this.s.values()),s=[];for(const c of e)n.has(c.url)||(await t.delete(c),s.push(c.url));return{deletedURLs:s}}async o({url:t,event:e,plugins:o}){const i=new Request(t,{credentials:"same-origin"});let a,r=await s.fetchWrapper.fetch({event:e,plugins:o,request:i});for(const t of o||[])"cacheWillUpdate"in t&&(a=t.cacheWillUpdate.bind(t));if(!(a?a({event:e,request:i,response:r}):r.status<400))throw new c.WorkboxError("bad-precaching-response",{url:t,status:r.status});r.redirected&&(r=await async function(t){const e=t.clone(),n="body"in e?Promise.resolve(e.body):e.blob(),s=await n;return new Response(s,{headers:e.headers,status:e.status,statusText:e.statusText})}(r)),await n.cacheWrapper.put({event:e,plugins:o,request:i,response:r,cacheName:this.t,matchOptions:{ignoreSearch:!0}})}getURLsToCacheKeys(){return this.s}getCachedURLs(){return[...this.s.keys()]}getCacheKeyForURL(t){const e=new URL(t,location);return this.s.get(e.href)}}let u;const h=()=>(u||(u=new l),u);const d=(t,e)=>{const n=h().getURLsToCacheKeys();for(const s of function*(t,{ignoreURLParametersMatching:e,directoryIndex:n,cleanURLs:s,urlManipulation:c}={}){const o=new URL(t,location);o.hash="",yield o.href;const i=function(t,e){for(const n of[...t.searchParams.keys()])e.some(t=>t.test(n))&&t.searchParams.delete(n);return t}(o,e);if(yield i.href,n&&i.pathname.endsWith("/")){const t=new URL(i);t.pathname+=n,yield t.href}if(s){const t=new URL(i);t.pathname+=".html",yield t.href}if(c){const t=c({url:o});for(const e of t)yield e.href}}(t,e)){const t=n.get(s);if(t)return t}};let w=!1;const f=t=>{w||((({ignoreURLParametersMatching:t=[/^utm_/],directoryIndex:n="index.html",cleanURLs:s=!0,urlManipulation:c=null}={})=>{const o=e.cacheNames.getPrecacheName();addEventListener("fetch",e=>{const i=d(e.request.url,{cleanURLs:s,directoryIndex:n,ignoreURLParametersMatching:t,urlManipulation:c});if(!i)return;let a=caches.open(o).then(t=>t.match(i)).then(t=>t||fetch(i));e.respondWith(a)})})(t),w=!0)},y=t=>{const e=h(),n=i.get();t.waitUntil(e.install({event:t,plugins:n}).catch(t=>{throw t}))},p=t=>{const e=h(),n=i.get();t.waitUntil(e.activate({event:t,plugins:n}))},L=t=>{h().addToCacheList(t),t.length>0&&(addEventListener("install",y),addEventListener("activate",p))};return t.addPlugins=(t=>{i.add(t)}),t.addRoute=f,t.cleanupOutdatedCaches=(()=>{addEventListener("activate",t=>{const n=e.cacheNames.getPrecacheName();t.waitUntil((async(t,e="-precache-")=>{const n=(await caches.keys()).filter(n=>n.includes(e)&&n.includes(self.registration.scope)&&n!==t);return await Promise.all(n.map(t=>caches.delete(t))),n})(n).then(t=>{}))})}),t.getCacheKeyForURL=(t=>{return h().getCacheKeyForURL(t)}),t.precache=L,t.precacheAndRoute=((t,e)=>{L(t),f(e)}),t.PrecacheController=l,t}({},workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private);
2
- //# sourceMappingURL=workbox-precaching.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workbox-precaching.prod.js","sources":["../_version.mjs","../utils/precachePlugins.mjs","../utils/createCacheKey.mjs","../PrecacheController.mjs","../utils/cleanRedirect.mjs","../utils/getOrCreatePrecacheController.mjs","../utils/getCacheKeyForURL.mjs","../utils/generateURLVariations.mjs","../utils/removeIgnoredSearchParams.mjs","../addRoute.mjs","../utils/addFetchListener.mjs","../precache.mjs","../addPlugins.mjs","../cleanupOutdatedCaches.mjs","../utils/deleteOutdatedCaches.mjs","../getCacheKeyForURL.mjs","../precacheAndRoute.mjs"],"sourcesContent":["try{self['workbox:precaching:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n\nconst plugins = [];\n\nexport const precachePlugins = {\n /*\n * @return {Array}\n * @private\n */\n get() {\n return plugins;\n },\n\n /*\n * @param {Array} newPlugins\n * @private\n */\n add(newPlugins) {\n plugins.push(...newPlugins);\n },\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\n\nimport '../_version.mjs';\n\n// Name of the search parameter used to store revision info.\nconst REVISION_SEARCH_PARAM = '__WB_REVISION__';\n\n/**\n * Converts a manifest entry into a versioned URL suitable for precaching.\n *\n * @param {Object} entry\n * @return {string} A URL with versioning info.\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function createCacheKey(entry) {\n if (!entry) {\n throw new WorkboxError('add-to-cache-list-unexpected-type', {entry});\n }\n\n // If a precache manifest entry is a string, it's assumed to be a versioned\n // URL, like '/app.abcd1234.js'. Return as-is.\n if (typeof entry === 'string') {\n const urlObject = new URL(entry, location);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href,\n };\n }\n\n const {revision, url} = entry;\n if (!url) {\n throw new WorkboxError('add-to-cache-list-unexpected-type', {entry});\n }\n\n // If there's just a URL and no revision, then it's also assumed to be a\n // versioned URL.\n if (!revision) {\n const urlObject = new URL(url, location);\n return {\n cacheKey: urlObject.href,\n url: urlObject.href,\n };\n }\n\n // Otherwise, construct a properly versioned URL using the custom Workbox\n // search parameter along with the revision info.\n const originalURL = new URL(url, location);\n const cacheKeyURL = new URL(url, location);\n cacheKeyURL.searchParams.set(REVISION_SEARCH_PARAM, revision);\n return {\n cacheKey: cacheKeyURL.href,\n url: originalURL.href,\n };\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {cacheNames} from 'workbox-core/_private/cacheNames.mjs';\nimport {cacheWrapper} from 'workbox-core/_private/cacheWrapper.mjs';\nimport {fetchWrapper} from 'workbox-core/_private/fetchWrapper.mjs';\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\n\nimport {cleanRedirect} from './utils/cleanRedirect.mjs';\nimport {createCacheKey} from './utils/createCacheKey.mjs';\nimport {printCleanupDetails} from './utils/printCleanupDetails.mjs';\nimport {printInstallDetails} from './utils/printInstallDetails.mjs';\n\nimport './_version.mjs';\n\n\n/**\n * Performs efficient precaching of assets.\n *\n * @memberof module:workbox-precaching\n */\nclass PrecacheController {\n /**\n * Create a new PrecacheController.\n *\n * @param {string} [cacheName] An optional name for the cache, to override\n * the default precache name.\n */\n constructor(cacheName) {\n this._cacheName = cacheNames.getPrecacheName(cacheName);\n this._urlsToCacheKeys = new Map();\n }\n\n /**\n * This method will add items to the precache list, removing duplicates\n * and ensuring the information is valid.\n *\n * @param {\n * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>\n * } entries Array of entries to precache.\n */\n addToCacheList(entries) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isArray(entries, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'addToCacheList',\n paramName: 'entries',\n });\n }\n\n for (const entry of entries) {\n const {cacheKey, url} = createCacheKey(entry);\n if (this._urlsToCacheKeys.has(url) &&\n this._urlsToCacheKeys.get(url) !== cacheKey) {\n throw new WorkboxError('add-to-cache-list-conflicting-entries', {\n firstEntry: this._urlsToCacheKeys.get(url),\n secondEntry: cacheKey,\n });\n }\n this._urlsToCacheKeys.set(url, cacheKey);\n }\n }\n\n /**\n * Precaches new and updated assets. Call this method from the service worker\n * install event.\n *\n * @param {Object} options\n * @param {Event} [options.event] The install event (if needed).\n * @param {Array<Object>} [options.plugins] Plugins to be used for fetching\n * and caching during install.\n * @return {Promise<workbox.precaching.InstallResult>}\n */\n async install({event, plugins} = {}) {\n if (process.env.NODE_ENV !== 'production') {\n if (plugins) {\n assert.isArray(plugins, {\n moduleName: 'workbox-precaching',\n className: 'PrecacheController',\n funcName: 'install',\n paramName: 'plugins',\n });\n }\n }\n\n const urlsToPrecache = [];\n const urlsAlreadyPrecached = [];\n\n const cache = await caches.open(this._cacheName);\n const alreadyCachedRequests = await cache.keys();\n const alreadyCachedURLs = new Set(alreadyCachedRequests.map(\n (request) => request.url));\n\n for (const cacheKey of this._urlsToCacheKeys.values()) {\n if (alreadyCachedURLs.has(cacheKey)) {\n urlsAlreadyPrecached.push(cacheKey);\n } else {\n urlsToPrecache.push(cacheKey);\n }\n }\n\n const precacheRequests = urlsToPrecache.map((url) => {\n return this._addURLToCache({event, plugins, url});\n });\n await Promise.all(precacheRequests);\n\n if (process.env.NODE_ENV !== 'production') {\n printInstallDetails(urlsToPrecache, urlsAlreadyPrecached);\n }\n\n return {\n updatedURLs: urlsToPrecache,\n notUpdatedURLs: urlsAlreadyPrecached,\n };\n }\n\n /**\n * Deletes assets that are no longer present in the current precache manifest.\n * Call this method from the service worker activate event.\n *\n * @return {Promise<workbox.precaching.CleanupResult>}\n */\n async activate() {\n const cache = await caches.open(this._cacheName);\n const currentlyCachedRequests = await cache.keys();\n const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());\n\n const deletedURLs = [];\n for (const request of currentlyCachedRequests) {\n if (!expectedCacheKeys.has(request.url)) {\n await cache.delete(request);\n deletedURLs.push(request.url);\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n printCleanupDetails(deletedURLs);\n }\n\n return {deletedURLs};\n }\n\n /**\n * Requests the entry and saves it to the cache if the response is valid.\n * By default, any response with a status code of less than 400 (including\n * opaque responses) is considered valid.\n *\n * If you need to use custom criteria to determine what's valid and what\n * isn't, then pass in an item in `options.plugins` that implements the\n * `cacheWillUpdate()` lifecycle event.\n *\n * @private\n * @param {Object} options\n * @param {string} options.url The URL to fetch and cache.\n * @param {Event} [options.event] The install event (if passed).\n * @param {Array<Object>} [options.plugins] An array of plugins to apply to\n * fetch and caching.\n */\n async _addURLToCache({url, event, plugins}) {\n const request = new Request(url, {credentials: 'same-origin'});\n let response = await fetchWrapper.fetch({\n event,\n plugins,\n request,\n });\n\n // Allow developers to override the default logic about what is and isn't\n // valid by passing in a plugin implementing cacheWillUpdate(), e.g.\n // a workbox.cacheableResponse.Plugin instance.\n let cacheWillUpdateCallback;\n for (const plugin of (plugins || [])) {\n if ('cacheWillUpdate' in plugin) {\n cacheWillUpdateCallback = plugin.cacheWillUpdate.bind(plugin);\n }\n }\n\n const isValidResponse = cacheWillUpdateCallback ?\n // Use a callback if provided. It returns a truthy value if valid.\n cacheWillUpdateCallback({event, request, response}) :\n // Otherwise, default to considering any response status under 400 valid.\n // This includes, by default, considering opaque responses valid.\n response.status < 400;\n\n // Consider this a failure, leading to the `install` handler failing, if\n // we get back an invalid response.\n if (!isValidResponse) {\n throw new WorkboxError('bad-precaching-response', {\n url,\n status: response.status,\n });\n }\n\n if (response.redirected) {\n response = await cleanRedirect(response);\n }\n\n await cacheWrapper.put({\n event,\n plugins,\n request,\n response,\n cacheName: this._cacheName,\n matchOptions: {\n ignoreSearch: true,\n },\n });\n }\n\n /**\n * Returns a mapping of a precached URL to the corresponding cache key, taking\n * into account the revision information for the URL.\n *\n * @return {Map<string, string>} A URL to cache key mapping.\n */\n getURLsToCacheKeys() {\n return this._urlsToCacheKeys;\n }\n\n /**\n * Returns a list of all the URLs that have been precached by the current\n * service worker.\n *\n * @return {Array<string>} The precached URLs.\n */\n getCachedURLs() {\n return [...this._urlsToCacheKeys.keys()];\n }\n\n /**\n * Returns the cache key used for storing a given URL. If that URL is\n * unversioned, like `/index.html', then the cache key will be the original\n * URL with a search parameter appended to it.\n *\n * @param {string} url A URL whose cache key you want to look up.\n * @return {string} The versioned URL that corresponds to a cache key\n * for the original URL, or undefined if that URL isn't precached.\n */\n getCacheKeyForURL(url) {\n const urlObject = new URL(url, location);\n return this._urlsToCacheKeys.get(urlObject.href);\n }\n}\n\nexport {PrecacheController};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n/**\n * @param {Response} response\n * @return {Response}\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport async function cleanRedirect(response) {\n const clonedResponse = response.clone();\n\n // Not all browsers support the Response.body stream, so fall back\n // to reading the entire body into memory as a blob.\n const bodyPromise = 'body' in clonedResponse ?\n Promise.resolve(clonedResponse.body) :\n clonedResponse.blob();\n\n const body = await bodyPromise;\n\n // new Response() is happy when passed either a stream or a Blob.\n return new Response(body, {\n headers: clonedResponse.headers,\n status: clonedResponse.status,\n statusText: clonedResponse.statusText,\n });\n}\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {PrecacheController} from '../PrecacheController.mjs';\nimport '../_version.mjs';\n\n\nlet precacheController;\n\n/**\n * @return {PrecacheController}\n * @private\n */\nexport const getOrCreatePrecacheController = () => {\n if (!precacheController) {\n precacheController = new PrecacheController();\n }\n return precacheController;\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {getOrCreatePrecacheController}\n from './getOrCreatePrecacheController.mjs';\nimport {generateURLVariations} from './generateURLVariations.mjs';\nimport '../_version.mjs';\n\n/**\n * This function will take the request URL and manipulate it based on the\n * configuration options.\n *\n * @param {string} url\n * @param {Object} options\n * @return {string} Returns the URL in the cache that matches the request,\n * if possible.\n *\n * @private\n */\nexport const getCacheKeyForURL = (url, options) => {\n const precacheController = getOrCreatePrecacheController();\n\n const urlsToCacheKeys = precacheController.getURLsToCacheKeys();\n for (const possibleURL of generateURLVariations(url, options)) {\n const possibleCacheKey = urlsToCacheKeys.get(possibleURL);\n if (possibleCacheKey) {\n return possibleCacheKey;\n }\n }\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {removeIgnoredSearchParams} from './removeIgnoredSearchParams.mjs';\n\nimport '../_version.mjs';\n\n/**\n * Generator function that yields possible variations on the original URL to\n * check, one at a time.\n *\n * @param {string} url\n * @param {Object} options\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function* generateURLVariations(url, {\n ignoreURLParametersMatching,\n directoryIndex,\n cleanURLs,\n urlManipulation,\n} = {}) {\n const urlObject = new URL(url, location);\n urlObject.hash = '';\n yield urlObject.href;\n\n const urlWithoutIgnoredParams = removeIgnoredSearchParams(\n urlObject, ignoreURLParametersMatching);\n yield urlWithoutIgnoredParams.href;\n\n if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {\n const directoryURL = new URL(urlWithoutIgnoredParams);\n directoryURL.pathname += directoryIndex;\n yield directoryURL.href;\n }\n\n if (cleanURLs) {\n const cleanURL = new URL(urlWithoutIgnoredParams);\n cleanURL.pathname += '.html';\n yield cleanURL.href;\n }\n\n if (urlManipulation) {\n const additionalURLs = urlManipulation({url: urlObject});\n for (const urlToAttempt of additionalURLs) {\n yield urlToAttempt.href;\n }\n }\n}\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\n/**\n * Removes any URL search parameters that should be ignored.\n *\n * @param {URL} urlObject The original URL.\n * @param {Array<RegExp>} ignoreURLParametersMatching RegExps to test against\n * each search parameter name. Matches mean that the search parameter should be\n * ignored.\n * @return {URL} The URL with any ignored search parameters removed.\n *\n * @private\n * @memberof module:workbox-precaching\n */\nexport function removeIgnoredSearchParams(urlObject,\n ignoreURLParametersMatching) {\n // Convert the iterable into an array at the start of the loop to make sure\n // deletion doesn't mess up iteration.\n for (const paramName of [...urlObject.searchParams.keys()]) {\n if (ignoreURLParametersMatching.some((regExp) => regExp.test(paramName))) {\n urlObject.searchParams.delete(paramName);\n }\n }\n\n return urlObject;\n}\n","\n/*\n Copyright 2019 Google LLC\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {addFetchListener} from './utils/addFetchListener.mjs';\nimport './_version.mjs';\n\n\nlet listenerAdded = false;\n\n/**\n * Add a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n *\n * @alias workbox.precaching.addRoute\n */\nexport const addRoute = (options) => {\n if (!listenerAdded) {\n addFetchListener(options);\n listenerAdded = true;\n }\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {cacheNames} from 'workbox-core/_private/cacheNames.mjs';\nimport {getFriendlyURL} from 'workbox-core/_private/getFriendlyURL.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {getCacheKeyForURL} from './getCacheKeyForURL.mjs';\nimport '../_version.mjs';\n\n\n/**\n * Adds a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * NOTE: when called more than once this method will replace the previously set\n * configuration options. Calling it more than once is not recommended outside\n * of tests.\n *\n * @private\n * @param {Object} options\n * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n * check cache entries for a URLs ending with '/' to see if there is a hit when\n * appending the `directoryIndex` value.\n * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/]] An\n * array of regex's to remove search params when looking for a cache match.\n * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will\n * check the cache for the URL with a `.html` added to the end of the end.\n * @param {workbox.precaching~urlManipulation} [options.urlManipulation]\n * This is a function that should take a URL and return an array of\n * alternative URL's that should be checked for precache matches.\n */\nexport const addFetchListener = ({\n ignoreURLParametersMatching = [/^utm_/],\n directoryIndex = 'index.html',\n cleanURLs = true,\n urlManipulation = null,\n} = {}) => {\n const cacheName = cacheNames.getPrecacheName();\n\n addEventListener('fetch', (event) => {\n const precachedURL = getCacheKeyForURL(event.request.url, {\n cleanURLs,\n directoryIndex,\n ignoreURLParametersMatching,\n urlManipulation,\n });\n if (!precachedURL) {\n if (process.env.NODE_ENV !== 'production') {\n logger.debug(`Precaching did not find a match for ` +\n getFriendlyURL(event.request.url));\n }\n return;\n }\n\n let responsePromise = caches.open(cacheName).then((cache) => {\n return cache.match(precachedURL);\n }).then((cachedResponse) => {\n if (cachedResponse) {\n return cachedResponse;\n }\n\n // Fall back to the network if we don't have a cached response\n // (perhaps due to manual cache cleanup).\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`The precached response for ` +\n `${getFriendlyURL(precachedURL)} in ${cacheName} was not found. ` +\n `Falling back to the network instead.`);\n }\n\n return fetch(precachedURL);\n });\n\n if (process.env.NODE_ENV !== 'production') {\n responsePromise = responsePromise.then((response) => {\n // Workbox is going to handle the route.\n // print the routing details to the console.\n logger.groupCollapsed(`Precaching is responding to: ` +\n getFriendlyURL(event.request.url));\n logger.log(`Serving the precached url: ${precachedURL}`);\n\n logger.groupCollapsed(`View request details here.`);\n logger.log(event.request);\n logger.groupEnd();\n\n logger.groupCollapsed(`View response details here.`);\n logger.log(response);\n logger.groupEnd();\n\n logger.groupEnd();\n return response;\n });\n }\n\n event.respondWith(responsePromise);\n });\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {getOrCreatePrecacheController} from './utils/getOrCreatePrecacheController.mjs';\nimport {precachePlugins} from './utils/precachePlugins.mjs';\nimport './_version.mjs';\n\n\nconst installListener = (event) => {\n const precacheController = getOrCreatePrecacheController();\n const plugins = precachePlugins.get();\n\n event.waitUntil(\n precacheController.install({event, plugins})\n .catch((error) => {\n if (process.env.NODE_ENV !== 'production') {\n logger.error(`Service worker installation failed. It will ` +\n `be retried automatically during the next navigation.`);\n }\n // Re-throw the error to ensure installation fails.\n throw error;\n })\n );\n};\n\nconst activateListener = (event) => {\n const precacheController = getOrCreatePrecacheController();\n const plugins = precachePlugins.get();\n\n event.waitUntil(precacheController.activate({event, plugins}));\n};\n\n/**\n * Adds items to the precache list, removing any duplicates and\n * stores the files in the\n * [\"precache cache\"]{@link module:workbox-core.cacheNames} when the service\n * worker installs.\n *\n * This method can be called multiple times.\n *\n * Please note: This method **will not** serve any of the cached files for you.\n * It only precaches files. To respond to a network request you call\n * [addRoute()]{@link module:workbox-precaching.addRoute}.\n *\n * If you have a single array of files to precache, you can just call\n * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n *\n * @alias workbox.precaching.precache\n */\nexport const precache = (entries) => {\n const precacheController = getOrCreatePrecacheController();\n precacheController.addToCacheList(entries);\n\n if (entries.length > 0) {\n // NOTE: these listeners will only be added once (even if the `precache()`\n // method is called multiple times) because event listeners are implemented\n // as a set, where each listener must be unique.\n addEventListener('install', installListener);\n addEventListener('activate', activateListener);\n }\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {precachePlugins} from './utils/precachePlugins.mjs';\nimport './_version.mjs';\n\n\n/**\n * Adds plugins to precaching.\n *\n * @param {Array<Object>} newPlugins\n *\n * @alias workbox.precaching.addPlugins\n */\nconst addPlugins = (newPlugins) => {\n precachePlugins.add(newPlugins);\n};\n\nexport {addPlugins};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {cacheNames} from 'workbox-core/_private/cacheNames.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\nimport {deleteOutdatedCaches} from './utils/deleteOutdatedCaches.mjs';\nimport './_version.mjs';\n\n\n/**\n * Adds an `activate` event listener which will clean up incompatible\n * precaches that were created by older versions of Workbox.\n *\n * @alias workbox.precaching.cleanupOutdatedCaches\n */\nexport const cleanupOutdatedCaches = () => {\n addEventListener('activate', (event) => {\n const cacheName = cacheNames.getPrecacheName();\n\n event.waitUntil(deleteOutdatedCaches(cacheName).then((cachesDeleted) => {\n if (process.env.NODE_ENV !== 'production') {\n if (cachesDeleted.length > 0) {\n logger.log(`The following out-of-date precaches were cleaned up ` +\n `automatically:`, cachesDeleted);\n }\n }\n }));\n });\n};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport '../_version.mjs';\n\nconst SUBSTRING_TO_FIND = '-precache-';\n\n/**\n * Cleans up incompatible precaches that were created by older versions of\n * Workbox, by a service worker registered under the current scope.\n *\n * This is meant to be called as part of the `activate` event.\n *\n * This should be safe to use as long as you don't include `substringToFind`\n * (defaulting to `-precache-`) in your non-precache cache names.\n *\n * @param {string} currentPrecacheName The cache name currently in use for\n * precaching. This cache won't be deleted.\n * @param {string} [substringToFind='-precache-'] Cache names which include this\n * substring will be deleted (excluding `currentPrecacheName`).\n * @return {Array<string>} A list of all the cache names that were deleted.\n *\n * @private\n * @memberof module:workbox-precaching\n */\nconst deleteOutdatedCaches = async (\n currentPrecacheName,\n substringToFind = SUBSTRING_TO_FIND) => {\n const cacheNames = await caches.keys();\n\n const cacheNamesToDelete = cacheNames.filter((cacheName) => {\n return cacheName.includes(substringToFind) &&\n cacheName.includes(self.registration.scope) &&\n cacheName !== currentPrecacheName;\n });\n\n await Promise.all(\n cacheNamesToDelete.map((cacheName) => caches.delete(cacheName)));\n\n return cacheNamesToDelete;\n};\n\nexport {deleteOutdatedCaches};\n\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {getOrCreatePrecacheController}\n from './utils/getOrCreatePrecacheController.mjs';\nimport './_version.mjs';\n\n\n/**\n * Takes in a URL, and returns the corresponding URL that could be used to\n * lookup the entry in the precache.\n *\n * If a relative URL is provided, the location of the service worker file will\n * be used as the base.\n *\n * For precached entries without revision information, the cache key will be the\n * same as the original URL.\n *\n * For precached entries with revision information, the cache key will be the\n * original URL with the addition of a query parameter used for keeping track of\n * the revision info.\n *\n * @param {string} url The URL whose cache key to look up.\n * @return {string} The cache key that corresponds to that URL.\n *\n * @alias workbox.precaching.getCacheKeyForURL\n */\nexport const getCacheKeyForURL = (url) => {\n const precacheController = getOrCreatePrecacheController();\n return precacheController.getCacheKeyForURL(url);\n};\n","/*\n Copyright 2019 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {addRoute} from './addRoute.mjs';\nimport {precache} from './precache.mjs';\nimport './_version.mjs';\n\n\n/**\n * This method will add entries to the precache list and add a route to\n * respond to fetch events.\n *\n * This is a convenience method that will call\n * [precache()]{@link module:workbox-precaching.precache} and\n * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n * @param {Object} options See\n * [addRoute() options]{@link module:workbox-precaching.addRoute}.\n *\n * @alias workbox.precaching.precacheAndRoute\n */\nexport const precacheAndRoute = (entries, options) => {\n precache(entries);\n addRoute(options);\n};\n"],"names":["self","_","e","plugins","precachePlugins","get","add","newPlugins","push","REVISION_SEARCH_PARAM","createCacheKey","entry","WorkboxError","urlObject","URL","location","cacheKey","href","url","revision","originalURL","cacheKeyURL","searchParams","set","PrecacheController","constructor","cacheName","_cacheName","cacheNames","getPrecacheName","_urlsToCacheKeys","Map","addToCacheList","entries","this","has","firstEntry","secondEntry","event","urlsToPrecache","urlsAlreadyPrecached","cache","caches","open","alreadyCachedRequests","keys","alreadyCachedURLs","Set","map","request","values","precacheRequests","_addURLToCache","Promise","all","updatedURLs","notUpdatedURLs","currentlyCachedRequests","expectedCacheKeys","deletedURLs","delete","Request","credentials","cacheWillUpdateCallback","response","fetchWrapper","fetch","plugin","cacheWillUpdate","bind","status","redirected","async","clonedResponse","clone","bodyPromise","resolve","body","blob","Response","headers","statusText","cleanRedirect","cacheWrapper","put","matchOptions","ignoreSearch","getURLsToCacheKeys","getCachedURLs","getCacheKeyForURL","precacheController","getOrCreatePrecacheController","options","urlsToCacheKeys","possibleURL","ignoreURLParametersMatching","directoryIndex","cleanURLs","urlManipulation","hash","urlWithoutIgnoredParams","paramName","some","regExp","test","removeIgnoredSearchParams","pathname","endsWith","directoryURL","cleanURL","additionalURLs","urlToAttempt","generateURLVariations","possibleCacheKey","listenerAdded","addRoute","addEventListener","precachedURL","responsePromise","then","match","cachedResponse","respondWith","addFetchListener","installListener","waitUntil","install","catch","error","activateListener","activate","precache","length","currentPrecacheName","substringToFind","cacheNamesToDelete","filter","includes","registration","scope","deleteOutdatedCaches","cachesDeleted"],"mappings":"uFAAA,IAAIA,KAAK,6BAA6BC,IAAI,MAAMC,ICWhD,MAAMC,EAAU,GAEHC,EAAkB,CAK7BC,IAAG,IACMF,EAOTG,IAAIC,GACFJ,EAAQK,QAAQD,KCdpB,MAAME,EAAwB,kBAWvB,SAASC,EAAeC,OACxBA,QACG,IAAIC,eAAa,oCAAqC,CAACD,MAAAA,OAK1C,iBAAVA,EAAoB,OACvBE,EAAY,IAAIC,IAAIH,EAAOI,gBAC1B,CACLC,SAAUH,EAAUI,KACpBC,IAAKL,EAAUI,YAIbE,SAACA,EAADD,IAAWA,GAAOP,MACnBO,QACG,IAAIN,eAAa,oCAAqC,CAACD,MAAAA,QAK1DQ,EAAU,OACPN,EAAY,IAAIC,IAAII,EAAKH,gBACxB,CACLC,SAAUH,EAAUI,KACpBC,IAAKL,EAAUI,YAMbG,EAAc,IAAIN,IAAII,EAAKH,UAC3BM,EAAc,IAAIP,IAAII,EAAKH,iBACjCM,EAAYC,aAAaC,IAAId,EAAuBU,GAC7C,CACLH,SAAUK,EAAYJ,KACtBC,IAAKE,EAAYH,MClCrB,MAAMO,EAOJC,YAAYC,QACLC,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G,IACI0D,IACR3D,eAAeC,GAE9BA,EAAQmG,OAAS,IAInBhB,iBAAiB,UAAWQ,GAC5BR,iBAAiB,WAAYa,yBC/Cb1H,CAAAA,IAClBH,EAAgBE,IAAIC,0CCAe,MACnC6G,iBAAiB,WAAa9E,UACtBZ,EAAYE,aAAWC,kBAE7BS,EAAMuF,UCMmBrD,OAC3B6D,EACAC,EAtBwB,sBAyBlBC,SAFmB7F,OAAOG,QAEM2F,OAAQ9G,GACrCA,EAAU+G,SAASH,IACnB5G,EAAU+G,SAASzI,KAAK0I,aAAaC,QACrCjH,IAAc2G,gBAGjBhF,QAAQC,IACViF,EAAmBvF,IAAKtB,GAAcgB,OAAOkB,OAAOlC,KAEjD6G,GDpBWK,CAAqBlH,GAAW6F,KAAMsB,gCEQxB3H,CAAAA,WACLyE,IACDF,kBAAkBvE,qCCPd,EAACe,EAAS2D,KACxCuC,EAASlG,GACTkF,EAASvB"}
@@ -1,268 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.rangeRequests = (function (exports, WorkboxError_mjs, assert_mjs, logger_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self['workbox:range-requests:4.3.1'] && _();
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2018 Google LLC
11
-
12
- Use of this source code is governed by an MIT-style
13
- license that can be found in the LICENSE file or at
14
- https://opensource.org/licenses/MIT.
15
- */
16
- /**
17
- * @param {Blob} blob A source blob.
18
- * @param {number|null} start The offset to use as the start of the
19
- * slice.
20
- * @param {number|null} end The offset to use as the end of the slice.
21
- * @return {Object} An object with `start` and `end` properties, reflecting
22
- * the effective boundaries to use given the size of the blob.
23
- *
24
- * @private
25
- */
26
-
27
- function calculateEffectiveBoundaries(blob, start, end) {
28
- {
29
- assert_mjs.assert.isInstance(blob, Blob, {
30
- moduleName: 'workbox-range-requests',
31
- funcName: 'calculateEffectiveBoundaries',
32
- paramName: 'blob'
33
- });
34
- }
35
-
36
- const blobSize = blob.size;
37
-
38
- if (end > blobSize || start < 0) {
39
- throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {
40
- size: blobSize,
41
- end,
42
- start
43
- });
44
- }
45
-
46
- let effectiveStart;
47
- let effectiveEnd;
48
-
49
- if (start === null) {
50
- effectiveStart = blobSize - end;
51
- effectiveEnd = blobSize;
52
- } else if (end === null) {
53
- effectiveStart = start;
54
- effectiveEnd = blobSize;
55
- } else {
56
- effectiveStart = start; // Range values are inclusive, so add 1 to the value.
57
-
58
- effectiveEnd = end + 1;
59
- }
60
-
61
- return {
62
- start: effectiveStart,
63
- end: effectiveEnd
64
- };
65
- }
66
-
67
- /*
68
- Copyright 2018 Google LLC
69
-
70
- Use of this source code is governed by an MIT-style
71
- license that can be found in the LICENSE file or at
72
- https://opensource.org/licenses/MIT.
73
- */
74
- /**
75
- * @param {string} rangeHeader A Range: header value.
76
- * @return {Object} An object with `start` and `end` properties, reflecting
77
- * the parsed value of the Range: header. If either the `start` or `end` are
78
- * omitted, then `null` will be returned.
79
- *
80
- * @private
81
- */
82
-
83
- function parseRangeHeader(rangeHeader) {
84
- {
85
- assert_mjs.assert.isType(rangeHeader, 'string', {
86
- moduleName: 'workbox-range-requests',
87
- funcName: 'parseRangeHeader',
88
- paramName: 'rangeHeader'
89
- });
90
- }
91
-
92
- const normalizedRangeHeader = rangeHeader.trim().toLowerCase();
93
-
94
- if (!normalizedRangeHeader.startsWith('bytes=')) {
95
- throw new WorkboxError_mjs.WorkboxError('unit-must-be-bytes', {
96
- normalizedRangeHeader
97
- });
98
- } // Specifying multiple ranges separate by commas is valid syntax, but this
99
- // library only attempts to handle a single, contiguous sequence of bytes.
100
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax
101
-
102
-
103
- if (normalizedRangeHeader.includes(',')) {
104
- throw new WorkboxError_mjs.WorkboxError('single-range-only', {
105
- normalizedRangeHeader
106
- });
107
- }
108
-
109
- const rangeParts = /(\d*)-(\d*)/.exec(normalizedRangeHeader); // We need either at least one of the start or end values.
110
-
111
- if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {
112
- throw new WorkboxError_mjs.WorkboxError('invalid-range-values', {
113
- normalizedRangeHeader
114
- });
115
- }
116
-
117
- return {
118
- start: rangeParts[1] === '' ? null : Number(rangeParts[1]),
119
- end: rangeParts[2] === '' ? null : Number(rangeParts[2])
120
- };
121
- }
122
-
123
- /*
124
- Copyright 2018 Google LLC
125
-
126
- Use of this source code is governed by an MIT-style
127
- license that can be found in the LICENSE file or at
128
- https://opensource.org/licenses/MIT.
129
- */
130
- /**
131
- * Given a `Request` and `Response` objects as input, this will return a
132
- * promise for a new `Response`.
133
- *
134
- * If the original `Response` already contains partial content (i.e. it has
135
- * a status of 206), then this assumes it already fulfills the `Range:`
136
- * requirements, and will return it as-is.
137
- *
138
- * @param {Request} request A request, which should contain a Range:
139
- * header.
140
- * @param {Response} originalResponse A response.
141
- * @return {Promise<Response>} Either a `206 Partial Content` response, with
142
- * the response body set to the slice of content specified by the request's
143
- * `Range:` header, or a `416 Range Not Satisfiable` response if the
144
- * conditions of the `Range:` header can't be met.
145
- *
146
- * @memberof workbox.rangeRequests
147
- */
148
-
149
- async function createPartialResponse(request, originalResponse) {
150
- try {
151
- {
152
- assert_mjs.assert.isInstance(request, Request, {
153
- moduleName: 'workbox-range-requests',
154
- funcName: 'createPartialResponse',
155
- paramName: 'request'
156
- });
157
- assert_mjs.assert.isInstance(originalResponse, Response, {
158
- moduleName: 'workbox-range-requests',
159
- funcName: 'createPartialResponse',
160
- paramName: 'originalResponse'
161
- });
162
- }
163
-
164
- if (originalResponse.status === 206) {
165
- // If we already have a 206, then just pass it through as-is;
166
- // see https://github.com/GoogleChrome/workbox/issues/1720
167
- return originalResponse;
168
- }
169
-
170
- const rangeHeader = request.headers.get('range');
171
-
172
- if (!rangeHeader) {
173
- throw new WorkboxError_mjs.WorkboxError('no-range-header');
174
- }
175
-
176
- const boundaries = parseRangeHeader(rangeHeader);
177
- const originalBlob = await originalResponse.blob();
178
- const effectiveBoundaries = calculateEffectiveBoundaries(originalBlob, boundaries.start, boundaries.end);
179
- const slicedBlob = originalBlob.slice(effectiveBoundaries.start, effectiveBoundaries.end);
180
- const slicedBlobSize = slicedBlob.size;
181
- const slicedResponse = new Response(slicedBlob, {
182
- // Status code 206 is for a Partial Content response.
183
- // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206
184
- status: 206,
185
- statusText: 'Partial Content',
186
- headers: originalResponse.headers
187
- });
188
- slicedResponse.headers.set('Content-Length', slicedBlobSize);
189
- slicedResponse.headers.set('Content-Range', `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` + originalBlob.size);
190
- return slicedResponse;
191
- } catch (error) {
192
- {
193
- logger_mjs.logger.warn(`Unable to construct a partial response; returning a ` + `416 Range Not Satisfiable response instead.`);
194
- logger_mjs.logger.groupCollapsed(`View details here.`);
195
- logger_mjs.logger.log(error);
196
- logger_mjs.logger.log(request);
197
- logger_mjs.logger.log(originalResponse);
198
- logger_mjs.logger.groupEnd();
199
- }
200
-
201
- return new Response('', {
202
- status: 416,
203
- statusText: 'Range Not Satisfiable'
204
- });
205
- }
206
- }
207
-
208
- /*
209
- Copyright 2018 Google LLC
210
-
211
- Use of this source code is governed by an MIT-style
212
- license that can be found in the LICENSE file or at
213
- https://opensource.org/licenses/MIT.
214
- */
215
- /**
216
- * The range request plugin makes it easy for a request with a 'Range' header to
217
- * be fulfilled by a cached response.
218
- *
219
- * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback
220
- * and returning the appropriate subset of the cached response body.
221
- *
222
- * @memberof workbox.rangeRequests
223
- */
224
-
225
- class Plugin {
226
- /**
227
- * @param {Object} options
228
- * @param {Request} options.request The original request, which may or may not
229
- * contain a Range: header.
230
- * @param {Response} options.cachedResponse The complete cached response.
231
- * @return {Promise<Response>} If request contains a 'Range' header, then a
232
- * new response with status 206 whose body is a subset of `cachedResponse` is
233
- * returned. Otherwise, `cachedResponse` is returned as-is.
234
- *
235
- * @private
236
- */
237
- async cachedResponseWillBeUsed({
238
- request,
239
- cachedResponse
240
- }) {
241
- // Only return a sliced response if there's something valid in the cache,
242
- // and there's a Range: header in the request.
243
- if (cachedResponse && request.headers.has('range')) {
244
- return await createPartialResponse(request, cachedResponse);
245
- } // If there was no Range: header, or if cachedResponse wasn't valid, just
246
- // pass it through as-is.
247
-
248
-
249
- return cachedResponse;
250
- }
251
-
252
- }
253
-
254
- /*
255
- Copyright 2018 Google LLC
256
-
257
- Use of this source code is governed by an MIT-style
258
- license that can be found in the LICENSE file or at
259
- https://opensource.org/licenses/MIT.
260
- */
261
-
262
- exports.createPartialResponse = createPartialResponse;
263
- exports.Plugin = Plugin;
264
-
265
- return exports;
266
-
267
- }({}, workbox.core._private, workbox.core._private, workbox.core._private));
268
- //# sourceMappingURL=workbox-range-requests.dev.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workbox-range-requests.dev.js","sources":["../_version.mjs","../utils/calculateEffectiveBoundaries.mjs","../utils/parseRangeHeader.mjs","../createPartialResponse.mjs","../Plugin.mjs","../index.mjs"],"sourcesContent":["try{self['workbox:range-requests:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\n\nimport '../_version.mjs';\n\n/**\n * @param {Blob} blob A source blob.\n * @param {number|null} start The offset to use as the start of the\n * slice.\n * @param {number|null} end The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\nfunction calculateEffectiveBoundaries(blob, start, end) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob',\n });\n }\n\n const blobSize = blob.size;\n\n if (end > blobSize || start < 0) {\n throw new WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start,\n });\n }\n\n let effectiveStart;\n let effectiveEnd;\n\n if (start === null) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n } else if (end === null) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n\n return {\n start: effectiveStart,\n end: effectiveEnd,\n };\n}\n\nexport {calculateEffectiveBoundaries};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\n\nimport '../_version.mjs';\n\n/**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\nfunction parseRangeHeader(rangeHeader) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader',\n });\n }\n\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError('unit-must-be-bytes', {normalizedRangeHeader});\n }\n\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError('single-range-only', {normalizedRangeHeader});\n }\n\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError('invalid-range-values', {normalizedRangeHeader});\n }\n\n return {\n start: rangeParts[1] === '' ? null : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? null : Number(rangeParts[2]),\n };\n}\n\nexport {parseRangeHeader};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\n\nimport {calculateEffectiveBoundaries} from\n './utils/calculateEffectiveBoundaries.mjs';\nimport {parseRangeHeader} from './utils/parseRangeHeader.mjs';\n\nimport './_version.mjs';\n\n/**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * If the original `Response` already contains partial content (i.e. it has\n * a status of 206), then this assumes it already fulfills the `Range:`\n * requirements, and will return it as-is.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse A response.\n * @return {Promise<Response>} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox.rangeRequests\n */\nasync function createPartialResponse(request, originalResponse) {\n try {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request',\n });\n\n assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse',\n });\n }\n\n if (originalResponse.status === 206) {\n // If we already have a 206, then just pass it through as-is;\n // see https://github.com/GoogleChrome/workbox/issues/1720\n return originalResponse;\n }\n\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError('no-range-header');\n }\n\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = await originalResponse.blob();\n\n const effectiveBoundaries = calculateEffectiveBoundaries(\n originalBlob, boundaries.start, boundaries.end);\n\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start,\n effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers,\n });\n\n slicedResponse.headers.set('Content-Length', slicedBlobSize);\n slicedResponse.headers.set('Content-Range',\n `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` +\n originalBlob.size);\n\n return slicedResponse;\n } catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to construct a partial response; returning a ` +\n `416 Range Not Satisfiable response instead.`);\n logger.groupCollapsed(`View details here.`);\n logger.log(error);\n logger.log(request);\n logger.log(originalResponse);\n logger.groupEnd();\n }\n\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable',\n });\n }\n}\n\nexport {createPartialResponse};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {createPartialResponse} from './createPartialResponse.mjs';\n\nimport './_version.mjs';\n\n/**\n * The range request plugin makes it easy for a request with a 'Range' header to\n * be fulfilled by a cached response.\n *\n * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback\n * and returning the appropriate subset of the cached response body.\n *\n * @memberof workbox.rangeRequests\n */\nclass Plugin {\n /**\n * @param {Object} options\n * @param {Request} options.request The original request, which may or may not\n * contain a Range: header.\n * @param {Response} options.cachedResponse The complete cached response.\n * @return {Promise<Response>} If request contains a 'Range' header, then a\n * new response with status 206 whose body is a subset of `cachedResponse` is\n * returned. Otherwise, `cachedResponse` is returned as-is.\n *\n * @private\n */\n async cachedResponseWillBeUsed({request, cachedResponse}) {\n // Only return a sliced response if there's something valid in the cache,\n // and there's a Range: header in the request.\n if (cachedResponse && request.headers.has('range')) {\n return await createPartialResponse(request, cachedResponse);\n }\n\n // If there was no Range: header, or if cachedResponse wasn't valid, just\n // pass it through as-is.\n return cachedResponse;\n }\n}\n\nexport {Plugin};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {createPartialResponse} from './createPartialResponse.mjs';\nimport {Plugin} from './Plugin.mjs';\nimport './_version.mjs';\n\n\n/**\n * @namespace workbox.rangeRequests\n */\n\nexport {\n createPartialResponse,\n Plugin,\n};\n"],"names":["self","_","e","calculateEffectiveBoundaries","blob","start","end","assert","isInstance","Blob","moduleName","funcName","paramName","blobSize","size","WorkboxError","effectiveStart","effectiveEnd","parseRangeHeader","rangeHeader","isType","normalizedRangeHeader","trim","toLowerCase","startsWith","includes","rangeParts","exec","Number","createPartialResponse","request","originalResponse","Request","Response","status","headers","get","boundaries","originalBlob","effectiveBoundaries","slicedBlob","slice","slicedBlobSize","slicedResponse","statusText","set","error","logger","warn","groupCollapsed","log","groupEnd","Plugin","cachedResponseWillBeUsed","cachedResponse","has"],"mappings":";;;;EAAA,IAAG;EAACA,EAAAA,IAAI,CAAC,8BAAD,CAAJ,IAAsCC,CAAC,EAAvC;EAA0C,CAA9C,CAA8C,OAAMC,CAAN,EAAQ;;ECAtD;;;;;;;AAQA,EAKA;;;;;;;;;;;EAUA,SAASC,4BAAT,CAAsCC,IAAtC,EAA4CC,KAA5C,EAAmDC,GAAnD,EAAwD;EACtD,EAA2C;EACzCC,IAAAA,iBAAM,CAACC,UAAP,CAAkBJ,IAAlB,EAAwBK,IAAxB,EAA8B;EAC5BC,MAAAA,UAAU,EAAE,wBADgB;EAE5BC,MAAAA,QAAQ,EAAE,8BAFkB;EAG5BC,MAAAA,SAAS,EAAE;EAHiB,KAA9B;EAKD;;EAED,QAAMC,QAAQ,GAAGT,IAAI,CAACU,IAAtB;;EAEA,MAAIR,GA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MAAAA,iBAAM,CAACE,cAAP,CAAuB,oBAAvB;EACAF,MAAAA,iBAAM,CAACG,GAAP,CAAWJ,KAAX;EACAC,MAAAA,iBAAM,CAACG,GAAP,CAAWpB,OAAX;EACAiB,MAAAA,iBAAM,CAACG,GAAP,CAAWnB,gBAAX;EACAgB,MAAAA,iBAAM,CAACI,QAAP;EACD;;EAED,WAAO,IAAIlB,QAAJ,CAAa,EAAb,EAAiB;EACtBC,MAAAA,MAAM,EAAE,GADc;EAEtBU,MAAAA,UAAU,EAAE;EAFU,KAAjB,CAAP;EAID;EACF;;ECvGD;;;;;;;AAQA,EAIA;;;;;;;;;;EASA,MAAMQ,MAAN,CAAa;EACX;;;;;;;;;;;EAWA,QAAMC,wBAAN,CAA+B;EAACvB,IAAAA,OAAD;EAAUwB,IAAAA;EAAV,GAA/B,EAA0D;EACxD;EACA;EACA,QAAIA,cAAc,IAAIxB,OAAO,CAACK,OAAR,CAAgBoB,GAAhB,CAAoB,OAApB,CAAtB,EAAoD;EAClD,aAAO,MAAM1B,qBAAqB,CAACC,OAAD,EAAUwB,cAAV,CAAlC;EACD,KALuD;EAQxD;;;EACA,WAAOA,cAAP;EACD;;EAtBU;;ECrBb;;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.rangeRequests=function(e,n){"use strict";try{self["workbox:range-requests:4.3.1"]&&_()}catch(e){}async function t(e,t){try{if(206===t.status)return t;const s=e.headers.get("range");if(!s)throw new n.WorkboxError("no-range-header");const a=function(e){const t=e.trim().toLowerCase();if(!t.startsWith("bytes="))throw new n.WorkboxError("unit-must-be-bytes",{normalizedRangeHeader:t});if(t.includes(","))throw new n.WorkboxError("single-range-only",{normalizedRangeHeader:t});const s=/(\d*)-(\d*)/.exec(t);if(null===s||!s[1]&&!s[2])throw new n.WorkboxError("invalid-range-values",{normalizedRangeHeader:t});return{start:""===s[1]?null:Number(s[1]),end:""===s[2]?null:Number(s[2])}}(s),r=await t.blob(),i=function(e,t,s){const a=e.size;if(s>a||t<0)throw new n.WorkboxError("range-not-satisfiable",{size:a,end:s,start:t});let r,i;return null===t?(r=a-s,i=a):null===s?(r=t,i=a):(r=t,i=s+1),{start:r,end:i}}(r,a.start,a.end),o=r.slice(i.start,i.end),u=o.size,l=new Response(o,{status:206,statusText:"Partial Content",headers:t.headers});return l.headers.set("Content-Length",u),l.headers.set("Content-Range",`bytes ${i.start}-${i.end-1}/`+r.size),l}catch(e){return new Response("",{status:416,statusText:"Range Not Satisfiable"})}}return e.createPartialResponse=t,e.Plugin=class{async cachedResponseWillBeUsed({request:e,cachedResponse:n}){return n&&e.headers.has("range")?await t(e,n):n}},e}({},workbox.core._private);
2
- //# sourceMappingURL=workbox-range-requests.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workbox-range-requests.prod.js","sources":["../_version.mjs","../createPartialResponse.mjs","../utils/parseRangeHeader.mjs","../utils/calculateEffectiveBoundaries.mjs","../Plugin.mjs"],"sourcesContent":["try{self['workbox:range-requests:4.3.1']&&_()}catch(e){}// eslint-disable-line","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\nimport {logger} from 'workbox-core/_private/logger.mjs';\n\nimport {calculateEffectiveBoundaries} from\n './utils/calculateEffectiveBoundaries.mjs';\nimport {parseRangeHeader} from './utils/parseRangeHeader.mjs';\n\nimport './_version.mjs';\n\n/**\n * Given a `Request` and `Response` objects as input, this will return a\n * promise for a new `Response`.\n *\n * If the original `Response` already contains partial content (i.e. it has\n * a status of 206), then this assumes it already fulfills the `Range:`\n * requirements, and will return it as-is.\n *\n * @param {Request} request A request, which should contain a Range:\n * header.\n * @param {Response} originalResponse A response.\n * @return {Promise<Response>} Either a `206 Partial Content` response, with\n * the response body set to the slice of content specified by the request's\n * `Range:` header, or a `416 Range Not Satisfiable` response if the\n * conditions of the `Range:` header can't be met.\n *\n * @memberof workbox.rangeRequests\n */\nasync function createPartialResponse(request, originalResponse) {\n try {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(request, Request, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'request',\n });\n\n assert.isInstance(originalResponse, Response, {\n moduleName: 'workbox-range-requests',\n funcName: 'createPartialResponse',\n paramName: 'originalResponse',\n });\n }\n\n if (originalResponse.status === 206) {\n // If we already have a 206, then just pass it through as-is;\n // see https://github.com/GoogleChrome/workbox/issues/1720\n return originalResponse;\n }\n\n const rangeHeader = request.headers.get('range');\n if (!rangeHeader) {\n throw new WorkboxError('no-range-header');\n }\n\n const boundaries = parseRangeHeader(rangeHeader);\n const originalBlob = await originalResponse.blob();\n\n const effectiveBoundaries = calculateEffectiveBoundaries(\n originalBlob, boundaries.start, boundaries.end);\n\n const slicedBlob = originalBlob.slice(effectiveBoundaries.start,\n effectiveBoundaries.end);\n const slicedBlobSize = slicedBlob.size;\n\n const slicedResponse = new Response(slicedBlob, {\n // Status code 206 is for a Partial Content response.\n // See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206\n status: 206,\n statusText: 'Partial Content',\n headers: originalResponse.headers,\n });\n\n slicedResponse.headers.set('Content-Length', slicedBlobSize);\n slicedResponse.headers.set('Content-Range',\n `bytes ${effectiveBoundaries.start}-${effectiveBoundaries.end - 1}/` +\n originalBlob.size);\n\n return slicedResponse;\n } catch (error) {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(`Unable to construct a partial response; returning a ` +\n `416 Range Not Satisfiable response instead.`);\n logger.groupCollapsed(`View details here.`);\n logger.log(error);\n logger.log(request);\n logger.log(originalResponse);\n logger.groupEnd();\n }\n\n return new Response('', {\n status: 416,\n statusText: 'Range Not Satisfiable',\n });\n }\n}\n\nexport {createPartialResponse};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\n\nimport '../_version.mjs';\n\n/**\n * @param {string} rangeHeader A Range: header value.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the parsed value of the Range: header. If either the `start` or `end` are\n * omitted, then `null` will be returned.\n *\n * @private\n */\nfunction parseRangeHeader(rangeHeader) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isType(rangeHeader, 'string', {\n moduleName: 'workbox-range-requests',\n funcName: 'parseRangeHeader',\n paramName: 'rangeHeader',\n });\n }\n\n const normalizedRangeHeader = rangeHeader.trim().toLowerCase();\n if (!normalizedRangeHeader.startsWith('bytes=')) {\n throw new WorkboxError('unit-must-be-bytes', {normalizedRangeHeader});\n }\n\n // Specifying multiple ranges separate by commas is valid syntax, but this\n // library only attempts to handle a single, contiguous sequence of bytes.\n // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range#Syntax\n if (normalizedRangeHeader.includes(',')) {\n throw new WorkboxError('single-range-only', {normalizedRangeHeader});\n }\n\n const rangeParts = /(\\d*)-(\\d*)/.exec(normalizedRangeHeader);\n // We need either at least one of the start or end values.\n if (rangeParts === null || !(rangeParts[1] || rangeParts[2])) {\n throw new WorkboxError('invalid-range-values', {normalizedRangeHeader});\n }\n\n return {\n start: rangeParts[1] === '' ? null : Number(rangeParts[1]),\n end: rangeParts[2] === '' ? null : Number(rangeParts[2]),\n };\n}\n\nexport {parseRangeHeader};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {WorkboxError} from 'workbox-core/_private/WorkboxError.mjs';\nimport {assert} from 'workbox-core/_private/assert.mjs';\n\nimport '../_version.mjs';\n\n/**\n * @param {Blob} blob A source blob.\n * @param {number|null} start The offset to use as the start of the\n * slice.\n * @param {number|null} end The offset to use as the end of the slice.\n * @return {Object} An object with `start` and `end` properties, reflecting\n * the effective boundaries to use given the size of the blob.\n *\n * @private\n */\nfunction calculateEffectiveBoundaries(blob, start, end) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isInstance(blob, Blob, {\n moduleName: 'workbox-range-requests',\n funcName: 'calculateEffectiveBoundaries',\n paramName: 'blob',\n });\n }\n\n const blobSize = blob.size;\n\n if (end > blobSize || start < 0) {\n throw new WorkboxError('range-not-satisfiable', {\n size: blobSize,\n end,\n start,\n });\n }\n\n let effectiveStart;\n let effectiveEnd;\n\n if (start === null) {\n effectiveStart = blobSize - end;\n effectiveEnd = blobSize;\n } else if (end === null) {\n effectiveStart = start;\n effectiveEnd = blobSize;\n } else {\n effectiveStart = start;\n // Range values are inclusive, so add 1 to the value.\n effectiveEnd = end + 1;\n }\n\n return {\n start: effectiveStart,\n end: effectiveEnd,\n };\n}\n\nexport {calculateEffectiveBoundaries};\n","/*\n Copyright 2018 Google LLC\n\n Use of this source code is governed by an MIT-style\n license that can be found in the LICENSE file or at\n https://opensource.org/licenses/MIT.\n*/\n\nimport {createPartialResponse} from './createPartialResponse.mjs';\n\nimport './_version.mjs';\n\n/**\n * The range request plugin makes it easy for a request with a 'Range' header to\n * be fulfilled by a cached response.\n *\n * It does this by intercepting the `cachedResponseWillBeUsed` plugin callback\n * and returning the appropriate subset of the cached response body.\n *\n * @memberof workbox.rangeRequests\n */\nclass Plugin {\n /**\n * @param {Object} options\n * @param {Request} options.request The original request, which may or may not\n * contain a Range: header.\n * @param {Response} options.cachedResponse The complete cached response.\n * @return {Promise<Response>} If request contains a 'Range' header, then a\n * new response with status 206 whose body is a subset of `cachedResponse` is\n * returned. Otherwise, `cachedResponse` is returned as-is.\n *\n * @private\n */\n async cachedResponseWillBeUsed({request, cachedResponse}) {\n // Only return a sliced response if there's something valid in the cache,\n // and there's a Range: header in the request.\n if (cachedResponse && request.headers.has('range')) {\n return await createPartialResponse(request, cachedResponse);\n }\n\n // If there was no Range: header, or if cachedResponse wasn't valid, just\n // pass it through as-is.\n return cachedResponse;\n }\n}\n\nexport {Plugin};\n"],"names":["self","_","e","async","createPartialResponse","request","originalResponse","status","rangeHeader","headers","get","WorkboxError","boundaries","normalizedRangeHeader","trim","toLowerCase","startsWith","includes","rangeParts","exec","start","Number","end","parseRangeHeader","originalBlob","blob","effectiveBoundaries","blobSize","size","effectiveStart","effectiveEnd","calculateEffectiveBoundaries","slicedBlob","slice","slicedBlobSize","slicedResponse","Response","statusText","set","error","cachedResponse","has"],"mappings":"oFAAA,IAAIA,KAAK,iCAAiCC,IAAI,MAAMC,ICoCpDC,eAAeC,EAAsBC,EAASC,UAgBV,MAA5BA,EAAiBC,cAGZD,QAGHE,EAAcH,EAAQI,QAAQC,IAAI,aACnCF,QACG,IAAIG,eAAa,yBAGnBC,EC1CV,SAA0BJ,SASlBK,EAAwBL,EAAYM,OAAOC,kBAC5CF,EAAsBG,WAAW,gBAC9B,IAAIL,eAAa,qBAAsB,CAACE,sBAAAA,OAM5CA,EAAsBI,SAAS,WAC3B,IAAIN,eAAa,oBAAqB,CAACE,sBAAAA,UAGzCK,EAAa,cAAcC,KAAKN,MAEnB,OAAfK,IAAyBA,EAAW,KAAMA,EAAW,SACjD,IAAIP,eAAa,uBAAwB,CAACE,sBAAAA,UAG3C,CACLO,MAAyB,KAAlBF,EAAW,GAAY,KAAOG,OAAOH,EAAW,IACvDI,IAAuB,KAAlBJ,EAAW,GAAY,KAAOG,OAAOH,EAAW,KDalCK,CAAiBf,GAC9BgB,QAAqBlB,EAAiBmB,OAEtCC,EE3CV,SAAsCD,EAAML,EAAOE,SAS3CK,EAAWF,EAAKG,QAElBN,EAAMK,GAAYP,EAAQ,QACtB,IAAIT,eAAa,wBAAyB,CAC9CiB,KAAMD,EACNL,IAAAA,EACAF,MAAAA,QAIAS,EACAC,SAEU,OAAVV,GACFS,EAAiBF,EAAWL,EAC5BQ,EAAeH,GACE,OAARL,GACTO,EAAiBT,EACjBU,EAAeH,IAEfE,EAAiBT,EAEjBU,EAAeR,EAAM,GAGhB,CACLF,MAAOS,EACPP,IAAKQ,GFOuBC,CACxBP,EAAcZ,EAAWQ,MAAOR,EAAWU,KAEzCU,EAAaR,EAAaS,MAAMP,EAAoBN,MACtDM,EAAoBJ,KAClBY,EAAiBF,EAAWJ,KAE5BO,EAAiB,IAAIC,SAASJ,EAAY,CAG9CzB,OAAQ,IACR8B,WAAY,kBACZ5B,QAASH,EAAiBG,iBAG5B0B,EAAe1B,QAAQ6B,IAAI,iBAAkBJ,GAC7CC,EAAe1B,QAAQ6B,IAAI,yBACdZ,EAAoBN,SAASM,EAAoBJ,IAAM,KAClEE,EAAaI,MAERO,EACP,MAAOI,UAWA,IAAIH,SAAS,GAAI,CACtB7B,OAAQ,IACR8B,WAAY,qEG/ElB,sCAYiChC,QAACA,EAADmC,eAAUA,WAGnCA,GAAkBnC,EAAQI,QAAQgC,IAAI,eAC3BrC,EAAsBC,EAASmC,GAKvCA"}
@@ -1,1020 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.routing = (function (exports, assert_mjs, logger_mjs, cacheNames_mjs, WorkboxError_mjs, getFriendlyURL_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self['workbox:routing:4.3.1'] && _();
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2018 Google LLC
11
-
12
- Use of this source code is governed by an MIT-style
13
- license that can be found in the LICENSE file or at
14
- https://opensource.org/licenses/MIT.
15
- */
16
- /**
17
- * The default HTTP method, 'GET', used when there's no specific method
18
- * configured for a route.
19
- *
20
- * @type {string}
21
- *
22
- * @private
23
- */
24
-
25
- const defaultMethod = 'GET';
26
- /**
27
- * The list of valid HTTP methods associated with requests that could be routed.
28
- *
29
- * @type {Array<string>}
30
- *
31
- * @private
32
- */
33
-
34
- const validMethods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
35
-
36
- /*
37
- Copyright 2018 Google LLC
38
-
39
- Use of this source code is governed by an MIT-style
40
- license that can be found in the LICENSE file or at
41
- https://opensource.org/licenses/MIT.
42
- */
43
- /**
44
- * @param {function()|Object} handler Either a function, or an object with a
45
- * 'handle' method.
46
- * @return {Object} An object with a handle method.
47
- *
48
- * @private
49
- */
50
-
51
- const normalizeHandler = handler => {
52
- if (handler && typeof handler === 'object') {
53
- {
54
- assert_mjs.assert.hasMethod(handler, 'handle', {
55
- moduleName: 'workbox-routing',
56
- className: 'Route',
57
- funcName: 'constructor',
58
- paramName: 'handler'
59
- });
60
- }
61
-
62
- return handler;
63
- } else {
64
- {
65
- assert_mjs.assert.isType(handler, 'function', {
66
- moduleName: 'workbox-routing',
67
- className: 'Route',
68
- funcName: 'constructor',
69
- paramName: 'handler'
70
- });
71
- }
72
-
73
- return {
74
- handle: handler
75
- };
76
- }
77
- };
78
-
79
- /*
80
- Copyright 2018 Google LLC
81
-
82
- Use of this source code is governed by an MIT-style
83
- license that can be found in the LICENSE file or at
84
- https://opensource.org/licenses/MIT.
85
- */
86
- /**
87
- * A `Route` consists of a pair of callback functions, "match" and "handler".
88
- * The "match" callback determine if a route should be used to "handle" a
89
- * request by returning a non-falsy value if it can. The "handler" callback
90
- * is called when there is a match and should return a Promise that resolves
91
- * to a `Response`.
92
- *
93
- * @memberof workbox.routing
94
- */
95
-
96
- class Route {
97
- /**
98
- * Constructor for Route class.
99
- *
100
- * @param {workbox.routing.Route~matchCallback} match
101
- * A callback function that determines whether the route matches a given
102
- * `fetch` event by returning a non-falsy value.
103
- * @param {workbox.routing.Route~handlerCallback} handler A callback
104
- * function that returns a Promise resolving to a Response.
105
- * @param {string} [method='GET'] The HTTP method to match the Route
106
- * against.
107
- */
108
- constructor(match, handler, method) {
109
- {
110
- assert_mjs.assert.isType(match, 'function', {
111
- moduleName: 'workbox-routing',
112
- className: 'Route',
113
- funcName: 'constructor',
114
- paramName: 'match'
115
- });
116
-
117
- if (method) {
118
- assert_mjs.assert.isOneOf(method, validMethods, {
119
- paramName: 'method'
120
- });
121
- }
122
- } // These values are referenced directly by Router so cannot be
123
- // altered by minifification.
124
-
125
-
126
- this.handler = normalizeHandler(handler);
127
- this.match = match;
128
- this.method = method || defaultMethod;
129
- }
130
-
131
- }
132
-
133
- /*
134
- Copyright 2018 Google LLC
135
-
136
- Use of this source code is governed by an MIT-style
137
- license that can be found in the LICENSE file or at
138
- https://opensource.org/licenses/MIT.
139
- */
140
- /**
141
- * NavigationRoute makes it easy to create a [Route]{@link
142
- * workbox.routing.Route} that matches for browser
143
- * [navigation requests]{@link https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading#first_what_are_navigation_requests}.
144
- *
145
- * It will only match incoming Requests whose
146
- * [`mode`]{@link https://fetch.spec.whatwg.org/#concept-request-mode}
147
- * is set to `navigate`.
148
- *
149
- * You can optionally only apply this route to a subset of navigation requests
150
- * by using one or both of the `blacklist` and `whitelist` parameters.
151
- *
152
- * @memberof workbox.routing
153
- * @extends workbox.routing.Route
154
- */
155
-
156
- class NavigationRoute extends Route {
157
- /**
158
- * If both `blacklist` and `whiltelist` are provided, the `blacklist` will
159
- * take precedence and the request will not match this route.
160
- *
161
- * The regular expressions in `whitelist` and `blacklist`
162
- * are matched against the concatenated
163
- * [`pathname`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/pathname}
164
- * and [`search`]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search}
165
- * portions of the requested URL.
166
- *
167
- * @param {workbox.routing.Route~handlerCallback} handler A callback
168
- * function that returns a Promise resulting in a Response.
169
- * @param {Object} options
170
- * @param {Array<RegExp>} [options.blacklist] If any of these patterns match,
171
- * the route will not handle the request (even if a whitelist RegExp matches).
172
- * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns
173
- * match the URL's pathname and search parameter, the route will handle the
174
- * request (assuming the blacklist doesn't match).
175
- */
176
- constructor(handler, {
177
- whitelist = [/./],
178
- blacklist = []
179
- } = {}) {
180
- {
181
- assert_mjs.assert.isArrayOfClass(whitelist, RegExp, {
182
- moduleName: 'workbox-routing',
183
- className: 'NavigationRoute',
184
- funcName: 'constructor',
185
- paramName: 'options.whitelist'
186
- });
187
- assert_mjs.assert.isArrayOfClass(blacklist, RegExp, {
188
- moduleName: 'workbox-routing',
189
- className: 'NavigationRoute',
190
- funcName: 'constructor',
191
- paramName: 'options.blacklist'
192
- });
193
- }
194
-
195
- super(options => this._match(options), handler);
196
- this._whitelist = whitelist;
197
- this._blacklist = blacklist;
198
- }
199
- /**
200
- * Routes match handler.
201
- *
202
- * @param {Object} options
203
- * @param {URL} options.url
204
- * @param {Request} options.request
205
- * @return {boolean}
206
- *
207
- * @private
208
- */
209
-
210
-
211
- _match({
212
- url,
213
- request
214
- }) {
215
- if (request.mode !== 'navigate') {
216
- return false;
217
- }
218
-
219
- const pathnameAndSearch = url.pathname + url.search;
220
-
221
- for (const regExp of this._blacklist) {
222
- if (regExp.test(pathnameAndSearch)) {
223
- {
224
- logger_mjs.logger.log(`The navigation route is not being used, since the ` + `URL matches this blacklist pattern: ${regExp}`);
225
- }
226
-
227
- return false;
228
- }
229
- }
230
-
231
- if (this._whitelist.some(regExp => regExp.test(pathnameAndSearch))) {
232
- {
233
- logger_mjs.logger.debug(`The navigation route is being used.`);
234
- }
235
-
236
- return true;
237
- }
238
-
239
- {
240
- logger_mjs.logger.log(`The navigation route is not being used, since the URL ` + `being navigated to doesn't match the whitelist.`);
241
- }
242
-
243
- return false;
244
- }
245
-
246
- }
247
-
248
- /*
249
- Copyright 2018 Google LLC
250
-
251
- Use of this source code is governed by an MIT-style
252
- license that can be found in the LICENSE file or at
253
- https://opensource.org/licenses/MIT.
254
- */
255
- /**
256
- * RegExpRoute makes it easy to create a regular expression based
257
- * [Route]{@link workbox.routing.Route}.
258
- *
259
- * For same-origin requests the RegExp only needs to match part of the URL. For
260
- * requests against third-party servers, you must define a RegExp that matches
261
- * the start of the URL.
262
- *
263
- * [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}
264
- *
265
- * @memberof workbox.routing
266
- * @extends workbox.routing.Route
267
- */
268
-
269
- class RegExpRoute extends Route {
270
- /**
271
- * If the regulard expression contains
272
- * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},
273
- * th ecaptured values will be passed to the
274
- * [handler's]{@link workbox.routing.Route~handlerCallback} `params`
275
- * argument.
276
- *
277
- * @param {RegExp} regExp The regular expression to match against URLs.
278
- * @param {workbox.routing.Route~handlerCallback} handler A callback
279
- * function that returns a Promise resulting in a Response.
280
- * @param {string} [method='GET'] The HTTP method to match the Route
281
- * against.
282
- */
283
- constructor(regExp, handler, method) {
284
- {
285
- assert_mjs.assert.isInstance(regExp, RegExp, {
286
- moduleName: 'workbox-routing',
287
- className: 'RegExpRoute',
288
- funcName: 'constructor',
289
- paramName: 'pattern'
290
- });
291
- }
292
-
293
- const match = ({
294
- url
295
- }) => {
296
- const result = regExp.exec(url.href); // Return null immediately if there's no match.
297
-
298
- if (!result) {
299
- return null;
300
- } // Require that the match start at the first character in the URL string
301
- // if it's a cross-origin request.
302
- // See https://github.com/GoogleChrome/workbox/issues/281 for the context
303
- // behind this behavior.
304
-
305
-
306
- if (url.origin !== location.origin && result.index !== 0) {
307
- {
308
- logger_mjs.logger.debug(`The regular expression '${regExp}' only partially matched ` + `against the cross-origin URL '${url}'. RegExpRoute's will only ` + `handle cross-origin requests if they match the entire URL.`);
309
- }
310
-
311
- return null;
312
- } // If the route matches, but there aren't any capture groups defined, then
313
- // this will return [], which is truthy and therefore sufficient to
314
- // indicate a match.
315
- // If there are capture groups, then it will return their values.
316
-
317
-
318
- return result.slice(1);
319
- };
320
-
321
- super(match, handler, method);
322
- }
323
-
324
- }
325
-
326
- /*
327
- Copyright 2018 Google LLC
328
-
329
- Use of this source code is governed by an MIT-style
330
- license that can be found in the LICENSE file or at
331
- https://opensource.org/licenses/MIT.
332
- */
333
- /**
334
- * The Router can be used to process a FetchEvent through one or more
335
- * [Routes]{@link workbox.routing.Route} responding with a Request if
336
- * a matching route exists.
337
- *
338
- * If no route matches a given a request, the Router will use a "default"
339
- * handler if one is defined.
340
- *
341
- * Should the matching Route throw an error, the Router will use a "catch"
342
- * handler if one is defined to gracefully deal with issues and respond with a
343
- * Request.
344
- *
345
- * If a request matches multiple routes, the **earliest** registered route will
346
- * be used to respond to the request.
347
- *
348
- * @memberof workbox.routing
349
- */
350
-
351
- class Router {
352
- /**
353
- * Initializes a new Router.
354
- */
355
- constructor() {
356
- this._routes = new Map();
357
- }
358
- /**
359
- * @return {Map<string, Array<workbox.routing.Route>>} routes A `Map` of HTTP
360
- * method name ('GET', etc.) to an array of all the corresponding `Route`
361
- * instances that are registered.
362
- */
363
-
364
-
365
- get routes() {
366
- return this._routes;
367
- }
368
- /**
369
- * Adds a fetch event listener to respond to events when a route matches
370
- * the event's request.
371
- */
372
-
373
-
374
- addFetchListener() {
375
- self.addEventListener('fetch', event => {
376
- const {
377
- request
378
- } = event;
379
- const responsePromise = this.handleRequest({
380
- request,
381
- event
382
- });
383
-
384
- if (responsePromise) {
385
- event.respondWith(responsePromise);
386
- }
387
- });
388
- }
389
- /**
390
- * Adds a message event listener for URLs to cache from the window.
391
- * This is useful to cache resources loaded on the page prior to when the
392
- * service worker started controlling it.
393
- *
394
- * The format of the message data sent from the window should be as follows.
395
- * Where the `urlsToCache` array may consist of URL strings or an array of
396
- * URL string + `requestInit` object (the same as you'd pass to `fetch()`).
397
- *
398
- * ```
399
- * {
400
- * type: 'CACHE_URLS',
401
- * payload: {
402
- * urlsToCache: [
403
- * './script1.js',
404
- * './script2.js',
405
- * ['./script3.js', {mode: 'no-cors'}],
406
- * ],
407
- * },
408
- * }
409
- * ```
410
- */
411
-
412
-
413
- addCacheListener() {
414
- self.addEventListener('message', async event => {
415
- if (event.data && event.data.type === 'CACHE_URLS') {
416
- const {
417
- payload
418
- } = event.data;
419
-
420
- {
421
- logger_mjs.logger.debug(`Caching URLs from the window`, payload.urlsToCache);
422
- }
423
-
424
- const requestPromises = Promise.all(payload.urlsToCache.map(entry => {
425
- if (typeof entry === 'string') {
426
- entry = [entry];
427
- }
428
-
429
- const request = new Request(...entry);
430
- return this.handleRequest({
431
- request
432
- });
433
- }));
434
- event.waitUntil(requestPromises); // If a MessageChannel was used, reply to the message on success.
435
-
436
- if (event.ports && event.ports[0]) {
437
- await requestPromises;
438
- event.ports[0].postMessage(true);
439
- }
440
- }
441
- });
442
- }
443
- /**
444
- * Apply the routing rules to a FetchEvent object to get a Response from an
445
- * appropriate Route's handler.
446
- *
447
- * @param {Object} options
448
- * @param {Request} options.request The request to handle (this is usually
449
- * from a fetch event, but it does not have to be).
450
- * @param {FetchEvent} [options.event] The event that triggered the request,
451
- * if applicable.
452
- * @return {Promise<Response>|undefined} A promise is returned if a
453
- * registered route can handle the request. If there is no matching
454
- * route and there's no `defaultHandler`, `undefined` is returned.
455
- */
456
-
457
-
458
- handleRequest({
459
- request,
460
- event
461
- }) {
462
- {
463
- assert_mjs.assert.isInstance(request, Request, {
464
- moduleName: 'workbox-routing',
465
- className: 'Router',
466
- funcName: 'handleRequest',
467
- paramName: 'options.request'
468
- });
469
- }
470
-
471
- const url = new URL(request.url, location);
472
-
473
- if (!url.protocol.startsWith('http')) {
474
- {
475
- logger_mjs.logger.debug(`Workbox Router only supports URLs that start with 'http'.`);
476
- }
477
-
478
- return;
479
- }
480
-
481
- let {
482
- params,
483
- route
484
- } = this.findMatchingRoute({
485
- url,
486
- request,
487
- event
488
- });
489
- let handler = route && route.handler;
490
- let debugMessages = [];
491
-
492
- {
493
- if (handler) {
494
- debugMessages.push([`Found a route to handle this request:`, route]);
495
-
496
- if (params) {
497
- debugMessages.push([`Passing the following params to the route's handler:`, params]);
498
- }
499
- }
500
- } // If we don't have a handler because there was no matching route, then
501
- // fall back to defaultHandler if that's defined.
502
-
503
-
504
- if (!handler && this._defaultHandler) {
505
- {
506
- debugMessages.push(`Failed to find a matching route. Falling ` + `back to the default handler.`); // This is used for debugging in logs in the case of an error.
507
-
508
- route = '[Default Handler]';
509
- }
510
-
511
- handler = this._defaultHandler;
512
- }
513
-
514
- if (!handler) {
515
- {
516
- // No handler so Workbox will do nothing. If logs is set of debug
517
- // i.e. verbose, we should print out this information.
518
- logger_mjs.logger.debug(`No route found for: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);
519
- }
520
-
521
- return;
522
- }
523
-
524
- {
525
- // We have a handler, meaning Workbox is going to handle the route.
526
- // print the routing details to the console.
527
- logger_mjs.logger.groupCollapsed(`Router is responding to: ${getFriendlyURL_mjs.getFriendlyURL(url)}`);
528
- debugMessages.forEach(msg => {
529
- if (Array.isArray(msg)) {
530
- logger_mjs.logger.log(...msg);
531
- } else {
532
- logger_mjs.logger.log(msg);
533
- }
534
- }); // The Request and Response objects contains a great deal of information,
535
- // hide it under a group in case developers want to see it.
536
-
537
- logger_mjs.logger.groupCollapsed(`View request details here.`);
538
- logger_mjs.logger.log(request);
539
- logger_mjs.logger.groupEnd();
540
- logger_mjs.logger.groupEnd();
541
- } // Wrap in try and catch in case the handle method throws a synchronous
542
- // error. It should still callback to the catch handler.
543
-
544
-
545
- let responsePromise;
546
-
547
- try {
548
- responsePromise = handler.handle({
549
- url,
550
- request,
551
- event,
552
- params
553
- });
554
- } catch (err) {
555
- responsePromise = Promise.reject(err);
556
- }
557
-
558
- if (responsePromise && this._catchHandler) {
559
- responsePromise = responsePromise.catch(err => {
560
- {
561
- // Still include URL here as it will be async from the console group
562
- // and may not make sense without the URL
563
- logger_mjs.logger.groupCollapsed(`Error thrown when responding to: ` + ` ${getFriendlyURL_mjs.getFriendlyURL(url)}. Falling back to Catch Handler.`);
564
- logger_mjs.logger.error(`Error thrown by:`, route);
565
- logger_mjs.logger.error(err);
566
- logger_mjs.logger.groupEnd();
567
- }
568
-
569
- return this._catchHandler.handle({
570
- url,
571
- event,
572
- err
573
- });
574
- });
575
- }
576
-
577
- return responsePromise;
578
- }
579
- /**
580
- * Checks a request and URL (and optionally an event) against the list of
581
- * registered routes, and if there's a match, returns the corresponding
582
- * route along with any params generated by the match.
583
- *
584
- * @param {Object} options
585
- * @param {URL} options.url
586
- * @param {Request} options.request The request to match.
587
- * @param {FetchEvent} [options.event] The corresponding event (unless N/A).
588
- * @return {Object} An object with `route` and `params` properties.
589
- * They are populated if a matching route was found or `undefined`
590
- * otherwise.
591
- */
592
-
593
-
594
- findMatchingRoute({
595
- url,
596
- request,
597
- event
598
- }) {
599
- {
600
- assert_mjs.assert.isInstance(url, URL, {
601
- moduleName: 'workbox-routing',
602
- className: 'Router',
603
- funcName: 'findMatchingRoute',
604
- paramName: 'options.url'
605
- });
606
- assert_mjs.assert.isInstance(request, Request, {
607
- moduleName: 'workbox-routing',
608
- className: 'Router',
609
- funcName: 'findMatchingRoute',
610
- paramName: 'options.request'
611
- });
612
- }
613
-
614
- const routes = this._routes.get(request.method) || [];
615
-
616
- for (const route of routes) {
617
- let params;
618
- let matchResult = route.match({
619
- url,
620
- request,
621
- event
622
- });
623
-
624
- if (matchResult) {
625
- if (Array.isArray(matchResult) && matchResult.length > 0) {
626
- // Instead of passing an empty array in as params, use undefined.
627
- params = matchResult;
628
- } else if (matchResult.constructor === Object && Object.keys(matchResult).length > 0) {
629
- // Instead of passing an empty object in as params, use undefined.
630
- params = matchResult;
631
- } // Return early if have a match.
632
-
633
-
634
- return {
635
- route,
636
- params
637
- };
638
- }
639
- } // If no match was found above, return and empty object.
640
-
641
-
642
- return {};
643
- }
644
- /**
645
- * Define a default `handler` that's called when no routes explicitly
646
- * match the incoming request.
647
- *
648
- * Without a default handler, unmatched requests will go against the
649
- * network as if there were no service worker present.
650
- *
651
- * @param {workbox.routing.Route~handlerCallback} handler A callback
652
- * function that returns a Promise resulting in a Response.
653
- */
654
-
655
-
656
- setDefaultHandler(handler) {
657
- this._defaultHandler = normalizeHandler(handler);
658
- }
659
- /**
660
- * If a Route throws an error while handling a request, this `handler`
661
- * will be called and given a chance to provide a response.
662
- *
663
- * @param {workbox.routing.Route~handlerCallback} handler A callback
664
- * function that returns a Promise resulting in a Response.
665
- */
666
-
667
-
668
- setCatchHandler(handler) {
669
- this._catchHandler = normalizeHandler(handler);
670
- }
671
- /**
672
- * Registers a route with the router.
673
- *
674
- * @param {workbox.routing.Route} route The route to register.
675
- */
676
-
677
-
678
- registerRoute(route) {
679
- {
680
- assert_mjs.assert.isType(route, 'object', {
681
- moduleName: 'workbox-routing',
682
- className: 'Router',
683
- funcName: 'registerRoute',
684
- paramName: 'route'
685
- });
686
- assert_mjs.assert.hasMethod(route, 'match', {
687
- moduleName: 'workbox-routing',
688
- className: 'Router',
689
- funcName: 'registerRoute',
690
- paramName: 'route'
691
- });
692
- assert_mjs.assert.isType(route.handler, 'object', {
693
- moduleName: 'workbox-routing',
694
- className: 'Router',
695
- funcName: 'registerRoute',
696
- paramName: 'route'
697
- });
698
- assert_mjs.assert.hasMethod(route.handler, 'handle', {
699
- moduleName: 'workbox-routing',
700
- className: 'Router',
701
- funcName: 'registerRoute',
702
- paramName: 'route.handler'
703
- });
704
- assert_mjs.assert.isType(route.method, 'string', {
705
- moduleName: 'workbox-routing',
706
- className: 'Router',
707
- funcName: 'registerRoute',
708
- paramName: 'route.method'
709
- });
710
- }
711
-
712
- if (!this._routes.has(route.method)) {
713
- this._routes.set(route.method, []);
714
- } // Give precedence to all of the earlier routes by adding this additional
715
- // route to the end of the array.
716
-
717
-
718
- this._routes.get(route.method).push(route);
719
- }
720
- /**
721
- * Unregisters a route with the router.
722
- *
723
- * @param {workbox.routing.Route} route The route to unregister.
724
- */
725
-
726
-
727
- unregisterRoute(route) {
728
- if (!this._routes.has(route.method)) {
729
- throw new WorkboxError_mjs.WorkboxError('unregister-route-but-not-found-with-method', {
730
- method: route.method
731
- });
732
- }
733
-
734
- const routeIndex = this._routes.get(route.method).indexOf(route);
735
-
736
- if (routeIndex > -1) {
737
- this._routes.get(route.method).splice(routeIndex, 1);
738
- } else {
739
- throw new WorkboxError_mjs.WorkboxError('unregister-route-route-not-registered');
740
- }
741
- }
742
-
743
- }
744
-
745
- /*
746
- Copyright 2019 Google LLC
747
-
748
- Use of this source code is governed by an MIT-style
749
- license that can be found in the LICENSE file or at
750
- https://opensource.org/licenses/MIT.
751
- */
752
- let defaultRouter;
753
- /**
754
- * Creates a new, singleton Router instance if one does not exist. If one
755
- * does already exist, that instance is returned.
756
- *
757
- * @private
758
- * @return {Router}
759
- */
760
-
761
- const getOrCreateDefaultRouter = () => {
762
- if (!defaultRouter) {
763
- defaultRouter = new Router(); // The helpers that use the default Router assume these listeners exist.
764
-
765
- defaultRouter.addFetchListener();
766
- defaultRouter.addCacheListener();
767
- }
768
-
769
- return defaultRouter;
770
- };
771
-
772
- /*
773
- Copyright 2019 Google LLC
774
-
775
- Use of this source code is governed by an MIT-style
776
- license that can be found in the LICENSE file or at
777
- https://opensource.org/licenses/MIT.
778
- */
779
- /**
780
- * Registers a route that will return a precached file for a navigation
781
- * request. This is useful for the
782
- * [application shell pattern]{@link https://developers.google.com/web/fundamentals/architecture/app-shell}.
783
- *
784
- * When determining the URL of the precached HTML document, you will likely need
785
- * to call `workbox.precaching.getCacheKeyForURL(originalUrl)`, to account for
786
- * the fact that Workbox's precaching naming conventions often results in URL
787
- * cache keys that contain extra revisioning info.
788
- *
789
- * This method will generate a
790
- * [NavigationRoute]{@link workbox.routing.NavigationRoute}
791
- * and call
792
- * [Router.registerRoute()]{@link workbox.routing.Router#registerRoute} on a
793
- * singleton Router instance.
794
- *
795
- * @param {string} cachedAssetUrl The cache key to use for the HTML file.
796
- * @param {Object} [options]
797
- * @param {string} [options.cacheName] Cache name to store and retrieve
798
- * requests. Defaults to precache cache name provided by
799
- * [workbox-core.cacheNames]{@link workbox.core.cacheNames}.
800
- * @param {Array<RegExp>} [options.blacklist=[]] If any of these patterns
801
- * match, the route will not handle the request (even if a whitelist entry
802
- * matches).
803
- * @param {Array<RegExp>} [options.whitelist=[/./]] If any of these patterns
804
- * match the URL's pathname and search parameter, the route will handle the
805
- * request (assuming the blacklist doesn't match).
806
- * @return {workbox.routing.NavigationRoute} Returns the generated
807
- * Route.
808
- *
809
- * @alias workbox.routing.registerNavigationRoute
810
- */
811
-
812
- const registerNavigationRoute = (cachedAssetUrl, options = {}) => {
813
- {
814
- assert_mjs.assert.isType(cachedAssetUrl, 'string', {
815
- moduleName: 'workbox-routing',
816
- funcName: 'registerNavigationRoute',
817
- paramName: 'cachedAssetUrl'
818
- });
819
- }
820
-
821
- const cacheName = cacheNames_mjs.cacheNames.getPrecacheName(options.cacheName);
822
-
823
- const handler = async () => {
824
- try {
825
- const response = await caches.match(cachedAssetUrl, {
826
- cacheName
827
- });
828
-
829
- if (response) {
830
- return response;
831
- } // This shouldn't normally happen, but there are edge cases:
832
- // https://github.com/GoogleChrome/workbox/issues/1441
833
-
834
-
835
- throw new Error(`The cache ${cacheName} did not have an entry for ` + `${cachedAssetUrl}.`);
836
- } catch (error) {
837
- // If there's either a cache miss, or the caches.match() call threw
838
- // an exception, then attempt to fulfill the navigation request with
839
- // a response from the network rather than leaving the user with a
840
- // failed navigation.
841
- {
842
- logger_mjs.logger.debug(`Unable to respond to navigation request with ` + `cached response. Falling back to network.`, error);
843
- } // This might still fail if the browser is offline...
844
-
845
-
846
- return fetch(cachedAssetUrl);
847
- }
848
- };
849
-
850
- const route = new NavigationRoute(handler, {
851
- whitelist: options.whitelist,
852
- blacklist: options.blacklist
853
- });
854
- const defaultRouter = getOrCreateDefaultRouter();
855
- defaultRouter.registerRoute(route);
856
- return route;
857
- };
858
-
859
- /*
860
- Copyright 2019 Google LLC
861
-
862
- Use of this source code is governed by an MIT-style
863
- license that can be found in the LICENSE file or at
864
- https://opensource.org/licenses/MIT.
865
- */
866
- /**
867
- * Easily register a RegExp, string, or function with a caching
868
- * strategy to a singleton Router instance.
869
- *
870
- * This method will generate a Route for you if needed and
871
- * call [Router.registerRoute()]{@link
872
- * workbox.routing.Router#registerRoute}.
873
- *
874
- * @param {
875
- * RegExp|
876
- * string|
877
- * workbox.routing.Route~matchCallback|
878
- * workbox.routing.Route
879
- * } capture
880
- * If the capture param is a `Route`, all other arguments will be ignored.
881
- * @param {workbox.routing.Route~handlerCallback} handler A callback
882
- * function that returns a Promise resulting in a Response.
883
- * @param {string} [method='GET'] The HTTP method to match the Route
884
- * against.
885
- * @return {workbox.routing.Route} The generated `Route`(Useful for
886
- * unregistering).
887
- *
888
- * @alias workbox.routing.registerRoute
889
- */
890
-
891
- const registerRoute = (capture, handler, method = 'GET') => {
892
- let route;
893
-
894
- if (typeof capture === 'string') {
895
- const captureUrl = new URL(capture, location);
896
-
897
- {
898
- if (!(capture.startsWith('/') || capture.startsWith('http'))) {
899
- throw new WorkboxError_mjs.WorkboxError('invalid-string', {
900
- moduleName: 'workbox-routing',
901
- funcName: 'registerRoute',
902
- paramName: 'capture'
903
- });
904
- } // We want to check if Express-style wildcards are in the pathname only.
905
- // TODO: Remove this log message in v4.
906
-
907
-
908
- const valueToCheck = capture.startsWith('http') ? captureUrl.pathname : capture; // See https://github.com/pillarjs/path-to-regexp#parameters
909
-
910
- const wildcards = '[*:?+]';
911
-
912
- if (valueToCheck.match(new RegExp(`${wildcards}`))) {
913
- logger_mjs.logger.debug(`The '$capture' parameter contains an Express-style wildcard ` + `character (${wildcards}). Strings are now always interpreted as ` + `exact matches; use a RegExp for partial or wildcard matches.`);
914
- }
915
- }
916
-
917
- const matchCallback = ({
918
- url
919
- }) => {
920
- {
921
- if (url.pathname === captureUrl.pathname && url.origin !== captureUrl.origin) {
922
- logger_mjs.logger.debug(`${capture} only partially matches the cross-origin URL ` + `${url}. This route will only handle cross-origin requests ` + `if they match the entire URL.`);
923
- }
924
- }
925
-
926
- return url.href === captureUrl.href;
927
- };
928
-
929
- route = new Route(matchCallback, handler, method);
930
- } else if (capture instanceof RegExp) {
931
- route = new RegExpRoute(capture, handler, method);
932
- } else if (typeof capture === 'function') {
933
- route = new Route(capture, handler, method);
934
- } else if (capture instanceof Route) {
935
- route = capture;
936
- } else {
937
- throw new WorkboxError_mjs.WorkboxError('unsupported-route-type', {
938
- moduleName: 'workbox-routing',
939
- funcName: 'registerRoute',
940
- paramName: 'capture'
941
- });
942
- }
943
-
944
- const defaultRouter = getOrCreateDefaultRouter();
945
- defaultRouter.registerRoute(route);
946
- return route;
947
- };
948
-
949
- /*
950
- Copyright 2019 Google LLC
951
-
952
- Use of this source code is governed by an MIT-style
953
- license that can be found in the LICENSE file or at
954
- https://opensource.org/licenses/MIT.
955
- */
956
- /**
957
- * If a Route throws an error while handling a request, this `handler`
958
- * will be called and given a chance to provide a response.
959
- *
960
- * @param {workbox.routing.Route~handlerCallback} handler A callback
961
- * function that returns a Promise resulting in a Response.
962
- *
963
- * @alias workbox.routing.setCatchHandler
964
- */
965
-
966
- const setCatchHandler = handler => {
967
- const defaultRouter = getOrCreateDefaultRouter();
968
- defaultRouter.setCatchHandler(handler);
969
- };
970
-
971
- /*
972
- Copyright 2019 Google LLC
973
-
974
- Use of this source code is governed by an MIT-style
975
- license that can be found in the LICENSE file or at
976
- https://opensource.org/licenses/MIT.
977
- */
978
- /**
979
- * Define a default `handler` that's called when no routes explicitly
980
- * match the incoming request.
981
- *
982
- * Without a default handler, unmatched requests will go against the
983
- * network as if there were no service worker present.
984
- *
985
- * @param {workbox.routing.Route~handlerCallback} handler A callback
986
- * function that returns a Promise resulting in a Response.
987
- *
988
- * @alias workbox.routing.setDefaultHandler
989
- */
990
-
991
- const setDefaultHandler = handler => {
992
- const defaultRouter = getOrCreateDefaultRouter();
993
- defaultRouter.setDefaultHandler(handler);
994
- };
995
-
996
- /*
997
- Copyright 2018 Google LLC
998
-
999
- Use of this source code is governed by an MIT-style
1000
- license that can be found in the LICENSE file or at
1001
- https://opensource.org/licenses/MIT.
1002
- */
1003
-
1004
- {
1005
- assert_mjs.assert.isSWEnv('workbox-routing');
1006
- }
1007
-
1008
- exports.NavigationRoute = NavigationRoute;
1009
- exports.RegExpRoute = RegExpRoute;
1010
- exports.registerNavigationRoute = registerNavigationRoute;
1011
- exports.registerRoute = registerRoute;
1012
- exports.Route = Route;
1013
- exports.Router = Router;
1014
- exports.setCatchHandler = setCatchHandler;
1015
- exports.setDefaultHandler = setDefaultHandler;
1016
-
1017
- return exports;
1018
-
1019
- }({}, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private, workbox.core._private));
1020
- //# sourceMappingURL=workbox-routing.dev.js.map