{"version":3,"sources":["webpack:///./node_modules/@capacitor-firebase/authentication/dist/esm/web.js"],"names":["FirebaseAuthenticationWeb","super","auth","onAuthStateChanged","user","this","handleAuthStateChange","options","oobCode","userCredential","email","password","createSignInResult","newPassword","currentUser","Error","ERROR_NO_USER_SIGNED_IN","userResult","createUserResult","result","idToken","getIdToken","forceRefresh","token","authCredential","credentialFromResult","tenantId","isSignInWithEmailLink","emailLink","provider","APPLE","applySignInOptions","linkCurrentUserWithPopupOrRedirect","mode","credential","linkCurrentUserWithCredential","credentialWithLink","MICROSOFT","_options","YAHOO","actionCodeSettings","languageCode","signInWithPopupOrRedirect","signOut","providerId","newEmail","useDeviceLanguage","port","host","change","notifyListeners","customParameters","map","parameter","key","value","setCustomParameters","scopes","scope","addScope","credentialResult","createCredentialResult","additionalUserInfoResult","createAdditionalUserInfoResult","additionalUserInfo","accessToken","secret","displayName","emailVerified","isAnonymous","phoneNumber","photoUrl","photoURL","uid","isNewUser","profile","username","undefined"],"mappings":"gHAAA,yGAGO,MAAMA,UAAkC,OAC3C,cACIC,QACA,MAAMC,EAAO,iBACbA,EAAKC,mBAAmBC,GAAQC,KAAKC,sBAAsBF,IAE/D,sBAAsBG,GAClB,MAAML,EAAO,iBACb,OAAO,eAAgBA,EAAMK,EAAQC,SAEzC,qCAAqCD,GACjC,MAAML,EAAO,iBACPO,QAAuB,eAA+BP,EAAMK,EAAQG,MAAOH,EAAQI,UACzF,OAAON,KAAKO,mBAAmBH,EAAgB,MAEnD,2BAA2BF,GACvB,MAAML,EAAO,iBACb,OAAO,eAAqBA,EAAMK,EAAQC,QAASD,EAAQM,aAE/D,mBACI,MAAMX,EAAO,iBACPY,EAAcZ,EAAKY,YACzB,IAAKA,EACD,MAAM,IAAIC,MAAMf,EAA0BgB,yBAE9C,OAAO,eAAWF,GAEtB,uBACI,MAAMZ,EAAO,iBACPe,EAAaZ,KAAKa,iBAAiBhB,EAAKY,aACxCK,EAAS,CACXf,KAAMa,GAEV,OAAOE,EAEX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AKa,kBAAqC,OAAnBT,QAA8C,IAAnBA,OAA4B,EAASA,EAAeL,OAAS,MAC5HwD,EAAmBvD,KAAKwD,uBAAuBrC,GAC/CsC,EAA2BzD,KAAK0D,+BAA+BtD,GAC/DU,EAAS,CACXf,KAAMa,EACNiB,WAAY0B,EACZI,mBAAoBF,GAExB,OAAO3C,EAEX,uBAAuBe,GACnB,IAAKA,EACD,OAAO,KAEX,MAAMf,EAAS,CACXyB,WAAYV,EAAWU,YAO3B,OALIV,aAAsB,SACtBf,EAAO8C,YAAc/B,EAAW+B,YAChC9C,EAAOC,QAAUc,EAAWd,QAC5BD,EAAO+C,OAAShC,EAAWgC,QAExB/C,EAEX,iBAAiBf,GACb,IAAKA,EACD,OAAO,KAEX,MAAMe,EAAS,CACXgD,YAAa/D,EAAK+D,YAClBzD,MAAON,EAAKM,MACZ0D,cAAehE,EAAKgE,cACpBC,YAAajE,EAAKiE,YAClBC,YAAalE,EAAKkE,YAClBC,SAAUnE,EAAKoE,SACf5B,WAAYxC,EAAKwC,WACjBlB,SAAUtB,EAAKsB,SACf+C,IAAKrE,EAAKqE,KAEd,OAAOtD,EAEX,+BAA+Be,GAC3B,IAAKA,EACD,OAAO,KAEX,MAAM8B,EAAqB,eAAsB9B,GACjD,IAAK8B,EACD,OAAO,KAEX,MAAM,UAAEU,EAAS,QAAEC,EAAO,WAAE/B,EAAU,SAAEgC,GAAaZ,EAC/C7C,EAAS,CACXuD,aAWJ,OATmB,OAAf9B,IACAzB,EAAOyB,WAAaA,GAER,OAAZ+B,IACAxD,EAAOwD,QAAUA,GAEJ,OAAbC,QAAkCC,IAAbD,IACrBzD,EAAOyD,SAAWA,GAEfzD,GAGfnB,EAA0BgB,wBAA0B","file":"js/chunk-2d238653.d8552ee6.js","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport { EmailAuthProvider, FacebookAuthProvider, GithubAuthProvider, GoogleAuthProvider, OAuthCredential, OAuthProvider, TwitterAuthProvider, applyActionCode, confirmPasswordReset, connectAuthEmulator, createUserWithEmailAndPassword, deleteUser, getAdditionalUserInfo, getAuth, getRedirectResult, isSignInWithEmailLink, linkWithCredential, linkWithPopup, linkWithRedirect, reload, sendEmailVerification, sendPasswordResetEmail, sendSignInLinkToEmail, signInAnonymously, signInWithCustomToken, signInWithEmailAndPassword, signInWithEmailLink, signInWithPopup, signInWithRedirect, unlink, updateEmail, updatePassword, updateProfile, } from 'firebase/auth';\nimport { ProviderId } from './definitions';\nexport class FirebaseAuthenticationWeb extends WebPlugin {\n constructor() {\n super();\n const auth = getAuth();\n auth.onAuthStateChanged(user => this.handleAuthStateChange(user));\n }\n async applyActionCode(options) {\n const auth = getAuth();\n return applyActionCode(auth, options.oobCode);\n }\n async createUserWithEmailAndPassword(options) {\n const auth = getAuth();\n const userCredential = await createUserWithEmailAndPassword(auth, options.email, options.password);\n return this.createSignInResult(userCredential, null);\n }\n async confirmPasswordReset(options) {\n const auth = getAuth();\n return confirmPasswordReset(auth, options.oobCode, options.newPassword);\n }\n async deleteUser() {\n const auth = getAuth();\n const currentUser = auth.currentUser;\n if (!currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return deleteUser(currentUser);\n }\n async getCurrentUser() {\n const auth = getAuth();\n const userResult = this.createUserResult(auth.currentUser);\n const result = {\n user: userResult,\n };\n return result;\n }\n async getIdToken(options) {\n const auth = getAuth();\n if (!auth.currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n const idToken = await auth.currentUser.getIdToken(options === null || options === void 0 ? void 0 : options.forceRefresh);\n const result = {\n token: idToken || '',\n };\n return result;\n }\n async getRedirectResult() {\n const auth = getAuth();\n const userCredential = await getRedirectResult(auth);\n const authCredential = userCredential\n ? OAuthProvider.credentialFromResult(userCredential)\n : null;\n return this.createSignInResult(userCredential, authCredential);\n }\n async getTenantId() {\n const auth = getAuth();\n return {\n tenantId: auth.tenantId,\n };\n }\n async isSignInWithEmailLink(options) {\n const auth = getAuth();\n return {\n isSignInWithEmailLink: isSignInWithEmailLink(auth, options.emailLink),\n };\n }\n async linkWithApple(options) {\n const provider = new OAuthProvider(ProviderId.APPLE);\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = OAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithEmailAndPassword(options) {\n const authCredential = EmailAuthProvider.credential(options.email, options.password);\n const userCredential = await this.linkCurrentUserWithCredential(authCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithEmailLink(options) {\n const authCredential = EmailAuthProvider.credentialWithLink(options.email, options.emailLink);\n const userCredential = await this.linkCurrentUserWithCredential(authCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithFacebook(options) {\n const provider = new FacebookAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = FacebookAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithGameCenter() {\n throw new Error('Not available on web.');\n }\n async linkWithGithub(options) {\n const provider = new GithubAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = GithubAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithGoogle(options) {\n const provider = new GoogleAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = GoogleAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithMicrosoft(options) {\n const provider = new OAuthProvider(ProviderId.MICROSOFT);\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = OAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithPhoneNumber(_options) {\n throw new Error('Not implemented on web.');\n }\n async linkWithPlayGames() {\n throw new Error('Not available on web.');\n }\n async linkWithTwitter(options) {\n const provider = new TwitterAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = TwitterAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async linkWithYahoo(options) {\n const provider = new OAuthProvider(ProviderId.YAHOO);\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.linkCurrentUserWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = OAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async reload() {\n const auth = getAuth();\n const currentUser = auth.currentUser;\n if (!currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return reload(currentUser);\n }\n async sendEmailVerification() {\n const auth = getAuth();\n const currentUser = auth.currentUser;\n if (!currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return sendEmailVerification(currentUser);\n }\n async sendPasswordResetEmail(options) {\n const auth = getAuth();\n return sendPasswordResetEmail(auth, options.email);\n }\n async sendSignInLinkToEmail(options) {\n const auth = getAuth();\n return sendSignInLinkToEmail(auth, options.email, options.actionCodeSettings);\n }\n async setLanguageCode(options) {\n const auth = getAuth();\n auth.languageCode = options.languageCode;\n }\n async signInAnonymously() {\n const auth = getAuth();\n const userCredential = await signInAnonymously(auth);\n return this.createSignInResult(userCredential, null);\n }\n async setTenantId(options) {\n const auth = getAuth();\n auth.tenantId = options.tenantId;\n }\n async signInWithApple(options) {\n const provider = new OAuthProvider(ProviderId.APPLE);\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = OAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signInWithCustomToken(options) {\n const auth = getAuth();\n const userCredential = await signInWithCustomToken(auth, options.token);\n return this.createSignInResult(userCredential, null);\n }\n async signInWithEmailAndPassword(options) {\n const auth = getAuth();\n const userCredential = await signInWithEmailAndPassword(auth, options.email, options.password);\n return this.createSignInResult(userCredential, null);\n }\n async signInWithEmailLink(options) {\n const auth = getAuth();\n const userCredential = await signInWithEmailLink(auth, options.email, options.emailLink);\n return this.createSignInResult(userCredential, null);\n }\n async signInWithFacebook(options) {\n const provider = new FacebookAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = FacebookAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signInWithGithub(options) {\n const provider = new GithubAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = GithubAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signInWithGoogle(options) {\n const provider = new GoogleAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = GoogleAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signInWithMicrosoft(options) {\n const provider = new OAuthProvider(ProviderId.MICROSOFT);\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = OAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signInWithPhoneNumber(_options) {\n throw new Error('Not implemented on web.');\n }\n async signInWithPlayGames() {\n throw new Error('Not available on web.');\n }\n async signInWithGameCenter() {\n throw new Error('Not available on web.');\n }\n async signInWithTwitter(options) {\n const provider = new TwitterAuthProvider();\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = TwitterAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signInWithYahoo(options) {\n const provider = new OAuthProvider(ProviderId.YAHOO);\n this.applySignInOptions(options || {}, provider);\n const userCredential = await this.signInWithPopupOrRedirect(provider, options === null || options === void 0 ? void 0 : options.mode);\n const authCredential = OAuthProvider.credentialFromResult(userCredential);\n return this.createSignInResult(userCredential, authCredential);\n }\n async signOut() {\n const auth = getAuth();\n await auth.signOut();\n }\n async unlink(options) {\n const auth = getAuth();\n if (!auth.currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n const user = await unlink(auth.currentUser, options.providerId);\n const userResult = this.createUserResult(user);\n const result = {\n user: userResult,\n };\n return result;\n }\n async updateEmail(options) {\n const auth = getAuth();\n const currentUser = auth.currentUser;\n if (!currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return updateEmail(currentUser, options.newEmail);\n }\n async updatePassword(options) {\n const auth = getAuth();\n const currentUser = auth.currentUser;\n if (!currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return updatePassword(currentUser, options.newPassword);\n }\n async updateProfile(options) {\n const auth = getAuth();\n const currentUser = auth.currentUser;\n if (!currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return updateProfile(currentUser, options);\n }\n async useAppLanguage() {\n const auth = getAuth();\n auth.useDeviceLanguage();\n }\n async useEmulator(options) {\n const auth = getAuth();\n const port = options.port || 9099;\n connectAuthEmulator(auth, `${options.host}:${port}`);\n }\n handleAuthStateChange(user) {\n const userResult = this.createUserResult(user);\n const change = {\n user: userResult,\n };\n this.notifyListeners('authStateChange', change);\n }\n applySignInOptions(options, provider) {\n if (options.customParameters) {\n const customParameters = {};\n options.customParameters.map(parameter => {\n customParameters[parameter.key] = parameter.value;\n });\n provider.setCustomParameters(customParameters);\n }\n if (options.scopes) {\n for (const scope of options.scopes) {\n provider.addScope(scope);\n }\n }\n }\n signInWithPopupOrRedirect(provider, mode) {\n const auth = getAuth();\n if (mode === 'redirect') {\n return signInWithRedirect(auth, provider);\n }\n else {\n return signInWithPopup(auth, provider);\n }\n }\n linkCurrentUserWithPopupOrRedirect(provider, mode) {\n const auth = getAuth();\n if (!auth.currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n if (mode === 'redirect') {\n return linkWithRedirect(auth.currentUser, provider);\n }\n else {\n return linkWithPopup(auth.currentUser, provider);\n }\n }\n linkCurrentUserWithCredential(credential) {\n const auth = getAuth();\n if (!auth.currentUser) {\n throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);\n }\n return linkWithCredential(auth.currentUser, credential);\n }\n createSignInResult(userCredential, authCredential) {\n const userResult = this.createUserResult((userCredential === null || userCredential === void 0 ? void 0 : userCredential.user) || null);\n const credentialResult = this.createCredentialResult(authCredential);\n const additionalUserInfoResult = this.createAdditionalUserInfoResult(userCredential);\n const result = {\n user: userResult,\n credential: credentialResult,\n additionalUserInfo: additionalUserInfoResult,\n };\n return result;\n }\n createCredentialResult(credential) {\n if (!credential) {\n return null;\n }\n const result = {\n providerId: credential.providerId,\n };\n if (credential instanceof OAuthCredential) {\n result.accessToken = credential.accessToken;\n result.idToken = credential.idToken;\n result.secret = credential.secret;\n }\n return result;\n }\n createUserResult(user) {\n if (!user) {\n return null;\n }\n const result = {\n displayName: user.displayName,\n email: user.email,\n emailVerified: user.emailVerified,\n isAnonymous: user.isAnonymous,\n phoneNumber: user.phoneNumber,\n photoUrl: user.photoURL,\n providerId: user.providerId,\n tenantId: user.tenantId,\n uid: user.uid,\n };\n return result;\n }\n createAdditionalUserInfoResult(credential) {\n if (!credential) {\n return null;\n }\n const additionalUserInfo = getAdditionalUserInfo(credential);\n if (!additionalUserInfo) {\n return null;\n }\n const { isNewUser, profile, providerId, username } = additionalUserInfo;\n const result = {\n isNewUser,\n };\n if (providerId !== null) {\n result.providerId = providerId;\n }\n if (profile !== null) {\n result.profile = profile;\n }\n if (username !== null && username !== undefined) {\n result.username = username;\n }\n return result;\n }\n}\nFirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN = 'No user is signed in.';\n//# sourceMappingURL=web.js.map"],"sourceRoot":""}