{"version":3,"sources":["node_modules/@firebase/app-compat/dist/esm/index.esm2017.js"],"sourcesContent":["import { ErrorFactory, contains, deepExtend, createSubscribe, isBrowser } from '@firebase/util';\nimport { Component } from '@firebase/component';\nimport * as modularAPIs from '@firebase/app';\nimport { _addComponent, deleteApp, _DEFAULT_ENTRY_NAME, _addOrOverwriteComponent, registerVersion } from '@firebase/app';\nimport { Logger } from '@firebase/logger';\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Global context object for a collection of services using\r\n * a shared authentication state.\r\n *\r\n * marked as internal because it references internal types exported from @firebase/app\r\n * @internal\r\n */\nclass FirebaseAppImpl {\n constructor(_delegate, firebase) {\n this._delegate = _delegate;\n this.firebase = firebase;\n // add itself to container\n _addComponent(_delegate, new Component('app-compat', () => this, \"PUBLIC\" /* ComponentType.PUBLIC */));\n this.container = _delegate.container;\n }\n get automaticDataCollectionEnabled() {\n return this._delegate.automaticDataCollectionEnabled;\n }\n set automaticDataCollectionEnabled(val) {\n this._delegate.automaticDataCollectionEnabled = val;\n }\n get name() {\n return this._delegate.name;\n }\n get options() {\n return this._delegate.options;\n }\n delete() {\n return new Promise(resolve => {\n this._delegate.checkDestroyed();\n resolve();\n }).then(() => {\n this.firebase.INTERNAL.removeApp(this.name);\n return deleteApp(this._delegate);\n });\n }\n /**\r\n * Return a service instance associated with this app (creating it\r\n * on demand), identified by the passed instanceIdentifier.\r\n *\r\n * NOTE: Currently storage and functions are the only ones that are leveraging this\r\n * functionality. They invoke it by calling:\r\n *\r\n * ```javascript\r\n * firebase.app().storage('STORAGE BUCKET ID')\r\n * ```\r\n *\r\n * The service name is passed to this already\r\n * @internal\r\n */\n _getService(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {\n var _a;\n this._delegate.checkDestroyed();\n // Initialize instance if InstatiationMode is `EXPLICIT`.\n const provider = this._delegate.container.getProvider(name);\n if (!provider.isInitialized() && ((_a = provider.getComponent()) === null || _a === void 0 ? void 0 : _a.instantiationMode) === \"EXPLICIT\" /* InstantiationMode.EXPLICIT */) {\n provider.initialize();\n }\n // getImmediate will always succeed because _getService is only called for registered components.\n return provider.getImmediate({\n identifier: instanceIdentifier\n });\n }\n /**\r\n * Remove a service instance from the cache, so we will create a new instance for this service\r\n * when people try to get it again.\r\n *\r\n * NOTE: currently only firestore uses this functionality to support firestore shutdown.\r\n *\r\n * @param name The service name\r\n * @param instanceIdentifier instance identifier in case multiple instances are allowed\r\n * @internal\r\n */\n _removeServiceInstance(name, instanceIdentifier = _DEFAULT_ENTRY_NAME) {\n this._delegate.container\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .getProvider(name).clearInstance(instanceIdentifier);\n }\n /**\r\n * @param component the component being added to this app's container\r\n * @internal\r\n */\n _addComponent(component) {\n _addComponent(this._delegate, component);\n }\n _addOrOverwriteComponent(component) {\n _addOrOverwriteComponent(this._delegate, component);\n }\n toJSON() {\n return {\n name: this.name,\n automaticDataCollectionEnabled: this.automaticDataCollectionEnabled,\n options: this.options\n };\n }\n}\n// TODO: investigate why the following needs to be commented out\n// Prevent dead-code elimination of these methods w/o invalid property\n// copying.\n// (FirebaseAppImpl.prototype.name && FirebaseAppImpl.prototype.options) ||\n// FirebaseAppImpl.prototype.delete ||\n// console.log('dc');\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst ERRORS = {\n [\"no-app\" /* AppError.NO_APP */]: \"No Firebase App '{$appName}' has been created - \" + 'call Firebase App.initializeApp()',\n [\"invalid-app-argument\" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' + 'Firebase App instance.'\n};\nconst ERROR_FACTORY = new ErrorFactory('app-compat', 'Firebase', ERRORS);\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Because auth can't share code with other components, we attach the utility functions\r\n * in an internal namespace to share code.\r\n * This function return a firebase namespace object without\r\n * any utility functions, so it can be shared between the regular firebaseNamespace and\r\n * the lite version.\r\n */\nfunction createFirebaseNamespaceCore(firebaseAppImpl) {\n const apps = {};\n // // eslint-disable-next-line @typescript-eslint/no-explicit-any\n // const components = new Map>();\n // A namespace is a plain JavaScript Object.\n const namespace = {\n // Hack to prevent Babel from modifying the object returned\n // as the firebase namespace.\n // @ts-ignore\n __esModule: true,\n initializeApp: initializeAppCompat,\n // @ts-ignore\n app,\n registerVersion: modularAPIs.registerVersion,\n setLogLevel: modularAPIs.setLogLevel,\n onLog: modularAPIs.onLog,\n // @ts-ignore\n apps: null,\n SDK_VERSION: modularAPIs.SDK_VERSION,\n INTERNAL: {\n registerComponent: registerComponentCompat,\n removeApp,\n useAsService,\n modularAPIs\n }\n };\n // Inject a circular default export to allow Babel users who were previously\n // using:\n //\n // import firebase from 'firebase';\n // which becomes: var firebase = require('firebase').default;\n //\n // instead of\n //\n // import * as firebase from 'firebase';\n // which becomes: var firebase = require('firebase');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n namespace['default'] = namespace;\n // firebase.apps is a read-only getter.\n Object.defineProperty(namespace, 'apps', {\n get: getApps\n });\n /**\r\n * Called by App.delete() - but before any services associated with the App\r\n * are deleted.\r\n */\n function removeApp(name) {\n delete apps[name];\n }\n /**\r\n * Get the App object for a given name (or DEFAULT).\r\n */\n function app(name) {\n name = name || modularAPIs._DEFAULT_ENTRY_NAME;\n if (!contains(apps, name)) {\n throw ERROR_FACTORY.create(\"no-app\" /* AppError.NO_APP */, {\n appName: name\n });\n }\n return apps[name];\n }\n // @ts-ignore\n app['App'] = firebaseAppImpl;\n /**\r\n * Create a new App instance (name must be unique).\r\n *\r\n * This function is idempotent. It can be called more than once and return the same instance using the same options and config.\r\n */\n function initializeAppCompat(options, rawConfig = {}) {\n const app = modularAPIs.initializeApp(options, rawConfig);\n if (contains(apps, app.name)) {\n return apps[app.name];\n }\n const appCompat = new firebaseAppImpl(app, namespace);\n apps[app.name] = appCompat;\n return appCompat;\n }\n /*\r\n * Return an array of all the non-deleted FirebaseApps.\r\n */\n function getApps() {\n // Make a copy so caller cannot mutate the apps list.\n return Object.keys(apps).map(name => apps[name]);\n }\n function registerComponentCompat(component) {\n const componentName = component.name;\n const componentNameWithoutCompat = componentName.replace('-compat', '');\n if (modularAPIs._registerComponent(component) && component.type === \"PUBLIC\" /* ComponentType.PUBLIC */) {\n // create service namespace for public components\n // The Service namespace is an accessor function ...\n const serviceNamespace = (appArg = app()) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof appArg[componentNameWithoutCompat] !== 'function') {\n // Invalid argument.\n // This happens in the following case: firebase.storage('gs:/')\n throw ERROR_FACTORY.create(\"invalid-app-argument\" /* AppError.INVALID_APP_ARGUMENT */, {\n appName: componentName\n });\n }\n // Forward service instance lookup to the FirebaseApp.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return appArg[componentNameWithoutCompat]();\n };\n // ... and a container for service-level properties.\n if (component.serviceProps !== undefined) {\n deepExtend(serviceNamespace, component.serviceProps);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n namespace[componentNameWithoutCompat] = serviceNamespace;\n // Patch the FirebaseAppImpl prototype\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n firebaseAppImpl.prototype[componentNameWithoutCompat] =\n // TODO: The eslint disable can be removed and the 'ignoreRestArgs'\n // option added to the no-explicit-any rule when ESlint releases it.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function (...args) {\n const serviceFxn = this._getService.bind(this, componentName);\n return serviceFxn.apply(this, component.multipleInstances ? args : []);\n };\n }\n return component.type === \"PUBLIC\" /* ComponentType.PUBLIC */ ?\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n namespace[componentNameWithoutCompat] : null;\n }\n // Map the requested service to a registered service name\n // (used to map auth to serverAuth service when needed).\n function useAsService(app, name) {\n if (name === 'serverAuth') {\n return null;\n }\n const useService = name;\n return useService;\n }\n return namespace;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Return a firebase namespace object.\r\n *\r\n * In production, this will be called exactly once and the result\r\n * assigned to the 'firebase' global. It may be called multiple times\r\n * in unit tests.\r\n */\nfunction createFirebaseNamespace() {\n const namespace = createFirebaseNamespaceCore(FirebaseAppImpl);\n namespace.INTERNAL = Object.assign(Object.assign({}, namespace.INTERNAL), {\n createFirebaseNamespace,\n extendNamespace,\n createSubscribe,\n ErrorFactory,\n deepExtend\n });\n /**\r\n * Patch the top-level firebase namespace with additional properties.\r\n *\r\n * firebase.INTERNAL.extendNamespace()\r\n */\n function extendNamespace(props) {\n deepExtend(namespace, props);\n }\n return namespace;\n}\nconst firebase$1 = createFirebaseNamespace();\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst logger = new Logger('@firebase/app-compat');\nconst name = \"@firebase/app-compat\";\nconst version = \"0.2.35\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction registerCoreComponents(variant) {\n // Register `app` package.\n registerVersion(name, version, variant);\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n// Firebase Lite detection\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nif (isBrowser() && self.firebase !== undefined) {\n logger.warn(`\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n `);\n // eslint-disable-next-line\n const sdkVersion = self.firebase.SDK_VERSION;\n if (sdkVersion && sdkVersion.indexOf('LITE') >= 0) {\n logger.warn(`\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n `);\n }\n}\nconst firebase = firebase$1;\nregisterCoreComponents();\nexport { firebase as default };\n"],"mappings":"mOA0KA,SAASA,EAA4BC,EAAiB,CACpD,IAAMC,EAAO,CAAC,EAIRC,EAAY,CAIhB,WAAY,GACZ,cAAeC,EAEf,IAAAC,EACA,gBAA6BC,EAC7B,YAAyBC,EACzB,MAAmBC,EAEnB,KAAM,KACN,YAAyBC,EACzB,SAAU,CACR,kBAAmBC,EACnB,UAAAC,EACA,aAAAC,EACA,YAAAC,CACF,CACF,EAYAV,EAAU,QAAaA,EAEvB,OAAO,eAAeA,EAAW,OAAQ,CACvC,IAAKW,CACP,CAAC,EAKD,SAASH,EAAUI,EAAM,CACvB,OAAOb,EAAKa,CAAI,CAClB,CAIA,SAASV,EAAIU,EAAM,CAEjB,GADAA,EAAOA,GAAoBC,EACvB,CAACC,EAASf,EAAMa,CAAI,EACtB,MAAMG,EAAc,OAAO,SAAgC,CACzD,QAASH,CACX,CAAC,EAEH,OAAOb,EAAKa,CAAI,CAClB,CAEAV,EAAI,IAASJ,EAMb,SAASG,EAAoBe,EAASC,EAAY,CAAC,EAAG,CACpD,IAAMf,EAAkBgB,EAAcF,EAASC,CAAS,EACxD,GAA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AAE,cAAcqC,CAAkB,CACrD,CAKA,cAAc7B,EAAW,CACvBwB,EAAc,KAAK,UAAWxB,CAAS,CACzC,CACA,yBAAyBA,EAAW,CAClCgC,EAAyB,KAAK,UAAWhC,CAAS,CACpD,CACA,QAAS,CACP,MAAO,CACL,KAAM,KAAK,KACX,+BAAgC,KAAK,+BACrC,QAAS,KAAK,OAChB,CACF,CACF,EAwBMiB,EAAS,CACZ,SAAiC,oFACjC,uBAA6D,4EAChE,EACMtB,EAAgB,IAAIiB,EAAa,aAAc,WAAYK,CAAM,EA2MjEC,EAAaV,EAAwB,EAkBrCW,EAAS,IAAIc,EAAO,sBAAsB,EAC1CzC,EAAO,uBACPwB,EAAU,SAyChB,GAAIkB,EAAU,GAAK,KAAK,WAAa,OAAW,CAC9Cf,EAAO,KAAK;AAAA;AAAA;AAAA,GAGX,EAED,IAAMgB,EAAa,KAAK,SAAS,YAC7BA,GAAcA,EAAW,QAAQ,MAAM,GAAK,GAC9ChB,EAAO,KAAK;AAAA;AAAA;AAAA,KAGX,CAEL,CACMC,EAAWF,EACjBJ,EAAuB","names":["createFirebaseNamespaceCore","firebaseAppImpl","apps","namespace","initializeAppCompat","app","registerVersion","setLogLevel","onLog","SDK_VERSION","registerComponentCompat","removeApp","useAsService","index_esm2017_exports","getApps","name","DEFAULT_ENTRY_NAME","contains","ERROR_FACTORY","options","rawConfig","initializeApp","appCompat","component","componentName","componentNameWithoutCompat","_registerComponent","serviceNamespace","appArg","deepExtend","args","createFirebaseNamespace","FirebaseAppImpl","extendNamespace","createSubscribe","ErrorFactory","props","registerCoreComponents","variant","version","ERRORS","firebase$1","logger","firebase","init_index_esm2017","__esmMin","_delegate","_addComponent","Component","val","resolve","deleteApp","instanceIdentifier","_a","provider","_addOrOverwriteComponent","Logger","isBrowser","sdkVersion"],"x_google_ignoreList":[0]}