UNPKG

firebase

Version:

Firebase JavaScript library for web and Node.js

1 lines • 177 kB
import{_isFirebaseServerApp as e,SDK_VERSION as t,_getProvider,_registerComponent as r,registerVersion as n,getApp as i}from"https://www.gstatic.com/firebasejs/10.12.2/firebase-app.js";var extendStatics=function(e,t){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},extendStatics(e,t)};function __extends(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function __(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}var __assign=function(){return __assign=Object.assign||function __assign(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __rest(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function __awaiter(e,t,r,n){return new(r||(r=Promise))((function(i,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n.throw(e))}catch(e){o(e)}}function step(e){e.done?i(e.value):function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))}function __generator(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function verb(o){return function(a){return function step(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}const o={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const i=e[t],o=t+1<e.length,s=o?e[t+1]:0,a=t+2<e.length,u=a?e[t+2]:0,c=i>>2,d=(3&i)<<4|s>>4;let l=(15&s)<<2|u>>6,h=63&u;a||(h=64,o||(l=64)),n.push(r[c],r[d],r[l],r[h])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){const o=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){const o=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(o>>10)),t[n++]=String.fromCharCode(56320+(1023&o))}else{const o=e[r++],s=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const i=r[e.charAt(t++)],o=t<e.length?r[e.charAt(t)]:0;++t;const s=t<e.length?r[e.charAt(t)]:64;++t;const a=t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==o||null==s||null==a)throw new DecodeBase64StringError;const u=i<<2|o>>4;if(n.push(u),64!==s){const e=o<<4&240|s>>2;if(n.push(e),64!==a){const e=s<<6&192|a;n.push(e)}}}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class DecodeBase64StringError extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}function getUA(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class FirebaseError extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,FirebaseError.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ErrorFactory.prototype.create)}}class ErrorFactory{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],o=i?function replaceTemplate(e,t){return e.replace(s,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(i,r):"Error",a=`${this.serviceName}: ${o} (${n}).`;return new FirebaseError(n,a,r)}}const s=/\{\$([^}]+)}/g;function deepEqual(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const i of r){if(!n.includes(i))return!1;const r=e[i],o=t[i];if(isObject(r)&&isObject(o)){if(!deepEqual(r,o))return!1}else if(r!==o)return!1}for(const e of n)if(!r.includes(e))return!1;return!0}function isObject(e){return null!==e&&"object"==typeof e}function querystring(e){const t=[];for(const[r,n]of Object.entries(e))Array.isArray(n)?n.forEach((e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function querystringDecode(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}})),t}function extractQuerystring(e){const t=e.indexOf("?");if(!t)return"";const r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}class ObserverProxy{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");n=function implementsAnyMethods(e,t){if("object"!=typeof e||null===e)return!1;for(const r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r},void 0===n.next&&(n.next=noop),void 0===n.error&&(n.error=noop),void 0===n.complete&&(n.complete=noop);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}})),this.observers.push(n),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function noop(){}function getModularInstance(e){return e&&e._delegate?e._delegate:e}class Component{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}var a;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(a||(a={}));const u={debug:a.DEBUG,verbose:a.VERBOSE,info:a.INFO,warn:a.WARN,error:a.ERROR,silent:a.SILENT},c=a.INFO,d={[a.DEBUG]:"log",[a.VERBOSE]:"log",[a.INFO]:"info",[a.WARN]:"warn",[a.ERROR]:"error"},defaultLogHandler=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),i=d[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)};function _allSettled(e){var t=this;return Promise.all(e.map((function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e];case 1:return[2,{fulfilled:!0,value:t.sent()}];case 2:return[2,{fulfilled:!1,reason:t.sent()}];case 3:return[2]}}))}))})))}var l=function(){function Receiver(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}return Receiver._getInstance=function(e){var t=this.receivers.find((function(t){return t.isListeningto(e)}));if(t)return t;var r=new Receiver(e);return this.receivers.push(r),r},Receiver.prototype.isListeningto=function(e){return this.eventTarget===e},Receiver.prototype.handleEvent=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n,i,o,s,a,u=this;return __generator(this,(function(c){switch(c.label){case 0:return r=(t=e).data,n=r.eventId,i=r.eventType,o=r.data,(null==(s=this.handlersMap[i])?void 0:s.size)?(t.ports[0].postMessage({status:"ack",eventId:n,eventType:i}),[4,_allSettled(Array.from(s).map((function(e){return __awaiter(u,void 0,void 0,(function(){return __generator(this,(function(r){return[2,e(t.origin,o)]}))}))})))]):[2];case 1:return a=c.sent(),t.ports[0].postMessage({status:"done",eventId:n,eventType:i,response:a}),[2]}}))}))},Receiver.prototype._subscribe=function(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)},Receiver.prototype._unsubscribe=function(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)},Receiver.receivers=[],Receiver}();function _generateEventId(e,t){void 0===e&&(e=""),void 0===t&&(t=10);for(var r="",n=0;n<t;n++)r+=Math.floor(10*Math.random());return e+r}var h=function(){function Sender(e){this.target=e,this.handlers=new Set}return Sender.prototype.removeMessageHandler=function(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)},Sender.prototype._send=function(e,t,r){return void 0===r&&(r=50),__awaiter(this,void 0,void 0,(function(){var n,i,o,s=this;return __generator(this,(function(a){if(!(n="undefined"!=typeof MessageChannel?new MessageChannel:null))throw new Error("connection_unavailable");return[2,new Promise((function(a,u){var c=_generateEventId("",20);n.port1.start();var d=setTimeout((function(){u(new Error("unsupported_event"))}),r);o={messageChannel:n,onMessage:function(e){var t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(d),i=setTimeout((function(){u(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),a(t.data.response);break;default:clearTimeout(d),clearTimeout(i),u(new Error("invalid_response"))}}},s.handlers.add(o),n.port1.addEventListener("message",o.onMessage),s.target.postMessage({eventType:e,eventId:c,data:t},[n.port2])})).finally((function(){o&&s.removeMessageHandler(o)}))]}))}))},Sender}();function _window(){return window}function _isWorker(){return void 0!==_window().WorkerGlobalScope&&"function"==typeof _window().importScripts}function _getActiveServiceWorker(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return[2,null];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,navigator.serviceWorker.ready];case 2:return[2,e.sent().active];case 3:return e.sent(),[2,null];case 4:return[2]}}))}))}var p="firebaseLocalStorageDb",f=function(){function DBPromise(e){this.request=e}return DBPromise.prototype.toPromise=function(){var e=this;return new Promise((function(t,r){e.request.addEventListener("success",(function(){t(e.request.result)})),e.request.addEventListener("error",(function(){r(e.request.error)}))}))},DBPromise}();function getObjectStore(e,t){return e.transaction(["firebaseLocalStorage"],t?"readwrite":"readonly").objectStore("firebaseLocalStorage")}function _deleteDatabase(){var e=indexedDB.deleteDatabase(p);return new f(e).toPromise()}function _openDatabase(){var e=this,t=indexedDB.open(p,1);return new Promise((function(r,n){t.addEventListener("error",(function(){n(t.error)})),t.addEventListener("upgradeneeded",(function(){var e=t.result;try{e.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(e){n(e)}})),t.addEventListener("success",(function(){return __awaiter(e,void 0,void 0,(function(){var e,n;return __generator(this,(function(i){switch(i.label){case 0:return(e=t.result).objectStoreNames.contains("firebaseLocalStorage")?[3,3]:(e.close(),[4,_deleteDatabase()]);case 1:return i.sent(),n=r,[4,_openDatabase()];case 2:return n.apply(void 0,[i.sent()]),[3,4];case 3:r(e),i.label=4;case 4:return[2]}}))}))}))}))}function _putObject(e,t,r){return __awaiter(this,void 0,void 0,(function(){var n,i;return __generator(this,(function(o){return n=getObjectStore(e,!0).put(((i={}).fbase_key=t,i.value=r,i)),[2,new f(n).toPromise()]}))}))}function _deleteObject(e,t){var r=getObjectStore(e,!0).delete(t);return new f(r).toPromise()}var _=function(){function IndexedDBLocalPersistence(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((function(){}),(function(){}))}return IndexedDBLocalPersistence.prototype._openDb=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return this.db?[2,this.db]:(e=this,[4,_openDatabase()]);case 1:return e.db=t.sent(),[2,this.db]}}))}))},IndexedDBLocalPersistence.prototype._withRetries=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n;return __generator(this,(function(i){switch(i.label){case 0:t=0,i.label=1;case 1:i.label=2;case 2:return i.trys.push([2,5,,6]),[4,this._openDb()];case 3:return r=i.sent(),[4,e(r)];case 4:return[2,i.sent()];case 5:if(n=i.sent(),t++>3)throw n;return this.db&&(this.db.close(),this.db=void 0),[3,6];case 6:return[3,1];case 7:return[2]}}))}))},IndexedDBLocalPersistence.prototype.initializeServiceWorkerMessaging=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,_isWorker()?this.initializeReceiver():this.initializeSender()]}))}))},IndexedDBLocalPersistence.prototype.initializeReceiver=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){return this.receiver=l._getInstance(function _getWorkerGlobalScope(){return _isWorker()?self:null}()),this.receiver._subscribe("keyChanged",(function(t,r){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this._poll()];case 1:return[2,{keyProcessed:e.sent().includes(r.key)}]}}))}))})),this.receiver._subscribe("ping",(function(t,r){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){return[2,["keyChanged"]]}))}))})),[2]}))}))},IndexedDBLocalPersistence.prototype.initializeSender=function(){var e,t;return __awaiter(this,void 0,void 0,(function(){var r,n;return __generator(this,(function(i){switch(i.label){case 0:return r=this,[4,_getActiveServiceWorker()];case 1:return r.activeServiceWorker=i.sent(),this.activeServiceWorker?(this.sender=new h(this.activeServiceWorker),[4,this.sender._send("ping",{},800)]):[2];case 2:return(n=i.sent())?((null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0),[2]):[2]}}))}))},IndexedDBLocalPersistence.prototype.notifyServiceWorker=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.sender||!this.activeServiceWorker||function _getServiceWorkerController(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()!==this.activeServiceWorker)return[2];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)];case 2:case 3:return t.sent(),[3,4];case 4:return[2]}}))}))},IndexedDBLocalPersistence.prototype._isAvailable=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),indexedDB?[4,_openDatabase()]:[2,!1];case 1:return[4,_putObject(e=t.sent(),"__sak","1")];case 2:return t.sent(),[4,_deleteObject(e,"__sak")];case 3:return t.sent(),[2,!0];case 4:return t.sent(),[3,5];case 5:return[2,!1]}}))}))},IndexedDBLocalPersistence.prototype._withPendingWrite=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:this.pendingWrites++,t.label=1;case 1:return t.trys.push([1,,3,4]),[4,e()];case 2:return t.sent(),[3,4];case 3:return this.pendingWrites--,[7];case 4:return[2]}}))}))},IndexedDBLocalPersistence.prototype._set=function(e,t){return __awaiter(this,void 0,void 0,(function(){var r=this;return __generator(this,(function(n){return[2,this._withPendingWrite((function(){return __awaiter(r,void 0,void 0,(function(){return __generator(this,(function(r){switch(r.label){case 0:return[4,this._withRetries((function(r){return _putObject(r,e,t)}))];case 1:return r.sent(),this.localCache[e]=t,[2,this.notifyServiceWorker(e)]}}))}))}))]}))}))},IndexedDBLocalPersistence.prototype._get=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:return[4,this._withRetries((function(t){return function getObject(e,t){return __awaiter(this,void 0,void 0,(function(){var r,n;return __generator(this,(function(i){switch(i.label){case 0:return r=getObjectStore(e,!1).get(t),[4,new f(r).toPromise()];case 1:return[2,void 0===(n=i.sent())?null:n.value]}}))}))}(t,e)}))];case 1:return t=r.sent(),this.localCache[e]=t,[2,t]}}))}))},IndexedDBLocalPersistence.prototype._remove=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){return[2,this._withPendingWrite((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this._withRetries((function(t){return _deleteObject(t,e)}))];case 1:return t.sent(),delete this.localCache[e],[2,this.notifyServiceWorker(e)]}}))}))}))]}))}))},IndexedDBLocalPersistence.prototype._poll=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,r,n,i,o,s,a,u,c,d;return __generator(this,(function(l){switch(l.label){case 0:return[4,this._withRetries((function(e){var t=getObjectStore(e,!1).getAll();return new f(t).toPromise()}))];case 1:if(!(e=l.sent()))return[2,[]];if(0!==this.pendingWrites)return[2,[]];if(t=[],r=new Set,0!==e.length)for(n=0,i=e;n<i.length;n++)o=i[n],s=o.fbase_key,a=o.value,r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(a)&&(this.notifyListeners(s,a),t.push(s));for(u=0,c=Object.keys(this.localCache);u<c.length;u++)d=c[u],this.localCache[d]&&!r.has(d)&&(this.notifyListeners(d,null),t.push(d));return[2,t]}}))}))},IndexedDBLocalPersistence.prototype.notifyListeners=function(e,t){this.localCache[e]=t;var r=this.listeners[e];if(r)for(var n=0,i=Array.from(r);n<i.length;n++){(0,i[n])(t)}},IndexedDBLocalPersistence.prototype.startPolling=function(){var e=this;this.stopPolling(),this.pollTimer=setInterval((function(){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this._poll()]}))}))}),800)},IndexedDBLocalPersistence.prototype.stopPolling=function(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)},IndexedDBLocalPersistence.prototype._addListener=function(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)},IndexedDBLocalPersistence.prototype._removeListener=function(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()},IndexedDBLocalPersistence.type="LOCAL",IndexedDBLocalPersistence}(),v=_;function _prodErrorMap(){var e;return(e={})["dependent-sdk-initialized-before-auth"]="Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK.",e}var g=function _debugErrorMap(){var e;return(e={})["admin-restricted-operation"]="This operation is restricted to administrators only.",e["argument-error"]="",e["app-not-authorized"]="This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.",e["app-not-installed"]="The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.",e["captcha-check-failed"]="The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.",e["code-expired"]="The SMS code has expired. Please re-send the verification code to try again.",e["cordova-not-ready"]="Cordova framework is not ready.",e["cors-unsupported"]="This browser is not supported.",e["credential-already-in-use"]="This credential is already associated with a different user account.",e["custom-token-mismatch"]="The custom token corresponds to a different audience.",e["requires-recent-login"]="This operation is sensitive and requires recent authentication. Log in again before retrying this request.",e["dependent-sdk-initialized-before-auth"]="Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK.",e["dynamic-link-not-activated"]="Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.",e["email-change-needs-verification"]="Multi-factor users must always have a verified email.",e["email-already-in-use"]="The email address is already in use by another account.",e["emulator-config-failed"]='Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',e["expired-action-code"]="The action code has expired.",e["cancelled-popup-request"]="This operation has been cancelled due to another conflicting popup being opened.",e["internal-error"]="An internal AuthError has occurred.",e["invalid-app-credential"]="The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.",e["invalid-app-id"]="The mobile app identifier is not registed for the current project.",e["invalid-user-token"]="This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.",e["invalid-auth-event"]="An internal AuthError has occurred.",e["invalid-verification-code"]="The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.",e["invalid-continue-uri"]="The continue URL provided in the request is invalid.",e["invalid-cordova-configuration"]="The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.",e["invalid-custom-token"]="The custom token format is incorrect. Please check the documentation.",e["invalid-dynamic-link-domain"]="The provided dynamic link domain is not configured or authorized for the current project.",e["invalid-email"]="The email address is badly formatted.",e["invalid-emulator-scheme"]="Emulator URL must start with a valid scheme (http:// or https://).",e["invalid-api-key"]="Your API key is invalid, please check you have copied it correctly.",e["invalid-cert-hash"]="The SHA-1 certificate hash provided is invalid.",e["invalid-credential"]="The supplied auth credential is incorrect, malformed or has expired.",e["invalid-message-payload"]="The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.",e["invalid-multi-factor-session"]="The request does not contain a valid proof of first factor successful sign-in.",e["invalid-oauth-provider"]="EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.",e["invalid-oauth-client-id"]="The OAuth client ID provided is either invalid or does not match the specified API key.",e["unauthorized-domain"]="This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.",e["invalid-action-code"]="The action code is invalid. This can happen if the code is malformed, expired, or has already been used.",e["wrong-password"]="The password is invalid or the user does not have a password.",e["invalid-persistence-type"]="The specified persistence type is invalid. It can only be local, session or none.",e["invalid-phone-number"]="The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].",e["invalid-provider-id"]="The specified provider ID is invalid.",e["invalid-recipient-email"]="The email corresponding to this action failed to send as the provided recipient email address is invalid.",e["invalid-sender"]="The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.",e["invalid-verification-id"]="The verification ID used to create the phone auth credential is invalid.",e["invalid-tenant-id"]="The Auth instance's tenant ID is invalid.",e["login-blocked"]="Login blocked by user-provided method: {$originalMessage}",e["missing-android-pkg-name"]="An Android Package Name must be provided if the Android App is required to be installed.",e["auth-domain-config-required"]="Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.",e["missing-app-credential"]="The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.",e["missing-verification-code"]="The phone auth credential was created with an empty SMS verification code.",e["missing-continue-uri"]="A continue URL must be provided in the request.",e["missing-iframe-start"]="An internal AuthError has occurred.",e["missing-ios-bundle-id"]="An iOS Bundle ID must be provided if an App Store ID is provided.",e["missing-or-invalid-nonce"]="The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.",e["missing-password"]="A non-empty password must be provided",e["missing-multi-factor-info"]="No second factor identifier is provided.",e["missing-multi-factor-session"]="The request is missing proof of first factor successful sign-in.",e["missing-phone-number"]="To send verification codes, provide a phone number for the recipient.",e["missing-verification-id"]="The phone auth credential was created with an empty verification ID.",e["app-deleted"]="This instance of FirebaseApp has been deleted.",e["multi-factor-info-not-found"]="The user does not have a second factor matching the identifier provided.",e["multi-factor-auth-required"]="Proof of ownership of a second factor is required to complete sign-in.",e["account-exists-with-different-credential"]="An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.",e["network-request-failed"]="A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.",e["no-auth-event"]="An internal AuthError has occurred.",e["no-such-provider"]="User was not linked to an account with the given provider.",e["null-user"]="A null user object was provided as the argument for an operation which requires a non-null user object.",e["operation-not-allowed"]="The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.",e["operation-not-supported-in-this-environment"]='This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',e["popup-blocked"]="Unable to establish a connection with the popup. It may have been blocked by the browser.",e["popup-closed-by-user"]="The popup has been closed by the user before finalizing the operation.",e["provider-already-linked"]="User can only be linked to one identity for the given provider.",e["quota-exceeded"]="The project's quota for this operation has been exceeded.",e["redirect-cancelled-by-user"]="The redirect operation has been cancelled by the user before finalizing.",e["redirect-operation-pending"]="A redirect sign-in operation is already pending.",e["rejected-credential"]="The request contains malformed or mismatching credentials.",e["second-factor-already-in-use"]="The second factor is already enrolled on this account.",e["maximum-second-factor-count-exceeded"]="The maximum allowed number of second factors on a user has been exceeded.",e["tenant-id-mismatch"]="The provided tenant ID does not match the Auth instance's tenant ID",e.timeout="The operation has timed out.",e["user-token-expired"]="The user's credential is no longer valid. The user must sign in again.",e["too-many-requests"]="We have blocked all requests from this device due to unusual activity. Try again later.",e["unauthorized-continue-uri"]="The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.",e["unsupported-first-factor"]="Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.",e["unsupported-persistence-type"]="The current environment does not support the specified persistence type.",e["unsupported-tenant-operation"]="This operation is not supported in a multi-tenant context.",e["unverified-email"]="The operation requires a verified email.",e["user-cancelled"]="The user did not grant your application the permissions it requested.",e["user-not-found"]="There is no user record corresponding to this identifier. The user may have been deleted.",e["user-disabled"]="The user account has been disabled by an administrator.",e["user-mismatch"]="The supplied credentials do not correspond to the previously signed in user.",e["user-signed-out"]="",e["weak-password"]="The password must be 6 characters long or more.",e["web-storage-unsupported"]="This browser is not supported or 3rd party cookies and data may be disabled.",e["already-initialized"]="initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.",e["missing-recaptcha-token"]="The reCAPTCHA token is missing when sending request to the backend.",e["invalid-recaptcha-token"]="The reCAPTCHA token is invalid when sending request to the backend.",e["invalid-recaptcha-action"]="The reCAPTCHA action is invalid when sending request to the backend.",e["recaptcha-not-enabled"]="reCAPTCHA Enterprise integration is not enabled for this project.",e["missing-client-type"]="The reCAPTCHA client type is missing when sending request to the backend.",e["missing-recaptcha-version"]="The reCAPTCHA version is missing when sending request to the backend.",e["invalid-req-type"]="Invalid request parameters.",e["invalid-recaptcha-version"]="The reCAPTCHA version is invalid when sending request to the backend.",e["unsupported-password-policy-schema-version"]="The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.",e["password-does-not-meet-requirements"]="The password does not meet the requirements.",e},m=_prodErrorMap,I=new ErrorFactory("auth","Firebase",_prodErrorMap()),A={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type"},y=new class Logger{constructor(e){this.name=e,this._logLevel=c,this._logHandler=defaultLogHandler,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in a))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?u[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,a.DEBUG,...e),this._logHandler(this,a.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,a.VERBOSE,...e),this._logHandler(this,a.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,a.INFO,...e),this._logHandler(this,a.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,a.WARN,...e),this._logHandler(this,a.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,a.ERROR,...e),this._logHandler(this,a.ERROR,...e)}}("@firebase/auth");function _logError(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];y.logLevel<=a.ERROR&&y.error.apply(y,__spreadArray(["Auth (".concat(t,"): ").concat(e)],r,!1))}function _fail(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];throw createErrorInternal.apply(void 0,__spreadArray([e],t,!1))}function _createError(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return createErrorInternal.apply(void 0,__spreadArray([e],t,!1))}function _errorWithCustomMessage(e,t,r){var n,i=__assign(__assign({},m()),((n={})[t]=r,n));return new ErrorFactory("auth","Firebase",i).create(t,{appName:e.name})}function _serverAppCurrentUserOperationNotSupportedError(e){return _errorWithCustomMessage(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function _assertInstanceOf(e,t,r){if(!(t instanceof r))throw r.name!==t.constructor.name&&_fail(e,"argument-error"),_errorWithCustomMessage(e,"argument-error","Type of ".concat(t.constructor.name," does not match expected instance.")+"Did you pass a reference from a different Auth SDK?")}function createErrorInternal(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("string"!=typeof e){var i=r[0],o=__spreadArray([],r.slice(1),!0);return o[0]&&(o[0].appName=e.name),(t=e._errorFactory).create.apply(t,__spreadArray([i],o,!1))}return I.create.apply(I,__spreadArray([e],r,!1))}function _assert(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!e)throw createErrorInternal.apply(void 0,__spreadArray([t],r,!1))}function debugFail(e){var t="INTERNAL ASSERTION FAILED: "+e;throw _logError(t),new Error(t)}function debugAssert(e,t){e||debugFail(t)}function _getCurrentUrl(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function _isHttpOrHttps(){return"http:"===_getCurrentScheme()||"https:"===_getCurrentScheme()}function _getCurrentScheme(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function _isOnline(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(_isHttpOrHttps()||function isBrowserExtension(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()||"connection"in navigator))||navigator.onLine}var E=function(){function Delay(e,t){this.shortDelay=e,this.longDelay=t,debugAssert(t>e,"Short delay should be less than long delay!"),this.isMobile=function isMobileCordova(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(getUA())}()||function isReactNative(){return"object"==typeof navigator&&"ReactNative"===navigator.product}()}return Delay.prototype.get=function(){return _isOnline()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)},Delay}();function _emulatorUrl(e,t){debugAssert(e.emulator,"Emulator should always be set here");var r=e.emulator.url;return t?"".concat(r).concat(t.startsWith("/")?t.slice(1):t):r}var w,T=function(){function FetchProvider(){}return FetchProvider.initialize=function(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)},FetchProvider.fetch=function(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void debugFail("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")},FetchProvider.headers=function(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void debugFail("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")},FetchProvider.response=function(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void debugFail("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")},FetchProvider}(),b=((w={}).CREDENTIAL_MISMATCH="custom-token-mismatch",w.MISSING_CUSTOM_TOKEN="internal-error",w.INVALID_IDENTIFIER="invalid-email",w.MISSING_CONTINUE_URI="internal-error",w.INVALID_PASSWORD="wrong-password",w.MISSING_PASSWORD="missing-password",w.INVALID_LOGIN_CREDENTIALS="invalid-credential",w.EMAIL_EXISTS="email-already-in-use",w.PASSWORD_LOGIN_DISABLED="operation-not-allowed",w.INVALID_IDP_RESPONSE="invalid-credential",w.INVALID_PENDING_TOKEN="invalid-credential",w.FEDERATED_USER_ID_ALREADY_LINKED="credential-already-in-use",w.MISSING_REQ_TYPE="internal-error",w.EMAIL_NOT_FOUND="user-not-found",w.RESET_PASSWORD_EXCEED_LIMIT="too-many-requests",w.EXPIRED_OOB_CODE="expired-action-code",w.INVALID_OOB_CODE="invalid-action-code",w.MISSING_OOB_CODE="internal-error",w.CREDENTIAL_TOO_OLD_LOGIN_AGAIN="requires-recent-login",w.INVALID_ID_TOKEN="invalid-user-token",w.TOKEN_EXPIRED="user-token-expired",w.USER_NOT_FOUND="user-token-expired",w.TOO_MANY_ATTEMPTS_TRY_LATER="too-many-requests",w.PASSWORD_DOES_NOT_MEET_REQUIREMENTS="password-does-not-meet-requirements",w.INVALID_CODE="invalid-verification-code",w.INVALID_SESSION_INFO="invalid-verification-id",w.INVALID_TEMPORARY_PROOF="invalid-credential",w.MISSING_SESSION_INFO="missing-verification-id",w.SESSION_EXPIRED="code-expired",w.MISSING_ANDROID_PACKAGE_NAME="missing-android-pkg-name",w.UNAUTHORIZED_DOMAIN="unauthorized-continue-uri",w.INVALID_OAUTH_CLIENT_ID="invalid-oauth-client-id",w.ADMIN_ONLY_OPERATION="admin-restricted-operation",w.INVALID_MFA_PENDING_CREDENTIAL="invalid-multi-factor-session",w.MFA_ENROLLMENT_NOT_FOUND="multi-factor-info-not-found",w.MISSING_MFA_ENROLLMENT_ID="missing-multi-factor-info",w.MISSING_MFA_PENDING_CREDENTIAL="missing-multi-factor-session",w.SECOND_FACTOR_EXISTS="second-factor-already-in-use",w.SECOND_FACTOR_LIMIT_EXCEEDED="maximum-second-factor-count-exceeded",w.BLOCKING_FUNCTION_ERROR_RESPONSE="internal-error",w.RECAPTCHA_NOT_ENABLED="recaptcha-not-enabled",w.MISSING_RECAPTCHA_TOKEN="missing-recaptcha-token",w.INVALID_RECAPTCHA_TOKEN="invalid-recaptcha-token",w.INVALID_RECAPTCHA_ACTION="invalid-recaptcha-action",w.MISSING_CLIENT_TYPE="missing-client-type",w.MISSING_RECAPTCHA_VERSION="missing-recaptcha-version",w.INVALID_RECAPTCHA_VERSION="invalid-recaptcha-version",w.INVALID_REQ_TYPE="invalid-req-type",w),P=new E(3e4,6e4);function _addTidIfNecessary(e,t){return e.tenantId&&!t.tenantId?__assign(__assign({},t),{tenantId:e.tenantId}):t}function _performApiRequest(e,t,r,n,i){return void 0===i&&(i={}),__awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(s){return[2,_performFetchWithErrorHandling(e,i,(function(){return __awaiter(o,void 0,void 0,(function(){var i,o,s,a;return __generator(this,(function(u){switch(u.label){case 0:return i={},o={},n&&("GET"===t?o=n:i={body:JSON.stringify(n)}),s=querystring(__assign({key:e.config.apiKey},o)).slice(1),[4,e._getAdditionalHeaders()];case 1:return(a=u.sent())["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),[2,T.fetch()(_getFinalTarget(e,e.config.apiHost,r,s),__assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))]}}))}))}))]}))}))}function _performFetchWithErrorHandling(e,t,r){return __awaiter(this,void 0,void 0,(function(){var n,i,o,s,a,u,c,d,l,h;return __generator(this,(function(p){switch(p.label){case 0:e._canInitEmulator=!1,n=__assign(__assign({},b),t),p.label=1;case 1:return p.trys.push([1,4,,5]),i=new S(e),[4,Promise.race([r(),i.promise])];case 2:return o=p.sent(),i.clearNetworkTimeout(),[4,o.json()];case 3:if("needConfirmation"in(s=p.sent()))throw _makeTaggedError(e,"account-exists-with-different-credential",s);if(o.ok&&!("errorMessage"in s))return[2,s];if(a=o.ok?s.errorMessage:s.error.message,u=a.split(" : "),c=u[0],d=u[1],"FEDERATED_USER_ID_ALREA