{"version":3,"sources":["webpack:///firebase-messaging.js","webpack:///./messaging/index.js","webpack:///../messaging/dist/esm/src/helpers/array-buffer-to-base64.js","webpack:///../messaging/dist/esm/src/models/token-details-model.js","webpack:///../messaging/dist/esm/index.js","webpack:///../messaging/dist/esm/src/models/errors.js","webpack:///../messaging/dist/esm/src/models/db-interface.js","webpack:///../messaging/dist/esm/src/models/vapid-details-model.js","webpack:///../messaging/dist/esm/src/models/fcm-details.js","webpack:///../messaging/dist/esm/src/models/iid-model.js","webpack:///../messaging/dist/esm/src/controllers/controller-interface.js","webpack:///../messaging/dist/esm/src/models/worker-page-message.js","webpack:///../messaging/dist/esm/src/models/default-sw.js","webpack:///../messaging/dist/esm/src/helpers/base64-to-array-buffer.js","webpack:///../messaging/dist/esm/src/controllers/window-controller.js","webpack:///../messaging/dist/esm/src/controllers/sw-controller.js"],"names":["webpackJsonpFirebase","116","module","exports","__webpack_require__","117","__webpack_exports__","toBase64","arrayBuffer","uint8Version","Uint8Array","window","btoa","String","fromCharCode","apply","ValidateInput","registerMessaging","instance","factoryMethod","app","self","sw_controller","window_controller","namespaceExports","Messaging","INTERNAL","registerService","Object","defineProperty","value","errors__a","cjs","CODES","AVAILABLE_IN_WINDOW","AVAILABLE_IN_SW","SHOULD_BE_INHERITED","BAD_SENDER_ID","INCORRECT_GCM_SENDER_ID","PERMISSION_DEFAULT","PERMISSION_BLOCKED","UNSUPPORTED_BROWSER","NOTIFICATIONS_BLOCKED","FAILED_DEFAULT_REGISTRATION","SW_REGISTRATION_EXPECTED","GET_SUBSCRIPTION_FAILED","INVALID_SAVED_TOKEN","SW_REG_REDUNDANT","TOKEN_SUBSCRIBE_FAILED","TOKEN_SUBSCRIBE_NO_TOKEN","TOKEN_SUBSCRIBE_NO_PUSH_SET","TOKEN_UNSUBSCRIBE_FAILED","TOKEN_UPDATE_FAILED","TOKEN_UPDATE_NO_TOKEN","USE_SW_BEFORE_GET_TOKEN","INVALID_DELETE_TOKEN","DELETE_TOKEN_NOT_FOUND","DELETE_SCOPE_NOT_FOUND","BG_HANDLER_FUNCTION_EXPECTED","NO_WINDOW_CLIENT_TO_MSG","UNABLE_TO_RESUBSCRIBE","NO_FCM_TOKEN_FOR_RESUBSCRIBE","FAILED_TO_DELETE_TOKEN","NO_SW_IN_REG","BAD_SCOPE","BAD_VAPID_KEY","BAD_SUBSCRIPTION","BAD_TOKEN","BAD_PUSH_SET","FAILED_DELETE_VAPID_KEY","INVALID_PUBLIC_VAPID_KEY","USE_PUBLIC_KEY_BEFORE_GET_TOKEN","PUBLIC_KEY_DECRYPTION_FAILED","ERROR_MAP","errors","codes","map","db_interface_DBInterface","DBInterface","dbName","dbVersion","this","errorFactory_","DB_NAME_","dbVersion_","openDbPromise_","TRANSACTION_READ_WRITE","prototype","openDatabase","_this","Promise","resolve","reject","request","indexedDB","open","onerror","event","target","error","onsuccess","result","onupgradeneeded","db","onDBUpgrade","err","close","closeDatabase","then","create","db_interface","array_buffer_to_base64","replace","__extends","extendStatics","setPrototypeOf","__proto__","Array","d","b","p","hasOwnProperty","__","constructor","DB_VERSION","fcmToken","swScope","vapidKey","subscription","fcmSenderId","fcmPushSet","token_details_model_TokenDetailsModel","_super","TokenDetailsModel","call","DB_NAME","get","enumerable","configurable","objectStore","createObjectStore","keyPath","createIndex","unique","validateInputs_","input","length","PushSubscription","getTokenDetailsFromToken","transaction","index","getTokenDetailsFromSWScope","scopeRequest","saveTokenDetails","_a","details","endpoint","auth","p256dh","createTime","Date","now","put","deleteToken","token","delete","token_details_model","vapid_details_model___extends","vapid_details_model_DB_VERSION","vapid_details_model_VapidDetailsModel","VapidDetailsModel","getVapidFromSWScope","saveVapidDetails","deleteVapidDetails","vapid_details_model","DEFAULT_PUBLIC_VAPID_KEY","SUBSCRIPTION_DETAILS","userVisibleOnly","applicationServerKey","fcm_details","ENDPOINT","iid_model_IIDModel","IIDModel","getToken","senderId","publicVapidKey","fcmSubscribeBody","headers","Headers","append","subscribeOptions","method","body","fetch","response","json","catch","fcmTokenResponse","message","pushSet","updateToken","fcmUpdateBody","updateFetchRes","updateOptions","fetchResponse","ok","fcmUnsubscribeBody","unsubscribeOptions","iid_model","SENDER_ID_OPTION_NAME","controller_interface_ControllerInterface","ControllerInterface","options","messagingSenderId_","tokenDetailsModel_","vapidDetailsModel_","iidModel_","currentPermission","getNotificationPermission_","notification_permission","swReg","getSWRegistration_","reg","scope","tokenDetails","manageExistingToken","getNewToken","isTokenStillValid","isValid","getPublicVapidKey_","publicKey","updatedToken","getPushSubscription_","pushSubscription","allDetails","iidTokenDetails","registration","pushManager","getSubscription","unsubscribe","requestPermission","useServiceWorker","usePublicVapidKey","b64PublicKey","onMessage","nextOrObserver","optError","optCompleted","onTokenRefresh","setBackgroundMessageHandler","callback","all","Notification","permission","getTokenDetailsModel","getVapidDetailsModel","getIIDModel","controller_interface","PARAMS","TYPE_OF_MSG","DATA","msgType","PUSH_MSG_RECEIVED","NOTIFICATION_CLICKED","createNewMsg","msgData","worker_page_message","TYPES_OF_MSG","default_sw","path","base64_to_array_buffer","base64String","padding","repeat","base64","rawData","atob","outputArray","i","charCodeAt","window_controller___extends","window_controller_WindowController","WindowController","messageObserver_","onMessage_","observer","tokenRefreshObserver_","onTokenRefresh_","registrationToUse_","manifestCheckPromise_","setupSWMessageListener_","isSupported_","manifestCheck_","manifestTag","document","querySelector","href","manifestContent","managePermissionResult","permissionPromise","ServiceWorkerRegistration","publicVapidKeyToUse_","parsedKey","waitForRegistrationToActivate_","serviceWorker","installing","waiting","active","state","stateChangeListener","removeEventListener","addEventListener","navigator","register","browserErrorMessage","update","swRegistration","subscribe","data","workerPageMessage","pushMessage","next","sw_controller___extends","sw_controller_SWController","SWController","e","onPush_","onSubChange_","onNotificationClick_","bgMessageHandler_","msgPayload","handleMsgPromise","hasVisibleClients_","hasVisibleClients","notification","sendMessageToWindowClients_","notificationDetails","getNotificationData_","notificationTitle_1","title","showNotification","waitUntil","promiseChain","stopImmediatePropagation","clickAction","getWindowClient_","windowClient","focus","clients","openWindow","internalMsg","attemptToMessageClient_","notificationInformation","assign","url","parsedURL","URL","location","matchAll","type","includeUncontrolled","clientList","suitableClient","client","postMessage","some","visibilityState","vapidKeyFromDatabase","esm","Error"],"mappings":";;;;;AAKA,IACQA,sBAAsB,IAExBC,IACA,SAAUC,EAAQC,EAASC,GCOjCA,EAAA,MDgBMC,IACA,SAAUH,EAAQI,EAAqBF,GAE7C,YEpBA,SAAAG,GAAAC,GACA,GAAAC,GAAA,GAAAC,YAAAF,EACA,OAAAG,QAAAC,KAAAC,OAAAC,aAAAC,MAAA,KAAAN,ICeA,QAAAO,MCbA,QAAAC,GAAAC,GACA,GACAC,GAAA,SAAAC,GACA,MAAAC,OAAA,4BAAAA,MACA,GAAAC,GAAAF,GAGA,GAAAG,GAAAH,IAEAI,GAEAC,UAAAF,EAEAL,GAAAQ,SAAAC,gBAZA,YAYAR,EAAAK,GJIAI,OAAOC,eAAevB,EAAqB,cAAgBwB,OAAO,GAGlE,IK+EAC,GL/EIC,EAAM5B,EAAoB,GKvB9B6B,GACAC,oBAAA,2BACAC,gBAAA,uBACAC,oBAAA,sBACAC,cAAA,gBACAC,wBAAA,0BACAC,mBAAA,qBACAC,mBAAA,qBACAC,oBAAA,sBACAC,sBAAA,wBACAC,4BAAA,oCACAC,yBAAA,2BACAC,wBAAA,0BACAC,oBAAA,sBACAC,iBAAA,mBACAC,uBAAA,yBACAC,yBAAA,2BACAC,4BAAA,8BACAC,yBAAA,2BACAC,oBAAA,sBACAC,sBAAA,wBACAC,wBAAA,0BACAC,qBAAA,uBACAC,uBAAA,yBACAC,uBAAA,yBACAC,6BAAA,+BACAC,wBAAA,0BACAC,sBAAA,wBACAC,6BAAA,+BACAC,uBAAA,yBACAC,aAAA,eACAC,UAAA,YACAC,cAAA,gBACAC,iBAAA,mBACAC,UAAA,YACAC,aAAA,eACAC,wBAAA,0BACAC,yBAAA,2BACAC,gCAAA,kCACAC,6BAAA,sCAEAC,GAAA1C,KACAA,EAAAE,EAAAC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AU8Q,OACR","file":"firebase-messaging.js","sourcesContent":["/*!\n * @license Firebase v4.10.0\n * Build: rev-fc81427\n * Terms: https://firebase.google.com/terms/\n */\ntry {\n webpackJsonpFirebase([3],{\n\n/***/ 116:\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n__webpack_require__(117);\n\n\n/***/ }),\n\n/***/ 117:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n// EXTERNAL MODULE: ../util/dist/cjs/index.js\nvar cjs = __webpack_require__(0);\nvar cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/errors.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar CODES = {\n AVAILABLE_IN_WINDOW: 'only-available-in-window',\n AVAILABLE_IN_SW: 'only-available-in-sw',\n SHOULD_BE_INHERITED: 'should-be-overriden',\n BAD_SENDER_ID: 'bad-sender-id',\n INCORRECT_GCM_SENDER_ID: 'incorrect-gcm-sender-id',\n PERMISSION_DEFAULT: 'permission-default',\n PERMISSION_BLOCKED: 'permission-blocked',\n UNSUPPORTED_BROWSER: 'unsupported-browser',\n NOTIFICATIONS_BLOCKED: 'notifications-blocked',\n FAILED_DEFAULT_REGISTRATION: 'failed-serviceworker-registration',\n SW_REGISTRATION_EXPECTED: 'sw-registration-expected',\n GET_SUBSCRIPTION_FAILED: 'get-subscription-failed',\n INVALID_SAVED_TOKEN: 'invalid-saved-token',\n SW_REG_REDUNDANT: 'sw-reg-redundant',\n TOKEN_SUBSCRIBE_FAILED: 'token-subscribe-failed',\n TOKEN_SUBSCRIBE_NO_TOKEN: 'token-subscribe-no-token',\n TOKEN_SUBSCRIBE_NO_PUSH_SET: 'token-subscribe-no-push-set',\n TOKEN_UNSUBSCRIBE_FAILED: 'token-unsubscribe-failed',\n TOKEN_UPDATE_FAILED: 'token-update-failed',\n TOKEN_UPDATE_NO_TOKEN: 'token-update-no-token',\n USE_SW_BEFORE_GET_TOKEN: 'use-sw-before-get-token',\n INVALID_DELETE_TOKEN: 'invalid-delete-token',\n DELETE_TOKEN_NOT_FOUND: 'delete-token-not-found',\n DELETE_SCOPE_NOT_FOUND: 'delete-scope-not-found',\n BG_HANDLER_FUNCTION_EXPECTED: 'bg-handler-function-expected',\n NO_WINDOW_CLIENT_TO_MSG: 'no-window-client-to-msg',\n UNABLE_TO_RESUBSCRIBE: 'unable-to-resubscribe',\n NO_FCM_TOKEN_FOR_RESUBSCRIBE: 'no-fcm-token-for-resubscribe',\n FAILED_TO_DELETE_TOKEN: 'failed-to-delete-token',\n NO_SW_IN_REG: 'no-sw-in-reg',\n BAD_SCOPE: 'bad-scope',\n BAD_VAPID_KEY: 'bad-vapid-key',\n BAD_SUBSCRIPTION: 'bad-subscription',\n BAD_TOKEN: 'bad-token',\n BAD_PUSH_SET: 'bad-push-set',\n FAILED_DELETE_VAPID_KEY: 'failed-delete-vapid-key',\n INVALID_PUBLIC_VAPID_KEY: 'invalid-public-vapid-key',\n USE_PUBLIC_KEY_BEFORE_GET_TOKEN: 'use-public-key-before-get-token',\n PUBLIC_KEY_DECRYPTION_FAILED: 'public-vapid-key-decryption-failed'\n};\nvar ERROR_MAP = (errors__a = {},\n errors__a[CODES.AVAILABLE_IN_WINDOW] = 'This method is available in a Window context.',\n errors__a[CODES.AVAILABLE_IN_SW] = 'This method is available in a service worker ' + 'context.',\n errors__a[CODES.SHOULD_BE_INHERITED] = 'This method should be overriden by ' + 'extended classes.',\n errors__a[CODES.BAD_SENDER_ID] = \"Please ensure that 'messagingSenderId' is set \" +\n 'correctly in the options passed into firebase.initializeApp().',\n errors__a[CODES.PERMISSION_DEFAULT] = 'The required permissions were not granted and ' + 'dismissed instead.',\n errors__a[CODES.PERMISSION_BLOCKED] = 'The required permissions were not granted and ' + 'blocked instead.',\n errors__a[CODES.UNSUPPORTED_BROWSER] = \"This browser doesn't support the API's \" +\n 'required to use the firebase SDK.',\n errors__a[CODES.NOTIFICATIONS_BLOCKED] = 'Notifications have been blocked.',\n errors__a[CODES.FAILED_DEFAULT_REGISTRATION] = 'We are unable to register the ' +\n 'default service worker. {$browserErrorMessage}',\n errors__a[CODES.SW_REGISTRATION_EXPECTED] = 'A service worker registration was the ' + 'expected input.',\n errors__a[CODES.GET_SUBSCRIPTION_FAILED] = 'There was an error when trying to get ' +\n 'any existing Push Subscriptions.',\n errors__a[CODES.INVALID_SAVED_TOKEN] = 'Unable to access details of the saved token.',\n errors__a[CODES.SW_REG_REDUNDANT] = 'The service worker being used for push was made ' + 'redundant.',\n errors__a[CODES.TOKEN_SUBSCRIBE_FAILED] = 'A problem occured while subscribing the ' + 'user to FCM: {$message}',\n errors__a[CODES.TOKEN_SUBSCRIBE_NO_TOKEN] = 'FCM returned no token when subscribing ' + 'the user to push.',\n errors__a[CODES.TOKEN_SUBSCRIBE_NO_PUSH_SET] = 'FCM returned an invalid response ' + 'when getting an FCM token.',\n errors__a[CODES.TOKEN_UNSUBSCRIBE_FAILED] = 'A problem occured while unsubscribing the ' + 'user from FCM: {$message}',\n errors__a[CODES.TOKEN_UPDATE_FAILED] = 'A problem occured while updating the ' + 'user from FCM: {$message}',\n errors__a[CODES.TOKEN_UPDATE_NO_TOKEN] = 'FCM returned no token when updating ' + 'the user to push.',\n errors__a[CODES.USE_SW_BEFORE_GET_TOKEN] = 'You must call useServiceWorker() before ' +\n 'calling getToken() to ensure your service worker is used.',\n errors__a[CODES.INVALID_DELETE_TOKEN] = 'You must pass a valid token into ' +\n 'deleteToken(), i.e. the token from getToken().',\n errors__a[CODES.DELETE_TOKEN_NOT_FOUND] = 'The deletion attempt for token could not ' +\n 'be performed as the token was not found.',\n errors__a[CODES.DELETE_SCOPE_NOT_FOUND] = 'The deletion attempt for service worker ' +\n 'scope could not be performed as the scope was not found.',\n errors__a[CODES.BG_HANDLER_FUNCTION_EXPECTED] = 'The input to ' + 'setBackgroundMessageHandler() must be a function.',\n errors__a[CODES.NO_WINDOW_CLIENT_TO_MSG] = 'An attempt was made to message a ' + 'non-existant window client.',\n errors__a[CODES.UNABLE_TO_RESUBSCRIBE] = 'There was an error while re-subscribing ' +\n 'the FCM token for push messaging. Will have to resubscribe the ' +\n 'user on next visit. {$message}',\n errors__a[CODES.NO_FCM_TOKEN_FOR_RESUBSCRIBE] = 'Could not find an FCM token ' +\n 'and as a result, unable to resubscribe. Will have to resubscribe the ' +\n 'user on next visit.',\n errors__a[CODES.FAILED_TO_DELETE_TOKEN] = 'Unable to delete the currently saved token.',\n errors__a[CODES.NO_SW_IN_REG] = 'Even though the service worker registration was ' +\n 'successful, there was a problem accessing the service worker itself.',\n errors__a[CODES.INCORRECT_GCM_SENDER_ID] = \"Please change your web app manifest's \" +\n \"'gcm_sender_id' value to '103953800507' to use Firebase messaging.\",\n errors__a[CODES.BAD_SCOPE] = 'The service worker scope must be a string with at ' +\n 'least one character.',\n errors__a[CODES.BAD_VAPID_KEY] = 'The public VAPID key is not a Uint8Array with 65 bytes.',\n errors__a[CODES.BAD_SUBSCRIPTION] = 'The subscription must be a valid ' + 'PushSubscription.',\n errors__a[CODES.BAD_TOKEN] = 'The FCM Token used for storage / lookup was not ' +\n 'a valid token string.',\n errors__a[CODES.BAD_PUSH_SET] = 'The FCM push set used for storage / lookup was not ' +\n 'not a valid push set string.',\n errors__a[CODES.FAILED_DELETE_VAPID_KEY] = 'The VAPID key could not be deleted.',\n errors__a[CODES.INVALID_PUBLIC_VAPID_KEY] = 'The public VAPID key must be a string.',\n errors__a[CODES.PUBLIC_KEY_DECRYPTION_FAILED] = 'The public VAPID key did not equal ' + '65 bytes when decrypted.',\n errors__a);\n/* harmony default export */ var errors = ({\n codes: CODES,\n map: ERROR_MAP\n});\nvar errors__a;\n\n//# sourceMappingURL=errors.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/db-interface.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n\nvar db_interface_DBInterface = /** @class */ (function () {\n /**\n * @param {string} dbName\n * @param {number} dbVersion\n */\n function DBInterface(dbName, dbVersion) {\n this.errorFactory_ = new cjs[\"ErrorFactory\"]('messaging', 'Messaging', errors.map);\n this.DB_NAME_ = dbName;\n this.dbVersion_ = dbVersion;\n this.openDbPromise_ = null;\n this.TRANSACTION_READ_WRITE = 'readwrite';\n }\n /**\n * Get the indexedDB as a promsie.\n * @protected\n * @return {!Promise} The IndexedDB database\n */\n DBInterface.prototype.openDatabase = function () {\n var _this = this;\n if (this.openDbPromise_) {\n return this.openDbPromise_;\n }\n this.openDbPromise_ = new Promise(function (resolve, reject) {\n var request = indexedDB.open(_this.DB_NAME_, _this.dbVersion_);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n resolve(event.target.result);\n };\n request.onupgradeneeded = function (event) {\n try {\n var db = event.target.result;\n _this.onDBUpgrade(db);\n }\n catch (err) {\n // close the database as it can't be used.\n db.close();\n reject(err);\n }\n };\n });\n return this.openDbPromise_;\n };\n /**\n * Close the currently open database.\n * @return {!Promise} Returns the result of the promise chain.\n */\n DBInterface.prototype.closeDatabase = function () {\n var _this = this;\n return Promise.resolve().then(function () {\n if (_this.openDbPromise_) {\n return _this.openDbPromise_.then(function (db) {\n db.close();\n _this.openDbPromise_ = null;\n });\n }\n });\n };\n /**\n * @protected\n * @param {!IDBDatabase} db\n */\n DBInterface.prototype.onDBUpgrade = function (db) {\n throw this.errorFactory_.create(errors.codes.SHOULD_BE_INHERITED);\n };\n return DBInterface;\n}());\n/* harmony default export */ var db_interface = (db_interface_DBInterface);\n\n//# sourceMappingURL=db-interface.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/helpers/array-buffer-to-base64.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction toBase64(arrayBuffer) {\n var uint8Version = new Uint8Array(arrayBuffer);\n return window.btoa(String.fromCharCode.apply(null, uint8Version));\n}\n/* harmony default export */ var array_buffer_to_base64 = (function (arrayBuffer) {\n var base64String = toBase64(arrayBuffer);\n return base64String\n .replace(/=/g, '')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_');\n});;\n\n//# sourceMappingURL=array-buffer-to-base64.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/token-details-model.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\nvar FCM_TOKEN_OBJ_STORE = 'fcm_token_object_Store';\nvar DB_VERSION = 1;\n/** @record */\nfunction ValidateInput() { }\n/** @type {string|undefined} */\nValidateInput.prototype.fcmToken;\n/** @type {string|undefined} */\nValidateInput.prototype.swScope;\n/** @type {string|undefined} */\nValidateInput.prototype.vapidKey;\n/** @type {PushSubscription|undefined} */\nValidateInput.prototype.subscription;\n/** @type {string|undefined} */\nValidateInput.prototype.fcmSenderId;\n/** @type {string|undefined} */\nValidateInput.prototype.fcmPushSet;\nvar token_details_model_TokenDetailsModel = /** @class */ (function (_super) {\n __extends(TokenDetailsModel, _super);\n function TokenDetailsModel() {\n return _super.call(this, TokenDetailsModel.DB_NAME, DB_VERSION) || this;\n }\n Object.defineProperty(TokenDetailsModel, \"DB_NAME\", {\n get: function () {\n return 'fcm_token_details_db';\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @override\n */\n TokenDetailsModel.prototype.onDBUpgrade = function (db) {\n var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, {\n keyPath: 'swScope'\n });\n // Make sure the sender ID can be searched\n objectStore.createIndex('fcmSenderId', 'fcmSenderId', {\n unique: false\n });\n objectStore.createIndex('fcmToken', 'fcmToken', {\n unique: true\n });\n };\n /**\n * This method takes an object and will check for known arguments and\n * validate the input.\n * @private\n * @param {!ValidateInput} input\n * @return {!Promise} Returns promise that resolves if input is valid,\n * rejects otherwise.\n */\n TokenDetailsModel.prototype.validateInputs_ = function (input) {\n if (input.fcmToken) {\n if (typeof input.fcmToken !== 'string' || input.fcmToken.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_TOKEN));\n }\n }\n if (input.swScope) {\n if (typeof input.swScope !== 'string' || input.swScope.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SCOPE));\n }\n }\n if (input.vapidKey) {\n if (!(input.vapidKey instanceof Uint8Array) ||\n input.vapidKey.length !== 65) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_VAPID_KEY));\n }\n }\n if (input.subscription) {\n if (!(input.subscription instanceof PushSubscription)) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SUBSCRIPTION));\n }\n }\n if (input.fcmSenderId) {\n if (typeof input.fcmSenderId !== 'string' ||\n input.fcmSenderId.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SENDER_ID));\n }\n }\n if (input.fcmPushSet) {\n if (typeof input.fcmPushSet !== 'string' ||\n input.fcmPushSet.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_PUSH_SET));\n }\n }\n return Promise.resolve();\n };\n /**\n * Given a token, this method will look up the details in indexedDB.\n * @param {string} fcmToken\n * @return {Promise} The details associated with that token.\n */\n TokenDetailsModel.prototype.getTokenDetailsFromToken = function (fcmToken) {\n var _this = this;\n if (!fcmToken) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_TOKEN));\n }\n return this.validateInputs_({ fcmToken: fcmToken })\n .then(function () {\n return _this.openDatabase();\n })\n .then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var index = objectStore.index('fcmToken');\n var request = index.get(fcmToken);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n var result = event.target.result\n ? event.target.result\n : null;\n resolve(result);\n };\n });\n });\n };\n /**\n * Given a service worker scope, this method will look up the details in\n * indexedDB.\n * @public\n * @param {string} swScope\n * @return {Promise} The details associated with that token.\n */\n TokenDetailsModel.prototype.getTokenDetailsFromSWScope = function (swScope) {\n var _this = this;\n if (!swScope) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SCOPE));\n }\n return this.validateInputs_({ swScope: swScope })\n .then(function () {\n return _this.openDatabase();\n })\n .then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var scopeRequest = objectStore.get(swScope);\n scopeRequest.onerror = function (event) {\n reject(event.target.error);\n };\n scopeRequest.onsuccess = function (event) {\n var result = event.target.result\n ? event.target.result\n : null;\n resolve(result);\n };\n });\n });\n };\n /**\n * Save the details for the fcm token for re-use at a later date.\n * @param {{swScope: !string, vapidKey: !string,\n * subscription: !PushSubscription, fcmSenderId: !string, fcmToken: !string,\n * fcmPushSet: !string}} input A plain js object containing args to save.\n * @return {Promise}\n */\n TokenDetailsModel.prototype.saveTokenDetails = function (_a) {\n var _this = this;\n var swScope = _a.swScope, vapidKey = _a.vapidKey, subscription = _a.subscription, fcmSenderId = _a.fcmSenderId, fcmToken = _a.fcmToken, fcmPushSet = _a.fcmPushSet;\n if (!swScope) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SCOPE));\n }\n if (!vapidKey) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_VAPID_KEY));\n }\n if (!subscription) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SUBSCRIPTION));\n }\n if (!fcmSenderId) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SENDER_ID));\n }\n if (!fcmToken) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_TOKEN));\n }\n if (!fcmPushSet) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_PUSH_SET));\n }\n return this.validateInputs_({\n swScope: swScope,\n vapidKey: vapidKey,\n subscription: subscription,\n fcmSenderId: fcmSenderId,\n fcmToken: fcmToken,\n fcmPushSet: fcmPushSet\n })\n .then(function () {\n return _this.openDatabase();\n })\n .then(function (db) {\n /**\n * @dict\n */\n var details = {\n swScope: swScope,\n vapidKey: array_buffer_to_base64(vapidKey),\n endpoint: subscription.endpoint,\n auth: array_buffer_to_base64(subscription['getKey']('auth')),\n p256dh: array_buffer_to_base64(subscription['getKey']('p256dh')),\n fcmSenderId: fcmSenderId,\n fcmToken: fcmToken,\n fcmPushSet: fcmPushSet,\n createTime: Date.now()\n };\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var request = objectStore.put(details);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n resolve();\n };\n });\n });\n };\n /**\n * This method deletes details of the current FCM token.\n * It's returning a promise in case we need to move to an async\n * method for deleting at a later date.\n * @return {Promise} Resolves once the FCM token details have been\n * deleted and returns the deleted details.\n */\n TokenDetailsModel.prototype.deleteToken = function (token) {\n var _this = this;\n if (typeof token !== 'string' || token.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.INVALID_DELETE_TOKEN));\n }\n return this.getTokenDetailsFromToken(token).then(function (details) {\n if (!details) {\n throw _this.errorFactory_.create(errors.codes.DELETE_TOKEN_NOT_FOUND);\n }\n return _this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var request = objectStore.delete(details['swScope']);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n if (event.target.result === 0) {\n reject(_this.errorFactory_.create(errors.codes.FAILED_TO_DELETE_TOKEN));\n return;\n }\n resolve(details);\n };\n });\n });\n });\n };\n return TokenDetailsModel;\n}(db_interface));\n/* harmony default export */ var token_details_model = (token_details_model_TokenDetailsModel);\n\n//# sourceMappingURL=token-details-model.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/vapid-details-model.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar vapid_details_model___extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar FCM_VAPID_OBJ_STORE = 'fcm_vapid_object_Store';\nvar vapid_details_model_DB_VERSION = 1;\nvar UNCOMPRESSED_PUBLIC_KEY_SIZE = 65;\nvar vapid_details_model_VapidDetailsModel = /** @class */ (function (_super) {\n vapid_details_model___extends(VapidDetailsModel, _super);\n function VapidDetailsModel() {\n return _super.call(this, VapidDetailsModel.DB_NAME, vapid_details_model_DB_VERSION) || this;\n }\n Object.defineProperty(VapidDetailsModel, \"DB_NAME\", {\n get: function () {\n return 'fcm_vapid_details_db';\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @override\n * @param {IDBDatabase} db\n */\n VapidDetailsModel.prototype.onDBUpgrade = function (db) {\n db.createObjectStore(FCM_VAPID_OBJ_STORE, {\n keyPath: 'swScope'\n });\n };\n /**\n * Given a service worker scope, this method will look up the vapid key\n * in indexedDB.\n */\n VapidDetailsModel.prototype.getVapidFromSWScope = function (swScope) {\n if (typeof swScope !== 'string' || swScope.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SCOPE));\n }\n return this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_VAPID_OBJ_STORE]);\n var objectStore = transaction.objectStore(FCM_VAPID_OBJ_STORE);\n var scopeRequest = objectStore.get(swScope);\n scopeRequest.onerror = function () {\n reject(scopeRequest.error);\n };\n scopeRequest.onsuccess = function () {\n var result = scopeRequest.result;\n var vapidKey = null;\n if (result) {\n vapidKey = result.vapidKey;\n }\n resolve(vapidKey);\n };\n });\n });\n };\n /**\n * Save a vapid key against a swScope for later date.\n */\n VapidDetailsModel.prototype.saveVapidDetails = function (swScope, vapidKey) {\n var _this = this;\n if (typeof swScope !== 'string' || swScope.length === 0) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_SCOPE));\n }\n if (vapidKey === null || vapidKey.length !== UNCOMPRESSED_PUBLIC_KEY_SIZE) {\n return Promise.reject(this.errorFactory_.create(errors.codes.BAD_VAPID_KEY));\n }\n var details = {\n swScope: swScope,\n vapidKey: vapidKey\n };\n return this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_VAPID_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_VAPID_OBJ_STORE);\n var request = objectStore.put(details);\n request.onerror = function () {\n reject(request.error);\n };\n request.onsuccess = function () {\n resolve();\n };\n });\n });\n };\n /**\n * This method deletes details of the current FCM VAPID key for a SW scope.\n * Resolves once the scope/vapid details have been deleted and returns the\n * deleted vapid key.\n */\n VapidDetailsModel.prototype.deleteVapidDetails = function (swScope) {\n var _this = this;\n return this.getVapidFromSWScope(swScope).then(function (vapidKey) {\n if (!vapidKey) {\n throw _this.errorFactory_.create(errors.codes.DELETE_SCOPE_NOT_FOUND);\n }\n return _this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_VAPID_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_VAPID_OBJ_STORE);\n var request = objectStore.delete(swScope);\n request.onerror = function () {\n reject(request.error);\n };\n request.onsuccess = function () {\n if (request.result === 0) {\n reject(_this.errorFactory_.create(errors.codes.FAILED_DELETE_VAPID_KEY));\n return;\n }\n resolve(vapidKey);\n };\n });\n });\n });\n };\n return VapidDetailsModel;\n}(db_interface));\n/* harmony default export */ var vapid_details_model = (vapid_details_model_VapidDetailsModel);\n\n//# sourceMappingURL=vapid-details-model.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/notification-permission.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* harmony default export */ var notification_permission = ({\n granted: 'granted',\n default: 'default',\n denied: 'denied'\n});\n\n//# sourceMappingURL=notification-permission.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/fcm-details.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar DEFAULT_PUBLIC_VAPID_KEY = new Uint8Array([\n 0x04,\n 0x33,\n 0x94,\n 0xf7,\n 0xdf,\n 0xa1,\n 0xeb,\n 0xb1,\n 0xdc,\n 0x03,\n 0xa2,\n 0x5e,\n 0x15,\n 0x71,\n 0xdb,\n 0x48,\n 0xd3,\n 0x2e,\n 0xed,\n 0xed,\n 0xb2,\n 0x34,\n 0xdb,\n 0xb7,\n 0x47,\n 0x3a,\n 0x0c,\n 0x8f,\n 0xc4,\n 0xcc,\n 0xe1,\n 0x6f,\n 0x3c,\n 0x8c,\n 0x84,\n 0xdf,\n 0xab,\n 0xb6,\n 0x66,\n 0x3e,\n 0xf2,\n 0x0c,\n 0xd4,\n 0x8b,\n 0xfe,\n 0xe3,\n 0xf9,\n 0x76,\n 0x2f,\n 0x14,\n 0x1c,\n 0x63,\n 0x08,\n 0x6a,\n 0x6f,\n 0x2d,\n 0xb1,\n 0x1a,\n 0x95,\n 0xb0,\n 0xce,\n 0x37,\n 0xc0,\n 0x9c,\n 0x6e\n]);\nvar SUBSCRIPTION_DETAILS = {\n userVisibleOnly: true,\n applicationServerKey: DEFAULT_PUBLIC_VAPID_KEY\n};\n/* harmony default export */ var fcm_details = ({\n DEFAULT_PUBLIC_VAPID_KEY: DEFAULT_PUBLIC_VAPID_KEY,\n SUBSCRIPTION_DETAILS: SUBSCRIPTION_DETAILS,\n ENDPOINT: 'https://fcm.googleapis.com'\n // ENDPOINT: 'https://jmt17.google.com'\n});\n\n//# sourceMappingURL=fcm-details.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/iid-model.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n\n\n\nvar iid_model_IIDModel = /** @class */ (function () {\n function IIDModel() {\n this.errorFactory_ = new cjs[\"ErrorFactory\"]('messaging', 'Messaging', errors.map);\n }\n /**\n * Given a PushSubscription and messagingSenderId, get an FCM token.\n * @public\n * @param {string} senderId The 'messagingSenderId' to tie the token to.\n * @param {PushSubscription} subscription The PushSusbcription to \"federate\".\n * @param {Uint8Array} publicVapidKey The public VAPID key.\n * @return {Promise} Returns the FCM token to be used in place\n * of the PushSubscription.\n */\n IIDModel.prototype.getToken = function (senderId, subscription, publicVapidKey) {\n var _this = this;\n var p256dh = array_buffer_to_base64(subscription['getKey']('p256dh'));\n var auth = array_buffer_to_base64(subscription['getKey']('auth'));\n var fcmSubscribeBody = \"authorized_entity=\" + senderId + \"&\" +\n (\"endpoint=\" + subscription.endpoint + \"&\") +\n (\"encryption_key=\" + p256dh + \"&\") +\n (\"encryption_auth=\" + auth);\n if (publicVapidKey !== fcm_details.DEFAULT_PUBLIC_VAPID_KEY) {\n var applicationPubKey = array_buffer_to_base64(publicVapidKey);\n fcmSubscribeBody += \"&application_pub_key=\" + applicationPubKey;\n }\n var headers = new Headers();\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\n var subscribeOptions = {\n method: 'POST',\n headers: headers,\n body: fcmSubscribeBody\n };\n return fetch(fcm_details.ENDPOINT + '/fcm/connect/subscribe', subscribeOptions)\n .then(function (response) { return response.json(); })\n .catch(function () {\n throw _this.errorFactory_.create(errors.codes.TOKEN_SUBSCRIBE_FAILED);\n })\n .then(function (response) {\n var fcmTokenResponse = response;\n if (fcmTokenResponse['error']) {\n var message = fcmTokenResponse['error']['message'];\n throw _this.errorFactory_.create(errors.codes.TOKEN_SUBSCRIBE_FAILED, {\n message: message\n });\n }\n if (!fcmTokenResponse['token']) {\n throw _this.errorFactory_.create(errors.codes.TOKEN_SUBSCRIBE_NO_TOKEN);\n }\n if (!fcmTokenResponse['pushSet']) {\n throw _this.errorFactory_.create(errors.codes.TOKEN_SUBSCRIBE_NO_PUSH_SET);\n }\n return {\n token: fcmTokenResponse['token'],\n pushSet: fcmTokenResponse['pushSet']\n };\n });\n };\n /**\n * Update the underlying token details for fcmToken.\n */\n IIDModel.prototype.updateToken = function (senderId, fcmToken, fcmPushSet, subscription, publicVapidKey) {\n var _this = this;\n var p256dh = array_buffer_to_base64(subscription['getKey']('p256dh'));\n var auth = array_buffer_to_base64(subscription['getKey']('auth'));\n var fcmUpdateBody = \"push_set=\" + fcmPushSet + \"&\" +\n (\"token=\" + fcmToken + \"&\") +\n (\"authorized_entity=\" + senderId + \"&\") +\n (\"endpoint=\" + subscription.endpoint + \"&\") +\n (\"encryption_key=\" + p256dh + \"&\") +\n (\"encryption_auth=\" + auth);\n if (publicVapidKey !== fcm_details.DEFAULT_PUBLIC_VAPID_KEY) {\n var applicationPubKey = array_buffer_to_base64(publicVapidKey);\n fcmUpdateBody += \"&application_pub_key=\" + applicationPubKey;\n }\n var headers = new Headers();\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\n var updateOptions = {\n method: 'POST',\n headers: headers,\n body: fcmUpdateBody\n };\n var updateFetchRes;\n return fetch(fcm_details.ENDPOINT + '/fcm/connect/subscribe', updateOptions)\n .then(function (fetchResponse) {\n updateFetchRes = fetchResponse;\n return fetchResponse.json();\n })\n .catch(function () {\n throw _this.errorFactory_.create(errors.codes.TOKEN_UPDATE_FAILED);\n })\n .then(function (fcmTokenResponse) {\n if (!updateFetchRes.ok) {\n var message = fcmTokenResponse['error']['message'];\n throw _this.errorFactory_.create(errors.codes.TOKEN_UPDATE_FAILED, {\n message: message\n });\n }\n if (!fcmTokenResponse['token']) {\n throw _this.errorFactory_.create(errors.codes.TOKEN_UPDATE_NO_TOKEN);\n }\n return fcmTokenResponse['token'];\n });\n };\n /**\n * Given a fcmToken, pushSet and messagingSenderId, delete an FCM token.\n */\n IIDModel.prototype.deleteToken = function (senderId, fcmToken, fcmPushSet) {\n var _this = this;\n var fcmUnsubscribeBody = \"authorized_entity=\" + senderId + \"&\" +\n (\"token=\" + fcmToken + \"&\") +\n (\"pushSet=\" + fcmPushSet);\n var headers = new Headers();\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\n var unsubscribeOptions = {\n method: 'POST',\n headers: headers,\n body: fcmUnsubscribeBody\n };\n return fetch(fcm_details.ENDPOINT + '/fcm/connect/unsubscribe', unsubscribeOptions).then(function (fetchResponse) {\n if (!fetchResponse.ok) {\n return fetchResponse.json().then(function (fcmTokenResponse) {\n if (fcmTokenResponse['error']) {\n var message = fcmTokenResponse['error']['message'];\n throw _this.errorFactory_.create(errors.codes.TOKEN_UNSUBSCRIBE_FAILED, {\n message: message\n });\n }\n }, function (err) {\n throw _this.errorFactory_.create(errors.codes.TOKEN_UNSUBSCRIBE_FAILED);\n });\n }\n });\n };\n return IIDModel;\n}());\n/* harmony default export */ var iid_model = (iid_model_IIDModel);\n\n//# sourceMappingURL=iid-model.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/controllers/controller-interface.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n\n\n\n\n\n\nvar SENDER_ID_OPTION_NAME = 'messagingSenderId';\n// Database cache should be invalidated once a week.\nvar TOKEN_EXPIRATION_MILLIS = 7 * 24 * 60 * 60 * 1000; // 7 days\nvar controller_interface_ControllerInterface = /** @class */ (function () {\n /**\n * An interface of the Messaging Service API\n * @param {!firebase.app.App} app\n */\n function ControllerInterface(app) {\n var _this = this;\n this.errorFactory_ = new cjs[\"ErrorFactory\"]('messaging', 'Messaging', errors.map);\n if (!app.options[SENDER_ID_OPTION_NAME] ||\n typeof app.options[SENDER_ID_OPTION_NAME] !== 'string') {\n throw this.errorFactory_.create(errors.codes.BAD_SENDER_ID);\n }\n this.messagingSenderId_ = app.options[SENDER_ID_OPTION_NAME];\n this.tokenDetailsModel_ = new token_details_model();\n this.vapidDetailsModel_ = new vapid_details_model();\n this.iidModel_ = new iid_model();\n this.app = app;\n this.INTERNAL = {};\n this.INTERNAL.delete = function () { return _this.delete(); };\n }\n /**\n * @export\n */\n ControllerInterface.prototype.getToken = function () {\n var _this = this;\n // Check with permissions\n var currentPermission = this.getNotificationPermission_();\n if (currentPermission !== notification_permission.granted) {\n if (currentPermission === notification_permission.denied) {\n return Promise.reject(this.errorFactory_.create(errors.codes.NOTIFICATIONS_BLOCKED));\n }\n // We must wait for permission to be granted\n return Promise.resolve(null);\n }\n var swReg;\n return this.getSWRegistration_()\n .then(function (reg) {\n swReg = reg;\n return _this.tokenDetailsModel_.getTokenDetailsFromSWScope(swReg.scope);\n })\n .then(function (tokenDetails) {\n if (tokenDetails) {\n return _this.manageExistingToken(tokenDetails, swReg);\n }\n return _this.getNewToken(swReg);\n });\n };\n /**\n * manageExistingToken is triggered if there's an existing FCM token in the\n * database and it can take 3 different actions:\n * 1) Retrieve the existing FCM token from the database.\n * 2) If VAPID details have changed: Delete the existing token and create a\n * new one with the new VAPID key.\n * 3) If the database cache is invalidated: Send a request to FCM to update\n * the token, and to check if the token is still valid on FCM-side.\n */\n ControllerInterface.prototype.manageExistingToken = function (tokenDetails, swReg) {\n var _this = this;\n return this.isTokenStillValid(tokenDetails).then(function (isValid) {\n if (isValid) {\n var now = Date.now();\n if (now < tokenDetails['createTime'] + TOKEN_EXPIRATION_MILLIS) {\n return tokenDetails['fcmToken'];\n }\n else {\n return _this.updateToken(tokenDetails, swReg);\n }\n }\n else {\n // If the VAPID details are updated, delete the existing token,\n // and create a new one.\n return _this.deleteToken(tokenDetails['fcmToken']).then(function () {\n return _this.getNewToken(swReg);\n });\n }\n });\n };\n /*\n * Checks if the tokenDetails match the details provided in the clients.\n */\n ControllerInterface.prototype.isTokenStillValid = function (tokenDetails) {\n // TODO Validate rest of the details.\n return this.getPublicVapidKey_().then(function (publicKey) {\n if (array_buffer_to_base64(publicKey) !== tokenDetails['vapidKey']) {\n return false;\n }\n return true;\n });\n };\n ControllerInterface.prototype.updateToken = function (tokenDetails, swReg) {\n var _this = this;\n var publicVapidKey;\n var updatedToken;\n var subscription;\n return this.getPublicVapidKey_()\n .then(function (publicKey) {\n publicVapidKey = publicKey;\n return _this.getPushSubscription_(swReg, publicVapidKey);\n })\n .then(function (pushSubscription) {\n subscription = pushSubscription;\n return _this.iidModel_.updateToken(_this.messagingSenderId_, tokenDetails['fcmToken'], tokenDetails['fcmPushSet'], subscription, publicVapidKey);\n })\n .catch(function (err) {\n return _this.deleteToken(tokenDetails['fcmToken']).then(function () {\n throw err;\n });\n })\n .then(function (token) {\n updatedToken = token;\n var allDetails = {\n swScope: swReg.scope,\n vapidKey: publicVapidKey,\n subscription: subscription,\n fcmSenderId: _this.messagingSenderId_,\n fcmToken: updatedToken,\n fcmPushSet: tokenDetails['fcmPushSet']\n };\n return _this.tokenDetailsModel_.saveTokenDetails(allDetails);\n })\n .then(function () {\n return _this.vapidDetailsModel_.saveVapidDetails(swReg.scope, publicVapidKey);\n })\n .then(function () {\n return updatedToken;\n });\n };\n ControllerInterface.prototype.getNewToken = function (swReg) {\n var _this = this;\n var publicVapidKey;\n var subscription;\n var tokenDetails;\n return this.getPublicVapidKey_()\n .then(function (publicKey) {\n publicVapidKey = publicKey;\n return _this.getPushSubscription_(swReg, publicVapidKey);\n })\n .then(function (pushSubscription) {\n subscription = pushSubscription;\n return _this.iidModel_.getToken(_this.messagingSenderId_, subscription, publicVapidKey);\n })\n .then(function (iidTokenDetails) {\n tokenDetails = iidTokenDetails;\n var allDetails = {\n swScope: swReg.scope,\n vapidKey: publicVapidKey,\n subscription: subscription,\n fcmSenderId: _this.messagingSenderId_,\n fcmToken: tokenDetails['token'],\n fcmPushSet: tokenDetails['pushSet']\n };\n return _this.tokenDetailsModel_.saveTokenDetails(allDetails);\n })\n .then(function () {\n return _this.vapidDetailsModel_.saveVapidDetails(swReg.scope, publicVapidKey);\n })\n .then(function () {\n return tokenDetails['token'];\n });\n };\n /**\n * This method deletes tokens that the token manager looks after,\n * unsubscribes the token from FCM and then unregisters the push\n * subscription if it exists. It returns a promise that indicates\n * whether or not the unsubscribe request was processed successfully.\n * @export\n */\n ControllerInterface.prototype.deleteToken = function (token) {\n var _this = this;\n return this.tokenDetailsModel_\n .deleteToken(token)\n .then(function (details) {\n return _this.iidModel_.deleteToken(details['fcmSenderId'], details['fcmToken'], details['fcmPushSet']);\n })\n .then(function () {\n return _this.getSWRegistration_()\n .then(function (registration) {\n if (registration) {\n return registration.pushManager.getSubscription();\n }\n })\n .then(function (subscription) {\n if (subscription) {\n return subscription.unsubscribe();\n }\n });\n });\n };\n ControllerInterface.prototype.getSWRegistration_ = function () {\n throw this.errorFactory_.create(errors.codes.SHOULD_BE_INHERITED);\n };\n ControllerInterface.prototype.getPublicVapidKey_ = function () {\n throw this.errorFactory_.create(errors.codes.SHOULD_BE_INHERITED);\n };\n //\n // The following methods should only be available in the window.\n //\n ControllerInterface.prototype.requestPermission = function () {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_WINDOW);\n };\n ControllerInterface.prototype.getPushSubscription_ = function (registration, publicVapidKey) {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!ServiceWorkerRegistration} registration\n */\n ControllerInterface.prototype.useServiceWorker = function (registration) {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!string} b64PublicKey\n */\n ControllerInterface.prototype.usePublicVapidKey = function (b64PublicKey) {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!firebase.Observer|function(*)} nextOrObserver\n * @param {function(!Error)=} optError\n * @param {function()=} optCompleted\n * @return {!function()}\n */\n ControllerInterface.prototype.onMessage = function (nextOrObserver, optError, optCompleted) {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!firebase.Observer|function()} nextOrObserver An observer object\n * or a function triggered on token refresh.\n * @param {function(!Error)=} optError Optional A function\n * triggered on token refresh error.\n * @param {function()=} optCompleted Optional function triggered when the\n * observer is removed.\n * @return {!function()} The unsubscribe function for the observer.\n */\n ControllerInterface.prototype.onTokenRefresh = function (nextOrObserver, optError, optCompleted) {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_WINDOW);\n };\n //\n // The following methods are used by the service worker only.\n //\n /**\n * @export\n * @param {function(Object)} callback\n */\n ControllerInterface.prototype.setBackgroundMessageHandler = function (callback) {\n throw this.errorFactory_.create(errors.codes.AVAILABLE_IN_SW);\n };\n //\n // The following methods are used by the service themselves and not exposed\n // publicly or not expected to be used by developers.\n //\n /**\n * This method is required to adhere to the Firebase interface.\n * It closes any currently open indexdb database connections.\n */\n ControllerInterface.prototype.delete = function () {\n return Promise.all([\n this.tokenDetailsModel_.closeDatabase(),\n this.vapidDetailsModel_.closeDatabase()\n ]);\n };\n /**\n * Returns the current Notification Permission state.\n * @private\n * @return {string} The currenct permission state.\n */\n ControllerInterface.prototype.getNotificationPermission_ = function () {\n return Notification.permission;\n };\n ControllerInterface.prototype.getTokenDetailsModel = function () {\n return this.tokenDetailsModel_;\n };\n ControllerInterface.prototype.getVapidDetailsModel = function () {\n return this.vapidDetailsModel_;\n };\n /**\n * @protected\n * @returns {IIDModel}\n */\n ControllerInterface.prototype.getIIDModel = function () {\n return this.iidModel_;\n };\n return ControllerInterface;\n}());\n/* harmony default export */ var controller_interface = (controller_interface_ControllerInterface);\n\n//# sourceMappingURL=controller-interface.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/worker-page-message.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// These fields are strings to prevent closure from thinking goog.getMsg\n// should be used to initialise the values\nvar PARAMS = {\n TYPE_OF_MSG: 'firebase-messaging-msg-type',\n DATA: 'firebase-messaging-msg-data'\n};\n// This value isn't using the TYPE_OF_MSG short hand as closure\n// expects the variable to be defined via goog.getMsg\nvar msgType = {\n PUSH_MSG_RECEIVED: 'push-msg-received',\n NOTIFICATION_CLICKED: 'notification-clicked'\n};\nvar createNewMsg = function (msgType, msgData) {\n var message = (_a = {},\n _a[PARAMS.TYPE_OF_MSG] = msgType,\n _a[PARAMS.DATA] = msgData,\n _a);\n return message;\n var _a;\n};\n/* harmony default export */ var worker_page_message = ({\n PARAMS: PARAMS,\n TYPES_OF_MSG: msgType,\n createNewMsg: createNewMsg\n});\n\n//# sourceMappingURL=worker-page-message.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/models/default-sw.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* harmony default export */ var default_sw = ({\n path: '/firebase-messaging-sw.js',\n scope: '/firebase-cloud-messaging-push-scope'\n});\n\n//# sourceMappingURL=default-sw.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/helpers/base64-to-array-buffer.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* harmony default export */ var base64_to_array_buffer = (function (base64String) {\n var padding = '='.repeat((4 - base64String.length % 4) % 4);\n var base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n var rawData = window.atob(base64);\n var outputArray = new Uint8Array(rawData.length);\n for (var i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n});;\n\n//# sourceMappingURL=base64-to-array-buffer.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/controllers/window-controller.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar window_controller___extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\n\n\n\n\nvar window_controller_WindowController = /** @class */ (function (_super) {\n window_controller___extends(WindowController, _super);\n /**\n * A service that provides a MessagingService instance.\n * @param {!firebase.app.App} app\n */\n function WindowController(app) {\n var _this = _super.call(this, app) || this;\n _this.messageObserver_ = null;\n _this.onMessage_ = Object(cjs[\"createSubscribe\"])(function (observer) {\n _this.messageObserver_ = observer;\n });\n _this.tokenRefreshObserver_ = null;\n _this.onTokenRefresh_ = Object(cjs[\"createSubscribe\"])(function (observer) {\n _this.tokenRefreshObserver_ = observer;\n });\n /**\n * @private\n * @type {ServiceWorkerRegistration}\n */\n _this.registrationToUse_;\n /**\n * @private\n * @type {Promise}\n */\n _this.manifestCheckPromise_;\n /**\n * @private\n * @type {firebase.Observer}\n */\n _this.messageObserver_ = null;\n /**\n * @private {!firebase.Subscribe} The subscribe function to the onMessage\n * observer.\n */\n _this.onMessage_ = Object(cjs[\"createSubscribe\"])(function (observer) {\n _this.messageObserver_ = observer;\n });\n /**\n * @private\n * @type {firebase.Observer}\n */\n _this.tokenRefreshObserver_ = null;\n _this.onTokenRefresh_ = Object(cjs[\"createSubscribe\"])(function (observer) {\n _this.tokenRefreshObserver_ = observer;\n });\n _this.setupSWMessageListener_();\n return _this;\n }\n /**\n * This method returns an FCM token if it can be generated.\n * The return promise will reject if the browser doesn't support\n * FCM, if permission is denied for notifications or it's not\n * possible to generate a token.\n * @export\n * @return {Promise | Promise} Returns a promise the\n * resolves to an FCM token or null if permission isn't granted.\n */\n WindowController.prototype.getToken = function () {\n var _this = this;\n // Check that the required API's are available\n if (!this.isSupported_()) {\n return Promise.reject(this.errorFactory_.create(errors.codes.UNSUPPORTED_BROWSER));\n }\n return this.manifestCheck_().then(function () {\n return _super.prototype.getToken.call(_this);\n });\n };\n /**\n * The method checks that a manifest is defined and has the correct GCM\n * sender ID.\n * @private\n * @return {Promise} Returns a promise that resolves if the manifest matches\n * our required sender ID\n */\n WindowController.prototype.manifestCheck_ = function () {\n var _this = this;\n if (this.manifestCheckPromise_) {\n return this.manifestCheckPromise_;\n }\n var manifestTag = document.querySelector('link[rel=\"manifest\"]');\n if (!manifestTag) {\n this.manifestCheckPromise_ = Promise.resolve();\n }\n else {\n this.manifestCheckPromise_ = fetch(manifestTag.href)\n .then(function (response) {\n return response.json();\n })\n .catch(function () {\n // If the download or parsing fails allow check.\n // We only want to error if we KNOW that the gcm_sender_id is incorrect.\n return Promise.resolve();\n })\n .then(function (manifestContent) {\n if (!manifestContent) {\n return;\n }\n if (!manifestContent['gcm_sender_id']) {\n return;\n }\n if (manifestContent['gcm_sender_id'] !== '103953800507') {\n throw _this.errorFactory_.create(errors.codes.INCORRECT_GCM_SENDER_ID);\n }\n });\n }\n return this.manifestCheckPromise_;\n };\n /**\n * Request permission if it is not currently granted\n * @export\n * @returns {Promise} Resolves if the permission was granted, otherwise\n * rejects\n */\n WindowController.prototype.requestPermission = function () {\n var _this = this;\n if (Notification.permission === notification_permission.granted) {\n return Promise.resolve();\n }\n return new Promise(function (resolve, reject) {\n var managePermissionResult = function (result) {\n if (result === notification_permission.granted) {\n return resolve();\n }\n else if (result === notification_permission.denied) {\n return reject(_this.errorFactory_.create(errors.codes.PERMISSION_BLOCKED));\n }\n else {\n return reject(_this.errorFactory_.create(errors.codes.PERMISSION_DEFAULT));\n }\n };\n // The Notification.requestPermission API was changed to\n // return a promise so now have to handle both in case\n // browsers stop support callbacks for promised version\n var permissionPromise = Notification.requestPermission(managePermissionResult);\n if (permissionPromise) {\n // Prefer the promise version as it's the future API.\n permissionPromise.then(managePermissionResult);\n }\n });\n };\n /**\n * This method allows a developer to override the default service worker and\n * instead use a custom service worker.\n * @export\n * @param {!ServiceWorkerRegistration} registration The service worker\n * registration that should be used to receive the push messages.\n */\n WindowController.prototype.useServiceWorker = function (registration) {\n if (!(registration instanceof ServiceWorkerRegistration)) {\n throw this.errorFactory_.create(errors.codes.SW_REGISTRATION_EXPECTED);\n }\n if (typeof this.registrationToUse_ !== 'undefined') {\n throw this.errorFactory_.create(errors.codes.USE_SW_BEFORE_GET_TOKEN);\n }\n this.registrationToUse_ = registration;\n };\n /**\n * This method allows a developer to override the default vapid key\n * and instead use a custom VAPID public key.\n * @export\n * @param {!string} publicKey A URL safe base64 encoded string.\n */\n WindowController.prototype.usePublicVapidKey = function (publicKey) {\n if (typeof publicKey !== 'string') {\n throw this.errorFactory_.create(errors.codes.INVALID_PUBLIC_VAPID_KEY);\n }\n if (typeof this.publicVapidKeyToUse_ !== 'undefined') {\n throw this.errorFactory_.create(errors.codes.USE_PUBLIC_KEY_BEFORE_GET_TOKEN);\n }\n var parsedKey = base64_to_array_buffer(publicKey);\n if (parsedKey.length !== 65) {\n throw this.errorFactory_.create(errors.codes.PUBLIC_KEY_DECRYPTION_FAILED);\n }\n this.publicVapidKeyToUse_ = parsedKey;\n };\n /**\n * @export\n * @param {!firebase.Observer|function(*)} nextOrObserver An observer object\n * or a function triggered on message.\n * @param {function(!Error)=} optError Optional A function triggered on\n * message error.\n * @param {function()=} optCompleted Optional function triggered when the\n * observer is removed.\n * @return {!function()} The unsubscribe function for the observer.\n */\n WindowController.prototype.onMessage = function (nextOrObserver, optError, optCompleted) {\n return this.onMessage_(nextOrObserver, optError, optCompleted);\n };\n /**\n * @export\n * @param {!firebase.Observer|function()} nextOrObserver An observer object\n * or a function triggered on token refresh.\n * @param {function(!Error)=} optError Optional A function\n * triggered on token refresh error.\n * @param {function()=} optCompleted Optional function triggered when the\n * observer is removed.\n * @return {!function()} The unsubscribe function for the observer.\n */\n WindowController.prototype.onTokenRefresh = function (nextOrObserver, optError, optCompleted) {\n return this.onTokenRefresh_(nextOrObserver, optError, optCompleted);\n };\n /**\n * Given a registration, wait for the service worker it relates to\n * become activer\n * @private\n * @param {ServiceWorkerRegistration} registration Registration to wait\n * for service worker to become active\n * @return {Promise} Wait for service worker\n * registration to become active\n */\n WindowController.prototype.waitForRegistrationToActivate_ = function (registration) {\n var _this = this;\n var serviceWorker = registration.installing || registration.waiting || registration.active;\n return new Promise(function (resolve, reject) {\n if (!serviceWorker) {\n // This is a rare scenario but has occured in firefox\n reject(_this.errorFactory_.create(errors.codes.NO_SW_IN_REG));\n return;\n }\n // Because the Promise function is called on next tick there is a\n // small chance that the worker became active or redundant already.\n if (serviceWorker.state === 'activated') {\n resolve(registration);\n return;\n }\n if (serviceWorker.state === 'redundant') {\n reject(_this.errorFactory_.create(errors.codes.SW_REG_REDUNDANT));\n return;\n }\n var stateChangeListener = function () {\n if (serviceWorker.state === 'activated') {\n resolve(registration);\n }\n else if (serviceWorker.state === 'redundant') {\n reject(_this.errorFactory_.create(errors.codes.SW_REG_REDUNDANT));\n }\n else {\n // Return early and wait to next state change\n return;\n }\n serviceWorker.removeEventListener('statechange', stateChangeListener);\n };\n serviceWorker.addEventListener('statechange', stateChangeListener);\n });\n };\n /**\n * This will regiater the default service worker and return the registration\n * @private\n * @return {Promise} The service worker\n * registration to be used for the push service.\n */\n WindowController.prototype.getSWRegistration_ = function () {\n var _this = this;\n if (this.registrationToUse_) {\n return this.waitForRegistrationToActivate_(this.registrationToUse_);\n }\n // Make the registration null so we know useServiceWorker will not\n // use a new service worker as registrationToUse_ is no longer undefined\n this.registrationToUse_ = null;\n return navigator.serviceWorker\n .register(default_sw.path, {\n scope: default_sw.scope\n })\n .catch(function (err) {\n throw _this.errorFactory_.create(errors.codes.FAILED_DEFAULT_REGISTRATION, {\n browserErrorMessage: err.message\n });\n })\n .then(function (registration) {\n return _this.waitForRegistrationToActivate_(registration).then(function () {\n _this.registrationToUse_ = registration;\n // We update after activation due to an issue with Firefox v49 where\n // a race condition occassionally causes the service work to not\n // install\n registration.update();\n return registration;\n });\n });\n };\n /**\n * This will return the default VAPID key or the uint8array version of the public VAPID key\n * provided by the developer.\n * @private\n */\n WindowController.prototype.getPublicVapidKey_ = function () {\n if (this.publicVapidKeyToUse_) {\n return Promise.resolve(this.publicVapidKeyToUse_);\n }\n return Promise.resolve(fcm_details.DEFAULT_PUBLIC_VAPID_KEY);\n };\n /**\n * Gets a PushSubscription for the current user.\n * @private\n * @param {ServiceWorkerRegistration} registration\n * @return {Promise}\n */\n WindowController.prototype.getPushSubscription_ = function (swRegistration, publicVapidKey) {\n // Check for existing subscription first\n var subscription;\n var fcmTokenDetails;\n return swRegistration.pushManager.getSubscription().then(function (subscription) {\n if (subscription) {\n return subscription;\n }\n return swRegistration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: publicVapidKey\n });\n });\n };\n /**\n * This method will set up a message listener to handle\n * events from the service worker that should trigger\n * events in the page.\n *\n * @private\n */\n WindowController.prototype.setupSWMessageListener_ = function () {\n var _this = this;\n if (!('serviceWorker' in navigator)) {\n return;\n }\n navigator.serviceWorker.addEventListener('message', function (event) {\n if (!event.data || !event.data[worker_page_message.PARAMS.TYPE_OF_MSG]) {\n // Not a message from FCM\n return;\n }\n var workerPageMessage = event.data;\n switch (workerPageMessage[worker_page_message.PARAMS.TYPE_OF_MSG]) {\n case worker_page_message.TYPES_OF_MSG.PUSH_MSG_RECEIVED:\n case worker_page_message.TYPES_OF_MSG.NOTIFICATION_CLICKED:\n var pushMessage = workerPageMessage[worker_page_message.PARAMS.DATA];\n if (_this.messageObserver_) {\n _this.messageObserver_.next(pushMessage);\n }\n break;\n default:\n // Noop.\n break;\n }\n }, false);\n };\n /**\n * Checks to see if the required API's are valid or not.\n * @private\n * @return {boolean} Returns true if the desired APIs are available.\n */\n WindowController.prototype.isSupported_ = function () {\n return ('serviceWorker' in navigator &&\n 'PushManager' in window &&\n 'Notification' in window &&\n 'fetch' in window &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey'));\n };\n return WindowController;\n}(controller_interface));\n/* harmony default export */ var window_controller = (window_controller_WindowController);\n\n//# sourceMappingURL=window-controller.js.map\n\n// CONCATENATED MODULE: ../messaging/dist/esm/src/controllers/sw-controller.js\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar sw_controller___extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\nvar FCM_MSG = 'FCM_MSG';\nvar sw_controller_SWController = /** @class */ (function (_super) {\n sw_controller___extends(SWController, _super);\n function SWController(app) {\n var _this = _super.call(this, app) || this;\n self.addEventListener('push', function (e) { return _this.onPush_(e); }, false);\n self.addEventListener('pushsubscriptionchange', function (e) { return _this.onSubChange_(e); }, false);\n self.addEventListener('notificationclick', function (e) { return _this.onNotificationClick_(e); }, false);\n /**\n * @private\n * @type {function(Object)|null}\n */\n _this.bgMessageHandler_ = null;\n return _this;\n }\n /**\n * A handler for push events that shows notifications based on the content of\n * the payload.\n *\n * The payload must be a JSON-encoded Object with a `notification` key. The\n * value of the `notification` property will be used as the NotificationOptions\n * object passed to showNotification. Additionally, the `title` property of the\n * notification object will be used as the title.\n *\n * If there is no notification data in the payload then no notification will be\n * shown.\n * @private\n */\n SWController.prototype.onPush_ = function (event) {\n var _this = this;\n var msgPayload;\n try {\n msgPayload = event.data.json();\n }\n catch (err) {\n // Not JSON so not an FCM message\n return;\n }\n var handleMsgPromise = this.hasVisibleClients_().then(function (hasVisibleClients) {\n if (hasVisibleClients) {\n // Do not need to show a notification.\n if (msgPayload.notification || _this.bgMessageHandler_) {\n // Send to page\n return _this.sendMessageToWindowClients_(msgPayload);\n }\n return;\n }\n var notificationDetails = _this.getNotificationData_(msgPayload);\n if (notificationDetails) {\n var notificationTitle_1 = notificationDetails.title || '';\n return _this.getSWRegistration_().then(function (reg) {\n return reg.showNotification(notificationTitle_1, notificationDetails);\n });\n }\n else if (_this.bgMessageHandler_) {\n return _this.bgMessageHandler_(msgPayload);\n }\n });\n event.waitUntil(handleMsgPromise);\n };\n /**\n * @private\n */\n SWController.prototype.onSubChange_ = function (event) {\n var _this = this;\n var promiseChain = this.getSWRegistration_()\n .then(function (registration) {\n return registration.pushManager\n .getSubscription()\n .then(function (subscription) {\n // TODO: Check if it's still valid\n // TODO: If not, then update token\n })\n .catch(function (err) {\n // The best thing we can do is log this to the terminal so\n // developers might notice the error.\n var tokenDetailsModel = _this.getTokenDetailsModel();\n return tokenDetailsModel\n .getTokenDetailsFromSWScope(registration.scope)\n .then(function (tokenDetails) {\n if (!tokenDetails) {\n // This should rarely occure, but could if indexedDB\n // is corrupted or wiped\n throw err;\n }\n // Attempt to delete the token if we know it's bad\n return _this.deleteToken(tokenDetails['fcmToken']).then(function () {\n throw err;\n });\n });\n });\n })\n .catch(function (err) {\n throw _this.errorFactory_.create(errors.codes.UNABLE_TO_RESUBSCRIBE, {\n message: err\n });\n });\n event.waitUntil(promiseChain);\n };\n /**\n * @private\n */\n SWController.prototype.onNotificationClick_ = function (event) {\n var _this = this;\n if (!(event.notification &&\n event.notification.data &&\n event.notification.data[FCM_MSG])) {\n // Not an FCM notification, do nothing.\n return;\n }\n // Prevent other listeners from receiving the event\n event.stopImmediatePropagation();\n event.notification.close();\n var msgPayload = event.notification.data[FCM_MSG];\n if (!msgPayload['notification']) {\n // Nothing to do.\n return;\n }\n var clickAction = msgPayload['notification']['click_action'];\n if (!clickAction) {\n // Nothing to do.\n return;\n }\n var promiseChain = this.getWindowClient_(clickAction)\n .then(function (windowClient) {\n if (!windowClient) {\n // Unable to find window client so need to open one.\n return self.clients.openWindow(clickAction);\n }\n return windowClient.focus();\n })\n .then(function (windowClient) {\n if (!windowClient) {\n // Window Client will not be returned if it's for a third party origin.\n return;\n }\n // Delete notification data from payload before sending to the page.\n var notificationData = msgPayload['notification'];\n delete msgPayload['notification'];\n var internalMsg = worker_page_message.createNewMsg(worker_page_message.TYPES_OF_MSG.NOTIFICATION_CLICKED, msgPayload);\n // Attempt to send a message to the client to handle the data\n // Is affected by: https://github.com/slightlyoff/ServiceWorker/issues/728\n return _this.attemptToMessageClient_(windowClient, internalMsg);\n });\n event.waitUntil(promiseChain);\n };\n /**\n * @private\n * @param {Object} msgPayload\n * @return {NotificationOptions|undefined}\n */\n SWController.prototype.getNotificationData_ = function (msgPayload) {\n if (!msgPayload) {\n return;\n }\n if (typeof msgPayload.notification !== 'object') {\n return;\n }\n var notificationInformation = Object.assign({}, msgPayload.notification);\n // Put the message payload under FCM_MSG name so we can identify the\n // notification as being an FCM notification vs a notification from\n // somewhere else (i.e. normal web push or developer generated\n // notification).\n notificationInformation['data'] = (_a = {},\n _a[FCM_MSG] = msgPayload,\n _a);\n return notificationInformation;\n var _a;\n };\n /**\n * Calling setBackgroundMessageHandler will opt in to some specific\n * behaviours.\n * 1.) If a notification doesn't need to be shown due to a window already\n * being visible, then push messages will be sent to the page.\n * 2.) If a notification needs to be shown, and the message contains no\n * notification data this method will be called\n * and the promise it returns will be passed to event.waitUntil.\n * If you do not set this callback then all push messages will let and the\n * developer can handle them in a their own 'push' event callback\n * @export\n * @param {function(Object)} callback The callback to be called when a push\n * message is received and a notification must be shown. The callback will\n * be given the data from the push message.\n */\n SWController.prototype.setBackgroundMessageHandler = function (callback) {\n if (!callback || typeof callback !== 'function') {\n throw this.errorFactory_.create(errors.codes.BG_HANDLER_FUNCTION_EXPECTED);\n }\n this.bgMessageHandler_ = callback;\n };\n /**\n * @private\n * @param {string} url The URL to look for when focusing a client.\n * @return {Object} Returns an existing window client or a newly opened\n * WindowClient.\n */\n SWController.prototype.getWindowClient_ = function (url) {\n // Use URL to normalize the URL when comparing to windowClients.\n // This at least handles whether to include trailing slashes or not\n var parsedURL = new URL(url, self.location).href;\n return self.clients\n .matchAll({\n type: 'window',\n includeUncontrolled: true\n })\n .then(function (clientList) {\n var suitableClient = null;\n for (var i = 0; i < clientList.length; i++) {\n var parsedClientUrl = new URL(clientList[i].url, self.location).href;\n if (parsedClientUrl === parsedURL) {\n suitableClient = clientList[i];\n break;\n }\n }\n if (suitableClient) {\n return suitableClient;\n }\n return null;\n });\n };\n /**\n * This message will attempt to send the message to a window client.\n * @private\n * @param {Object} client The WindowClient to send the message to.\n * @param {Object} message The message to send to the client.\n * @returns {Promise} Returns a promise that resolves after sending the\n * message. This does not guarantee that the message was successfully\n * received.\n */\n SWController.prototype.attemptToMessageClient_ = function (client, message) {\n // NOTE: This returns a promise in case this API is abstracted later on to\n // do additional work\n if (!client) {\n return Promise.reject(this.errorFactory_.create(errors.codes.NO_WINDOW_CLIENT_TO_MSG));\n }\n client.postMessage(message);\n return Promise.resolve();\n };\n /**\n * @private\n * @returns {Promise} If there is currently a visible WindowClient,\n * this method will resolve to true, otherwise false.\n */\n SWController.prototype.hasVisibleClients_ = function () {\n return self.clients\n .matchAll({\n type: 'window',\n includeUncontrolled: true\n })\n .then(function (clientList) {\n return clientList.some(function (client) { return client.visibilityState === 'visible'; });\n });\n };\n /**\n * @private\n * @param {Object} msgPayload The data from the push event that should be sent\n * to all available pages.\n * @returns {Promise} Returns a promise that resolves once the message\n * has been sent to all WindowClients.\n */\n SWController.prototype.sendMessageToWindowClients_ = function (msgPayload) {\n var _this = this;\n return self.clients\n .matchAll({\n type: 'window',\n includeUncontrolled: true\n })\n .then(function (clientList) {\n var internalMsg = worker_page_message.createNewMsg(worker_page_message.TYPES_OF_MSG.PUSH_MSG_RECEIVED, msgPayload);\n return Promise.all(clientList.map(function (client) {\n return _this.attemptToMessageClient_(client, internalMsg);\n }));\n });\n };\n /**\n * This will register the default service worker and return the registration.\n * @private\n * @return {Promise} The service worker\n * registration to be used for the push service.\n */\n SWController.prototype.getSWRegistration_ = function () {\n return Promise.resolve(self.registration);\n };\n /**\n * This will return the default VAPID key or the uint8array version of the\n * public VAPID key provided by the developer.\n */\n SWController.prototype.getPublicVapidKey_ = function () {\n var _this = this;\n return this.getSWRegistration_()\n .then(function (swReg) {\n return _this.getVapidDetailsModel().getVapidFromSWScope(swReg.scope);\n })\n .then(function (vapidKeyFromDatabase) {\n if (vapidKeyFromDatabase === null) {\n return fcm_details.DEFAULT_PUBLIC_VAPID_KEY;\n }\n return vapidKeyFromDatabase;\n });\n };\n return SWController;\n}(controller_interface));\n/* harmony default export */ var sw_controller = (sw_controller_SWController);\n\n//# sourceMappingURL=sw-controller.js.map\n\n// EXTERNAL MODULE: ../app/dist/esm/index.js + 1 modules\nvar esm = __webpack_require__(6);\n\n// CONCATENATED MODULE: ../messaging/dist/esm/index.js\n/* harmony export (immutable) */ __webpack_exports__[\"registerMessaging\"] = registerMessaging;\n/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n\n\nfunction registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new sw_controller(app);\n }\n // Assume we are in the window context.\n return new window_controller(app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: window_controller\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}\nregisterMessaging(esm[\"firebase\"]);\n\n//# sourceMappingURL=index.js.map\n\n\n/***/ })\n\n},[116]);\n } catch(error) {\n throw new Error(\n 'Cannot instantiate firebase-messaging.js - ' +\n 'be sure to load firebase-app.js first.'\n )\n }\n\n\n// WEBPACK FOOTER //\n// firebase-messaging.js","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nrequire('@firebase/messaging');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./messaging/index.js\n// module id = 116\n// module chunks = 3","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction toBase64(arrayBuffer) {\n var uint8Version = new Uint8Array(arrayBuffer);\n return window.btoa(String.fromCharCode.apply(null, uint8Version));\n}\nexport default function (arrayBuffer) {\n var base64String = toBase64(arrayBuffer);\n return base64String\n .replace(/=/g, '')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_');\n};\n\n//# sourceMappingURL=array-buffer-to-base64.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/helpers/array-buffer-to-base64.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport DBInterface from './db-interface';\nimport Errors from './errors';\nimport arrayBufferToBase64 from '../helpers/array-buffer-to-base64';\nvar FCM_TOKEN_OBJ_STORE = 'fcm_token_object_Store';\nvar DB_VERSION = 1;\n/** @record */\nfunction ValidateInput() { }\n/** @type {string|undefined} */\nValidateInput.prototype.fcmToken;\n/** @type {string|undefined} */\nValidateInput.prototype.swScope;\n/** @type {string|undefined} */\nValidateInput.prototype.vapidKey;\n/** @type {PushSubscription|undefined} */\nValidateInput.prototype.subscription;\n/** @type {string|undefined} */\nValidateInput.prototype.fcmSenderId;\n/** @type {string|undefined} */\nValidateInput.prototype.fcmPushSet;\nvar TokenDetailsModel = /** @class */ (function (_super) {\n __extends(TokenDetailsModel, _super);\n function TokenDetailsModel() {\n return _super.call(this, TokenDetailsModel.DB_NAME, DB_VERSION) || this;\n }\n Object.defineProperty(TokenDetailsModel, \"DB_NAME\", {\n get: function () {\n return 'fcm_token_details_db';\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @override\n */\n TokenDetailsModel.prototype.onDBUpgrade = function (db) {\n var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, {\n keyPath: 'swScope'\n });\n // Make sure the sender ID can be searched\n objectStore.createIndex('fcmSenderId', 'fcmSenderId', {\n unique: false\n });\n objectStore.createIndex('fcmToken', 'fcmToken', {\n unique: true\n });\n };\n /**\n * This method takes an object and will check for known arguments and\n * validate the input.\n * @private\n * @param {!ValidateInput} input\n * @return {!Promise} Returns promise that resolves if input is valid,\n * rejects otherwise.\n */\n TokenDetailsModel.prototype.validateInputs_ = function (input) {\n if (input.fcmToken) {\n if (typeof input.fcmToken !== 'string' || input.fcmToken.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_TOKEN));\n }\n }\n if (input.swScope) {\n if (typeof input.swScope !== 'string' || input.swScope.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SCOPE));\n }\n }\n if (input.vapidKey) {\n if (!(input.vapidKey instanceof Uint8Array) ||\n input.vapidKey.length !== 65) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_VAPID_KEY));\n }\n }\n if (input.subscription) {\n if (!(input.subscription instanceof PushSubscription)) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SUBSCRIPTION));\n }\n }\n if (input.fcmSenderId) {\n if (typeof input.fcmSenderId !== 'string' ||\n input.fcmSenderId.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SENDER_ID));\n }\n }\n if (input.fcmPushSet) {\n if (typeof input.fcmPushSet !== 'string' ||\n input.fcmPushSet.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_PUSH_SET));\n }\n }\n return Promise.resolve();\n };\n /**\n * Given a token, this method will look up the details in indexedDB.\n * @param {string} fcmToken\n * @return {Promise} The details associated with that token.\n */\n TokenDetailsModel.prototype.getTokenDetailsFromToken = function (fcmToken) {\n var _this = this;\n if (!fcmToken) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_TOKEN));\n }\n return this.validateInputs_({ fcmToken: fcmToken })\n .then(function () {\n return _this.openDatabase();\n })\n .then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var index = objectStore.index('fcmToken');\n var request = index.get(fcmToken);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n var result = event.target.result\n ? event.target.result\n : null;\n resolve(result);\n };\n });\n });\n };\n /**\n * Given a service worker scope, this method will look up the details in\n * indexedDB.\n * @public\n * @param {string} swScope\n * @return {Promise} The details associated with that token.\n */\n TokenDetailsModel.prototype.getTokenDetailsFromSWScope = function (swScope) {\n var _this = this;\n if (!swScope) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SCOPE));\n }\n return this.validateInputs_({ swScope: swScope })\n .then(function () {\n return _this.openDatabase();\n })\n .then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE]);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var scopeRequest = objectStore.get(swScope);\n scopeRequest.onerror = function (event) {\n reject(event.target.error);\n };\n scopeRequest.onsuccess = function (event) {\n var result = event.target.result\n ? event.target.result\n : null;\n resolve(result);\n };\n });\n });\n };\n /**\n * Save the details for the fcm token for re-use at a later date.\n * @param {{swScope: !string, vapidKey: !string,\n * subscription: !PushSubscription, fcmSenderId: !string, fcmToken: !string,\n * fcmPushSet: !string}} input A plain js object containing args to save.\n * @return {Promise}\n */\n TokenDetailsModel.prototype.saveTokenDetails = function (_a) {\n var _this = this;\n var swScope = _a.swScope, vapidKey = _a.vapidKey, subscription = _a.subscription, fcmSenderId = _a.fcmSenderId, fcmToken = _a.fcmToken, fcmPushSet = _a.fcmPushSet;\n if (!swScope) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SCOPE));\n }\n if (!vapidKey) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_VAPID_KEY));\n }\n if (!subscription) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SUBSCRIPTION));\n }\n if (!fcmSenderId) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SENDER_ID));\n }\n if (!fcmToken) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_TOKEN));\n }\n if (!fcmPushSet) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_PUSH_SET));\n }\n return this.validateInputs_({\n swScope: swScope,\n vapidKey: vapidKey,\n subscription: subscription,\n fcmSenderId: fcmSenderId,\n fcmToken: fcmToken,\n fcmPushSet: fcmPushSet\n })\n .then(function () {\n return _this.openDatabase();\n })\n .then(function (db) {\n /**\n * @dict\n */\n var details = {\n swScope: swScope,\n vapidKey: arrayBufferToBase64(vapidKey),\n endpoint: subscription.endpoint,\n auth: arrayBufferToBase64(subscription['getKey']('auth')),\n p256dh: arrayBufferToBase64(subscription['getKey']('p256dh')),\n fcmSenderId: fcmSenderId,\n fcmToken: fcmToken,\n fcmPushSet: fcmPushSet,\n createTime: Date.now()\n };\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var request = objectStore.put(details);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n resolve();\n };\n });\n });\n };\n /**\n * This method deletes details of the current FCM token.\n * It's returning a promise in case we need to move to an async\n * method for deleting at a later date.\n * @return {Promise} Resolves once the FCM token details have been\n * deleted and returns the deleted details.\n */\n TokenDetailsModel.prototype.deleteToken = function (token) {\n var _this = this;\n if (typeof token !== 'string' || token.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.INVALID_DELETE_TOKEN));\n }\n return this.getTokenDetailsFromToken(token).then(function (details) {\n if (!details) {\n throw _this.errorFactory_.create(Errors.codes.DELETE_TOKEN_NOT_FOUND);\n }\n return _this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_TOKEN_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_TOKEN_OBJ_STORE);\n var request = objectStore.delete(details['swScope']);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n if (event.target.result === 0) {\n reject(_this.errorFactory_.create(Errors.codes.FAILED_TO_DELETE_TOKEN));\n return;\n }\n resolve(details);\n };\n });\n });\n });\n };\n return TokenDetailsModel;\n}(DBInterface));\nexport default TokenDetailsModel;\n\n//# sourceMappingURL=token-details-model.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/token-details-model.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nimport WindowController from './src/controllers/window-controller';\nimport SWController from './src/controllers/sw-controller';\nimport { firebase } from '@firebase/app';\nexport function registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new SWController(app);\n }\n // Assume we are in the window context.\n return new WindowController(app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: WindowController\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}\nregisterMessaging(firebase);\n\n//# sourceMappingURL=index.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/index.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nvar CODES = {\n AVAILABLE_IN_WINDOW: 'only-available-in-window',\n AVAILABLE_IN_SW: 'only-available-in-sw',\n SHOULD_BE_INHERITED: 'should-be-overriden',\n BAD_SENDER_ID: 'bad-sender-id',\n INCORRECT_GCM_SENDER_ID: 'incorrect-gcm-sender-id',\n PERMISSION_DEFAULT: 'permission-default',\n PERMISSION_BLOCKED: 'permission-blocked',\n UNSUPPORTED_BROWSER: 'unsupported-browser',\n NOTIFICATIONS_BLOCKED: 'notifications-blocked',\n FAILED_DEFAULT_REGISTRATION: 'failed-serviceworker-registration',\n SW_REGISTRATION_EXPECTED: 'sw-registration-expected',\n GET_SUBSCRIPTION_FAILED: 'get-subscription-failed',\n INVALID_SAVED_TOKEN: 'invalid-saved-token',\n SW_REG_REDUNDANT: 'sw-reg-redundant',\n TOKEN_SUBSCRIBE_FAILED: 'token-subscribe-failed',\n TOKEN_SUBSCRIBE_NO_TOKEN: 'token-subscribe-no-token',\n TOKEN_SUBSCRIBE_NO_PUSH_SET: 'token-subscribe-no-push-set',\n TOKEN_UNSUBSCRIBE_FAILED: 'token-unsubscribe-failed',\n TOKEN_UPDATE_FAILED: 'token-update-failed',\n TOKEN_UPDATE_NO_TOKEN: 'token-update-no-token',\n USE_SW_BEFORE_GET_TOKEN: 'use-sw-before-get-token',\n INVALID_DELETE_TOKEN: 'invalid-delete-token',\n DELETE_TOKEN_NOT_FOUND: 'delete-token-not-found',\n DELETE_SCOPE_NOT_FOUND: 'delete-scope-not-found',\n BG_HANDLER_FUNCTION_EXPECTED: 'bg-handler-function-expected',\n NO_WINDOW_CLIENT_TO_MSG: 'no-window-client-to-msg',\n UNABLE_TO_RESUBSCRIBE: 'unable-to-resubscribe',\n NO_FCM_TOKEN_FOR_RESUBSCRIBE: 'no-fcm-token-for-resubscribe',\n FAILED_TO_DELETE_TOKEN: 'failed-to-delete-token',\n NO_SW_IN_REG: 'no-sw-in-reg',\n BAD_SCOPE: 'bad-scope',\n BAD_VAPID_KEY: 'bad-vapid-key',\n BAD_SUBSCRIPTION: 'bad-subscription',\n BAD_TOKEN: 'bad-token',\n BAD_PUSH_SET: 'bad-push-set',\n FAILED_DELETE_VAPID_KEY: 'failed-delete-vapid-key',\n INVALID_PUBLIC_VAPID_KEY: 'invalid-public-vapid-key',\n USE_PUBLIC_KEY_BEFORE_GET_TOKEN: 'use-public-key-before-get-token',\n PUBLIC_KEY_DECRYPTION_FAILED: 'public-vapid-key-decryption-failed'\n};\nvar ERROR_MAP = (_a = {},\n _a[CODES.AVAILABLE_IN_WINDOW] = 'This method is available in a Window context.',\n _a[CODES.AVAILABLE_IN_SW] = 'This method is available in a service worker ' + 'context.',\n _a[CODES.SHOULD_BE_INHERITED] = 'This method should be overriden by ' + 'extended classes.',\n _a[CODES.BAD_SENDER_ID] = \"Please ensure that 'messagingSenderId' is set \" +\n 'correctly in the options passed into firebase.initializeApp().',\n _a[CODES.PERMISSION_DEFAULT] = 'The required permissions were not granted and ' + 'dismissed instead.',\n _a[CODES.PERMISSION_BLOCKED] = 'The required permissions were not granted and ' + 'blocked instead.',\n _a[CODES.UNSUPPORTED_BROWSER] = \"This browser doesn't support the API's \" +\n 'required to use the firebase SDK.',\n _a[CODES.NOTIFICATIONS_BLOCKED] = 'Notifications have been blocked.',\n _a[CODES.FAILED_DEFAULT_REGISTRATION] = 'We are unable to register the ' +\n 'default service worker. {$browserErrorMessage}',\n _a[CODES.SW_REGISTRATION_EXPECTED] = 'A service worker registration was the ' + 'expected input.',\n _a[CODES.GET_SUBSCRIPTION_FAILED] = 'There was an error when trying to get ' +\n 'any existing Push Subscriptions.',\n _a[CODES.INVALID_SAVED_TOKEN] = 'Unable to access details of the saved token.',\n _a[CODES.SW_REG_REDUNDANT] = 'The service worker being used for push was made ' + 'redundant.',\n _a[CODES.TOKEN_SUBSCRIBE_FAILED] = 'A problem occured while subscribing the ' + 'user to FCM: {$message}',\n _a[CODES.TOKEN_SUBSCRIBE_NO_TOKEN] = 'FCM returned no token when subscribing ' + 'the user to push.',\n _a[CODES.TOKEN_SUBSCRIBE_NO_PUSH_SET] = 'FCM returned an invalid response ' + 'when getting an FCM token.',\n _a[CODES.TOKEN_UNSUBSCRIBE_FAILED] = 'A problem occured while unsubscribing the ' + 'user from FCM: {$message}',\n _a[CODES.TOKEN_UPDATE_FAILED] = 'A problem occured while updating the ' + 'user from FCM: {$message}',\n _a[CODES.TOKEN_UPDATE_NO_TOKEN] = 'FCM returned no token when updating ' + 'the user to push.',\n _a[CODES.USE_SW_BEFORE_GET_TOKEN] = 'You must call useServiceWorker() before ' +\n 'calling getToken() to ensure your service worker is used.',\n _a[CODES.INVALID_DELETE_TOKEN] = 'You must pass a valid token into ' +\n 'deleteToken(), i.e. the token from getToken().',\n _a[CODES.DELETE_TOKEN_NOT_FOUND] = 'The deletion attempt for token could not ' +\n 'be performed as the token was not found.',\n _a[CODES.DELETE_SCOPE_NOT_FOUND] = 'The deletion attempt for service worker ' +\n 'scope could not be performed as the scope was not found.',\n _a[CODES.BG_HANDLER_FUNCTION_EXPECTED] = 'The input to ' + 'setBackgroundMessageHandler() must be a function.',\n _a[CODES.NO_WINDOW_CLIENT_TO_MSG] = 'An attempt was made to message a ' + 'non-existant window client.',\n _a[CODES.UNABLE_TO_RESUBSCRIBE] = 'There was an error while re-subscribing ' +\n 'the FCM token for push messaging. Will have to resubscribe the ' +\n 'user on next visit. {$message}',\n _a[CODES.NO_FCM_TOKEN_FOR_RESUBSCRIBE] = 'Could not find an FCM token ' +\n 'and as a result, unable to resubscribe. Will have to resubscribe the ' +\n 'user on next visit.',\n _a[CODES.FAILED_TO_DELETE_TOKEN] = 'Unable to delete the currently saved token.',\n _a[CODES.NO_SW_IN_REG] = 'Even though the service worker registration was ' +\n 'successful, there was a problem accessing the service worker itself.',\n _a[CODES.INCORRECT_GCM_SENDER_ID] = \"Please change your web app manifest's \" +\n \"'gcm_sender_id' value to '103953800507' to use Firebase messaging.\",\n _a[CODES.BAD_SCOPE] = 'The service worker scope must be a string with at ' +\n 'least one character.',\n _a[CODES.BAD_VAPID_KEY] = 'The public VAPID key is not a Uint8Array with 65 bytes.',\n _a[CODES.BAD_SUBSCRIPTION] = 'The subscription must be a valid ' + 'PushSubscription.',\n _a[CODES.BAD_TOKEN] = 'The FCM Token used for storage / lookup was not ' +\n 'a valid token string.',\n _a[CODES.BAD_PUSH_SET] = 'The FCM push set used for storage / lookup was not ' +\n 'not a valid push set string.',\n _a[CODES.FAILED_DELETE_VAPID_KEY] = 'The VAPID key could not be deleted.',\n _a[CODES.INVALID_PUBLIC_VAPID_KEY] = 'The public VAPID key must be a string.',\n _a[CODES.PUBLIC_KEY_DECRYPTION_FAILED] = 'The public VAPID key did not equal ' + '65 bytes when decrypted.',\n _a);\nexport default {\n codes: CODES,\n map: ERROR_MAP\n};\nvar _a;\n\n//# sourceMappingURL=errors.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/errors.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nimport { ErrorFactory } from '@firebase/util';\nimport Errors from './errors';\nvar DBInterface = /** @class */ (function () {\n /**\n * @param {string} dbName\n * @param {number} dbVersion\n */\n function DBInterface(dbName, dbVersion) {\n this.errorFactory_ = new ErrorFactory('messaging', 'Messaging', Errors.map);\n this.DB_NAME_ = dbName;\n this.dbVersion_ = dbVersion;\n this.openDbPromise_ = null;\n this.TRANSACTION_READ_WRITE = 'readwrite';\n }\n /**\n * Get the indexedDB as a promsie.\n * @protected\n * @return {!Promise} The IndexedDB database\n */\n DBInterface.prototype.openDatabase = function () {\n var _this = this;\n if (this.openDbPromise_) {\n return this.openDbPromise_;\n }\n this.openDbPromise_ = new Promise(function (resolve, reject) {\n var request = indexedDB.open(_this.DB_NAME_, _this.dbVersion_);\n request.onerror = function (event) {\n reject(event.target.error);\n };\n request.onsuccess = function (event) {\n resolve(event.target.result);\n };\n request.onupgradeneeded = function (event) {\n try {\n var db = event.target.result;\n _this.onDBUpgrade(db);\n }\n catch (err) {\n // close the database as it can't be used.\n db.close();\n reject(err);\n }\n };\n });\n return this.openDbPromise_;\n };\n /**\n * Close the currently open database.\n * @return {!Promise} Returns the result of the promise chain.\n */\n DBInterface.prototype.closeDatabase = function () {\n var _this = this;\n return Promise.resolve().then(function () {\n if (_this.openDbPromise_) {\n return _this.openDbPromise_.then(function (db) {\n db.close();\n _this.openDbPromise_ = null;\n });\n }\n });\n };\n /**\n * @protected\n * @param {!IDBDatabase} db\n */\n DBInterface.prototype.onDBUpgrade = function (db) {\n throw this.errorFactory_.create(Errors.codes.SHOULD_BE_INHERITED);\n };\n return DBInterface;\n}());\nexport default DBInterface;\n\n//# sourceMappingURL=db-interface.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/db-interface.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport DBInterface from './db-interface';\nimport Errors from './errors';\nvar FCM_VAPID_OBJ_STORE = 'fcm_vapid_object_Store';\nvar DB_VERSION = 1;\nvar UNCOMPRESSED_PUBLIC_KEY_SIZE = 65;\nvar VapidDetailsModel = /** @class */ (function (_super) {\n __extends(VapidDetailsModel, _super);\n function VapidDetailsModel() {\n return _super.call(this, VapidDetailsModel.DB_NAME, DB_VERSION) || this;\n }\n Object.defineProperty(VapidDetailsModel, \"DB_NAME\", {\n get: function () {\n return 'fcm_vapid_details_db';\n },\n enumerable: true,\n configurable: true\n });\n /**\n * @override\n * @param {IDBDatabase} db\n */\n VapidDetailsModel.prototype.onDBUpgrade = function (db) {\n db.createObjectStore(FCM_VAPID_OBJ_STORE, {\n keyPath: 'swScope'\n });\n };\n /**\n * Given a service worker scope, this method will look up the vapid key\n * in indexedDB.\n */\n VapidDetailsModel.prototype.getVapidFromSWScope = function (swScope) {\n if (typeof swScope !== 'string' || swScope.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SCOPE));\n }\n return this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_VAPID_OBJ_STORE]);\n var objectStore = transaction.objectStore(FCM_VAPID_OBJ_STORE);\n var scopeRequest = objectStore.get(swScope);\n scopeRequest.onerror = function () {\n reject(scopeRequest.error);\n };\n scopeRequest.onsuccess = function () {\n var result = scopeRequest.result;\n var vapidKey = null;\n if (result) {\n vapidKey = result.vapidKey;\n }\n resolve(vapidKey);\n };\n });\n });\n };\n /**\n * Save a vapid key against a swScope for later date.\n */\n VapidDetailsModel.prototype.saveVapidDetails = function (swScope, vapidKey) {\n var _this = this;\n if (typeof swScope !== 'string' || swScope.length === 0) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_SCOPE));\n }\n if (vapidKey === null || vapidKey.length !== UNCOMPRESSED_PUBLIC_KEY_SIZE) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.BAD_VAPID_KEY));\n }\n var details = {\n swScope: swScope,\n vapidKey: vapidKey\n };\n return this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_VAPID_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_VAPID_OBJ_STORE);\n var request = objectStore.put(details);\n request.onerror = function () {\n reject(request.error);\n };\n request.onsuccess = function () {\n resolve();\n };\n });\n });\n };\n /**\n * This method deletes details of the current FCM VAPID key for a SW scope.\n * Resolves once the scope/vapid details have been deleted and returns the\n * deleted vapid key.\n */\n VapidDetailsModel.prototype.deleteVapidDetails = function (swScope) {\n var _this = this;\n return this.getVapidFromSWScope(swScope).then(function (vapidKey) {\n if (!vapidKey) {\n throw _this.errorFactory_.create(Errors.codes.DELETE_SCOPE_NOT_FOUND);\n }\n return _this.openDatabase().then(function (db) {\n return new Promise(function (resolve, reject) {\n var transaction = db.transaction([FCM_VAPID_OBJ_STORE], _this.TRANSACTION_READ_WRITE);\n var objectStore = transaction.objectStore(FCM_VAPID_OBJ_STORE);\n var request = objectStore.delete(swScope);\n request.onerror = function () {\n reject(request.error);\n };\n request.onsuccess = function () {\n if (request.result === 0) {\n reject(_this.errorFactory_.create(Errors.codes.FAILED_DELETE_VAPID_KEY));\n return;\n }\n resolve(vapidKey);\n };\n });\n });\n });\n };\n return VapidDetailsModel;\n}(DBInterface));\nexport default VapidDetailsModel;\n\n//# sourceMappingURL=vapid-details-model.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/vapid-details-model.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nvar DEFAULT_PUBLIC_VAPID_KEY = new Uint8Array([\n 0x04,\n 0x33,\n 0x94,\n 0xf7,\n 0xdf,\n 0xa1,\n 0xeb,\n 0xb1,\n 0xdc,\n 0x03,\n 0xa2,\n 0x5e,\n 0x15,\n 0x71,\n 0xdb,\n 0x48,\n 0xd3,\n 0x2e,\n 0xed,\n 0xed,\n 0xb2,\n 0x34,\n 0xdb,\n 0xb7,\n 0x47,\n 0x3a,\n 0x0c,\n 0x8f,\n 0xc4,\n 0xcc,\n 0xe1,\n 0x6f,\n 0x3c,\n 0x8c,\n 0x84,\n 0xdf,\n 0xab,\n 0xb6,\n 0x66,\n 0x3e,\n 0xf2,\n 0x0c,\n 0xd4,\n 0x8b,\n 0xfe,\n 0xe3,\n 0xf9,\n 0x76,\n 0x2f,\n 0x14,\n 0x1c,\n 0x63,\n 0x08,\n 0x6a,\n 0x6f,\n 0x2d,\n 0xb1,\n 0x1a,\n 0x95,\n 0xb0,\n 0xce,\n 0x37,\n 0xc0,\n 0x9c,\n 0x6e\n]);\nvar SUBSCRIPTION_DETAILS = {\n userVisibleOnly: true,\n applicationServerKey: DEFAULT_PUBLIC_VAPID_KEY\n};\nexport default {\n DEFAULT_PUBLIC_VAPID_KEY: DEFAULT_PUBLIC_VAPID_KEY,\n SUBSCRIPTION_DETAILS: SUBSCRIPTION_DETAILS,\n ENDPOINT: 'https://fcm.googleapis.com'\n // ENDPOINT: 'https://jmt17.google.com'\n};\n\n//# sourceMappingURL=fcm-details.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/fcm-details.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nimport { ErrorFactory } from '@firebase/util';\nimport Errors from './errors';\nimport arrayBufferToBase64 from '../helpers/array-buffer-to-base64';\nimport FCMDetails from './fcm-details';\nvar IIDModel = /** @class */ (function () {\n function IIDModel() {\n this.errorFactory_ = new ErrorFactory('messaging', 'Messaging', Errors.map);\n }\n /**\n * Given a PushSubscription and messagingSenderId, get an FCM token.\n * @public\n * @param {string} senderId The 'messagingSenderId' to tie the token to.\n * @param {PushSubscription} subscription The PushSusbcription to \"federate\".\n * @param {Uint8Array} publicVapidKey The public VAPID key.\n * @return {Promise} Returns the FCM token to be used in place\n * of the PushSubscription.\n */\n IIDModel.prototype.getToken = function (senderId, subscription, publicVapidKey) {\n var _this = this;\n var p256dh = arrayBufferToBase64(subscription['getKey']('p256dh'));\n var auth = arrayBufferToBase64(subscription['getKey']('auth'));\n var fcmSubscribeBody = \"authorized_entity=\" + senderId + \"&\" +\n (\"endpoint=\" + subscription.endpoint + \"&\") +\n (\"encryption_key=\" + p256dh + \"&\") +\n (\"encryption_auth=\" + auth);\n if (publicVapidKey !== FCMDetails.DEFAULT_PUBLIC_VAPID_KEY) {\n var applicationPubKey = arrayBufferToBase64(publicVapidKey);\n fcmSubscribeBody += \"&application_pub_key=\" + applicationPubKey;\n }\n var headers = new Headers();\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\n var subscribeOptions = {\n method: 'POST',\n headers: headers,\n body: fcmSubscribeBody\n };\n return fetch(FCMDetails.ENDPOINT + '/fcm/connect/subscribe', subscribeOptions)\n .then(function (response) { return response.json(); })\n .catch(function () {\n throw _this.errorFactory_.create(Errors.codes.TOKEN_SUBSCRIBE_FAILED);\n })\n .then(function (response) {\n var fcmTokenResponse = response;\n if (fcmTokenResponse['error']) {\n var message = fcmTokenResponse['error']['message'];\n throw _this.errorFactory_.create(Errors.codes.TOKEN_SUBSCRIBE_FAILED, {\n message: message\n });\n }\n if (!fcmTokenResponse['token']) {\n throw _this.errorFactory_.create(Errors.codes.TOKEN_SUBSCRIBE_NO_TOKEN);\n }\n if (!fcmTokenResponse['pushSet']) {\n throw _this.errorFactory_.create(Errors.codes.TOKEN_SUBSCRIBE_NO_PUSH_SET);\n }\n return {\n token: fcmTokenResponse['token'],\n pushSet: fcmTokenResponse['pushSet']\n };\n });\n };\n /**\n * Update the underlying token details for fcmToken.\n */\n IIDModel.prototype.updateToken = function (senderId, fcmToken, fcmPushSet, subscription, publicVapidKey) {\n var _this = this;\n var p256dh = arrayBufferToBase64(subscription['getKey']('p256dh'));\n var auth = arrayBufferToBase64(subscription['getKey']('auth'));\n var fcmUpdateBody = \"push_set=\" + fcmPushSet + \"&\" +\n (\"token=\" + fcmToken + \"&\") +\n (\"authorized_entity=\" + senderId + \"&\") +\n (\"endpoint=\" + subscription.endpoint + \"&\") +\n (\"encryption_key=\" + p256dh + \"&\") +\n (\"encryption_auth=\" + auth);\n if (publicVapidKey !== FCMDetails.DEFAULT_PUBLIC_VAPID_KEY) {\n var applicationPubKey = arrayBufferToBase64(publicVapidKey);\n fcmUpdateBody += \"&application_pub_key=\" + applicationPubKey;\n }\n var headers = new Headers();\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\n var updateOptions = {\n method: 'POST',\n headers: headers,\n body: fcmUpdateBody\n };\n var updateFetchRes;\n return fetch(FCMDetails.ENDPOINT + '/fcm/connect/subscribe', updateOptions)\n .then(function (fetchResponse) {\n updateFetchRes = fetchResponse;\n return fetchResponse.json();\n })\n .catch(function () {\n throw _this.errorFactory_.create(Errors.codes.TOKEN_UPDATE_FAILED);\n })\n .then(function (fcmTokenResponse) {\n if (!updateFetchRes.ok) {\n var message = fcmTokenResponse['error']['message'];\n throw _this.errorFactory_.create(Errors.codes.TOKEN_UPDATE_FAILED, {\n message: message\n });\n }\n if (!fcmTokenResponse['token']) {\n throw _this.errorFactory_.create(Errors.codes.TOKEN_UPDATE_NO_TOKEN);\n }\n return fcmTokenResponse['token'];\n });\n };\n /**\n * Given a fcmToken, pushSet and messagingSenderId, delete an FCM token.\n */\n IIDModel.prototype.deleteToken = function (senderId, fcmToken, fcmPushSet) {\n var _this = this;\n var fcmUnsubscribeBody = \"authorized_entity=\" + senderId + \"&\" +\n (\"token=\" + fcmToken + \"&\") +\n (\"pushSet=\" + fcmPushSet);\n var headers = new Headers();\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\n var unsubscribeOptions = {\n method: 'POST',\n headers: headers,\n body: fcmUnsubscribeBody\n };\n return fetch(FCMDetails.ENDPOINT + '/fcm/connect/unsubscribe', unsubscribeOptions).then(function (fetchResponse) {\n if (!fetchResponse.ok) {\n return fetchResponse.json().then(function (fcmTokenResponse) {\n if (fcmTokenResponse['error']) {\n var message = fcmTokenResponse['error']['message'];\n throw _this.errorFactory_.create(Errors.codes.TOKEN_UNSUBSCRIBE_FAILED, {\n message: message\n });\n }\n }, function (err) {\n throw _this.errorFactory_.create(Errors.codes.TOKEN_UNSUBSCRIBE_FAILED);\n });\n }\n });\n };\n return IIDModel;\n}());\nexport default IIDModel;\n\n//# sourceMappingURL=iid-model.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/iid-model.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nimport { ErrorFactory } from '@firebase/util';\nimport Errors from '../models/errors';\nimport TokenDetailsModel from '../models/token-details-model';\nimport VapidDetailsModel from '../models/vapid-details-model';\nimport NOTIFICATION_PERMISSION from '../models/notification-permission';\nimport IIDModel from '../models/iid-model';\nimport arrayBufferToBase64 from '../helpers/array-buffer-to-base64';\nvar SENDER_ID_OPTION_NAME = 'messagingSenderId';\n// Database cache should be invalidated once a week.\nexport var TOKEN_EXPIRATION_MILLIS = 7 * 24 * 60 * 60 * 1000; // 7 days\nvar ControllerInterface = /** @class */ (function () {\n /**\n * An interface of the Messaging Service API\n * @param {!firebase.app.App} app\n */\n function ControllerInterface(app) {\n var _this = this;\n this.errorFactory_ = new ErrorFactory('messaging', 'Messaging', Errors.map);\n if (!app.options[SENDER_ID_OPTION_NAME] ||\n typeof app.options[SENDER_ID_OPTION_NAME] !== 'string') {\n throw this.errorFactory_.create(Errors.codes.BAD_SENDER_ID);\n }\n this.messagingSenderId_ = app.options[SENDER_ID_OPTION_NAME];\n this.tokenDetailsModel_ = new TokenDetailsModel();\n this.vapidDetailsModel_ = new VapidDetailsModel();\n this.iidModel_ = new IIDModel();\n this.app = app;\n this.INTERNAL = {};\n this.INTERNAL.delete = function () { return _this.delete(); };\n }\n /**\n * @export\n */\n ControllerInterface.prototype.getToken = function () {\n var _this = this;\n // Check with permissions\n var currentPermission = this.getNotificationPermission_();\n if (currentPermission !== NOTIFICATION_PERMISSION.granted) {\n if (currentPermission === NOTIFICATION_PERMISSION.denied) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.NOTIFICATIONS_BLOCKED));\n }\n // We must wait for permission to be granted\n return Promise.resolve(null);\n }\n var swReg;\n return this.getSWRegistration_()\n .then(function (reg) {\n swReg = reg;\n return _this.tokenDetailsModel_.getTokenDetailsFromSWScope(swReg.scope);\n })\n .then(function (tokenDetails) {\n if (tokenDetails) {\n return _this.manageExistingToken(tokenDetails, swReg);\n }\n return _this.getNewToken(swReg);\n });\n };\n /**\n * manageExistingToken is triggered if there's an existing FCM token in the\n * database and it can take 3 different actions:\n * 1) Retrieve the existing FCM token from the database.\n * 2) If VAPID details have changed: Delete the existing token and create a\n * new one with the new VAPID key.\n * 3) If the database cache is invalidated: Send a request to FCM to update\n * the token, and to check if the token is still valid on FCM-side.\n */\n ControllerInterface.prototype.manageExistingToken = function (tokenDetails, swReg) {\n var _this = this;\n return this.isTokenStillValid(tokenDetails).then(function (isValid) {\n if (isValid) {\n var now = Date.now();\n if (now < tokenDetails['createTime'] + TOKEN_EXPIRATION_MILLIS) {\n return tokenDetails['fcmToken'];\n }\n else {\n return _this.updateToken(tokenDetails, swReg);\n }\n }\n else {\n // If the VAPID details are updated, delete the existing token,\n // and create a new one.\n return _this.deleteToken(tokenDetails['fcmToken']).then(function () {\n return _this.getNewToken(swReg);\n });\n }\n });\n };\n /*\n * Checks if the tokenDetails match the details provided in the clients.\n */\n ControllerInterface.prototype.isTokenStillValid = function (tokenDetails) {\n // TODO Validate rest of the details.\n return this.getPublicVapidKey_().then(function (publicKey) {\n if (arrayBufferToBase64(publicKey) !== tokenDetails['vapidKey']) {\n return false;\n }\n return true;\n });\n };\n ControllerInterface.prototype.updateToken = function (tokenDetails, swReg) {\n var _this = this;\n var publicVapidKey;\n var updatedToken;\n var subscription;\n return this.getPublicVapidKey_()\n .then(function (publicKey) {\n publicVapidKey = publicKey;\n return _this.getPushSubscription_(swReg, publicVapidKey);\n })\n .then(function (pushSubscription) {\n subscription = pushSubscription;\n return _this.iidModel_.updateToken(_this.messagingSenderId_, tokenDetails['fcmToken'], tokenDetails['fcmPushSet'], subscription, publicVapidKey);\n })\n .catch(function (err) {\n return _this.deleteToken(tokenDetails['fcmToken']).then(function () {\n throw err;\n });\n })\n .then(function (token) {\n updatedToken = token;\n var allDetails = {\n swScope: swReg.scope,\n vapidKey: publicVapidKey,\n subscription: subscription,\n fcmSenderId: _this.messagingSenderId_,\n fcmToken: updatedToken,\n fcmPushSet: tokenDetails['fcmPushSet']\n };\n return _this.tokenDetailsModel_.saveTokenDetails(allDetails);\n })\n .then(function () {\n return _this.vapidDetailsModel_.saveVapidDetails(swReg.scope, publicVapidKey);\n })\n .then(function () {\n return updatedToken;\n });\n };\n ControllerInterface.prototype.getNewToken = function (swReg) {\n var _this = this;\n var publicVapidKey;\n var subscription;\n var tokenDetails;\n return this.getPublicVapidKey_()\n .then(function (publicKey) {\n publicVapidKey = publicKey;\n return _this.getPushSubscription_(swReg, publicVapidKey);\n })\n .then(function (pushSubscription) {\n subscription = pushSubscription;\n return _this.iidModel_.getToken(_this.messagingSenderId_, subscription, publicVapidKey);\n })\n .then(function (iidTokenDetails) {\n tokenDetails = iidTokenDetails;\n var allDetails = {\n swScope: swReg.scope,\n vapidKey: publicVapidKey,\n subscription: subscription,\n fcmSenderId: _this.messagingSenderId_,\n fcmToken: tokenDetails['token'],\n fcmPushSet: tokenDetails['pushSet']\n };\n return _this.tokenDetailsModel_.saveTokenDetails(allDetails);\n })\n .then(function () {\n return _this.vapidDetailsModel_.saveVapidDetails(swReg.scope, publicVapidKey);\n })\n .then(function () {\n return tokenDetails['token'];\n });\n };\n /**\n * This method deletes tokens that the token manager looks after,\n * unsubscribes the token from FCM and then unregisters the push\n * subscription if it exists. It returns a promise that indicates\n * whether or not the unsubscribe request was processed successfully.\n * @export\n */\n ControllerInterface.prototype.deleteToken = function (token) {\n var _this = this;\n return this.tokenDetailsModel_\n .deleteToken(token)\n .then(function (details) {\n return _this.iidModel_.deleteToken(details['fcmSenderId'], details['fcmToken'], details['fcmPushSet']);\n })\n .then(function () {\n return _this.getSWRegistration_()\n .then(function (registration) {\n if (registration) {\n return registration.pushManager.getSubscription();\n }\n })\n .then(function (subscription) {\n if (subscription) {\n return subscription.unsubscribe();\n }\n });\n });\n };\n ControllerInterface.prototype.getSWRegistration_ = function () {\n throw this.errorFactory_.create(Errors.codes.SHOULD_BE_INHERITED);\n };\n ControllerInterface.prototype.getPublicVapidKey_ = function () {\n throw this.errorFactory_.create(Errors.codes.SHOULD_BE_INHERITED);\n };\n //\n // The following methods should only be available in the window.\n //\n ControllerInterface.prototype.requestPermission = function () {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW);\n };\n ControllerInterface.prototype.getPushSubscription_ = function (registration, publicVapidKey) {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!ServiceWorkerRegistration} registration\n */\n ControllerInterface.prototype.useServiceWorker = function (registration) {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!string} b64PublicKey\n */\n ControllerInterface.prototype.usePublicVapidKey = function (b64PublicKey) {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!firebase.Observer|function(*)} nextOrObserver\n * @param {function(!Error)=} optError\n * @param {function()=} optCompleted\n * @return {!function()}\n */\n ControllerInterface.prototype.onMessage = function (nextOrObserver, optError, optCompleted) {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW);\n };\n /**\n * @export\n * @param {!firebase.Observer|function()} nextOrObserver An observer object\n * or a function triggered on token refresh.\n * @param {function(!Error)=} optError Optional A function\n * triggered on token refresh error.\n * @param {function()=} optCompleted Optional function triggered when the\n * observer is removed.\n * @return {!function()} The unsubscribe function for the observer.\n */\n ControllerInterface.prototype.onTokenRefresh = function (nextOrObserver, optError, optCompleted) {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_WINDOW);\n };\n //\n // The following methods are used by the service worker only.\n //\n /**\n * @export\n * @param {function(Object)} callback\n */\n ControllerInterface.prototype.setBackgroundMessageHandler = function (callback) {\n throw this.errorFactory_.create(Errors.codes.AVAILABLE_IN_SW);\n };\n //\n // The following methods are used by the service themselves and not exposed\n // publicly or not expected to be used by developers.\n //\n /**\n * This method is required to adhere to the Firebase interface.\n * It closes any currently open indexdb database connections.\n */\n ControllerInterface.prototype.delete = function () {\n return Promise.all([\n this.tokenDetailsModel_.closeDatabase(),\n this.vapidDetailsModel_.closeDatabase()\n ]);\n };\n /**\n * Returns the current Notification Permission state.\n * @private\n * @return {string} The currenct permission state.\n */\n ControllerInterface.prototype.getNotificationPermission_ = function () {\n return Notification.permission;\n };\n ControllerInterface.prototype.getTokenDetailsModel = function () {\n return this.tokenDetailsModel_;\n };\n ControllerInterface.prototype.getVapidDetailsModel = function () {\n return this.vapidDetailsModel_;\n };\n /**\n * @protected\n * @returns {IIDModel}\n */\n ControllerInterface.prototype.getIIDModel = function () {\n return this.iidModel_;\n };\n return ControllerInterface;\n}());\nexport default ControllerInterface;\n\n//# sourceMappingURL=controller-interface.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/controllers/controller-interface.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\n// These fields are strings to prevent closure from thinking goog.getMsg\n// should be used to initialise the values\nvar PARAMS = {\n TYPE_OF_MSG: 'firebase-messaging-msg-type',\n DATA: 'firebase-messaging-msg-data'\n};\n// This value isn't using the TYPE_OF_MSG short hand as closure\n// expects the variable to be defined via goog.getMsg\nvar msgType = {\n PUSH_MSG_RECEIVED: 'push-msg-received',\n NOTIFICATION_CLICKED: 'notification-clicked'\n};\nvar createNewMsg = function (msgType, msgData) {\n var message = (_a = {},\n _a[PARAMS.TYPE_OF_MSG] = msgType,\n _a[PARAMS.DATA] = msgData,\n _a);\n return message;\n var _a;\n};\nexport default {\n PARAMS: PARAMS,\n TYPES_OF_MSG: msgType,\n createNewMsg: createNewMsg\n};\n\n//# sourceMappingURL=worker-page-message.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/worker-page-message.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nexport default {\n path: '/firebase-messaging-sw.js',\n scope: '/firebase-cloud-messaging-push-scope'\n};\n\n//# sourceMappingURL=default-sw.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/models/default-sw.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport default function (base64String) {\n var padding = '='.repeat((4 - base64String.length % 4) % 4);\n var base64 = (base64String + padding)\n .replace(/\\-/g, '+')\n .replace(/_/g, '/');\n var rawData = window.atob(base64);\n var outputArray = new Uint8Array(rawData.length);\n for (var i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n};\n\n//# sourceMappingURL=base64-to-array-buffer.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/helpers/base64-to-array-buffer.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport ControllerInterface from './controller-interface';\nimport Errors from '../models/errors';\nimport WorkerPageMessage from '../models/worker-page-message';\nimport DefaultSW from '../models/default-sw';\nimport NOTIFICATION_PERMISSION from '../models/notification-permission';\nimport FCMDetails from '../models/fcm-details';\nimport base64ToArrayBuffer from '../helpers/base64-to-array-buffer';\nimport { createSubscribe } from '@firebase/util';\nvar WindowController = /** @class */ (function (_super) {\n __extends(WindowController, _super);\n /**\n * A service that provides a MessagingService instance.\n * @param {!firebase.app.App} app\n */\n function WindowController(app) {\n var _this = _super.call(this, app) || this;\n _this.messageObserver_ = null;\n _this.onMessage_ = createSubscribe(function (observer) {\n _this.messageObserver_ = observer;\n });\n _this.tokenRefreshObserver_ = null;\n _this.onTokenRefresh_ = createSubscribe(function (observer) {\n _this.tokenRefreshObserver_ = observer;\n });\n /**\n * @private\n * @type {ServiceWorkerRegistration}\n */\n _this.registrationToUse_;\n /**\n * @private\n * @type {Promise}\n */\n _this.manifestCheckPromise_;\n /**\n * @private\n * @type {firebase.Observer}\n */\n _this.messageObserver_ = null;\n /**\n * @private {!firebase.Subscribe} The subscribe function to the onMessage\n * observer.\n */\n _this.onMessage_ = createSubscribe(function (observer) {\n _this.messageObserver_ = observer;\n });\n /**\n * @private\n * @type {firebase.Observer}\n */\n _this.tokenRefreshObserver_ = null;\n _this.onTokenRefresh_ = createSubscribe(function (observer) {\n _this.tokenRefreshObserver_ = observer;\n });\n _this.setupSWMessageListener_();\n return _this;\n }\n /**\n * This method returns an FCM token if it can be generated.\n * The return promise will reject if the browser doesn't support\n * FCM, if permission is denied for notifications or it's not\n * possible to generate a token.\n * @export\n * @return {Promise | Promise} Returns a promise the\n * resolves to an FCM token or null if permission isn't granted.\n */\n WindowController.prototype.getToken = function () {\n var _this = this;\n // Check that the required API's are available\n if (!this.isSupported_()) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.UNSUPPORTED_BROWSER));\n }\n return this.manifestCheck_().then(function () {\n return _super.prototype.getToken.call(_this);\n });\n };\n /**\n * The method checks that a manifest is defined and has the correct GCM\n * sender ID.\n * @private\n * @return {Promise} Returns a promise that resolves if the manifest matches\n * our required sender ID\n */\n WindowController.prototype.manifestCheck_ = function () {\n var _this = this;\n if (this.manifestCheckPromise_) {\n return this.manifestCheckPromise_;\n }\n var manifestTag = document.querySelector('link[rel=\"manifest\"]');\n if (!manifestTag) {\n this.manifestCheckPromise_ = Promise.resolve();\n }\n else {\n this.manifestCheckPromise_ = fetch(manifestTag.href)\n .then(function (response) {\n return response.json();\n })\n .catch(function () {\n // If the download or parsing fails allow check.\n // We only want to error if we KNOW that the gcm_sender_id is incorrect.\n return Promise.resolve();\n })\n .then(function (manifestContent) {\n if (!manifestContent) {\n return;\n }\n if (!manifestContent['gcm_sender_id']) {\n return;\n }\n if (manifestContent['gcm_sender_id'] !== '103953800507') {\n throw _this.errorFactory_.create(Errors.codes.INCORRECT_GCM_SENDER_ID);\n }\n });\n }\n return this.manifestCheckPromise_;\n };\n /**\n * Request permission if it is not currently granted\n * @export\n * @returns {Promise} Resolves if the permission was granted, otherwise\n * rejects\n */\n WindowController.prototype.requestPermission = function () {\n var _this = this;\n if (Notification.permission === NOTIFICATION_PERMISSION.granted) {\n return Promise.resolve();\n }\n return new Promise(function (resolve, reject) {\n var managePermissionResult = function (result) {\n if (result === NOTIFICATION_PERMISSION.granted) {\n return resolve();\n }\n else if (result === NOTIFICATION_PERMISSION.denied) {\n return reject(_this.errorFactory_.create(Errors.codes.PERMISSION_BLOCKED));\n }\n else {\n return reject(_this.errorFactory_.create(Errors.codes.PERMISSION_DEFAULT));\n }\n };\n // The Notification.requestPermission API was changed to\n // return a promise so now have to handle both in case\n // browsers stop support callbacks for promised version\n var permissionPromise = Notification.requestPermission(managePermissionResult);\n if (permissionPromise) {\n // Prefer the promise version as it's the future API.\n permissionPromise.then(managePermissionResult);\n }\n });\n };\n /**\n * This method allows a developer to override the default service worker and\n * instead use a custom service worker.\n * @export\n * @param {!ServiceWorkerRegistration} registration The service worker\n * registration that should be used to receive the push messages.\n */\n WindowController.prototype.useServiceWorker = function (registration) {\n if (!(registration instanceof ServiceWorkerRegistration)) {\n throw this.errorFactory_.create(Errors.codes.SW_REGISTRATION_EXPECTED);\n }\n if (typeof this.registrationToUse_ !== 'undefined') {\n throw this.errorFactory_.create(Errors.codes.USE_SW_BEFORE_GET_TOKEN);\n }\n this.registrationToUse_ = registration;\n };\n /**\n * This method allows a developer to override the default vapid key\n * and instead use a custom VAPID public key.\n * @export\n * @param {!string} publicKey A URL safe base64 encoded string.\n */\n WindowController.prototype.usePublicVapidKey = function (publicKey) {\n if (typeof publicKey !== 'string') {\n throw this.errorFactory_.create(Errors.codes.INVALID_PUBLIC_VAPID_KEY);\n }\n if (typeof this.publicVapidKeyToUse_ !== 'undefined') {\n throw this.errorFactory_.create(Errors.codes.USE_PUBLIC_KEY_BEFORE_GET_TOKEN);\n }\n var parsedKey = base64ToArrayBuffer(publicKey);\n if (parsedKey.length !== 65) {\n throw this.errorFactory_.create(Errors.codes.PUBLIC_KEY_DECRYPTION_FAILED);\n }\n this.publicVapidKeyToUse_ = parsedKey;\n };\n /**\n * @export\n * @param {!firebase.Observer|function(*)} nextOrObserver An observer object\n * or a function triggered on message.\n * @param {function(!Error)=} optError Optional A function triggered on\n * message error.\n * @param {function()=} optCompleted Optional function triggered when the\n * observer is removed.\n * @return {!function()} The unsubscribe function for the observer.\n */\n WindowController.prototype.onMessage = function (nextOrObserver, optError, optCompleted) {\n return this.onMessage_(nextOrObserver, optError, optCompleted);\n };\n /**\n * @export\n * @param {!firebase.Observer|function()} nextOrObserver An observer object\n * or a function triggered on token refresh.\n * @param {function(!Error)=} optError Optional A function\n * triggered on token refresh error.\n * @param {function()=} optCompleted Optional function triggered when the\n * observer is removed.\n * @return {!function()} The unsubscribe function for the observer.\n */\n WindowController.prototype.onTokenRefresh = function (nextOrObserver, optError, optCompleted) {\n return this.onTokenRefresh_(nextOrObserver, optError, optCompleted);\n };\n /**\n * Given a registration, wait for the service worker it relates to\n * become activer\n * @private\n * @param {ServiceWorkerRegistration} registration Registration to wait\n * for service worker to become active\n * @return {Promise} Wait for service worker\n * registration to become active\n */\n WindowController.prototype.waitForRegistrationToActivate_ = function (registration) {\n var _this = this;\n var serviceWorker = registration.installing || registration.waiting || registration.active;\n return new Promise(function (resolve, reject) {\n if (!serviceWorker) {\n // This is a rare scenario but has occured in firefox\n reject(_this.errorFactory_.create(Errors.codes.NO_SW_IN_REG));\n return;\n }\n // Because the Promise function is called on next tick there is a\n // small chance that the worker became active or redundant already.\n if (serviceWorker.state === 'activated') {\n resolve(registration);\n return;\n }\n if (serviceWorker.state === 'redundant') {\n reject(_this.errorFactory_.create(Errors.codes.SW_REG_REDUNDANT));\n return;\n }\n var stateChangeListener = function () {\n if (serviceWorker.state === 'activated') {\n resolve(registration);\n }\n else if (serviceWorker.state === 'redundant') {\n reject(_this.errorFactory_.create(Errors.codes.SW_REG_REDUNDANT));\n }\n else {\n // Return early and wait to next state change\n return;\n }\n serviceWorker.removeEventListener('statechange', stateChangeListener);\n };\n serviceWorker.addEventListener('statechange', stateChangeListener);\n });\n };\n /**\n * This will regiater the default service worker and return the registration\n * @private\n * @return {Promise} The service worker\n * registration to be used for the push service.\n */\n WindowController.prototype.getSWRegistration_ = function () {\n var _this = this;\n if (this.registrationToUse_) {\n return this.waitForRegistrationToActivate_(this.registrationToUse_);\n }\n // Make the registration null so we know useServiceWorker will not\n // use a new service worker as registrationToUse_ is no longer undefined\n this.registrationToUse_ = null;\n return navigator.serviceWorker\n .register(DefaultSW.path, {\n scope: DefaultSW.scope\n })\n .catch(function (err) {\n throw _this.errorFactory_.create(Errors.codes.FAILED_DEFAULT_REGISTRATION, {\n browserErrorMessage: err.message\n });\n })\n .then(function (registration) {\n return _this.waitForRegistrationToActivate_(registration).then(function () {\n _this.registrationToUse_ = registration;\n // We update after activation due to an issue with Firefox v49 where\n // a race condition occassionally causes the service work to not\n // install\n registration.update();\n return registration;\n });\n });\n };\n /**\n * This will return the default VAPID key or the uint8array version of the public VAPID key\n * provided by the developer.\n * @private\n */\n WindowController.prototype.getPublicVapidKey_ = function () {\n if (this.publicVapidKeyToUse_) {\n return Promise.resolve(this.publicVapidKeyToUse_);\n }\n return Promise.resolve(FCMDetails.DEFAULT_PUBLIC_VAPID_KEY);\n };\n /**\n * Gets a PushSubscription for the current user.\n * @private\n * @param {ServiceWorkerRegistration} registration\n * @return {Promise}\n */\n WindowController.prototype.getPushSubscription_ = function (swRegistration, publicVapidKey) {\n // Check for existing subscription first\n var subscription;\n var fcmTokenDetails;\n return swRegistration.pushManager.getSubscription().then(function (subscription) {\n if (subscription) {\n return subscription;\n }\n return swRegistration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: publicVapidKey\n });\n });\n };\n /**\n * This method will set up a message listener to handle\n * events from the service worker that should trigger\n * events in the page.\n *\n * @private\n */\n WindowController.prototype.setupSWMessageListener_ = function () {\n var _this = this;\n if (!('serviceWorker' in navigator)) {\n return;\n }\n navigator.serviceWorker.addEventListener('message', function (event) {\n if (!event.data || !event.data[WorkerPageMessage.PARAMS.TYPE_OF_MSG]) {\n // Not a message from FCM\n return;\n }\n var workerPageMessage = event.data;\n switch (workerPageMessage[WorkerPageMessage.PARAMS.TYPE_OF_MSG]) {\n case WorkerPageMessage.TYPES_OF_MSG.PUSH_MSG_RECEIVED:\n case WorkerPageMessage.TYPES_OF_MSG.NOTIFICATION_CLICKED:\n var pushMessage = workerPageMessage[WorkerPageMessage.PARAMS.DATA];\n if (_this.messageObserver_) {\n _this.messageObserver_.next(pushMessage);\n }\n break;\n default:\n // Noop.\n break;\n }\n }, false);\n };\n /**\n * Checks to see if the required API's are valid or not.\n * @private\n * @return {boolean} Returns true if the desired APIs are available.\n */\n WindowController.prototype.isSupported_ = function () {\n return ('serviceWorker' in navigator &&\n 'PushManager' in window &&\n 'Notification' in window &&\n 'fetch' in window &&\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\n PushSubscription.prototype.hasOwnProperty('getKey'));\n };\n return WindowController;\n}(ControllerInterface));\nexport default WindowController;\n\n//# sourceMappingURL=window-controller.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/controllers/window-controller.js\n// module id = null\n// module chunks = ","/**\n * Copyright 2017 Google Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport ControllerInterface from './controller-interface';\nimport Errors from '../models/errors';\nimport FCMDetails from '../models/fcm-details';\nimport WorkerPageMessage from '../models/worker-page-message';\nvar FCM_MSG = 'FCM_MSG';\nvar SWController = /** @class */ (function (_super) {\n __extends(SWController, _super);\n function SWController(app) {\n var _this = _super.call(this, app) || this;\n self.addEventListener('push', function (e) { return _this.onPush_(e); }, false);\n self.addEventListener('pushsubscriptionchange', function (e) { return _this.onSubChange_(e); }, false);\n self.addEventListener('notificationclick', function (e) { return _this.onNotificationClick_(e); }, false);\n /**\n * @private\n * @type {function(Object)|null}\n */\n _this.bgMessageHandler_ = null;\n return _this;\n }\n /**\n * A handler for push events that shows notifications based on the content of\n * the payload.\n *\n * The payload must be a JSON-encoded Object with a `notification` key. The\n * value of the `notification` property will be used as the NotificationOptions\n * object passed to showNotification. Additionally, the `title` property of the\n * notification object will be used as the title.\n *\n * If there is no notification data in the payload then no notification will be\n * shown.\n * @private\n */\n SWController.prototype.onPush_ = function (event) {\n var _this = this;\n var msgPayload;\n try {\n msgPayload = event.data.json();\n }\n catch (err) {\n // Not JSON so not an FCM message\n return;\n }\n var handleMsgPromise = this.hasVisibleClients_().then(function (hasVisibleClients) {\n if (hasVisibleClients) {\n // Do not need to show a notification.\n if (msgPayload.notification || _this.bgMessageHandler_) {\n // Send to page\n return _this.sendMessageToWindowClients_(msgPayload);\n }\n return;\n }\n var notificationDetails = _this.getNotificationData_(msgPayload);\n if (notificationDetails) {\n var notificationTitle_1 = notificationDetails.title || '';\n return _this.getSWRegistration_().then(function (reg) {\n return reg.showNotification(notificationTitle_1, notificationDetails);\n });\n }\n else if (_this.bgMessageHandler_) {\n return _this.bgMessageHandler_(msgPayload);\n }\n });\n event.waitUntil(handleMsgPromise);\n };\n /**\n * @private\n */\n SWController.prototype.onSubChange_ = function (event) {\n var _this = this;\n var promiseChain = this.getSWRegistration_()\n .then(function (registration) {\n return registration.pushManager\n .getSubscription()\n .then(function (subscription) {\n // TODO: Check if it's still valid\n // TODO: If not, then update token\n })\n .catch(function (err) {\n // The best thing we can do is log this to the terminal so\n // developers might notice the error.\n var tokenDetailsModel = _this.getTokenDetailsModel();\n return tokenDetailsModel\n .getTokenDetailsFromSWScope(registration.scope)\n .then(function (tokenDetails) {\n if (!tokenDetails) {\n // This should rarely occure, but could if indexedDB\n // is corrupted or wiped\n throw err;\n }\n // Attempt to delete the token if we know it's bad\n return _this.deleteToken(tokenDetails['fcmToken']).then(function () {\n throw err;\n });\n });\n });\n })\n .catch(function (err) {\n throw _this.errorFactory_.create(Errors.codes.UNABLE_TO_RESUBSCRIBE, {\n message: err\n });\n });\n event.waitUntil(promiseChain);\n };\n /**\n * @private\n */\n SWController.prototype.onNotificationClick_ = function (event) {\n var _this = this;\n if (!(event.notification &&\n event.notification.data &&\n event.notification.data[FCM_MSG])) {\n // Not an FCM notification, do nothing.\n return;\n }\n // Prevent other listeners from receiving the event\n event.stopImmediatePropagation();\n event.notification.close();\n var msgPayload = event.notification.data[FCM_MSG];\n if (!msgPayload['notification']) {\n // Nothing to do.\n return;\n }\n var clickAction = msgPayload['notification']['click_action'];\n if (!clickAction) {\n // Nothing to do.\n return;\n }\n var promiseChain = this.getWindowClient_(clickAction)\n .then(function (windowClient) {\n if (!windowClient) {\n // Unable to find window client so need to open one.\n return self.clients.openWindow(clickAction);\n }\n return windowClient.focus();\n })\n .then(function (windowClient) {\n if (!windowClient) {\n // Window Client will not be returned if it's for a third party origin.\n return;\n }\n // Delete notification data from payload before sending to the page.\n var notificationData = msgPayload['notification'];\n delete msgPayload['notification'];\n var internalMsg = WorkerPageMessage.createNewMsg(WorkerPageMessage.TYPES_OF_MSG.NOTIFICATION_CLICKED, msgPayload);\n // Attempt to send a message to the client to handle the data\n // Is affected by: https://github.com/slightlyoff/ServiceWorker/issues/728\n return _this.attemptToMessageClient_(windowClient, internalMsg);\n });\n event.waitUntil(promiseChain);\n };\n /**\n * @private\n * @param {Object} msgPayload\n * @return {NotificationOptions|undefined}\n */\n SWController.prototype.getNotificationData_ = function (msgPayload) {\n if (!msgPayload) {\n return;\n }\n if (typeof msgPayload.notification !== 'object') {\n return;\n }\n var notificationInformation = Object.assign({}, msgPayload.notification);\n // Put the message payload under FCM_MSG name so we can identify the\n // notification as being an FCM notification vs a notification from\n // somewhere else (i.e. normal web push or developer generated\n // notification).\n notificationInformation['data'] = (_a = {},\n _a[FCM_MSG] = msgPayload,\n _a);\n return notificationInformation;\n var _a;\n };\n /**\n * Calling setBackgroundMessageHandler will opt in to some specific\n * behaviours.\n * 1.) If a notification doesn't need to be shown due to a window already\n * being visible, then push messages will be sent to the page.\n * 2.) If a notification needs to be shown, and the message contains no\n * notification data this method will be called\n * and the promise it returns will be passed to event.waitUntil.\n * If you do not set this callback then all push messages will let and the\n * developer can handle them in a their own 'push' event callback\n * @export\n * @param {function(Object)} callback The callback to be called when a push\n * message is received and a notification must be shown. The callback will\n * be given the data from the push message.\n */\n SWController.prototype.setBackgroundMessageHandler = function (callback) {\n if (!callback || typeof callback !== 'function') {\n throw this.errorFactory_.create(Errors.codes.BG_HANDLER_FUNCTION_EXPECTED);\n }\n this.bgMessageHandler_ = callback;\n };\n /**\n * @private\n * @param {string} url The URL to look for when focusing a client.\n * @return {Object} Returns an existing window client or a newly opened\n * WindowClient.\n */\n SWController.prototype.getWindowClient_ = function (url) {\n // Use URL to normalize the URL when comparing to windowClients.\n // This at least handles whether to include trailing slashes or not\n var parsedURL = new URL(url, self.location).href;\n return self.clients\n .matchAll({\n type: 'window',\n includeUncontrolled: true\n })\n .then(function (clientList) {\n var suitableClient = null;\n for (var i = 0; i < clientList.length; i++) {\n var parsedClientUrl = new URL(clientList[i].url, self.location).href;\n if (parsedClientUrl === parsedURL) {\n suitableClient = clientList[i];\n break;\n }\n }\n if (suitableClient) {\n return suitableClient;\n }\n return null;\n });\n };\n /**\n * This message will attempt to send the message to a window client.\n * @private\n * @param {Object} client The WindowClient to send the message to.\n * @param {Object} message The message to send to the client.\n * @returns {Promise} Returns a promise that resolves after sending the\n * message. This does not guarantee that the message was successfully\n * received.\n */\n SWController.prototype.attemptToMessageClient_ = function (client, message) {\n // NOTE: This returns a promise in case this API is abstracted later on to\n // do additional work\n if (!client) {\n return Promise.reject(this.errorFactory_.create(Errors.codes.NO_WINDOW_CLIENT_TO_MSG));\n }\n client.postMessage(message);\n return Promise.resolve();\n };\n /**\n * @private\n * @returns {Promise} If there is currently a visible WindowClient,\n * this method will resolve to true, otherwise false.\n */\n SWController.prototype.hasVisibleClients_ = function () {\n return self.clients\n .matchAll({\n type: 'window',\n includeUncontrolled: true\n })\n .then(function (clientList) {\n return clientList.some(function (client) { return client.visibilityState === 'visible'; });\n });\n };\n /**\n * @private\n * @param {Object} msgPayload The data from the push event that should be sent\n * to all available pages.\n * @returns {Promise} Returns a promise that resolves once the message\n * has been sent to all WindowClients.\n */\n SWController.prototype.sendMessageToWindowClients_ = function (msgPayload) {\n var _this = this;\n return self.clients\n .matchAll({\n type: 'window',\n includeUncontrolled: true\n })\n .then(function (clientList) {\n var internalMsg = WorkerPageMessage.createNewMsg(WorkerPageMessage.TYPES_OF_MSG.PUSH_MSG_RECEIVED, msgPayload);\n return Promise.all(clientList.map(function (client) {\n return _this.attemptToMessageClient_(client, internalMsg);\n }));\n });\n };\n /**\n * This will register the default service worker and return the registration.\n * @private\n * @return {Promise} The service worker\n * registration to be used for the push service.\n */\n SWController.prototype.getSWRegistration_ = function () {\n return Promise.resolve(self.registration);\n };\n /**\n * This will return the default VAPID key or the uint8array version of the\n * public VAPID key provided by the developer.\n */\n SWController.prototype.getPublicVapidKey_ = function () {\n var _this = this;\n return this.getSWRegistration_()\n .then(function (swReg) {\n return _this.getVapidDetailsModel().getVapidFromSWScope(swReg.scope);\n })\n .then(function (vapidKeyFromDatabase) {\n if (vapidKeyFromDatabase === null) {\n return FCMDetails.DEFAULT_PUBLIC_VAPID_KEY;\n }\n return vapidKeyFromDatabase;\n });\n };\n return SWController;\n}(ControllerInterface));\nexport default SWController;\n\n//# sourceMappingURL=sw-controller.js.map\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ../messaging/dist/esm/src/controllers/sw-controller.js\n// module id = null\n// module chunks = "],"sourceRoot":""}