@firebase/auth-compat 0.5.18-canary.70e08cf95 → 0.5.18-canary.84dfeca39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/firebase-auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)})(this,function(xn,jn){try{!function(){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var F=t(xn);let V={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(i,e){if(!Array.isArray(i))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let r=0;r<i.length;r+=3){var a=i[r],o=r+1<i.length,l=o?i[r+1]:0,c=r+2<i.length,d=c?i[r+2]:0;let e=(15&l)<<2|d>>6,t=63&d;c||(t=64,o)||(e=64),s.push(n[a>>2],n[(3&a)<<4|l>>4],n[e],n[t])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray((r=>{var i=[];let n=0;for(let t=0;t<r.length;t++){let e=r.charCodeAt(t);e<128?i[n++]=e:(e<2048?i[n++]=e>>6|192:(55296==(64512&e)&&t+1<r.length&&56320==(64512&r.charCodeAt(t+1))?(e=65536+((1023&e)<<10)+(1023&r.charCodeAt(++t)),i[n++]=e>>18|240,i[n++]=e>>12&63|128):i[n++]=e>>12|224,i[n++]=e>>6&63|128),i[n++]=63&e|128)}return i})(e),t)},decodeString(r,i){if(this.HAS_NATIVE_SUPPORT&&!i)return atob(r);{var n=this.decodeStringToByteArray(r,i);var s=[];let e=0,t=0;for(;e<n.length;){var a,o,l,c=n[e++];c<128?s[t++]=String.fromCharCode(c):191<c&&c<224?(a=n[e++],s[t++]=String.fromCharCode((31&c)<<6|63&a)):239<c&&c<365?(a=((7&c)<<18|(63&n[e++])<<12|(63&n[e++])<<6|63&n[e++])-65536,s[t++]=String.fromCharCode(55296+(a>>10)),s[t++]=String.fromCharCode(56320+(1023&a))):(o=n[e++],l=n[e++],s[t++]=String.fromCharCode((15&c)<<12|(63&o)<<6|63&l))}return s.join("");return}},decodeStringToByteArray(t,e){this.init_();var r=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let e=0;e<t.length;){var n=r[t.charAt(e++)],s=e<t.length?r[t.charAt(e)]:0,a=++e<t.length?r[t.charAt(e)]:64,o=++e<t.length?r[t.charAt(e)]:64;if(++e,null==n||null==s||null==a||null==o)throw new x;i.push(n<<2|s>>4),64!==a&&(i.push(s<<4&240|a>>2),64!==o)&&i.push(a<<6&192|o)}return i},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)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class x extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let j=function(e){try{return V.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};let H=()=>(()=>{if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")})().__FIREBASE_DEFAULTS__,W=()=>{var e;return"undefined"!=typeof process&&void 0!==process.env&&(e=process.env.__FIREBASE_DEFAULTS__)?JSON.parse(e):void 0},q=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&j(e[1]);return t&&JSON.parse(t)}},B=()=>{try{return H()||W()||q()}catch(e){console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}};var i;function l(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function z(){var e=null==(e=B())?void 0:e.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function G(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function K(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function J(){var e=l();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function Y(){try{return"object"==typeof indexedDB}catch(e){return!1}}class c extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,c.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,$.prototype.create)}}class ${constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var i,t=t[0]||{},r=this.service+"/"+e,e=this.errors[e],e=e?(i=t,e.replace(X,(e,t)=>{var r=i[t];return null!=r?String(r):`<${t}?>`})):"Error",e=this.serviceName+`: ${e} (${r}).`;return new c(r,e,t)}}let X=/\{\$([^}]+)}/g;function Q(r){let i=[];for(let[t,e]of Object.entries(r))Array.isArray(e)?e.forEach(e=>{i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}):i.push(encodeURIComponent(t)+"="+encodeURIComponent(e));return i.length?"&"+i.join("&"):""}function Z(e){let r={};return e.replace(/^\?/,"").split("&").forEach(e=>{var t;e&&([e,t]=e.split("="),r[decodeURIComponent(e)]=decodeURIComponent(t))}),r}function ee(e){var t,r=e.indexOf("?");return r?(t=e.indexOf("#",r),e.substring(r,0<t?t:void 0)):""}class te{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(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");void 0===(i=((e,t)=>{if("object"==typeof e&&null!==e)for(var r of t)if(r in e&&"function"==typeof e[r])return 1})(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&&(i.next=re),void 0===i.error&&(i.error=re),void 0===i.complete&&(i.complete=re);e=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}}),this.observers.push(i),e}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount)&&void 0!==this.onNoObservers&&this.onNoObservers(this)}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}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 re(){}function s(e){return e&&e._delegate?e._delegate:e}(e=i=i||{})[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";let ie={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},ne=i.INFO,se={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},ae=(e,t,...r)=>{if(!(t<e.logLevel)){var i=(new Date).toISOString(),n=se[t];if(!n)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[n](`[${i}] ${e.name}:`,...r)}};function oe(e,t){var r={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,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}class le{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}}let ce={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},de={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};function ue(){return{"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."}}function he(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","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.","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.","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.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","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.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","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.","invalid-auth-event":"An internal AuthError has occurred.","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.","invalid-continue-uri":"The continue URL provided in the request is invalid.","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.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","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.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","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].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","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.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","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.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","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.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","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.","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.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","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.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","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.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}let pe=ue,me=new $("auth","Firebase",ue()),ge=new class{constructor(e){this.name=e,this._logLevel=ne,this._logHandler=ae,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?ie[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,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}("@firebase/auth");function fe(e,...t){ge.logLevel<=i.ERROR&&ge.error(`Auth (${jn.SDK_VERSION}): `+e,...t)}function d(e,...t){throw ye(e,...t)}function u(e,...t){return ye(e,...t)}function ve(e,t,r){r=Object.assign(Object.assign({},pe()),{[t]:r});return new $("auth","Firebase",r).create(t,{appName:e.name})}function h(e){return ve(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function _e(e,t,r){if(!(t instanceof r))throw r.name!==t.constructor.name&&d(e,"argument-error"),ve(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.`+"Did you pass a reference from a different Auth SDK?")}function ye(e,...t){var r,i;return"string"!=typeof e?(r=t[0],(i=[...t.slice(1)])[0]&&(i[0].appName=e.name),e._errorFactory.create(r,...i)):me.create(e,...t)}function m(e,t,...r){if(!e)throw ye(t,...r)}function n(e){e="INTERNAL ASSERTION FAILED: "+e;throw fe(e),new Error(e)}function a(e,t){e||n(t)}function Ie(){var e;return"undefined"!=typeof self&&(null==(e=self.location)?void 0:e.href)||""}function we(){return"http:"===Te()||"https:"===Te()}function Te(){var e;return"undefined"!=typeof self&&(null==(e=self.location)?void 0:e.protocol)||null}class Ee{constructor(e,t){a((this.shortDelay=e)<(this.longDelay=t),"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(l())||K()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(we()||G()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function be(e,t){a(e.emulator,"Emulator should always be set here");e=e.emulator.url;return t?""+e+(t.startsWith("/")?t.slice(1):t):e}class ke{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl||("undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void n("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static headers(){return this.headersImpl||("undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void n("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static response(){return this.responseImpl||("undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void n("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}}let Se={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Re=new Ee(3e4,6e4);function o(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function p(n,s,a,o,e={}){return Ae(n,e,async()=>{let e={},t={};o&&("GET"===s?t=o:e={body:JSON.stringify(o)});var r=Q(Object.assign({key:n.config.apiKey},t)).slice(1),i=await n._getAdditionalHeaders(),i=(i["Content-Type"]="application/json",n.languageCode&&(i["X-Firebase-Locale"]=n.languageCode),Object.assign({method:s,headers:i},e));return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(i.referrerPolicy="no-referrer"),ke.fetch()(Pe(n,n.config.apiHost,a,r),i)})}async function Ae(t,e,r){t._canInitEmulator=!1;e=Object.assign(Object.assign({},Se),e);try{var i=new Ce(t),n=await Promise.race([r(),i.promise]),s=(i.clearNetworkTimeout(),await n.json());if("needConfirmation"in s)throw Oe(t,"account-exists-with-different-credential",s);if(n.ok&&!("errorMessage"in s))return s;var[a,o]=(n.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===a)throw Oe(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===a)throw Oe(t,"email-already-in-use",s);if("USER_DISABLED"===a)throw Oe(t,"user-disabled",s);var l=e[a]||a.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw ve(t,l,o);d(t,l)}catch(e){if(e instanceof c)throw e;d(t,"network-request-failed",{message:String(e)})}}async function r(e,t,r,i,n={}){t=await p(e,t,r,i,n);return"mfaPendingCredential"in t&&d(e,"multi-factor-auth-required",{_serverResponse:t}),t}function Pe(e,t,r,i){t=""+t+r+"?"+i;return e.config.emulator?be(e.config,t):e.config.apiScheme+"://"+t}class Ce{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(u(this.auth,"network-request-failed")),Re.get())})}}function Oe(e,t,r){var i={appName:e.name},e=(r.email&&(i.email=r.email),r.phoneNumber&&(i.phoneNumber=r.phoneNumber),u(e,t,i));return e.customData._tokenResponse=r,e}function Ne(e){return void 0!==e&&void 0!==e.getResponse}function Le(e){return void 0!==e&&void 0!==e.enterprise}class De{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(t){if(this.recaptchaEnforcementState&&0!==this.recaptchaEnforcementState.length)for(let e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t){switch(e.enforcementState){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}return}return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Ue(e,t){return p(e,"GET","/v2/recaptchaConfig",o(e,t))}async function Me(e,t){return p(e,"POST","/v1/accounts:lookup",t)}function Fe(e){if(e)try{var t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function Ve(e){return 1e3*Number(e)}function xe(e){var[e,t,r]=e.split(".");if(void 0===e||void 0===t||void 0===r)return fe("JWT malformed, contained fewer than 3 sections"),null;try{var i=j(t);return i?JSON.parse(i):(fe("Failed to decode base64 JWT payload"),null)}catch(e){return fe("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function je(e){e=xe(e);return m(e,"internal-error"),m(void 0!==e.exp,"internal-error"),m(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}async function g(t,e,r=!1){if(r)return e;try{return await e}catch(e){throw e instanceof c&&(r=[e.code][0],"auth/user-disabled"===r||"auth/user-token-expired"===r)&&(t.auth.currentUser===t&&await t.auth.signOut()),e}}class He{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId)&&clearTimeout(this.timerId)}getInterval(e){return e?(e=this.errorBackoff,this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e):(this.errorBackoff=3e4,e=(null!=(e=this.user.stsTokenManager.expirationTime)?e:0)-Date.now()-3e5,Math.max(0,e))}schedule(e=!1){this.isRunning&&(e=this.getInterval(e),this.timerId=setTimeout(async()=>{await this.iteration()},e))}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class We{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Fe(this.lastLoginAt),this.creationTime=Fe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function qe(e){var t=e.auth,r=await e.getIdToken(),r=await g(e,Me(t,{idToken:r})),t=(m(null==r?void 0:r.users.length,t,"internal-error"),r.users[0]),r=(e._notifyReloadListener(t),null!=(r=t.providerUserInfo)&&r.length?Be(t.providerUserInfo):[]),r=((e,r)=>[...e=e.filter(t=>!r.some(e=>e.providerId===t.providerId)),...r])(e.providerData,r),i=!(e.email&&t.passwordHash||null!=r&&r.length),i=!!e.isAnonymous&&i,r={uid:t.localId,displayName:t.displayName||null,photoURL:t.photoUrl||null,email:t.email||null,emailVerified:t.emailVerified||!1,phoneNumber:t.phoneNumber||null,tenantId:t.tenantId||null,providerData:r,metadata:new We(t.createdAt,t.lastLoginAt),isAnonymous:i};Object.assign(e,r)}function Be(e){return e.map(e=>{var t=e.providerId,e=oe(e,["providerId"]);return{providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}})}class ze{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){m(e.idToken,"internal-error"),m(void 0!==e.idToken,"internal-error"),m(void 0!==e.refreshToken,"internal-error");var t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):je(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){m(0!==e.length,"internal-error");var t=je(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(m(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){n=t;var i,n,{accessToken:e,refreshToken:t,expiresIn:r}=await{accessToken:(t=await Ae(i=e,{},async()=>{var e=Q({grant_type:"refresh_token",refresh_token:n}).slice(1),{tokenApiHost:t,apiKey:r}=i.config,t=Pe(i,t,"/v1/token","key="+r),r=await i._getAdditionalHeaders();return r["Content-Type"]="application/x-www-form-urlencoded",ke.fetch()(t,{method:"POST",headers:r,body:e})})).access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token};this.updateTokensAndExpiration(e,t,Number(r))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){var{refreshToken:t,accessToken:r,expirationTime:i}=t,n=new ze;return t&&(m("string"==typeof t,"internal-error",{appName:e}),n.refreshToken=t),r&&(m("string"==typeof r,"internal-error",{appName:e}),n.accessToken=r),i&&(m("number"==typeof i,"internal-error",{appName:e}),n.expirationTime=i),n}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new ze,this.toJSON())}_performRefresh(){return n("not implemented")}}function f(e,t){m("string"==typeof e||void 0===e,"internal-error",{appName:t})}class v{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,e=oe(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new He(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=e.displayName||null,this.email=e.email||null,this.emailVerified=e.emailVerified||!1,this.phoneNumber=e.phoneNumber||null,this.photoURL=e.photoURL||null,this.isAnonymous=e.isAnonymous||!1,this.tenantId=e.tenantId||null,this.providerData=e.providerData?[...e.providerData]:[],this.metadata=new We(e.createdAt||void 0,e.lastLoginAt||void 0)}async getIdToken(e){e=await g(this,this.stsTokenManager.getToken(this.auth,e));return m(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(e){return(async(e,t=!1)=>{var e=s(e),r=xe(t=await e.getIdToken(t)),i=(m(r&&r.exp&&r.auth_time&&r.iat,e.auth,"internal-error"),null==(e="object"==typeof r.firebase?r.firebase:void 0)?void 0:e.sign_in_provider);return{claims:r,token:t,authTime:Fe(Ve(r.auth_time)),issuedAtTime:Fe(Ve(r.iat)),expirationTime:Fe(Ve(r.exp)),signInProvider:i||null,signInSecondFactor:(null==e?void 0:e.sign_in_second_factor)||null}})(this,e)}reload(){return(async e=>{await qe(e=s(e)),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)})(this)}_assign(e){this!==e&&(m(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){e=new v(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(e){m(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await qe(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){var e;return jn._isFirebaseServerApp(this.auth.app)?Promise.reject(h(this.auth)):(e=await this.getIdToken(),await g(this,(async(e,t)=>p(e,"POST","/v1/accounts:delete",t))(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut())}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r=null!=(r=t.displayName)?r:void 0,i=null!=(i=t.email)?i:void 0,n=null!=(n=t.phoneNumber)?n:void 0,s=null!=(s=t.photoURL)?s:void 0,a=null!=(a=t.tenantId)?a:void 0,o=null!=(o=t._redirectEventId)?o:void 0,l=null!=(l=t.createdAt)?l:void 0,c=null!=(c=t.lastLoginAt)?c:void 0,{uid:t,emailVerified:d,isAnonymous:u,providerData:h,stsTokenManager:p}=t,p=(m(t&&p,e,"internal-error"),ze.fromJSON(this.name,p)),t=(m("string"==typeof t,e,"internal-error"),f(r,e.name),f(i,e.name),m("boolean"==typeof d,e,"internal-error"),m("boolean"==typeof u,e,"internal-error"),f(n,e.name),f(s,e.name),f(a,e.name),f(o,e.name),f(l,e.name),f(c,e.name),new v({uid:t,auth:e,email:i,emailVerified:d,displayName:r,isAnonymous:u,photoURL:s,phoneNumber:n,tenantId:a,stsTokenManager:p,createdAt:l,lastLoginAt:c}));return h&&Array.isArray(h)&&(t.providerData=h.map(e=>Object.assign({},e))),o&&(t._redirectEventId=o),t}static async _fromIdTokenResponse(e,t,r=!1){var i=new ze,t=(i.updateFromServerResponse(t),new v({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r}));return await qe(t),t}static async _fromGetAccountInfoResponse(e,t,r){var t=t.users[0],i=(m(void 0!==t.localId,"internal-error"),void 0!==t.providerUserInfo?Be(t.providerUserInfo):[]),n=!(t.email&&t.passwordHash||null!=i&&i.length),s=new ze,r=(s.updateFromIdToken(r),new v({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:n})),e={uid:t.localId,displayName:t.displayName||null,photoURL:t.photoUrl||null,email:t.email||null,emailVerified:t.emailVerified||!1,phoneNumber:t.phoneNumber||null,tenantId:t.tenantId||null,providerData:i,metadata:new We(t.createdAt,t.lastLoginAt),isAnonymous:!(t.email&&t.passwordHash||null!=i&&i.length)};return Object.assign(r,e),r}}let Ge=new Map;function _(e){a(e instanceof Function,"Expected a class definition");var t=Ge.get(e);return t?a(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,Ge.set(e,t)),t}class Ke{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){e=this.storage[e];return void 0===e?null:e}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Ke.type="NONE";let Je=Ke;function y(e,t,r){return`firebase:${e}:${t}:`+r}class Ye{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;var{config:e,name:r}=this.auth;this.fullUserKey=y(this.userKey,e.apiKey,r),this.fullPersistenceKey=y("persistence",e.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){var e=await this.persistence._get(this.fullUserKey);return e?v._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){var t;if(this.persistence!==e)return t=await this.getCurrentUser(),await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new Ye(_(Je),e,r);var i,n=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let s=n[0]||_(Je),a=y(r,e.config.apiKey,e.name),o=null;for(i of t)try{var l=await i._get(a);if(l){var c=v._fromJSON(e,l);i!==s&&(o=c),s=i;break}}catch(e){}n=n.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&n.length&&(s=n[0],o&&await s._set(a,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==s)try{await e._remove(a)}catch(e){}}))),new Ye(s,e,r)}}function $e(e){var t=e.toLowerCase();return t.includes("opera/")||t.includes("opr/")||t.includes("opios/")?"Opera":et(t)?"IEMobile":t.includes("msie")||t.includes("trident/")?"IE":t.includes("edge/")?"Edge":Xe(t)?"Firefox":t.includes("silk/")?"Silk":rt(t)?"Blackberry":it(t)?"Webos":Qe(t)?"Safari":!t.includes("chrome/")&&!Ze(t)||t.includes("edge/")?tt(t)?"Android":2===(null==(t=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))?void 0:t.length)?t[1]:"Other":"Chrome"}function Xe(e=l()){return/firefox\//i.test(e)}function Qe(e=l()){e=e.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ze(e=l()){return/crios\//i.test(e)}function et(e=l()){return/iemobile/i.test(e)}function tt(e=l()){return/android/i.test(e)}function rt(e=l()){return/blackberry/i.test(e)}function it(e=l()){return/webos/i.test(e)}function nt(e=l()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function st(e=l()){return nt(e)||tt(e)||it(e)||rt(e)||/windows phone/i.test(e)||et(e)}function at(e,t=[]){let r;switch(e){case"Browser":r=$e(l());break;case"Worker":r=$e(l())+"-"+e;break;default:r=e}t=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${jn.SDK_VERSION}/`+t}class ot{constructor(e){this.auth=e,this.queue=[]}pushCallback(i,e){var t=r=>new Promise((e,t)=>{try{e(i(r))}catch(e){t(e)}});t.onAbort=e,this.queue.push(t);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser!==e){var t=[];try{for(var r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){t.reverse();for(var i of t)try{i()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}}class lt{constructor(e){var t,r=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!=(t=r.minPasswordLength)?t:6,r.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=r.maxPasswordLength),void 0!==r.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=r.containsLowercaseCharacter),void 0!==r.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=r.containsUppercaseCharacter),void 0!==r.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=r.containsNumericCharacter),void 0!==r.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=r.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!=(r=null==(t=e.allowedNonAlphanumericCharacters)?void 0:t.join(""))?r:"",this.forceUpgradeOnSignin=null!=(t=e.forceUpgradeOnSignin)&&t,this.schemaVersion=e.schemaVersion}validatePassword(e){var t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=null==(e=t.meetsMinPasswordLength)||e),t.isValid&&(t.isValid=null==(e=t.meetsMaxPasswordLength)||e),t.isValid&&(t.isValid=null==(e=t.containsLowercaseLetter)||e),t.isValid&&(t.isValid=null==(e=t.containsUppercaseLetter)||e),t.isValid&&(t.isValid=null==(e=t.containsNumericCharacter)||e),t.isValid&&(t.isValid=null==(e=t.containsNonAlphanumericCharacter)||e),t}validatePasswordLengthOptions(e,t){var r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(t,r){var i;this.updatePasswordCharacterOptionsStatuses(r,!1,!1,!1,!1);for(let e=0;e<t.length;e++)i=t.charAt(e),this.updatePasswordCharacterOptionsStatuses(r,"a"<=i&&i<="z","A"<=i&&i<="Z","0"<=i&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,r,i,n){this.customStrengthOptions.containsLowercaseLetter&&!e.containsLowercaseLetter&&(e.containsLowercaseLetter=t),this.customStrengthOptions.containsUppercaseLetter&&!e.containsUppercaseLetter&&(e.containsUppercaseLetter=r),this.customStrengthOptions.containsNumericCharacter&&!e.containsNumericCharacter&&(e.containsNumericCharacter=i),this.customStrengthOptions.containsNonAlphanumericCharacter&&!e.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter=n)}}class ct{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new dt(this),this.idTokenSubscription=new dt(this),this.beforeStateQueue=new ot(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=me,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(t,r){return r&&(this._popupRedirectResolver=_(r)),this._initializationPromise=this.queue(async()=>{var e;if(!this._deleted&&(this.persistenceManager=await Ye.create(this,t),!this._deleted)){if(null!=(e=this._popupRedirectResolver)&&e._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(r),this.lastNotifiedUid=(null==(e=this.currentUser)?void 0:e.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){var e;!this._deleted&&(e=await this.assertedPersistence.getCurrentUser(),this.currentUser||e)&&(this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),await this.currentUser.getIdToken()):await this._updateCurrentUser(e,!0))}async initializeCurrentUserFromIdToken(e){try{var t=await Me(this,{idToken:e}),r=await v._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(jn._isFirebaseServerApp(this.app)){let t=this.app.settings.authIdToken;return t?new Promise(e=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(t).then(e,e))}):this.directlySetCurrentUser(null)}var t,r,i=await this.assertedPersistence.getCurrentUser();let n=i,s=!1;if(e&&this.config.authDomain&&(await this.getOrInitRedirectPersistenceManager(),t=null==(t=this.redirectUser)?void 0:t._redirectEventId,r=null==n?void 0:n._redirectEventId,e=await this.tryRedirectSignIn(e),t&&t!==r||null==e||!e.user||(n=e.user,s=!0)),!n)return this.directlySetCurrentUser(null);if(n._redirectEventId)return m(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n);if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await qe(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){var e;this.languageCode="undefined"!=typeof navigator&&((e=navigator).languages&&e.languages[0]||e.language)||null}async _delete(){this._deleted=!0}async updateCurrentUser(e){return jn._isFirebaseServerApp(this.app)?Promise.reject(h(this)):((e=e?s(e):null)&&m(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this)))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&m(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return jn._isFirebaseServerApp(this.app)?Promise.reject(h(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return jn._isFirebaseServerApp(this.app)?Promise.reject(h(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(_(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();var t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){var e=await p(e=this,"GET","/v2/passwordPolicy",o(e,{})),e=new lt(e);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new $("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((t,r)=>{if(this.currentUser)t();else{let e=this.onAuthStateChanged(()=>{e(),t()},r)}})}async revokeAccessToken(e){var t;this.currentUser&&(e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()},null!=this.tenantId&&(e.tenantId=this.tenantId),await p(t=this,"POST","/v2/accounts:revokeToken",o(t,e)))}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null==(e=this._currentUser)?void 0:e.toJSON()}}async _setRedirectUser(e,t){t=await this.getOrInitRedirectPersistenceManager(t);return null===e?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){return this.redirectPersistenceManager||(m(e=e&&_(e)||this._popupRedirectResolver,this,"argument-error"),this.redirectPersistenceManager=await Ye.create(this,[_(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()),this.redirectPersistenceManager}async _redirectUserForId(e){var t;return this._isInitialized&&await this.queue(async()=>{}),(null==(t=this._currentUser)?void 0:t._redirectEventId)===e?this._currentUser:(null==(t=this.redirectUser)?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:`+this.name}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e;this._isInitialized&&(this.idTokenSubscription.next(this.currentUser),e=null!=(e=null==(e=this.currentUser)?void 0:e.uid)?e:null,this.lastNotifiedUid!==e)&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,r,i,n){if(this._deleted)return()=>{};let e="function"==typeof r?r:r.next.bind(r),s=!1;var a=this._isInitialized?Promise.resolve():this._initializationPromise;if(m(a,this,"internal-error"),a.then(()=>{s||e(this.currentUser)}),"function"==typeof r){let e=t.addObserver(r,i,n);return()=>{s=!0,e()}}{let e=t.addObserver(r);return()=>{s=!0,e()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),(this.currentUser=e)?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return m(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=at(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e={"X-Client-Version":this.clientVersion},t=(this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId),await(null==(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))?void 0:t.getHeartbeatsHeader())),t=(t&&(e["X-Firebase-Client"]=t),await this._getAppCheckToken());return t&&(e["X-Firebase-AppCheck"]=t),e}async _getAppCheckToken(){var e,t,r;return jn._isFirebaseServerApp(this.app)&&this.app.settings.appCheckToken?this.app.settings.appCheckToken:(null!=(e=await(null==(e=this.appCheckServiceProvider.getImmediate({optional:!0}))?void 0:e.getToken()))&&e.error&&(t="Error while retrieving App Check token: "+e.error,r=[],ge.logLevel<=i.WARN)&&ge.warn(`Auth (${jn.SDK_VERSION}): `+t,...r),null==e?void 0:e.token)}}function I(e){return s(e)}class dt{constructor(e){var t;this.auth=e,this.observer=null,this.addObserver=(e=e=>this.observer=e,(e=new te(e,t)).subscribe.bind(e))}get next(){return m(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let ut={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function ht(e){return ut.loadJS(e)}function pt(e){return"__"+e+Math.floor(1e6*Math.random())}class mt{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){var r=this.counter;return this._widgets.set(r,new vt(e,this.auth.name,t||{})),this.counter++,r}reset(e){var t,e=e||1e12;null!=(t=this._widgets.get(e))&&t.delete(),this._widgets.delete(e)}getResponse(e){return(null==(e=this._widgets.get(e||1e12))?void 0:e.getResponse())||""}async execute(e){return null!=(e=this._widgets.get(e||1e12))&&e.execute(),""}}class gt{constructor(){this.enterprise=new ft}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class ft{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class vt{constructor(e,t,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};r="string"==typeof e?document.getElementById(e):e;m(r,"argument-error",{appName:t}),this.container=r,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout(()=>{this.responseToken=(t=>{var r=[],i="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<t;e++)r.push(i.charAt(Math.floor(Math.random()*i.length)));return r.join("")})(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}let _t="NO_RECAPTCHA";class yt{constructor(e){this.type="recaptcha-enterprise",this.auth=I(e)}async verify(n="verify",e=!1){function s(e,t,r){let i=window.grecaptcha;Le(i)?i.enterprise.ready(()=>{i.enterprise.execute(e,{action:n}).then(e=>{t(e)}).catch(()=>{t(_t)})}):r(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?(new gt).execute("siteKey",{action:"verify"}):new Promise((r,i)=>{(async i=>{if(!e){if(null==i.tenantId&&null!=i._agentRecaptchaConfig)return i._agentRecaptchaConfig.siteKey;if(null!=i.tenantId&&void 0!==i._tenantRecaptchaConfigs[i.tenantId])return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(t,r)=>{Ue(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(e=>{if(void 0!==e.recaptchaKey)return e=new De(e),null==i.tenantId?i._agentRecaptchaConfig=e:i._tenantRecaptchaConfigs[i.tenantId]=e,t(e.siteKey);r(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{r(e)})})})(this.auth).then(t=>{if(!e&&Le(window.grecaptcha))s(t,r,i);else if("undefined"==typeof window)i(new Error("RecaptchaVerifier is only supported in browser"));else{let e=ut.recaptchaEnterpriseScript;0!==e.length&&(e+=t),ht(e).then(()=>{s(t,r,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function It(t,e,r,i=!1,n=!1){t=new yt(t);let s;if(n)s=_t;else try{s=await t.verify(r)}catch(e){s=await t.verify(r,!0)}n=Object.assign({},e);return"mfaSmsEnrollment"===r||"mfaSmsSignIn"===r?"phoneEnrollmentInfo"in n?(t=n.phoneEnrollmentInfo.phoneNumber,e=n.phoneEnrollmentInfo.recaptchaToken,Object.assign(n,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})):"phoneSignInInfo"in n&&(r=n.phoneSignInInfo.recaptchaToken,Object.assign(n,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})):(i?Object.assign(n,{captchaResp:s}):Object.assign(n,{captchaResponse:s}),Object.assign(n,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(n,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"})),n}async function w(r,i,n,s,e){var t;return"EMAIL_PASSWORD_PROVIDER"===e?null!=(t=r._getRecaptchaConfig())&&t.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")?(t=await It(r,i,n,"getOobCode"===n),s(r,t)):s(r,i).catch(async e=>{var t;return"auth/missing-recaptcha-token"===e.code?(console.log(n+" is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."),t=await It(r,i,n,"getOobCode"===n),s(r,t)):Promise.reject(e)}):"PHONE_PROVIDER"===e?null!=(t=r._getRecaptchaConfig())&&t.isProviderEnabled("PHONE_PROVIDER")?(t=await It(r,i,n),s(r,t).catch(async e=>{var t;if("AUDIT"===(null==(t=r._getRecaptchaConfig())?void 0:t.getProviderEnforcementState("PHONE_PROVIDER"))&&("auth/missing-recaptcha-token"===e.code||"auth/invalid-app-credential"===e.code))return console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`),t=await It(r,i,n,!1,!0),s(r,t);return Promise.reject(e)})):(t=await It(r,i,n,!1,!0),s(r,t)):Promise.reject(e+" provider is not supported.")}function wt(e,t,r){var e=I(e),r=(m(e._canInitEmulator,e,"emulator-config-failed"),m(/^https?:\/\//.test(t),e,"invalid-emulator-scheme"),!(null==r||!r.disableWarnings)),i=Tt(t),{host:t,port:n}=(e=>{var t=Tt(e);return(e=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length)))?(t=e[2].split("@").pop()||"",(e=/^(\[[^\]]+\])(:|$)/.exec(t))?{host:e=e[1],port:Et(t.substr(e.length+1))}:([e,t]=t.split(":"),{host:e,port:Et(t)})):{host:"",port:null}})(t);function s(){var e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}e.config.emulator={url:i+`//${t}${null===n?"":":"+n}/`},e.settings.appVerificationDisabledForTesting=!0,e.emulatorConfig=Object.freeze({host:t,port:n,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||("undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",s):s()))}function Tt(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Et(e){return!e||(e=Number(e),isNaN(e))?null:e}class bt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return n("not implemented")}_getIdTokenResponse(e){return n("not implemented")}_linkToIdToken(e,t){return n("not implemented")}_getReauthenticationResolver(e){return n("not implemented")}}async function kt(e,t){return p(e,"POST","/v1/accounts:resetPassword",o(e,t))}async function St(e,t){return p(e,"POST","/v1/accounts:signUp",t)}async function Rt(e,t){return r(e,"POST","/v1/accounts:signInWithPassword",o(e,t))}async function At(e,t){return p(e,"POST","/v1/accounts:sendOobCode",o(e,t))}async function Pt(e,t){return At(e,t)}async function Ct(e,t){return At(e,t)}class Ot extends bt{constructor(e,t,r,i=null){super("password",r),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new Ot(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Ot(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){e="string"==typeof e?JSON.parse(e):e;if(null!=e&&e.email&&null!=e&&e.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return w(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Rt,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithEmailLink",o(e,t)))(e,{email:this._email,oobCode:this._password});default:d(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return w(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",St,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithEmailLink",o(e,t)))(e,{idToken:t,email:this._email,oobCode:this._password});default:d(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function T(e,t){return r(e,"POST","/v1/accounts:signInWithIdp",o(e,t))}class E extends bt{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){var t=new E(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):d("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){var e="string"==typeof e?JSON.parse(e):e,{providerId:t,signInMethod:r}=e,e=oe(e,["providerId","signInMethod"]);return t&&r?((t=new E(t,r)).idToken=e.idToken||void 0,t.accessToken=e.accessToken||void 0,t.secret=e.secret,t.nonce=e.nonce,t.pendingToken=e.pendingToken||null,t):null}_getIdTokenResponse(e){return T(e,this.buildRequest())}_linkToIdToken(e,t){var r=this.buildRequest();return r.idToken=t,T(e,r)}_getReauthenticationResolver(e){var t=this.buildRequest();return t.autoCreate=!1,T(e,t)}buildRequest(){var e,t={requestUri:"http://localhost",returnSecureToken:!0};return this.pendingToken?t.pendingToken=this.pendingToken:(e={},this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=Q(e)),t}}async function Nt(e,t){return p(e,"POST","/v1/accounts:sendVerificationCode",o(e,t))}let Lt={USER_NOT_FOUND:"user-not-found"};class Dt extends bt{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Dt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Dt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithPhoneNumber",o(e,t)))(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return(async(e,t)=>{if((t=await r(e,"POST","/v1/accounts:signInWithPhoneNumber",o(e,t))).temporaryProof)throw Oe(e,"account-exists-with-different-credential",t);return t})(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithPhoneNumber",o(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Lt))(e,this._makeVerificationRequest())}_makeVerificationRequest(){var{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:i}}toJSON(){var e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){var{verificationId:e,verificationCode:t,phoneNumber:r,temporaryProof:i}=e="string"==typeof e?JSON.parse(e):e;return t||e||r||i?new Dt({verificationId:e,verificationCode:t,phoneNumber:r,temporaryProof:i}):null}}class Ut{constructor(e){var e=Z(ee(e)),t=null!=(t=e.apiKey)?t:null,r=null!=(r=e.oobCode)?r:null,i=(e=>{switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}})(null!=(i=e.mode)?i:null);m(t&&r&&i,"argument-error"),this.apiKey=t,this.operation=i,this.code=r,this.continueUrl=null!=(t=e.continueUrl)?t:null,this.languageCode=null!=(i=e.languageCode)?i:null,this.tenantId=null!=(r=e.tenantId)?r:null}static parseLink(e){t=Z(ee(e=e)).link,r=t?Z(ee(t)).deep_link_id:null;var t,r,i=((i=Z(ee(e)).deep_link_id)?Z(ee(i)).link:null)||i||r||t||e;try{return new Ut(i)}catch(e){return null}}}class Mt{constructor(){this.providerId=Mt.PROVIDER_ID}static credential(e,t){return Ot._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){t=Ut.parseLink(t);return m(t,"argument-error"),Ot._fromEmailAndCode(e,t.code,t.tenantId)}}Mt.PROVIDER_ID="password",Mt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Mt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class b{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class Ft extends b{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Vt extends Ft{static credentialFromJSON(e){e="string"==typeof e?JSON.parse(e):e;return m("providerId"in e&&"signInMethod"in e,"argument-error"),E._fromParams(e)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return m(e.idToken||e.accessToken,"argument-error"),E._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return Vt.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return Vt.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:e,oauthAccessToken:t,oauthTokenSecret:r,pendingToken:i,nonce:n,providerId:s}=e;if(!(t||r||e||i))return null;if(!s)return null;try{return new Vt(s)._credential({idToken:e,accessToken:t,nonce:n,pendingToken:i})}catch(e){return null}}}class k extends Ft{constructor(){super("facebook.com")}static credential(e){return E._fromParams({providerId:k.PROVIDER_ID,signInMethod:k.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return k.credentialFromTaggedObject(e)}static credentialFromError(e){return k.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return k.credential(e.oauthAccessToken)}catch(e){return null}}}k.FACEBOOK_SIGN_IN_METHOD="facebook.com",k.PROVIDER_ID="facebook.com";class S extends Ft{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return E._fromParams({providerId:S.PROVIDER_ID,signInMethod:S.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return S.credentialFromTaggedObject(e)}static credentialFromError(e){return S.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:e,oauthAccessToken:t}=e;if(!e&&!t)return null;try{return S.credential(e,t)}catch(e){return null}}}S.GOOGLE_SIGN_IN_METHOD="google.com",S.PROVIDER_ID="google.com";class R extends Ft{constructor(){super("github.com")}static credential(e){return E._fromParams({providerId:R.PROVIDER_ID,signInMethod:R.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return R.credentialFromTaggedObject(e)}static credentialFromError(e){return R.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return R.credential(e.oauthAccessToken)}catch(e){return null}}}R.GITHUB_SIGN_IN_METHOD="github.com",R.PROVIDER_ID="github.com";class xt extends bt{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return T(e,this.buildRequest())}_linkToIdToken(e,t){var r=this.buildRequest();return r.idToken=t,T(e,r)}_getReauthenticationResolver(e){var t=this.buildRequest();return t.autoCreate=!1,T(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){var{providerId:e,signInMethod:t,pendingToken:r}="string"==typeof e?JSON.parse(e):e;return e&&t&&r&&e===t?new xt(e,r):null}static _create(e,t){return new xt(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class jt extends b{constructor(e){m(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return jt.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return jt.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){e=xt.fromJSON(e);return m(e,"argument-error"),e}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{pendingToken:e,providerId:t}=e;if(!e||!t)return null;try{return xt._create(t,e)}catch(e){return null}}}class A extends Ft{constructor(){super("twitter.com")}static credential(e,t){return E._fromParams({providerId:A.PROVIDER_ID,signInMethod:A.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return A.credentialFromTaggedObject(e)}static credentialFromError(e){return A.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthAccessToken:e,oauthTokenSecret:t}=e;if(!e||!t)return null;try{return A.credential(e,t)}catch(e){return null}}}async function Ht(e,t){return r(e,"POST","/v1/accounts:signUp",o(e,t))}A.TWITTER_SIGN_IN_METHOD="twitter.com",A.PROVIDER_ID="twitter.com";class P{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){e=await v._fromIdTokenResponse(e,r,i),i=Wt(r);return new P({user:e,providerId:i,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);var i=Wt(r);return new P({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function Wt(e){return e.providerId||("phoneNumber"in e?"phone":null)}class qt extends c{constructor(e,t,r,i){super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,qt.prototype),this.customData={appName:e.name,tenantId:null!=(i=e.tenantId)?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new qt(e,t,r,i)}}function Bt(t,r,e,i){return("reauthenticate"===r?e._getReauthenticationResolver(t):e._getIdTokenResponse(t)).catch(e=>{if("auth/multi-factor-auth-required"===e.code)throw qt._fromErrorAndOperation(t,e,r,i);throw e})}function zt(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function Gt(e,t){var e=s(e),r=(await Jt(!0,e,t),r=e.auth,t={idToken:await e.getIdToken(),deleteProvider:[t]},await p(r,"POST","/v1/accounts:update",t)).providerUserInfo;let i=zt(r||[]);return e.providerData=e.providerData.filter(e=>i.has(e.providerId)),i.has("phone")||(e.phoneNumber=null),await e.auth._persistUserIfCurrent(e),e}async function Kt(e,t,r=!1){t=await g(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return P._forOperation(e,"link",t)}async function Jt(e,t,r){await qe(t);var i=!1===e?"provider-already-linked":"no-such-provider";m(zt(t.providerData).has(r)===e,t.auth,i)}async function Yt(e,t,r=!1){var i=e.auth;if(jn._isFirebaseServerApp(i.app))return Promise.reject(h(i));var n="reauthenticate";try{var s=await g(e,Bt(i,n,t,e),r),a=(m(s.idToken,i,"internal-error"),xe(s.idToken)),o=(m(a,i,"internal-error"),a).sub;return m(e.uid===o,i,"user-mismatch"),P._forOperation(e,n,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&d(i,"user-mismatch"),e}}async function $t(e,t,r=!1){return jn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(t=await Bt(e,"signIn",t),t=await P._fromIdTokenResponse(e,"signIn",t),r||await e._updateCurrentUser(t.user),t)}async function Xt(e,t){return $t(I(e),t)}async function Qt(e,t){e=s(e);return await Jt(!1,e,t.providerId),Kt(e,t)}async function Zt(e,t){return Yt(s(e),t)}async function er(e,t){return jn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(t=await r(e=I(e),"POST","/v1/accounts:signInWithCustomToken",o(e,{token:t,returnSecureToken:!0})),t=await P._fromIdTokenResponse(e,"signIn",t),await e._updateCurrentUser(t.user),t)}class tr{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?rr._fromServerResponse(e,t):"totpInfo"in t?ir._fromServerResponse(e,t):d(e,"internal-error")}}class rr extends tr{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new rr(t)}}class ir extends tr{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new ir(t)}}function nr(e,t,r){var i;m(0<(null==(i=r.url)?void 0:i.length),e,"invalid-continue-uri"),m(void 0===r.dynamicLinkDomain||0<r.dynamicLinkDomain.length,e,"invalid-dynamic-link-domain"),m(void 0===r.linkDomain||0<r.linkDomain.length,e,"invalid-hosting-link-domain"),t.continueUrl=r.url,t.dynamicLinkDomain=r.dynamicLinkDomain,t.linkDomain=r.linkDomain,t.canHandleCodeInApp=r.handleCodeInApp,r.iOS&&(m(0<r.iOS.bundleId.length,e,"missing-ios-bundle-id"),t.iOSBundleId=r.iOS.bundleId),r.android&&(m(0<r.android.packageName.length,e,"missing-android-pkg-name"),t.androidInstallApp=r.android.installApp,t.androidMinimumVersionCode=r.android.minimumVersion,t.androidPackageName=r.android.packageName)}async function sr(e){e=I(e);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ar(e,t){await p(e=s(e),"POST","/v1/accounts:update",o(e,{oobCode:t}))}async function or(e,t){var r=s(e),i=await kt(r,{oobCode:t}),e=i.requestType;switch(m(e,r,"internal-error"),e){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":m(i.newEmail,r,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":m(i.mfaInfo,r,"internal-error");default:m(i.email,r,"internal-error")}let n=null;return i.mfaInfo&&(n=tr._fromServerResponse(I(r),i.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.newEmail:i.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.email:i.newEmail)||null,multiFactorInfo:n},operation:e}}async function lr(e,t){var r=we()?Ie():"http://localhost",e=(await p(e=s(e),"POST","/v1/accounts:createAuthUri",o(e,{identifier:t,continueUri:r}))).signinMethods;return e||[]}async function cr(e,t){var r=s(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()},t=(t&&nr(r.auth,i,t),await At(r.auth,i)).email;t!==e.email&&await e.reload()}async function dr(e,t,r){var i=s(e),t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t},r=(r&&nr(i.auth,t,r),await At(i.auth,t)).email;r!==e.email&&await e.reload()}async function ur(e,{displayName:t,photoURL:r}){var i;void 0===t&&void 0===r||(i=await(e=s(e)).getIdToken(),i=await g(e,(async(e,t)=>p(e,"POST","/v1/accounts:update",t))(e.auth,{idToken:i,displayName:t,photoUrl:r,returnSecureToken:!0})),e.displayName=i.displayName||null,e.photoURL=i.photoUrl||null,(t=e.providerData.find(({providerId:e})=>"password"===e))&&(t.displayName=e.displayName,t.photoURL=e.photoURL),await e._updateTokensIfNecessary(i))}async function hr(e,t,r){var i=e.auth,n={idToken:await e.getIdToken(),returnSecureToken:!0},t=(t&&(n.email=t),r&&(n.password=r),await g(e,(async(e,t)=>p(e,"POST","/v1/accounts:update",t))(i,n)));await e._updateTokensIfNecessary(t,!0)}class pr{constructor(e,t,r={}){this.isNewUser=e,this.providerId=t,this.profile=r}}class mr extends pr{constructor(e,t,r,i){super(e,t,r),this.username=i}}class gr extends pr{constructor(e,t){super(e,"facebook.com",t)}}class fr extends mr{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class vr extends pr{constructor(e,t){super(e,"google.com",t)}}class _r extends mr{constructor(e,t,r){super(e,"twitter.com",t,r)}}function yr(e){var{user:e,_tokenResponse:t}=e;if(e.isAnonymous&&!t)return{providerId:null,isNewUser:!1,profile:null};var r=t;if(!r)return null;var i=r.providerId,n=r.rawUserInfo?JSON.parse(r.rawUserInfo):{},s=r.isNewUser||"identitytoolkit#SignupNewUserResponse"===r.kind;if(!i&&null!=r&&r.idToken){e=null==(e=null==(e=xe(r.idToken))?void 0:e.firebase)?void 0:e.sign_in_provider;if(e)return e="anonymous"!==e&&"custom"!==e?e:null,new pr(s,e)}if(!i)return null;switch(i){case"facebook.com":return new gr(s,n);case"github.com":return new fr(s,n);case"google.com":return new vr(s,n);case"twitter.com":return new _r(s,n,r.screenName||null);case"custom":case"anonymous":return new pr(s,null);default:return new pr(s,i,n)}}class Ir{constructor(e,t,r){this.type=e,this.credential=t,this.user=r}static _fromIdtoken(e,t){return new Ir("enroll",e,t)}static _fromMfaPendingCredential(e){return new Ir("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t;if(null!=e&&e.multiFactorSession){if(null!=(t=e.multiFactorSession)&&t.pendingCredential)return Ir._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null!=(t=e.multiFactorSession)&&t.idToken)return Ir._fromIdtoken(e.multiFactorSession.idToken)}return null}}class wr{constructor(e,t,r){this.session=e,this.hints=t,this.signInResolver=r}static _fromError(e,i){let n=I(e),s=i.customData._serverResponse;e=(s.mfaInfo||[]).map(e=>tr._fromServerResponse(n,e));m(s.mfaPendingCredential,n,"internal-error");let a=Ir._fromMfaPendingCredential(s.mfaPendingCredential);return new wr(a,e,async e=>{var e=await e._process(n,a),t=(delete s.mfaInfo,delete s.mfaPendingCredential,Object.assign(Object.assign({},s),{idToken:e.idToken,refreshToken:e.refreshToken}));switch(i.operationType){case"signIn":var r=await P._fromIdTokenResponse(n,i.operationType,t);return await n._updateCurrentUser(r.user),r;case"reauthenticate":return m(i.user,n,"internal-error"),P._forOperation(i.user,i.operationType,t);default:d(n,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}function Tr(e,t){return p(e,"POST","/v2/accounts/mfaEnrollment:start",o(e,t))}class Er{constructor(t){this.user=t,this.enrolledFactors=[],t._onReload(e=>{e.mfaInfo&&(this.enrolledFactors=e.mfaInfo.map(e=>tr._fromServerResponse(t.auth,e)))})}static _fromUser(e){return new Er(e)}async getSession(){return Ir._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){var r=await this.getSession(),e=await g(this.user,e._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(e),this.user.reload()}async unenroll(e){let t="string"==typeof e?e:e.uid;var r,i,e=await this.user.getIdToken();try{var n=await g(this.user,(r=this.user.auth,i={idToken:e,mfaEnrollmentId:t},p(r,"POST","/v2/accounts/mfaEnrollment:withdraw",o(r,i))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(n),await this.user.reload()}catch(e){throw e}}}let br=new WeakMap;let kr="__sak";class Sr{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(kr,"1"),this.storage.removeItem(kr),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){e=this.storage.getItem(e);return Promise.resolve(e?JSON.parse(e):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Rr extends Sr{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=st(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(var t of Object.keys(this.listeners)){var r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,r=!1){if(e.key){let t=e.key;r?this.detachListener():this.stopPolling();var i=()=>{var e=this.storage.getItem(t);!r&&this.localCache[t]===e||this.notifyListeners(t,e)},n=this.storage.getItem(t);J()&&10===document.documentMode&&n!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}else this.forAllChangedKeys((e,t,r)=>{this.notifyListeners(e,r)})}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(var r of Array.from(e))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(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.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){var t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Rr.type="LOCAL";let Ar=Rr;class Pr extends Sr{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Pr.type="SESSION";let Cr=Pr;class Or{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){var e=this.receivers.find(e=>e.isListeningto(t));return e||(e=new Or(t),this.receivers.push(e),e)}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:r,eventType:i,data:n}=t.data;var e=this.handlersMap[i];null!=e&&e.size&&(t.ports[0].postMessage({status:"ack",eventId:r,eventType:i}),e=Array.from(e).map(async e=>e(t.origin,n)),e=await Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})),t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:e}))}_subscribe(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)}_unsubscribe(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)}}function Nr(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}Or.receivers=[];class Lr{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,a=50){let o="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!o)throw new Error("connection_unavailable");let l,c;return new Promise((r,i)=>{let n=Nr("",20),s=(o.port1.start(),setTimeout(()=>{i(new Error("unsupported_event"))},a));c={messageChannel:o,onMessage(e){var t=e;if(t.data.eventId===n)switch(t.data.status){case"ack":clearTimeout(s),l=setTimeout(()=>{i(new Error("timeout"))},3e3);break;case"done":clearTimeout(l),r(t.data.response);break;default:clearTimeout(s),clearTimeout(l),i(new Error("invalid_response"))}}},this.handlers.add(c),o.port1.addEventListener("message",c.onMessage),this.target.postMessage({eventType:e,eventId:n,data:t},[o.port2])}).finally(()=>{c&&this.removeMessageHandler(c)})}}function C(){return window}function Dr(){return void 0!==C().WorkerGlobalScope&&"function"==typeof C().importScripts}let Ur="firebaseLocalStorageDb",Mr="firebaseLocalStorage",Fr="fbase_key";class Vr{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function xr(e,t){return e.transaction([Mr],t?"readwrite":"readonly").objectStore(Mr)}function jr(){let i=indexedDB.open(Ur,1);return new Promise((t,r)=>{i.addEventListener("error",()=>{r(i.error)}),i.addEventListener("upgradeneeded",()=>{var e=i.result;try{e.createObjectStore(Mr,{keyPath:Fr})}catch(e){r(e)}}),i.addEventListener("success",async()=>{var e=i.result;e.objectStoreNames.contains(Mr)?t(e):(e.close(),e=indexedDB.deleteDatabase(Ur),await new Vr(e).toPromise(),t(await jr()))})})}async function Hr(e,t,r){e=xr(e,!0).put({fbase_key:t,value:r});return new Vr(e).toPromise()}function Wr(e,t){e=xr(e,!0).delete(t);return new Vr(e).toPromise()}class qr{constructor(){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(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await jr()),this.db}async _withRetries(e){let t=0;for(;;)try{return await e(await this._openDb())}catch(e){if(3<t++)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Or._getInstance(Dr()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;this.activeServiceWorker=await(async()=>{if(null==navigator||!navigator.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}})(),this.activeServiceWorker&&(this.sender=new Lr(this.activeServiceWorker),t=await this.sender._send("ping",{},800))&&null!=(e=t[0])&&e.fulfilled&&null!=(e=t[0])&&e.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null==(t=null==navigator?void 0:navigator.serviceWorker)?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{var e;return indexedDB?(await Hr(e=await jr(),kr,"1"),await Wr(e,kr),!0):!1}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(t,r){return this._withPendingWrite(async()=>(await this._withRetries(e=>Hr(e,t,r)),this.localCache[t]=r,this.notifyServiceWorker(t)))}async _get(t){var e=await this._withRetries(e=>(async(e,t)=>(e=xr(e,!1).get(t),void 0===(t=await new Vr(e).toPromise())?null:t.value))(e,t));return this.localCache[t]=e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>Wr(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){var e=await this._withRetries(e=>{e=xr(e,!1).getAll();return new Vr(e).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];var t,r=[],i=new Set;if(0!==e.length)for(var{fbase_key:n,value:s}of e)i.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(s)&&(this.notifyListeners(n,s),r.push(n));for(t of Object.keys(this.localCache))this.localCache[t]&&!i.has(t)&&(this.notifyListeners(t,null),r.push(t));return r}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(var r of Array.from(e))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(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)}_removeListener(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()}}qr.type="LOCAL";let Br=qr;function zr(e,t){return p(e,"POST","/v2/accounts/mfaSignIn:start",o(e,t))}let Gr=pt("rcb"),Kr=new Ee(3e4,6e4);class Jr{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!(null==(e=C().grecaptcha)||!e.render)}load(n,s=""){var e;return m((e=s).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e),n,"argument-error"),this.shouldResolveImmediately(s)&&Ne(C().grecaptcha)?Promise.resolve(C().grecaptcha):new Promise((t,r)=>{let i=C().setTimeout(()=>{r(u(n,"network-request-failed"))},Kr.get());C()[Gr]=()=>{C().clearTimeout(i),delete C()[Gr];var e=C().grecaptcha;if(e&&Ne(e)){let r=e.render;e.render=(e,t)=>{e=r(e,t);return this.counter++,e},this.hostLanguage=s,t(e)}else r(u(n,"internal-error"))},ht(ut.recaptchaV2Script+"?"+Q({onload:Gr,render:"explicit",hl:s})).catch(()=>{clearTimeout(i),r(u(n,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!(null==(t=C().grecaptcha)||!t.render)&&(e===this.hostLanguage||0<this.counter||this.librarySeparatelyLoaded)}}class Yr{async load(e){return new mt(e)}clearedOneInstance(){}}let $r="recaptcha",Xr={theme:"light",type:"image"};class Qr{constructor(e,t,r=Object.assign({},Xr)){this.parameters=r,this.type=$r,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=I(e),this.isInvisible="invisible"===this.parameters.size,m("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");r="string"==typeof t?document.getElementById(t):t;m(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=new(this.auth.settings.appVerificationDisabledForTesting?Yr:Jr),this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),i=this.getAssertedRecaptcha();var t=i.getResponse(e);return t||new Promise(t=>{let r=e=>{e&&(this.tokenChangeListeners.delete(r),t(e))};this.tokenChangeListeners.add(r),this.isInvisible&&i.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e})),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){m(!this.parameters.sitekey,this.auth,"argument-error"),m(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),m("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(r){return t=>{var e;this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof r?r(t):"string"==typeof r&&"function"==typeof(e=C()[r])&&e(t)}}assertNotDestroyed(){m(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;var t;this.isInvisible||(t=document.createElement("div"),e.appendChild(t),e=t),this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){m(we()&&!Dr(),this.auth,"internal-error"),await(()=>{let t=null;return new Promise(e=>{"complete"===document.readyState?e():(t=()=>e(),window.addEventListener("load",t))}).catch(e=>{throw t&&window.removeEventListener("load",t),e})})(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);var e=await((await p(this.auth,"GET","/v1/recaptchaParams")).recaptchaSiteKey||"");m(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return m(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class Zr{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){e=Dt._fromVerification(this.verificationId,e);return this.onConfirmation(e)}}async function ei(t,r,i){var n,e,s,a,o,l,c,d;if(!t._getRecaptchaConfig())try{s=await Ue(e=I(e=t),{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),s=new De(s),null==e.tenantId?e._agentRecaptchaConfig=s:e._tenantRecaptchaConfigs[e.tenantId]=s,await(!s.isAnyProviderEnabled()||!new yt(e).verify())}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let e;return("session"in(e="string"==typeof r?{phoneNumber:r}:r)?(a=e.session,"phoneNumber"in e?(m("enroll"===a.type,t,"internal-error"),o={idToken:a.credential,phoneEnrollmentInfo:{phoneNumber:e.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},(await w(t,o,"mfaSmsEnrollment",async(e,t)=>t.phoneEnrollmentInfo.captchaResponse===_t?(m((null==i?void 0:i.type)===$r,e,"argument-error"),Tr(e,await ti(e,t,i))):Tr(e,t),"PHONE_PROVIDER").catch(e=>Promise.reject(e))).phoneSessionInfo):(m("signin"===a.type,t,"internal-error"),m(l=(null==(n=e.multiFactorHint)?void 0:n.uid)||e.multiFactorUid,t,"missing-multi-factor-info"),c={mfaPendingCredential:a.credential,mfaEnrollmentId:l,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},(await w(t,c,"mfaSmsSignIn",async(e,t)=>t.phoneSignInInfo.captchaResponse===_t?(m((null==i?void 0:i.type)===$r,e,"argument-error"),zr(e,await ti(e,t,i))):zr(e,t),"PHONE_PROVIDER").catch(e=>Promise.reject(e))).phoneResponseInfo)):(d={phoneNumber:e.phoneNumber,clientType:"CLIENT_TYPE_WEB"},await w(t,d,"sendVerificationCode",async(e,t)=>t.captchaResponse===_t?(m((null==i?void 0:i.type)===$r,e,"argument-error"),Nt(e,await ti(e,t,i))):Nt(e,t),"PHONE_PROVIDER").catch(e=>Promise.reject(e)))).sessionInfo}finally{null!=i&&i._reset()}}async function ti(e,t,r){m(r.type===$r,e,"argument-error");var i,n,s,r=await r.verify(),e=(m("string"==typeof r,e,"argument-error"),Object.assign({},t));return"phoneEnrollmentInfo"in e?(t=e.phoneEnrollmentInfo.phoneNumber,n=e.phoneEnrollmentInfo.captchaResponse,s=e.phoneEnrollmentInfo.clientType,i=e.phoneEnrollmentInfo.recaptchaVersion,Object.assign(e,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:r,captchaResponse:n,clientType:s,recaptchaVersion:i}})):"phoneSignInInfo"in e?(t=e.phoneSignInInfo.captchaResponse,n=e.phoneSignInInfo.clientType,s=e.phoneSignInInfo.recaptchaVersion,Object.assign(e,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:t,clientType:n,recaptchaVersion:s}})):Object.assign(e,{recaptchaToken:r}),e}class O{constructor(e){this.providerId=O.PROVIDER_ID,this.auth=I(e)}verifyPhoneNumber(e,t){return ei(this.auth,e,s(t))}static credential(e,t){return Dt._fromVerification(e,t)}static credentialFromResult(e){return O.credentialFromTaggedObject(e)}static credentialFromError(e){return O.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){var t;return e&&({phoneNumber:e,temporaryProof:t}=e,e)&&t?Dt._fromTokenResponse(e,t):null}}function ri(e,t){return t?_(t):(m(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}O.PROVIDER_ID="phone",O.PHONE_SIGN_IN_METHOD="phone";class ii extends bt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return T(e,this._buildIdpRequest())}_linkToIdToken(e,t){return T(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return T(e,this._buildIdpRequest())}_buildIdpRequest(e){var t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function ni(e){return $t(e.auth,new ii(e),e.bypassAuthState)}function si(e){var{auth:t,user:r}=e;return m(r,t,"internal-error"),Yt(r,new ii(e),e.bypassAuthState)}async function ai(e){var{auth:t,user:r}=e;return m(r,t,"internal-error"),Kt(r,new ii(e),e.bypassAuthState)}class oi{constructor(e,t,r,i,n=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=n,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){var{urlResponse:e,sessionId:t,postBody:r,tenantId:i,error:n,type:s}=e;if(n)this.reject(n);else{n={auth:this.auth,requestUri:e,sessionId:t,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(n))}catch(e){this.reject(e)}}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ni;case"linkViaPopup":case"linkViaRedirect":return ai;case"reauthViaPopup":case"reauthViaRedirect":return si;default:d(this.auth,"internal-error")}}resolve(e){a(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){a(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let li=new Ee(2e3,1e4);class N extends oi{constructor(e,t,r,i,n){super(e,t,i,n),this.provider=r,this.authWindow=null,this.pollId=null,N.currentPopupAction&&N.currentPopupAction.cancel(),N.currentPopupAction=this}async executeNotNull(){var e=await this.execute();return m(e,this.auth,"internal-error"),e}async onExecution(){a(1===this.filter.length,"Popup operations only handle one event");var e=Nr();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(u(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null==(e=this.authWindow)?void 0:e.associatedEvent)||null}cancel(){this.reject(u(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,N.currentPopupAction=null}pollUserCancellation(){let t=()=>{var e;null!=(e=null==(e=this.authWindow)?void 0:e.window)&&e.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(u(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(t,li.get())};t()}}N.currentPopupAction=null;let ci="pendingRedirect",di=new Map;class ui extends oi{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let t=di.get(this.auth._key());if(!t){try{let e=await(async(e,t)=>{var r;return t=gi(t),!!await(e=mi(e))._isAvailable()&&(r="true"===await e._get(t),await e._remove(t),r)})(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}di.set(this.auth._key(),t)}return this.bypassAuthState||di.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type)this.resolve(null);else if(e.eventId){var t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function hi(e,t){return mi(e)._set(gi(t),"true")}function pi(e,t){di.set(e._key(),t)}function mi(e){return _(e._redirectPersistence)}function gi(e){return y(ci,e.config.apiKey,e.name)}function fi(e,t,r){return(async(e,t,r)=>{var i;return jn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(i=I(e),_e(e,t,b),await i._initializationPromise,await hi(e=ri(i,r),i),e._openRedirect(i,t,"signInViaRedirect"))})(e,t,r)}function vi(e,t,r){return(async(e,t,r)=>{if(_e((e=s(e)).auth,t,b),jn._isFirebaseServerApp(e.auth.app))return Promise.reject(h(e.auth));await e.auth._initializationPromise;await hi(r=ri(e.auth,r),e.auth);var i=await Ii(e);return r._openRedirect(e.auth,t,"reauthViaRedirect",i)})(e,t,r)}function _i(e,t,r){return(async(e,t,r)=>{_e((e=s(e)).auth,t,b),await e.auth._initializationPromise;var r=ri(e.auth,r),i=(await Jt(!1,e,t.providerId),await hi(r,e.auth),await Ii(e));return r._openRedirect(e.auth,t,"linkViaRedirect",i)})(e,t,r)}async function yi(e,t,r=!1){var i;return jn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(i=ri(e=I(e),t),(i=await new ui(e,i,r).execute())&&!r&&(delete i.user._redirectEventId,await e._persistUserIfCurrent(i.user),await e._setRedirectUser(null,t)),i)}async function Ii(e){var t=Nr(e.uid+":::");return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class wi{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let r=!1;return this.consumers.forEach(e=>{this.isEventForConsumer(t,e)&&(r=!0,this.sendToConsumer(t,e),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!(e=>{switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return 1;case"unknown":return Ei(e);default:return}})(t)||(this.hasHandledPotentialRedirect=!0,r)||(this.queuedRedirectEvent=t,r=!0),r}sendToConsumer(e,t){var r;e.error&&!Ei(e)?(r=(null==(r=e.error.code)?void 0:r.split("auth/")[1])||"internal-error",t.onError(u(this.auth,r))):t.onAuthEvent(e)}isEventForConsumer(e,t){var r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return 6e5<=Date.now()-this.lastProcessedEventTime&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ti(e))}saveEventToCache(e){this.cachedEventUids.add(Ti(e)),this.lastProcessedEventTime=Date.now()}}function Ti(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function Ei({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}async function bi(e,t={}){return p(e,"GET","/v1/projects",t)}let ki=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Si=/^https?/;async function Ri(e){if(!e.config.emulator){var t,r=(await bi(e)).authorizedDomains;for(t of r)try{if((e=>{var t,r=Ie(),{protocol:i,hostname:n}=new URL(r);return e.startsWith("chrome-extension://")?""===(t=new URL(e)).hostname&&""===n?"chrome-extension:"===i&&e.replace("chrome-extension://","")===r.replace("chrome-extension://",""):"chrome-extension:"===i&&t.hostname===n:Si.test(i)&&(ki.test(e)?n===e:(r=e.replace(/\./g,"\\."),(t=new RegExp("^(.+\\."+r+"|"+r+")$","i")).test(n)))})(t))return}catch(e){}d(e,"unauthorized-domain")}}let Ai=new Ee(3e4,6e4);function Pi(){var t=C().___jsl;if(null!=t&&t.H)for(var e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Ci(n){return new Promise((e,t)=>{var r;function i(){Pi(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Pi(),t(u(n,"network-request-failed"))},timeout:Ai.get()})}if(null!=(r=null==(r=C().gapi)?void 0:r.iframes)&&r.Iframe)e(gapi.iframes.getContext());else{if(null==(r=C().gapi)||!r.load)return r=pt("iframefcb"),C()[r]=()=>{gapi.load?i():t(u(n,"network-request-failed"))},ht(ut.gapiScript+"?onload="+r).catch(e=>t(e));i()}}).catch(e=>{throw Oi=null,e})}let Oi=null;let Ni=new Ee(5e3,15e3),Li="__/auth/iframe",Di="emulator/auth/iframe",Ui={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Mi=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function Fi(a){i=a;var e,t,r,i=await(Oi=Oi||Ci(i)),n=C().gapi;return m(n,a,"internal-error"),i.open({where:document.body,url:(m((t=(i=a).config).authDomain,i,"auth-domain-config-required"),e=t.emulator?be(t,Di):`https://${i.config.authDomain}/`+Li,t={apiKey:t.apiKey,appName:i.name,v:jn.SDK_VERSION},(r=Mi.get(i.config.apiHost))&&(t.eid=r),(r=i._getFrameworks()).length&&(t.fw=r.join(",")),e+"?"+Q(t).slice(1)),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ui,dontclear:!0},s=>new Promise(async(e,t)=>{await s.restyle({setHideOnLeave:!1});let r=u(a,"network-request-failed"),i=C().setTimeout(()=>{t(r)},Ni.get());function n(){C().clearTimeout(i),e(s)}s.ping(n).then(n,()=>{t(r)})}))}let Vi={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class xi{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function ji(e,t,r,i=500,n=600){var s=Math.max((window.screen.availHeight-n)/2,0).toString(),a=Math.max((window.screen.availWidth-i)/2,0).toString();let o="";var i=Object.assign(Object.assign({},Vi),{width:i.toString(),height:n.toString(),top:s,left:a}),n=l().toLowerCase(),s=(r&&(o=Ze(n)?"_blank":r),Xe(n)&&(t=t||"http://localhost",i.scrollbars="yes"),Object.entries(i).reduce((e,[t,r])=>""+e+t+`=${r},`,""));if([a=l()]=[n],nt(a)&&null!=(a=window.navigator)&&a.standalone&&"_self"!==o)return r=t||"",i=o,(n=document.createElement("a")).href=r,n.target=i,(r=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r),new xi(null);a=window.open(t||"",o,s);m(a,e,"popup-blocked");try{a.focus()}catch(e){}return new xi(a)}let Hi="__/auth/handler",Wi="emulator/auth/handler",qi=encodeURIComponent("fac");async function Bi(e,t,r,i,n,s){m(e.config.authDomain,e,"auth-domain-config-required"),m(e.config.apiKey,e,"invalid-api-key");var a={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:i,v:jn.SDK_VERSION,eventId:n};if(t instanceof b){t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",(e=>{for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return;return 1})(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters()));for(var[o,l]of Object.entries(s||{}))a[o]=l}t instanceof Ft&&0<(r=t.getScopes().filter(e=>""!==e)).length&&(a.scopes=r.join(",")),e.tenantId&&(a.tid=e.tenantId);var c,d=a;for(c of Object.keys(d))void 0===d[c]&&delete d[c];i=await e._getAppCheckToken(),n=i?`#${qi}=`+encodeURIComponent(i):"";return`${s=[e.config][0],s.emulator?be(s,Wi):`https://${s.authDomain}/`+Hi}?`+Q(d).slice(1)+n}let zi="webStorageSupport";class Gi{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Cr,this._completeRedirectFn=yi,this._overrideRedirectResult=pi}async _openPopup(e,t,r,i){a(null==(n=this.eventManagers[e._key()])?void 0:n.manager,"_initialize() not called before _openPopup()");var n=await Bi(e,t,r,Ie(),i);return ji(e,n,Nr())}async _openRedirect(e,t,r,i){await this._originValidation(e);e=await Bi(e,t,r,Ie(),i);return C().location.href=e,new Promise(()=>{})}_initialize(e){let r=e._key();if(this.eventManagers[r]){let{manager:e,promise:t}=this.eventManagers[r];return e?Promise.resolve(e):(a(t,"If manager is not set, promise should be"),t)}let t=this.initAndGetManager(e);return this.eventManagers[r]={promise:t},t.catch(()=>{delete this.eventManagers[r]}),t}async initAndGetManager(t){var e=await Fi(t);let r=new wi(t);return e.register("authEvent",e=>(m(null==e?void 0:e.authEvent,t,"invalid-auth-event"),{status:r.onEvent(e.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=e,r}_isIframeWebStorageSupported(t,r){this.iframes[t._key()].send(zi,{type:zi},e=>{e=null==(e=null==e?void 0:e[0])?void 0:e[zi];void 0!==e&&r(!!e),d(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Ri(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return st()||Qe()||nt()}}let Ki=Gi;class Ji extends class{constructor(e){this.factorId=e}_process(e,t,r){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,r);case"signin":return this._finalizeSignIn(e,t.credential);default:return n("unexpected MultiFactorSessionType")}}}{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new Ji(e)}_finalizeEnroll(e,t,r){return e=e,t={idToken:t,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()},p(e,"POST","/v2/accounts/mfaEnrollment:finalize",o(e,t))}_finalizeSignIn(e,t){return e=e,t={mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()},p(e,"POST","/v2/accounts/mfaSignIn:finalize",o(e,t))}}class Yi{constructor(){}static assertion(e){return Ji._fromCredential(e)}}Yi.FACTOR_ID="phone";var e="@firebase/auth",$i="1.9.0-canary.70e08cf95";class Xi{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null==(e=this.auth.currentUser)?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(t){var e;this.assertAuthConfigured(),this.internalListeners.has(t)||(e=this.auth.onIdTokenChanged(e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}),this.internalListeners.set(t,e),this.updateProactiveRefresh())}removeAuthTokenListener(e){this.assertAuthConfigured();var t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){m(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){0<this.internalListeners.size?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}var Qi,Zi;function en(){return window}Qi="authIdTokenMaxAge",null!=(gn=B())&&gn["_"+Qi],ut={loadJS(i){return new Promise((e,r)=>{var t=document.createElement("script");t.setAttribute("src",i),t.onload=e,t.onerror=e=>{var t=u("internal-error");t.customData=e,r(t)},t.type="text/javascript",t.charset="UTF-8",(null!=(e=null==(e=document.getElementsByTagName("head"))?void 0:e[0])?e:document).appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},Zi="Browser",jn._registerComponent(new le("auth",(e,{options:t})=>{var r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),e=e.getProvider("app-check-internal"),{apiKey:n,authDomain:s}=r.options,n=(m(n&&!n.includes(":"),"invalid-api-key",{appName:r.name}),{apiKey:n,authDomain:s,clientPlatform:Zi,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:at(Zi)}),s=new ct(r,i,e,n);return r=s,e=(null==(i=t)?void 0:i.persistence)||[],e=(Array.isArray(e)?e:[e]).map(_),null!=i&&i.errorMap&&r._updateErrorMap(i.errorMap),r._initializeWithPersistence(e,null==i?void 0:i.popupRedirectResolver),s},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),jn._registerComponent(new le("auth-internal",e=>{var e=I(e.getProvider("auth").getImmediate());return e=e,new Xi(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),jn.registerVersion(e,$i,(e=>{switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}})(Zi)),jn.registerVersion(e,$i,"esm2017");async function tn(e,t,r){var i=en().BuildInfo,n=(a(t.sessionId,"AuthEvent did not contain a session ID"),await(async e=>(e=(t=>{if(a(/[0-9a-zA-Z]+/.test(t),"Can only convert alpha-numeric strings"),"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);var e=new ArrayBuffer(t.length),r=new Uint8Array(e);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r})(e),e=await crypto.subtle.digest("SHA-256",e),(e=Array.from(new Uint8Array(e))).map(e=>e.toString(16).padStart(2,"0")).join("")))(t.sessionId)),s={};return nt()?s.ibi=i.packageName:tt()?s.apn=i.packageName:d(e,"operation-not-supported-in-this-environment"),i.displayName&&(s.appDisplayName=i.displayName),s.sessionId=n,Bi(e,r,t.type,void 0,null!=(i=t.eventId)?i:void 0,s)}function rn(i){let n=en().cordova;return new Promise(r=>{n.plugins.browsertab.isAvailable(e=>{let t=null;e?n.plugins.browsertab.openUrl(i):t=n.InAppBrowser.open(i,(e=l(),/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)?"_blank":"_system"),"location=yes"),r(t)})})}let nn=20;class sn extends wi{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise(e=>{this.resolveInitialized=e})}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(t){return this.resolveInitialized(),this.passiveListeners.forEach(e=>e(t)),super.onEvent(t)}async initialized(){await this.initPromise}}function an(e,t,r=null){return{type:t,eventId:r,urlResponse:null,sessionId:(()=>{var t=[],r="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<nn;e++){var i=Math.floor(Math.random()*r.length);t.push(r.charAt(i))}return t.join("")})(),postBody:null,tenantId:e.tenantId,error:u(e,"no-auth-event")}}async function on(e){var t=await cn()._get(dn(e));return t&&await cn()._remove(dn(e)),t}function ln(e,t){n=un(t=t),i=n.link?decodeURIComponent(n.link):void 0,r=un(i).link,n=n.deep_link_id?decodeURIComponent(n.deep_link_id):void 0;var r,i,n=un(n).link||n||r||i||t;return n.includes("/__/auth/callback")?(t=(i=null==(r=null==(t=null==(i=(r=un(n)).firebaseError?(e=>{try{return JSON.parse(e)}catch(e){return null}})(decodeURIComponent(r.firebaseError)):null)?void 0:i.code)?void 0:t.split("auth/"))?void 0:r[1])?u(i):null)?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:t,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:n,postBody:null}:null}function cn(){return _(Ar)}function dn(e){return y("authEvent",e.config.apiKey,e.name)}function un(e){var t;return null!=e&&e.includes("?")?([t,...e]=e.split("?"),Z(e.join("?"))):{}}class hn{constructor(){this._redirectPersistence=Cr,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=yi,this._overrideRedirectResult=pi}async _initialize(e){var t=e._key();let r=this.eventManagers.get(t);return r||(r=new sn(e),this.eventManagers.set(t,r),this.attachCallbackListeners(e,r)),r}_openPopup(e){d(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,r,i){n=e,a=en(),m("function"==typeof(null==(s=null==a?void 0:a.universalLinks)?void 0:s.subscribe),n,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),m(void 0!==(null==(s=null==a?void 0:a.BuildInfo)?void 0:s.packageName),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),m("function"==typeof(null==(s=null==(s=null==(s=null==a?void 0:a.cordova)?void 0:s.plugins)?void 0:s.browsertab)?void 0:s.openUrl),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),m("function"==typeof(null==(s=null==(s=null==(s=null==a?void 0:a.cordova)?void 0:s.plugins)?void 0:s.browsertab)?void 0:s.isAvailable),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),m("function"==typeof(null==(a=null==(s=null==a?void 0:a.cordova)?void 0:s.InAppBrowser)?void 0:a.open),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"});var n,s=await this._initialize(e),a=(await s.initialized(),s.resetRedirect(),di.clear(),await this._originValidation(e),an(e,r,i)),i=(n=e,r=a,await cn()._set(dn(n),r),await tn(e,a,t));return(async(a,o,l)=>{let c=en().cordova,d=()=>{};try{await new Promise((t,e)=>{let r=null;function i(){t();var e=null==(e=c.plugins.browsertab)?void 0:e.close;"function"==typeof e&&e(),"function"==typeof(null==l?void 0:l.close)&&l.close()}function n(){r=r||window.setTimeout(()=>{e(u(a,"redirect-cancelled-by-user"))},2e3)}function s(){"visible"===(null==document?void 0:document.visibilityState)&&n()}o.addPassiveListener(i),document.addEventListener("resume",n,!1),tt()&&document.addEventListener("visibilitychange",s,!1),d=()=>{o.removePassiveListener(i),document.removeEventListener("resume",n,!1),document.removeEventListener("visibilitychange",s,!1),r&&window.clearTimeout(r)}})}finally{d()}})(e,s,await rn(i))}_isIframeWebStorageSupported(e,t){throw new Error("Method not implemented.")}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=(async e=>{var t=en().BuildInfo,r={};nt()?r.iosBundleId=t.packageName:tt()?r.androidPackageName=t.packageName:d(e,"operation-not-supported-in-this-environment"),await bi(e,r)})(e)),this.originValidationPromises[t]}attachCallbackListeners(i,n){var{universalLinks:e,handleOpenURL:t,BuildInfo:r}=en();let s=setTimeout(async()=>{await on(i),n.onEvent(mn())},500),a=async e=>{clearTimeout(s);var t=await on(i);let r=null;t&&null!=e&&e.url&&(r=ln(t,e.url)),n.onEvent(r||mn())},o=(void 0!==e&&"function"==typeof e.subscribe&&e.subscribe(null,a),t),l=r.packageName.toLowerCase()+"://";en().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(l)&&a({url:e}),"function"==typeof o)try{o(e)}catch(e){console.error(e)}}}}let pn=hn;function mn(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:u("no-auth-event")}}var gn;function fn(){var e;return(null==(e=null==self?void 0:self.location)?void 0:e.protocol)||null}function vn(e=l()){return!("file:"!==fn()&&"ionic:"!==fn()&&"capacitor:"!==fn()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function _n(e=l()){return J()&&11===(null==document?void 0:document.documentMode)||([e=l()]=[e],/Edge\/\d+/.test(e))}function yn(){try{var e=self.localStorage,t=Nr();if(e)return e.setItem(t,"1"),e.removeItem(t),!_n()||Y()}catch(e){return In()&&Y()}return!1}function In(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function wn(){return("http:"===fn()||"https:"===fn()||G()||vn())&&!(K()||z())&&yn()&&!In()}function Tn(){return vn()&&"undefined"!=typeof document}let L={LOCAL:"local",NONE:"none",SESSION:"session"},En=m,bn="persistence";async function kn(e){await e._initializationPromise;var t=Sn(),r=y(bn,e.config.apiKey,e.name);t&&t.setItem(r,e._getPersistence())}function Sn(){var e;try{return(null===(e="undefined"!=typeof window?window:null)?void 0:e.sessionStorage)||null}catch(e){return null}}let Rn=m;class D{constructor(){this.browserResolver=_(Ki),this.cordovaResolver=_(pn),this.underlyingResolver=null,this._redirectPersistence=Cr,this._completeRedirectFn=yi,this._overrideRedirectResult=pi}async _initialize(e){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._initialize(e)}async _openPopup(e,t,r,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openPopup(e,t,r,i)}async _openRedirect(e,t,r,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openRedirect(e,t,r,i)}_isIframeWebStorageSupported(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)}_originValidation(e){return this.assertedUnderlyingResolver._originValidation(e)}get _shouldInitProactively(){return Tn()||this.browserResolver._shouldInitProactively}get assertedUnderlyingResolver(){return Rn(this.underlyingResolver,"internal-error"),this.underlyingResolver}async selectUnderlyingResolver(){var e;this.underlyingResolver||(e=await(!!Tn()&&new Promise(e=>{let t=setTimeout(()=>{e(!1)},1e3);document.addEventListener("deviceready",()=>{clearTimeout(t),e(!0)})})),this.underlyingResolver=e?this.cordovaResolver:this.browserResolver)}}function An(e){return e.unwrap()}function Pn(e,t){var r,i,n=null==(n=t.customData)?void 0:n._tokenResponse;"auth/multi-factor-auth-required"===(null==t?void 0:t.code)?t.resolver=new Nn(e,(r=t,e=s(e=e),m((i=r).customData.operationType,e,"argument-error"),m(null==(r=i.customData._serverResponse)?void 0:r.mfaPendingCredential,e,"argument-error"),wr._fromError(e,i))):n&&(e=Cn(r=t))&&(r.credential=e,r.tenantId=n.tenantId||void 0,r.email=n.email||void 0,r.phoneNumber=n.phoneNumber||void 0)}function Cn(e){var t=(e instanceof c?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof c)&&"temporaryProof"in t&&"phoneNumber"in t)return O.credentialFromResult(e);var r=t.providerId;if(!r||r===ce.PASSWORD)return null;let i;switch(r){case ce.GOOGLE:i=S;break;case ce.FACEBOOK:i=k;break;case ce.GITHUB:i=R;break;case ce.TWITTER:i=A;break;default:var{oauthIdToken:n,oauthAccessToken:s,oauthTokenSecret:a,pendingToken:o,nonce:l}=t;return s||a||n||o?o?r.startsWith("saml.")?xt._create(r,o):E._fromParams({providerId:r,signInMethod:r,pendingToken:o,idToken:n,accessToken:s}):new Vt(r).credential({idToken:n,accessToken:s,rawNonce:l}):null}return e instanceof c?i.credentialFromError(e):i.credentialFromResult(e)}function U(t,e){return e.catch(e=>{throw e instanceof c&&Pn(t,e),e}).then(e=>{var t=e.operationType,r=e.user;return{operationType:t,credential:Cn(e),additionalUserInfo:yr(e),user:M.getOrCreate(r)}})}async function On(t,e){let r=await e;return{verificationId:r.verificationId,confirm:e=>U(t,r.confirm(e))}}class Nn{constructor(e,t){this.resolver=t,this.auth=e.wrapped()}get session(){return this.resolver.session}get hints(){return this.resolver.hints}resolveSignIn(e){return U(An(this.auth),this.resolver.resolveSignIn(e))}}class M{constructor(e){this._delegate=e,this.multiFactor=(e=s(e=e),br.has(e)||br.set(e,Er._fromUser(e)),br.get(e))}static getOrCreate(e){return M.USER_MAP.has(e)||M.USER_MAP.set(e,new M(e)),M.USER_MAP.get(e)}delete(){return this._delegate.delete()}reload(){return this._delegate.reload()}toJSON(){return this._delegate.toJSON()}getIdTokenResult(e){return this._delegate.getIdTokenResult(e)}getIdToken(e){return this._delegate.getIdToken(e)}linkAndRetrieveDataWithCredential(e){return this.linkWithCredential(e)}async linkWithCredential(e){return U(this.auth,Qt(this._delegate,e))}async linkWithPhoneNumber(e,t){return On(this.auth,(async(e,t,r)=>{let i=s(e);return await Jt(!1,i,"phone"),e=await ei(i.auth,t,s(r)),new Zr(e,e=>Qt(i,e))})(this._delegate,e,t))}async linkWithPopup(e){return U(this.auth,(async(e,t,r)=>(_e((e=s(e)).auth,t,b),r=ri(e.auth,r),new N(e.auth,"linkViaPopup",t,r,e).executeNotNull()))(this._delegate,e,D))}async linkWithRedirect(e){return await kn(I(this.auth)),_i(this._delegate,e,D)}reauthenticateAndRetrieveDataWithCredential(e){return this.reauthenticateWithCredential(e)}async reauthenticateWithCredential(e){return U(this.auth,Zt(this._delegate,e))}reauthenticateWithPhoneNumber(e,t){return On(this.auth,(async(e,t,r)=>{let i=s(e);return jn._isFirebaseServerApp(i.auth.app)?Promise.reject(h(i.auth)):(e=await ei(i.auth,t,s(r)),new Zr(e,e=>Zt(i,e)))})(this._delegate,e,t))}reauthenticateWithPopup(e){return U(this.auth,(async(e,t,r)=>(e=s(e),jn._isFirebaseServerApp(e.auth.app)?Promise.reject(u(e.auth,"operation-not-supported-in-this-environment")):(_e(e.auth,t,b),r=ri(e.auth,r),new N(e.auth,"reauthViaPopup",t,r,e).executeNotNull())))(this._delegate,e,D))}async reauthenticateWithRedirect(e){return await kn(I(this.auth)),vi(this._delegate,e,D)}sendEmailVerification(e){return cr(this._delegate,e)}async unlink(e){return await Gt(this._delegate,e),this}updateEmail(e){return t=this._delegate,e=e,t=s(t),jn._isFirebaseServerApp(t.auth.app)?Promise.reject(h(t.auth)):hr(t,e,null);var t}updatePassword(e){return hr(s(this._delegate),null,e)}updatePhoneNumber(e){return(async(e,t)=>{if(e=s(e),jn._isFirebaseServerApp(e.auth.app))return Promise.reject(h(e.auth));await Kt(e,t)})(this._delegate,e)}updateProfile(e){return ur(this._delegate,e)}verifyBeforeUpdateEmail(e,t){return dr(this._delegate,e,t)}get emailVerified(){return this._delegate.emailVerified}get isAnonymous(){return this._delegate.isAnonymous}get metadata(){return this._delegate.metadata}get phoneNumber(){return this._delegate.phoneNumber}get providerData(){return this._delegate.providerData}get refreshToken(){return this._delegate.refreshToken}get tenantId(){return this._delegate.tenantId}get displayName(){return this._delegate.displayName}get email(){return this._delegate.email}get photoURL(){return this._delegate.photoURL}get providerId(){return this._delegate.providerId}get uid(){return this._delegate.uid}get auth(){return this._delegate.auth}}M.USER_MAP=new WeakMap;let Ln=m;class Dn{constructor(e,t){var r,i;this.app=e,t.isInitialized()?this._delegate=t.getImmediate():(r=e.options.apiKey,Ln(r,"invalid-api-key",{appName:e.name}),Ln(r,"invalid-api-key",{appName:e.name}),i="undefined"!=typeof window?D:void 0,this._delegate=t.initialize({options:{persistence:((e,t)=>{var r=((e,t)=>{var r=Sn();if(!r)return[];switch(e=y(bn,e,t),r.getItem(e)){case L.NONE:return[Je];case L.LOCAL:return[Br,Cr];case L.SESSION:return[Cr];default:return[]}})(e,t);if("undefined"==typeof self||r.includes(Br)||r.push(Br),"undefined"!=typeof window)for(var i of[Ar,Cr])r.includes(i)||r.push(i);return r.includes(Je)||r.push(Je),r})(r,e.name),popupRedirectResolver:i}}),this._delegate._updateErrorMap(he)),this.linkUnderlyingAuth()}get emulatorConfig(){return this._delegate.emulatorConfig}get currentUser(){return this._delegate.currentUser?M.getOrCreate(this._delegate.currentUser):null}get languageCode(){return this._delegate.languageCode}set languageCode(e){this._delegate.languageCode=e}get settings(){return this._delegate.settings}get tenantId(){return this._delegate.tenantId}set tenantId(e){this._delegate.tenantId=e}useDeviceLanguage(){this._delegate.useDeviceLanguage()}signOut(){return this._delegate.signOut()}useEmulator(e,t){wt(this._delegate,e,t)}applyActionCode(e){return ar(this._delegate,e)}checkActionCode(e){return or(this._delegate,e)}confirmPasswordReset(e,t){return(async(t,e,r)=>{await kt(s(t),{oobCode:e,newPassword:r}).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&sr(t),e})})(this._delegate,e,t)}async createUserWithEmailAndPassword(e,t){return U(this._delegate,(async(t,e,r)=>{var i;return jn._isFirebaseServerApp(t.app)?Promise.reject(h(t)):(e=await w(i=I(t),{returnSecureToken:!0,email:e,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Ht,"EMAIL_PASSWORD_PROVIDER").catch(e=>{throw"auth/password-does-not-meet-requirements"===e.code&&sr(t),e}),r=await P._fromIdTokenResponse(i,"signIn",e),await i._updateCurrentUser(r.user),r)})(this._delegate,e,t))}fetchProvidersForEmail(e){return this.fetchSignInMethodsForEmail(e)}fetchSignInMethodsForEmail(e){return lr(this._delegate,e)}isSignInWithEmailLink(e){return this._delegate,e=e,"EMAIL_SIGNIN"===(null==(e=Ut.parseLink(e))?void 0:e.operation)}async getRedirectResult(){Ln(wn(),this._delegate,"operation-not-supported-in-this-environment");t=this._delegate,e=D,await I(t)._initializationPromise;var e,t=await yi(t,e,!1);return t?U(this._delegate,Promise.resolve(t)):{credential:null,user:null}}addFrameworkForLogging(e){I(this._delegate)._logFramework(e)}onAuthStateChanged(e,t,r){var{next:e,error:t,complete:r}=Un(e,t,r);return this._delegate.onAuthStateChanged(e,t,r)}onIdTokenChanged(e,t,r){var{next:e,error:t,complete:r}=Un(e,t,r);return this._delegate.onIdTokenChanged(e,t,r)}sendSignInLinkToEmail(e,t){return(async(e,t,r)=>{let i=I(e);t=e={requestType:"EMAIL_SIGNIN",email:t,clientType:"CLIENT_TYPE_WEB"},m((r=r).handleCodeInApp,i,"argument-error"),r&&nr(i,t,r),await w(i,e,"getOobCode",Ct,"EMAIL_PASSWORD_PROVIDER")})(this._delegate,e,t)}sendPasswordResetEmail(e,t){return(async(e,t,r)=>{e=I(e),t={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"},r&&nr(e,t,r),await w(e,t,"getOobCode",Pt,"EMAIL_PASSWORD_PROVIDER")})(this._delegate,e,t||void 0)}async setPersistence(e){var t,r;t=this._delegate,r=e,En(Object.values(L).includes(r),t,"invalid-persistence-type"),K()?En(r!==L.SESSION,t,"unsupported-persistence-type"):z()?En(r===L.NONE,t,"unsupported-persistence-type"):In()?En(r===L.NONE||r===L.LOCAL&&Y(),t,"unsupported-persistence-type"):En(r===L.NONE||yn(),t,"unsupported-persistence-type");let i;switch(e){case L.SESSION:i=Cr;break;case L.LOCAL:var n=await _(Br)._isAvailable();i=n?Br:Ar;break;case L.NONE:i=Je;break;default:return d("argument-error",{appName:this._delegate.name})}return this._delegate.setPersistence(i)}signInAndRetrieveDataWithCredential(e){return this.signInWithCredential(e)}signInAnonymously(){return U(this._delegate,(async e=>{var t;return jn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(await(e=I(e))._initializationPromise,null!=(t=e.currentUser)&&t.isAnonymous?new P({user:e.currentUser,providerId:null,operationType:"signIn"}):(t=await Ht(e,{returnSecureToken:!0}),t=await P._fromIdTokenResponse(e,"signIn",t,!0),await e._updateCurrentUser(t.user),t))})(this._delegate))}signInWithCredential(e){return U(this._delegate,Xt(this._delegate,e))}signInWithCustomToken(e){return U(this._delegate,er(this._delegate,e))}signInWithEmailAndPassword(e,t){return U(this._delegate,(r=this._delegate,e=e,t=t,jn._isFirebaseServerApp(r.app)?Promise.reject(h(r)):Xt(s(r),Mt.credential(e,t)).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&sr(r),e})));var r}signInWithEmailLink(e,t){return U(this._delegate,(async(e,t,r)=>jn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(e=s(e),m((t=Mt.credentialWithLink(t,r||Ie()))._tenantId===(e.tenantId||null),e,"tenant-id-mismatch"),Xt(e,t)))(this._delegate,e,t))}signInWithPhoneNumber(e,t){return On(this._delegate,(async(e,t,r)=>{if(jn._isFirebaseServerApp(e.app))return Promise.reject(h(e));let i=I(e);return e=await ei(i,t,s(r)),new Zr(e,e=>Xt(i,e))})(this._delegate,e,t))}async signInWithPopup(e){return Ln(wn(),this._delegate,"operation-not-supported-in-this-environment"),U(this._delegate,(async(e,t,r)=>{var i;return jn._isFirebaseServerApp(e.app)?Promise.reject(u(e,"operation-not-supported-in-this-environment")):(i=I(e),_e(e,t,b),e=ri(i,r),new N(i,"signInViaPopup",t,e).executeNotNull())})(this._delegate,e,D))}async signInWithRedirect(e){return Ln(wn(),this._delegate,"operation-not-supported-in-this-environment"),await kn(this._delegate),fi(this._delegate,e,D)}updateCurrentUser(e){return this._delegate.updateCurrentUser(e)}verifyPasswordResetCode(e){return(async(e,t)=>(e=(await or(s(e),t)).data).email)(this._delegate,e)}unwrap(){return this._delegate}_delete(){return this._delegate._delete()}linkUnderlyingAuth(){this._delegate.wrapped=()=>this}}function Un(e,t,r){let i=e,n=("function"!=typeof e&&({next:i,error:t,complete:r}=e),i);return{next:e=>n(e&&M.getOrCreate(e)),error:t,complete:r}}Dn.Persistence=L;class Mn{static credential(e,t){return O.credential(e,t)}constructor(){this.providerId="phone",this._delegate=new O(An(F.default.auth()))}verifyPhoneNumber(e,t){return this._delegate.verifyPhoneNumber(e,t)}unwrap(){return this._delegate}}Mn.PHONE_SIGN_IN_METHOD=O.PHONE_SIGN_IN_METHOD,Mn.PROVIDER_ID=O.PROVIDER_ID;let Fn=m;class Vn{constructor(e,t,r=F.default.app()){var i;Fn(null==(i=r.options)?void 0:i.apiKey,"invalid-api-key",{appName:r.name}),this._delegate=new Qr(r.auth(),e,t),this.type=this._delegate.type}clear(){this._delegate.clear()}render(){return this._delegate.render()}verify(){return this._delegate.verify()}}(gn=F.default).INTERNAL.registerComponent(new le("auth-compat",e=>{var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth");return new Dn(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:de.EMAIL_SIGNIN,PASSWORD_RESET:de.PASSWORD_RESET,RECOVER_EMAIL:de.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:de.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:de.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:de.VERIFY_EMAIL}},EmailAuthProvider:Mt,FacebookAuthProvider:k,GithubAuthProvider:R,GoogleAuthProvider:S,OAuthProvider:Vt,SAMLAuthProvider:jt,PhoneAuthProvider:Mn,PhoneMultiFactorGenerator:Yi,RecaptchaVerifier:Vn,TwitterAuthProvider:A,Auth:Dn,AuthCredential:bt,Error:c}).setInstantiationMode("LAZY").setMultipleInstances(!1)),gn.registerVersion("@firebase/auth-compat","0.5.18-canary.70e08cf95")}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}});//# sourceMappingURL=firebase-auth.js.map
|
|
1
|
+
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)})(this,function(Hn,Wn){try{!function(){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var F=t(Hn);let V={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(i,e){if(!Array.isArray(i))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,s=[];for(let r=0;r<i.length;r+=3){var a=i[r],o=r+1<i.length,l=o?i[r+1]:0,c=r+2<i.length,d=c?i[r+2]:0;let e=(15&l)<<2|d>>6,t=63&d;c||(t=64,o)||(e=64),s.push(n[a>>2],n[(3&a)<<4|l>>4],n[e],n[t])}return s.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray((r=>{var i=[];let n=0;for(let t=0;t<r.length;t++){let e=r.charCodeAt(t);e<128?i[n++]=e:(e<2048?i[n++]=e>>6|192:(55296==(64512&e)&&t+1<r.length&&56320==(64512&r.charCodeAt(t+1))?(e=65536+((1023&e)<<10)+(1023&r.charCodeAt(++t)),i[n++]=e>>18|240,i[n++]=e>>12&63|128):i[n++]=e>>12|224,i[n++]=e>>6&63|128),i[n++]=63&e|128)}return i})(e),t)},decodeString(r,i){if(this.HAS_NATIVE_SUPPORT&&!i)return atob(r);{var n=this.decodeStringToByteArray(r,i);var s=[];let e=0,t=0;for(;e<n.length;){var a,o,l,c=n[e++];c<128?s[t++]=String.fromCharCode(c):191<c&&c<224?(a=n[e++],s[t++]=String.fromCharCode((31&c)<<6|63&a)):239<c&&c<365?(a=((7&c)<<18|(63&n[e++])<<12|(63&n[e++])<<6|63&n[e++])-65536,s[t++]=String.fromCharCode(55296+(a>>10)),s[t++]=String.fromCharCode(56320+(1023&a))):(o=n[e++],l=n[e++],s[t++]=String.fromCharCode((15&c)<<12|(63&o)<<6|63&l))}return s.join("");return}},decodeStringToByteArray(t,e){this.init_();var r=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let e=0;e<t.length;){var n=r[t.charAt(e++)],s=e<t.length?r[t.charAt(e)]:0,a=++e<t.length?r[t.charAt(e)]:64,o=++e<t.length?r[t.charAt(e)]:64;if(++e,null==n||null==s||null==a||null==o)throw new x;i.push(n<<2|s>>4),64!==a&&(i.push(s<<4&240|a>>2),64!==o)&&i.push(a<<6&192|o)}return i},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)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class x extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let j=function(e){try{return V.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};let H=()=>(()=>{if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")})().__FIREBASE_DEFAULTS__,W=()=>{var e;return"undefined"!=typeof process&&void 0!==process.env&&(e=process.env.__FIREBASE_DEFAULTS__)?JSON.parse(e):void 0},q=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&j(e[1]);return t&&JSON.parse(t)}},B=()=>{try{return H()||W()||q()}catch(e){console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}};var i;function l(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function z(){var e=null==(e=B())?void 0:e.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function G(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function K(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function J(){var e=l();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function Y(){try{return"object"==typeof indexedDB}catch(e){return!1}}class c extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,c.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,$.prototype.create)}}class ${constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var i,t=t[0]||{},r=this.service+"/"+e,e=this.errors[e],e=e?(i=t,e.replace(X,(e,t)=>{var r=i[t];return null!=r?String(r):`<${t}?>`})):"Error",e=this.serviceName+`: ${e} (${r}).`;return new c(r,e,t)}}let X=/\{\$([^}]+)}/g;function Q(e,t){if(e!==t){var r,i,n=Object.keys(e),s=Object.keys(t);for(r of n){if(!s.includes(r))return!1;var a=e[r],o=t[r];if(Z(a)&&Z(o)){if(!Q(a,o))return!1}else if(a!==o)return!1}for(i of s)if(!n.includes(i))return!1}return!0}function Z(e){return null!==e&&"object"==typeof e}function ee(r){let i=[];for(let[t,e]of Object.entries(r))Array.isArray(e)?e.forEach(e=>{i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))}):i.push(encodeURIComponent(t)+"="+encodeURIComponent(e));return i.length?"&"+i.join("&"):""}function te(e){let r={};return e.replace(/^\?/,"").split("&").forEach(e=>{var t;e&&([e,t]=e.split("="),r[decodeURIComponent(e)]=decodeURIComponent(t))}),r}function re(e){var t,r=e.indexOf("?");return r?(t=e.indexOf("#",r),e.substring(r,0<t?t:void 0)):""}class ie{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(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");void 0===(i=((e,t)=>{if("object"==typeof e&&null!==e)for(var r of t)if(r in e&&"function"==typeof e[r])return 1})(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&&(i.next=ne),void 0===i.error&&(i.error=ne),void 0===i.complete&&(i.complete=ne);e=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}}),this.observers.push(i),e}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount)&&void 0!==this.onNoObservers&&this.onNoObservers(this)}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}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 ne(){}function s(e){return e&&e._delegate?e._delegate:e}(e=i=i||{})[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";let se={debug:i.DEBUG,verbose:i.VERBOSE,info:i.INFO,warn:i.WARN,error:i.ERROR,silent:i.SILENT},ae=i.INFO,oe={[i.DEBUG]:"log",[i.VERBOSE]:"log",[i.INFO]:"info",[i.WARN]:"warn",[i.ERROR]:"error"},le=(e,t,...r)=>{if(!(t<e.logLevel)){var i=(new Date).toISOString(),n=oe[t];if(!n)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[n](`[${i}] ${e.name}:`,...r)}};function ce(e,t){var r={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,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}class de{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}}let ue={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},he={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};function pe(){return{"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."}}function me(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","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.","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.","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.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","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.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","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.","invalid-auth-event":"An internal AuthError has occurred.","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.","invalid-continue-uri":"The continue URL provided in the request is invalid.","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.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","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.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","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].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","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.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","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.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","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.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","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.","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.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","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.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","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.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}let ge=pe,fe=new $("auth","Firebase",pe()),ve=new class{constructor(e){this.name=e,this._logLevel=ae,this._logHandler=le,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in i))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?se[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,i.DEBUG,...e),this._logHandler(this,i.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,i.VERBOSE,...e),this._logHandler(this,i.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,i.INFO,...e),this._logHandler(this,i.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,i.WARN,...e),this._logHandler(this,i.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,i.ERROR,...e),this._logHandler(this,i.ERROR,...e)}}("@firebase/auth");function _e(e,...t){ve.logLevel<=i.ERROR&&ve.error(`Auth (${Wn.SDK_VERSION}): `+e,...t)}function d(e,...t){throw we(e,...t)}function u(e,...t){return we(e,...t)}function ye(e,t,r){r=Object.assign(Object.assign({},ge()),{[t]:r});return new $("auth","Firebase",r).create(t,{appName:e.name})}function h(e){return ye(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Ie(e,t,r){if(!(t instanceof r))throw r.name!==t.constructor.name&&d(e,"argument-error"),ye(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.`+"Did you pass a reference from a different Auth SDK?")}function we(e,...t){var r,i;return"string"!=typeof e?(r=t[0],(i=[...t.slice(1)])[0]&&(i[0].appName=e.name),e._errorFactory.create(r,...i)):fe.create(e,...t)}function m(e,t,...r){if(!e)throw we(t,...r)}function n(e){e="INTERNAL ASSERTION FAILED: "+e;throw _e(e),new Error(e)}function a(e,t){e||n(t)}function Te(){var e;return"undefined"!=typeof self&&(null==(e=self.location)?void 0:e.href)||""}function Ee(){return"http:"===be()||"https:"===be()}function be(){var e;return"undefined"!=typeof self&&(null==(e=self.location)?void 0:e.protocol)||null}class ke{constructor(e,t){a((this.shortDelay=e)<(this.longDelay=t),"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(l())||K()}get(){return"undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&(Ee()||G()||"connection"in navigator)&&!navigator.onLine?Math.min(5e3,this.shortDelay):this.isMobile?this.longDelay:this.shortDelay}}function Se(e,t){a(e.emulator,"Emulator should always be set here");e=e.emulator.url;return t?""+e+(t.startsWith("/")?t.slice(1):t):e}class Re{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl||("undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void n("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static headers(){return this.headersImpl||("undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void n("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}static response(){return this.responseImpl||("undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void n("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill"))}}let Ae={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Pe=new ke(3e4,6e4);function o(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function p(n,s,a,o,e={}){return Ce(n,e,async()=>{let e={},t={};o&&("GET"===s?t=o:e={body:JSON.stringify(o)});var r=ee(Object.assign({key:n.config.apiKey},t)).slice(1),i=await n._getAdditionalHeaders(),i=(i["Content-Type"]="application/json",n.languageCode&&(i["X-Firebase-Locale"]=n.languageCode),Object.assign({method:s,headers:i},e));return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(i.referrerPolicy="no-referrer"),Re.fetch()(Oe(n,n.config.apiHost,a,r),i)})}async function Ce(t,e,r){t._canInitEmulator=!1;e=Object.assign(Object.assign({},Ae),e);try{var i=new Ne(t),n=await Promise.race([r(),i.promise]),s=(i.clearNetworkTimeout(),await n.json());if("needConfirmation"in s)throw Le(t,"account-exists-with-different-credential",s);if(n.ok&&!("errorMessage"in s))return s;var[a,o]=(n.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===a)throw Le(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===a)throw Le(t,"email-already-in-use",s);if("USER_DISABLED"===a)throw Le(t,"user-disabled",s);var l=e[a]||a.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw ye(t,l,o);d(t,l)}catch(e){if(e instanceof c)throw e;d(t,"network-request-failed",{message:String(e)})}}async function r(e,t,r,i,n={}){t=await p(e,t,r,i,n);return"mfaPendingCredential"in t&&d(e,"multi-factor-auth-required",{_serverResponse:t}),t}function Oe(e,t,r,i){t=""+t+r+"?"+i;return e.config.emulator?Se(e.config,t):e.config.apiScheme+"://"+t}class Ne{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(u(this.auth,"network-request-failed")),Pe.get())})}}function Le(e,t,r){var i={appName:e.name},e=(r.email&&(i.email=r.email),r.phoneNumber&&(i.phoneNumber=r.phoneNumber),u(e,t,i));return e.customData._tokenResponse=r,e}function De(e){return void 0!==e&&void 0!==e.getResponse}function Ue(e){return void 0!==e&&void 0!==e.enterprise}class Me{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(t){if(this.recaptchaEnforcementState&&0!==this.recaptchaEnforcementState.length)for(let e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t){switch(e.enforcementState){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}return}return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Fe(e,t){return p(e,"GET","/v2/recaptchaConfig",o(e,t))}async function Ve(e,t){return p(e,"POST","/v1/accounts:lookup",t)}function xe(e){if(e)try{var t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function je(e){return 1e3*Number(e)}function He(e){var[e,t,r]=e.split(".");if(void 0===e||void 0===t||void 0===r)return _e("JWT malformed, contained fewer than 3 sections"),null;try{var i=j(t);return i?JSON.parse(i):(_e("Failed to decode base64 JWT payload"),null)}catch(e){return _e("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function We(e){e=He(e);return m(e,"internal-error"),m(void 0!==e.exp,"internal-error"),m(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}async function g(t,e,r=!1){if(r)return e;try{return await e}catch(e){throw e instanceof c&&(r=[e.code][0],"auth/user-disabled"===r||"auth/user-token-expired"===r)&&(t.auth.currentUser===t&&await t.auth.signOut()),e}}class qe{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId)&&clearTimeout(this.timerId)}getInterval(e){return e?(e=this.errorBackoff,this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e):(this.errorBackoff=3e4,e=(null!=(e=this.user.stsTokenManager.expirationTime)?e:0)-Date.now()-3e5,Math.max(0,e))}schedule(e=!1){this.isRunning&&(e=this.getInterval(e),this.timerId=setTimeout(async()=>{await this.iteration()},e))}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class Be{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=xe(this.lastLoginAt),this.creationTime=xe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function ze(e){var t=e.auth,r=await e.getIdToken(),r=await g(e,Ve(t,{idToken:r})),t=(m(null==r?void 0:r.users.length,t,"internal-error"),r.users[0]),r=(e._notifyReloadListener(t),null!=(r=t.providerUserInfo)&&r.length?Ge(t.providerUserInfo):[]),r=((e,r)=>[...e=e.filter(t=>!r.some(e=>e.providerId===t.providerId)),...r])(e.providerData,r),i=!(e.email&&t.passwordHash||null!=r&&r.length),i=!!e.isAnonymous&&i,r={uid:t.localId,displayName:t.displayName||null,photoURL:t.photoUrl||null,email:t.email||null,emailVerified:t.emailVerified||!1,phoneNumber:t.phoneNumber||null,tenantId:t.tenantId||null,providerData:r,metadata:new Be(t.createdAt,t.lastLoginAt),isAnonymous:i};Object.assign(e,r)}function Ge(e){return e.map(e=>{var t=e.providerId,e=ce(e,["providerId"]);return{providerId:t,uid:e.rawId||"",displayName:e.displayName||null,email:e.email||null,phoneNumber:e.phoneNumber||null,photoURL:e.photoUrl||null}})}class Ke{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){m(e.idToken,"internal-error"),m(void 0!==e.idToken,"internal-error"),m(void 0!==e.refreshToken,"internal-error");var t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):We(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){m(0!==e.length,"internal-error");var t=We(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(m(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){n=t;var i,n,{accessToken:e,refreshToken:t,expiresIn:r}=await{accessToken:(t=await Ce(i=e,{},async()=>{var e=ee({grant_type:"refresh_token",refresh_token:n}).slice(1),{tokenApiHost:t,apiKey:r}=i.config,t=Oe(i,t,"/v1/token","key="+r),r=await i._getAdditionalHeaders();return r["Content-Type"]="application/x-www-form-urlencoded",Re.fetch()(t,{method:"POST",headers:r,body:e})})).access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token};this.updateTokensAndExpiration(e,t,Number(r))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){var{refreshToken:t,accessToken:r,expirationTime:i}=t,n=new Ke;return t&&(m("string"==typeof t,"internal-error",{appName:e}),n.refreshToken=t),r&&(m("string"==typeof r,"internal-error",{appName:e}),n.accessToken=r),i&&(m("number"==typeof i,"internal-error",{appName:e}),n.expirationTime=i),n}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ke,this.toJSON())}_performRefresh(){return n("not implemented")}}function f(e,t){m("string"==typeof e||void 0===e,"internal-error",{appName:t})}class v{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,e=ce(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new qe(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=e.displayName||null,this.email=e.email||null,this.emailVerified=e.emailVerified||!1,this.phoneNumber=e.phoneNumber||null,this.photoURL=e.photoURL||null,this.isAnonymous=e.isAnonymous||!1,this.tenantId=e.tenantId||null,this.providerData=e.providerData?[...e.providerData]:[],this.metadata=new Be(e.createdAt||void 0,e.lastLoginAt||void 0)}async getIdToken(e){e=await g(this,this.stsTokenManager.getToken(this.auth,e));return m(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(e){return(async(e,t=!1)=>{var e=s(e),r=He(t=await e.getIdToken(t)),i=(m(r&&r.exp&&r.auth_time&&r.iat,e.auth,"internal-error"),null==(e="object"==typeof r.firebase?r.firebase:void 0)?void 0:e.sign_in_provider);return{claims:r,token:t,authTime:xe(je(r.auth_time)),issuedAtTime:xe(je(r.iat)),expirationTime:xe(je(r.exp)),signInProvider:i||null,signInSecondFactor:(null==e?void 0:e.sign_in_second_factor)||null}})(this,e)}reload(){return(async e=>{await ze(e=s(e)),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)})(this)}_assign(e){this!==e&&(m(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){e=new v(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(e){m(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await ze(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){var e;return Wn._isFirebaseServerApp(this.auth.app)?Promise.reject(h(this.auth)):(e=await this.getIdToken(),await g(this,(async(e,t)=>p(e,"POST","/v1/accounts:delete",t))(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut())}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r=null!=(r=t.displayName)?r:void 0,i=null!=(i=t.email)?i:void 0,n=null!=(n=t.phoneNumber)?n:void 0,s=null!=(s=t.photoURL)?s:void 0,a=null!=(a=t.tenantId)?a:void 0,o=null!=(o=t._redirectEventId)?o:void 0,l=null!=(l=t.createdAt)?l:void 0,c=null!=(c=t.lastLoginAt)?c:void 0,{uid:t,emailVerified:d,isAnonymous:u,providerData:h,stsTokenManager:p}=t,p=(m(t&&p,e,"internal-error"),Ke.fromJSON(this.name,p)),t=(m("string"==typeof t,e,"internal-error"),f(r,e.name),f(i,e.name),m("boolean"==typeof d,e,"internal-error"),m("boolean"==typeof u,e,"internal-error"),f(n,e.name),f(s,e.name),f(a,e.name),f(o,e.name),f(l,e.name),f(c,e.name),new v({uid:t,auth:e,email:i,emailVerified:d,displayName:r,isAnonymous:u,photoURL:s,phoneNumber:n,tenantId:a,stsTokenManager:p,createdAt:l,lastLoginAt:c}));return h&&Array.isArray(h)&&(t.providerData=h.map(e=>Object.assign({},e))),o&&(t._redirectEventId=o),t}static async _fromIdTokenResponse(e,t,r=!1){var i=new Ke,t=(i.updateFromServerResponse(t),new v({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r}));return await ze(t),t}static async _fromGetAccountInfoResponse(e,t,r){var t=t.users[0],i=(m(void 0!==t.localId,"internal-error"),void 0!==t.providerUserInfo?Ge(t.providerUserInfo):[]),n=!(t.email&&t.passwordHash||null!=i&&i.length),s=new Ke,r=(s.updateFromIdToken(r),new v({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:n})),e={uid:t.localId,displayName:t.displayName||null,photoURL:t.photoUrl||null,email:t.email||null,emailVerified:t.emailVerified||!1,phoneNumber:t.phoneNumber||null,tenantId:t.tenantId||null,providerData:i,metadata:new Be(t.createdAt,t.lastLoginAt),isAnonymous:!(t.email&&t.passwordHash||null!=i&&i.length)};return Object.assign(r,e),r}}let Je=new Map;function _(e){a(e instanceof Function,"Expected a class definition");var t=Je.get(e);return t?a(t instanceof e,"Instance stored in cache mismatched with class"):(t=new e,Je.set(e,t)),t}class Ye{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){e=this.storage[e];return void 0===e?null:e}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Ye.type="NONE";let $e=Ye;function y(e,t,r){return`firebase:${e}:${t}:`+r}class Xe{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;var{config:e,name:r}=this.auth;this.fullUserKey=y(this.userKey,e.apiKey,r),this.fullPersistenceKey=y("persistence",e.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){var e=await this.persistence._get(this.fullUserKey);return e?v._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){var t;if(this.persistence!==e)return t=await this.getCurrentUser(),await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new Xe(_($e),e,r);var i,n=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let s=n[0]||_($e),a=y(r,e.config.apiKey,e.name),o=null;for(i of t)try{var l=await i._get(a);if(l){var c=v._fromJSON(e,l);i!==s&&(o=c),s=i;break}}catch(e){}n=n.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&n.length&&(s=n[0],o&&await s._set(a,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==s)try{await e._remove(a)}catch(e){}}))),new Xe(s,e,r)}}function Qe(e){var t=e.toLowerCase();return t.includes("opera/")||t.includes("opr/")||t.includes("opios/")?"Opera":rt(t)?"IEMobile":t.includes("msie")||t.includes("trident/")?"IE":t.includes("edge/")?"Edge":Ze(t)?"Firefox":t.includes("silk/")?"Silk":nt(t)?"Blackberry":st(t)?"Webos":et(t)?"Safari":!t.includes("chrome/")&&!tt(t)||t.includes("edge/")?it(t)?"Android":2===(null==(t=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))?void 0:t.length)?t[1]:"Other":"Chrome"}function Ze(e=l()){return/firefox\//i.test(e)}function et(e=l()){e=e.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function tt(e=l()){return/crios\//i.test(e)}function rt(e=l()){return/iemobile/i.test(e)}function it(e=l()){return/android/i.test(e)}function nt(e=l()){return/blackberry/i.test(e)}function st(e=l()){return/webos/i.test(e)}function at(e=l()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function ot(e=l()){return at(e)||it(e)||st(e)||nt(e)||/windows phone/i.test(e)||rt(e)}function lt(e,t=[]){let r;switch(e){case"Browser":r=Qe(l());break;case"Worker":r=Qe(l())+"-"+e;break;default:r=e}t=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${Wn.SDK_VERSION}/`+t}class ct{constructor(e){this.auth=e,this.queue=[]}pushCallback(i,e){var t=r=>new Promise((e,t)=>{try{e(i(r))}catch(e){t(e)}});t.onAbort=e,this.queue.push(t);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser!==e){var t=[];try{for(var r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){t.reverse();for(var i of t)try{i()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}}class dt{constructor(e){var t,r=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!=(t=r.minPasswordLength)?t:6,r.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=r.maxPasswordLength),void 0!==r.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=r.containsLowercaseCharacter),void 0!==r.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=r.containsUppercaseCharacter),void 0!==r.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=r.containsNumericCharacter),void 0!==r.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=r.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!=(r=null==(t=e.allowedNonAlphanumericCharacters)?void 0:t.join(""))?r:"",this.forceUpgradeOnSignin=null!=(t=e.forceUpgradeOnSignin)&&t,this.schemaVersion=e.schemaVersion}validatePassword(e){var t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=null==(e=t.meetsMinPasswordLength)||e),t.isValid&&(t.isValid=null==(e=t.meetsMaxPasswordLength)||e),t.isValid&&(t.isValid=null==(e=t.containsLowercaseLetter)||e),t.isValid&&(t.isValid=null==(e=t.containsUppercaseLetter)||e),t.isValid&&(t.isValid=null==(e=t.containsNumericCharacter)||e),t.isValid&&(t.isValid=null==(e=t.containsNonAlphanumericCharacter)||e),t}validatePasswordLengthOptions(e,t){var r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(t,r){var i;this.updatePasswordCharacterOptionsStatuses(r,!1,!1,!1,!1);for(let e=0;e<t.length;e++)i=t.charAt(e),this.updatePasswordCharacterOptionsStatuses(r,"a"<=i&&i<="z","A"<=i&&i<="Z","0"<=i&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,r,i,n){this.customStrengthOptions.containsLowercaseLetter&&!e.containsLowercaseLetter&&(e.containsLowercaseLetter=t),this.customStrengthOptions.containsUppercaseLetter&&!e.containsUppercaseLetter&&(e.containsUppercaseLetter=r),this.customStrengthOptions.containsNumericCharacter&&!e.containsNumericCharacter&&(e.containsNumericCharacter=i),this.customStrengthOptions.containsNonAlphanumericCharacter&&!e.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter=n)}}class ut{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ht(this),this.idTokenSubscription=new ht(this),this.beforeStateQueue=new ct(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=fe,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(t,r){return r&&(this._popupRedirectResolver=_(r)),this._initializationPromise=this.queue(async()=>{var e;if(!this._deleted&&(this.persistenceManager=await Xe.create(this,t),!this._deleted)){if(null!=(e=this._popupRedirectResolver)&&e._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(r),this.lastNotifiedUid=(null==(e=this.currentUser)?void 0:e.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){var e;!this._deleted&&(e=await this.assertedPersistence.getCurrentUser(),this.currentUser||e)&&(this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),await this.currentUser.getIdToken()):await this._updateCurrentUser(e,!0))}async initializeCurrentUserFromIdToken(e){try{var t=await Ve(this,{idToken:e}),r=await v._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Wn._isFirebaseServerApp(this.app)){let t=this.app.settings.authIdToken;return t?new Promise(e=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(t).then(e,e))}):this.directlySetCurrentUser(null)}var t,r,i=await this.assertedPersistence.getCurrentUser();let n=i,s=!1;if(e&&this.config.authDomain&&(await this.getOrInitRedirectPersistenceManager(),t=null==(t=this.redirectUser)?void 0:t._redirectEventId,r=null==n?void 0:n._redirectEventId,e=await this.tryRedirectSignIn(e),t&&t!==r||null==e||!e.user||(n=e.user,s=!0)),!n)return this.directlySetCurrentUser(null);if(n._redirectEventId)return m(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n);if(s)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ze(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){var e;this.languageCode="undefined"!=typeof navigator&&((e=navigator).languages&&e.languages[0]||e.language)||null}async _delete(){this._deleted=!0}async updateCurrentUser(e){return Wn._isFirebaseServerApp(this.app)?Promise.reject(h(this)):((e=e?s(e):null)&&m(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this)))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&m(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Wn._isFirebaseServerApp(this.app)?Promise.reject(h(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Wn._isFirebaseServerApp(this.app)?Promise.reject(h(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(_(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();var t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){var e=await p(e=this,"GET","/v2/passwordPolicy",o(e,{})),e=new dt(e);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new $("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((t,r)=>{if(this.currentUser)t();else{let e=this.onAuthStateChanged(()=>{e(),t()},r)}})}async revokeAccessToken(e){var t;this.currentUser&&(e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()},null!=this.tenantId&&(e.tenantId=this.tenantId),await p(t=this,"POST","/v2/accounts:revokeToken",o(t,e)))}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null==(e=this._currentUser)?void 0:e.toJSON()}}async _setRedirectUser(e,t){t=await this.getOrInitRedirectPersistenceManager(t);return null===e?t.removeCurrentUser():t.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){return this.redirectPersistenceManager||(m(e=e&&_(e)||this._popupRedirectResolver,this,"argument-error"),this.redirectPersistenceManager=await Xe.create(this,[_(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()),this.redirectPersistenceManager}async _redirectUserForId(e){var t;return this._isInitialized&&await this.queue(async()=>{}),(null==(t=this._currentUser)?void 0:t._redirectEventId)===e?this._currentUser:(null==(t=this.redirectUser)?void 0:t._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:`+this.name}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e;this._isInitialized&&(this.idTokenSubscription.next(this.currentUser),e=null!=(e=null==(e=this.currentUser)?void 0:e.uid)?e:null,this.lastNotifiedUid!==e)&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,r,i,n){if(this._deleted)return()=>{};let e="function"==typeof r?r:r.next.bind(r),s=!1;var a=this._isInitialized?Promise.resolve():this._initializationPromise;if(m(a,this,"internal-error"),a.then(()=>{s||e(this.currentUser)}),"function"==typeof r){let e=t.addObserver(r,i,n);return()=>{s=!0,e()}}{let e=t.addObserver(r);return()=>{s=!0,e()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),(this.currentUser=e)?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return m(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=lt(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e={"X-Client-Version":this.clientVersion},t=(this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId),await(null==(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))?void 0:t.getHeartbeatsHeader())),t=(t&&(e["X-Firebase-Client"]=t),await this._getAppCheckToken());return t&&(e["X-Firebase-AppCheck"]=t),e}async _getAppCheckToken(){var e,t,r;return Wn._isFirebaseServerApp(this.app)&&this.app.settings.appCheckToken?this.app.settings.appCheckToken:(null!=(e=await(null==(e=this.appCheckServiceProvider.getImmediate({optional:!0}))?void 0:e.getToken()))&&e.error&&(t="Error while retrieving App Check token: "+e.error,r=[],ve.logLevel<=i.WARN)&&ve.warn(`Auth (${Wn.SDK_VERSION}): `+t,...r),null==e?void 0:e.token)}}function I(e){return s(e)}class ht{constructor(e){var t;this.auth=e,this.observer=null,this.addObserver=(e=e=>this.observer=e,(e=new ie(e,t)).subscribe.bind(e))}get next(){return m(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let pt={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function mt(e){return pt.loadJS(e)}function gt(e){return"__"+e+Math.floor(1e6*Math.random())}class ft{constructor(e){this.auth=e,this.counter=1e12,this._widgets=new Map}render(e,t){var r=this.counter;return this._widgets.set(r,new yt(e,this.auth.name,t||{})),this.counter++,r}reset(e){var t,e=e||1e12;null!=(t=this._widgets.get(e))&&t.delete(),this._widgets.delete(e)}getResponse(e){return(null==(e=this._widgets.get(e||1e12))?void 0:e.getResponse())||""}async execute(e){return null!=(e=this._widgets.get(e||1e12))&&e.execute(),""}}class vt{constructor(){this.enterprise=new _t}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class _t{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class yt{constructor(e,t,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};r="string"==typeof e?document.getElementById(e):e;m(r,"argument-error",{appName:t}),this.container=r,this.isVisible="invisible"!==this.params.size,this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),this.timerId||(this.timerId=window.setTimeout(()=>{this.responseToken=(t=>{var r=[],i="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<t;e++)r.push(i.charAt(Math.floor(Math.random()*i.length)));return r.join("")})(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch(e){}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch(e){}this.isVisible&&this.execute()},6e4)},500))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}let It="NO_RECAPTCHA";class wt{constructor(e){this.type="recaptcha-enterprise",this.auth=I(e)}async verify(n="verify",e=!1){function s(e,t,r){let i=window.grecaptcha;Ue(i)?i.enterprise.ready(()=>{i.enterprise.execute(e,{action:n}).then(e=>{t(e)}).catch(()=>{t(It)})}):r(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?(new vt).execute("siteKey",{action:"verify"}):new Promise((r,i)=>{(async i=>{if(!e){if(null==i.tenantId&&null!=i._agentRecaptchaConfig)return i._agentRecaptchaConfig.siteKey;if(null!=i.tenantId&&void 0!==i._tenantRecaptchaConfigs[i.tenantId])return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(t,r)=>{Fe(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(e=>{if(void 0!==e.recaptchaKey)return e=new Me(e),null==i.tenantId?i._agentRecaptchaConfig=e:i._tenantRecaptchaConfigs[i.tenantId]=e,t(e.siteKey);r(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{r(e)})})})(this.auth).then(t=>{if(!e&&Ue(window.grecaptcha))s(t,r,i);else if("undefined"==typeof window)i(new Error("RecaptchaVerifier is only supported in browser"));else{let e=pt.recaptchaEnterpriseScript;0!==e.length&&(e+=t),mt(e).then(()=>{s(t,r,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function Tt(t,e,r,i=!1,n=!1){t=new wt(t);let s;if(n)s=It;else try{s=await t.verify(r)}catch(e){s=await t.verify(r,!0)}n=Object.assign({},e);return"mfaSmsEnrollment"===r||"mfaSmsSignIn"===r?"phoneEnrollmentInfo"in n?(t=n.phoneEnrollmentInfo.phoneNumber,e=n.phoneEnrollmentInfo.recaptchaToken,Object.assign(n,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})):"phoneSignInInfo"in n&&(r=n.phoneSignInInfo.recaptchaToken,Object.assign(n,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})):(i?Object.assign(n,{captchaResp:s}):Object.assign(n,{captchaResponse:s}),Object.assign(n,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(n,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"})),n}async function w(r,i,n,s,e){var t;return"EMAIL_PASSWORD_PROVIDER"===e?null!=(t=r._getRecaptchaConfig())&&t.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")?(t=await Tt(r,i,n,"getOobCode"===n),s(r,t)):s(r,i).catch(async e=>{var t;return"auth/missing-recaptcha-token"===e.code?(console.log(n+" is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow."),t=await Tt(r,i,n,"getOobCode"===n),s(r,t)):Promise.reject(e)}):"PHONE_PROVIDER"===e?null!=(t=r._getRecaptchaConfig())&&t.isProviderEnabled("PHONE_PROVIDER")?(t=await Tt(r,i,n),s(r,t).catch(async e=>{var t;if("AUDIT"===(null==(t=r._getRecaptchaConfig())?void 0:t.getProviderEnforcementState("PHONE_PROVIDER"))&&("auth/missing-recaptcha-token"===e.code||"auth/invalid-app-credential"===e.code))return console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`),t=await Tt(r,i,n,!1,!0),s(r,t);return Promise.reject(e)})):(t=await Tt(r,i,n,!1,!0),s(r,t)):Promise.reject(e+" provider is not supported.")}function Et(e,t,r){var e=I(e),r=(m(/^https?:\/\//.test(t),e,"invalid-emulator-scheme"),!(null==r||!r.disableWarnings)),i=bt(t),{host:t,port:n}=(e=>{var t=bt(e);return(e=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length)))?(t=e[2].split("@").pop()||"",(e=/^(\[[^\]]+\])(:|$)/.exec(t))?{host:e=e[1],port:kt(t.substr(e.length+1))}:([e,t]=t.split(":"),{host:e,port:kt(t)})):{host:"",port:null}})(t),s={url:i+`//${t}${null===n?"":":"+n}/`},t=Object.freeze({host:t,port:n,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:r})});function a(){var e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}e._canInitEmulator?(e.config.emulator=s,e.emulatorConfig=t,e.settings.appVerificationDisabledForTesting=!0,r||("undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",a):a()))):(m(e.config.emulator&&e.emulatorConfig,e,"emulator-config-failed"),m(Q(s,e.config.emulator)&&Q(t,e.emulatorConfig),e,"emulator-config-failed"))}function bt(e){var t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function kt(e){return!e||(e=Number(e),isNaN(e))?null:e}class St{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return n("not implemented")}_getIdTokenResponse(e){return n("not implemented")}_linkToIdToken(e,t){return n("not implemented")}_getReauthenticationResolver(e){return n("not implemented")}}async function Rt(e,t){return p(e,"POST","/v1/accounts:resetPassword",o(e,t))}async function At(e,t){return p(e,"POST","/v1/accounts:signUp",t)}async function Pt(e,t){return r(e,"POST","/v1/accounts:signInWithPassword",o(e,t))}async function Ct(e,t){return p(e,"POST","/v1/accounts:sendOobCode",o(e,t))}async function Ot(e,t){return Ct(e,t)}async function Nt(e,t){return Ct(e,t)}class Lt extends St{constructor(e,t,r,i=null){super("password",r),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new Lt(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Lt(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){e="string"==typeof e?JSON.parse(e):e;if(null!=e&&e.email&&null!=e&&e.password){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return w(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Pt,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithEmailLink",o(e,t)))(e,{email:this._email,oobCode:this._password});default:d(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return w(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",At,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithEmailLink",o(e,t)))(e,{idToken:t,email:this._email,oobCode:this._password});default:d(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function T(e,t){return r(e,"POST","/v1/accounts:signInWithIdp",o(e,t))}class E extends St{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){var t=new E(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):d("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){var e="string"==typeof e?JSON.parse(e):e,{providerId:t,signInMethod:r}=e,e=ce(e,["providerId","signInMethod"]);return t&&r?((t=new E(t,r)).idToken=e.idToken||void 0,t.accessToken=e.accessToken||void 0,t.secret=e.secret,t.nonce=e.nonce,t.pendingToken=e.pendingToken||null,t):null}_getIdTokenResponse(e){return T(e,this.buildRequest())}_linkToIdToken(e,t){var r=this.buildRequest();return r.idToken=t,T(e,r)}_getReauthenticationResolver(e){var t=this.buildRequest();return t.autoCreate=!1,T(e,t)}buildRequest(){var e,t={requestUri:"http://localhost",returnSecureToken:!0};return this.pendingToken?t.pendingToken=this.pendingToken:(e={},this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=ee(e)),t}}async function Dt(e,t){return p(e,"POST","/v1/accounts:sendVerificationCode",o(e,t))}let Ut={USER_NOT_FOUND:"user-not-found"};class Mt extends St{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Mt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Mt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithPhoneNumber",o(e,t)))(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return(async(e,t)=>{if((t=await r(e,"POST","/v1/accounts:signInWithPhoneNumber",o(e,t))).temporaryProof)throw Le(e,"account-exists-with-different-credential",t);return t})(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return(async(e,t)=>r(e,"POST","/v1/accounts:signInWithPhoneNumber",o(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Ut))(e,this._makeVerificationRequest())}_makeVerificationRequest(){var{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:i}}toJSON(){var e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){var{verificationId:e,verificationCode:t,phoneNumber:r,temporaryProof:i}=e="string"==typeof e?JSON.parse(e):e;return t||e||r||i?new Mt({verificationId:e,verificationCode:t,phoneNumber:r,temporaryProof:i}):null}}class Ft{constructor(e){var e=te(re(e)),t=null!=(t=e.apiKey)?t:null,r=null!=(r=e.oobCode)?r:null,i=(e=>{switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}})(null!=(i=e.mode)?i:null);m(t&&r&&i,"argument-error"),this.apiKey=t,this.operation=i,this.code=r,this.continueUrl=null!=(t=e.continueUrl)?t:null,this.languageCode=null!=(i=e.languageCode)?i:null,this.tenantId=null!=(r=e.tenantId)?r:null}static parseLink(e){t=te(re(e=e)).link,r=t?te(re(t)).deep_link_id:null;var t,r,i=((i=te(re(e)).deep_link_id)?te(re(i)).link:null)||i||r||t||e;try{return new Ft(i)}catch(e){return null}}}class Vt{constructor(){this.providerId=Vt.PROVIDER_ID}static credential(e,t){return Lt._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){t=Ft.parseLink(t);return m(t,"argument-error"),Lt._fromEmailAndCode(e,t.code,t.tenantId)}}Vt.PROVIDER_ID="password",Vt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Vt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class b{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class xt extends b{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class jt extends xt{static credentialFromJSON(e){e="string"==typeof e?JSON.parse(e):e;return m("providerId"in e&&"signInMethod"in e,"argument-error"),E._fromParams(e)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return m(e.idToken||e.accessToken,"argument-error"),E._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return jt.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return jt.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:e,oauthAccessToken:t,oauthTokenSecret:r,pendingToken:i,nonce:n,providerId:s}=e;if(!(t||r||e||i))return null;if(!s)return null;try{return new jt(s)._credential({idToken:e,accessToken:t,nonce:n,pendingToken:i})}catch(e){return null}}}class k extends xt{constructor(){super("facebook.com")}static credential(e){return E._fromParams({providerId:k.PROVIDER_ID,signInMethod:k.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return k.credentialFromTaggedObject(e)}static credentialFromError(e){return k.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return k.credential(e.oauthAccessToken)}catch(e){return null}}}k.FACEBOOK_SIGN_IN_METHOD="facebook.com",k.PROVIDER_ID="facebook.com";class S extends xt{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return E._fromParams({providerId:S.PROVIDER_ID,signInMethod:S.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return S.credentialFromTaggedObject(e)}static credentialFromError(e){return S.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthIdToken:e,oauthAccessToken:t}=e;if(!e&&!t)return null;try{return S.credential(e,t)}catch(e){return null}}}S.GOOGLE_SIGN_IN_METHOD="google.com",S.PROVIDER_ID="google.com";class R extends xt{constructor(){super("github.com")}static credential(e){return E._fromParams({providerId:R.PROVIDER_ID,signInMethod:R.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return R.credentialFromTaggedObject(e)}static credentialFromError(e){return R.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!(e&&"oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return R.credential(e.oauthAccessToken)}catch(e){return null}}}R.GITHUB_SIGN_IN_METHOD="github.com",R.PROVIDER_ID="github.com";class Ht extends St{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){return T(e,this.buildRequest())}_linkToIdToken(e,t){var r=this.buildRequest();return r.idToken=t,T(e,r)}_getReauthenticationResolver(e){var t=this.buildRequest();return t.autoCreate=!1,T(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){var{providerId:e,signInMethod:t,pendingToken:r}="string"==typeof e?JSON.parse(e):e;return e&&t&&r&&e===t?new Ht(e,r):null}static _create(e,t){return new Ht(e,t)}buildRequest(){return{requestUri:"http://localhost",returnSecureToken:!0,pendingToken:this.pendingToken}}}class Wt extends b{constructor(e){m(e.startsWith("saml."),"argument-error"),super(e)}static credentialFromResult(e){return Wt.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return Wt.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){e=Ht.fromJSON(e);return m(e,"argument-error"),e}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{pendingToken:e,providerId:t}=e;if(!e||!t)return null;try{return Ht._create(t,e)}catch(e){return null}}}class A extends xt{constructor(){super("twitter.com")}static credential(e,t){return E._fromParams({providerId:A.PROVIDER_ID,signInMethod:A.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return A.credentialFromTaggedObject(e)}static credentialFromError(e){return A.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;var{oauthAccessToken:e,oauthTokenSecret:t}=e;if(!e||!t)return null;try{return A.credential(e,t)}catch(e){return null}}}async function qt(e,t){return r(e,"POST","/v1/accounts:signUp",o(e,t))}A.TWITTER_SIGN_IN_METHOD="twitter.com",A.PROVIDER_ID="twitter.com";class P{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){e=await v._fromIdTokenResponse(e,r,i),i=Bt(r);return new P({user:e,providerId:i,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);var i=Bt(r);return new P({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function Bt(e){return e.providerId||("phoneNumber"in e?"phone":null)}class zt extends c{constructor(e,t,r,i){super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,zt.prototype),this.customData={appName:e.name,tenantId:null!=(i=e.tenantId)?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new zt(e,t,r,i)}}function Gt(t,r,e,i){return("reauthenticate"===r?e._getReauthenticationResolver(t):e._getIdTokenResponse(t)).catch(e=>{if("auth/multi-factor-auth-required"===e.code)throw zt._fromErrorAndOperation(t,e,r,i);throw e})}function Kt(e){return new Set(e.map(({providerId:e})=>e).filter(e=>!!e))}async function Jt(e,t){var e=s(e),r=(await $t(!0,e,t),r=e.auth,t={idToken:await e.getIdToken(),deleteProvider:[t]},await p(r,"POST","/v1/accounts:update",t)).providerUserInfo;let i=Kt(r||[]);return e.providerData=e.providerData.filter(e=>i.has(e.providerId)),i.has("phone")||(e.phoneNumber=null),await e.auth._persistUserIfCurrent(e),e}async function Yt(e,t,r=!1){t=await g(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return P._forOperation(e,"link",t)}async function $t(e,t,r){await ze(t);var i=!1===e?"provider-already-linked":"no-such-provider";m(Kt(t.providerData).has(r)===e,t.auth,i)}async function Xt(e,t,r=!1){var i=e.auth;if(Wn._isFirebaseServerApp(i.app))return Promise.reject(h(i));var n="reauthenticate";try{var s=await g(e,Gt(i,n,t,e),r),a=(m(s.idToken,i,"internal-error"),He(s.idToken)),o=(m(a,i,"internal-error"),a).sub;return m(e.uid===o,i,"user-mismatch"),P._forOperation(e,n,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&d(i,"user-mismatch"),e}}async function Qt(e,t,r=!1){return Wn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(t=await Gt(e,"signIn",t),t=await P._fromIdTokenResponse(e,"signIn",t),r||await e._updateCurrentUser(t.user),t)}async function Zt(e,t){return Qt(I(e),t)}async function er(e,t){e=s(e);return await $t(!1,e,t.providerId),Yt(e,t)}async function tr(e,t){return Xt(s(e),t)}async function rr(e,t){return Wn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(t=await r(e=I(e),"POST","/v1/accounts:signInWithCustomToken",o(e,{token:t,returnSecureToken:!0})),t=await P._fromIdTokenResponse(e,"signIn",t),await e._updateCurrentUser(t.user),t)}class ir{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?nr._fromServerResponse(e,t):"totpInfo"in t?sr._fromServerResponse(e,t):d(e,"internal-error")}}class nr extends ir{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new nr(t)}}class sr extends ir{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new sr(t)}}function ar(e,t,r){var i;m(0<(null==(i=r.url)?void 0:i.length),e,"invalid-continue-uri"),m(void 0===r.dynamicLinkDomain||0<r.dynamicLinkDomain.length,e,"invalid-dynamic-link-domain"),m(void 0===r.linkDomain||0<r.linkDomain.length,e,"invalid-hosting-link-domain"),t.continueUrl=r.url,t.dynamicLinkDomain=r.dynamicLinkDomain,t.linkDomain=r.linkDomain,t.canHandleCodeInApp=r.handleCodeInApp,r.iOS&&(m(0<r.iOS.bundleId.length,e,"missing-ios-bundle-id"),t.iOSBundleId=r.iOS.bundleId),r.android&&(m(0<r.android.packageName.length,e,"missing-android-pkg-name"),t.androidInstallApp=r.android.installApp,t.androidMinimumVersionCode=r.android.minimumVersion,t.androidPackageName=r.android.packageName)}async function or(e){e=I(e);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function lr(e,t){await p(e=s(e),"POST","/v1/accounts:update",o(e,{oobCode:t}))}async function cr(e,t){var r=s(e),i=await Rt(r,{oobCode:t}),e=i.requestType;switch(m(e,r,"internal-error"),e){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":m(i.newEmail,r,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":m(i.mfaInfo,r,"internal-error");default:m(i.email,r,"internal-error")}let n=null;return i.mfaInfo&&(n=ir._fromServerResponse(I(r),i.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.newEmail:i.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===i.requestType?i.email:i.newEmail)||null,multiFactorInfo:n},operation:e}}async function dr(e,t){var r=Ee()?Te():"http://localhost",e=(await p(e=s(e),"POST","/v1/accounts:createAuthUri",o(e,{identifier:t,continueUri:r}))).signinMethods;return e||[]}async function ur(e,t){var r=s(e),i={requestType:"VERIFY_EMAIL",idToken:await e.getIdToken()},t=(t&&ar(r.auth,i,t),await Ct(r.auth,i)).email;t!==e.email&&await e.reload()}async function hr(e,t,r){var i=s(e),t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await e.getIdToken(),newEmail:t},r=(r&&ar(i.auth,t,r),await Ct(i.auth,t)).email;r!==e.email&&await e.reload()}async function pr(e,{displayName:t,photoURL:r}){var i;void 0===t&&void 0===r||(i=await(e=s(e)).getIdToken(),i=await g(e,(async(e,t)=>p(e,"POST","/v1/accounts:update",t))(e.auth,{idToken:i,displayName:t,photoUrl:r,returnSecureToken:!0})),e.displayName=i.displayName||null,e.photoURL=i.photoUrl||null,(t=e.providerData.find(({providerId:e})=>"password"===e))&&(t.displayName=e.displayName,t.photoURL=e.photoURL),await e._updateTokensIfNecessary(i))}async function mr(e,t,r){var i=e.auth,n={idToken:await e.getIdToken(),returnSecureToken:!0},t=(t&&(n.email=t),r&&(n.password=r),await g(e,(async(e,t)=>p(e,"POST","/v1/accounts:update",t))(i,n)));await e._updateTokensIfNecessary(t,!0)}class gr{constructor(e,t,r={}){this.isNewUser=e,this.providerId=t,this.profile=r}}class fr extends gr{constructor(e,t,r,i){super(e,t,r),this.username=i}}class vr extends gr{constructor(e,t){super(e,"facebook.com",t)}}class _r extends fr{constructor(e,t){super(e,"github.com",t,"string"==typeof(null==t?void 0:t.login)?null==t?void 0:t.login:null)}}class yr extends gr{constructor(e,t){super(e,"google.com",t)}}class Ir extends fr{constructor(e,t,r){super(e,"twitter.com",t,r)}}function wr(e){var{user:e,_tokenResponse:t}=e;if(e.isAnonymous&&!t)return{providerId:null,isNewUser:!1,profile:null};var r=t;if(!r)return null;var i=r.providerId,n=r.rawUserInfo?JSON.parse(r.rawUserInfo):{},s=r.isNewUser||"identitytoolkit#SignupNewUserResponse"===r.kind;if(!i&&null!=r&&r.idToken){e=null==(e=null==(e=He(r.idToken))?void 0:e.firebase)?void 0:e.sign_in_provider;if(e)return e="anonymous"!==e&&"custom"!==e?e:null,new gr(s,e)}if(!i)return null;switch(i){case"facebook.com":return new vr(s,n);case"github.com":return new _r(s,n);case"google.com":return new yr(s,n);case"twitter.com":return new Ir(s,n,r.screenName||null);case"custom":case"anonymous":return new gr(s,null);default:return new gr(s,i,n)}}class Tr{constructor(e,t,r){this.type=e,this.credential=t,this.user=r}static _fromIdtoken(e,t){return new Tr("enroll",e,t)}static _fromMfaPendingCredential(e){return new Tr("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t;if(null!=e&&e.multiFactorSession){if(null!=(t=e.multiFactorSession)&&t.pendingCredential)return Tr._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(null!=(t=e.multiFactorSession)&&t.idToken)return Tr._fromIdtoken(e.multiFactorSession.idToken)}return null}}class Er{constructor(e,t,r){this.session=e,this.hints=t,this.signInResolver=r}static _fromError(e,i){let n=I(e),s=i.customData._serverResponse;e=(s.mfaInfo||[]).map(e=>ir._fromServerResponse(n,e));m(s.mfaPendingCredential,n,"internal-error");let a=Tr._fromMfaPendingCredential(s.mfaPendingCredential);return new Er(a,e,async e=>{var e=await e._process(n,a),t=(delete s.mfaInfo,delete s.mfaPendingCredential,Object.assign(Object.assign({},s),{idToken:e.idToken,refreshToken:e.refreshToken}));switch(i.operationType){case"signIn":var r=await P._fromIdTokenResponse(n,i.operationType,t);return await n._updateCurrentUser(r.user),r;case"reauthenticate":return m(i.user,n,"internal-error"),P._forOperation(i.user,i.operationType,t);default:d(n,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}function br(e,t){return p(e,"POST","/v2/accounts/mfaEnrollment:start",o(e,t))}class kr{constructor(t){this.user=t,this.enrolledFactors=[],t._onReload(e=>{e.mfaInfo&&(this.enrolledFactors=e.mfaInfo.map(e=>ir._fromServerResponse(t.auth,e)))})}static _fromUser(e){return new kr(e)}async getSession(){return Tr._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){var r=await this.getSession(),e=await g(this.user,e._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(e),this.user.reload()}async unenroll(e){let t="string"==typeof e?e:e.uid;var r,i,e=await this.user.getIdToken();try{var n=await g(this.user,(r=this.user.auth,i={idToken:e,mfaEnrollmentId:t},p(r,"POST","/v2/accounts/mfaEnrollment:withdraw",o(r,i))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(n),await this.user.reload()}catch(e){throw e}}}let Sr=new WeakMap;let Rr="__sak";class Ar{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Rr,"1"),this.storage.removeItem(Rr),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){e=this.storage.getItem(e);return Promise.resolve(e?JSON.parse(e):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class Pr extends Ar{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ot(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(var t of Object.keys(this.listeners)){var r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,r=!1){if(e.key){let t=e.key;r?this.detachListener():this.stopPolling();var i=()=>{var e=this.storage.getItem(t);!r&&this.localCache[t]===e||this.notifyListeners(t,e)},n=this.storage.getItem(t);J()&&10===document.documentMode&&n!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}else this.forAllChangedKeys((e,t,r)=>{this.notifyListeners(e,r)})}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(var r of Array.from(e))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(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.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){var t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Pr.type="LOCAL";let Cr=Pr;class Or extends Ar{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Or.type="SESSION";let Nr=Or;class Lr{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){var e=this.receivers.find(e=>e.isListeningto(t));return e||(e=new Lr(t),this.receivers.push(e),e)}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:r,eventType:i,data:n}=t.data;var e=this.handlersMap[i];null!=e&&e.size&&(t.ports[0].postMessage({status:"ack",eventId:r,eventType:i}),e=Array.from(e).map(async e=>e(t.origin,n)),e=await Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})),t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:e}))}_subscribe(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)}_unsubscribe(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)}}function Dr(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}Lr.receivers=[];class Ur{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,a=50){let o="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!o)throw new Error("connection_unavailable");let l,c;return new Promise((r,i)=>{let n=Dr("",20),s=(o.port1.start(),setTimeout(()=>{i(new Error("unsupported_event"))},a));c={messageChannel:o,onMessage(e){var t=e;if(t.data.eventId===n)switch(t.data.status){case"ack":clearTimeout(s),l=setTimeout(()=>{i(new Error("timeout"))},3e3);break;case"done":clearTimeout(l),r(t.data.response);break;default:clearTimeout(s),clearTimeout(l),i(new Error("invalid_response"))}}},this.handlers.add(c),o.port1.addEventListener("message",c.onMessage),this.target.postMessage({eventType:e,eventId:n,data:t},[o.port2])}).finally(()=>{c&&this.removeMessageHandler(c)})}}function C(){return window}function Mr(){return void 0!==C().WorkerGlobalScope&&"function"==typeof C().importScripts}let Fr="firebaseLocalStorageDb",Vr="firebaseLocalStorage",xr="fbase_key";class jr{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Hr(e,t){return e.transaction([Vr],t?"readwrite":"readonly").objectStore(Vr)}function Wr(){let i=indexedDB.open(Fr,1);return new Promise((t,r)=>{i.addEventListener("error",()=>{r(i.error)}),i.addEventListener("upgradeneeded",()=>{var e=i.result;try{e.createObjectStore(Vr,{keyPath:xr})}catch(e){r(e)}}),i.addEventListener("success",async()=>{var e=i.result;e.objectStoreNames.contains(Vr)?t(e):(e.close(),e=indexedDB.deleteDatabase(Fr),await new jr(e).toPromise(),t(await Wr()))})})}async function qr(e,t,r){e=Hr(e,!0).put({fbase_key:t,value:r});return new jr(e).toPromise()}function Br(e,t){e=Hr(e,!0).delete(t);return new jr(e).toPromise()}class zr{constructor(){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(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await Wr()),this.db}async _withRetries(e){let t=0;for(;;)try{return await e(await this._openDb())}catch(e){if(3<t++)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Mr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Lr._getInstance(Mr()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;this.activeServiceWorker=await(async()=>{if(null==navigator||!navigator.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}})(),this.activeServiceWorker&&(this.sender=new Ur(this.activeServiceWorker),t=await this.sender._send("ping",{},800))&&null!=(e=t[0])&&e.fulfilled&&null!=(e=t[0])&&e.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null==(t=null==navigator?void 0:navigator.serviceWorker)?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{var e;return indexedDB?(await qr(e=await Wr(),Rr,"1"),await Br(e,Rr),!0):!1}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(t,r){return this._withPendingWrite(async()=>(await this._withRetries(e=>qr(e,t,r)),this.localCache[t]=r,this.notifyServiceWorker(t)))}async _get(t){var e=await this._withRetries(e=>(async(e,t)=>(e=Hr(e,!1).get(t),void 0===(t=await new jr(e).toPromise())?null:t.value))(e,t));return this.localCache[t]=e}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(e=>Br(e,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){var e=await this._withRetries(e=>{e=Hr(e,!1).getAll();return new jr(e).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];var t,r=[],i=new Set;if(0!==e.length)for(var{fbase_key:n,value:s}of e)i.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(s)&&(this.notifyListeners(n,s),r.push(n));for(t of Object.keys(this.localCache))this.localCache[t]&&!i.has(t)&&(this.notifyListeners(t,null),r.push(t));return r}notifyListeners(e,t){this.localCache[e]=t;e=this.listeners[e];if(e)for(var r of Array.from(e))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(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)}_removeListener(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()}}zr.type="LOCAL";let Gr=zr;function Kr(e,t){return p(e,"POST","/v2/accounts/mfaSignIn:start",o(e,t))}let Jr=gt("rcb"),Yr=new ke(3e4,6e4);class $r{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!(null==(e=C().grecaptcha)||!e.render)}load(n,s=""){var e;return m((e=s).length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(e),n,"argument-error"),this.shouldResolveImmediately(s)&&De(C().grecaptcha)?Promise.resolve(C().grecaptcha):new Promise((t,r)=>{let i=C().setTimeout(()=>{r(u(n,"network-request-failed"))},Yr.get());C()[Jr]=()=>{C().clearTimeout(i),delete C()[Jr];var e=C().grecaptcha;if(e&&De(e)){let r=e.render;e.render=(e,t)=>{e=r(e,t);return this.counter++,e},this.hostLanguage=s,t(e)}else r(u(n,"internal-error"))},mt(pt.recaptchaV2Script+"?"+ee({onload:Jr,render:"explicit",hl:s})).catch(()=>{clearTimeout(i),r(u(n,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!(null==(t=C().grecaptcha)||!t.render)&&(e===this.hostLanguage||0<this.counter||this.librarySeparatelyLoaded)}}class Xr{async load(e){return new ft(e)}clearedOneInstance(){}}let Qr="recaptcha",Zr={theme:"light",type:"image"};class ei{constructor(e,t,r=Object.assign({},Zr)){this.parameters=r,this.type=Qr,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=I(e),this.isInvisible="invisible"===this.parameters.size,m("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment");r="string"==typeof t?document.getElementById(t):t;m(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=new(this.auth.settings.appVerificationDisabledForTesting?Xr:$r),this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),i=this.getAssertedRecaptcha();var t=i.getResponse(e);return t||new Promise(t=>{let r=e=>{e&&(this.tokenChangeListeners.delete(r),t(e))};this.tokenChangeListeners.add(r),this.isInvisible&&i.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise||(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e})),this.renderPromise}_reset(){this.assertNotDestroyed(),null!==this.widgetId&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){m(!this.parameters.sitekey,this.auth,"argument-error"),m(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),m("undefined"!=typeof document,this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(r){return t=>{var e;this.tokenChangeListeners.forEach(e=>e(t)),"function"==typeof r?r(t):"string"==typeof r&&"function"==typeof(e=C()[r])&&e(t)}}assertNotDestroyed(){m(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;var t;this.isInvisible||(t=document.createElement("div"),e.appendChild(t),e=t),this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){m(Ee()&&!Mr(),this.auth,"internal-error"),await(()=>{let t=null;return new Promise(e=>{"complete"===document.readyState?e():(t=()=>e(),window.addEventListener("load",t))}).catch(e=>{throw t&&window.removeEventListener("load",t),e})})(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);var e=await((await p(this.auth,"GET","/v1/recaptchaParams")).recaptchaSiteKey||"");m(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return m(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}class ti{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){e=Mt._fromVerification(this.verificationId,e);return this.onConfirmation(e)}}async function ri(t,r,i){var n,e,s,a,o,l,c,d;if(!t._getRecaptchaConfig())try{s=await Fe(e=I(e=t),{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),s=new Me(s),null==e.tenantId?e._agentRecaptchaConfig=s:e._tenantRecaptchaConfigs[e.tenantId]=s,await(!s.isAnyProviderEnabled()||!new wt(e).verify())}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let e;return("session"in(e="string"==typeof r?{phoneNumber:r}:r)?(a=e.session,"phoneNumber"in e?(m("enroll"===a.type,t,"internal-error"),o={idToken:a.credential,phoneEnrollmentInfo:{phoneNumber:e.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},(await w(t,o,"mfaSmsEnrollment",async(e,t)=>t.phoneEnrollmentInfo.captchaResponse===It?(m((null==i?void 0:i.type)===Qr,e,"argument-error"),br(e,await ii(e,t,i))):br(e,t),"PHONE_PROVIDER").catch(e=>Promise.reject(e))).phoneSessionInfo):(m("signin"===a.type,t,"internal-error"),m(l=(null==(n=e.multiFactorHint)?void 0:n.uid)||e.multiFactorUid,t,"missing-multi-factor-info"),c={mfaPendingCredential:a.credential,mfaEnrollmentId:l,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},(await w(t,c,"mfaSmsSignIn",async(e,t)=>t.phoneSignInInfo.captchaResponse===It?(m((null==i?void 0:i.type)===Qr,e,"argument-error"),Kr(e,await ii(e,t,i))):Kr(e,t),"PHONE_PROVIDER").catch(e=>Promise.reject(e))).phoneResponseInfo)):(d={phoneNumber:e.phoneNumber,clientType:"CLIENT_TYPE_WEB"},await w(t,d,"sendVerificationCode",async(e,t)=>t.captchaResponse===It?(m((null==i?void 0:i.type)===Qr,e,"argument-error"),Dt(e,await ii(e,t,i))):Dt(e,t),"PHONE_PROVIDER").catch(e=>Promise.reject(e)))).sessionInfo}finally{null!=i&&i._reset()}}async function ii(e,t,r){m(r.type===Qr,e,"argument-error");var i,n,s,r=await r.verify(),e=(m("string"==typeof r,e,"argument-error"),Object.assign({},t));return"phoneEnrollmentInfo"in e?(t=e.phoneEnrollmentInfo.phoneNumber,n=e.phoneEnrollmentInfo.captchaResponse,s=e.phoneEnrollmentInfo.clientType,i=e.phoneEnrollmentInfo.recaptchaVersion,Object.assign(e,{phoneEnrollmentInfo:{phoneNumber:t,recaptchaToken:r,captchaResponse:n,clientType:s,recaptchaVersion:i}})):"phoneSignInInfo"in e?(t=e.phoneSignInInfo.captchaResponse,n=e.phoneSignInInfo.clientType,s=e.phoneSignInInfo.recaptchaVersion,Object.assign(e,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:t,clientType:n,recaptchaVersion:s}})):Object.assign(e,{recaptchaToken:r}),e}class O{constructor(e){this.providerId=O.PROVIDER_ID,this.auth=I(e)}verifyPhoneNumber(e,t){return ri(this.auth,e,s(t))}static credential(e,t){return Mt._fromVerification(e,t)}static credentialFromResult(e){return O.credentialFromTaggedObject(e)}static credentialFromError(e){return O.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){var t;return e&&({phoneNumber:e,temporaryProof:t}=e,e)&&t?Mt._fromTokenResponse(e,t):null}}function ni(e,t){return t?_(t):(m(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}O.PROVIDER_ID="phone",O.PHONE_SIGN_IN_METHOD="phone";class si extends St{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return T(e,this._buildIdpRequest())}_linkToIdToken(e,t){return T(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return T(e,this._buildIdpRequest())}_buildIdpRequest(e){var t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function ai(e){return Qt(e.auth,new si(e),e.bypassAuthState)}function oi(e){var{auth:t,user:r}=e;return m(r,t,"internal-error"),Xt(r,new si(e),e.bypassAuthState)}async function li(e){var{auth:t,user:r}=e;return m(r,t,"internal-error"),Yt(r,new si(e),e.bypassAuthState)}class ci{constructor(e,t,r,i,n=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=n,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){var{urlResponse:e,sessionId:t,postBody:r,tenantId:i,error:n,type:s}=e;if(n)this.reject(n);else{n={auth:this.auth,requestUri:e,sessionId:t,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(s)(n))}catch(e){this.reject(e)}}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ai;case"linkViaPopup":case"linkViaRedirect":return li;case"reauthViaPopup":case"reauthViaRedirect":return oi;default:d(this.auth,"internal-error")}}resolve(e){a(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){a(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let di=new ke(2e3,1e4);class N extends ci{constructor(e,t,r,i,n){super(e,t,i,n),this.provider=r,this.authWindow=null,this.pollId=null,N.currentPopupAction&&N.currentPopupAction.cancel(),N.currentPopupAction=this}async executeNotNull(){var e=await this.execute();return m(e,this.auth,"internal-error"),e}async onExecution(){a(1===this.filter.length,"Popup operations only handle one event");var e=Dr();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(u(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null==(e=this.authWindow)?void 0:e.associatedEvent)||null}cancel(){this.reject(u(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,N.currentPopupAction=null}pollUserCancellation(){let t=()=>{var e;null!=(e=null==(e=this.authWindow)?void 0:e.window)&&e.closed?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(u(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(t,di.get())};t()}}N.currentPopupAction=null;let ui="pendingRedirect",hi=new Map;class pi extends ci{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let t=hi.get(this.auth._key());if(!t){try{let e=await(async(e,t)=>{var r;return t=vi(t),!!await(e=fi(e))._isAvailable()&&(r="true"===await e._get(t),await e._remove(t),r)})(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}hi.set(this.auth._key(),t)}return this.bypassAuthState||hi.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type)this.resolve(null);else if(e.eventId){var t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function mi(e,t){return fi(e)._set(vi(t),"true")}function gi(e,t){hi.set(e._key(),t)}function fi(e){return _(e._redirectPersistence)}function vi(e){return y(ui,e.config.apiKey,e.name)}function _i(e,t,r){return(async(e,t,r)=>{var i;return Wn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(i=I(e),Ie(e,t,b),await i._initializationPromise,await mi(e=ni(i,r),i),e._openRedirect(i,t,"signInViaRedirect"))})(e,t,r)}function yi(e,t,r){return(async(e,t,r)=>{if(Ie((e=s(e)).auth,t,b),Wn._isFirebaseServerApp(e.auth.app))return Promise.reject(h(e.auth));await e.auth._initializationPromise;await mi(r=ni(e.auth,r),e.auth);var i=await Ti(e);return r._openRedirect(e.auth,t,"reauthViaRedirect",i)})(e,t,r)}function Ii(e,t,r){return(async(e,t,r)=>{Ie((e=s(e)).auth,t,b),await e.auth._initializationPromise;var r=ni(e.auth,r),i=(await $t(!1,e,t.providerId),await mi(r,e.auth),await Ti(e));return r._openRedirect(e.auth,t,"linkViaRedirect",i)})(e,t,r)}async function wi(e,t,r=!1){var i;return Wn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(i=ni(e=I(e),t),(i=await new pi(e,i,r).execute())&&!r&&(delete i.user._redirectEventId,await e._persistUserIfCurrent(i.user),await e._setRedirectUser(null,t)),i)}async function Ti(e){var t=Dr(e.uid+":::");return e._redirectEventId=t,await e.auth._setRedirectUser(e),await e.auth._persistUserIfCurrent(e),t}class Ei{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let r=!1;return this.consumers.forEach(e=>{this.isEventForConsumer(t,e)&&(r=!0,this.sendToConsumer(t,e),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!(e=>{switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return 1;case"unknown":return ki(e);default:return}})(t)||(this.hasHandledPotentialRedirect=!0,r)||(this.queuedRedirectEvent=t,r=!0),r}sendToConsumer(e,t){var r;e.error&&!ki(e)?(r=(null==(r=e.error.code)?void 0:r.split("auth/")[1])||"internal-error",t.onError(u(this.auth,r))):t.onAuthEvent(e)}isEventForConsumer(e,t){var r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return 6e5<=Date.now()-this.lastProcessedEventTime&&this.cachedEventUids.clear(),this.cachedEventUids.has(bi(e))}saveEventToCache(e){this.cachedEventUids.add(bi(e)),this.lastProcessedEventTime=Date.now()}}function bi(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function ki({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}async function Si(e,t={}){return p(e,"GET","/v1/projects",t)}let Ri=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ai=/^https?/;async function Pi(e){if(!e.config.emulator){var t,r=(await Si(e)).authorizedDomains;for(t of r)try{if((e=>{var t,r=Te(),{protocol:i,hostname:n}=new URL(r);return e.startsWith("chrome-extension://")?""===(t=new URL(e)).hostname&&""===n?"chrome-extension:"===i&&e.replace("chrome-extension://","")===r.replace("chrome-extension://",""):"chrome-extension:"===i&&t.hostname===n:Ai.test(i)&&(Ri.test(e)?n===e:(r=e.replace(/\./g,"\\."),(t=new RegExp("^(.+\\."+r+"|"+r+")$","i")).test(n)))})(t))return}catch(e){}d(e,"unauthorized-domain")}}let Ci=new ke(3e4,6e4);function Oi(){var t=C().___jsl;if(null!=t&&t.H)for(var e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Ni(n){return new Promise((e,t)=>{var r;function i(){Oi(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Oi(),t(u(n,"network-request-failed"))},timeout:Ci.get()})}if(null!=(r=null==(r=C().gapi)?void 0:r.iframes)&&r.Iframe)e(gapi.iframes.getContext());else{if(null==(r=C().gapi)||!r.load)return r=gt("iframefcb"),C()[r]=()=>{gapi.load?i():t(u(n,"network-request-failed"))},mt(pt.gapiScript+"?onload="+r).catch(e=>t(e));i()}}).catch(e=>{throw Li=null,e})}let Li=null;let Di=new ke(5e3,15e3),Ui="__/auth/iframe",Mi="emulator/auth/iframe",Fi={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Vi=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function xi(a){i=a;var e,t,r,i=await(Li=Li||Ni(i)),n=C().gapi;return m(n,a,"internal-error"),i.open({where:document.body,url:(m((t=(i=a).config).authDomain,i,"auth-domain-config-required"),e=t.emulator?Se(t,Mi):`https://${i.config.authDomain}/`+Ui,t={apiKey:t.apiKey,appName:i.name,v:Wn.SDK_VERSION},(r=Vi.get(i.config.apiHost))&&(t.eid=r),(r=i._getFrameworks()).length&&(t.fw=r.join(",")),e+"?"+ee(t).slice(1)),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Fi,dontclear:!0},s=>new Promise(async(e,t)=>{await s.restyle({setHideOnLeave:!1});let r=u(a,"network-request-failed"),i=C().setTimeout(()=>{t(r)},Di.get());function n(){C().clearTimeout(i),e(s)}s.ping(n).then(n,()=>{t(r)})}))}let ji={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Hi{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Wi(e,t,r,i=500,n=600){var s=Math.max((window.screen.availHeight-n)/2,0).toString(),a=Math.max((window.screen.availWidth-i)/2,0).toString();let o="";var i=Object.assign(Object.assign({},ji),{width:i.toString(),height:n.toString(),top:s,left:a}),n=l().toLowerCase(),s=(r&&(o=tt(n)?"_blank":r),Ze(n)&&(t=t||"http://localhost",i.scrollbars="yes"),Object.entries(i).reduce((e,[t,r])=>""+e+t+`=${r},`,""));if([a=l()]=[n],at(a)&&null!=(a=window.navigator)&&a.standalone&&"_self"!==o)return r=t||"",i=o,(n=document.createElement("a")).href=r,n.target=i,(r=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r),new Hi(null);a=window.open(t||"",o,s);m(a,e,"popup-blocked");try{a.focus()}catch(e){}return new Hi(a)}let qi="__/auth/handler",Bi="emulator/auth/handler",zi=encodeURIComponent("fac");async function Gi(e,t,r,i,n,s){m(e.config.authDomain,e,"auth-domain-config-required"),m(e.config.apiKey,e,"invalid-api-key");var a={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:i,v:Wn.SDK_VERSION,eventId:n};if(t instanceof b){t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",(e=>{for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return;return 1})(t.getCustomParameters())||(a.customParameters=JSON.stringify(t.getCustomParameters()));for(var[o,l]of Object.entries(s||{}))a[o]=l}t instanceof xt&&0<(r=t.getScopes().filter(e=>""!==e)).length&&(a.scopes=r.join(",")),e.tenantId&&(a.tid=e.tenantId);var c,d=a;for(c of Object.keys(d))void 0===d[c]&&delete d[c];i=await e._getAppCheckToken(),n=i?`#${zi}=`+encodeURIComponent(i):"";return`${s=[e.config][0],s.emulator?Se(s,Bi):`https://${s.authDomain}/`+qi}?`+ee(d).slice(1)+n}let Ki="webStorageSupport";class Ji{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Nr,this._completeRedirectFn=wi,this._overrideRedirectResult=gi}async _openPopup(e,t,r,i){a(null==(n=this.eventManagers[e._key()])?void 0:n.manager,"_initialize() not called before _openPopup()");var n=await Gi(e,t,r,Te(),i);return Wi(e,n,Dr())}async _openRedirect(e,t,r,i){await this._originValidation(e);e=await Gi(e,t,r,Te(),i);return C().location.href=e,new Promise(()=>{})}_initialize(e){let r=e._key();if(this.eventManagers[r]){let{manager:e,promise:t}=this.eventManagers[r];return e?Promise.resolve(e):(a(t,"If manager is not set, promise should be"),t)}let t=this.initAndGetManager(e);return this.eventManagers[r]={promise:t},t.catch(()=>{delete this.eventManagers[r]}),t}async initAndGetManager(t){var e=await xi(t);let r=new Ei(t);return e.register("authEvent",e=>(m(null==e?void 0:e.authEvent,t,"invalid-auth-event"),{status:r.onEvent(e.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=e,r}_isIframeWebStorageSupported(t,r){this.iframes[t._key()].send(Ki,{type:Ki},e=>{e=null==(e=null==e?void 0:e[0])?void 0:e[Ki];void 0!==e&&r(!!e),d(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Pi(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return ot()||et()||at()}}let Yi=Ji;class $i extends class{constructor(e){this.factorId=e}_process(e,t,r){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,r);case"signin":return this._finalizeSignIn(e,t.credential);default:return n("unexpected MultiFactorSessionType")}}}{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new $i(e)}_finalizeEnroll(e,t,r){return e=e,t={idToken:t,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()},p(e,"POST","/v2/accounts/mfaEnrollment:finalize",o(e,t))}_finalizeSignIn(e,t){return e=e,t={mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()},p(e,"POST","/v2/accounts/mfaSignIn:finalize",o(e,t))}}class Xi{constructor(){}static assertion(e){return $i._fromCredential(e)}}Xi.FACTOR_ID="phone";var e="@firebase/auth",Qi="1.9.0-canary.84dfeca39";class Zi{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null==(e=this.auth.currentUser)?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(t){var e;this.assertAuthConfigured(),this.internalListeners.has(t)||(e=this.auth.onIdTokenChanged(e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}),this.internalListeners.set(t,e),this.updateProactiveRefresh())}removeAuthTokenListener(e){this.assertAuthConfigured();var t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){m(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){0<this.internalListeners.size?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}var en,tn;function rn(){return window}en="authIdTokenMaxAge",null!=(vn=B())&&vn["_"+en],pt={loadJS(i){return new Promise((e,r)=>{var t=document.createElement("script");t.setAttribute("src",i),t.onload=e,t.onerror=e=>{var t=u("internal-error");t.customData=e,r(t)},t.type="text/javascript",t.charset="UTF-8",(null!=(e=null==(e=document.getElementsByTagName("head"))?void 0:e[0])?e:document).appendChild(t)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},tn="Browser",Wn._registerComponent(new de("auth",(e,{options:t})=>{var r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),e=e.getProvider("app-check-internal"),{apiKey:n,authDomain:s}=r.options,n=(m(n&&!n.includes(":"),"invalid-api-key",{appName:r.name}),{apiKey:n,authDomain:s,clientPlatform:tn,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:lt(tn)}),s=new ut(r,i,e,n);return r=s,e=(null==(i=t)?void 0:i.persistence)||[],e=(Array.isArray(e)?e:[e]).map(_),null!=i&&i.errorMap&&r._updateErrorMap(i.errorMap),r._initializeWithPersistence(e,null==i?void 0:i.popupRedirectResolver),s},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),Wn._registerComponent(new de("auth-internal",e=>{var e=I(e.getProvider("auth").getImmediate());return e=e,new Zi(e)},"PRIVATE").setInstantiationMode("EXPLICIT")),Wn.registerVersion(e,Qi,(e=>{switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}})(tn)),Wn.registerVersion(e,Qi,"esm2017");async function nn(e,t,r){var i=rn().BuildInfo,n=(a(t.sessionId,"AuthEvent did not contain a session ID"),await(async e=>(e=(t=>{if(a(/[0-9a-zA-Z]+/.test(t),"Can only convert alpha-numeric strings"),"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);var e=new ArrayBuffer(t.length),r=new Uint8Array(e);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r})(e),e=await crypto.subtle.digest("SHA-256",e),(e=Array.from(new Uint8Array(e))).map(e=>e.toString(16).padStart(2,"0")).join("")))(t.sessionId)),s={};return at()?s.ibi=i.packageName:it()?s.apn=i.packageName:d(e,"operation-not-supported-in-this-environment"),i.displayName&&(s.appDisplayName=i.displayName),s.sessionId=n,Gi(e,r,t.type,void 0,null!=(i=t.eventId)?i:void 0,s)}function sn(i){let n=rn().cordova;return new Promise(r=>{n.plugins.browsertab.isAvailable(e=>{let t=null;e?n.plugins.browsertab.openUrl(i):t=n.InAppBrowser.open(i,(e=l(),/(iPad|iPhone|iPod).*OS 7_\d/i.test(e)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(e)?"_blank":"_system"),"location=yes"),r(t)})})}let an=20;class on extends Ei{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise(e=>{this.resolveInitialized=e})}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(t){return this.resolveInitialized(),this.passiveListeners.forEach(e=>e(t)),super.onEvent(t)}async initialized(){await this.initPromise}}function ln(e,t,r=null){return{type:t,eventId:r,urlResponse:null,sessionId:(()=>{var t=[],r="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let e=0;e<an;e++){var i=Math.floor(Math.random()*r.length);t.push(r.charAt(i))}return t.join("")})(),postBody:null,tenantId:e.tenantId,error:u(e,"no-auth-event")}}async function cn(e){var t=await un()._get(hn(e));return t&&await un()._remove(hn(e)),t}function dn(e,t){n=pn(t=t),i=n.link?decodeURIComponent(n.link):void 0,r=pn(i).link,n=n.deep_link_id?decodeURIComponent(n.deep_link_id):void 0;var r,i,n=pn(n).link||n||r||i||t;return n.includes("/__/auth/callback")?(t=(i=null==(r=null==(t=null==(i=(r=pn(n)).firebaseError?(e=>{try{return JSON.parse(e)}catch(e){return null}})(decodeURIComponent(r.firebaseError)):null)?void 0:i.code)?void 0:t.split("auth/"))?void 0:r[1])?u(i):null)?{type:e.type,eventId:e.eventId,tenantId:e.tenantId,error:t,urlResponse:null,sessionId:null,postBody:null}:{type:e.type,eventId:e.eventId,tenantId:e.tenantId,sessionId:e.sessionId,urlResponse:n,postBody:null}:null}function un(){return _(Cr)}function hn(e){return y("authEvent",e.config.apiKey,e.name)}function pn(e){var t;return null!=e&&e.includes("?")?([t,...e]=e.split("?"),te(e.join("?"))):{}}class mn{constructor(){this._redirectPersistence=Nr,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=wi,this._overrideRedirectResult=gi}async _initialize(e){var t=e._key();let r=this.eventManagers.get(t);return r||(r=new on(e),this.eventManagers.set(t,r),this.attachCallbackListeners(e,r)),r}_openPopup(e){d(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,r,i){n=e,a=rn(),m("function"==typeof(null==(s=null==a?void 0:a.universalLinks)?void 0:s.subscribe),n,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),m(void 0!==(null==(s=null==a?void 0:a.BuildInfo)?void 0:s.packageName),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),m("function"==typeof(null==(s=null==(s=null==(s=null==a?void 0:a.cordova)?void 0:s.plugins)?void 0:s.browsertab)?void 0:s.openUrl),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),m("function"==typeof(null==(s=null==(s=null==(s=null==a?void 0:a.cordova)?void 0:s.plugins)?void 0:s.browsertab)?void 0:s.isAvailable),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),m("function"==typeof(null==(a=null==(s=null==a?void 0:a.cordova)?void 0:s.InAppBrowser)?void 0:a.open),n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"});var n,s=await this._initialize(e),a=(await s.initialized(),s.resetRedirect(),hi.clear(),await this._originValidation(e),ln(e,r,i)),i=(n=e,r=a,await un()._set(hn(n),r),await nn(e,a,t));return(async(a,o,l)=>{let c=rn().cordova,d=()=>{};try{await new Promise((t,e)=>{let r=null;function i(){t();var e=null==(e=c.plugins.browsertab)?void 0:e.close;"function"==typeof e&&e(),"function"==typeof(null==l?void 0:l.close)&&l.close()}function n(){r=r||window.setTimeout(()=>{e(u(a,"redirect-cancelled-by-user"))},2e3)}function s(){"visible"===(null==document?void 0:document.visibilityState)&&n()}o.addPassiveListener(i),document.addEventListener("resume",n,!1),it()&&document.addEventListener("visibilitychange",s,!1),d=()=>{o.removePassiveListener(i),document.removeEventListener("resume",n,!1),document.removeEventListener("visibilitychange",s,!1),r&&window.clearTimeout(r)}})}finally{d()}})(e,s,await sn(i))}_isIframeWebStorageSupported(e,t){throw new Error("Method not implemented.")}_originValidation(e){var t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=(async e=>{var t=rn().BuildInfo,r={};at()?r.iosBundleId=t.packageName:it()?r.androidPackageName=t.packageName:d(e,"operation-not-supported-in-this-environment"),await Si(e,r)})(e)),this.originValidationPromises[t]}attachCallbackListeners(i,n){var{universalLinks:e,handleOpenURL:t,BuildInfo:r}=rn();let s=setTimeout(async()=>{await cn(i),n.onEvent(fn())},500),a=async e=>{clearTimeout(s);var t=await cn(i);let r=null;t&&null!=e&&e.url&&(r=dn(t,e.url)),n.onEvent(r||fn())},o=(void 0!==e&&"function"==typeof e.subscribe&&e.subscribe(null,a),t),l=r.packageName.toLowerCase()+"://";rn().handleOpenURL=async e=>{if(e.toLowerCase().startsWith(l)&&a({url:e}),"function"==typeof o)try{o(e)}catch(e){console.error(e)}}}}let gn=mn;function fn(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:u("no-auth-event")}}var vn;function _n(){var e;return(null==(e=null==self?void 0:self.location)?void 0:e.protocol)||null}function yn(e=l()){return!("file:"!==_n()&&"ionic:"!==_n()&&"capacitor:"!==_n()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function In(e=l()){return J()&&11===(null==document?void 0:document.documentMode)||([e=l()]=[e],/Edge\/\d+/.test(e))}function wn(){try{var e=self.localStorage,t=Dr();if(e)return e.setItem(t,"1"),e.removeItem(t),!In()||Y()}catch(e){return Tn()&&Y()}return!1}function Tn(){return"undefined"!=typeof global&&"WorkerGlobalScope"in global&&"importScripts"in global}function En(){return("http:"===_n()||"https:"===_n()||G()||yn())&&!(K()||z())&&wn()&&!Tn()}function bn(){return yn()&&"undefined"!=typeof document}let L={LOCAL:"local",NONE:"none",SESSION:"session"},kn=m,Sn="persistence";async function Rn(e){await e._initializationPromise;var t=An(),r=y(Sn,e.config.apiKey,e.name);t&&t.setItem(r,e._getPersistence())}function An(){var e;try{return(null===(e="undefined"!=typeof window?window:null)?void 0:e.sessionStorage)||null}catch(e){return null}}let Pn=m;class D{constructor(){this.browserResolver=_(Yi),this.cordovaResolver=_(gn),this.underlyingResolver=null,this._redirectPersistence=Nr,this._completeRedirectFn=wi,this._overrideRedirectResult=gi}async _initialize(e){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._initialize(e)}async _openPopup(e,t,r,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openPopup(e,t,r,i)}async _openRedirect(e,t,r,i){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openRedirect(e,t,r,i)}_isIframeWebStorageSupported(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)}_originValidation(e){return this.assertedUnderlyingResolver._originValidation(e)}get _shouldInitProactively(){return bn()||this.browserResolver._shouldInitProactively}get assertedUnderlyingResolver(){return Pn(this.underlyingResolver,"internal-error"),this.underlyingResolver}async selectUnderlyingResolver(){var e;this.underlyingResolver||(e=await(!!bn()&&new Promise(e=>{let t=setTimeout(()=>{e(!1)},1e3);document.addEventListener("deviceready",()=>{clearTimeout(t),e(!0)})})),this.underlyingResolver=e?this.cordovaResolver:this.browserResolver)}}function Cn(e){return e.unwrap()}function On(e,t){var r,i,n=null==(n=t.customData)?void 0:n._tokenResponse;"auth/multi-factor-auth-required"===(null==t?void 0:t.code)?t.resolver=new Dn(e,(r=t,e=s(e=e),m((i=r).customData.operationType,e,"argument-error"),m(null==(r=i.customData._serverResponse)?void 0:r.mfaPendingCredential,e,"argument-error"),Er._fromError(e,i))):n&&(e=Nn(r=t))&&(r.credential=e,r.tenantId=n.tenantId||void 0,r.email=n.email||void 0,r.phoneNumber=n.phoneNumber||void 0)}function Nn(e){var t=(e instanceof c?e.customData:e)._tokenResponse;if(!t)return null;if(!(e instanceof c)&&"temporaryProof"in t&&"phoneNumber"in t)return O.credentialFromResult(e);var r=t.providerId;if(!r||r===ue.PASSWORD)return null;let i;switch(r){case ue.GOOGLE:i=S;break;case ue.FACEBOOK:i=k;break;case ue.GITHUB:i=R;break;case ue.TWITTER:i=A;break;default:var{oauthIdToken:n,oauthAccessToken:s,oauthTokenSecret:a,pendingToken:o,nonce:l}=t;return s||a||n||o?o?r.startsWith("saml.")?Ht._create(r,o):E._fromParams({providerId:r,signInMethod:r,pendingToken:o,idToken:n,accessToken:s}):new jt(r).credential({idToken:n,accessToken:s,rawNonce:l}):null}return e instanceof c?i.credentialFromError(e):i.credentialFromResult(e)}function U(t,e){return e.catch(e=>{throw e instanceof c&&On(t,e),e}).then(e=>{var t=e.operationType,r=e.user;return{operationType:t,credential:Nn(e),additionalUserInfo:wr(e),user:M.getOrCreate(r)}})}async function Ln(t,e){let r=await e;return{verificationId:r.verificationId,confirm:e=>U(t,r.confirm(e))}}class Dn{constructor(e,t){this.resolver=t,this.auth=e.wrapped()}get session(){return this.resolver.session}get hints(){return this.resolver.hints}resolveSignIn(e){return U(Cn(this.auth),this.resolver.resolveSignIn(e))}}class M{constructor(e){this._delegate=e,this.multiFactor=(e=s(e=e),Sr.has(e)||Sr.set(e,kr._fromUser(e)),Sr.get(e))}static getOrCreate(e){return M.USER_MAP.has(e)||M.USER_MAP.set(e,new M(e)),M.USER_MAP.get(e)}delete(){return this._delegate.delete()}reload(){return this._delegate.reload()}toJSON(){return this._delegate.toJSON()}getIdTokenResult(e){return this._delegate.getIdTokenResult(e)}getIdToken(e){return this._delegate.getIdToken(e)}linkAndRetrieveDataWithCredential(e){return this.linkWithCredential(e)}async linkWithCredential(e){return U(this.auth,er(this._delegate,e))}async linkWithPhoneNumber(e,t){return Ln(this.auth,(async(e,t,r)=>{let i=s(e);return await $t(!1,i,"phone"),e=await ri(i.auth,t,s(r)),new ti(e,e=>er(i,e))})(this._delegate,e,t))}async linkWithPopup(e){return U(this.auth,(async(e,t,r)=>(Ie((e=s(e)).auth,t,b),r=ni(e.auth,r),new N(e.auth,"linkViaPopup",t,r,e).executeNotNull()))(this._delegate,e,D))}async linkWithRedirect(e){return await Rn(I(this.auth)),Ii(this._delegate,e,D)}reauthenticateAndRetrieveDataWithCredential(e){return this.reauthenticateWithCredential(e)}async reauthenticateWithCredential(e){return U(this.auth,tr(this._delegate,e))}reauthenticateWithPhoneNumber(e,t){return Ln(this.auth,(async(e,t,r)=>{let i=s(e);return Wn._isFirebaseServerApp(i.auth.app)?Promise.reject(h(i.auth)):(e=await ri(i.auth,t,s(r)),new ti(e,e=>tr(i,e)))})(this._delegate,e,t))}reauthenticateWithPopup(e){return U(this.auth,(async(e,t,r)=>(e=s(e),Wn._isFirebaseServerApp(e.auth.app)?Promise.reject(u(e.auth,"operation-not-supported-in-this-environment")):(Ie(e.auth,t,b),r=ni(e.auth,r),new N(e.auth,"reauthViaPopup",t,r,e).executeNotNull())))(this._delegate,e,D))}async reauthenticateWithRedirect(e){return await Rn(I(this.auth)),yi(this._delegate,e,D)}sendEmailVerification(e){return ur(this._delegate,e)}async unlink(e){return await Jt(this._delegate,e),this}updateEmail(e){return t=this._delegate,e=e,t=s(t),Wn._isFirebaseServerApp(t.auth.app)?Promise.reject(h(t.auth)):mr(t,e,null);var t}updatePassword(e){return mr(s(this._delegate),null,e)}updatePhoneNumber(e){return(async(e,t)=>{if(e=s(e),Wn._isFirebaseServerApp(e.auth.app))return Promise.reject(h(e.auth));await Yt(e,t)})(this._delegate,e)}updateProfile(e){return pr(this._delegate,e)}verifyBeforeUpdateEmail(e,t){return hr(this._delegate,e,t)}get emailVerified(){return this._delegate.emailVerified}get isAnonymous(){return this._delegate.isAnonymous}get metadata(){return this._delegate.metadata}get phoneNumber(){return this._delegate.phoneNumber}get providerData(){return this._delegate.providerData}get refreshToken(){return this._delegate.refreshToken}get tenantId(){return this._delegate.tenantId}get displayName(){return this._delegate.displayName}get email(){return this._delegate.email}get photoURL(){return this._delegate.photoURL}get providerId(){return this._delegate.providerId}get uid(){return this._delegate.uid}get auth(){return this._delegate.auth}}M.USER_MAP=new WeakMap;let Un=m;class Mn{constructor(e,t){var r,i;this.app=e,t.isInitialized()?this._delegate=t.getImmediate():(r=e.options.apiKey,Un(r,"invalid-api-key",{appName:e.name}),Un(r,"invalid-api-key",{appName:e.name}),i="undefined"!=typeof window?D:void 0,this._delegate=t.initialize({options:{persistence:((e,t)=>{var r=((e,t)=>{var r=An();if(!r)return[];switch(e=y(Sn,e,t),r.getItem(e)){case L.NONE:return[$e];case L.LOCAL:return[Gr,Nr];case L.SESSION:return[Nr];default:return[]}})(e,t);if("undefined"==typeof self||r.includes(Gr)||r.push(Gr),"undefined"!=typeof window)for(var i of[Cr,Nr])r.includes(i)||r.push(i);return r.includes($e)||r.push($e),r})(r,e.name),popupRedirectResolver:i}}),this._delegate._updateErrorMap(me)),this.linkUnderlyingAuth()}get emulatorConfig(){return this._delegate.emulatorConfig}get currentUser(){return this._delegate.currentUser?M.getOrCreate(this._delegate.currentUser):null}get languageCode(){return this._delegate.languageCode}set languageCode(e){this._delegate.languageCode=e}get settings(){return this._delegate.settings}get tenantId(){return this._delegate.tenantId}set tenantId(e){this._delegate.tenantId=e}useDeviceLanguage(){this._delegate.useDeviceLanguage()}signOut(){return this._delegate.signOut()}useEmulator(e,t){Et(this._delegate,e,t)}applyActionCode(e){return lr(this._delegate,e)}checkActionCode(e){return cr(this._delegate,e)}confirmPasswordReset(e,t){return(async(t,e,r)=>{await Rt(s(t),{oobCode:e,newPassword:r}).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&or(t),e})})(this._delegate,e,t)}async createUserWithEmailAndPassword(e,t){return U(this._delegate,(async(t,e,r)=>{var i;return Wn._isFirebaseServerApp(t.app)?Promise.reject(h(t)):(e=await w(i=I(t),{returnSecureToken:!0,email:e,password:r,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",qt,"EMAIL_PASSWORD_PROVIDER").catch(e=>{throw"auth/password-does-not-meet-requirements"===e.code&&or(t),e}),r=await P._fromIdTokenResponse(i,"signIn",e),await i._updateCurrentUser(r.user),r)})(this._delegate,e,t))}fetchProvidersForEmail(e){return this.fetchSignInMethodsForEmail(e)}fetchSignInMethodsForEmail(e){return dr(this._delegate,e)}isSignInWithEmailLink(e){return this._delegate,e=e,"EMAIL_SIGNIN"===(null==(e=Ft.parseLink(e))?void 0:e.operation)}async getRedirectResult(){Un(En(),this._delegate,"operation-not-supported-in-this-environment");t=this._delegate,e=D,await I(t)._initializationPromise;var e,t=await wi(t,e,!1);return t?U(this._delegate,Promise.resolve(t)):{credential:null,user:null}}addFrameworkForLogging(e){I(this._delegate)._logFramework(e)}onAuthStateChanged(e,t,r){var{next:e,error:t,complete:r}=Fn(e,t,r);return this._delegate.onAuthStateChanged(e,t,r)}onIdTokenChanged(e,t,r){var{next:e,error:t,complete:r}=Fn(e,t,r);return this._delegate.onIdTokenChanged(e,t,r)}sendSignInLinkToEmail(e,t){return(async(e,t,r)=>{let i=I(e);t=e={requestType:"EMAIL_SIGNIN",email:t,clientType:"CLIENT_TYPE_WEB"},m((r=r).handleCodeInApp,i,"argument-error"),r&&ar(i,t,r),await w(i,e,"getOobCode",Nt,"EMAIL_PASSWORD_PROVIDER")})(this._delegate,e,t)}sendPasswordResetEmail(e,t){return(async(e,t,r)=>{e=I(e),t={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"},r&&ar(e,t,r),await w(e,t,"getOobCode",Ot,"EMAIL_PASSWORD_PROVIDER")})(this._delegate,e,t||void 0)}async setPersistence(e){var t,r;t=this._delegate,r=e,kn(Object.values(L).includes(r),t,"invalid-persistence-type"),K()?kn(r!==L.SESSION,t,"unsupported-persistence-type"):z()?kn(r===L.NONE,t,"unsupported-persistence-type"):Tn()?kn(r===L.NONE||r===L.LOCAL&&Y(),t,"unsupported-persistence-type"):kn(r===L.NONE||wn(),t,"unsupported-persistence-type");let i;switch(e){case L.SESSION:i=Nr;break;case L.LOCAL:var n=await _(Gr)._isAvailable();i=n?Gr:Cr;break;case L.NONE:i=$e;break;default:return d("argument-error",{appName:this._delegate.name})}return this._delegate.setPersistence(i)}signInAndRetrieveDataWithCredential(e){return this.signInWithCredential(e)}signInAnonymously(){return U(this._delegate,(async e=>{var t;return Wn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(await(e=I(e))._initializationPromise,null!=(t=e.currentUser)&&t.isAnonymous?new P({user:e.currentUser,providerId:null,operationType:"signIn"}):(t=await qt(e,{returnSecureToken:!0}),t=await P._fromIdTokenResponse(e,"signIn",t,!0),await e._updateCurrentUser(t.user),t))})(this._delegate))}signInWithCredential(e){return U(this._delegate,Zt(this._delegate,e))}signInWithCustomToken(e){return U(this._delegate,rr(this._delegate,e))}signInWithEmailAndPassword(e,t){return U(this._delegate,(r=this._delegate,e=e,t=t,Wn._isFirebaseServerApp(r.app)?Promise.reject(h(r)):Zt(s(r),Vt.credential(e,t)).catch(async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&or(r),e})));var r}signInWithEmailLink(e,t){return U(this._delegate,(async(e,t,r)=>Wn._isFirebaseServerApp(e.app)?Promise.reject(h(e)):(e=s(e),m((t=Vt.credentialWithLink(t,r||Te()))._tenantId===(e.tenantId||null),e,"tenant-id-mismatch"),Zt(e,t)))(this._delegate,e,t))}signInWithPhoneNumber(e,t){return Ln(this._delegate,(async(e,t,r)=>{if(Wn._isFirebaseServerApp(e.app))return Promise.reject(h(e));let i=I(e);return e=await ri(i,t,s(r)),new ti(e,e=>Zt(i,e))})(this._delegate,e,t))}async signInWithPopup(e){return Un(En(),this._delegate,"operation-not-supported-in-this-environment"),U(this._delegate,(async(e,t,r)=>{var i;return Wn._isFirebaseServerApp(e.app)?Promise.reject(u(e,"operation-not-supported-in-this-environment")):(i=I(e),Ie(e,t,b),e=ni(i,r),new N(i,"signInViaPopup",t,e).executeNotNull())})(this._delegate,e,D))}async signInWithRedirect(e){return Un(En(),this._delegate,"operation-not-supported-in-this-environment"),await Rn(this._delegate),_i(this._delegate,e,D)}updateCurrentUser(e){return this._delegate.updateCurrentUser(e)}verifyPasswordResetCode(e){return(async(e,t)=>(e=(await cr(s(e),t)).data).email)(this._delegate,e)}unwrap(){return this._delegate}_delete(){return this._delegate._delete()}linkUnderlyingAuth(){this._delegate.wrapped=()=>this}}function Fn(e,t,r){let i=e,n=("function"!=typeof e&&({next:i,error:t,complete:r}=e),i);return{next:e=>n(e&&M.getOrCreate(e)),error:t,complete:r}}Mn.Persistence=L;class Vn{static credential(e,t){return O.credential(e,t)}constructor(){this.providerId="phone",this._delegate=new O(Cn(F.default.auth()))}verifyPhoneNumber(e,t){return this._delegate.verifyPhoneNumber(e,t)}unwrap(){return this._delegate}}Vn.PHONE_SIGN_IN_METHOD=O.PHONE_SIGN_IN_METHOD,Vn.PROVIDER_ID=O.PROVIDER_ID;let xn=m;class jn{constructor(e,t,r=F.default.app()){var i;xn(null==(i=r.options)?void 0:i.apiKey,"invalid-api-key",{appName:r.name}),this._delegate=new ei(r.auth(),e,t),this.type=this._delegate.type}clear(){this._delegate.clear()}render(){return this._delegate.render()}verify(){return this._delegate.verify()}}(vn=F.default).INTERNAL.registerComponent(new de("auth-compat",e=>{var t=e.getProvider("app-compat").getImmediate(),e=e.getProvider("auth");return new Mn(t,e)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:he.EMAIL_SIGNIN,PASSWORD_RESET:he.PASSWORD_RESET,RECOVER_EMAIL:he.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:he.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:he.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:he.VERIFY_EMAIL}},EmailAuthProvider:Vt,FacebookAuthProvider:k,GithubAuthProvider:R,GoogleAuthProvider:S,OAuthProvider:jt,SAMLAuthProvider:Wt,PhoneAuthProvider:Vn,PhoneMultiFactorGenerator:Xi,RecaptchaVerifier:jn,TwitterAuthProvider:A,Auth:Mn,AuthCredential:St,Error:c}).setInstantiationMode("LAZY").setMultipleInstances(!1)),vn.registerVersion("@firebase/auth-compat","0.5.18-canary.84dfeca39")}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-auth.js - be sure to load firebase-app.js first.")}});//# sourceMappingURL=firebase-auth.js.map
|