1import {E,hb as Dc,hc as Bo,hd as zo,he as Wo,hf as ca,hg as Yo,hh as Xa,hi as Zt,hj as Go,hk as E$1,hl as Rn,hm as Po,hn as Oo,ho as ko,hp as mn,hq as Ua,hr as Lo,hs as Mr,ht as aa,hu as Xo,hv as Ho,hw as qo,hx as O,hy as sa,hz as jt,hA as di,hB as Pn,hC as ci,hD as Mo,hE as Vo,hF as jo,hG as Ko,hH as Ma,hI as Uo,hJ as ta,hK as na,hL as ea,hM as Kr,hN as Qo,hO as Ga,hP as Wa,hQ as Ja,hR as $a,hS as ri,hT as W,hU as ia}from'./main-EX6XMYYT.js';var ie=(()=>{class s extends E{constructor(){super(),this.lastConfirmationResult=new Map;let e=Dc();e.onAuthStateChanged(t=>this.handleAuthStateChange(t)),e.onIdTokenChanged(t=>{this.handleIdTokenChange(t);});}async applyActionCode(e){let t=Dc();return Bo(t,e.oobCode)}async createUserWithEmailAndPassword(e){let t=Dc(),n=await zo(t,e.email,e.password);return this.createSignInResult(n,null)}async confirmPasswordReset(e){let t=Dc();return Wo(t,e.oobCode,e.newPassword)}async confirmVerificationCode(e){let{verificationCode:t,verificationId:n}=e,r=this.lastConfirmationResult.get(n);if(!r)throw new Error(s.ERROR_CONFIRMATION_RESULT_MISSING);let o=await r.confirm(t);return this.createSignInResult(o,null)}async deleteUser(){let t=Dc().currentUser;if(!t)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return ca(t)}async fetchSignInMethodsForEmail(e){let t=Dc();return {signInMethods:await Yo(t,e.email)}}async getPendingAuthResult(){throw this.unimplemented("Not implemented on web.")}async getCurrentUser(){let e=Dc();return {user:this.createUserResult(e.currentUser)}}async getIdToken(e){let t=Dc();if(!t.currentUser)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return {token:await t.currentUser.getIdToken(e?.forceRefresh)||""}}async getIdTokenResult(e){let t=Dc();if(!t.currentUser)throw new Error(s.ERROR_NO_USER_SIGNED_IN);let n=await t.currentUser.getIdTokenResult(e?.forceRefresh);return Object.assign(Object.assign({},n),{authTime:Date.parse(n.authTime),expirationTime:Date.parse(n.expirationTime),issuedAtTime:Date.parse(n.issuedAtTime)})}async getRedirectResult(){let e=Dc(),t=await Xa(e),n=t?Zt.credentialFromResult(t):null;return this.createSignInResult(t,n)}async getTenantId(){return {tenantId:Dc().tenantId}}async isSignInWithEmailLink(e){let t=Dc();return {isSignInWithEmailLink:Go(t,e.emailLink)}}async linkWithApple(e){let t=new Zt(E$1.APPLE);this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithEmailAndPassword(e){let t=Rn.credential(e.email,e.password),n=await this.linkCurrentUserWithCredential(t);return this.createSignInResult(n,t)}async linkWithEmailLink(e){let t=Rn.credentialWithLink(e.email,e.emailLink),n=await this.linkCurrentUserWithCredential(t);return this.createSignInResult(n,t)}async linkWithFacebook(e){let t=new Po;this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=Po.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithGameCenter(){throw this.unimplemented("Not implemented on web.")}async linkWithGithub(e){let t=new Oo;this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=Oo.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithGoogle(e){let t=new ko;this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=ko.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithMicrosoft(e){let t=new Zt(E$1.MICROSOFT);this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithOpenIdConnect(e){let t=new Zt(e.providerId);this.applySignInOptions(e,t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithPhoneNumber(e){let n=Dc().currentUser;if(!n)throw new Error(s.ERROR_NO_USER_SIGNED_IN);if(!e.phoneNumber)throw new Error(s.ERROR_PHONE_NUMBER_MISSING);if(!e.recaptchaVerifier||!(e.recaptchaVerifier instanceof mn))throw new Error(s.ERROR_RECAPTCHA_VERIFIER_MISSING);try{let r=await Ua(n,e.phoneNumber,e.recaptchaVerifier),{verificationId:o}=r;this.lastConfirmationResult.set(o,r);let c={verificationId:o};this.notifyListeners(s.PHONE_CODE_SENT_EVENT,c);}catch(r){let o={message:this.getErrorMessage(r)};this.notifyListeners(s.PHONE_VERIFICATION_FAILED_EVENT,o);}}async linkWithPlayGames(){throw this.unimplemented("Not implemented on web.")}async linkWithTwitter(e){let t=new Lo;this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=Lo.credentialFromResult(n);return this.createSignInResult(n,r)}async linkWithYahoo(e){let t=new Zt(E$1.YAHOO);this.applySignInOptions(e||{},t);let n=await this.linkCurrentUserWithPopupOrRedirect(t,e?.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async reload(){let t=Dc().currentUser;if(!t)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return Mr(t)}async revokeAccessToken(e){let t=Dc();return aa(t,e.token)}async sendEmailVerification(e){let n=Dc().currentUser;if(!n)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return Xo(n,e?.actionCodeSettings)}async sendPasswordResetEmail(e){let t=Dc();return Ho(t,e.email,e.actionCodeSettings)}async sendSignInLinkToEmail(e){let t=Dc();return qo(t,e.email,e.actionCodeSettings)}async setLanguageCode(e){let t=Dc();t.languageCode=e.languageCode;}async setPersistence(e){let t=Dc();switch(e.persistence){case O.BrowserLocal:await sa(t,ci);break;case O.BrowserSession:await sa(t,Pn);break;case O.IndexedDbLocal:await sa(t,di);break;case O.InMemory:await sa(t,jt);break}}async setTenantId(e){let t=Dc();t.tenantId=e.tenantId;}async signInAnonymously(){let e=Dc(),t=await Mo(e);return this.createSignInResult(t,null)}async signInWithApple(e){let t=new Zt(E$1.APPLE);this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithCustomToken(e){let t=Dc(),n=await Vo(t,e.token);return this.createSignInResult(n,null)}async signInWithEmailAndPassword(e){let t=Dc(),n=await jo(t,e.email,e.password);return this.createSignInResult(n,null)}async signInWithEmailLink(e){let t=Dc(),n=await Ko(t,e.email,e.emailLink);return this.createSignInResult(n,null)}async signInWithFacebook(e){let t=new Po;this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=Po.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithGithub(e){let t=new Oo;this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=Oo.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithGoogle(e){let t=new ko;this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=ko.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithMicrosoft(e){let t=new Zt(E$1.MICROSOFT);this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithOpenIdConnect(e){let t=new Zt(e.providerId);this.applySignInOptions(e,t);let n=await this.signInWithPopupOrRedirect(t,e.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithPhoneNumber(e){if(!e.phoneNumber)throw new Error(s.ERROR_PHONE_NUMBER_MISSING);
1if(!e.recaptchaVerifier||!(e.recaptchaVerifier instanceof mn))throw new Error(s.ERROR_RECAPTCHA_VERIFIER_MISSING);let t=Dc();try{let n=await Ma(t,e.phoneNumber,e.recaptchaVerifier),{verificationId:r}=n;this.lastConfirmationResult.set(r,n);let o={verificationId:r};this.notifyListeners(s.PHONE_CODE_SENT_EVENT,o);}catch(n){let r={message:this.getErrorMessage(n)};this.notifyListeners(s.PHONE_VERIFICATION_FAILED_EVENT,r);}}async signInWithPlayGames(){throw this.unimplemented("Not implemented on web.")}async signInWithGameCenter(){throw this.unimplemented("Not implemented on web.")}async signInWithTwitter(e){let t=new Lo;this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=Lo.credentialFromResult(n);return this.createSignInResult(n,r)}async signInWithYahoo(e){let t=new Zt(E$1.YAHOO);this.applySignInOptions(e||{},t);let n=await this.signInWithPopupOrRedirect(t,e?.mode),r=Zt.credentialFromResult(n);return this.createSignInResult(n,r)}async signOut(){await Dc().signOut();}async unlink(e){let t=Dc();if(!t.currentUser)throw new Error(s.ERROR_NO_USER_SIGNED_IN);let n=await Uo(t.currentUser,e.providerId);return {user:this.createUserResult(n)}}async updateEmail(e){let n=Dc().currentUser;if(!n)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return ta(n,e.newEmail)}async updatePassword(e){let n=Dc().currentUser;if(!n)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return na(n,e.newPassword)}async updateProfile(e){let n=Dc().currentUser;if(!n)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return ea(n,{displayName:e.displayName,photoURL:e.photoUrl})}async useAppLanguage(){Dc().useDeviceLanguage();}async useEmulator(e){let t=Dc(),n=e.port||9099,r=e.scheme||"http";e.host.includes("://")?Kr(t,`${e.host}:${n}`):Kr(t,`${r}://${e.host}:${n}`);}async verifyBeforeUpdateEmail(e){let n=Dc().currentUser;if(!n)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return Qo(n,e?.newEmail,e?.actionCodeSettings)}handleAuthStateChange(e){let n={user:this.createUserResult(e)};this.notifyListeners(s.AUTH_STATE_CHANGE_EVENT,n,true);}async handleIdTokenChange(e){if(!e)return;let n={token:await e.getIdToken(false)};this.notifyListeners(s.ID_TOKEN_CHANGE_EVENT,n,true);}applySignInOptions(e,t){if(e.customParameters){let n={};e.customParameters.map(r=>{n[r.key]=r.value;}),t.setCustomParameters(n);}if(e.scopes)for(let n of e.scopes)t.addScope(n);}signInWithPopupOrRedirect(e,t){let n=Dc();return t==="redirect"?Ga(n,e):Wa(n,e)}linkCurrentUserWithPopupOrRedirect(e,t){let n=Dc();if(!n.currentUser)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return t==="redirect"?Ja(n.currentUser,e):$a(n.currentUser,e)}linkCurrentUserWithCredential(e){let t=Dc();if(!t.currentUser)throw new Error(s.ERROR_NO_USER_SIGNED_IN);return ri(t.currentUser,e)}requestAppTrackingTransparencyPermission(){throw this.unimplemented("Not implemented on web.")}checkAppTrackingTransparencyPermission(){throw this.unimplemented("Not implemented on web.")}createSignInResult(e,t){let n=this.createUserResult(e?.user||null),r=this.createCredentialResult(t),o=this.createAdditionalUserInfoResult(e);return {user:n,credential:r,additionalUserInfo:o}}createCredentialResult(e){if(!e)return null;let t={providerId:e.providerId};return e instanceof W&&(t.accessToken=e.accessToken,t.idToken=e.idToken,t.secret=e.secret),t}createUserResult(e){return e?{displayName:e.displayName,email:e.email,emailVerified:e.emailVerified,isAnonymous:e.isAnonymous,metadata:this.createUserMetadataResult(e.metadata),phoneNumber:e.phoneNumber,photoUrl:e.photoURL,providerData:this.createUserProviderDataResult(e.providerData),providerId:e.providerId,tenantId:e.tenantId,uid:e.uid}:null}createUserMetadataResult(e){let t={};return e.creationTime&&(t.creationTime=Date.parse(e.creationTime)),e.lastSignInTime&&(t.lastSignInTime=Date.parse(e.lastSignInTime)),t}createUserProviderDataResult(e){return e.map(t=>({displayName:t.displayName,email:t.email,phoneNumber:t.phoneNumber,photoUrl:t.photoURL,providerId:t.providerId,uid:t.uid}))}createAdditionalUserInfoResult(e){if(!e)return null;let t=ia(e);if(!t)return null;let{isNewUser:n,profile:r,providerId:o,username:c}=t,E={isNewUser:n};return o!==null&&(E.providerId=o),r!==null&&(E.profile=r),c!=null&&(E.username=c),E}getErrorMessage(e){return e instanceof Object&&"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e)}}return s.AUTH_STATE_CHANGE_EVENT="authStateChange",s.ID_TOKEN_CHANGE_EVENT="idTokenChange",s.PHONE_CODE_SENT_EVENT="phoneCodeSent",s.PHONE_VERIFICATION_FAILED_EVENT="phoneVerificationFailed",s.ERROR_NO_USER_SIGNED_IN="No user is signed in.",s.ERROR_PHONE_NUMBER_MISSING="phoneNumber must be provided.",s.ERROR_RECAPTCHA_VERIFIER_MISSING="recaptchaVerifier must be provided and must be an instance of RecaptchaVerifier.",s.ERROR_CONFIRMATION_RESULT_MISSING="No confirmation result with this verification id was found.",s})(); 2export{ie as FirebaseAuthenticationWeb};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.