{"version":3,"sources":["../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_version.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/models/messages/messageGenerator.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/WorkboxError.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/cacheNames.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/waitUntil.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/_version.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/createCacheKey.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/PrecacheInstallReportPlugin.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/PrecacheCacheKeyPlugin.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/canConstructResponseFromBodyStream.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/copyResponse.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/getFriendlyURL.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/cacheMatchIgnoreParams.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/Deferred.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/models/quotaErrorCallbacks.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/executeQuotaErrorCallbacks.js","../node_modules/.pnpm/workbox-core@7.4.0/node_modules/workbox-core/_private/timeout.js","../node_modules/.pnpm/workbox-strategies@7.4.0/node_modules/workbox-strategies/_version.js","../node_modules/.pnpm/workbox-strategies@7.4.0/node_modules/workbox-strategies/StrategyHandler.js","../node_modules/.pnpm/workbox-strategies@7.4.0/node_modules/workbox-strategies/Strategy.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/PrecacheStrategy.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/PrecacheController.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/getOrCreatePrecacheController.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/_version.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/utils/constants.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/utils/normalizeHandler.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/Route.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/RegExpRoute.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/Router.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/utils/getOrCreateDefaultRouter.js","../node_modules/.pnpm/workbox-routing@7.4.0/node_modules/workbox-routing/registerRoute.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/removeIgnoredSearchParams.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/generateURLVariations.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/PrecacheRoute.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/addRoute.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/utils/deleteOutdatedCaches.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/cleanupOutdatedCaches.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/precache.js","../node_modules/.pnpm/workbox-precaching@7.4.0/node_modules/workbox-precaching/precacheAndRoute.js","../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/NamespacedValue.js","../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/@types/event.js","../src/app/utils/notificationStyle.ts","../src/sw/pushNotification.ts","../src/sw.ts"],"names":["fallback","code","args","msg","messageGenerator","WorkboxError","errorCode","details","message","_cacheNameDetails","_createCacheName","cacheName","value","eachCacheNameDetail","fn","key","cacheNames","userCacheName","waitUntil","event","asyncFn","returnPromise","REVISION_SEARCH_PARAM","createCacheKey","entry","urlObject","revision","url","cacheKeyURL","originalURL","PrecacheInstallReportPlugin","request","state","cachedResponse","PrecacheCacheKeyPlugin","precacheController","params","cacheKey","supportStatus","canConstructResponseFromBodyStream","testResponse","copyResponse","response","modifier","origin","clonedResponse","modifiedResponseInit","body","getFriendlyURL","stripParams","fullURL","ignoreParams","strippedURL","param","cacheMatchIgnoreParams","cache","matchOptions","strippedRequestURL","keysOptions","cacheKeys","strippedCacheKeyURL","Deferred","resolve","reject","quotaErrorCallbacks","executeQuotaErrorCallbacks","callback","timeout","ms","toRequest","input","StrategyHandler","strategy","options","plugin","possiblePreloadResponse","originalRequest","cb","err","pluginFilteredRequest","fetchResponse","error","responseClone","effectiveRequest","multiMatchOptions","responseToCache","hasCacheUpdateCallback","oldResponse","mode","name","statefulParam","promise","promises","firstRejection","i","pluginsUsed","Strategy","responseDone","handler","handlerDone","waitUntilError","PrecacheStrategy","integrityInManifest","integrityInRequest","noIntegrityConflict","defaultPluginIndex","cacheWillUpdatePluginCount","index","PrecacheController","plugins","fallbackToNetwork","entries","urlsToWarnAbout","cacheMode","warningMessage","installReportPlugin","integrity","updatedURLs","notUpdatedURLs","currentlyCachedRequests","expectedCacheKeys","deletedURLs","getOrCreatePrecacheController","defaultMethod","normalizeHandler","Route","match","method","RegExpRoute","regExp","result","Router","responsePromise","payload","requestPromises","sameOrigin","route","catchHandler","catchErr","routes","matchResult","routeIndex","defaultRouter","getOrCreateDefaultRouter","registerRoute","capture","captureUrl","matchCallback","removeIgnoredSearchParams","ignoreURLParametersMatching","paramName","generateURLVariations","directoryIndex","cleanURLs","urlManipulation","urlWithoutIgnoredParams","directoryURL","cleanURL","additionalURLs","urlToAttempt","PrecacheRoute","urlsToCacheKeys","possibleURL","addRoute","precacheRoute","SUBSTRING_TO_FIND","deleteOutdatedCaches","currentPrecacheName","substringToFind","cacheNamesToDelete","cleanupOutdatedCaches","cachesDeleted","precache","precacheAndRoute","NamespacedValue","stable","unstable","names","altName","val","obj","arr","included","UnstableValue","EventType","DEFAULT_NOTIFICATION_ICON","DEFAULT_NOTIFICATION_BADGE","DEFAULT_MESSAGE_PREVIEW","ENCRYPTED_MESSAGE_PREVIEW","getString","normalized","getBodyFromContent","content","resolveNotificationPreviewText","eventType","isEncryptedRoom","showMessageContent","showEncryptedMessageContent","relatesTo","encryptedContext","toLocalpart","userId","buildRoomMessageNotification","roomName","username","roomAvatar","previewText","silent","eventId","data","recipientId","sender","room","avatar","recipientSuffix","resolveSilent","createPushNotifications","self","getNotificationSettings","showNotificationWithData","title","icon","badge","roomId","tag","notifOptions","handleCallNotification","pushData","senderDisplayName","handleRoomMessageNotification","notificationPayload","handleEncryptedMessageNotification","handleInvitationNotification","notificationSoundEnabled","appIsVisible","clearNotificationsOnRead","handlePushNotificationPushData","SW_SETTINGS_CACHE","SW_SETTINGS_URL","SW_SESSION_CACHE","SW_SESSION_URL","persistSettings","loadPersistedSettings","persistSession","session","clearPersistedSession","loadPersistedSession","sessions","preloadedSession","clientToResolve","clientToSessionPromise","cleanupDeadClients","activeClients","activeIds","c","id","setSession","clientId","accessToken","baseUrl","info","resolveSession","requestSession","client","requestSessionWithTimeout","timeoutMs","sessionPromise","decryptionPendingMap","fetchRawEvent","res","fetchRoomName","fetchMemberInfo","displayname","avatarUrl","fetchRoomAvatar","mxcToNotificationUrl","mxcUrl","server","mediaId","getAnyStoredSession","mxidLocalpart","requestDecryptionFromClient","windowClients","rawEvent","prevPromise","prev","handleMinimalPushPayload","roomNameFromState","roomAvatarMxc","memberInfo","senderDisplay","resolvedRoomName","notificationAvatarUrl","baseData","type","MEDIA_PATHS","mediaPath","pathname","p","validMediaRequest","validUrl","fetchConfig","token","fetchOptions","redirect","byBaseUrl","s","persisted","isMinimalPushPayload","d","onPushNotification","clients","hasVisibleClient","n","scope","pushUserId","pushRoomId","pushEventId","isInvite","isCall","targetUrl","u","callParam","segments","clientList","wc"],"mappings":"AAEA,GAAI,CACA,KAAK,oBAAoB,GAAK,EAAC,CACnC,MACU,CAAE,CCIZ,MAAM,GAAW,CAAC,KAAS,IAAS,CAChC,IAAI,EAAM,EACV,OAAI,EAAK,OAAS,IACd,GAAO,OAAO,KAAK,UAAU,CAAI,CAAC,IAE/B,CACX,EAQa,GAA2D,GCLxE,MAAM,UAAqB,KAAM,CAS7B,YAAY,EAAW,EAAS,CAC5B,MAAM,EAAU,GAAiB,EAAW,CAAO,EACnD,MAAM,CAAO,EACb,KAAK,KAAO,EACZ,KAAK,QAAU,CACnB,CACJ,CCzBA,MAAM,EAAoB,CACtB,gBAAiB,kBACjB,SAAU,cACV,OAAQ,UACR,QAAS,UACT,OAAQ,OAAO,aAAiB,IAAc,aAAa,MAAQ,EACvE,EACM,EAAoB,GACf,CAAC,EAAkB,OAAQ,EAAW,EAAkB,MAAM,EAChE,OAAQ,GAAU,GAAS,EAAM,OAAS,CAAC,EAC3C,KAAK,GAAG,EAEX,GAAuB,GAAO,CAChC,UAAW,KAAO,OAAO,KAAK,CAAiB,EAC3C,EAAG,CAAG,CAEd,EACa,EAAa,CACtB,cAAgB,GAAY,CACxB,GAAqB,GAAQ,CACrB,OAAO,EAAQ,CAAG,GAAM,WACxB,EAAkB,CAAG,EAAI,EAAQ,CAAG,EAE5C,CAAC,CACL,EACA,uBAAyB,GACd,GAAiB,EAAiB,EAAkB,eAAe,EAE9E,gBAAkB,GACP,GAAiB,EAAiB,EAAkB,QAAQ,EAEvE,UAAW,IACA,EAAkB,OAE7B,eAAiB,GACN,GAAiB,EAAiB,EAAkB,OAAO,EAEtE,UAAW,IACA,EAAkB,MAEjC,EChCA,SAAS,EAAU,EAAO,EAAS,CAC/B,MAAM,EAAgB,EAAO,EAC7B,OAAA,EAAM,UAA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AAK,EAAE,IACvC,MAEE,EAAY,IAAI,IAAI,uBAAwB,CAAK,EAAE,KAGrD,QAAQ,MAAM,oCAAqC,CAAS,EAE5D,EAAM,WACH,SAAY,CACX,MAAM,EAAc,MAAM,KAAK,QAAQ,SAAS,CAC9C,KAAM,SACN,oBAAqB,EAAA,CACtB,EAED,QAAQ,MACN,yCACA,EAAW,IAAK,IAAO,CACrB,IAAK,EAAE,IACP,WAAY,EAAE,gBACd,QAAS,EAAE,OAAA,EACX,CAAA,EAGJ,UAAW,KAAM,EAAY,CAC3B,QAAQ,MAAM,yDAA0D,EAAG,GAAG,EAC9E,GAAI,CAKF,EAAG,YAAY,CACb,KAAM,oBACN,OAAQ,EACR,OAAQ,EACR,QAAS,EACT,SAAA,EACA,OAAA,CAAA,CACD,EAED,MAAM,EAAG,MAAA,EACT,MACF,OAAS,EAAK,CACZ,QAAQ,MAAM,mDAAoD,CAAG,CACvE,CACF,CAIA,QAAQ,MAAM,sDAAuD,CAAS,EAC1E,KAAK,QAAQ,YACf,MAAM,KAAK,QAAQ,WAAW,CAAS,CAE3C,GAAA,CAAG,CAEP,CAAC,EAED,GAAiB,qmBAAK,aAAa,EACnC,GAAA","file":"sw.js","sourcesContent":["\"use strict\";\n// @ts-ignore\ntry {\n    self['workbox:core:7.3.0'] && _();\n}\ncatch (e) { }\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { messages } from './messages.js';\nimport '../../_version.js';\nconst fallback = (code, ...args) => {\n    let msg = code;\n    if (args.length > 0) {\n        msg += ` :: ${JSON.stringify(args)}`;\n    }\n    return msg;\n};\nconst generatorFunction = (code, details = {}) => {\n    const message = messages[code];\n    if (!message) {\n        throw new Error(`Unable to find message for code '${code}'.`);\n    }\n    return message(details);\n};\nexport const messageGenerator = process.env.NODE_ENV === 'production' ? fallback : generatorFunction;\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { messageGenerator } from '../models/messages/messageGenerator.js';\nimport '../_version.js';\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 */\nclass 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        const message = messageGenerator(errorCode, details);\n        super(message);\n        this.name = errorCode;\n        this.details = details;\n    }\n}\nexport { WorkboxError };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst _cacheNameDetails = {\n    googleAnalytics: 'googleAnalytics',\n    precache: 'precache-v2',\n    prefix: 'workbox',\n    runtime: 'runtime',\n    suffix: typeof registration !== 'undefined' ? registration.scope : '',\n};\nconst _createCacheName = (cacheName) => {\n    return [_cacheNameDetails.prefix, cacheName, _cacheNameDetails.suffix]\n        .filter((value) => value && value.length > 0)\n        .join('-');\n};\nconst eachCacheNameDetail = (fn) => {\n    for (const key of Object.keys(_cacheNameDetails)) {\n        fn(key);\n    }\n};\nexport const cacheNames = {\n    updateDetails: (details) => {\n        eachCacheNameDetail((key) => {\n            if (typeof details[key] === 'string') {\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    getPrefix: () => {\n        return _cacheNameDetails.prefix;\n    },\n    getRuntimeName: (userCacheName) => {\n        return userCacheName || _createCacheName(_cacheNameDetails.runtime);\n    },\n    getSuffix: () => {\n        return _cacheNameDetails.suffix;\n    },\n};\n","/*\n  Copyright 2020 Google LLC\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A utility method that makes it easier to use `event.waitUntil` with\n * async functions and return the result.\n *\n * @param {ExtendableEvent} event\n * @param {Function} asyncFn\n * @return {Function}\n * @private\n */\nfunction waitUntil(event, asyncFn) {\n    const returnPromise = asyncFn();\n    event.waitUntil(returnPromise);\n    return returnPromise;\n}\nexport { waitUntil };\n","\"use strict\";\n// @ts-ignore\ntry {\n    self['workbox:precaching:7.3.0'] && _();\n}\ncatch (e) { }\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport '../_version.js';\n// Name of the search parameter used to store revision info.\nconst REVISION_SEARCH_PARAM = '__WB_REVISION__';\n/**\n * Converts a manifest entry into a versioned URL suitable for precaching.\n *\n * @param {Object|string} entry\n * @return {string} A URL with versioning info.\n *\n * @private\n * @memberof workbox-precaching\n */\nexport function createCacheKey(entry) {\n    if (!entry) {\n        throw new WorkboxError('add-to-cache-list-unexpected-type', { entry });\n    }\n    // If a precache manifest entry is a string, it's assumed to be a versioned\n    // URL, like '/app.abcd1234.js'. Return as-is.\n    if (typeof entry === 'string') {\n        const urlObject = new URL(entry, location.href);\n        return {\n            cacheKey: urlObject.href,\n            url: urlObject.href,\n        };\n    }\n    const { revision, url } = entry;\n    if (!url) {\n        throw new WorkboxError('add-to-cache-list-unexpected-type', { entry });\n    }\n    // If there's just a URL and no revision, then it's also assumed to be a\n    // versioned URL.\n    if (!revision) {\n        const urlObject = new URL(url, location.href);\n        return {\n            cacheKey: urlObject.href,\n            url: urlObject.href,\n        };\n    }\n    // Otherwise, construct a properly versioned URL using the custom Workbox\n    // search parameter along with the revision info.\n    const cacheKeyURL = new URL(url, location.href);\n    const originalURL = new URL(url, location.href);\n    cacheKeyURL.searchParams.set(REVISION_SEARCH_PARAM, revision);\n    return {\n        cacheKey: cacheKeyURL.href,\n        url: originalURL.href,\n    };\n}\n","/*\n  Copyright 2020 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A plugin, designed to be used with PrecacheController, to determine the\n * of assets that were updated (or not updated) during the install event.\n *\n * @private\n */\nclass PrecacheInstallReportPlugin {\n    constructor() {\n        this.updatedURLs = [];\n        this.notUpdatedURLs = [];\n        this.handlerWillStart = async ({ request, state, }) => {\n            // TODO: `state` should never be undefined...\n            if (state) {\n                state.originalRequest = request;\n            }\n        };\n        this.cachedResponseWillBeUsed = async ({ event, state, cachedResponse, }) => {\n            if (event.type === 'install') {\n                if (state &&\n                    state.originalRequest &&\n                    state.originalRequest instanceof Request) {\n                    // TODO: `state` should never be undefined...\n                    const url = state.originalRequest.url;\n                    if (cachedResponse) {\n                        this.notUpdatedURLs.push(url);\n                    }\n                    else {\n                        this.updatedURLs.push(url);\n                    }\n                }\n            }\n            return cachedResponse;\n        };\n    }\n}\nexport { PrecacheInstallReportPlugin };\n","/*\n  Copyright 2020 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * A plugin, designed to be used with PrecacheController, to translate URLs into\n * the corresponding cache key, based on the current revision info.\n *\n * @private\n */\nclass PrecacheCacheKeyPlugin {\n    constructor({ precacheController }) {\n        this.cacheKeyWillBeUsed = async ({ request, params, }) => {\n            // Params is type any, can't change right now.\n            /* eslint-disable */\n            const cacheKey = (params === null || params === void 0 ? void 0 : params.cacheKey) ||\n                this._precacheController.getCacheKeyForURL(request.url);\n            /* eslint-enable */\n            return cacheKey\n                ? new Request(cacheKey, { headers: request.headers })\n                : request;\n        };\n        this._precacheController = precacheController;\n    }\n}\nexport { PrecacheCacheKeyPlugin };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nlet supportStatus;\n/**\n * A utility function that determines whether the current browser supports\n * constructing a new `Response` from a `response.body` stream.\n *\n * @return {boolean} `true`, if the current browser can successfully\n *     construct a `Response` from a `response.body` stream, `false` otherwise.\n *\n * @private\n */\nfunction canConstructResponseFromBodyStream() {\n    if (supportStatus === undefined) {\n        const testResponse = new Response('');\n        if ('body' in testResponse) {\n            try {\n                new Response(testResponse.body);\n                supportStatus = true;\n            }\n            catch (error) {\n                supportStatus = false;\n            }\n        }\n        supportStatus = false;\n    }\n    return supportStatus;\n}\nexport { canConstructResponseFromBodyStream };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { canConstructResponseFromBodyStream } from './_private/canConstructResponseFromBodyStream.js';\nimport { WorkboxError } from './_private/WorkboxError.js';\nimport './_version.js';\n/**\n * Allows developers to copy a response and modify its `headers`, `status`,\n * or `statusText` values (the values settable via a\n * [`ResponseInit`]{@link https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#Syntax}\n * object in the constructor).\n * To modify these values, pass a function as the second argument. That\n * function will be invoked with a single object with the response properties\n * `{headers, status, statusText}`. The return value of this function will\n * be used as the `ResponseInit` for the new `Response`. To change the values\n * either modify the passed parameter(s) and return it, or return a totally\n * new object.\n *\n * This method is intentionally limited to same-origin responses, regardless of\n * whether CORS was used or not.\n *\n * @param {Response} response\n * @param {Function} modifier\n * @memberof workbox-core\n */\nasync function copyResponse(response, modifier) {\n    let origin = null;\n    // If response.url isn't set, assume it's cross-origin and keep origin null.\n    if (response.url) {\n        const responseURL = new URL(response.url);\n        origin = responseURL.origin;\n    }\n    if (origin !== self.location.origin) {\n        throw new WorkboxError('cross-origin-copy-response', { origin });\n    }\n    const clonedResponse = response.clone();\n    // Create a fresh `ResponseInit` object by cloning the headers.\n    const responseInit = {\n        headers: new Headers(clonedResponse.headers),\n        status: clonedResponse.status,\n        statusText: clonedResponse.statusText,\n    };\n    // Apply any user modifications.\n    const modifiedResponseInit = modifier ? modifier(responseInit) : responseInit;\n    // Create the new response from the body stream and `ResponseInit`\n    // modifications. Note: not all browsers support the Response.body stream,\n    // so fall back to reading the entire body into memory as a blob.\n    const body = canConstructResponseFromBodyStream()\n        ? clonedResponse.body\n        : await clonedResponse.blob();\n    return new Response(body, modifiedResponseInit);\n}\nexport { copyResponse };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst getFriendlyURL = (url) => {\n    const urlObj = new URL(String(url), location.href);\n    // See https://github.com/GoogleChrome/workbox/issues/2323\n    // We want to include everything, except for the origin if it's same-origin.\n    return urlObj.href.replace(new RegExp(`^${location.origin}`), '');\n};\nexport { getFriendlyURL };\n","/*\n  Copyright 2020 Google LLC\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nfunction stripParams(fullURL, ignoreParams) {\n    const strippedURL = new URL(fullURL);\n    for (const param of ignoreParams) {\n        strippedURL.searchParams.delete(param);\n    }\n    return strippedURL.href;\n}\n/**\n * Matches an item in the cache, ignoring specific URL params. This is similar\n * to the `ignoreSearch` option, but it allows you to ignore just specific\n * params (while continuing to match on the others).\n *\n * @private\n * @param {Cache} cache\n * @param {Request} request\n * @param {Object} matchOptions\n * @param {Array<string>} ignoreParams\n * @return {Promise<Response|undefined>}\n */\nasync function cacheMatchIgnoreParams(cache, request, ignoreParams, matchOptions) {\n    const strippedRequestURL = stripParams(request.url, ignoreParams);\n    // If the request doesn't include any ignored params, match as normal.\n    if (request.url === strippedRequestURL) {\n        return cache.match(request, matchOptions);\n    }\n    // Otherwise, match by comparing keys\n    const keysOptions = Object.assign(Object.assign({}, matchOptions), { ignoreSearch: true });\n    const cacheKeys = await cache.keys(request, keysOptions);\n    for (const cacheKey of cacheKeys) {\n        const strippedCacheKeyURL = stripParams(cacheKey.url, ignoreParams);\n        if (strippedRequestURL === strippedCacheKeyURL) {\n            return cache.match(cacheKey, matchOptions);\n        }\n    }\n    return;\n}\nexport { cacheMatchIgnoreParams };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The Deferred class composes Promises in a way that allows for them to be\n * resolved or rejected from outside the constructor. In most cases promises\n * should be used directly, but Deferreds can be necessary when the logic to\n * resolve a promise must be separate.\n *\n * @private\n */\nclass Deferred {\n    /**\n     * Creates a promise and exposes its resolve and reject functions as methods.\n     */\n    constructor() {\n        this.promise = new Promise((resolve, reject) => {\n            this.resolve = resolve;\n            this.reject = reject;\n        });\n    }\n}\nexport { Deferred };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n// Callbacks to be executed whenever there's a quota error.\n// Can't change Function type right now.\n// eslint-disable-next-line @typescript-eslint/ban-types\nconst quotaErrorCallbacks = new Set();\nexport { quotaErrorCallbacks };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { logger } from '../_private/logger.js';\nimport { quotaErrorCallbacks } from '../models/quotaErrorCallbacks.js';\nimport '../_version.js';\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 */\nasync function executeQuotaErrorCallbacks() {\n    if (process.env.NODE_ENV !== 'production') {\n        logger.log(`About to run ${quotaErrorCallbacks.size} ` +\n            `callbacks to clean up caches.`);\n    }\n    for (const callback of quotaErrorCallbacks) {\n        await callback();\n        if (process.env.NODE_ENV !== 'production') {\n            logger.log(callback, 'is complete.');\n        }\n    }\n    if (process.env.NODE_ENV !== 'production') {\n        logger.log('Finished running callbacks.');\n    }\n}\nexport { executeQuotaErrorCallbacks };\n","/*\n  Copyright 2019 Google LLC\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Returns a promise that resolves and the passed number of milliseconds.\n * This utility is an async/await-friendly version of `setTimeout`.\n *\n * @param {number} ms\n * @return {Promise}\n * @private\n */\nexport function timeout(ms) {\n    return new Promise((resolve) => setTimeout(resolve, ms));\n}\n","\"use strict\";\n// @ts-ignore\ntry {\n    self['workbox:strategies:7.3.0'] && _();\n}\ncatch (e) { }\n","/*\n  Copyright 2020 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheMatchIgnoreParams } from 'workbox-core/_private/cacheMatchIgnoreParams.js';\nimport { Deferred } from 'workbox-core/_private/Deferred.js';\nimport { executeQuotaErrorCallbacks } from 'workbox-core/_private/executeQuotaErrorCallbacks.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { timeout } from 'workbox-core/_private/timeout.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport './_version.js';\nfunction toRequest(input) {\n    return typeof input === 'string' ? new Request(input) : input;\n}\n/**\n * A class created every time a Strategy instance calls\n * {@link workbox-strategies.Strategy~handle} or\n * {@link workbox-strategies.Strategy~handleAll} that wraps all fetch and\n * cache actions around plugin callbacks and keeps track of when the strategy\n * is \"done\" (i.e. all added `event.waitUntil()` promises have resolved).\n *\n * @memberof workbox-strategies\n */\nclass StrategyHandler {\n    /**\n     * Creates a new instance associated with the passed strategy and event\n     * that's handling the request.\n     *\n     * The constructor also initializes the state that will be passed to each of\n     * the plugins handling this request.\n     *\n     * @param {workbox-strategies.Strategy} strategy\n     * @param {Object} options\n     * @param {Request|string} options.request A request to run this strategy for.\n     * @param {ExtendableEvent} options.event The event associated with the\n     *     request.\n     * @param {URL} [options.url]\n     * @param {*} [options.params] The return value from the\n     *     {@link workbox-routing~matchCallback} (if applicable).\n     */\n    constructor(strategy, options) {\n        this._cacheKeys = {};\n        /**\n         * The request the strategy is performing (passed to the strategy's\n         * `handle()` or `handleAll()` method).\n         * @name request\n         * @instance\n         * @type {Request}\n         * @memberof workbox-strategies.StrategyHandler\n         */\n        /**\n         * The event associated with this request.\n         * @name event\n         * @instance\n         * @type {ExtendableEvent}\n         * @memberof workbox-strategies.StrategyHandler\n         */\n        /**\n         * A `URL` instance of `request.url` (if passed to the strategy's\n         * `handle()` or `handleAll()` method).\n         * Note: the `url` param will be present if the strategy was invoked\n         * from a workbox `Route` object.\n         * @name url\n         * @instance\n         * @type {URL|undefined}\n         * @memberof workbox-strategies.StrategyHandler\n         */\n        /**\n         * A `param` value (if passed to the strategy's\n         * `handle()` or `handleAll()` method).\n         * Note: the `param` param will be present if the strategy was invoked\n         * from a workbox `Route` object and the\n         * {@link workbox-routing~matchCallback} returned\n         * a truthy value (it will be that value).\n         * @name params\n         * @instance\n         * @type {*|undefined}\n         * @memberof workbox-strategies.StrategyHandler\n         */\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isInstance(options.event, ExtendableEvent, {\n                moduleName: 'workbox-strategies',\n                className: 'StrategyHandler',\n                funcName: 'constructor',\n                paramName: 'options.event',\n            });\n        }\n        Object.assign(this, options);\n        this.event = options.event;\n        this._strategy = strategy;\n        this._handlerDeferred = new Deferred();\n        this._extendLifetimePromises = [];\n        // Copy the plugins list (since it's mutable on the strategy),\n        // so any mutations don't affect this handler instance.\n        this._plugins = [...strategy.plugins];\n        this._pluginStateMap = new Map();\n        for (const plugin of this._plugins) {\n            this._pluginStateMap.set(plugin, {});\n        }\n        this.event.waitUntil(this._handlerDeferred.promise);\n    }\n    /**\n     * Fetches a given request (and invokes any applicable plugin callback\n     * methods) using the `fetchOptions` (for non-navigation requests) and\n     * `plugins` defined on the `Strategy` object.\n     *\n     * The following plugin lifecycle methods are invoked when using this method:\n     * - `requestWillFetch()`\n     * - `fetchDidSucceed()`\n     * - `fetchDidFail()`\n     *\n     * @param {Request|string} input The URL or request to fetch.\n     * @return {Promise<Response>}\n     */\n    async fetch(input) {\n        const { event } = this;\n        let request = toRequest(input);\n        if (request.mode === 'navigate' &&\n            event instanceof FetchEvent &&\n            event.preloadResponse) {\n            const possiblePreloadResponse = (await event.preloadResponse);\n            if (possiblePreloadResponse) {\n                if (process.env.NODE_ENV !== 'production') {\n                    logger.log(`Using a preloaded navigation response for ` +\n                        `'${getFriendlyURL(request.url)}'`);\n                }\n                return possiblePreloadResponse;\n            }\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 = this.hasCallback('fetchDidFail')\n            ? request.clone()\n            : null;\n        try {\n            for (const cb of this.iterateCallbacks('requestWillFetch')) {\n                request = await cb({ request: request.clone(), event });\n            }\n        }\n        catch (err) {\n            if (err instanceof Error) {\n                throw new WorkboxError('plugin-error-request-will-fetch', {\n                    thrownErrorMessage: err.message,\n                });\n            }\n        }\n        // The request can be altered by plugins with `requestWillFetch` making\n        // the original request (most likely from a `fetch` event) different\n        // from the Request we make. Pass both to `fetchDidFail` to aid debugging.\n        const pluginFilteredRequest = request.clone();\n        try {\n            let fetchResponse;\n            // See https://github.com/GoogleChrome/workbox/issues/1796\n            fetchResponse = await fetch(request, request.mode === 'navigate' ? undefined : this._strategy.fetchOptions);\n            if (process.env.NODE_ENV !== 'production') {\n                logger.debug(`Network request for ` +\n                    `'${getFriendlyURL(request.url)}' returned a response with ` +\n                    `status '${fetchResponse.status}'.`);\n            }\n            for (const callback of this.iterateCallbacks('fetchDidSucceed')) {\n                fetchResponse = await callback({\n                    event,\n                    request: pluginFilteredRequest,\n                    response: fetchResponse,\n                });\n            }\n            return fetchResponse;\n        }\n        catch (error) {\n            if (process.env.NODE_ENV !== 'production') {\n                logger.log(`Network request for ` +\n                    `'${getFriendlyURL(request.url)}' threw an error.`, error);\n            }\n            // `originalRequest` will only exist if a `fetchDidFail` callback\n            // is being used (see above).\n            if (originalRequest) {\n                await this.runCallbacks('fetchDidFail', {\n                    error: error,\n                    event,\n                    originalRequest: originalRequest.clone(),\n                    request: pluginFilteredRequest.clone(),\n                });\n            }\n            throw error;\n        }\n    }\n    /**\n     * Calls `this.fetch()` and (in the background) runs `this.cachePut()` on\n     * the response generated by `this.fetch()`.\n     *\n     * The call to `this.cachePut()` automatically invokes `this.waitUntil()`,\n     * so you do not have to manually call `waitUntil()` on the event.\n     *\n     * @param {Request|string} input The request or URL to fetch and cache.\n     * @return {Promise<Response>}\n     */\n    async fetchAndCachePut(input) {\n        const response = await this.fetch(input);\n        const responseClone = response.clone();\n        void this.waitUntil(this.cachePut(input, responseClone));\n        return response;\n    }\n    /**\n     * Matches a request from the cache (and invokes any applicable plugin\n     * callback methods) using the `cacheName`, `matchOptions`, and `plugins`\n     * defined on the strategy object.\n     *\n     * The following plugin lifecycle methods are invoked when using this method:\n     * - cacheKeyWillBeUsed()\n     * - cachedResponseWillBeUsed()\n     *\n     * @param {Request|string} key The Request or URL to use as the cache key.\n     * @return {Promise<Response|undefined>} A matching response, if found.\n     */\n    async cacheMatch(key) {\n        const request = toRequest(key);\n        let cachedResponse;\n        const { cacheName, matchOptions } = this._strategy;\n        const effectiveRequest = await this.getCacheKey(request, 'read');\n        const multiMatchOptions = Object.assign(Object.assign({}, matchOptions), { cacheName });\n        cachedResponse = await caches.match(effectiveRequest, multiMatchOptions);\n        if (process.env.NODE_ENV !== 'production') {\n            if (cachedResponse) {\n                logger.debug(`Found a cached response in '${cacheName}'.`);\n            }\n            else {\n                logger.debug(`No cached response found in '${cacheName}'.`);\n            }\n        }\n        for (const callback of this.iterateCallbacks('cachedResponseWillBeUsed')) {\n            cachedResponse =\n                (await callback({\n                    cacheName,\n                    matchOptions,\n                    cachedResponse,\n                    request: effectiveRequest,\n                    event: this.event,\n                })) || undefined;\n        }\n        return cachedResponse;\n    }\n    /**\n     * Puts a request/response pair in the cache (and invokes any applicable\n     * plugin callback methods) using the `cacheName` and `plugins` defined on\n     * the strategy object.\n     *\n     * The following plugin lifecycle methods are invoked when using this method:\n     * - cacheKeyWillBeUsed()\n     * - cacheWillUpdate()\n     * - cacheDidUpdate()\n     *\n     * @param {Request|string} key The request or URL to use as the cache key.\n     * @param {Response} response The response to cache.\n     * @return {Promise<boolean>} `false` if a cacheWillUpdate caused the response\n     * not be cached, and `true` otherwise.\n     */\n    async cachePut(key, response) {\n        const request = toRequest(key);\n        // Run in the next task to avoid blocking other cache reads.\n        // https://github.com/w3c/ServiceWorker/issues/1397\n        await timeout(0);\n        const effectiveRequest = await this.getCacheKey(request, 'write');\n        if (process.env.NODE_ENV !== 'production') {\n            if (effectiveRequest.method && effectiveRequest.method !== 'GET') {\n                throw new WorkboxError('attempt-to-cache-non-get-request', {\n                    url: getFriendlyURL(effectiveRequest.url),\n                    method: effectiveRequest.method,\n                });\n            }\n            // See https://github.com/GoogleChrome/workbox/issues/2818\n            const vary = response.headers.get('Vary');\n            if (vary) {\n                logger.debug(`The response for ${getFriendlyURL(effectiveRequest.url)} ` +\n                    `has a 'Vary: ${vary}' header. ` +\n                    `Consider setting the {ignoreVary: true} option on your strategy ` +\n                    `to ensure cache matching and deletion works as expected.`);\n            }\n        }\n        if (!response) {\n            if (process.env.NODE_ENV !== 'production') {\n                logger.error(`Cannot cache non-existent response for ` +\n                    `'${getFriendlyURL(effectiveRequest.url)}'.`);\n            }\n            throw new WorkboxError('cache-put-with-no-response', {\n                url: getFriendlyURL(effectiveRequest.url),\n            });\n        }\n        const responseToCache = await this._ensureResponseSafeToCache(response);\n        if (!responseToCache) {\n            if (process.env.NODE_ENV !== 'production') {\n                logger.debug(`Response '${getFriendlyURL(effectiveRequest.url)}' ` +\n                    `will not be cached.`, responseToCache);\n            }\n            return false;\n        }\n        const { cacheName, matchOptions } = this._strategy;\n        const cache = await self.caches.open(cacheName);\n        const hasCacheUpdateCallback = this.hasCallback('cacheDidUpdate');\n        const oldResponse = hasCacheUpdateCallback\n            ? await cacheMatchIgnoreParams(\n            // TODO(philipwalton): the `__WB_REVISION__` param is a precaching\n            // feature. Consider into ways to only add this behavior if using\n            // precaching.\n            cache, effectiveRequest.clone(), ['__WB_REVISION__'], matchOptions)\n            : null;\n        if (process.env.NODE_ENV !== 'production') {\n            logger.debug(`Updating the '${cacheName}' cache with a new Response ` +\n                `for ${getFriendlyURL(effectiveRequest.url)}.`);\n        }\n        try {\n            await cache.put(effectiveRequest, hasCacheUpdateCallback ? responseToCache.clone() : responseToCache);\n        }\n        catch (error) {\n            if (error instanceof Error) {\n                // See https://developer.mozilla.org/en-US/docs/Web/API/DOMException#exception-QuotaExceededError\n                if (error.name === 'QuotaExceededError') {\n                    await executeQuotaErrorCallbacks();\n                }\n                throw error;\n            }\n        }\n        for (const callback of this.iterateCallbacks('cacheDidUpdate')) {\n            await callback({\n                cacheName,\n                oldResponse,\n                newResponse: responseToCache.clone(),\n                request: effectiveRequest,\n                event: this.event,\n            });\n        }\n        return true;\n    }\n    /**\n     * Checks the list of plugins for the `cacheKeyWillBeUsed` callback, and\n     * executes any of those callbacks found in sequence. The final `Request`\n     * object returned by the last plugin is treated as the cache key for cache\n     * reads and/or writes. If no `cacheKeyWillBeUsed` plugin callbacks have\n     * been registered, the passed request is returned unmodified\n     *\n     * @param {Request} request\n     * @param {string} mode\n     * @return {Promise<Request>}\n     */\n    async getCacheKey(request, mode) {\n        const key = `${request.url} | ${mode}`;\n        if (!this._cacheKeys[key]) {\n            let effectiveRequest = request;\n            for (const callback of this.iterateCallbacks('cacheKeyWillBeUsed')) {\n                effectiveRequest = toRequest(await callback({\n                    mode,\n                    request: effectiveRequest,\n                    event: this.event,\n                    // params has a type any can't change right now.\n                    params: this.params, // eslint-disable-line\n                }));\n            }\n            this._cacheKeys[key] = effectiveRequest;\n        }\n        return this._cacheKeys[key];\n    }\n    /**\n     * Returns true if the strategy has at least one plugin with the given\n     * callback.\n     *\n     * @param {string} name The name of the callback to check for.\n     * @return {boolean}\n     */\n    hasCallback(name) {\n        for (const plugin of this._strategy.plugins) {\n            if (name in plugin) {\n                return true;\n            }\n        }\n        return false;\n    }\n    /**\n     * Runs all plugin callbacks matching the given name, in order, passing the\n     * given param object (merged ith the current plugin state) as the only\n     * argument.\n     *\n     * Note: since this method runs all plugins, it's not suitable for cases\n     * where the return value of a callback needs to be applied prior to calling\n     * the next callback. See\n     * {@link workbox-strategies.StrategyHandler#iterateCallbacks}\n     * below for how to handle that case.\n     *\n     * @param {string} name The name of the callback to run within each plugin.\n     * @param {Object} param The object to pass as the first (and only) param\n     *     when executing each callback. This object will be merged with the\n     *     current plugin state prior to callback execution.\n     */\n    async runCallbacks(name, param) {\n        for (const callback of this.iterateCallbacks(name)) {\n            // TODO(philipwalton): not sure why `any` is needed. It seems like\n            // this should work with `as WorkboxPluginCallbackParam[C]`.\n            await callback(param);\n        }\n    }\n    /**\n     * Accepts a callback and returns an iterable of matching plugin callbacks,\n     * where each callback is wrapped with the current handler state (i.e. when\n     * you call each callback, whatever object parameter you pass it will\n     * be merged with the plugin's current state).\n     *\n     * @param {string} name The name fo the callback to run\n     * @return {Array<Function>}\n     */\n    *iterateCallbacks(name) {\n        for (const plugin of this._strategy.plugins) {\n            if (typeof plugin[name] === 'function') {\n                const state = this._pluginStateMap.get(plugin);\n                const statefulCallback = (param) => {\n                    const statefulParam = Object.assign(Object.assign({}, param), { state });\n                    // TODO(philipwalton): not sure why `any` is needed. It seems like\n                    // this should work with `as WorkboxPluginCallbackParam[C]`.\n                    return plugin[name](statefulParam);\n                };\n                yield statefulCallback;\n            }\n        }\n    }\n    /**\n     * Adds a promise to the\n     * [extend lifetime promises]{@link https://w3c.github.io/ServiceWorker/#extendableevent-extend-lifetime-promises}\n     * of the event associated with the request being handled (usually a\n     * `FetchEvent`).\n     *\n     * Note: you can await\n     * {@link workbox-strategies.StrategyHandler~doneWaiting}\n     * to know when all added promises have settled.\n     *\n     * @param {Promise} promise A promise to add to the extend lifetime promises\n     *     of the event that triggered the request.\n     */\n    waitUntil(promise) {\n        this._extendLifetimePromises.push(promise);\n        return promise;\n    }\n    /**\n     * Returns a promise that resolves once all promises passed to\n     * {@link workbox-strategies.StrategyHandler~waitUntil}\n     * have settled.\n     *\n     * Note: any work done after `doneWaiting()` settles should be manually\n     * passed to an event's `waitUntil()` method (not this handler's\n     * `waitUntil()` method), otherwise the service worker thread may be killed\n     * prior to your work completing.\n     */\n    async doneWaiting() {\n        while (this._extendLifetimePromises.length) {\n            const promises = this._extendLifetimePromises.splice(0);\n            const result = await Promise.allSettled(promises);\n            const firstRejection = result.find((i) => i.status === 'rejected');\n            if (firstRejection) {\n                throw firstRejection.reason;\n            }\n        }\n    }\n    /**\n     * Stops running the strategy and immediately resolves any pending\n     * `waitUntil()` promises.\n     */\n    destroy() {\n        this._handlerDeferred.resolve(null);\n    }\n    /**\n     * This method will call cacheWillUpdate on the available plugins (or use\n     * status === 200) to determine if the Response is safe and valid to cache.\n     *\n     * @param {Request} options.request\n     * @param {Response} options.response\n     * @return {Promise<Response|undefined>}\n     *\n     * @private\n     */\n    async _ensureResponseSafeToCache(response) {\n        let responseToCache = response;\n        let pluginsUsed = false;\n        for (const callback of this.iterateCallbacks('cacheWillUpdate')) {\n            responseToCache =\n                (await callback({\n                    request: this.request,\n                    response: responseToCache,\n                    event: this.event,\n                })) || undefined;\n            pluginsUsed = true;\n            if (!responseToCache) {\n                break;\n            }\n        }\n        if (!pluginsUsed) {\n            if (responseToCache && responseToCache.status !== 200) {\n                responseToCache = undefined;\n            }\n            if (process.env.NODE_ENV !== 'production') {\n                if (responseToCache) {\n                    if (responseToCache.status !== 200) {\n                        if (responseToCache.status === 0) {\n                            logger.warn(`The response for '${this.request.url}' ` +\n                                `is an opaque response. The caching strategy that you're ` +\n                                `using will not cache opaque responses by default.`);\n                        }\n                        else {\n                            logger.debug(`The response for '${this.request.url}' ` +\n                                `returned a status code of '${response.status}' and won't ` +\n                                `be cached as a result.`);\n                        }\n                    }\n                }\n            }\n        }\n        return responseToCache;\n    }\n}\nexport { StrategyHandler };\n","/*\n  Copyright 2020 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { StrategyHandler } from './StrategyHandler.js';\nimport './_version.js';\n/**\n * An abstract base class that all other strategy classes must extend from:\n *\n * @memberof workbox-strategies\n */\nclass Strategy {\n    /**\n     * Creates a new instance of the strategy and sets all documented option\n     * properties as public instance properties.\n     *\n     * Note: if a custom strategy class extends the base Strategy class and does\n     * not need more than these properties, it does not need to define its own\n     * constructor.\n     *\n     * @param {Object} [options]\n     * @param {string} [options.cacheName] Cache name to store and retrieve\n     * requests. Defaults to the cache names provided by\n     * {@link workbox-core.cacheNames}.\n     * @param {Array<Object>} [options.plugins] [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n     * to use in conjunction with this caching strategy.\n     * @param {Object} [options.fetchOptions] Values passed along to the\n     * [`init`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters)\n     * of [non-navigation](https://github.com/GoogleChrome/workbox/issues/1796)\n     * `fetch()` requests made by this strategy.\n     * @param {Object} [options.matchOptions] The\n     * [`CacheQueryOptions`]{@link https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions}\n     * for any `cache.match()` or `cache.put()` calls made by this strategy.\n     */\n    constructor(options = {}) {\n        /**\n         * Cache name to store and retrieve\n         * requests. Defaults to the cache names provided by\n         * {@link workbox-core.cacheNames}.\n         *\n         * @type {string}\n         */\n        this.cacheName = cacheNames.getRuntimeName(options.cacheName);\n        /**\n         * The list\n         * [Plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}\n         * used by this strategy.\n         *\n         * @type {Array<Object>}\n         */\n        this.plugins = options.plugins || [];\n        /**\n         * Values passed along to the\n         * [`init`]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters}\n         * of all fetch() requests made by this strategy.\n         *\n         * @type {Object}\n         */\n        this.fetchOptions = options.fetchOptions;\n        /**\n         * The\n         * [`CacheQueryOptions`]{@link https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions}\n         * for any `cache.match()` or `cache.put()` calls made by this strategy.\n         *\n         * @type {Object}\n         */\n        this.matchOptions = options.matchOptions;\n    }\n    /**\n     * Perform a request strategy and returns a `Promise` that will resolve with\n     * a `Response`, invoking all relevant plugin callbacks.\n     *\n     * When a strategy instance is registered with a Workbox\n     * {@link workbox-routing.Route}, this method is automatically\n     * called when the route matches.\n     *\n     * Alternatively, this method can be used in a standalone `FetchEvent`\n     * listener by passing it to `event.respondWith()`.\n     *\n     * @param {FetchEvent|Object} options A `FetchEvent` or an object with the\n     *     properties listed below.\n     * @param {Request|string} options.request A request to run this strategy for.\n     * @param {ExtendableEvent} options.event The event associated with the\n     *     request.\n     * @param {URL} [options.url]\n     * @param {*} [options.params]\n     */\n    handle(options) {\n        const [responseDone] = this.handleAll(options);\n        return responseDone;\n    }\n    /**\n     * Similar to {@link workbox-strategies.Strategy~handle}, but\n     * instead of just returning a `Promise` that resolves to a `Response` it\n     * it will return an tuple of `[response, done]` promises, where the former\n     * (`response`) is equivalent to what `handle()` returns, and the latter is a\n     * Promise that will resolve once any promises that were added to\n     * `event.waitUntil()` as part of performing the strategy have completed.\n     *\n     * You can await the `done` promise to ensure any extra work performed by\n     * the strategy (usually caching responses) completes successfully.\n     *\n     * @param {FetchEvent|Object} options A `FetchEvent` or an object with the\n     *     properties listed below.\n     * @param {Request|string} options.request A request to run this strategy for.\n     * @param {ExtendableEvent} options.event The event associated with the\n     *     request.\n     * @param {URL} [options.url]\n     * @param {*} [options.params]\n     * @return {Array<Promise>} A tuple of [response, done]\n     *     promises that can be used to determine when the response resolves as\n     *     well as when the handler has completed all its work.\n     */\n    handleAll(options) {\n        // Allow for flexible options to be passed.\n        if (options instanceof FetchEvent) {\n            options = {\n                event: options,\n                request: options.request,\n            };\n        }\n        const event = options.event;\n        const request = typeof options.request === 'string'\n            ? new Request(options.request)\n            : options.request;\n        const params = 'params' in options ? options.params : undefined;\n        const handler = new StrategyHandler(this, { event, request, params });\n        const responseDone = this._getResponse(handler, request, event);\n        const handlerDone = this._awaitComplete(responseDone, handler, request, event);\n        // Return an array of promises, suitable for use with Promise.all().\n        return [responseDone, handlerDone];\n    }\n    async _getResponse(handler, request, event) {\n        await handler.runCallbacks('handlerWillStart', { event, request });\n        let response = undefined;\n        try {\n            response = await this._handle(request, handler);\n            // The \"official\" Strategy subclasses all throw this error automatically,\n            // but in case a third-party Strategy doesn't, ensure that we have a\n            // consistent failure when there's no response or an error response.\n            if (!response || response.type === 'error') {\n                throw new WorkboxError('no-response', { url: request.url });\n            }\n        }\n        catch (error) {\n            if (error instanceof Error) {\n                for (const callback of handler.iterateCallbacks('handlerDidError')) {\n                    response = await callback({ error, event, request });\n                    if (response) {\n                        break;\n                    }\n                }\n            }\n            if (!response) {\n                throw error;\n            }\n            else if (process.env.NODE_ENV !== 'production') {\n                logger.log(`While responding to '${getFriendlyURL(request.url)}', ` +\n                    `an ${error instanceof Error ? error.toString() : ''} error occurred. Using a fallback response provided by ` +\n                    `a handlerDidError plugin.`);\n            }\n        }\n        for (const callback of handler.iterateCallbacks('handlerWillRespond')) {\n            response = await callback({ event, request, response });\n        }\n        return response;\n    }\n    async _awaitComplete(responseDone, handler, request, event) {\n        let response;\n        let error;\n        try {\n            response = await responseDone;\n        }\n        catch (error) {\n            // Ignore errors, as response errors should be caught via the `response`\n            // promise above. The `done` promise will only throw for errors in\n            // promises passed to `handler.waitUntil()`.\n        }\n        try {\n            await handler.runCallbacks('handlerDidRespond', {\n                event,\n                request,\n                response,\n            });\n            await handler.doneWaiting();\n        }\n        catch (waitUntilError) {\n            if (waitUntilError instanceof Error) {\n                error = waitUntilError;\n            }\n        }\n        await handler.runCallbacks('handlerDidComplete', {\n            event,\n            request,\n            response,\n            error: error,\n        });\n        handler.destroy();\n        if (error) {\n            throw error;\n        }\n    }\n}\nexport { Strategy };\n/**\n * Classes extending the `Strategy` based class should implement this method,\n * and leverage the {@link workbox-strategies.StrategyHandler}\n * arg to perform all fetching and cache logic, which will ensure all relevant\n * cache, cache options, fetch options and plugins are used (per the current\n * strategy instance).\n *\n * @name _handle\n * @instance\n * @abstract\n * @function\n * @param {Request} request\n * @param {workbox-strategies.StrategyHandler} handler\n * @return {Promise<Response>}\n *\n * @memberof workbox-strategies.Strategy\n */\n","/*\n  Copyright 2020 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { copyResponse } from 'workbox-core/copyResponse.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { Strategy } from 'workbox-strategies/Strategy.js';\nimport './_version.js';\n/**\n * A {@link workbox-strategies.Strategy} implementation\n * specifically designed to work with\n * {@link workbox-precaching.PrecacheController}\n * to both cache and fetch precached assets.\n *\n * Note: an instance of this class is created automatically when creating a\n * `PrecacheController`; it's generally not necessary to create this yourself.\n *\n * @extends workbox-strategies.Strategy\n * @memberof workbox-precaching\n */\nclass PrecacheStrategy extends Strategy {\n    /**\n     *\n     * @param {Object} [options]\n     * @param {string} [options.cacheName] Cache name to store and retrieve\n     * requests. Defaults to the cache names provided by\n     * {@link workbox-core.cacheNames}.\n     * @param {Array<Object>} [options.plugins] {@link https://developers.google.com/web/tools/workbox/guides/using-plugins|Plugins}\n     * to use in conjunction with this caching strategy.\n     * @param {Object} [options.fetchOptions] Values passed along to the\n     * {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters|init}\n     * of all fetch() requests made by this strategy.\n     * @param {Object} [options.matchOptions] The\n     * {@link https://w3c.github.io/ServiceWorker/#dictdef-cachequeryoptions|CacheQueryOptions}\n     * for any `cache.match()` or `cache.put()` calls made by this strategy.\n     * @param {boolean} [options.fallbackToNetwork=true] Whether to attempt to\n     * get the response from the network if there's a precache miss.\n     */\n    constructor(options = {}) {\n        options.cacheName = cacheNames.getPrecacheName(options.cacheName);\n        super(options);\n        this._fallbackToNetwork =\n            options.fallbackToNetwork === false ? false : true;\n        // Redirected responses cannot be used to satisfy a navigation request, so\n        // any redirected response must be \"copied\" rather than cloned, so the new\n        // response doesn't contain the `redirected` flag. See:\n        // https://bugs.chromium.org/p/chromium/issues/detail?id=669363&desc=2#c1\n        this.plugins.push(PrecacheStrategy.copyRedirectedCacheableResponsesPlugin);\n    }\n    /**\n     * @private\n     * @param {Request|string} request A request to run this strategy for.\n     * @param {workbox-strategies.StrategyHandler} handler The event that\n     *     triggered the request.\n     * @return {Promise<Response>}\n     */\n    async _handle(request, handler) {\n        const response = await handler.cacheMatch(request);\n        if (response) {\n            return response;\n        }\n        // If this is an `install` event for an entry that isn't already cached,\n        // then populate the cache.\n        if (handler.event && handler.event.type === 'install') {\n            return await this._handleInstall(request, handler);\n        }\n        // Getting here means something went wrong. An entry that should have been\n        // precached wasn't found in the cache.\n        return await this._handleFetch(request, handler);\n    }\n    async _handleFetch(request, handler) {\n        let response;\n        const params = (handler.params || {});\n        // Fall back to the network if we're configured to do so.\n        if (this._fallbackToNetwork) {\n            if (process.env.NODE_ENV !== 'production') {\n                logger.warn(`The precached response for ` +\n                    `${getFriendlyURL(request.url)} in ${this.cacheName} was not ` +\n                    `found. Falling back to the network.`);\n            }\n            const integrityInManifest = params.integrity;\n            const integrityInRequest = request.integrity;\n            const noIntegrityConflict = !integrityInRequest || integrityInRequest === integrityInManifest;\n            // Do not add integrity if the original request is no-cors\n            // See https://github.com/GoogleChrome/workbox/issues/3096\n            response = await handler.fetch(new Request(request, {\n                integrity: request.mode !== 'no-cors'\n                    ? integrityInRequest || integrityInManifest\n                    : undefined,\n            }));\n            // It's only \"safe\" to repair the cache if we're using SRI to guarantee\n            // that the response matches the precache manifest's expectations,\n            // and there's either a) no integrity property in the incoming request\n            // or b) there is an integrity, and it matches the precache manifest.\n            // See https://github.com/GoogleChrome/workbox/issues/2858\n            // Also if the original request users no-cors we don't use integrity.\n            // See https://github.com/GoogleChrome/workbox/issues/3096\n            if (integrityInManifest &&\n                noIntegrityConflict &&\n                request.mode !== 'no-cors') {\n                this._useDefaultCacheabilityPluginIfNeeded();\n                const wasCached = await handler.cachePut(request, response.clone());\n                if (process.env.NODE_ENV !== 'production') {\n                    if (wasCached) {\n                        logger.log(`A response for ${getFriendlyURL(request.url)} ` +\n                            `was used to \"repair\" the precache.`);\n                    }\n                }\n            }\n        }\n        else {\n            // This shouldn't normally happen, but there are edge cases:\n            // https://github.com/GoogleChrome/workbox/issues/1441\n            throw new WorkboxError('missing-precache-entry', {\n                cacheName: this.cacheName,\n                url: request.url,\n            });\n        }\n        if (process.env.NODE_ENV !== 'production') {\n            const cacheKey = params.cacheKey || (await handler.getCacheKey(request, 'read'));\n            // Workbox is going to handle the route.\n            // print the routing details to the console.\n            logger.groupCollapsed(`Precaching is responding to: ` + getFriendlyURL(request.url));\n            logger.log(`Serving the precached url: ${getFriendlyURL(cacheKey instanceof Request ? cacheKey.url : cacheKey)}`);\n            logger.groupCollapsed(`View request details here.`);\n            logger.log(request);\n            logger.groupEnd();\n            logger.groupCollapsed(`View response details here.`);\n            logger.log(response);\n            logger.groupEnd();\n            logger.groupEnd();\n        }\n        return response;\n    }\n    async _handleInstall(request, handler) {\n        this._useDefaultCacheabilityPluginIfNeeded();\n        const response = await handler.fetch(request);\n        // Make sure we defer cachePut() until after we know the response\n        // should be cached; see https://github.com/GoogleChrome/workbox/issues/2737\n        const wasCached = await handler.cachePut(request, response.clone());\n        if (!wasCached) {\n            // Throwing here will lead to the `install` handler failing, which\n            // we want to do if *any* of the responses aren't safe to cache.\n            throw new WorkboxError('bad-precaching-response', {\n                url: request.url,\n                status: response.status,\n            });\n        }\n        return response;\n    }\n    /**\n     * This method is complex, as there a number of things to account for:\n     *\n     * The `plugins` array can be set at construction, and/or it might be added to\n     * to at any time before the strategy is used.\n     *\n     * At the time the strategy is used (i.e. during an `install` event), there\n     * needs to be at least one plugin that implements `cacheWillUpdate` in the\n     * array, other than `copyRedirectedCacheableResponsesPlugin`.\n     *\n     * - If this method is called and there are no suitable `cacheWillUpdate`\n     * plugins, we need to add `defaultPrecacheCacheabilityPlugin`.\n     *\n     * - If this method is called and there is exactly one `cacheWillUpdate`, then\n     * we don't have to do anything (this might be a previously added\n     * `defaultPrecacheCacheabilityPlugin`, or it might be a custom plugin).\n     *\n     * - If this method is called and there is more than one `cacheWillUpdate`,\n     * then we need to check if one is `defaultPrecacheCacheabilityPlugin`. If so,\n     * we need to remove it. (This situation is unlikely, but it could happen if\n     * the strategy is used multiple times, the first without a `cacheWillUpdate`,\n     * and then later on after manually adding a custom `cacheWillUpdate`.)\n     *\n     * See https://github.com/GoogleChrome/workbox/issues/2737 for more context.\n     *\n     * @private\n     */\n    _useDefaultCacheabilityPluginIfNeeded() {\n        let defaultPluginIndex = null;\n        let cacheWillUpdatePluginCount = 0;\n        for (const [index, plugin] of this.plugins.entries()) {\n            // Ignore the copy redirected plugin when determining what to do.\n            if (plugin === PrecacheStrategy.copyRedirectedCacheableResponsesPlugin) {\n                continue;\n            }\n            // Save the default plugin's index, in case it needs to be removed.\n            if (plugin === PrecacheStrategy.defaultPrecacheCacheabilityPlugin) {\n                defaultPluginIndex = index;\n            }\n            if (plugin.cacheWillUpdate) {\n                cacheWillUpdatePluginCount++;\n            }\n        }\n        if (cacheWillUpdatePluginCount === 0) {\n            this.plugins.push(PrecacheStrategy.defaultPrecacheCacheabilityPlugin);\n        }\n        else if (cacheWillUpdatePluginCount > 1 && defaultPluginIndex !== null) {\n            // Only remove the default plugin; multiple custom plugins are allowed.\n            this.plugins.splice(defaultPluginIndex, 1);\n        }\n        // Nothing needs to be done if cacheWillUpdatePluginCount is 1\n    }\n}\nPrecacheStrategy.defaultPrecacheCacheabilityPlugin = {\n    async cacheWillUpdate({ response }) {\n        if (!response || response.status >= 400) {\n            return null;\n        }\n        return response;\n    },\n};\nPrecacheStrategy.copyRedirectedCacheableResponsesPlugin = {\n    async cacheWillUpdate({ response }) {\n        return response.redirected ? await copyResponse(response) : response;\n    },\n};\nexport { PrecacheStrategy };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { waitUntil } from 'workbox-core/_private/waitUntil.js';\nimport { createCacheKey } from './utils/createCacheKey.js';\nimport { PrecacheInstallReportPlugin } from './utils/PrecacheInstallReportPlugin.js';\nimport { PrecacheCacheKeyPlugin } from './utils/PrecacheCacheKeyPlugin.js';\nimport { printCleanupDetails } from './utils/printCleanupDetails.js';\nimport { printInstallDetails } from './utils/printInstallDetails.js';\nimport { PrecacheStrategy } from './PrecacheStrategy.js';\nimport './_version.js';\n/**\n * Performs efficient precaching of assets.\n *\n * @memberof workbox-precaching\n */\nclass PrecacheController {\n    /**\n     * Create a new PrecacheController.\n     *\n     * @param {Object} [options]\n     * @param {string} [options.cacheName] The cache to use for precaching.\n     * @param {string} [options.plugins] Plugins to use when precaching as well\n     * as responding to fetch events for precached assets.\n     * @param {boolean} [options.fallbackToNetwork=true] Whether to attempt to\n     * get the response from the network if there's a precache miss.\n     */\n    constructor({ cacheName, plugins = [], fallbackToNetwork = true, } = {}) {\n        this._urlsToCacheKeys = new Map();\n        this._urlsToCacheModes = new Map();\n        this._cacheKeysToIntegrities = new Map();\n        this._strategy = new PrecacheStrategy({\n            cacheName: cacheNames.getPrecacheName(cacheName),\n            plugins: [\n                ...plugins,\n                new PrecacheCacheKeyPlugin({ precacheController: this }),\n            ],\n            fallbackToNetwork,\n        });\n        // Bind the install and activate methods to the instance.\n        this.install = this.install.bind(this);\n        this.activate = this.activate.bind(this);\n    }\n    /**\n     * @type {workbox-precaching.PrecacheStrategy} The strategy created by this controller and\n     * used to cache assets and respond to fetch events.\n     */\n    get strategy() {\n        return this._strategy;\n    }\n    /**\n     * Adds items to the precache list, removing any duplicates and\n     * stores the files in the\n     * {@link workbox-core.cacheNames|\"precache cache\"} when the service\n     * worker installs.\n     *\n     * This method can be called multiple times.\n     *\n     * @param {Array<Object|string>} [entries=[]] Array of entries to precache.\n     */\n    precache(entries) {\n        this.addToCacheList(entries);\n        if (!this._installAndActiveListenersAdded) {\n            self.addEventListener('install', this.install);\n            self.addEventListener('activate', this.activate);\n            this._installAndActiveListenersAdded = true;\n        }\n    }\n    /**\n     * This method will add items to the precache list, removing duplicates\n     * and ensuring the information is valid.\n     *\n     * @param {Array<workbox-precaching.PrecacheController.PrecacheEntry|string>} entries\n     *     Array of entries to precache.\n     */\n    addToCacheList(entries) {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isArray(entries, {\n                moduleName: 'workbox-precaching',\n                className: 'PrecacheController',\n                funcName: 'addToCacheList',\n                paramName: 'entries',\n            });\n        }\n        const urlsToWarnAbout = [];\n        for (const entry of entries) {\n            // See https://github.com/GoogleChrome/workbox/issues/2259\n            if (typeof entry === 'string') {\n                urlsToWarnAbout.push(entry);\n            }\n            else if (entry && entry.revision === undefined) {\n                urlsToWarnAbout.push(entry.url);\n            }\n            const { cacheKey, url } = createCacheKey(entry);\n            const cacheMode = typeof entry !== 'string' && entry.revision ? 'reload' : 'default';\n            if (this._urlsToCacheKeys.has(url) &&\n                this._urlsToCacheKeys.get(url) !== cacheKey) {\n                throw new WorkboxError('add-to-cache-list-conflicting-entries', {\n                    firstEntry: this._urlsToCacheKeys.get(url),\n                    secondEntry: cacheKey,\n                });\n            }\n            if (typeof entry !== 'string' && entry.integrity) {\n                if (this._cacheKeysToIntegrities.has(cacheKey) &&\n                    this._cacheKeysToIntegrities.get(cacheKey) !== entry.integrity) {\n                    throw new WorkboxError('add-to-cache-list-conflicting-integrities', {\n                        url,\n                    });\n                }\n                this._cacheKeysToIntegrities.set(cacheKey, entry.integrity);\n            }\n            this._urlsToCacheKeys.set(url, cacheKey);\n            this._urlsToCacheModes.set(url, cacheMode);\n            if (urlsToWarnAbout.length > 0) {\n                const warningMessage = `Workbox is precaching URLs without revision ` +\n                    `info: ${urlsToWarnAbout.join(', ')}\\nThis is generally NOT safe. ` +\n                    `Learn more at https://bit.ly/wb-precache`;\n                if (process.env.NODE_ENV === 'production') {\n                    // Use console directly to display this warning without bloating\n                    // bundle sizes by pulling in all of the logger codebase in prod.\n                    console.warn(warningMessage);\n                }\n                else {\n                    logger.warn(warningMessage);\n                }\n            }\n        }\n    }\n    /**\n     * Precaches new and updated assets. Call this method from the service worker\n     * install event.\n     *\n     * Note: this method calls `event.waitUntil()` for you, so you do not need\n     * to call it yourself in your event handlers.\n     *\n     * @param {ExtendableEvent} event\n     * @return {Promise<workbox-precaching.InstallResult>}\n     */\n    install(event) {\n        // waitUntil returns Promise<any>\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n        return waitUntil(event, async () => {\n            const installReportPlugin = new PrecacheInstallReportPlugin();\n            this.strategy.plugins.push(installReportPlugin);\n            // Cache entries one at a time.\n            // See https://github.com/GoogleChrome/workbox/issues/2528\n            for (const [url, cacheKey] of this._urlsToCacheKeys) {\n                const integrity = this._cacheKeysToIntegrities.get(cacheKey);\n                const cacheMode = this._urlsToCacheModes.get(url);\n                const request = new Request(url, {\n                    integrity,\n                    cache: cacheMode,\n                    credentials: 'same-origin',\n                });\n                await Promise.all(this.strategy.handleAll({\n                    params: { cacheKey },\n                    request,\n                    event,\n                }));\n            }\n            const { updatedURLs, notUpdatedURLs } = installReportPlugin;\n            if (process.env.NODE_ENV !== 'production') {\n                printInstallDetails(updatedURLs, notUpdatedURLs);\n            }\n            return { updatedURLs, notUpdatedURLs };\n        });\n    }\n    /**\n     * Deletes assets that are no longer present in the current precache manifest.\n     * Call this method from the service worker activate event.\n     *\n     * Note: this method calls `event.waitUntil()` for you, so you do not need\n     * to call it yourself in your event handlers.\n     *\n     * @param {ExtendableEvent} event\n     * @return {Promise<workbox-precaching.CleanupResult>}\n     */\n    activate(event) {\n        // waitUntil returns Promise<any>\n        // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n        return waitUntil(event, async () => {\n            const cache = await self.caches.open(this.strategy.cacheName);\n            const currentlyCachedRequests = await cache.keys();\n            const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());\n            const deletedURLs = [];\n            for (const request of currentlyCachedRequests) {\n                if (!expectedCacheKeys.has(request.url)) {\n                    await cache.delete(request);\n                    deletedURLs.push(request.url);\n                }\n            }\n            if (process.env.NODE_ENV !== 'production') {\n                printCleanupDetails(deletedURLs);\n            }\n            return { deletedURLs };\n        });\n    }\n    /**\n     * Returns a mapping of a precached URL to the corresponding cache key, taking\n     * into account the revision information for the URL.\n     *\n     * @return {Map<string, string>} A URL to cache key mapping.\n     */\n    getURLsToCacheKeys() {\n        return this._urlsToCacheKeys;\n    }\n    /**\n     * Returns a list of all the URLs that have been precached by the current\n     * service worker.\n     *\n     * @return {Array<string>} The precached URLs.\n     */\n    getCachedURLs() {\n        return [...this._urlsToCacheKeys.keys()];\n    }\n    /**\n     * Returns the cache key used for storing a given URL. If that URL is\n     * unversioned, like `/index.html', then the cache key will be the original\n     * URL with a search parameter appended to it.\n     *\n     * @param {string} url A URL whose cache key you want to look up.\n     * @return {string} The versioned URL that corresponds to a cache key\n     * for the original URL, or undefined if that URL isn't precached.\n     */\n    getCacheKeyForURL(url) {\n        const urlObject = new URL(url, location.href);\n        return this._urlsToCacheKeys.get(urlObject.href);\n    }\n    /**\n     * @param {string} url A cache key whose SRI you want to look up.\n     * @return {string} The subresource integrity associated with the cache key,\n     * or undefined if it's not set.\n     */\n    getIntegrityForCacheKey(cacheKey) {\n        return this._cacheKeysToIntegrities.get(cacheKey);\n    }\n    /**\n     * This acts as a drop-in replacement for\n     * [`cache.match()`](https://developer.mozilla.org/en-US/docs/Web/API/Cache/match)\n     * with the following differences:\n     *\n     * - It knows what the name of the precache is, and only checks in that cache.\n     * - It allows you to pass in an \"original\" URL without versioning parameters,\n     * and it will automatically look up the correct cache key for the currently\n     * active revision of that URL.\n     *\n     * E.g., `matchPrecache('index.html')` will find the correct precached\n     * response for the currently active service worker, even if the actual cache\n     * key is `'/index.html?__WB_REVISION__=1234abcd'`.\n     *\n     * @param {string|Request} request The key (without revisioning parameters)\n     * to look up in the precache.\n     * @return {Promise<Response|undefined>}\n     */\n    async matchPrecache(request) {\n        const url = request instanceof Request ? request.url : request;\n        const cacheKey = this.getCacheKeyForURL(url);\n        if (cacheKey) {\n            const cache = await self.caches.open(this.strategy.cacheName);\n            return cache.match(cacheKey);\n        }\n        return undefined;\n    }\n    /**\n     * Returns a function that looks up `url` in the precache (taking into\n     * account revision information), and returns the corresponding `Response`.\n     *\n     * @param {string} url The precached URL which will be used to lookup the\n     * `Response`.\n     * @return {workbox-routing~handlerCallback}\n     */\n    createHandlerBoundToURL(url) {\n        const cacheKey = this.getCacheKeyForURL(url);\n        if (!cacheKey) {\n            throw new WorkboxError('non-precached-url', { url });\n        }\n        return (options) => {\n            options.request = new Request(url);\n            options.params = Object.assign({ cacheKey }, options.params);\n            return this.strategy.handle(options);\n        };\n    }\n}\nexport { PrecacheController };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { PrecacheController } from '../PrecacheController.js';\nimport '../_version.js';\nlet precacheController;\n/**\n * @return {PrecacheController}\n * @private\n */\nexport const getOrCreatePrecacheController = () => {\n    if (!precacheController) {\n        precacheController = new PrecacheController();\n    }\n    return precacheController;\n};\n","\"use strict\";\n// @ts-ignore\ntry {\n    self['workbox:routing:7.3.0'] && _();\n}\ncatch (e) { }\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * The default HTTP method, 'GET', used when there's no specific method\n * configured for a route.\n *\n * @type {string}\n *\n * @private\n */\nexport const defaultMethod = 'GET';\n/**\n * The list of valid HTTP methods associated with requests that could be routed.\n *\n * @type {Array<string>}\n *\n * @private\n */\nexport const validMethods = [\n    'DELETE',\n    'GET',\n    'HEAD',\n    'PATCH',\n    'POST',\n    'PUT',\n];\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport '../_version.js';\n/**\n * @param {function()|Object} handler Either a function, or an object with a\n * 'handle' method.\n * @return {Object} An object with a handle method.\n *\n * @private\n */\nexport const normalizeHandler = (handler) => {\n    if (handler && typeof handler === 'object') {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.hasMethod(handler, 'handle', {\n                moduleName: 'workbox-routing',\n                className: 'Route',\n                funcName: 'constructor',\n                paramName: 'handler',\n            });\n        }\n        return handler;\n    }\n    else {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isType(handler, 'function', {\n                moduleName: 'workbox-routing',\n                className: 'Route',\n                funcName: 'constructor',\n                paramName: 'handler',\n            });\n        }\n        return { handle: handler };\n    }\n};\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { defaultMethod, validMethods } from './utils/constants.js';\nimport { normalizeHandler } from './utils/normalizeHandler.js';\nimport './_version.js';\n/**\n * A `Route` consists of a pair of callback functions, \"match\" and \"handler\".\n * The \"match\" callback determine if a route should be used to \"handle\" a\n * request by returning a non-falsy value if it can. The \"handler\" callback\n * is called when there is a match and should return a Promise that resolves\n * to a `Response`.\n *\n * @memberof workbox-routing\n */\nclass Route {\n    /**\n     * Constructor for Route class.\n     *\n     * @param {workbox-routing~matchCallback} match\n     * A callback function that determines whether the route matches a given\n     * `fetch` event by returning a non-falsy value.\n     * @param {workbox-routing~handlerCallback} handler A callback\n     * function that returns a Promise resolving to a Response.\n     * @param {string} [method='GET'] The HTTP method to match the Route\n     * against.\n     */\n    constructor(match, handler, method = defaultMethod) {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isType(match, 'function', {\n                moduleName: 'workbox-routing',\n                className: 'Route',\n                funcName: 'constructor',\n                paramName: 'match',\n            });\n            if (method) {\n                assert.isOneOf(method, validMethods, { paramName: 'method' });\n            }\n        }\n        // These values are referenced directly by Router so cannot be\n        // altered by minificaton.\n        this.handler = normalizeHandler(handler);\n        this.match = match;\n        this.method = method;\n    }\n    /**\n     *\n     * @param {workbox-routing-handlerCallback} handler A callback\n     * function that returns a Promise resolving to a Response\n     */\n    setCatchHandler(handler) {\n        this.catchHandler = normalizeHandler(handler);\n    }\n}\nexport { Route };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { Route } from './Route.js';\nimport './_version.js';\n/**\n * RegExpRoute makes it easy to create a regular expression based\n * {@link workbox-routing.Route}.\n *\n * For same-origin requests the RegExp only needs to match part of the URL. For\n * requests against third-party servers, you must define a RegExp that matches\n * the start of the URL.\n *\n * @memberof workbox-routing\n * @extends workbox-routing.Route\n */\nclass RegExpRoute extends Route {\n    /**\n     * If the regular expression contains\n     * [capture groups]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#grouping-back-references},\n     * the captured values will be passed to the\n     * {@link workbox-routing~handlerCallback} `params`\n     * argument.\n     *\n     * @param {RegExp} regExp The regular expression to match against URLs.\n     * @param {workbox-routing~handlerCallback} handler A callback\n     * function that returns a Promise resulting in a Response.\n     * @param {string} [method='GET'] The HTTP method to match the Route\n     * against.\n     */\n    constructor(regExp, handler, method) {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isInstance(regExp, RegExp, {\n                moduleName: 'workbox-routing',\n                className: 'RegExpRoute',\n                funcName: 'constructor',\n                paramName: 'pattern',\n            });\n        }\n        const match = ({ url }) => {\n            const result = regExp.exec(url.href);\n            // Return immediately if there's no match.\n            if (!result) {\n                return;\n            }\n            // Require that the match start at the first character in the URL string\n            // if it's a cross-origin request.\n            // See https://github.com/GoogleChrome/workbox/issues/281 for the context\n            // behind this behavior.\n            if (url.origin !== location.origin && result.index !== 0) {\n                if (process.env.NODE_ENV !== 'production') {\n                    logger.debug(`The regular expression '${regExp.toString()}' only partially matched ` +\n                        `against the cross-origin URL '${url.toString()}'. RegExpRoute's will only ` +\n                        `handle cross-origin requests if they match the entire URL.`);\n                }\n                return;\n            }\n            // If the route matches, but there aren't any capture groups defined, then\n            // this will return [], which is truthy and therefore sufficient to\n            // indicate a match.\n            // If there are capture groups, then it will return their values.\n            return result.slice(1);\n        };\n        super(match, handler, method);\n    }\n}\nexport { RegExpRoute };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { assert } from 'workbox-core/_private/assert.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { defaultMethod } from './utils/constants.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { normalizeHandler } from './utils/normalizeHandler.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport './_version.js';\n/**\n * The Router can be used to process a `FetchEvent` using one or more\n * {@link workbox-routing.Route}, responding with a `Response` if\n * a matching route exists.\n *\n * If no route matches a given a request, the Router will use a \"default\"\n * handler if one is defined.\n *\n * Should the matching Route throw an error, the Router will use a \"catch\"\n * handler if one is defined to gracefully deal with issues and respond with a\n * Request.\n *\n * If a request matches multiple routes, the **earliest** registered route will\n * be used to respond to the request.\n *\n * @memberof workbox-routing\n */\nclass Router {\n    /**\n     * Initializes a new Router.\n     */\n    constructor() {\n        this._routes = new Map();\n        this._defaultHandlerMap = new Map();\n    }\n    /**\n     * @return {Map<string, Array<workbox-routing.Route>>} routes A `Map` of HTTP\n     * method name ('GET', etc.) to an array of all the corresponding `Route`\n     * instances that are registered.\n     */\n    get routes() {\n        return this._routes;\n    }\n    /**\n     * Adds a fetch event listener to respond to events when a route matches\n     * the event's request.\n     */\n    addFetchListener() {\n        // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n        self.addEventListener('fetch', ((event) => {\n            const { request } = event;\n            const responsePromise = this.handleRequest({ request, event });\n            if (responsePromise) {\n                event.respondWith(responsePromise);\n            }\n        }));\n    }\n    /**\n     * Adds a message event listener for URLs to cache from the window.\n     * This is useful to cache resources loaded on the page prior to when the\n     * service worker started controlling it.\n     *\n     * The format of the message data sent from the window should be as follows.\n     * Where the `urlsToCache` array may consist of URL strings or an array of\n     * URL string + `requestInit` object (the same as you'd pass to `fetch()`).\n     *\n     * ```\n     * {\n     *   type: 'CACHE_URLS',\n     *   payload: {\n     *     urlsToCache: [\n     *       './script1.js',\n     *       './script2.js',\n     *       ['./script3.js', {mode: 'no-cors'}],\n     *     ],\n     *   },\n     * }\n     * ```\n     */\n    addCacheListener() {\n        // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n        self.addEventListener('message', ((event) => {\n            // event.data is type 'any'\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n            if (event.data && event.data.type === 'CACHE_URLS') {\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n                const { payload } = event.data;\n                if (process.env.NODE_ENV !== 'production') {\n                    logger.debug(`Caching URLs from the window`, payload.urlsToCache);\n                }\n                const requestPromises = Promise.all(payload.urlsToCache.map((entry) => {\n                    if (typeof entry === 'string') {\n                        entry = [entry];\n                    }\n                    const request = new Request(...entry);\n                    return this.handleRequest({ request, event });\n                    // TODO(philipwalton): TypeScript errors without this typecast for\n                    // some reason (probably a bug). The real type here should work but\n                    // doesn't: `Array<Promise<Response> | undefined>`.\n                })); // TypeScript\n                event.waitUntil(requestPromises);\n                // If a MessageChannel was used, reply to the message on success.\n                if (event.ports && event.ports[0]) {\n                    void requestPromises.then(() => event.ports[0].postMessage(true));\n                }\n            }\n        }));\n    }\n    /**\n     * Apply the routing rules to a FetchEvent object to get a Response from an\n     * appropriate Route's handler.\n     *\n     * @param {Object} options\n     * @param {Request} options.request The request to handle.\n     * @param {ExtendableEvent} options.event The event that triggered the\n     *     request.\n     * @return {Promise<Response>|undefined} A promise is returned if a\n     *     registered route can handle the request. If there is no matching\n     *     route and there's no `defaultHandler`, `undefined` is returned.\n     */\n    handleRequest({ request, event, }) {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isInstance(request, Request, {\n                moduleName: 'workbox-routing',\n                className: 'Router',\n                funcName: 'handleRequest',\n                paramName: 'options.request',\n            });\n        }\n        const url = new URL(request.url, location.href);\n        if (!url.protocol.startsWith('http')) {\n            if (process.env.NODE_ENV !== 'production') {\n                logger.debug(`Workbox Router only supports URLs that start with 'http'.`);\n            }\n            return;\n        }\n        const sameOrigin = url.origin === location.origin;\n        const { params, route } = this.findMatchingRoute({\n            event,\n            request,\n            sameOrigin,\n            url,\n        });\n        let handler = route && route.handler;\n        const debugMessages = [];\n        if (process.env.NODE_ENV !== 'production') {\n            if (handler) {\n                debugMessages.push([`Found a route to handle this request:`, route]);\n                if (params) {\n                    debugMessages.push([\n                        `Passing the following params to the route's handler:`,\n                        params,\n                    ]);\n                }\n            }\n        }\n        // If we don't have a handler because there was no matching route, then\n        // fall back to defaultHandler if that's defined.\n        const method = request.method;\n        if (!handler && this._defaultHandlerMap.has(method)) {\n            if (process.env.NODE_ENV !== 'production') {\n                debugMessages.push(`Failed to find a matching route. Falling ` +\n                    `back to the default handler for ${method}.`);\n            }\n            handler = this._defaultHandlerMap.get(method);\n        }\n        if (!handler) {\n            if (process.env.NODE_ENV !== 'production') {\n                // No handler so Workbox will do nothing. If logs is set of debug\n                // i.e. verbose, we should print out this information.\n                logger.debug(`No route found for: ${getFriendlyURL(url)}`);\n            }\n            return;\n        }\n        if (process.env.NODE_ENV !== 'production') {\n            // We have a handler, meaning Workbox is going to handle the route.\n            // print the routing details to the console.\n            logger.groupCollapsed(`Router is responding to: ${getFriendlyURL(url)}`);\n            debugMessages.forEach((msg) => {\n                if (Array.isArray(msg)) {\n                    logger.log(...msg);\n                }\n                else {\n                    logger.log(msg);\n                }\n            });\n            logger.groupEnd();\n        }\n        // Wrap in try and catch in case the handle method throws a synchronous\n        // error. It should still callback to the catch handler.\n        let responsePromise;\n        try {\n            responsePromise = handler.handle({ url, request, event, params });\n        }\n        catch (err) {\n            responsePromise = Promise.reject(err);\n        }\n        // Get route's catch handler, if it exists\n        const catchHandler = route && route.catchHandler;\n        if (responsePromise instanceof Promise &&\n            (this._catchHandler || catchHandler)) {\n            responsePromise = responsePromise.catch(async (err) => {\n                // If there's a route catch handler, process that first\n                if (catchHandler) {\n                    if (process.env.NODE_ENV !== 'production') {\n                        // Still include URL here as it will be async from the console group\n                        // and may not make sense without the URL\n                        logger.groupCollapsed(`Error thrown when responding to: ` +\n                            ` ${getFriendlyURL(url)}. Falling back to route's Catch Handler.`);\n                        logger.error(`Error thrown by:`, route);\n                        logger.error(err);\n                        logger.groupEnd();\n                    }\n                    try {\n                        return await catchHandler.handle({ url, request, event, params });\n                    }\n                    catch (catchErr) {\n                        if (catchErr instanceof Error) {\n                            err = catchErr;\n                        }\n                    }\n                }\n                if (this._catchHandler) {\n                    if (process.env.NODE_ENV !== 'production') {\n                        // Still include URL here as it will be async from the console group\n                        // and may not make sense without the URL\n                        logger.groupCollapsed(`Error thrown when responding to: ` +\n                            ` ${getFriendlyURL(url)}. Falling back to global Catch Handler.`);\n                        logger.error(`Error thrown by:`, route);\n                        logger.error(err);\n                        logger.groupEnd();\n                    }\n                    return this._catchHandler.handle({ url, request, event });\n                }\n                throw err;\n            });\n        }\n        return responsePromise;\n    }\n    /**\n     * Checks a request and URL (and optionally an event) against the list of\n     * registered routes, and if there's a match, returns the corresponding\n     * route along with any params generated by the match.\n     *\n     * @param {Object} options\n     * @param {URL} options.url\n     * @param {boolean} options.sameOrigin The result of comparing `url.origin`\n     *     against the current origin.\n     * @param {Request} options.request The request to match.\n     * @param {Event} options.event The corresponding event.\n     * @return {Object} An object with `route` and `params` properties.\n     *     They are populated if a matching route was found or `undefined`\n     *     otherwise.\n     */\n    findMatchingRoute({ url, sameOrigin, request, event, }) {\n        const routes = this._routes.get(request.method) || [];\n        for (const route of routes) {\n            let params;\n            // route.match returns type any, not possible to change right now.\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n            const matchResult = route.match({ url, sameOrigin, request, event });\n            if (matchResult) {\n                if (process.env.NODE_ENV !== 'production') {\n                    // Warn developers that using an async matchCallback is almost always\n                    // not the right thing to do.\n                    if (matchResult instanceof Promise) {\n                        logger.warn(`While routing ${getFriendlyURL(url)}, an async ` +\n                            `matchCallback function was used. Please convert the ` +\n                            `following route to use a synchronous matchCallback function:`, route);\n                    }\n                }\n                // See https://github.com/GoogleChrome/workbox/issues/2079\n                // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n                params = matchResult;\n                if (Array.isArray(params) && params.length === 0) {\n                    // Instead of passing an empty array in as params, use undefined.\n                    params = undefined;\n                }\n                else if (matchResult.constructor === Object && // eslint-disable-line\n                    Object.keys(matchResult).length === 0) {\n                    // Instead of passing an empty object in as params, use undefined.\n                    params = undefined;\n                }\n                else if (typeof matchResult === 'boolean') {\n                    // For the boolean value true (rather than just something truth-y),\n                    // don't set params.\n                    // See https://github.com/GoogleChrome/workbox/pull/2134#issuecomment-513924353\n                    params = undefined;\n                }\n                // Return early if have a match.\n                return { route, params };\n            }\n        }\n        // If no match was found above, return and empty object.\n        return {};\n    }\n    /**\n     * Define a default `handler` that's called when no routes explicitly\n     * match the incoming request.\n     *\n     * Each HTTP method ('GET', 'POST', etc.) gets its own default handler.\n     *\n     * Without a default handler, unmatched requests will go against the\n     * network as if there were no service worker present.\n     *\n     * @param {workbox-routing~handlerCallback} handler A callback\n     * function that returns a Promise resulting in a Response.\n     * @param {string} [method='GET'] The HTTP method to associate with this\n     * default handler. Each method has its own default.\n     */\n    setDefaultHandler(handler, method = defaultMethod) {\n        this._defaultHandlerMap.set(method, normalizeHandler(handler));\n    }\n    /**\n     * If a Route throws an error while handling a request, this `handler`\n     * will be called and given a chance to provide a response.\n     *\n     * @param {workbox-routing~handlerCallback} handler A callback\n     * function that returns a Promise resulting in a Response.\n     */\n    setCatchHandler(handler) {\n        this._catchHandler = normalizeHandler(handler);\n    }\n    /**\n     * Registers a route with the router.\n     *\n     * @param {workbox-routing.Route} route The route to register.\n     */\n    registerRoute(route) {\n        if (process.env.NODE_ENV !== 'production') {\n            assert.isType(route, 'object', {\n                moduleName: 'workbox-routing',\n                className: 'Router',\n                funcName: 'registerRoute',\n                paramName: 'route',\n            });\n            assert.hasMethod(route, 'match', {\n                moduleName: 'workbox-routing',\n                className: 'Router',\n                funcName: 'registerRoute',\n                paramName: 'route',\n            });\n            assert.isType(route.handler, 'object', {\n                moduleName: 'workbox-routing',\n                className: 'Router',\n                funcName: 'registerRoute',\n                paramName: 'route',\n            });\n            assert.hasMethod(route.handler, 'handle', {\n                moduleName: 'workbox-routing',\n                className: 'Router',\n                funcName: 'registerRoute',\n                paramName: 'route.handler',\n            });\n            assert.isType(route.method, 'string', {\n                moduleName: 'workbox-routing',\n                className: 'Router',\n                funcName: 'registerRoute',\n                paramName: 'route.method',\n            });\n        }\n        if (!this._routes.has(route.method)) {\n            this._routes.set(route.method, []);\n        }\n        // Give precedence to all of the earlier routes by adding this additional\n        // route to the end of the array.\n        this._routes.get(route.method).push(route);\n    }\n    /**\n     * Unregisters a route with the router.\n     *\n     * @param {workbox-routing.Route} route The route to unregister.\n     */\n    unregisterRoute(route) {\n        if (!this._routes.has(route.method)) {\n            throw new WorkboxError('unregister-route-but-not-found-with-method', {\n                method: route.method,\n            });\n        }\n        const routeIndex = this._routes.get(route.method).indexOf(route);\n        if (routeIndex > -1) {\n            this._routes.get(route.method).splice(routeIndex, 1);\n        }\n        else {\n            throw new WorkboxError('unregister-route-route-not-registered');\n        }\n    }\n}\nexport { Router };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { Router } from '../Router.js';\nimport '../_version.js';\nlet defaultRouter;\n/**\n * Creates a new, singleton Router instance if one does not exist. If one\n * does already exist, that instance is returned.\n *\n * @private\n * @return {Router}\n */\nexport const getOrCreateDefaultRouter = () => {\n    if (!defaultRouter) {\n        defaultRouter = new Router();\n        // The helpers that use the default Router assume these listeners exist.\n        defaultRouter.addFetchListener();\n        defaultRouter.addCacheListener();\n    }\n    return defaultRouter;\n};\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { WorkboxError } from 'workbox-core/_private/WorkboxError.js';\nimport { Route } from './Route.js';\nimport { RegExpRoute } from './RegExpRoute.js';\nimport { getOrCreateDefaultRouter } from './utils/getOrCreateDefaultRouter.js';\nimport './_version.js';\n/**\n * Easily register a RegExp, string, or function with a caching\n * strategy to a singleton Router instance.\n *\n * This method will generate a Route for you if needed and\n * call {@link workbox-routing.Router#registerRoute}.\n *\n * @param {RegExp|string|workbox-routing.Route~matchCallback|workbox-routing.Route} capture\n * If the capture param is a `Route`, all other arguments will be ignored.\n * @param {workbox-routing~handlerCallback} [handler] A callback\n * function that returns a Promise resulting in a Response. This parameter\n * is required if `capture` is not a `Route` object.\n * @param {string} [method='GET'] The HTTP method to match the Route\n * against.\n * @return {workbox-routing.Route} The generated `Route`.\n *\n * @memberof workbox-routing\n */\nfunction registerRoute(capture, handler, method) {\n    let route;\n    if (typeof capture === 'string') {\n        const captureUrl = new URL(capture, location.href);\n        if (process.env.NODE_ENV !== 'production') {\n            if (!(capture.startsWith('/') || capture.startsWith('http'))) {\n                throw new WorkboxError('invalid-string', {\n                    moduleName: 'workbox-routing',\n                    funcName: 'registerRoute',\n                    paramName: 'capture',\n                });\n            }\n            // We want to check if Express-style wildcards are in the pathname only.\n            // TODO: Remove this log message in v4.\n            const valueToCheck = capture.startsWith('http')\n                ? captureUrl.pathname\n                : capture;\n            // See https://github.com/pillarjs/path-to-regexp#parameters\n            const wildcards = '[*:?+]';\n            if (new RegExp(`${wildcards}`).exec(valueToCheck)) {\n                logger.debug(`The '$capture' parameter contains an Express-style wildcard ` +\n                    `character (${wildcards}). Strings are now always interpreted as ` +\n                    `exact matches; use a RegExp for partial or wildcard matches.`);\n            }\n        }\n        const matchCallback = ({ url }) => {\n            if (process.env.NODE_ENV !== 'production') {\n                if (url.pathname === captureUrl.pathname &&\n                    url.origin !== captureUrl.origin) {\n                    logger.debug(`${capture} only partially matches the cross-origin URL ` +\n                        `${url.toString()}. This route will only handle cross-origin requests ` +\n                        `if they match the entire URL.`);\n                }\n            }\n            return url.href === captureUrl.href;\n        };\n        // If `capture` is a string then `handler` and `method` must be present.\n        route = new Route(matchCallback, handler, method);\n    }\n    else if (capture instanceof RegExp) {\n        // If `capture` is a `RegExp` then `handler` and `method` must be present.\n        route = new RegExpRoute(capture, handler, method);\n    }\n    else if (typeof capture === 'function') {\n        // If `capture` is a function then `handler` and `method` must be present.\n        route = new Route(capture, handler, method);\n    }\n    else if (capture instanceof Route) {\n        route = capture;\n    }\n    else {\n        throw new WorkboxError('unsupported-route-type', {\n            moduleName: 'workbox-routing',\n            funcName: 'registerRoute',\n            paramName: 'capture',\n        });\n    }\n    const defaultRouter = getOrCreateDefaultRouter();\n    defaultRouter.registerRoute(route);\n    return route;\n}\nexport { registerRoute };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\n/**\n * Removes any URL search parameters that should be ignored.\n *\n * @param {URL} urlObject The original URL.\n * @param {Array<RegExp>} ignoreURLParametersMatching RegExps to test against\n * each search parameter name. Matches mean that the search parameter should be\n * ignored.\n * @return {URL} The URL with any ignored search parameters removed.\n *\n * @private\n * @memberof workbox-precaching\n */\nexport function removeIgnoredSearchParams(urlObject, ignoreURLParametersMatching = []) {\n    // Convert the iterable into an array at the start of the loop to make sure\n    // deletion doesn't mess up iteration.\n    for (const paramName of [...urlObject.searchParams.keys()]) {\n        if (ignoreURLParametersMatching.some((regExp) => regExp.test(paramName))) {\n            urlObject.searchParams.delete(paramName);\n        }\n    }\n    return urlObject;\n}\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { removeIgnoredSearchParams } from './removeIgnoredSearchParams.js';\nimport '../_version.js';\n/**\n * Generator function that yields possible variations on the original URL to\n * check, one at a time.\n *\n * @param {string} url\n * @param {Object} options\n *\n * @private\n * @memberof workbox-precaching\n */\nexport function* generateURLVariations(url, { ignoreURLParametersMatching = [/^utm_/, /^fbclid$/], directoryIndex = 'index.html', cleanURLs = true, urlManipulation, } = {}) {\n    const urlObject = new URL(url, location.href);\n    urlObject.hash = '';\n    yield urlObject.href;\n    const urlWithoutIgnoredParams = removeIgnoredSearchParams(urlObject, ignoreURLParametersMatching);\n    yield urlWithoutIgnoredParams.href;\n    if (directoryIndex && urlWithoutIgnoredParams.pathname.endsWith('/')) {\n        const directoryURL = new URL(urlWithoutIgnoredParams.href);\n        directoryURL.pathname += directoryIndex;\n        yield directoryURL.href;\n    }\n    if (cleanURLs) {\n        const cleanURL = new URL(urlWithoutIgnoredParams.href);\n        cleanURL.pathname += '.html';\n        yield cleanURL.href;\n    }\n    if (urlManipulation) {\n        const additionalURLs = urlManipulation({ url: urlObject });\n        for (const urlToAttempt of additionalURLs) {\n            yield urlToAttempt.href;\n        }\n    }\n}\n","/*\n  Copyright 2020 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';\nimport { Route } from 'workbox-routing/Route.js';\nimport { generateURLVariations } from './utils/generateURLVariations.js';\nimport './_version.js';\n/**\n * A subclass of {@link workbox-routing.Route} that takes a\n * {@link workbox-precaching.PrecacheController}\n * instance and uses it to match incoming requests and handle fetching\n * responses from the precache.\n *\n * @memberof workbox-precaching\n * @extends workbox-routing.Route\n */\nclass PrecacheRoute extends Route {\n    /**\n     * @param {PrecacheController} precacheController A `PrecacheController`\n     * instance used to both match requests and respond to fetch events.\n     * @param {Object} [options] Options to control how requests are matched\n     * against the list of precached URLs.\n     * @param {string} [options.directoryIndex=index.html] The `directoryIndex` will\n     * check cache entries for a URLs ending with '/' to see if there is a hit when\n     * appending the `directoryIndex` value.\n     * @param {Array<RegExp>} [options.ignoreURLParametersMatching=[/^utm_/, /^fbclid$/]] An\n     * array of regex's to remove search params when looking for a cache match.\n     * @param {boolean} [options.cleanURLs=true] The `cleanURLs` option will\n     * check the cache for the URL with a `.html` added to the end of the end.\n     * @param {workbox-precaching~urlManipulation} [options.urlManipulation]\n     * This is a function that should take a URL and return an array of\n     * alternative URLs that should be checked for precache matches.\n     */\n    constructor(precacheController, options) {\n        const match = ({ request, }) => {\n            const urlsToCacheKeys = precacheController.getURLsToCacheKeys();\n            for (const possibleURL of generateURLVariations(request.url, options)) {\n                const cacheKey = urlsToCacheKeys.get(possibleURL);\n                if (cacheKey) {\n                    const integrity = precacheController.getIntegrityForCacheKey(cacheKey);\n                    return { cacheKey, integrity };\n                }\n            }\n            if (process.env.NODE_ENV !== 'production') {\n                logger.debug(`Precaching did not find a match for ` + getFriendlyURL(request.url));\n            }\n            return;\n        };\n        super(match, precacheController.strategy);\n    }\n}\nexport { PrecacheRoute };\n","/*\n  Copyright 2019 Google LLC\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { registerRoute } from 'workbox-routing/registerRoute.js';\nimport { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController.js';\nimport { PrecacheRoute } from './PrecacheRoute.js';\nimport './_version.js';\n/**\n * Add a `fetch` listener to the service worker that will\n * respond to\n * [network requests]{@link https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers#Custom_responses_to_requests}\n * with precached assets.\n *\n * Requests for assets that aren't precached, the `FetchEvent` will not be\n * responded to, allowing the event to fall through to other `fetch` event\n * listeners.\n *\n * @param {Object} [options] See the {@link workbox-precaching.PrecacheRoute}\n * options.\n *\n * @memberof workbox-precaching\n */\nfunction addRoute(options) {\n    const precacheController = getOrCreatePrecacheController();\n    const precacheRoute = new PrecacheRoute(precacheController, options);\n    registerRoute(precacheRoute);\n}\nexport { addRoute };\n","/*\n  Copyright 2018 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport '../_version.js';\nconst SUBSTRING_TO_FIND = '-precache-';\n/**\n * Cleans up incompatible precaches that were created by older versions of\n * Workbox, by a service worker registered under the current scope.\n *\n * This is meant to be called as part of the `activate` event.\n *\n * This should be safe to use as long as you don't include `substringToFind`\n * (defaulting to `-precache-`) in your non-precache cache names.\n *\n * @param {string} currentPrecacheName The cache name currently in use for\n * precaching. This cache won't be deleted.\n * @param {string} [substringToFind='-precache-'] Cache names which include this\n * substring will be deleted (excluding `currentPrecacheName`).\n * @return {Array<string>} A list of all the cache names that were deleted.\n *\n * @private\n * @memberof workbox-precaching\n */\nconst deleteOutdatedCaches = async (currentPrecacheName, substringToFind = SUBSTRING_TO_FIND) => {\n    const cacheNames = await self.caches.keys();\n    const cacheNamesToDelete = cacheNames.filter((cacheName) => {\n        return (cacheName.includes(substringToFind) &&\n            cacheName.includes(self.registration.scope) &&\n            cacheName !== currentPrecacheName);\n    });\n    await Promise.all(cacheNamesToDelete.map((cacheName) => self.caches.delete(cacheName)));\n    return cacheNamesToDelete;\n};\nexport { deleteOutdatedCaches };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { cacheNames } from 'workbox-core/_private/cacheNames.js';\nimport { logger } from 'workbox-core/_private/logger.js';\nimport { deleteOutdatedCaches } from './utils/deleteOutdatedCaches.js';\nimport './_version.js';\n/**\n * Adds an `activate` event listener which will clean up incompatible\n * precaches that were created by older versions of Workbox.\n *\n * @memberof workbox-precaching\n */\nfunction cleanupOutdatedCaches() {\n    // See https://github.com/Microsoft/TypeScript/issues/28357#issuecomment-436484705\n    self.addEventListener('activate', ((event) => {\n        const cacheName = cacheNames.getPrecacheName();\n        event.waitUntil(deleteOutdatedCaches(cacheName).then((cachesDeleted) => {\n            if (process.env.NODE_ENV !== 'production') {\n                if (cachesDeleted.length > 0) {\n                    logger.log(`The following out-of-date precaches were cleaned up ` +\n                        `automatically:`, cachesDeleted);\n                }\n            }\n        }));\n    }));\n}\nexport { cleanupOutdatedCaches };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { getOrCreatePrecacheController } from './utils/getOrCreatePrecacheController.js';\nimport './_version.js';\n/**\n * Adds items to the precache list, removing any duplicates and\n * stores the files in the\n * {@link workbox-core.cacheNames|\"precache cache\"} when the service\n * worker installs.\n *\n * This method can be called multiple times.\n *\n * Please note: This method **will not** serve any of the cached files for you.\n * It only precaches files. To respond to a network request you call\n * {@link workbox-precaching.addRoute}.\n *\n * If you have a single array of files to precache, you can just call\n * {@link workbox-precaching.precacheAndRoute}.\n *\n * @param {Array<Object|string>} [entries=[]] Array of entries to precache.\n *\n * @memberof workbox-precaching\n */\nfunction precache(entries) {\n    const precacheController = getOrCreatePrecacheController();\n    precacheController.precache(entries);\n}\nexport { precache };\n","/*\n  Copyright 2019 Google LLC\n\n  Use of this source code is governed by an MIT-style\n  license that can be found in the LICENSE file or at\n  https://opensource.org/licenses/MIT.\n*/\nimport { addRoute } from './addRoute.js';\nimport { precache } from './precache.js';\nimport './_version.js';\n/**\n * This method will add entries to the precache list and add a route to\n * respond to fetch events.\n *\n * This is a convenience method that will call\n * {@link workbox-precaching.precache} and\n * {@link workbox-precaching.addRoute} in a single call.\n *\n * @param {Array<Object|string>} entries Array of entries to precache.\n * @param {Object} [options] See the\n * {@link workbox-precaching.PrecacheRoute} options.\n *\n * @memberof workbox-precaching\n */\nfunction precacheAndRoute(entries, options) {\n    precache(entries);\n    addRoute(options);\n}\nexport { precacheAndRoute };\n","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2021 - 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Represents a simple Matrix namespaced value. This will assume that if a stable prefix\n * is provided that the stable prefix should be used when representing the identifier.\n */\nexport class NamespacedValue {\n  // Stable is optional, but one of the two parameters is required, hence the weird-looking types.\n  // Goal is to to have developers explicitly say there is no stable value (if applicable).\n\n  constructor(stable, unstable) {\n    this.stable = stable;\n    this.unstable = unstable;\n    if (!this.unstable && !this.stable) {\n      throw new Error(\"One of stable or unstable values must be supplied\");\n    }\n  }\n  get name() {\n    if (this.stable) {\n      return this.stable;\n    }\n    return this.unstable;\n  }\n  get altName() {\n    if (!this.stable) {\n      return null;\n    }\n    return this.unstable;\n  }\n  get names() {\n    var names = [this.name];\n    var altName = this.altName;\n    if (altName) names.push(altName);\n    return names;\n  }\n  matches(val) {\n    return this.name === val || this.altName === val;\n  }\n\n  // this desperately wants https://github.com/microsoft/TypeScript/pull/26349 at the top level of the class\n  // so we can instantiate `NamespacedValue<string, _, _>` as a default type for that namespace.\n  findIn(obj) {\n    var val = undefined;\n    if (this.name) {\n      val = obj === null || obj === void 0 ? void 0 : obj[this.name];\n    }\n    if (!val && this.altName) {\n      val = obj === null || obj === void 0 ? void 0 : obj[this.altName];\n    }\n    return val;\n  }\n  includedIn(arr) {\n    var included = false;\n    if (this.name) {\n      included = arr.includes(this.name);\n    }\n    if (!included && this.altName) {\n      included = arr.includes(this.altName);\n    }\n    return included;\n  }\n}\nexport class ServerControlledNamespacedValue extends NamespacedValue {\n  constructor() {\n    super(...arguments);\n    _defineProperty(this, \"preferUnstable\", false);\n  }\n  setPreferUnstable(preferUnstable) {\n    this.preferUnstable = preferUnstable;\n  }\n  get name() {\n    if (this.stable && !this.preferUnstable) {\n      return this.stable;\n    }\n    return this.unstable;\n  }\n}\n\n/**\n * Represents a namespaced value which prioritizes the unstable value over the stable\n * value.\n */\nexport class UnstableValue extends NamespacedValue {\n  // Note: Constructor difference is that `unstable` is *required*.\n  constructor(stable, unstable) {\n    super(stable, unstable);\n    if (!this.unstable) {\n      throw new Error(\"Unstable value must be supplied\");\n    }\n  }\n  get name() {\n    return this.unstable;\n  }\n  get altName() {\n    return this.stable;\n  }\n}\n//# sourceMappingURL=NamespacedValue.js.map","/*\nCopyright 2020 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { NamespacedValue, UnstableValue } from \"../NamespacedValue.js\";\nexport var EventType = /*#__PURE__*/function (EventType) {\n  // Room state events\n  EventType[\"RoomCanonicalAlias\"] = \"m.room.canonical_alias\";\n  EventType[\"RoomCreate\"] = \"m.room.create\";\n  EventType[\"RoomJoinRules\"] = \"m.room.join_rules\";\n  EventType[\"RoomMember\"] = \"m.room.member\";\n  EventType[\"RoomThirdPartyInvite\"] = \"m.room.third_party_invite\";\n  EventType[\"RoomPowerLevels\"] = \"m.room.power_levels\";\n  EventType[\"RoomName\"] = \"m.room.name\";\n  EventType[\"RoomTopic\"] = \"m.room.topic\";\n  EventType[\"RoomAvatar\"] = \"m.room.avatar\";\n  EventType[\"RoomPinnedEvents\"] = \"m.room.pinned_events\";\n  EventType[\"RoomEncryption\"] = \"m.room.encryption\";\n  EventType[\"RoomHistoryVisibility\"] = \"m.room.history_visibility\";\n  EventType[\"RoomGuestAccess\"] = \"m.room.guest_access\";\n  EventType[\"RoomServerAcl\"] = \"m.room.server_acl\";\n  EventType[\"RoomTombstone\"] = \"m.room.tombstone\";\n  EventType[\"RoomPredecessor\"] = \"org.matrix.msc3946.room_predecessor\";\n  // Moderation policy lists\n  EventType[\"PolicyRuleUser\"] = \"m.policy.rule.user\";\n  EventType[\"PolicyRuleRoom\"] = \"m.policy.rule.room\";\n  EventType[\"PolicyRuleServer\"] = \"m.policy.rule.server\";\n  EventType[\"SpaceChild\"] = \"m.space.child\";\n  EventType[\"SpaceParent\"] = \"m.space.parent\";\n  // Room timeline events\n  EventType[\"RoomRedaction\"] = \"m.room.redaction\";\n  EventType[\"RoomMessage\"] = \"m.room.message\";\n  EventType[\"RoomMessageEncrypted\"] = \"m.room.encrypted\";\n  EventType[\"Sticker\"] = \"m.sticker\";\n  EventType[\"CallInvite\"] = \"m.call.invite\";\n  EventType[\"CallCandidates\"] = \"m.call.candidates\";\n  EventType[\"CallAnswer\"] = \"m.call.answer\";\n  EventType[\"CallHangup\"] = \"m.call.hangup\";\n  EventType[\"CallReject\"] = \"m.call.reject\";\n  EventType[\"CallSelectAnswer\"] = \"m.call.select_answer\";\n  EventType[\"CallNegotiate\"] = \"m.call.negotiate\";\n  EventType[\"CallSDPStreamMetadataChanged\"] = \"m.call.sdp_stream_metadata_changed\";\n  EventType[\"CallSDPStreamMetadataChangedPrefix\"] = \"org.matrix.call.sdp_stream_metadata_changed\";\n  EventType[\"CallReplaces\"] = \"m.call.replaces\";\n  EventType[\"CallAssertedIdentity\"] = \"m.call.asserted_identity\";\n  EventType[\"CallAssertedIdentityPrefix\"] = \"org.matrix.call.asserted_identity\";\n  EventType[\"CallEncryptionKeysPrefix\"] = \"io.element.call.encryption_keys\";\n  EventType[\"KeyVerificationRequest\"] = \"m.key.verification.request\";\n  EventType[\"KeyVerificationStart\"] = \"m.key.verification.start\";\n  EventType[\"KeyVerificationCancel\"] = \"m.key.verification.cancel\";\n  EventType[\"KeyVerificationMac\"] = \"m.key.verification.mac\";\n  EventType[\"KeyVerificationDone\"] = \"m.key.verification.done\";\n  EventType[\"KeyVerificationKey\"] = \"m.key.verification.key\";\n  EventType[\"KeyVerificationAccept\"] = \"m.key.verification.accept\";\n  // Not used directly - see READY_TYPE in VerificationRequest.\n  EventType[\"KeyVerificationReady\"] = \"m.key.verification.ready\";\n  // use of this is discouraged https://matrix.org/docs/spec/client_server/r0.6.1#m-room-message-feedback\n  EventType[\"RoomMessageFeedback\"] = \"m.room.message.feedback\";\n  EventType[\"Reaction\"] = \"m.reaction\";\n  EventType[\"PollStart\"] = \"org.matrix.msc3381.poll.start\";\n  // Room ephemeral events\n  EventType[\"Typing\"] = \"m.typing\";\n  EventType[\"Receipt\"] = \"m.receipt\";\n  EventType[\"Presence\"] = \"m.presence\";\n  // Room account_data events\n  EventType[\"FullyRead\"] = \"m.fully_read\";\n  EventType[\"Tag\"] = \"m.tag\";\n  EventType[\"SpaceOrder\"] = \"org.matrix.msc3230.space_order\";\n  // MSC3230\n  // User account_data events\n  EventType[\"PushRules\"] = \"m.push_rules\";\n  EventType[\"Direct\"] = \"m.direct\";\n  EventType[\"IgnoredUserList\"] = \"m.ignored_user_list\";\n  // to_device events\n  EventType[\"RoomKey\"] = \"m.room_key\";\n  EventType[\"RoomKeyRequest\"] = \"m.room_key_request\";\n  EventType[\"ForwardedRoomKey\"] = \"m.forwarded_room_key\";\n  EventType[\"Dummy\"] = \"m.dummy\";\n  EventType[\"SecretRequest\"] = \"m.secret.request\";\n  EventType[\"SecretSend\"] = \"m.secret.send\";\n  // Group call events\n  EventType[\"GroupCallPrefix\"] = \"org.matrix.msc3401.call\";\n  EventType[\"GroupCallMemberPrefix\"] = \"org.matrix.msc3401.call.member\";\n  // MatrixRTC events\n  EventType[\"CallNotify\"] = \"org.matrix.msc4075.call.notify\";\n  EventType[\"RTCNotification\"] = \"org.matrix.msc4075.rtc.notification\";\n  EventType[\"RTCDecline\"] = \"org.matrix.msc4310.rtc.decline\";\n  return EventType;\n}({});\nexport var RelationType = /*#__PURE__*/function (RelationType) {\n  RelationType[\"Annotation\"] = \"m.annotation\";\n  RelationType[\"Replace\"] = \"m.replace\";\n  RelationType[\"Reference\"] = \"m.reference\";\n  // Don't use this yet: it's only the stable version. The code still assumes we support the unstable prefix and,\n  // moreover, our tests currently use the unstable prefix. Use THREAD_RELATION_TYPE.name.\n  // Once we support *only* the stable prefix, THREAD_RELATION_TYPE can die and we can switch to this.\n  RelationType[\"Thread\"] = \"m.thread\";\n  return RelationType;\n}({});\nexport var MsgType = /*#__PURE__*/function (MsgType) {\n  MsgType[\"Text\"] = \"m.text\";\n  MsgType[\"Emote\"] = \"m.emote\";\n  MsgType[\"Notice\"] = \"m.notice\";\n  MsgType[\"Image\"] = \"m.image\";\n  MsgType[\"File\"] = \"m.file\";\n  MsgType[\"Audio\"] = \"m.audio\";\n  MsgType[\"Location\"] = \"m.location\";\n  MsgType[\"Video\"] = \"m.video\";\n  MsgType[\"KeyVerificationRequest\"] = \"m.key.verification.request\";\n  return MsgType;\n}({});\nexport var RoomCreateTypeField = \"type\";\nexport var RoomType = /*#__PURE__*/function (RoomType) {\n  RoomType[\"Space\"] = \"m.space\";\n  RoomType[\"UnstableCall\"] = \"org.matrix.msc3417.call\";\n  RoomType[\"ElementVideo\"] = \"io.element.video\";\n  return RoomType;\n}({});\nexport var ToDeviceMessageId = \"org.matrix.msgid\";\n\n/**\n * Identifier for an [MSC3088](https://github.com/matrix-org/matrix-doc/pull/3088)\n * room purpose. Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport var UNSTABLE_MSC3088_PURPOSE = new UnstableValue(\"m.room.purpose\", \"org.matrix.msc3088.purpose\");\n\n/**\n * Enabled flag for an [MSC3088](https://github.com/matrix-org/matrix-doc/pull/3088)\n * room purpose. Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport var UNSTABLE_MSC3088_ENABLED = new UnstableValue(\"m.enabled\", \"org.matrix.msc3088.enabled\");\n\n/**\n * Subtype for an [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room.\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n */\nexport var UNSTABLE_MSC3089_TREE_SUBTYPE = new UnstableValue(\"m.data_tree\", \"org.matrix.msc3089.data_tree\");\n\n/**\n * Leaf type for an event in a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room.\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n */\nexport var UNSTABLE_MSC3089_LEAF = new UnstableValue(\"m.leaf\", \"org.matrix.msc3089.leaf\");\n\n/**\n * Branch (Leaf Reference) type for the index approach in a\n * [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room. Note that this reference is\n * UNSTABLE and subject to breaking changes, including its eventual removal.\n */\nexport var UNSTABLE_MSC3089_BRANCH = new UnstableValue(\"m.branch\", \"org.matrix.msc3089.branch\");\n\n/**\n * Marker event type to point back at imported historical content in a room. See\n * [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716).\n * Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport var UNSTABLE_MSC2716_MARKER = new UnstableValue(\"m.room.marker\", \"org.matrix.msc2716.marker\");\n\n/**\n * Name of the request property for relation based redactions.\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/3912}\n */\nexport var MSC3912_RELATION_BASED_REDACTIONS_PROP = new UnstableValue(\"with_rel_types\", \"org.matrix.msc3912.with_relations\");\n\n/**\n * Functional members type for declaring a purpose of room members (e.g. helpful bots).\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n *\n * Schema (TypeScript):\n * ```\n * {\n *   service_members?: string[]\n * }\n * ```\n *\n * @example\n * ```\n * {\n *   \"service_members\": [\n *     \"@helperbot:localhost\",\n *     \"@reminderbot:alice.tdl\"\n *   ]\n * }\n * ```\n */\nexport var UNSTABLE_ELEMENT_FUNCTIONAL_USERS = new UnstableValue(\"io.element.functional_members\", \"io.element.functional_members\");\n\n/**\n * A type of message that affects visibility of a message,\n * as per https://github.com/matrix-org/matrix-doc/pull/3531\n *\n * @experimental\n */\nexport var EVENT_VISIBILITY_CHANGE_TYPE = new UnstableValue(\"m.visibility\", \"org.matrix.msc3531.visibility\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3881\n *\n * @experimental\n */\nexport var PUSHER_ENABLED = new UnstableValue(\"enabled\", \"org.matrix.msc3881.enabled\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3881\n *\n * @experimental\n */\nexport var PUSHER_DEVICE_ID = new UnstableValue(\"device_id\", \"org.matrix.msc3881.device_id\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3890\n *\n * @experimental\n */\nexport var LOCAL_NOTIFICATION_SETTINGS_PREFIX = new UnstableValue(\"m.local_notification_settings\", \"org.matrix.msc3890.local_notification_settings\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/4023\n *\n * @experimental\n */\nexport var UNSIGNED_THREAD_ID_FIELD = new UnstableValue(\"thread_id\", \"org.matrix.msc4023.thread_id\");\n\n/**\n * https://github.com/matrix-org/matrix-spec-proposals/pull/4115\n *\n * @experimental\n */\nexport var UNSIGNED_MEMBERSHIP_FIELD = new NamespacedValue(\"membership\", \"io.element.msc4115.membership\");\n\n/**\n * Mapped type from event type to content type for all specified non-state room events.\n */\n\n/**\n * Mapped type from event type to content type for all specified room state events.\n */\n\n/**\n * Mapped type from event type to content type for all specified global account_data events.\n */\n\n/**\n * Mapped type from event type to content type for all specified global events encrypted by secret storage.\n *\n * See https://spec.matrix.org/v1.13/client-server-api/#msecret_storagev1aes-hmac-sha2-1\n */\n//# sourceMappingURL=event.js.map","export const DEFAULT_NOTIFICATION_ICON = '/public/res/logo-maskable/logo-maskable-180x180.png';\nexport const DEFAULT_NOTIFICATION_BADGE = '/public/res/logo-maskable/logo-maskable-72x72.png';\nexport const DEFAULT_MESSAGE_PREVIEW = 'new message';\nexport const ENCRYPTED_MESSAGE_PREVIEW = 'Encrypted message';\n\ntype RoomMessageNotificationInput = {\n  roomName?: string;\n  username?: string;\n  roomAvatar?: string;\n  previewText?: string;\n  silent?: boolean;\n  eventId?: string;\n  data?: unknown;\n  /** Matrix user ID of the account that received the notification. When provided,\n   * the account's localpart is appended to the title so multi-account users know\n   * which account the notification is for. */\n  recipientId?: string;\n};\n\ntype NotificationPayload = {\n  title: string;\n  options: NotificationOptions;\n};\n\ntype NotificationPreviewInput = {\n  content?: unknown;\n  eventType?: string;\n  isEncryptedRoom?: boolean;\n  showMessageContent: boolean;\n  showEncryptedMessageContent: boolean;\n};\n\nconst getString = (value: unknown, fallback: string): string => {\n  if (typeof value !== 'string') return fallback;\n  const normalized = value.trim();\n  return normalized.length > 0 ? normalized : fallback;\n};\n\nconst getBodyFromContent = (content: unknown): string | undefined => {\n  if (!content || typeof content !== 'object') return undefined;\n  const { body } = content as Record<string, unknown>;\n  if (typeof body !== 'string') return undefined;\n  const normalized = body.trim();\n  return normalized.length > 0 ? normalized : undefined;\n};\n\nexport const resolveNotificationPreviewText = ({\n  content,\n  eventType,\n  isEncryptedRoom,\n  showMessageContent,\n  showEncryptedMessageContent,\n}: NotificationPreviewInput): string => {\n  // Handle reactions specially - show the reaction emoji\n  if (eventType === 'm.reaction' && content && typeof content === 'object') {\n    const relatesTo = (content as Record<string, unknown>)['m.relates_to'];\n    if (relatesTo && typeof relatesTo === 'object') {\n      const { key } = relatesTo as Record<string, unknown>;\n      if (typeof key === 'string') {\n        return `Reacted with ${key}`;\n      }\n    }\n    return 'Added a reaction';\n  }\n\n  const encryptedContext = isEncryptedRoom || eventType === 'm.room.encrypted';\n\n  if (!showMessageContent) {\n    return encryptedContext ? ENCRYPTED_MESSAGE_PREVIEW : DEFAULT_MESSAGE_PREVIEW;\n  }\n  if (encryptedContext && !showEncryptedMessageContent) {\n    return ENCRYPTED_MESSAGE_PREVIEW;\n  }\n\n  const body = getBodyFromContent(content);\n  if (body) return body;\n\n  return encryptedContext ? ENCRYPTED_MESSAGE_PREVIEW : DEFAULT_MESSAGE_PREVIEW;\n};\n\n/** Extracts the localpart (everything between @ and the first :) from a Matrix user ID. */\nconst toLocalpart = (userId: string): string => userId.match(/^@([^:]+):/)?.[1] ?? userId;\n\nexport const buildRoomMessageNotification = ({\n  roomName,\n  username,\n  roomAvatar,\n  previewText,\n  silent,\n  eventId,\n  data,\n  recipientId,\n}: RoomMessageNotificationInput): NotificationPayload => {\n  const sender = getString(username, 'Someone');\n  const room = getString(roomName, 'Unknown');\n  const message = getString(previewText, DEFAULT_MESSAGE_PREVIEW);\n  const avatar = getString(roomAvatar, DEFAULT_NOTIFICATION_ICON);\n  const recipientSuffix = recipientId ? ` • ${toLocalpart(recipientId)}` : '';\n\n  return {\n    title: `${sender} in ${room}${recipientSuffix}`,\n    options: {\n      icon: avatar,\n      badge: avatar || DEFAULT_NOTIFICATION_BADGE,\n      body: `${sender}: ${message}`,\n      silent,\n      tag: eventId ?? `${room}-${sender}`,\n      data,\n    },\n  };\n};\n","/* oxlint-disable no-console */\n// Keep the service worker import graph narrow, the app barrel pulls in runtime Matrix SDK modules that break SW script evaluation\nimport { EventType } from 'matrix-js-sdk/lib/@types/event';\nimport {\n  buildRoomMessageNotification,\n  DEFAULT_NOTIFICATION_ICON,\n  DEFAULT_NOTIFICATION_BADGE,\n  resolveNotificationPreviewText,\n} from '../app/utils/notificationStyle';\n\ntype NotificationSettings = {\n  showMessageContent: boolean;\n  showEncryptedMessageContent: boolean;\n};\n\ninterface MatrixPushData {\n  type?: string;\n  content?: { notification_type?: string; membership?: string };\n  sender_display_name?: string;\n  room_name?: string;\n  room_id?: string;\n  room_avatar_url?: string;\n  event_id?: string;\n  user_id?: string;\n  timestamp?: number;\n  data?: Record<string, unknown>;\n}\n\nconst resolveSilent = (): boolean => false;\n\nexport const createPushNotifications = (\n  self: ServiceWorkerGlobalScope,\n  getNotificationSettings: () => NotificationSettings\n) => {\n  const showNotificationWithData = async (\n    title: string,\n    body: string | undefined,\n    data: Record<string, unknown>,\n    silent?: boolean,\n    icon?: string,\n    badge?: string\n  ) => {\n    const roomId: string | undefined = data?.room_id as string | undefined;\n    // Group by room so new messages in the same room replace the previous\n    // notification rather than stacking individually. renotify: true ensures\n    // the user is still alerted when the existing tag is replaced.\n    const tag: string = roomId ? `room-${roomId}` : ((data?.event_id as string) ?? 'Cinny');\n    const renotify = !!roomId;\n    // `renotify` is a valid Web API property absent from TypeScript's NotificationOptions type.\n    // Build the options object separately to avoid the excess-property check, then cast.\n    const notifOptions = {\n      body,\n      icon: icon ?? DEFAULT_NOTIFICATION_ICON,\n      badge: badge ?? DEFAULT_NOTIFICATION_BADGE,\n      tag,\n      renotify,\n      silent,\n      data,\n    };\n    console.debug('[SW showNotification] title:', title, '| data:', JSON.stringify(data, null, 2));\n    await self.registration.showNotification(title, notifOptions as NotificationOptions);\n  };\n\n  const handleCallNotification = async (pushData: MatrixPushData) => {\n    const content = pushData?.content as { notification_type?: string } | undefined;\n    if (content?.notification_type !== 'ring') return;\n\n    const senderDisplayName = pushData?.sender_display_name;\n    const roomName = pushData?.room_name;\n    const title = 'Incoming Call';\n    const body = senderDisplayName\n      ? `${senderDisplayName} is calling you ${roomName ? `in ${roomName}` : ''}`\n      : 'Incoming voice chat';\n\n    const data = {\n      type: pushData?.type,\n      room_id: pushData?.room_id,\n      user_id: pushData?.user_id,\n      timestamp: Date.now(),\n      isCall: true,\n      ...pushData.data,\n    };\n\n    await showNotificationWithData(title, body, data, resolveSilent(), pushData?.room_avatar_url);\n  };\n\n  const handleRoomMessageNotification = async (pushData: MatrixPushData) => {\n    const data: Record<string, unknown> = {\n      type: pushData?.type,\n      room_id: pushData?.room_id,\n      event_id: pushData?.event_id,\n      user_id: pushData?.user_id,\n      timestamp: Date.now(),\n      ...pushData.data,\n    };\n    const notificationPayload = buildRoomMessageNotification({\n      roomName: pushData?.room_name,\n      username: pushData?.sender_display_name,\n      roomAvatar: pushData?.room_avatar_url,\n      previewText: resolveNotificationPreviewText({\n        content: pushData?.content,\n        eventType: pushData?.type,\n        isEncryptedRoom: false,\n        showMessageContent: getNotificationSettings().showMessageContent,\n        showEncryptedMessageContent: getNotificationSettings().showEncryptedMessageContent,\n      }),\n      silent: resolveSilent(),\n      eventId: pushData?.event_id,\n      recipientId: typeof pushData?.user_id === 'string' ? pushData.user_id : undefined,\n      data,\n    });\n    await showNotificationWithData(\n      notificationPayload.title,\n      notificationPayload.options.body,\n      data,\n      notificationPayload.options.silent ?? undefined,\n      notificationPayload.options.icon,\n      notificationPayload.options.badge\n    );\n  };\n\n  const handleEncryptedMessageNotification = async (pushData: MatrixPushData) => {\n    const data: Record<string, unknown> = {\n      type: pushData?.type,\n      room_id: pushData?.room_id,\n      event_id: pushData?.event_id,\n      user_id: pushData?.user_id,\n      timestamp: Date.now(),\n      ...pushData.data,\n    };\n    const notificationPayload = buildRoomMessageNotification({\n      roomName: pushData?.room_name,\n      username: pushData?.sender_display_name,\n      roomAvatar: pushData?.room_avatar_url,\n      previewText: resolveNotificationPreviewText({\n        content: pushData?.content,\n        eventType: pushData?.type,\n        isEncryptedRoom: true,\n        showMessageContent: getNotificationSettings().showMessageContent,\n        showEncryptedMessageContent: getNotificationSettings().showEncryptedMessageContent,\n      }),\n      silent: resolveSilent(),\n      eventId: pushData?.event_id,\n      recipientId: typeof pushData?.user_id === 'string' ? pushData.user_id : undefined,\n      data,\n    });\n    await showNotificationWithData(\n      notificationPayload.title,\n      notificationPayload.options.body,\n      data,\n      notificationPayload.options.silent ?? undefined,\n      notificationPayload.options.icon,\n      notificationPayload.options.badge\n    );\n  };\n\n  const handleInvitationNotification = async (pushData: MatrixPushData) => {\n    const senderDisplayName = pushData?.sender_display_name;\n    const roomName = pushData?.room_name;\n\n    let body = '';\n    if (senderDisplayName && roomName) body = `${senderDisplayName} invites you to ${roomName}`;\n    if (senderDisplayName && !roomName) body = `from ${senderDisplayName}`;\n    if (!senderDisplayName && roomName) body = `to ${roomName}`;\n    if (!senderDisplayName && !roomName) body = '';\n\n    const data = {\n      type: pushData?.type,\n      content: pushData?.content,\n      user_id: pushData?.user_id,\n      timestamp: Date.now(),\n      ...pushData.data,\n    };\n\n    await showNotificationWithData('New Invitation', body, data, resolveSilent());\n  };\n\n  const handlePushNotificationPushData = async (pushData: MatrixPushData) => {\n    const eventType = pushData?.type as EventType | undefined;\n    if (!eventType) {\n      console.warn('no event type');\n    }\n\n    switch (eventType as string) {\n      case EventType.RoomMessage as string:\n      case EventType.Sticker as string:\n        await handleRoomMessageNotification(pushData);\n        break;\n      case EventType.RoomMessageEncrypted as string:\n        await handleEncryptedMessageNotification(pushData);\n        break;\n      case EventType.RoomMember as string:\n        if (!((pushData?.content as { membership?: string } | undefined)?.membership === 'invite'))\n          break;\n        await handleInvitationNotification(pushData);\n        break;\n      case 'org.matrix.msc4075.call.notify':\n      case 'org.matrix.msc4075.rtc.notification':\n        await handleCallNotification(pushData);\n        break;\n      default:\n        // no voip support in app anyway\n        break;\n    }\n  };\n\n  return { handlePushNotificationPushData };\n};\n","/// <reference lib=\"WebWorker\" />\n\n/* oxlint-disable no-console, unicorn/require-post-message-target-origin */\nimport { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching';\n\nimport { createPushNotifications } from './sw/pushNotification';\n\ndeclare const self: ServiceWorkerGlobalScope;\n\nlet notificationSoundEnabled = true;\n// Tracks whether a page client has reported itself as visible.\n// The clients.matchAll() visibilityState is unreliable on iOS Safari PWA,\n// so we use this explicit flag as a fallback.\nlet appIsVisible = false;\nlet showMessageContent = false;\nlet showEncryptedMessageContent = false;\nlet clearNotificationsOnRead = false;\nconst { handlePushNotificationPushData } = createPushNotifications(self, () => ({\n  showMessageContent,\n  showEncryptedMessageContent,\n}));\n\n/** Cache key used to persist notification settings across SW restarts (iOS kills the SW frequently). */\nconst SW_SETTINGS_CACHE = 'sable-sw-settings-v1';\nconst SW_SETTINGS_URL = '/sw-settings-meta';\n\n/** Cache key used to persist the active session so push-event fetches work after SW restart. */\nconst SW_SESSION_CACHE = 'sable-sw-session-v1';\nconst SW_SESSION_URL = '/sw-session-meta';\n\nasync function persistSettings() {\n  try {\n    const cache = await self.caches.open(SW_SETTINGS_CACHE);\n    await cache.put(\n      SW_SETTINGS_URL,\n      new Response(\n        JSON.stringify({\n          notificationSoundEnabled,\n          showMessageContent,\n          showEncryptedMessageContent,\n          clearNotificationsOnRead,\n        }),\n        { headers: { 'Content-Type': 'application/json' } }\n      )\n    );\n  } catch {\n    // Ignore — caches may be unavailable in some environments.\n  }\n}\n\nasync function loadPersistedSettings() {\n  try {\n    const cache = await self.caches.open(SW_SETTINGS_CACHE);\n    const response = await cache.match(SW_SETTINGS_URL);\n    if (!response) return;\n    const s = await response.json();\n    if (typeof s.notificationSoundEnabled === 'boolean')\n      notificationSoundEnabled = s.notificationSoundEnabled;\n    if (typeof s.showMessageContent === 'boolean') showMessageContent = s.showMessageContent;\n    if (typeof s.showEncryptedMessageContent === 'boolean')\n      showEncryptedMessageContent = s.showEncryptedMessageContent;\n    if (typeof s.clearNotificationsOnRead === 'boolean')\n      clearNotificationsOnRead = s.clearNotificationsOnRead;\n  } catch {\n    // Ignore — stale or missing cache is fine; we fall back to defaults.\n  }\n}\n\nasync function persistSession(session: SessionInfo): Promise<void> {\n  try {\n    const cache = await self.caches.open(SW_SESSION_CACHE);\n    await cache.put(\n      SW_SESSION_URL,\n      new Response(JSON.stringify(session), {\n        headers: { 'Content-Type': 'application/json' },\n      })\n    );\n  } catch {\n    // Ignore — caches may be unavailable in some environments.\n  }\n}\n\nasync function clearPersistedSession(): Promise<void> {\n  try {\n    const cache = await self.caches.open(SW_SESSION_CACHE);\n    await cache.delete(SW_SESSION_URL);\n  } catch {\n    // Ignore.\n  }\n}\n\nasync function loadPersistedSession(): Promise<SessionInfo | undefined> {\n  try {\n    const cache = await self.caches.open(SW_SESSION_CACHE);\n    const response = await cache.match(SW_SESSION_URL);\n    if (!response) return undefined;\n    const s = await response.json();\n    if (typeof s.accessToken === 'string' && typeof s.baseUrl === 'string') {\n      return {\n        accessToken: s.accessToken,\n        baseUrl: s.baseUrl,\n        userId: typeof s.userId === 'string' ? s.userId : undefined,\n      };\n    }\n    return undefined;\n  } catch {\n    return undefined;\n  }\n}\n\ntype SessionInfo = {\n  accessToken: string;\n  baseUrl: string;\n  /** Matrix user ID of the account, used to identify which account a push belongs to. */\n  userId?: string;\n};\n\n/**\n * Store session per client (tab)\n */\nconst sessions = new Map<string, SessionInfo>();\n\n/**\n * Session pre-loaded from cache on SW activation. Acts as an immediate\n * fallback so media fetches don't 401 during the window between SW restart\n * and the first live setSession message from the page.\n * Cleared as soon as any real setSession call comes in.\n */\nlet preloadedSession: SessionInfo | undefined;\n\nconst clientToResolve = new Map<string, (value: SessionInfo | undefined) => void>();\nconst clientToSessionPromise = new Map<string, Promise<SessionInfo | undefined>>();\n\nasync function cleanupDeadClients() {\n  const activeClients = await self.clients.matchAll();\n  const activeIds = new Set(activeClients.map((c) => c.id));\n\n  Array.from(sessions.keys()).forEach((id) => {\n    if (!activeIds.has(id)) {\n      sessions.delete(id);\n      clientToResolve.delete(id);\n      clientToSessionPromise.delete(id);\n    }\n  });\n}\n\nfunction setSession(clientId: string, accessToken: unknown, baseUrl: unknown, userId?: unknown) {\n  if (typeof accessToken === 'string' && typeof baseUrl === 'string') {\n    const info: SessionInfo = {\n      accessToken,\n      baseUrl,\n      userId: typeof userId === 'string' ? userId : undefined,\n    };\n    sessions.set(clientId, info);\n    // A real session has arrived — discard the preloaded fallback.\n    preloadedSession = undefined;\n    console.debug('[SW] setSession: stored', clientId, baseUrl);\n    // Persist so push-event fetches work after iOS restarts the SW.\n    persistSession(info).catch(() => undefined);\n  } else {\n    // Logout or invalid session\n    sessions.delete(clientId);\n    preloadedSession = undefined;\n    console.debug('[SW] setSession: removed', clientId);\n    clearPersistedSession().catch(() => undefined);\n  }\n\n  const resolveSession = clientToResolve.get(clientId);\n  if (resolveSession) {\n    resolveSession(sessions.get(clientId));\n    clientToResolve.delete(clientId);\n    clientToSessionPromise.delete(clientId);\n  }\n}\n\nfunction requestSession(client: Client): Promise<SessionInfo | undefined> {\n  const promise =\n    clientToSessionPromise.get(client.id) ??\n    new Promise((resolve) => {\n      clientToResolve.set(client.id, resolve);\n      client.postMessage({ type: 'requestSession' });\n    });\n\n  if (!clientToSessionPromise.has(client.id)) {\n    clientToSessionPromise.set(client.id, promise);\n  }\n\n  return promise;\n}\n\nasync function requestSessionWithTimeout(\n  clientId: string,\n  timeoutMs = 3000\n): Promise<SessionInfo | undefined> {\n  const client = await self.clients.get(clientId);\n  if (!client) {\n    console.warn('[SW] requestSessionWithTimeout: client not found', clientId);\n    return undefined;\n  }\n\n  const sessionPromise = requestSession(client);\n\n  const timeout = new Promise<undefined>((resolve) => {\n    setTimeout(() => {\n      console.warn('[SW] requestSessionWithTimeout: timed out after', timeoutMs, 'ms', clientId);\n      resolve(undefined);\n    }, timeoutMs);\n  });\n\n  return Promise.race([sessionPromise, timeout]);\n}\n\n// ---------------------------------------------------------------------------\n// Encrypted push — decryption relay\n// ---------------------------------------------------------------------------\n\n/**\n * The shape returned by the client tab after decrypting an encrypted push event.\n * Also used as a partial pushData object for handlePushNotificationPushData.\n */\ntype DecryptionResult = {\n  eventId: string;\n  success: boolean;\n  eventType?: string;\n  content?: unknown;\n  sender_display_name?: string;\n  room_name?: string;\n  /** document.visibilityState reported by the responding app tab. */\n  visibilityState?: string;\n};\n\n/** Pending decryption requests keyed by event_id. */\nconst decryptionPendingMap = new Map<string, (result: DecryptionResult) => void>();\n\n/**\n * Fetch a single raw Matrix event from the homeserver.\n * Returns undefined on error (e.g. network failure, auth error, redacted event).\n */\nasync function fetchRawEvent(\n  baseUrl: string,\n  accessToken: string,\n  roomId: string,\n  eventId: string\n): Promise<Record<string, unknown> | undefined> {\n  try {\n    const url = `${baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/event/${encodeURIComponent(eventId)}`;\n    const res = await fetch(url, {\n      headers: { Authorization: `Bearer ${accessToken}` },\n    });\n    if (!res.ok) {\n      console.warn('[SW fetchRawEvent] HTTP', res.status, 'for', eventId);\n      return undefined;\n    }\n    return (await res.json()) as Record<string, unknown>;\n  } catch (err) {\n    console.warn('[SW fetchRawEvent] error', err);\n    return undefined;\n  }\n}\n\n/**\n * Fetch the m.room.name state event from the homeserver.\n * Returns undefined when not set (DMs and many encrypted rooms have no explicit name).\n */\nasync function fetchRoomName(\n  baseUrl: string,\n  accessToken: string,\n  roomId: string\n): Promise<string | undefined> {\n  try {\n    const url = `${baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/m.room.name`;\n    const res = await fetch(url, {\n      headers: { Authorization: `Bearer ${accessToken}` },\n    });\n    if (!res.ok) return undefined;\n    const data = (await res.json()) as Record<string, unknown>;\n    const { name } = data;\n    return typeof name === 'string' && name.trim() ? name.trim() : undefined;\n  } catch {\n    return undefined;\n  }\n}\n\ntype MemberInfo = {\n  displayname: string | undefined;\n  avatarUrl: string | undefined;\n};\n\n/**\n * Fetch a room member's state from the homeserver.\n * Returns displayname and avatar_url (both may be undefined).\n */\nasync function fetchMemberInfo(\n  baseUrl: string,\n  accessToken: string,\n  roomId: string,\n  userId: string\n): Promise<MemberInfo> {\n  try {\n    const url = `${baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/m.room.member/${encodeURIComponent(userId)}`;\n    const res = await fetch(url, {\n      headers: { Authorization: `Bearer ${accessToken}` },\n    });\n    if (!res.ok) return { displayname: undefined, avatarUrl: undefined };\n    const data = (await res.json()) as Record<string, unknown>;\n    const displayname =\n      typeof data.displayname === 'string' && data.displayname.trim()\n        ? data.displayname.trim()\n        : undefined;\n    const avatarUrl =\n      typeof data.avatar_url === 'string' && data.avatar_url.trim()\n        ? data.avatar_url.trim()\n        : undefined;\n    return { displayname, avatarUrl };\n  } catch {\n    return { displayname: undefined, avatarUrl: undefined };\n  }\n}\n\n/**\n * Fetch the m.room.avatar state event URL from the homeserver.\n * Returns undefined when the room has no avatar or the request fails.\n */\nasync function fetchRoomAvatar(\n  baseUrl: string,\n  accessToken: string,\n  roomId: string\n): Promise<string | undefined> {\n  try {\n    const url = `${baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/state/m.room.avatar`;\n    const res = await fetch(url, {\n      headers: { Authorization: `Bearer ${accessToken}` },\n    });\n    if (!res.ok) return undefined;\n    const data = (await res.json()) as Record<string, unknown>;\n    const avatarUrl = data.url;\n    return typeof avatarUrl === 'string' && avatarUrl.trim() ? avatarUrl.trim() : undefined;\n  } catch {\n    return undefined;\n  }\n}\n\n/**\n * Convert an mxc:// URL to a legacy unauthenticated thumbnail URL.\n * Notification icons are fetched by the OS without auth headers, so we use\n * the pre-MSC3916 media endpoint which most homeservers still serve publicly.\n */\nfunction mxcToNotificationUrl(mxcUrl: string, baseUrl: string): string | undefined {\n  const match = mxcUrl.match(/^mxc:\\/\\/([^/]+)\\/([^?#]+)/);\n  if (!match || !match[1] || !match[2]) return undefined;\n  const [, server, mediaId] = match;\n  return `${baseUrl}/_matrix/media/v3/thumbnail/${encodeURIComponent(server)}/${encodeURIComponent(mediaId)}?width=96&height=96&method=crop`;\n}\n\n/**\n * Return the first any-session we have stored (used for push fetches where we\n * don't have a client ID, e.g. when the app is backgrounded but still loaded).\n */\nfunction getAnyStoredSession(): SessionInfo | undefined {\n  return sessions.values().next().value;\n}\n\n/**\n * Extract the MXID localpart (@user:server → user) for fallback display names.\n */\nfunction mxidLocalpart(userId: string): string {\n  return userId.match(/^@([^:]+):/)?.[1] ?? userId;\n}\n\n/**\n * Post a decryptPushEvent request to one of the open window clients and wait\n * up to 5 s for the pushDecryptResult reply.\n */\nasync function requestDecryptionFromClient(\n  windowClients: readonly Client[],\n  rawEvent: Record<string, unknown>\n): Promise<DecryptionResult | undefined> {\n  const eventId = rawEvent.event_id as string;\n\n  // Chain clients sequentially using reduce to avoid await-in-loop and for-of.\n  return Array.from(windowClients).reduce(\n    async (prevPromise, client) => {\n      const prev = await prevPromise;\n      if (prev?.success) return prev;\n\n      const promise = new Promise<DecryptionResult>((resolve) => {\n        decryptionPendingMap.set(eventId, resolve);\n      });\n\n      const timeout = new Promise<undefined>((resolve) => {\n        setTimeout(() => {\n          decryptionPendingMap.delete(eventId);\n          console.warn('[SW decryptRelay] timed out waiting for client', client.id);\n          resolve(undefined);\n        }, 5000);\n      });\n\n      try {\n        (client as WindowClient).postMessage({\n          type: 'decryptPushEvent',\n          rawEvent,\n        });\n      } catch (err) {\n        decryptionPendingMap.delete(eventId);\n        console.warn('[SW decryptRelay] postMessage error', err);\n        return undefined;\n      }\n\n      return Promise.race([promise, timeout]);\n    },\n    Promise.resolve(undefined) as Promise<DecryptionResult | undefined>\n  );\n}\n\n/**\n * Handle a minimal push payload (event_id_only format).\n * Fetches the event from the homeserver and shows a notification.\n * For encrypted events, attempts to relay decryption to an open app tab.\n */\nasync function handleMinimalPushPayload(\n  roomId: string,\n  eventId: string,\n  windowClients: readonly Client[]\n): Promise<void> {\n  // On iOS the SW is killed and restarted for every push, clearing the in-memory sessions\n  // Map.  Fall back to the Cache Storage copy that was written when the user last opened\n  // the app (same pattern as settings persistence).\n  const session = getAnyStoredSession() ?? (await loadPersistedSession());\n\n  if (!session) {\n    // No session anywhere — app was never opened since install, or the user logged out.\n    // Show a minimal actionable notification so the user can tap through to the room.\n    console.debug('[SW push] minimal payload: no session, showing generic notification');\n    await self.registration.showNotification('New Message', {\n      body: undefined,\n      icon: '/public/res/logo-maskable/logo-maskable-180x180.png',\n      badge: '/public/res/logo-maskable/logo-maskable-72x72.png',\n      tag: `room-${roomId}`,\n      renotify: true,\n      data: { room_id: roomId, event_id: eventId },\n    } as NotificationOptions);\n    return;\n  }\n\n  // Fetch the raw event, room name, and room avatar in parallel — all need only roomId.\n  const [rawEvent, roomNameFromState, roomAvatarMxc] = await Promise.all([\n    fetchRawEvent(session.baseUrl, session.accessToken, roomId, eventId),\n    fetchRoomName(session.baseUrl, session.accessToken, roomId),\n    fetchRoomAvatar(session.baseUrl, session.accessToken, roomId),\n  ]);\n\n  if (!rawEvent) {\n    await self.registration.showNotification('New Message', {\n      body: undefined,\n      icon: '/public/res/logo-maskable/logo-maskable-180x180.png',\n      badge: '/public/res/logo-maskable/logo-maskable-72x72.png',\n      tag: `room-${roomId}`,\n      renotify: true,\n      data: { room_id: roomId, event_id: eventId, user_id: session.userId },\n    } as NotificationOptions);\n    return;\n  }\n\n  const eventType = rawEvent.type as string | undefined;\n  const sender = rawEvent.sender as string | undefined;\n  // Fetch sender's member state — gives us both display name and avatar URL.\n  const memberInfo = sender\n    ? await fetchMemberInfo(session.baseUrl, session.accessToken, roomId, sender)\n    : { displayname: undefined, avatarUrl: undefined };\n  // Fall back to MXID localpart when the server returns no displayname.\n  const senderDisplay = memberInfo.displayname ?? (sender ? mxidLocalpart(sender) : 'Someone');\n  // For DMs (no m.room.name state), use the sender's display name as the room name.\n  const resolvedRoomName = roomNameFromState ?? senderDisplay;\n  // Room avatar takes priority (group rooms); for DMs fall back to sender's member avatar.\n  // Convert mxc:// to a legacy unauthenticated thumbnail URL so the OS can fetch it.\n  const notificationAvatarUrl =\n    (roomAvatarMxc ?? memberInfo.avatarUrl) !== undefined\n      ? mxcToNotificationUrl((roomAvatarMxc ?? memberInfo.avatarUrl)!, session.baseUrl)\n      : undefined;\n  const baseData = {\n    room_id: roomId,\n    event_id: eventId,\n    user_id: session.userId,\n  };\n\n  if (eventType === 'm.room.encrypted') {\n    // Try to relay decryption to an open app tab.\n    const result =\n      windowClients.length > 0\n        ? await requestDecryptionFromClient(windowClients, rawEvent)\n        : undefined;\n\n    // If the relay responded and the app is currently visible, the in-app UI is already\n    // displaying the message — skip the OS notification entirely.\n    if (result?.visibilityState === 'visible') return;\n\n    if (result?.success) {\n      // App was backgrounded but not frozen — decryption succeeded.\n      // Prefer the server-fetched display name (authoritative) over the relay's SDK cache\n      // value, which may be stale or missing if the SDK hasn't fully synced yet.\n      await handlePushNotificationPushData({\n        ...baseData,\n        type: result.eventType,\n        content: result.content as { notification_type?: string; membership?: string } | undefined,\n        sender_display_name: senderDisplay,\n        // Prefer relay's room name (has m.direct / computed SDK name); fall back to state fetch.\n        room_name: result.room_name || resolvedRoomName,\n        room_avatar_url: notificationAvatarUrl,\n      });\n    } else {\n      // App is frozen or fully closed — show \"Encrypted message\" fallback.\n      await handlePushNotificationPushData({\n        ...baseData,\n        type: 'm.room.encrypted',\n        content: {},\n        sender_display_name: senderDisplay,\n        room_name: resolvedRoomName,\n        room_avatar_url: notificationAvatarUrl,\n      });\n    }\n  } else {\n    // Unencrypted event — we have the plaintext, show it.\n    await handlePushNotificationPushData({\n      ...baseData,\n      type: eventType,\n      content: rawEvent.content as { notification_type?: string; membership?: string } | undefined,\n      sender_display_name: senderDisplay,\n      room_name: resolvedRoomName,\n      room_avatar_url: notificationAvatarUrl,\n    });\n  }\n}\n\nself.addEventListener('install', (event: ExtendableEvent) => {\n  event.waitUntil(self.skipWaiting());\n});\n\nself.addEventListener('activate', (event: ExtendableEvent) => {\n  event.waitUntil(\n    (async () => {\n      await self.clients.claim();\n      await cleanupDeadClients();\n      // Pre-load the persisted session into memory so that media fetches arriving\n      // before the first setSession message from the page are immediately\n      // authenticated rather than falling through to a 3-second timeout.\n      preloadedSession = await loadPersistedSession();\n      // Proactively request sessions from all window clients so the sessions Map\n      // is pre-populated after a SW restart, rather than waiting for the first\n      // media fetch to trigger requestSessionWithTimeout.\n      const windowClients = await self.clients.matchAll({ type: 'window' });\n      windowClients.forEach((client) => client.postMessage({ type: 'requestSession' }));\n    })()\n  );\n});\n\n/**\n * Receive session updates from clients\n */\nself.addEventListener('message', (event: ExtendableMessageEvent) => {\n  const client = event.source as Client | null;\n  if (!client) return;\n\n  const { data } = event;\n  if (!data || typeof data !== 'object') return;\n  const { type, accessToken, baseUrl, userId } = data as Record<string, unknown>;\n\n  if (type === 'setSession') {\n    setSession(client.id, accessToken, baseUrl, userId);\n    event.waitUntil(cleanupDeadClients());\n  }\n  if (type === 'pushDecryptResult') {\n    // Resolve a pending decryption request from handleMinimalPushPayload\n    const { eventId } = data as { eventId?: string };\n    if (typeof eventId === 'string') {\n      const resolve = decryptionPendingMap.get(eventId);\n      if (resolve) {\n        decryptionPendingMap.delete(eventId);\n        resolve(data as DecryptionResult);\n      }\n    }\n  }\n  if (type === 'setAppVisible') {\n    if (typeof (data as { visible?: unknown }).visible === 'boolean') {\n      appIsVisible = (data as { visible: boolean }).visible;\n    }\n  }\n  if (type === 'setNotificationSettings') {\n    if (\n      typeof (data as { notificationSoundEnabled?: unknown }).notificationSoundEnabled === 'boolean'\n    ) {\n      notificationSoundEnabled = (data as { notificationSoundEnabled: boolean })\n        .notificationSoundEnabled;\n    }\n    if (typeof (data as { showMessageContent?: unknown }).showMessageContent === 'boolean') {\n      showMessageContent = (data as { showMessageContent: boolean }).showMessageContent;\n    }\n    if (\n      typeof (data as { showEncryptedMessageContent?: unknown }).showEncryptedMessageContent ===\n      'boolean'\n    ) {\n      showEncryptedMessageContent = (data as { showEncryptedMessageContent: boolean })\n        .showEncryptedMessageContent;\n    }\n    if (\n      typeof (data as { clearNotificationsOnRead?: unknown }).clearNotificationsOnRead === 'boolean'\n    ) {\n      clearNotificationsOnRead = (data as { clearNotificationsOnRead: boolean })\n        .clearNotificationsOnRead;\n    }\n    // Persist so settings survive SW restart (iOS kills the SW aggressively).\n    event.waitUntil(persistSettings());\n  }\n});\n\nconst MEDIA_PATHS = [\n  '/_matrix/client/v1/media/download',\n  '/_matrix/client/v1/media/thumbnail',\n  // Legacy unauthenticated endpoints — servers that require auth return 404/403\n  // for these when no token is present, so intercept and add auth here too.\n  '/_matrix/media/v3/download',\n  '/_matrix/media/v3/thumbnail',\n  '/_matrix/media/r0/download',\n  '/_matrix/media/r0/thumbnail',\n];\n\nfunction mediaPath(url: string): boolean {\n  try {\n    const { pathname } = new URL(url);\n    return MEDIA_PATHS.some((p) => pathname.startsWith(p));\n  } catch {\n    return false;\n  }\n}\n\nfunction validMediaRequest(url: string, baseUrl: string): boolean {\n  return MEDIA_PATHS.some((p) => {\n    const validUrl = new URL(p, baseUrl);\n    return url.startsWith(validUrl.href);\n  });\n}\n\nfunction fetchConfig(token: string): RequestInit {\n  return {\n    headers: {\n      Authorization: `Bearer ${token}`,\n    },\n    cache: 'default',\n  };\n}\n\nself.addEventListener('message', (event: ExtendableMessageEvent) => {\n  if (event.data.type === 'togglePush') {\n    const token = event.data?.token;\n    const fetchOptions = fetchConfig(token);\n    event.waitUntil(\n      fetch(`${event.data.url}/_matrix/client/v3/pushers/set`, {\n        method: 'POST',\n        ...fetchOptions,\n        body: JSON.stringify(event.data.pusherData),\n      })\n    );\n  }\n});\n\nself.addEventListener('fetch', (event: FetchEvent) => {\n  const { url, method } = event.request;\n\n  if (method !== 'GET' || !mediaPath(url)) return;\n\n  const { clientId } = event;\n\n  // For browser sub-resource loads (images, video, audio, etc.), 'follow' is\n  // the correct mode: the auth header is sent to the Matrix server which owns\n  // the first hop; any CDN redirect it issues is followed natively by the\n  // Fetch machinery.  'manual' would return an opaque-redirect Response that\n  // the browser cannot render as an <img>/<video>/etc.\n  const redirect: RequestRedirect = 'follow';\n\n  const session = clientId ? sessions.get(clientId) : undefined;\n  if (session && validMediaRequest(url, session.baseUrl)) {\n    event.respondWith(fetch(url, { ...fetchConfig(session.accessToken), redirect }));\n    return;\n  }\n\n  // Since widgets like element call have their own client ids,\n  // we need this logic. We just go through the sessions list and get a session\n  // with the right base url. Media requests to a homeserver simply are fine with any account\n  // on the homeserver authenticating it, so this is fine. But it can be technically wrong.\n  // If you have two tabs for different users on the same homeserver, it might authenticate\n  // as the wrong one.\n  // Thus any logic in the future which cares about which user is authenticating the request\n  // might break this. Also, again, it is technically wrong.\n  // Also checks preloadedSession — populated from cache at SW activate — for the window\n  // between SW restart and the first live setSession arriving from the page.\n  const byBaseUrl =\n    [...sessions.values()].find((s) => validMediaRequest(url, s.baseUrl)) ??\n    (preloadedSession && validMediaRequest(url, preloadedSession.baseUrl)\n      ? preloadedSession\n      : undefined);\n  if (byBaseUrl) {\n    event.respondWith(fetch(url, { ...fetchConfig(byBaseUrl.accessToken), redirect }));\n    return;\n  }\n\n  // No clientId: the fetch came from a context not associated with a specific\n  // window (e.g. a prerender). Fall back to the persisted session directly.\n  if (!clientId) {\n    event.respondWith(\n      loadPersistedSession().then((persisted) => {\n        if (persisted && validMediaRequest(url, persisted.baseUrl)) {\n          return fetch(url, {\n            ...fetchConfig(persisted.accessToken),\n            redirect,\n          });\n        }\n        return fetch(event.request);\n      })\n    );\n    return;\n  }\n\n  event.respondWith(\n    requestSessionWithTimeout(clientId).then(async (s) => {\n      // Primary: session received from the live client window.\n      if (s && validMediaRequest(url, s.baseUrl)) {\n        return fetch(url, { ...fetchConfig(s.accessToken), redirect });\n      }\n      // Fallback: try the persisted session (helps when SW restarts on iOS and\n      // the client window hasn't responded to requestSession yet).\n      const persisted = await loadPersistedSession();\n      if (persisted && validMediaRequest(url, persisted.baseUrl)) {\n        return fetch(url, { ...fetchConfig(persisted.accessToken), redirect });\n      }\n      console.warn(\n        '[SW fetch] No valid session for media request',\n        { url, clientId, hasSession: !!s },\n        'falling back to unauthenticated fetch'\n      );\n      return fetch(event.request);\n    })\n  );\n});\n\n// Detect a minimal (event_id_only) payload: has room_id + event_id but no\n// event type field — meaning the homeserver stripped the event content.\nfunction isMinimalPushPayload(data: unknown): data is { room_id: string; event_id: string } {\n  if (!data || typeof data !== 'object') return false;\n  const d = data as Record<string, unknown>;\n  return typeof d.room_id === 'string' && typeof d.event_id === 'string' && !d.type;\n}\n\nconst onPushNotification = async (event: PushEvent) => {\n  if (!event?.data) return;\n\n  // The SW may have been restarted by the OS (iOS is aggressive about this),\n  // so in-memory settings would be at their defaults.  Reload from cache and\n  // match active clients in parallel — they are independent operations.\n  const [, , clients] = await Promise.all([\n    loadPersistedSettings(),\n    loadPersistedSession(),\n    self.clients.matchAll({ type: 'window', includeUncontrolled: true }),\n  ]);\n\n  // If the app is open and visible, skip the OS push notification — the in-app\n  // pill notification handles the alert instead.\n  // Combine clients.matchAll() visibility with the explicit appIsVisible flag\n  // because iOS Safari PWA often returns empty or stale results from matchAll().\n  const hasVisibleClient =\n    appIsVisible || clients.some((client) => client.visibilityState === 'visible');\n  console.debug(\n    '[SW push] appIsVisible:',\n    appIsVisible,\n    '| clients:',\n    clients.map((c) => ({ url: c.url, visibility: c.visibilityState }))\n  );\n  console.debug('[SW push] hasVisibleClient:', hasVisibleClient);\n  if (hasVisibleClient) {\n    console.debug('[SW push] suppressing OS notification — app is visible');\n    return;\n  }\n\n  const pushData = event.data.json();\n  console.debug('[SW push] raw payload:', JSON.stringify(pushData, null, 2));\n\n  try {\n    if (typeof pushData?.unread === 'number') {\n      if (pushData.unread === 0) {\n        // All messages read elsewhere — clear the home-screen badge and,\n        // if the user opted in, dismiss outstanding lock-screen notifications.\n        await (\n          self.navigator as unknown as { clearAppBadge?: () => Promise<void> }\n        ).clearAppBadge?.();\n        if (clearNotificationsOnRead) {\n          const notifs = await self.registration.getNotifications();\n          notifs.forEach((n) => n.close());\n        }\n        return;\n      }\n      // unread > 0: update the PWA badge with the current count.\n      await (\n        self.navigator as unknown as { setAppBadge?: (count: number) => Promise<void> }\n      ).setAppBadge?.(pushData.unread);\n    } else {\n      // No unread field in payload — clear badge to avoid a stale count.\n      await (\n        self.navigator as unknown as { clearAppBadge?: () => Promise<void> }\n      ).clearAppBadge?.();\n    }\n  } catch {\n    // Badging API absent (Firefox/Gecko) — continue to show the notification.\n  }\n\n  // event_id_only format: fetch the event ourselves and (for E2EE rooms) try\n  // to relay decryption to an open app tab.\n  if (isMinimalPushPayload(pushData)) {\n    console.debug('[SW push] minimal payload detected — fetching event', pushData.event_id);\n    await handleMinimalPushPayload(pushData.room_id, pushData.event_id, clients);\n    return;\n  }\n\n  await handlePushNotificationPushData(pushData);\n};\n\n// ---------------------------------------------------------------------------\n// Push handler\n// ---------------------------------------------------------------------------\n\nself.addEventListener('push', (event: PushEvent) => event.waitUntil(onPushNotification(event)));\n\nself.addEventListener('notificationclick', (event: NotificationEvent) => {\n  event.notification.close();\n\n  const { data } = event.notification;\n  const { scope } = self.registration;\n\n  const pushUserId: string | undefined = data?.user_id ?? undefined;\n  const pushRoomId: string | undefined = data?.room_id ?? undefined;\n  const pushEventId: string | undefined = data?.event_id ?? undefined;\n  const isInvite = data?.content?.membership === 'invite';\n\n  console.debug('[SW notificationclick] notification data:', JSON.stringify(data, null, 2));\n  console.debug('[SW notificationclick] resolved fields:', {\n    pushUserId,\n    pushRoomId,\n    pushEventId,\n    isInvite,\n    scope,\n  });\n\n  const isCall = data?.isCall === true;\n\n  // Build a canonical deep-link URL.\n  //\n  // Room messages: /to/:user_id/:room_id/:event_id?\n  //   e.g. https://sable.cloudhub.social/to/%40alice%3Aserver/%21room%3Aserver/%24event%3Aserver\n  //   The :user_id segment ensures ToRoomEvent switches to the correct account\n  //   before navigating — required for background-account notifications.\n  //\n  // Invites: /inbox/invites/?uid=:user_id\n  //   Navigates straight to the invites page for the correct account.\n  let targetUrl: string;\n  if (isInvite) {\n    const u = new URL('inbox/invites/', scope);\n    if (pushUserId) u.searchParams.set('uid', pushUserId);\n    targetUrl = u.href;\n  } else if (pushUserId && pushRoomId) {\n    const callParam = isCall ? '?joinCall=true' : '';\n    const segments = pushEventId\n      ? `to/${encodeURIComponent(pushUserId)}/${encodeURIComponent(pushRoomId)}/${encodeURIComponent(pushEventId)}/${callParam}`\n      : `to/${encodeURIComponent(pushUserId)}/${encodeURIComponent(pushRoomId)}/${callParam}`;\n    targetUrl = new URL(segments, scope).href;\n  } else {\n    // Fallback: no room ID or no user ID in payload.\n    targetUrl = new URL('inbox/notifications/', scope).href;\n  }\n\n  console.debug('[SW notificationclick] targetUrl:', targetUrl);\n\n  event.waitUntil(\n    (async () => {\n      const clientList = (await self.clients.matchAll({\n        type: 'window',\n        includeUncontrolled: true,\n      })) as WindowClient[];\n\n      console.debug(\n        '[SW notificationclick] window clients:',\n        clientList.map((c) => ({\n          url: c.url,\n          visibility: c.visibilityState,\n          focused: c.focused,\n        }))\n      );\n\n      for (const wc of clientList) {\n        console.debug('[SW notificationclick] postMessage to existing client:', wc.url);\n        try {\n          // Post notification data directly to the running app so its\n          // ServiceWorkerClickHandler can call setActiveSessionId + setPending\n          // (same path as the pill-style in-app banner) without navigating to\n          // the /to/ route first.\n          wc.postMessage({\n            type: 'notificationClick',\n            userId: pushUserId,\n            roomId: pushRoomId,\n            eventId: pushEventId,\n            isInvite,\n            isCall,\n          });\n          // oxlint-disable-next-line no-await-in-loop\n          await wc.focus();\n          return;\n        } catch (err) {\n          console.debug('[SW notificationclick] postMessage/focus failed:', err);\n        }\n      }\n\n      // No existing window clients — open a new window.\n      // ToRoomEvent handles the /to/ URL on cold launch (account switch + pending atom).\n      console.debug('[SW notificationclick] falling back to openWindow()', targetUrl);\n      if (self.clients.openWindow) {\n        await self.clients.openWindow(targetUrl);\n      }\n    })()\n  );\n});\n\nprecacheAndRoute(self.__WB_MANIFEST);\ncleanupOutdatedCaches();\n"]}