text: (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["category-category-module"],{
  
  /***/ "./node_modules/@firebase/analytics/dist/index.esm.js":
  /*!************************************************************!*\
    !*** ./node_modules/@firebase/analytics/dist/index.esm.js ***!
    \************************************************************/
  /*! exports provided: factory, getGlobalVars, registerAnalytics, resetGlobalVars, settings */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "factory", function() { return factory; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGlobalVars", function() { return getGlobalVars; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerAnalytics", function() { return registerAnalytics; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetGlobalVars", function() { return resetGlobalVars; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; });
  /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js");
  /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_app__WEBPACK_IMPORTED_MODULE_0__);
  /* harmony import */ var _firebase_installations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/installations */ "./node_modules/@firebase/installations/dist/index.esm.js");
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/index.esm.js");
  /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.cjs.js");
  /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_firebase_util__WEBPACK_IMPORTED_MODULE_4__);
  /* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/index.cjs.js");
  /* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_firebase_component__WEBPACK_IMPORTED_MODULE_5__);
  
  
  
  
  
  
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var ANALYTICS_ID_FIELD = 'measurementId';
  // Key to attach FID to in gtag params.
  var GA_FID_KEY = 'firebase_id';
  var ORIGIN_KEY = 'origin';
  var GTAG_URL = 'https://www.googletagmanager.com/gtag/js';
  var GtagCommand;
  (function (GtagCommand) {
      GtagCommand["EVENT"] = "event";
      GtagCommand["SET"] = "set";
      GtagCommand["CONFIG"] = "config";
  })(GtagCommand || (GtagCommand = {}));
  /*
   * Officially recommended event names for gtag.js
   * Any other string is also allowed.
   */
  var EventName;
  (function (EventName) {
      EventName["ADD_SHIPPING_INFO"] = "add_shipping_info";
      EventName["ADD_PAYMENT_INFO"] = "add_payment_info";
      EventName["ADD_TO_CART"] = "add_to_cart";
      EventName["ADD_TO_WISHLIST"] = "add_to_wishlist";
      EventName["BEGIN_CHECKOUT"] = "begin_checkout";
      /** @deprecated */
      EventName["CHECKOUT_PROGRESS"] = "checkout_progress";
      EventName["EXCEPTION"] = "exception";
      EventName["GENERATE_LEAD"] = "generate_lead";
      EventName["LOGIN"] = "login";
      EventName["PAGE_VIEW"] = "page_view";
      EventName["PURCHASE"] = "purchase";
      EventName["REFUND"] = "refund";
      EventName["REMOVE_FROM_CART"] = "remove_from_cart";
      EventName["SCREEN_VIEW"] = "screen_view";
      EventName["SEARCH"] = "search";
      EventName["SELECT_CONTENT"] = "select_content";
      EventName["SELECT_ITEM"] = "select_item";
      EventName["SELECT_PROMOTION"] = "select_promotion";
      /** @deprecated */
      EventName["SET_CHECKOUT_OPTION"] = "set_checkout_option";
      EventName["SHARE"] = "share";
      EventName["SIGN_UP"] = "sign_up";
      EventName["TIMING_COMPLETE"] = "timing_complete";
      EventName["VIEW_CART"] = "view_cart";
      EventName["VIEW_ITEM"] = "view_item";
      EventName["VIEW_ITEM_LIST"] = "view_item_list";
      EventName["VIEW_PROMOTION"] = "view_promotion";
      EventName["VIEW_SEARCH_RESULTS"] = "view_search_results";
  })(EventName || (EventName = {}));
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Logs an analytics event through the Firebase SDK.
   *
   * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
   * @param eventName Google Analytics event name, choose from standard list or use a custom string.
   * @param eventParams Analytics event parameters.
   */
  function logEvent(gtagFunction, analyticsId, eventName, eventParams, options) {
      var params = eventParams || {};
      if (!options || !options.global) {
          params = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, eventParams), { 'send_to': analyticsId });
      }
      // Workaround for http://b/141370449 - third argument cannot be undefined.
      gtagFunction(GtagCommand.EVENT, eventName, params || {});
  }
  // TODO: Brad is going to add `screen_name` to GA Gold config parameter schema
  /**
   * Set screen_name parameter for this Google Analytics ID.
   *
   * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
   * @param screenName Screen name string to set.
   */
  function setCurrentScreen(gtagFunction, analyticsId, screenName, options) {
      if (options && options.global) {
          gtagFunction(GtagCommand.SET, { 'screen_name': screenName });
      }
      else {
          gtagFunction(GtagCommand.CONFIG, analyticsId, {
              update: true,
              'screen_name': screenName
          });
      }
  }
  /**
   * Set user_id parameter for this Google Analytics ID.
   *
   * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
   * @param id User ID string to set
   */
  function setUserId(gtagFunction, analyticsId, id, options) {
      if (options && options.global) {
          gtagFunction(GtagCommand.SET, { 'user_id': id });
      }
      else {
          gtagFunction(GtagCommand.CONFIG, analyticsId, {
              update: true,
              'user_id': id
          });
      }
  }
  /**
   * Set all other user properties other than user_id and screen_name.
   *
   * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
   * @param properties Map of user properties to set
   */
  function setUserProperties(gtagFunction, analyticsId, properties, options) {
      if (options && options.global) {
          var flatProperties = {};
          for (var _i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {
              var key = _a[_i];
              // use dot notation for merge behavior in gtag.js
              flatProperties["user_properties." + key] = properties[key];
          }
          gtagFunction(GtagCommand.SET, flatProperties);
      }
      else {
          gtagFunction(GtagCommand.CONFIG, analyticsId, {
              update: true,
              'user_properties': properties
          });
      }
  }
  /**
   * Set whether collection is enabled for this ID.
   *
   * @param enabled If true, collection is enabled for this ID.
   */
  function setAnalyticsCollectionEnabled(analyticsId, enabled) {
      window["ga-disable-" + analyticsId] = !enabled;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var logger = new _firebase_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"]('@firebase/analytics');
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Initialize the analytics instance in gtag.js by calling config command with fid.
   *
   * NOTE: We combine analytics initialization and setting fid together because we want fid to be
   * part of the `page_view` event that's sent during the initialization
   * @param app Firebase app
   * @param gtagCore The gtag function that's not wrapped.
   */
  function initializeGAId(app, installations, gtagCore) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var fid;
          var _a;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0: return [4 /*yield*/, installations.getId()];
                  case 1:
                      fid = _b.sent();
                      // This command initializes gtag.js and only needs to be called once for the entire web app,
                      // but since it is idempotent, we can call it multiple times.
                      // We keep it together with other initialization logic for better code structure.
                      // eslint-disable-next-line @typescript-eslint/no-explicit-any
                      gtagCore('js', new Date());
                      // It should be the first config command called on this GA-ID
                      // Initialize this GA-ID and set FID on it using the gtag config API.
                      gtagCore(GtagCommand.CONFIG, app.options[ANALYTICS_ID_FIELD], (_a = {},
                          _a[GA_FID_KEY] = fid,
                          // guard against developers accidentally setting properties with prefix `firebase_`
                          _a[ORIGIN_KEY] = 'firebase',
                          _a.update = true,
                          _a));
                      return [2 /*return*/];
              }
          });
      });
  }
  function insertScriptTag(dataLayerName) {
      var script = document.createElement('script');
      // We are not providing an analyticsId in the URL because it would trigger a `page_view`
      // without fid. We will initialize ga-id using gtag (config) command together with fid.
      script.src = GTAG_URL + "?l=" + dataLayerName;
      script.async = true;
      document.head.appendChild(script);
  }
  /** Get reference to, or create, global datalayer.
   * @param dataLayerName Name of datalayer (most often the default, "_dataLayer")
   */
  function getOrCreateDataLayer(dataLayerName) {
      // Check for existing dataLayer and create if needed.
      var dataLayer = [];
      if (Array.isArray(window[dataLayerName])) {
          dataLayer = window[dataLayerName];
      }
      else {
          window[dataLayerName] = dataLayer;
      }
      return dataLayer;
  }
  /**
   * Wraps a standard gtag function with extra code to wait for completion of
   * relevant initialization promises before sending requests.
   *
   * @param gtagCore Basic gtag function that just appends to dataLayer
   * @param initializedIdPromisesMap Map of gaIds to their initialization promises
   */
  function wrapGtag(gtagCore, initializedIdPromisesMap) {
      return function (command, idOrNameOrParams, gtagParams) {
          // If event, check that relevant initialization promises have completed.
          if (command === GtagCommand.EVENT) {
              var initializationPromisesToWaitFor = [];
              // If there's a 'send_to' param, check if any ID specified matches
              // a FID we have begun a fetch on.
              if (gtagParams && gtagParams['send_to']) {
                  var gaSendToList = gtagParams['send_to'];
                  // Make it an array if is isn't, so it can be dealt with the same way.
                  if (!Array.isArray(gaSendToList)) {
                      gaSendToList = [gaSendToList];
                  }
                  for (var _i = 0, gaSendToList_1 = gaSendToList; _i < gaSendToList_1.length; _i++) {
                      var sendToId = gaSendToList_1[_i];
                      var initializationPromise = initializedIdPromisesMap[sendToId];
                      // Groups will not be in the map.
                      if (initializationPromise) {
                          initializationPromisesToWaitFor.push(initializationPromise);
                      }
                      else {
                          // There is an item in 'send_to' that is not associated
                          // directly with an FID, possibly a group.  Empty this array
                          // and let it get populated below.
                          initializationPromisesToWaitFor = [];
                          break;
                      }
                  }
              }
              // This will be unpopulated if there was no 'send_to' field , or
              // if not all entries in the 'send_to' field could be mapped to
              // a FID. In these cases, wait on all pending initialization promises.
              if (initializationPromisesToWaitFor.length === 0) {
                  for (var _a = 0, _b = Object.values(initializedIdPromisesMap); _a < _b.length; _a++) {
                      var idPromise = _b[_a];
                      initializationPromisesToWaitFor.push(idPromise);
                  }
              }
              // Run core gtag function with args after all relevant initialization
              // promises have been resolved.
              Promise.all(initializationPromisesToWaitFor)
                  // Workaround for http://b/141370449 - third argument cannot be undefined.
                  .then(function () {
                  return gtagCore(GtagCommand.EVENT, idOrNameOrParams, gtagParams || {});
              })
                  .catch(function (e) { return logger.error(e); });
          }
          else if (command === GtagCommand.CONFIG) {
              var initializationPromiseToWait = initializedIdPromisesMap[idOrNameOrParams] ||
                  Promise.resolve();
              initializationPromiseToWait
                  .then(function () {
                  gtagCore(GtagCommand.CONFIG, idOrNameOrParams, gtagParams);
              })
                  .catch(function (e) { return logger.error(e); });
          }
          else {
              // SET command.
              // Splitting calls for CONFIG and SET to make it clear which signature
              // Typescript is checking.
              gtagCore(GtagCommand.SET, idOrNameOrParams);
          }
      };
  }
  /**
   * Creates global gtag function or wraps existing one if found.
   * This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and
   * 'event' calls that belong to the GAID associated with this Firebase instance.
   *
   * @param initializedIdPromisesMap Map of gaId to initialization promises.
   * @param dataLayerName Name of global GA datalayer array.
   * @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified)
   */
  function wrapOrCreateGtag(initializedIdPromisesMap, dataLayerName, gtagFunctionName) {
      // Create a basic core gtag function
      var gtagCore = function () {
          var _args = [];
          for (var _i = 0; _i < arguments.length; _i++) {
              _args[_i] = arguments[_i];
          }
          // Must push IArguments object, not an array.
          window[dataLayerName].push(arguments);
      };
      // Replace it with existing one if found
      if (window[gtagFunctionName] &&
          typeof window[gtagFunctionName] === 'function') {
          // @ts-ignore
          gtagCore = window[gtagFunctionName];
      }
      window[gtagFunctionName] = wrapGtag(gtagCore, initializedIdPromisesMap);
      return {
          gtagCore: gtagCore,
          wrappedGtag: window[gtagFunctionName]
      };
  }
  /**
   * Returns first script tag in DOM matching our gtag url pattern.
   */
  function findGtagScriptOnPage() {
      var scriptTags = window.document.getElementsByTagName('script');
      for (var _i = 0, _a = Object.values(scriptTags); _i < _a.length; _i++) {
          var tag = _a[_i];
          if (tag.src && tag.src.includes(GTAG_URL)) {
              return tag;
          }
      }
      return null;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var _a;
  var ERRORS = (_a = {},
      _a["no-ga-id" /* NO_GA_ID */] = "\"" + ANALYTICS_ID_FIELD + "\" field is empty in " +
          'Firebase config. Firebase Analytics ' +
          'requires this field to contain a valid measurement ID.',
      _a["already-exists" /* ALREADY_EXISTS */] = 'A Firebase Analytics instance with the measurement ID ${id} ' +
          ' already exists. ' +
          'Only one Firebase Analytics instance can be created for each measurement ID.',
      _a["already-initialized" /* ALREADY_INITIALIZED */] = '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" /* INTEROP_COMPONENT_REG_FAILED */] = 'Firebase Analytics Interop Component failed to instantiate',
      _a);
  var ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_4__["ErrorFactory"]('analytics', 'Analytics', ERRORS);
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Maps gaId to FID fetch promises.
   */
  var initializedIdPromisesMap = {};
  /**
   * Name for window global data layer array used by GA: defaults to 'dataLayer'.
   */
  var dataLayerName = 'dataLayer';
  /**
   * Name for window global gtag function used by GA: defaults to 'gtag'.
   */
  var gtagName = 'gtag';
  /**
   * Reproduction of standard gtag function or reference to existing
   * gtag function on window object.
   */
  var gtagCoreFunction;
  /**
   * Wrapper around gtag function that ensures FID is sent with all
   * relevant event and config calls.
   */
  var wrappedGtagFunction;
  /**
   * Flag to ensure page initialization steps (creation or wrapping of
   * dataLayer and gtag script) are only run once per page load.
   */
  var globalInitDone = false;
  /**
   * For testing
   */
  function resetGlobalVars(newGlobalInitDone, newGaInitializedPromise) {
      if (newGlobalInitDone === void 0) { newGlobalInitDone = false; }
      if (newGaInitializedPromise === void 0) { newGaInitializedPromise = {}; }
      globalInitDone = newGlobalInitDone;
      initializedIdPromisesMap = newGaInitializedPromise;
      dataLayerName = 'dataLayer';
      gtagName = 'gtag';
  }
  /**
   * For testing
   */
  function getGlobalVars() {
      return {
          initializedIdPromisesMap: initializedIdPromisesMap
      };
  }
  /**
   * This must be run before calling firebase.analytics() or it won't
   * have any effect.
   * @param options Custom gtag and dataLayer names.
   */
  function settings(options) {
      if (globalInitDone) {
          throw ERROR_FACTORY.create("already-initialized" /* ALREADY_INITIALIZED */);
      }
      if (options.dataLayerName) {
          dataLayerName = options.dataLayerName;
      }
      if (options.gtagName) {
          gtagName = options.gtagName;
      }
  }
  function factory(app, installations) {
      var analyticsId = app.options[ANALYTICS_ID_FIELD];
      if (!analyticsId) {
          throw ERROR_FACTORY.create("no-ga-id" /* NO_GA_ID */);
      }
      if (initializedIdPromisesMap[analyticsId] != null) {
          throw ERROR_FACTORY.create("already-exists" /* ALREADY_EXISTS */, {
              id: analyticsId
          });
      }
      if (!globalInitDone) {
          // Steps here should only be done once per page: creation or wrapping
          // of dataLayer and global gtag function.
          // Detect if user has already put the gtag <script> tag on this page.
          if (!findGtagScriptOnPage()) {
              insertScriptTag(dataLayerName);
          }
          getOrCreateDataLayer(dataLayerName);
          var _a = wrapOrCreateGtag(initializedIdPromisesMap, dataLayerName, gtagName), wrappedGtag = _a.wrappedGtag, gtagCore = _a.gtagCore;
          wrappedGtagFunction = wrappedGtag;
          gtagCoreFunction = gtagCore;
          globalInitDone = true;
      }
      // Async but non-blocking.
      initializedIdPromisesMap[analyticsId] = initializeGAId(app, installations, gtagCoreFunction);
      var analyticsInstance = {
          app: app,
          logEvent: function (eventName, eventParams, options) {
              return logEvent(wrappedGtagFunction, analyticsId, eventName, eventParams, options);
          },
          setCurrentScreen: function (screenName, options) {
              return setCurrentScreen(wrappedGtagFunction, analyticsId, screenName, options);
          },
          setUserId: function (id, options) {
              return setUserId(wrappedGtagFunction, analyticsId, id, options);
          },
          setUserProperties: function (properties, options) {
              return setUserProperties(wrappedGtagFunction, analyticsId, properties, options);
          },
          setAnalyticsCollectionEnabled: function (enabled) {
              return setAnalyticsCollectionEnabled(analyticsId, enabled);
          }
      };
      return analyticsInstance;
  }
  
  var name = "@firebase/analytics";
  var version = "0.3.3";
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Type constant for Firebase Analytics.
   */
  var ANALYTICS_TYPE = 'analytics';
  function registerAnalytics(instance) {
      instance.INTERNAL.registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_5__["Component"](ANALYTICS_TYPE, function (container) {
          // getImmediate for FirebaseApp will always succeed
          var app = container.getProvider('app').getImmediate();
          var installations = container
              .getProvider('installations')
              .getImmediate();
          return factory(app, installations);
      }, "PUBLIC" /* PUBLIC */).setServiceProps({
          settings: settings,
          EventName: EventName
      }));
      instance.INTERNAL.registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_5__["Component"]('analytics-internal', internalFactory, "PRIVATE" /* PRIVATE */));
      instance.registerVersion(name, version);
      function internalFactory(container) {
          try {
              var analytics = container.getProvider(ANALYTICS_TYPE).getImmediate();
              return {
                  logEvent: analytics.logEvent
              };
          }
          catch (e) {
              throw ERROR_FACTORY.create("interop-component-reg-failed" /* INTEROP_COMPONENT_REG_FAILED */, {
                  reason: e
              });
          }
      }
  }
  registerAnalytics(_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a);
  
  
  //# sourceMappingURL=index.esm.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js":
  /*!**************************************************************************!*\
    !*** ./node_modules/@firebase/analytics/node_modules/tslib/tslib.es6.js ***!
    \**************************************************************************/
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  };
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  function __classPrivateFieldGet(receiver, privateMap) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to get private field on non-instance");
      }
      return privateMap.get(receiver);
  }
  
  function __classPrivateFieldSet(receiver, privateMap, value) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to set private field on non-instance");
      }
      privateMap.set(receiver, value);
      return value;
  }
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/functions/dist/index.cjs.js":
  /*!************************************************************!*\
    !*** ./node_modules/@firebase/functions/dist/index.cjs.js ***!
    \************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  
  var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js"));
  var tslib = __webpack_require__(/*! tslib */ "./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js");
  var component = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/index.cjs.js");
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Standard error codes for different ways a request can fail, as defined by:
   * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
   *
   * This map is used primarily to convert from a backend error code string to
   * a client SDK error code string, and make sure it's in the supported set.
   */
  var errorCodeMap = {
      OK: 'ok',
      CANCELLED: 'cancelled',
      UNKNOWN: 'unknown',
      INVALID_ARGUMENT: 'invalid-argument',
      DEADLINE_EXCEEDED: 'deadline-exceeded',
      NOT_FOUND: 'not-found',
      ALREADY_EXISTS: 'already-exists',
      PERMISSION_DENIED: 'permission-denied',
      UNAUTHENTICATED: 'unauthenticated',
      RESOURCE_EXHAUSTED: 'resource-exhausted',
      FAILED_PRECONDITION: 'failed-precondition',
      ABORTED: 'aborted',
      OUT_OF_RANGE: 'out-of-range',
      UNIMPLEMENTED: 'unimplemented',
      INTERNAL: 'internal',
      UNAVAILABLE: 'unavailable',
      DATA_LOSS: 'data-loss'
  };
  /**
   * An explicit error that can be thrown from a handler to send an error to the
   * client that called the function.
   */
  var HttpsErrorImpl = /** @class */ (function (_super) {
      tslib.__extends(HttpsErrorImpl, _super);
      function HttpsErrorImpl(code, message, details) {
          var _this = _super.call(this, message) || this;
          // This is a workaround for a bug in TypeScript when extending Error:
          // tslint:disable-next-line
          // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
          Object.setPrototypeOf(_this, HttpsErrorImpl.prototype);
          _this.code = code;
          _this.details = details;
          return _this;
      }
      return HttpsErrorImpl;
  }(Error));
  /**
   * Takes an HTTP status code and returns the corresponding ErrorCode.
   * This is the standard HTTP status code -> error mapping defined in:
   * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
   *
   * @param status An HTTP status code.
   * @return The corresponding ErrorCode, or ErrorCode.UNKNOWN if none.
   */
  function codeForHTTPStatus(status) {
      // Make sure any successful status is OK.
      if (status >= 200 && status < 300) {
          return 'ok';
      }
      switch (status) {
          case 0:
              // This can happen if the server returns 500.
              return 'internal';
          case 400:
              return 'invalid-argument';
          case 401:
              return 'unauthenticated';
          case 403:
              return 'permission-denied';
          case 404:
              return 'not-found';
          case 409:
              return 'aborted';
          case 429:
              return 'resource-exhausted';
          case 499:
              return 'cancelled';
          case 500:
              return 'internal';
          case 501:
              return 'unimplemented';
          case 503:
              return 'unavailable';
          case 504:
              return 'deadline-exceeded';
      }
      return 'unknown';
  }
  /**
   * Takes an HTTP response and returns the corresponding Error, if any.
   */
  function _errorForResponse(status, bodyJSON, serializer) {
      var code = codeForHTTPStatus(status);
      // Start with reasonable defaults from the status code.
      var description = code;
      var details = undefined;
      // Then look through the body for explicit details.
      try {
          var errorJSON = bodyJSON && bodyJSON.error;
          if (errorJSON) {
              var status_1 = errorJSON.status;
              if (typeof status_1 === 'string') {
                  if (!errorCodeMap[status_1]) {
                      // They must've included an unknown error code in the body.
                      return new HttpsErrorImpl('internal', 'internal');
                  }
                  code = errorCodeMap[status_1];
                  // TODO(klimt): Add better default descriptions for error enums.
                  // The default description needs to be updated for the new code.
                  description = status_1;
              }
              var message = errorJSON.message;
              if (typeof message === 'string') {
                  description = message;
              }
              details = errorJSON.details;
              if (details !== undefined) {
                  details = serializer.decode(details);
              }
          }
      }
      catch (e) {
          // If we couldn't parse explicit error data, that's fine.
      }
      if (code === 'ok') {
          // Technically, there's an edge case where a developer could explicitly
          // return an error code of OK, and we will treat it as success, but that
          // seems reasonable.
          return null;
      }
      return new HttpsErrorImpl(code, description, details);
  }
  
  /**
   * Helper class to get metadata that should be included with a function call.
   */
  var ContextProvider = /** @class */ (function () {
      function ContextProvider(authProvider, messagingProvider) {
          var _this = this;
          this.auth = null;
          this.messaging = null;
          this.auth = authProvider.getImmediate({ optional: true });
          this.messaging = messagingProvider.getImmediate({
              optional: true
          });
          if (!this.auth) {
              authProvider.get().then(function (auth) { return (_this.auth = auth); }, function () {
                  /* get() never rejects */
              });
          }
          if (!this.messaging) {
              messagingProvider.get().then(function (messaging) { return (_this.messaging = messaging); }, function () {
                  /* get() never rejects */
              });
          }
      }
      ContextProvider.prototype.getAuthToken = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var token, e_1;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          if (!this.auth) {
                              return [2 /*return*/, undefined];
                          }
                          _a.label = 1;
                      case 1:
                          _a.trys.push([1, 3, , 4]);
                          return [4 /*yield*/, this.auth.getToken()];
                      case 2:
                          token = _a.sent();
                          if (!token) {
                              return [2 /*return*/, undefined];
                          }
                          return [2 /*return*/, token.accessToken];
                      case 3:
                          e_1 = _a.sent();
                          // If there's any error when trying to get the auth token, leave it off.
                          return [2 /*return*/, undefined];
                      case 4: return [2 /*return*/];
                  }
              });
          });
      };
      ContextProvider.prototype.getInstanceIdToken = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              return tslib.__generator(this, function (_a) {
                  if (!this.messaging ||
                      !('Notification' in self) ||
                      Notification.permission !== 'granted') {
                      return [2 /*return*/, undefined];
                  }
                  try {
                      return [2 /*return*/, this.messaging.getToken()];
                  }
                  catch (e) {
                      // We don't warn on this, because it usually means messaging isn't set up.
                      // console.warn('Failed to retrieve instance id token.', e);
                      // If there's any error when trying to get the token, leave it off.
                      return [2 /*return*/, undefined];
                  }
                  return [2 /*return*/];
              });
          });
      };
      ContextProvider.prototype.getContext = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var authToken, instanceIdToken;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.getAuthToken()];
                      case 1:
                          authToken = _a.sent();
                          return [4 /*yield*/, this.getInstanceIdToken()];
                      case 2:
                          instanceIdToken = _a.sent();
                          return [2 /*return*/, { authToken: authToken, instanceIdToken: instanceIdToken }];
                  }
              });
          });
      };
      return ContextProvider;
  }());
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var LONG_TYPE = 'type.googleapis.com/google.protobuf.Int64Value';
  var UNSIGNED_LONG_TYPE = 'type.googleapis.com/google.protobuf.UInt64Value';
  function mapValues(
  // { [k: string]: unknown } is no longer a wildcard assignment target after typescript 3.5
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  o, f) {
      var result = {};
      for (var key in o) {
          if (o.hasOwnProperty(key)) {
              result[key] = f(o[key]);
          }
      }
      return result;
  }
  var Serializer = /** @class */ (function () {
      function Serializer() {
      }
      // Takes data and encodes it in a JSON-friendly way, such that types such as
      // Date are preserved.
      Serializer.prototype.encode = function (data) {
          var _this = this;
          if (data == null) {
              return null;
          }
          if (data instanceof Number) {
              data = data.valueOf();
          }
          if (typeof data === 'number' && isFinite(data)) {
              // Any number in JS is safe to put directly in JSON and parse as a double
              // without any loss of precision.
              return data;
          }
          if (data === true || data === false) {
              return data;
          }
          if (Object.prototype.toString.call(data) === '[object String]') {
              return data;
          }
          if (Array.isArray(data)) {
              return data.map(function (x) { return _this.encode(x); });
          }
          if (typeof data === 'function' || typeof data === 'object') {
              return mapValues(data, function (x) { return _this.encode(x); });
          }
          // If we got this far, the data is not encodable.
          throw new Error('Data cannot be encoded in JSON: ' + data);
      };
      // Takes data that's been encoded in a JSON-friendly form and returns a form
      // with richer datatypes, such as Dates, etc.
      Serializer.prototype.decode = function (json) {
          var _this = this;
          if (json == null) {
              return json;
          }
          if (json['@type']) {
              switch (json['@type']) {
                  case LONG_TYPE:
                  // Fall through and handle this the same as unsigned.
                  case UNSIGNED_LONG_TYPE: {
                      // Technically, this could work return a valid number for malformed
                      // data if there was a number followed by garbage. But it's just not
                      // worth all the extra code to detect that case.
                      var value = Number(json['value']);
                      if (isNaN(value)) {
                          throw new Error('Data cannot be decoded from JSON: ' + json);
                      }
                      return value;
                  }
                  default: {
                      throw new Error('Data cannot be decoded from JSON: ' + json);
                  }
              }
          }
          if (Array.isArray(json)) {
              return json.map(function (x) { return _this.decode(x); });
          }
          if (typeof json === 'function' || typeof json === 'object') {
              return mapValues(json, function (x) { return _this.decode(x); });
          }
          // Anything else is safe to return.
          return json;
      };
      return Serializer;
  }());
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Returns a Promise that will be rejected after the given duration.
   * The error will be of type HttpsErrorImpl.
   *
   * @param millis Number of milliseconds to wait before rejecting.
   */
  function failAfter(millis) {
      return new Promise(function (_, reject) {
          setTimeout(function () {
              reject(new HttpsErrorImpl('deadline-exceeded', 'deadline-exceeded'));
          }, millis);
      });
  }
  /**
   * The main class for the Firebase Functions SDK.
   */
  var Service = /** @class */ (function () {
      /**
       * Creates a new Functions service for the given app and (optional) region.
       * @param app_ The FirebaseApp to use.
       * @param region_ The region to call functions in.
       */
      function Service(app_, authProvider, messagingProvider, region_) {
          var _this = this;
          if (region_ === void 0) { region_ = 'us-central1'; }
          this.app_ = app_;
          this.region_ = region_;
          this.serializer = new Serializer();
          this.emulatorOrigin = null;
          this.INTERNAL = {
              delete: function () {
                  return _this.deleteService();
              }
          };
          this.contextProvider = new ContextProvider(authProvider, messagingProvider);
          // Cancels all ongoing requests when resolved.
          this.cancelAllRequests = new Promise(function (resolve) {
              _this.deleteService = function () {
                  return resolve();
              };
          });
      }
      Object.defineProperty(Service.prototype, "app", {
          get: function () {
              return this.app_;
          },
          enumerable: true,
          configurable: true
      });
      /**
       * Returns the URL for a callable with the given name.
       * @param name The name of the callable.
       */
      Service.prototype._url = function (name) {
          var projectId = this.app_.options.projectId;
          var region = this.region_;
          if (this.emulatorOrigin !== null) {
              var origin_1 = this.emulatorOrigin;
              return origin_1 + "/" + projectId + "/" + region + "/" + name;
          }
          return "https://" + region + "-" + projectId + ".cloudfunctions.net/" + name;
      };
      /**
       * Changes this instance to point to a Cloud Functions emulator running
       * locally. See https://firebase.google.com/docs/functions/local-emulator
       *
       * @param origin The origin of the local emulator, such as
       * "http://localhost:5005".
       */
      Service.prototype.useFunctionsEmulator = function (origin) {
          this.emulatorOrigin = origin;
      };
      /**
       * Returns a reference to the callable https trigger with the given name.
       * @param name The name of the trigger.
       */
      Service.prototype.httpsCallable = function (name, options) {
          var _this = this;
          return function (data) {
              return _this.call(name, data, options || {});
          };
      };
      /**
       * Does an HTTP POST and returns the completed response.
       * @param url The url to post to.
       * @param body The JSON body of the post.
       * @param headers The HTTP headers to include in the request.
       * @return A Promise that will succeed when the request finishes.
       */
      Service.prototype.postJSON = function (url, body, headers) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var response, e_1, json, e_2;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          headers.append('Content-Type', 'application/json');
                          _a.label = 1;
                      case 1:
                          _a.trys.push([1, 3, , 4]);
                          return [4 /*yield*/, fetch(url, {
                                  method: 'POST',
                                  body: JSON.stringify(body),
                                  headers: headers
                              })];
                      case 2:
                          response = _a.sent();
                          return [3 /*break*/, 4];
                      case 3:
                          e_1 = _a.sent();
                          // This could be an unhandled error on the backend, or it could be a
                          // network error. There's no way to know, since an unhandled error on the
                          // backend will fail to set the proper CORS header, and thus will be
                          // treated as a network error by fetch.
                          return [2 /*return*/, {
                                  status: 0,
                                  json: null
                              }];
                      case 4:
                          json = null;
                          _a.label = 5;
                      case 5:
                          _a.trys.push([5, 7, , 8]);
                          return [4 /*yield*/, response.json()];
                      case 6:
                          json = _a.sent();
                          return [3 /*break*/, 8];
                      case 7:
                          e_2 = _a.sent();
                          return [3 /*break*/, 8];
                      case 8: return [2 /*return*/, {
                              status: response.status,
                              json: json
                          }];
                  }
              });
          });
      };
      /**
       * Calls a callable function asynchronously and returns the result.
       * @param name The name of the callable trigger.
       * @param data The data to pass as params to the function.s
       */
      Service.prototype.call = function (name, data, options) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var url, body, headers, context, timeout, response, error, responseData, decodedData;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          url = this._url(name);
                          // Encode any special types, such as dates, in the input data.
                          data = this.serializer.encode(data);
                          body = { data: data };
                          headers = new Headers();
                          return [4 /*yield*/, this.contextProvider.getContext()];
                      case 1:
                          context = _a.sent();
                          if (context.authToken) {
                              headers.append('Authorization', 'Bearer ' + context.authToken);
                          }
                          if (context.instanceIdToken) {
                              headers.append('Firebase-Instance-ID-Token', context.instanceIdToken);
                          }
                          timeout = options.timeout || 70000;
                          return [4 /*yield*/, Promise.race([
                                  this.postJSON(url, body, headers),
                                  failAfter(timeout),
                                  this.cancelAllRequests
                              ])];
                      case 2:
                          response = _a.sent();
                          // If service was deleted, interrupted response throws an error.
                          if (!response) {
                              throw new HttpsErrorImpl('cancelled', 'Firebase Functions instance was deleted.');
                          }
                          error = _errorForResponse(response.status, response.json, this.serializer);
                          if (error) {
                              throw error;
                          }
                          if (!response.json) {
                              throw new HttpsErrorImpl('internal', 'Response is not valid JSON object.');
                          }
                          responseData = response.json.data;
                          // TODO(klimt): For right now, allow "result" instead of "data", for
                          // backwards compatibility.
                          if (typeof responseData === 'undefined') {
                              responseData = response.json.result;
                          }
                          if (typeof responseData === 'undefined') {
                              // Consider the response malformed.
                              throw new HttpsErrorImpl('internal', 'Response is missing data field.');
                          }
                          decodedData = this.serializer.decode(responseData);
                          return [2 /*return*/, { data: decodedData }];
                  }
              });
          });
      };
      return Service;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Type constant for Firebase Functions.
   */
  var FUNCTIONS_TYPE = 'functions';
  function factory(container, region) {
      // Dependencies
      var app = container.getProvider('app').getImmediate();
      var authProvider = container.getProvider('auth-internal');
      var messagingProvider = container.getProvider('messaging');
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      return new Service(app, authProvider, messagingProvider, region);
  }
  function registerFunctions(instance) {
      var namespaceExports = {
          // no-inline
          Functions: Service
      };
      instance.INTERNAL.registerComponent(new component.Component(FUNCTIONS_TYPE, factory, "PUBLIC" /* PUBLIC */)
          .setServiceProps(namespaceExports)
          .setMultipleInstances(true));
  }
  
  var name = "@firebase/functions";
  var version = "0.4.42";
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  registerFunctions(firebase);
  firebase.registerVersion(name, version);
  //# sourceMappingURL=index.cjs.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js":
  /*!**************************************************************************!*\
    !*** ./node_modules/@firebase/functions/node_modules/tslib/tslib.es6.js ***!
    \**************************************************************************/
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  };
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  function __classPrivateFieldGet(receiver, privateMap) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to get private field on non-instance");
      }
      return privateMap.get(receiver);
  }
  
  function __classPrivateFieldSet(receiver, privateMap, value) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to set private field on non-instance");
      }
      privateMap.set(receiver, value);
      return value;
  }
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/installations/dist/index.esm.js":
  /*!****************************************************************!*\
    !*** ./node_modules/@firebase/installations/dist/index.esm.js ***!
    \****************************************************************/
  /*! exports provided: registerInstallations */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerInstallations", function() { return registerInstallations; });
  /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js");
  /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_app__WEBPACK_IMPORTED_MODULE_0__);
  /* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/index.cjs.js");
  /* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_firebase_component__WEBPACK_IMPORTED_MODULE_1__);
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/@firebase/installations/node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.cjs.js");
  /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_firebase_util__WEBPACK_IMPORTED_MODULE_3__);
  /* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! idb */ "./node_modules/idb/build/idb.js");
  /* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(idb__WEBPACK_IMPORTED_MODULE_4__);
  
  
  
  
  
  
  var name = "@firebase/installations";
  var version = "0.4.8";
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var PENDING_TIMEOUT_MS = 10000;
  var PACKAGE_VERSION = "w:" + version;
  var INTERNAL_AUTH_VERSION = 'FIS_v2';
  var INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1';
  var TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour
  var SERVICE = 'installations';
  var SERVICE_NAME = 'Installations';
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var _a;
  var ERROR_DESCRIPTION_MAP = (_a = {},
      _a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"',
      _a["not-registered" /* NOT_REGISTERED */] = 'Firebase Installation is not registered.',
      _a["installation-not-found" /* INSTALLATION_NOT_FOUND */] = 'Firebase Installation not found.',
      _a["request-failed" /* REQUEST_FAILED */] = '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
      _a["app-offline" /* APP_OFFLINE */] = 'Could not process request. Application offline.',
      _a["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */] = "Can't delete installation while there is a pending registration request.",
      _a);
  var ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_3__["ErrorFactory"](SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
  /** Returns true if error is a FirebaseError that is based on an error from the server. */
  function isServerError(error) {
      return (error instanceof _firebase_util__WEBPACK_IMPORTED_MODULE_3__["FirebaseError"] &&
          error.code.includes("request-failed" /* REQUEST_FAILED */));
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function getInstallationsEndpoint(_a) {
      var projectId = _a.projectId;
      return INSTALLATIONS_API_URL + "/projects/" + projectId + "/installations";
  }
  function extractAuthTokenInfoFromResponse(response) {
      return {
          token: response.token,
          requestStatus: 2 /* COMPLETED */,
          expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
          creationTime: Date.now()
      };
  }
  function getErrorFromResponse(requestName, response) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var responseJson, errorData;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, response.json()];
                  case 1:
                      responseJson = _a.sent();
                      errorData = responseJson.error;
                      return [2 /*return*/, ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, {
                              requestName: requestName,
                              serverCode: errorData.code,
                              serverMessage: errorData.message,
                              serverStatus: errorData.status
                          })];
              }
          });
      });
  }
  function getHeaders(_a) {
      var apiKey = _a.apiKey;
      return new Headers({
          'Content-Type': 'application/json',
          Accept: 'application/json',
          'x-goog-api-key': apiKey
      });
  }
  function getHeadersWithAuth(appConfig, _a) {
      var refreshToken = _a.refreshToken;
      var headers = getHeaders(appConfig);
      headers.append('Authorization', getAuthorizationHeader(refreshToken));
      return headers;
  }
  /**
   * Calls the passed in fetch wrapper and returns the response.
   * If the returned response has a status of 5xx, re-runs the function once and
   * returns the response.
   */
  function retryIfServerError(fn) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var result;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, fn()];
                  case 1:
                      result = _a.sent();
                      if (result.status >= 500 && result.status < 600) {
                          // Internal Server Error. Retry request.
                          return [2 /*return*/, fn()];
                      }
                      return [2 /*return*/, result];
              }
          });
      });
  }
  function getExpiresInFromResponseExpiresIn(responseExpiresIn) {
      // This works because the server will never respond with fractions of a second.
      return Number(responseExpiresIn.replace('s', '000'));
  }
  function getAuthorizationHeader(refreshToken) {
      return INTERNAL_AUTH_VERSION + " " + refreshToken;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function createInstallationRequest(appConfig, _a) {
      var fid = _a.fid;
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var endpoint, headers, body, request, response, responseValue, registeredInstallationEntry;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0:
                      endpoint = getInstallationsEndpoint(appConfig);
                      headers = getHeaders(appConfig);
                      body = {
                          fid: fid,
                          authVersion: INTERNAL_AUTH_VERSION,
                          appId: appConfig.appId,
                          sdkVersion: PACKAGE_VERSION
                      };
                      request = {
                          method: 'POST',
                          headers: headers,
                          body: JSON.stringify(body)
                      };
                      return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })];
                  case 1:
                      response = _b.sent();
                      if (!response.ok) return [3 /*break*/, 3];
                      return [4 /*yield*/, response.json()];
                  case 2:
                      responseValue = _b.sent();
                      registeredInstallationEntry = {
                          fid: responseValue.fid || fid,
                          registrationStatus: 2 /* COMPLETED */,
                          refreshToken: responseValue.refreshToken,
                          authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
                      };
                      return [2 /*return*/, registeredInstallationEntry];
                  case 3: return [4 /*yield*/, getErrorFromResponse('Create Installation', response)];
                  case 4: throw _b.sent();
              }
          });
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /** Returns a promise that resolves after given time passes. */
  function sleep(ms) {
      return new Promise(function (resolve) {
          setTimeout(resolve, ms);
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function bufferToBase64UrlSafe(array) {
      var b64 = btoa(String.fromCharCode.apply(String, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(array)));
      return b64.replace(/\+/g, '-').replace(/\//g, '_');
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var VALID_FID_PATTERN = /^[cdef][\w-]{21}$/;
  var INVALID_FID = '';
  /**
   * Generates a new FID using random values from Web Crypto API.
   * Returns an empty string if FID generation fails for any reason.
   */
  function generateFid() {
      try {
          // A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5
          // bytes. our implementation generates a 17 byte array instead.
          var fidByteArray = new Uint8Array(17);
          var crypto_1 = self.crypto || self.msCrypto;
          crypto_1.getRandomValues(fidByteArray);
          // Replace the first 4 random bits with the constant FID header of 0b0111.
          fidByteArray[0] = 112 + (fidByteArray[0] % 16);
          var fid = encode(fidByteArray);
          return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID;
      }
      catch (_a) {
          // FID generation errored
          return INVALID_FID;
      }
  }
  /** Converts a FID Uint8Array to a base64 string representation. */
  function encode(fidByteArray) {
      var b64String = bufferToBase64UrlSafe(fidByteArray);
      // Remove the 23rd character that was added because of the extra 4 bits at the
      // end of our 17 byte array, and the '=' padding.
      return b64String.substr(0, 22);
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /** Returns a string key that can be used to identify the app. */
  function getKey(appConfig) {
      return appConfig.appName + "!" + appConfig.appId;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var fidChangeCallbacks = new Map();
  /**
   * Calls the onIdChange callbacks with the new FID value, and broadcasts the
   * change to other tabs.
   */
  function fidChanged(appConfig, fid) {
      var key = getKey(appConfig);
      callFidChangeCallbacks(key, fid);
      broadcastFidChange(key, fid);
  }
  function addCallback(appConfig, callback) {
      // Open the broadcast channel if it's not already open,
      // to be able to listen to change events from other tabs.
      getBroadcastChannel();
      var key = getKey(appConfig);
      var callbackSet = fidChangeCallbacks.get(key);
      if (!callbackSet) {
          callbackSet = new Set();
          fidChangeCallbacks.set(key, callbackSet);
      }
      callbackSet.add(callback);
  }
  function removeCallback(appConfig, callback) {
      var key = getKey(appConfig);
      var callbackSet = fidChangeCallbacks.get(key);
      if (!callbackSet) {
          return;
      }
      callbackSet.delete(callback);
      if (callbackSet.size === 0) {
          fidChangeCallbacks.delete(key);
      }
      // Close broadcast channel if there are no more callbacks.
      closeBroadcastChannel();
  }
  function callFidChangeCallbacks(key, fid) {
      var e_1, _a;
      var callbacks = fidChangeCallbacks.get(key);
      if (!callbacks) {
          return;
      }
      try {
          for (var callbacks_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__values"])(callbacks), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) {
              var callback = callbacks_1_1.value;
              callback(fid);
          }
      }
      catch (e_1_1) { e_1 = { error: e_1_1 }; }
      finally {
          try {
              if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1);
          }
          finally { if (e_1) throw e_1.error; }
      }
  }
  function broadcastFidChange(key, fid) {
      var channel = getBroadcastChannel();
      if (channel) {
          channel.postMessage({ key: key, fid: fid });
      }
      closeBroadcastChannel();
  }
  var broadcastChannel = null;
  /** Opens and returns a BroadcastChannel if it is supported by the browser. */
  function getBroadcastChannel() {
      if (!broadcastChannel && 'BroadcastChannel' in self) {
          broadcastChannel = new BroadcastChannel('[Firebase] FID Change');
          broadcastChannel.onmessage = function (e) {
              callFidChangeCallbacks(e.data.key, e.data.fid);
          };
      }
      return broadcastChannel;
  }
  function closeBroadcastChannel() {
      if (fidChangeCallbacks.size === 0 && broadcastChannel) {
          broadcastChannel.close();
          broadcastChannel = null;
      }
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var DATABASE_NAME = 'firebase-installations-database';
  var DATABASE_VERSION = 1;
  var OBJECT_STORE_NAME = 'firebase-installations-store';
  var dbPromise = null;
  function getDbPromise() {
      if (!dbPromise) {
          dbPromise = Object(idb__WEBPACK_IMPORTED_MODULE_4__["openDb"])(DATABASE_NAME, DATABASE_VERSION, function (upgradeDB) {
              // We don't use 'break' in this switch statement, the fall-through
              // behavior is what we want, because if there are multiple versions between
              // the old version and the current version, we want ALL the migrations
              // that correspond to those versions to run, not only the last one.
              // eslint-disable-next-line default-case
              switch (upgradeDB.oldVersion) {
                  case 0:
                      upgradeDB.createObjectStore(OBJECT_STORE_NAME);
              }
          });
      }
      return dbPromise;
  }
  /** Assigns or overwrites the record for the given key with the given value. */
  function set(appConfig, value) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var key, db, tx, objectStore, oldValue;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      key = getKey(appConfig);
                      return [4 /*yield*/, getDbPromise()];
                  case 1:
                      db = _a.sent();
                      tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
                      objectStore = tx.objectStore(OBJECT_STORE_NAME);
                      return [4 /*yield*/, objectStore.get(key)];
                  case 2:
                      oldValue = _a.sent();
                      return [4 /*yield*/, objectStore.put(value, key)];
                  case 3:
                      _a.sent();
                      return [4 /*yield*/, tx.complete];
                  case 4:
                      _a.sent();
                      if (!oldValue || oldValue.fid !== value.fid) {
                          fidChanged(appConfig, value.fid);
                      }
                      return [2 /*return*/, value];
              }
          });
      });
  }
  /** Removes record(s) from the objectStore that match the given key. */
  function remove(appConfig) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var key, db, tx;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      key = getKey(appConfig);
                      return [4 /*yield*/, getDbPromise()];
                  case 1:
                      db = _a.sent();
                      tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
                      return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).delete(key)];
                  case 2:
                      _a.sent();
                      return [4 /*yield*/, tx.complete];
                  case 3:
                      _a.sent();
                      return [2 /*return*/];
              }
          });
      });
  }
  /**
   * Atomically updates a record with the result of updateFn, which gets
   * called with the current value. If newValue is undefined, the record is
   * deleted instead.
   * @return Updated value
   */
  function update(appConfig, updateFn) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var key, db, tx, store, oldValue, newValue;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      key = getKey(appConfig);
                      return [4 /*yield*/, getDbPromise()];
                  case 1:
                      db = _a.sent();
                      tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
                      store = tx.objectStore(OBJECT_STORE_NAME);
                      return [4 /*yield*/, store.get(key)];
                  case 2:
                      oldValue = _a.sent();
                      newValue = updateFn(oldValue);
                      if (!(newValue === undefined)) return [3 /*break*/, 4];
                      return [4 /*yield*/, store.delete(key)];
                  case 3:
                      _a.sent();
                      return [3 /*break*/, 6];
                  case 4: return [4 /*yield*/, store.put(newValue, key)];
                  case 5:
                      _a.sent();
                      _a.label = 6;
                  case 6: return [4 /*yield*/, tx.complete];
                  case 7:
                      _a.sent();
                      if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {
                          fidChanged(appConfig, newValue.fid);
                      }
                      return [2 /*return*/, newValue];
              }
          });
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Updates and returns the InstallationEntry from the database.
   * Also triggers a registration request if it is necessary and possible.
   */
  function getInstallationEntry(appConfig) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var registrationPromise, installationEntry, _a;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0: return [4 /*yield*/, update(appConfig, function (oldEntry) {
                          var installationEntry = updateOrCreateInstallationEntry(oldEntry);
                          var entryWithPromise = triggerRegistrationIfNecessary(appConfig, installationEntry);
                          registrationPromise = entryWithPromise.registrationPromise;
                          return entryWithPromise.installationEntry;
                      })];
                  case 1:
                      installationEntry = _b.sent();
                      if (!(installationEntry.fid === INVALID_FID)) return [3 /*break*/, 3];
                      _a = {};
                      return [4 /*yield*/, registrationPromise];
                  case 2: 
                  // FID generation failed. Waiting for the FID from the server.
                  return [2 /*return*/, (_a.installationEntry = _b.sent(), _a)];
                  case 3: return [2 /*return*/, {
                          installationEntry: installationEntry,
                          registrationPromise: registrationPromise
                      }];
              }
          });
      });
  }
  /**
   * Creates a new Installation Entry if one does not exist.
   * Also clears timed out pending requests.
   */
  function updateOrCreateInstallationEntry(oldEntry) {
      var entry = oldEntry || {
          fid: generateFid(),
          registrationStatus: 0 /* NOT_STARTED */
      };
      return clearTimedOutRequest(entry);
  }
  /**
   * If the Firebase Installation is not registered yet, this will trigger the
   * registration and return an InProgressInstallationEntry.
   *
   * If registrationPromise does not exist, the installationEntry is guaranteed
   * to be registered.
   */
  function triggerRegistrationIfNecessary(appConfig, installationEntry) {
      if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) {
          if (!navigator.onLine) {
              // Registration required but app is offline.
              var registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */));
              return {
                  installationEntry: installationEntry,
                  registrationPromise: registrationPromiseWithError
              };
          }
          // Try registering. Change status to IN_PROGRESS.
          var inProgressEntry = {
              fid: installationEntry.fid,
              registrationStatus: 1 /* IN_PROGRESS */,
              registrationTime: Date.now()
          };
          var registrationPromise = registerInstallation(appConfig, inProgressEntry);
          return { installationEntry: inProgressEntry, registrationPromise: registrationPromise };
      }
      else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) {
          return {
              installationEntry: installationEntry,
              registrationPromise: waitUntilFidRegistration(appConfig)
          };
      }
      else {
          return { installationEntry: installationEntry };
      }
  }
  /** This will be executed only once for each new Firebase Installation. */
  function registerInstallation(appConfig, installationEntry) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var registeredInstallationEntry, e_1;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      _a.trys.push([0, 2, , 7]);
                      return [4 /*yield*/, createInstallationRequest(appConfig, installationEntry)];
                  case 1:
                      registeredInstallationEntry = _a.sent();
                      return [2 /*return*/, set(appConfig, registeredInstallationEntry)];
                  case 2:
                      e_1 = _a.sent();
                      if (!(isServerError(e_1) && e_1.serverCode === 409)) return [3 /*break*/, 4];
                      // Server returned a "FID can not be used" error.
                      // Generate a new ID next time.
                      return [4 /*yield*/, remove(appConfig)];
                  case 3:
                      // Server returned a "FID can not be used" error.
                      // Generate a new ID next time.
                      _a.sent();
                      return [3 /*break*/, 6];
                  case 4: 
                  // Registration failed. Set FID as not registered.
                  return [4 /*yield*/, set(appConfig, {
                          fid: installationEntry.fid,
                          registrationStatus: 0 /* NOT_STARTED */
                      })];
                  case 5:
                      // Registration failed. Set FID as not registered.
                      _a.sent();
                      _a.label = 6;
                  case 6: throw e_1;
                  case 7: return [2 /*return*/];
              }
          });
      });
  }
  /** Call if FID registration is pending in another request. */
  function waitUntilFidRegistration(appConfig) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var entry, _a, installationEntry, registrationPromise;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0: return [4 /*yield*/, updateInstallationRequest(appConfig)];
                  case 1:
                      entry = _b.sent();
                      _b.label = 2;
                  case 2:
                      if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5];
                      // createInstallation request still in progress.
                      return [4 /*yield*/, sleep(100)];
                  case 3:
                      // createInstallation request still in progress.
                      _b.sent();
                      return [4 /*yield*/, updateInstallationRequest(appConfig)];
                  case 4:
                      entry = _b.sent();
                      return [3 /*break*/, 2];
                  case 5:
                      if (!(entry.registrationStatus === 0 /* NOT_STARTED */)) return [3 /*break*/, 7];
                      return [4 /*yield*/, getInstallationEntry(appConfig)];
                  case 6:
                      _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise;
                      if (registrationPromise) {
                          return [2 /*return*/, registrationPromise];
                      }
                      else {
                          // if there is no registrationPromise, entry is registered.
                          return [2 /*return*/, installationEntry];
                      }
                  case 7: return [2 /*return*/, entry];
              }
          });
      });
  }
  /**
   * Called only if there is a CreateInstallation request in progress.
   *
   * Updates the InstallationEntry in the DB based on the status of the
   * CreateInstallation request.
   *
   * Returns the updated InstallationEntry.
   */
  function updateInstallationRequest(appConfig) {
      return update(appConfig, function (oldEntry) {
          if (!oldEntry) {
              throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */);
          }
          return clearTimedOutRequest(oldEntry);
      });
  }
  function clearTimedOutRequest(entry) {
      if (hasInstallationRequestTimedOut(entry)) {
          return {
              fid: entry.fid,
              registrationStatus: 0 /* NOT_STARTED */
          };
      }
      return entry;
  }
  function hasInstallationRequestTimedOut(installationEntry) {
      return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ &&
          installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now());
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function generateAuthTokenRequest(_a, installationEntry) {
      var appConfig = _a.appConfig, platformLoggerProvider = _a.platformLoggerProvider;
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var endpoint, headers, platformLogger, body, request, response, responseValue, completedAuthToken;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0:
                      endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);
                      headers = getHeadersWithAuth(appConfig, installationEntry);
                      platformLogger = platformLoggerProvider.getImmediate({
                          optional: true
                      });
                      if (platformLogger) {
                          headers.append('x-firebase-client', platformLogger.getPlatformInfoString());
                      }
                      body = {
                          installation: {
                              sdkVersion: PACKAGE_VERSION
                          }
                      };
                      request = {
                          method: 'POST',
                          headers: headers,
                          body: JSON.stringify(body)
                      };
                      return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })];
                  case 1:
                      response = _b.sent();
                      if (!response.ok) return [3 /*break*/, 3];
                      return [4 /*yield*/, response.json()];
                  case 2:
                      responseValue = _b.sent();
                      completedAuthToken = extractAuthTokenInfoFromResponse(responseValue);
                      return [2 /*return*/, completedAuthToken];
                  case 3: return [4 /*yield*/, getErrorFromResponse('Generate Auth Token', response)];
                  case 4: throw _b.sent();
              }
          });
      });
  }
  function getGenerateAuthTokenEndpoint(appConfig, _a) {
      var fid = _a.fid;
      return getInstallationsEndpoint(appConfig) + "/" + fid + "/authTokens:generate";
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Returns a valid authentication token for the installation. Generates a new
   * token if one doesn't exist, is expired or about to expire.
   *
   * Should only be called if the Firebase Installation is registered.
   */
  function refreshAuthToken(dependencies, forceRefresh) {
      if (forceRefresh === void 0) { forceRefresh = false; }
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var tokenPromise, entry, authToken, _a;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0: return [4 /*yield*/, update(dependencies.appConfig, function (oldEntry) {
                          if (!isEntryRegistered(oldEntry)) {
                              throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
                          }
                          var oldAuthToken = oldEntry.authToken;
                          if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {
                              // There is a valid token in the DB.
                              return oldEntry;
                          }
                          else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) {
                              // There already is a token request in progress.
                              tokenPromise = waitUntilAuthTokenRequest(dependencies, forceRefresh);
                              return oldEntry;
                          }
                          else {
                              // No token or token expired.
                              if (!navigator.onLine) {
                                  throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
                              }
                              var inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
                              tokenPromise = fetchAuthTokenFromServer(dependencies, inProgressEntry);
                              return inProgressEntry;
                          }
                      })];
                  case 1:
                      entry = _b.sent();
                      if (!tokenPromise) return [3 /*break*/, 3];
                      return [4 /*yield*/, tokenPromise];
                  case 2:
                      _a = _b.sent();
                      return [3 /*break*/, 4];
                  case 3:
                      _a = entry.authToken;
                      _b.label = 4;
                  case 4:
                      authToken = _a;
                      return [2 /*return*/, authToken];
              }
          });
      });
  }
  /**
   * Call only if FID is registered and Auth Token request is in progress.
   *
   * Waits until the current pending request finishes. If the request times out,
   * tries once in this thread as well.
   */
  function waitUntilAuthTokenRequest(dependencies, forceRefresh) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var entry, authToken;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)];
                  case 1:
                      entry = _a.sent();
                      _a.label = 2;
                  case 2:
                      if (!(entry.authToken.requestStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 5];
                      // generateAuthToken still in progress.
                      return [4 /*yield*/, sleep(100)];
                  case 3:
                      // generateAuthToken still in progress.
                      _a.sent();
                      return [4 /*yield*/, updateAuthTokenRequest(dependencies.appConfig)];
                  case 4:
                      entry = _a.sent();
                      return [3 /*break*/, 2];
                  case 5:
                      authToken = entry.authToken;
                      if (authToken.requestStatus === 0 /* NOT_STARTED */) {
                          // The request timed out or failed in a different call. Try again.
                          return [2 /*return*/, refreshAuthToken(dependencies, forceRefresh)];
                      }
                      else {
                          return [2 /*return*/, authToken];
                      }
              }
          });
      });
  }
  /**
   * Called only if there is a GenerateAuthToken request in progress.
   *
   * Updates the InstallationEntry in the DB based on the status of the
   * GenerateAuthToken request.
   *
   * Returns the updated InstallationEntry.
   */
  function updateAuthTokenRequest(appConfig) {
      return update(appConfig, function (oldEntry) {
          if (!isEntryRegistered(oldEntry)) {
              throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
          }
          var oldAuthToken = oldEntry.authToken;
          if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
              return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, oldEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
          }
          return oldEntry;
      });
  }
  function fetchAuthTokenFromServer(dependencies, installationEntry) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var authToken, updatedInstallationEntry, e_1, updatedInstallationEntry;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      _a.trys.push([0, 3, , 8]);
                      return [4 /*yield*/, generateAuthTokenRequest(dependencies, installationEntry)];
                  case 1:
                      authToken = _a.sent();
                      updatedInstallationEntry = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, installationEntry), { authToken: authToken });
                      return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)];
                  case 2:
                      _a.sent();
                      return [2 /*return*/, authToken];
                  case 3:
                      e_1 = _a.sent();
                      if (!(isServerError(e_1) && (e_1.serverCode === 401 || e_1.serverCode === 404))) return [3 /*break*/, 5];
                      // Server returned a "FID not found" or a "Invalid authentication" error.
                      // Generate a new ID next time.
                      return [4 /*yield*/, remove(dependencies.appConfig)];
                  case 4:
                      // Server returned a "FID not found" or a "Invalid authentication" error.
                      // Generate a new ID next time.
                      _a.sent();
                      return [3 /*break*/, 7];
                  case 5:
                      updatedInstallationEntry = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, installationEntry), { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
                      return [4 /*yield*/, set(dependencies.appConfig, updatedInstallationEntry)];
                  case 6:
                      _a.sent();
                      _a.label = 7;
                  case 7: throw e_1;
                  case 8: return [2 /*return*/];
              }
          });
      });
  }
  function isEntryRegistered(installationEntry) {
      return (installationEntry !== undefined &&
          installationEntry.registrationStatus === 2 /* COMPLETED */);
  }
  function isAuthTokenValid(authToken) {
      return (authToken.requestStatus === 2 /* COMPLETED */ &&
          !isAuthTokenExpired(authToken));
  }
  function isAuthTokenExpired(authToken) {
      var now = Date.now();
      return (now < authToken.creationTime ||
          authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER);
  }
  /** Returns an updated InstallationEntry with an InProgressAuthToken. */
  function makeAuthTokenRequestInProgressEntry(oldEntry) {
      var inProgressAuthToken = {
          requestStatus: 1 /* IN_PROGRESS */,
          requestTime: Date.now()
      };
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__assign"])({}, oldEntry), { authToken: inProgressAuthToken });
  }
  function hasAuthTokenRequestTimedOut(authToken) {
      return (authToken.requestStatus === 1 /* IN_PROGRESS */ &&
          authToken.requestTime + PENDING_TIMEOUT_MS < Date.now());
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function getId(dependencies) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var _a, installationEntry, registrationPromise;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0: return [4 /*yield*/, getInstallationEntry(dependencies.appConfig)];
                  case 1:
                      _a = _b.sent(), installationEntry = _a.installationEntry, registrationPromise = _a.registrationPromise;
                      if (registrationPromise) {
                          registrationPromise.catch(console.error);
                      }
                      else {
                          // If the installation is already registered, update the authentication
                          // token if needed.
                          refreshAuthToken(dependencies).catch(console.error);
                      }
                      return [2 /*return*/, installationEntry.fid];
              }
          });
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function getToken(dependencies, forceRefresh) {
      if (forceRefresh === void 0) { forceRefresh = false; }
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var authToken;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, completeInstallationRegistration(dependencies.appConfig)];
                  case 1:
                      _a.sent();
                      return [4 /*yield*/, refreshAuthToken(dependencies, forceRefresh)];
                  case 2:
                      authToken = _a.sent();
                      return [2 /*return*/, authToken.token];
              }
          });
      });
  }
  function completeInstallationRegistration(appConfig) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var registrationPromise;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, getInstallationEntry(appConfig)];
                  case 1:
                      registrationPromise = (_a.sent()).registrationPromise;
                      if (!registrationPromise) return [3 /*break*/, 3];
                      // A createInstallation request is in progress. Wait until it finishes.
                      return [4 /*yield*/, registrationPromise];
                  case 2:
                      // A createInstallation request is in progress. Wait until it finishes.
                      _a.sent();
                      _a.label = 3;
                  case 3: return [2 /*return*/];
              }
          });
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function deleteInstallationRequest(appConfig, installationEntry) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var endpoint, headers, request, response;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      endpoint = getDeleteEndpoint(appConfig, installationEntry);
                      headers = getHeadersWithAuth(appConfig, installationEntry);
                      request = {
                          method: 'DELETE',
                          headers: headers
                      };
                      return [4 /*yield*/, retryIfServerError(function () { return fetch(endpoint, request); })];
                  case 1:
                      response = _a.sent();
                      if (!!response.ok) return [3 /*break*/, 3];
                      return [4 /*yield*/, getErrorFromResponse('Delete Installation', response)];
                  case 2: throw _a.sent();
                  case 3: return [2 /*return*/];
              }
          });
      });
  }
  function getDeleteEndpoint(appConfig, _a) {
      var fid = _a.fid;
      return getInstallationsEndpoint(appConfig) + "/" + fid;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function deleteInstallation(dependencies) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__awaiter"])(this, void 0, void 0, function () {
          var appConfig, entry;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      appConfig = dependencies.appConfig;
                      return [4 /*yield*/, update(appConfig, function (oldEntry) {
                              if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) {
                                  // Delete the unregistered entry without sending a deleteInstallation request.
                                  return undefined;
                              }
                              return oldEntry;
                          })];
                  case 1:
                      entry = _a.sent();
                      if (!entry) return [3 /*break*/, 6];
                      if (!(entry.registrationStatus === 1 /* IN_PROGRESS */)) return [3 /*break*/, 2];
                      // Can't delete while trying to register.
                      throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */);
                  case 2:
                      if (!(entry.registrationStatus === 2 /* COMPLETED */)) return [3 /*break*/, 6];
                      if (!!navigator.onLine) return [3 /*break*/, 3];
                      throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
                  case 3: return [4 /*yield*/, deleteInstallationRequest(appConfig, entry)];
                  case 4:
                      _a.sent();
                      return [4 /*yield*/, remove(appConfig)];
                  case 5:
                      _a.sent();
                      _a.label = 6;
                  case 6: return [2 /*return*/];
              }
          });
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Sets a new callback that will get called when Installation ID changes.
   * Returns an unsubscribe function that will remove the callback when called.
   */
  function onIdChange(_a, callback) {
      var appConfig = _a.appConfig;
      addCallback(appConfig, callback);
      return function () {
          removeCallback(appConfig, callback);
      };
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function extractAppConfig(app) {
      var e_1, _a;
      if (!app || !app.options) {
          throw getMissingValueError('App Configuration');
      }
      if (!app.name) {
          throw getMissingValueError('App Name');
      }
      // Required app config keys
      var configKeys = [
          'projectId',
          'apiKey',
          'appId'
      ];
      try {
          for (var configKeys_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__values"])(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) {
              var keyName = configKeys_1_1.value;
              if (!app.options[keyName]) {
                  throw getMissingValueError(keyName);
              }
          }
      }
      catch (e_1_1) { e_1 = { error: e_1_1 }; }
      finally {
          try {
              if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1);
          }
          finally { if (e_1) throw e_1.error; }
      }
      return {
          appName: app.name,
          projectId: app.options.projectId,
          apiKey: app.options.apiKey,
          appId: app.options.appId
      };
  }
  function getMissingValueError(valueName) {
      return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, {
          valueName: valueName
      });
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function registerInstallations(instance) {
      var installationsName = 'installations';
      instance.INTERNAL.registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__["Component"](installationsName, function (container) {
          var app = container.getProvider('app').getImmediate();
          // Throws if app isn't configured properly.
          var appConfig = extractAppConfig(app);
          var platformLoggerProvider = container.getProvider('platform-logger');
          var dependencies = {
              appConfig: appConfig,
              platformLoggerProvider: platformLoggerProvider
          };
          var installations = {
              app: app,
              getId: function () { return getId(dependencies); },
              getToken: function (forceRefresh) {
                  return getToken(dependencies, forceRefresh);
              },
              delete: function () { return deleteInstallation(dependencies); },
              onIdChange: function (callback) {
                  return onIdChange(dependencies, callback);
              }
          };
          return installations;
      }, "PUBLIC" /* PUBLIC */));
      instance.registerVersion(name, version);
  }
  registerInstallations(_firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a);
  
  
  //# sourceMappingURL=index.esm.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/installations/node_modules/tslib/tslib.es6.js":
  /*!******************************************************************************!*\
    !*** ./node_modules/@firebase/installations/node_modules/tslib/tslib.es6.js ***!
    \******************************************************************************/
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  };
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  function __classPrivateFieldGet(receiver, privateMap) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to get private field on non-instance");
      }
      return privateMap.get(receiver);
  }
  
  function __classPrivateFieldSet(receiver, privateMap, value) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to set private field on non-instance");
      }
      privateMap.set(receiver, value);
      return value;
  }
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/messaging/dist/index.esm.js":
  /*!************************************************************!*\
    !*** ./node_modules/@firebase/messaging/dist/index.esm.js ***!
    \************************************************************/
  /*! no exports provided */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js");
  /* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_app__WEBPACK_IMPORTED_MODULE_0__);
  /* harmony import */ var _firebase_installations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/installations */ "./node_modules/@firebase/installations/dist/index.esm.js");
  /* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/index.cjs.js");
  /* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_firebase_component__WEBPACK_IMPORTED_MODULE_2__);
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.cjs.js");
  /* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_firebase_util__WEBPACK_IMPORTED_MODULE_4__);
  /* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! idb */ "./node_modules/idb/build/idb.js");
  /* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(idb__WEBPACK_IMPORTED_MODULE_5__);
  
  
  
  
  
  
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var _a;
  var ERROR_MAP = (_a = {},
      _a["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */] = 'Missing App configuration value: "{$valueName}"',
      _a["only-available-in-window" /* AVAILABLE_IN_WINDOW */] = 'This method is available in a Window context.',
      _a["only-available-in-sw" /* AVAILABLE_IN_SW */] = 'This method is available in a service worker context.',
      _a["permission-default" /* PERMISSION_DEFAULT */] = 'The notification permission was not granted and dismissed instead.',
      _a["permission-blocked" /* PERMISSION_BLOCKED */] = 'The notification permission was not granted and blocked instead.',
      _a["unsupported-browser" /* UNSUPPORTED_BROWSER */] = "This browser doesn't support the API's required to use the firebase SDK.",
      _a["failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */] = 'We are unable to register the default service worker. {$browserErrorMessage}',
      _a["token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */] = 'A problem occured while subscribing the user to FCM: {$errorInfo}',
      _a["token-subscribe-no-token" /* TOKEN_SUBSCRIBE_NO_TOKEN */] = 'FCM returned no token when subscribing the user to push.',
      _a["token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */] = 'A problem occured while unsubscribing the ' +
          'user from FCM: {$errorInfo}',
      _a["token-update-failed" /* TOKEN_UPDATE_FAILED */] = 'A problem occured while updating the user from FCM: {$errorInfo}',
      _a["token-update-no-token" /* TOKEN_UPDATE_NO_TOKEN */] = 'FCM returned no token when updating the user to push.',
      _a["use-sw-after-get-token" /* USE_SW_AFTER_GET_TOKEN */] = 'The useServiceWorker() method may only be called once and must be ' +
          'called before calling getToken() to ensure your service worker is used.',
      _a["invalid-sw-registration" /* INVALID_SW_REGISTRATION */] = 'The input to useServiceWorker() must be a ServiceWorkerRegistration.',
      _a["invalid-bg-handler" /* INVALID_BG_HANDLER */] = 'The input to setBackgroundMessageHandler() must be a function.',
      _a["invalid-vapid-key" /* INVALID_VAPID_KEY */] = 'The public VAPID key must be a string.',
      _a["use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */] = 'The usePublicVapidKey() method may only be called once and must be ' +
          'called before calling getToken() to ensure your VAPID key is used.',
      _a);
  var ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_4__["ErrorFactory"]('messaging', 'Messaging', ERROR_MAP);
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function extractAppConfig(app) {
      var e_1, _a;
      if (!app || !app.options) {
          throw getMissingValueError('App Configuration Object');
      }
      if (!app.name) {
          throw getMissingValueError('App Name');
      }
      // Required app config keys
      var configKeys = [
          'projectId',
          'apiKey',
          'appId',
          'messagingSenderId'
      ];
      var options = app.options;
      try {
          for (var configKeys_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__values"])(configKeys), configKeys_1_1 = configKeys_1.next(); !configKeys_1_1.done; configKeys_1_1 = configKeys_1.next()) {
              var keyName = configKeys_1_1.value;
              if (!options[keyName]) {
                  throw getMissingValueError(keyName);
              }
          }
      }
      catch (e_1_1) { e_1 = { error: e_1_1 }; }
      finally {
          try {
              if (configKeys_1_1 && !configKeys_1_1.done && (_a = configKeys_1.return)) _a.call(configKeys_1);
          }
          finally { if (e_1) throw e_1.error; }
      }
      return {
          appName: app.name,
          projectId: options.projectId,
          apiKey: options.apiKey,
          appId: options.appId,
          senderId: options.messagingSenderId
      };
  }
  function getMissingValueError(valueName) {
      return ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */, {
          valueName: valueName
      });
  }
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function arrayToBase64(array) {
      var uint8Array = new Uint8Array(array);
      var base64String = btoa(String.fromCharCode.apply(String, Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__spread"])(uint8Array)));
      return base64String
          .replace(/=/g, '')
          .replace(/\+/g, '-')
          .replace(/\//g, '_');
  }
  function base64ToArray(base64String) {
      var padding = '='.repeat((4 - (base64String.length % 4)) % 4);
      var base64 = (base64String + padding)
          .replace(/\-/g, '+')
          .replace(/_/g, '/');
      var rawData = atob(base64);
      var outputArray = new Uint8Array(rawData.length);
      for (var i = 0; i < rawData.length; ++i) {
          outputArray[i] = rawData.charCodeAt(i);
      }
      return outputArray;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var OLD_DB_NAME = 'fcm_token_details_db';
  /**
   * The last DB version of 'fcm_token_details_db' was 4. This is one higher,
   * so that the upgrade callback is called for all versions of the old DB.
   */
  var OLD_DB_VERSION = 5;
  var OLD_OBJECT_STORE_NAME = 'fcm_token_object_Store';
  function migrateOldDatabase(senderId) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var databases, dbNames, tokenDetails, db;
          var _this = this;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      if (!('databases' in indexedDB)) return [3 /*break*/, 2];
                      return [4 /*yield*/, indexedDB.databases()];
                  case 1:
                      databases = _a.sent();
                      dbNames = databases.map(function (db) { return db.name; });
                      if (!dbNames.includes(OLD_DB_NAME)) {
                          // old DB didn't exist, no need to open.
                          return [2 /*return*/, null];
                      }
                      _a.label = 2;
                  case 2:
                      tokenDetails = null;
                      return [4 /*yield*/, Object(idb__WEBPACK_IMPORTED_MODULE_5__["openDb"])(OLD_DB_NAME, OLD_DB_VERSION, function (db) { return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(_this, void 0, void 0, function () {
                              var objectStore, value, oldDetails, oldDetails, oldDetails;
                              var _a;
                              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_b) {
                                  switch (_b.label) {
                                      case 0:
                                          if (db.oldVersion < 2) {
                                              // Database too old, skip migration.
                                              return [2 /*return*/];
                                          }
                                          if (!db.objectStoreNames.contains(OLD_OBJECT_STORE_NAME)) {
                                              // Database did not exist. Nothing to do.
                                              return [2 /*return*/];
                                          }
                                          objectStore = db.transaction.objectStore(OLD_OBJECT_STORE_NAME);
                                          return [4 /*yield*/, objectStore.index('fcmSenderId').get(senderId)];
                                      case 1:
                                          value = _b.sent();
                                          return [4 /*yield*/, objectStore.clear()];
                                      case 2:
                                          _b.sent();
                                          if (!value) {
                                              // No entry in the database, nothing to migrate.
                                              return [2 /*return*/];
                                          }
                                          if (db.oldVersion === 2) {
                                              oldDetails = value;
                                              if (!oldDetails.auth || !oldDetails.p256dh || !oldDetails.endpoint) {
                                                  return [2 /*return*/];
                                              }
                                              tokenDetails = {
                                                  token: oldDetails.fcmToken,
                                                  createTime: (_a = oldDetails.createTime) !== null && _a !== void 0 ? _a : Date.now(),
                                                  subscriptionOptions: {
                                                      auth: oldDetails.auth,
                                                      p256dh: oldDetails.p256dh,
                                                      endpoint: oldDetails.endpoint,
                                                      swScope: oldDetails.swScope,
                                                      vapidKey: typeof oldDetails.vapidKey === 'string'
                                                          ? oldDetails.vapidKey
                                                          : arrayToBase64(oldDetails.vapidKey)
                                                  }
                                              };
                                          }
                                          else if (db.oldVersion === 3) {
                                              oldDetails = value;
                                              tokenDetails = {
                                                  token: oldDetails.fcmToken,
                                                  createTime: oldDetails.createTime,
                                                  subscriptionOptions: {
                                                      auth: arrayToBase64(oldDetails.auth),
                                                      p256dh: arrayToBase64(oldDetails.p256dh),
                                                      endpoint: oldDetails.endpoint,
                                                      swScope: oldDetails.swScope,
                                                      vapidKey: arrayToBase64(oldDetails.vapidKey)
                                                  }
                                              };
                                          }
                                          else if (db.oldVersion === 4) {
                                              oldDetails = value;
                                              tokenDetails = {
                                                  token: oldDetails.fcmToken,
                                                  createTime: oldDetails.createTime,
                                                  subscriptionOptions: {
                                                      auth: arrayToBase64(oldDetails.auth),
                                                      p256dh: arrayToBase64(oldDetails.p256dh),
                                                      endpoint: oldDetails.endpoint,
                                                      swScope: oldDetails.swScope,
                                                      vapidKey: arrayToBase64(oldDetails.vapidKey)
                                                  }
                                              };
                                          }
                                          return [2 /*return*/];
                                  }
                              });
                          }); })];
                  case 3:
                      db = _a.sent();
                      db.close();
                      // Delete all old databases.
                      return [4 /*yield*/, Object(idb__WEBPACK_IMPORTED_MODULE_5__["deleteDb"])(OLD_DB_NAME)];
                  case 4:
                      // Delete all old databases.
                      _a.sent();
                      return [4 /*yield*/, Object(idb__WEBPACK_IMPORTED_MODULE_5__["deleteDb"])('fcm_vapid_details_db')];
                  case 5:
                      _a.sent();
                      return [4 /*yield*/, Object(idb__WEBPACK_IMPORTED_MODULE_5__["deleteDb"])('undefined')];
                  case 6:
                      _a.sent();
                      return [2 /*return*/, checkTokenDetails(tokenDetails) ? tokenDetails : null];
              }
          });
      });
  }
  function checkTokenDetails(tokenDetails) {
      if (!tokenDetails || !tokenDetails.subscriptionOptions) {
          return false;
      }
      var subscriptionOptions = tokenDetails.subscriptionOptions;
      return (typeof tokenDetails.createTime === 'number' &&
          tokenDetails.createTime > 0 &&
          typeof tokenDetails.token === 'string' &&
          tokenDetails.token.length > 0 &&
          typeof subscriptionOptions.auth === 'string' &&
          subscriptionOptions.auth.length > 0 &&
          typeof subscriptionOptions.p256dh === 'string' &&
          subscriptionOptions.p256dh.length > 0 &&
          typeof subscriptionOptions.endpoint === 'string' &&
          subscriptionOptions.endpoint.length > 0 &&
          typeof subscriptionOptions.swScope === 'string' &&
          subscriptionOptions.swScope.length > 0 &&
          typeof subscriptionOptions.vapidKey === 'string' &&
          subscriptionOptions.vapidKey.length > 0);
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  // Exported for tests.
  var DATABASE_NAME = 'firebase-messaging-database';
  var DATABASE_VERSION = 1;
  var OBJECT_STORE_NAME = 'firebase-messaging-store';
  var dbPromise = null;
  function getDbPromise() {
      if (!dbPromise) {
          dbPromise = Object(idb__WEBPACK_IMPORTED_MODULE_5__["openDb"])(DATABASE_NAME, DATABASE_VERSION, function (upgradeDb) {
              // We don't use 'break' in this switch statement, the fall-through
              // behavior is what we want, because if there are multiple versions between
              // the old version and the current version, we want ALL the migrations
              // that correspond to those versions to run, not only the last one.
              // eslint-disable-next-line default-case
              switch (upgradeDb.oldVersion) {
                  case 0:
                      upgradeDb.createObjectStore(OBJECT_STORE_NAME);
              }
          });
      }
      return dbPromise;
  }
  /** Gets record(s) from the objectStore that match the given key. */
  function dbGet(firebaseDependencies) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var key, db, tokenDetails, oldTokenDetails;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      key = getKey(firebaseDependencies);
                      return [4 /*yield*/, getDbPromise()];
                  case 1:
                      db = _a.sent();
                      return [4 /*yield*/, db
                              .transaction(OBJECT_STORE_NAME)
                              .objectStore(OBJECT_STORE_NAME)
                              .get(key)];
                  case 2:
                      tokenDetails = _a.sent();
                      if (!tokenDetails) return [3 /*break*/, 3];
                      return [2 /*return*/, tokenDetails];
                  case 3: return [4 /*yield*/, migrateOldDatabase(firebaseDependencies.appConfig.senderId)];
                  case 4:
                      oldTokenDetails = _a.sent();
                      if (!oldTokenDetails) return [3 /*break*/, 6];
                      return [4 /*yield*/, dbSet(firebaseDependencies, oldTokenDetails)];
                  case 5:
                      _a.sent();
                      return [2 /*return*/, oldTokenDetails];
                  case 6: return [2 /*return*/];
              }
          });
      });
  }
  /** Assigns or overwrites the record for the given key with the given value. */
  function dbSet(firebaseDependencies, tokenDetails) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var key, db, tx;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      key = getKey(firebaseDependencies);
                      return [4 /*yield*/, getDbPromise()];
                  case 1:
                      db = _a.sent();
                      tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
                      return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).put(tokenDetails, key)];
                  case 2:
                      _a.sent();
                      return [4 /*yield*/, tx.complete];
                  case 3:
                      _a.sent();
                      return [2 /*return*/, tokenDetails];
              }
          });
      });
  }
  /** Removes record(s) from the objectStore that match the given key. */
  function dbRemove(firebaseDependencies) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var key, db, tx;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      key = getKey(firebaseDependencies);
                      return [4 /*yield*/, getDbPromise()];
                  case 1:
                      db = _a.sent();
                      tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
                      return [4 /*yield*/, tx.objectStore(OBJECT_STORE_NAME).delete(key)];
                  case 2:
                      _a.sent();
                      return [4 /*yield*/, tx.complete];
                  case 3:
                      _a.sent();
                      return [2 /*return*/];
              }
          });
      });
  }
  function getKey(_a) {
      var appConfig = _a.appConfig;
      return appConfig.appId;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var DEFAULT_SW_PATH = '/firebase-messaging-sw.js';
  var DEFAULT_SW_SCOPE = '/firebase-cloud-messaging-push-scope';
  var DEFAULT_VAPID_KEY = 'BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4';
  var ENDPOINT = 'https://fcmregistrations.googleapis.com/v1';
  /** Key of FCM Payload in Notification's data field. */
  var FCM_MSG = 'FCM_MSG';
  var CONSOLE_CAMPAIGN_ID = 'google.c.a.c_id';
  var CONSOLE_CAMPAIGN_NAME = 'google.c.a.c_l';
  var CONSOLE_CAMPAIGN_TIME = 'google.c.a.ts';
  /** Set to '1' if Analytics is enabled for the campaign */
  var CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e';
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function requestGetToken(firebaseDependencies, subscriptionOptions) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var headers, body, subscribeOptions, responseData, response, err_1, message;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, getHeaders(firebaseDependencies)];
                  case 1:
                      headers = _a.sent();
                      body = getBody(subscriptionOptions);
                      subscribeOptions = {
                          method: 'POST',
                          headers: headers,
                          body: JSON.stringify(body)
                      };
                      _a.label = 2;
                  case 2:
                      _a.trys.push([2, 5, , 6]);
                      return [4 /*yield*/, fetch(getEndpoint(firebaseDependencies.appConfig), subscribeOptions)];
                  case 3:
                      response = _a.sent();
                      return [4 /*yield*/, response.json()];
                  case 4:
                      responseData = _a.sent();
                      return [3 /*break*/, 6];
                  case 5:
                      err_1 = _a.sent();
                      throw ERROR_FACTORY.create("token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */, {
                          errorInfo: err_1
                      });
                  case 6:
                      if (responseData.error) {
                          message = responseData.error.message;
                          throw ERROR_FACTORY.create("token-subscribe-failed" /* TOKEN_SUBSCRIBE_FAILED */, {
                              errorInfo: message
                          });
                      }
                      if (!responseData.token) {
                          throw ERROR_FACTORY.create("token-subscribe-no-token" /* TOKEN_SUBSCRIBE_NO_TOKEN */);
                      }
                      return [2 /*return*/, responseData.token];
              }
          });
      });
  }
  function requestUpdateToken(firebaseDependencies, tokenDetails) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var headers, body, updateOptions, responseData, response, err_2, message;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, getHeaders(firebaseDependencies)];
                  case 1:
                      headers = _a.sent();
                      body = getBody(tokenDetails.subscriptionOptions);
                      updateOptions = {
                          method: 'PATCH',
                          headers: headers,
                          body: JSON.stringify(body)
                      };
                      _a.label = 2;
                  case 2:
                      _a.trys.push([2, 5, , 6]);
                      return [4 /*yield*/, fetch(getEndpoint(firebaseDependencies.appConfig) + "/" + tokenDetails.token, updateOptions)];
                  case 3:
                      response = _a.sent();
                      return [4 /*yield*/, response.json()];
                  case 4:
                      responseData = _a.sent();
                      return [3 /*break*/, 6];
                  case 5:
                      err_2 = _a.sent();
                      throw ERROR_FACTORY.create("token-update-failed" /* TOKEN_UPDATE_FAILED */, {
                          errorInfo: err_2
                      });
                  case 6:
                      if (responseData.error) {
                          message = responseData.error.message;
                          throw ERROR_FACTORY.create("token-update-failed" /* TOKEN_UPDATE_FAILED */, {
                              errorInfo: message
                          });
                      }
                      if (!responseData.token) {
                          throw ERROR_FACTORY.create("token-update-no-token" /* TOKEN_UPDATE_NO_TOKEN */);
                      }
                      return [2 /*return*/, responseData.token];
              }
          });
      });
  }
  function requestDeleteToken(firebaseDependencies, token) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var headers, unsubscribeOptions, response, responseData, message, err_3;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, getHeaders(firebaseDependencies)];
                  case 1:
                      headers = _a.sent();
                      unsubscribeOptions = {
                          method: 'DELETE',
                          headers: headers
                      };
                      _a.label = 2;
                  case 2:
                      _a.trys.push([2, 5, , 6]);
                      return [4 /*yield*/, fetch(getEndpoint(firebaseDependencies.appConfig) + "/" + token, unsubscribeOptions)];
                  case 3:
                      response = _a.sent();
                      return [4 /*yield*/, response.json()];
                  case 4:
                      responseData = _a.sent();
                      if (responseData.error) {
                          message = responseData.error.message;
                          throw ERROR_FACTORY.create("token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */, {
                              errorInfo: message
                          });
                      }
                      return [3 /*break*/, 6];
                  case 5:
                      err_3 = _a.sent();
                      throw ERROR_FACTORY.create("token-unsubscribe-failed" /* TOKEN_UNSUBSCRIBE_FAILED */, {
                          errorInfo: err_3
                      });
                  case 6: return [2 /*return*/];
              }
          });
      });
  }
  function getEndpoint(_a) {
      var projectId = _a.projectId;
      return ENDPOINT + "/projects/" + projectId + "/registrations";
  }
  function getHeaders(_a) {
      var appConfig = _a.appConfig, installations = _a.installations;
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var authToken;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0: return [4 /*yield*/, installations.getToken()];
                  case 1:
                      authToken = _b.sent();
                      return [2 /*return*/, new Headers({
                              'Content-Type': 'application/json',
                              Accept: 'application/json',
                              'x-goog-api-key': appConfig.apiKey,
                              'x-goog-firebase-installations-auth': "FIS " + authToken
                          })];
              }
          });
      });
  }
  function getBody(_a) {
      var p256dh = _a.p256dh, auth = _a.auth, endpoint = _a.endpoint, vapidKey = _a.vapidKey;
      var body = {
          web: {
              endpoint: endpoint,
              auth: auth,
              p256dh: p256dh
          }
      };
      if (vapidKey !== DEFAULT_VAPID_KEY) {
          body.web.applicationPubKey = vapidKey;
      }
      return body;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /** UpdateRegistration will be called once every week. */
  var TOKEN_EXPIRATION_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
  function getToken(firebaseDependencies, swRegistration, vapidKey) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var pushSubscription, tokenDetails, subscriptionOptions, e_1;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      if (Notification.permission !== 'granted') {
                          throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */);
                      }
                      return [4 /*yield*/, getPushSubscription(swRegistration, vapidKey)];
                  case 1:
                      pushSubscription = _a.sent();
                      return [4 /*yield*/, dbGet(firebaseDependencies)];
                  case 2:
                      tokenDetails = _a.sent();
                      subscriptionOptions = {
                          vapidKey: vapidKey,
                          swScope: swRegistration.scope,
                          endpoint: pushSubscription.endpoint,
                          auth: arrayToBase64(pushSubscription.getKey('auth')),
                          p256dh: arrayToBase64(pushSubscription.getKey('p256dh'))
                      };
                      if (!!tokenDetails) return [3 /*break*/, 3];
                      // No token, get a new one.
                      return [2 /*return*/, getNewToken(firebaseDependencies, subscriptionOptions)];
                  case 3:
                      if (!!isTokenValid(tokenDetails.subscriptionOptions, subscriptionOptions)) return [3 /*break*/, 8];
                      _a.label = 4;
                  case 4:
                      _a.trys.push([4, 6, , 7]);
                      return [4 /*yield*/, requestDeleteToken(firebaseDependencies, tokenDetails.token)];
                  case 5:
                      _a.sent();
                      return [3 /*break*/, 7];
                  case 6:
                      e_1 = _a.sent();
                      // Suppress errors because of #2364
                      console.warn(e_1);
                      return [3 /*break*/, 7];
                  case 7: return [2 /*return*/, getNewToken(firebaseDependencies, subscriptionOptions)];
                  case 8:
                      if (Date.now() >= tokenDetails.createTime + TOKEN_EXPIRATION_MS) {
                          // Weekly token refresh
                          return [2 /*return*/, updateToken({
                                  token: tokenDetails.token,
                                  createTime: Date.now(),
                                  subscriptionOptions: subscriptionOptions
                              }, firebaseDependencies, swRegistration)];
                      }
                      else {
                          // Valid token, nothing to do.
                          return [2 /*return*/, tokenDetails.token];
                      }
                  case 9: return [2 /*return*/];
              }
          });
      });
  }
  /**
   * This method deletes the token from the database, unsubscribes the token from
   * FCM, and unregisters the push subscription if it exists.
   */
  function deleteToken(firebaseDependencies, swRegistration) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var tokenDetails, pushSubscription;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, dbGet(firebaseDependencies)];
                  case 1:
                      tokenDetails = _a.sent();
                      if (!tokenDetails) return [3 /*break*/, 4];
                      return [4 /*yield*/, requestDeleteToken(firebaseDependencies, tokenDetails.token)];
                  case 2:
                      _a.sent();
                      return [4 /*yield*/, dbRemove(firebaseDependencies)];
                  case 3:
                      _a.sent();
                      _a.label = 4;
                  case 4: return [4 /*yield*/, swRegistration.pushManager.getSubscription()];
                  case 5:
                      pushSubscription = _a.sent();
                      if (pushSubscription) {
                          return [2 /*return*/, pushSubscription.unsubscribe()];
                      }
                      // If there's no SW, consider it a success.
                      return [2 /*return*/, true];
              }
          });
      });
  }
  function updateToken(tokenDetails, firebaseDependencies, swRegistration) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var updatedToken, updatedTokenDetails, e_2;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      _a.trys.push([0, 3, , 5]);
                      return [4 /*yield*/, requestUpdateToken(firebaseDependencies, tokenDetails)];
                  case 1:
                      updatedToken = _a.sent();
                      updatedTokenDetails = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({ token: updatedToken, createTime: Date.now() }, tokenDetails);
                      return [4 /*yield*/, dbSet(firebaseDependencies, updatedTokenDetails)];
                  case 2:
                      _a.sent();
                      return [2 /*return*/, updatedToken];
                  case 3:
                      e_2 = _a.sent();
                      return [4 /*yield*/, deleteToken(firebaseDependencies, swRegistration)];
                  case 4:
                      _a.sent();
                      throw e_2;
                  case 5: return [2 /*return*/];
              }
          });
      });
  }
  function getNewToken(firebaseDependencies, subscriptionOptions) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var token, tokenDetails;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, requestGetToken(firebaseDependencies, subscriptionOptions)];
                  case 1:
                      token = _a.sent();
                      tokenDetails = {
                          token: token,
                          createTime: Date.now(),
                          subscriptionOptions: subscriptionOptions
                      };
                      return [4 /*yield*/, dbSet(firebaseDependencies, tokenDetails)];
                  case 2:
                      _a.sent();
                      return [2 /*return*/, tokenDetails.token];
              }
          });
      });
  }
  /**
   * Gets a PushSubscription for the current user.
   */
  function getPushSubscription(swRegistration, vapidKey) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var subscription;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
              switch (_a.label) {
                  case 0: return [4 /*yield*/, swRegistration.pushManager.getSubscription()];
                  case 1:
                      subscription = _a.sent();
                      if (subscription) {
                          return [2 /*return*/, subscription];
                      }
                      return [2 /*return*/, swRegistration.pushManager.subscribe({
                              userVisibleOnly: true,
                              // Chrome <= 75 doesn't support base64-encoded VAPID key. For backward compatibility, VAPID key
                              // submitted to pushManager#subscribe must be of type Uint8Array.
                              applicationServerKey: base64ToArray(vapidKey)
                          })];
              }
          });
      });
  }
  /**
   * Checks if the saved tokenDetails object matches the configuration provided.
   */
  function isTokenValid(dbOptions, currentOptions) {
      var isVapidKeyEqual = currentOptions.vapidKey === dbOptions.vapidKey;
      var isEndpointEqual = currentOptions.endpoint === dbOptions.endpoint;
      var isAuthEqual = currentOptions.auth === dbOptions.auth;
      var isP256dhEqual = currentOptions.p256dh === dbOptions.p256dh;
      return isVapidKeyEqual && isEndpointEqual && isAuthEqual && isP256dhEqual;
  }
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var MessageType;
  (function (MessageType) {
      MessageType["PUSH_RECEIVED"] = "push-received";
      MessageType["NOTIFICATION_CLICKED"] = "notification-clicked";
  })(MessageType || (MessageType = {}));
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function isConsoleMessage(data) {
      // This message has a campaign ID, meaning it was sent using the
      // Firebase Console.
      return typeof data === 'object' && !!data && CONSOLE_CAMPAIGN_ID in data;
  }
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var WindowController = /** @class */ (function () {
      function WindowController(firebaseDependencies) {
          var _this = this;
          this.firebaseDependencies = firebaseDependencies;
          this.vapidKey = null;
          this.onMessageCallback = null;
          navigator.serviceWorker.addEventListener('message', function (e) {
              return _this.messageEventListener(e);
          });
      }
      Object.defineProperty(WindowController.prototype, "app", {
          get: function () {
              return this.firebaseDependencies.app;
          },
          enumerable: true,
          configurable: true
      });
      WindowController.prototype.getToken = function () {
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var swRegistration;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          if (!this.vapidKey) {
                              this.vapidKey = DEFAULT_VAPID_KEY;
                          }
                          return [4 /*yield*/, this.getServiceWorkerRegistration()];
                      case 1:
                          swRegistration = _a.sent();
                          if (!(Notification.permission === 'default')) return [3 /*break*/, 3];
                          // The user hasn't allowed or denied notifications yet. Ask them.
                          return [4 /*yield*/, Notification.requestPermission()];
                      case 2:
                          // The user hasn't allowed or denied notifications yet. Ask them.
                          _a.sent();
                          _a.label = 3;
                      case 3:
                          if (Notification.permission !== 'granted') {
                              throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */);
                          }
                          return [2 /*return*/, getToken(this.firebaseDependencies, swRegistration, this.vapidKey)];
                  }
              });
          });
      };
      WindowController.prototype.deleteToken = function () {
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var swRegistration;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.getServiceWorkerRegistration()];
                      case 1:
                          swRegistration = _a.sent();
                          return [2 /*return*/, deleteToken(this.firebaseDependencies, swRegistration)];
                  }
              });
          });
      };
      /**
       * Request permission if it is not currently granted.
       *
       * @return Resolves if the permission was granted, rejects otherwise.
       *
       * @deprecated Use Notification.requestPermission() instead.
       * https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission
       */
      WindowController.prototype.requestPermission = function () {
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var permissionResult;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          if (Notification.permission === 'granted') {
                              return [2 /*return*/];
                          }
                          return [4 /*yield*/, Notification.requestPermission()];
                      case 1:
                          permissionResult = _a.sent();
                          if (permissionResult === 'granted') {
                              return [2 /*return*/];
                          }
                          else if (permissionResult === 'denied') {
                              throw ERROR_FACTORY.create("permission-blocked" /* PERMISSION_BLOCKED */);
                          }
                          else {
                              throw ERROR_FACTORY.create("permission-default" /* PERMISSION_DEFAULT */);
                          }
                  }
              });
          });
      };
      // TODO: Deprecate this and make VAPID key a parameter in getToken.
      WindowController.prototype.usePublicVapidKey = function (vapidKey) {
          if (this.vapidKey !== null) {
              throw ERROR_FACTORY.create("use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */);
          }
          if (typeof vapidKey !== 'string' || vapidKey.length === 0) {
              throw ERROR_FACTORY.create("invalid-vapid-key" /* INVALID_VAPID_KEY */);
          }
          this.vapidKey = vapidKey;
      };
      WindowController.prototype.useServiceWorker = function (swRegistration) {
          if (!(swRegistration instanceof ServiceWorkerRegistration)) {
              throw ERROR_FACTORY.create("invalid-sw-registration" /* INVALID_SW_REGISTRATION */);
          }
          if (this.swRegistration) {
              throw ERROR_FACTORY.create("use-sw-after-get-token" /* USE_SW_AFTER_GET_TOKEN */);
          }
          this.swRegistration = swRegistration;
      };
      /**
       * @param nextOrObserver An observer object or a function triggered on
       * message.
       * @return The unsubscribe function for the observer.
       */
      // TODO: Simplify this to only accept a function and not an Observer.
      WindowController.prototype.onMessage = function (nextOrObserver) {
          var _this = this;
          this.onMessageCallback =
              typeof nextOrObserver === 'function'
                  ? nextOrObserver
                  : nextOrObserver.next;
          return function () {
              _this.onMessageCallback = null;
          };
      };
      WindowController.prototype.setBackgroundMessageHandler = function () {
          throw ERROR_FACTORY.create("only-available-in-sw" /* AVAILABLE_IN_SW */);
      };
      // Unimplemented
      WindowController.prototype.onTokenRefresh = function () {
          return function () { };
      };
      /**
       * Creates or updates the default service worker registration.
       * @return The service worker registration to be used for the push service.
       */
      WindowController.prototype.getServiceWorkerRegistration = function () {
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var _a, e_1;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_b) {
                  switch (_b.label) {
                      case 0:
                          if (!!this.swRegistration) return [3 /*break*/, 4];
                          _b.label = 1;
                      case 1:
                          _b.trys.push([1, 3, , 4]);
                          _a = this;
                          return [4 /*yield*/, navigator.serviceWorker.register(DEFAULT_SW_PATH, {
                                  scope: DEFAULT_SW_SCOPE
                              })];
                      case 2:
                          _a.swRegistration = _b.sent();
                          // The timing when browser updates sw when sw has an update is unreliable by my experiment.
                          // It leads to version conflict when the SDK upgrades to a newer version in the main page, but
                          // sw is stuck with the old version. For example, https://github.com/firebase/firebase-js-sdk/issues/2590
                          // The following line reliably updates sw if there was an update.
                          this.swRegistration.update().catch(function () {
                              /* it is non blocking and we don't care if it failed */
                          });
                          return [3 /*break*/, 4];
                      case 3:
                          e_1 = _b.sent();
                          throw ERROR_FACTORY.create("failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */, {
                              browserErrorMessage: e_1.message
                          });
                      case 4: return [2 /*return*/, this.swRegistration];
                  }
              });
          });
      };
      WindowController.prototype.messageEventListener = function (event) {
          var _a;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var _b, type, payload, data;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_c) {
                  switch (_c.label) {
                      case 0:
                          if (!((_a = event.data) === null || _a === void 0 ? void 0 : _a.firebaseMessaging)) {
                              // Not a message from FCM
                              return [2 /*return*/];
                          }
                          _b = event.data.firebaseMessaging, type = _b.type, payload = _b.payload;
                          if (this.onMessageCallback && type === MessageType.PUSH_RECEIVED) {
                              this.onMessageCallback(payload);
                          }
                          data = payload.data;
                          if (!(isConsoleMessage(data) &&
                              data[CONSOLE_CAMPAIGN_ANALYTICS_ENABLED] === '1')) return [3 /*break*/, 2];
                          // Analytics is enabled on this message, so we should log it.
                          return [4 /*yield*/, this.logEvent(type, data)];
                      case 1:
                          // Analytics is enabled on this message, so we should log it.
                          _c.sent();
                          _c.label = 2;
                      case 2: return [2 /*return*/];
                  }
              });
          });
      };
      WindowController.prototype.logEvent = function (messageType, data) {
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var eventType, analytics;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          eventType = getEventType(messageType);
                          return [4 /*yield*/, this.firebaseDependencies.analyticsProvider.get()];
                      case 1:
                          analytics = _a.sent();
                          analytics.logEvent(eventType, {
                              /* eslint-disable camelcase */
                              message_id: data[CONSOLE_CAMPAIGN_ID],
                              message_name: data[CONSOLE_CAMPAIGN_NAME],
                              message_time: data[CONSOLE_CAMPAIGN_TIME],
                              message_device_time: Math.floor(Date.now() / 1000)
                              /* eslint-enable camelcase */
                          });
                          return [2 /*return*/];
                  }
              });
          });
      };
      return WindowController;
  }());
  function getEventType(messageType) {
      switch (messageType) {
          case MessageType.NOTIFICATION_CLICKED:
              return 'notification_open';
          case MessageType.PUSH_RECEIVED:
              return 'notification_foreground';
          default:
              throw new Error();
      }
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /** Returns a promise that resolves after given time passes. */
  function sleep(ms) {
      return new Promise(function (resolve) {
          setTimeout(resolve, ms);
      });
  }
  
  /**
   * @license
   * Copyright 2017 Google LLC
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var SwController = /** @class */ (function () {
      function SwController(firebaseDependencies) {
          var _this = this;
          this.firebaseDependencies = firebaseDependencies;
          this.vapidKey = null;
          this.bgMessageHandler = null;
          self.addEventListener('push', function (e) {
              e.waitUntil(_this.onPush(e));
          });
          self.addEventListener('pushsubscriptionchange', function (e) {
              e.waitUntil(_this.onSubChange(e));
          });
          self.addEventListener('notificationclick', function (e) {
              e.waitUntil(_this.onNotificationClick(e));
          });
      }
      Object.defineProperty(SwController.prototype, "app", {
          get: function () {
              return this.firebaseDependencies.app;
          },
          enumerable: true,
          configurable: true
      });
      /**
       * Calling setBackgroundMessageHandler will opt in to some specific
       * behaviours.
       * 1.) If a notification doesn't need to be shown due to a window already
       * being visible, then push messages will be sent to the page.
       * 2.) If a notification needs to be shown, and the message contains no
       * notification data this method will be called
       * and the promise it returns will be passed to event.waitUntil.
       * If you do not set this callback then all push messages will let and the
       * developer can handle them in a their own 'push' event callback
       *
       * @param callback The callback to be called when a push message is received
       * and a notification must be shown. The callback will be given the data from
       * the push message.
       */
      SwController.prototype.setBackgroundMessageHandler = function (callback) {
          if (!callback || typeof callback !== 'function') {
              throw ERROR_FACTORY.create("invalid-bg-handler" /* INVALID_BG_HANDLER */);
          }
          this.bgMessageHandler = callback;
      };
      // TODO: Remove getToken from SW Controller.
      // Calling this from an old SW can cause all kinds of trouble.
      SwController.prototype.getToken = function () {
          var _a, _b;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var tokenDetails;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_c) {
                  switch (_c.label) {
                      case 0:
                          if (!!this.vapidKey) return [3 /*break*/, 2];
                          return [4 /*yield*/, dbGet(this.firebaseDependencies)];
                      case 1:
                          tokenDetails = _c.sent();
                          this.vapidKey = (_b = (_a = tokenDetails === null || tokenDetails === void 0 ? void 0 : tokenDetails.subscriptionOptions) === null || _a === void 0 ? void 0 : _a.vapidKey) !== null && _b !== void 0 ? _b : DEFAULT_VAPID_KEY;
                          _c.label = 2;
                      case 2: return [2 /*return*/, getToken(this.firebaseDependencies, self.registration, this.vapidKey)];
                  }
              });
          });
      };
      // TODO: Remove deleteToken from SW Controller.
      // Calling this from an old SW can cause all kinds of trouble.
      SwController.prototype.deleteToken = function () {
          return deleteToken(this.firebaseDependencies, self.registration);
      };
      SwController.prototype.requestPermission = function () {
          throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
      };
      // TODO: Deprecate this and make VAPID key a parameter in getToken.
      // TODO: Remove this together with getToken from SW Controller.
      SwController.prototype.usePublicVapidKey = function (vapidKey) {
          if (this.vapidKey !== null) {
              throw ERROR_FACTORY.create("use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */);
          }
          if (typeof vapidKey !== 'string' || vapidKey.length === 0) {
              throw ERROR_FACTORY.create("invalid-vapid-key" /* INVALID_VAPID_KEY */);
          }
          this.vapidKey = vapidKey;
      };
      SwController.prototype.useServiceWorker = function () {
          throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
      };
      SwController.prototype.onMessage = function () {
          throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
      };
      SwController.prototype.onTokenRefresh = function () {
          throw ERROR_FACTORY.create("only-available-in-window" /* AVAILABLE_IN_WINDOW */);
      };
      /**
       * A handler for push events that shows notifications based on the content of
       * the payload.
       *
       * The payload must be a JSON-encoded Object with a `notification` key. The
       * value of the `notification` property will be used as the NotificationOptions
       * object passed to showNotification. Additionally, the `title` property of the
       * notification object will be used as the title.
       *
       * If there is no notification data in the payload then no notification will be
       * shown.
       */
      SwController.prototype.onPush = function (event) {
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var payload, clientList, notificationDetails;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          payload = getMessagePayload(event);
                          if (!payload) {
                              return [2 /*return*/];
                          }
                          return [4 /*yield*/, getClientList()];
                      case 1:
                          clientList = _a.sent();
                          if (hasVisibleClients(clientList)) {
                              // App in foreground. Send to page.
                              return [2 /*return*/, sendMessageToWindowClients(clientList, payload)];
                          }
                          notificationDetails = getNotificationData(payload);
                          if (!notificationDetails) return [3 /*break*/, 3];
                          return [4 /*yield*/, showNotification(notificationDetails)];
                      case 2:
                          _a.sent();
                          return [3 /*break*/, 5];
                      case 3:
                          if (!this.bgMessageHandler) return [3 /*break*/, 5];
                          return [4 /*yield*/, this.bgMessageHandler(payload)];
                      case 4:
                          _a.sent();
                          _a.label = 5;
                      case 5: return [2 /*return*/];
                  }
              });
          });
      };
      SwController.prototype.onSubChange = function (event) {
          var _a, _b;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var newSubscription, tokenDetails;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_c) {
                  switch (_c.label) {
                      case 0:
                          newSubscription = event.newSubscription;
                          if (!!newSubscription) return [3 /*break*/, 2];
                          // Subscription revoked, delete token
                          return [4 /*yield*/, deleteToken(this.firebaseDependencies, self.registration)];
                      case 1:
                          // Subscription revoked, delete token
                          _c.sent();
                          return [2 /*return*/];
                      case 2: return [4 /*yield*/, dbGet(this.firebaseDependencies)];
                      case 3:
                          tokenDetails = _c.sent();
                          return [4 /*yield*/, deleteToken(this.firebaseDependencies, self.registration)];
                      case 4:
                          _c.sent();
                          return [4 /*yield*/, getToken(this.firebaseDependencies, self.registration, (_b = (_a = tokenDetails === null || tokenDetails === void 0 ? void 0 : tokenDetails.subscriptionOptions) === null || _a === void 0 ? void 0 : _a.vapidKey) !== null && _b !== void 0 ? _b : DEFAULT_VAPID_KEY)];
                      case 5:
                          _c.sent();
                          return [2 /*return*/];
                  }
              });
          });
      };
      SwController.prototype.onNotificationClick = function (event) {
          var _a, _b;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
              var payload, link, client, message;
              return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_c) {
                  switch (_c.label) {
                      case 0:
                          payload = (_b = (_a = event.notification) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b[FCM_MSG];
                          if (!payload) {
                              // Not an FCM notification, do nothing.
                              return [2 /*return*/];
                          }
                          else if (event.action) {
                              // User clicked on an action button.
                              // This will allow devs to act on action button clicks by using a custom
                              // onNotificationClick listener that they define.
                              return [2 /*return*/];
                          }
                          // Prevent other listeners from receiving the event
                          event.stopImmediatePropagation();
                          event.notification.close();
                          link = getLink(payload);
                          if (!link) {
                              return [2 /*return*/];
                          }
                          return [4 /*yield*/, getWindowClient(link)];
                      case 1:
                          client = _c.sent();
                          if (!!client) return [3 /*break*/, 4];
                          return [4 /*yield*/, self.clients.openWindow(link)];
                      case 2:
                          // Unable to find window client so need to open one.
                          // This also focuses the opened client.
                          client = _c.sent();
                          // Wait three seconds for the client to initialize and set up the message
                          // handler so that it can receive the message.
                          return [4 /*yield*/, sleep(3000)];
                      case 3:
                          // Wait three seconds for the client to initialize and set up the message
                          // handler so that it can receive the message.
                          _c.sent();
                          return [3 /*break*/, 6];
                      case 4: return [4 /*yield*/, client.focus()];
                      case 5:
                          client = _c.sent();
                          _c.label = 6;
                      case 6:
                          if (!client) {
                              // Window Client will not be returned if it's for a third party origin.
                              return [2 /*return*/];
                          }
                          message = createNewMessage(MessageType.NOTIFICATION_CLICKED, payload);
                          return [2 /*return*/, client.postMessage(message)];
                  }
              });
          });
      };
      return SwController;
  }());
  function getMessagePayload(_a) {
      var data = _a.data;
      if (!data) {
          return null;
      }
      try {
          return data.json();
      }
      catch (err) {
          // Not JSON so not an FCM message.
          return null;
      }
  }
  function getNotificationData(payload) {
      var _a;
      if (!payload || typeof payload.notification !== 'object') {
          return;
      }
      var notificationInformation = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, payload.notification);
      // Put the message payload under FCM_MSG name so we can identify the
      // notification as being an FCM notification vs a notification from
      // somewhere else (i.e. normal web push or developer generated
      // notification).
      notificationInformation.data = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__assign"])({}, payload.notification.data), (_a = {}, _a[FCM_MSG] = payload, _a));
      return notificationInformation;
  }
  /**
   * @param url The URL to look for when focusing a client.
   * @return Returns an existing window client or a newly opened WindowClient.
   */
  function getWindowClient(url) {
      return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__awaiter"])(this, void 0, void 0, function () {
          var parsedURL, clientList, clientList_1, clientList_1_1, client, parsedClientUrl;
          var e_1, _a;
          return Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__generator"])(this, function (_b) {
              switch (_b.label) {
                  case 0:
                      parsedURL = new URL(url, self.location.href);
                      return [4 /*yield*/, getClientList()];
                  case 1:
                      clientList = _b.sent();
                      try {
                          for (clientList_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__values"])(clientList), clientList_1_1 = clientList_1.next(); !clientList_1_1.done; clientList_1_1 = clientList_1.next()) {
                              client = clientList_1_1.value;
                              parsedClientUrl = new URL(client.url, self.location.href);
                              if (parsedClientUrl.host === parsedURL.host) {
                                  return [2 /*return*/, client];
                              }
                          }
                      }
                      catch (e_1_1) { e_1 = { error: e_1_1 }; }
                      finally {
                          try {
                              if (clientList_1_1 && !clientList_1_1.done && (_a = clientList_1.return)) _a.call(clientList_1);
                          }
                          finally { if (e_1) throw e_1.error; }
                      }
                      return [2 /*return*/, null];
              }
          });
      });
  }
  /**
   * @returns If there is currently a visible WindowClient, this method will
   * resolve to true, otherwise false.
   */
  function hasVisibleClients(clientList) {
      return clientList.some(function (client) {
          return client.visibilityState === 'visible' &&
              // Ignore chrome-extension clients as that matches the background pages
              // of extensions, which are always considered visible for some reason.
              !client.url.startsWith('chrome-extension://');
      });
  }
  /**
   * @param payload The data from the push event that should be sent to all
   * available pages.
   * @returns Returns a promise that resolves once the message has been sent to
   * all WindowClients.
   */
  function sendMessageToWindowClients(clientList, payload) {
      var e_2, _a;
      var message = createNewMessage(MessageType.PUSH_RECEIVED, payload);
      try {
          for (var clientList_2 = Object(tslib__WEBPACK_IMPORTED_MODULE_3__["__values"])(clientList), clientList_2_1 = clientList_2.next(); !clientList_2_1.done; clientList_2_1 = clientList_2.next()) {
              var client = clientList_2_1.value;
              client.postMessage(message);
          }
      }
      catch (e_2_1) { e_2 = { error: e_2_1 }; }
      finally {
          try {
              if (clientList_2_1 && !clientList_2_1.done && (_a = clientList_2.return)) _a.call(clientList_2);
          }
          finally { if (e_2) throw e_2.error; }
      }
  }
  function getClientList() {
      return self.clients.matchAll({
          type: 'window',
          includeUncontrolled: true
          // TS doesn't know that "type: 'window'" means it'll return WindowClient[]
      });
  }
  function createNewMessage(type, payload) {
      return {
          firebaseMessaging: { type: type, payload: payload }
      };
  }
  function showNotification(details) {
      var _a;
      var title = (_a = details.title) !== null && _a !== void 0 ? _a : '';
      var actions = details.actions;
      // Note: Firefox does not support the maxActions property.
      // https://developer.mozilla.org/en-US/docs/Web/API/notification/maxActions
      var maxActions = Notification.maxActions;
      if (actions && maxActions && actions.length > maxActions) {
          console.warn("This browser only supports " + maxActions + " actions. The remaining actions will not be displayed.");
      }
      return self.registration.showNotification(title, details);
  }
  function getLink(payload) {
      var _a, _b, _c;
      // eslint-disable-next-line camelcase
      var link = (_b = (_a = payload.fcmOptions) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : (_c = payload.notification) === null || _c === void 0 ? void 0 : _c.click_action;
      if (link) {
          return link;
      }
      if (isConsoleMessage(payload.data)) {
          // Notification created in the Firebase Console. Redirect to origin.
          return self.location.origin;
      }
      else {
          return null;
      }
  }
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var MESSAGING_NAME = 'messaging';
  function factoryMethod(container) {
      // Dependencies.
      var app = container.getProvider('app').getImmediate();
      var appConfig = extractAppConfig(app);
      var installations = container.getProvider('installations').getImmediate();
      var analyticsProvider = container.getProvider('analytics-internal');
      var firebaseDependencies = {
          app: app,
          appConfig: appConfig,
          installations: installations,
          analyticsProvider: analyticsProvider
      };
      if (!isSupported()) {
          throw ERROR_FACTORY.create("unsupported-browser" /* UNSUPPORTED_BROWSER */);
      }
      if (self && 'ServiceWorkerGlobalScope' in self) {
          // Running in ServiceWorker context
          return new SwController(firebaseDependencies);
      }
      else {
          // Assume we are in the window context.
          return new WindowController(firebaseDependencies);
      }
  }
  var NAMESPACE_EXPORTS = {
      isSupported: isSupported
  };
  _firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.INTERNAL.registerComponent(new _firebase_component__WEBPACK_IMPORTED_MODULE_2__["Component"](MESSAGING_NAME, factoryMethod, "PUBLIC" /* PUBLIC */).setServiceProps(NAMESPACE_EXPORTS));
  function isSupported() {
      if (self && 'ServiceWorkerGlobalScope' in self) {
          // Running in ServiceWorker context
          return isSWControllerSupported();
      }
      else {
          // Assume we are in the window context.
          return isWindowControllerSupported();
      }
  }
  /**
   * Checks to see if the required APIs exist.
   */
  function isWindowControllerSupported() {
      return ('indexedDB' in window &&
          indexedDB !== null &&
          navigator.cookieEnabled &&
          'serviceWorker' in navigator &&
          'PushManager' in window &&
          'Notification' in window &&
          'fetch' in window &&
          ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
          PushSubscription.prototype.hasOwnProperty('getKey'));
  }
  /**
   * Checks to see if the required APIs exist within SW Context.
   */
  function isSWControllerSupported() {
      return ('indexedDB' in self &&
          indexedDB !== null &&
          'PushManager' in self &&
          'Notification' in self &&
          ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') &&
          PushSubscription.prototype.hasOwnProperty('getKey'));
  }
  //# sourceMappingURL=index.esm.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js":
  /*!**************************************************************************!*\
    !*** ./node_modules/@firebase/messaging/node_modules/tslib/tslib.es6.js ***!
    \**************************************************************************/
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  };
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  function __classPrivateFieldGet(receiver, privateMap) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to get private field on non-instance");
      }
      return privateMap.get(receiver);
  }
  
  function __classPrivateFieldSet(receiver, privateMap, value) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to set private field on non-instance");
      }
      privateMap.set(receiver, value);
      return value;
  }
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/performance/dist/index.cjs.js":
  /*!**************************************************************!*\
    !*** ./node_modules/@firebase/performance/dist/index.cjs.js ***!
    \**************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  
  var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js"));
  __webpack_require__(/*! @firebase/installations */ "./node_modules/@firebase/installations/dist/index.esm.js");
  var tslib = __webpack_require__(/*! tslib */ "./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js");
  var util = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.cjs.js");
  var logger$1 = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/index.esm.js");
  var component = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/index.cjs.js");
  
  var name = "@firebase/performance";
  var version = "0.3.2";
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var SDK_VERSION = version;
  /** The prefix for start User Timing marks used for creating Traces. */
  var TRACE_START_MARK_PREFIX = 'FB-PERF-TRACE-START';
  /** The prefix for stop User Timing marks used for creating Traces. */
  var TRACE_STOP_MARK_PREFIX = 'FB-PERF-TRACE-STOP';
  /** The prefix for User Timing measure used for creating Traces. */
  var TRACE_MEASURE_PREFIX = 'FB-PERF-TRACE-MEASURE';
  /** The prefix for out of the box page load Trace name. */
  var OOB_TRACE_PAGE_LOAD_PREFIX = '_wt_';
  var FIRST_PAINT_COUNTER_NAME = '_fp';
  var FIRST_CONTENTFUL_PAINT_COUNTER_NAME = '_fcp';
  var FIRST_INPUT_DELAY_COUNTER_NAME = '_fid';
  var CONFIG_LOCAL_STORAGE_KEY = '@firebase/performance/config';
  var CONFIG_EXPIRY_LOCAL_STORAGE_KEY = '@firebase/performance/configexpire';
  var SERVICE = 'performance';
  var SERVICE_NAME = 'Performance';
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var _a;
  var ERROR_DESCRIPTION_MAP = (_a = {},
      _a["trace started" /* TRACE_STARTED_BEFORE */] = 'Trace {$traceName} was started before.',
      _a["trace stopped" /* TRACE_STOPPED_BEFORE */] = 'Trace {$traceName} is not running.',
      _a["no window" /* NO_WINDOW */] = 'Window is not available.',
      _a["no app id" /* NO_APP_ID */] = 'App id is not available.',
      _a["no project id" /* NO_PROJECT_ID */] = 'Project id is not available.',
      _a["no api key" /* NO_API_KEY */] = 'Api key is not available.',
      _a["invalid cc log" /* INVALID_CC_LOG */] = 'Attempted to queue invalid cc event',
      _a["FB not default" /* FB_NOT_DEFAULT */] = 'Performance can only start when Firebase app instance is the default one.',
      _a["RC response not ok" /* RC_NOT_OK */] = 'RC response is not ok',
      _a["invalid attribute name" /* INVALID_ATTRIBUTE_NAME */] = 'Attribute name {$attributeName} is invalid.',
      _a["invalid attribute value" /* INVALID_ATTRIBUTE_VALUE */] = 'Attribute value {$attributeValue} is invalid.',
      _a["invalid custom metric name" /* INVALID_CUSTOM_METRIC_NAME */] = 'Custom metric name {$customMetricName} is invalid',
      _a["invalid String merger input" /* INVALID_STRING_MERGER_PARAMETER */] = 'Input for String merger is invalid, contact support team to resolve.',
      _a);
  var ERROR_FACTORY = new util.ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var apiInstance;
  var windowInstance;
  /**
   * This class holds a reference to various browser related objects injected by
   * set methods.
   */
  var Api = /** @class */ (function () {
      function Api(window) {
          this.window = window;
          if (!window) {
              throw ERROR_FACTORY.create("no window" /* NO_WINDOW */);
          }
          this.performance = window.performance;
          this.PerformanceObserver = window.PerformanceObserver;
          this.windowLocation = window.location;
          this.navigator = window.navigator;
          this.document = window.document;
          if (this.navigator && this.navigator.cookieEnabled) {
              // If user blocks cookies on the browser, accessing localStorage will
              // throw an exception.
              this.localStorage = window.localStorage;
          }
          if (window.perfMetrics && window.perfMetrics.onFirstInputDelay) {
              this.onFirstInputDelay = window.perfMetrics.onFirstInputDelay;
          }
      }
      Api.prototype.getUrl = function () {
          // Do not capture the string query part of url.
          return this.windowLocation.href.split('?')[0];
      };
      Api.prototype.mark = function (name) {
          if (!this.performance || !this.performance.mark) {
              return;
          }
          this.performance.mark(name);
      };
      Api.prototype.measure = function (measureName, mark1, mark2) {
          if (!this.performance || !this.performance.measure) {
              return;
          }
          this.performance.measure(measureName, mark1, mark2);
      };
      Api.prototype.getEntriesByType = function (type) {
          if (!this.performance || !this.performance.getEntriesByType) {
              return [];
          }
          return this.performance.getEntriesByType(type);
      };
      Api.prototype.getEntriesByName = function (name) {
          if (!this.performance || !this.performance.getEntriesByName) {
              return [];
          }
          return this.performance.getEntriesByName(name);
      };
      Api.prototype.getTimeOrigin = function () {
          // Polyfill the time origin with performance.timing.navigationStart.
          return (this.performance &&
              (this.performance.timeOrigin || this.performance.timing.navigationStart));
      };
      Api.prototype.requiredApisAvailable = function () {
          if (fetch && Promise && this.navigator && this.navigator.cookieEnabled) {
              return true;
          }
          return false;
      };
      Api.prototype.setupObserver = function (entryType, callback) {
          if (!this.PerformanceObserver) {
              return;
          }
          var observer = new this.PerformanceObserver(function (list) {
              for (var _i = 0, _a = list.getEntries(); _i < _a.length; _i++) {
                  var entry = _a[_i];
                  // `entry` is a PerformanceEntry instance.
                  callback(entry);
              }
          });
          // Start observing the entry types you care about.
          observer.observe({ entryTypes: [entryType] });
      };
      Api.getInstance = function () {
          if (apiInstance === undefined) {
              apiInstance = new Api(windowInstance);
          }
          return apiInstance;
      };
      return Api;
  }());
  function setupApi(window) {
      windowInstance = window;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function mergeStrings(part1, part2) {
      var sizeDiff = part1.length - part2.length;
      if (sizeDiff < 0 || sizeDiff > 1) {
          throw ERROR_FACTORY.create("invalid String merger input" /* INVALID_STRING_MERGER_PARAMETER */);
      }
      var resultArray = [];
      for (var i = 0; i < part1.length; i++) {
          resultArray.push(part1.charAt(i));
          if (part2.length > i) {
              resultArray.push(part2.charAt(i));
          }
      }
      return resultArray.join('');
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var settingsServiceInstance;
  var SettingsService = /** @class */ (function () {
      function SettingsService() {
          // The variable which controls logging of automatic traces and HTTP/S network monitoring.
          this.instrumentationEnabled = true;
          // The variable which controls logging of custom traces.
          this.dataCollectionEnabled = true;
          // Configuration flags set through remote config.
          this.loggingEnabled = false;
          // Sampling rate between 0 and 1.
          this.tracesSamplingRate = 1;
          this.networkRequestsSamplingRate = 1;
          // Address of logging service.
          this.logEndPointUrl = 'https://firebaselogging.googleapis.com/v0cc/log?format=json_proto';
          // Performance event transport endpoint URL which should be compatible with proto3.
          // New Address for transport service, not configurable via Remote Config.
          this.flTransportEndpointUrl = mergeStrings('hts/frbslgigp.ogepscmv/ieo/eaylg', 'tp:/ieaeogn-agolai.o/1frlglgc/o');
          this.transportKey = mergeStrings('AzSC8r6ReiGqFMyfvgow', 'Iayx0u-XT3vksVM-pIV');
          this.shouldSendToFl = false;
          // Source type for performance event logs.
          this.logSource = 462;
          // Flags which control per session logging of traces and network requests.
          this.logTraceAfterSampling = false;
          this.logNetworkAfterSampling = false;
          // TTL of config retrieved from remote config in hours.
          this.configTimeToLive = 12;
      }
      SettingsService.prototype.getAppId = function () {
          var appId = this.firebaseAppInstance &&
              this.firebaseAppInstance.options &&
              this.firebaseAppInstance.options.appId;
          if (!appId) {
              throw ERROR_FACTORY.create("no app id" /* NO_APP_ID */);
          }
          return appId;
      };
      SettingsService.prototype.getProjectId = function () {
          var projectId = this.firebaseAppInstance &&
              this.firebaseAppInstance.options &&
              this.firebaseAppInstance.options.projectId;
          if (!projectId) {
              throw ERROR_FACTORY.create("no project id" /* NO_PROJECT_ID */);
          }
          return projectId;
      };
      SettingsService.prototype.getApiKey = function () {
          var apiKey = this.firebaseAppInstance &&
              this.firebaseAppInstance.options &&
              this.firebaseAppInstance.options.apiKey;
          if (!apiKey) {
              throw ERROR_FACTORY.create("no api key" /* NO_API_KEY */);
          }
          return apiKey;
      };
      SettingsService.prototype.getFlTransportFullUrl = function () {
          return this.flTransportEndpointUrl.concat('?key=', this.transportKey);
      };
      SettingsService.getInstance = function () {
          if (settingsServiceInstance === undefined) {
              settingsServiceInstance = new SettingsService();
          }
          return settingsServiceInstance;
      };
      return SettingsService;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var iid;
  function getIidPromise() {
      var iidPromise = SettingsService.getInstance().installationsService.getId();
      // eslint-disable-next-line @typescript-eslint/no-floating-promises
      iidPromise.then(function (iidVal) {
          iid = iidVal;
      });
      return iidPromise;
  }
  // This method should be used after the iid is retrieved by getIidPromise method.
  function getIid() {
      return iid;
  }
  function getAuthTokenPromise() {
      var authTokenPromise = SettingsService.getInstance().installationsService.getToken();
      // eslint-disable-next-line @typescript-eslint/no-floating-promises
      authTokenPromise.then(function (authTokenVal) {
      });
      return authTokenPromise;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var VisibilityState;
  (function (VisibilityState) {
      VisibilityState[VisibilityState["UNKNOWN"] = 0] = "UNKNOWN";
      VisibilityState[VisibilityState["VISIBLE"] = 1] = "VISIBLE";
      VisibilityState[VisibilityState["HIDDEN"] = 2] = "HIDDEN";
  })(VisibilityState || (VisibilityState = {}));
  var RESERVED_ATTRIBUTE_PREFIXES = ['firebase_', 'google_', 'ga_'];
  var ATTRIBUTE_FORMAT_REGEX = new RegExp('^[a-zA-Z]\\w*$');
  var MAX_ATTRIBUTE_NAME_LENGTH = 40;
  var MAX_ATTRIBUTE_VALUE_LENGTH = 100;
  function getServiceWorkerStatus() {
      var navigator = Api.getInstance().navigator;
      if ('serviceWorker' in navigator) {
          if (navigator.serviceWorker.controller) {
              return 2 /* CONTROLLED */;
          }
          else {
              return 3 /* UNCONTROLLED */;
          }
      }
      else {
          return 1 /* UNSUPPORTED */;
      }
  }
  function getVisibilityState() {
      var document = Api.getInstance().document;
      var visibilityState = document.visibilityState;
      switch (visibilityState) {
          case 'visible':
              return VisibilityState.VISIBLE;
          case 'hidden':
              return VisibilityState.HIDDEN;
          default:
              return VisibilityState.UNKNOWN;
      }
  }
  function getEffectiveConnectionType() {
      var navigator = Api.getInstance().navigator;
      var navigatorConnection = navigator.connection;
      var effectiveType = navigatorConnection && navigatorConnection.effectiveType;
      switch (effectiveType) {
          case 'slow-2g':
              return 1 /* CONNECTION_SLOW_2G */;
          case '2g':
              return 2 /* CONNECTION_2G */;
          case '3g':
              return 3 /* CONNECTION_3G */;
          case '4g':
              return 4 /* CONNECTION_4G */;
          default:
              return 0 /* UNKNOWN */;
      }
  }
  function isValidCustomAttributeName(name) {
      if (name.length === 0 || name.length > MAX_ATTRIBUTE_NAME_LENGTH) {
          return false;
      }
      var matchesReservedPrefix = RESERVED_ATTRIBUTE_PREFIXES.some(function (prefix) {
          return name.startsWith(prefix);
      });
      return !matchesReservedPrefix && !!name.match(ATTRIBUTE_FORMAT_REGEX);
  }
  function isValidCustomAttributeValue(value) {
      return value.length !== 0 && value.length <= MAX_ATTRIBUTE_VALUE_LENGTH;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var consoleLogger = new logger$1.Logger(SERVICE_NAME);
  consoleLogger.logLevel = logger$1.LogLevel.INFO;
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var REMOTE_CONFIG_SDK_VERSION = '0.0.1';
  // These values will be used if the remote config object is successfully
  // retrieved, but the template does not have these fields.
  var DEFAULT_CONFIGS = {
      loggingEnabled: true,
      shouldSendToFl: true
  };
  // These values will be used if the remote config object is successfully
  // retrieved, but the config object state shows unspecified or no template.
  var NO_TEMPLATE_CONFIGS = {
      shouldSendToFl: false
  };
  var FIS_AUTH_PREFIX = 'FIREBASE_INSTALLATIONS_AUTH';
  function getConfig(iid) {
      var config = getStoredConfig();
      if (config) {
          processConfig(iid, config);
          return Promise.resolve();
      }
      return getRemoteConfig(iid)
          .then(function (config) { return processConfig(iid, config); })
          .then(function (config) { return storeConfig(config); }, 
      /** Do nothing for error, use defaults set in settings service. */
      function () { });
  }
  function getStoredConfig() {
      var localStorage = Api.getInstance().localStorage;
      if (!localStorage) {
          return;
      }
      var expiryString = localStorage.getItem(CONFIG_EXPIRY_LOCAL_STORAGE_KEY);
      if (!expiryString || !configValid(expiryString)) {
          return;
      }
      var configStringified = localStorage.getItem(CONFIG_LOCAL_STORAGE_KEY);
      if (!configStringified) {
          return;
      }
      try {
          var configResponse = JSON.parse(configStringified);
          return configResponse;
      }
      catch (_a) {
          return;
      }
  }
  function storeConfig(config) {
      var localStorage = Api.getInstance().localStorage;
      if (!config || !localStorage) {
          return;
      }
      localStorage.setItem(CONFIG_LOCAL_STORAGE_KEY, JSON.stringify(config));
      localStorage.setItem(CONFIG_EXPIRY_LOCAL_STORAGE_KEY, String(Date.now() +
          SettingsService.getInstance().configTimeToLive * 60 * 60 * 1000));
  }
  var COULD_NOT_GET_CONFIG_MSG = 'Could not fetch config, will use default configs';
  function getRemoteConfig(iid) {
      // Perf needs auth token only to retrieve remote config.
      return getAuthTokenPromise()
          .then(function (authToken) {
          var projectId = SettingsService.getInstance().getProjectId();
          var configEndPoint = "https://firebaseremoteconfig.googleapis.com/v1/projects/" + projectId + "/namespaces/fireperf:fetch?key=" + SettingsService.getInstance().getApiKey();
          var request = new Request(configEndPoint, {
              method: 'POST',
              headers: { Authorization: FIS_AUTH_PREFIX + " " + authToken },
              /* eslint-disable camelcase */
              body: JSON.stringify({
                  app_instance_id: iid,
                  app_instance_id_token: authToken,
                  app_id: SettingsService.getInstance().getAppId(),
                  app_version: SDK_VERSION,
                  sdk_version: REMOTE_CONFIG_SDK_VERSION
              })
              /* eslint-enable camelcase */
          });
          return fetch(request).then(function (response) {
              if (response.ok) {
                  return response.json();
              }
              // In case response is not ok. This will be caught by catch.
              throw ERROR_FACTORY.create("RC response not ok" /* RC_NOT_OK */);
          });
      })
          .catch(function () {
          consoleLogger.info(COULD_NOT_GET_CONFIG_MSG);
          return undefined;
      });
  }
  /**
   * Processes config coming either from calling RC or from local storage.
   * This method only runs if call is successful or config in storage
   * is valid.
   */
  function processConfig(iid, config) {
      if (!config) {
          return config;
      }
      var settingsServiceInstance = SettingsService.getInstance();
      var entries = config.entries || {};
      var state = config.state;
      if (entries.fpr_enabled !== undefined) {
          // TODO: Change the assignment of loggingEnabled once the received type is
          // known.
          settingsServiceInstance.loggingEnabled =
              String(entries.fpr_enabled) === 'true';
      }
      else {
          // Config retrieved successfully, but there is no fpr_enabled in template.
          // Use secondary configs value.
          settingsServiceInstance.loggingEnabled = DEFAULT_CONFIGS.loggingEnabled;
      }
      if (entries.fpr_log_source) {
          settingsServiceInstance.logSource = Number(entries.fpr_log_source);
      }
      if (entries.fpr_log_endpoint_url) {
          settingsServiceInstance.logEndPointUrl = entries.fpr_log_endpoint_url;
      }
      // Key from Remote Config has to be non-empty string, otherwsie use local value.
      if (entries.fpr_log_transport_key) {
          settingsServiceInstance.transportKey = entries.fpr_log_transport_key;
      }
      // If config object state indicates that no template has been set, that means it is new user of
      // Performance Monitoring and should use the old log endpoint, because it is guaranteed to work.
      if (state === undefined ||
          state === 'INSTANCE_STATE_UNSPECIFIED' ||
          state === 'NO_TEMPLATE') {
          {
              settingsServiceInstance.shouldSendToFl =
                  NO_TEMPLATE_CONFIGS.shouldSendToFl;
          }
      }
      else if (entries.fpr_log_transport_web_percent) {
          // If config object state doesn't indicate no template, it can only be UPDATE for now.
          // - Performance Monitoring doesn't set etag in request, therefore state cannot be NO_CHANGE.
          // - Sampling rate flags and master flag are required, therefore state cannot be EMPTY_CONFIG.
          // If config object state is UPDATE and rollout flag is present, determine endpoint by iid.
          settingsServiceInstance.shouldSendToFl = isDestFl(iid, Number(entries.fpr_log_transport_web_percent));
      }
      else {
          // If config object state is UPDATE and rollout flag is not present, that means rollout is
          // complete and rollout flag is deprecated, therefore dispatch events to new transport endpoint.
          settingsServiceInstance.shouldSendToFl = DEFAULT_CONFIGS.shouldSendToFl;
      }
      if (entries.fpr_vc_network_request_sampling_rate !== undefined) {
          settingsServiceInstance.networkRequestsSamplingRate = Number(entries.fpr_vc_network_request_sampling_rate);
      }
      if (entries.fpr_vc_trace_sampling_rate !== undefined) {
          settingsServiceInstance.tracesSamplingRate = Number(entries.fpr_vc_trace_sampling_rate);
      }
      // Set the per session trace and network logging flags.
      settingsServiceInstance.logTraceAfterSampling = shouldLogAfterSampling(settingsServiceInstance.tracesSamplingRate);
      settingsServiceInstance.logNetworkAfterSampling = shouldLogAfterSampling(settingsServiceInstance.networkRequestsSamplingRate);
      return config;
  }
  function configValid(expiry) {
      return Number(expiry) > Date.now();
  }
  function shouldLogAfterSampling(samplingRate) {
      return Math.random() <= samplingRate;
  }
  /**
   * True if event should be sent to Fl transport endpoint rather than CC transport endpoint.
   * rolloutPercent is in range [0.0, 100.0].
   * @param iid Installation ID which identifies a web app installed on client.
   * @param rolloutPercent the possibility of this app sending events to Fl endpoint.
   * @return true if this installation should send events to Fl endpoint.
   */
  function isDestFl(iid, rolloutPercent) {
      if (iid.length === 0) {
          return false;
      }
      return getHashPercent(iid) < rolloutPercent;
  }
  /**
   * Generate integer value range in [0, 99]. Implementation from String.hashCode() in Java.
   * @param seed Same seed will generate consistent hash value using this algorithm.
   * @return Hash value in range [0, 99], generated from seed and hash algorithm.
   */
  function getHashPercent(seed) {
      var hash = 0;
      for (var i = 0; i < seed.length; i++) {
          hash = (hash << 3) + hash - seed.charCodeAt(i);
      }
      hash = Math.abs(hash % 100);
      return hash;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var initializationStatus = 1 /* notInitialized */;
  var initializationPromise;
  function getInitializationPromise() {
      initializationStatus = 2 /* initializationPending */;
      initializationPromise = initializationPromise || initializePerf();
      return initializationPromise;
  }
  function isPerfInitialized() {
      return initializationStatus === 3 /* initialized */;
  }
  function initializePerf() {
      return getDocumentReadyComplete()
          .then(function () { return getIidPromise(); })
          .then(function (iid) { return getConfig(iid); })
          .then(function () { return changeInitializationStatus(); }, function () { return changeInitializationStatus(); });
  }
  /**
   * Returns a promise which resolves whenever the document readystate is complete or
   * immediately if it is called after page load complete.
   */
  function getDocumentReadyComplete() {
      var document = Api.getInstance().document;
      return new Promise(function (resolve) {
          if (document && document.readyState !== 'complete') {
              var handler_1 = function () {
                  if (document.readyState === 'complete') {
                      document.removeEventListener('readystatechange', handler_1);
                      resolve();
                  }
              };
              document.addEventListener('readystatechange', handler_1);
          }
          else {
              resolve();
          }
      });
  }
  function changeInitializationStatus() {
      initializationStatus = 3 /* initialized */;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var DEFAULT_SEND_INTERVAL_MS = 10 * 1000;
  var INITIAL_SEND_TIME_DELAY_MS = 5.5 * 1000;
  // If end point does not work, the call will be tried for these many times.
  var DEFAULT_REMAINING_TRIES = 3;
  var remainingTries = DEFAULT_REMAINING_TRIES;
  /* eslint-enable camelcase */
  var queue = [];
  var isTransportSetup = false;
  function setupTransportService() {
      if (!isTransportSetup) {
          processQueue(INITIAL_SEND_TIME_DELAY_MS);
          isTransportSetup = true;
      }
  }
  function processQueue(timeOffset) {
      setTimeout(function () {
          // If there is no remainingTries left, stop retrying.
          if (remainingTries === 0) {
              return;
          }
          // If there are no events to process, wait for DEFAULT_SEND_INTERVAL_MS and try again.
          if (!queue.length) {
              return processQueue(DEFAULT_SEND_INTERVAL_MS);
          }
          dispatchQueueEvents();
      }, timeOffset);
  }
  function dispatchQueueEvents() {
      // Capture a snapshot of the queue and empty the "official queue".
      var staged = tslib.__spreadArrays(queue);
      queue = [];
      /* eslint-disable camelcase */
      // We will pass the JSON serialized event to the backend.
      var log_event = staged.map(function (evt) { return ({
          source_extension_json_proto3: evt.message,
          event_time_ms: String(evt.eventTime)
      }); });
      var data = {
          request_time_ms: String(Date.now()),
          client_info: {
              client_type: 1,
              js_client_info: {}
          },
          log_source: SettingsService.getInstance().logSource,
          log_event: log_event
      };
      /* eslint-enable camelcase */
      postToEndpoint(data, staged).catch(function () {
          // If the request fails for some reason, add the events that were attempted
          // back to the primary queue to retry later.
          queue = tslib.__spreadArrays(staged, queue);
          remainingTries--;
          consoleLogger.info("Tries left: " + remainingTries + ".");
          processQueue(DEFAULT_SEND_INTERVAL_MS);
      });
  }
  function postToEndpoint(data, staged) {
      // Gradually rollout traffic from cc to transport using remote config.
      if (SettingsService.getInstance().shouldSendToFl) {
          return sendEventsToFl(data, staged);
      }
      else {
          return sendEventsToCc(data);
      }
  }
  function sendEventsToFl(data, staged) {
      return postToFlEndpoint(data)
          .then(function (res) {
          if (!res.ok) {
              consoleLogger.info('Call to Firebase backend failed.');
          }
          return res.json();
      })
          .then(function (res) {
          // Find the next call wait time from the response.
          var transportWait = Number(res.nextRequestWaitMillis);
          var requestOffset = DEFAULT_SEND_INTERVAL_MS;
          if (!isNaN(transportWait)) {
              requestOffset = Math.max(transportWait, requestOffset);
          }
          // Delete request if response include RESPONSE_ACTION_UNKNOWN or DELETE_REQUEST action.
          // Otherwise, retry request using normal scheduling if response include RETRY_REQUEST_LATER.
          var logResponseDetails = res.logResponseDetails;
          if (Array.isArray(logResponseDetails) &&
              logResponseDetails.length > 0 &&
              logResponseDetails[0].responseAction === 'RETRY_REQUEST_LATER') {
              queue = tslib.__spreadArrays(staged, queue);
              consoleLogger.info("Retry transport request later.");
          }
          remainingTries = DEFAULT_REMAINING_TRIES;
          // Schedule the next process.
          processQueue(requestOffset);
      });
  }
  function sendEventsToCc(data) {
      return fetch(SettingsService.getInstance().logEndPointUrl, {
          method: 'POST',
          body: JSON.stringify(data)
      })
          .then(function (res) {
          if (!res.ok) {
              consoleLogger.info('Call to Firebase backend failed.');
          }
          return res.json();
      })
          .then(function (res) {
          var wait = Number(res.next_request_wait_millis);
          // Find the next call wait time from the response.
          var requestOffset = isNaN(wait)
              ? DEFAULT_SEND_INTERVAL_MS
              : Math.max(DEFAULT_SEND_INTERVAL_MS, wait);
          remainingTries = DEFAULT_REMAINING_TRIES;
          // Schedule the next process.
          processQueue(requestOffset);
      });
  }
  function postToFlEndpoint(data) {
      var flTransportFullUrl = SettingsService.getInstance().getFlTransportFullUrl();
      return fetch(flTransportFullUrl, {
          method: 'POST',
          body: JSON.stringify(data)
      });
  }
  function addToQueue(evt) {
      if (!evt.eventTime || !evt.message) {
          throw ERROR_FACTORY.create("invalid cc log" /* INVALID_CC_LOG */);
      }
      // Add the new event to the queue.
      queue = tslib.__spreadArrays(queue, [evt]);
  }
  /** Log handler for cc service to send the performance logs to the server. */
  function transportHandler(
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  serializer) {
      return function () {
          var args = [];
          for (var _i = 0; _i < arguments.length; _i++) {
              args[_i] = arguments[_i];
          }
          var message = serializer.apply(void 0, args);
          addToQueue({
              message: message,
              eventTime: Date.now()
          });
      };
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /* eslint-enble camelcase */
  var logger;
  // This method is not called before initialization.
  function sendLog(resource, resourceType) {
      if (!logger) {
          logger = transportHandler(serializer);
      }
      logger(resource, resourceType);
  }
  function logTrace(trace) {
      var settingsService = SettingsService.getInstance();
      // Do not log if trace is auto generated and instrumentation is disabled.
      if (!settingsService.instrumentationEnabled && trace.isAuto) {
          return;
      }
      // Do not log if trace is custom and data collection is disabled.
      if (!settingsService.dataCollectionEnabled && !trace.isAuto) {
          return;
      }
      // Do not log if required apis are not available.
      if (!Api.getInstance().requiredApisAvailable()) {
          return;
      }
      // Only log the page load auto traces if page is visible.
      if (trace.isAuto && getVisibilityState() !== VisibilityState.VISIBLE) {
          return;
      }
      if (!settingsService.loggingEnabled ||
          !settingsService.logTraceAfterSampling) {
          return;
      }
      if (isPerfInitialized()) {
          sendTraceLog(trace);
      }
      else {
          // Custom traces can be used before the initialization but logging
          // should wait until after.
          getInitializationPromise().then(function () { return sendTraceLog(trace); }, function () { return sendTraceLog(trace); });
      }
  }
  function sendTraceLog(trace) {
      if (getIid()) {
          setTimeout(function () { return sendLog(trace, 1 /* Trace */); }, 0);
      }
  }
  function logNetworkRequest(networkRequest) {
      var settingsService = SettingsService.getInstance();
      // Do not log network requests if instrumentation is disabled.
      if (!settingsService.instrumentationEnabled) {
          return;
      }
      // Do not log the js sdk's call to transport service domain to avoid unnecessary cycle.
      // Need to blacklist both old and new endpoints to avoid migration gap.
      var networkRequestUrl = networkRequest.url;
      // Blacklist old log endpoint and new transport endpoint.
      // Because Performance SDK doesn't instrument requests sent from SDK itself.
      var logEndpointUrl = settingsService.logEndPointUrl.split('?')[0];
      var flEndpointUrl = settingsService.flTransportEndpointUrl.split('?')[0];
      if (networkRequestUrl === logEndpointUrl ||
          networkRequestUrl === flEndpointUrl) {
          return;
      }
      if (!settingsService.loggingEnabled ||
          !settingsService.logNetworkAfterSampling) {
          return;
      }
      setTimeout(function () { return sendLog(networkRequest, 0 /* NetworkRequest */); }, 0);
  }
  function serializer(resource, resourceType) {
      if (resourceType === 0 /* NetworkRequest */) {
          return serializeNetworkRequest(resource);
      }
      return serializeTrace(resource);
  }
  function serializeNetworkRequest(networkRequest) {
      var networkRequestMetric = {
          url: networkRequest.url,
          http_method: networkRequest.httpMethod || 0,
          http_response_code: 200,
          response_payload_bytes: networkRequest.responsePayloadBytes,
          client_start_time_us: networkRequest.startTimeUs,
          time_to_response_initiated_us: networkRequest.timeToResponseInitiatedUs,
          time_to_response_completed_us: networkRequest.timeToResponseCompletedUs
      };
      var perfMetric = {
          application_info: getApplicationInfo(),
          network_request_metric: networkRequestMetric
      };
      return JSON.stringify(perfMetric);
  }
  function serializeTrace(trace) {
      var traceMetric = {
          name: trace.name,
          is_auto: trace.isAuto,
          client_start_time_us: trace.startTimeUs,
          duration_us: trace.durationUs
      };
      if (Object.keys(trace.counters).length !== 0) {
          traceMetric.counters = trace.counters;
      }
      var customAttributes = trace.getAttributes();
      if (Object.keys(customAttributes).length !== 0) {
          traceMetric.custom_attributes = customAttributes;
      }
      var perfMetric = {
          application_info: getApplicationInfo(),
          trace_metric: traceMetric
      };
      return JSON.stringify(perfMetric);
  }
  function getApplicationInfo() {
      return {
          google_app_id: SettingsService.getInstance().getAppId(),
          app_instance_id: getIid(),
          web_app_info: {
              sdk_version: SDK_VERSION,
              page_url: Api.getInstance().getUrl(),
              service_worker_status: getServiceWorkerStatus(),
              visibility_state: getVisibilityState(),
              effective_connection_type: getEffectiveConnectionType()
          },
          application_process_state: 0
      };
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var MAX_METRIC_NAME_LENGTH = 100;
  var RESERVED_AUTO_PREFIX = '_';
  var oobMetrics = [
      FIRST_PAINT_COUNTER_NAME,
      FIRST_CONTENTFUL_PAINT_COUNTER_NAME,
      FIRST_INPUT_DELAY_COUNTER_NAME
  ];
  /**
   * Returns true if the metric is custom and does not start with reserved prefix, or if
   * the metric is one of out of the box page load trace metrics.
   */
  function isValidMetricName(name, traceName) {
      if (name.length === 0 || name.length > MAX_METRIC_NAME_LENGTH) {
          return false;
      }
      return ((traceName &&
          traceName.startsWith(OOB_TRACE_PAGE_LOAD_PREFIX) &&
          oobMetrics.indexOf(name) > -1) ||
          !name.startsWith(RESERVED_AUTO_PREFIX));
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var Trace = /** @class */ (function () {
      /**
       * @param name The name of the trace.
       * @param isAuto If the trace is auto-instrumented.
       * @param traceMeasureName The name of the measure marker in user timing specification. This field
       * is only set when the trace is built for logging when the user directly uses the user timing
       * api (performance.mark and performance.measure).
       */
      function Trace(name, isAuto, traceMeasureName) {
          if (isAuto === void 0) { isAuto = false; }
          this.name = name;
          this.isAuto = isAuto;
          this.state = 1 /* UNINITIALIZED */;
          this.customAttributes = {};
          this.counters = {};
          this.api = Api.getInstance();
          this.randomId = Math.floor(Math.random() * 1000000);
          if (!this.isAuto) {
              this.traceStartMark = TRACE_START_MARK_PREFIX + "-" + this.randomId + "-" + this.name;
              this.traceStopMark = TRACE_STOP_MARK_PREFIX + "-" + this.randomId + "-" + this.name;
              this.traceMeasure =
                  traceMeasureName ||
                      TRACE_MEASURE_PREFIX + "-" + this.randomId + "-" + this.name;
              if (traceMeasureName) {
                  // For the case of direct user timing traces, no start stop will happen. The measure object
                  // is already available.
                  this.calculateTraceMetrics();
              }
          }
      }
      /**
       * Starts a trace. The measurement of the duration starts at this point.
       */
      Trace.prototype.start = function () {
          if (this.state !== 1 /* UNINITIALIZED */) {
              throw ERROR_FACTORY.create("trace started" /* TRACE_STARTED_BEFORE */, {
                  traceName: this.name
              });
          }
          this.api.mark(this.traceStartMark);
          this.state = 2 /* RUNNING */;
      };
      /**
       * Stops the trace. The measurement of the duration of the trace stops at this point and trace
       * is logged.
       */
      Trace.prototype.stop = function () {
          if (this.state !== 2 /* RUNNING */) {
              throw ERROR_FACTORY.create("trace stopped" /* TRACE_STOPPED_BEFORE */, {
                  traceName: this.name
              });
          }
          this.state = 3 /* TERMINATED */;
          this.api.mark(this.traceStopMark);
          this.api.measure(this.traceMeasure, this.traceStartMark, this.traceStopMark);
          this.calculateTraceMetrics();
          logTrace(this);
      };
      /**
       * Records a trace with predetermined values. If this method is used a trace is created and logged
       * directly. No need to use start and stop methods.
       * @param startTime Trace start time since epoch in millisec
       * @param duration The duraction of the trace in millisec
       * @param options An object which can optionally hold maps of custom metrics and custom attributes
       */
      Trace.prototype.record = function (startTime, duration, options) {
          this.durationUs = Math.floor(duration * 1000);
          this.startTimeUs = Math.floor(startTime * 1000);
          if (options && options.attributes) {
              this.customAttributes = tslib.__assign({}, options.attributes);
          }
          if (options && options.metrics) {
              for (var _i = 0, _a = Object.keys(options.metrics); _i < _a.length; _i++) {
                  var metric = _a[_i];
                  if (!isNaN(Number(options.metrics[metric]))) {
                      this.counters[metric] = Number(Math.floor(options.metrics[metric]));
                  }
              }
          }
          logTrace(this);
      };
      /**
       * Increments a custom metric by a certain number or 1 if number not specified. Will create a new
       * custom metric if one with the given name does not exist.
       * @param counter Name of the custom metric
       * @param num Increment by value
       */
      Trace.prototype.incrementMetric = function (counter, num) {
          if (num === void 0) { num = 1; }
          if (this.counters[counter] === undefined) {
              this.putMetric(counter, 0);
          }
          this.counters[counter] += num;
      };
      /**
       * Sets a custom metric to a specified value. Will create a new custom metric if one with the
       * given name does not exist.
       * @param counter Name of the custom metric
       * @param num Set custom metric to this value
       */
      Trace.prototype.putMetric = function (counter, num) {
          if (isValidMetricName(counter, this.name)) {
              this.counters[counter] = num;
          }
          else {
              throw ERROR_FACTORY.create("invalid custom metric name" /* INVALID_CUSTOM_METRIC_NAME */, {
                  customMetricName: counter
              });
          }
      };
      /**
       * Returns the value of the custom metric by that name. If a custom metric with that name does
       * not exist will return zero.
       * @param counter
       */
      Trace.prototype.getMetric = function (counter) {
          return this.counters[counter] || 0;
      };
      /**
       * Sets a custom attribute of a trace to a certain value.
       * @param attr
       * @param value
       */
      Trace.prototype.putAttribute = function (attr, value) {
          var isValidName = isValidCustomAttributeName(attr);
          var isValidValue = isValidCustomAttributeValue(value);
          if (isValidName && isValidValue) {
              this.customAttributes[attr] = value;
              return;
          }
          // Throw appropriate error when the attribute name or value is invalid.
          if (!isValidName) {
              throw ERROR_FACTORY.create("invalid attribute name" /* INVALID_ATTRIBUTE_NAME */, {
                  attributeName: attr
              });
          }
          if (!isValidValue) {
              throw ERROR_FACTORY.create("invalid attribute value" /* INVALID_ATTRIBUTE_VALUE */, {
                  attributeValue: value
              });
          }
      };
      /**
       * Retrieves the value a custom attribute of a trace is set to.
       * @param attr
       */
      Trace.prototype.getAttribute = function (attr) {
          return this.customAttributes[attr];
      };
      Trace.prototype.removeAttribute = function (attr) {
          if (this.customAttributes[attr] === undefined) {
              return;
          }
          delete this.customAttributes[attr];
      };
      Trace.prototype.getAttributes = function () {
          return tslib.__assign({}, this.customAttributes);
      };
      Trace.prototype.setStartTime = function (startTime) {
          this.startTimeUs = startTime;
      };
      Trace.prototype.setDuration = function (duration) {
          this.durationUs = duration;
      };
      /**
       * Calculates and assigns the duration and start time of the trace using the measure performance
       * entry.
       */
      Trace.prototype.calculateTraceMetrics = function () {
          var perfMeasureEntries = this.api.getEntriesByName(this.traceMeasure);
          var perfMeasureEntry = perfMeasureEntries && perfMeasureEntries[0];
          if (perfMeasureEntry) {
              this.durationUs = Math.floor(perfMeasureEntry.duration * 1000);
              this.startTimeUs = Math.floor((perfMeasureEntry.startTime + this.api.getTimeOrigin()) * 1000);
          }
      };
      /**
       * @param navigationTimings A single element array which contains the navigationTIming object of
       * the page load
       * @param paintTimings A array which contains paintTiming object of the page load
       * @param firstInputDelay First input delay in millisec
       */
      Trace.createOobTrace = function (navigationTimings, paintTimings, firstInputDelay) {
          var route = Api.getInstance().getUrl();
          if (!route) {
              return;
          }
          var trace = new Trace(OOB_TRACE_PAGE_LOAD_PREFIX + route, true);
          var timeOriginUs = Math.floor(Api.getInstance().getTimeOrigin() * 1000);
          trace.setStartTime(timeOriginUs);
          // navigationTimings includes only one element.
          if (navigationTimings && navigationTimings[0]) {
              trace.setDuration(Math.floor(navigationTimings[0].duration * 1000));
              trace.putMetric('domInteractive', Math.floor(navigationTimings[0].domInteractive * 1000));
              trace.putMetric('domContentLoadedEventEnd', Math.floor(navigationTimings[0].domContentLoadedEventEnd * 1000));
              trace.putMetric('loadEventEnd', Math.floor(navigationTimings[0].loadEventEnd * 1000));
          }
          var FIRST_PAINT = 'first-paint';
          var FIRST_CONTENTFUL_PAINT = 'first-contentful-paint';
          if (paintTimings) {
              var firstPaint = paintTimings.find(function (paintObject) { return paintObject.name === FIRST_PAINT; });
              if (firstPaint && firstPaint.startTime) {
                  trace.putMetric(FIRST_PAINT_COUNTER_NAME, Math.floor(firstPaint.startTime * 1000));
              }
              var firstContentfulPaint = paintTimings.find(function (paintObject) { return paintObject.name === FIRST_CONTENTFUL_PAINT; });
              if (firstContentfulPaint && firstContentfulPaint.startTime) {
                  trace.putMetric(FIRST_CONTENTFUL_PAINT_COUNTER_NAME, Math.floor(firstContentfulPaint.startTime * 1000));
              }
              if (firstInputDelay) {
                  trace.putMetric(FIRST_INPUT_DELAY_COUNTER_NAME, Math.floor(firstInputDelay * 1000));
              }
          }
          logTrace(trace);
      };
      Trace.createUserTimingTrace = function (measureName) {
          var trace = new Trace(measureName, false, measureName);
          logTrace(trace);
      };
      return Trace;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function createNetworkRequestEntry(entry) {
      var performanceEntry = entry;
      if (!performanceEntry || performanceEntry.responseStart === undefined) {
          return;
      }
      var timeOrigin = Api.getInstance().getTimeOrigin();
      var startTimeUs = Math.floor((performanceEntry.startTime + timeOrigin) * 1000);
      var timeToResponseInitiatedUs = performanceEntry.responseStart
          ? Math.floor((performanceEntry.responseStart - performanceEntry.startTime) * 1000)
          : undefined;
      var timeToResponseCompletedUs = Math.floor((performanceEntry.responseEnd - performanceEntry.startTime) * 1000);
      // Remove the query params from logged network request url.
      var url = performanceEntry.name && performanceEntry.name.split('?')[0];
      var networkRequest = {
          url: url,
          responsePayloadBytes: performanceEntry.transferSize,
          startTimeUs: startTimeUs,
          timeToResponseInitiatedUs: timeToResponseInitiatedUs,
          timeToResponseCompletedUs: timeToResponseCompletedUs
      };
      logNetworkRequest(networkRequest);
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var FID_WAIT_TIME_MS = 5000;
  function setupOobResources() {
      // Do not initialize unless iid is available.
      if (!getIid()) {
          return;
      }
      // The load event might not have fired yet, and that means performance navigation timing
      // object has a duration of 0. The setup should run after all current tasks in js queue.
      setTimeout(function () { return setupOobTraces(); }, 0);
      setTimeout(function () { return setupNetworkRequests(); }, 0);
      setTimeout(function () { return setupUserTimingTraces(); }, 0);
  }
  function setupNetworkRequests() {
      var api = Api.getInstance();
      var resources = api.getEntriesByType('resource');
      for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) {
          var resource = resources_1[_i];
          createNetworkRequestEntry(resource);
      }
      api.setupObserver('resource', createNetworkRequestEntry);
  }
  function setupOobTraces() {
      var api = Api.getInstance();
      var navigationTimings = api.getEntriesByType('navigation');
      var paintTimings = api.getEntriesByType('paint');
      // If First Input Desly polyfill is added to the page, report the fid value.
      // https://github.com/GoogleChromeLabs/first-input-delay
      if (api.onFirstInputDelay) {
          // If the fid call back is not called for certain time, continue without it.
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
          var timeoutId_1 = setTimeout(function () {
              Trace.createOobTrace(navigationTimings, paintTimings);
              timeoutId_1 = undefined;
          }, FID_WAIT_TIME_MS);
          api.onFirstInputDelay(function (fid) {
              if (timeoutId_1) {
                  clearTimeout(timeoutId_1);
                  Trace.createOobTrace(navigationTimings, paintTimings, fid);
              }
          });
      }
      else {
          Trace.createOobTrace(navigationTimings, paintTimings);
      }
  }
  function setupUserTimingTraces() {
      var api = Api.getInstance();
      // Run through the measure performance entries collected up to this point.
      var measures = api.getEntriesByType('measure');
      for (var _i = 0, measures_1 = measures; _i < measures_1.length; _i++) {
          var measure = measures_1[_i];
          createUserTimingTrace(measure);
      }
      // Setup an observer to capture the measures from this point on.
      api.setupObserver('measure', createUserTimingTrace);
  }
  function createUserTimingTrace(measure) {
      var measureName = measure.name;
      // Do not create a trace, if the user timing marks and measures are created by the sdk itself.
      if (measureName.substring(0, TRACE_MEASURE_PREFIX.length) ===
          TRACE_MEASURE_PREFIX) {
          return;
      }
      Trace.createUserTimingTrace(measureName);
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var PerformanceController = /** @class */ (function () {
      function PerformanceController(app) {
          this.app = app;
          if (Api.getInstance().requiredApisAvailable()) {
              setupTransportService();
              getInitializationPromise().then(setupOobResources, setupOobResources);
          }
          else {
              consoleLogger.info('Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.');
          }
      }
      PerformanceController.prototype.trace = function (name) {
          return new Trace(name);
      };
      Object.defineProperty(PerformanceController.prototype, "instrumentationEnabled", {
          get: function () {
              return SettingsService.getInstance().instrumentationEnabled;
          },
          set: function (val) {
              SettingsService.getInstance().instrumentationEnabled = val;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(PerformanceController.prototype, "dataCollectionEnabled", {
          get: function () {
              return SettingsService.getInstance().dataCollectionEnabled;
          },
          set: function (val) {
              SettingsService.getInstance().dataCollectionEnabled = val;
          },
          enumerable: true,
          configurable: true
      });
      return PerformanceController;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var DEFAULT_ENTRY_NAME = '[DEFAULT]';
  function registerPerformance(instance) {
      var factoryMethod = function (app, installations) {
          if (app.name !== DEFAULT_ENTRY_NAME) {
              throw ERROR_FACTORY.create("FB not default" /* FB_NOT_DEFAULT */);
          }
          if (typeof window === 'undefined') {
              throw ERROR_FACTORY.create("no window" /* NO_WINDOW */);
          }
          setupApi(window);
          SettingsService.getInstance().firebaseAppInstance = app;
          SettingsService.getInstance().installationsService = installations;
          return new PerformanceController(app);
      };
      // Register performance with firebase-app.
      instance.INTERNAL.registerComponent(new component.Component('performance', function (container) {
          /* Dependencies */
          // getImmediate for FirebaseApp will always succeed
          var app = container.getProvider('app').getImmediate();
          // The following call will always succeed because perf has `import '@firebase/installations'`
          var installations = container
              .getProvider('installations')
              .getImmediate();
          return factoryMethod(app, installations);
      }, "PUBLIC" /* PUBLIC */));
      instance.registerVersion(name, version);
  }
  registerPerformance(firebase);
  
  exports.registerPerformance = registerPerformance;
  //# sourceMappingURL=index.cjs.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js":
  /*!****************************************************************************!*\
    !*** ./node_modules/@firebase/performance/node_modules/tslib/tslib.es6.js ***!
    \****************************************************************************/
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  };
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  function __classPrivateFieldGet(receiver, privateMap) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to get private field on non-instance");
      }
      return privateMap.get(receiver);
  }
  
  function __classPrivateFieldSet(receiver, privateMap, value) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to set private field on non-instance");
      }
      privateMap.set(receiver, value);
      return value;
  }
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/remote-config/dist/index.cjs.js":
  /*!****************************************************************!*\
    !*** ./node_modules/@firebase/remote-config/dist/index.cjs.js ***!
    \****************************************************************/
  /*! no static exports found */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  
  var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js"));
  __webpack_require__(/*! @firebase/installations */ "./node_modules/@firebase/installations/dist/index.esm.js");
  var tslib = __webpack_require__(/*! tslib */ "./node_modules/@firebase/remote-config/node_modules/tslib/tslib.es6.js");
  var util = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.cjs.js");
  var logger = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/index.esm.js");
  var component = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/index.cjs.js");
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Implements the {@link RemoteConfigClient} abstraction with success response caching.
   *
   * <p>Comparable to the browser's Cache API for responses, but the Cache API requires a Service
   * Worker, which requires HTTPS, which would significantly complicate SDK installation. Also, the
   * Cache API doesn't support matching entries by time.
   */
  var CachingClient = /** @class */ (function () {
      function CachingClient(client, storage, storageCache, logger) {
          this.client = client;
          this.storage = storage;
          this.storageCache = storageCache;
          this.logger = logger;
      }
      /**
       * Returns true if the age of the cached fetched configs is less than or equal to
       * {@link Settings#minimumFetchIntervalInSeconds}.
       *
       * <p>This is comparable to passing `headers = { 'Cache-Control': max-age <maxAge> }` to the
       * native Fetch API.
       *
       * <p>Visible for testing.
       */
      CachingClient.prototype.isCachedDataFresh = function (cacheMaxAgeMillis, lastSuccessfulFetchTimestampMillis) {
          // Cache can only be fresh if it's populated.
          if (!lastSuccessfulFetchTimestampMillis) {
              this.logger.debug('Config fetch cache check. Cache unpopulated.');
              return false;
          }
          // Calculates age of cache entry.
          var cacheAgeMillis = Date.now() - lastSuccessfulFetchTimestampMillis;
          var isCachedDataFresh = cacheAgeMillis <= cacheMaxAgeMillis;
          this.logger.debug('Config fetch cache check.' +
              (" Cache age millis: " + cacheAgeMillis + ".") +
              (" Cache max age millis (minimumFetchIntervalMillis setting): " + cacheMaxAgeMillis + ".") +
              (" Is cache hit: " + isCachedDataFresh + "."));
          return isCachedDataFresh;
      };
      CachingClient.prototype.fetch = function (request) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var _a, lastSuccessfulFetchTimestampMillis, lastSuccessfulFetchResponse, response, storageOperations;
              return tslib.__generator(this, function (_b) {
                  switch (_b.label) {
                      case 0: return [4 /*yield*/, Promise.all([
                              this.storage.getLastSuccessfulFetchTimestampMillis(),
                              this.storage.getLastSuccessfulFetchResponse()
                          ])];
                      case 1:
                          _a = _b.sent(), lastSuccessfulFetchTimestampMillis = _a[0], lastSuccessfulFetchResponse = _a[1];
                          // Exits early on cache hit.
                          if (lastSuccessfulFetchResponse &&
                              this.isCachedDataFresh(request.cacheMaxAgeMillis, lastSuccessfulFetchTimestampMillis)) {
                              return [2 /*return*/, lastSuccessfulFetchResponse];
                          }
                          // Deviates from pure decorator by not honoring a passed ETag since we don't have a public API
                          // that allows the caller to pass an ETag.
                          request.eTag =
                              lastSuccessfulFetchResponse && lastSuccessfulFetchResponse.eTag;
                          return [4 /*yield*/, this.client.fetch(request)];
                      case 2:
                          response = _b.sent();
                          storageOperations = [
                              // Uses write-through cache for consistency with synchronous public API.
                              this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())
                          ];
                          if (response.status === 200) {
                              // Caches response only if it has changed, ie non-304 responses.
                              storageOperations.push(this.storage.setLastSuccessfulFetchResponse(response));
                          }
                          return [4 /*yield*/, Promise.all(storageOperations)];
                      case 3:
                          _b.sent();
                          return [2 /*return*/, response];
                  }
              });
          });
      };
      return CachingClient;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var _a;
  var ERROR_DESCRIPTION_MAP = (_a = {},
      _a["registration-window" /* REGISTRATION_WINDOW */] = 'Undefined window object. This SDK only supports usage in a browser environment.',
      _a["registration-project-id" /* REGISTRATION_PROJECT_ID */] = 'Undefined project identifier. Check Firebase app initialization.',
      _a["registration-api-key" /* REGISTRATION_API_KEY */] = 'Undefined API key. Check Firebase app initialization.',
      _a["registration-app-id" /* REGISTRATION_APP_ID */] = 'Undefined app identifier. Check Firebase app initialization.',
      _a["storage-open" /* STORAGE_OPEN */] = 'Error thrown when opening storage. Original error: {$originalErrorMessage}.',
      _a["storage-get" /* STORAGE_GET */] = 'Error thrown when reading from storage. Original error: {$originalErrorMessage}.',
      _a["storage-set" /* STORAGE_SET */] = 'Error thrown when writing to storage. Original error: {$originalErrorMessage}.',
      _a["storage-delete" /* STORAGE_DELETE */] = 'Error thrown when deleting from storage. Original error: {$originalErrorMessage}.',
      _a["fetch-client-network" /* FETCH_NETWORK */] = 'Fetch client failed to connect to a network. Check Internet connection.' +
          ' Original error: {$originalErrorMessage}.',
      _a["fetch-timeout" /* FETCH_TIMEOUT */] = 'The config fetch request timed out. ' +
          ' Configure timeout using "fetchTimeoutMillis" SDK setting.',
      _a["fetch-throttle" /* FETCH_THROTTLE */] = 'The config fetch request timed out while in an exponential backoff state.' +
          ' Configure timeout using "fetchTimeoutMillis" SDK setting.' +
          ' Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',
      _a["fetch-client-parse" /* FETCH_PARSE */] = 'Fetch client could not parse response.' +
          ' Original error: {$originalErrorMessage}.',
      _a["fetch-status" /* FETCH_STATUS */] = 'Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.',
      _a);
  var ERROR_FACTORY = new util.ErrorFactory('remoteconfig' /* service */, 'Remote Config' /* service name */, ERROR_DESCRIPTION_MAP);
  // Note how this is like typeof/instanceof, but for ErrorCode.
  function hasErrorCode(e, errorCode) {
      return e instanceof util.FirebaseError && e.code.indexOf(errorCode) !== -1;
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Attempts to get the most accurate browser language setting.
   *
   * <p>Adapted from getUserLanguage in packages/auth/src/utils.js for TypeScript.
   *
   * <p>Defers default language specification to server logic for consistency.
   *
   * @param navigatorLanguage Enables tests to override read-only {@link NavigatorLanguage}.
   */
  function getUserLanguage(navigatorLanguage) {
      if (navigatorLanguage === void 0) { navigatorLanguage = navigator; }
      return (
      // Most reliable, but only supported in Chrome/Firefox.
      (navigatorLanguage.languages && navigatorLanguage.languages[0]) ||
          // Supported in most browsers, but returns the language of the browser
          // UI, not the language set in browser settings.
          navigatorLanguage.language
      // Polyfill otherwise.
      );
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Implements the Client abstraction for the Remote Config REST API.
   */
  var RestClient = /** @class */ (function () {
      function RestClient(firebaseInstallations, sdkVersion, namespace, projectId, apiKey, appId) {
          this.firebaseInstallations = firebaseInstallations;
          this.sdkVersion = sdkVersion;
          this.namespace = namespace;
          this.projectId = projectId;
          this.apiKey = apiKey;
          this.appId = appId;
      }
      /**
       * Fetches from the Remote Config REST API.
       *
       * @throws a {@link ErrorCode.FETCH_NETWORK} error if {@link GlobalFetch#fetch} can't
       * connect to the network.
       * @throws a {@link ErrorCode.FETCH_PARSE} error if {@link Response#json} can't parse the
       * fetch response.
       * @throws a {@link ErrorCode.FETCH_STATUS} error if the service returns an HTTP error status.
       */
      RestClient.prototype.fetch = function (request) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var _a, installationId, installationToken, urlBase, url, headers, requestBody, options, fetchPromise, timeoutPromise, response, originalError_1, errorCode, status, responseEtag, config, state, responseBody, originalError_2;
              return tslib.__generator(this, function (_b) {
                  switch (_b.label) {
                      case 0: return [4 /*yield*/, Promise.all([
                              this.firebaseInstallations.getId(),
                              this.firebaseInstallations.getToken()
                          ])];
                      case 1:
                          _a = _b.sent(), installationId = _a[0], installationToken = _a[1];
                          urlBase = window.FIREBASE_REMOTE_CONFIG_URL_BASE ||
                              'https://firebaseremoteconfig.googleapis.com';
                          url = urlBase + "/v1/projects/" + this.projectId + "/namespaces/" + this.namespace + ":fetch?key=" + this.apiKey;
                          headers = {
                              'Content-Type': 'application/json',
                              'Content-Encoding': 'gzip',
                              // Deviates from pure decorator by not passing max-age header since we don't currently have
                              // service behavior using that header.
                              'If-None-Match': request.eTag || '*'
                          };
                          requestBody = {
                              /* eslint-disable camelcase */
                              sdk_version: this.sdkVersion,
                              app_instance_id: installationId,
                              app_instance_id_token: installationToken,
                              app_id: this.appId,
                              language_code: getUserLanguage()
                              /* eslint-enable camelcase */
                          };
                          options = {
                              method: 'POST',
                              headers: headers,
                              body: JSON.stringify(requestBody)
                          };
                          fetchPromise = fetch(url, options);
                          timeoutPromise = new Promise(function (_resolve, reject) {
                              // Maps async event listener to Promise API.
                              request.signal.addEventListener(function () {
                                  // Emulates https://heycam.github.io/webidl/#aborterror
                                  var error = new Error('The operation was aborted.');
                                  error.name = 'AbortError';
                                  reject(error);
                              });
                          });
                          _b.label = 2;
                      case 2:
                          _b.trys.push([2, 5, , 6]);
                          return [4 /*yield*/, Promise.race([fetchPromise, timeoutPromise])];
                      case 3:
                          _b.sent();
                          return [4 /*yield*/, fetchPromise];
                      case 4:
                          response = _b.sent();
                          return [3 /*break*/, 6];
                      case 5:
                          originalError_1 = _b.sent();
                          errorCode = "fetch-client-network" /* FETCH_NETWORK */;
                          if (originalError_1.name === 'AbortError') {
                              errorCode = "fetch-timeout" /* FETCH_TIMEOUT */;
                          }
                          throw ERROR_FACTORY.create(errorCode, {
                              originalErrorMessage: originalError_1.message
                          });
                      case 6:
                          status = response.status;
                          responseEtag = response.headers.get('ETag') || undefined;
                          if (!(response.status === 200)) return [3 /*break*/, 11];
                          responseBody = void 0;
                          _b.label = 7;
                      case 7:
                          _b.trys.push([7, 9, , 10]);
                          return [4 /*yield*/, response.json()];
                      case 8:
                          responseBody = _b.sent();
                          return [3 /*break*/, 10];
                      case 9:
                          originalError_2 = _b.sent();
                          throw ERROR_FACTORY.create("fetch-client-parse" /* FETCH_PARSE */, {
                              originalErrorMessage: originalError_2.message
                          });
                      case 10:
                          config = responseBody['entries'];
                          state = responseBody['state'];
                          _b.label = 11;
                      case 11:
                          // Normalizes based on legacy state.
                          if (state === 'INSTANCE_STATE_UNSPECIFIED') {
                              status = 500;
                          }
                          else if (state === 'NO_CHANGE') {
                              status = 304;
                          }
                          else if (state === 'NO_TEMPLATE' || state === 'EMPTY_CONFIG') {
                              // These cases can be fixed remotely, so normalize to safe value.
                              config = {};
                          }
                          // Normalize to exception-based control flow for non-success cases.
                          // Encapsulates HTTP specifics in this class as much as possible. Status is still the best for
                          // differentiating success states (200 from 304; the state body param is undefined in a
                          // standard 304).
                          if (status !== 304 && status !== 200) {
                              throw ERROR_FACTORY.create("fetch-status" /* FETCH_STATUS */, {
                                  httpStatus: status
                              });
                          }
                          return [2 /*return*/, { status: status, eTag: responseEtag, config: config }];
                  }
              });
          });
      };
      return RestClient;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Shims a minimal AbortSignal.
   *
   * <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects
   * of networking, such as retries. Firebase doesn't use AbortController enough to justify a
   * polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be
   * swapped out if/when we do.
   */
  var RemoteConfigAbortSignal = /** @class */ (function () {
      function RemoteConfigAbortSignal() {
          this.listeners = [];
      }
      RemoteConfigAbortSignal.prototype.addEventListener = function (listener) {
          this.listeners.push(listener);
      };
      RemoteConfigAbortSignal.prototype.abort = function () {
          this.listeners.forEach(function (listener) { return listener(); });
      };
      return RemoteConfigAbortSignal;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var DEFAULT_VALUE_FOR_BOOLEAN = false;
  var DEFAULT_VALUE_FOR_STRING = '';
  var DEFAULT_VALUE_FOR_NUMBER = 0;
  var BOOLEAN_TRUTHY_VALUES = ['1', 'true', 't', 'yes', 'y', 'on'];
  var Value = /** @class */ (function () {
      function Value(_source, _value) {
          if (_value === void 0) { _value = DEFAULT_VALUE_FOR_STRING; }
          this._source = _source;
          this._value = _value;
      }
      Value.prototype.asString = function () {
          return this._value;
      };
      Value.prototype.asBoolean = function () {
          if (this._source === 'static') {
              return DEFAULT_VALUE_FOR_BOOLEAN;
          }
          return BOOLEAN_TRUTHY_VALUES.indexOf(this._value.toLowerCase()) >= 0;
      };
      Value.prototype.asNumber = function () {
          if (this._source === 'static') {
              return DEFAULT_VALUE_FOR_NUMBER;
          }
          var num = Number(this._value);
          if (isNaN(num)) {
              num = DEFAULT_VALUE_FOR_NUMBER;
          }
          return num;
      };
      Value.prototype.getSource = function () {
          return this._source;
      };
      return Value;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  var DEFAULT_FETCH_TIMEOUT_MILLIS = 60 * 1000; // One minute
  var DEFAULT_CACHE_MAX_AGE_MILLIS = 12 * 60 * 60 * 1000; // Twelve hours.
  /**
   * Encapsulates business logic mapping network and storage dependencies to the public SDK API.
   *
   * See {@link https://github.com/FirebasePrivate/firebase-js-sdk/blob/master/packages/firebase/index.d.ts|interface documentation} for method descriptions.
   */
  var RemoteConfig = /** @class */ (function () {
      function RemoteConfig(
      // Required by FirebaseServiceFactory interface.
      app, 
      // JS doesn't support private yet
      // (https://github.com/tc39/proposal-class-fields#private-fields), so we hint using an
      // underscore prefix.
      _client, _storageCache, _storage, _logger) {
          this.app = app;
          this._client = _client;
          this._storageCache = _storageCache;
          this._storage = _storage;
          this._logger = _logger;
          // Tracks completion of initialization promise.
          this._isInitializationComplete = false;
          this.settings = {
              fetchTimeoutMillis: DEFAULT_FETCH_TIMEOUT_MILLIS,
              minimumFetchIntervalMillis: DEFAULT_CACHE_MAX_AGE_MILLIS
          };
          this.defaultConfig = {};
      }
      // Based on packages/firestore/src/util/log.ts but not static because we need per-instance levels
      // to differentiate 2p and 3p use-cases.
      RemoteConfig.prototype.setLogLevel = function (logLevel) {
          switch (logLevel) {
              case 'debug':
                  this._logger.logLevel = logger.LogLevel.DEBUG;
                  break;
              case 'silent':
                  this._logger.logLevel = logger.LogLevel.SILENT;
                  break;
              default:
                  this._logger.logLevel = logger.LogLevel.ERROR;
          }
      };
      Object.defineProperty(RemoteConfig.prototype, "fetchTimeMillis", {
          get: function () {
              return this._storageCache.getLastSuccessfulFetchTimestampMillis() || -1;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(RemoteConfig.prototype, "lastFetchStatus", {
          get: function () {
              return this._storageCache.getLastFetchStatus() || 'no-fetch-yet';
          },
          enumerable: true,
          configurable: true
      });
      RemoteConfig.prototype.activate = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var _a, lastSuccessfulFetchResponse, activeConfigEtag;
              return tslib.__generator(this, function (_b) {
                  switch (_b.label) {
                      case 0: return [4 /*yield*/, Promise.all([
                              this._storage.getLastSuccessfulFetchResponse(),
                              this._storage.getActiveConfigEtag()
                          ])];
                      case 1:
                          _a = _b.sent(), lastSuccessfulFetchResponse = _a[0], activeConfigEtag = _a[1];
                          if (!lastSuccessfulFetchResponse ||
                              !lastSuccessfulFetchResponse.config ||
                              !lastSuccessfulFetchResponse.eTag ||
                              lastSuccessfulFetchResponse.eTag === activeConfigEtag) {
                              // Either there is no successful fetched config, or is the same as current active
                              // config.
                              return [2 /*return*/, false];
                          }
                          return [4 /*yield*/, Promise.all([
                                  this._storageCache.setActiveConfig(lastSuccessfulFetchResponse.config),
                                  this._storage.setActiveConfigEtag(lastSuccessfulFetchResponse.eTag)
                              ])];
                      case 2:
                          _b.sent();
                          return [2 /*return*/, true];
                  }
              });
          });
      };
      RemoteConfig.prototype.ensureInitialized = function () {
          var _this = this;
          if (!this._initializePromise) {
              this._initializePromise = this._storageCache
                  .loadFromStorage()
                  .then(function () {
                  _this._isInitializationComplete = true;
              });
          }
          return this._initializePromise;
      };
      /**
       * @throws a {@link ErrorCode.FETCH_CLIENT_TIMEOUT} if the request takes longer than
       * {@link Settings.fetchTimeoutInSeconds} or
       * {@link DEFAULT_FETCH_TIMEOUT_SECONDS}.
       */
      RemoteConfig.prototype.fetch = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var abortSignal, e_1, lastFetchStatus;
              var _this = this;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          abortSignal = new RemoteConfigAbortSignal();
                          setTimeout(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
                              return tslib.__generator(this, function (_a) {
                                  // Note a very low delay, eg < 10ms, can elapse before listeners are initialized.
                                  abortSignal.abort();
                                  return [2 /*return*/];
                              });
                          }); }, this.settings.fetchTimeoutMillis);
                          _a.label = 1;
                      case 1:
                          _a.trys.push([1, 4, , 6]);
                          return [4 /*yield*/, this._client.fetch({
                                  cacheMaxAgeMillis: this.settings.minimumFetchIntervalMillis,
                                  signal: abortSignal
                              })];
                      case 2:
                          _a.sent();
                          return [4 /*yield*/, this._storageCache.setLastFetchStatus('success')];
                      case 3:
                          _a.sent();
                          return [3 /*break*/, 6];
                      case 4:
                          e_1 = _a.sent();
                          lastFetchStatus = hasErrorCode(e_1, "fetch-throttle" /* FETCH_THROTTLE */)
                              ? 'throttle'
                              : 'failure';
                          return [4 /*yield*/, this._storageCache.setLastFetchStatus(lastFetchStatus)];
                      case 5:
                          _a.sent();
                          throw e_1;
                      case 6: return [2 /*return*/];
                  }
              });
          });
      };
      RemoteConfig.prototype.fetchAndActivate = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.fetch()];
                      case 1:
                          _a.sent();
                          return [2 /*return*/, this.activate()];
                  }
              });
          });
      };
      RemoteConfig.prototype.getAll = function () {
          var _this = this;
          return getAllKeys(this._storageCache.getActiveConfig(), this.defaultConfig).reduce(function (allConfigs, key) {
              allConfigs[key] = _this.getValue(key);
              return allConfigs;
          }, {});
      };
      RemoteConfig.prototype.getBoolean = function (key) {
          return this.getValue(key).asBoolean();
      };
      RemoteConfig.prototype.getNumber = function (key) {
          return this.getValue(key).asNumber();
      };
      RemoteConfig.prototype.getString = function (key) {
          return this.getValue(key).asString();
      };
      RemoteConfig.prototype.getValue = function (key) {
          if (!this._isInitializationComplete) {
              this._logger.debug("A value was requested for key \"" + key + "\" before SDK initialization completed." +
                  ' Await on ensureInitialized if the intent was to get a previously activated value.');
          }
          var activeConfig = this._storageCache.getActiveConfig();
          if (activeConfig && activeConfig[key] !== undefined) {
              return new Value('remote', activeConfig[key]);
          }
          else if (this.defaultConfig && this.defaultConfig[key] !== undefined) {
              return new Value('default', String(this.defaultConfig[key]));
          }
          this._logger.debug("Returning static value for key \"" + key + "\"." +
              ' Define a default or remote value if this is unintentional.');
          return new Value('static');
      };
      return RemoteConfig;
  }());
  /**
   * Dedupes and returns an array of all the keys of the received objects.
   */
  function getAllKeys(obj1, obj2) {
      if (obj1 === void 0) { obj1 = {}; }
      if (obj2 === void 0) { obj2 = {}; }
      return Object.keys(tslib.__assign(tslib.__assign({}, obj1), obj2));
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Converts an error event associated with a {@link IDBRequest} to a {@link FirebaseError}.
   */
  function toFirebaseError(event, errorCode) {
      var originalError = event.target.error || undefined;
      return ERROR_FACTORY.create(errorCode, {
          originalErrorMessage: originalError && originalError.message
      });
  }
  /**
   * A general-purpose store keyed by app + namespace + {@link
   * ProjectNamespaceKeyFieldValue}.
   *
   * <p>The Remote Config SDK can be used with multiple app installations, and each app can interact
   * with multiple namespaces, so this store uses app (ID + name) and namespace as common parent keys
   * for a set of key-value pairs. See {@link Storage#createCompositeKey}.
   *
   * <p>Visible for testing.
   */
  var APP_NAMESPACE_STORE = 'app_namespace_store';
  var DB_NAME = 'firebase_remote_config';
  var DB_VERSION = 1;
  // Visible for testing.
  function openDatabase() {
      return new Promise(function (resolve, reject) {
          var request = indexedDB.open(DB_NAME, DB_VERSION);
          request.onerror = function (event) {
              reject(toFirebaseError(event, "storage-open" /* STORAGE_OPEN */));
          };
          request.onsuccess = function (event) {
              resolve(event.target.result);
          };
          request.onupgradeneeded = function (event) {
              var db = event.target.result;
              // We don't use 'break' in this switch statement, the fall-through
              // behavior is what we want, because if there are multiple versions between
              // the old version and the current version, we want ALL the migrations
              // that correspond to those versions to run, not only the last one.
              // eslint-disable-next-line default-case
              switch (event.oldVersion) {
                  case 0:
                      db.createObjectStore(APP_NAMESPACE_STORE, {
                          keyPath: 'compositeKey'
                      });
              }
          };
      });
  }
  /**
   * Abstracts data persistence.
   */
  var Storage = /** @class */ (function () {
      /**
       * @param appId enables storage segmentation by app (ID + name).
       * @param appName enables storage segmentation by app (ID + name).
       * @param namespace enables storage segmentation by namespace.
       */
      function Storage(appId, appName, namespace, openDbPromise) {
          if (openDbPromise === void 0) { openDbPromise = openDatabase(); }
          this.appId = appId;
          this.appName = appName;
          this.namespace = namespace;
          this.openDbPromise = openDbPromise;
      }
      Storage.prototype.getLastFetchStatus = function () {
          return this.get('last_fetch_status');
      };
      Storage.prototype.setLastFetchStatus = function (status) {
          return this.set('last_fetch_status', status);
      };
      // This is comparable to a cache entry timestamp. If we need to expire other data, we could
      // consider adding timestamp to all storage records and an optional max age arg to getters.
      Storage.prototype.getLastSuccessfulFetchTimestampMillis = function () {
          return this.get('last_successful_fetch_timestamp_millis');
      };
      Storage.prototype.setLastSuccessfulFetchTimestampMillis = function (timestamp) {
          return this.set('last_successful_fetch_timestamp_millis', timestamp);
      };
      Storage.prototype.getLastSuccessfulFetchResponse = function () {
          return this.get('last_successful_fetch_response');
      };
      Storage.prototype.setLastSuccessfulFetchResponse = function (response) {
          return this.set('last_successful_fetch_response', response);
      };
      Storage.prototype.getActiveConfig = function () {
          return this.get('active_config');
      };
      Storage.prototype.setActiveConfig = function (config) {
          return this.set('active_config', config);
      };
      Storage.prototype.getActiveConfigEtag = function () {
          return this.get('active_config_etag');
      };
      Storage.prototype.setActiveConfigEtag = function (etag) {
          return this.set('active_config_etag', etag);
      };
      Storage.prototype.getThrottleMetadata = function () {
          return this.get('throttle_metadata');
      };
      Storage.prototype.setThrottleMetadata = function (metadata) {
          return this.set('throttle_metadata', metadata);
      };
      Storage.prototype.deleteThrottleMetadata = function () {
          return this.delete('throttle_metadata');
      };
      Storage.prototype.get = function (key) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var db;
              var _this = this;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.openDbPromise];
                      case 1:
                          db = _a.sent();
                          return [2 /*return*/, new Promise(function (resolve, reject) {
                                  var transaction = db.transaction([APP_NAMESPACE_STORE], 'readonly');
                                  var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);
                                  var compositeKey = _this.createCompositeKey(key);
                                  try {
                                      var request = objectStore.get(compositeKey);
                                      request.onerror = function (event) {
                                          reject(toFirebaseError(event, "storage-get" /* STORAGE_GET */));
                                      };
                                      request.onsuccess = function (event) {
                                          var result = event.target.result;
                                          if (result) {
                                              resolve(result.value);
                                          }
                                          else {
                                              resolve(undefined);
                                          }
                                      };
                                  }
                                  catch (e) {
                                      reject(ERROR_FACTORY.create("storage-get" /* STORAGE_GET */, {
                                          originalErrorMessage: e && e.message
                                      }));
                                  }
                              })];
                  }
              });
          });
      };
      Storage.prototype.set = function (key, value) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var db;
              var _this = this;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.openDbPromise];
                      case 1:
                          db = _a.sent();
                          return [2 /*return*/, new Promise(function (resolve, reject) {
                                  var transaction = db.transaction([APP_NAMESPACE_STORE], 'readwrite');
                                  var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);
                                  var compositeKey = _this.createCompositeKey(key);
                                  try {
                                      var request = objectStore.put({
                                          compositeKey: compositeKey,
                                          value: value
                                      });
                                      request.onerror = function (event) {
                                          reject(toFirebaseError(event, "storage-set" /* STORAGE_SET */));
                                      };
                                      request.onsuccess = function () {
                                          resolve();
                                      };
                                  }
                                  catch (e) {
                                      reject(ERROR_FACTORY.create("storage-set" /* STORAGE_SET */, {
                                          originalErrorMessage: e && e.message
                                      }));
                                  }
                              })];
                  }
              });
          });
      };
      Storage.prototype.delete = function (key) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var db;
              var _this = this;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.openDbPromise];
                      case 1:
                          db = _a.sent();
                          return [2 /*return*/, new Promise(function (resolve, reject) {
                                  var transaction = db.transaction([APP_NAMESPACE_STORE], 'readwrite');
                                  var objectStore = transaction.objectStore(APP_NAMESPACE_STORE);
                                  var compositeKey = _this.createCompositeKey(key);
                                  try {
                                      var request = objectStore.delete(compositeKey);
                                      request.onerror = function (event) {
                                          reject(toFirebaseError(event, "storage-delete" /* STORAGE_DELETE */));
                                      };
                                      request.onsuccess = function () {
                                          resolve();
                                      };
                                  }
                                  catch (e) {
                                      reject(ERROR_FACTORY.create("storage-delete" /* STORAGE_DELETE */, {
                                          originalErrorMessage: e && e.message
                                      }));
                                  }
                              })];
                  }
              });
          });
      };
      // Facilitates composite key functionality (which is unsupported in IE).
      Storage.prototype.createCompositeKey = function (key) {
          return [this.appId, this.appName, this.namespace, key].join();
      };
      return Storage;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * A memory cache layer over storage to support the SDK's synchronous read requirements.
   */
  var StorageCache = /** @class */ (function () {
      function StorageCache(storage) {
          this.storage = storage;
      }
      /**
       * Memory-only getters
       */
      StorageCache.prototype.getLastFetchStatus = function () {
          return this.lastFetchStatus;
      };
      StorageCache.prototype.getLastSuccessfulFetchTimestampMillis = function () {
          return this.lastSuccessfulFetchTimestampMillis;
      };
      StorageCache.prototype.getActiveConfig = function () {
          return this.activeConfig;
      };
      /**
       * Read-ahead getter
       */
      StorageCache.prototype.loadFromStorage = function () {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var lastFetchStatusPromise, lastSuccessfulFetchTimestampMillisPromise, activeConfigPromise, lastFetchStatus, lastSuccessfulFetchTimestampMillis, activeConfig;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0:
                          lastFetchStatusPromise = this.storage.getLastFetchStatus();
                          lastSuccessfulFetchTimestampMillisPromise = this.storage.getLastSuccessfulFetchTimestampMillis();
                          activeConfigPromise = this.storage.getActiveConfig();
                          return [4 /*yield*/, lastFetchStatusPromise];
                      case 1:
                          lastFetchStatus = _a.sent();
                          if (lastFetchStatus) {
                              this.lastFetchStatus = lastFetchStatus;
                          }
                          return [4 /*yield*/, lastSuccessfulFetchTimestampMillisPromise];
                      case 2:
                          lastSuccessfulFetchTimestampMillis = _a.sent();
                          if (lastSuccessfulFetchTimestampMillis) {
                              this.lastSuccessfulFetchTimestampMillis = lastSuccessfulFetchTimestampMillis;
                          }
                          return [4 /*yield*/, activeConfigPromise];
                      case 3:
                          activeConfig = _a.sent();
                          if (activeConfig) {
                              this.activeConfig = activeConfig;
                          }
                          return [2 /*return*/];
                  }
              });
          });
      };
      /**
       * Write-through setters
       */
      StorageCache.prototype.setLastFetchStatus = function (status) {
          this.lastFetchStatus = status;
          return this.storage.setLastFetchStatus(status);
      };
      StorageCache.prototype.setLastSuccessfulFetchTimestampMillis = function (timestampMillis) {
          this.lastSuccessfulFetchTimestampMillis = timestampMillis;
          return this.storage.setLastSuccessfulFetchTimestampMillis(timestampMillis);
      };
      StorageCache.prototype.setActiveConfig = function (activeConfig) {
          this.activeConfig = activeConfig;
          return this.storage.setActiveConfig(activeConfig);
      };
      return StorageCache;
  }());
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * The amount of milliseconds to exponentially increase.
   */
  var INTERVAL_MILLIS = 1000;
  /**
   * The factor to backoff by.
   * Should be a number greater than 1.
   */
  var BACKOFF_FACTOR = 2;
  /**
   * The maximum milliseconds to increase to.
   *
   * <p>Visible for testing
   */
  var MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android.
  /**
   * The percentage of backoff time to randomize by.
   * See
   * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic
   * for context.
   *
   * <p>Visible for testing
   */
  var RANDOM_FACTOR = 0.5;
  /**
   * Based on the backoff method from
   * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js.
   * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around.
   */
  function calculateBackoffMillis(backoffCount) {
      // Calculates an exponentially increasing value.
      // Deviation: calculates value from count and a constant interval, so we only need to save value
      // and count to restore state.
      var currBaseValue = INTERVAL_MILLIS * Math.pow(BACKOFF_FACTOR, backoffCount);
      // A random "fuzz" to avoid waves of retries.
      // Deviation: randomFactor is required.
      var randomWait = Math.round(
      // A fraction of the backoff value to add/subtract.
      // Deviation: changes multiplication order to improve readability.
      RANDOM_FACTOR *
          currBaseValue *
          // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines
          // if we add or subtract.
          (Math.random() - 0.5) *
          2);
      // Limits backoff to max to avoid effectively permanent backoff.
      return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait);
  }
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /**
   * Supports waiting on a backoff by:
   *
   * <ul>
   *   <li>Promisifying setTimeout, so we can set a timeout in our Promise chain</li>
   *   <li>Listening on a signal bus for abort events, just like the Fetch API</li>
   *   <li>Failing in the same way the Fetch API fails, so timing out a live request and a throttled
   *       request appear the same.</li>
   * </ul>
   *
   * <p>Visible for testing.
   */
  function setAbortableTimeout(signal, throttleEndTimeMillis) {
      return new Promise(function (resolve, reject) {
          // Derives backoff from given end time, normalizing negative numbers to zero.
          var backoffMillis = Math.max(throttleEndTimeMillis - Date.now(), 0);
          var timeout = setTimeout(resolve, backoffMillis);
          // Adds listener, rather than sets onabort, because signal is a shared object.
          signal.addEventListener(function () {
              clearTimeout(timeout);
              // If the request completes before this timeout, the rejection has no effect.
              reject(ERROR_FACTORY.create("fetch-throttle" /* FETCH_THROTTLE */, {
                  throttleEndTimeMillis: throttleEndTimeMillis
              }));
          });
      });
  }
  /**
   * Returns true if the {@link Error} indicates a fetch request may succeed later.
   */
  function isRetriableError(e) {
      if (!(e instanceof util.FirebaseError)) {
          return false;
      }
      // Uses string index defined by ErrorData, which FirebaseError implements.
      var httpStatus = Number(e['httpStatus']);
      return (httpStatus === 429 ||
          httpStatus === 500 ||
          httpStatus === 503 ||
          httpStatus === 504);
  }
  /**
   * Decorates a Client with retry logic.
   *
   * <p>Comparable to CachingClient, but uses backoff logic instead of cache max age and doesn't cache
   * responses (because the SDK has no use for error responses).
   */
  var RetryingClient = /** @class */ (function () {
      function RetryingClient(client, storage) {
          this.client = client;
          this.storage = storage;
      }
      RetryingClient.prototype.fetch = function (request) {
          return tslib.__awaiter(this, void 0, void 0, function () {
              var throttleMetadata;
              return tslib.__generator(this, function (_a) {
                  switch (_a.label) {
                      case 0: return [4 /*yield*/, this.storage.getThrottleMetadata()];
                      case 1:
                          throttleMetadata = (_a.sent()) || {
                              backoffCount: 0,
                              throttleEndTimeMillis: Date.now()
                          };
                          return [2 /*return*/, this.attemptFetch(request, throttleMetadata)];
                  }
              });
          });
      };
      /**
       * A recursive helper for attempting a fetch request repeatedly.
       *
       * @throws any non-retriable errors.
       */
      RetryingClient.prototype.attemptFetch = function (request, _a) {
          var throttleEndTimeMillis = _a.throttleEndTimeMillis, backoffCount = _a.backoffCount;
          return tslib.__awaiter(this, void 0, void 0, function () {
              var response, e_1, throttleMetadata;
              return tslib.__generator(this, function (_b) {
                  switch (_b.label) {
                      case 0: 
                      // Starts with a (potentially zero) timeout to support resumption from stored state.
                      // Ensures the throttle end time is honored if the last attempt timed out.
                      // Note the SDK will never make a request if the fetch timeout expires at this point.
                      return [4 /*yield*/, setAbortableTimeout(request.signal, throttleEndTimeMillis)];
                      case 1:
                          // Starts with a (potentially zero) timeout to support resumption from stored state.
                          // Ensures the throttle end time is honored if the last attempt timed out.
                          // Note the SDK will never make a request if the fetch timeout expires at this point.
                          _b.sent();
                          _b.label = 2;
                      case 2:
                          _b.trys.push([2, 5, , 7]);
                          return [4 /*yield*/, this.client.fetch(request)];
                      case 3:
                          response = _b.sent();
                          // Note the SDK only clears throttle state if response is success or non-retriable.
                          return [4 /*yield*/, this.storage.deleteThrottleMetadata()];
                      case 4:
                          // Note the SDK only clears throttle state if response is success or non-retriable.
                          _b.sent();
                          return [2 /*return*/, response];
                      case 5:
                          e_1 = _b.sent();
                          if (!isRetriableError(e_1)) {
                              throw e_1;
                          }
                          throttleMetadata = {
                              throttleEndTimeMillis: Date.now() + calculateBackoffMillis(backoffCount),
                              backoffCount: backoffCount + 1
                          };
                          // Persists state.
                          return [4 /*yield*/, this.storage.setThrottleMetadata(throttleMetadata)];
                      case 6:
                          // Persists state.
                          _b.sent();
                          return [2 /*return*/, this.attemptFetch(request, throttleMetadata)];
                      case 7: return [2 /*return*/];
                  }
              });
          });
      };
      return RetryingClient;
  }());
  
  var name = "@firebase/remote-config";
  var version = "0.1.19";
  
  /**
   * @license
   * Copyright 2019 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  function registerRemoteConfig(firebaseInstance) {
      firebaseInstance.INTERNAL.registerComponent(new component.Component('remoteConfig', remoteConfigFactory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
      firebaseInstance.registerVersion(name, version);
      function remoteConfigFactory(container, namespace) {
          /* Dependencies */
          // getImmediate for FirebaseApp will always succeed
          var app = container.getProvider('app').getImmediate();
          // The following call will always succeed because rc has `import '@firebase/installations'`
          var installations = container.getProvider('installations').getImmediate();
          // Guards against the SDK being used in non-browser environments.
          if (typeof window === 'undefined') {
              throw ERROR_FACTORY.create("registration-window" /* REGISTRATION_WINDOW */);
          }
          // Normalizes optional inputs.
          var _a = app.options, projectId = _a.projectId, apiKey = _a.apiKey, appId = _a.appId;
          if (!projectId) {
              throw ERROR_FACTORY.create("registration-project-id" /* REGISTRATION_PROJECT_ID */);
          }
          if (!apiKey) {
              throw ERROR_FACTORY.create("registration-api-key" /* REGISTRATION_API_KEY */);
          }
          if (!appId) {
              throw ERROR_FACTORY.create("registration-app-id" /* REGISTRATION_APP_ID */);
          }
          namespace = namespace || 'firebase';
          var storage = new Storage(appId, app.name, namespace);
          var storageCache = new StorageCache(storage);
          var logger$1 = new logger.Logger(name);
          // Sets ERROR as the default log level.
          // See RemoteConfig#setLogLevel for corresponding normalization to ERROR log level.
          logger$1.logLevel = logger.LogLevel.ERROR;
          var restClient = new RestClient(installations, 
          // Uses the JS SDK version, by which the RC package version can be deduced, if necessary.
          firebaseInstance.SDK_VERSION, namespace, projectId, apiKey, appId);
          var retryingClient = new RetryingClient(restClient, storage);
          var cachingClient = new CachingClient(retryingClient, storage, storageCache, logger$1);
          var remoteConfigInstance = new RemoteConfig(app, cachingClient, storageCache, storage, logger$1);
          // Starts warming cache.
          // eslint-disable-next-line @typescript-eslint/no-floating-promises
          remoteConfigInstance.ensureInitialized();
          return remoteConfigInstance;
      }
  }
  registerRemoteConfig(firebase);
  
  exports.registerRemoteConfig = registerRemoteConfig;
  //# sourceMappingURL=index.cjs.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/@firebase/remote-config/node_modules/tslib/tslib.es6.js":
  /*!******************************************************************************!*\
    !*** ./node_modules/@firebase/remote-config/node_modules/tslib/tslib.es6.js ***!
    \******************************************************************************/
  /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  /*! *****************************************************************************
  Copyright (c) Microsoft Corporation. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  this file except in compliance with the License. You may obtain a copy of the
  License at http://www.apache.org/licenses/LICENSE-2.0
  
  THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  MERCHANTABLITY OR NON-INFRINGEMENT.
  
  See the Apache Version 2.0 License for specific language governing permissions
  and limitations under the License.
  ***************************************************************************** */
  /* global Reflect, Promise */
  
  var extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
          function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
      return extendStatics(d, b);
  };
  
  function __extends(d, b) {
      extendStatics(d, b);
      function __() { this.constructor = d; }
      d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  }
  
  var __assign = function() {
      __assign = Object.assign || function __assign(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
          }
          return t;
      }
      return __assign.apply(this, arguments);
  }
  
  function __rest(s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  }
  
  function __decorate(decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  }
  
  function __param(paramIndex, decorator) {
      return function (target, key) { decorator(target, key, paramIndex); }
  }
  
  function __metadata(metadataKey, metadataValue) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  }
  
  function __awaiter(thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  }
  
  function __generator(thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  }
  
  function __exportStar(m, exports) {
      for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  }
  
  function __values(o) {
      var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
      if (m) return m.call(o);
      if (o && typeof o.length === "number") return {
          next: function () {
              if (o && i >= o.length) o = void 0;
              return { value: o && o[i++], done: !o };
          }
      };
      throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  }
  
  function __read(o, n) {
      var m = typeof Symbol === "function" && o[Symbol.iterator];
      if (!m) return o;
      var i = m.call(o), r, ar = [], e;
      try {
          while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
      }
      catch (error) { e = { error: error }; }
      finally {
          try {
              if (r && !r.done && (m = i["return"])) m.call(i);
          }
          finally { if (e) throw e.error; }
      }
      return ar;
  }
  
  function __spread() {
      for (var ar = [], i = 0; i < arguments.length; i++)
          ar = ar.concat(__read(arguments[i]));
      return ar;
  }
  
  function __spreadArrays() {
      for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
      for (var r = Array(s), k = 0, i = 0; i < il; i++)
          for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
              r[k] = a[j];
      return r;
  };
  
  function __await(v) {
      return this instanceof __await ? (this.v = v, this) : new __await(v);
  }
  
  function __asyncGenerator(thisArg, _arguments, generator) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var g = generator.apply(thisArg, _arguments || []), i, q = [];
      return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
      function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
      function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
      function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
      function fulfill(value) { resume("next", value); }
      function reject(value) { resume("throw", value); }
      function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  }
  
  function __asyncDelegator(o) {
      var i, p;
      return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
      function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  }
  
  function __asyncValues(o) {
      if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
      var m = o[Symbol.asyncIterator], i;
      return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
      function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
      function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  }
  
  function __makeTemplateObject(cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  
  function __importStar(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result.default = mod;
      return result;
  }
  
  function __importDefault(mod) {
      return (mod && mod.__esModule) ? mod : { default: mod };
  }
  
  function __classPrivateFieldGet(receiver, privateMap) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to get private field on non-instance");
      }
      return privateMap.get(receiver);
  }
  
  function __classPrivateFieldSet(receiver, privateMap, value) {
      if (!privateMap.has(receiver)) {
          throw new TypeError("attempted to set private field on non-instance");
      }
      privateMap.set(receiver, value);
      return value;
  }
  
  
  /***/ }),
  
  /***/ "./node_modules/firebase/dist/index.cjs.js":
  /*!*************************************************!*\
    !*** ./node_modules/firebase/dist/index.cjs.js ***!
    \*************************************************/
  /*! no static exports found */
  /***/ (function(module, exports, __webpack_require__) {
  
  "use strict";
  
  
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  
  var firebase = _interopDefault(__webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/index.cjs.js"));
  __webpack_require__(/*! @firebase/auth */ "./node_modules/@firebase/auth/dist/auth.esm.js");
  __webpack_require__(/*! @firebase/database */ "./node_modules/@firebase/database/dist/index.cjs.js");
  __webpack_require__(/*! @firebase/firestore */ "./node_modules/@firebase/firestore/dist/index.cjs.js");
  __webpack_require__(/*! @firebase/functions */ "./node_modules/@firebase/functions/dist/index.cjs.js");
  __webpack_require__(/*! @firebase/messaging */ "./node_modules/@firebase/messaging/dist/index.esm.js");
  __webpack_require__(/*! @firebase/storage */ "./node_modules/@firebase/storage/dist/index.esm.js");
  __webpack_require__(/*! @firebase/performance */ "./node_modules/@firebase/performance/dist/index.cjs.js");
  __webpack_require__(/*! @firebase/analytics */ "./node_modules/@firebase/analytics/dist/index.esm.js");
  __webpack_require__(/*! @firebase/remote-config */ "./node_modules/@firebase/remote-config/dist/index.cjs.js");
  
  var name = "firebase";
  var version = "7.14.2";
  
  /**
   * @license
   * Copyright 2018 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  firebase.registerVersion(name, version, 'app');
  
  var name$1 = "firebase";
  var version$1 = "7.14.2";
  
  /**
   * @license
   * Copyright 2017 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the module builds, these are available in the following manner\n(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):\n\nCommonJS Modules:\nconst firebase = require('firebase/app');\nrequire('firebase/<PACKAGE>');\n\nES Modules:\nimport firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n\nTypescript:\nimport * as firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n");
  firebase.registerVersion(name$1, version$1);
  
  module.exports = firebase;
  //# sourceMappingURL=index.cjs.js.map
  
  
  /***/ }),
  
  /***/ "./node_modules/idb/build/idb.js":
  /*!***************************************!*\
    !*** ./node_modules/idb/build/idb.js ***!
    \***************************************/
  /*! no static exports found */
  /***/ (function(module, exports, __webpack_require__) {
  
  (function (global, factory) {
     true ? factory(exports) :
    undefined;
  }(this, function (exports) { 'use strict';
  
    function toArray(arr) {
      return Array.prototype.slice.call(arr);
    }
  
    function promisifyRequest(request) {
      return new Promise(function(resolve, reject) {
        request.onsuccess = function() {
          resolve(request.result);
        };
  
        request.onerror = function() {
          reject(request.error);
        };
      });
    }
  
    function promisifyRequestCall(obj, method, args) {
      var request;
      var p = new Promise(function(resolve, reject) {
        request = obj[method].apply(obj, args);
        promisifyRequest(request).then(resolve, reject);
      });
  
      p.request = request;
      return p;
    }
  
    function promisifyCursorRequestCall(obj, method, args) {
      var p = promisifyRequestCall(obj, method, args);
      return p.then(function(value) {
        if (!value) return;
        return new Cursor(value, p.request);
      });
    }
  
    function proxyProperties(ProxyClass, targetProp, properties) {
      properties.forEach(function(prop) {
        Object.defineProperty(ProxyClass.prototype, prop, {
          get: function() {
            return this[targetProp][prop];
          },
          set: function(val) {
            this[targetProp][prop] = val;
          }
        });
      });
    }
  
    function proxyRequestMethods(ProxyClass, targetProp, Constructor, properties) {
      properties.forEach(function(prop) {
        if (!(prop in Constructor.prototype)) return;
        ProxyClass.prototype[prop] = function() {
          return promisifyRequestCall(this[targetProp], prop, arguments);
        };
      });
    }
  
    function proxyMethods(ProxyClass, targetProp, Constructor, properties) {
      properties.forEach(function(prop) {
        if (!(prop in Constructor.prototype)) return;
        ProxyClass.prototype[prop] = function() {
          return this[targetProp][prop].apply(this[targetProp], arguments);
        };
      });
    }
  
    function proxyCursorRequestMethods(ProxyClass, targetProp, Constructor, properties) {
      properties.forEach(function(prop) {
        if (!(prop in Constructor.prototype)) return;
        ProxyClass.prototype[prop] = function() {
          return promisifyCursorRequestCall(this[targetProp], prop, arguments);
        };
      });
    }
  
    function Index(index) {
      this._index = index;
    }
  
    proxyProperties(Index, '_index', [
      'name',
      'keyPath',
      'multiEntry',
      'unique'
    ]);
  
    proxyRequestMethods(Index, '_index', IDBIndex, [
      'get',
      'getKey',
      'getAll',
      'getAllKeys',
      'count'
    ]);
  
    proxyCursorRequestMethods(Index, '_index', IDBIndex, [
      'openCursor',
      'openKeyCursor'
    ]);
  
    function Cursor(cursor, request) {
      this._cursor = cursor;
      this._request = request;
    }
  
    proxyProperties(Cursor, '_cursor', [
      'direction',
      'key',
      'primaryKey',
      'value'
    ]);
  
    proxyRequestMethods(Cursor, '_cursor', IDBCursor, [
      'update',
      'delete'
    ]);
  
    // proxy 'next' methods
    ['advance', 'continue', 'continuePrimaryKey'].forEach(function(methodName) {
      if (!(methodName in IDBCursor.prototype)) return;
      Cursor.prototype[methodName] = function() {
        var cursor = this;
        var args = arguments;
        return Promise.resolve().then(function() {
          cursor._cursor[methodName].apply(cursor._cursor, args);
          return promisifyRequest(cursor._request).then(function(value) {
            if (!value) return;
            return new Cursor(value, cursor._request);
          });
        });
      };
    });
  
    function ObjectStore(store) {
      this._store = store;
    }
  
    ObjectStore.prototype.createIndex = function() {
      return new Index(this._store.createIndex.apply(this._store, arguments));
    };
  
    ObjectStore.prototype.index = function() {
      return new Index(this._store.index.apply(this._store, arguments));
    };
  
    proxyProperties(ObjectStore, '_store', [
      'name',
      'keyPath',
      'indexNames',
      'autoIncrement'
    ]);
  
    proxyRequestMethods(ObjectStore, '_store', IDBObjectStore, [
      'put',
      'add',
      'delete',
      'clear',
      'get',
      'getAll',
      'getKey',
      'getAllKeys',
      'count'
    ]);
  
    proxyCursorRequestMethods(ObjectStore, '_store', IDBObjectStore, [
      'openCursor',
      'openKeyCursor'
    ]);
  
    proxyMethods(ObjectStore, '_store', IDBObjectStore, [
      'deleteIndex'
    ]);
  
    function Transaction(idbTransaction) {
      this._tx = idbTransaction;
      this.complete = new Promise(function(resolve, reject) {
        idbTransaction.oncomplete = function() {
          resolve();
        };
        idbTransaction.onerror = function() {
          reject(idbTransaction.error);
        };
        idbTransaction.onabort = function() {
          reject(idbTransaction.error);
        };
      });
    }
  
    Transaction.prototype.objectStore = function() {
      return new ObjectStore(this._tx.objectStore.apply(this._tx, arguments));
    };
  
    proxyProperties(Transaction, '_tx', [
      'objectStoreNames',
      'mode'
    ]);
  
    proxyMethods(Transaction, '_tx', IDBTransaction, [
      'abort'
    ]);
  
    function UpgradeDB(db, oldVersion, transaction) {
      this._db = db;
      this.oldVersion = oldVersion;
      this.transaction = new Transaction(transaction);
    }
  
    UpgradeDB.prototype.createObjectStore = function() {
      return new ObjectStore(this._db.createObjectStore.apply(this._db, arguments));
    };
  
    proxyProperties(UpgradeDB, '_db', [
      'name',
      'version',
      'objectStoreNames'
    ]);
  
    proxyMethods(UpgradeDB, '_db', IDBDatabase, [
      'deleteObjectStore',
      'close'
    ]);
  
    function DB(db) {
      this._db = db;
    }
  
    DB.prototype.transaction = function() {
      return new Transaction(this._db.transaction.apply(this._db, arguments));
    };
  
    proxyProperties(DB, '_db', [
      'name',
      'version',
      'objectStoreNames'
    ]);
  
    proxyMethods(DB, '_db', IDBDatabase, [
      'close'
    ]);
  
    // Add cursor iterators
    // TODO: remove this once browsers do the right thing with promises
    ['openCursor', 'openKeyCursor'].forEach(function(funcName) {
      [ObjectStore, Index].forEach(function(Constructor) {
        // Don't create iterateKeyCursor if openKeyCursor doesn't exist.
        if (!(funcName in Constructor.prototype)) return;
  
        Constructor.prototype[funcName.replace('open', 'iterate')] = function() {
          var args = toArray(arguments);
          var callback = args[args.length - 1];
          var nativeObject = this._store || this._index;
          var request = nativeObject[funcName].apply(nativeObject, args.slice(0, -1));
          request.onsuccess = function() {
            callback(request.result);
          };
        };
      });
    });
  
    // polyfill getAll
    [Index, ObjectStore].forEach(function(Constructor) {
      if (Constructor.prototype.getAll) return;
      Constructor.prototype.getAll = function(query, count) {
        var instance = this;
        var items = [];
  
        return new Promise(function(resolve) {
          instance.iterateCursor(query, function(cursor) {
            if (!cursor) {
              resolve(items);
              return;
            }
            items.push(cursor.value);
  
            if (count !== undefined && items.length == count) {
              resolve(items);
              return;
            }
            cursor.continue();
          });
        });
      };
    });
  
    function openDb(name, version, upgradeCallback) {
      var p = promisifyRequestCall(indexedDB, 'open', [name, version]);
      var request = p.request;
  
      if (request) {
        request.onupgradeneeded = function(event) {
          if (upgradeCallback) {
            upgradeCallback(new UpgradeDB(request.result, event.oldVersion, request.transaction));
          }
        };
      }
  
      return p.then(function(db) {
        return new DB(db);
      });
    }
  
    function deleteDb(name) {
      return promisifyRequestCall(indexedDB, 'deleteDatabase', [name]);
    }
  
    exports.openDb = openDb;
    exports.deleteDb = deleteDb;
  
    Object.defineProperty(exports, '__esModule', { value: true });
  
  }));
  
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/dist/cjs.js!./src/app/components/menu/menu.component.html":
  /*!*******************************************************************************************!*\
    !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/components/menu/menu.component.html ***!
    \*******************************************************************************************/
  /*! exports provided: default */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony default export */ __webpack_exports__["default"] = ("<ion-item *ngFor=\"let item of cates\" lines=\"none\" (click)=\"selected(item)\">\n  <ion-label>{{item.name}}</ion-label>\n</ion-item>");
  
  /***/ }),
  
  /***/ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/category/category.page.html":
  /*!*****************************************************************************************!*\
    !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/pages/category/category.page.html ***!
    \*****************************************************************************************/
  /*! exports provided: default */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony default export */ __webpack_exports__["default"] = ("<ion-content #content>\n  <div class=\"mainContent\">\n    <div class=\"restContent\" [style.backgroundImage]=\"'url('+cover+')'\">\n      <div class=\"btnss\"> \n       \n      </div>\n    </div>\n    <div class=\"foodsContent\">\n      <ion-label class=\"restname\">{{name}}</ion-label>\n      <ion-label class=\"cusine\">{{getCusine(cusine)}}</ion-label>\n      <div class=\"vegSection\"> \n      </div>\n      <div *ngFor=\"let item of dummy\">\n        <ion-list>\n          <ion-item>\n            <ion-thumbnail slot=\"start\">\n              <ion-skeleton-text animated></ion-skeleton-text>\n            </ion-thumbnail>\n            <ion-label>\n              <h3>\n                <ion-skeleton-text animated style=\"width: 50%\"></ion-skeleton-text>\n              </h3>\n              <p>\n                <ion-skeleton-text animated style=\"width: 80%\"></ion-skeleton-text>\n              </p>\n              <p>\n                <ion-skeleton-text animated style=\"width: 60%\"></ion-skeleton-text>\n              </p>\n            </ion-label>\n          </ion-item>\n        </ion-list>\n      </div>\n      <div *ngFor=\"let cate of categories\">\n        <ion-label class=\"cateTitle\" [id]=\"cate.id\">{{cate.name}}</ion-label>\n        <div class=\"card_div\">\n\n          <div class=\"card\" *ngFor=\"let item of foods;let i = index\">\n            <div *ngIf=\"cate.id == item.cid.id\" class=\"mainCat\">\n              <img [src]=\"item.cover\" alt=\"\" class=\"image_div\">\n              <div class=\"desc_div\">\n                <ion-label class=\"heading_lbl\">{{item.name}}</ion-label>\n                <ion-label class=\"small_lbl\">{{item.desc}}</ion-label>\n                <ion-label class=\"small_lbl\">{{getCurrency()}} {{item.price}}</ion-label>\n              </div>\n              <div class=\"cartBtn\" *ngIf=\"item.quantiy <= 0\">\n                <ion-label class=\"btns\" (click)=\"add(i)\">Add</ion-label>\n                <!-- <ion-button (click)=\"add(i)\" size=\"small\" expand=\"block\" fill=\"outline\" shape=\"round\">\n                  {{'Add' | translate}}\n                </ion-button> -->\n              </div>\n              <div class=\"cartBtn2\" *ngIf=\"item.quantiy > 0\">\n                <ion-button (click)=\"removeQ(i)\" fill=\"clear\" size=\"small\">\n                  <ion-icon name=\"remove\"></ion-icon>\n                </ion-button>\n                <p class=\"qunitity\">{{item.quantiy}}</p>\n                <ion-button (click)=\"addQ(i)\" fill=\"clear\" size=\"small\">\n                  <ion-icon name=\"add\"></ion-icon>\n                </ion-button>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>");
  
  /***/ }),
  
  /***/ "./src/app/components/components.module.ts":
  /*!*************************************************!*\
    !*** ./src/app/components/components.module.ts ***!
    \*************************************************/
  /*! exports provided: ComponentsModule */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentsModule", function() { return ComponentsModule; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm2015/common.js");
  /* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ionic/angular */ "./node_modules/@ionic/angular/fesm2015/ionic-angular.js");
  /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm2015/forms.js");
  /* harmony import */ var _menu_menu_component__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./menu/menu.component */ "./src/app/components/menu/menu.component.ts");
  /* harmony import */ var _directives_shared_module__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../directives/shared.module */ "./src/app/directives/shared.module.ts");
  
  
  
  
  
  
  
  const components = [
      _menu_menu_component__WEBPACK_IMPORTED_MODULE_5__["MenuComponent"]
  ];
  let ComponentsModule = class ComponentsModule {
  };
  ComponentsModule = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
          declarations: [
              components
          ],
          imports: [
              _angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"],
              _ionic_angular__WEBPACK_IMPORTED_MODULE_3__["IonicModule"],
              _angular_forms__WEBPACK_IMPORTED_MODULE_4__["FormsModule"],
              _directives_shared_module__WEBPACK_IMPORTED_MODULE_6__["SharedModule"]
          ],
          exports: [
              ...components,
          ]
      })
  ], ComponentsModule);
  
  
  
  /***/ }),
  
  /***/ "./src/app/components/menu/menu.component.scss":
  /*!*****************************************************!*\
    !*** ./src/app/components/menu/menu.component.scss ***!
    \*****************************************************/
  /*! exports provided: default */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony default export */ __webpack_exports__["default"] = ("\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzcmMvYXBwL2NvbXBvbmVudHMvbWVudS9tZW51LmNvbXBvbmVudC5zY3NzIn0= */");
  
  /***/ }),
  
  /***/ "./src/app/components/menu/menu.component.ts":
  /*!***************************************************!*\
    !*** ./src/app/components/menu/menu.component.ts ***!
    \***************************************************/
  /*! exports provided: MenuComponent */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MenuComponent", function() { return MenuComponent; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ionic/angular */ "./node_modules/@ionic/angular/fesm2015/ionic-angular.js");
  
  
  
  let MenuComponent = class MenuComponent {
      constructor(navParam, popoverController) {
          this.navParam = navParam;
          this.popoverController = popoverController;
          this.cates = this.navParam.get('data');
      }
      ngOnInit() { }
      selected(item) {
          this.popoverController.dismiss(item, 'selected');
      }
  };
  MenuComponent.ctorParameters = () => [
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["NavParams"] },
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["PopoverController"] }
  ];
  MenuComponent = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({
          selector: 'app-menu',
          template: tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"](__webpack_require__(/*! raw-loader!./menu.component.html */ "./node_modules/raw-loader/dist/cjs.js!./src/app/components/menu/menu.component.html")).default,
          styles: [tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"](__webpack_require__(/*! ./menu.component.scss */ "./src/app/components/menu/menu.component.scss")).default]
      }),
      tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_ionic_angular__WEBPACK_IMPORTED_MODULE_2__["NavParams"],
          _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["PopoverController"]])
  ], MenuComponent);
  
  
  
  /***/ }),
  
  /***/ "./src/app/pages/category/category-routing.module.ts":
  /*!***********************************************************!*\
    !*** ./src/app/pages/category/category-routing.module.ts ***!
    \***********************************************************/
  /*! exports provided: CategoryPageRoutingModule */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CategoryPageRoutingModule", function() { return CategoryPageRoutingModule; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm2015/router.js");
  /* harmony import */ var _category_page__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./category.page */ "./src/app/pages/category/category.page.ts");
  
  
  
  
  const routes = [
      {
          path: '',
          component: _category_page__WEBPACK_IMPORTED_MODULE_3__["CategoryPage"]
      }
  ];
  let CategoryPageRoutingModule = class CategoryPageRoutingModule {
  };
  CategoryPageRoutingModule = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
          imports: [_angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterModule"].forChild(routes)],
          exports: [_angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterModule"]],
      })
  ], CategoryPageRoutingModule);
  
  
  
  /***/ }),
  
  /***/ "./src/app/pages/category/category.module.ts":
  /*!***************************************************!*\
    !*** ./src/app/pages/category/category.module.ts ***!
    \***************************************************/
  /*! exports provided: CategoryPageModule */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CategoryPageModule", function() { return CategoryPageModule; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm2015/common.js");
  /* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "./node_modules/@angular/forms/fesm2015/forms.js");
  /* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ionic/angular */ "./node_modules/@ionic/angular/fesm2015/ionic-angular.js");
  /* harmony import */ var _category_routing_module__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./category-routing.module */ "./src/app/pages/category/category-routing.module.ts");
  /* harmony import */ var _category_page__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./category.page */ "./src/app/pages/category/category.page.ts");
  /* harmony import */ var src_app_components_menu_menu_component__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/components/menu/menu.component */ "./src/app/components/menu/menu.component.ts");
  /* harmony import */ var src_app_components_components_module__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! src/app/components/components.module */ "./src/app/components/components.module.ts");
  /* harmony import */ var src_app_directives_shared_module__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! src/app/directives/shared.module */ "./src/app/directives/shared.module.ts");
  
  
  
  
  
  
  
  
  
  
  let CategoryPageModule = class CategoryPageModule {
  };
  CategoryPageModule = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
          entryComponents: [
              src_app_components_menu_menu_component__WEBPACK_IMPORTED_MODULE_7__["MenuComponent"]
          ],
          imports: [
              _angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"],
              _angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormsModule"],
              _ionic_angular__WEBPACK_IMPORTED_MODULE_4__["IonicModule"],
              _category_routing_module__WEBPACK_IMPORTED_MODULE_5__["CategoryPageRoutingModule"],
              src_app_components_components_module__WEBPACK_IMPORTED_MODULE_8__["ComponentsModule"],
              src_app_directives_shared_module__WEBPACK_IMPORTED_MODULE_9__["SharedModule"]
          ],
          declarations: [_category_page__WEBPACK_IMPORTED_MODULE_6__["CategoryPage"]]
      })
  ], CategoryPageModule);
  
  
  
  /***/ }),
  
  /***/ "./src/app/pages/category/category.page.scss":
  /*!***************************************************!*\
    !*** ./src/app/pages/category/category.page.scss ***!
    \***************************************************/
  /*! exports provided: default */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony default export */ __webpack_exports__["default"] = ("ion-fab-button {\n  --border-radius:10px;\n  --padding:10px;\n  width: 80px;\n}\n\nion-label {\n  display: block;\n}\n\nion-toolbar {\n  padding: 0px 10px;\n  font-weight: bold;\n}\n\nion-toolbar ion-button {\n  font-weight: bold;\n}\n\n.mainContent .restContent {\n  width: 100%;\n  height: 200px;\n  background-position: center;\n  background-repeat: no-repeat;\n  background-size: cover;\n}\n\n.mainContent .restContent .btnss {\n  background-image: linear-gradient(-230deg, #17181a63, #827777) !important;\n  display: -webkit-box;\n  display: flex;\n  -webkit-box-orient: horizontal;\n  -webkit-box-direction: normal;\n          flex-direction: row;\n  -webkit-box-pack: justify;\n          justify-content: space-between;\n  -webkit-box-align: center;\n          align-items: center;\n  position: absolute;\n  width: 100%;\n  padding: 10px;\n  height: 150px;\n}\n\n.mainContent .restContent .btnss .backIcon {\n  font-size: 2rem;\n}\n\n.mainContent .restContent .btnss .moreInfo {\n  color: white;\n  font-weight: bold;\n}\n\n.mainContent .foodsContent {\n  position: absolute;\n  background: white;\n  height: 100%;\n  top: 100px;\n  border-top-left-radius: 10px;\n  border-top-right-radius: 10px;\n  width: 100%;\n  padding: 10px;\n}\n\n.mainContent .foodsContent .restname {\n  font-size: 1.2rem;\n  font-weight: bold;\n  color: black;\n  padding-left: 10px;\n}\n\n.mainContent .foodsContent .cusine {\n  font-size: 1rem;\n  color: lightgray;\n  padding-left: 10px;\n  padding-top: 10px;\n}\n\n.mainContent .foodsContent .cateTitle {\n  font-size: 1.2rem;\n  font-weight: bold;\n  color: black;\n  padding-left: 10px;\n  padding-top: 10px;\n}\n\n.mainContent .foodsContent .card_div .card {\n  display: -webkit-box;\n  display: flex;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat {\n  width: 100%;\n  -webkit-box-orient: horizontal;\n  -webkit-box-direction: normal;\n          flex-direction: row;\n  padding: 5px 10px;\n  display: -webkit-box;\n  display: flex;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .image_div {\n  border-radius: 10px;\n  background-position: center;\n  background-repeat: no-repeat;\n  background-size: cover;\n  width: 80px !important;\n  height: 80px !important;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .desc_div {\n  margin-left: 20px;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .desc_div .heading_lbl {\n  font-size: 14px;\n  display: block;\n  text-align: left;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .desc_div .ratting {\n  font-size: 10px;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .desc_div .small_lbl {\n  font-size: 8px;\n  color: lightgray;\n  display: block;\n  text-align: left;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .cartBtn {\n  position: absolute;\n  right: 15px;\n  width: 60px;\n  background: white;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .cartBtn .btns {\n  border: 1px solid var(--ion-color-primary);\n  border-radius: 10px;\n  padding: 2px;\n  font-size: 12px;\n  text-align: center;\n  color: var(--ion-color-primary);\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .cartBtn2 {\n  position: absolute;\n  right: 15px;\n  width: 80px;\n  display: -webkit-box;\n  display: flex;\n  background: white;\n}\n\n.mainContent .foodsContent .card_div .card .mainCat .cartBtn2 .qunitity {\n  font-weight: bold;\n  margin-top: 8px;\n}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9wYXNhbmVkaXJpc29vcml5YS9Eb3dubG9hZHMvaW9uaWM1Rm9vZEFwcEZ1bGwgMi9BcHBfY29kZS9Vc2VyQXBwIGNvcHkvc3JjL2FwcC9wYWdlcy9jYXRlZ29yeS9jYXRlZ29yeS5wYWdlLnNjc3MiLCJzcmMvYXBwL3BhZ2VzL2NhdGVnb3J5L2NhdGVnb3J5LnBhZ2Uuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNJLG9CQUFBO0VBQ0EsY0FBQTtFQUNBLFdBQUE7QUNDSjs7QURDQTtFQUNJLGNBQUE7QUNFSjs7QURBQTtFQUNHLGlCQUFBO0VBQ0EsaUJBQUE7QUNHSDs7QURGRztFQUNJLGlCQUFBO0FDSVA7O0FEQ0k7RUFDSSxXQUFBO0VBQ0EsYUFBQTtFQUNBLDJCQUFBO0VBQ0EsNEJBQUE7RUFDQSxzQkFBQTtBQ0VSOztBRERRO0VBQ0kseUVBQUE7RUFDQSxvQkFBQTtFQUFBLGFBQUE7RUFDQSw4QkFBQTtFQUFBLDZCQUFBO1VBQUEsbUJBQUE7RUFDQSx5QkFBQTtVQUFBLDhCQUFBO0VBQ0EseUJBQUE7VUFBQSxtQkFBQTtFQUNBLGtCQUFBO0VBQ0EsV0FBQTtFQUNBLGFBQUE7RUFDQSxhQUFBO0FDR1o7O0FERlk7RUFJSSxlQUFBO0FDQ2hCOztBRENZO0VBSUksWUFBQTtFQUNBLGlCQUFBO0FDRmhCOztBRE9JO0VBQ0ksa0JBQUE7RUFDQSxpQkFBQTtFQUNBLFlBQUE7RUFFQSxVQUFBO0VBQ0EsNEJBQUE7RUFDQSw2QkFBQTtFQUNBLFdBQUE7RUFDQSxhQUFBO0FDTlI7O0FET1E7RUFDSSxpQkFBQTtFQUNBLGlCQUFBO0VBQ0EsWUFBQTtFQUNBLGtCQUFBO0FDTFo7O0FET1E7RUFDSSxlQUFBO0VBQ0EsZ0JBQUE7RUFDQSxrQkFBQTtFQUNBLGlCQUFBO0FDTFo7O0FET1E7RUFDSSxpQkFBQTtFQUNBLGlCQUFBO0VBQ0EsWUFBQTtFQUNBLGtCQUFBO0VBQ0EsaUJBQUE7QUNMWjs7QURRWTtFQUNJLG9CQUFBO0VBQUEsYUFBQTtBQ05oQjs7QURPZ0I7RUFDSSxXQUFBO0VBQ0EsOEJBQUE7RUFBQSw2QkFBQTtVQUFBLG1CQUFBO0VBQ0EsaUJBQUE7RUFDQSxvQkFBQTtFQUFBLGFBQUE7QUNMcEI7O0FETW9CO0VBQ0ksbUJBQUE7RUFDQSwyQkFBQTtFQUNBLDRCQUFBO0VBQ0Esc0JBQUE7RUFDQSxzQkFBQTtFQUNBLHVCQUFBO0FDSnhCOztBRE1vQjtFQUNJLGlCQUFBO0FDSnhCOztBREt3QjtFQUVJLGVBQUE7RUFDQSxjQUFBO0VBQ0EsZ0JBQUE7QUNKNUI7O0FETXdCO0VBRUksZUFBQTtBQ0w1Qjs7QURPd0I7RUFDSSxjQUFBO0VBQ0EsZ0JBQUE7RUFDQSxjQUFBO0VBQ0EsZ0JBQUE7QUNMNUI7O0FEU29CO0VBQ0ksa0JBQUE7RUFDQSxXQUFBO0VBQ0EsV0FBQTtFQUNBLGlCQUFBO0FDUHhCOztBRFF3QjtFQUNJLDBDQUFBO0VBQ0EsbUJBQUE7RUFDQSxZQUFBO0VBQ0EsZUFBQTtFQUNBLGtCQUFBO0VBQ0EsK0JBQUE7QUNONUI7O0FEU29CO0VBQ0ksa0JBQUE7RUFDQSxXQUFBO0VBQ0EsV0FBQTtFQUNBLG9CQUFBO0VBQUEsYUFBQTtFQUNBLGlCQUFBO0FDUHhCOztBRFF3QjtFQUNJLGlCQUFBO0VBQ0EsZUFBQTtBQ041QiIsImZpbGUiOiJzcmMvYXBwL3BhZ2VzL2NhdGVnb3J5L2NhdGVnb3J5LnBhZ2Uuc2NzcyIsInNvdXJjZXNDb250ZW50IjpbImlvbi1mYWItYnV0dG9ue1xuICAgIC0tYm9yZGVyLXJhZGl1c1x0OjEwcHg7XG4gICAgLS1wYWRkaW5nOjEwcHg7XG4gICAgd2lkdGg6IDgwcHg7XG59XG5pb24tbGFiZWx7XG4gICAgZGlzcGxheTogYmxvY2s7XG59XG5pb24tdG9vbGJhciB7XG4gICBwYWRkaW5nOiAwcHggMTBweDtcbiAgIGZvbnQtd2VpZ2h0OiBib2xkO1xuICAgaW9uLWJ1dHRvbiB7XG4gICAgICAgZm9udC13ZWlnaHQ6IGJvbGQ7XG4gICB9XG59XG4ubWFpbkNvbnRlbnR7XG4gICAgXG4gICAgLnJlc3RDb250ZW50e1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgaGVpZ2h0OiAyMDBweDtcbiAgICAgICAgYmFja2dyb3VuZC1wb3NpdGlvbjogY2VudGVyO1xuICAgICAgICBiYWNrZ3JvdW5kLXJlcGVhdDogbm8tcmVwZWF0O1xuICAgICAgICBiYWNrZ3JvdW5kLXNpemU6IGNvdmVyO1xuICAgICAgICAuYnRuc3N7XG4gICAgICAgICAgICBiYWNrZ3JvdW5kLWltYWdlOiBsaW5lYXItZ3JhZGllbnQoLTIzMGRlZywgIzE3MTgxYTYzLCAjODI3Nzc3KSAhaW1wb3J0YW50O1xuICAgICAgICAgICAgZGlzcGxheTogZmxleDtcbiAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiByb3c7XG4gICAgICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG4gICAgICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyO1xuICAgICAgICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgICAgICAgd2lkdGg6IDEwMCU7XG4gICAgICAgICAgICBwYWRkaW5nOiAxMHB4O1xuICAgICAgICAgICAgaGVpZ2h0OiAxNTBweDtcbiAgICAgICAgICAgIC5iYWNrSWNvbntcbiAgICAgICAgICAgICAgICAvLyBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgICAgICAgLy8gbGVmdDogMTBweDtcbiAgICAgICAgICAgICAgICAvLyB0b3A6IDQwcHg7XG4gICAgICAgICAgICAgICAgZm9udC1zaXplOiAycmVtO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLm1vcmVJbmZve1xuICAgICAgICAgICAgICAgIC8vIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgICAgICAgICAvLyByaWdodDogMTBweDtcbiAgICAgICAgICAgICAgICAvLyB0b3A6IDQwcHg7XG4gICAgICAgICAgICAgICAgY29sb3I6IHdoaXRlO1xuICAgICAgICAgICAgICAgIGZvbnQtd2VpZ2h0OiBib2xkO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIFxuICAgIH1cbiAgICAuZm9vZHNDb250ZW50e1xuICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgIGJhY2tncm91bmQ6IHdoaXRlO1xuICAgICAgICBoZWlnaHQ6IDEwMCU7XG4gICAgICAgIC8vIG92ZXJmbG93OiBzY3JvbGw7XG4gICAgICAgIHRvcDogMTAwcHg7XG4gICAgICAgIGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDEwcHg7XG4gICAgICAgIGJvcmRlci10b3AtcmlnaHQtcmFkaXVzOiAxMHB4O1xuICAgICAgICB3aWR0aDogMTAwJTtcbiAgICAgICAgcGFkZGluZzogMTBweDtcbiAgICAgICAgLnJlc3RuYW1le1xuICAgICAgICAgICAgZm9udC1zaXplOiAxLjJyZW07XG4gICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDtcbiAgICAgICAgICAgIGNvbG9yOiBibGFjaztcbiAgICAgICAgICAgIHBhZGRpbmctbGVmdDogMTBweDtcbiAgICAgICAgfVxuICAgICAgICAuY3VzaW5le1xuICAgICAgICAgICAgZm9udC1zaXplOiAxcmVtO1xuICAgICAgICAgICAgY29sb3I6IGxpZ2h0Z3JheTtcbiAgICAgICAgICAgIHBhZGRpbmctbGVmdDogMTBweDtcbiAgICAgICAgICAgIHBhZGRpbmctdG9wOiAxMHB4O1xuICAgICAgICB9IFxuICAgICAgICAuY2F0ZVRpdGxle1xuICAgICAgICAgICAgZm9udC1zaXplOiAxLjJyZW07XG4gICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDtcbiAgICAgICAgICAgIGNvbG9yOiBibGFjaztcbiAgICAgICAgICAgIHBhZGRpbmctbGVmdDogMTBweDtcbiAgICAgICAgICAgIHBhZGRpbmctdG9wOiAxMHB4O1xuICAgICAgICB9XG4gICAgICAgIC5jYXJkX2RpdntcbiAgICAgICAgICAgIC5jYXJke1xuICAgICAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgICAgICAgICAgICAgLm1haW5DYXR7XG4gICAgICAgICAgICAgICAgICAgIHdpZHRoOiAxMDAlO1xuICAgICAgICAgICAgICAgICAgICBmbGV4LWRpcmVjdGlvbjogcm93O1xuICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOjVweCAxMHB4O1xuICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgICAgICAgICAgICAgICAuaW1hZ2VfZGl2e1xuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogMTBweDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmQtcG9zaXRpb246IGNlbnRlcjtcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmQtcmVwZWF0OiBuby1yZXBlYXQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kLXNpemU6IGNvdmVyO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDgwcHggIWltcG9ydGFudDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogODBweCAhaW1wb3J0YW50O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC5kZXNjX2RpdntcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbi1sZWZ0OiAyMHB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgLmhlYWRpbmdfbGJse1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZvbnQtc2l6ZTogMXJlbTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb250LXNpemU6IDE0cHg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dC1hbGlnbjogbGVmdDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIC5yYXR0aW5ne1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZvbnQtc2l6ZTogMC44cmVtO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogMTBweDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIC5zbWFsbF9sYmx7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9udC1zaXplOiA4cHg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3I6IGxpZ2h0Z3JheTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiBibG9jaztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOiBsZWZ0O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgLmNhcnRCdG57XG4gICAgICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgICAgICAgICAgICAgICByaWdodDogMTVweDtcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiA2MHB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZDogd2hpdGU7XG4gICAgICAgICAgICAgICAgICAgICAgICAuYnRuc3tcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3JkZXI6IDFweCBzb2xpZCB2YXIoLS1pb24tY29sb3ItcHJpbWFyeSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogMTBweDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAycHg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9udC1zaXplOiAxMnB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQtYWxpZ246IGNlbnRlcjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvcjogdmFyKC0taW9uLWNvbG9yLXByaW1hcnkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC5jYXJ0QnRuMntcbiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0OiAxNXB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IDgwcHg7XG4gICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiBmbGV4O1xuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZDogd2hpdGU7XG4gICAgICAgICAgICAgICAgICAgICAgICAucXVuaXRpdHl7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9udC13ZWlnaHQ6IGJvbGQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFyZ2luLXRvcDogOHB4O1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxufVxuXG5cblxuIiwiaW9uLWZhYi1idXR0b24ge1xuICAtLWJvcmRlci1yYWRpdXM6MTBweDtcbiAgLS1wYWRkaW5nOjEwcHg7XG4gIHdpZHRoOiA4MHB4O1xufVxuXG5pb24tbGFiZWwge1xuICBkaXNwbGF5OiBibG9jaztcbn1cblxuaW9uLXRvb2xiYXIge1xuICBwYWRkaW5nOiAwcHggMTBweDtcbiAgZm9udC13ZWlnaHQ6IGJvbGQ7XG59XG5pb24tdG9vbGJhciBpb24tYnV0dG9uIHtcbiAgZm9udC13ZWlnaHQ6IGJvbGQ7XG59XG5cbi5tYWluQ29udGVudCAucmVzdENvbnRlbnQge1xuICB3aWR0aDogMTAwJTtcbiAgaGVpZ2h0OiAyMDBweDtcbiAgYmFja2dyb3VuZC1wb3NpdGlvbjogY2VudGVyO1xuICBiYWNrZ3JvdW5kLXJlcGVhdDogbm8tcmVwZWF0O1xuICBiYWNrZ3JvdW5kLXNpemU6IGNvdmVyO1xufVxuLm1haW5Db250ZW50IC5yZXN0Q29udGVudCAuYnRuc3Mge1xuICBiYWNrZ3JvdW5kLWltYWdlOiBsaW5lYXItZ3JhZGllbnQoLTIzMGRlZywgIzE3MTgxYTYzLCAjODI3Nzc3KSAhaW1wb3J0YW50O1xuICBkaXNwbGF5OiBmbGV4O1xuICBmbGV4LWRpcmVjdGlvbjogcm93O1xuICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgd2lkdGg6IDEwMCU7XG4gIHBhZGRpbmc6IDEwcHg7XG4gIGhlaWdodDogMTUwcHg7XG59XG4ubWFpbkNvbnRlbnQgLnJlc3RDb250ZW50IC5idG5zcyAuYmFja0ljb24ge1xuICBmb250LXNpemU6IDJyZW07XG59XG4ubWFpbkNvbnRlbnQgLnJlc3RDb250ZW50IC5idG5zcyAubW9yZUluZm8ge1xuICBjb2xvcjogd2hpdGU7XG4gIGZvbnQtd2VpZ2h0OiBib2xkO1xufVxuLm1haW5Db250ZW50IC5mb29kc0NvbnRlbnQge1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIGJhY2tncm91bmQ6IHdoaXRlO1xuICBoZWlnaHQ6IDEwMCU7XG4gIHRvcDogMTAwcHg7XG4gIGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDEwcHg7XG4gIGJvcmRlci10b3AtcmlnaHQtcmFkaXVzOiAxMHB4O1xuICB3aWR0aDogMTAwJTtcbiAgcGFkZGluZzogMTBweDtcbn1cbi5tYWluQ29udGVudCAuZm9vZHNDb250ZW50IC5yZXN0bmFtZSB7XG4gIGZvbnQtc2l6ZTogMS4ycmVtO1xuICBmb250LXdlaWdodDogYm9sZDtcbiAgY29sb3I6IGJsYWNrO1xuICBwYWRkaW5nLWxlZnQ6IDEwcHg7XG59XG4ubWFpbkNvbnRlbnQgLmZvb2RzQ29udGVudCAuY3VzaW5lIHtcbiAgZm9udC1zaXplOiAxcmVtO1xuICBjb2xvcjogbGlnaHRncmF5O1xuICBwYWRkaW5nLWxlZnQ6IDEwcHg7XG4gIHBhZGRpbmctdG9wOiAxMHB4O1xufVxuLm1haW5Db250ZW50IC5mb29kc0NvbnRlbnQgLmNhdGVUaXRsZSB7XG4gIGZvbnQtc2l6ZTogMS4ycmVtO1xuICBmb250LXdlaWdodDogYm9sZDtcbiAgY29sb3I6IGJsYWNrO1xuICBwYWRkaW5nLWxlZnQ6IDEwcHg7XG4gIHBhZGRpbmctdG9wOiAxMHB4O1xufVxuLm1haW5Db250ZW50IC5mb29kc0NvbnRlbnQgLmNhcmRfZGl2IC5jYXJkIHtcbiAgZGlzcGxheTogZmxleDtcbn1cbi5tYWluQ29udGVudCAuZm9vZHNDb250ZW50IC5jYXJkX2RpdiAuY2FyZCAubWFpbkNhdCB7XG4gIHdpZHRoOiAxMDAlO1xuICBmbGV4LWRpcmVjdGlvbjogcm93O1xuICBwYWRkaW5nOiA1cHggMTBweDtcbiAgZGlzcGxheTogZmxleDtcbn1cbi5tYWluQ29udGVudCAuZm9vZHNDb250ZW50IC5jYXJkX2RpdiAuY2FyZCAubWFpbkNhdCAuaW1hZ2VfZGl2IHtcbiAgYm9yZGVyLXJhZGl1czogMTBweDtcbiAgYmFja2dyb3VuZC1wb3NpdGlvbjogY2VudGVyO1xuICBiYWNrZ3JvdW5kLXJlcGVhdDogbm8tcmVwZWF0O1xuICBiYWNrZ3JvdW5kLXNpemU6IGNvdmVyO1xuICB3aWR0aDogODBweCAhaW1wb3J0YW50O1xuICBoZWlnaHQ6IDgwcHggIWltcG9ydGFudDtcbn1cbi5tYWluQ29udGVudCAuZm9vZHNDb250ZW50IC5jYXJkX2RpdiAuY2FyZCAubWFpbkNhdCAuZGVzY19kaXYge1xuICBtYXJnaW4tbGVmdDogMjBweDtcbn1cbi5tYWluQ29udGVudCAuZm9vZHNDb250ZW50IC5jYXJkX2RpdiAuY2FyZCAubWFpbkNhdCAuZGVzY19kaXYgLmhlYWRpbmdfbGJsIHtcbiAgZm9udC1zaXplOiAxNHB4O1xuICBkaXNwbGF5OiBibG9jaztcbiAgdGV4dC1hbGlnbjogbGVmdDtcbn1cbi5tYWluQ29udGVudCAuZm9vZHNDb250ZW50IC5jYXJkX2RpdiAuY2FyZCAubWFpbkNhdCAuZGVzY19kaXYgLnJhdHRpbmcge1xuICBmb250LXNpemU6IDEwcHg7XG59XG4ubWFpbkNvbnRlbnQgLmZvb2RzQ29udGVudCAuY2FyZF9kaXYgLmNhcmQgLm1haW5DYXQgLmRlc2NfZGl2IC5zbWFsbF9sYmwge1xuICBmb250LXNpemU6IDhweDtcbiAgY29sb3I6IGxpZ2h0Z3JheTtcbiAgZGlzcGxheTogYmxvY2s7XG4gIHRleHQtYWxpZ246IGxlZnQ7XG59XG4ubWFpbkNvbnRlbnQgLmZvb2RzQ29udGVudCAuY2FyZF9kaXYgLmNhcmQgLm1haW5DYXQgLmNhcnRCdG4ge1xuICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gIHJpZ2h0OiAxNXB4O1xuICB3aWR0aDogNjBweDtcbiAgYmFja2dyb3VuZDogd2hpdGU7XG59XG4ubWFpbkNvbnRlbnQgLmZvb2RzQ29udGVudCAuY2FyZF9kaXYgLmNhcmQgLm1haW5DYXQgLmNhcnRCdG4gLmJ0bnMge1xuICBib3JkZXI6IDFweCBzb2xpZCB2YXIoLS1pb24tY29sb3ItcHJpbWFyeSk7XG4gIGJvcmRlci1yYWRpdXM6IDEwcHg7XG4gIHBhZGRpbmc6IDJweDtcbiAgZm9udC1zaXplOiAxMnB4O1xuICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gIGNvbG9yOiB2YXIoLS1pb24tY29sb3ItcHJpbWFyeSk7XG59XG4ubWFpbkNvbnRlbnQgLmZvb2RzQ29udGVudCAuY2FyZF9kaXYgLmNhcmQgLm1haW5DYXQgLmNhcnRCdG4yIHtcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICByaWdodDogMTVweDtcbiAgd2lkdGg6IDgwcHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGJhY2tncm91bmQ6IHdoaXRlO1xufVxuLm1haW5Db250ZW50IC5mb29kc0NvbnRlbnQgLmNhcmRfZGl2IC5jYXJkIC5tYWluQ2F0IC5jYXJ0QnRuMiAucXVuaXRpdHkge1xuICBmb250LXdlaWdodDogYm9sZDtcbiAgbWFyZ2luLXRvcDogOHB4O1xufSJdfQ== */");
  
  /***/ }),
  
  /***/ "./src/app/pages/category/category.page.ts":
  /*!*************************************************!*\
    !*** ./src/app/pages/category/category.page.ts ***!
    \*************************************************/
  /*! exports provided: CategoryPage */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CategoryPage", function() { return CategoryPage; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ionic/angular */ "./node_modules/@ionic/angular/fesm2015/ionic-angular.js");
  /* harmony import */ var src_app_services_apis_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/apis.service */ "./src/app/services/apis.service.ts");
  /* harmony import */ var src_app_services_util_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/util.service */ "./src/app/services/util.service.ts");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm2015/router.js");
  
  
  
  
  
  
  let CategoryPage = class CategoryPage {
      constructor(api, util, navCtrl, router) {
          this.api = api;
          this.util = util;
          this.navCtrl = navCtrl;
          this.router = router;
          this.cover = '';
          this.cusine = [];
          this.foods = [];
          this.dummyFoods = [];
          this.categories = [];
          this.dummy = Array(50);
          this.totalItem = 0;
          this.totalPrice = 0;
          this.deliveryAddress = '';
          this.foodIds = [];
          this.cart = [];
      }
      ngOnInit() {
          this.id = "uoZfuvtoEyVqMsHeo9pOe5fhzMk2";
          // this.route.queryParams.subscribe(data => {
          //   console.log('data=>', data);
          //   if (data.hasOwnProperty('id')) {
          //     this.id = data.id;
          this.getVenueDetails();
          //   }
          // });
      }
      getAddress() {
          const address = JSON.parse(localStorage.getItem('deliveryAddress'));
          if (address && address.address) {
              this.deliveryAddress = address.address;
          }
          return this.deliveryAddress;
      }
      getVenueDetails() {
          // Venue Details
          this.api.getVenueDetails(this.id).then(data => {
              console.log(data);
              if (data) {
                  this.name = data.name;
                  this.descritions = data.descritions;
                  this.cover = data.cover;
                  this.address = data.address;
                  this.ratting = data.ratting ? data.ratting : 0;
                  this.totalRatting = data.totalRatting ? data.totalRatting : 2;
                  this.dishPrice = data.dishPrice;
                  this.time = data.time;
                  this.cusine = data.cusine;
                  const vid = localStorage.getItem('vid');
                  console.log('id', vid, this.id);
                  if (vid && vid !== this.id) {
                      this.dummy = [];
                      return false;
                  }
                  this.getCates();
                  this.getFoods();
              }
          }, error => {
              console.log(error);
              this.util.errorToast(this.util.translate('Something went wrong'));
          }).catch(error => {
              console.log(error);
              this.util.errorToast(this.util.translate('Something went wrong'));
          });
      }
      getCates() {
          this.api.getVenueCategories(this.id).then(cate => {
              console.log(cate);
              if (cate) {
                  this.categories = cate;
              }
          }, error => {
              console.log(error);
              this.dummy = [];
              this.util.errorToast(this.util.translate('Something went wrong'));
          }).catch(error => {
              console.log(error);
              this.dummy = [];
              this.util.errorToast(this.util.translate('Something went wrong'));
          });
      }
      getFoods() {
          this.api.getFoods(this.id).then(foods => {
              console.log(foods);
              if (foods) {
                  // if()
                  this.dummy = [];
                  this.foods = [];
                  this.dummyFoods = [];
                  foods.forEach(element => {
                      if (element && element.status === true) {
                          const info = {
                              cid: {
                                  id: element.cid.id,
                              },
                              cover: element.cover,
                              desc: element.desc,
                              id: element.id,
                              name: element.name,
                              price: element.price,
                              ratting: element.ratting,
                              uid: element.uid,
                              veg: element.veg,
                              quantiy: 0,
                              size: element.size,
                              variations: element.variations,
                              totalRatting: element.totalRatting ? element.totalRatting : 0,
                              selectedItem: []
                          };
                          this.foods.push(info);
                          this.dummyFoods.push(info);
                          this.foodIds.push(element.id);
                      }
                  });
                  console.log('myfoods', this.foods);
                  if (!this.foods.length || this.foods.length === 0) {
                      this.util.errorToast(this.util.translate('No Foods found'));
                      this.navCtrl.back();
                      return false;
                  }
              }
          }, error => {
              console.log(error);
              this.dummy = [];
              this.util.errorToast(this.util.translate('Something went wrong'));
          }).catch(error => {
              console.log(error);
              this.dummy = [];
              this.util.errorToast(this.util.translate('Something went wrong'));
          });
      }
      back() {
          this.navCtrl.navigateRoot(['tabs']);
      }
      getCusine(cusine) {
          return cusine.join('-');
      }
      setData() {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const vid = localStorage.getItem('vid');
              console.log('leaving the planet', vid, this.id);
              console.log('total item', this.totalItem);
              if (vid && vid === this.id && this.totalPrice > 0) {
                  localStorage.setItem('vid', this.id);
                  yield localStorage.setItem('foods', JSON.stringify(this.foods));
                  localStorage.setItem('categories', JSON.stringify(this.categories));
                  localStorage.setItem('dummyItem', JSON.stringify(this.dummyFoods));
                  localStorage.setItem('totalItem', this.totalItem);
                  localStorage.setItem('totalPrice', this.totalPrice);
              }
              else if (!vid && this.totalItem > 0) {
                  localStorage.setItem('vid', this.id);
                  yield localStorage.setItem('foods', JSON.stringify(this.foods));
                  localStorage.setItem('categories', JSON.stringify(this.categories));
                  localStorage.setItem('dummyItem', JSON.stringify(this.dummyFoods));
                  localStorage.setItem('totalItem', this.totalItem);
                  localStorage.setItem('totalPrice', this.totalPrice);
              }
              else if (this.totalItem == 0) {
                  this.totalItem = 0;
                  this.totalPrice = 0;
              }
          });
      }
      ionViewWillLeave() {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              yield this.setData();
          });
      }
      openDetails() {
          const navData = {
              queryParams: {
                  id: this.id
              }
          };
          this.router.navigate(['rest-details'], navData);
      }
      getCurrency() {
          return this.util.getCurrecySymbol();
      }
  };
  CategoryPage.ctorParameters = () => [
      { type: src_app_services_apis_service__WEBPACK_IMPORTED_MODULE_3__["ApisService"] },
      { type: src_app_services_util_service__WEBPACK_IMPORTED_MODULE_4__["UtilService"] },
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["NavController"] },
      { type: _angular_router__WEBPACK_IMPORTED_MODULE_5__["Router"] }
  ];
  tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewChild"])('content', { static: false }),
      tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:type", Object)
  ], CategoryPage.prototype, "content", void 0);
  CategoryPage = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({
          selector: 'app-category',
          template: tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"](__webpack_require__(/*! raw-loader!./category.page.html */ "./node_modules/raw-loader/dist/cjs.js!./src/app/pages/category/category.page.html")).default,
          styles: [tslib__WEBPACK_IMPORTED_MODULE_0__["__importDefault"](__webpack_require__(/*! ./category.page.scss */ "./src/app/pages/category/category.page.scss")).default]
      }),
      tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [src_app_services_apis_service__WEBPACK_IMPORTED_MODULE_3__["ApisService"],
          src_app_services_util_service__WEBPACK_IMPORTED_MODULE_4__["UtilService"],
          _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["NavController"],
          _angular_router__WEBPACK_IMPORTED_MODULE_5__["Router"]])
  ], CategoryPage);
  
  
  
  /***/ }),
  
  /***/ "./src/app/services/apis.service.ts":
  /*!******************************************!*\
    !*** ./src/app/services/apis.service.ts ***!
    \******************************************/
  /*! exports provided: AuthInfo, ApisService */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AuthInfo", function() { return AuthInfo; });
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApisService", function() { return ApisService; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _angular_fire_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/fire/auth */ "./node_modules/@angular/fire/auth/es2015/index.js");
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm2015/index.js");
  /* harmony import */ var firebase__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! firebase */ "./node_modules/firebase/dist/index.cjs.js");
  /* harmony import */ var firebase__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(firebase__WEBPACK_IMPORTED_MODULE_4__);
  /* harmony import */ var _angular_fire_firestore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/fire/firestore */ "./node_modules/@angular/fire/firestore/es2015/index.js");
  /* harmony import */ var src_environments_environment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/environments/environment */ "./src/environments/environment.ts");
  /* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular/common/http */ "./node_modules/@angular/common/fesm2015/http.js");
  
  var ApisService_1;
  
  
  
  
  
  
  
  class AuthInfo {
      constructor($uid) {
          this.$uid = $uid;
      }
      isLoggedIn() {
          return !!this.$uid;
      }
  }
  let ApisService = ApisService_1 = class ApisService {
      constructor(fireAuth, adb, http) {
          this.fireAuth = fireAuth;
          this.adb = adb;
          this.http = http;
          this.db = firebase__WEBPACK_IMPORTED_MODULE_4__["firestore"]();
          this.authInfo$ = new rxjs__WEBPACK_IMPORTED_MODULE_3__["BehaviorSubject"](ApisService_1.UNKNOWN_USER);
      }
      getVenueDetails(id) {
          return new Promise((resolve, reject) => {
              this.adb.collection('venue').doc(id).get().subscribe((venue) => {
                  resolve(venue.data());
              }, error => {
                  reject(error);
              });
          });
      }
      getVenueCategories(id) {
          return new Promise((resolve, reject) => {
              this.adb.collection('categories', ref => ref.where('uid', '==', id)).get().subscribe((venue) => {
                  var data = venue.docs.map(element => {
                      var item = element.data();
                      item.id = element.id;
                      return item;
                  });
                  resolve(data);
              }, error => {
                  reject(error);
              });
          });
      }
      getFoods(uid) {
          return new Promise((resolve, reject) => {
              this.db.collection('foods').doc(uid).collection('all').get().then((data) => {
                  var users = data.docs.map(doc => {
                      var item = doc.data();
                      item.cid.get().then(function (doc) {
                          item.cid = doc.data();
                          item.cid.id = doc.id;
                      });
                      item.id = doc.id;
                      return item;
                  });
                  resolve(users);
              }, error => {
                  reject(error);
              });
          });
      }
      httpPost(url, body) {
          const header = {
              headers: new _angular_common_http__WEBPACK_IMPORTED_MODULE_7__["HttpHeaders"]()
                  .set('Content-Type', 'application/x-www-form-urlencoded')
                  .set('Authorization', `Bearer ${src_environments_environment__WEBPACK_IMPORTED_MODULE_6__["environment"].stripe.sk}`)
          };
          const order = this.JSON_to_URLEncoded(body);
          console.log(order);
          return this.http.post(url, order, header);
      }
      httpGet(url) {
          const header = {
              headers: new _angular_common_http__WEBPACK_IMPORTED_MODULE_7__["HttpHeaders"]()
                  .set('Content-Type', 'application/x-www-form-urlencoded')
                  .set('Authorization', `Bearer ${src_environments_environment__WEBPACK_IMPORTED_MODULE_6__["environment"].stripe.sk}`)
          };
          return this.http.get(url, header);
      }
      JSON_to_URLEncoded(element, key, list) {
          let new_list = list || [];
          if (typeof element == "object") {
              for (let idx in element) {
                  this.JSON_to_URLEncoded(element[idx], key ? key + "[" + idx + "]" : idx, new_list);
              }
          }
          else {
              new_list.push(key + "=" + encodeURIComponent(element));
          }
          return new_list.join("&");
      }
  };
  ApisService.UNKNOWN_USER = new AuthInfo(null);
  ApisService.ctorParameters = () => [
      { type: _angular_fire_auth__WEBPACK_IMPORTED_MODULE_2__["AngularFireAuth"] },
      { type: _angular_fire_firestore__WEBPACK_IMPORTED_MODULE_5__["AngularFirestore"] },
      { type: _angular_common_http__WEBPACK_IMPORTED_MODULE_7__["HttpClient"] }
  ];
  ApisService = ApisService_1 = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({
          providedIn: 'root'
      }),
      tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_angular_fire_auth__WEBPACK_IMPORTED_MODULE_2__["AngularFireAuth"],
          _angular_fire_firestore__WEBPACK_IMPORTED_MODULE_5__["AngularFirestore"],
          _angular_common_http__WEBPACK_IMPORTED_MODULE_7__["HttpClient"]])
  ], ApisService);
  
  
  
  /***/ }),
  
  /***/ "./src/app/services/util.service.ts":
  /*!******************************************!*\
    !*** ./src/app/services/util.service.ts ***!
    \******************************************/
  /*! exports provided: UtilService */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  __webpack_require__.r(__webpack_exports__);
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UtilService", function() { return UtilService; });
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js");
  /* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ionic/angular */ "./node_modules/@ionic/angular/fesm2015/ionic-angular.js");
  /* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ "./node_modules/@angular/router/fesm2015/router.js");
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm2015/index.js");
  /* harmony import */ var _ngx_translate_core__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ngx-translate/core */ "./node_modules/@ngx-translate/core/fesm2015/ngx-translate-core.js");
  /* harmony import */ var src_environments_environment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/environments/environment */ "./src/environments/environment.ts");
  
  
  
  
  
  
  
  let UtilService = class UtilService {
      constructor(loadingCtrl, alertCtrl, toastCtrl, router, navCtrl, translateService) {
          this.loadingCtrl = loadingCtrl;
          this.alertCtrl = alertCtrl;
          this.toastCtrl = toastCtrl;
          this.router = router;
          this.navCtrl = navCtrl;
          this.translateService = translateService;
          this.isLoading = false;
          this.address = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"]();
          this.coupon = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"]();
          this.review = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"]();
          this.changeLocation = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"]();
          this.loggedIn = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"]();
          this.profile = new rxjs__WEBPACK_IMPORTED_MODULE_4__["Subject"]();
      }
      /*
      Start Loader
      Call this method to Start your Loader
      */
      publishAddress(data) {
          this.address.next(data);
      }
      publishReview(data) {
          this.review.next(data);
      }
      publishProfile(data) {
          this.profile.next(data);
      }
      observProfile() {
          return this.profile;
      }
      getLanguage() {
          return this.translateService.currentLang;
      }
      getReviewObservable() {
          return this.review;
      }
      publishLocation(data) {
          this.changeLocation.next(data);
      }
      subscribeLocation() {
          return this.changeLocation;
      }
      publishLoggedIn(data) {
          this.loggedIn.next(data);
      }
      subscribeLoggedIn() {
          return this.loggedIn;
      }
      translate(str) {
          const currentLang = this.translateService.currentLang;
          const returnValue = this.translateService.translations[currentLang][str];
          if (returnValue === undefined) {
              return this.translateService.translations.en_merch[str];
          }
          else {
              return returnValue;
          }
      }
      translateInEN(str) {
          const currentLang = 'en';
          const returnValue = this.translateService.translations[currentLang][str];
          if (returnValue === undefined) {
              return this.translateService.translations.en_merch[str];
          }
          else {
              return returnValue;
          }
      }
      getCurrencyCode() {
          return src_environments_environment__WEBPACK_IMPORTED_MODULE_6__["environment"].general.code;
      }
      getCurrecySymbol() {
          return src_environments_environment__WEBPACK_IMPORTED_MODULE_6__["environment"].general.symbol;
      }
      getObservable() {
          return this.address;
      }
      publishCoupon(data) {
          this.coupon.next(data);
      }
      getCouponObservable() {
          return this.coupon;
      }
      setOrders(data) {
          this.orders = null;
          this.orders = data;
      }
      gerOrder() {
          return this.orders;
      }
      show(msg) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              this.isLoading = true;
              return yield this.loadingCtrl.create({
                  message: msg,
                  spinner: 'bubbles',
              }).then(a => {
                  a.present().then(() => {
                      //console.log('presented');
                      if (!this.isLoading) {
                          a.dismiss().then(() => console.log('abort presenting'));
                      }
                  });
              });
          });
      }
      hide() {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              this.isLoading = false;
              return yield this.loadingCtrl.dismiss().then(() => console.log('dismissed'));
          });
      }
      /*
        Show Warning Alert Message
        param : msg = message to display
        Call this method to show Warning Alert,
        */
      showWarningAlert(msg) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const alert = yield this.alertCtrl.create({
                  header: 'Warning',
                  message: msg,
                  buttons: ['OK']
              });
              yield alert.present();
          });
      }
      showSimpleAlert(msg) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const alert = yield this.alertCtrl.create({
                  header: '',
                  message: msg,
                  buttons: ['OK']
              });
              yield alert.present();
          });
      }
      /*
       Show Error Alert Message
       param : msg = message to display
       Call this method to show Error Alert,
       */
      showErrorAlert(msg) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const alert = yield this.alertCtrl.create({
                  header: 'Error',
                  message: msg,
                  buttons: ['OK']
              });
              yield alert.present();
          });
      }
      /*
         param : email = email to verify
         Call this method to get verify email
         */
      getEmailFilter(email) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const emailfilter = /^[\w._-]+[+]?[\w._-]+@[\w.-]+\.[a-zA-Z]{2,6}$/;
              if (!(emailfilter.test(email))) {
                  const alert = yield this.alertCtrl.create({
                      header: 'Warning',
                      message: 'Please enter valid email',
                      buttons: ['OK']
                  });
                  yield alert.present();
                  return false;
              }
              else {
                  return true;
              }
          });
      }
      /*
        Show Toast Message on Screen
         param : msg = message to display, color= background
         color of toast example dark,danger,light. position  = position of message example top,bottom
         Call this method to show toast message
         */
      showToast(msg, colors, positon) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const toast = yield this.toastCtrl.create({
                  message: msg,
                  duration: 2000,
                  color: colors,
                  position: positon
              });
              toast.present();
          });
      }
      shoNotification(msg, colors, positon) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const toast = yield this.toastCtrl.create({
                  message: msg,
                  duration: 4000,
                  color: colors,
                  position: positon,
                  buttons: [
                      {
                          text: 'Ok',
                          role: 'cancel',
                          handler: () => {
                              // console.log('Cancel clicked');
                          }
                      }
                  ]
              });
              toast.present();
          });
      }
      errorToast(msg) {
          return tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"](this, void 0, void 0, function* () {
              const toast = yield this.toastCtrl.create({
                  message: msg,
                  duration: 2000,
              });
              toast.present();
          });
      }
      apiErrorHandler(err) {
          // console.log('Error got in service =>', err)
          if (err.status === -1) {
              this.showErrorAlert('Failed To Connect With Server');
          }
          else if (err.status === 401) {
              this.showErrorAlert('Unauthorized Request!');
              this.navCtrl.navigateRoot('/login');
          }
          else if (err.status === 500) {
              this.showErrorAlert('Somethimg Went Wrong..');
          }
      }
      // setDetails(data) {
      //   this.details = null;
      //   this.details = data;
      // }
      // getDetails() {
      //   return this.details;
      // }
      makeid(length) {
          let result = '';
          const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
          const charactersLength = characters.length;
          for (let i = 0; i < length; i++) {
              result += characters.charAt(Math.floor(Math.random() * charactersLength));
          }
          return result;
      }
  };
  UtilService.ctorParameters = () => [
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["LoadingController"] },
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["AlertController"] },
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["ToastController"] },
      { type: _angular_router__WEBPACK_IMPORTED_MODULE_3__["Router"] },
      { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["NavController"] },
      { type: _ngx_translate_core__WEBPACK_IMPORTED_MODULE_5__["TranslateService"] }
  ];
  UtilService = tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
      Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])({
          providedIn: 'root'
      }),
      tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"]("design:paramtypes", [_ionic_angular__WEBPACK_IMPORTED_MODULE_2__["LoadingController"],
          _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["AlertController"],
          _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["ToastController"],
          _angular_router__WEBPACK_IMPORTED_MODULE_3__["Router"],
          _ionic_angular__WEBPACK_IMPORTED_MODULE_2__["NavController"],
          _ngx_translate_core__WEBPACK_IMPORTED_MODULE_5__["TranslateService"]])
  ], UtilService);
  
  
  
  /***/ })
  
  }]);
  //# sourceMappingURL=category-category-module-es2015.js.map