package V2;

import android.app.Application;
import com.debridstream.tv.AuthViewModel;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;

/* JADX INFO: loaded from: classes.dex */
public final class M0 implements FirebaseAuth.AuthStateListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ AuthViewModel f7432a;

    public M0(AuthViewModel authViewModel) {
        this.f7432a = authViewModel;
    }

    @Override // com.google.firebase.auth.FirebaseAuth.AuthStateListener
    public final void onAuthStateChanged(FirebaseAuth firebaseAuth) {
        Y4.c0 c0Var;
        Object value;
        kotlin.jvm.internal.o.h(firebaseAuth, "firebaseAuth");
        FirebaseUser currentUser = firebaseAuth.getCurrentUser();
        AuthViewModel authViewModel = this.f7432a;
        if (currentUser != null) {
            V4.E.y(androidx.lifecycle.X.h(authViewModel), null, null, new L0(authViewModel, null), 3);
            return;
        }
        Y4.c0 c0Var2 = C0706p0.f7996a;
        C0706p0.c();
        Application context = authViewModel.getApplication();
        kotlin.jvm.internal.o.h(context, "context");
        context.getApplicationContext().getSharedPreferences("debridstream_app_progress_cache", 0).edit().clear().apply();
        Y4.c0 c0Var3 = AbstractC0714r1.f8036a;
        x4.y yVar = x4.y.f26065a;
        c0Var3.getClass();
        c0Var3.k(null, yVar);
        C3.a();
        N2.q.m(x4.z.f26066a);
        Y4.H h5 = authViewModel._uiState;
        do {
            c0Var = (Y4.c0) h5;
            value = c0Var.getValue();
            ((C0745z0) value).getClass();
        } while (!c0Var.i(value, new C0745z0(null, yVar, true, false, false, "", null, null, false, 0)));
        Y4.c0 c0Var4 = z3.f8212a;
        Application context2 = authViewModel.getApplication();
        kotlin.jvm.internal.o.h(context2, "context");
        z3.f8214c = false;
        z3.b(context2);
    }
}
