-
Notifications
You must be signed in to change notification settings - Fork 0
/
207-1c068906b152e702e80b.js.map
1 lines (1 loc) · 152 KB
/
207-1c068906b152e702e80b.js.map
1
{"version":3,"file":"207-1c068906b152e702e80b.js","mappings":";4HAiDIA,oDA3CAC,EAAU,SAkBVC,EAAqB,IACrBC,EAAkB,WAClBC,EAAwB,SAExBC,EAA0B,KAuB1BC,IAAyBN,EAAK,IAAO,6BAErC,kDAAmDA,EAAG,kBAEtD,2CAA4CA,EAAG,0BAE/C,mCAAoCA,EAAG,kBAEvC,6FAA8FA,EAAG,eAEjG,kDAAmDA,EAAG,+BAEtD,2EAA4EA,GAC5EO,EAAgB,IAAI,KAlCV,gBACK,gBAiCyCD,GAG5D,SAASE,EAAcC,GACrB,OAAOA,aAAiB,MAAiBA,EAAMC,KAAKC,SAAS,kBAsB/D,SAASC,EAAyBZ,GAEhC,MAAOa,4DADSb,EAAGc,UACuC,iBAG5D,SAASC,EAAiCC,GACxC,MAAO,CACLC,MAAOD,EAASC,MAChBC,cAAe,EAGfC,WAmFuCC,EAnFMJ,EAASG,UAqFjDE,OAAOD,EAAkBE,QAAQ,IAAK,SApF3CC,aAAcC,KAAKC,OAkFvB,IAA2CL,EA9E3C,SAASM,EAAqBC,EAAaX,GACzC,OAAO,QAAUY,UAAM,OAAQ,GAAQ,WACrC,IAAIC,EAAcC,EAClB,OAAO,QAAYF,MAAM,SAAU5B,GACjC,OAAQA,EAAG+B,OACT,KAAK,EACH,MAAO,CAAC,EAENf,EAASgB,QAEb,KAAK,EAGH,OAFAH,EAAe7B,EAAGiC,OAClBH,EAAYD,EAAapB,MAClB,CAAC,EAENF,EAAc2B,OAAO,iBAErB,CACAP,YAAaA,EACbQ,WAAYL,EAAUpB,KACtB0B,cAAeN,EAAUO,QACzBC,aAAcR,EAAUS,iBAOpC,SAASC,EAAWxC,GAClB,IAAIyC,EAASzC,EAAGyC,OAChB,OAAO,IAAIC,QAAQ,CACjB,eAAgB,mBAChBC,OAAQ,mBACR,iBA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AM8U,EAAc1C,EAAKN,MAAM,GAAI,IAExE5T,EAAQ8T,UAAY,WAClBzQ,EAASrD,EAAQL,iBAMzB,CAACqV,EAAOK,GAAahG,SAAQ,SAAUwF,GACjCA,EAAYvH,UAAUuJ,SAE1BhC,EAAYvH,UAAUuJ,OAAS,SAAUC,EAAOC,GAC9C,IAAI9S,EAAW9F,KACX6Y,EAAQ,GACZ,OAAO,IAAIjW,SAAQ,SAAUC,GAC3BiD,EAASgT,cAAcH,GAAO,SAAU5B,GACjCA,GAKL8B,EAAM1Q,KAAK4O,EAAO5R,YAEJiC,IAAVwR,GAAuBC,EAAM/K,QAAU8K,EAK3C7B,EAAOgC,WAJLlW,EAAQgW,IAPRhW,EAAQgW,cAsClBvD,EAAQpP,OAASA,EACjBoP,EAAQ0C,SAAWA,EACnBjK,OAAOwI,eAAejB,EAAS,aAAc,CAC3CnQ,OAAO,IAxPsD8N,CAAQqC","sources":["webpack://lubycon-home/./node_modules/@lubycon/logger/node_modules/@firebase/installations/dist/index.esm.js","webpack://lubycon-home/./node_modules/@lubycon/logger/node_modules/@firebase/analytics/dist/index.esm.js","webpack://lubycon-home/./node_modules/idb/build/idb.js"],"sourcesContent":["import firebase from '@firebase/app';\nimport { Component } from '@firebase/component';\nimport { __awaiter, __generator, __spreadArray, __read, __values, __assign } from 'tslib';\nimport { ErrorFactory, FirebaseError } from '@firebase/util';\nimport { openDb } from 'idb';\nvar name = \"@firebase/installations\";\nvar version = \"0.4.32\";\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\nvar PENDING_TIMEOUT_MS = 10000;\nvar PACKAGE_VERSION = \"w:\" + version;\nvar INTERNAL_AUTH_VERSION = 'FIS_v2';\nvar INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1';\nvar TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour\n\nvar SERVICE = 'installations';\nvar SERVICE_NAME = 'Installations';\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\nvar _a;\n\nvar ERROR_DESCRIPTION_MAP = (_a = {}, _a[\"missing-app-config-values\"\n/* MISSING_APP_CONFIG_VALUES */\n] = 'Missing App configuration value: \"{$valueName}\"', _a[\"not-registered\"\n/* NOT_REGISTERED */\n] = 'Firebase Installation is not registered.', _a[\"installation-not-found\"\n/* INSTALLATION_NOT_FOUND */\n] = 'Firebase Installation not found.', _a[\"request-failed\"\n/* REQUEST_FAILED */\n] = '{$requestName} request failed with error \"{$serverCode} {$serverStatus}: {$serverMessage}\"', _a[\"app-offline\"\n/* APP_OFFLINE */\n] = 'Could not process request. Application offline.', _a[\"delete-pending-registration\"\n/* DELETE_PENDING_REGISTRATION */\n] = \"Can't delete installation while there is a pending registration request.\", _a);\nvar ERROR_FACTORY = new ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);\n/** Returns true if error is a FirebaseError that is based on an error from the server. */\n\nfunction isServerError(error) {\n return error instanceof FirebaseError && error.code.includes(\"request-failed\"\n /* REQUEST_FAILED */\n );\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction getInstallationsEndpoint(_a) {\n var projectId = _a.projectId;\n return INSTALLATIONS_API_URL + \"/projects/\" + projectId + \"/installations\";\n}\n\nfunction extractAuthTokenInfoFromResponse(response) {\n return {\n token: response.token,\n requestStatus: 2\n /* COMPLETED */\n ,\n expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),\n creationTime: Date.now()\n };\n}\n\nfunction getErrorFromResponse(requestName, response) {\n return __awaiter(this, void 0, void 0, function () {\n var responseJson, errorData;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , response.json()];\n\n case 1:\n responseJson = _a.sent();\n errorData = responseJson.error;\n return [2\n /*return*/\n , ERROR_FACTORY.create(\"request-failed\"\n /* REQUEST_FAILED */\n , {\n requestName: requestName,\n serverCode: errorData.code,\n serverMessage: errorData.message,\n serverStatus: errorData.status\n })];\n }\n });\n });\n}\n\nfunction getHeaders(_a) {\n var apiKey = _a.apiKey;\n return new Headers({\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n 'x-goog-api-key': apiKey\n });\n}\n\nfunction getHeadersWithAuth(appConfig, _a) {\n var refreshToken = _a.refreshToken;\n var headers = getHeaders(appConfig);\n headers.append('Authorization', getAuthorizationHeader(refreshToken));\n return headers;\n}\n/**\r\n * Calls the passed in fetch wrapper and returns the response.\r\n * If the returned response has a status of 5xx, re-runs the function once and\r\n * returns the response.\r\n */\n\n\nfunction retryIfServerError(fn) {\n return __awaiter(this, void 0, void 0, function () {\n var result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , fn()];\n\n case 1:\n result = _a.sent();\n\n if (result.status >= 500 && result.status < 600) {\n // Internal Server Error. Retry request.\n return [2\n /*return*/\n , fn()];\n }\n\n return [2\n /*return*/\n , result];\n }\n });\n });\n}\n\nfunction getExpiresInFromResponseExpiresIn(responseExpiresIn) {\n // This works because the server will never respond with fractions of a second.\n return Number(responseExpiresIn.replace('s', '000'));\n}\n\nfunction getAuthorizationHeader(refreshToken) {\n return INTERNAL_AUTH_VERSION + \" \" + refreshToken;\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction createInstallationRequest(appConfig, _a) {\n var fid = _a.fid;\n return __awaiter(this, void 0, void 0, function () {\n var endpoint, headers, body, request, response, responseValue, registeredInstallationEntry;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n endpoint = getInstallationsEndpoint(appConfig);\n headers = getHeaders(appConfig);\n body = {\n fid: fid,\n authVersion: INTERNAL_AUTH_VERSION,\n appId: appConfig.appId,\n sdkVersion: PACKAGE_VERSION\n };\n request = {\n method: 'POST',\n headers: headers,\n body: JSON.stringify(body)\n };\n return [4\n /*yield*/\n , retryIfServerError(function () {\n return fetch(endpoint, request);\n })];\n\n case 1:\n response = _b.sent();\n if (!response.ok) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , response.json()];\n\n case 2:\n responseValue = _b.sent();\n registeredInstallationEntry = {\n fid: responseValue.fid || fid,\n registrationStatus: 2\n /* COMPLETED */\n ,\n refreshToken: responseValue.refreshToken,\n authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)\n };\n return [2\n /*return*/\n , registeredInstallationEntry];\n\n case 3:\n return [4\n /*yield*/\n , getErrorFromResponse('Create Installation', response)];\n\n case 4:\n throw _b.sent();\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\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 */\n\n/** Returns a promise that resolves after given time passes. */\n\n\nfunction sleep(ms) {\n return new Promise(function (resolve) {\n setTimeout(resolve, ms);\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction bufferToBase64UrlSafe(array) {\n var b64 = btoa(String.fromCharCode.apply(String, __spreadArray([], __read(array))));\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_');\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nvar VALID_FID_PATTERN = /^[cdef][\\w-]{21}$/;\nvar INVALID_FID = '';\n/**\r\n * Generates a new FID using random values from Web Crypto API.\r\n * Returns an empty string if FID generation fails for any reason.\r\n */\n\nfunction generateFid() {\n try {\n // A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5\n // bytes. our implementation generates a 17 byte array instead.\n var fidByteArray = new Uint8Array(17);\n var crypto_1 = self.crypto || self.msCrypto;\n crypto_1.getRandomValues(fidByteArray); // Replace the first 4 random bits with the constant FID header of 0b0111.\n\n fidByteArray[0] = 112 + fidByteArray[0] % 16;\n var fid = encode(fidByteArray);\n return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID;\n } catch (_a) {\n // FID generation errored\n return INVALID_FID;\n }\n}\n/** Converts a FID Uint8Array to a base64 string representation. */\n\n\nfunction encode(fidByteArray) {\n var b64String = bufferToBase64UrlSafe(fidByteArray); // Remove the 23rd character that was added because of the extra 4 bits at the\n // end of our 17 byte array, and the '=' padding.\n\n return b64String.substr(0, 22);\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/** Returns a string key that can be used to identify the app. */\n\n\nfunction getKey(appConfig) {\n return appConfig.appName + \"!\" + appConfig.appId;\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nvar fidChangeCallbacks = new Map();\n/**\r\n * Calls the onIdChange callbacks with the new FID value, and broadcasts the\r\n * change to other tabs.\r\n */\n\nfunction fidChanged(appConfig, fid) {\n var key = getKey(appConfig);\n callFidChangeCallbacks(key, fid);\n broadcastFidChange(key, fid);\n}\n\nfunction addCallback(appConfig, callback) {\n // Open the broadcast channel if it's not already open,\n // to be able to listen to change events from other tabs.\n getBroadcastChannel();\n var key = getKey(appConfig);\n var callbackSet = fidChangeCallbacks.get(key);\n\n if (!callbackSet) {\n callbackSet = new Set();\n fidChangeCallbacks.set(key, callbackSet);\n }\n\n callbackSet.add(callback);\n}\n\nfunction removeCallback(appConfig, callback) {\n var key = getKey(appConfig);\n var callbackSet = fidChangeCallbacks.get(key);\n\n if (!callbackSet) {\n return;\n }\n\n callbackSet.delete(callback);\n\n if (callbackSet.size === 0) {\n fidChangeCallbacks.delete(key);\n } // Close broadcast channel if there are no more callbacks.\n\n\n closeBroadcastChannel();\n}\n\nfunction callFidChangeCallbacks(key, fid) {\n var e_1, _a;\n\n var callbacks = fidChangeCallbacks.get(key);\n\n if (!callbacks) {\n return;\n }\n\n try {\n for (var callbacks_1 = __values(callbacks), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) {\n var callback = callbacks_1_1.value;\n callback(fid);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n}\n\nfunction broadcastFidChange(key, fid) {\n var channel = getBroadcastChannel();\n\n if (channel) {\n channel.postMessage({\n key: key,\n fid: fid\n });\n }\n\n closeBroadcastChannel();\n}\n\nvar broadcastChannel = null;\n/** Opens and returns a BroadcastChannel if it is supported by the browser. */\n\nfunction getBroadcastChannel() {\n if (!broadcastChannel && 'BroadcastChannel' in self) {\n broadcastChannel = new BroadcastChannel('[Firebase] FID Change');\n\n broadcastChannel.onmessage = function (e) {\n callFidChangeCallbacks(e.data.key, e.data.fid);\n };\n }\n\n return broadcastChannel;\n}\n\nfunction closeBroadcastChannel() {\n if (fidChangeCallbacks.size === 0 && broadcastChannel) {\n broadcastChannel.close();\n broadcastChannel = null;\n }\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nvar DATABASE_NAME = 'firebase-installations-database';\nvar DATABASE_VERSION = 1;\nvar OBJECT_STORE_NAME = 'firebase-installations-store';\nvar dbPromise = null;\n\nfunction getDbPromise() {\n if (!dbPromise) {\n dbPromise = openDb(DATABASE_NAME, DATABASE_VERSION, function (upgradeDB) {\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (upgradeDB.oldVersion) {\n case 0:\n upgradeDB.createObjectStore(OBJECT_STORE_NAME);\n }\n });\n }\n\n return dbPromise;\n}\n/** Assigns or overwrites the record for the given key with the given value. */\n\n\nfunction set(appConfig, value) {\n return __awaiter(this, void 0, void 0, function () {\n var key, db, tx, objectStore, oldValue;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n key = getKey(appConfig);\n return [4\n /*yield*/\n , getDbPromise()];\n\n case 1:\n db = _a.sent();\n tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n objectStore = tx.objectStore(OBJECT_STORE_NAME);\n return [4\n /*yield*/\n , objectStore.get(key)];\n\n case 2:\n oldValue = _a.sent();\n return [4\n /*yield*/\n , objectStore.put(value, key)];\n\n case 3:\n _a.sent();\n\n return [4\n /*yield*/\n , tx.complete];\n\n case 4:\n _a.sent();\n\n if (!oldValue || oldValue.fid !== value.fid) {\n fidChanged(appConfig, value.fid);\n }\n\n return [2\n /*return*/\n , value];\n }\n });\n });\n}\n/** Removes record(s) from the objectStore that match the given key. */\n\n\nfunction remove(appConfig) {\n return __awaiter(this, void 0, void 0, function () {\n var key, db, tx;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n key = getKey(appConfig);\n return [4\n /*yield*/\n , getDbPromise()];\n\n case 1:\n db = _a.sent();\n tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n return [4\n /*yield*/\n , tx.objectStore(OBJECT_STORE_NAME).delete(key)];\n\n case 2:\n _a.sent();\n\n return [4\n /*yield*/\n , tx.complete];\n\n case 3:\n _a.sent();\n\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Atomically updates a record with the result of updateFn, which gets\r\n * called with the current value. If newValue is undefined, the record is\r\n * deleted instead.\r\n * @return Updated value\r\n */\n\n\nfunction update(appConfig, updateFn) {\n return __awaiter(this, void 0, void 0, function () {\n var key, db, tx, store, oldValue, newValue;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n key = getKey(appConfig);\n return [4\n /*yield*/\n , getDbPromise()];\n\n case 1:\n db = _a.sent();\n tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n store = tx.objectStore(OBJECT_STORE_NAME);\n return [4\n /*yield*/\n , store.get(key)];\n\n case 2:\n oldValue = _a.sent();\n newValue = updateFn(oldValue);\n if (!(newValue === undefined)) return [3\n /*break*/\n , 4];\n return [4\n /*yield*/\n , store.delete(key)];\n\n case 3:\n _a.sent();\n\n return [3\n /*break*/\n , 6];\n\n case 4:\n return [4\n /*yield*/\n , store.put(newValue, key)];\n\n case 5:\n _a.sent();\n\n _a.label = 6;\n\n case 6:\n return [4\n /*yield*/\n , tx.complete];\n\n case 7:\n _a.sent();\n\n if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {\n fidChanged(appConfig, newValue.fid);\n }\n\n return [2\n /*return*/\n , newValue];\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/**\r\n * Updates and returns the InstallationEntry from the database.\r\n * Also triggers a registration request if it is necessary and possible.\r\n */\n\n\nfunction getInstallationEntry(appConfig) {\n return __awaiter(this, void 0, void 0, function () {\n var registrationPromise, installationEntry;\n\n var _a;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4\n /*yield*/\n , update(appConfig, function (oldEntry) {\n var installationEntry = updateOrCreateInstallationEntry(oldEntry);\n var entryWithPromise = triggerRegistrationIfNecessary(appConfig, installationEntry);\n registrationPromise = entryWithPromise.registrationPromise;\n return entryWithPromise.installationEntry;\n })];\n\n case 1:\n installationEntry = _b.sent();\n if (!(installationEntry.fid === INVALID_FID)) return [3\n /*break*/\n , 3];\n _a = {};\n return [4\n /*yield*/\n , registrationPromise];\n\n case 2:\n // FID generation failed. Waiting for the FID from the server.\n return [2\n /*return*/\n , (_a.installationEntry = _b.sent(), _a)];\n\n case 3:\n return [2\n /*return*/\n , {\n installationEntry: installationEntry,\n registrationPromise: registrationPromise\n }];\n }\n });\n });\n}\n/**\r\n * Creates a new Installation Entry if one does not exist.\r\n * Also clears timed out pending requests.\r\n */\n\n\nfunction updateOrCreateInstallationEntry(oldEntry) {\n var entry = oldEntry || {\n fid: generateFid(),\n registrationStatus: 0\n /* NOT_STARTED */\n\n };\n return clearTimedOutRequest(entry);\n}\n/**\r\n * If the Firebase Installation is not registered yet, this will trigger the\r\n * registration and return an InProgressInstallationEntry.\r\n *\r\n * If registrationPromise does not exist, the installationEntry is guaranteed\r\n * to be registered.\r\n */\n\n\nfunction triggerRegistrationIfNecessary(appConfig, installationEntry) {\n if (installationEntry.registrationStatus === 0\n /* NOT_STARTED */\n ) {\n if (!navigator.onLine) {\n // Registration required but app is offline.\n var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create(\"app-offline\"\n /* APP_OFFLINE */\n ));\n return {\n installationEntry: installationEntry,\n registrationPromise: registrationPromiseWithError\n };\n } // Try registering. Change status to IN_PROGRESS.\n\n\n var inProgressEntry = {\n fid: installationEntry.fid,\n registrationStatus: 1\n /* IN_PROGRESS */\n ,\n registrationTime: Date.now()\n };\n var registrationPromise = registerInstallation(appConfig, inProgressEntry);\n return {\n installationEntry: inProgressEntry,\n registrationPromise: registrationPromise\n };\n } else if (installationEntry.registrationStatus === 1\n /* IN_PROGRESS */\n ) {\n return {\n installationEntry: installationEntry,\n registrationPromise: waitUntilFidRegistration(appConfig)\n };\n } else {\n return {\n installationEntry: installationEntry\n };\n }\n}\n/** This will be executed only once for each new Firebase Installation. */\n\n\nfunction registerInstallation(appConfig, installationEntry) {\n return __awaiter(this, void 0, void 0, function () {\n var registeredInstallationEntry, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2,, 7]);\n\n return [4\n /*yield*/\n , createInstallationRequest(appConfig, installationEntry)];\n\n case 1:\n registeredInstallationEntry = _a.sent();\n return [2\n /*return*/\n , set(appConfig, registeredInstallationEntry)];\n\n case 2:\n e_1 = _a.sent();\n if (!(isServerError(e_1) && e_1.customData.serverCode === 409)) return [3\n /*break*/\n , 4]; // Server returned a \"FID can not be used\" error.\n // Generate a new ID next time.\n\n return [4\n /*yield*/\n , remove(appConfig)];\n\n case 3:\n // Server returned a \"FID can not be used\" error.\n // Generate a new ID next time.\n _a.sent();\n\n return [3\n /*break*/\n , 6];\n\n case 4:\n // Registration failed. Set FID as not registered.\n return [4\n /*yield*/\n , set(appConfig, {\n fid: installationEntry.fid,\n registrationStatus: 0\n /* NOT_STARTED */\n\n })];\n\n case 5:\n // Registration failed. Set FID as not registered.\n _a.sent();\n\n _a.label = 6;\n\n case 6:\n throw e_1;\n\n case 7:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/** Call if FID registration is pending in another request. */\n\n\nfunction waitUntilFidRegistration(appConfig) {\n return __awaiter(this, void 0, void 0, function () {\n var entry, _a, installationEntry, registrationPromise;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4\n /*yield*/\n , updateInstallationRequest(appConfig)];\n\n case 1:\n entry = _b.sent();\n _b.label = 2;\n\n case 2:\n if (!(entry.registrationStatus === 1\n /* IN_PROGRESS */\n )) return [3\n /*break*/\n , 5]; // createInstallation request still in progress.\n\n return [4\n /*yield*/\n , sleep(100)];\n\n case 3:\n // createInstallation request still in progress.\n _b.sent();\n\n return [4\n /*yield*/\n , updateInstallationRequest(appConfig)];\n\n case 4:\n entry = _b.sent();\n return [3\n /*break*/\n , 2];\n\n case 5:\n if (!(entry.registrationStatus === 0\n /* NOT_STARTED */\n )) return [3\n /*break*/\n , 7];\n return [4\n /*yield*/\n , getInstallationEntry(appConfig)];\n\n case 6:\n _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise;\n\n if (registrationPromise) {\n return [2\n /*return*/\n , registrationPromise];\n } else {\n // if there is no registrationPromise, entry is registered.\n return [2\n /*return*/\n , installationEntry];\n }\n\n case 7:\n return [2\n /*return*/\n , entry];\n }\n });\n });\n}\n/**\r\n * Called only if there is a CreateInstallation request in progress.\r\n *\r\n * Updates the InstallationEntry in the DB based on the status of the\r\n * CreateInstallation request.\r\n *\r\n * Returns the updated InstallationEntry.\r\n */\n\n\nfunction updateInstallationRequest(appConfig) {\n return update(appConfig, function (oldEntry) {\n if (!oldEntry) {\n throw ERROR_FACTORY.create(\"installation-not-found\"\n /* INSTALLATION_NOT_FOUND */\n );\n }\n\n return clearTimedOutRequest(oldEntry);\n });\n}\n\nfunction clearTimedOutRequest(entry) {\n if (hasInstallationRequestTimedOut(entry)) {\n return {\n fid: entry.fid,\n registrationStatus: 0\n /* NOT_STARTED */\n\n };\n }\n\n return entry;\n}\n\nfunction hasInstallationRequestTimedOut(installationEntry) {\n return installationEntry.registrationStatus === 1\n /* IN_PROGRESS */\n && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now();\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction generateAuthTokenRequest(_a, installationEntry) {\n var appConfig = _a.appConfig,\n platformLoggerProvider = _a.platformLoggerProvider;\n return __awaiter(this, void 0, void 0, function () {\n var endpoint, headers, platformLogger, body, request, response, responseValue, completedAuthToken;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);\n headers = getHeadersWithAuth(appConfig, installationEntry);\n platformLogger = platformLoggerProvider.getImmediate({\n optional: true\n });\n\n if (platformLogger) {\n headers.append('x-firebase-client', platformLogger.getPlatformInfoString());\n }\n\n body = {\n installation: {\n sdkVersion: PACKAGE_VERSION\n }\n };\n request = {\n method: 'POST',\n headers: headers,\n body: JSON.stringify(body)\n };\n return [4\n /*yield*/\n , retryIfServerError(function () {\n return fetch(endpoint, request);\n })];\n\n case 1:\n response = _b.sent();\n if (!response.ok) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , response.json()];\n\n case 2:\n responseValue = _b.sent();\n completedAuthToken = extractAuthTokenInfoFromResponse(responseValue);\n return [2\n /*return*/\n , completedAuthToken];\n\n case 3:\n return [4\n /*yield*/\n , getErrorFromResponse('Generate Auth Token', response)];\n\n case 4:\n throw _b.sent();\n }\n });\n });\n}\n\nfunction getGenerateAuthTokenEndpoint(appConfig, _a) {\n var fid = _a.fid;\n return getInstallationsEndpoint(appConfig) + \"/\" + fid + \"/authTokens:generate\";\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/**\r\n * Returns a valid authentication token for the installation. Generates a new\r\n * token if one doesn't exist, is expired or about to expire.\r\n *\r\n * Should only be called if the Firebase Installation is registered.\r\n */\n\n\nfunction refreshAuthToken(dependencies, forceRefresh) {\n if (forceRefresh === void 0) {\n forceRefresh = false;\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var tokenPromise, entry, authToken, _a;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4\n /*yield*/\n , update(dependencies.appConfig, function (oldEntry) {\n if (!isEntryRegistered(oldEntry)) {\n throw ERROR_FACTORY.create(\"not-registered\"\n /* NOT_REGISTERED */\n );\n }\n\n var oldAuthToken = oldEntry.authToken;\n\n if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {\n // There is a valid token in the DB.\n return oldEntry;\n } else if (oldAuthToken.requestStatus === 1\n /* IN_PROGRESS */\n ) {\n // There already is a token request in progress.\n tokenPromise = waitUntilAuthTokenRequest(dependencies, forceRefresh);\n return oldEntry;\n } else {\n // No token or token expired.\n if (!navigator.onLine) {\n throw ERROR_FACTORY.create(\"app-offline\"\n /* APP_OFFLINE */\n );\n }\n\n var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);\n tokenPromise = fetchAuthTokenFromServer(dependencies, inProgressEntry);\n return inProgressEntry;\n }\n })];\n\n case 1:\n entry = _b.sent();\n if (!tokenPromise) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , tokenPromise];\n\n case 2:\n _a = _b.sent();\n return [3\n /*break*/\n , 4];\n\n case 3:\n _a = entry.authToken;\n _b.label = 4;\n\n case 4:\n authToken = _a;\n return [2\n /*return*/\n , authToken];\n }\n });\n });\n}\n/**\r\n * Call only if FID is registered and Auth Token request is in progress.\r\n *\r\n * Waits until the current pending request finishes. If the request times out,\r\n * tries once in this thread as well.\r\n */\n\n\nfunction waitUntilAuthTokenRequest(dependencies, forceRefresh) {\n return __awaiter(this, void 0, void 0, function () {\n var entry, authToken;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , updateAuthTokenRequest(dependencies.appConfig)];\n\n case 1:\n entry = _a.sent();\n _a.label = 2;\n\n case 2:\n if (!(entry.authToken.requestStatus === 1\n /* IN_PROGRESS */\n )) return [3\n /*break*/\n , 5]; // generateAuthToken still in progress.\n\n return [4\n /*yield*/\n , sleep(100)];\n\n case 3:\n // generateAuthToken still in progress.\n _a.sent();\n\n return [4\n /*yield*/\n , updateAuthTokenRequest(dependencies.appConfig)];\n\n case 4:\n entry = _a.sent();\n return [3\n /*break*/\n , 2];\n\n case 5:\n authToken = entry.authToken;\n\n if (authToken.requestStatus === 0\n /* NOT_STARTED */\n ) {\n // The request timed out or failed in a different call. Try again.\n return [2\n /*return*/\n , refreshAuthToken(dependencies, forceRefresh)];\n } else {\n return [2\n /*return*/\n , authToken];\n }\n\n }\n });\n });\n}\n/**\r\n * Called only if there is a GenerateAuthToken request in progress.\r\n *\r\n * Updates the InstallationEntry in the DB based on the status of the\r\n * GenerateAuthToken request.\r\n *\r\n * Returns the updated InstallationEntry.\r\n */\n\n\nfunction updateAuthTokenRequest(appConfig) {\n return update(appConfig, function (oldEntry) {\n if (!isEntryRegistered(oldEntry)) {\n throw ERROR_FACTORY.create(\"not-registered\"\n /* NOT_REGISTERED */\n );\n }\n\n var oldAuthToken = oldEntry.authToken;\n\n if (hasAuthTokenRequestTimedOut(oldAuthToken)) {\n return __assign(__assign({}, oldEntry), {\n authToken: {\n requestStatus: 0\n /* NOT_STARTED */\n\n }\n });\n }\n\n return oldEntry;\n });\n}\n\nfunction fetchAuthTokenFromServer(dependencies, installationEntry) {\n return __awaiter(this, void 0, void 0, function () {\n var authToken, updatedInstallationEntry, e_1, updatedInstallationEntry;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3,, 8]);\n\n return [4\n /*yield*/\n , generateAuthTokenRequest(dependencies, installationEntry)];\n\n case 1:\n authToken = _a.sent();\n updatedInstallationEntry = __assign(__assign({}, installationEntry), {\n authToken: authToken\n });\n return [4\n /*yield*/\n , set(dependencies.appConfig, updatedInstallationEntry)];\n\n case 2:\n _a.sent();\n\n return [2\n /*return*/\n , authToken];\n\n case 3:\n e_1 = _a.sent();\n if (!(isServerError(e_1) && (e_1.customData.serverCode === 401 || e_1.customData.serverCode === 404))) return [3\n /*break*/\n , 5]; // Server returned a \"FID not found\" or a \"Invalid authentication\" error.\n // Generate a new ID next time.\n\n return [4\n /*yield*/\n , remove(dependencies.appConfig)];\n\n case 4:\n // Server returned a \"FID not found\" or a \"Invalid authentication\" error.\n // Generate a new ID next time.\n _a.sent();\n\n return [3\n /*break*/\n , 7];\n\n case 5:\n updatedInstallationEntry = __assign(__assign({}, installationEntry), {\n authToken: {\n requestStatus: 0\n /* NOT_STARTED */\n\n }\n });\n return [4\n /*yield*/\n , set(dependencies.appConfig, updatedInstallationEntry)];\n\n case 6:\n _a.sent();\n\n _a.label = 7;\n\n case 7:\n throw e_1;\n\n case 8:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction isEntryRegistered(installationEntry) {\n return installationEntry !== undefined && installationEntry.registrationStatus === 2\n /* COMPLETED */\n ;\n}\n\nfunction isAuthTokenValid(authToken) {\n return authToken.requestStatus === 2\n /* COMPLETED */\n && !isAuthTokenExpired(authToken);\n}\n\nfunction isAuthTokenExpired(authToken) {\n var now = Date.now();\n return now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER;\n}\n/** Returns an updated InstallationEntry with an InProgressAuthToken. */\n\n\nfunction makeAuthTokenRequestInProgressEntry(oldEntry) {\n var inProgressAuthToken = {\n requestStatus: 1\n /* IN_PROGRESS */\n ,\n requestTime: Date.now()\n };\n return __assign(__assign({}, oldEntry), {\n authToken: inProgressAuthToken\n });\n}\n\nfunction hasAuthTokenRequestTimedOut(authToken) {\n return authToken.requestStatus === 1\n /* IN_PROGRESS */\n && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now();\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction _getId(dependencies) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, installationEntry, registrationPromise;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n return [4\n /*yield*/\n , getInstallationEntry(dependencies.appConfig)];\n\n case 1:\n _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise;\n\n if (registrationPromise) {\n registrationPromise.catch(console.error);\n } else {\n // If the installation is already registered, update the authentication\n // token if needed.\n refreshAuthToken(dependencies).catch(console.error);\n }\n\n return [2\n /*return*/\n , installationEntry.fid];\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction _getToken(dependencies, forceRefresh) {\n if (forceRefresh === void 0) {\n forceRefresh = false;\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var authToken;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , completeInstallationRegistration(dependencies.appConfig)];\n\n case 1:\n _a.sent();\n\n return [4\n /*yield*/\n , refreshAuthToken(dependencies, forceRefresh)];\n\n case 2:\n authToken = _a.sent();\n return [2\n /*return*/\n , authToken.token];\n }\n });\n });\n}\n\nfunction completeInstallationRegistration(appConfig) {\n return __awaiter(this, void 0, void 0, function () {\n var registrationPromise;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , getInstallationEntry(appConfig)];\n\n case 1:\n registrationPromise = _a.sent().registrationPromise;\n if (!registrationPromise) return [3\n /*break*/\n , 3]; // A createInstallation request is in progress. Wait until it finishes.\n\n return [4\n /*yield*/\n , registrationPromise];\n\n case 2:\n // A createInstallation request is in progress. Wait until it finishes.\n _a.sent();\n\n _a.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction deleteInstallationRequest(appConfig, installationEntry) {\n return __awaiter(this, void 0, void 0, function () {\n var endpoint, headers, request, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n endpoint = getDeleteEndpoint(appConfig, installationEntry);\n headers = getHeadersWithAuth(appConfig, installationEntry);\n request = {\n method: 'DELETE',\n headers: headers\n };\n return [4\n /*yield*/\n , retryIfServerError(function () {\n return fetch(endpoint, request);\n })];\n\n case 1:\n response = _a.sent();\n if (!!response.ok) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , getErrorFromResponse('Delete Installation', response)];\n\n case 2:\n throw _a.sent();\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nfunction getDeleteEndpoint(appConfig, _a) {\n var fid = _a.fid;\n return getInstallationsEndpoint(appConfig) + \"/\" + fid;\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction deleteInstallation(dependencies) {\n return __awaiter(this, void 0, void 0, function () {\n var appConfig, entry;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n appConfig = dependencies.appConfig;\n return [4\n /*yield*/\n , update(appConfig, function (oldEntry) {\n if (oldEntry && oldEntry.registrationStatus === 0\n /* NOT_STARTED */\n ) {\n // Delete the unregistered entry without sending a deleteInstallation request.\n return undefined;\n }\n\n return oldEntry;\n })];\n\n case 1:\n entry = _a.sent();\n if (!entry) return [3\n /*break*/\n , 6];\n if (!(entry.registrationStatus === 1\n /* IN_PROGRESS */\n )) return [3\n /*break*/\n , 2]; // Can't delete while trying to register.\n\n throw ERROR_FACTORY.create(\"delete-pending-registration\"\n /* DELETE_PENDING_REGISTRATION */\n );\n\n case 2:\n if (!(entry.registrationStatus === 2\n /* COMPLETED */\n )) return [3\n /*break*/\n , 6];\n if (!!navigator.onLine) return [3\n /*break*/\n , 3];\n throw ERROR_FACTORY.create(\"app-offline\"\n /* APP_OFFLINE */\n );\n\n case 3:\n return [4\n /*yield*/\n , deleteInstallationRequest(appConfig, entry)];\n\n case 4:\n _a.sent();\n\n return [4\n /*yield*/\n , remove(appConfig)];\n\n case 5:\n _a.sent();\n\n _a.label = 6;\n\n case 6:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/**\r\n * Sets a new callback that will get called when Installation ID changes.\r\n * Returns an unsubscribe function that will remove the callback when called.\r\n */\n\n\nfunction _onIdChange(_a, callback) {\n var appConfig = _a.appConfig;\n addCallback(appConfig, callback);\n return function () {\n removeCallback(appConfig, callback);\n };\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction extractAppConfig(app) {\n var e_1, _a;\n\n if (!app || !app.options) {\n throw getMissingValueError('App Configuration');\n }\n\n if (!app.name) {\n throw getMissingValueError('App Name');\n } // Required app config keys\n\n\n var configKeys = ['projectId', 'apiKey', 'appId'];\n\n try {\n for (var configKeys_1 = __values(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) {\n var keyName = configKeys_1_1.value;\n\n if (!app.options[keyName]) {\n throw getMissingValueError(keyName);\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return {\n appName: app.name,\n projectId: app.options.projectId,\n apiKey: app.options.apiKey,\n appId: app.options.appId\n };\n}\n\nfunction getMissingValueError(valueName) {\n return ERROR_FACTORY.create(\"missing-app-config-values\"\n /* MISSING_APP_CONFIG_VALUES */\n , {\n valueName: valueName\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nfunction registerInstallations(instance) {\n var installationsName = 'installations';\n instance.INTERNAL.registerComponent(new Component(installationsName, function (container) {\n var app = container.getProvider('app').getImmediate(); // Throws if app isn't configured properly.\n\n var appConfig = extractAppConfig(app);\n var platformLoggerProvider = container.getProvider('platform-logger');\n var dependencies = {\n appConfig: appConfig,\n platformLoggerProvider: platformLoggerProvider\n };\n var installations = {\n app: app,\n getId: function getId() {\n return _getId(dependencies);\n },\n getToken: function getToken(forceRefresh) {\n return _getToken(dependencies, forceRefresh);\n },\n delete: function _delete() {\n return deleteInstallation(dependencies);\n },\n onIdChange: function onIdChange(callback) {\n return _onIdChange(dependencies, callback);\n }\n };\n return installations;\n }, \"PUBLIC\"\n /* PUBLIC */\n ));\n instance.registerVersion(name, version);\n}\n\nregisterInstallations(firebase);\nexport { registerInstallations };","import { __awaiter, __generator, __assign } from 'tslib';\nimport firebase from '@firebase/app';\nimport '@firebase/installations';\nimport { Logger } from '@firebase/logger';\nimport { ErrorFactory, calculateBackoffMillis, FirebaseError, validateIndexedDBOpenable, isIndexedDBAvailable, isBrowserExtension, areCookiesEnabled } from '@firebase/util';\nimport { Component } from '@firebase/component';\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n// Key to attach FID to in gtag params.\n\nvar GA_FID_KEY = 'firebase_id';\nvar ORIGIN_KEY = 'origin';\nvar FETCH_TIMEOUT_MILLIS = 60 * 1000;\nvar DYNAMIC_CONFIG_URL = 'https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig';\nvar GTAG_URL = 'https://www.googletagmanager.com/gtag/js';\nvar GtagCommand;\n\n(function (GtagCommand) {\n GtagCommand[\"EVENT\"] = \"event\";\n GtagCommand[\"SET\"] = \"set\";\n GtagCommand[\"CONFIG\"] = \"config\";\n})(GtagCommand || (GtagCommand = {}));\n/**\r\n * Officially recommended event names for gtag.js\r\n * Any other string is also allowed.\r\n *\r\n * @public\r\n */\n\n\nvar EventName;\n\n(function (EventName) {\n EventName[\"ADD_SHIPPING_INFO\"] = \"add_shipping_info\";\n EventName[\"ADD_PAYMENT_INFO\"] = \"add_payment_info\";\n EventName[\"ADD_TO_CART\"] = \"add_to_cart\";\n EventName[\"ADD_TO_WISHLIST\"] = \"add_to_wishlist\";\n EventName[\"BEGIN_CHECKOUT\"] = \"begin_checkout\";\n /**\r\n * @deprecated\r\n * This event name is deprecated and is unsupported in updated\r\n * Enhanced Ecommerce reports.\r\n */\n\n EventName[\"CHECKOUT_PROGRESS\"] = \"checkout_progress\";\n EventName[\"EXCEPTION\"] = \"exception\";\n EventName[\"GENERATE_LEAD\"] = \"generate_lead\";\n EventName[\"LOGIN\"] = \"login\";\n EventName[\"PAGE_VIEW\"] = \"page_view\";\n EventName[\"PURCHASE\"] = \"purchase\";\n EventName[\"REFUND\"] = \"refund\";\n EventName[\"REMOVE_FROM_CART\"] = \"remove_from_cart\";\n EventName[\"SCREEN_VIEW\"] = \"screen_view\";\n EventName[\"SEARCH\"] = \"search\";\n EventName[\"SELECT_CONTENT\"] = \"select_content\";\n EventName[\"SELECT_ITEM\"] = \"select_item\";\n EventName[\"SELECT_PROMOTION\"] = \"select_promotion\";\n /** @deprecated */\n\n EventName[\"SET_CHECKOUT_OPTION\"] = \"set_checkout_option\";\n EventName[\"SHARE\"] = \"share\";\n EventName[\"SIGN_UP\"] = \"sign_up\";\n EventName[\"TIMING_COMPLETE\"] = \"timing_complete\";\n EventName[\"VIEW_CART\"] = \"view_cart\";\n EventName[\"VIEW_ITEM\"] = \"view_item\";\n EventName[\"VIEW_ITEM_LIST\"] = \"view_item_list\";\n EventName[\"VIEW_PROMOTION\"] = \"view_promotion\";\n EventName[\"VIEW_SEARCH_RESULTS\"] = \"view_search_results\";\n})(EventName || (EventName = {}));\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/**\r\n * Logs an analytics event through the Firebase SDK.\r\n *\r\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\r\n * @param eventName Google Analytics event name, choose from standard list or use a custom string.\r\n * @param eventParams Analytics event parameters.\r\n */\n\n\nfunction _logEvent(gtagFunction, initializationPromise, eventName, eventParams, options) {\n return __awaiter(this, void 0, void 0, function () {\n var measurementId, params;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(options && options.global)) return [3\n /*break*/\n , 1];\n gtagFunction(GtagCommand.EVENT, eventName, eventParams);\n return [2\n /*return*/\n ];\n\n case 1:\n return [4\n /*yield*/\n , initializationPromise];\n\n case 2:\n measurementId = _a.sent();\n params = __assign(__assign({}, eventParams), {\n 'send_to': measurementId\n });\n gtagFunction(GtagCommand.EVENT, eventName, params);\n _a.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Set screen_name parameter for this Google Analytics ID.\r\n *\r\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\r\n * @param screenName Screen name string to set.\r\n */\n\n\nfunction _setCurrentScreen(gtagFunction, initializationPromise, screenName, options) {\n return __awaiter(this, void 0, void 0, function () {\n var measurementId;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(options && options.global)) return [3\n /*break*/\n , 1];\n gtagFunction(GtagCommand.SET, {\n 'screen_name': screenName\n });\n return [2\n /*return*/\n , Promise.resolve()];\n\n case 1:\n return [4\n /*yield*/\n , initializationPromise];\n\n case 2:\n measurementId = _a.sent();\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'screen_name': screenName\n });\n _a.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Set user_id parameter for this Google Analytics ID.\r\n *\r\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\r\n * @param id User ID string to set\r\n */\n\n\nfunction _setUserId(gtagFunction, initializationPromise, id, options) {\n return __awaiter(this, void 0, void 0, function () {\n var measurementId;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!(options && options.global)) return [3\n /*break*/\n , 1];\n gtagFunction(GtagCommand.SET, {\n 'user_id': id\n });\n return [2\n /*return*/\n , Promise.resolve()];\n\n case 1:\n return [4\n /*yield*/\n , initializationPromise];\n\n case 2:\n measurementId = _a.sent();\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'user_id': id\n });\n _a.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Set all other user properties other than user_id and screen_name.\r\n *\r\n * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event\r\n * @param properties Map of user properties to set\r\n */\n\n\nfunction _setUserProperties(gtagFunction, initializationPromise, properties, options) {\n return __awaiter(this, void 0, void 0, function () {\n var flatProperties, _i, _a, key, measurementId;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!(options && options.global)) return [3\n /*break*/\n , 1];\n flatProperties = {};\n\n for (_i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {\n key = _a[_i]; // use dot notation for merge behavior in gtag.js\n\n flatProperties[\"user_properties.\" + key] = properties[key];\n }\n\n gtagFunction(GtagCommand.SET, flatProperties);\n return [2\n /*return*/\n , Promise.resolve()];\n\n case 1:\n return [4\n /*yield*/\n , initializationPromise];\n\n case 2:\n measurementId = _b.sent();\n gtagFunction(GtagCommand.CONFIG, measurementId, {\n update: true,\n 'user_properties': properties\n });\n _b.label = 3;\n\n case 3:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Set whether collection is enabled for this ID.\r\n *\r\n * @param enabled If true, collection is enabled for this ID.\r\n */\n\n\nfunction _setAnalyticsCollectionEnabled(initializationPromise, enabled) {\n return __awaiter(this, void 0, void 0, function () {\n var measurementId;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , initializationPromise];\n\n case 1:\n measurementId = _a.sent();\n window[\"ga-disable-\" + measurementId] = !enabled;\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nvar logger = new Logger('@firebase/analytics');\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/**\r\n * Inserts gtag script tag into the page to asynchronously download gtag.\r\n * @param dataLayerName Name of datalayer (most often the default, \"_dataLayer\").\r\n */\n\nfunction insertScriptTag(dataLayerName, measurementId) {\n var script = document.createElement('script');\n script.src = GTAG_URL + \"?l=\" + dataLayerName + \"&id=\" + measurementId;\n script.async = true;\n document.head.appendChild(script);\n}\n/**\r\n * Get reference to, or create, global datalayer.\r\n * @param dataLayerName Name of datalayer (most often the default, \"_dataLayer\").\r\n */\n\n\nfunction getOrCreateDataLayer(dataLayerName) {\n // Check for existing dataLayer and create if needed.\n var dataLayer = [];\n\n if (Array.isArray(window[dataLayerName])) {\n dataLayer = window[dataLayerName];\n } else {\n window[dataLayerName] = dataLayer;\n }\n\n return dataLayer;\n}\n/**\r\n * Wrapped gtag logic when gtag is called with 'config' command.\r\n *\r\n * @param gtagCore Basic gtag function that just appends to dataLayer.\r\n * @param initializationPromisesMap Map of appIds to their initialization promises.\r\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\r\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\r\n * @param measurementId GA Measurement ID to set config for.\r\n * @param gtagParams Gtag config params to set.\r\n */\n\n\nfunction gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, measurementId, gtagParams) {\n return __awaiter(this, void 0, void 0, function () {\n var correspondingAppId, dynamicConfigResults, foundConfig, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n correspondingAppId = measurementIdToAppId[measurementId];\n _a.label = 1;\n\n case 1:\n _a.trys.push([1, 7,, 8]);\n\n if (!correspondingAppId) return [3\n /*break*/\n , 3];\n return [4\n /*yield*/\n , initializationPromisesMap[correspondingAppId]];\n\n case 2:\n _a.sent();\n\n return [3\n /*break*/\n , 6];\n\n case 3:\n return [4\n /*yield*/\n , Promise.all(dynamicConfigPromisesList)];\n\n case 4:\n dynamicConfigResults = _a.sent();\n foundConfig = dynamicConfigResults.find(function (config) {\n return config.measurementId === measurementId;\n });\n if (!foundConfig) return [3\n /*break*/\n , 6];\n return [4\n /*yield*/\n , initializationPromisesMap[foundConfig.appId]];\n\n case 5:\n _a.sent();\n\n _a.label = 6;\n\n case 6:\n return [3\n /*break*/\n , 8];\n\n case 7:\n e_1 = _a.sent();\n logger.error(e_1);\n return [3\n /*break*/\n , 8];\n\n case 8:\n gtagCore(GtagCommand.CONFIG, measurementId, gtagParams);\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Wrapped gtag logic when gtag is called with 'event' command.\r\n *\r\n * @param gtagCore Basic gtag function that just appends to dataLayer.\r\n * @param initializationPromisesMap Map of appIds to their initialization promises.\r\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\r\n * @param measurementId GA Measurement ID to log event to.\r\n * @param gtagParams Params to log with this event.\r\n */\n\n\nfunction gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementId, gtagParams) {\n return __awaiter(this, void 0, void 0, function () {\n var initializationPromisesToWaitFor, gaSendToList, dynamicConfigResults, _loop_1, _i, gaSendToList_1, sendToId, state_1, e_2;\n\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 4,, 5]);\n\n initializationPromisesToWaitFor = [];\n if (!(gtagParams && gtagParams['send_to'])) return [3\n /*break*/\n , 2];\n gaSendToList = gtagParams['send_to']; // Make it an array if is isn't, so it can be dealt with the same way.\n\n if (!Array.isArray(gaSendToList)) {\n gaSendToList = [gaSendToList];\n }\n\n return [4\n /*yield*/\n , Promise.all(dynamicConfigPromisesList)];\n\n case 1:\n dynamicConfigResults = _a.sent();\n\n _loop_1 = function _loop_1(sendToId) {\n // Any fetched dynamic measurement ID that matches this 'send_to' ID\n var foundConfig = dynamicConfigResults.find(function (config) {\n return config.measurementId === sendToId;\n });\n var initializationPromise = foundConfig && initializationPromisesMap[foundConfig.appId];\n\n if (initializationPromise) {\n initializationPromisesToWaitFor.push(initializationPromise);\n } else {\n // Found an item in 'send_to' that is not associated\n // directly with an FID, possibly a group. Empty this array,\n // exit the loop early, and let it get populated below.\n initializationPromisesToWaitFor = [];\n return \"break\";\n }\n };\n\n for (_i = 0, gaSendToList_1 = gaSendToList; _i < gaSendToList_1.length; _i++) {\n sendToId = gaSendToList_1[_i];\n state_1 = _loop_1(sendToId);\n if (state_1 === \"break\") break;\n }\n\n _a.label = 2;\n\n case 2:\n // This will be unpopulated if there was no 'send_to' field , or\n // if not all entries in the 'send_to' field could be mapped to\n // a FID. In these cases, wait on all pending initialization promises.\n if (initializationPromisesToWaitFor.length === 0) {\n initializationPromisesToWaitFor = Object.values(initializationPromisesMap);\n } // Run core gtag function with args after all relevant initialization\n // promises have been resolved.\n\n\n return [4\n /*yield*/\n , Promise.all(initializationPromisesToWaitFor)];\n\n case 3:\n // Run core gtag function with args after all relevant initialization\n // promises have been resolved.\n _a.sent(); // Workaround for http://b/141370449 - third argument cannot be undefined.\n\n\n gtagCore(GtagCommand.EVENT, measurementId, gtagParams || {});\n return [3\n /*break*/\n , 5];\n\n case 4:\n e_2 = _a.sent();\n logger.error(e_2);\n return [3\n /*break*/\n , 5];\n\n case 5:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Wraps a standard gtag function with extra code to wait for completion of\r\n * relevant initialization promises before sending requests.\r\n *\r\n * @param gtagCore Basic gtag function that just appends to dataLayer.\r\n * @param initializationPromisesMap Map of appIds to their initialization promises.\r\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\r\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\r\n */\n\n\nfunction wrapGtag(gtagCore,\n/**\r\n * Allows wrapped gtag calls to wait on whichever intialization promises are required,\r\n * depending on the contents of the gtag params' `send_to` field, if any.\r\n */\ninitializationPromisesMap,\n/**\r\n * Wrapped gtag calls sometimes require all dynamic config fetches to have returned\r\n * before determining what initialization promises (which include FIDs) to wait for.\r\n */\ndynamicConfigPromisesList,\n/**\r\n * Wrapped gtag config calls can narrow down which initialization promise (with FID)\r\n * to wait for if the measurementId is already fetched, by getting the corresponding appId,\r\n * which is the key for the initialization promises map.\r\n */\nmeasurementIdToAppId) {\n /**\r\n * Wrapper around gtag that ensures FID is sent with gtag calls.\r\n * @param command Gtag command type.\r\n * @param idOrNameOrParams Measurement ID if command is EVENT/CONFIG, params if command is SET.\r\n * @param gtagParams Params if event is EVENT/CONFIG.\r\n */\n function gtagWrapper(command, idOrNameOrParams, gtagParams) {\n return __awaiter(this, void 0, void 0, function () {\n var e_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 6,, 7]);\n\n if (!(command === GtagCommand.EVENT)) return [3\n /*break*/\n , 2]; // If EVENT, second arg must be measurementId.\n\n return [4\n /*yield*/\n , gtagOnEvent(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, idOrNameOrParams, gtagParams)];\n\n case 1:\n // If EVENT, second arg must be measurementId.\n _a.sent();\n\n return [3\n /*break*/\n , 5];\n\n case 2:\n if (!(command === GtagCommand.CONFIG)) return [3\n /*break*/\n , 4]; // If CONFIG, second arg must be measurementId.\n\n return [4\n /*yield*/\n , gtagOnConfig(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, idOrNameOrParams, gtagParams)];\n\n case 3:\n // If CONFIG, second arg must be measurementId.\n _a.sent();\n\n return [3\n /*break*/\n , 5];\n\n case 4:\n // If SET, second arg must be params.\n gtagCore(GtagCommand.SET, idOrNameOrParams);\n _a.label = 5;\n\n case 5:\n return [3\n /*break*/\n , 7];\n\n case 6:\n e_3 = _a.sent();\n logger.error(e_3);\n return [3\n /*break*/\n , 7];\n\n case 7:\n return [2\n /*return*/\n ];\n }\n });\n });\n }\n\n return gtagWrapper;\n}\n/**\r\n * Creates global gtag function or wraps existing one if found.\r\n * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and\r\n * 'event' calls that belong to the GAID associated with this Firebase instance.\r\n *\r\n * @param initializationPromisesMap Map of appIds to their initialization promises.\r\n * @param dynamicConfigPromisesList Array of dynamic config fetch promises.\r\n * @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.\r\n * @param dataLayerName Name of global GA datalayer array.\r\n * @param gtagFunctionName Name of global gtag function (\"gtag\" if not user-specified).\r\n */\n\n\nfunction wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagFunctionName) {\n // Create a basic core gtag function\n var gtagCore = function gtagCore() {\n var _args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n } // Must push IArguments object, not an array.\n\n\n window[dataLayerName].push(arguments);\n }; // Replace it with existing one if found\n\n\n if (window[gtagFunctionName] && typeof window[gtagFunctionName] === 'function') {\n // @ts-ignore\n gtagCore = window[gtagFunctionName];\n }\n\n window[gtagFunctionName] = wrapGtag(gtagCore, initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId);\n return {\n gtagCore: gtagCore,\n wrappedGtag: window[gtagFunctionName]\n };\n}\n/**\r\n * Returns first script tag in DOM matching our gtag url pattern.\r\n */\n\n\nfunction findGtagScriptOnPage() {\n var scriptTags = window.document.getElementsByTagName('script');\n\n for (var _i = 0, _a = Object.values(scriptTags); _i < _a.length; _i++) {\n var tag = _a[_i];\n\n if (tag.src && tag.src.includes(GTAG_URL)) {\n return tag;\n }\n }\n\n return null;\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n\nvar _a;\n\nvar ERRORS = (_a = {}, _a[\"already-exists\"\n/* ALREADY_EXISTS */\n] = 'A Firebase Analytics instance with the appId {$id} ' + ' already exists. ' + 'Only one Firebase Analytics instance can be created for each appId.', _a[\"already-initialized\"\n/* ALREADY_INITIALIZED */\n] = 'Firebase Analytics has already been initialized.' + 'settings() must be called before initializing any Analytics instance' + 'or it will have no effect.', _a[\"interop-component-reg-failed\"\n/* INTEROP_COMPONENT_REG_FAILED */\n] = 'Firebase Analytics Interop Component failed to instantiate: {$reason}', _a[\"invalid-analytics-context\"\n/* INVALID_ANALYTICS_CONTEXT */\n] = 'Firebase Analytics is not supported in this environment. ' + 'Wrap initialization of analytics in analytics.isSupported() ' + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', _a[\"indexeddb-unavailable\"\n/* INDEXEDDB_UNAVAILABLE */\n] = 'IndexedDB unavailable or restricted in this environment. ' + 'Wrap initialization of analytics in analytics.isSupported() ' + 'to prevent initialization in unsupported environments. Details: {$errorInfo}', _a[\"fetch-throttle\"\n/* FETCH_THROTTLE */\n] = 'The config fetch request timed out while in an exponential backoff state.' + ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.', _a[\"config-fetch-failed\"\n/* CONFIG_FETCH_FAILED */\n] = 'Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}', _a[\"no-api-key\"\n/* NO_API_KEY */\n] = 'The \"apiKey\" field is empty in the local Firebase config. Firebase Analytics requires this field to' + 'contain a valid API key.', _a[\"no-app-id\"\n/* NO_APP_ID */\n] = 'The \"appId\" field is empty in the local Firebase config. Firebase Analytics requires this field to' + 'contain a valid app ID.', _a);\nvar ERROR_FACTORY = new ErrorFactory('analytics', 'Analytics', ERRORS);\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\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 */\n\n/**\r\n * Backoff factor for 503 errors, which we want to be conservative about\r\n * to avoid overloading servers. Each retry interval will be\r\n * BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one\r\n * will be ~30 seconds (with fuzzing).\r\n */\n\nvar LONG_RETRY_FACTOR = 30;\n/**\r\n * Base wait interval to multiplied by backoffFactor^backoffCount.\r\n */\n\nvar BASE_INTERVAL_MILLIS = 1000;\n/**\r\n * Stubbable retry data storage class.\r\n */\n\nvar RetryData = function () {\n function RetryData(throttleMetadata, intervalMillis) {\n if (throttleMetadata === void 0) {\n throttleMetadata = {};\n }\n\n if (intervalMillis === void 0) {\n intervalMillis = BASE_INTERVAL_MILLIS;\n }\n\n this.throttleMetadata = throttleMetadata;\n this.intervalMillis = intervalMillis;\n }\n\n RetryData.prototype.getThrottleMetadata = function (appId) {\n return this.throttleMetadata[appId];\n };\n\n RetryData.prototype.setThrottleMetadata = function (appId, metadata) {\n this.throttleMetadata[appId] = metadata;\n };\n\n RetryData.prototype.deleteThrottleMetadata = function (appId) {\n delete this.throttleMetadata[appId];\n };\n\n return RetryData;\n}();\n\nvar defaultRetryData = new RetryData();\n/**\r\n * Set GET request headers.\r\n * @param apiKey App API key.\r\n */\n\nfunction getHeaders(apiKey) {\n return new Headers({\n Accept: 'application/json',\n 'x-goog-api-key': apiKey\n });\n}\n/**\r\n * Fetches dynamic config from backend.\r\n * @param app Firebase app to fetch config for.\r\n */\n\n\nfunction fetchDynamicConfig(appFields) {\n var _a;\n\n return __awaiter(this, void 0, void 0, function () {\n var appId, apiKey, request, appUrl, response, errorMessage, jsonResponse;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n appId = appFields.appId, apiKey = appFields.apiKey;\n request = {\n method: 'GET',\n headers: getHeaders(apiKey)\n };\n appUrl = DYNAMIC_CONFIG_URL.replace('{app-id}', appId);\n return [4\n /*yield*/\n , fetch(appUrl, request)];\n\n case 1:\n response = _b.sent();\n if (!(response.status !== 200 && response.status !== 304)) return [3\n /*break*/\n , 6];\n errorMessage = '';\n _b.label = 2;\n\n case 2:\n _b.trys.push([2, 4,, 5]);\n\n return [4\n /*yield*/\n , response.json()];\n\n case 3:\n jsonResponse = _b.sent();\n\n if ((_a = jsonResponse.error) === null || _a === void 0 ? void 0 : _a.message) {\n errorMessage = jsonResponse.error.message;\n }\n\n return [3\n /*break*/\n , 5];\n\n case 4:\n _b.sent();\n\n return [3\n /*break*/\n , 5];\n\n case 5:\n throw ERROR_FACTORY.create(\"config-fetch-failed\"\n /* CONFIG_FETCH_FAILED */\n , {\n httpStatus: response.status,\n responseMessage: errorMessage\n });\n\n case 6:\n return [2\n /*return*/\n , response.json()];\n }\n });\n });\n}\n/**\r\n * Fetches dynamic config from backend, retrying if failed.\r\n * @param app Firebase app to fetch config for.\r\n */\n\n\nfunction fetchDynamicConfigWithRetry(app, // retryData and timeoutMillis are parameterized to allow passing a different value for testing.\nretryData, timeoutMillis) {\n if (retryData === void 0) {\n retryData = defaultRetryData;\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var _a, appId, apiKey, measurementId, throttleMetadata, signal;\n\n var _this = this;\n\n return __generator(this, function (_b) {\n _a = app.options, appId = _a.appId, apiKey = _a.apiKey, measurementId = _a.measurementId;\n\n if (!appId) {\n throw ERROR_FACTORY.create(\"no-app-id\"\n /* NO_APP_ID */\n );\n }\n\n if (!apiKey) {\n if (measurementId) {\n return [2\n /*return*/\n , {\n measurementId: measurementId,\n appId: appId\n }];\n }\n\n throw ERROR_FACTORY.create(\"no-api-key\"\n /* NO_API_KEY */\n );\n }\n\n throttleMetadata = retryData.getThrottleMetadata(appId) || {\n backoffCount: 0,\n throttleEndTimeMillis: Date.now()\n };\n signal = new AnalyticsAbortSignal();\n setTimeout(function () {\n return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n // Note a very low delay, eg < 10ms, can elapse before listeners are initialized.\n signal.abort();\n return [2\n /*return*/\n ];\n });\n });\n }, timeoutMillis !== undefined ? timeoutMillis : FETCH_TIMEOUT_MILLIS);\n return [2\n /*return*/\n , attemptFetchDynamicConfigWithRetry({\n appId: appId,\n apiKey: apiKey,\n measurementId: measurementId\n }, throttleMetadata, signal, retryData)];\n });\n });\n}\n/**\r\n * Runs one retry attempt.\r\n * @param appFields Necessary app config fields.\r\n * @param throttleMetadata Ongoing metadata to determine throttling times.\r\n * @param signal Abort signal.\r\n */\n\n\nfunction attemptFetchDynamicConfigWithRetry(appFields, _a, signal, retryData // for testing\n) {\n var throttleEndTimeMillis = _a.throttleEndTimeMillis,\n backoffCount = _a.backoffCount;\n\n if (retryData === void 0) {\n retryData = defaultRetryData;\n }\n\n return __awaiter(this, void 0, void 0, function () {\n var appId, measurementId, e_1, response, e_2, backoffMillis, throttleMetadata;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n appId = appFields.appId, measurementId = appFields.measurementId;\n _b.label = 1;\n\n case 1:\n _b.trys.push([1, 3,, 4]);\n\n return [4\n /*yield*/\n , setAbortableTimeout(signal, throttleEndTimeMillis)];\n\n case 2:\n _b.sent();\n\n return [3\n /*break*/\n , 4];\n\n case 3:\n e_1 = _b.sent();\n\n if (measurementId) {\n logger.warn(\"Timed out fetching this Firebase app's measurement ID from the server.\" + (\" Falling back to the measurement ID \" + measurementId) + (\" provided in the \\\"measurementId\\\" field in the local Firebase config. [\" + e_1.message + \"]\"));\n return [2\n /*return*/\n , {\n appId: appId,\n measurementId: measurementId\n }];\n }\n\n throw e_1;\n\n case 4:\n _b.trys.push([4, 6,, 7]);\n\n return [4\n /*yield*/\n , fetchDynamicConfig(appFields)];\n\n case 5:\n response = _b.sent(); // Note the SDK only clears throttle state if response is success or non-retriable.\n\n retryData.deleteThrottleMetadata(appId);\n return [2\n /*return*/\n , response];\n\n case 6:\n e_2 = _b.sent();\n\n if (!isRetriableError(e_2)) {\n retryData.deleteThrottleMetadata(appId);\n\n if (measurementId) {\n logger.warn(\"Failed to fetch this Firebase app's measurement ID from the server.\" + (\" Falling back to the measurement ID \" + measurementId) + (\" provided in the \\\"measurementId\\\" field in the local Firebase config. [\" + e_2.message + \"]\"));\n return [2\n /*return*/\n , {\n appId: appId,\n measurementId: measurementId\n }];\n } else {\n throw e_2;\n }\n }\n\n backoffMillis = Number(e_2.customData.httpStatus) === 503 ? calculateBackoffMillis(backoffCount, retryData.intervalMillis, LONG_RETRY_FACTOR) : calculateBackoffMillis(backoffCount, retryData.intervalMillis);\n throttleMetadata = {\n throttleEndTimeMillis: Date.now() + backoffMillis,\n backoffCount: backoffCount + 1\n }; // Persists state.\n\n retryData.setThrottleMetadata(appId, throttleMetadata);\n logger.debug(\"Calling attemptFetch again in \" + backoffMillis + \" millis\");\n return [2\n /*return*/\n , attemptFetchDynamicConfigWithRetry(appFields, throttleMetadata, signal, retryData)];\n\n case 7:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n/**\r\n * Supports waiting on a backoff by:\r\n *\r\n * <ul>\r\n * <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li>\r\n * <li>Listening on a signal bus for abort events, just like the Fetch API</li>\r\n * <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled\r\n * request appear the same.</li>\r\n * </ul>\r\n *\r\n * <p>Visible for testing.\r\n */\n\n\nfunction setAbortableTimeout(signal, throttleEndTimeMillis) {\n return new Promise(function (resolve, reject) {\n // Derives backoff from given end time, normalizing negative numbers to zero.\n var backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0);\n var timeout = setTimeout(resolve, backoffMillis); // Adds listener, rather than sets onabort, because signal is a shared object.\n\n signal.addEventListener(function () {\n clearTimeout(timeout); // If the request completes before this timeout, the rejection has no effect.\n\n reject(ERROR_FACTORY.create(\"fetch-throttle\"\n /* FETCH_THROTTLE */\n , {\n throttleEndTimeMillis: throttleEndTimeMillis\n }));\n });\n });\n}\n/**\r\n * Returns true if the {@link Error} indicates a fetch request may succeed later.\r\n */\n\n\nfunction isRetriableError(e) {\n if (!(e instanceof FirebaseError) || !e.customData) {\n return false;\n } // Uses string index defined by ErrorData, which FirebaseError implements.\n\n\n var httpStatus = Number(e.customData['httpStatus']);\n return httpStatus === 429 || httpStatus === 500 || httpStatus === 503 || httpStatus === 504;\n}\n/**\r\n * Shims a minimal AbortSignal (copied from Remote Config).\r\n *\r\n * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects\r\n * of networking, such as retries. Firebase doesn't use AbortController enough to justify a\r\n * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be\r\n * swapped out if/when we do.\r\n */\n\n\nvar AnalyticsAbortSignal = function () {\n function AnalyticsAbortSignal() {\n this.listeners = [];\n }\n\n AnalyticsAbortSignal.prototype.addEventListener = function (listener) {\n this.listeners.push(listener);\n };\n\n AnalyticsAbortSignal.prototype.abort = function () {\n this.listeners.forEach(function (listener) {\n return listener();\n });\n };\n\n return AnalyticsAbortSignal;\n}();\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\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 */\n\n\nfunction validateIndexedDB() {\n return __awaiter(this, void 0, void 0, function () {\n var e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!!isIndexedDBAvailable()) return [3\n /*break*/\n , 1];\n logger.warn(ERROR_FACTORY.create(\"indexeddb-unavailable\"\n /* INDEXEDDB_UNAVAILABLE */\n , {\n errorInfo: 'IndexedDB is not available in this environment.'\n }).message);\n return [2\n /*return*/\n , false];\n\n case 1:\n _a.trys.push([1, 3,, 4]);\n\n return [4\n /*yield*/\n , validateIndexedDBOpenable()];\n\n case 2:\n _a.sent();\n\n return [3\n /*break*/\n , 4];\n\n case 3:\n e_1 = _a.sent();\n logger.warn(ERROR_FACTORY.create(\"indexeddb-unavailable\"\n /* INDEXEDDB_UNAVAILABLE */\n , {\n errorInfo: e_1\n }).message);\n return [2\n /*return*/\n , false];\n\n case 4:\n return [2\n /*return*/\n , true];\n }\n });\n });\n}\n/**\r\n * Initialize the analytics instance in gtag.js by calling config command with fid.\r\n *\r\n * NOTE: We combine analytics initialization and setting fid together because we want fid to be\r\n * part of the `page_view` event that's sent during the initialization\r\n * @param app Firebase app\r\n * @param gtagCore The gtag function that's not wrapped.\r\n * @param dynamicConfigPromisesList Array of all dynamic config promises.\r\n * @param measurementIdToAppId Maps measurementID to appID.\r\n * @param installations FirebaseInstallations instance.\r\n *\r\n * @returns Measurement ID.\r\n */\n\n\nfunction initializeIds(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCore, dataLayerName) {\n return __awaiter(this, void 0, void 0, function () {\n var dynamicConfigPromise, fidPromise, _a, dynamicConfig, fid, configProperties;\n\n var _b;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n dynamicConfigPromise = fetchDynamicConfigWithRetry(app); // Once fetched, map measurementIds to appId, for ease of lookup in wrapped gtag function.\n\n dynamicConfigPromise.then(function (config) {\n measurementIdToAppId[config.measurementId] = config.appId;\n\n if (app.options.measurementId && config.measurementId !== app.options.measurementId) {\n logger.warn(\"The measurement ID in the local Firebase config (\" + app.options.measurementId + \")\" + (\" does not match the measurement ID fetched from the server (\" + config.measurementId + \").\") + \" To ensure analytics events are always sent to the correct Analytics property,\" + \" update the\" + \" measurement ID field in the local config or remove it from the local config.\");\n }\n }).catch(function (e) {\n return logger.error(e);\n }); // Add to list to track state of all dynamic config promises.\n\n dynamicConfigPromisesList.push(dynamicConfigPromise);\n fidPromise = validateIndexedDB().then(function (envIsValid) {\n if (envIsValid) {\n return installations.getId();\n } else {\n return undefined;\n }\n });\n return [4\n /*yield*/\n , Promise.all([dynamicConfigPromise, fidPromise])];\n\n case 1:\n _a = _c.sent(), dynamicConfig = _a[0], fid = _a[1]; // Detect if user has already put the gtag <script> tag on this page.\n\n if (!findGtagScriptOnPage()) {\n insertScriptTag(dataLayerName, dynamicConfig.measurementId);\n } // This command initializes gtag.js and only needs to be called once for the entire web app,\n // but since it is idempotent, we can call it multiple times.\n // We keep it together with other initialization logic for better code structure.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\n\n gtagCore('js', new Date());\n configProperties = (_b = {}, // guard against developers accidentally setting properties with prefix `firebase_`\n _b[ORIGIN_KEY] = 'firebase', _b.update = true, _b);\n\n if (fid != null) {\n configProperties[GA_FID_KEY] = fid;\n } // It should be the first config command called on this GA-ID\n // Initialize this GA-ID and set FID on it using the gtag config API.\n // Note: This will trigger a page_view event unless 'send_page_view' is set to false in\n // `configProperties`.\n\n\n gtagCore(GtagCommand.CONFIG, dynamicConfig.measurementId, configProperties);\n return [2\n /*return*/\n , dynamicConfig.measurementId];\n }\n });\n });\n}\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\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 */\n\n/**\r\n * Maps appId to full initialization promise. Wrapped gtag calls must wait on\r\n * all or some of these, depending on the call's `send_to` param and the status\r\n * of the dynamic config fetches (see below).\r\n */\n\n\nvar initializationPromisesMap = {};\n/**\r\n * List of dynamic config fetch promises. In certain cases, wrapped gtag calls\r\n * wait on all these to be complete in order to determine if it can selectively\r\n * wait for only certain initialization (FID) promises or if it must wait for all.\r\n */\n\nvar dynamicConfigPromisesList = [];\n/**\r\n * Maps fetched measurementIds to appId. Populated when the app's dynamic config\r\n * fetch completes. If already populated, gtag config calls can use this to\r\n * selectively wait for only this app's initialization promise (FID) instead of all\r\n * initialization promises.\r\n */\n\nvar measurementIdToAppId = {};\n/**\r\n * Name for window global data layer array used by GA: defaults to 'dataLayer'.\r\n */\n\nvar dataLayerName = 'dataLayer';\n/**\r\n * Name for window global gtag function used by GA: defaults to 'gtag'.\r\n */\n\nvar gtagName = 'gtag';\n/**\r\n * Reproduction of standard gtag function or reference to existing\r\n * gtag function on window object.\r\n */\n\nvar gtagCoreFunction;\n/**\r\n * Wrapper around gtag function that ensures FID is sent with all\r\n * relevant event and config calls.\r\n */\n\nvar wrappedGtagFunction;\n/**\r\n * Flag to ensure page initialization steps (creation or wrapping of\r\n * dataLayer and gtag script) are only run once per page load.\r\n */\n\nvar globalInitDone = false;\n/**\r\n * For testing\r\n */\n\nfunction resetGlobalVars(newGlobalInitDone, newInitializationPromisesMap, newDynamicPromises) {\n if (newGlobalInitDone === void 0) {\n newGlobalInitDone = false;\n }\n\n if (newInitializationPromisesMap === void 0) {\n newInitializationPromisesMap = {};\n }\n\n if (newDynamicPromises === void 0) {\n newDynamicPromises = [];\n }\n\n globalInitDone = newGlobalInitDone;\n initializationPromisesMap = newInitializationPromisesMap;\n dynamicConfigPromisesList = newDynamicPromises;\n dataLayerName = 'dataLayer';\n gtagName = 'gtag';\n}\n/**\r\n * For testing\r\n */\n\n\nfunction getGlobalVars() {\n return {\n initializationPromisesMap: initializationPromisesMap,\n dynamicConfigPromisesList: dynamicConfigPromisesList\n };\n}\n/**\r\n * This must be run before calling firebase.analytics() or it won't\r\n * have any effect.\r\n * @param options Custom gtag and dataLayer names.\r\n */\n\n\nfunction settings(options) {\n if (globalInitDone) {\n throw ERROR_FACTORY.create(\"already-initialized\"\n /* ALREADY_INITIALIZED */\n );\n }\n\n if (options.dataLayerName) {\n dataLayerName = options.dataLayerName;\n }\n\n if (options.gtagName) {\n gtagName = options.gtagName;\n }\n}\n/**\r\n * Returns true if no environment mismatch is found.\r\n * If environment mismatches are found, throws an INVALID_ANALYTICS_CONTEXT\r\n * error that also lists details for each mismatch found.\r\n */\n\n\nfunction warnOnBrowserContextMismatch() {\n var mismatchedEnvMessages = [];\n\n if (isBrowserExtension()) {\n mismatchedEnvMessages.push('This is a browser extension environment.');\n }\n\n if (!areCookiesEnabled()) {\n mismatchedEnvMessages.push('Cookies are not available.');\n }\n\n if (mismatchedEnvMessages.length > 0) {\n var details = mismatchedEnvMessages.map(function (message, index) {\n return \"(\" + (index + 1) + \") \" + message;\n }).join(' ');\n var err = ERROR_FACTORY.create(\"invalid-analytics-context\"\n /* INVALID_ANALYTICS_CONTEXT */\n , {\n errorInfo: details\n });\n logger.warn(err.message);\n }\n}\n\nfunction factory(app, installations) {\n warnOnBrowserContextMismatch();\n var appId = app.options.appId;\n\n if (!appId) {\n throw ERROR_FACTORY.create(\"no-app-id\"\n /* NO_APP_ID */\n );\n }\n\n if (!app.options.apiKey) {\n if (app.options.measurementId) {\n logger.warn(\"The \\\"apiKey\\\" field is empty in the local Firebase config. This is needed to fetch the latest\" + (\" measurement ID for this Firebase app. Falling back to the measurement ID \" + app.options.measurementId) + \" provided in the \\\"measurementId\\\" field in the local Firebase config.\");\n } else {\n throw ERROR_FACTORY.create(\"no-api-key\"\n /* NO_API_KEY */\n );\n }\n }\n\n if (initializationPromisesMap[appId] != null) {\n throw ERROR_FACTORY.create(\"already-exists\"\n /* ALREADY_EXISTS */\n , {\n id: appId\n });\n }\n\n if (!globalInitDone) {\n // Steps here should only be done once per page: creation or wrapping\n // of dataLayer and global gtag function.\n getOrCreateDataLayer(dataLayerName);\n\n var _a = wrapOrCreateGtag(initializationPromisesMap, dynamicConfigPromisesList, measurementIdToAppId, dataLayerName, gtagName),\n wrappedGtag = _a.wrappedGtag,\n gtagCore = _a.gtagCore;\n\n wrappedGtagFunction = wrappedGtag;\n gtagCoreFunction = gtagCore;\n globalInitDone = true;\n } // Async but non-blocking.\n // This map reflects the completion state of all promises for each appId.\n\n\n initializationPromisesMap[appId] = initializeIds(app, dynamicConfigPromisesList, measurementIdToAppId, installations, gtagCoreFunction, dataLayerName);\n var analyticsInstance = {\n app: app,\n // Public methods return void for API simplicity and to better match gtag,\n // while internal implementations return promises.\n logEvent: function logEvent(eventName, eventParams, options) {\n _logEvent(wrappedGtagFunction, initializationPromisesMap[appId], eventName, eventParams, options).catch(function (e) {\n return logger.error(e);\n });\n },\n setCurrentScreen: function setCurrentScreen(screenName, options) {\n _setCurrentScreen(wrappedGtagFunction, initializationPromisesMap[appId], screenName, options).catch(function (e) {\n return logger.error(e);\n });\n },\n setUserId: function setUserId(id, options) {\n _setUserId(wrappedGtagFunction, initializationPromisesMap[appId], id, options).catch(function (e) {\n return logger.error(e);\n });\n },\n setUserProperties: function setUserProperties(properties, options) {\n _setUserProperties(wrappedGtagFunction, initializationPromisesMap[appId], properties, options).catch(function (e) {\n return logger.error(e);\n });\n },\n setAnalyticsCollectionEnabled: function setAnalyticsCollectionEnabled(enabled) {\n _setAnalyticsCollectionEnabled(initializationPromisesMap[appId], enabled).catch(function (e) {\n return logger.error(e);\n });\n },\n INTERNAL: {\n delete: function _delete() {\n delete initializationPromisesMap[appId];\n return Promise.resolve();\n }\n }\n };\n return analyticsInstance;\n}\n\nvar name = \"@firebase/analytics\";\nvar version = \"0.6.18\";\n/**\r\n * Type constant for Firebase Analytics.\r\n */\n\nvar ANALYTICS_TYPE = 'analytics';\n\nfunction registerAnalytics(instance) {\n instance.INTERNAL.registerComponent(new Component(ANALYTICS_TYPE, function (container) {\n // getImmediate for FirebaseApp will always succeed\n var app = container.getProvider('app').getImmediate();\n var installations = container.getProvider('installations').getImmediate();\n return factory(app, installations);\n }, \"PUBLIC\"\n /* PUBLIC */\n ).setServiceProps({\n settings: settings,\n EventName: EventName,\n isSupported: isSupported\n }));\n instance.INTERNAL.registerComponent(new Component('analytics-internal', internalFactory, \"PRIVATE\"\n /* PRIVATE */\n ));\n instance.registerVersion(name, version);\n\n function internalFactory(container) {\n try {\n var analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();\n return {\n logEvent: analytics.logEvent\n };\n } catch (e) {\n throw ERROR_FACTORY.create(\"interop-component-reg-failed\"\n /* INTEROP_COMPONENT_REG_FAILED */\n , {\n reason: e\n });\n }\n }\n}\n\nregisterAnalytics(firebase);\n/**\r\n * this is a public static method provided to users that wraps four different checks:\r\n *\r\n * 1. check if it's not a browser extension environment.\r\n * 1. check if cookie is enabled in current browser.\r\n * 3. check if IndexedDB is supported by the browser environment.\r\n * 4. check if the current browser context is valid for using IndexedDB.\r\n *\r\n */\n\nfunction isSupported() {\n return __awaiter(this, void 0, void 0, function () {\n var isDBOpenable;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (isBrowserExtension()) {\n return [2\n /*return*/\n , false];\n }\n\n if (!areCookiesEnabled()) {\n return [2\n /*return*/\n , false];\n }\n\n if (!isIndexedDBAvailable()) {\n return [2\n /*return*/\n , false];\n }\n\n _a.label = 1;\n\n case 1:\n _a.trys.push([1, 3,, 4]);\n\n return [4\n /*yield*/\n , validateIndexedDBOpenable()];\n\n case 2:\n isDBOpenable = _a.sent();\n return [2\n /*return*/\n , isDBOpenable];\n\n case 3:\n _a.sent();\n\n return [2\n /*return*/\n , false];\n\n case 4:\n return [2\n /*return*/\n ];\n }\n });\n });\n}\n\nexport { factory, getGlobalVars, registerAnalytics, resetGlobalVars, settings };","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.idb = {}));\n})(this, function (exports) {\n 'use strict';\n\n function toArray(arr) {\n return Array.prototype.slice.call(arr);\n }\n\n function promisifyRequest(request) {\n return new Promise(function (resolve, reject) {\n request.onsuccess = function () {\n resolve(request.result);\n };\n\n request.onerror = function () {\n reject(request.error);\n };\n });\n }\n\n function promisifyRequestCall(obj, method, args) {\n var request;\n var p = new Promise(function (resolve, reject) {\n request = obj[method].apply(obj, args);\n promisifyRequest(request).then(resolve, reject);\n });\n p.request = request;\n return p;\n }\n\n function promisifyCursorRequestCall(obj, method, args) {\n var p = promisifyRequestCall(obj, method, args);\n return p.then(function (value) {\n if (!value) return;\n return new Cursor(value, p.request);\n });\n }\n\n function proxyProperties(ProxyClass, targetProp, properties) {\n properties.forEach(function (prop) {\n Object.defineProperty(ProxyClass.prototype, prop, {\n get: function get() {\n return this[targetProp][prop];\n },\n set: function set(val) {\n this[targetProp][prop] = val;\n }\n });\n });\n }\n\n function proxyRequestMethods(ProxyClass, targetProp, Constructor, properties) {\n properties.forEach(function (prop) {\n if (!(prop in Constructor.prototype)) return;\n\n ProxyClass.prototype[prop] = function () {\n return promisifyRequestCall(this[targetProp], prop, arguments);\n };\n });\n }\n\n function proxyMethods(ProxyClass, targetProp, Constructor, properties) {\n properties.forEach(function (prop) {\n if (!(prop in Constructor.prototype)) return;\n\n ProxyClass.prototype[prop] = function () {\n return this[targetProp][prop].apply(this[targetProp], arguments);\n };\n });\n }\n\n function proxyCursorRequestMethods(ProxyClass, targetProp, Constructor, properties) {\n properties.forEach(function (prop) {\n if (!(prop in Constructor.prototype)) return;\n\n ProxyClass.prototype[prop] = function () {\n return promisifyCursorRequestCall(this[targetProp], prop, arguments);\n };\n });\n }\n\n function Index(index) {\n this._index = index;\n }\n\n proxyProperties(Index, '_index', ['name', 'keyPath', 'multiEntry', 'unique']);\n proxyRequestMethods(Index, '_index', IDBIndex, ['get', 'getKey', 'getAll', 'getAllKeys', 'count']);\n proxyCursorRequestMethods(Index, '_index', IDBIndex, ['openCursor', 'openKeyCursor']);\n\n function Cursor(cursor, request) {\n this._cursor = cursor;\n this._request = request;\n }\n\n proxyProperties(Cursor, '_cursor', ['direction', 'key', 'primaryKey', 'value']);\n proxyRequestMethods(Cursor, '_cursor', IDBCursor, ['update', 'delete']); // proxy 'next' methods\n\n ['advance', 'continue', 'continuePrimaryKey'].forEach(function (methodName) {\n if (!(methodName in IDBCursor.prototype)) return;\n\n Cursor.prototype[methodName] = function () {\n var cursor = this;\n var args = arguments;\n return Promise.resolve().then(function () {\n cursor._cursor[methodName].apply(cursor._cursor, args);\n\n return promisifyRequest(cursor._request).then(function (value) {\n if (!value) return;\n return new Cursor(value, cursor._request);\n });\n });\n };\n });\n\n function ObjectStore(store) {\n this._store = store;\n }\n\n ObjectStore.prototype.createIndex = function () {\n return new Index(this._store.createIndex.apply(this._store, arguments));\n };\n\n ObjectStore.prototype.index = function () {\n return new Index(this._store.index.apply(this._store, arguments));\n };\n\n proxyProperties(ObjectStore, '_store', ['name', 'keyPath', 'indexNames', 'autoIncrement']);\n proxyRequestMethods(ObjectStore, '_store', IDBObjectStore, ['put', 'add', 'delete', 'clear', 'get', 'getAll', 'getKey', 'getAllKeys', 'count']);\n proxyCursorRequestMethods(ObjectStore, '_store', IDBObjectStore, ['openCursor', 'openKeyCursor']);\n proxyMethods(ObjectStore, '_store', IDBObjectStore, ['deleteIndex']);\n\n function Transaction(idbTransaction) {\n this._tx = idbTransaction;\n this.complete = new Promise(function (resolve, reject) {\n idbTransaction.oncomplete = function () {\n resolve();\n };\n\n idbTransaction.onerror = function () {\n reject(idbTransaction.error);\n };\n\n idbTransaction.onabort = function () {\n reject(idbTransaction.error);\n };\n });\n }\n\n Transaction.prototype.objectStore = function () {\n return new ObjectStore(this._tx.objectStore.apply(this._tx, arguments));\n };\n\n proxyProperties(Transaction, '_tx', ['objectStoreNames', 'mode']);\n proxyMethods(Transaction, '_tx', IDBTransaction, ['abort']);\n\n function UpgradeDB(db, oldVersion, transaction) {\n this._db = db;\n this.oldVersion = oldVersion;\n this.transaction = new Transaction(transaction);\n }\n\n UpgradeDB.prototype.createObjectStore = function () {\n return new ObjectStore(this._db.createObjectStore.apply(this._db, arguments));\n };\n\n proxyProperties(UpgradeDB, '_db', ['name', 'version', 'objectStoreNames']);\n proxyMethods(UpgradeDB, '_db', IDBDatabase, ['deleteObjectStore', 'close']);\n\n function DB(db) {\n this._db = db;\n }\n\n DB.prototype.transaction = function () {\n return new Transaction(this._db.transaction.apply(this._db, arguments));\n };\n\n proxyProperties(DB, '_db', ['name', 'version', 'objectStoreNames']);\n proxyMethods(DB, '_db', IDBDatabase, ['close']); // Add cursor iterators\n // TODO: remove this once browsers do the right thing with promises\n\n ['openCursor', 'openKeyCursor'].forEach(function (funcName) {\n [ObjectStore, Index].forEach(function (Constructor) {\n // Don't create iterateKeyCursor if openKeyCursor doesn't exist.\n if (!(funcName in Constructor.prototype)) return;\n\n Constructor.prototype[funcName.replace('open', 'iterate')] = function () {\n var args = toArray(arguments);\n var callback = args[args.length - 1];\n var nativeObject = this._store || this._index;\n var request = nativeObject[funcName].apply(nativeObject, args.slice(0, -1));\n\n request.onsuccess = function () {\n callback(request.result);\n };\n };\n });\n }); // polyfill getAll\n\n [Index, ObjectStore].forEach(function (Constructor) {\n if (Constructor.prototype.getAll) return;\n\n Constructor.prototype.getAll = function (query, count) {\n var instance = this;\n var items = [];\n return new Promise(function (resolve) {\n instance.iterateCursor(query, function (cursor) {\n if (!cursor) {\n resolve(items);\n return;\n }\n\n items.push(cursor.value);\n\n if (count !== undefined && items.length == count) {\n resolve(items);\n return;\n }\n\n cursor.continue();\n });\n });\n };\n });\n\n function openDb(name, version, upgradeCallback) {\n var p = promisifyRequestCall(indexedDB, 'open', [name, version]);\n var request = p.request;\n\n if (request) {\n request.onupgradeneeded = function (event) {\n if (upgradeCallback) {\n upgradeCallback(new UpgradeDB(request.result, event.oldVersion, request.transaction));\n }\n };\n }\n\n return p.then(function (db) {\n return new DB(db);\n });\n }\n\n function deleteDb(name) {\n return promisifyRequestCall(indexedDB, 'deleteDatabase', [name]);\n }\n\n exports.openDb = openDb;\n exports.deleteDb = deleteDb;\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n});"],"names":["_a","version","PENDING_TIMEOUT_MS","PACKAGE_VERSION","INTERNAL_AUTH_VERSION","TOKEN_EXPIRATION_BUFFER","ERROR_DESCRIPTION_MAP","ERROR_FACTORY","isServerError","error","code","includes","getInstallationsEndpoint","INSTALLATIONS_API_URL","projectId","extractAuthTokenInfoFromResponse","response","token","requestStatus","expiresIn","responseExpiresIn","Number","replace","creationTime","Date","now","getErrorFromResponse","requestName","this","responseJson","errorData","label","json","sent","create","serverCode","serverMessage","message","serverStatus","status","getHeaders","apiKey","Headers","Accept","getHeadersWithAuth","appConfig","refreshToken","headers","append","getAuthorizationHeader","retryIfServerError","fn","result","createInstallationRequest","fid","endpoint","body","request","responseValue","_b","authVersion","appId","sdkVersion","method","JSON","stringify","fetch","ok","registrationStatus","authToken","sleep","ms","Promise","resolve","setTimeout","VALID_FID_PATTERN","generateFid","fidByteArray","Uint8Array","self","crypto","msCrypto","getRandomValues","array","btoa","String","fromCharCode","apply","substr","encode","test","getKey","appName","fidChangeCallbacks","Map","fidChanged","key","callFidChangeCallbacks","channel","getBroadcastChannel","postMessage","closeBroadcastChannel","broadcastFidChange","e_1","callbacks","get","callbacks_1","callbacks_1_1","next","done","callback","value","e_1_1","return","call","broadcastChannel","BroadcastChannel","onmessage","e","data","size","close","instance","OBJECT_STORE_NAME","dbPromise","getDbPromise","openDb","upgradeDB","oldVersion","createObjectStore","set","db","tx","objectStore","oldValue","transaction","put","complete","remove","delete","update","updateFn","store","newValue","undefined","getInstallationEntry","registrationPromise","installationEntry","oldEntry","clearTimedOutRequest","updateOrCreateInstallationEntry","entryWithPromise","navigator","onLine","reject","inProgressEntry","registrationTime","registeredInstallationEntry","trys","push","customData","registerInstallation","waitUntilFidRegistration","triggerRegistrationIfNecessary","entry","updateInstallationRequest","generateAuthTokenRequest","platformLoggerProvider","platformLogger","getGenerateAuthTokenEndpoint","getImmediate","optional","getPlatformInfoString","installation","refreshAuthToken","dependencies","forceRefresh","tokenPromise","isEntryRegistered","oldAuthToken","isAuthTokenExpired","isAuthTokenValid","updateAuthTokenRequest","waitUntilAuthTokenRequest","inProgressAuthToken","requestTime","makeAuthTokenRequestInProgressEntry","updatedInstallationEntry","fetchAuthTokenFromServer","completeInstallationRegistration","deleteInstallationRequest","getDeleteEndpoint","_onIdChange","callbackSet","Set","add","addCallback","removeCallback","getMissingValueError","valueName","INTERNAL","registerComponent","container","app","getProvider","options","name","configKeys_1","configKeys_1_1","keyName","extractAppConfig","installations","getId","catch","console","_getId","getToken","_getToken","deleteInstallation","onIdChange","registerVersion","GtagCommand","EventName","GTAG_URL","logger","gtagOnConfig","gtagCore","initializationPromisesMap","dynamicConfigPromisesList","measurementIdToAppId","measurementId","gtagParams","correspondingAppId","dynamicConfigResults","foundConfig","all","find","config","CONFIG","gtagOnEvent","initializationPromisesToWaitFor","gaSendToList","_loop_1","_i","gaSendToList_1","sendToId","e_2","Array","isArray","initializationPromise","length","Object","values","EVENT","wrapOrCreateGtag","dataLayerName","gtagFunctionName","_args","arguments","window","command","idOrNameOrParams","e_3","SET","wrapGtag","wrappedGtag","ERRORS","defaultRetryData","RetryData","throttleMetadata","intervalMillis","prototype","getThrottleMetadata","setThrottleMetadata","metadata","deleteThrottleMetadata","fetchDynamicConfig","appFields","appUrl","errorMessage","jsonResponse","httpStatus","responseMessage","attemptFetchDynamicConfigWithRetry","signal","retryData","throttleEndTimeMillis","backoffCount","backoffMillis","setAbortableTimeout","warn","isRetriableError","debug","Math","max","timeout","addEventListener","clearTimeout","AnalyticsAbortSignal","listeners","listener","abort","forEach","initializeIds","dynamicConfigPromise","fidPromise","dynamicConfig","configProperties","_c","timeoutMillis","_this","fetchDynamicConfigWithRetry","then","errorInfo","validateIndexedDB","envIsValid","scriptTags","document","getElementsByTagName","tag","src","findGtagScriptOnPage","script","createElement","async","head","appendChild","insertScriptTag","gtagCoreFunction","wrappedGtagFunction","gtagName","globalInitDone","settings","factory","mismatchedEnvMessages","details","map","index","join","err","warnOnBrowserContextMismatch","id","dataLayer","getOrCreateDataLayer","analyticsInstance","logEvent","eventName","eventParams","gtagFunction","params","global","_logEvent","setCurrentScreen","screenName","_setCurrentScreen","setUserId","_setUserId","setUserProperties","properties","flatProperties","keys","_setUserProperties","setAnalyticsCollectionEnabled","enabled","_setAnalyticsCollectionEnabled","ANALYTICS_TYPE","isSupported","setServiceProps","reason","registerAnalytics","exports","toArray","arr","slice","promisifyRequest","onsuccess","onerror","promisifyRequestCall","obj","args","p","promisifyCursorRequestCall","Cursor","proxyProperties","ProxyClass","targetProp","prop","defineProperty","val","proxyRequestMethods","Constructor","proxyMethods","proxyCursorRequestMethods","Index","_index","cursor","_cursor","_request","ObjectStore","_store","Transaction","idbTransaction","_tx","oncomplete","onabort","UpgradeDB","_db","DB","upgradeCallback","indexedDB","onupgradeneeded","event","deleteDb","IDBIndex","IDBCursor","methodName","createIndex","IDBObjectStore","IDBTransaction","IDBDatabase","funcName","nativeObject","getAll","query","count","items","iterateCursor","continue"],"sourceRoot":""}