jekyll-pwa-plugin 2.2.3 → 5.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +5 -5
  2. data/lib/jekyll-pwa-plugin.rb +11 -3
  3. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.dev.js +818 -0
  4. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.dev.js.map +1 -0
  5. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.prod.js +2 -0
  6. data/lib/vendor/workbox-v5.1.4/workbox-background-sync.prod.js.map +1 -0
  7. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.dev.js +288 -0
  8. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.dev.js.map +1 -0
  9. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.prod.js +2 -0
  10. data/lib/vendor/workbox-v5.1.4/workbox-broadcast-update.prod.js.map +1 -0
  11. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.dev.js +191 -0
  12. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.dev.js.map +1 -0
  13. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.prod.js +2 -0
  14. data/lib/vendor/workbox-v5.1.4/workbox-cacheable-response.prod.js.map +1 -0
  15. data/lib/vendor/workbox-v5.1.4/workbox-core.dev.js +1858 -0
  16. data/lib/vendor/workbox-v5.1.4/workbox-core.dev.js.map +1 -0
  17. data/lib/vendor/workbox-v5.1.4/workbox-core.prod.js +2 -0
  18. data/lib/vendor/workbox-v5.1.4/workbox-core.prod.js.map +1 -0
  19. data/lib/vendor/workbox-v5.1.4/workbox-expiration.dev.js +649 -0
  20. data/lib/vendor/workbox-v5.1.4/workbox-expiration.dev.js.map +1 -0
  21. data/lib/vendor/workbox-v5.1.4/workbox-expiration.prod.js +2 -0
  22. data/lib/vendor/workbox-v5.1.4/workbox-expiration.prod.js.map +1 -0
  23. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.dev.js +102 -0
  24. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.dev.js.map +1 -0
  25. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.prod.js +2 -0
  26. data/lib/vendor/workbox-v5.1.4/workbox-navigation-preload.prod.js.map +1 -0
  27. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.dev.js +235 -0
  28. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.dev.js.map +1 -0
  29. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.prod.js +2 -0
  30. data/lib/vendor/workbox-v5.1.4/workbox-offline-ga.prod.js.map +1 -0
  31. data/lib/vendor/workbox-v5.1.4/workbox-precaching.dev.js +1210 -0
  32. data/lib/vendor/workbox-v5.1.4/workbox-precaching.dev.js.map +1 -0
  33. data/lib/vendor/workbox-v5.1.4/workbox-precaching.prod.js +2 -0
  34. data/lib/vendor/workbox-v5.1.4/workbox-precaching.prod.js.map +1 -0
  35. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.dev.js +262 -0
  36. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.dev.js.map +1 -0
  37. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.prod.js +2 -0
  38. data/lib/vendor/workbox-v5.1.4/workbox-range-requests.prod.js.map +1 -0
  39. data/lib/vendor/workbox-v5.1.4/workbox-routing.dev.js +923 -0
  40. data/lib/vendor/workbox-v5.1.4/workbox-routing.dev.js.map +1 -0
  41. data/lib/vendor/workbox-v5.1.4/workbox-routing.prod.js +2 -0
  42. data/lib/vendor/workbox-v5.1.4/workbox-routing.prod.js.map +1 -0
  43. data/lib/vendor/workbox-v5.1.4/workbox-strategies.dev.js +923 -0
  44. data/lib/vendor/workbox-v5.1.4/workbox-strategies.dev.js.map +1 -0
  45. data/lib/vendor/workbox-v5.1.4/workbox-strategies.prod.js +2 -0
  46. data/lib/vendor/workbox-v5.1.4/workbox-strategies.prod.js.map +1 -0
  47. data/lib/vendor/workbox-v5.1.4/workbox-streams.dev.js +318 -0
  48. data/lib/vendor/workbox-v5.1.4/workbox-streams.dev.js.map +1 -0
  49. data/lib/vendor/workbox-v5.1.4/workbox-streams.prod.js +2 -0
  50. data/lib/vendor/workbox-v5.1.4/workbox-streams.prod.js.map +1 -0
  51. data/lib/vendor/workbox-v5.1.4/workbox-sw.js +2 -0
  52. data/lib/vendor/workbox-v5.1.4/workbox-sw.js.map +1 -0
  53. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.es5.mjs +1125 -0
  54. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.es5.mjs.map +1 -0
  55. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.mjs +943 -0
  56. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.mjs.map +1 -0
  57. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.umd.js +1136 -0
  58. data/lib/vendor/workbox-v5.1.4/workbox-window.dev.umd.js.map +1 -0
  59. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.es5.mjs +2 -0
  60. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.es5.mjs.map +1 -0
  61. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.mjs +2 -0
  62. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.mjs.map +1 -0
  63. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.umd.js +2 -0
  64. data/lib/vendor/workbox-v5.1.4/workbox-window.prod.umd.js.map +1 -0
  65. metadata +65 -55
  66. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.dev.js +0 -593
  67. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.dev.js.map +0 -1
  68. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.prod.js +0 -3
  69. data/lib/vendor/workbox-v3.6.3/workbox-background-sync.prod.js.map +0 -1
  70. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.dev.js +0 -395
  71. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.dev.js.map +0 -1
  72. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.prod.js +0 -3
  73. data/lib/vendor/workbox-v3.6.3/workbox-broadcast-cache-update.prod.js.map +0 -1
  74. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.dev.js +0 -740
  75. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.dev.js.map +0 -1
  76. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.prod.js +0 -3
  77. data/lib/vendor/workbox-v3.6.3/workbox-cache-expiration.prod.js.map +0 -1
  78. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.dev.js +0 -236
  79. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.dev.js.map +0 -1
  80. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.prod.js +0 -3
  81. data/lib/vendor/workbox-v3.6.3/workbox-cacheable-response.prod.js.map +0 -1
  82. data/lib/vendor/workbox-v3.6.3/workbox-core.dev.js +0 -1736
  83. data/lib/vendor/workbox-v3.6.3/workbox-core.dev.js.map +0 -1
  84. data/lib/vendor/workbox-v3.6.3/workbox-core.prod.js +0 -3
  85. data/lib/vendor/workbox-v3.6.3/workbox-core.prod.js.map +0 -1
  86. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.dev.js +0 -255
  87. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.dev.js.map +0 -1
  88. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.prod.js +0 -3
  89. data/lib/vendor/workbox-v3.6.3/workbox-google-analytics.prod.js.map +0 -1
  90. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.dev.js +0 -159
  91. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.dev.js.map +0 -1
  92. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.prod.js +0 -3
  93. data/lib/vendor/workbox-v3.6.3/workbox-navigation-preload.prod.js.map +0 -1
  94. data/lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js +0 -1171
  95. data/lib/vendor/workbox-v3.6.3/workbox-precaching.dev.js.map +0 -1
  96. data/lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js +0 -3
  97. data/lib/vendor/workbox-v3.6.3/workbox-precaching.prod.js.map +0 -1
  98. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.dev.js +0 -299
  99. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.dev.js.map +0 -1
  100. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.prod.js +0 -3
  101. data/lib/vendor/workbox-v3.6.3/workbox-range-requests.prod.js.map +0 -1
  102. data/lib/vendor/workbox-v3.6.3/workbox-routing.dev.js +0 -863
  103. data/lib/vendor/workbox-v3.6.3/workbox-routing.dev.js.map +0 -1
  104. data/lib/vendor/workbox-v3.6.3/workbox-routing.prod.js +0 -3
  105. data/lib/vendor/workbox-v3.6.3/workbox-routing.prod.js.map +0 -1
  106. data/lib/vendor/workbox-v3.6.3/workbox-strategies.dev.js +0 -1172
  107. data/lib/vendor/workbox-v3.6.3/workbox-strategies.dev.js.map +0 -1
  108. data/lib/vendor/workbox-v3.6.3/workbox-strategies.prod.js +0 -3
  109. data/lib/vendor/workbox-v3.6.3/workbox-strategies.prod.js.map +0 -1
  110. data/lib/vendor/workbox-v3.6.3/workbox-streams.dev.js +0 -380
  111. data/lib/vendor/workbox-v3.6.3/workbox-streams.dev.js.map +0 -1
  112. data/lib/vendor/workbox-v3.6.3/workbox-streams.prod.js +0 -3
  113. data/lib/vendor/workbox-v3.6.3/workbox-streams.prod.js.map +0 -1
  114. data/lib/vendor/workbox-v3.6.3/workbox-sw.js +0 -3
  115. data/lib/vendor/workbox-v3.6.3/workbox-sw.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["/* eslint-disable */\n// This is extracted from the Babel runtime (original source: https://github.com/babel/babel/blob/9e0f5235b1ca5167c368a576ad7c5af62d20b0e3/packages/babel-helpers/src/helpers.js#L240).\n// As part of the Rollup bundling process, it's injected once into workbox-core\n// and reused throughout all of the other modules, avoiding code duplication.\n// See https://github.com/GoogleChrome/workbox/pull/1048#issuecomment-344698046\n// for further background.\nself.babelHelpers = {\n asyncToGenerator: function(fn) {\n return function() {\n var gen = fn.apply(this, arguments);\n return new Promise(function(resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function(value) {\n step('next', value);\n }, function(err) {\n step('throw', err);\n });\n }\n }\n\n return step('next');\n });\n };\n },\n};\n\nthis.workbox = this.workbox || {};\nthis.workbox.core = (function () {\n 'use strict';\n\n try {\n self.workbox.v['workbox:core:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * The available log levels in Workbox: debug, log, warn, error and silent.\n *\n * @property {int} debug Prints all logs from Workbox. Useful for debugging.\n * @property {int} log Prints console log, warn, error and groups. Default for\n * debug builds.\n * @property {int} warn Prints console warn, error and groups. Default for\n * non-debug builds.\n * @property {int} error Print console error and groups.\n * @property {int} silent Force no logging from Workbox.\n *\n * @alias workbox.core.LOG_LEVELS\n */\n\n var LOG_LEVELS = {\n debug: 0,\n log: 1,\n warn: 2,\n error: 3,\n silent: 4\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n // Safari doesn't print all console.groupCollapsed() arguments.\n // Related bug: https://bugs.webkit.org/show_bug.cgi?id=182754\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n\n const GREY = `#7f8c8d`;\n const GREEN = `#2ecc71`;\n const YELLOW = `#f39c12`;\n const RED = `#c0392b`;\n const BLUE = `#3498db`;\n\n const getDefaultLogLevel = () => LOG_LEVELS.log;\n\n let logLevel = getDefaultLogLevel();\n const shouldPrint = minLevel => logLevel <= minLevel;\n const setLoggerLevel = newLogLevel => logLevel = newLogLevel;\n const getLoggerLevel = () => logLevel;\n\n // We always want groups to be logged unless logLevel is silent.\n const groupLevel = LOG_LEVELS.error;\n\n const _print = function (keyName, logArgs, levelColor) {\n const logLevel = keyName.indexOf('group') === 0 ? groupLevel : LOG_LEVELS[keyName];\n if (!shouldPrint(logLevel)) {\n return;\n }\n\n if (!levelColor || keyName === 'groupCollapsed' && isSafari) {\n console[keyName](...logArgs);\n return;\n }\n\n const logPrefix = ['%cworkbox', `background: ${levelColor}; color: white; padding: 2px 0.5em; ` + `border-radius: 0.5em;`];\n console[keyName](...logPrefix, ...logArgs);\n };\n\n const groupEnd = () => {\n if (shouldPrint(groupLevel)) {\n console.groupEnd();\n }\n };\n\n const defaultExport = {\n groupEnd,\n unprefixed: {\n groupEnd\n }\n };\n\n const setupLogs = (keyName, color) => {\n defaultExport[keyName] = (...args) => _print(keyName, args, color);\n defaultExport.unprefixed[keyName] = (...args) => _print(keyName, args);\n };\n\n const levelToColor = {\n debug: GREY,\n log: GREEN,\n warn: YELLOW,\n error: RED,\n groupCollapsed: BLUE\n };\n Object.keys(levelToColor).forEach(keyName => setupLogs(keyName, levelToColor[keyName]));\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var messages = {\n 'invalid-value': ({ paramName, validValueDescription, value }) => {\n if (!paramName || !validValueDescription) {\n throw new Error(`Unexpected input to 'invalid-value' error.`);\n }\n return `The '${paramName}' parameter was given a value with an ` + `unexpected value. ${validValueDescription} Received a value of ` + `${JSON.stringify(value)}.`;\n },\n\n 'not-in-sw': ({ moduleName }) => {\n if (!moduleName) {\n throw new Error(`Unexpected input to 'not-in-sw' error.`);\n }\n return `The '${moduleName}' must be used in a service worker.`;\n },\n\n 'not-an-array': ({ moduleName, className, funcName, paramName }) => {\n if (!moduleName || !className || !funcName || !paramName) {\n throw new Error(`Unexpected input to 'not-an-array' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className}.${funcName}()' must be an array.`;\n },\n\n 'incorrect-type': ({ expectedType, paramName, moduleName, className,\n funcName }) => {\n if (!expectedType || !paramName || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-type' error.`);\n }\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}` + `${funcName}()' must be of type ${expectedType}.`;\n },\n\n 'incorrect-class': ({ expectedClass, paramName, moduleName, className,\n funcName, isReturnValueProblem }) => {\n if (!expectedClass || !moduleName || !funcName) {\n throw new Error(`Unexpected input to 'incorrect-class' error.`);\n }\n\n if (isReturnValueProblem) {\n return `The return value from ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n }\n\n return `The parameter '${paramName}' passed into ` + `'${moduleName}.${className ? className + '.' : ''}${funcName}()' ` + `must be an instance of class ${expectedClass.name}.`;\n },\n\n 'missing-a-method': ({ expectedMethod, paramName, moduleName, className,\n funcName }) => {\n if (!expectedMethod || !paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'missing-a-method' error.`);\n }\n return `${moduleName}.${className}.${funcName}() expected the ` + `'${paramName}' parameter to expose a '${expectedMethod}' method.`;\n },\n\n 'add-to-cache-list-unexpected-type': ({ entry }) => {\n return `An unexpected entry was passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' The entry ` + `'${JSON.stringify(entry)}' isn't supported. You must supply an array of ` + `strings with one or more characters, objects with a url property or ` + `Request objects.`;\n },\n\n 'add-to-cache-list-conflicting-entries': ({ firstEntry, secondEntry }) => {\n if (!firstEntry || !secondEntry) {\n throw new Error(`Unexpected input to ` + `'add-to-cache-list-duplicate-entries' error.`);\n }\n\n return `Two of the entries passed to ` + `'workbox-precaching.PrecacheController.addToCacheList()' had matching ` + `URLs but different revision details. This means workbox-precaching ` + `is unable to determine cache the asset correctly. Please remove one ` + `of the entries.`;\n },\n\n 'plugin-error-request-will-fetch': ({ thrownError }) => {\n if (!thrownError) {\n throw new Error(`Unexpected input to ` + `'plugin-error-request-will-fetch', error.`);\n }\n\n return `An error was thrown by a plugins 'requestWillFetch()' method. ` + `The thrown error message was: '${thrownError.message}'.`;\n },\n\n 'invalid-cache-name': ({ cacheNameId, value }) => {\n if (!cacheNameId) {\n throw new Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);\n }\n\n return `You must provide a name containing at least one character for ` + `setCacheDeatils({${cacheNameId}: '...'}). Received a value of ` + `'${JSON.stringify(value)}'`;\n },\n\n 'unregister-route-but-not-found-with-method': ({ method }) => {\n if (!method) {\n throw new Error(`Unexpected input to ` + `'unregister-route-but-not-found-with-method' error.`);\n }\n\n return `The route you're trying to unregister was not previously ` + `registered for the method type '${method}'.`;\n },\n\n 'unregister-route-route-not-registered': () => {\n return `The route you're trying to unregister was not previously ` + `registered.`;\n },\n\n 'queue-replay-failed': ({ name, count }) => {\n return `${count} requests failed, while trying to replay Queue: ${name}.`;\n },\n\n 'duplicate-queue-name': ({ name }) => {\n return `The Queue name '${name}' is already being used. ` + `All instances of backgroundSync.Queue must be given unique names.`;\n },\n\n 'expired-test-without-max-age': ({ methodName, paramName }) => {\n return `The '${methodName}()' method can only be used when the ` + `'${paramName}' is used in the constructor.`;\n },\n\n 'unsupported-route-type': ({ moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter was an unsupported type. ` + `Please check the docs for ${moduleName}.${className}.${funcName} for ` + `valid input types.`;\n },\n\n 'not-array-of-class': ({ value, expectedClass,\n moduleName, className, funcName, paramName }) => {\n return `The supplied '${paramName}' parameter must be an array of ` + `'${expectedClass}' objects. Received '${JSON.stringify(value)},'. ` + `Please check the call to ${moduleName}.${className}.${funcName}() ` + `to fix the issue.`;\n },\n\n 'max-entries-or-age-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.maxEntries or config.maxAgeSeconds` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'statuses-or-headers-required': ({ moduleName, className, funcName }) => {\n return `You must define either config.statuses or config.headers` + `in ${moduleName}.${className}.${funcName}`;\n },\n\n 'invalid-string': ({ moduleName, className, funcName, paramName }) => {\n if (!paramName || !moduleName || !className || !funcName) {\n throw new Error(`Unexpected input to 'invalid-string' error.`);\n }\n return `When using strings, the '${paramName}' parameter must start with ` + `'http' (for cross-origin matches) or '/' (for same-origin matches). ` + `Please see the docs for ${moduleName}.${className}.${funcName}() for ` + `more info.`;\n },\n 'channel-name-required': () => {\n return `You must provide a channelName to construct a ` + `BroadcastCacheUpdate instance.`;\n },\n 'invalid-responses-are-same-args': () => {\n return `The arguments passed into responsesAreSame() appear to be ` + `invalid. Please ensure valid Responses are used.`;\n },\n 'expire-custom-caches-only': () => {\n return `You must provide a 'cacheName' property when using the ` + `expiration plugin with a runtime caching strategy.`;\n },\n 'unit-must-be-bytes': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'unit-must-be-bytes' error.`);\n }\n return `The 'unit' portion of the Range header must be set to 'bytes'. ` + `The Range header provided was \"${normalizedRangeHeader}\"`;\n },\n 'single-range-only': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'single-range-only' error.`);\n }\n return `Multiple ranges are not supported. Please use a single start ` + `value, and optional end value. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'invalid-range-values': ({ normalizedRangeHeader }) => {\n if (!normalizedRangeHeader) {\n throw new Error(`Unexpected input to 'invalid-range-values' error.`);\n }\n return `The Range header is missing both start and end values. At least ` + `one of those values is needed. The Range header provided was ` + `\"${normalizedRangeHeader}\"`;\n },\n 'no-range-header': () => {\n return `No Range header was found in the Request provided.`;\n },\n 'range-not-satisfiable': ({ size, start, end }) => {\n return `The start (${start}) and end (${end}) values in the Range are ` + `not satisfiable by the cached response, which is ${size} bytes.`;\n },\n 'attempt-to-cache-non-get-request': ({ url, method }) => {\n return `Unable to cache '${url}' because it is a '${method}' request and ` + `only 'GET' requests can be cached.`;\n },\n 'cache-put-with-no-response': ({ url }) => {\n return `There was an attempt to cache '${url}' but the response was not ` + `defined.`;\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const generatorFunction = (code, ...args) => {\n const message = messages[code];\n if (!message) {\n throw new Error(`Unable to find message for code '${code}'.`);\n }\n\n return message(...args);\n };\n\n const exportedValue = generatorFunction;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Workbox errors should be thrown with this class.\n * This allows use to ensure the type easily in tests,\n * helps developers identify errors from workbox\n * easily and allows use to optimise error\n * messages correctly.\n *\n * @private\n */\n class WorkboxError extends Error {\n /**\n *\n * @param {string} errorCode The error code that\n * identifies this particular error.\n * @param {Object=} details Any relevant arguments\n * that will help developers identify issues should\n * be added as a key on the context object.\n */\n constructor(errorCode, details) {\n let message = exportedValue(errorCode, details);\n\n super(message);\n\n this.name = errorCode;\n this.details = details;\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n * This method returns true if the current context is a service worker.\n */\n const isSwEnv = moduleName => {\n if (!('ServiceWorkerGlobalScope' in self)) {\n throw new WorkboxError('not-in-sw', { moduleName });\n }\n };\n\n /*\n * This method throws if the supplied value is not an array.\n * The destructed values are required to produce a meaningful error for users.\n * The destructed and restructured object is so it's clear what is\n * needed.\n */\n const isArray = (value, { moduleName, className, funcName, paramName }) => {\n if (!Array.isArray(value)) {\n throw new WorkboxError('not-an-array', {\n moduleName,\n className,\n funcName,\n paramName\n });\n }\n };\n\n const hasMethod = (object, expectedMethod, { moduleName, className, funcName, paramName }) => {\n const type = typeof object[expectedMethod];\n if (type !== 'function') {\n throw new WorkboxError('missing-a-method', { paramName, expectedMethod,\n moduleName, className, funcName });\n }\n };\n\n const isType = (object, expectedType, { moduleName, className, funcName, paramName }) => {\n if (typeof object !== expectedType) {\n throw new WorkboxError('incorrect-type', { paramName, expectedType,\n moduleName, className, funcName });\n }\n };\n\n const isInstance = (object, expectedClass, { moduleName, className, funcName,\n paramName, isReturnValueProblem }) => {\n if (!(object instanceof expectedClass)) {\n throw new WorkboxError('incorrect-class', { paramName, expectedClass,\n moduleName, className, funcName, isReturnValueProblem });\n }\n };\n\n const isOneOf = (value, validValues, { paramName }) => {\n if (!validValues.includes(value)) {\n throw new WorkboxError('invalid-value', {\n paramName,\n value,\n validValueDescription: `Valid values are ${JSON.stringify(validValues)}.`\n });\n }\n };\n\n const isArrayOfClass = (value, expectedClass, { moduleName, className, funcName, paramName }) => {\n const error = new WorkboxError('not-array-of-class', {\n value, expectedClass,\n moduleName, className, funcName, paramName\n });\n if (!Array.isArray(value)) {\n throw error;\n }\n\n for (let item of value) {\n if (!(item instanceof expectedClass)) {\n throw error;\n }\n }\n };\n\n const finalAssertExports = {\n hasMethod,\n isArray,\n isInstance,\n isOneOf,\n isSwEnv,\n isType,\n isArrayOfClass\n };\n\n /**\n * Runs all of the callback functions, one at a time sequentially, in the order\n * in which they were registered.\n *\n * @memberof workbox.core\n * @private\n */\n let executeQuotaErrorCallbacks = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* () {\n {\n defaultExport.log(`About to run ${callbacks.size} callbacks to clean up caches.`);\n }\n\n for (const callback of callbacks) {\n yield callback();\n {\n defaultExport.log(callback, 'is complete.');\n }\n }\n\n {\n defaultExport.log('Finished running callbacks.');\n }\n });\n\n return function executeQuotaErrorCallbacks() {\n return _ref.apply(this, arguments);\n };\n })();\n\n const callbacks = new Set();\n\n /**\n * Adds a function to the set of callbacks that will be executed when there's\n * a quota error.\n *\n * @param {Function} callback\n * @memberof workbox.core\n */\n function registerQuotaErrorCallback(callback) {\n {\n finalAssertExports.isType(callback, 'function', {\n moduleName: 'workbox-core',\n funcName: 'register',\n paramName: 'callback'\n });\n }\n\n callbacks.add(callback);\n\n {\n defaultExport.log('Registered a callback to respond to quota errors.', callback);\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * A class that wraps common IndexedDB functionality in a promise-based API.\n * It exposes all the underlying power and functionality of IndexedDB, but\n * wraps the most commonly used features in a way that's much simpler to use.\n *\n * @private\n */\n class DBWrapper {\n /**\n * @param {string} name\n * @param {number} version\n * @param {Object=} [callback]\n * @param {function(this:DBWrapper, Event)} [callbacks.onupgradeneeded]\n * @param {function(this:DBWrapper, Event)} [callbacks.onversionchange]\n * Defaults to DBWrapper.prototype._onversionchange when not specified.\n */\n constructor(name, version, {\n onupgradeneeded,\n onversionchange = this._onversionchange\n } = {}) {\n this._name = name;\n this._version = version;\n this._onupgradeneeded = onupgradeneeded;\n this._onversionchange = onversionchange;\n\n // If this is null, it means the database isn't open.\n this._db = null;\n }\n\n /**\n * Opens a connected to an IDBDatabase, invokes any onupgradedneeded\n * callback, and added an onversionchange callback to the database.\n *\n * @return {IDBDatabase}\n *\n * @private\n */\n open() {\n var _this = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if (_this._db) return;\n\n _this._db = yield new Promise(function (resolve, reject) {\n // This flag is flipped to true if the timeout callback runs prior\n // to the request failing or succeeding. Note: we use a timeout instead\n // of an onblocked handler since there are cases where onblocked will\n // never never run. A timeout better handles all possible scenarios:\n // https://github.com/w3c/IndexedDB/issues/223\n let openRequestTimedOut = false;\n setTimeout(function () {\n openRequestTimedOut = true;\n reject(new Error('The open request was blocked and timed out'));\n }, _this.OPEN_TIMEOUT);\n\n const openRequest = indexedDB.open(_this._name, _this._version);\n openRequest.onerror = function (evt) {\n return reject(openRequest.error);\n };\n openRequest.onupgradeneeded = function (evt) {\n if (openRequestTimedOut) {\n openRequest.transaction.abort();\n evt.target.result.close();\n } else if (_this._onupgradeneeded) {\n _this._onupgradeneeded(evt);\n }\n };\n openRequest.onsuccess = function (evt) {\n const db = evt.target.result;\n if (openRequestTimedOut) {\n db.close();\n } else {\n db.onversionchange = _this._onversionchange;\n resolve(db);\n }\n };\n });\n\n return _this;\n })();\n }\n\n /**\n * Delegates to the native `get()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n get(storeName, ...args) {\n var _this2 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this2._call('get', storeName, 'readonly', ...args);\n })();\n }\n\n /**\n * Delegates to the native `add()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n add(storeName, ...args) {\n var _this3 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this3._call('add', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `put()` method for the object store.\n *\n * @param {string} storeName The name of the object store to put the value.\n * @param {...*} args The values passed to the delegated method.\n * @return {*} The key of the entry.\n *\n * @private\n */\n put(storeName, ...args) {\n var _this4 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this4._call('put', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Delegates to the native `delete()` method for the object store.\n *\n * @param {string} storeName\n * @param {...*} args The values passed to the delegated method.\n *\n * @private\n */\n delete(storeName, ...args) {\n var _this5 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this5._call('delete', storeName, 'readwrite', ...args);\n })();\n }\n\n /**\n * Deletes the underlying database, ensuring that any open connections are\n * closed first.\n *\n * @private\n */\n deleteDatabase() {\n var _this6 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n _this6.close();\n _this6._db = null;\n yield new Promise(function (resolve, reject) {\n const request = indexedDB.deleteDatabase(_this6._name);\n request.onerror = function (evt) {\n return reject(evt.target.error);\n };\n request.onblocked = function () {\n return reject(new Error('Deletion was blocked.'));\n };\n request.onsuccess = function () {\n return resolve();\n };\n });\n })();\n }\n\n /**\n * Delegates to the native `getAll()` or polyfills it via the `find()`\n * method in older browsers.\n *\n * @param {string} storeName\n * @param {*} query\n * @param {number} count\n * @return {Array}\n *\n * @private\n */\n getAll(storeName, query, count) {\n var _this7 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n if ('getAll' in IDBObjectStore.prototype) {\n return yield _this7._call('getAll', storeName, 'readonly', query, count);\n } else {\n return yield _this7.getAllMatching(storeName, { query, count });\n }\n })();\n }\n\n /**\n * Supports flexible lookup in an object store by specifying an index,\n * query, direction, and count. This method returns an array of objects\n * with the signature .\n *\n * @param {string} storeName\n * @param {Object} [opts]\n * @param {IDBCursorDirection} [opts.direction]\n * @param {*} [opts.query]\n * @param {string} [opts.index] The index to use (if specified).\n * @param {number} [opts.count] The max number of results to return.\n * @param {boolean} [opts.includeKeys] When true, the structure of the\n * returned objects is changed from an array of values to an array of\n * objects in the form {key, primaryKey, value}.\n * @return {Array}\n *\n * @private\n */\n getAllMatching(storeName, opts = {}) {\n var _this8 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n return yield _this8.transaction([storeName], 'readonly', function (stores, done) {\n const store = stores[storeName];\n const target = opts.index ? store.index(opts.index) : store;\n const results = [];\n\n // Passing `undefined` arguments to Edge's `openCursor(...)` causes\n // 'DOMException: DataError'\n // Details in issue: https://github.com/GoogleChrome/workbox/issues/1509\n const query = opts.query || null;\n const direction = opts.direction || 'next';\n target.openCursor(query, direction).onsuccess = function (evt) {\n const cursor = evt.target.result;\n if (cursor) {\n const { primaryKey, key, value } = cursor;\n results.push(opts.includeKeys ? { primaryKey, key, value } : value);\n if (opts.count && results.length >= opts.count) {\n done(results);\n } else {\n cursor.continue();\n }\n } else {\n done(results);\n }\n };\n });\n })();\n }\n\n /**\n * Accepts a list of stores, a transaction type, and a callback and\n * performs a transaction. A promise is returned that resolves to whatever\n * value the callback chooses. The callback holds all the transaction logic\n * and is invoked with three arguments:\n * 1. An object mapping object store names to IDBObjectStore values.\n * 2. A `done` function, that's used to resolve the promise when\n * when the transaction is done.\n * 3. An `abort` function that can be called to abort the transaction\n * at any time.\n *\n * @param {Array<string>} storeNames An array of object store names\n * involved in the transaction.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {function(Object, function(), function(*)):?IDBRequest} callback\n * @return {*} The result of the transaction ran by the callback.\n *\n * @private\n */\n transaction(storeNames, type, callback) {\n var _this9 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this9.open();\n const result = yield new Promise(function (resolve, reject) {\n const txn = _this9._db.transaction(storeNames, type);\n const done = function (value) {\n return resolve(value);\n };\n const abort = function () {\n reject(new Error('The transaction was manually aborted'));\n txn.abort();\n };\n txn.onerror = function (evt) {\n return reject(evt.target.error);\n };\n txn.onabort = function (evt) {\n return reject(evt.target.error);\n };\n txn.oncomplete = function () {\n return resolve();\n };\n\n const stores = {};\n for (const storeName of storeNames) {\n stores[storeName] = txn.objectStore(storeName);\n }\n callback(stores, done, abort);\n });\n return result;\n })();\n }\n\n /**\n * Delegates async to a native IDBObjectStore method.\n *\n * @param {string} method The method name.\n * @param {string} storeName The object store name.\n * @param {string} type Can be `readonly` or `readwrite`.\n * @param {...*} args The list of args to pass to the native method.\n * @return {*} The result of the transaction.\n *\n * @private\n */\n _call(method, storeName, type, ...args) {\n var _this10 = this;\n\n return babelHelpers.asyncToGenerator(function* () {\n yield _this10.open();\n const callback = function (stores, done) {\n stores[storeName][method](...args).onsuccess = function (evt) {\n done(evt.target.result);\n };\n };\n\n return yield _this10.transaction([storeName], type, callback);\n })();\n }\n\n /**\n * The default onversionchange handler, which closes the database so other\n * connections can open without being blocked.\n *\n * @param {Event} evt\n *\n * @private\n */\n _onversionchange(evt) {\n this.close();\n }\n\n /**\n * Closes the connection opened by `DBWrapper.open()`. Generally this method\n * doesn't need to be called since:\n * 1. It's usually better to keep a connection open since opening\n * a new connection is somewhat slow.\n * 2. Connections are automatically closed when the reference is\n * garbage collected.\n * The primary use case for needing to close a connection is when another\n * reference (typically in another tab) needs to upgrade it and would be\n * blocked by the current, open connection.\n *\n * @private\n */\n close() {\n if (this._db) this._db.close();\n }\n }\n\n // Exposed to let users modify the default timeout on a per-instance\n // or global basis.\n DBWrapper.prototype.OPEN_TIMEOUT = 2000;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const _cacheNameDetails = {\n prefix: 'workbox',\n suffix: self.registration.scope,\n googleAnalytics: 'googleAnalytics',\n precache: 'precache',\n runtime: 'runtime'\n };\n\n const _createCacheName = cacheName => {\n return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix].filter(value => value.length > 0).join('-');\n };\n\n const cacheNames = {\n updateDetails: details => {\n Object.keys(_cacheNameDetails).forEach(key => {\n if (typeof details[key] !== 'undefined') {\n _cacheNameDetails[key] = details[key];\n }\n });\n },\n getGoogleAnalyticsName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.googleAnalytics);\n },\n getPrecacheName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.precache);\n },\n getRuntimeName: userCacheName => {\n return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginEvents = {\n CACHE_DID_UPDATE: 'cacheDidUpdate',\n CACHE_WILL_UPDATE: 'cacheWillUpdate',\n CACHED_RESPONSE_WILL_BE_USED: 'cachedResponseWillBeUsed',\n FETCH_DID_FAIL: 'fetchDidFail',\n REQUEST_WILL_FETCH: 'requestWillFetch'\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var pluginUtils = {\n filter: (plugins, callbackname) => {\n return plugins.filter(plugin => callbackname in plugin);\n }\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const getFriendlyURL = url => {\n const urlObj = new URL(url, location);\n if (urlObj.origin === location.origin) {\n return urlObj.pathname;\n }\n return urlObj.href;\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around cache.put().\n *\n * Will call `cacheDidUpdate` on plugins if the cache was updated.\n *\n * @param {Object} options\n * @param {string} options.cacheName\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n *\n * @private\n * @memberof module:workbox-core\n */\n const putWrapper = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n response,\n event,\n plugins = []\n } = {}) {\n if (!response) {\n {\n defaultExport.error(`Cannot cache non-existent response for ` + `'${getFriendlyURL(request.url)}'.`);\n }\n\n throw new WorkboxError('cache-put-with-no-response', {\n url: getFriendlyURL(request.url)\n });\n }\n\n let responseToCache = yield _isResponseSafeToCache({ request, response, event, plugins });\n\n if (!responseToCache) {\n {\n defaultExport.debug(`Response '${getFriendlyURL(request.url)}' will not be ` + `cached.`, responseToCache);\n }\n return;\n }\n\n {\n if (responseToCache.method && responseToCache.method !== 'GET') {\n throw new WorkboxError('attempt-to-cache-non-get-request', {\n url: getFriendlyURL(request.url),\n method: responseToCache.method\n });\n }\n }\n\n const cache = yield caches.open(cacheName);\n\n const updatePlugins = pluginUtils.filter(plugins, pluginEvents.CACHE_DID_UPDATE);\n\n let oldResponse = updatePlugins.length > 0 ? yield matchWrapper({ cacheName, request }) : null;\n\n {\n defaultExport.debug(`Updating the '${cacheName}' cache with a new Response for ` + `${getFriendlyURL(request.url)}.`);\n }\n\n try {\n yield cache.put(request, responseToCache);\n } catch (error) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n if (error.name === 'QuotaExceededError') {\n yield executeQuotaErrorCallbacks();\n }\n throw error;\n }\n\n for (let plugin of updatePlugins) {\n yield plugin[pluginEvents.CACHE_DID_UPDATE].call(plugin, {\n cacheName,\n request,\n event,\n oldResponse,\n newResponse: responseToCache\n });\n }\n });\n\n return function putWrapper() {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * This is a wrapper around cache.match().\n *\n * @param {Object} options\n * @param {string} options.cacheName Name of the cache to match against.\n * @param {Request} options.request The Request that will be used to look up\n *. cache entries.\n * @param {Event} [options.event] The event that propted the action.\n * @param {Object} [options.matchOptions] Options passed to cache.match().\n * @param {Array<Object>} [options.plugins=[]] Array of plugins.\n * @return {Response} A cached response if available.\n *\n * @private\n * @memberof module:workbox-core\n */\n const matchWrapper = (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* ({\n cacheName,\n request,\n event,\n matchOptions,\n plugins = [] }) {\n const cache = yield caches.open(cacheName);\n let cachedResponse = yield cache.match(request, matchOptions);\n {\n if (cachedResponse) {\n defaultExport.debug(`Found a cached response in '${cacheName}'.`);\n } else {\n defaultExport.debug(`No cached response found in '${cacheName}'.`);\n }\n }\n for (let plugin of plugins) {\n if (pluginEvents.CACHED_RESPONSE_WILL_BE_USED in plugin) {\n cachedResponse = yield plugin[pluginEvents.CACHED_RESPONSE_WILL_BE_USED].call(plugin, {\n cacheName,\n request,\n event,\n matchOptions,\n cachedResponse\n });\n {\n if (cachedResponse) {\n finalAssertExports.isInstance(cachedResponse, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n return cachedResponse;\n });\n\n return function matchWrapper(_x) {\n return _ref2.apply(this, arguments);\n };\n })();\n\n /**\n * This method will call cacheWillUpdate on the available plugins (or use\n * response.ok) to determine if the Response is safe and valid to cache.\n *\n * @param {Object} options\n * @param {Request} options.request\n * @param {Response} options.response\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const _isResponseSafeToCache = (() => {\n var _ref3 = babelHelpers.asyncToGenerator(function* ({ request, response, event, plugins }) {\n let responseToCache = response;\n let pluginsUsed = false;\n for (let plugin of plugins) {\n if (pluginEvents.CACHE_WILL_UPDATE in plugin) {\n pluginsUsed = true;\n responseToCache = yield plugin[pluginEvents.CACHE_WILL_UPDATE].call(plugin, {\n request,\n response: responseToCache,\n event\n });\n\n {\n if (responseToCache) {\n finalAssertExports.isInstance(responseToCache, Response, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHE_WILL_UPDATE,\n isReturnValueProblem: true\n });\n }\n }\n\n if (!responseToCache) {\n break;\n }\n }\n }\n\n if (!pluginsUsed) {\n {\n if (!responseToCache.ok) {\n if (responseToCache.status === 0) {\n defaultExport.warn(`The response for '${request.url}' is an opaque ` + `response. The caching strategy that you're using will not ` + `cache opaque responses by default.`);\n } else {\n defaultExport.debug(`The response for '${request.url}' returned ` + `a status code of '${response.status}' and won't be cached as a ` + `result.`);\n }\n }\n }\n responseToCache = responseToCache.ok ? responseToCache : null;\n }\n\n return responseToCache ? responseToCache : null;\n });\n\n return function _isResponseSafeToCache(_x2) {\n return _ref3.apply(this, arguments);\n };\n })();\n\n const cacheWrapper = {\n put: putWrapper,\n match: matchWrapper\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Wrapper around the fetch API.\n *\n * Will call requestWillFetch on available plugins.\n *\n * @param {Object} options\n * @param {Request|string} options.request\n * @param {Object} [options.fetchOptions]\n * @param {Event} [options.event]\n * @param {Array<Object>} [options.plugins=[]]\n * @return {Promise<Response>}\n *\n * @private\n * @memberof module:workbox-core\n */\n const wrappedFetch = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* ({\n request,\n fetchOptions,\n event,\n plugins = [] }) {\n // We *should* be able to call `await event.preloadResponse` even if it's\n // undefined, but for some reason, doing so leads to errors in our Node unit\n // tests. To work around that, explicitly check preloadResponse's value first.\n if (event && event.preloadResponse) {\n const possiblePreloadResponse = yield event.preloadResponse;\n if (possiblePreloadResponse) {\n {\n defaultExport.log(`Using a preloaded navigation response for ` + `'${getFriendlyURL(request.url)}'`);\n }\n return possiblePreloadResponse;\n }\n }\n\n if (typeof request === 'string') {\n request = new Request(request);\n }\n\n {\n finalAssertExports.isInstance(request, Request, {\n paramName: request,\n expectedClass: 'Request',\n moduleName: 'workbox-core',\n className: 'fetchWrapper',\n funcName: 'wrappedFetch'\n });\n }\n\n const failedFetchPlugins = pluginUtils.filter(plugins, pluginEvents.FETCH_DID_FAIL);\n\n // If there is a fetchDidFail plugin, we need to save a clone of the\n // original request before it's either modified by a requestWillFetch\n // plugin or before the original request's body is consumed via fetch().\n const originalRequest = failedFetchPlugins.length > 0 ? request.clone() : null;\n\n try {\n for (let plugin of plugins) {\n if (pluginEvents.REQUEST_WILL_FETCH in plugin) {\n request = yield plugin[pluginEvents.REQUEST_WILL_FETCH].call(plugin, {\n request: request.clone(),\n event\n });\n\n {\n if (request) {\n finalAssertExports.isInstance(request, Request, {\n moduleName: 'Plugin',\n funcName: pluginEvents.CACHED_RESPONSE_WILL_BE_USED,\n isReturnValueProblem: true\n });\n }\n }\n }\n }\n } catch (err) {\n throw new WorkboxError('plugin-error-request-will-fetch', {\n thrownError: err\n });\n }\n\n // The request can be altered by plugins with `requestWillFetch` making\n // the original request (Most likely from a `fetch` event) to be different\n // to the Request we make. Pass both to `fetchDidFail` to aid debugging.\n const pluginFilteredRequest = request.clone();\n\n try {\n const fetchResponse = yield fetch(request, fetchOptions);\n {\n defaultExport.debug(`Network request for ` + `'${getFriendlyURL(request.url)}' returned a response with ` + `status '${fetchResponse.status}'.`);\n }\n return fetchResponse;\n } catch (error) {\n {\n defaultExport.error(`Network request for ` + `'${getFriendlyURL(request.url)}' threw an error.`, error);\n }\n\n for (let plugin of failedFetchPlugins) {\n yield plugin[pluginEvents.FETCH_DID_FAIL].call(plugin, {\n error,\n event,\n originalRequest: originalRequest.clone(),\n request: pluginFilteredRequest.clone()\n });\n }\n\n throw error;\n }\n });\n\n return function wrappedFetch(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n const fetchWrapper = {\n fetch: wrappedFetch\n };\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n var _private = /*#__PURE__*/Object.freeze({\n DBWrapper: DBWrapper,\n WorkboxError: WorkboxError,\n assert: finalAssertExports,\n cacheNames: cacheNames,\n cacheWrapper: cacheWrapper,\n fetchWrapper: fetchWrapper,\n getFriendlyURL: getFriendlyURL,\n logger: defaultExport\n });\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Logs a warning to the user recommending changing\n * to max-age=0 or no-cache.\n *\n * @param {string} cacheControlHeader\n *\n * @private\n */\n function showWarning(cacheControlHeader) {\n const docsUrl = 'https://developers.google.com/web/tools/workbox/guides/service-worker-checklist#cache-control_of_your_service_worker_file';\n defaultExport.warn(`You are setting a 'cache-control' header of ` + `'${cacheControlHeader}' on your service worker file. This should be ` + `set to 'max-age=0' or 'no-cache' to ensure the latest service worker ` + `is served to your users. Learn more here: ${docsUrl}`);\n }\n\n /**\n * Checks for cache-control header on SW file and\n * warns the developer if it exists with a value\n * other than max-age=0 or no-cache.\n *\n * @return {Promise}\n * @private\n */\n function checkSWFileCacheHeaders() {\n // This is wrapped as an iife to allow async/await while making\n // rollup exclude it in builds.\n return babelHelpers.asyncToGenerator(function* () {\n try {\n const swFile = self.location.href;\n const response = yield fetch(swFile);\n if (!response.ok) {\n // Response failed so nothing we can check;\n return;\n }\n\n if (!response.headers.has('cache-control')) {\n // No cache control header.\n return;\n }\n\n const cacheControlHeader = response.headers.get('cache-control');\n const maxAgeResult = /max-age\\s*=\\s*(\\d*)/g.exec(cacheControlHeader);\n if (maxAgeResult) {\n if (parseInt(maxAgeResult[1], 10) === 0) {\n return;\n }\n }\n\n if (cacheControlHeader.indexOf('no-cache') !== -1) {\n return;\n }\n\n if (cacheControlHeader.indexOf('no-store') !== -1) {\n return;\n }\n\n showWarning(cacheControlHeader);\n } catch (err) {\n // NOOP\n }\n })();\n }\n\n const finalCheckSWFileCacheHeaders = checkSWFileCacheHeaders;\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * This class is never exposed publicly. Inidividual methods are exposed\n * using jsdoc alias commands.\n *\n * @memberof workbox.core\n * @private\n */\n class WorkboxCore {\n /**\n * You should not instantiate this object directly.\n *\n * @private\n */\n constructor() {\n // Give our version strings something to hang off of.\n try {\n self.workbox.v = self.workbox.v || {};\n } catch (err) {}\n // NOOP\n\n\n // A WorkboxCore instance must be exported before we can use the logger.\n // This is so it can get the current log level.\n {\n const padding = ' ';\n defaultExport.groupCollapsed('Welcome to Workbox!');\n defaultExport.unprefixed.log(`You are currently using a development build. ` + `By default this will switch to prod builds when not on localhost. ` + `You can force this with workbox.setConfig({debug: true|false}).`);\n defaultExport.unprefixed.log(`📖 Read the guides and documentation\\n` + `${padding}https://developers.google.com/web/tools/workbox/`);\n defaultExport.unprefixed.log(`❓ Use the [workbox] tag on Stack Overflow to ask questions\\n` + `${padding}https://stackoverflow.com/questions/ask?tags=workbox`);\n defaultExport.unprefixed.log(`🐛 Found a bug? Report it on GitHub\\n` + `${padding}https://github.com/GoogleChrome/workbox/issues/new`);\n defaultExport.groupEnd();\n\n if (typeof finalCheckSWFileCacheHeaders === 'function') {\n finalCheckSWFileCacheHeaders();\n }\n }\n }\n\n /**\n * Get the current cache names used by Workbox.\n *\n * `cacheNames.precache` is used for precached assets,\n * `cacheNames.googleAnalytics` is used by `workbox-google-analytics` to\n * store `analytics.js`,\n * and `cacheNames.runtime` is used for everything else.\n *\n * @return {Object} An object with `precache` and `runtime` cache names.\n *\n * @alias workbox.core.cacheNames\n */\n get cacheNames() {\n return {\n googleAnalytics: cacheNames.getGoogleAnalyticsName(),\n precache: cacheNames.getPrecacheName(),\n runtime: cacheNames.getRuntimeName()\n };\n }\n\n /**\n * You can alter the default cache names used by the Workbox modules by\n * changing the cache name details.\n *\n * Cache names are generated as `<prefix>-<Cache Name>-<suffix>`.\n *\n * @param {Object} details\n * @param {Object} details.prefix The string to add to the beginning of\n * the precache and runtime cache names.\n * @param {Object} details.suffix The string to add to the end of\n * the precache and runtime cache names.\n * @param {Object} details.precache The cache name to use for precache\n * caching.\n * @param {Object} details.runtime The cache name to use for runtime caching.\n * @param {Object} details.googleAnalytics The cache name to use for\n * `workbox-google-analytics` caching.\n *\n * @alias workbox.core.setCacheNameDetails\n */\n setCacheNameDetails(details) {\n {\n Object.keys(details).forEach(key => {\n finalAssertExports.isType(details[key], 'string', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'setCacheNameDetails',\n paramName: `details.${key}`\n });\n });\n\n if ('precache' in details && details.precache.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'precache',\n value: details.precache\n });\n }\n\n if ('runtime' in details && details.runtime.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'runtime',\n value: details.runtime\n });\n }\n\n if ('googleAnalytics' in details && details.googleAnalytics.length === 0) {\n throw new WorkboxError('invalid-cache-name', {\n cacheNameId: 'googleAnalytics',\n value: details.googleAnalytics\n });\n }\n }\n\n cacheNames.updateDetails(details);\n }\n\n /**\n * Get the current log level.\n *\n * @return {number}.\n *\n * @alias workbox.core.logLevel\n */\n get logLevel() {\n return getLoggerLevel();\n }\n\n /**\n * Set the current log level passing in one of the values from\n * [LOG_LEVELS]{@link module:workbox-core.LOG_LEVELS}.\n *\n * @param {number} newLevel The new log level to use.\n *\n * @alias workbox.core.setLogLevel\n */\n setLogLevel(newLevel) {\n {\n finalAssertExports.isType(newLevel, 'number', {\n moduleName: 'workbox-core',\n className: 'WorkboxCore',\n funcName: 'logLevel [setter]',\n paramName: `logLevel`\n });\n }\n\n if (newLevel > LOG_LEVELS.silent || newLevel < LOG_LEVELS.debug) {\n throw new WorkboxError('invalid-value', {\n paramName: 'logLevel',\n validValueDescription: `Please use a value from LOG_LEVELS, i.e ` + `'logLevel = workbox.core.LOG_LEVELS.debug'.`,\n value: newLevel\n });\n }\n\n setLoggerLevel(newLevel);\n }\n }\n\n var defaultExport$1 = new WorkboxCore();\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const finalExports = Object.assign(defaultExport$1, {\n _private,\n LOG_LEVELS,\n registerQuotaErrorCallback\n });\n\n return finalExports;\n\n}());\n"],"file":"workbox-core.dev.js"}
@@ -1,3 +0,0 @@
1
- self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n("next",e)},function(e){n("throw",e)});e(l)}("next")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){"use strict";try{self.workbox.v["workbox:core:3.6.3"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf("group")?c:e[r];if(!n(l))return;if(!i||"groupCollapsed"===r&&t)return void console[r](...o);const s=["%cworkbox",`background: ${i}; color: white; padding: 2px 0.5em; `+"border-radius: 0.5em;"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:"#7f8c8d",log:"#2ecc71",warn:"#f39c12",error:"#c0392b",groupCollapsed:"#3498db"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error("The open request was blocked and timed out"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("get",e,"readonly",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("add",e,"readwrite",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i("put",e,"readwrite",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i("delete",e,"readwrite",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error("Deletion was blocked."))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return"getAll"in IDBObjectStore.prototype?yield n.i("getAll",e,"readonly",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],"readonly",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||"next";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error("The transaction was manually aborted")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:"workbox",suffix:self.registration.scope,googleAnalytics:"googleAnalytics",precache:"precache",runtime:"runtime"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join("-"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E="cacheDidUpdate",L="cacheWillUpdate",x="cachedResponseWillBeUsed",H="fetchDidFail",N="requestWillFetch",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p("cache-put-with-no-response",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw"QuotaExceededError"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}"string"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p("plugin-error-request-will-fetch",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p("invalid-value",{paramName:"logLevel",validValueDescription:"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();
2
-
3
- //# sourceMappingURL=workbox-core.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-core/browser.mjs"],"sourcesContent":["self.babelHelpers={asyncToGenerator:function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var c=t[o](i),l=c.value}catch(e){return void r(e)}if(!c.done)return Promise.resolve(l).then(function(e){n(\"next\",e)},function(e){n(\"throw\",e)});e(l)}(\"next\")})}}},this.workbox=this.workbox||{},this.workbox.core=function(){\"use strict\";try{self.workbox.v[\"workbox:core:3.6.3\"]=1}catch(e){}var e={debug:0,log:1,warn:2,error:3,silent:4};const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);let r=(()=>e.warn)();const n=e=>r<=e,o=e=>r=e,i=()=>r,c=e.error,l=function(r,o,i){const l=0===r.indexOf(\"group\")?c:e[r];if(!n(l))return;if(!i||\"groupCollapsed\"===r&&t)return void console[r](...o);const s=[\"%cworkbox\",`background: ${i}; color: white; padding: 2px 0.5em; `+\"border-radius: 0.5em;\"];console[r](...s,...o)},s=()=>{n(c)&&console.groupEnd()},u={groupEnd:s,unprefixed:{groupEnd:s}},a={debug:\"#7f8c8d\",log:\"#2ecc71\",warn:\"#f39c12\",error:\"#c0392b\",groupCollapsed:\"#3498db\"};var f,d;Object.keys(a).forEach(e=>(e=e,d=a[e],u[e]=((...t)=>l(e,t,d)),void(u.unprefixed[e]=((...t)=>l(e,t)))));const h=(e,...t)=>{let r=e;return t.length>0&&(r+=` :: ${JSON.stringify(t)}`),r};class p extends Error{constructor(e,t){super(h(e,t)),this.name=e,this.details=t}}let b=(y=babelHelpers.asyncToGenerator(function*(){for(const e of g)yield e()}),function(){return y.apply(this,arguments)});var y;const g=new Set;class v{constructor(e,t,{onupgradeneeded:r,onversionchange:n=this.e}={}){this.t=e,this.r=t,this.n=r,this.e=n,this.o=null}open(){var e=this;return babelHelpers.asyncToGenerator(function*(){if(!e.o)return e.o=yield new Promise(function(t,r){let n=!1;setTimeout(function(){n=!0,r(new Error(\"The open request was blocked and timed out\"))},e.OPEN_TIMEOUT);const o=indexedDB.open(e.t,e.r);o.onerror=function(e){return r(o.error)},o.onupgradeneeded=function(t){n?(o.transaction.abort(),t.target.result.close()):e.n&&e.n(t)},o.onsuccess=function(r){const o=r.target.result;n?o.close():(o.onversionchange=e.e,t(o))}}),e})()}get(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"get\",e,\"readonly\",...t)})()}add(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"add\",e,\"readwrite\",...t)})()}put(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.i(\"put\",e,\"readwrite\",...t)})()}delete(e,...t){var r=this;return babelHelpers.asyncToGenerator(function*(){yield r.i(\"delete\",e,\"readwrite\",...t)})()}deleteDatabase(){var e=this;return babelHelpers.asyncToGenerator(function*(){e.close(),e.o=null,yield new Promise(function(t,r){const n=indexedDB.deleteDatabase(e.t);n.onerror=function(e){return r(e.target.error)},n.onblocked=function(){return r(new Error(\"Deletion was blocked.\"))},n.onsuccess=function(){return t()}})})()}getAll(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return\"getAll\"in IDBObjectStore.prototype?yield n.i(\"getAll\",e,\"readonly\",t,r):yield n.getAllMatching(e,{query:t,count:r})})()}getAllMatching(e,t={}){var r=this;return babelHelpers.asyncToGenerator(function*(){return yield r.transaction([e],\"readonly\",function(r,n){const o=r[e],i=t.index?o.index(t.index):o,c=[],l=t.query||null,s=t.direction||\"next\";i.openCursor(l,s).onsuccess=function(e){const r=e.target.result;if(r){const{primaryKey:e,key:o,value:i}=r;c.push(t.includeKeys?{primaryKey:e,key:o,value:i}:i),t.count&&c.length>=t.count?n(c):r.continue()}else n(c)}})})()}transaction(e,t,r){var n=this;return babelHelpers.asyncToGenerator(function*(){return yield n.open(),yield new Promise(function(o,i){const c=n.o.transaction(e,t);c.onerror=function(e){return i(e.target.error)},c.onabort=function(e){return i(e.target.error)},c.oncomplete=function(){return o()};const l={};for(const t of e)l[t]=c.objectStore(t);r(l,function(e){return o(e)},function(){i(new Error(\"The transaction was manually aborted\")),c.abort()})})})()}i(e,t,r,...n){var o=this;return babelHelpers.asyncToGenerator(function*(){yield o.open();return yield o.transaction([t],r,function(r,o){r[t][e](...n).onsuccess=function(e){o(e.target.result)}})})()}e(e){this.close()}close(){this.o&&this.o.close()}}v.prototype.OPEN_TIMEOUT=2e3;const w={prefix:\"workbox\",suffix:self.registration.scope,googleAnalytics:\"googleAnalytics\",precache:\"precache\",runtime:\"runtime\"},m=e=>[w.prefix,e,w.suffix].filter(e=>e.length>0).join(\"-\"),q={updateDetails:e=>{Object.keys(w).forEach(t=>{void 0!==e[t]&&(w[t]=e[t])})},getGoogleAnalyticsName:e=>e||m(w.googleAnalytics),getPrecacheName:e=>e||m(w.precache),getRuntimeName:e=>e||m(w.runtime)};var E=\"cacheDidUpdate\",L=\"cacheWillUpdate\",x=\"cachedResponseWillBeUsed\",H=\"fetchDidFail\",N=\"requestWillFetch\",O=(e,t)=>e.filter(e=>t in e);const k=e=>{const t=new URL(e,location);return t.origin===location.origin?t.pathname:t.href},D=(()=>{var e=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,response:r,event:n,plugins:o=[]}={}){if(!r)throw new p(\"cache-put-with-no-response\",{url:k(t.url)});let i=yield P({request:t,response:r,event:n,plugins:o});if(!i)return;const c=yield caches.open(e),l=O(o,E);let s=l.length>0?yield R({cacheName:e,request:t}):null;try{yield c.put(t,i)}catch(e){throw\"QuotaExceededError\"===e.name&&(yield b()),e}for(let r of l)yield r[E].call(r,{cacheName:e,request:t,event:n,oldResponse:s,newResponse:i})});return function(){return e.apply(this,arguments)}})(),R=(A=babelHelpers.asyncToGenerator(function*({cacheName:e,request:t,event:r,matchOptions:n,plugins:o=[]}){let i=yield(yield caches.open(e)).match(t,n);for(let c of o)x in c&&(i=yield c[x].call(c,{cacheName:e,request:t,event:r,matchOptions:n,cachedResponse:i}));return i}),function(e){return A.apply(this,arguments)});var A;const P=(W=babelHelpers.asyncToGenerator(function*({request:e,response:t,event:r,plugins:n}){let o=t,i=!1;for(let t of n)if(L in t&&(i=!0,!(o=yield t[L].call(t,{request:e,response:o,event:r}))))break;return i||(o=o.ok?o:null),o||null}),function(e){return W.apply(this,arguments)});var W;const S={put:D,match:R},_={fetch:(()=>{var e=babelHelpers.asyncToGenerator(function*({request:e,fetchOptions:t,event:r,plugins:n=[]}){if(r&&r.preloadResponse){const e=yield r.preloadResponse;if(e)return e}\"string\"==typeof e&&(e=new Request(e));const o=O(n,H),i=o.length>0?e.clone():null;try{for(let t of n)N in t&&(e=yield t[N].call(t,{request:e.clone(),event:r}))}catch(e){throw new p(\"plugin-error-request-will-fetch\",{thrownError:e})}const c=e.clone();try{return yield fetch(e,t)}catch(e){for(let t of o)yield t[H].call(t,{error:e,event:r,originalRequest:i.clone(),request:c.clone()});throw e}});return function(t){return e.apply(this,arguments)}})()};var j=Object.freeze({DBWrapper:v,WorkboxError:p,assert:null,cacheNames:q,cacheWrapper:S,fetchWrapper:_,getFriendlyURL:k,logger:u});var B=new class{constructor(){try{self.workbox.v=self.workbox.v||{}}catch(e){}}get cacheNames(){return{googleAnalytics:q.getGoogleAnalyticsName(),precache:q.getPrecacheName(),runtime:q.getRuntimeName()}}setCacheNameDetails(e){q.updateDetails(e)}get logLevel(){return i()}setLogLevel(t){if(t>e.silent||t<e.debug)throw new p(\"invalid-value\",{paramName:\"logLevel\",validValueDescription:\"Please use a value from LOG_LEVELS, i.e 'logLevel = workbox.core.LOG_LEVELS.debug'.\",value:t});o(t)}};return Object.assign(B,{_private:j,LOG_LEVELS:e,registerQuotaErrorCallback:function(e){g.add(e)}})}();\n"],"file":"workbox-core.prod.js"}
@@ -1,255 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self.workbox.v['workbox:google-analytics:3.6.3'] = 1;
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2017 Google Inc. All Rights Reserved.
11
- Licensed under the Apache License, Version 2.0 (the "License");
12
- you may not use this file except in compliance with the License.
13
- You may obtain a copy of the License at
14
-
15
- http://www.apache.org/licenses/LICENSE-2.0
16
-
17
- Unless required by applicable law or agreed to in writing, software
18
- distributed under the License is distributed on an "AS IS" BASIS,
19
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- See the License for the specific language governing permissions and
21
- limitations under the License.
22
- */
23
-
24
- const QUEUE_NAME = 'workbox-google-analytics';
25
- const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes
26
- const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';
27
- const GTM_HOST = 'www.googletagmanager.com';
28
- const ANALYTICS_JS_PATH = '/analytics.js';
29
- const GTAG_JS_PATH = '/gtag/js';
30
-
31
- // This RegExp matches all known Measurement Protocol single-hit collect
32
- // endpoints. Most of the time the default path (/collect) is used, but
33
- // occasionally an experimental endpoint is used when testing new features,
34
- // (e.g. /r/collect or /j/collect)
35
- const COLLECT_PATHS_REGEX = /^\/(\w+\/)?collect/;
36
-
37
- /*
38
- Copyright 2017 Google Inc. All Rights Reserved.
39
- Licensed under the Apache License, Version 2.0 (the "License");
40
- you may not use this file except in compliance with the License.
41
- You may obtain a copy of the License at
42
-
43
- http://www.apache.org/licenses/LICENSE-2.0
44
-
45
- Unless required by applicable law or agreed to in writing, software
46
- distributed under the License is distributed on an "AS IS" BASIS,
47
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
- See the License for the specific language governing permissions and
49
- limitations under the License.
50
- */
51
-
52
- /**
53
- * Promisifies the FileReader API to await a text response from a Blob.
54
- *
55
- * @param {Blob} blob
56
- * @return {Promise<string>}
57
- *
58
- * @private
59
- */
60
- const getTextFromBlob = (() => {
61
- var _ref = babelHelpers.asyncToGenerator(function* (blob) {
62
- // This usage of `return await new Promise...` is intentional to work around
63
- // a bug in the transpiled/minified output.
64
- // See https://github.com/GoogleChrome/workbox/issues/1186
65
- return yield new Promise(function (resolve, reject) {
66
- const reader = new FileReader();
67
- reader.onloadend = function () {
68
- return resolve(reader.result);
69
- };
70
- reader.onerror = function () {
71
- return reject(reader.error);
72
- };
73
- reader.readAsText(blob);
74
- });
75
- });
76
-
77
- return function getTextFromBlob(_x) {
78
- return _ref.apply(this, arguments);
79
- };
80
- })();
81
-
82
- /**
83
- * Creates the requestWillDequeue callback to be used with the background
84
- * sync queue plugin. The callback takes the failed request and adds the
85
- * `qt` param based on the current time, as well as applies any other
86
- * user-defined hit modifications.
87
- *
88
- * @param {Object} config See workbox.googleAnalytics.initialize.
89
- * @return {Function} The requestWillDequeu callback function.
90
- *
91
- * @private
92
- */
93
- const createRequestWillReplayCallback = config => {
94
- return (() => {
95
- var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {
96
- let { url, requestInit, timestamp } = storableRequest;
97
- url = new URL(url);
98
-
99
- // Measurement protocol requests can set their payload parameters in either
100
- // the URL query string (for GET requests) or the POST body.
101
- let params;
102
- if (requestInit.body) {
103
- const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;
104
-
105
- params = new URLSearchParams(payload);
106
- } else {
107
- params = url.searchParams;
108
- }
109
-
110
- // Calculate the qt param, accounting for the fact that an existing
111
- // qt param may be present and should be updated rather than replaced.
112
- const originalHitTime = timestamp - (Number(params.get('qt')) || 0);
113
- const queueTime = Date.now() - originalHitTime;
114
-
115
- // Set the qt param prior to applying the hitFilter or parameterOverrides.
116
- params.set('qt', queueTime);
117
-
118
- if (config.parameterOverrides) {
119
- for (const param of Object.keys(config.parameterOverrides)) {
120
- const value = config.parameterOverrides[param];
121
- params.set(param, value);
122
- }
123
- }
124
-
125
- if (typeof config.hitFilter === 'function') {
126
- config.hitFilter.call(null, params);
127
- }
128
-
129
- requestInit.body = params.toString();
130
- requestInit.method = 'POST';
131
- requestInit.mode = 'cors';
132
- requestInit.credentials = 'omit';
133
- requestInit.headers = { 'Content-Type': 'text/plain' };
134
-
135
- // Ignore URL search params as they're now in the post body.
136
- storableRequest.url = `${url.origin}${url.pathname}`;
137
- });
138
-
139
- return function (_x2) {
140
- return _ref2.apply(this, arguments);
141
- };
142
- })();
143
- };
144
-
145
- /**
146
- * Creates GET and POST routes to catch failed Measurement Protocol hits.
147
- *
148
- * @param {Plugin} queuePlugin
149
- * @return {Array<Route>} The created routes.
150
- *
151
- * @private
152
- */
153
- const createCollectRoutes = queuePlugin => {
154
- const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);
155
-
156
- const handler = new NetworkOnly_mjs.NetworkOnly({
157
- plugins: [queuePlugin]
158
- });
159
-
160
- return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];
161
- };
162
-
163
- /**
164
- * Creates a route with a network first strategy for the analytics.js script.
165
- *
166
- * @param {string} cacheName
167
- * @return {Route} The created route.
168
- *
169
- * @private
170
- */
171
- const createAnalyticsJsRoute = cacheName => {
172
- const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;
173
- const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });
174
-
175
- return new Route_mjs.Route(match, handler, 'GET');
176
- };
177
-
178
- /**
179
- * Creates a route with a network first strategy for the gtag.js script.
180
- *
181
- * @param {string} cacheName
182
- * @return {Route} The created route.
183
- *
184
- * @private
185
- */
186
- const createGtagJsRoute = cacheName => {
187
- const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;
188
- const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });
189
-
190
- return new Route_mjs.Route(match, handler, 'GET');
191
- };
192
-
193
- /**
194
- * @param {Object=} [options]
195
- * @param {Object} [options.cacheName] The cache name to store and retrieve
196
- * analytics.js. Defaults to the cache names provided by `workbox-core`.
197
- * @param {Object} [options.parameterOverrides]
198
- * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),
199
- * expressed as key/value pairs, to be added to replayed Google Analytics
200
- * requests. This can be used to, e.g., set a custom dimension indicating
201
- * that the request was replayed.
202
- * @param {Function} [options.hitFilter] A function that allows you to modify
203
- * the hit parameters prior to replaying
204
- * the hit. The function is invoked with the original hit's URLSearchParams
205
- * object as its only argument.
206
- *
207
- * @memberof workbox.googleAnalytics
208
- */
209
- const initialize = (options = {}) => {
210
- const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);
211
-
212
- const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {
213
- maxRetentionTime: MAX_RETENTION_TIME,
214
- callbacks: {
215
- requestWillReplay: createRequestWillReplayCallback(options)
216
- }
217
- });
218
-
219
- const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];
220
-
221
- const router = new Router_mjs.Router();
222
- for (const route of routes) {
223
- router.registerRoute(route);
224
- }
225
-
226
- self.addEventListener('fetch', evt => {
227
- const responsePromise = router.handleRequest(evt);
228
- if (responsePromise) {
229
- evt.respondWith(responsePromise);
230
- }
231
- });
232
- };
233
-
234
- /*
235
- Copyright 2017 Google Inc. All Rights Reserved.
236
- Licensed under the Apache License, Version 2.0 (the "License");
237
- you may not use this file except in compliance with the License.
238
- You may obtain a copy of the License at
239
-
240
- http://www.apache.org/licenses/LICENSE-2.0
241
-
242
- Unless required by applicable law or agreed to in writing, software
243
- distributed under the License is distributed on an "AS IS" BASIS,
244
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
245
- See the License for the specific language governing permissions and
246
- limitations under the License.
247
- */
248
-
249
- exports.initialize = initialize;
250
-
251
- return exports;
252
-
253
- }({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));
254
-
255
- //# sourceMappingURL=workbox-google-analytics.dev.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.googleAnalytics = (function (exports,Plugin_mjs,cacheNames_mjs,Route_mjs,Router_mjs,NetworkFirst_mjs,NetworkOnly_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:google-analytics:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n const QUEUE_NAME = 'workbox-google-analytics';\n const MAX_RETENTION_TIME = 60 * 48; // Two days in minutes\n const GOOGLE_ANALYTICS_HOST = 'www.google-analytics.com';\n const GTM_HOST = 'www.googletagmanager.com';\n const ANALYTICS_JS_PATH = '/analytics.js';\n const GTAG_JS_PATH = '/gtag/js';\n\n // This RegExp matches all known Measurement Protocol single-hit collect\n // endpoints. Most of the time the default path (/collect) is used, but\n // occasionally an experimental endpoint is used when testing new features,\n // (e.g. /r/collect or /j/collect)\n const COLLECT_PATHS_REGEX = /^\\/(\\w+\\/)?collect/;\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * Promisifies the FileReader API to await a text response from a Blob.\n *\n * @param {Blob} blob\n * @return {Promise<string>}\n *\n * @private\n */\n const getTextFromBlob = (() => {\n var _ref = babelHelpers.asyncToGenerator(function* (blob) {\n // This usage of `return await new Promise...` is intentional to work around\n // a bug in the transpiled/minified output.\n // See https://github.com/GoogleChrome/workbox/issues/1186\n return yield new Promise(function (resolve, reject) {\n const reader = new FileReader();\n reader.onloadend = function () {\n return resolve(reader.result);\n };\n reader.onerror = function () {\n return reject(reader.error);\n };\n reader.readAsText(blob);\n });\n });\n\n return function getTextFromBlob(_x) {\n return _ref.apply(this, arguments);\n };\n })();\n\n /**\n * Creates the requestWillDequeue callback to be used with the background\n * sync queue plugin. The callback takes the failed request and adds the\n * `qt` param based on the current time, as well as applies any other\n * user-defined hit modifications.\n *\n * @param {Object} config See workbox.googleAnalytics.initialize.\n * @return {Function} The requestWillDequeu callback function.\n *\n * @private\n */\n const createRequestWillReplayCallback = config => {\n return (() => {\n var _ref2 = babelHelpers.asyncToGenerator(function* (storableRequest) {\n let { url, requestInit, timestamp } = storableRequest;\n url = new URL(url);\n\n // Measurement protocol requests can set their payload parameters in either\n // the URL query string (for GET requests) or the POST body.\n let params;\n if (requestInit.body) {\n const payload = requestInit.body instanceof Blob ? yield getTextFromBlob(requestInit.body) : requestInit.body;\n\n params = new URLSearchParams(payload);\n } else {\n params = url.searchParams;\n }\n\n // Calculate the qt param, accounting for the fact that an existing\n // qt param may be present and should be updated rather than replaced.\n const originalHitTime = timestamp - (Number(params.get('qt')) || 0);\n const queueTime = Date.now() - originalHitTime;\n\n // Set the qt param prior to applying the hitFilter or parameterOverrides.\n params.set('qt', queueTime);\n\n if (config.parameterOverrides) {\n for (const param of Object.keys(config.parameterOverrides)) {\n const value = config.parameterOverrides[param];\n params.set(param, value);\n }\n }\n\n if (typeof config.hitFilter === 'function') {\n config.hitFilter.call(null, params);\n }\n\n requestInit.body = params.toString();\n requestInit.method = 'POST';\n requestInit.mode = 'cors';\n requestInit.credentials = 'omit';\n requestInit.headers = { 'Content-Type': 'text/plain' };\n\n // Ignore URL search params as they're now in the post body.\n storableRequest.url = `${url.origin}${url.pathname}`;\n });\n\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n })();\n };\n\n /**\n * Creates GET and POST routes to catch failed Measurement Protocol hits.\n *\n * @param {Plugin} queuePlugin\n * @return {Array<Route>} The created routes.\n *\n * @private\n */\n const createCollectRoutes = queuePlugin => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && COLLECT_PATHS_REGEX.test(url.pathname);\n\n const handler = new NetworkOnly_mjs.NetworkOnly({\n plugins: [queuePlugin]\n });\n\n return [new Route_mjs.Route(match, handler, 'GET'), new Route_mjs.Route(match, handler, 'POST')];\n };\n\n /**\n * Creates a route with a network first strategy for the analytics.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createAnalyticsJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST && url.pathname === ANALYTICS_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * Creates a route with a network first strategy for the gtag.js script.\n *\n * @param {string} cacheName\n * @return {Route} The created route.\n *\n * @private\n */\n const createGtagJsRoute = cacheName => {\n const match = ({ url }) => url.hostname === GTM_HOST && url.pathname === GTAG_JS_PATH;\n const handler = new NetworkFirst_mjs.NetworkFirst({ cacheName });\n\n return new Route_mjs.Route(match, handler, 'GET');\n };\n\n /**\n * @param {Object=} [options]\n * @param {Object} [options.cacheName] The cache name to store and retrieve\n * analytics.js. Defaults to the cache names provided by `workbox-core`.\n * @param {Object} [options.parameterOverrides]\n * [Measurement Protocol parameters](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters),\n * expressed as key/value pairs, to be added to replayed Google Analytics\n * requests. This can be used to, e.g., set a custom dimension indicating\n * that the request was replayed.\n * @param {Function} [options.hitFilter] A function that allows you to modify\n * the hit parameters prior to replaying\n * the hit. The function is invoked with the original hit's URLSearchParams\n * object as its only argument.\n *\n * @memberof workbox.googleAnalytics\n */\n const initialize = (options = {}) => {\n const cacheName = cacheNames_mjs.cacheNames.getGoogleAnalyticsName(options.cacheName);\n\n const queuePlugin = new Plugin_mjs.Plugin(QUEUE_NAME, {\n maxRetentionTime: MAX_RETENTION_TIME,\n callbacks: {\n requestWillReplay: createRequestWillReplayCallback(options)\n }\n });\n\n const routes = [createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];\n\n const router = new Router_mjs.Router();\n for (const route of routes) {\n router.registerRoute(route);\n }\n\n self.addEventListener('fetch', evt => {\n const responsePromise = router.handleRequest(evt);\n if (responsePromise) {\n evt.respondWith(responsePromise);\n }\n });\n };\n\n /*\n Copyright 2017 Google Inc. All Rights Reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.initialize = initialize;\n\n return exports;\n\n}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies));\n"],"file":"workbox-google-analytics.dev.js"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.6.3"]=1}catch(e){}const l=/^\/(\w+\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get("qt"))||0),l=Date.now()-s;if(t.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method="POST",r.mode="cors",r.credentials="omit",r.headers={"Content-Type":"text/plain"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.google-analytics.com"===e.hostname&&"/analytics.js"===e.pathname,n,"GET")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(i),...(e=>{const n=({url:e})=>"www.google-analytics.com"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener("fetch",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
2
-
3
- //# sourceMappingURL=workbox-google-analytics.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-google-analytics/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){\"use strict\";try{self.workbox.v[\"workbox:google-analytics:3.6.3\"]=1}catch(e){}const l=/^\\/(\\w+\\/)?collect/,i=(a=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})}),function(e){return a.apply(this,arguments)});var a;const w=e=>(u=babelHelpers.asyncToGenerator(function*(n){let t,{url:o,requestInit:r,timestamp:c}=n;if(o=new URL(o),r.body){const e=r.body instanceof Blob?yield i(r.body):r.body;t=new URLSearchParams(e)}else t=o.searchParams;const s=c-(Number(t.get(\"qt\"))||0),l=Date.now()-s;if(t.set(\"qt\",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const o=e.parameterOverrides[n];t.set(n,o)}\"function\"==typeof e.hitFilter&&e.hitFilter.call(null,t),r.body=t.toString(),r.method=\"POST\",r.mode=\"cors\",r.credentials=\"omit\",r.headers={\"Content-Type\":\"text/plain\"},n.url=`${o.origin}${o.pathname}`}),function(e){return u.apply(this,arguments)});var u;return e.initialize=((e={})=>{const i=t.cacheNames.getGoogleAnalyticsName(e.cacheName),a=new n.Plugin(\"workbox-google-analytics\",{maxRetentionTime:2880,callbacks:{requestWillReplay:w(e)}}),u=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.google-analytics.com\"===e.hostname&&\"/analytics.js\"===e.pathname,n,\"GET\")})(i),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>\"www.googletagmanager.com\"===e.hostname&&\"/gtag/js\"===e.pathname,n,\"GET\")})(i),...(e=>{const n=({url:e})=>\"www.google-analytics.com\"===e.hostname&&l.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,\"GET\"),new o.Route(n,t,\"POST\")]})(a)],f=new r.Router;for(const e of u)f.registerRoute(e);self.addEventListener(\"fetch\",e=>{const n=f.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);\n"],"file":"workbox-google-analytics.prod.js"}
@@ -1,159 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.navigationPreload = (function (exports,logger_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self.workbox.v['workbox:navigation-preload:3.6.3'] = 1;
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2018 Google Inc.
11
-
12
- Licensed under the Apache License, Version 2.0 (the "License");
13
- you may not use this file except in compliance with the License.
14
- You may obtain a copy of the License at
15
-
16
- https://www.apache.org/licenses/LICENSE-2.0
17
-
18
- Unless required by applicable law or agreed to in writing, software
19
- distributed under the License is distributed on an "AS IS" BASIS,
20
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- See the License for the specific language governing permissions and
22
- limitations under the License.
23
- */
24
-
25
- /**
26
- * @return {boolean} Whether or not the current browser supports enabling
27
- * navigation preload.
28
- *
29
- * @memberof workbox.navigationPreload
30
- */
31
- function isSupported() {
32
- return Boolean(self.registration && self.registration.navigationPreload);
33
- }
34
-
35
- /*
36
- Copyright 2017 Google Inc.
37
-
38
- Licensed under the Apache License, Version 2.0 (the "License");
39
- you may not use this file except in compliance with the License.
40
- You may obtain a copy of the License at
41
-
42
- https://www.apache.org/licenses/LICENSE-2.0
43
-
44
- Unless required by applicable law or agreed to in writing, software
45
- distributed under the License is distributed on an "AS IS" BASIS,
46
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47
- See the License for the specific language governing permissions and
48
- limitations under the License.
49
- */
50
-
51
- /**
52
- * If the browser supports Navigation Preload, then this will disable it.
53
- *
54
- * @memberof workbox.navigationPreload
55
- */
56
- function disable() {
57
- if (isSupported()) {
58
- self.addEventListener('activate', event => {
59
- event.waitUntil(self.registration.navigationPreload.disable().then(() => {
60
- {
61
- logger_mjs.logger.log(`Navigation preload is disabled.`);
62
- }
63
- }));
64
- });
65
- } else {
66
- {
67
- logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
68
- }
69
- }
70
- }
71
-
72
- /*
73
- Copyright 2017 Google Inc.
74
-
75
- Licensed under the Apache License, Version 2.0 (the "License");
76
- you may not use this file except in compliance with the License.
77
- You may obtain a copy of the License at
78
-
79
- https://www.apache.org/licenses/LICENSE-2.0
80
-
81
- Unless required by applicable law or agreed to in writing, software
82
- distributed under the License is distributed on an "AS IS" BASIS,
83
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84
- See the License for the specific language governing permissions and
85
- limitations under the License.
86
- */
87
-
88
- /**
89
- * If the browser supports Navigation Preload, then this will enable it.
90
- *
91
- * @param {string} [headerValue] Optionally, allows developers to
92
- * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)
93
- * the value of the `Service-Worker-Navigation-Preload` header which will be
94
- * sent to the server when making the navigation request.
95
- *
96
- * @memberof workbox.navigationPreload
97
- */
98
- function enable(headerValue) {
99
- if (isSupported()) {
100
- self.addEventListener('activate', event => {
101
- event.waitUntil(self.registration.navigationPreload.enable().then(() => {
102
- // Defaults to Service-Worker-Navigation-Preload: true if not set.
103
- if (headerValue) {
104
- self.registration.navigationPreload.setHeaderValue(headerValue);
105
- }
106
-
107
- {
108
- logger_mjs.logger.log(`Navigation preload is enabled.`);
109
- }
110
- }));
111
- });
112
- } else {
113
- {
114
- logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);
115
- }
116
- }
117
- }
118
-
119
- /*
120
- Copyright 2017 Google Inc.
121
-
122
- Licensed under the Apache License, Version 2.0 (the "License");
123
- you may not use this file except in compliance with the License.
124
- You may obtain a copy of the License at
125
-
126
- https://www.apache.org/licenses/LICENSE-2.0
127
-
128
- Unless required by applicable law or agreed to in writing, software
129
- distributed under the License is distributed on an "AS IS" BASIS,
130
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131
- See the License for the specific language governing permissions and
132
- limitations under the License.
133
- */
134
-
135
- /*
136
- Copyright 2017 Google Inc.
137
-
138
- Licensed under the Apache License, Version 2.0 (the "License");
139
- you may not use this file except in compliance with the License.
140
- You may obtain a copy of the License at
141
-
142
- https://www.apache.org/licenses/LICENSE-2.0
143
-
144
- Unless required by applicable law or agreed to in writing, software
145
- distributed under the License is distributed on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
147
- See the License for the specific language governing permissions and
148
- limitations under the License.
149
- */
150
-
151
- exports.disable = disable;
152
- exports.enable = enable;
153
- exports.isSupported = isSupported;
154
-
155
- return exports;
156
-
157
- }({},workbox.core._private));
158
-
159
- //# sourceMappingURL=workbox-navigation-preload.dev.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox = this.workbox || {};\nthis.workbox.navigationPreload = (function (exports,logger_mjs) {\n 'use strict';\n\n try {\n self.workbox.v['workbox:navigation-preload:3.6.3'] = 1;\n } catch (e) {} // eslint-disable-line\n\n /*\n Copyright 2018 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * @return {boolean} Whether or not the current browser supports enabling\n * navigation preload.\n *\n * @memberof workbox.navigationPreload\n */\n function isSupported() {\n return Boolean(self.registration && self.registration.navigationPreload);\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will disable it.\n *\n * @memberof workbox.navigationPreload\n */\n function disable() {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.disable().then(() => {\n {\n logger_mjs.logger.log(`Navigation preload is disabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /**\n * If the browser supports Navigation Preload, then this will enable it.\n *\n * @param {string} [headerValue] Optionally, allows developers to\n * [override](https://developers.google.com/web/updates/2017/02/navigation-preload#changing_the_header)\n * the value of the `Service-Worker-Navigation-Preload` header which will be\n * sent to the server when making the navigation request.\n *\n * @memberof workbox.navigationPreload\n */\n function enable(headerValue) {\n if (isSupported()) {\n self.addEventListener('activate', event => {\n event.waitUntil(self.registration.navigationPreload.enable().then(() => {\n // Defaults to Service-Worker-Navigation-Preload: true if not set.\n if (headerValue) {\n self.registration.navigationPreload.setHeaderValue(headerValue);\n }\n\n {\n logger_mjs.logger.log(`Navigation preload is enabled.`);\n }\n }));\n });\n } else {\n {\n logger_mjs.logger.log(`Navigation preload is not supported in this browser.`);\n }\n }\n }\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n /*\n Copyright 2017 Google Inc.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n exports.disable = disable;\n exports.enable = enable;\n exports.isSupported = isSupported;\n\n return exports;\n\n}({},workbox.core._private));\n"],"file":"workbox-navigation-preload.dev.js"}
@@ -1,3 +0,0 @@
1
- this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){"use strict";try{self.workbox.v["workbox:navigation-preload:3.6.3"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener("activate",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener("activate",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});
2
-
3
- //# sourceMappingURL=workbox-navigation-preload.prod.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"mappings":"","sources":["packages/workbox-navigation-preload/browser.mjs"],"sourcesContent":["this.workbox=this.workbox||{},this.workbox.navigationPreload=function(t){\"use strict\";try{self.workbox.v[\"workbox:navigation-preload:3.6.3\"]=1}catch(t){}function e(){return Boolean(self.registration&&self.registration.navigationPreload)}return t.disable=function(){e()&&self.addEventListener(\"activate\",t=>{t.waitUntil(self.registration.navigationPreload.disable().then(()=>{}))})},t.enable=function(t){e()&&self.addEventListener(\"activate\",e=>{e.waitUntil(self.registration.navigationPreload.enable().then(()=>{t&&self.registration.navigationPreload.setHeaderValue(t)}))})},t.isSupported=e,t}({});\n"],"file":"workbox-navigation-preload.prod.js"}
@@ -1,1171 +0,0 @@
1
- this.workbox = this.workbox || {};
2
- this.workbox.precaching = (function (DBWrapper_mjs,logger_mjs,cacheNames_mjs,WorkboxError_mjs,fetchWrapper_mjs,cacheWrapper_mjs,assert_mjs,getFriendlyURL_mjs) {
3
- 'use strict';
4
-
5
- try {
6
- self.workbox.v['workbox:precaching:3.6.3'] = 1;
7
- } catch (e) {} // eslint-disable-line
8
-
9
- /*
10
- Copyright 2017 Google Inc.
11
-
12
- Licensed under the Apache License, Version 2.0 (the "License");
13
- you may not use this file except in compliance with the License.
14
- You may obtain a copy of the License at
15
-
16
- https://www.apache.org/licenses/LICENSE-2.0
17
-
18
- Unless required by applicable law or agreed to in writing, software
19
- distributed under the License is distributed on an "AS IS" BASIS,
20
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- See the License for the specific language governing permissions and
22
- limitations under the License.
23
- */
24
-
25
- /**
26
- * Used as a consistent way of referencing a URL to precache.
27
- *
28
- * @private
29
- * @memberof module:workbox-precaching
30
- */
31
- class PrecacheEntry {
32
- /**
33
- * This class ensures all cache list entries are consistent and
34
- * adds cache busting if required.
35
- *
36
- * @param {*} originalInput
37
- * @param {string} url
38
- * @param {string} revision
39
- * @param {boolean} shouldCacheBust
40
- */
41
- constructor(originalInput, url, revision, shouldCacheBust) {
42
- this._originalInput = originalInput;
43
- this._entryId = url;
44
- this._revision = revision;
45
- const requestAsCacheKey = new Request(url, { credentials: 'same-origin' });
46
- this._cacheRequest = requestAsCacheKey;
47
- this._networkRequest = shouldCacheBust ? this._cacheBustRequest(requestAsCacheKey) : requestAsCacheKey;
48
- }
49
-
50
- /**
51
- * This method will either use Request.cache option OR append a cache
52
- * busting parameter to the URL.
53
- *
54
- * @param {Request} request The request to cache bust
55
- * @return {Request} A cachebusted Request
56
- *
57
- * @private
58
- */
59
- _cacheBustRequest(request) {
60
- let url = request.url;
61
- const requestOptions = {
62
- credentials: 'same-origin'
63
- };
64
- if ('cache' in Request.prototype) {
65
- // Make use of the Request cache mode where we can.
66
- // Reload skips the HTTP cache for outgoing requests and updates
67
- // the cache with the returned response.
68
- requestOptions.cache = 'reload';
69
- } else {
70
- const parsedURL = new URL(url, location);
71
-
72
- // This is done so the minifier can mangle 'global.encodeURIComponent'
73
- const _encodeURIComponent = encodeURIComponent;
74
-
75
- parsedURL.search += (parsedURL.search ? '&' : '') + _encodeURIComponent(`_workbox-cache-bust`) + '=' + _encodeURIComponent(this._revision);
76
- url = parsedURL.toString();
77
- }
78
-
79
- return new Request(url, requestOptions);
80
- }
81
- }
82
-
83
- /*
84
- Copyright 2017 Google Inc.
85
-
86
- Licensed under the Apache License, Version 2.0 (the "License");
87
- you may not use this file except in compliance with the License.
88
- You may obtain a copy of the License at
89
-
90
- https://www.apache.org/licenses/LICENSE-2.0
91
-
92
- Unless required by applicable law or agreed to in writing, software
93
- distributed under the License is distributed on an "AS IS" BASIS,
94
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
- See the License for the specific language governing permissions and
96
- limitations under the License.
97
- */
98
-
99
- // Allows minifier to mangle this name
100
- const REVISON_IDB_FIELD = 'revision';
101
- const URL_IDB_FIELD = 'url';
102
- const DB_STORE_NAME = 'precached-details-models';
103
- /**
104
- * This model will track the relevant information of entries that
105
- * are cached and their matching revision details.
106
- *
107
- * @private
108
- */
109
- class PrecachedDetailsModel {
110
- /**
111
- * Construct a new model for a specific cache.
112
- *
113
- * @param {string} dbName
114
- * @private
115
- */
116
- constructor(dbName) {
117
- // This ensures the db name contains only letters, numbers, '-', '_' and '$'
118
- const filteredDBName = dbName.replace(/[^\w-]/g, '_');
119
- this._db = new DBWrapper_mjs.DBWrapper(filteredDBName, 2, {
120
- onupgradeneeded: this._handleUpgrade
121
- });
122
- }
123
-
124
- /**
125
- * Should perform an upgrade of indexedDB.
126
- *
127
- * @param {Event} evt
128
- *
129
- * @private
130
- */
131
- _handleUpgrade(evt) {
132
- const db = evt.target.result;
133
- if (evt.oldVersion < 2) {
134
- // IndexedDB version 1 used both 'workbox-precaching' and
135
- // 'precached-details-model' before upgrading to version 2.
136
- // Delete them and create a new store with latest schema.
137
- if (db.objectStoreNames.contains('workbox-precaching')) {
138
- db.deleteObjectStore('workbox-precaching');
139
- }
140
- if (db.objectStoreNames.contains(DB_STORE_NAME)) {
141
- db.deleteObjectStore(DB_STORE_NAME);
142
- }
143
- }
144
- db.createObjectStore(DB_STORE_NAME);
145
- }
146
-
147
- /**
148
- * Check if an entry is already cached. Returns false if
149
- * the entry isn't cached or the revision has changed.
150
- *
151
- * @param {string} cacheName
152
- * @param {PrecacheEntry} precacheEntry
153
- * @return {boolean}
154
- *
155
- * @private
156
- */
157
- _isEntryCached(cacheName, precacheEntry) {
158
- var _this = this;
159
-
160
- return babelHelpers.asyncToGenerator(function* () {
161
- const revisionDetails = yield _this._getRevision(precacheEntry._entryId);
162
- if (revisionDetails !== precacheEntry._revision) {
163
- return false;
164
- }
165
-
166
- const openCache = yield caches.open(cacheName);
167
- const cachedResponse = yield openCache.match(precacheEntry._cacheRequest);
168
- return !!cachedResponse;
169
- })();
170
- }
171
-
172
- /**
173
- * @return {Promise<Array>}
174
- *
175
- * @private
176
- */
177
- _getAllEntries() {
178
- var _this2 = this;
179
-
180
- return babelHelpers.asyncToGenerator(function* () {
181
- return yield _this2._db.getAllMatching(DB_STORE_NAME, {
182
- includeKeys: true
183
- });
184
- })();
185
- }
186
-
187
- /**
188
- * Get the current revision details.
189
- *
190
- * @param {Object} entryId
191
- * @return {Promise<string|null>}
192
- *
193
- * @private
194
- */
195
- _getRevision(entryId) {
196
- var _this3 = this;
197
-
198
- return babelHelpers.asyncToGenerator(function* () {
199
- const data = yield _this3._db.get(DB_STORE_NAME, entryId);
200
- return data ? data[REVISON_IDB_FIELD] : null;
201
- })();
202
- }
203
-
204
- /**
205
- * Add an entry to the details model.
206
- *
207
- * @param {PrecacheEntry} precacheEntry
208
- *
209
- * @private
210
- */
211
- _addEntry(precacheEntry) {
212
- var _this4 = this;
213
-
214
- return babelHelpers.asyncToGenerator(function* () {
215
- yield _this4._db.put(DB_STORE_NAME, {
216
- [REVISON_IDB_FIELD]: precacheEntry._revision,
217
- [URL_IDB_FIELD]: precacheEntry._cacheRequest.url
218
- }, precacheEntry._entryId);
219
- })();
220
- }
221
-
222
- /**
223
- * Delete entry from details model.
224
- *
225
- * @param {string} entryId
226
- *
227
- * @private
228
- */
229
- _deleteEntry(entryId) {
230
- var _this5 = this;
231
-
232
- return babelHelpers.asyncToGenerator(function* () {
233
- yield _this5._db.delete(DB_STORE_NAME, entryId);
234
- })();
235
- }
236
- }
237
-
238
- /*
239
- Copyright 2017 Google Inc.
240
-
241
- Licensed under the Apache License, Version 2.0 (the "License");
242
- you may not use this file except in compliance with the License.
243
- You may obtain a copy of the License at
244
-
245
- https://www.apache.org/licenses/LICENSE-2.0
246
-
247
- Unless required by applicable law or agreed to in writing, software
248
- distributed under the License is distributed on an "AS IS" BASIS,
249
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
250
- See the License for the specific language governing permissions and
251
- limitations under the License.
252
- */
253
-
254
- /**
255
- * This method will print out a warning if a precache entry doesn't have
256
- * a `revision` value.
257
- *
258
- * This is common if the asset if revisioned in the url like `index.1234.css`.
259
- *
260
- * @param {Map} entriesMap
261
- *
262
- * @private
263
- * @memberof module:workbox-preaching
264
- */
265
- var showWarningsIfNeeded = (entriesMap => {
266
- const urlOnlyEntries = [];
267
- entriesMap.forEach(entry => {
268
- if (typeof entry === 'string' || !entry._originalInput.revision) {
269
- urlOnlyEntries.push(entry._originalInput);
270
- }
271
- });
272
-
273
- if (urlOnlyEntries.length === 0) {
274
- // No warnings needed.
275
- return;
276
- }
277
-
278
- logger_mjs.logger.groupCollapsed('Are your precached assets revisioned?');
279
-
280
- const urlsList = urlOnlyEntries.map(urlOnlyEntry => {
281
- return ` - ${JSON.stringify(urlOnlyEntry)}`;
282
- }).join(`\n`);
283
-
284
- logger_mjs.logger.warn(`The following precache entries might not be revisioned:` + `\n\n` + urlsList + `\n\n`);
285
-
286
- logger_mjs.logger.unprefixed.warn(`You can learn more about why this might be a ` + `problem here: https://developers.google.com/web/tools/workbox/modules/workbox-precaching`);
287
-
288
- logger_mjs.logger.groupEnd();
289
- });
290
-
291
- /*
292
- Copyright 2017 Google Inc.
293
-
294
- Licensed under the Apache License, Version 2.0 (the "License");
295
- you may not use this file except in compliance with the License.
296
- You may obtain a copy of the License at
297
-
298
- https://www.apache.org/licenses/LICENSE-2.0
299
-
300
- Unless required by applicable law or agreed to in writing, software
301
- distributed under the License is distributed on an "AS IS" BASIS,
302
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
303
- See the License for the specific language governing permissions and
304
- limitations under the License.
305
- */
306
-
307
- /**
308
- * @param {string} groupTitle
309
- * @param {Array<PrecacheEntry>} entries
310
- *
311
- * @private
312
- */
313
- const _nestedGroup = (groupTitle, entries) => {
314
- if (entries.length === 0) {
315
- return;
316
- }
317
-
318
- logger_mjs.logger.groupCollapsed(groupTitle);
319
-
320
- entries.forEach(entry => {
321
- logger_mjs.logger.log(entry._originalInput);
322
- });
323
-
324
- logger_mjs.logger.groupEnd();
325
- };
326
-
327
- /**
328
- * @param {Array<Object>} entriesToPrecache
329
- * @param {Array<Object>} alreadyPrecachedEntries
330
- *
331
- * @private
332
- * @memberof module:workbox-precachig
333
- */
334
- var printInstallDetails = ((entriesToPrecache, alreadyPrecachedEntries) => {
335
- // Goal is to print the message:
336
- // Precaching X files.
337
- // Or:
338
- // Precaching X files. Y files were cached and up-to-date.
339
-
340
- const precachedCount = entriesToPrecache.length;
341
- const alreadyPrecachedCount = alreadyPrecachedEntries.length;
342
- let printText = `Precaching ${precachedCount} file${precachedCount === 1 ? '' : 's'}.`;
343
- if (alreadyPrecachedCount > 0) {
344
- printText += ` ${alreadyPrecachedCount} ` + `file${alreadyPrecachedCount === 1 ? ' is' : 's are'} already cached.`;
345
- }
346
-
347
- logger_mjs.logger.groupCollapsed(printText);
348
-
349
- _nestedGroup(`View precached URLs.`, entriesToPrecache);
350
- _nestedGroup(`View URLs that were already precached.`, alreadyPrecachedEntries);
351
- logger_mjs.logger.groupEnd();
352
- });
353
-
354
- /*
355
- Copyright 2017 Google Inc.
356
-
357
- Licensed under the Apache License, Version 2.0 (the "License");
358
- you may not use this file except in compliance with the License.
359
- You may obtain a copy of the License at
360
-
361
- https://www.apache.org/licenses/LICENSE-2.0
362
-
363
- Unless required by applicable law or agreed to in writing, software
364
- distributed under the License is distributed on an "AS IS" BASIS,
365
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
366
- See the License for the specific language governing permissions and
367
- limitations under the License.
368
- */
369
-
370
- const logGroup = (groupTitle, urls) => {
371
- logger_mjs.logger.groupCollapsed(groupTitle);
372
-
373
- urls.forEach(url => {
374
- logger_mjs.logger.log(url);
375
- });
376
-
377
- logger_mjs.logger.groupEnd();
378
- };
379
-
380
- /**
381
- * @param {Array<string>} deletedCacheRequests
382
- * @param {Array<string>} deletedRevisionDetails
383
- *
384
- * @private
385
- * @memberof module:workbox-precachig
386
- */
387
- var printCleanupDetails = ((deletedCacheRequests, deletedRevisionDetails) => {
388
- if (deletedCacheRequests.length === 0 && deletedRevisionDetails.length === 0) {
389
- return;
390
- }
391
-
392
- const cacheDeleteCount = deletedCacheRequests.length;
393
- const revisionDeleteCount = deletedRevisionDetails.length;
394
-
395
- const cacheDeleteText = `${cacheDeleteCount} cached ` + `request${cacheDeleteCount === 1 ? ' was' : 's were'} deleted`;
396
- const revisionDeleteText = `${revisionDeleteCount} ` + `${revisionDeleteCount === 1 ? 'entry' : 'entries'} ` + `${revisionDeleteCount === 1 ? 'was' : 'were'} deleted from IndexedDB.`;
397
-
398
- logger_mjs.logger.groupCollapsed(`During precaching cleanup, ${cacheDeleteText} and ${revisionDeleteText}`);
399
-
400
- logGroup('Deleted Cache Requests', deletedCacheRequests);
401
- logGroup('Revision Details Deleted from DB', deletedRevisionDetails);
402
-
403
- logger_mjs.logger.groupEnd();
404
- });
405
-
406
- /*
407
- Copyright 2017 Google Inc.
408
-
409
- Licensed under the Apache License, Version 2.0 (the "License");
410
- you may not use this file except in compliance with the License.
411
- You may obtain a copy of the License at
412
-
413
- https://www.apache.org/licenses/LICENSE-2.0
414
-
415
- Unless required by applicable law or agreed to in writing, software
416
- distributed under the License is distributed on an "AS IS" BASIS,
417
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
418
- See the License for the specific language governing permissions and
419
- limitations under the License.
420
- */
421
-
422
- /**
423
- * @param {Response} response
424
- * @return {Response}
425
- *
426
- * @private
427
- * @memberof module:workbox-precaching
428
- */
429
- const cleanRedirect = (() => {
430
- var _ref = babelHelpers.asyncToGenerator(function* (response) {
431
- const clonedResponse = response.clone();
432
-
433
- // Not all browsers support the Response.body stream, so fall back
434
- // to reading the entire body into memory as a blob.
435
- const bodyPromise = 'body' in clonedResponse ? Promise.resolve(clonedResponse.body) : clonedResponse.blob();
436
-
437
- const body = yield bodyPromise;
438
-
439
- // new Response() is happy when passed either a stream or a Blob.
440
- return new Response(body, {
441
- headers: clonedResponse.headers,
442
- status: clonedResponse.status,
443
- statusText: clonedResponse.statusText
444
- });
445
- });
446
-
447
- return function cleanRedirect(_x) {
448
- return _ref.apply(this, arguments);
449
- };
450
- })();
451
-
452
- /*
453
- Copyright 2017 Google Inc.
454
-
455
- Licensed under the Apache License, Version 2.0 (the "License");
456
- you may not use this file except in compliance with the License.
457
- You may obtain a copy of the License at
458
-
459
- https://www.apache.org/licenses/LICENSE-2.0
460
-
461
- Unless required by applicable law or agreed to in writing, software
462
- distributed under the License is distributed on an "AS IS" BASIS,
463
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
464
- See the License for the specific language governing permissions and
465
- limitations under the License.
466
- */
467
-
468
- /**
469
- * Performs efficient precaching of assets.
470
- *
471
- * @memberof workbox.precaching
472
- */
473
- class PrecacheController {
474
- /**
475
- * Create a new PrecacheController.
476
- *
477
- * @param {string} cacheName
478
- */
479
- constructor(cacheName) {
480
- this._cacheName = cacheNames_mjs.cacheNames.getPrecacheName(cacheName);
481
- this._entriesToCacheMap = new Map();
482
- this._precacheDetailsModel = new PrecachedDetailsModel(this._cacheName);
483
- }
484
-
485
- /**
486
- * This method will add items to the precache list, removing duplicates
487
- * and ensuring the information is valid.
488
- *
489
- * @param {
490
- * Array<module:workbox-precaching.PrecacheController.PrecacheEntry|string>
491
- * } entries Array of entries to
492
- * precache.
493
- */
494
- addToCacheList(entries) {
495
- {
496
- assert_mjs.assert.isArray(entries, {
497
- moduleName: 'workbox-precaching',
498
- className: 'PrecacheController',
499
- funcName: 'addToCacheList',
500
- paramName: 'entries'
501
- });
502
- }
503
-
504
- entries.map(userEntry => {
505
- this._addEntryToCacheList(this._parseEntry(userEntry));
506
- });
507
- }
508
-
509
- /**
510
- * This method returns a precache entry.
511
- *
512
- * @private
513
- * @param {string|Object} input
514
- * @return {PrecacheEntry}
515
- */
516
- _parseEntry(input) {
517
- switch (typeof input) {
518
- case 'string':
519
- {
520
- {
521
- if (input.length === 0) {
522
- throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {
523
- entry: input
524
- });
525
- }
526
- }
527
-
528
- return new PrecacheEntry(input, input, input);
529
- }
530
- case 'object':
531
- {
532
- {
533
- if (!input || !input.url) {
534
- throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {
535
- entry: input
536
- });
537
- }
538
- }
539
-
540
- return new PrecacheEntry(input, input.url, input.revision || input.url, !!input.revision);
541
- }
542
- default:
543
- throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-unexpected-type', {
544
- entry: input
545
- });
546
- }
547
- }
548
-
549
- /**
550
- * Adds an entry to the precache list, accounting for possible duplicates.
551
- *
552
- * @private
553
- * @param {PrecacheEntry} entryToAdd
554
- */
555
- _addEntryToCacheList(entryToAdd) {
556
- // Check if the entry is already part of the map
557
- const existingEntry = this._entriesToCacheMap.get(entryToAdd._entryId);
558
- if (!existingEntry) {
559
- this._entriesToCacheMap.set(entryToAdd._entryId, entryToAdd);
560
- return;
561
- }
562
-
563
- // Duplicates are fine, but make sure the revision information
564
- // is the same.
565
- if (existingEntry._revision !== entryToAdd._revision) {
566
- throw new WorkboxError_mjs.WorkboxError('add-to-cache-list-conflicting-entries', {
567
- firstEntry: existingEntry._originalInput,
568
- secondEntry: entryToAdd._originalInput
569
- });
570
- }
571
- }
572
-
573
- /**
574
- * Call this method from a service work install event to start
575
- * precaching assets.
576
- *
577
- * @param {Object} options
578
- * @param {boolean} [options.suppressWarnings] Suppress warning messages.
579
- * @param {Event} [options.event] The install event (if needed).
580
- * @param {Array<Object>} [options.plugins] Plugins to be used for fetching
581
- * and caching during install.
582
- * @return {Promise<workbox.precaching.InstallResult>}
583
- */
584
- install({ suppressWarnings = false, event, plugins } = {}) {
585
- var _this = this;
586
-
587
- return babelHelpers.asyncToGenerator(function* () {
588
- {
589
- if (suppressWarnings !== true) {
590
- showWarningsIfNeeded(_this._entriesToCacheMap);
591
- }
592
-
593
- if (plugins) {
594
- assert_mjs.assert.isArray(plugins, {
595
- moduleName: 'workbox-precaching',
596
- className: 'PrecacheController',
597
- funcName: 'install',
598
- paramName: 'plugins'
599
- });
600
- }
601
- }
602
-
603
- // Empty the temporary cache.
604
- // NOTE: We remove all entries instead of deleting the cache as the cache
605
- // may be marked for deletion but still exist until a later stage
606
- // resulting in unexpected behavior of being deletect when all references
607
- // are dropped.
608
- // https://github.com/GoogleChrome/workbox/issues/1368
609
- const tempCache = yield caches.open(_this._getTempCacheName());
610
- const requests = yield tempCache.keys();
611
- yield Promise.all(requests.map(function (request) {
612
- return tempCache.delete(request);
613
- }));
614
-
615
- const entriesToPrecache = [];
616
- const entriesAlreadyPrecached = [];
617
-
618
- for (const precacheEntry of _this._entriesToCacheMap.values()) {
619
- if (yield _this._precacheDetailsModel._isEntryCached(_this._cacheName, precacheEntry)) {
620
- entriesAlreadyPrecached.push(precacheEntry);
621
- } else {
622
- entriesToPrecache.push(precacheEntry);
623
- }
624
- }
625
-
626
- // Wait for all requests to be cached.
627
- yield Promise.all(entriesToPrecache.map(function (precacheEntry) {
628
- return _this._cacheEntryInTemp({ event, plugins, precacheEntry });
629
- }));
630
-
631
- {
632
- printInstallDetails(entriesToPrecache, entriesAlreadyPrecached);
633
- }
634
-
635
- return {
636
- updatedEntries: entriesToPrecache,
637
- notUpdatedEntries: entriesAlreadyPrecached
638
- };
639
- })();
640
- }
641
-
642
- /**
643
- * Takes the current set of temporary files and moves them to the final
644
- * cache, deleting the temporary cache once copying is complete.
645
- *
646
- * @param {Object} options
647
- * @param {Array<Object>} options.plugins Plugins to be used for fetching
648
- * and caching during install.
649
- * @return {
650
- * Promise<workbox.precaching.CleanupResult>}
651
- * Resolves with an object containing details of the deleted cache requests
652
- * and precache revision details.
653
- */
654
- activate(options = {}) {
655
- var _this2 = this;
656
-
657
- return babelHelpers.asyncToGenerator(function* () {
658
- const tempCache = yield caches.open(_this2._getTempCacheName());
659
-
660
- const requests = yield tempCache.keys();
661
- // Process each request/response one at a time, deleting the temporary entry
662
- // when done, to help avoid triggering quota errors.
663
- for (const request of requests) {
664
- const response = yield tempCache.match(request);
665
- yield cacheWrapper_mjs.cacheWrapper.put({
666
- cacheName: _this2._cacheName,
667
- request,
668
- response,
669
- plugins: options.plugins
670
- });
671
- yield tempCache.delete(request);
672
- }
673
-
674
- return _this2._cleanup();
675
- })();
676
- }
677
-
678
- /**
679
- * Returns the name of the temporary cache.
680
- *
681
- * @return {string}
682
- *
683
- * @private
684
- */
685
- _getTempCacheName() {
686
- return `${this._cacheName}-temp`;
687
- }
688
-
689
- /**
690
- * Requests the entry and saves it to the cache if the response
691
- * is valid.
692
- *
693
- * @private
694
- * @param {Object} options
695
- * @param {BaseCacheEntry} options.precacheEntry The entry to fetch and cache.
696
- * @param {Event} [options.event] The install event (if passed).
697
- * @param {Array<Object>} [options.plugins] An array of plugins to apply to
698
- * fetch and caching.
699
- * @return {Promise<boolean>} Returns a promise that resolves once the entry
700
- * has been fetched and cached or skipped if no update is needed. The
701
- * promise resolves with true if the entry was cached / updated and
702
- * false if the entry is already cached and up-to-date.
703
- */
704
- _cacheEntryInTemp({ precacheEntry, event, plugins }) {
705
- var _this3 = this;
706
-
707
- return babelHelpers.asyncToGenerator(function* () {
708
- let response = yield fetchWrapper_mjs.fetchWrapper.fetch({
709
- request: precacheEntry._networkRequest,
710
- event,
711
- fetchOptions: null,
712
- plugins
713
- });
714
-
715
- if (response.redirected) {
716
- response = yield cleanRedirect(response);
717
- }
718
-
719
- yield cacheWrapper_mjs.cacheWrapper.put({
720
- cacheName: _this3._getTempCacheName(),
721
- request: precacheEntry._cacheRequest,
722
- response,
723
- event,
724
- plugins
725
- });
726
-
727
- yield _this3._precacheDetailsModel._addEntry(precacheEntry);
728
-
729
- return true;
730
- })();
731
- }
732
-
733
- /**
734
- * Compare the URLs and determines which assets are no longer required
735
- * in the cache.
736
- *
737
- * This should be called in the service worker activate event.
738
- *
739
- * @return {
740
- * Promise<workbox.precaching.CleanupResult>}
741
- * Resolves with an object containing details of the deleted cache requests
742
- * and precache revision details.
743
- *
744
- * @private
745
- */
746
- _cleanup() {
747
- var _this4 = this;
748
-
749
- return babelHelpers.asyncToGenerator(function* () {
750
- const expectedCacheUrls = [];
751
- _this4._entriesToCacheMap.forEach(function (entry) {
752
- const fullUrl = new URL(entry._cacheRequest.url, location).toString();
753
- expectedCacheUrls.push(fullUrl);
754
- });
755
-
756
- const [deletedCacheRequests, deletedRevisionDetails] = yield Promise.all([_this4._cleanupCache(expectedCacheUrls), _this4._cleanupDetailsModel(expectedCacheUrls)]);
757
-
758
- {
759
- printCleanupDetails(deletedCacheRequests, deletedRevisionDetails);
760
- }
761
-
762
- return {
763
- deletedCacheRequests,
764
- deletedRevisionDetails
765
- };
766
- })();
767
- }
768
-
769
- /**
770
- * Goes through all the cache entries and removes any that are
771
- * outdated.
772
- *
773
- * @private
774
- * @param {Array<string>} expectedCacheUrls Array of URLs that are
775
- * expected to be cached.
776
- * @return {Promise<Array<string>>} Resolves to an array of URLs
777
- * of cached requests that were deleted.
778
- */
779
- _cleanupCache(expectedCacheUrls) {
780
- var _this5 = this;
781
-
782
- return babelHelpers.asyncToGenerator(function* () {
783
- if (!(yield caches.has(_this5._cacheName))) {
784
- // Cache doesn't exist, so nothing to delete
785
- return [];
786
- }
787
-
788
- const cache = yield caches.open(_this5._cacheName);
789
- const cachedRequests = yield cache.keys();
790
- const cachedRequestsToDelete = cachedRequests.filter(function (cachedRequest) {
791
- return !expectedCacheUrls.includes(new URL(cachedRequest.url, location).toString());
792
- });
793
-
794
- yield Promise.all(cachedRequestsToDelete.map(function (cacheUrl) {
795
- return cache.delete(cacheUrl);
796
- }));
797
-
798
- return cachedRequestsToDelete.map(function (request) {
799
- return request.url;
800
- });
801
- })();
802
- }
803
-
804
- /**
805
- * Goes through all entries in indexedDB and removes any that are outdated.
806
- *
807
- * @private
808
- * @param {Array<string>} expectedCacheUrls Array of URLs that are
809
- * expected to be cached.
810
- * @return {Promise<Array<string>>} Resolves to an array of URLs removed
811
- * from indexedDB.
812
- */
813
- _cleanupDetailsModel(expectedCacheUrls) {
814
- var _this6 = this;
815
-
816
- return babelHelpers.asyncToGenerator(function* () {
817
- const revisionedEntries = yield _this6._precacheDetailsModel._getAllEntries();
818
- const detailsToDelete = revisionedEntries.filter(function (entry) {
819
- const fullUrl = new URL(entry.value.url, location).toString();
820
- return !expectedCacheUrls.includes(fullUrl);
821
- });
822
-
823
- yield Promise.all(detailsToDelete.map(function (entry) {
824
- return _this6._precacheDetailsModel._deleteEntry(entry.primaryKey);
825
- }));
826
- return detailsToDelete.map(function (entry) {
827
- return entry.value.url;
828
- });
829
- })();
830
- }
831
-
832
- /**
833
- * Returns an array of fully qualified URL's that will be precached.
834
- *
835
- * @return {Array<string>} An array of URLs.
836
- */
837
- getCachedUrls() {
838
- return Array.from(this._entriesToCacheMap.keys()).map(url => new URL(url, location).href);
839
- }
840
- }
841
-
842
- /*
843
- Copyright 2017 Google Inc.
844
-
845
- Licensed under the Apache License, Version 2.0 (the "License");
846
- you may not use this file except in compliance with the License.
847
- You may obtain a copy of the License at
848
-
849
- https://www.apache.org/licenses/LICENSE-2.0
850
-
851
- Unless required by applicable law or agreed to in writing, software
852
- distributed under the License is distributed on an "AS IS" BASIS,
853
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
854
- See the License for the specific language governing permissions and
855
- limitations under the License.
856
- */
857
-
858
- var publicAPI = /*#__PURE__*/Object.freeze({
859
- PrecacheController: PrecacheController
860
- });
861
-
862
- /*
863
- Copyright 2017 Google Inc.
864
-
865
- Licensed under the Apache License, Version 2.0 (the "License");
866
- you may not use this file except in compliance with the License.
867
- You may obtain a copy of the License at
868
-
869
- https://www.apache.org/licenses/LICENSE-2.0
870
-
871
- Unless required by applicable law or agreed to in writing, software
872
- distributed under the License is distributed on an "AS IS" BASIS,
873
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
874
- See the License for the specific language governing permissions and
875
- limitations under the License.
876
- */
877
-
878
- {
879
- assert_mjs.assert.isSwEnv('workbox-precaching');
880
- }
881
-
882
- let installActivateListenersAdded = false;
883
- let fetchListenersAdded = false;
884
- let suppressWarnings = false;
885
- let plugins = [];
886
-
887
- const cacheName = cacheNames_mjs.cacheNames.getPrecacheName();
888
- const precacheController = new PrecacheController(cacheName);
889
-
890
- const _removeIgnoreUrlParams = (origUrlObject, ignoreUrlParametersMatching) => {
891
- // Exclude initial '?'
892
- const searchString = origUrlObject.search.slice(1);
893
-
894
- // Split into an array of 'key=value' strings
895
- const keyValueStrings = searchString.split('&');
896
- const keyValuePairs = keyValueStrings.map(keyValueString => {
897
- // Split each 'key=value' string into a [key, value] array
898
- return keyValueString.split('=');
899
- });
900
- const filteredKeyValuesPairs = keyValuePairs.filter(keyValuePair => {
901
- return ignoreUrlParametersMatching.every(ignoredRegex => {
902
- // Return true iff the key doesn't match any of the regexes.
903
- return !ignoredRegex.test(keyValuePair[0]);
904
- });
905
- });
906
- const filteredStrings = filteredKeyValuesPairs.map(keyValuePair => {
907
- // Join each [key, value] array into a 'key=value' string
908
- return keyValuePair.join('=');
909
- });
910
-
911
- // Join the array of 'key=value' strings into a string with '&' in
912
- // between each
913
- const urlClone = new URL(origUrlObject);
914
- urlClone.search = filteredStrings.join('&');
915
- return urlClone;
916
- };
917
-
918
- /**
919
- * This function will take the request URL and manipulate it based on the
920
- * configuration options.
921
- *
922
- * @param {string} url
923
- * @param {Object} options
924
- * @return {string|null} Returns the URL in the cache that matches the request
925
- * if available, other null.
926
- *
927
- * @private
928
- */
929
- const _getPrecachedUrl = (url, {
930
- ignoreUrlParametersMatching = [/^utm_/],
931
- directoryIndex = 'index.html',
932
- cleanUrls = true,
933
- urlManipulation = null
934
- } = {}) => {
935
- const urlObject = new URL(url, location);
936
-
937
- // Change '/some-url#123' => '/some-url'
938
- urlObject.hash = '';
939
-
940
- const urlWithoutIgnoredParams = _removeIgnoreUrlParams(urlObject, ignoreUrlParametersMatching);
941
-
942
- let urlsToAttempt = [
943
- // Test the URL that was fetched
944
- urlObject,
945
- // Test the URL without search params
946
- urlWithoutIgnoredParams];
947
-
948
- // Test the URL with a directory index
949
- if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {
950
- const directoryUrl = new URL(urlWithoutIgnoredParams);
951
- directoryUrl.pathname += directoryIndex;
952
- urlsToAttempt.push(directoryUrl);
953
- }
954
-
955
- // Test the URL with a '.html' extension
956
- if (cleanUrls) {
957
- const cleanUrl = new URL(urlWithoutIgnoredParams);
958
- cleanUrl.pathname += '.html';
959
- urlsToAttempt.push(cleanUrl);
960
- }
961
-
962
- if (urlManipulation) {
963
- const additionalUrls = urlManipulation({ url: urlObject });
964
- urlsToAttempt = urlsToAttempt.concat(additionalUrls);
965
- }
966
-
967
- const cachedUrls = precacheController.getCachedUrls();
968
- for (const possibleUrl of urlsToAttempt) {
969
- if (cachedUrls.indexOf(possibleUrl.href) !== -1) {
970
- // It's a perfect match
971
- {
972
- logger_mjs.logger.debug(`Precaching found a match for ` + getFriendlyURL_mjs.getFriendlyURL(possibleUrl.toString()));
973
- }
974
- return possibleUrl.href;
975
- }
976
- }
977
-
978
- return null;
979
- };
980
-
981
- const moduleExports = {};
982
-
983
- /**
984
- * Add items to the precache list, removing any duplicates and
985
- * store the files in the
986
- * ["precache cache"]{@link module:workbox-core.cacheNames} when the service
987
- * worker installs.
988
- *
989
- * This method can be called multiple times.
990
- *
991
- * Please note: This method **will not** serve any of the cached files for you,
992
- * it only precaches files. To respond to a network request you call
993
- * [addRoute()]{@link module:workbox-precaching.addRoute}.
994
- *
995
- * If you have a single array of files to precache, you can just call
996
- * [precacheAndRoute()]{@link module:workbox-precaching.precacheAndRoute}.
997
- *
998
- * @param {Array<Object|string>} entries Array of entries to precache.
999
- *
1000
- * @alias workbox.precaching.precache
1001
- */
1002
- moduleExports.precache = entries => {
1003
- precacheController.addToCacheList(entries);
1004
-
1005
- if (installActivateListenersAdded || entries.length <= 0) {
1006
- return;
1007
- }
1008
-
1009
- installActivateListenersAdded = true;
1010
- self.addEventListener('install', event => {
1011
- event.waitUntil(precacheController.install({
1012
- event,
1013
- plugins,
1014
- suppressWarnings
1015
- }));
1016
- });
1017
- self.addEventListener('activate', event => {
1018
- event.waitUntil(precacheController.activate({
1019
- event,
1020
- plugins
1021
- }));
1022
- });
1023
- };
1024
-
1025
- /**
1026
- * Add a `fetch` listener to the service worker that will
1027
- * respond to
1028
- * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}
1029
- * with precached assets.
1030
- *
1031
- * Requests for assets that aren't precached, the `FetchEvent` will not be
1032
- * responded to, allowing the event to fall through to other `fetch` event
1033
- * listeners.
1034
- *
1035
- * @param {Object} options
1036
- * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will
1037
- * check cache entries for a URLs ending with '/' to see if there is a hit when
1038
- * appending the `directoryIndex` value.
1039
- * @param {Array<RegExp>} [options.ignoreUrlParametersMatching=[/^utm_/]] An
1040
- * array of regex's to remove search params when looking for a cache match.
1041
- * @param {boolean} [options.cleanUrls=true] The `cleanUrls` option will
1042
- * check the cache for the URL with a `.html` added to the end of the end.
1043
- * @param {workbox.precaching~urlManipulation} [options.urlManipulation]
1044
- * This is a function that should take a URL and return an array of
1045
- * alternative URL's that should be checked for precache matches.
1046
- *
1047
- * @alias workbox.precaching.addRoute
1048
- */
1049
- moduleExports.addRoute = options => {
1050
- if (fetchListenersAdded) {
1051
- // TODO: Throw error here.
1052
- return;
1053
- }
1054
-
1055
- fetchListenersAdded = true;
1056
- self.addEventListener('fetch', event => {
1057
- const precachedUrl = _getPrecachedUrl(event.request.url, options);
1058
- if (!precachedUrl) {
1059
- {
1060
- logger_mjs.logger.debug(`Precaching found no match for ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));
1061
- }
1062
- return;
1063
- }
1064
-
1065
- let responsePromise = caches.open(cacheName).then(cache => {
1066
- return cache.match(precachedUrl);
1067
- }).then(cachedResponse => {
1068
- if (cachedResponse) {
1069
- return cachedResponse;
1070
- }
1071
-
1072
- // Fall back to the network if we don't have a cached response (perhaps
1073
- // due to manual cache cleanup).
1074
- {
1075
- logger_mjs.logger.debug(`The precached response for ` + `${getFriendlyURL_mjs.getFriendlyURL(precachedUrl)} in ${cacheName} was not found. ` + `Falling back to the network instead.`);
1076
- }
1077
-
1078
- return fetch(precachedUrl);
1079
- });
1080
-
1081
- {
1082
- responsePromise = responsePromise.then(response => {
1083
- // Workbox is going to handle the route.
1084
- // print the routing details to the console.
1085
- logger_mjs.logger.groupCollapsed(`Precaching is responding to: ` + getFriendlyURL_mjs.getFriendlyURL(event.request.url));
1086
- logger_mjs.logger.log(`Serving the precached url: ${precachedUrl}`);
1087
-
1088
- // The Request and Response objects contains a great deal of
1089
- // information, hide it under a group in case developers want to see it.
1090
- logger_mjs.logger.groupCollapsed(`View request details here.`);
1091
- logger_mjs.logger.unprefixed.log(event.request);
1092
- logger_mjs.logger.groupEnd();
1093
-
1094
- logger_mjs.logger.groupCollapsed(`View response details here.`);
1095
- logger_mjs.logger.unprefixed.log(response);
1096
- logger_mjs.logger.groupEnd();
1097
-
1098
- logger_mjs.logger.groupEnd();
1099
- return response;
1100
- });
1101
- }
1102
- event.respondWith(responsePromise);
1103
- });
1104
- };
1105
-
1106
- /**
1107
- * This method will add entries to the precache list and add a route to
1108
- * respond to fetch events.
1109
- *
1110
- * This is a convenience method that will call
1111
- * [precache()]{@link module:workbox-precaching.precache} and
1112
- * [addRoute()]{@link module:workbox-precaching.addRoute} in a single call.
1113
- *
1114
- * @param {Array<Object|string>} entries Array of entries to precache.
1115
- * @param {Object} options See
1116
- * [addRoute() options]{@link module:workbox-precaching.addRoute}.
1117
- *
1118
- * @alias workbox.precaching.precacheAndRoute
1119
- */
1120
- moduleExports.precacheAndRoute = (entries, options) => {
1121
- moduleExports.precache(entries);
1122
- moduleExports.addRoute(options);
1123
- };
1124
-
1125
- /**
1126
- * Warnings will be logged if any of the precached assets are entered without
1127
- * a `revision` property. This is extremely dangerous if the URL's aren't
1128
- * revisioned. However, the warnings can be supressed with this method.
1129
- *
1130
- * @param {boolean} suppress
1131
- *
1132
- * @alias workbox.precaching.suppressWarnings
1133
- */
1134
- moduleExports.suppressWarnings = suppress => {
1135
- suppressWarnings = suppress;
1136
- };
1137
-
1138
- /**
1139
- * Add plugins to precaching.
1140
- *
1141
- * @param {Array<Object>} newPlugins
1142
- *
1143
- * @alias workbox.precaching.addPlugins
1144
- */
1145
- moduleExports.addPlugins = newPlugins => {
1146
- plugins = plugins.concat(newPlugins);
1147
- };
1148
-
1149
- /*
1150
- Copyright 2017 Google Inc.
1151
-
1152
- Licensed under the Apache License, Version 2.0 (the "License");
1153
- you may not use this file except in compliance with the License.
1154
- You may obtain a copy of the License at
1155
-
1156
- https://www.apache.org/licenses/LICENSE-2.0
1157
-
1158
- Unless required by applicable law or agreed to in writing, software
1159
- distributed under the License is distributed on an "AS IS" BASIS,
1160
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1161
- See the License for the specific language governing permissions and
1162
- limitations under the License.
1163
- */
1164
-
1165
- const finalExport = Object.assign(moduleExports, publicAPI);
1166
-
1167
- return finalExport;
1168
-
1169
- }(workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private,workbox.core._private));
1170
-
1171
- //# sourceMappingURL=workbox-precaching.dev.js.map