{"version":3,"sources":["webpack:///./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","webpack:///./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","webpack:///./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","webpack:///./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack:///./node_modules/@babel/runtime/helpers/esm/inherits.js","webpack:///./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","webpack:///./node_modules/@babel/runtime/helpers/esm/iterableToArray.js","webpack:///./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","webpack:///./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","webpack:///./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","webpack:///./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","webpack:///./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","webpack:///./node_modules/@babel/runtime/helpers/esm/slicedToArray.js","webpack:///./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack:///./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","webpack:///./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","webpack:///./node_modules/@firebase/messaging/dist/index.esm.js","webpack:///./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","webpack:///./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","webpack:///./node_modules/@firebase/logger/dist/index.esm.js","webpack:///./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack:///./node_modules/@babel/runtime/helpers/esm/createClass.js","webpack:///./node_modules/@firebase/app/dist/index.cjs.js","webpack:///./node_modules/@firebase/util/dist/index.cjs.js","webpack:///./node_modules/@babel/runtime/helpers/esm/classCallCheck.js"],"names":["_unsupportedIterableToArray","o","minLen","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","_objectWithoutPropertiesLoose","source","excluded","key","i","target","sourceKeys","keys","length","indexOf","_objectWithoutProperties","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","_setPrototypeOf","p","setPrototypeOf","__proto__","_inherits","subClass","superClass","TypeError","create","value","writable","configurable","_arrayWithoutHoles","arr","isArray","arrayLikeToArray","_iterableToArray","iter","Symbol","iterator","_nonIterableSpread","_toConsumableArray","unsupportedIterableToArray","_arrayWithHoles","_iterableToArrayLimit","_arr","_n","_d","_e","undefined","_s","_i","next","done","push","err","_nonIterableRest","_slicedToArray","_typeof","obj","_arrayLikeToArray","len","arr2","_getPrototypeOf","getPrototypeOf","_a","MessageParameter","MessageType","ERROR_MAP","errorFactory","DEFAULT_PUBLIC_VAPID_KEY","Uint8Array","ENDPOINT","isArrayBufferEqual","a","b","byteLength","viewA","DataView","viewB","getUint8","toBase64","arrayBuffer","uint8Version","btoa","String","fromCharCode","apply","arrayBufferToBase64","base64String","replace","IidModel","getToken","senderId","subscription","publicVapidKey","this","p256dh","auth","fcmSubscribeBody","applicationPubKey","headers","subscribeOptions","responseData","response","err_1","message","label","getKey","endpoint","buffer","Headers","append","method","body","trys","fetch","sent","json","errorInfo","error","token","pushSet","updateToken","fcmToken","fcmPushSet","fcmUpdateBody","updateOptions","err_2","deleteToken","fcmUnsubscribeBody","unsubscribeOptions","err_3","base64ToArrayBuffer","padding","repeat","base64","rawData","atob","outputArray","charCodeAt","OLD_DB_NAME","OLD_OBJECT_STORE_NAME","handleDb","db","objectStoreNames","contains","transaction","objectStore","iidModel","openCursorRequest","openCursor","onerror","event","console","warn","onsuccess","cursor","result","tokenDetails","fcmSenderId","continue","close","indexedDB","deleteDatabase","cleanV1","request","open","_event","DbInterface","dbPromise","get","createTransaction","getIndex","index","runRequest","idbIndex","put","delete","closeDatabase","mode","getDb","objectStoreName","promisify","Promise","resolve","reject","oncomplete","_this","dbName","dbVersion","onupgradeneeded","onDbUpgrade","TokenDetailsModel","_super","arguments","oldVersion","createObjectStore","keyPath","createIndex","unique","cursorRequest_1","newValue","createTime","Date","now","vapidKey","update","getTokenDetailsFromToken","validateInputs","getTokenDetailsFromSWScope","swScope","saveTokenDetails","details","input","ArrayBuffer","UNCOMPRESSED_PUBLIC_KEY_SIZE","VapidDetailsModel","getVapidFromSWScope","saveVapidDetails","deleteVapidDetails","SENDER_ID_OPTION_NAME","TOKEN_EXPIRATION_MILLIS","BaseController","app","options","messagingSenderId","tokenDetailsModel","vapidDetailsModel","INTERNAL","currentPermission","swReg","pushSubscription","getNotificationPermission_","getSWRegistration_","getPublicVapidKey_","getPushSubscription","scope","manageExistingToken","getNewToken","isTokenValid","isTokenStillValid","deleteTokenFromDB","updatedToken","allDetails","e_1","registration","pushManager","getSubscription","unsubscribe","swRegistration","then","subscribe","userVisibleOnly","applicationServerKey","requestPermission","useServiceWorker","_registration","usePublicVapidKey","_b64PublicKey","onMessage","_nextOrObserver","_error","_completed","onTokenRefresh","setBackgroundMessageHandler","_callback","all","Notification","permission","getTokenDetailsModel","getVapidDetailsModel","getIidModel","isEndpointEqual","isAuthEqual","isP256dhEqual","FCM_MSG","SwController","bgMessageHandler","self","addEventListener","e","onPush","onSubChange","onNotificationClick","waitUntil","onPush_","onSubChange_","onNotificationClick_","msgPayload","hasVisibleClients","notificationDetails","notificationTitle","reg","actions","maxActions","data","hasVisibleClients_","sendMessageToWindowClients_","getNotificationData_","title","showNotification","link","windowClient","internalMsg","notification","action","stopImmediatePropagation","fcmOptions","click_action","getWindowClient_","clients","openWindow","focus","createNewMsg","NOTIFICATION_CLICKED","attemptToMessageClient_","notificationInformation","callback","url","parsedURL","clientList","suitableClient","parsedClientUrl","URL","location","href","getClientList","client","postMessage","some","visibilityState","startsWith","PUSH_MSG_RECEIVED","map","vapidKeyFromDatabase","matchAll","type","includeUncontrolled","msgType","msgData","TYPE_OF_MSG","DATA","DEFAULT_SW_PATH","DEFAULT_SW_SCOPE","WindowController","registrationToUse","publicVapidKeyToUse","messageObserver","tokenRefreshObserver","onMessageInternal","observer","onTokenRefreshInternal","setupSWMessageListener_","permissionResult","ServiceWorkerRegistration","publicKey","parsedKey","nextOrObserver","completed","waitForRegistrationToActivate_","serviceWorker","installing","waiting","active","state","stateChangeListener","removeEventListener","navigator","register","catch","browserErrorMessage","workerPageMessage","pushMessage","registerMessaging","instance","messagingName","factoryMethod","isSupported","namespaceExports","registerService","isSWControllerSupported","isWindowControllerSupported","cookieEnabled","window","hasOwnProperty","PushSubscription","_assertThisInitialized","ReferenceError","_possibleConstructorReturn","LogLevel","instances","defaultLogLevel","INFO","defaultLogHandler","logType","args","logLevel","toISOString","DEBUG","log","concat","VERBOSE","info","WARN","ERROR","Error","Logger","_logLevel","_logHandler","defineProperty","set","val","enumerable","debug","setLogLevel","level","forEach","inst","_defineProperty","_defineProperties","props","descriptor","_createClass","Constructor","protoProps","staticProps","exports","tslib_1","util","logger$1","ERRORS","ERROR_FACTORY","ErrorFactory","DEFAULT_ENTRY_NAME","tokenListeners","FirebaseAppImpl","config","firebase_","isDeleted_","services_","name_","automaticDataCollectionEnabled_","automaticDataCollectionEnabled","options_","deepCopy","getUid","addAuthTokenListener","setTimeout","removeAuthTokenListener","filter","listener","checkDestroyed_","removeApp","services","serviceKey","_b","_c","instanceKey","service","_getService","instanceIdentifier","instanceSpecifier","factories","extendApp","bind","_removeServiceInstance","deepExtend","appName","version","logger","createFirebaseNamespaceCore","firebaseAppImpl","apps","appHooks","namespace","__esModule","initializeApp","SDK_VERSION","useAsService","callAppHooks","rawConfig","name_1","getApps","createService","serviceProperties","appHook","allowMultipleInstances","serviceNamespace","appArg","serviceFxn","eventName","serviceName","factoryName","useService","createFirebaseNamespace","extendNamespace","__assign","createSubscribe","isBrowser","firebase","sdkVersion","firebaseNamespace","isNode","default","CONSTANTS","NODE_CLIENT","NODE_ADMIN","assert","assertion","assertionError","stringToByteArray","str","out","c","byteArrayToString","bytes","pos","c1","c2","c3","c4","u","join","byteToCharMap_","charToByteMap_","byteToCharMapWebSafe_","charToByteMapWebSafe_","ENCODED_VALS_BASE","HAS_NATIVE_SUPPORT","encodeByteArray","webSafe","init_","byteToCharMap","output","byte1","haveByte2","byte2","haveByte3","byte3","outByte1","outByte2","outByte3","outByte4","encodeString","decodeString","decodeStringToByteArray","charToByteMap","charAt","haveByte4","byte4","ENCODED_VALS","ENCODED_VALS_WEBSAFE","base64Encode","utf8Bytes","base64Decode","dateValue","getTime","prop","Deferred","promise","wrapCallback","getUA","isMobileCordova","global","process","isReactNative","isNodeSdk","ERROR_NAME","FirebaseError","code","captureStackTrace","__extends","errors","customData","fullCode","template","replaceTemplate","fullMessage","PATTERN","_","jsonEval","JSON","parse","stringify","decode","header","claims","signature","parts","split","isValidTimestamp","Math","floor","validSince","validUntil","issuedAtTime","isValidFormat","decoded","isAdmin","safeGet","isEmpty","fn","contextObj","res","querystring","querystringParams","params","_loop_1","arrayVal","encodeURIComponent","entries","querystringDecode","tokens","Sha1","chain_","buf_","W_","pad_","inbuf_","total_","blockSize","reset","compress_","buf","offset","W","t","f","k","d","lengthMinusBlock","inbuf","digest","totalBits","j","executor","onNoObservers","proxy","ObserverProxy","observers","unsubscribes","observerCount","task","finalized","forEachObserver","complete","implementsAnyMethods","noop","unsub","unsubscribeOne","finalError","sendOne","async","onError","methods","methods_1","validateArgCount","fnName","minCount","maxCount","argCount","argError","errorPrefix","argumentNumber","optional","argName","validateNamespace","validateCallback","validateContextObject","context","stringToByteArray$1","high","low","stringLength","_classCallCheck"],"mappings":"0HAAA,kDACe,SAASA,EAA4BC,EAAGC,GACrD,GAAKD,EAAL,CACA,GAAiB,kBAANA,EAAgB,OAAO,eAAiBA,EAAGC,GACtD,IAAIC,EAAIC,OAAOC,UAAUC,SAASC,KAAKN,GAAGO,MAAM,GAAI,GAEpD,MADU,WAANL,GAAkBF,EAAEQ,cAAaN,EAAIF,EAAEQ,YAAYC,MAC7C,QAANP,GAAqB,QAANA,EAAoBQ,MAAMC,KAAKX,GACxC,cAANE,GAAqB,2CAA2CU,KAAKV,GAAW,eAAiBF,EAAGC,QAAxG,K,oCCPa,SAASY,EAA8BC,EAAQC,GAC5D,GAAc,MAAVD,EAA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EAAQgI,aAAeA,EACvBhI,EAAQ8H,aAAeA,EACvB9H,EAAQzR,SAAWA,EACnByR,EAAQuE,gBAAkBA,EAC1BvE,EAAQ8J,OAASA,EACjB9J,EAAQkB,SAAWA,EACnBlB,EAAQwC,WAAaA,EACrBxC,EAAQ4O,YAAcA,EACtB5O,EAAQuI,MAAQA,EAChBvI,EAAQ4K,QAAUA,EAClB5K,EAAQwE,UAAYA,EACpBxE,EAAQ8K,QAAUA,EAClB9K,EAAQwI,gBAAkBA,EAC1BxI,EAAQ4E,OAASA,EACjB5E,EAAQ4I,UAAYA,EACpB5I,EAAQ2I,cAAgBA,EACxB3I,EAAQ0K,cAAgBA,EACxB1K,EAAQoK,iBAAmBA,EAC3BpK,EAAQyK,aAAeA,EACvBzK,EAAQ0J,SAAWA,EACnB1J,EAAQ7F,IAAMA,EACd6F,EAAQkL,YAAcA,EACtBlL,EAAQyL,kBAAoBA,EAC5BzL,EAAQ6K,QAAUA,EAClB7K,EAAQuP,aAAeA,EACvBvP,EAAQoF,kBAAoBgK,EAC5BpP,EAAQ6J,UAAYA,EACpB7J,EAAQsO,iBAAmBA,EAC3BtO,EAAQiP,iBAAmBA,EAC3BjP,EAAQkP,sBAAwBA,EAChClP,EAAQgP,kBAAoBA,I,wDCplDb,SAASQ,EAAgB5S,EAAUiD,GAChD,KAAMjD,aAAoBiD,GACxB,MAAM,IAAI7Y,UAAU,qCAFxB","file":"js/chunk-vendors~0f485567.756944ce.js","sourcesContent":["import arrayLikeToArray from \"@babel/runtime/helpers/esm/arrayLikeToArray\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","import objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"@babel/runtime/helpers/esm/setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import arrayLikeToArray from \"@babel/runtime/helpers/esm/arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"@babel/runtime/helpers/esm/arrayWithoutHoles\";\nimport iterableToArray from \"@babel/runtime/helpers/esm/iterableToArray\";\nimport unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nimport nonIterableSpread from \"@babel/runtime/helpers/esm/nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"@babel/runtime/helpers/esm/arrayWithHoles\";\nimport iterableToArrayLimit from \"@babel/runtime/helpers/esm/iterableToArrayLimit\";\nimport unsupportedIterableToArray from \"@babel/runtime/helpers/esm/unsupportedIterableToArray\";\nimport nonIterableRest from \"@babel/runtime/helpers/esm/nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","import firebase from '@firebase/app';\nimport { __spread, __awaiter, __generator, __extends, __assign } from 'tslib';\nimport { ErrorFactory, createSubscribe } from '@firebase/util';\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar _a;\r\nvar ERROR_MAP = (_a = {},\r\n _a[\"only-available-in-window\" /* AVAILABLE_IN_WINDOW */] = 'This method is available in a Window context.',\r\n _a[\"only-available-in-sw\" /* AVAILABLE_IN_SW */] = 'This method is available in a service worker context.',\r\n _a[\"should-be-overriden\" /* SHOULD_BE_INHERITED */] = 'This method should be overriden by extended classes.',\r\n _a[\"bad-sender-id\" /* BAD_SENDER_ID */] = \"Please ensure that 'messagingSenderId' is set \" +\r\n 'correctly in the options passed into firebase.initializeApp().',\r\n _a[\"permission-default\" /* PERMISSION_DEFAULT */] = 'The required permissions were not granted and dismissed instead.',\r\n _a[\"permission-blocked\" /* PERMISSION_BLOCKED */] = 'The required permissions were not granted and blocked instead.',\r\n _a[\"unsupported-browser\" /* UNSUPPORTED_BROWSER */] = \"This browser doesn't support the API's \" +\r\n 'required to use the firebase SDK.',\r\n _a[\"notifications-blocked\" /* NOTIFICATIONS_BLOCKED */] = 'Notifications have been blocked.',\r\n _a[\"failed-serviceworker-registration\" /* FAILED_DEFAULT_REGISTRATION */] = 'We are unable to register the ' +\r\n 'default service worker. {$browserErrorMessage}',\r\n _a[\"sw-registration-expected\" /* SW_REGISTRATION_EXPECTED */] = 'A service worker registration was the expected input.',\r\n _a[\"get-subscription-failed\" /* GET_SUBSCRIPTION_FAILED */] = 'There was an error when trying to get ' +\r\n 'any existing Push Subscriptions.',\r\n _a[\"invalid-saved-token\" /* INVALID_SAVED_TOKEN */] = 'Unable to access details of the saved token.',\r\n _a[\"sw-reg-redundant\" /* SW_REG_REDUNDANT */] = 'The service worker being used for push was made redundant.',\r\n _a[\"token-subscribe-failed\" /* TOKEN_SUBSCRIBE_FAILED */] = 'A problem occured while subscribing the user to FCM: {$errorInfo}',\r\n _a[\"token-subscribe-no-token\" /* TOKEN_SUBSCRIBE_NO_TOKEN */] = 'FCM returned no token when subscribing the user to push.',\r\n _a[\"token-subscribe-no-push-set\" /* TOKEN_SUBSCRIBE_NO_PUSH_SET */] = 'FCM returned an invalid response when getting an FCM token.',\r\n _a[\"token-unsubscribe-failed\" /* TOKEN_UNSUBSCRIBE_FAILED */] = 'A problem occured while unsubscribing the ' +\r\n 'user from FCM: {$errorInfo}',\r\n _a[\"token-update-failed\" /* TOKEN_UPDATE_FAILED */] = 'A problem occured while updating the user from FCM: {$errorInfo}',\r\n _a[\"token-update-no-token\" /* TOKEN_UPDATE_NO_TOKEN */] = 'FCM returned no token when updating the user to push.',\r\n _a[\"use-sw-before-get-token\" /* USE_SW_BEFORE_GET_TOKEN */] = 'The useServiceWorker() method may only be called once and must be ' +\r\n 'called before calling getToken() to ensure your service worker is used.',\r\n _a[\"invalid-delete-token\" /* INVALID_DELETE_TOKEN */] = 'You must pass a valid token into ' +\r\n 'deleteToken(), i.e. the token from getToken().',\r\n _a[\"delete-token-not-found\" /* DELETE_TOKEN_NOT_FOUND */] = 'The deletion attempt for token could not ' +\r\n 'be performed as the token was not found.',\r\n _a[\"delete-scope-not-found\" /* DELETE_SCOPE_NOT_FOUND */] = 'The deletion attempt for service worker ' +\r\n 'scope could not be performed as the scope was not found.',\r\n _a[\"bg-handler-function-expected\" /* BG_HANDLER_FUNCTION_EXPECTED */] = 'The input to setBackgroundMessageHandler() must be a function.',\r\n _a[\"no-window-client-to-msg\" /* NO_WINDOW_CLIENT_TO_MSG */] = 'An attempt was made to message a non-existant window client.',\r\n _a[\"unable-to-resubscribe\" /* UNABLE_TO_RESUBSCRIBE */] = 'There was an error while re-subscribing ' +\r\n 'the FCM token for push messaging. Will have to resubscribe the ' +\r\n 'user on next visit. {$errorInfo}',\r\n _a[\"no-fcm-token-for-resubscribe\" /* NO_FCM_TOKEN_FOR_RESUBSCRIBE */] = 'Could not find an FCM token ' +\r\n 'and as a result, unable to resubscribe. Will have to resubscribe the ' +\r\n 'user on next visit.',\r\n _a[\"failed-to-delete-token\" /* FAILED_TO_DELETE_TOKEN */] = 'Unable to delete the currently saved token.',\r\n _a[\"no-sw-in-reg\" /* NO_SW_IN_REG */] = 'Even though the service worker registration was ' +\r\n 'successful, there was a problem accessing the service worker itself.',\r\n _a[\"bad-scope\" /* BAD_SCOPE */] = 'The service worker scope must be a string with at ' +\r\n 'least one character.',\r\n _a[\"bad-vapid-key\" /* BAD_VAPID_KEY */] = 'The public VAPID key is not a Uint8Array with 65 bytes.',\r\n _a[\"bad-subscription\" /* BAD_SUBSCRIPTION */] = 'The subscription must be a valid PushSubscription.',\r\n _a[\"bad-token\" /* BAD_TOKEN */] = 'The FCM Token used for storage / lookup was not ' +\r\n 'a valid token string.',\r\n _a[\"bad-push-set\" /* BAD_PUSH_SET */] = 'The FCM push set used for storage / lookup was not ' +\r\n 'not a valid push set string.',\r\n _a[\"failed-delete-vapid-key\" /* FAILED_DELETE_VAPID_KEY */] = 'The VAPID key could not be deleted.',\r\n _a[\"invalid-public-vapid-key\" /* INVALID_PUBLIC_VAPID_KEY */] = 'The public VAPID key must be a string.',\r\n _a[\"use-public-key-before-get-token\" /* USE_PUBLIC_KEY_BEFORE_GET_TOKEN */] = 'The usePublicVapidKey() method may only be called once and must be ' +\r\n 'called before calling getToken() to ensure your VAPID key is used.',\r\n _a[\"public-vapid-key-decryption-failed\" /* PUBLIC_KEY_DECRYPTION_FAILED */] = 'The public VAPID key did not equal 65 bytes when decrypted.',\r\n _a);\r\nvar errorFactory = new ErrorFactory('messaging', 'Messaging', ERROR_MAP);\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar DEFAULT_PUBLIC_VAPID_KEY = new Uint8Array([\r\n 0x04,\r\n 0x33,\r\n 0x94,\r\n 0xf7,\r\n 0xdf,\r\n 0xa1,\r\n 0xeb,\r\n 0xb1,\r\n 0xdc,\r\n 0x03,\r\n 0xa2,\r\n 0x5e,\r\n 0x15,\r\n 0x71,\r\n 0xdb,\r\n 0x48,\r\n 0xd3,\r\n 0x2e,\r\n 0xed,\r\n 0xed,\r\n 0xb2,\r\n 0x34,\r\n 0xdb,\r\n 0xb7,\r\n 0x47,\r\n 0x3a,\r\n 0x0c,\r\n 0x8f,\r\n 0xc4,\r\n 0xcc,\r\n 0xe1,\r\n 0x6f,\r\n 0x3c,\r\n 0x8c,\r\n 0x84,\r\n 0xdf,\r\n 0xab,\r\n 0xb6,\r\n 0x66,\r\n 0x3e,\r\n 0xf2,\r\n 0x0c,\r\n 0xd4,\r\n 0x8b,\r\n 0xfe,\r\n 0xe3,\r\n 0xf9,\r\n 0x76,\r\n 0x2f,\r\n 0x14,\r\n 0x1c,\r\n 0x63,\r\n 0x08,\r\n 0x6a,\r\n 0x6f,\r\n 0x2d,\r\n 0xb1,\r\n 0x1a,\r\n 0x95,\r\n 0xb0,\r\n 0xce,\r\n 0x37,\r\n 0xc0,\r\n 0x9c,\r\n 0x6e\r\n]);\r\nvar ENDPOINT = 'https://fcm.googleapis.com';\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar MessageParameter;\r\n(function (MessageParameter) {\r\n MessageParameter[\"TYPE_OF_MSG\"] = \"firebase-messaging-msg-type\";\r\n MessageParameter[\"DATA\"] = \"firebase-messaging-msg-data\";\r\n})(MessageParameter || (MessageParameter = {}));\r\nvar MessageType;\r\n(function (MessageType) {\r\n MessageType[\"PUSH_MSG_RECEIVED\"] = \"push-msg-received\";\r\n MessageType[\"NOTIFICATION_CLICKED\"] = \"notification-clicked\";\r\n})(MessageType || (MessageType = {}));\n\n/**\r\n * @license\r\n * Copyright 2018 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction isArrayBufferEqual(a, b) {\r\n if (a == null || b == null) {\r\n return false;\r\n }\r\n if (a === b) {\r\n return true;\r\n }\r\n if (a.byteLength !== b.byteLength) {\r\n return false;\r\n }\r\n var viewA = new DataView(a);\r\n var viewB = new DataView(b);\r\n for (var i = 0; i < a.byteLength; i++) {\r\n if (viewA.getUint8(i) !== viewB.getUint8(i)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction toBase64(arrayBuffer) {\r\n var uint8Version = new Uint8Array(arrayBuffer);\r\n return btoa(String.fromCharCode.apply(String, __spread(uint8Version)));\r\n}\r\nfunction arrayBufferToBase64(arrayBuffer) {\r\n var base64String = toBase64(arrayBuffer);\r\n return base64String\r\n .replace(/=/g, '')\r\n .replace(/\\+/g, '-')\r\n .replace(/\\//g, '_');\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar IidModel = /** @class */ (function () {\r\n function IidModel() {\r\n }\r\n IidModel.prototype.getToken = function (senderId, subscription, publicVapidKey) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var p256dh, auth, fcmSubscribeBody, applicationPubKey, headers, subscribeOptions, responseData, response, err_1, message;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n p256dh = arrayBufferToBase64(subscription.getKey('p256dh'));\r\n auth = arrayBufferToBase64(subscription.getKey('auth'));\r\n fcmSubscribeBody = \"authorized_entity=\" + senderId + \"&\" +\r\n (\"endpoint=\" + subscription.endpoint + \"&\") +\r\n (\"encryption_key=\" + p256dh + \"&\") +\r\n (\"encryption_auth=\" + auth);\r\n if (!isArrayBufferEqual(publicVapidKey.buffer, DEFAULT_PUBLIC_VAPID_KEY.buffer)) {\r\n applicationPubKey = arrayBufferToBase64(publicVapidKey);\r\n fcmSubscribeBody += \"&application_pub_key=\" + applicationPubKey;\r\n }\r\n headers = new Headers();\r\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\r\n subscribeOptions = {\r\n method: 'POST',\r\n headers: headers,\r\n body: fcmSubscribeBody\r\n };\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 4, , 5]);\r\n return [4 /*yield*/, fetch(ENDPOINT + '/fcm/connect/subscribe', subscribeOptions)];\r\n case 2:\r\n response = _a.sent();\r\n return [4 /*yield*/, response.json()];\r\n case 3:\r\n responseData = _a.sent();\r\n return [3 /*break*/, 5];\r\n case 4:\r\n err_1 = _a.sent();\r\n throw errorFactory.create(\"token-subscribe-failed\" /* TOKEN_SUBSCRIBE_FAILED */, {\r\n errorInfo: err_1\r\n });\r\n case 5:\r\n if (responseData.error) {\r\n message = responseData.error.message;\r\n throw errorFactory.create(\"token-subscribe-failed\" /* TOKEN_SUBSCRIBE_FAILED */, {\r\n errorInfo: message\r\n });\r\n }\r\n if (!responseData.token) {\r\n throw errorFactory.create(\"token-subscribe-no-token\" /* TOKEN_SUBSCRIBE_NO_TOKEN */);\r\n }\r\n if (!responseData.pushSet) {\r\n throw errorFactory.create(\"token-subscribe-no-push-set\" /* TOKEN_SUBSCRIBE_NO_PUSH_SET */);\r\n }\r\n return [2 /*return*/, {\r\n token: responseData.token,\r\n pushSet: responseData.pushSet\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Update the underlying token details for fcmToken.\r\n */\r\n IidModel.prototype.updateToken = function (senderId, fcmToken, fcmPushSet, subscription, publicVapidKey) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var p256dh, auth, fcmUpdateBody, applicationPubKey, headers, updateOptions, responseData, response, err_2, message;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n p256dh = arrayBufferToBase64(subscription.getKey('p256dh'));\r\n auth = arrayBufferToBase64(subscription.getKey('auth'));\r\n fcmUpdateBody = \"push_set=\" + fcmPushSet + \"&\" +\r\n (\"token=\" + fcmToken + \"&\") +\r\n (\"authorized_entity=\" + senderId + \"&\") +\r\n (\"endpoint=\" + subscription.endpoint + \"&\") +\r\n (\"encryption_key=\" + p256dh + \"&\") +\r\n (\"encryption_auth=\" + auth);\r\n if (!isArrayBufferEqual(publicVapidKey.buffer, DEFAULT_PUBLIC_VAPID_KEY.buffer)) {\r\n applicationPubKey = arrayBufferToBase64(publicVapidKey);\r\n fcmUpdateBody += \"&application_pub_key=\" + applicationPubKey;\r\n }\r\n headers = new Headers();\r\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\r\n updateOptions = {\r\n method: 'POST',\r\n headers: headers,\r\n body: fcmUpdateBody\r\n };\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 4, , 5]);\r\n return [4 /*yield*/, fetch(ENDPOINT + '/fcm/connect/subscribe', updateOptions)];\r\n case 2:\r\n response = _a.sent();\r\n return [4 /*yield*/, response.json()];\r\n case 3:\r\n responseData = _a.sent();\r\n return [3 /*break*/, 5];\r\n case 4:\r\n err_2 = _a.sent();\r\n throw errorFactory.create(\"token-update-failed\" /* TOKEN_UPDATE_FAILED */, {\r\n errorInfo: err_2\r\n });\r\n case 5:\r\n if (responseData.error) {\r\n message = responseData.error.message;\r\n throw errorFactory.create(\"token-update-failed\" /* TOKEN_UPDATE_FAILED */, {\r\n errorInfo: message\r\n });\r\n }\r\n if (!responseData.token) {\r\n throw errorFactory.create(\"token-update-no-token\" /* TOKEN_UPDATE_NO_TOKEN */);\r\n }\r\n return [2 /*return*/, responseData.token];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Given a fcmToken, pushSet and messagingSenderId, delete an FCM token.\r\n */\r\n IidModel.prototype.deleteToken = function (senderId, fcmToken, fcmPushSet) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var fcmUnsubscribeBody, headers, unsubscribeOptions, response, responseData, message, err_3;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n fcmUnsubscribeBody = \"authorized_entity=\" + senderId + \"&\" +\r\n (\"token=\" + fcmToken + \"&\") +\r\n (\"pushSet=\" + fcmPushSet);\r\n headers = new Headers();\r\n headers.append('Content-Type', 'application/x-www-form-urlencoded');\r\n unsubscribeOptions = {\r\n method: 'POST',\r\n headers: headers,\r\n body: fcmUnsubscribeBody\r\n };\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 4, , 5]);\r\n return [4 /*yield*/, fetch(ENDPOINT + '/fcm/connect/unsubscribe', unsubscribeOptions)];\r\n case 2:\r\n response = _a.sent();\r\n return [4 /*yield*/, response.json()];\r\n case 3:\r\n responseData = _a.sent();\r\n if (responseData.error) {\r\n message = responseData.error.message;\r\n throw errorFactory.create(\"token-unsubscribe-failed\" /* TOKEN_UNSUBSCRIBE_FAILED */, {\r\n errorInfo: message\r\n });\r\n }\r\n return [3 /*break*/, 5];\r\n case 4:\r\n err_3 = _a.sent();\r\n throw errorFactory.create(\"token-unsubscribe-failed\" /* TOKEN_UNSUBSCRIBE_FAILED */, {\r\n errorInfo: err_3\r\n });\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return IidModel;\r\n}());\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction base64ToArrayBuffer(base64String) {\r\n var padding = '='.repeat((4 - (base64String.length % 4)) % 4);\r\n var base64 = (base64String + padding)\r\n .replace(/\\-/g, '+')\r\n .replace(/_/g, '/');\r\n var rawData = atob(base64);\r\n var outputArray = new Uint8Array(rawData.length);\r\n for (var i = 0; i < rawData.length; ++i) {\r\n outputArray[i] = rawData.charCodeAt(i);\r\n }\r\n return outputArray;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar OLD_DB_NAME = 'undefined';\r\nvar OLD_OBJECT_STORE_NAME = 'fcm_token_object_Store';\r\nfunction handleDb(db) {\r\n if (!db.objectStoreNames.contains(OLD_OBJECT_STORE_NAME)) {\r\n // We found a database with the name 'undefined', but our expected object\r\n // store isn't defined.\r\n return;\r\n }\r\n var transaction = db.transaction(OLD_OBJECT_STORE_NAME);\r\n var objectStore = transaction.objectStore(OLD_OBJECT_STORE_NAME);\r\n var iidModel = new IidModel();\r\n var openCursorRequest = objectStore.openCursor();\r\n openCursorRequest.onerror = function (event) {\r\n // NOOP - Nothing we can do.\r\n console.warn('Unable to cleanup old IDB.', event);\r\n };\r\n openCursorRequest.onsuccess = function () {\r\n var cursor = openCursorRequest.result;\r\n if (cursor) {\r\n // cursor.value contains the current record being iterated through\r\n // this is where you'd do something with the result\r\n var tokenDetails = cursor.value;\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n iidModel.deleteToken(tokenDetails.fcmSenderId, tokenDetails.fcmToken, tokenDetails.fcmPushSet);\r\n cursor.continue();\r\n }\r\n else {\r\n db.close();\r\n indexedDB.deleteDatabase(OLD_DB_NAME);\r\n }\r\n };\r\n}\r\nfunction cleanV1() {\r\n var request = indexedDB.open(OLD_DB_NAME);\r\n request.onerror = function (_event) {\r\n // NOOP - Nothing we can do.\r\n };\r\n request.onsuccess = function (_event) {\r\n var db = request.result;\r\n handleDb(db);\r\n };\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar DbInterface = /** @class */ (function () {\r\n function DbInterface() {\r\n this.dbPromise = null;\r\n }\r\n /** Gets record(s) from the objectStore that match the given key. */\r\n DbInterface.prototype.get = function (key) {\r\n return this.createTransaction(function (objectStore) { return objectStore.get(key); });\r\n };\r\n /** Gets record(s) from the objectStore that match the given index. */\r\n DbInterface.prototype.getIndex = function (index, key) {\r\n function runRequest(objectStore) {\r\n var idbIndex = objectStore.index(index);\r\n return idbIndex.get(key);\r\n }\r\n return this.createTransaction(runRequest);\r\n };\r\n /** Assigns or overwrites the record for the given value. */\r\n // IndexedDB values are of type \"any\"\r\n DbInterface.prototype.put = function (value) {\r\n return this.createTransaction(function (objectStore) { return objectStore.put(value); }, 'readwrite');\r\n };\r\n /** Deletes record(s) from the objectStore that match the given key. */\r\n DbInterface.prototype.delete = function (key) {\r\n return this.createTransaction(function (objectStore) { return objectStore.delete(key); }, 'readwrite');\r\n };\r\n /**\r\n * Close the currently open database.\r\n */\r\n DbInterface.prototype.closeDatabase = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var db;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!this.dbPromise) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.dbPromise];\r\n case 1:\r\n db = _a.sent();\r\n db.close();\r\n this.dbPromise = null;\r\n _a.label = 2;\r\n case 2: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates an IndexedDB Transaction and passes its objectStore to the\r\n * runRequest function, which runs the database request.\r\n *\r\n * @return Promise that resolves with the result of the runRequest function\r\n */\r\n DbInterface.prototype.createTransaction = function (runRequest, mode) {\r\n if (mode === void 0) { mode = 'readonly'; }\r\n return __awaiter(this, void 0, void 0, function () {\r\n var db, transaction, request, result;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getDb()];\r\n case 1:\r\n db = _a.sent();\r\n transaction = db.transaction(this.objectStoreName, mode);\r\n request = transaction.objectStore(this.objectStoreName);\r\n return [4 /*yield*/, promisify(runRequest(request))];\r\n case 2:\r\n result = _a.sent();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n transaction.oncomplete = function () {\r\n resolve(result);\r\n };\r\n transaction.onerror = function () {\r\n reject(transaction.error);\r\n };\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /** Gets the cached db connection or opens a new one. */\r\n DbInterface.prototype.getDb = function () {\r\n var _this = this;\r\n if (!this.dbPromise) {\r\n this.dbPromise = new Promise(function (resolve, reject) {\r\n var request = indexedDB.open(_this.dbName, _this.dbVersion);\r\n request.onsuccess = function () {\r\n resolve(request.result);\r\n };\r\n request.onerror = function () {\r\n _this.dbPromise = null;\r\n reject(request.error);\r\n };\r\n request.onupgradeneeded = function (event) { return _this.onDbUpgrade(request, event); };\r\n });\r\n }\r\n return this.dbPromise;\r\n };\r\n return DbInterface;\r\n}());\r\n/** Promisifies an IDBRequest. Resolves with the IDBRequest's result. */\r\nfunction promisify(request) {\r\n return new Promise(function (resolve, reject) {\r\n request.onsuccess = function () {\r\n resolve(request.result);\r\n };\r\n request.onerror = function () {\r\n reject(request.error);\r\n };\r\n });\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar TokenDetailsModel = /** @class */ (function (_super) {\r\n __extends(TokenDetailsModel, _super);\r\n function TokenDetailsModel() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.dbName = 'fcm_token_details_db';\r\n _this.dbVersion = 3;\r\n _this.objectStoreName = 'fcm_token_object_Store';\r\n return _this;\r\n }\r\n TokenDetailsModel.prototype.onDbUpgrade = function (request, event) {\r\n var db = request.result;\r\n // Lack of 'break' statements is intentional.\r\n switch (event.oldVersion) {\r\n case 0: {\r\n // New IDB instance\r\n var objectStore = db.createObjectStore(this.objectStoreName, {\r\n keyPath: 'swScope'\r\n });\r\n // Make sure the sender ID can be searched\r\n objectStore.createIndex('fcmSenderId', 'fcmSenderId', {\r\n unique: false\r\n });\r\n objectStore.createIndex('fcmToken', 'fcmToken', { unique: true });\r\n }\r\n case 1: {\r\n // Prior to version 2, we were using either 'fcm_token_details_db'\r\n // or 'undefined' as the database name due to bug in the SDK\r\n // So remove the old tokens and databases.\r\n cleanV1();\r\n }\r\n case 2: {\r\n var objectStore = request.transaction.objectStore(this.objectStoreName);\r\n var cursorRequest_1 = objectStore.openCursor();\r\n cursorRequest_1.onsuccess = function () {\r\n var cursor = cursorRequest_1.result;\r\n if (cursor) {\r\n var value = cursor.value;\r\n var newValue = __assign({}, value);\r\n if (!value.createTime) {\r\n newValue.createTime = Date.now();\r\n }\r\n if (typeof value.vapidKey === 'string') {\r\n newValue.vapidKey = base64ToArrayBuffer(value.vapidKey);\r\n }\r\n if (typeof value.auth === 'string') {\r\n newValue.auth = base64ToArrayBuffer(value.auth).buffer;\r\n }\r\n if (typeof value.auth === 'string') {\r\n newValue.p256dh = base64ToArrayBuffer(value.p256dh).buffer;\r\n }\r\n cursor.update(newValue);\r\n cursor.continue();\r\n }\r\n };\r\n }\r\n default: // ignore\r\n }\r\n };\r\n /**\r\n * Given a token, this method will look up the details in indexedDB.\r\n */\r\n TokenDetailsModel.prototype.getTokenDetailsFromToken = function (fcmToken) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n if (!fcmToken) {\r\n throw errorFactory.create(\"bad-token\" /* BAD_TOKEN */);\r\n }\r\n validateInputs({ fcmToken: fcmToken });\r\n return [2 /*return*/, this.getIndex('fcmToken', fcmToken)];\r\n });\r\n });\r\n };\r\n /**\r\n * Given a service worker scope, this method will look up the details in\r\n * indexedDB.\r\n * @return The details associated with that token.\r\n */\r\n TokenDetailsModel.prototype.getTokenDetailsFromSWScope = function (swScope) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n if (!swScope) {\r\n throw errorFactory.create(\"bad-scope\" /* BAD_SCOPE */);\r\n }\r\n validateInputs({ swScope: swScope });\r\n return [2 /*return*/, this.get(swScope)];\r\n });\r\n });\r\n };\r\n /**\r\n * Save the details for the fcm token for re-use at a later date.\r\n * @param input A plain js object containing args to save.\r\n */\r\n TokenDetailsModel.prototype.saveTokenDetails = function (tokenDetails) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n if (!tokenDetails.swScope) {\r\n throw errorFactory.create(\"bad-scope\" /* BAD_SCOPE */);\r\n }\r\n if (!tokenDetails.vapidKey) {\r\n throw errorFactory.create(\"bad-vapid-key\" /* BAD_VAPID_KEY */);\r\n }\r\n if (!tokenDetails.endpoint || !tokenDetails.auth || !tokenDetails.p256dh) {\r\n throw errorFactory.create(\"bad-subscription\" /* BAD_SUBSCRIPTION */);\r\n }\r\n if (!tokenDetails.fcmSenderId) {\r\n throw errorFactory.create(\"bad-sender-id\" /* BAD_SENDER_ID */);\r\n }\r\n if (!tokenDetails.fcmToken) {\r\n throw errorFactory.create(\"bad-token\" /* BAD_TOKEN */);\r\n }\r\n if (!tokenDetails.fcmPushSet) {\r\n throw errorFactory.create(\"bad-push-set\" /* BAD_PUSH_SET */);\r\n }\r\n validateInputs(tokenDetails);\r\n return [2 /*return*/, this.put(tokenDetails)];\r\n });\r\n });\r\n };\r\n /**\r\n * This method deletes details of the current FCM token.\r\n * It's returning a promise in case we need to move to an async\r\n * method for deleting at a later date.\r\n *\r\n * @return Resolves once the FCM token details have been deleted and returns\r\n * the deleted details.\r\n */\r\n TokenDetailsModel.prototype.deleteToken = function (token) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var details;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (typeof token !== 'string' || token.length === 0) {\r\n return [2 /*return*/, Promise.reject(errorFactory.create(\"invalid-delete-token\" /* INVALID_DELETE_TOKEN */))];\r\n }\r\n return [4 /*yield*/, this.getTokenDetailsFromToken(token)];\r\n case 1:\r\n details = _a.sent();\r\n if (!details) {\r\n throw errorFactory.create(\"delete-token-not-found\" /* DELETE_TOKEN_NOT_FOUND */);\r\n }\r\n return [4 /*yield*/, this.delete(details.swScope)];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/, details];\r\n }\r\n });\r\n });\r\n };\r\n return TokenDetailsModel;\r\n}(DbInterface));\r\n/**\r\n * This method takes an object and will check for known arguments and\r\n * validate the input.\r\n * @return Promise that resolves if input is valid, rejects otherwise.\r\n */\r\nfunction validateInputs(input) {\r\n if (input.fcmToken) {\r\n if (typeof input.fcmToken !== 'string' || input.fcmToken.length === 0) {\r\n throw errorFactory.create(\"bad-token\" /* BAD_TOKEN */);\r\n }\r\n }\r\n if (input.swScope) {\r\n if (typeof input.swScope !== 'string' || input.swScope.length === 0) {\r\n throw errorFactory.create(\"bad-scope\" /* BAD_SCOPE */);\r\n }\r\n }\r\n if (input.vapidKey) {\r\n if (!(input.vapidKey instanceof Uint8Array) ||\r\n input.vapidKey.length !== 65) {\r\n throw errorFactory.create(\"bad-vapid-key\" /* BAD_VAPID_KEY */);\r\n }\r\n }\r\n if (input.endpoint) {\r\n if (typeof input.endpoint !== 'string' || input.endpoint.length === 0) {\r\n throw errorFactory.create(\"bad-subscription\" /* BAD_SUBSCRIPTION */);\r\n }\r\n }\r\n if (input.auth) {\r\n if (!(input.auth instanceof ArrayBuffer)) {\r\n throw errorFactory.create(\"bad-subscription\" /* BAD_SUBSCRIPTION */);\r\n }\r\n }\r\n if (input.p256dh) {\r\n if (!(input.p256dh instanceof ArrayBuffer)) {\r\n throw errorFactory.create(\"bad-subscription\" /* BAD_SUBSCRIPTION */);\r\n }\r\n }\r\n if (input.fcmSenderId) {\r\n if (typeof input.fcmSenderId !== 'string' ||\r\n input.fcmSenderId.length === 0) {\r\n throw errorFactory.create(\"bad-sender-id\" /* BAD_SENDER_ID */);\r\n }\r\n }\r\n if (input.fcmPushSet) {\r\n if (typeof input.fcmPushSet !== 'string' || input.fcmPushSet.length === 0) {\r\n throw errorFactory.create(\"bad-push-set\" /* BAD_PUSH_SET */);\r\n }\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar UNCOMPRESSED_PUBLIC_KEY_SIZE = 65;\r\nvar VapidDetailsModel = /** @class */ (function (_super) {\r\n __extends(VapidDetailsModel, _super);\r\n function VapidDetailsModel() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.dbName = 'fcm_vapid_details_db';\r\n _this.dbVersion = 1;\r\n _this.objectStoreName = 'fcm_vapid_object_Store';\r\n return _this;\r\n }\r\n VapidDetailsModel.prototype.onDbUpgrade = function (request) {\r\n var db = request.result;\r\n db.createObjectStore(this.objectStoreName, { keyPath: 'swScope' });\r\n };\r\n /**\r\n * Given a service worker scope, this method will look up the vapid key\r\n * in indexedDB.\r\n */\r\n VapidDetailsModel.prototype.getVapidFromSWScope = function (swScope) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var result;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (typeof swScope !== 'string' || swScope.length === 0) {\r\n throw errorFactory.create(\"bad-scope\" /* BAD_SCOPE */);\r\n }\r\n return [4 /*yield*/, this.get(swScope)];\r\n case 1:\r\n result = _a.sent();\r\n return [2 /*return*/, result ? result.vapidKey : undefined];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Save a vapid key against a swScope for later date.\r\n */\r\n VapidDetailsModel.prototype.saveVapidDetails = function (swScope, vapidKey) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var details;\r\n return __generator(this, function (_a) {\r\n if (typeof swScope !== 'string' || swScope.length === 0) {\r\n throw errorFactory.create(\"bad-scope\" /* BAD_SCOPE */);\r\n }\r\n if (vapidKey === null || vapidKey.length !== UNCOMPRESSED_PUBLIC_KEY_SIZE) {\r\n throw errorFactory.create(\"bad-vapid-key\" /* BAD_VAPID_KEY */);\r\n }\r\n details = {\r\n swScope: swScope,\r\n vapidKey: vapidKey\r\n };\r\n return [2 /*return*/, this.put(details)];\r\n });\r\n });\r\n };\r\n /**\r\n * This method deletes details of the current FCM VAPID key for a SW scope.\r\n * Resolves once the scope/vapid details have been deleted and returns the\r\n * deleted vapid key.\r\n */\r\n VapidDetailsModel.prototype.deleteVapidDetails = function (swScope) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var vapidKey;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getVapidFromSWScope(swScope)];\r\n case 1:\r\n vapidKey = _a.sent();\r\n if (!vapidKey) {\r\n throw errorFactory.create(\"delete-scope-not-found\" /* DELETE_SCOPE_NOT_FOUND */);\r\n }\r\n return [4 /*yield*/, this.delete(swScope)];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/, vapidKey];\r\n }\r\n });\r\n });\r\n };\r\n return VapidDetailsModel;\r\n}(DbInterface));\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar SENDER_ID_OPTION_NAME = 'messagingSenderId';\r\n// Database cache should be invalidated once a week.\r\nvar TOKEN_EXPIRATION_MILLIS = 7 * 24 * 60 * 60 * 1000; // 7 days\r\nvar BaseController = /** @class */ (function () {\r\n /**\r\n * An interface of the Messaging Service API\r\n */\r\n function BaseController(app) {\r\n var _this = this;\r\n if (!app.options[SENDER_ID_OPTION_NAME] ||\r\n typeof app.options[SENDER_ID_OPTION_NAME] !== 'string') {\r\n throw errorFactory.create(\"bad-sender-id\" /* BAD_SENDER_ID */);\r\n }\r\n this.messagingSenderId = app.options[SENDER_ID_OPTION_NAME];\r\n this.tokenDetailsModel = new TokenDetailsModel();\r\n this.vapidDetailsModel = new VapidDetailsModel();\r\n this.iidModel = new IidModel();\r\n this.app = app;\r\n this.INTERNAL = {\r\n delete: function () { return _this.delete(); }\r\n };\r\n }\r\n /**\r\n * @export\r\n */\r\n BaseController.prototype.getToken = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var currentPermission, swReg, publicVapidKey, pushSubscription, tokenDetails;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n currentPermission = this.getNotificationPermission_();\r\n if (currentPermission === 'denied') {\r\n throw errorFactory.create(\"notifications-blocked\" /* NOTIFICATIONS_BLOCKED */);\r\n }\r\n else if (currentPermission !== 'granted') {\r\n // We must wait for permission to be granted\r\n return [2 /*return*/, null];\r\n }\r\n return [4 /*yield*/, this.getSWRegistration_()];\r\n case 1:\r\n swReg = _a.sent();\r\n return [4 /*yield*/, this.getPublicVapidKey_()];\r\n case 2:\r\n publicVapidKey = _a.sent();\r\n return [4 /*yield*/, this.getPushSubscription(swReg, publicVapidKey)];\r\n case 3:\r\n pushSubscription = _a.sent();\r\n return [4 /*yield*/, this.tokenDetailsModel.getTokenDetailsFromSWScope(swReg.scope)];\r\n case 4:\r\n tokenDetails = _a.sent();\r\n if (tokenDetails) {\r\n return [2 /*return*/, this.manageExistingToken(swReg, pushSubscription, publicVapidKey, tokenDetails)];\r\n }\r\n return [2 /*return*/, this.getNewToken(swReg, pushSubscription, publicVapidKey)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * manageExistingToken is triggered if there's an existing FCM token in the\r\n * database and it can take 3 different actions:\r\n * 1) Retrieve the existing FCM token from the database.\r\n * 2) If VAPID details have changed: Delete the existing token and create a\r\n * new one with the new VAPID key.\r\n * 3) If the database cache is invalidated: Send a request to FCM to update\r\n * the token, and to check if the token is still valid on FCM-side.\r\n */\r\n BaseController.prototype.manageExistingToken = function (swReg, pushSubscription, publicVapidKey, tokenDetails) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var isTokenValid, now;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n isTokenValid = isTokenStillValid(pushSubscription, publicVapidKey, tokenDetails);\r\n if (isTokenValid) {\r\n now = Date.now();\r\n if (now < tokenDetails.createTime + TOKEN_EXPIRATION_MILLIS) {\r\n return [2 /*return*/, tokenDetails.fcmToken];\r\n }\r\n else {\r\n return [2 /*return*/, this.updateToken(swReg, pushSubscription, publicVapidKey, tokenDetails)];\r\n }\r\n }\r\n // If the token is no longer valid (for example if the VAPID details\r\n // have changed), delete the existing token from the FCM client and server\r\n // database. No need to unsubscribe from the Service Worker as we have a\r\n // good push subscription that we'd like to use in getNewToken.\r\n return [4 /*yield*/, this.deleteTokenFromDB(tokenDetails.fcmToken)];\r\n case 1:\r\n // If the token is no longer valid (for example if the VAPID details\r\n // have changed), delete the existing token from the FCM client and server\r\n // database. No need to unsubscribe from the Service Worker as we have a\r\n // good push subscription that we'd like to use in getNewToken.\r\n _a.sent();\r\n return [2 /*return*/, this.getNewToken(swReg, pushSubscription, publicVapidKey)];\r\n }\r\n });\r\n });\r\n };\r\n BaseController.prototype.updateToken = function (swReg, pushSubscription, publicVapidKey, tokenDetails) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var updatedToken, allDetails, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 4, , 6]);\r\n return [4 /*yield*/, this.iidModel.updateToken(this.messagingSenderId, tokenDetails.fcmToken, tokenDetails.fcmPushSet, pushSubscription, publicVapidKey)];\r\n case 1:\r\n updatedToken = _a.sent();\r\n allDetails = {\r\n swScope: swReg.scope,\r\n vapidKey: publicVapidKey,\r\n fcmSenderId: this.messagingSenderId,\r\n fcmToken: updatedToken,\r\n fcmPushSet: tokenDetails.fcmPushSet,\r\n createTime: Date.now(),\r\n endpoint: pushSubscription.endpoint,\r\n auth: pushSubscription.getKey('auth'),\r\n p256dh: pushSubscription.getKey('p256dh')\r\n };\r\n return [4 /*yield*/, this.tokenDetailsModel.saveTokenDetails(allDetails)];\r\n case 2:\r\n _a.sent();\r\n return [4 /*yield*/, this.vapidDetailsModel.saveVapidDetails(swReg.scope, publicVapidKey)];\r\n case 3:\r\n _a.sent();\r\n return [2 /*return*/, updatedToken];\r\n case 4:\r\n e_1 = _a.sent();\r\n return [4 /*yield*/, this.deleteToken(tokenDetails.fcmToken)];\r\n case 5:\r\n _a.sent();\r\n throw e_1;\r\n case 6: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n BaseController.prototype.getNewToken = function (swReg, pushSubscription, publicVapidKey) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var tokenDetails, allDetails;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.iidModel.getToken(this.messagingSenderId, pushSubscription, publicVapidKey)];\r\n case 1:\r\n tokenDetails = _a.sent();\r\n allDetails = {\r\n swScope: swReg.scope,\r\n vapidKey: publicVapidKey,\r\n fcmSenderId: this.messagingSenderId,\r\n fcmToken: tokenDetails.token,\r\n fcmPushSet: tokenDetails.pushSet,\r\n createTime: Date.now(),\r\n endpoint: pushSubscription.endpoint,\r\n auth: pushSubscription.getKey('auth'),\r\n p256dh: pushSubscription.getKey('p256dh')\r\n };\r\n return [4 /*yield*/, this.tokenDetailsModel.saveTokenDetails(allDetails)];\r\n case 2:\r\n _a.sent();\r\n return [4 /*yield*/, this.vapidDetailsModel.saveVapidDetails(swReg.scope, publicVapidKey)];\r\n case 3:\r\n _a.sent();\r\n return [2 /*return*/, tokenDetails.token];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This method deletes tokens that the token manager looks after,\r\n * unsubscribes the token from FCM and then unregisters the push\r\n * subscription if it exists. It returns a promise that indicates\r\n * whether or not the unsubscribe request was processed successfully.\r\n */\r\n BaseController.prototype.deleteToken = function (token) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var registration, pushSubscription;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: \r\n // Delete the token details from the database.\r\n return [4 /*yield*/, this.deleteTokenFromDB(token)];\r\n case 1:\r\n // Delete the token details from the database.\r\n _a.sent();\r\n return [4 /*yield*/, this.getSWRegistration_()];\r\n case 2:\r\n registration = _a.sent();\r\n if (!registration) return [3 /*break*/, 4];\r\n return [4 /*yield*/, registration.pushManager.getSubscription()];\r\n case 3:\r\n pushSubscription = _a.sent();\r\n if (pushSubscription) {\r\n return [2 /*return*/, pushSubscription.unsubscribe()];\r\n }\r\n _a.label = 4;\r\n case 4: \r\n // If there's no SW, consider it a success.\r\n return [2 /*return*/, true];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This method will delete the token from the client database, and make a\r\n * call to FCM to remove it from the server DB. Does not temper with the\r\n * push subscription.\r\n */\r\n BaseController.prototype.deleteTokenFromDB = function (token) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var details;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.tokenDetailsModel.deleteToken(token)];\r\n case 1:\r\n details = _a.sent();\r\n return [4 /*yield*/, this.iidModel.deleteToken(details.fcmSenderId, details.fcmToken, details.fcmPushSet)];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Gets a PushSubscription for the current user.\r\n */\r\n BaseController.prototype.getPushSubscription = function (swRegistration, publicVapidKey) {\r\n return swRegistration.pushManager.getSubscription().then(function (subscription) {\r\n if (subscription) {\r\n return subscription;\r\n }\r\n return swRegistration.pushManager.subscribe({\r\n userVisibleOnly: true,\r\n applicationServerKey: publicVapidKey\r\n });\r\n });\r\n };\r\n //\r\n // The following methods should only be available in the window.\r\n //\r\n /**\r\n * @deprecated Use Notification.requestPermission() instead.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission\r\n */\r\n BaseController.prototype.requestPermission = function () {\r\n throw errorFactory.create(\"only-available-in-window\" /* AVAILABLE_IN_WINDOW */);\r\n };\r\n BaseController.prototype.useServiceWorker = function (_registration) {\r\n throw errorFactory.create(\"only-available-in-window\" /* AVAILABLE_IN_WINDOW */);\r\n };\r\n BaseController.prototype.usePublicVapidKey = function (_b64PublicKey) {\r\n throw errorFactory.create(\"only-available-in-window\" /* AVAILABLE_IN_WINDOW */);\r\n };\r\n BaseController.prototype.onMessage = function (_nextOrObserver, _error, _completed) {\r\n throw errorFactory.create(\"only-available-in-window\" /* AVAILABLE_IN_WINDOW */);\r\n };\r\n BaseController.prototype.onTokenRefresh = function (_nextOrObserver, _error, _completed) {\r\n throw errorFactory.create(\"only-available-in-window\" /* AVAILABLE_IN_WINDOW */);\r\n };\r\n //\r\n // The following methods are used by the service worker only.\r\n //\r\n BaseController.prototype.setBackgroundMessageHandler = function (_callback) {\r\n throw errorFactory.create(\"only-available-in-sw\" /* AVAILABLE_IN_SW */);\r\n };\r\n //\r\n // The following methods are used by the service themselves and not exposed\r\n // publicly or not expected to be used by developers.\r\n //\r\n /**\r\n * This method is required to adhere to the Firebase interface.\r\n * It closes any currently open indexdb database connections.\r\n */\r\n BaseController.prototype.delete = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, Promise.all([\r\n this.tokenDetailsModel.closeDatabase(),\r\n this.vapidDetailsModel.closeDatabase()\r\n ])];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns the current Notification Permission state.\r\n */\r\n BaseController.prototype.getNotificationPermission_ = function () {\r\n return Notification.permission;\r\n };\r\n BaseController.prototype.getTokenDetailsModel = function () {\r\n return this.tokenDetailsModel;\r\n };\r\n BaseController.prototype.getVapidDetailsModel = function () {\r\n return this.vapidDetailsModel;\r\n };\r\n // Visible for testing\r\n // TODO: make protected\r\n BaseController.prototype.getIidModel = function () {\r\n return this.iidModel;\r\n };\r\n return BaseController;\r\n}());\r\n/**\r\n * Checks if the tokenDetails match the details provided in the clients.\r\n */\r\nfunction isTokenStillValid(pushSubscription, publicVapidKey, tokenDetails) {\r\n if (!tokenDetails.vapidKey ||\r\n !isArrayBufferEqual(publicVapidKey.buffer, tokenDetails.vapidKey.buffer)) {\r\n return false;\r\n }\r\n var isEndpointEqual = pushSubscription.endpoint === tokenDetails.endpoint;\r\n var isAuthEqual = isArrayBufferEqual(pushSubscription.getKey('auth'), tokenDetails.auth);\r\n var isP256dhEqual = isArrayBufferEqual(pushSubscription.getKey('p256dh'), tokenDetails.p256dh);\r\n return isEndpointEqual && isAuthEqual && isP256dhEqual;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar FCM_MSG = 'FCM_MSG';\r\nvar SwController = /** @class */ (function (_super) {\r\n __extends(SwController, _super);\r\n function SwController(app) {\r\n var _this = _super.call(this, app) || this;\r\n _this.bgMessageHandler = null;\r\n self.addEventListener('push', function (e) {\r\n _this.onPush(e);\r\n });\r\n self.addEventListener('pushsubscriptionchange', function (e) {\r\n _this.onSubChange(e);\r\n });\r\n self.addEventListener('notificationclick', function (e) {\r\n _this.onNotificationClick(e);\r\n });\r\n return _this;\r\n }\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.onPush = function (event) {\r\n event.waitUntil(this.onPush_(event));\r\n };\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.onSubChange = function (event) {\r\n event.waitUntil(this.onSubChange_(event));\r\n };\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.onNotificationClick = function (event) {\r\n event.waitUntil(this.onNotificationClick_(event));\r\n };\r\n /**\r\n * A handler for push events that shows notifications based on the content of\r\n * the payload.\r\n *\r\n * The payload must be a JSON-encoded Object with a `notification` key. The\r\n * value of the `notification` property will be used as the NotificationOptions\r\n * object passed to showNotification. Additionally, the `title` property of the\r\n * notification object will be used as the title.\r\n *\r\n * If there is no notification data in the payload then no notification will be\r\n * shown.\r\n */\r\n SwController.prototype.onPush_ = function (event) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var msgPayload, hasVisibleClients, notificationDetails, notificationTitle, reg, actions, maxActions;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!event.data) {\r\n return [2 /*return*/];\r\n }\r\n try {\r\n msgPayload = event.data.json();\r\n }\r\n catch (err) {\r\n // Not JSON so not an FCM message\r\n return [2 /*return*/];\r\n }\r\n return [4 /*yield*/, this.hasVisibleClients_()];\r\n case 1:\r\n hasVisibleClients = _a.sent();\r\n if (hasVisibleClients) {\r\n // App in foreground. Send to page.\r\n return [2 /*return*/, this.sendMessageToWindowClients_(msgPayload)];\r\n }\r\n notificationDetails = this.getNotificationData_(msgPayload);\r\n if (!notificationDetails) return [3 /*break*/, 3];\r\n notificationTitle = notificationDetails.title || '';\r\n return [4 /*yield*/, this.getSWRegistration_()];\r\n case 2:\r\n reg = _a.sent();\r\n actions = notificationDetails.actions;\r\n maxActions = Notification.maxActions;\r\n // tslint:enable no-any\r\n if (actions && maxActions && actions.length > maxActions) {\r\n console.warn(\"This browser only supports \" + maxActions + \" actions.\" +\r\n \"The remaining actions will not be displayed.\");\r\n }\r\n return [2 /*return*/, reg.showNotification(notificationTitle, notificationDetails)];\r\n case 3:\r\n if (!this.bgMessageHandler) return [3 /*break*/, 5];\r\n return [4 /*yield*/, this.bgMessageHandler(msgPayload)];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n SwController.prototype.onSubChange_ = function (_event) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var registration, err_1, err_2, tokenDetailsModel, tokenDetails;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n return [4 /*yield*/, this.getSWRegistration_()];\r\n case 1:\r\n registration = _a.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n err_1 = _a.sent();\r\n throw errorFactory.create(\"unable-to-resubscribe\" /* UNABLE_TO_RESUBSCRIBE */, {\r\n errorInfo: err_1\r\n });\r\n case 3:\r\n _a.trys.push([3, 5, , 8]);\r\n return [4 /*yield*/, registration.pushManager.getSubscription()];\r\n case 4:\r\n _a.sent();\r\n return [3 /*break*/, 8];\r\n case 5:\r\n err_2 = _a.sent();\r\n tokenDetailsModel = this.getTokenDetailsModel();\r\n return [4 /*yield*/, tokenDetailsModel.getTokenDetailsFromSWScope(registration.scope)];\r\n case 6:\r\n tokenDetails = _a.sent();\r\n if (!tokenDetails) {\r\n // This should rarely occure, but could if indexedDB\r\n // is corrupted or wiped\r\n throw err_2;\r\n }\r\n // Attempt to delete the token if we know it's bad\r\n return [4 /*yield*/, this.deleteToken(tokenDetails.fcmToken)];\r\n case 7:\r\n // Attempt to delete the token if we know it's bad\r\n _a.sent();\r\n throw err_2;\r\n case 8: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n SwController.prototype.onNotificationClick_ = function (event) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var msgPayload, link, windowClient, internalMsg;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!event.notification ||\r\n !event.notification.data ||\r\n !event.notification.data[FCM_MSG]) {\r\n // Not an FCM notification, do nothing.\r\n return [2 /*return*/];\r\n }\r\n else if (event.action) {\r\n // User clicked on an action button.\r\n // This will allow devs to act on action button clicks by using a custom\r\n // onNotificationClick listener that they define.\r\n return [2 /*return*/];\r\n }\r\n // Prevent other listeners from receiving the event\r\n event.stopImmediatePropagation();\r\n event.notification.close();\r\n msgPayload = event.notification.data[FCM_MSG];\r\n if (!msgPayload.notification) {\r\n // Nothing to do.\r\n return [2 /*return*/];\r\n }\r\n link = (msgPayload.fcmOptions && msgPayload.fcmOptions.link) ||\r\n msgPayload.notification.click_action;\r\n if (!link) {\r\n // Nothing to do.\r\n return [2 /*return*/];\r\n }\r\n return [4 /*yield*/, this.getWindowClient_(link)];\r\n case 1:\r\n windowClient = _a.sent();\r\n if (!!windowClient) return [3 /*break*/, 3];\r\n return [4 /*yield*/, self.clients.openWindow(link)];\r\n case 2:\r\n // Unable to find window client so need to open one.\r\n windowClient = _a.sent();\r\n return [3 /*break*/, 5];\r\n case 3: return [4 /*yield*/, windowClient.focus()];\r\n case 4:\r\n windowClient = _a.sent();\r\n _a.label = 5;\r\n case 5:\r\n if (!windowClient) {\r\n // Window Client will not be returned if it's for a third party origin.\r\n return [2 /*return*/];\r\n }\r\n // Delete notification and fcmOptions data from payload before sending to\r\n // the page.\r\n delete msgPayload.notification;\r\n delete msgPayload.fcmOptions;\r\n internalMsg = createNewMsg(MessageType.NOTIFICATION_CLICKED, msgPayload);\r\n // Attempt to send a message to the client to handle the data\r\n // Is affected by: https://github.com/slightlyoff/ServiceWorker/issues/728\r\n return [2 /*return*/, this.attemptToMessageClient_(windowClient, internalMsg)];\r\n }\r\n });\r\n });\r\n };\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.getNotificationData_ = function (msgPayload) {\r\n var _a;\r\n if (!msgPayload) {\r\n return;\r\n }\r\n if (typeof msgPayload.notification !== 'object') {\r\n return;\r\n }\r\n var notificationInformation = __assign({}, msgPayload.notification);\r\n // Put the message payload under FCM_MSG name so we can identify the\r\n // notification as being an FCM notification vs a notification from\r\n // somewhere else (i.e. normal web push or developer generated\r\n // notification).\r\n notificationInformation.data = __assign({}, msgPayload.notification.data, (_a = {}, _a[FCM_MSG] = msgPayload, _a));\r\n return notificationInformation;\r\n };\r\n /**\r\n * Calling setBackgroundMessageHandler will opt in to some specific\r\n * behaviours.\r\n * 1.) If a notification doesn't need to be shown due to a window already\r\n * being visible, then push messages will be sent to the page.\r\n * 2.) If a notification needs to be shown, and the message contains no\r\n * notification data this method will be called\r\n * and the promise it returns will be passed to event.waitUntil.\r\n * If you do not set this callback then all push messages will let and the\r\n * developer can handle them in a their own 'push' event callback\r\n *\r\n * @param callback The callback to be called when a push message is received\r\n * and a notification must be shown. The callback will be given the data from\r\n * the push message.\r\n */\r\n SwController.prototype.setBackgroundMessageHandler = function (callback) {\r\n if (!callback || typeof callback !== 'function') {\r\n throw errorFactory.create(\"bg-handler-function-expected\" /* BG_HANDLER_FUNCTION_EXPECTED */);\r\n }\r\n this.bgMessageHandler = callback;\r\n };\r\n /**\r\n * @param url The URL to look for when focusing a client.\r\n * @return Returns an existing window client or a newly opened WindowClient.\r\n */\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.getWindowClient_ = function (url) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var parsedURL, clientList, suitableClient, i, parsedClientUrl;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n parsedURL = new URL(url, self.location.href).href;\r\n return [4 /*yield*/, getClientList()];\r\n case 1:\r\n clientList = _a.sent();\r\n suitableClient = null;\r\n for (i = 0; i < clientList.length; i++) {\r\n parsedClientUrl = new URL(clientList[i].url, self.location.href)\r\n .href;\r\n if (parsedClientUrl === parsedURL) {\r\n suitableClient = clientList[i];\r\n break;\r\n }\r\n }\r\n return [2 /*return*/, suitableClient];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This message will attempt to send the message to a window client.\r\n * @param client The WindowClient to send the message to.\r\n * @param message The message to send to the client.\r\n * @returns Returns a promise that resolves after sending the message. This\r\n * does not guarantee that the message was successfully received.\r\n */\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.attemptToMessageClient_ = function (client, message) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n // NOTE: This returns a promise in case this API is abstracted later on to\r\n // do additional work\r\n if (!client) {\r\n throw errorFactory.create(\"no-window-client-to-msg\" /* NO_WINDOW_CLIENT_TO_MSG */);\r\n }\r\n client.postMessage(message);\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * @returns If there is currently a visible WindowClient, this method will\r\n * resolve to true, otherwise false.\r\n */\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.hasVisibleClients_ = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientList;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, getClientList()];\r\n case 1:\r\n clientList = _a.sent();\r\n return [2 /*return*/, clientList.some(function (client) {\r\n return client.visibilityState === 'visible' &&\r\n // Ignore chrome-extension clients as that matches the background pages\r\n // of extensions, which are always considered visible.\r\n !client.url.startsWith('chrome-extension://');\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * @param msgPayload The data from the push event that should be sent to all\r\n * available pages.\r\n * @returns Returns a promise that resolves once the message has been sent to\r\n * all WindowClients.\r\n */\r\n // Visible for testing\r\n // TODO: Make private\r\n SwController.prototype.sendMessageToWindowClients_ = function (msgPayload) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientList, internalMsg;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, getClientList()];\r\n case 1:\r\n clientList = _a.sent();\r\n internalMsg = createNewMsg(MessageType.PUSH_MSG_RECEIVED, msgPayload);\r\n return [4 /*yield*/, Promise.all(clientList.map(function (client) {\r\n return _this.attemptToMessageClient_(client, internalMsg);\r\n }))];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This will register the default service worker and return the registration.\r\n * @return he service worker registration to be used for the push service.\r\n */\r\n SwController.prototype.getSWRegistration_ = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, self.registration];\r\n });\r\n });\r\n };\r\n /**\r\n * This will return the default VAPID key or the uint8array version of the\r\n * public VAPID key provided by the developer.\r\n */\r\n SwController.prototype.getPublicVapidKey_ = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var swReg, vapidKeyFromDatabase;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getSWRegistration_()];\r\n case 1:\r\n swReg = _a.sent();\r\n if (!swReg) {\r\n throw errorFactory.create(\"sw-registration-expected\" /* SW_REGISTRATION_EXPECTED */);\r\n }\r\n return [4 /*yield*/, this.getVapidDetailsModel().getVapidFromSWScope(swReg.scope)];\r\n case 2:\r\n vapidKeyFromDatabase = _a.sent();\r\n if (vapidKeyFromDatabase == null) {\r\n return [2 /*return*/, DEFAULT_PUBLIC_VAPID_KEY];\r\n }\r\n return [2 /*return*/, vapidKeyFromDatabase];\r\n }\r\n });\r\n });\r\n };\r\n return SwController;\r\n}(BaseController));\r\nfunction getClientList() {\r\n return self.clients.matchAll({\r\n type: 'window',\r\n includeUncontrolled: true\r\n // TS doesn't know that \"type: 'window'\" means it'll return WindowClient[]\r\n });\r\n}\r\nfunction createNewMsg(msgType, msgData) {\r\n var _a;\r\n return _a = {},\r\n _a[MessageParameter.TYPE_OF_MSG] = msgType,\r\n _a[MessageParameter.DATA] = msgData,\r\n _a;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar DEFAULT_SW_PATH = '/firebase-messaging-sw.js';\r\nvar DEFAULT_SW_SCOPE = '/firebase-cloud-messaging-push-scope';\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar WindowController = /** @class */ (function (_super) {\r\n __extends(WindowController, _super);\r\n /**\r\n * A service that provides a MessagingService instance.\r\n */\r\n function WindowController(app) {\r\n var _this = _super.call(this, app) || this;\r\n _this.registrationToUse = null;\r\n _this.publicVapidKeyToUse = null;\r\n _this.messageObserver = null;\r\n // @ts-ignore: Unused variable error, this is not implemented yet.\r\n _this.tokenRefreshObserver = null;\r\n _this.onMessageInternal = createSubscribe(function (observer) {\r\n _this.messageObserver = observer;\r\n });\r\n _this.onTokenRefreshInternal = createSubscribe(function (observer) {\r\n _this.tokenRefreshObserver = observer;\r\n });\r\n _this.setupSWMessageListener_();\r\n return _this;\r\n }\r\n /**\r\n * Request permission if it is not currently granted\r\n *\r\n * @return Resolves if the permission was granted, otherwise rejects\r\n *\r\n * @deprecated Use Notification.requestPermission() instead.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission\r\n */\r\n WindowController.prototype.requestPermission = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var permissionResult;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (this.getNotificationPermission_() === 'granted') {\r\n return [2 /*return*/];\r\n }\r\n return [4 /*yield*/, Notification.requestPermission()];\r\n case 1:\r\n permissionResult = _a.sent();\r\n if (permissionResult === 'granted') {\r\n return [2 /*return*/];\r\n }\r\n else if (permissionResult === 'denied') {\r\n throw errorFactory.create(\"permission-blocked\" /* PERMISSION_BLOCKED */);\r\n }\r\n else {\r\n throw errorFactory.create(\"permission-default\" /* PERMISSION_DEFAULT */);\r\n }\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This method allows a developer to override the default service worker and\r\n * instead use a custom service worker.\r\n *\r\n * @param registration The service worker registration that should be used to\r\n * receive the push messages.\r\n */\r\n WindowController.prototype.useServiceWorker = function (registration) {\r\n if (!(registration instanceof ServiceWorkerRegistration)) {\r\n throw errorFactory.create(\"sw-registration-expected\" /* SW_REGISTRATION_EXPECTED */);\r\n }\r\n if (this.registrationToUse != null) {\r\n throw errorFactory.create(\"use-sw-before-get-token\" /* USE_SW_BEFORE_GET_TOKEN */);\r\n }\r\n this.registrationToUse = registration;\r\n };\r\n /**\r\n * This method allows a developer to override the default vapid key\r\n * and instead use a custom VAPID public key.\r\n *\r\n * @param publicKey A URL safe base64 encoded string.\r\n */\r\n WindowController.prototype.usePublicVapidKey = function (publicKey) {\r\n if (typeof publicKey !== 'string') {\r\n throw errorFactory.create(\"invalid-public-vapid-key\" /* INVALID_PUBLIC_VAPID_KEY */);\r\n }\r\n if (this.publicVapidKeyToUse != null) {\r\n throw errorFactory.create(\"use-public-key-before-get-token\" /* USE_PUBLIC_KEY_BEFORE_GET_TOKEN */);\r\n }\r\n var parsedKey = base64ToArrayBuffer(publicKey);\r\n if (parsedKey.length !== 65) {\r\n throw errorFactory.create(\"public-vapid-key-decryption-failed\" /* PUBLIC_KEY_DECRYPTION_FAILED */);\r\n }\r\n this.publicVapidKeyToUse = parsedKey;\r\n };\r\n /**\r\n * @export\r\n * @param nextOrObserver An observer object or a function triggered on\r\n * message.\r\n * @param error A function triggered on message error.\r\n * @param completed function triggered when the observer is removed.\r\n * @return The unsubscribe function for the observer.\r\n */\r\n WindowController.prototype.onMessage = function (nextOrObserver, error, completed) {\r\n if (typeof nextOrObserver === 'function') {\r\n return this.onMessageInternal(nextOrObserver, error, completed);\r\n }\r\n else {\r\n return this.onMessageInternal(nextOrObserver);\r\n }\r\n };\r\n /**\r\n * @param nextOrObserver An observer object or a function triggered on token\r\n * refresh.\r\n * @param error A function triggered on token refresh error.\r\n * @param completed function triggered when the observer is removed.\r\n * @return The unsubscribe function for the observer.\r\n */\r\n WindowController.prototype.onTokenRefresh = function (nextOrObserver, error, completed) {\r\n if (typeof nextOrObserver === 'function') {\r\n return this.onTokenRefreshInternal(nextOrObserver, error, completed);\r\n }\r\n else {\r\n return this.onTokenRefreshInternal(nextOrObserver);\r\n }\r\n };\r\n /**\r\n * Given a registration, wait for the service worker it relates to\r\n * become activer\r\n * @param registration Registration to wait for service worker to become active\r\n * @return Wait for service worker registration to become active\r\n */\r\n // Visible for testing\r\n // TODO: Make private\r\n WindowController.prototype.waitForRegistrationToActivate_ = function (registration) {\r\n var serviceWorker = registration.installing || registration.waiting || registration.active;\r\n return new Promise(function (resolve, reject) {\r\n if (!serviceWorker) {\r\n // This is a rare scenario but has occured in firefox\r\n reject(errorFactory.create(\"no-sw-in-reg\" /* NO_SW_IN_REG */));\r\n return;\r\n }\r\n // Because the Promise function is called on next tick there is a\r\n // small chance that the worker became active or redundant already.\r\n if (serviceWorker.state === 'activated') {\r\n resolve(registration);\r\n return;\r\n }\r\n if (serviceWorker.state === 'redundant') {\r\n reject(errorFactory.create(\"sw-reg-redundant\" /* SW_REG_REDUNDANT */));\r\n return;\r\n }\r\n var stateChangeListener = function () {\r\n if (serviceWorker.state === 'activated') {\r\n resolve(registration);\r\n }\r\n else if (serviceWorker.state === 'redundant') {\r\n reject(errorFactory.create(\"sw-reg-redundant\" /* SW_REG_REDUNDANT */));\r\n }\r\n else {\r\n // Return early and wait to next state change\r\n return;\r\n }\r\n serviceWorker.removeEventListener('statechange', stateChangeListener);\r\n };\r\n serviceWorker.addEventListener('statechange', stateChangeListener);\r\n });\r\n };\r\n /**\r\n * This will register the default service worker and return the registration\r\n * @return The service worker registration to be used for the push service.\r\n */\r\n WindowController.prototype.getSWRegistration_ = function () {\r\n var _this = this;\r\n if (this.registrationToUse) {\r\n return this.waitForRegistrationToActivate_(this.registrationToUse);\r\n }\r\n // Make the registration null so we know useServiceWorker will not\r\n // use a new service worker as registrationToUse is no longer undefined\r\n this.registrationToUse = null;\r\n return navigator.serviceWorker\r\n .register(DEFAULT_SW_PATH, {\r\n scope: DEFAULT_SW_SCOPE\r\n })\r\n .catch(function (err) {\r\n throw errorFactory.create(\"failed-serviceworker-registration\" /* FAILED_DEFAULT_REGISTRATION */, {\r\n browserErrorMessage: err.message\r\n });\r\n })\r\n .then(function (registration) {\r\n return _this.waitForRegistrationToActivate_(registration).then(function () {\r\n _this.registrationToUse = registration;\r\n // We update after activation due to an issue with Firefox v49 where\r\n // a race condition occassionally causes the service worker to not\r\n // install\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n registration.update();\r\n return registration;\r\n });\r\n });\r\n };\r\n /**\r\n * This will return the default VAPID key or the uint8array version of the public VAPID key\r\n * provided by the developer.\r\n */\r\n WindowController.prototype.getPublicVapidKey_ = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n if (this.publicVapidKeyToUse) {\r\n return [2 /*return*/, this.publicVapidKeyToUse];\r\n }\r\n return [2 /*return*/, DEFAULT_PUBLIC_VAPID_KEY];\r\n });\r\n });\r\n };\r\n /**\r\n * This method will set up a message listener to handle\r\n * events from the service worker that should trigger\r\n * events in the page.\r\n */\r\n // Visible for testing\r\n // TODO: Make private\r\n WindowController.prototype.setupSWMessageListener_ = function () {\r\n var _this = this;\r\n navigator.serviceWorker.addEventListener('message', function (event) {\r\n if (!event.data || !event.data[MessageParameter.TYPE_OF_MSG]) {\r\n // Not a message from FCM\r\n return;\r\n }\r\n var workerPageMessage = event.data;\r\n switch (workerPageMessage[MessageParameter.TYPE_OF_MSG]) {\r\n case MessageType.PUSH_MSG_RECEIVED:\r\n case MessageType.NOTIFICATION_CLICKED:\r\n var pushMessage = workerPageMessage[MessageParameter.DATA];\r\n if (_this.messageObserver) {\r\n _this.messageObserver.next(pushMessage);\r\n }\r\n break;\r\n default:\r\n // Noop.\r\n break;\r\n }\r\n }, false);\r\n };\r\n return WindowController;\r\n}(BaseController));\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction registerMessaging(instance) {\r\n var messagingName = 'messaging';\r\n var factoryMethod = function (app) {\r\n if (!isSupported()) {\r\n throw errorFactory.create(\"unsupported-browser\" /* UNSUPPORTED_BROWSER */);\r\n }\r\n if (self && 'ServiceWorkerGlobalScope' in self) {\r\n // Running in ServiceWorker context\r\n return new SwController(app);\r\n }\r\n else {\r\n // Assume we are in the window context.\r\n return new WindowController(app);\r\n }\r\n };\r\n var namespaceExports = {\r\n isSupported: isSupported\r\n };\r\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\r\n}\r\nregisterMessaging(firebase);\r\nfunction isSupported() {\r\n if (self && 'ServiceWorkerGlobalScope' in self) {\r\n // Running in ServiceWorker context\r\n return isSWControllerSupported();\r\n }\r\n else {\r\n // Assume we are in the window context.\r\n return isWindowControllerSupported();\r\n }\r\n}\r\n/**\r\n * Checks to see if the required APIs exist.\r\n */\r\nfunction isWindowControllerSupported() {\r\n return (navigator.cookieEnabled &&\r\n 'serviceWorker' in navigator &&\r\n 'PushManager' in window &&\r\n 'Notification' in window &&\r\n 'fetch' in window &&\r\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\r\n PushSubscription.prototype.hasOwnProperty('getKey'));\r\n}\r\n/**\r\n * Checks to see if the required APIs exist within SW Context.\r\n */\r\nfunction isSWControllerSupported() {\r\n return ('PushManager' in self &&\r\n 'Notification' in self &&\r\n ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&\r\n PushSubscription.prototype.hasOwnProperty('getKey'));\r\n}\n\nexport { isSupported, registerMessaging };\n//# sourceMappingURL=index.esm.js.map\n","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * A container for all of the Logger instances\r\n */\r\nvar instances = [];\r\n/**\r\n * The JS SDK supports 5 log levels and also allows a user the ability to\r\n * silence the logs altogether.\r\n *\r\n * The order is a follows:\r\n * DEBUG < VERBOSE < INFO < WARN < ERROR\r\n *\r\n * All of the log types above the current log level will be captured (i.e. if\r\n * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and\r\n * `VERBOSE` logs will not)\r\n */\r\nvar LogLevel;\r\n(function (LogLevel) {\r\n LogLevel[LogLevel[\"DEBUG\"] = 0] = \"DEBUG\";\r\n LogLevel[LogLevel[\"VERBOSE\"] = 1] = \"VERBOSE\";\r\n LogLevel[LogLevel[\"INFO\"] = 2] = \"INFO\";\r\n LogLevel[LogLevel[\"WARN\"] = 3] = \"WARN\";\r\n LogLevel[LogLevel[\"ERROR\"] = 4] = \"ERROR\";\r\n LogLevel[LogLevel[\"SILENT\"] = 5] = \"SILENT\";\r\n})(LogLevel || (LogLevel = {}));\r\n/**\r\n * The default log level\r\n */\r\nvar defaultLogLevel = LogLevel.INFO;\r\n/**\r\n * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR\r\n * messages on to their corresponding console counterparts (if the log method\r\n * is supported by the current log level)\r\n */\r\nvar defaultLogHandler = function (instance, logType) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n if (logType < instance.logLevel) {\r\n return;\r\n }\r\n var now = new Date().toISOString();\r\n switch (logType) {\r\n /**\r\n * By default, `console.debug` is not displayed in the developer console (in\r\n * chrome). To avoid forcing users to have to opt-in to these logs twice\r\n * (i.e. once for firebase, and once in the console), we are sending `DEBUG`\r\n * logs to the `console.log` function.\r\n */\r\n case LogLevel.DEBUG:\r\n console.log.apply(console, [\"[\" + now + \"] \" + instance.name + \":\"].concat(args));\r\n break;\r\n case LogLevel.VERBOSE:\r\n console.log.apply(console, [\"[\" + now + \"] \" + instance.name + \":\"].concat(args));\r\n break;\r\n case LogLevel.INFO:\r\n console.info.apply(console, [\"[\" + now + \"] \" + instance.name + \":\"].concat(args));\r\n break;\r\n case LogLevel.WARN:\r\n console.warn.apply(console, [\"[\" + now + \"] \" + instance.name + \":\"].concat(args));\r\n break;\r\n case LogLevel.ERROR:\r\n console.error.apply(console, [\"[\" + now + \"] \" + instance.name + \":\"].concat(args));\r\n break;\r\n default:\r\n throw new Error(\"Attempted to log a message with an invalid logType (value: \" + logType + \")\");\r\n }\r\n};\r\nvar Logger = /** @class */ (function () {\r\n /**\r\n * Gives you an instance of a Logger to capture messages according to\r\n * Firebase's logging scheme.\r\n *\r\n * @param name The name that the logs will be associated with\r\n */\r\n function Logger(name) {\r\n this.name = name;\r\n /**\r\n * The log level of the given Logger instance.\r\n */\r\n this._logLevel = defaultLogLevel;\r\n /**\r\n * The log handler for the Logger instance.\r\n */\r\n this._logHandler = defaultLogHandler;\r\n /**\r\n * Capture the current instance for later use\r\n */\r\n instances.push(this);\r\n }\r\n Object.defineProperty(Logger.prototype, \"logLevel\", {\r\n get: function () {\r\n return this._logLevel;\r\n },\r\n set: function (val) {\r\n if (!(val in LogLevel)) {\r\n throw new TypeError('Invalid value assigned to `logLevel`');\r\n }\r\n this._logLevel = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(Logger.prototype, \"logHandler\", {\r\n get: function () {\r\n return this._logHandler;\r\n },\r\n set: function (val) {\r\n if (typeof val !== 'function') {\r\n throw new TypeError('Value assigned to `logHandler` must be a function');\r\n }\r\n this._logHandler = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * The functions below are all based on the `console` interface\r\n */\r\n Logger.prototype.debug = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n this._logHandler.apply(this, [this, LogLevel.DEBUG].concat(args));\r\n };\r\n Logger.prototype.log = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n this._logHandler.apply(this, [this, LogLevel.VERBOSE].concat(args));\r\n };\r\n Logger.prototype.info = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n this._logHandler.apply(this, [this, LogLevel.INFO].concat(args));\r\n };\r\n Logger.prototype.warn = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n this._logHandler.apply(this, [this, LogLevel.WARN].concat(args));\r\n };\r\n Logger.prototype.error = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n this._logHandler.apply(this, [this, LogLevel.ERROR].concat(args));\r\n };\r\n return Logger;\r\n}());\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction setLogLevel(level) {\r\n instances.forEach(function (inst) {\r\n inst.logLevel = level;\r\n });\r\n}\n\nexport { LogLevel, Logger, setLogLevel };\n//# sourceMappingURL=index.esm.js.map\n","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar tslib_1 = require('tslib');\nvar util = require('@firebase/util');\nvar logger$1 = require('@firebase/logger');\n\n/**\r\n * @license\r\n * Copyright 2019 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar _a;\r\nvar ERRORS = (_a = {},\r\n _a[\"no-app\" /* NO_APP */] = \"No Firebase App '{$appName}' has been created - \" +\r\n 'call Firebase App.initializeApp()',\r\n _a[\"bad-app-name\" /* BAD_APP_NAME */] = \"Illegal App name: '{$appName}\",\r\n _a[\"duplicate-app\" /* DUPLICATE_APP */] = \"Firebase App named '{$appName}' already exists\",\r\n _a[\"app-deleted\" /* APP_DELETED */] = \"Firebase App named '{$appName}' already deleted\",\r\n _a[\"invalid-app-argument\" /* INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' +\r\n 'Firebase App instance.',\r\n _a);\r\nvar ERROR_FACTORY = new util.ErrorFactory('app', 'Firebase', ERRORS);\n\n/**\r\n * @license\r\n * Copyright 2019 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar DEFAULT_ENTRY_NAME = '[DEFAULT]';\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// An array to capture listeners before the true auth functions\r\n// exist\r\nvar tokenListeners = [];\r\n/**\r\n * Global context object for a collection of services using\r\n * a shared authentication state.\r\n */\r\nvar FirebaseAppImpl = /** @class */ (function () {\r\n function FirebaseAppImpl(options, config, firebase_) {\r\n this.firebase_ = firebase_;\r\n this.isDeleted_ = false;\r\n this.services_ = {};\r\n this.name_ = config.name;\r\n this.automaticDataCollectionEnabled_ =\r\n config.automaticDataCollectionEnabled || false;\r\n this.options_ = util.deepCopy(options);\r\n this.INTERNAL = {\r\n getUid: function () { return null; },\r\n getToken: function () { return Promise.resolve(null); },\r\n addAuthTokenListener: function (callback) {\r\n tokenListeners.push(callback);\r\n // Make sure callback is called, asynchronously, in the absence of the auth module\r\n setTimeout(function () { return callback(null); }, 0);\r\n },\r\n removeAuthTokenListener: function (callback) {\r\n tokenListeners = tokenListeners.filter(function (listener) { return listener !== callback; });\r\n }\r\n };\r\n }\r\n Object.defineProperty(FirebaseAppImpl.prototype, \"automaticDataCollectionEnabled\", {\r\n get: function () {\r\n this.checkDestroyed_();\r\n return this.automaticDataCollectionEnabled_;\r\n },\r\n set: function (val) {\r\n this.checkDestroyed_();\r\n this.automaticDataCollectionEnabled_ = val;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FirebaseAppImpl.prototype, \"name\", {\r\n get: function () {\r\n this.checkDestroyed_();\r\n return this.name_;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(FirebaseAppImpl.prototype, \"options\", {\r\n get: function () {\r\n this.checkDestroyed_();\r\n return this.options_;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n FirebaseAppImpl.prototype.delete = function () {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.checkDestroyed_();\r\n resolve();\r\n })\r\n .then(function () {\r\n _this.firebase_.INTERNAL.removeApp(_this.name_);\r\n var services = [];\r\n for (var _i = 0, _a = Object.keys(_this.services_); _i < _a.length; _i++) {\r\n var serviceKey = _a[_i];\r\n for (var _b = 0, _c = Object.keys(_this.services_[serviceKey]); _b < _c.length; _b++) {\r\n var instanceKey = _c[_b];\r\n services.push(_this.services_[serviceKey][instanceKey]);\r\n }\r\n }\r\n return Promise.all(services\r\n .filter(function (service) { return 'INTERNAL' in service; })\r\n .map(function (service) { return service.INTERNAL.delete(); }));\r\n })\r\n .then(function () {\r\n _this.isDeleted_ = true;\r\n _this.services_ = {};\r\n });\r\n };\r\n /**\r\n * Return a service instance associated with this app (creating it\r\n * on demand), identified by the passed instanceIdentifier.\r\n *\r\n * NOTE: Currently storage and functions are the only ones that are leveraging this\r\n * functionality. They invoke it by calling:\r\n *\r\n * ```javascript\r\n * firebase.app().storage('STORAGE BUCKET ID')\r\n * ```\r\n *\r\n * The service name is passed to this already\r\n * @internal\r\n */\r\n FirebaseAppImpl.prototype._getService = function (name, instanceIdentifier) {\r\n if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }\r\n this.checkDestroyed_();\r\n if (!this.services_[name]) {\r\n this.services_[name] = {};\r\n }\r\n if (!this.services_[name][instanceIdentifier]) {\r\n /**\r\n * If a custom instance has been defined (i.e. not '[DEFAULT]')\r\n * then we will pass that instance on, otherwise we pass `null`\r\n */\r\n var instanceSpecifier = instanceIdentifier !== DEFAULT_ENTRY_NAME\r\n ? instanceIdentifier\r\n : undefined;\r\n var service = this.firebase_.INTERNAL.factories[name](this, this.extendApp.bind(this), instanceSpecifier);\r\n this.services_[name][instanceIdentifier] = service;\r\n }\r\n return this.services_[name][instanceIdentifier];\r\n };\r\n /**\r\n * Remove a service instance from the cache, so we will create a new instance for this service\r\n * when people try to get this service again.\r\n *\r\n * NOTE: currently only firestore is using this functionality to support firestore shutdown.\r\n *\r\n * @param name The service name\r\n * @param instanceIdentifier instance identifier in case multiple instances are allowed\r\n * @internal\r\n */\r\n FirebaseAppImpl.prototype._removeServiceInstance = function (name, instanceIdentifier) {\r\n if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }\r\n if (this.services_[name] && this.services_[name][instanceIdentifier]) {\r\n delete this.services_[name][instanceIdentifier];\r\n }\r\n };\r\n /**\r\n * Callback function used to extend an App instance at the time\r\n * of service instance creation.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n FirebaseAppImpl.prototype.extendApp = function (props) {\r\n var _this = this;\r\n // Copy the object onto the FirebaseAppImpl prototype\r\n util.deepExtend(this, props);\r\n /**\r\n * If the app has overwritten the addAuthTokenListener stub, forward\r\n * the active token listeners on to the true fxn.\r\n *\r\n * TODO: This function is required due to our current module\r\n * structure. Once we are able to rely strictly upon a single module\r\n * implementation, this code should be refactored and Auth should\r\n * provide these stubs and the upgrade logic\r\n */\r\n if (props.INTERNAL && props.INTERNAL.addAuthTokenListener) {\r\n tokenListeners.forEach(function (listener) {\r\n _this.INTERNAL.addAuthTokenListener(listener);\r\n });\r\n tokenListeners = [];\r\n }\r\n };\r\n /**\r\n * This function will throw an Error if the App has already been deleted -\r\n * use before performing API actions on the App.\r\n */\r\n FirebaseAppImpl.prototype.checkDestroyed_ = function () {\r\n if (this.isDeleted_) {\r\n throw ERROR_FACTORY.create(\"app-deleted\" /* APP_DELETED */, { appName: this.name_ });\r\n }\r\n };\r\n return FirebaseAppImpl;\r\n}());\r\n// Prevent dead-code elimination of these methods w/o invalid property\r\n// copying.\r\n(FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||\r\n FirebaseAppImpl.prototype.delete ||\r\n console.log('dc');\n\nvar version = \"6.6.2\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar logger = new logger$1.Logger('@firebase/app');\n\n/**\r\n * @license\r\n * Copyright 2019 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Because auth can't share code with other components, we attach the utility functions\r\n * in an internal namespace to share code.\r\n * This function return a firebase namespace object without\r\n * any utility functions, so it can be shared between the regular firebaseNamespace and\r\n * the lite version.\r\n */\r\nfunction createFirebaseNamespaceCore(firebaseAppImpl) {\r\n var apps = {};\r\n var factories = {};\r\n var appHooks = {};\r\n // A namespace is a plain JavaScript Object.\r\n var namespace = {\r\n // Hack to prevent Babel from modifying the object returned\r\n // as the firebase namespace.\r\n // @ts-ignore\r\n __esModule: true,\r\n initializeApp: initializeApp,\r\n // @ts-ignore\r\n app: app,\r\n // @ts-ignore\r\n apps: null,\r\n SDK_VERSION: version,\r\n INTERNAL: {\r\n registerService: registerService,\r\n removeApp: removeApp,\r\n factories: factories,\r\n useAsService: useAsService\r\n }\r\n };\r\n // Inject a circular default export to allow Babel users who were previously\r\n // using:\r\n //\r\n // import firebase from 'firebase';\r\n // which becomes: var firebase = require('firebase').default;\r\n //\r\n // instead of\r\n //\r\n // import * as firebase from 'firebase';\r\n // which becomes: var firebase = require('firebase');\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n namespace['default'] = namespace;\r\n // firebase.apps is a read-only getter.\r\n Object.defineProperty(namespace, 'apps', {\r\n get: getApps\r\n });\r\n /**\r\n * Called by App.delete() - but before any services associated with the App\r\n * are deleted.\r\n */\r\n function removeApp(name) {\r\n var app = apps[name];\r\n callAppHooks(app, 'delete');\r\n delete apps[name];\r\n }\r\n /**\r\n * Get the App object for a given name (or DEFAULT).\r\n */\r\n function app(name) {\r\n name = name || DEFAULT_ENTRY_NAME;\r\n if (!util.contains(apps, name)) {\r\n throw ERROR_FACTORY.create(\"no-app\" /* NO_APP */, { appName: name });\r\n }\r\n return apps[name];\r\n }\r\n // @ts-ignore\r\n app['App'] = firebaseAppImpl;\r\n function initializeApp(options, rawConfig) {\r\n if (rawConfig === void 0) { rawConfig = {}; }\r\n if (typeof rawConfig !== 'object' || rawConfig === null) {\r\n var name_1 = rawConfig;\r\n rawConfig = { name: name_1 };\r\n }\r\n var config = rawConfig;\r\n if (config.name === undefined) {\r\n config.name = DEFAULT_ENTRY_NAME;\r\n }\r\n var name = config.name;\r\n if (typeof name !== 'string' || !name) {\r\n throw ERROR_FACTORY.create(\"bad-app-name\" /* BAD_APP_NAME */, {\r\n appName: String(name)\r\n });\r\n }\r\n if (util.contains(apps, name)) {\r\n throw ERROR_FACTORY.create(\"duplicate-app\" /* DUPLICATE_APP */, { appName: name });\r\n }\r\n var app = new firebaseAppImpl(options, config, namespace);\r\n apps[name] = app;\r\n callAppHooks(app, 'create');\r\n return app;\r\n }\r\n /*\r\n * Return an array of all the non-deleted FirebaseApps.\r\n */\r\n function getApps() {\r\n // Make a copy so caller cannot mutate the apps list.\r\n return Object.keys(apps).map(function (name) { return apps[name]; });\r\n }\r\n /*\r\n * Register a Firebase Service.\r\n *\r\n * firebase.INTERNAL.registerService()\r\n *\r\n * TODO: Implement serviceProperties.\r\n */\r\n function registerService(name, createService, serviceProperties, appHook, allowMultipleInstances) {\r\n if (allowMultipleInstances === void 0) { allowMultipleInstances = false; }\r\n // If re-registering a service that already exists, return existing service\r\n if (factories[name]) {\r\n logger.debug(\"There were multiple attempts to register service \" + name + \".\");\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n return namespace[name];\r\n }\r\n // Capture the service factory for later service instantiation\r\n factories[name] = createService;\r\n // Capture the appHook, if passed\r\n if (appHook) {\r\n appHooks[name] = appHook;\r\n // Run the **new** app hook on all existing apps\r\n getApps().forEach(function (app) {\r\n appHook('create', app);\r\n });\r\n }\r\n // The Service namespace is an accessor function ...\r\n function serviceNamespace(appArg) {\r\n if (appArg === void 0) { appArg = app(); }\r\n // @ts-ignore\r\n if (typeof appArg[name] !== 'function') {\r\n // Invalid argument.\r\n // This happens in the following case: firebase.storage('gs:/')\r\n throw ERROR_FACTORY.create(\"invalid-app-argument\" /* INVALID_APP_ARGUMENT */, {\r\n appName: name\r\n });\r\n }\r\n // Forward service instance lookup to the FirebaseApp.\r\n // @ts-ignore\r\n return appArg[name]();\r\n }\r\n // ... and a container for service-level properties.\r\n if (serviceProperties !== undefined) {\r\n util.deepExtend(serviceNamespace, serviceProperties);\r\n }\r\n // Monkey-patch the serviceNamespace onto the firebase namespace\r\n // @ts-ignore\r\n namespace[name] = serviceNamespace;\r\n // Patch the FirebaseAppImpl prototype\r\n // @ts-ignore\r\n firebaseAppImpl.prototype[name] =\r\n // TODO: The eslint disable can be removed and the 'ignoreRestArgs'\r\n // option added to the no-explicit-any rule when ESlint releases it.\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var serviceFxn = this._getService.bind(this, name);\r\n return serviceFxn.apply(this, allowMultipleInstances ? args : []);\r\n };\r\n return serviceNamespace;\r\n }\r\n function callAppHooks(app, eventName) {\r\n for (var _i = 0, _a = Object.keys(factories); _i < _a.length; _i++) {\r\n var serviceName = _a[_i];\r\n // Ignore virtual services\r\n var factoryName = useAsService(app, serviceName);\r\n if (factoryName === null) {\r\n return;\r\n }\r\n if (appHooks[factoryName]) {\r\n appHooks[factoryName](eventName, app);\r\n }\r\n }\r\n }\r\n // Map the requested service to a registered service name\r\n // (used to map auth to serverAuth service when needed).\r\n function useAsService(app, name) {\r\n if (name === 'serverAuth') {\r\n return null;\r\n }\r\n var useService = name;\r\n return useService;\r\n }\r\n return namespace;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Return a firebase namespace object.\r\n *\r\n * In production, this will be called exactly once and the result\r\n * assigned to the 'firebase' global. It may be called multiple times\r\n * in unit tests.\r\n */\r\nfunction createFirebaseNamespace() {\r\n var namespace = createFirebaseNamespaceCore(FirebaseAppImpl);\r\n namespace.INTERNAL = tslib_1.__assign({}, namespace.INTERNAL, { createFirebaseNamespace: createFirebaseNamespace,\r\n extendNamespace: extendNamespace,\r\n createSubscribe: util.createSubscribe,\r\n ErrorFactory: util.ErrorFactory,\r\n deepExtend: util.deepExtend });\r\n /**\r\n * Patch the top-level firebase namespace with additional properties.\r\n *\r\n * firebase.INTERNAL.extendNamespace()\r\n */\r\n function extendNamespace(props) {\r\n util.deepExtend(namespace, props);\r\n }\r\n return namespace;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// Firebase Lite detection\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nif (util.isBrowser() && self.firebase !== undefined) {\r\n logger.warn(\"\\n Warning: Firebase is already defined in the global scope. Please make sure\\n Firebase library is only loaded once.\\n \");\r\n // eslint-disable-next-line\r\n var sdkVersion = self.firebase.SDK_VERSION;\r\n if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {\r\n logger.warn(\"\\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\\n \");\r\n }\r\n}\r\nvar firebaseNamespace = createFirebaseNamespace();\r\nvar initializeApp = firebaseNamespace.initializeApp;\r\n// TODO: This disable can be removed and the 'ignoreRestArgs' option added to\r\n// the no-explicit-any rule when ESlint releases it.\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nfirebaseNamespace.initializeApp = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n // Environment check before initializing app\r\n // Do the check in initializeApp, so people have a chance to disable it by setting logLevel\r\n // in @firebase/logger\r\n if (util.isNode()) {\r\n logger.warn(\"\\n Warning: This is a browser-targeted Firebase bundle but it appears it is being\\n run in a Node environment. If running in a Node environment, make sure you\\n are using the bundle specified by the \\\"main\\\" field in package.json.\\n \\n If you are using Webpack, you can specify \\\"main\\\" as the first item in\\n \\\"resolve.mainFields\\\":\\n https://webpack.js.org/configuration/resolve/#resolvemainfields\\n \\n If using Rollup, use the rollup-plugin-node-resolve plugin and specify \\\"main\\\"\\n as the first item in \\\"mainFields\\\", e.g. ['main', 'module'].\\n https://github.com/rollup/rollup-plugin-node-resolve\\n \");\r\n }\r\n return initializeApp.apply(undefined, args);\r\n};\r\nvar firebase = firebaseNamespace;\n\nexports.default = firebase;\nexports.firebase = firebase;\n//# sourceMappingURL=index.cjs.js.map\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar tslib_1 = require('tslib');\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * @fileoverview Firebase constants. Some of these (@defines) can be overridden at compile-time.\r\n */\r\nvar CONSTANTS = {\r\n /**\r\n * @define {boolean} Whether this is the client Node.js SDK.\r\n */\r\n NODE_CLIENT: false,\r\n /**\r\n * @define {boolean} Whether this is the Admin Node.js SDK.\r\n */\r\n NODE_ADMIN: false,\r\n /**\r\n * Firebase SDK Version\r\n */\r\n SDK_VERSION: '${JSCORE_VERSION}'\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Throws an error if the provided assertion is falsy\r\n */\r\nvar assert = function (assertion, message) {\r\n if (!assertion) {\r\n throw assertionError(message);\r\n }\r\n};\r\n/**\r\n * Returns an Error object suitable for throwing.\r\n */\r\nvar assertionError = function (message) {\r\n return new Error('Firebase Database (' +\r\n CONSTANTS.SDK_VERSION +\r\n ') INTERNAL ASSERT FAILED: ' +\r\n message);\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar stringToByteArray = function (str) {\r\n // TODO(user): Use native implementations if/when available\r\n var out = [];\r\n var p = 0;\r\n for (var i = 0; i < str.length; i++) {\r\n var c = str.charCodeAt(i);\r\n if (c < 128) {\r\n out[p++] = c;\r\n }\r\n else if (c < 2048) {\r\n out[p++] = (c >> 6) | 192;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else if ((c & 0xfc00) === 0xd800 &&\r\n i + 1 < str.length &&\r\n (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00) {\r\n // Surrogate Pair\r\n c = 0x10000 + ((c & 0x03ff) << 10) + (str.charCodeAt(++i) & 0x03ff);\r\n out[p++] = (c >> 18) | 240;\r\n out[p++] = ((c >> 12) & 63) | 128;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else {\r\n out[p++] = (c >> 12) | 224;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n }\r\n return out;\r\n};\r\n/**\r\n * Turns an array of numbers into the string given by the concatenation of the\r\n * characters to which the numbers correspond.\r\n * @param bytes Array of numbers representing characters.\r\n * @return Stringification of the array.\r\n */\r\nvar byteArrayToString = function (bytes) {\r\n // TODO(user): Use native implementations if/when available\r\n var out = [];\r\n var pos = 0, c = 0;\r\n while (pos < bytes.length) {\r\n var c1 = bytes[pos++];\r\n if (c1 < 128) {\r\n out[c++] = String.fromCharCode(c1);\r\n }\r\n else if (c1 > 191 && c1 < 224) {\r\n var c2 = bytes[pos++];\r\n out[c++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));\r\n }\r\n else if (c1 > 239 && c1 < 365) {\r\n // Surrogate Pair\r\n var c2 = bytes[pos++];\r\n var c3 = bytes[pos++];\r\n var c4 = bytes[pos++];\r\n var u = (((c1 & 7) << 18) | ((c2 & 63) << 12) | ((c3 & 63) << 6) | (c4 & 63)) -\r\n 0x10000;\r\n out[c++] = String.fromCharCode(0xd800 + (u >> 10));\r\n out[c++] = String.fromCharCode(0xdc00 + (u & 1023));\r\n }\r\n else {\r\n var c2 = bytes[pos++];\r\n var c3 = bytes[pos++];\r\n out[c++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\r\n }\r\n }\r\n return out.join('');\r\n};\r\n// We define it as an object literal instead of a class because a class compiled down to es5 can't\r\n// be treeshaked. https://github.com/rollup/rollup/issues/1691\r\n// Static lookup maps, lazily populated by init_()\r\nvar base64 = {\r\n /**\r\n * Maps bytes to characters.\r\n */\r\n byteToCharMap_: null,\r\n /**\r\n * Maps characters to bytes.\r\n */\r\n charToByteMap_: null,\r\n /**\r\n * Maps bytes to websafe characters.\r\n * @private\r\n */\r\n byteToCharMapWebSafe_: null,\r\n /**\r\n * Maps websafe characters to bytes.\r\n * @private\r\n */\r\n charToByteMapWebSafe_: null,\r\n /**\r\n * Our default alphabet, shared between\r\n * ENCODED_VALS and ENCODED_VALS_WEBSAFE\r\n */\r\n ENCODED_VALS_BASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + 'abcdefghijklmnopqrstuvwxyz' + '0123456789',\r\n /**\r\n * Our default alphabet. Value 64 (=) is special; it means \"nothing.\"\r\n */\r\n get ENCODED_VALS() {\r\n return this.ENCODED_VALS_BASE + '+/=';\r\n },\r\n /**\r\n * Our websafe alphabet.\r\n */\r\n get ENCODED_VALS_WEBSAFE() {\r\n return this.ENCODED_VALS_BASE + '-_.';\r\n },\r\n /**\r\n * Whether this browser supports the atob and btoa functions. This extension\r\n * started at Mozilla but is now implemented by many browsers. We use the\r\n * ASSUME_* variables to avoid pulling in the full useragent detection library\r\n * but still allowing the standard per-browser compilations.\r\n *\r\n */\r\n HAS_NATIVE_SUPPORT: typeof atob === 'function',\r\n /**\r\n * Base64-encode an array of bytes.\r\n *\r\n * @param input An array of bytes (numbers with\r\n * value in [0, 255]) to encode.\r\n * @param webSafe Boolean indicating we should use the\r\n * alternative alphabet.\r\n * @return The base64 encoded string.\r\n */\r\n encodeByteArray: function (input, webSafe) {\r\n if (!Array.isArray(input)) {\r\n throw Error('encodeByteArray takes an array as a parameter');\r\n }\r\n this.init_();\r\n var byteToCharMap = webSafe\r\n ? this.byteToCharMapWebSafe_\r\n : this.byteToCharMap_;\r\n var output = [];\r\n for (var i = 0; i < input.length; i += 3) {\r\n var byte1 = input[i];\r\n var haveByte2 = i + 1 < input.length;\r\n var byte2 = haveByte2 ? input[i + 1] : 0;\r\n var haveByte3 = i + 2 < input.length;\r\n var byte3 = haveByte3 ? input[i + 2] : 0;\r\n var outByte1 = byte1 >> 2;\r\n var outByte2 = ((byte1 & 0x03) << 4) | (byte2 >> 4);\r\n var outByte3 = ((byte2 & 0x0f) << 2) | (byte3 >> 6);\r\n var outByte4 = byte3 & 0x3f;\r\n if (!haveByte3) {\r\n outByte4 = 64;\r\n if (!haveByte2) {\r\n outByte3 = 64;\r\n }\r\n }\r\n output.push(byteToCharMap[outByte1], byteToCharMap[outByte2], byteToCharMap[outByte3], byteToCharMap[outByte4]);\r\n }\r\n return output.join('');\r\n },\r\n /**\r\n * Base64-encode a string.\r\n *\r\n * @param input A string to encode.\r\n * @param webSafe If true, we should use the\r\n * alternative alphabet.\r\n * @return The base64 encoded string.\r\n */\r\n encodeString: function (input, webSafe) {\r\n // Shortcut for Mozilla browsers that implement\r\n // a native base64 encoder in the form of \"btoa/atob\"\r\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\r\n return btoa(input);\r\n }\r\n return this.encodeByteArray(stringToByteArray(input), webSafe);\r\n },\r\n /**\r\n * Base64-decode a string.\r\n *\r\n * @param input to decode.\r\n * @param webSafe True if we should use the\r\n * alternative alphabet.\r\n * @return string representing the decoded value.\r\n */\r\n decodeString: function (input, webSafe) {\r\n // Shortcut for Mozilla browsers that implement\r\n // a native base64 encoder in the form of \"btoa/atob\"\r\n if (this.HAS_NATIVE_SUPPORT && !webSafe) {\r\n return atob(input);\r\n }\r\n return byteArrayToString(this.decodeStringToByteArray(input, webSafe));\r\n },\r\n /**\r\n * Base64-decode a string.\r\n *\r\n * In base-64 decoding, groups of four characters are converted into three\r\n * bytes. If the encoder did not apply padding, the input length may not\r\n * be a multiple of 4.\r\n *\r\n * In this case, the last group will have fewer than 4 characters, and\r\n * padding will be inferred. If the group has one or two characters, it decodes\r\n * to one byte. If the group has three characters, it decodes to two bytes.\r\n *\r\n * @param input Input to decode.\r\n * @param webSafe True if we should use the web-safe alphabet.\r\n * @return bytes representing the decoded value.\r\n */\r\n decodeStringToByteArray: function (input, webSafe) {\r\n this.init_();\r\n var charToByteMap = webSafe\r\n ? this.charToByteMapWebSafe_\r\n : this.charToByteMap_;\r\n var output = [];\r\n for (var i = 0; i < input.length;) {\r\n var byte1 = charToByteMap[input.charAt(i++)];\r\n var haveByte2 = i < input.length;\r\n var byte2 = haveByte2 ? charToByteMap[input.charAt(i)] : 0;\r\n ++i;\r\n var haveByte3 = i < input.length;\r\n var byte3 = haveByte3 ? charToByteMap[input.charAt(i)] : 64;\r\n ++i;\r\n var haveByte4 = i < input.length;\r\n var byte4 = haveByte4 ? charToByteMap[input.charAt(i)] : 64;\r\n ++i;\r\n if (byte1 == null || byte2 == null || byte3 == null || byte4 == null) {\r\n throw Error();\r\n }\r\n var outByte1 = (byte1 << 2) | (byte2 >> 4);\r\n output.push(outByte1);\r\n if (byte3 !== 64) {\r\n var outByte2 = ((byte2 << 4) & 0xf0) | (byte3 >> 2);\r\n output.push(outByte2);\r\n if (byte4 !== 64) {\r\n var outByte3 = ((byte3 << 6) & 0xc0) | byte4;\r\n output.push(outByte3);\r\n }\r\n }\r\n }\r\n return output;\r\n },\r\n /**\r\n * Lazy static initialization function. Called before\r\n * accessing any of the static map variables.\r\n * @private\r\n */\r\n init_: function () {\r\n if (!this.byteToCharMap_) {\r\n this.byteToCharMap_ = {};\r\n this.charToByteMap_ = {};\r\n this.byteToCharMapWebSafe_ = {};\r\n this.charToByteMapWebSafe_ = {};\r\n // We want quick mappings back and forth, so we precompute two maps.\r\n for (var i = 0; i < this.ENCODED_VALS.length; i++) {\r\n this.byteToCharMap_[i] = this.ENCODED_VALS.charAt(i);\r\n this.charToByteMap_[this.byteToCharMap_[i]] = i;\r\n this.byteToCharMapWebSafe_[i] = this.ENCODED_VALS_WEBSAFE.charAt(i);\r\n this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[i]] = i;\r\n // Be forgiving when decoding and correctly decode both encodings.\r\n if (i >= this.ENCODED_VALS_BASE.length) {\r\n this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(i)] = i;\r\n this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(i)] = i;\r\n }\r\n }\r\n }\r\n }\r\n};\r\n/**\r\n * URL-safe base64 encoding\r\n */\r\nvar base64Encode = function (str) {\r\n var utf8Bytes = stringToByteArray(str);\r\n return base64.encodeByteArray(utf8Bytes, true);\r\n};\r\n/**\r\n * URL-safe base64 decoding\r\n *\r\n * NOTE: DO NOT use the global atob() function - it does NOT support the\r\n * base64Url variant encoding.\r\n *\r\n * @param str To be decoded\r\n * @return Decoded result, if possible\r\n */\r\nvar base64Decode = function (str) {\r\n try {\r\n return base64.decodeString(str, true);\r\n }\r\n catch (e) {\r\n console.error('base64Decode failed: ', e);\r\n }\r\n return null;\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Do a deep-copy of basic JavaScript Objects or Arrays.\r\n */\r\nfunction deepCopy(value) {\r\n return deepExtend(undefined, value);\r\n}\r\n/**\r\n * Copy properties from source to target (recursively allows extension\r\n * of Objects and Arrays). Scalar values in the target are over-written.\r\n * If target is undefined, an object of the appropriate type will be created\r\n * (and returned).\r\n *\r\n * We recursively copy all child properties of plain Objects in the source- so\r\n * that namespace- like dictionaries are merged.\r\n *\r\n * Note that the target can be a function, in which case the properties in\r\n * the source Object are copied onto it as static properties of the Function.\r\n */\r\nfunction deepExtend(target, source) {\r\n if (!(source instanceof Object)) {\r\n return source;\r\n }\r\n switch (source.constructor) {\r\n case Date:\r\n // Treat Dates like scalars; if the target date object had any child\r\n // properties - they will be lost!\r\n var dateValue = source;\r\n return new Date(dateValue.getTime());\r\n case Object:\r\n if (target === undefined) {\r\n target = {};\r\n }\r\n break;\r\n case Array:\r\n // Always copy the array source and overwrite the target.\r\n target = [];\r\n break;\r\n default:\r\n // Not a plain Object - treat it as a scalar.\r\n return source;\r\n }\r\n for (var prop in source) {\r\n if (!source.hasOwnProperty(prop)) {\r\n continue;\r\n }\r\n target[prop] = deepExtend(target[prop], source[prop]);\r\n }\r\n return target;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar Deferred = /** @class */ (function () {\r\n function Deferred() {\r\n var _this = this;\r\n this.reject = function () { };\r\n this.resolve = function () { };\r\n this.promise = new Promise(function (resolve, reject) {\r\n _this.resolve = resolve;\r\n _this.reject = reject;\r\n });\r\n }\r\n /**\r\n * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around\r\n * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback\r\n * and returns a node-style callback which will resolve or reject the Deferred's promise.\r\n */\r\n Deferred.prototype.wrapCallback = function (callback) {\r\n var _this = this;\r\n return function (error, value) {\r\n if (error) {\r\n _this.reject(error);\r\n }\r\n else {\r\n _this.resolve(value);\r\n }\r\n if (typeof callback === 'function') {\r\n // Attaching noop handler just in case developer wasn't expecting\r\n // promises\r\n _this.promise.catch(function () { });\r\n // Some of our callbacks don't expect a value and our own tests\r\n // assert that the parameter length is 1\r\n if (callback.length === 1) {\r\n callback(error);\r\n }\r\n else {\r\n callback(error, value);\r\n }\r\n }\r\n };\r\n };\r\n return Deferred;\r\n}());\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns navigator.userAgent string or '' if it's not defined.\r\n * @return user agent string\r\n */\r\nfunction getUA() {\r\n if (typeof navigator !== 'undefined' &&\r\n typeof navigator['userAgent'] === 'string') {\r\n return navigator['userAgent'];\r\n }\r\n else {\r\n return '';\r\n }\r\n}\r\n/**\r\n * Detect Cordova / PhoneGap / Ionic frameworks on a mobile device.\r\n *\r\n * Deliberately does not rely on checking `file://` URLs (as this fails PhoneGap\r\n * in the Ripple emulator) nor Cordova `onDeviceReady`, which would normally\r\n * wait for a callback.\r\n */\r\nfunction isMobileCordova() {\r\n return (typeof window !== 'undefined' &&\r\n // @ts-ignore Setting up an broadly applicable index signature for Window\r\n // just to deal with this case would probably be a bad idea.\r\n !!(window['cordova'] || window['phonegap'] || window['PhoneGap']) &&\r\n /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA()));\r\n}\r\n/**\r\n * Detect Node.js.\r\n *\r\n * @return true if Node.js environment is detected.\r\n */\r\n// Node detection logic from: https://github.com/iliakan/detect-node/\r\nfunction isNode() {\r\n try {\r\n return (Object.prototype.toString.call(global.process) === '[object process]');\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n}\r\n/**\r\n * Detect Browser Environment\r\n */\r\nfunction isBrowser() {\r\n return typeof self === 'object' && self.self === self;\r\n}\r\n/**\r\n * Detect React Native.\r\n *\r\n * @return true if ReactNative environment is detected.\r\n */\r\nfunction isReactNative() {\r\n return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');\r\n}\r\n/**\r\n * Detect whether the current SDK build is the Node version.\r\n *\r\n * @return true if it's the Node SDK build.\r\n */\r\nfunction isNodeSdk() {\r\n return CONSTANTS.NODE_CLIENT === true || CONSTANTS.NODE_ADMIN === true;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nvar ERROR_NAME = 'FirebaseError';\r\n// Based on code from:\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types\r\nvar FirebaseError = /** @class */ (function (_super) {\r\n tslib_1.__extends(FirebaseError, _super);\r\n function FirebaseError(code, message) {\r\n var _this = _super.call(this, message) || this;\r\n _this.code = code;\r\n _this.name = ERROR_NAME;\r\n // Fix For ES5\r\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n Object.setPrototypeOf(_this, FirebaseError.prototype);\r\n // Maintains proper stack trace for where our error was thrown.\r\n // Only available on V8.\r\n if (Error.captureStackTrace) {\r\n Error.captureStackTrace(_this, ErrorFactory.prototype.create);\r\n }\r\n return _this;\r\n }\r\n return FirebaseError;\r\n}(Error));\r\nvar ErrorFactory = /** @class */ (function () {\r\n function ErrorFactory(service, serviceName, errors) {\r\n this.service = service;\r\n this.serviceName = serviceName;\r\n this.errors = errors;\r\n }\r\n ErrorFactory.prototype.create = function (code) {\r\n var data = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n data[_i - 1] = arguments[_i];\r\n }\r\n var customData = data[0] || {};\r\n var fullCode = this.service + \"/\" + code;\r\n var template = this.errors[code];\r\n var message = template ? replaceTemplate(template, customData) : 'Error';\r\n // Service Name: Error message (service/code).\r\n var fullMessage = this.serviceName + \": \" + message + \" (\" + fullCode + \").\";\r\n var error = new FirebaseError(fullCode, fullMessage);\r\n // Keys with an underscore at the end of their name are not included in\r\n // error.data for some reason.\r\n // TODO: Replace with Object.entries when lib is updated to es2017.\r\n for (var _a = 0, _b = Object.keys(customData); _a < _b.length; _a++) {\r\n var key = _b[_a];\r\n if (key.slice(-1) !== '_') {\r\n if (key in error) {\r\n console.warn(\"Overwriting FirebaseError base field \\\"\" + key + \"\\\" can cause unexpected behavior.\");\r\n }\r\n error[key] = customData[key];\r\n }\r\n }\r\n return error;\r\n };\r\n return ErrorFactory;\r\n}());\r\nfunction replaceTemplate(template, data) {\r\n return template.replace(PATTERN, function (_, key) {\r\n var value = data[key];\r\n return value != null ? value.toString() : \"<\" + key + \"?>\";\r\n });\r\n}\r\nvar PATTERN = /\\{\\$([^}]+)}/g;\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Evaluates a JSON string into a javascript object.\r\n *\r\n * @param {string} str A string containing JSON.\r\n * @return {*} The javascript object representing the specified JSON.\r\n */\r\nfunction jsonEval(str) {\r\n return JSON.parse(str);\r\n}\r\n/**\r\n * Returns JSON representing a javascript object.\r\n * @param {*} data Javascript object to be stringified.\r\n * @return {string} The JSON contents of the object.\r\n */\r\nfunction stringify(data) {\r\n return JSON.stringify(data);\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Decodes a Firebase auth. token into constituent parts.\r\n *\r\n * Notes:\r\n * - May return with invalid / incomplete claims if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nvar decode = function (token) {\r\n var header = {}, claims = {}, data = {}, signature = '';\r\n try {\r\n var parts = token.split('.');\r\n header = jsonEval(base64Decode(parts[0]) || '');\r\n claims = jsonEval(base64Decode(parts[1]) || '');\r\n signature = parts[2];\r\n data = claims['d'] || {};\r\n delete claims['d'];\r\n }\r\n catch (e) { }\r\n return {\r\n header: header,\r\n claims: claims,\r\n data: data,\r\n signature: signature\r\n };\r\n};\r\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the\r\n * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nvar isValidTimestamp = function (token) {\r\n var claims = decode(token).claims;\r\n var now = Math.floor(new Date().getTime() / 1000);\r\n var validSince = 0, validUntil = 0;\r\n if (typeof claims === 'object') {\r\n if (claims.hasOwnProperty('nbf')) {\r\n validSince = claims['nbf'];\r\n }\r\n else if (claims.hasOwnProperty('iat')) {\r\n validSince = claims['iat'];\r\n }\r\n if (claims.hasOwnProperty('exp')) {\r\n validUntil = claims['exp'];\r\n }\r\n else {\r\n // token will expire after 24h by default\r\n validUntil = validSince + 86400;\r\n }\r\n }\r\n return (!!now &&\r\n !!validSince &&\r\n !!validUntil &&\r\n now >= validSince &&\r\n now <= validUntil);\r\n};\r\n/**\r\n * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise.\r\n *\r\n * Notes:\r\n * - May return null if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nvar issuedAtTime = function (token) {\r\n var claims = decode(token).claims;\r\n if (typeof claims === 'object' && claims.hasOwnProperty('iat')) {\r\n return claims['iat'];\r\n }\r\n return null;\r\n};\r\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nvar isValidFormat = function (token) {\r\n var decoded = decode(token), claims = decoded.claims;\r\n return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat');\r\n};\r\n/**\r\n * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\r\nvar isAdmin = function (token) {\r\n var claims = decode(token).claims;\r\n return typeof claims === 'object' && claims['admin'] === true;\r\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nfunction contains(obj, key) {\r\n return Object.prototype.hasOwnProperty.call(obj, key);\r\n}\r\nfunction safeGet(obj, key) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n return obj[key];\r\n }\r\n else {\r\n return undefined;\r\n }\r\n}\r\nfunction isEmpty(obj) {\r\n for (var key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nfunction map(obj, fn, contextObj) {\r\n var res = {};\r\n for (var key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n res[key] = fn.call(contextObj, obj[key], key, obj);\r\n }\r\n }\r\n return res;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a\r\n * params object (e.g. {arg: 'val', arg2: 'val2'})\r\n * Note: You must prepend it with ? when adding it to a URL.\r\n */\r\nfunction querystring(querystringParams) {\r\n var params = [];\r\n var _loop_1 = function (key, value) {\r\n if (Array.isArray(value)) {\r\n value.forEach(function (arrayVal) {\r\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal));\r\n });\r\n }\r\n else {\r\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\r\n }\r\n };\r\n for (var _i = 0, _a = Object.entries(querystringParams); _i < _a.length; _i++) {\r\n var _b = _a[_i], key = _b[0], value = _b[1];\r\n _loop_1(key, value);\r\n }\r\n return params.length ? '&' + params.join('&') : '';\r\n}\r\n/**\r\n * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object\r\n * (e.g. {arg: 'val', arg2: 'val2'})\r\n */\r\nfunction querystringDecode(querystring) {\r\n var obj = {};\r\n var tokens = querystring.replace(/^\\?/, '').split('&');\r\n tokens.forEach(function (token) {\r\n if (token) {\r\n var key = token.split('=');\r\n obj[key[0]] = key[1];\r\n }\r\n });\r\n return obj;\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * @fileoverview SHA-1 cryptographic hash.\r\n * Variable names follow the notation in FIPS PUB 180-3:\r\n * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf.\r\n *\r\n * Usage:\r\n * var sha1 = new sha1();\r\n * sha1.update(bytes);\r\n * var hash = sha1.digest();\r\n *\r\n * Performance:\r\n * Chrome 23: ~400 Mbit/s\r\n * Firefox 16: ~250 Mbit/s\r\n *\r\n */\r\n/**\r\n * SHA-1 cryptographic hash constructor.\r\n *\r\n * The properties declared here are discussed in the above algorithm document.\r\n * @constructor\r\n * @final\r\n * @struct\r\n */\r\nvar Sha1 = /** @class */ (function () {\r\n function Sha1() {\r\n /**\r\n * Holds the previous values of accumulated variables a-e in the compress_\r\n * function.\r\n * @private\r\n */\r\n this.chain_ = [];\r\n /**\r\n * A buffer holding the partially computed hash result.\r\n * @private\r\n */\r\n this.buf_ = [];\r\n /**\r\n * An array of 80 bytes, each a part of the message to be hashed. Referred to\r\n * as the message schedule in the docs.\r\n * @private\r\n */\r\n this.W_ = [];\r\n /**\r\n * Contains data needed to pad messages less than 64 bytes.\r\n * @private\r\n */\r\n this.pad_ = [];\r\n /**\r\n * @private {number}\r\n */\r\n this.inbuf_ = 0;\r\n /**\r\n * @private {number}\r\n */\r\n this.total_ = 0;\r\n this.blockSize = 512 / 8;\r\n this.pad_[0] = 128;\r\n for (var i = 1; i < this.blockSize; ++i) {\r\n this.pad_[i] = 0;\r\n }\r\n this.reset();\r\n }\r\n Sha1.prototype.reset = function () {\r\n this.chain_[0] = 0x67452301;\r\n this.chain_[1] = 0xefcdab89;\r\n this.chain_[2] = 0x98badcfe;\r\n this.chain_[3] = 0x10325476;\r\n this.chain_[4] = 0xc3d2e1f0;\r\n this.inbuf_ = 0;\r\n this.total_ = 0;\r\n };\r\n /**\r\n * Internal compress helper function.\r\n * @param buf Block to compress.\r\n * @param offset Offset of the block in the buffer.\r\n * @private\r\n */\r\n Sha1.prototype.compress_ = function (buf, offset) {\r\n if (!offset) {\r\n offset = 0;\r\n }\r\n var W = this.W_;\r\n // get 16 big endian words\r\n if (typeof buf === 'string') {\r\n for (var i = 0; i < 16; i++) {\r\n // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS\r\n // have a bug that turns the post-increment ++ operator into pre-increment\r\n // during JIT compilation. We have code that depends heavily on SHA-1 for\r\n // correctness and which is affected by this bug, so I've removed all uses\r\n // of post-increment ++ in which the result value is used. We can revert\r\n // this change once the Safari bug\r\n // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and\r\n // most clients have been updated.\r\n W[i] =\r\n (buf.charCodeAt(offset) << 24) |\r\n (buf.charCodeAt(offset + 1) << 16) |\r\n (buf.charCodeAt(offset + 2) << 8) |\r\n buf.charCodeAt(offset + 3);\r\n offset += 4;\r\n }\r\n }\r\n else {\r\n for (var i = 0; i < 16; i++) {\r\n W[i] =\r\n (buf[offset] << 24) |\r\n (buf[offset + 1] << 16) |\r\n (buf[offset + 2] << 8) |\r\n buf[offset + 3];\r\n offset += 4;\r\n }\r\n }\r\n // expand to 80 words\r\n for (var i = 16; i < 80; i++) {\r\n var t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\r\n W[i] = ((t << 1) | (t >>> 31)) & 0xffffffff;\r\n }\r\n var a = this.chain_[0];\r\n var b = this.chain_[1];\r\n var c = this.chain_[2];\r\n var d = this.chain_[3];\r\n var e = this.chain_[4];\r\n var f, k;\r\n // TODO(user): Try to unroll this loop to speed up the computation.\r\n for (var i = 0; i < 80; i++) {\r\n if (i < 40) {\r\n if (i < 20) {\r\n f = d ^ (b & (c ^ d));\r\n k = 0x5a827999;\r\n }\r\n else {\r\n f = b ^ c ^ d;\r\n k = 0x6ed9eba1;\r\n }\r\n }\r\n else {\r\n if (i < 60) {\r\n f = (b & c) | (d & (b | c));\r\n k = 0x8f1bbcdc;\r\n }\r\n else {\r\n f = b ^ c ^ d;\r\n k = 0xca62c1d6;\r\n }\r\n }\r\n var t = (((a << 5) | (a >>> 27)) + f + e + k + W[i]) & 0xffffffff;\r\n e = d;\r\n d = c;\r\n c = ((b << 30) | (b >>> 2)) & 0xffffffff;\r\n b = a;\r\n a = t;\r\n }\r\n this.chain_[0] = (this.chain_[0] + a) & 0xffffffff;\r\n this.chain_[1] = (this.chain_[1] + b) & 0xffffffff;\r\n this.chain_[2] = (this.chain_[2] + c) & 0xffffffff;\r\n this.chain_[3] = (this.chain_[3] + d) & 0xffffffff;\r\n this.chain_[4] = (this.chain_[4] + e) & 0xffffffff;\r\n };\r\n Sha1.prototype.update = function (bytes, length) {\r\n // TODO(johnlenz): tighten the function signature and remove this check\r\n if (bytes == null) {\r\n return;\r\n }\r\n if (length === undefined) {\r\n length = bytes.length;\r\n }\r\n var lengthMinusBlock = length - this.blockSize;\r\n var n = 0;\r\n // Using local instead of member variables gives ~5% speedup on Firefox 16.\r\n var buf = this.buf_;\r\n var inbuf = this.inbuf_;\r\n // The outer while loop should execute at most twice.\r\n while (n < length) {\r\n // When we have no data in the block to top up, we can directly process the\r\n // input buffer (assuming it contains sufficient data). This gives ~25%\r\n // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that\r\n // the data is provided in large chunks (or in multiples of 64 bytes).\r\n if (inbuf === 0) {\r\n while (n <= lengthMinusBlock) {\r\n this.compress_(bytes, n);\r\n n += this.blockSize;\r\n }\r\n }\r\n if (typeof bytes === 'string') {\r\n while (n < length) {\r\n buf[inbuf] = bytes.charCodeAt(n);\r\n ++inbuf;\r\n ++n;\r\n if (inbuf === this.blockSize) {\r\n this.compress_(buf);\r\n inbuf = 0;\r\n // Jump to the outer loop so we use the full-block optimization.\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n while (n < length) {\r\n buf[inbuf] = bytes[n];\r\n ++inbuf;\r\n ++n;\r\n if (inbuf === this.blockSize) {\r\n this.compress_(buf);\r\n inbuf = 0;\r\n // Jump to the outer loop so we use the full-block optimization.\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n this.inbuf_ = inbuf;\r\n this.total_ += length;\r\n };\r\n /** @override */\r\n Sha1.prototype.digest = function () {\r\n var digest = [];\r\n var totalBits = this.total_ * 8;\r\n // Add pad 0x80 0x00*.\r\n if (this.inbuf_ < 56) {\r\n this.update(this.pad_, 56 - this.inbuf_);\r\n }\r\n else {\r\n this.update(this.pad_, this.blockSize - (this.inbuf_ - 56));\r\n }\r\n // Add # bits.\r\n for (var i = this.blockSize - 1; i >= 56; i--) {\r\n this.buf_[i] = totalBits & 255;\r\n totalBits /= 256; // Don't use bit-shifting here!\r\n }\r\n this.compress_(this.buf_);\r\n var n = 0;\r\n for (var i = 0; i < 5; i++) {\r\n for (var j = 24; j >= 0; j -= 8) {\r\n digest[n] = (this.chain_[i] >> j) & 255;\r\n ++n;\r\n }\r\n }\r\n return digest;\r\n };\r\n return Sha1;\r\n}());\n\n/**\r\n * Helper to make a Subscribe function (just like Promise helps make a\r\n * Thenable).\r\n *\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\r\nfunction createSubscribe(executor, onNoObservers) {\r\n var proxy = new ObserverProxy(executor, onNoObservers);\r\n return proxy.subscribe.bind(proxy);\r\n}\r\n/**\r\n * Implement fan-out for any number of Observers attached via a subscribe\r\n * function.\r\n */\r\nvar ObserverProxy = /** @class */ (function () {\r\n /**\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\r\n function ObserverProxy(executor, onNoObservers) {\r\n var _this = this;\r\n this.observers = [];\r\n this.unsubscribes = [];\r\n this.observerCount = 0;\r\n // Micro-task scheduling by calling task.then().\r\n this.task = Promise.resolve();\r\n this.finalized = false;\r\n this.onNoObservers = onNoObservers;\r\n // Call the executor asynchronously so subscribers that are called\r\n // synchronously after the creation of the subscribe function\r\n // can still receive the very first value generated in the executor.\r\n this.task\r\n .then(function () {\r\n executor(_this);\r\n })\r\n .catch(function (e) {\r\n _this.error(e);\r\n });\r\n }\r\n ObserverProxy.prototype.next = function (value) {\r\n this.forEachObserver(function (observer) {\r\n observer.next(value);\r\n });\r\n };\r\n ObserverProxy.prototype.error = function (error) {\r\n this.forEachObserver(function (observer) {\r\n observer.error(error);\r\n });\r\n this.close(error);\r\n };\r\n ObserverProxy.prototype.complete = function () {\r\n this.forEachObserver(function (observer) {\r\n observer.complete();\r\n });\r\n this.close();\r\n };\r\n /**\r\n * Subscribe function that can be used to add an Observer to the fan-out list.\r\n *\r\n * - We require that no event is sent to a subscriber sychronously to their\r\n * call to subscribe().\r\n */\r\n ObserverProxy.prototype.subscribe = function (nextOrObserver, error, complete) {\r\n var _this = this;\r\n var observer;\r\n if (nextOrObserver === undefined &&\r\n error === undefined &&\r\n complete === undefined) {\r\n throw new Error('Missing Observer.');\r\n }\r\n // Assemble an Observer object when passed as callback functions.\r\n if (implementsAnyMethods(nextOrObserver, [\r\n 'next',\r\n 'error',\r\n 'complete'\r\n ])) {\r\n observer = nextOrObserver;\r\n }\r\n else {\r\n observer = {\r\n next: nextOrObserver,\r\n error: error,\r\n complete: complete\r\n };\r\n }\r\n if (observer.next === undefined) {\r\n observer.next = noop;\r\n }\r\n if (observer.error === undefined) {\r\n observer.error = noop;\r\n }\r\n if (observer.complete === undefined) {\r\n observer.complete = noop;\r\n }\r\n var unsub = this.unsubscribeOne.bind(this, this.observers.length);\r\n // Attempt to subscribe to a terminated Observable - we\r\n // just respond to the Observer with the final error or complete\r\n // event.\r\n if (this.finalized) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.task.then(function () {\r\n try {\r\n if (_this.finalError) {\r\n observer.error(_this.finalError);\r\n }\r\n else {\r\n observer.complete();\r\n }\r\n }\r\n catch (e) {\r\n // nothing\r\n }\r\n return;\r\n });\r\n }\r\n this.observers.push(observer);\r\n return unsub;\r\n };\r\n // Unsubscribe is synchronous - we guarantee that no events are sent to\r\n // any unsubscribed Observer.\r\n ObserverProxy.prototype.unsubscribeOne = function (i) {\r\n if (this.observers === undefined || this.observers[i] === undefined) {\r\n return;\r\n }\r\n delete this.observers[i];\r\n this.observerCount -= 1;\r\n if (this.observerCount === 0 && this.onNoObservers !== undefined) {\r\n this.onNoObservers(this);\r\n }\r\n };\r\n ObserverProxy.prototype.forEachObserver = function (fn) {\r\n if (this.finalized) {\r\n // Already closed by previous event....just eat the additional values.\r\n return;\r\n }\r\n // Since sendOne calls asynchronously - there is no chance that\r\n // this.observers will become undefined.\r\n for (var i = 0; i < this.observers.length; i++) {\r\n this.sendOne(i, fn);\r\n }\r\n };\r\n // Call the Observer via one of it's callback function. We are careful to\r\n // confirm that the observe has not been unsubscribed since this asynchronous\r\n // function had been queued.\r\n ObserverProxy.prototype.sendOne = function (i, fn) {\r\n var _this = this;\r\n // Execute the callback asynchronously\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.task.then(function () {\r\n if (_this.observers !== undefined && _this.observers[i] !== undefined) {\r\n try {\r\n fn(_this.observers[i]);\r\n }\r\n catch (e) {\r\n // Ignore exceptions raised in Observers or missing methods of an\r\n // Observer.\r\n // Log error to console. b/31404806\r\n if (typeof console !== 'undefined' && console.error) {\r\n console.error(e);\r\n }\r\n }\r\n }\r\n });\r\n };\r\n ObserverProxy.prototype.close = function (err) {\r\n var _this = this;\r\n if (this.finalized) {\r\n return;\r\n }\r\n this.finalized = true;\r\n if (err !== undefined) {\r\n this.finalError = err;\r\n }\r\n // Proxy is no longer needed - garbage collect references\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.task.then(function () {\r\n _this.observers = undefined;\r\n _this.onNoObservers = undefined;\r\n });\r\n };\r\n return ObserverProxy;\r\n}());\r\n/** Turn synchronous function into one called asynchronously. */\r\nfunction async(fn, onError) {\r\n return function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n Promise.resolve(true)\r\n .then(function () {\r\n fn.apply(void 0, args);\r\n })\r\n .catch(function (error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n });\r\n };\r\n}\r\n/**\r\n * Return true if the object passed in implements any of the named methods.\r\n */\r\nfunction implementsAnyMethods(obj, methods) {\r\n if (typeof obj !== 'object' || obj === null) {\r\n return false;\r\n }\r\n for (var _i = 0, methods_1 = methods; _i < methods_1.length; _i++) {\r\n var method = methods_1[_i];\r\n if (method in obj && typeof obj[method] === 'function') {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nfunction noop() {\r\n // do nothing\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Check to make sure the appropriate number of arguments are provided for a public function.\r\n * Throws an error if it fails.\r\n *\r\n * @param fnName The function name\r\n * @param minCount The minimum number of arguments to allow for the function call\r\n * @param maxCount The maximum number of argument to allow for the function call\r\n * @param argCount The actual number of arguments provided.\r\n */\r\nvar validateArgCount = function (fnName, minCount, maxCount, argCount) {\r\n var argError;\r\n if (argCount < minCount) {\r\n argError = 'at least ' + minCount;\r\n }\r\n else if (argCount > maxCount) {\r\n argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount;\r\n }\r\n if (argError) {\r\n var error = fnName +\r\n ' failed: Was called with ' +\r\n argCount +\r\n (argCount === 1 ? ' argument.' : ' arguments.') +\r\n ' Expects ' +\r\n argError +\r\n '.';\r\n throw new Error(error);\r\n }\r\n};\r\n/**\r\n * Generates a string to prefix an error message about failed argument validation\r\n *\r\n * @param fnName The function name\r\n * @param argumentNumber The index of the argument\r\n * @param optional Whether or not the argument is optional\r\n * @return The prefix to add to the error thrown for validation.\r\n */\r\nfunction errorPrefix(fnName, argumentNumber, optional) {\r\n var argName = '';\r\n switch (argumentNumber) {\r\n case 1:\r\n argName = optional ? 'first' : 'First';\r\n break;\r\n case 2:\r\n argName = optional ? 'second' : 'Second';\r\n break;\r\n case 3:\r\n argName = optional ? 'third' : 'Third';\r\n break;\r\n case 4:\r\n argName = optional ? 'fourth' : 'Fourth';\r\n break;\r\n default:\r\n throw new Error('errorPrefix called with argumentNumber > 4. Need to update it?');\r\n }\r\n var error = fnName + ' failed: ';\r\n error += argName + ' argument ';\r\n return error;\r\n}\r\n/**\r\n * @param fnName\r\n * @param argumentNumber\r\n * @param namespace\r\n * @param optional\r\n */\r\nfunction validateNamespace(fnName, argumentNumber, namespace, optional) {\r\n if (optional && !namespace) {\r\n return;\r\n }\r\n if (typeof namespace !== 'string') {\r\n //TODO: I should do more validation here. We only allow certain chars in namespaces.\r\n throw new Error(errorPrefix(fnName, argumentNumber, optional) +\r\n 'must be a valid firebase namespace.');\r\n }\r\n}\r\nfunction validateCallback(fnName, argumentNumber, callback, optional) {\r\n if (optional && !callback) {\r\n return;\r\n }\r\n if (typeof callback !== 'function') {\r\n throw new Error(errorPrefix(fnName, argumentNumber, optional) +\r\n 'must be a valid function.');\r\n }\r\n}\r\nfunction validateContextObject(fnName, argumentNumber, context, optional) {\r\n if (optional && !context) {\r\n return;\r\n }\r\n if (typeof context !== 'object' || context === null) {\r\n throw new Error(errorPrefix(fnName, argumentNumber, optional) +\r\n 'must be a valid context object.');\r\n }\r\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they\r\n// automatically replaced '\\r\\n' with '\\n', and they didn't handle surrogate pairs,\r\n// so it's been modified.\r\n// Note that not all Unicode characters appear as single characters in JavaScript strings.\r\n// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters\r\n// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first\r\n// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate\r\n// pair).\r\n// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3\r\n/**\r\n * @param {string} str\r\n * @return {Array}\r\n */\r\nvar stringToByteArray$1 = function (str) {\r\n var out = [];\r\n var p = 0;\r\n for (var i = 0; i < str.length; i++) {\r\n var c = str.charCodeAt(i);\r\n // Is this the lead surrogate in a surrogate pair?\r\n if (c >= 0xd800 && c <= 0xdbff) {\r\n var high = c - 0xd800; // the high 10 bits.\r\n i++;\r\n assert(i < str.length, 'Surrogate pair missing trail surrogate.');\r\n var low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.\r\n c = 0x10000 + (high << 10) + low;\r\n }\r\n if (c < 128) {\r\n out[p++] = c;\r\n }\r\n else if (c < 2048) {\r\n out[p++] = (c >> 6) | 192;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else if (c < 65536) {\r\n out[p++] = (c >> 12) | 224;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n else {\r\n out[p++] = (c >> 18) | 240;\r\n out[p++] = ((c >> 12) & 63) | 128;\r\n out[p++] = ((c >> 6) & 63) | 128;\r\n out[p++] = (c & 63) | 128;\r\n }\r\n }\r\n return out;\r\n};\r\n/**\r\n * Calculate length without actually converting; useful for doing cheaper validation.\r\n * @param {string} str\r\n * @return {number}\r\n */\r\nvar stringLength = function (str) {\r\n var p = 0;\r\n for (var i = 0; i < str.length; i++) {\r\n var c = str.charCodeAt(i);\r\n if (c < 128) {\r\n p++;\r\n }\r\n else if (c < 2048) {\r\n p += 2;\r\n }\r\n else if (c >= 0xd800 && c <= 0xdbff) {\r\n // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent.\r\n p += 4;\r\n i++; // skip trail surrogate.\r\n }\r\n else {\r\n p += 3;\r\n }\r\n }\r\n return p;\r\n};\n\nexports.CONSTANTS = CONSTANTS;\nexports.Deferred = Deferred;\nexports.ErrorFactory = ErrorFactory;\nexports.FirebaseError = FirebaseError;\nexports.Sha1 = Sha1;\nexports.assert = assert;\nexports.assertionError = assertionError;\nexports.async = async;\nexports.base64 = base64;\nexports.base64Decode = base64Decode;\nexports.base64Encode = base64Encode;\nexports.contains = contains;\nexports.createSubscribe = createSubscribe;\nexports.decode = decode;\nexports.deepCopy = deepCopy;\nexports.deepExtend = deepExtend;\nexports.errorPrefix = errorPrefix;\nexports.getUA = getUA;\nexports.isAdmin = isAdmin;\nexports.isBrowser = isBrowser;\nexports.isEmpty = isEmpty;\nexports.isMobileCordova = isMobileCordova;\nexports.isNode = isNode;\nexports.isNodeSdk = isNodeSdk;\nexports.isReactNative = isReactNative;\nexports.isValidFormat = isValidFormat;\nexports.isValidTimestamp = isValidTimestamp;\nexports.issuedAtTime = issuedAtTime;\nexports.jsonEval = jsonEval;\nexports.map = map;\nexports.querystring = querystring;\nexports.querystringDecode = querystringDecode;\nexports.safeGet = safeGet;\nexports.stringLength = stringLength;\nexports.stringToByteArray = stringToByteArray$1;\nexports.stringify = stringify;\nexports.validateArgCount = validateArgCount;\nexports.validateCallback = validateCallback;\nexports.validateContextObject = validateContextObject;\nexports.validateNamespace = validateNamespace;\n//# sourceMappingURL=index.cjs.js.map\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}"],"sourceRoot":""}