text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  var component = require('@firebase/component');
  var tslib = require('tslib');
  var logger$1 = require('@firebase/logger');
  var util = require('@firebase/util');
  
  /**
   * @license
   * Copyright 2019 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 PlatformLoggerServiceImpl = /** @class */ (function () {
      function PlatformLoggerServiceImpl(container) {
          this.container = container;
      }
      // In initial implementation, this will be called by installations on
      // auth token refresh, and installations will send this string.
      PlatformLoggerServiceImpl.prototype.getPlatformInfoString = function () {
          var providers = this.container.getProviders();
          // Loop through providers and get library/version pairs from any that are
          // version components.
          return providers
              .map(function (provider) {
              if (isVersionServiceProvider(provider)) {
                  var service = provider.getImmediate();
                  return service.library + "/" + service.version;
              }
              else {
                  return null;
              }
          })
              .filter(function (logString) { return logString; })
              .join(' ');
      };
      return PlatformLoggerServiceImpl;
  }());
  /**
   *
   * @param provider check if this provider provides a VersionService
   *
   * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider
   * provides VersionService. The provider is not necessarily a 'app-version'
   * provider.
   */
  function isVersionServiceProvider(provider) {
      var component = provider.getComponent();
      return (component === null || component === void 0 ? void 0 : component.type) === "VERSION" /* VERSION */;
  }
  
  var name = "@firebase/app-exp";
  var version = "0.0.900-exp.894b5da5a";
  
  /**
   * @license
   * Copyright 2019 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 logger = new logger$1.Logger('@firebase/app');
  
  var name$1 = "@firebase/app-compat";
  
  var name$2 = "@firebase/analytics-compat";
  
  var name$3 = "@firebase/analytics-exp";
  
  var name$4 = "@firebase/auth-exp";
  
  var name$5 = "@firebase/auth-compat";
  
  var name$6 = "@firebase/database";
  
  var name$7 = "@firebase/database-compat";
  
  var name$8 = "@firebase/functions-exp";
  
  var name$9 = "@firebase/functions-compat";
  
  var name$a = "@firebase/installations-exp";
  
  var name$b = "@firebase/installations-compat";
  
  var name$c = "@firebase/messaging-exp";
  
  var name$d = "@firebase/messaging-compat";
  
  var name$e = "@firebase/performance-exp";
  
  var name$f = "@firebase/performance-compat";
  
  var name$g = "@firebase/remote-config-exp";
  
  var name$h = "@firebase/remote-config-compat";
  
  var name$i = "@firebase/storage";
  
  var name$j = "@firebase/storage-compat";
  
  var name$k = "@firebase/firestore";
  
  var name$l = "@firebase/firestore-compat";
  
  var name$m = "firebase-exp";
  var version$1 = "9.0.0-beta.1";
  
  /**
   * @license
   * Copyright 2019 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 _a;
  /**
   * The default app name
   *
   * @internal
   */
  var DEFAULT_ENTRY_NAME = '[DEFAULT]';
  var PLATFORM_LOG_STRING = (_a = {},
      _a[name] = 'fire-core',
      _a[name$1] = 'fire-core-compat',
      _a[name$3] = 'fire-analytics',
      _a[name$2] = 'fire-analytics-compat',
      _a[name$4] = 'fire-auth',
      _a[name$5] = 'fire-auth-compat',
      _a[name$6] = 'fire-rtdb',
      _a[name$7] = 'fire-rtdb-compat',
      _a[name$8] = 'fire-fn',
      _a[name$9] = 'fire-fn-compat',
      _a[name$a] = 'fire-iid',
      _a[name$b] = 'fire-iid-compat',
      _a[name$c] = 'fire-fcm',
      _a[name$d] = 'fire-fcm-compat',
      _a[name$e] = 'fire-perf',
      _a[name$f] = 'fire-perf-compat',
      _a[name$g] = 'fire-rc',
      _a[name$h] = 'fire-rc-compat',
      _a[name$i] = 'fire-gcs',
      _a[name$j] = 'fire-gcs-compat',
      _a[name$k] = 'fire-fst',
      _a[name$l] = 'fire-fst-compat',
      _a['fire-js'] = 'fire-js',
      _a[name$m] = 'fire-js-all',
      _a);
  
  /**
   * @license
   * Copyright 2019 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.
   */
  /**
   * @internal
   */
  var _apps = new Map();
  /**
   * Registered components.
   *
   * @internal
   */
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  var _components = new Map();
  /**
   * @param component - the component being added to this app's container
   *
   * @internal
   */
  function _addComponent(app, component) {
      try {
          app.container.addComponent(component);
      }
      catch (e) {
          logger.debug("Component " + component.name + " failed to register with FirebaseApp " + app.name, e);
      }
  }
  /**
   *
   * @internal
   */
  function _addOrOverwriteComponent(app, component) {
      app.container.addOrOverwriteComponent(component);
  }
  /**
   *
   * @param component - the component to register
   * @returns whether or not the component is registered successfully
   *
   * @internal
   */
  function _registerComponent(component) {
      var e_1, _a;
      var componentName = component.name;
      if (_components.has(componentName)) {
          logger.debug("There were multiple attempts to register component " + componentName + ".");
          return false;
      }
      _components.set(componentName, component);
      try {
          // add the component to existing app instances
          for (var _b = tslib.__values(_apps.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
              var app = _c.value;
              _addComponent(app, component);
          }
      }
      catch (e_1_1) { e_1 = { error: e_1_1 }; }
      finally {
          try {
              if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
          }
          finally { if (e_1) throw e_1.error; }
      }
      return true;
  }
  /**
   *
   * @param app - FirebaseApp instance
   * @param name - service name
   *
   * @returns the provider for the service with the matching name
   *
   * @internal
   */
  function _getProvider(app, name) {
      return app.container.getProvider(name);
  }
  /**
   *
   * @param app - FirebaseApp instance
   * @param name - service name
   * @param instanceIdentifier - service instance identifier in case the service supports multiple instances
   *
   * @internal
   */
  function _removeServiceInstance(app, name, instanceIdentifier) {
      if (instanceIdentifier === void 0) { instanceIdentifier = DEFAULT_ENTRY_NAME; }
      _getProvider(app, name).clearInstance(instanceIdentifier);
  }
  /**
   * Test only
   *
   * @internal
   */
  function _clearComponents() {
      _components.clear();
  }
  
  /**
   * @license
   * Copyright 2019 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 _a$1;
  var ERRORS = (_a$1 = {},
      _a$1["no-app" /* NO_APP */] = "No Firebase App '{$appName}' has been created - " +
          'call Firebase App.initializeApp()',
      _a$1["bad-app-name" /* BAD_APP_NAME */] = "Illegal App name: '{$appName}",
      _a$1["duplicate-app" /* DUPLICATE_APP */] = "Firebase App named '{$appName}' already exists",
      _a$1["app-deleted" /* APP_DELETED */] = "Firebase App named '{$appName}' already deleted",
      _a$1["invalid-app-argument" /* INVALID_APP_ARGUMENT */] = 'firebase.{$appName}() takes either no argument or a ' +
          'Firebase App instance.',
      _a$1["invalid-log-argument" /* INVALID_LOG_ARGUMENT */] = 'First argument to `onLog` must be null or a function.',
      _a$1);
  var ERROR_FACTORY = new util.ErrorFactory('app', 'Firebase', ERRORS);
  
  /**
   * @license
   * Copyright 2019 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 FirebaseAppImpl = /** @class */ (function () {
      function FirebaseAppImpl(options, config, container) {
          var _this = this;
          this._isDeleted = false;
          this._options = tslib.__assign({}, options);
          this._name = config.name;
          this._automaticDataCollectionEnabled =
              config.automaticDataCollectionEnabled;
          this._container = container;
          this.container.addComponent(new component.Component('app-exp', function () { return _this; }, "PUBLIC" /* PUBLIC */));
      }
      Object.defineProperty(FirebaseAppImpl.prototype, "automaticDataCollectionEnabled", {
          get: function () {
              this.checkDestroyed();
              return this._automaticDataCollectionEnabled;
          },
          set: function (val) {
              this.checkDestroyed();
              this._automaticDataCollectionEnabled = val;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(FirebaseAppImpl.prototype, "name", {
          get: function () {
              this.checkDestroyed();
              return this._name;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(FirebaseAppImpl.prototype, "options", {
          get: function () {
              this.checkDestroyed();
              return this._options;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(FirebaseAppImpl.prototype, "container", {
          get: function () {
              return this._container;
          },
          enumerable: false,
          configurable: true
      });
      Object.defineProperty(FirebaseAppImpl.prototype, "isDeleted", {
          get: function () {
              return this._isDeleted;
          },
          set: function (val) {
              this._isDeleted = val;
          },
          enumerable: false,
          configurable: true
      });
      /**
       * This function will throw an Error if the App has already been deleted -
       * use before performing API actions on the App.
       */
      FirebaseAppImpl.prototype.checkDestroyed = function () {
          if (this.isDeleted) {
              throw ERROR_FACTORY.create("app-deleted" /* APP_DELETED */, { appName: this._name });
          }
      };
      return FirebaseAppImpl;
  }());
  
  /**
   * @license
   * Copyright 2019 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.
   */
  /**
   * The current SDK version.
   *
   * @public
   */
  var SDK_VERSION = version$1;
  function initializeApp(options, rawConfig) {
      var e_1, _a;
      if (rawConfig === void 0) { rawConfig = {}; }
      if (typeof rawConfig !== 'object') {
          var name_1 = rawConfig;
          rawConfig = { name: name_1 };
      }
      var config = tslib.__assign({ name: DEFAULT_ENTRY_NAME, automaticDataCollectionEnabled: false }, rawConfig);
      var name = config.name;
      if (typeof name !== 'string' || !name) {
          throw ERROR_FACTORY.create("bad-app-name" /* BAD_APP_NAME */, {
              appName: String(name)
          });
      }
      if (_apps.has(name)) {
          throw ERROR_FACTORY.create("duplicate-app" /* DUPLICATE_APP */, { appName: name });
      }
      var container = new component.ComponentContainer(name);
      try {
          for (var _b = tslib.__values(_components.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
              var component$1 = _c.value;
              container.addComponent(component$1);
          }
      }
      catch (e_1_1) { e_1 = { error: e_1_1 }; }
      finally {
          try {
              if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
          }
          finally { if (e_1) throw e_1.error; }
      }
      var newApp = new FirebaseAppImpl(options, config, container);
      _apps.set(name, newApp);
      return newApp;
  }
  /**
   * Retrieves a FirebaseApp instance.
   *
   * When called with no arguments, the default app is returned. When an app name
   * is provided, the app corresponding to that name is returned.
   *
   * An exception is thrown if the app being retrieved has not yet been
   * initialized.
   *
   * @example
   * ```javascript
   * // Return the default app
   * const app = getApp();
   * ```
   *
   * @example
   * ```javascript
   * // Return a named app
   * const otherApp = getApp("otherApp");
   * ```
   *
   * @param name - Optional name of the app to return. If no name is
   *   provided, the default is `"[DEFAULT]"`.
   *
   * @returns The app corresponding to the provided app name.
   *   If no app name is provided, the default app is returned.
   *
   * @public
   */
  function getApp(name) {
      if (name === void 0) { name = DEFAULT_ENTRY_NAME; }
      var app = _apps.get(name);
      if (!app) {
          throw ERROR_FACTORY.create("no-app" /* NO_APP */, { appName: name });
      }
      return app;
  }
  /**
   * A (read-only) array of all initialized apps.
   * @public
   */
  function getApps() {
      return Array.from(_apps.values());
  }
  /**
   * Renders this app unusable and frees the resources of all associated
   * services.
   *
   * @example
   * ```javascript
   * deleteApp(app)
   *   .then(function() {
   *     console.log("App deleted successfully");
   *   })
   *   .catch(function(error) {
   *     console.log("Error deleting app:", error);
   *   });
   * ```
   *
   * @public
   */
  function deleteApp(app) {
      return tslib.__awaiter(this, void 0, void 0, function () {
          var name;
          return tslib.__generator(this, function (_a) {
              switch (_a.label) {
                  case 0:
                      name = app.name;
                      if (!_apps.has(name)) return [3 /*break*/, 2];
                      _apps.delete(name);
                      return [4 /*yield*/, Promise.all(app.container
                              .getProviders()
                              .map(function (provider) { return provider.delete(); }))];
                  case 1:
                      _a.sent();
                      app.isDeleted = true;
                      _a.label = 2;
                  case 2: return [2 /*return*/];
              }
          });
      });
  }
  /**
   * Registers a library's name and version for platform logging purposes.
   * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)
   * @param version - Current version of that library.
   * @param variant - Bundle variant, e.g., node, rn, etc.
   *
   * @public
   */
  function registerVersion(libraryKeyOrName, version, variant) {
      var _a;
      // TODO: We can use this check to whitelist strings when/if we set up
      // a good whitelist system.
      var library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;
      if (variant) {
          library += "-" + variant;
      }
      var libraryMismatch = library.match(/\s|\//);
      var versionMismatch = version.match(/\s|\//);
      if (libraryMismatch || versionMismatch) {
          var warning = [
              "Unable to register library \"" + library + "\" with version \"" + version + "\":"
          ];
          if (libraryMismatch) {
              warning.push("library name \"" + library + "\" contains illegal characters (whitespace or \"/\")");
          }
          if (libraryMismatch && versionMismatch) {
              warning.push('and');
          }
          if (versionMismatch) {
              warning.push("version name \"" + version + "\" contains illegal characters (whitespace or \"/\")");
          }
          logger.warn(warning.join(' '));
          return;
      }
      _registerComponent(new component.Component(library + "-version", function () { return ({ library: library, version: version }); }, "VERSION" /* VERSION */));
  }
  /**
   * Sets log handler for all Firebase SDKs.
   * @param logCallback - An optional custom log handler that executes user code whenever
   * the Firebase SDK makes a logging call.
   *
   * @public
   */
  function onLog(logCallback, options) {
      if (logCallback !== null && typeof logCallback !== 'function') {
          throw ERROR_FACTORY.create("invalid-log-argument" /* INVALID_LOG_ARGUMENT */);
      }
      logger$1.setUserLogHandler(logCallback, options);
  }
  /**
   * Sets log level for all Firebase SDKs.
   *
   * All of the log types above the current log level are captured (i.e. if
   * you set the log level to `info`, errors are logged, but `debug` and
   * `verbose` logs are not).
   *
   * @public
   */
  function setLogLevel(logLevel) {
      logger$1.setLogLevel(logLevel);
  }
  
  /**
   * @license
   * Copyright 2019 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.
   */
  function registerCoreComponents(variant) {
      _registerComponent(new component.Component('platform-logger', function (container) { return new PlatformLoggerServiceImpl(container); }, "PRIVATE" /* PRIVATE */));
      // Register `app` package.
      registerVersion(name, version, variant);
      // Register platform SDK identifier (no version).
      registerVersion('fire-js', '');
  }
  
  /**
   * Firebase App
   *
   * @remarks This package coordinates the communication between the different Firebase components
   * @packageDocumentation
   */
  registerCoreComponents();
  
  exports.SDK_VERSION = SDK_VERSION;
  exports._DEFAULT_ENTRY_NAME = DEFAULT_ENTRY_NAME;
  exports._addComponent = _addComponent;
  exports._addOrOverwriteComponent = _addOrOverwriteComponent;
  exports._apps = _apps;
  exports._clearComponents = _clearComponents;
  exports._components = _components;
  exports._getProvider = _getProvider;
  exports._registerComponent = _registerComponent;
  exports._removeServiceInstance = _removeServiceInstance;
  exports.deleteApp = deleteApp;
  exports.getApp = getApp;
  exports.getApps = getApps;
  exports.initializeApp = initializeApp;
  exports.onLog = onLog;
  exports.registerVersion = registerVersion;
  exports.setLogLevel = setLogLevel;
  //# sourceMappingURL=index.cjs.js.map
  