PhotoRoom v4.8.2版本的 MD5 值为:c40a01bb3380c0f75c0cb6ac6760f295

以下内容为反编译后的 d.java 源代码,内容仅作参考


package qq;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import androidx.activity.ComponentActivity;
import androidx.activity.result.f;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import b10.e2;
import b10.o;
import b10.o0;
import b10.p0;
import com.appboy.Constants;
import com.facebook.m;
import com.facebook.s;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.a0;
import com.google.firebase.auth.f0;
import com.google.firebase.auth.x;
import com.photoroom.models.User;
import e10.m0;
import e10.y;
import hy.l;
import hy.p;
import ie.e0;
import ie.g0;
import java.util.ArrayList;
import kotlin.Metadata;
import kotlin.collections.u;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import mf.c;
import px.c0;
import px.f1;
import px.h0;
import px.m0;
import px.n0;
import px.u0;
public final class d {
    private final Context f66896a;
    private final xt.h f66897b;
    private final com.photoroom.util.data.i f66898c;
    private final qt.a f66899d;
    private final bs.b f66900e;
    private final bs.c f66901f;
    private final vt.e f66902g;
    private final y f66903h;
    private final m0 f66904i;
    private final mf.l f66905j;
    private final com.facebook.m f66906k;

    @Metadata(d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bv\u0018\u00002\u00020\u0001:\u0005\u0002\u0003\u0004\u0005\u0006\u0082\u0001\u0004\u0007\b\t\n¨\u0006\u000b"}, d2 = {"Lqq/d$a;", "", Constants.APPBOY_PUSH_CONTENT_KEY, "b", "c", Constants.APPBOY_PUSH_NOTIFICATION_SOUND_DEFAULT_VALUE, "e", "Lqq/d$a$a;", "Lqq/d$a$b;", "Lqq/d$a$c;", "Lqq/d$a$d;", "app_release"}, k = 1, mv = {1, 9, 0})
    public interface a {

        public static final class C2141a implements a {
            private final Exception f66907a;

            public C2141a(Exception exc) {
                this.f66907a = exc;
            }

            public final Exception a() {
                return this.f66907a;
            }

            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                return (obj instanceof C2141a) && t.d(this.f66907a, ((C2141a) obj).f66907a);
            }

            public int hashCode() {
                Exception exc = this.f66907a;
                if (exc == null) {
                    return 0;
                }
                return exc.hashCode();
            }

            public String toString() {
                Exception exc = this.f66907a;
                return "Error(exception=" + exc + ")";
            }
        }

        public static final class b implements a {
            public static final b f66908a = new b();

            private b() {
            }

            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (obj instanceof b) {
                    b bVar = (b) obj;
                    return true;
                }
                return false;
            }

            public int hashCode() {
                return 1171390754;
            }

            public String toString() {
                return "Logged";
            }
        }

        public static final class c implements a {
            private final e f66909a;

            public c(e provider) {
                t.i(provider, "provider");
                this.f66909a = provider;
            }

            public final e a() {
                return this.f66909a;
            }

            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                return (obj instanceof c) && this.f66909a == ((c) obj).f66909a;
            }

            public int hashCode() {
                return this.f66909a.hashCode();
            }

            public String toString() {
                e eVar = this.f66909a;
                return "Logging(provider=" + eVar + ")";
            }
        }

        public static final class C2142d implements a {
            public static final C2142d f66910a = new C2142d();

            private C2142d() {
            }

            public boolean equals(Object obj) {
                if (this == obj) {
                    return true;
                }
                if (obj instanceof C2142d) {
                    C2142d c2142d = (C2142d) obj;
                    return true;
                }
                return false;
            }

            public int hashCode() {
                return -1138183531;
            }

            public String toString() {
                return "NotLogged";
            }
        }

        public static final class e {
            public static final e f66911b = new e("GOOGLE", 0);
            public static final e f66912c = new e("FACEBOOK", 1);
            public static final e f66913d = new e("APPLE", 2);
            private static final e[] f66914e;
            private static final wx.a f66915f;

            static {
                e[] a11 = a();
                f66914e = a11;
                f66915f = wx.b.a(a11);
            }

            private e(String str, int i11) {
            }

            private static final e[] a() {
                return new e[]{f66911b, f66912c, f66913d};
            }

            public static e valueOf(String str) {
                return (e) Enum.valueOf(e.class, str);
            }

            public static e[] values() {
                return (e[]) f66914e.clone();
            }
        }
    }

    public static final class b {
        public static final b f66916b = new b("EMAIL", 0);
        public static final b f66917c = new b("EMAIL_MAGIC_CODE", 1);
        public static final b f66918d = new b("FACEBOOK", 2);
        public static final b f66919e = new b("APPLE", 3);
        public static final b f66920f = new b("GOOGLE", 4);
        private static final b[] f66921g;
        private static final wx.a f66922h;

        public class a {
            public static final int[] f66923a;

            static {
                int[] iArr = new int[b.values().length];
                try {
                    iArr[b.f66916b.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[b.f66917c.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                try {
                    iArr[b.f66918d.ordinal()] = 3;
                } catch (NoSuchFieldError unused3) {
                }
                try {
                    iArr[b.f66919e.ordinal()] = 4;
                } catch (NoSuchFieldError unused4) {
                }
                try {
                    iArr[b.f66920f.ordinal()] = 5;
                } catch (NoSuchFieldError unused5) {
                }
                f66923a = iArr;
            }
        }

        static {
            b[] a11 = a();
            f66921g = a11;
            f66922h = wx.b.a(a11);
        }

        private b(String str, int i11) {
        }

        private static final b[] a() {
            return new b[]{f66916b, f66917c, f66918d, f66919e, f66920f};
        }

        public static b valueOf(String str) {
            return (b) Enum.valueOf(b.class, str);
        }

        public static b[] values() {
            return (b[]) f66921g.clone();
        }

        public final String c() {
            int i11 = a.f66923a[ordinal()];
            if (i11 != 1) {
                if (i11 != 2) {
                    if (i11 != 3) {
                        if (i11 != 4) {
                            if (i11 == 5) {
                                return "Google";
                            }
                            throw new c0();
                        }
                        return "Apple";
                    }
                    return "Facebook";
                }
                return "EmailMagicCode";
            }
            return "Email";
        }
    }

    public class c {
        public static final int[] f66924a;

        static {
            int[] iArr = new int[b.values().length];
            try {
                iArr[b.f66918d.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[b.f66919e.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[b.f66920f.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr[b.f66916b.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                iArr[b.f66917c.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            f66924a = iArr;
        }
    }

    public static final class C2143d extends kotlin.coroutines.jvm.internal.m implements p {
        int f66925h;
        private Object f66926i;
        final a0 f66927j;
        final b f66928k;
        final d f66929l;

        public static final class a extends kotlin.coroutines.jvm.internal.m implements p {
            int f66930h;
            final d f66931i;

            a(d dVar, ux.d dVar2) {
                super(2, dVar2);
                this.f66931i = dVar;
            }

            @Override
            public final ux.d create(Object obj, ux.d dVar) {
                return new a(this.f66931i, dVar);
            }

            @Override
            public final Object invoke(o0 o0Var, ux.d dVar) {
                return ((a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
            }

            @Override
            public final Object invokeSuspend(Object obj) {
                Object e11;
                e11 = vx.d.e();
                int i11 = this.f66930h;
                if (i11 == 0) {
                    n0.b(obj);
                    this.f66931i.f66897b.k();
                    this.f66931i.f66897b.l();
                    vt.e eVar = this.f66931i.f66902g;
                    this.f66930h = 1;
                    if (eVar.a(this) == e11) {
                        return e11;
                    }
                } else if (i11 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                } else {
                    n0.b(obj);
                }
                return f1.f64673a;
            }
        }

        C2143d(a0 a0Var, b bVar, d dVar, ux.d dVar2) {
            super(2, dVar2);
            this.f66927j = a0Var;
            this.f66928k = bVar;
            this.f66929l = dVar;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            C2143d c2143d = new C2143d(this.f66927j, this.f66928k, this.f66929l, dVar);
            c2143d.f66926i = obj;
            return c2143d;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((C2143d) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            vx.d.e();
            if (this.f66925h == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f66926i;
                if (this.f66927j != null) {
                    w7.e.G0(w7.f.a(), this.f66928k.c(), null, 2, null);
                    b10.k.d(o0Var, null, null, new a(this.f66929l, null), 3, null);
                    this.f66929l.f66903h.setValue(a.b.f66908a);
                } else {
                    d.t(this.f66929l, this.f66928k, false, new IllegalStateException("Login successful but no user object"), 2, null);
                }
                return f1.f64673a;
            }
            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }

    public static final class e extends kotlin.coroutines.jvm.internal.m implements p {
        Object f66932h;
        Object f66933i;
        Object f66934j;
        Object f66935k;
        Object f66936l;
        Object f66937m;
        int f66938n;
        private Object f66939o;
        final com.google.firebase.auth.h f66940p;
        final d f66941q;
        final b f66942r;
        final Activity f66943s;

        public static final class a implements OnCompleteListener {
            final o0 f66944a;
            final d f66945b;
            final b f66946c;
            final o f66947d;
            final Activity f66948e;
            final kotlin.jvm.internal.n0 f66949f;

            static final class C2144a extends kotlin.coroutines.jvm.internal.m implements p {
                int f66950h;
                final Task f66951i;
                final d f66952j;
                final b f66953k;
                final o f66954l;
                final Activity f66955m;
                final kotlin.jvm.internal.n0 f66956n;

                C2144a(Task task, d dVar, b bVar, o oVar, Activity activity, kotlin.jvm.internal.n0 n0Var, ux.d dVar2) {
                    super(2, dVar2);
                    this.f66951i = task;
                    this.f66952j = dVar;
                    this.f66953k = bVar;
                    this.f66954l = oVar;
                    this.f66955m = activity;
                    this.f66956n = n0Var;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new C2144a(this.f66951i, this.f66952j, this.f66953k, this.f66954l, this.f66955m, this.f66956n, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((C2144a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    com.google.firebase.auth.h b11;
                    e11 = vx.d.e();
                    int i11 = this.f66950h;
                    if (i11 == 0) {
                        n0.b(obj);
                        if (this.f66951i.isSuccessful()) {
                            d dVar = this.f66952j;
                            b bVar = this.f66953k;
                            a0 j11 = ((com.google.firebase.auth.i) this.f66951i.getResult()).j();
                            this.f66950h = 1;
                            if (dVar.v(bVar, j11, this) == e11) {
                                return e11;
                            }
                        } else {
                            Exception exception = this.f66951i.getException();
                            if (exception != null) {
                                d dVar2 = this.f66952j;
                                b bVar2 = this.f66953k;
                                Activity activity = this.f66955m;
                                kotlin.jvm.internal.n0 n0Var = this.f66956n;
                                if ((exception instanceof x) && (b11 = ((x) exception).b()) != null) {
                                    n0Var.f55807b = b11;
                                }
                                this.f66950h = 2;
                                if (dVar2.A(bVar2, activity, (com.google.firebase.auth.h) n0Var.f55807b, this) == e11) {
                                    return e11;
                                }
                            }
                        }
                    } else if (i11 != 1 && i11 != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f66954l;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            a(o0 o0Var, d dVar, b bVar, o oVar, Activity activity, kotlin.jvm.internal.n0 n0Var) {
                this.f66944a = o0Var;
                this.f66945b = dVar;
                this.f66946c = bVar;
                this.f66947d = oVar;
                this.f66948e = activity;
                this.f66949f = n0Var;
            }

            @Override
            public final void onComplete(Task task) {
                t.i(task, "task");
                b10.k.d(this.f66944a, null, null, new C2144a(task, this.f66945b, this.f66946c, this.f66947d, this.f66948e, this.f66949f, null), 3, null);
            }
        }

        e(com.google.firebase.auth.h hVar, d dVar, b bVar, Activity activity, ux.d dVar2) {
            super(2, dVar2);
            this.f66940p = hVar;
            this.f66941q = dVar;
            this.f66942r = bVar;
            this.f66943s = activity;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            e eVar = new e(this.f66940p, this.f66941q, this.f66942r, this.f66943s, dVar);
            eVar.f66939o = obj;
            return eVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((e) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object e11;
            ux.d c11;
            Object e12;
            e11 = vx.d.e();
            int i11 = this.f66938n;
            if (i11 != 0) {
                if (i11 == 1) {
                    n0.b(obj);
                    return f1.f64673a;
                }
                if (i11 == 2) {
                    b bVar = (b) this.f66937m;
                    d dVar = (d) this.f66936l;
                    Activity activity = (Activity) this.f66935k;
                    com.google.firebase.auth.h hVar = (com.google.firebase.auth.h) this.f66934j;
                    a0 a0Var = (a0) this.f66933i;
                    kotlin.jvm.internal.n0 n0Var = (kotlin.jvm.internal.n0) this.f66932h;
                    o0 o0Var = (o0) this.f66939o;
                } else if (i11 != 3) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                n0.b(obj);
                return f1.f64673a;
            }
            n0.b(obj);
            o0 o0Var2 = (o0) this.f66939o;
            User.INSTANCE.acceptTermsAndConditions();
            kotlin.jvm.internal.n0 n0Var2 = new kotlin.jvm.internal.n0();
            n0Var2.f55807b = this.f66940p;
            a0 f11 = FirebaseAuth.getInstance().f();
            if (f11 == null) {
                this.f66938n = 1;
                if (this.f66941q.A(this.f66942r, this.f66943s, (com.google.firebase.auth.h) n0Var2.f55807b, this) == e11) {
                    return e11;
                }
                return f1.f64673a;
            }
            if (f11.v0()) {
                com.google.firebase.auth.h hVar2 = this.f66940p;
                Activity activity2 = this.f66943s;
                d dVar2 = this.f66941q;
                b bVar2 = this.f66942r;
                this.f66939o = o0Var2;
                this.f66932h = n0Var2;
                this.f66933i = f11;
                this.f66934j = hVar2;
                this.f66935k = activity2;
                this.f66936l = dVar2;
                this.f66937m = bVar2;
                this.f66938n = 2;
                c11 = vx.c.c(this);
                b10.p pVar = new b10.p(c11, 1);
                pVar.A();
                f11.w0(hVar2).addOnCompleteListener(activity2, new a(o0Var2, dVar2, bVar2, pVar, activity2, n0Var2));
                Object x11 = pVar.x();
                e12 = vx.d.e();
                if (x11 == e12) {
                    kotlin.coroutines.jvm.internal.h.c(this);
                }
                if (x11 == e11) {
                    return e11;
                }
            } else {
                this.f66938n = 3;
                if (this.f66941q.A(this.f66942r, this.f66943s, (com.google.firebase.auth.h) n0Var2.f55807b, this) == e11) {
                    return e11;
                }
            }
            return f1.f64673a;
        }
    }

    public static final class f extends kotlin.coroutines.jvm.internal.m implements p {
        Object f66957h;
        Object f66958i;
        Object f66959j;
        Object f66960k;
        int f66961l;
        private Object f66962m;
        final com.google.firebase.auth.h f66963n;
        final Activity f66964o;
        final d f66965p;
        final b f66966q;

        public static final class a implements OnCompleteListener {
            final o0 f66967a;
            final d f66968b;
            final b f66969c;
            final o f66970d;

            static final class C2145a extends kotlin.coroutines.jvm.internal.m implements p {
                int f66971h;
                final d f66972i;
                final b f66973j;
                final o f66974k;

                C2145a(d dVar, b bVar, o oVar, ux.d dVar2) {
                    super(2, dVar2);
                    this.f66972i = dVar;
                    this.f66973j = bVar;
                    this.f66974k = oVar;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new C2145a(this.f66972i, this.f66973j, this.f66974k, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((C2145a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    e11 = vx.d.e();
                    int i11 = this.f66971h;
                    if (i11 == 0) {
                        n0.b(obj);
                        d dVar = this.f66972i;
                        b bVar = this.f66973j;
                        a0 f11 = FirebaseAuth.getInstance().f();
                        this.f66971h = 1;
                        if (dVar.v(bVar, f11, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f66974k;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            a(o0 o0Var, d dVar, b bVar, o oVar) {
                this.f66967a = o0Var;
                this.f66968b = dVar;
                this.f66969c = bVar;
                this.f66970d = oVar;
            }

            @Override
            public final void onComplete(Task task) {
                t.i(task, "task");
                if (task.isSuccessful()) {
                    b10.k.d(this.f66967a, null, null, new C2145a(this.f66968b, this.f66969c, this.f66970d, null), 3, null);
                    return;
                }
                Exception exception = task.getException();
                d dVar = this.f66968b;
                b bVar = this.f66969c;
                d.t(dVar, bVar, false, (bVar == b.f66918d && (exception instanceof x)) ? new wt.e(exception) : exception, 2, null);
                o oVar = this.f66970d;
                m0.a aVar = px.m0.f64687c;
                oVar.resumeWith(px.m0.b(f1.f64673a));
            }
        }

        f(com.google.firebase.auth.h hVar, Activity activity, d dVar, b bVar, ux.d dVar2) {
            super(2, dVar2);
            this.f66963n = hVar;
            this.f66964o = activity;
            this.f66965p = dVar;
            this.f66966q = bVar;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            f fVar = new f(this.f66963n, this.f66964o, this.f66965p, this.f66966q, dVar);
            fVar.f66962m = obj;
            return fVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((f) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object e11;
            ux.d c11;
            Object e12;
            e11 = vx.d.e();
            int i11 = this.f66961l;
            if (i11 == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f66962m;
                com.google.firebase.auth.h hVar = this.f66963n;
                Activity activity = this.f66964o;
                d dVar = this.f66965p;
                b bVar = this.f66966q;
                this.f66962m = o0Var;
                this.f66957h = hVar;
                this.f66958i = activity;
                this.f66959j = dVar;
                this.f66960k = bVar;
                this.f66961l = 1;
                c11 = vx.c.c(this);
                b10.p pVar = new b10.p(c11, 1);
                pVar.A();
                FirebaseAuth.getInstance().m(hVar).addOnCompleteListener(activity, new a(o0Var, dVar, bVar, pVar));
                Object x11 = pVar.x();
                e12 = vx.d.e();
                if (x11 == e12) {
                    kotlin.coroutines.jvm.internal.h.c(this);
                }
                if (x11 == e11) {
                    return e11;
                }
            } else if (i11 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            } else {
                b bVar2 = (b) this.f66960k;
                d dVar2 = (d) this.f66959j;
                Activity activity2 = (Activity) this.f66958i;
                com.google.firebase.auth.h hVar2 = (com.google.firebase.auth.h) this.f66957h;
                o0 o0Var2 = (o0) this.f66962m;
                n0.b(obj);
            }
            return f1.f64673a;
        }
    }

    static final class g extends kotlin.coroutines.jvm.internal.m implements p {
        Object f66975h;
        Object f66976i;
        Object f66977j;
        Object f66978k;
        Object f66979l;
        int f66980m;
        private Object f66981n;
        final String f66982o;
        final String f66983p;
        final d f66984q;
        final Activity f66985r;

        public static final class a implements OnCompleteListener {
            final o0 f66986a;
            final d f66987b;
            final b f66988c;
            final o f66989d;
            final Activity f66990e;

            static final class C2146a extends kotlin.coroutines.jvm.internal.m implements p {
                int f66991h;
                final d f66992i;
                final b f66993j;
                final Activity f66994k;
                final com.google.firebase.auth.h f66995l;
                final o f66996m;

                C2146a(d dVar, b bVar, Activity activity, com.google.firebase.auth.h hVar, o oVar, ux.d dVar2) {
                    super(2, dVar2);
                    this.f66992i = dVar;
                    this.f66993j = bVar;
                    this.f66994k = activity;
                    this.f66995l = hVar;
                    this.f66996m = oVar;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new C2146a(this.f66992i, this.f66993j, this.f66994k, this.f66995l, this.f66996m, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((C2146a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    e11 = vx.d.e();
                    int i11 = this.f66991h;
                    if (i11 == 0) {
                        n0.b(obj);
                        d dVar = this.f66992i;
                        b bVar = this.f66993j;
                        Activity activity = this.f66994k;
                        com.google.firebase.auth.h credential = this.f66995l;
                        t.h(credential, "$credential");
                        this.f66991h = 1;
                        if (dVar.y(bVar, activity, credential, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f66996m;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            static final class b extends kotlin.coroutines.jvm.internal.m implements p {
                int f66997h;
                final d f66998i;
                final b f66999j;
                final Task f67000k;
                final o f67001l;

                b(d dVar, b bVar, Task task, o oVar, ux.d dVar2) {
                    super(2, dVar2);
                    this.f66998i = dVar;
                    this.f66999j = bVar;
                    this.f67000k = task;
                    this.f67001l = oVar;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new b(this.f66998i, this.f66999j, this.f67000k, this.f67001l, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((b) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    e11 = vx.d.e();
                    int i11 = this.f66997h;
                    if (i11 == 0) {
                        n0.b(obj);
                        d dVar = this.f66998i;
                        b bVar = this.f66999j;
                        a0 j11 = ((com.google.firebase.auth.i) this.f67000k.getResult()).j();
                        this.f66997h = 1;
                        if (dVar.v(bVar, j11, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f67001l;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            a(o0 o0Var, d dVar, b bVar, o oVar, Activity activity) {
                this.f66986a = o0Var;
                this.f66987b = dVar;
                this.f66988c = bVar;
                this.f66989d = oVar;
                this.f66990e = activity;
            }

            @Override
            public final void onComplete(Task task) {
                e2 d11;
                t.i(task, "task");
                if (!task.isSuccessful()) {
                    d.t(this.f66987b, this.f66988c, false, task.getException(), 2, null);
                    o oVar = this.f66989d;
                    m0.a aVar = px.m0.f64687c;
                    oVar.resumeWith(px.m0.b(f1.f64673a));
                    return;
                }
                com.google.firebase.auth.h e02 = ((com.google.firebase.auth.i) task.getResult()).e0();
                if (e02 != null) {
                    d11 = b10.k.d(this.f66986a, null, null, new C2146a(this.f66987b, this.f66988c, this.f66990e, e02, this.f66989d, null), 3, null);
                    if (d11 != null) {
                        return;
                    }
                }
                b10.k.d(this.f66986a, null, null, new b(this.f66987b, this.f66988c, task, this.f66989d, null), 3, null);
            }
        }

        g(String str, String str2, d dVar, Activity activity, ux.d dVar2) {
            super(2, dVar2);
            this.f66982o = str;
            this.f66983p = str2;
            this.f66984q = dVar;
            this.f66985r = activity;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            g gVar = new g(this.f66982o, this.f66983p, this.f66984q, this.f66985r, dVar);
            gVar.f66981n = obj;
            return gVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((g) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object e11;
            ux.d c11;
            Object e12;
            e11 = vx.d.e();
            int i11 = this.f66980m;
            if (i11 == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f66981n;
                b bVar = b.f66916b;
                User user = User.INSTANCE;
                user.getPreferences().setSignInMethod(bt.h.f15073d.c());
                user.updateUserPreferences();
                if (FirebaseAuth.getInstance().h(this.f66982o)) {
                    if (this.f66983p.length() == 0) {
                        d.t(this.f66984q, bVar, false, new IllegalStateException("Email is empty"), 2, null);
                        return f1.f64673a;
                    }
                    String str = this.f66983p;
                    String str2 = this.f66982o;
                    d dVar = this.f66984q;
                    Activity activity = this.f66985r;
                    this.f66981n = o0Var;
                    this.f66975h = bVar;
                    this.f66976i = str;
                    this.f66977j = str2;
                    this.f66978k = dVar;
                    this.f66979l = activity;
                    this.f66980m = 1;
                    c11 = vx.c.c(this);
                    b10.p pVar = new b10.p(c11, 1);
                    pVar.A();
                    FirebaseAuth.getInstance().p(str, str2).addOnCompleteListener(new a(o0Var, dVar, bVar, pVar, activity));
                    Object x11 = pVar.x();
                    e12 = vx.d.e();
                    if (x11 == e12) {
                        kotlin.coroutines.jvm.internal.h.c(this);
                    }
                    if (x11 == e11) {
                        return e11;
                    }
                } else {
                    d dVar2 = this.f66984q;
                    String str3 = this.f66982o;
                    d.t(dVar2, bVar, false, new IllegalStateException("Email link not valid: " + str3), 2, null);
                }
            } else if (i11 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            } else {
                Activity activity2 = (Activity) this.f66979l;
                d dVar3 = (d) this.f66978k;
                String str4 = (String) this.f66977j;
                String str5 = (String) this.f66976i;
                b bVar2 = (b) this.f66975h;
                o0 o0Var2 = (o0) this.f66981n;
                n0.b(obj);
            }
            return f1.f64673a;
        }
    }

    static final class h extends kotlin.coroutines.jvm.internal.m implements p {
        Object f67002h;
        Object f67003i;
        Object f67004j;
        Object f67005k;
        Object f67006l;
        int f67007m;
        private Object f67008n;
        final String f67009o;
        final String f67010p;
        final Activity f67011q;
        final d f67012r;

        public static final class a implements OnCompleteListener {
            final o0 f67013a;
            final d f67014b;
            final b f67015c;
            final o f67016d;
            final Activity f67017e;

            static final class C2147a extends kotlin.coroutines.jvm.internal.m implements p {
                int f67018h;
                final d f67019i;
                final b f67020j;
                final Activity f67021k;
                final com.google.firebase.auth.h f67022l;
                final o f67023m;

                C2147a(d dVar, b bVar, Activity activity, com.google.firebase.auth.h hVar, o oVar, ux.d dVar2) {
                    super(2, dVar2);
                    this.f67019i = dVar;
                    this.f67020j = bVar;
                    this.f67021k = activity;
                    this.f67022l = hVar;
                    this.f67023m = oVar;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new C2147a(this.f67019i, this.f67020j, this.f67021k, this.f67022l, this.f67023m, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((C2147a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    e11 = vx.d.e();
                    int i11 = this.f67018h;
                    if (i11 == 0) {
                        n0.b(obj);
                        d dVar = this.f67019i;
                        b bVar = this.f67020j;
                        Activity activity = this.f67021k;
                        com.google.firebase.auth.h it = this.f67022l;
                        t.h(it, "$it");
                        this.f67018h = 1;
                        if (dVar.y(bVar, activity, it, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f67023m;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            static final class b extends kotlin.coroutines.jvm.internal.m implements p {
                int f67024h;
                final d f67025i;
                final b f67026j;
                final Task f67027k;
                final o f67028l;

                b(d dVar, b bVar, Task task, o oVar, ux.d dVar2) {
                    super(2, dVar2);
                    this.f67025i = dVar;
                    this.f67026j = bVar;
                    this.f67027k = task;
                    this.f67028l = oVar;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new b(this.f67025i, this.f67026j, this.f67027k, this.f67028l, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((b) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    e11 = vx.d.e();
                    int i11 = this.f67024h;
                    if (i11 == 0) {
                        n0.b(obj);
                        d dVar = this.f67025i;
                        b bVar = this.f67026j;
                        a0 j11 = ((com.google.firebase.auth.i) this.f67027k.getResult()).j();
                        this.f67024h = 1;
                        if (dVar.v(bVar, j11, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f67028l;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            a(o0 o0Var, d dVar, b bVar, o oVar, Activity activity) {
                this.f67013a = o0Var;
                this.f67014b = dVar;
                this.f67015c = bVar;
                this.f67016d = oVar;
                this.f67017e = activity;
            }

            @Override
            public final void onComplete(Task task) {
                e2 d11;
                t.i(task, "task");
                if (!task.isSuccessful()) {
                    d.t(this.f67014b, this.f67015c, false, task.getException(), 2, null);
                    o oVar = this.f67016d;
                    m0.a aVar = px.m0.f64687c;
                    oVar.resumeWith(px.m0.b(f1.f64673a));
                    return;
                }
                com.google.firebase.auth.h e02 = ((com.google.firebase.auth.i) task.getResult()).e0();
                if (e02 != null) {
                    d11 = b10.k.d(this.f67013a, null, null, new C2147a(this.f67014b, this.f67015c, this.f67017e, e02, this.f67016d, null), 3, null);
                    if (d11 != null) {
                        return;
                    }
                }
                b10.k.d(this.f67013a, null, null, new b(this.f67014b, this.f67015c, task, this.f67016d, null), 3, null);
            }
        }

        h(String str, String str2, Activity activity, d dVar, ux.d dVar2) {
            super(2, dVar2);
            this.f67009o = str;
            this.f67010p = str2;
            this.f67011q = activity;
            this.f67012r = dVar;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            h hVar = new h(this.f67009o, this.f67010p, this.f67011q, this.f67012r, dVar);
            hVar.f67008n = obj;
            return hVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((h) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object e11;
            ux.d c11;
            Object e12;
            e11 = vx.d.e();
            int i11 = this.f67007m;
            if (i11 == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f67008n;
                b bVar = b.f66916b;
                String str = this.f67009o;
                String str2 = this.f67010p;
                Activity activity = this.f67011q;
                d dVar = this.f67012r;
                this.f67008n = o0Var;
                this.f67002h = bVar;
                this.f67003i = str;
                this.f67004j = str2;
                this.f67005k = activity;
                this.f67006l = dVar;
                this.f67007m = 1;
                c11 = vx.c.c(this);
                b10.p pVar = new b10.p(c11, 1);
                pVar.A();
                FirebaseAuth.getInstance().o(str, str2).addOnCompleteListener(activity, new a(o0Var, dVar, bVar, pVar, activity));
                Object x11 = pVar.x();
                e12 = vx.d.e();
                if (x11 == e12) {
                    kotlin.coroutines.jvm.internal.h.c(this);
                }
                if (x11 == e11) {
                    return e11;
                }
            } else if (i11 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            } else {
                d dVar2 = (d) this.f67006l;
                Activity activity2 = (Activity) this.f67005k;
                String str3 = (String) this.f67004j;
                String str4 = (String) this.f67003i;
                b bVar2 = (b) this.f67002h;
                o0 o0Var2 = (o0) this.f67008n;
                n0.b(obj);
            }
            return f1.f64673a;
        }
    }

    static final class i extends kotlin.coroutines.jvm.internal.m implements p {
        Object f67029h;
        Object f67030i;
        Object f67031j;
        Object f67032k;
        int f67033l;
        private Object f67034m;
        final Fragment f67036o;
        final ComponentActivity f67037p;

        public static final class a implements com.facebook.o {
            final o0 f67038a;
            final d f67039b;
            final ComponentActivity f67040c;
            final o f67041d;
            final b f67042e;

            public static final class C2148a extends kotlin.coroutines.jvm.internal.m implements p {
                int f67043h;
                final d f67044i;
                final ComponentActivity f67045j;
                final g0 f67046k;
                final o f67047l;

                C2148a(d dVar, ComponentActivity componentActivity, g0 g0Var, o oVar, ux.d dVar2) {
                    super(2, dVar2);
                    this.f67044i = dVar;
                    this.f67045j = componentActivity;
                    this.f67046k = g0Var;
                    this.f67047l = oVar;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    return new C2148a(this.f67044i, this.f67045j, this.f67046k, this.f67047l, dVar);
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((C2148a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    e11 = vx.d.e();
                    int i11 = this.f67043h;
                    if (i11 == 0) {
                        n0.b(obj);
                        d dVar = this.f67044i;
                        ComponentActivity componentActivity = this.f67045j;
                        com.facebook.a a11 = this.f67046k.a();
                        this.f67043h = 1;
                        if (dVar.r(componentActivity, a11, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                    }
                    o oVar = this.f67047l;
                    m0.a aVar = px.m0.f64687c;
                    f1 f1Var = f1.f64673a;
                    oVar.resumeWith(px.m0.b(f1Var));
                    return f1Var;
                }
            }

            a(o0 o0Var, d dVar, ComponentActivity componentActivity, o oVar, b bVar) {
                this.f67038a = o0Var;
                this.f67039b = dVar;
                this.f67040c = componentActivity;
                this.f67041d = oVar;
                this.f67042e = bVar;
            }

            @Override
            public void a() {
                d.t(this.f67039b, this.f67042e, true, null, 4, null);
                o oVar = this.f67041d;
                m0.a aVar = px.m0.f64687c;
                oVar.resumeWith(px.m0.b(f1.f64673a));
            }

            @Override
            public void b(s error) {
                t.i(error, "error");
                d.t(this.f67039b, this.f67042e, false, error, 2, null);
                o oVar = this.f67041d;
                m0.a aVar = px.m0.f64687c;
                oVar.resumeWith(px.m0.b(f1.f64673a));
            }

            @Override
            public void onSuccess(g0 result) {
                t.i(result, "result");
                b10.k.d(this.f67038a, null, null, new C2148a(this.f67039b, this.f67040c, result, this.f67041d, null), 3, null);
            }
        }

        public static final class b extends v implements hy.l {
            final d f67048g;

            b(d dVar) {
                super(1);
                this.f67048g = dVar;
            }

            @Override
            public Object invoke(Object obj) {
                invoke((Throwable) obj);
                return f1.f64673a;
            }

            public final void invoke(Throwable th2) {
                e0.f49343j.c().w(this.f67048g.f66906k);
            }
        }

        i(Fragment fragment, ComponentActivity componentActivity, ux.d dVar) {
            super(2, dVar);
            this.f67036o = fragment;
            this.f67037p = componentActivity;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            i iVar = new i(this.f67036o, this.f67037p, dVar);
            iVar.f67034m = obj;
            return iVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((i) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object e11;
            ux.d c11;
            ArrayList g11;
            Object e12;
            ArrayList g12;
            e11 = vx.d.e();
            int i11 = this.f67033l;
            if (i11 == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f67034m;
                b bVar = b.f66918d;
                d.this.u(bVar);
                e0.b bVar2 = e0.f49343j;
                bVar2.c().w(d.this.f66906k);
                d dVar = d.this;
                Fragment fragment = this.f67036o;
                ComponentActivity componentActivity = this.f67037p;
                this.f67034m = o0Var;
                this.f67029h = bVar;
                this.f67030i = dVar;
                this.f67031j = fragment;
                this.f67032k = componentActivity;
                this.f67033l = 1;
                c11 = vx.c.c(this);
                b10.p pVar = new b10.p(c11, 1);
                pVar.A();
                bVar2.c().p(dVar.f66906k, new a(o0Var, dVar, componentActivity, pVar, bVar));
                if (fragment != null) {
                    e0 c12 = bVar2.c();
                    com.facebook.m mVar = dVar.f66906k;
                    g12 = u.g("email", "public_profile");
                    c12.l(fragment, mVar, g12);
                } else {
                    e0 c13 = bVar2.c();
                    com.facebook.m mVar2 = dVar.f66906k;
                    g11 = u.g("email", "public_profile");
                    c13.k(componentActivity, mVar2, g11);
                }
                pVar.G(new b(dVar));
                Object x11 = pVar.x();
                e12 = vx.d.e();
                if (x11 == e12) {
                    kotlin.coroutines.jvm.internal.h.c(this);
                }
                if (x11 == e11) {
                    return e11;
                }
            } else if (i11 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            } else {
                ComponentActivity componentActivity2 = (ComponentActivity) this.f67032k;
                Fragment fragment2 = (Fragment) this.f67031j;
                d dVar2 = (d) this.f67030i;
                b bVar3 = (b) this.f67029h;
                o0 o0Var2 = (o0) this.f67034m;
                n0.b(obj);
            }
            return f1.f64673a;
        }
    }

    static final class j extends v implements hy.l {
        final hy.l f67049g;

        j(hy.l lVar) {
            super(1);
            this.f67049g = lVar;
        }

        public final void a(mf.d dVar) {
            IntentSender intentSender = dVar.f0().getIntentSender();
            t.h(intentSender, "getIntentSender(...)");
            this.f67049g.invoke(new f.a(intentSender).a());
        }

        @Override
        public Object invoke(Object obj) {
            a((mf.d) obj);
            return f1.f64673a;
        }
    }

    static final class k extends kotlin.coroutines.jvm.internal.m implements p {
        Object f67050h;
        Object f67051i;
        Object f67052j;
        Object f67053k;
        int f67054l;
        private Object f67055m;
        final String f67056n;
        final Activity f67057o;
        final d f67058p;
        final b f67059q;

        public static final class a implements OnCompleteListener {
            final o0 f67060a;
            final d f67061b;
            final b f67062c;
            final o f67063d;
            final Activity f67064e;

            static final class C2149a extends kotlin.coroutines.jvm.internal.m implements p {
                int f67065h;
                private Object f67066i;
                final Task f67067j;
                final o f67068k;
                final d f67069l;
                final b f67070m;
                final Activity f67071n;

                C2149a(Task task, o oVar, d dVar, b bVar, Activity activity, ux.d dVar2) {
                    super(2, dVar2);
                    this.f67067j = task;
                    this.f67068k = oVar;
                    this.f67069l = dVar;
                    this.f67070m = bVar;
                    this.f67071n = activity;
                }

                @Override
                public final ux.d create(Object obj, ux.d dVar) {
                    C2149a c2149a = new C2149a(this.f67067j, this.f67068k, this.f67069l, this.f67070m, this.f67071n, dVar);
                    c2149a.f67066i = obj;
                    return c2149a;
                }

                @Override
                public final Object invoke(o0 o0Var, ux.d dVar) {
                    return ((C2149a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
                }

                @Override
                public final Object invokeSuspend(Object obj) {
                    Object e11;
                    f1 f1Var;
                    e11 = vx.d.e();
                    int i11 = this.f67065h;
                    if (i11 == 0) {
                        n0.b(obj);
                        o0 o0Var = (o0) this.f67066i;
                        com.google.firebase.auth.h e02 = ((com.google.firebase.auth.i) this.f67067j.getResult()).e0();
                        if (e02 == null) {
                            f1Var = null;
                            if (f1Var == null) {
                                d dVar = this.f67069l;
                                b bVar = this.f67070m;
                                a0 j11 = ((com.google.firebase.auth.i) this.f67067j.getResult()).j();
                                this.f67066i = null;
                                this.f67065h = 2;
                                if (dVar.v(bVar, j11, this) == e11) {
                                    return e11;
                                }
                            }
                            o oVar = this.f67068k;
                            m0.a aVar = px.m0.f64687c;
                            f1 f1Var2 = f1.f64673a;
                            oVar.resumeWith(px.m0.b(f1Var2));
                            return f1Var2;
                        }
                        d dVar2 = this.f67069l;
                        b bVar2 = this.f67070m;
                        Activity activity = this.f67071n;
                        this.f67066i = o0Var;
                        this.f67065h = 1;
                        if (dVar2.y(bVar2, activity, e02, this) == e11) {
                            return e11;
                        }
                    } else if (i11 != 1) {
                        if (i11 == 2) {
                            n0.b(obj);
                            o oVar2 = this.f67068k;
                            m0.a aVar2 = px.m0.f64687c;
                            f1 f1Var22 = f1.f64673a;
                            oVar2.resumeWith(px.m0.b(f1Var22));
                            return f1Var22;
                        }
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        o0 o0Var2 = (o0) this.f67066i;
                        n0.b(obj);
                    }
                    f1Var = f1.f64673a;
                    if (f1Var == null) {
                    }
                    o oVar22 = this.f67068k;
                    m0.a aVar22 = px.m0.f64687c;
                    f1 f1Var222 = f1.f64673a;
                    oVar22.resumeWith(px.m0.b(f1Var222));
                    return f1Var222;
                }
            }

            a(o0 o0Var, d dVar, b bVar, o oVar, Activity activity) {
                this.f67060a = o0Var;
                this.f67061b = dVar;
                this.f67062c = bVar;
                this.f67063d = oVar;
                this.f67064e = activity;
            }

            @Override
            public final void onComplete(Task task) {
                t.i(task, "task");
                if (task.isSuccessful()) {
                    b10.k.d(this.f67060a, null, null, new C2149a(task, this.f67063d, this.f67061b, this.f67062c, this.f67064e, null), 3, null);
                    return;
                }
                d.t(this.f67061b, this.f67062c, false, task.getException(), 2, null);
                o oVar = this.f67063d;
                m0.a aVar = px.m0.f64687c;
                oVar.resumeWith(px.m0.b(f1.f64673a));
            }
        }

        k(String str, Activity activity, d dVar, b bVar, ux.d dVar2) {
            super(2, dVar2);
            this.f67056n = str;
            this.f67057o = activity;
            this.f67058p = dVar;
            this.f67059q = bVar;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            k kVar = new k(this.f67056n, this.f67057o, this.f67058p, this.f67059q, dVar);
            kVar.f67055m = obj;
            return kVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((k) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            Object e11;
            ux.d c11;
            Object e12;
            e11 = vx.d.e();
            int i11 = this.f67054l;
            if (i11 == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f67055m;
                String str = this.f67056n;
                Activity activity = this.f67057o;
                d dVar = this.f67058p;
                b bVar = this.f67059q;
                this.f67055m = o0Var;
                this.f67050h = str;
                this.f67051i = activity;
                this.f67052j = dVar;
                this.f67053k = bVar;
                this.f67054l = 1;
                c11 = vx.c.c(this);
                b10.p pVar = new b10.p(c11, 1);
                pVar.A();
                FirebaseAuth.getInstance().n(str).addOnCompleteListener(activity, new a(o0Var, dVar, bVar, pVar, activity));
                Object x11 = pVar.x();
                e12 = vx.d.e();
                if (x11 == e12) {
                    kotlin.coroutines.jvm.internal.h.c(this);
                }
                if (x11 == e11) {
                    return e11;
                }
            } else if (i11 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            } else {
                b bVar2 = (b) this.f67053k;
                d dVar2 = (d) this.f67052j;
                Activity activity2 = (Activity) this.f67051i;
                String str2 = (String) this.f67050h;
                o0 o0Var2 = (o0) this.f67055m;
                n0.b(obj);
            }
            return f1.f64673a;
        }
    }

    public static final class l extends v implements hy.a {
        public static final l f67072g = new l();

        l() {
            super(0);
        }

        @Override
        public Object invoke() {
            m15064invoke();
            return f1.f64673a;
        }

        public final void m15064invoke() {
        }
    }

    public static final class m extends kotlin.coroutines.jvm.internal.m implements p {
        int f67073h;
        private Object f67074i;
        final Context f67075j;
        final d f67076k;
        final hy.a f67077l;

        public static final class a extends kotlin.coroutines.jvm.internal.m implements p {
            int f67078h;
            final d f67079i;

            a(d dVar, ux.d dVar2) {
                super(2, dVar2);
                this.f67079i = dVar;
            }

            @Override
            public final ux.d create(Object obj, ux.d dVar) {
                return new a(this.f67079i, dVar);
            }

            @Override
            public final Object invoke(o0 o0Var, ux.d dVar) {
                return ((a) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
            }

            @Override
            public final Object invokeSuspend(Object obj) {
                Object e11;
                bs.c cVar;
                jt.a aVar;
                e11 = vx.d.e();
                int i11 = this.f67078h;
                if (i11 == 0) {
                    n0.b(obj);
                    this.f67079i.f66900e.l();
                    qt.a aVar2 = this.f67079i.f66899d;
                    this.f67078h = 1;
                    if (aVar2.b(this) == e11) {
                        return e11;
                    }
                } else if (i11 != 1) {
                    if (i11 == 2) {
                        n0.b(obj);
                        cVar = this.f67079i.f66901f;
                        this.f67078h = 3;
                        if (cVar.b(this) == e11) {
                            return e11;
                        }
                        aVar = jt.a.f53936b;
                        this.f67078h = 4;
                        if (aVar.f(this) == e11) {
                        }
                        this.f67079i.f66897b.k();
                        this.f67079i.f66897b.l();
                        return f1.f64673a;
                    } else if (i11 != 3) {
                        if (i11 == 4) {
                            n0.b(obj);
                            this.f67079i.f66897b.k();
                            this.f67079i.f66897b.l();
                            return f1.f64673a;
                        }
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    } else {
                        n0.b(obj);
                        aVar = jt.a.f53936b;
                        this.f67078h = 4;
                        if (aVar.f(this) == e11) {
                            return e11;
                        }
                        this.f67079i.f66897b.k();
                        this.f67079i.f66897b.l();
                        return f1.f64673a;
                    }
                } else {
                    n0.b(obj);
                }
                bs.b bVar = this.f67079i.f66900e;
                this.f67078h = 2;
                if (bVar.n(this) == e11) {
                    return e11;
                }
                cVar = this.f67079i.f66901f;
                this.f67078h = 3;
                if (cVar.b(this) == e11) {
                }
                aVar = jt.a.f53936b;
                this.f67078h = 4;
                if (aVar.f(this) == e11) {
                }
                this.f67079i.f66897b.k();
                this.f67079i.f66897b.l();
                return f1.f64673a;
            }
        }

        public static final class b implements FirebaseAuth.a {
            final hy.a f67080a;

            b(hy.a aVar) {
                this.f67080a = aVar;
            }

            @Override
            public void a(FirebaseAuth firebaseAuth) {
                t.i(firebaseAuth, "firebaseAuth");
                a0 f11 = firebaseAuth.f();
                if (f11 != null) {
                    hy.a aVar = this.f67080a;
                    User.INSTANCE.resetUserPreferences();
                    if (f11.v0()) {
                        cj.a.a(fk.a.f44679a).i(this);
                        aVar.invoke();
                    }
                }
            }
        }

        m(Context context, d dVar, hy.a aVar, ux.d dVar2) {
            super(2, dVar2);
            this.f67075j = context;
            this.f67076k = dVar;
            this.f67077l = aVar;
        }

        @Override
        public final ux.d create(Object obj, ux.d dVar) {
            m mVar = new m(this.f67075j, this.f67076k, this.f67077l, dVar);
            mVar.f67074i = obj;
            return mVar;
        }

        @Override
        public final Object invoke(o0 o0Var, ux.d dVar) {
            return ((m) create(o0Var, dVar)).invokeSuspend(f1.f64673a);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            vx.d.e();
            if (this.f67073h == 0) {
                n0.b(obj);
                o0 o0Var = (o0) this.f67074i;
                b bVar = new b(this.f67077l);
                fk.a aVar = fk.a.f44679a;
                cj.a.a(aVar).d(bVar);
                cj.a.a(aVar).q();
                GoogleSignInOptions a11 = new GoogleSignInOptions.a(GoogleSignInOptions.f27011m).c(this.f67075j.getString(em.l.f42758w4)).a();
                t.h(a11, "build(...)");
                com.google.android.gms.auth.api.signin.a.a(this.f67075j, a11).signOut();
                this.f67076k.f66898c.a("userEmail");
                this.f67076k.f66898c.a("SelectedTeam");
                w7.f.a().A0();
                b10.k.d(o0Var, null, null, new a(this.f67076k, null), 3, null);
                this.f67076k.f66903h.setValue(a.C2142d.f66910a);
                return f1.f64673a;
            }
            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }

    public static final class n extends kotlin.coroutines.jvm.internal.d {
        Object f67081h;
        Object f67082i;
        Object f67083j;
        int f67085l;

        n(ux.d dVar) {
            super(dVar);
        }

        @Override
        public final Object invokeSuspend(Object obj) {
            this.f67083j = obj;
            this.f67085l |= LinearLayoutManager.INVALID_OFFSET;
            return d.this.K(null, null, this);
        }
    }

    public d(Context context, xt.h syncableDataManager, com.photoroom.util.data.i sharedPreferencesUtil, qt.a templateLocalDataSource, bs.b templateRepository, bs.c userConceptRepository, vt.e updateTermsAndConditionsDetailsUseCase) {
        t.i(context, "context");
        t.i(syncableDataManager, "syncableDataManager");
        t.i(sharedPreferencesUtil, "sharedPreferencesUtil");
        t.i(templateLocalDataSource, "templateLocalDataSource");
        t.i(templateRepository, "templateRepository");
        t.i(userConceptRepository, "userConceptRepository");
        t.i(updateTermsAndConditionsDetailsUseCase, "updateTermsAndConditionsDetailsUseCase");
        this.f66896a = context;
        this.f66897b = syncableDataManager;
        this.f66898c = sharedPreferencesUtil;
        this.f66899d = templateLocalDataSource;
        this.f66900e = templateRepository;
        this.f66901f = userConceptRepository;
        this.f66902g = updateTermsAndConditionsDetailsUseCase;
        y a11 = e10.o0.a(a.C2142d.f66910a);
        this.f66903h = a11;
        this.f66904i = a11;
        mf.l a12 = mf.h.a(context);
        t.h(a12, "getSignInClient(...)");
        this.f66905j = a12;
        this.f66906k = m.a.a();
    }

    public final Object A(b bVar, Activity activity, com.google.firebase.auth.h hVar, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new f(hVar, activity, this, bVar, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public static final void F(hy.l tmp0, Object obj) {
        t.i(tmp0, "$tmp0");
        tmp0.invoke(obj);
    }

    public static final void G(d this$0, b authType, Exception exception) {
        t.i(this$0, "this$0");
        t.i(authType, "$authType");
        t.i(exception, "exception");
        t(this$0, authType, false, exception, 2, null);
    }

    public static Object J(d dVar, Context context, hy.a aVar, ux.d dVar2, int i11, Object obj) {
        if ((i11 & 2) != 0) {
            aVar = l.f67072g;
        }
        return dVar.I(context, aVar, dVar2);
    }

    public final Object r(Activity activity, com.facebook.a aVar, ux.d dVar) {
        Object e11;
        com.google.firebase.auth.h a11 = com.google.firebase.auth.m.a(aVar.n());
        t.h(a11, "getCredential(...)");
        Object y11 = y(b.f66918d, activity, a11, dVar);
        e11 = vx.d.e();
        return y11 == e11 ? y11 : f1.f64673a;
    }

    private final void s(b bVar, boolean z11, Exception exc) {
        Object c2141a;
        w7.e.C0(w7.f.a(), bVar.c(), null, 2, null);
        y yVar = this.f66903h;
        if (z11) {
            c2141a = a.C2142d.f66910a;
        } else {
            t50.a.f72680a.c(exc);
            c2141a = new a.C2141a(exc);
        }
        yVar.setValue(c2141a);
    }

    static void t(d dVar, b bVar, boolean z11, Exception exc, int i11, Object obj) {
        if ((i11 & 2) != 0) {
            z11 = false;
        }
        if ((i11 & 4) != 0) {
            exc = null;
        }
        dVar.s(bVar, z11, exc);
    }

    public final void u(b bVar) {
        h0 a11;
        int i11 = c.f66924a[bVar.ordinal()];
        if (i11 == 1) {
            a11 = u0.a(a.e.f66912c, bt.h.f15074e.c());
        } else if (i11 == 2) {
            a11 = u0.a(a.e.f66913d, bt.h.f15072c.c());
        } else if (i11 == 3) {
            a11 = u0.a(a.e.f66911b, bt.h.f15075f.c());
        } else if (i11 != 4 && i11 != 5) {
            throw new c0();
        } else {
            a11 = u0.a(null, bt.h.f15073d.c());
        }
        a.e eVar = (a.e) a11.a();
        String str = (String) a11.b();
        if (eVar != null) {
            this.f66903h.setValue(new a.c(eVar));
        }
        w7.e.E0(w7.f.a(), bVar.c(), null, null, null, null, null, 62, null);
        User user = User.INSTANCE;
        user.getPreferences().setSignInMethod(str);
        user.updateUserPreferences();
    }

    public final Object v(b bVar, a0 a0Var, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new C2143d(a0Var, bVar, this, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public static final void x(hy.a onSuccess, hy.l onError, Task task) {
        t.i(onSuccess, "$onSuccess");
        t.i(onError, "$onError");
        t.i(task, "task");
        if (task.isSuccessful()) {
            onSuccess.invoke();
        } else {
            onError.invoke(task.getException());
        }
    }

    public final Object y(b bVar, Activity activity, com.google.firebase.auth.h hVar, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new e(hVar, this, bVar, activity, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public final Object B(Activity activity, String str, String str2, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new g(str, str2, this, activity, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public final Object C(Activity activity, String str, String str2, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new h(str, str2, activity, this, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public final Object D(ComponentActivity componentActivity, Fragment fragment, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new i(fragment, componentActivity, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public final void E(Activity activity, hy.l onGoogleOneTapIntentSenderResultRequested) {
        t.i(activity, "activity");
        t.i(onGoogleOneTapIntentSenderResultRequested, "onGoogleOneTapIntentSenderResultRequested");
        final b bVar = b.f66920f;
        u(bVar);
        mf.c a11 = mf.c.f0().f(c.e.f0().b(true).a()).c(c.b.f0().d(true).c(activity.getString(em.l.f42758w4)).b(false).a()).b(true).a();
        t.h(a11, "build(...)");
        Task beginSignIn = this.f66905j.beginSignIn(a11);
        final j jVar = new j(onGoogleOneTapIntentSenderResultRequested);
        beginSignIn.addOnSuccessListener(new OnSuccessListener() {
            @Override
            public final void onSuccess(Object obj) {
                d.F(l.this, obj);
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public final void onFailure(Exception exc) {
                d.G(d.this, bVar, exc);
            }
        });
    }

    public final Object H(b bVar, Activity activity, String str, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new k(str, activity, this, bVar, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public final Object I(Context context, hy.a aVar, ux.d dVar) {
        Object e11;
        Object f11 = p0.f(new m(context, this, aVar, null), dVar);
        e11 = vx.d.e();
        return f11 == e11 ? f11 : f1.f64673a;
    }

    public final Object K(Activity activity, Intent intent, ux.d dVar) {
        n nVar;
        Object e11;
        int i11;
        d dVar2;
        com.google.android.gms.common.api.b e12;
        b bVar;
        if (dVar instanceof n) {
            nVar = (n) dVar;
            int i12 = nVar.f67085l;
            if ((i12 & LinearLayoutManager.INVALID_OFFSET) != 0) {
                nVar.f67085l = i12 - LinearLayoutManager.INVALID_OFFSET;
                Object obj = nVar.f67083j;
                e11 = vx.d.e();
                i11 = nVar.f67085l;
                if (i11 != 0) {
                    n0.b(obj);
                    b bVar2 = b.f66920f;
                    try {
                        mf.m signInCredentialFromIntent = this.f66905j.getSignInCredentialFromIntent(intent);
                        t.h(signInCredentialFromIntent, "getSignInCredentialFromIntent(...)");
                        com.google.firebase.auth.h a11 = f0.a(signInCredentialFromIntent.r0(), null);
                        t.h(a11, "getCredential(...)");
                        nVar.f67081h = this;
                        nVar.f67082i = bVar2;
                        nVar.f67085l = 1;
                        if (y(bVar2, activity, a11, nVar) == e11) {
                            return e11;
                        }
                    } catch (com.google.android.gms.common.api.b e13) {
                        dVar2 = this;
                        e12 = e13;
                        bVar = bVar2;
                        dVar2.s(bVar, e12.getStatus().isCanceled(), e12);
                        return f1.f64673a;
                    }
                } else if (i11 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                } else {
                    bVar = (b) nVar.f67082i;
                    dVar2 = (d) nVar.f67081h;
                    try {
                        n0.b(obj);
                    } catch (com.google.android.gms.common.api.b e14) {
                        e12 = e14;
                        dVar2.s(bVar, e12.getStatus().isCanceled(), e12);
                        return f1.f64673a;
                    }
                }
                return f1.f64673a;
            }
        }
        nVar = new n(dVar);
        Object obj2 = nVar.f67083j;
        e11 = vx.d.e();
        i11 = nVar.f67085l;
        if (i11 != 0) {
        }
        return f1.f64673a;
    }

    public final e10.m0 q() {
        return this.f66904i;
    }

    public final void w(String email, final hy.l onError, final hy.a onSuccess) {
        t.i(email, "email");
        t.i(onError, "onError");
        t.i(onSuccess, "onSuccess");
        u(b.f66916b);
        com.google.firebase.auth.e a11 = com.google.firebase.auth.e.u0().e("https://background-7ef44.firebaseapp.com").c(true).d("com.photoroom.app").b(this.f66896a.getPackageName(), true, "53").a();
        t.h(a11, "build(...)");
        cj.a.a(fk.a.f44679a).j(email, a11).addOnCompleteListener(new OnCompleteListener() {
            @Override
            public final void onComplete(Task task) {
                d.x(hy.a.this, onError, task);
            }
        });
    }

    public final Object z(Activity activity, String str, ux.d dVar) {
        Object e11;
        b bVar = b.f66919e;
        u(bVar);
        com.google.firebase.auth.h a11 = com.google.firebase.auth.m0.a("apple.com").b(str).a();
        t.h(a11, "build(...)");
        Object y11 = y(bVar, activity, a11, dVar);
        e11 = vx.d.e();
        return y11 == e11 ? y11 : f1.f64673a;
    }
}