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D,CAAE,MAAO,GACP,KAAK,SAAW,KAAK,QAAQ,EAC/B,GAGF,SAAW,CAAC,EAAU,KACpB,IACE,SAAS,OAAO,+BAA+B,EAAU,GACtD,MAAM,IACL,EAAK,uBAAuB,IAE7B,OAAO,GAAQ,KAAK,SAAW,KAAK,QAAQ,IACjD,CAAE,MAAO,GACP,KAAK,SAAW,KAAK,QAAQ,EAC/B,GAGF,mBAAqB,KACnB,KAAK,KAAK,uBAAuB,EAGnC,cAAiB,IACf,KAAK,SAAS,MAAM,GACjB,MAAM,GACL,SAAS,OACN,qBAAqB,SAAS,KAAK,qBAAqB,WAAW,MAEvE,OAAO,GAAQ,KAAK,SAAW,KAAK,QAAQ,IAAK,EAGtD,YAAc,KACZ,KAAK,OAAO,QACT,MAAM,GACL,SAAS,OACN,qBAAqB,SAAS,KAAK,mBAAmB,WAAW,KAAM,MAE3E,OAAO,GAAQ,KAAK,SAAW,KAAK,QAAQ,IAAK,EAGtD,OAAS,KACP,SAAS,OAAO,SAAS,EAG3B,OAAU,GACS,SAAS,WAAW,IAAI,YAAY,KAAK,KAAK,OAC7C,OAAO,GAG3B,cAAiB,IACf,SAAS,OAAO,uBAAuB,EAAM,EAG/C,eAAkB,IAChB,KAAK,KAAK,eAAe,EAAS,EAGpC,eAAiB,OAIjB,iBAAmB,OAInB,cAAgB,uBAKH,IAAI","file":"/npm/react-native-firebase-auth@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-native-firebase-auth@1.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import * as firebase from 'firebase';\nimport Auth from './auth';\n\nconst FireAuth = class {\n  user = null;\n  profile = null;\n  onUserChange = null;\n  onLogout = null;\n  onEmailVerified = null;\n  onLogin = null;\n  onError = null;\n\n  init(googleConfig) {\n    Auth.Google.configure(googleConfig);\n  }\n\n  setup = (onLogin, onUserChange, onLogout, onEmailVerified, onError) => {\n    this.onUserChange = onUserChange;\n    this.onLogout = onLogout;\n    this.onEmailVerified = onEmailVerified;\n    this.onLogin = onLogin;\n    this.onError = onError;\n\n    firebase.auth().onAuthStateChanged((user)=> {\n\n      if (user) {\n        // Determine if user needs to verify email\n        var emailVerified = !user.providerData || !user.providerData.length || user.providerData[0].providerId != 'password' || user.emailVerified;\n\n        // Upsert profile information\n        var profileRef = firebase.database().ref(`profiles/${user.uid}`);\n        profileRef.update({ emailVerified: emailVerified, email: user.email });\n\n        profileRef.on('value', (profile)=> {\n          const val = profile.val();\n\n          // Email become verified in session\n          if (val.emailVerified && (this.profile && !this.profile.val().emailVerified)) {\n            this.onEmailVerified && this.onEmailVerified();\n          }\n\n          if (!this.user) {\n            this.onLogin && this.onLogin(user, val); // On login\n          } else if (val) {\n            this.onUserChange && this.onUserChange(user, val); // On updated\n          }\n\n          this.profile = profile; // Store profile\n          this.user = user; // Store user\n        });\n\n      } else {\n        this.profile = null;\n        this.user = null; // Clear user and logout\n        this.onLogout && this.onLogout();\n      }\n\n    });\n  }\n\n  login = (email, password) => {\n    try {\n      firebase.auth().signInWithEmailAndPassword(email, password)\n        .catch((err) => this.onError && this.onError(err));\n    } catch (e) {\n      this.onError && this.onError(e);\n    }\n  }\n\n  loginAnonymously = () => {\n    try {\n      firebase.auth().signInAnonymously()\n        .catch((err) => this.onError && this.onError(err));\n    } catch (e) {\n      this.onError && this.onError(e);\n    }\n  }\n\n  register = (username, password) => {\n    try {\n      firebase.auth().createUserWithEmailAndPassword(username, password)\n        .then((user)=> {\n          user.sendEmailVerification();\n        })\n        .catch((err) => this.onError && this.onError(err));\n    } catch (e) {\n      this.onError && this.onError(e);\n    }\n  }\n\n  resendVerification = () => {\n    this.user.sendEmailVerification();\n  }\n\n  facebookLogin = (permissions) => {\n    Auth.Facebook.login(permissions)\n      .then((token) => (\n        firebase.auth()\n          .signInWithCredential(firebase.auth.FacebookAuthProvider.credential(token))\n      ))\n      .catch((err) => this.onError && this.onError(err));\n  }\n\n  googleLogin = () => {\n    Auth.Google.login()\n      .then((token) => (\n        firebase.auth()\n          .signInWithCredential(firebase.auth.GoogleAuthProvider.credential(null, token))\n      ))\n      .catch((err) => this.onError && this.onError(err));\n  }\n\n  logout = () => {\n    firebase.auth().signOut();\n  }\n\n  update = (data) => {\n    var profileRef = firebase.database().ref(`profiles/${this.user.uid}`);\n    return profileRef.update(data);\n  }\n\n  resetPassword = (email) => {\n    firebase.auth().sendPasswordResetEmail(email);\n  }\n\n  updatePassword = (password) => {\n    this.user.updatePassword(password);\n  }\n\n  linkWithGoogle = () => {\n    // @TODO\n  }\n\n  linkWithFacebook = () => {\n    // @TODO\n  }\n\n  linkWithEmail = () => {\n    // @TODO\n  }\n};\n\nexport default new FireAuth();\n"]}