package com.google.android.gms.auth.api.signin;

import X.AnonymousClass94H;
import X.C36088vf;
import X.C407797s;
import X.C407997u;
import X.C408097v;
import X.C412899r;
import android.accounts.Account;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.google.android.gms.auth.api.signin.internal.GoogleSignInOptionsExtensionParcelable;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.internal.ReflectedParcelable;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class GoogleSignInOptions extends AbstractSafeParcelable implements C412899r, ReflectedParcelable {
    public static final Parcelable.Creator<GoogleSignInOptions> CREATOR = new AnonymousClass94H();
    public static final Scope LIZ = new Scope("profile");
    public static final Scope LIZIZ = new Scope("email");
    public static final Scope LIZJ = new Scope("openid");
    public static final Scope LIZLLL;
    public static final Scope LJ = new Scope("https://www.googleapis.com/auth/games");
    public static final GoogleSignInOptions LJFF;
    public static final GoogleSignInOptions LJI;
    public static Comparator<Scope> LJIJ = new C407997u();
    public final ArrayList<Scope> LJII;
    public Account LJIIIIZZ;
    public boolean LJIIIZ;
    public final boolean LJIIJ;
    public final boolean LJIIJJI;
    public String LJIIL;
    public String LJIILIIL;
    public ArrayList<GoogleSignInOptionsExtensionParcelable> LJIILJJIL;
    public String LJIILL;
    public final int LJIILLIIL;
    public Map<Integer, GoogleSignInOptionsExtensionParcelable> LJIIZILJ;

    public final ArrayList<Scope> LIZ() {
        return new ArrayList<>(this.LJII);
    }

    static {
        Covode.recordClassIndex(42504);
        Scope scope = new Scope("https://www.googleapis.com/auth/games_lite");
        LIZLLL = scope;
        C407797s r0 = new C407797s();
        r0.LIZ();
        r0.LIZIZ();
        LJFF = r0.LIZJ();
        C407797s r1 = new C407797s();
        r1.LIZ(scope, new Scope[0]);
        LJI = r1.LIZJ();
    }

    public final JSONObject LIZIZ() {
        JSONObject jSONObject = new JSONObject();
        try {
            JSONArray jSONArray = new JSONArray();
            Collections.sort(this.LJII, LJIJ);
            ArrayList<Scope> arrayList = this.LJII;
            int size = arrayList.size();
            int i = 0;
            while (i < size) {
                Scope scope = arrayList.get(i);
                i++;
                jSONArray.put(scope.LIZ);
            }
            jSONObject.put("scopes", jSONArray);
            Account account = this.LJIIIIZZ;
            if (account != null) {
                jSONObject.put("accountName", account.name);
            }
            jSONObject.put("idTokenRequested", this.LJIIIZ);
            jSONObject.put("forceCodeForRefreshToken", this.LJIIJJI);
            jSONObject.put("serverAuthRequested", this.LJIIJ);
            if (!TextUtils.isEmpty(this.LJIIL)) {
                jSONObject.put("serverClientId", this.LJIIL);
            }
            if (!TextUtils.isEmpty(this.LJIILIIL)) {
                jSONObject.put("hostedDomain", this.LJIILIIL);
            }
            return jSONObject;
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
    }

    public int hashCode() {
        ArrayList arrayList = new ArrayList();
        ArrayList<Scope> arrayList2 = this.LJII;
        int size = arrayList2.size();
        int i = 0;
        while (i < size) {
            Scope scope = arrayList2.get(i);
            i++;
            arrayList.add(scope.LIZ);
        }
        Collections.sort(arrayList);
        C408097v r1 = new C408097v();
        r1.LIZ((Object) arrayList);
        r1.LIZ((Object) this.LJIIIIZZ);
        r1.LIZ((Object) this.LJIIL);
        r1.LIZ(this.LJIIJJI);
        r1.LIZ(this.LJIIIZ);
        r1.LIZ(this.LJIIJ);
        r1.LIZ((Object) this.LJIILL);
        return r1.LIZ;
    }

    public static Map<Integer, GoogleSignInOptionsExtensionParcelable> LIZIZ(List<GoogleSignInOptionsExtensionParcelable> list) {
        HashMap hashMap = new HashMap();
        if (list == null) {
            return hashMap;
        }
        for (GoogleSignInOptionsExtensionParcelable next : list) {
            hashMap.put(Integer.valueOf(next.LIZ), next);
        }
        return hashMap;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:17:0x003a, code lost:
        if (r4.LJIIIIZZ == null) goto L_0x003c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:21:0x004a, code lost:
        if (android.text.TextUtils.isEmpty(r4.LJIIL) != false) goto L_0x004c;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public boolean equals(java.lang.Object r4) {
        /*
            r3 = this;
            r2 = 0
            if (r4 != 0) goto L_0x0004
            return r2
        L_0x0004:
            com.google.android.gms.auth.api.signin.GoogleSignInOptions r4 = (com.google.android.gms.auth.api.signin.GoogleSignInOptions) r4     // Catch:{ ClassCastException -> 0x007f }
            java.util.ArrayList<com.google.android.gms.auth.api.signin.internal.GoogleSignInOptionsExtensionParcelable> r0 = r3.LJIILJJIL     // Catch:{ ClassCastException -> 0x007f }
            int r0 = r0.size()     // Catch:{ ClassCastException -> 0x007f }
            if (r0 > 0) goto L_0x007f
            java.util.ArrayList<com.google.android.gms.auth.api.signin.internal.GoogleSignInOptionsExtensionParcelable> r0 = r4.LJIILJJIL     // Catch:{ ClassCastException -> 0x007f }
            int r0 = r0.size()     // Catch:{ ClassCastException -> 0x007f }
            if (r0 <= 0) goto L_0x0017
            goto L_0x007f
        L_0x0017:
            java.util.ArrayList<com.google.android.gms.common.api.Scope> r0 = r3.LJII     // Catch:{ ClassCastException -> 0x007f }
            int r1 = r0.size()     // Catch:{ ClassCastException -> 0x007f }
            java.util.ArrayList r0 = r4.LIZ()     // Catch:{ ClassCastException -> 0x007f }
            int r0 = r0.size()     // Catch:{ ClassCastException -> 0x007f }
            if (r1 != r0) goto L_0x007f
            java.util.ArrayList<com.google.android.gms.common.api.Scope> r1 = r3.LJII     // Catch:{ ClassCastException -> 0x007f }
            java.util.ArrayList r0 = r4.LIZ()     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = r1.containsAll(r0)     // Catch:{ ClassCastException -> 0x007f }
            if (r0 != 0) goto L_0x0034
            goto L_0x007f
        L_0x0034:
            android.accounts.Account r1 = r3.LJIIIIZZ     // Catch:{ ClassCastException -> 0x007f }
            if (r1 != 0) goto L_0x0072
            android.accounts.Account r0 = r4.LJIIIIZZ     // Catch:{ ClassCastException -> 0x007f }
            if (r0 != 0) goto L_0x007f
        L_0x003c:
            java.lang.String r0 = r3.LJIIL     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = android.text.TextUtils.isEmpty(r0)     // Catch:{ ClassCastException -> 0x007f }
            if (r0 == 0) goto L_0x0067
            java.lang.String r0 = r4.LJIIL     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = android.text.TextUtils.isEmpty(r0)     // Catch:{ ClassCastException -> 0x007f }
            if (r0 == 0) goto L_0x007f
        L_0x004c:
            boolean r1 = r3.LJIIJJI     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = r4.LJIIJJI     // Catch:{ ClassCastException -> 0x007f }
            if (r1 != r0) goto L_0x007f
            boolean r1 = r3.LJIIIZ     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = r4.LJIIIZ     // Catch:{ ClassCastException -> 0x007f }
            if (r1 != r0) goto L_0x007f
            boolean r1 = r3.LJIIJ     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = r4.LJIIJ     // Catch:{ ClassCastException -> 0x007f }
            if (r1 != r0) goto L_0x007f
            java.lang.String r1 = r3.LJIILL     // Catch:{ ClassCastException -> 0x007f }
            java.lang.String r0 = r4.LJIILL     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = android.text.TextUtils.equals(r1, r0)     // Catch:{ ClassCastException -> 0x007f }
            goto L_0x007b
        L_0x0067:
            java.lang.String r1 = r3.LJIIL     // Catch:{ ClassCastException -> 0x007f }
            java.lang.String r0 = r4.LJIIL     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = r1.equals(r0)     // Catch:{ ClassCastException -> 0x007f }
            if (r0 == 0) goto L_0x007f
            goto L_0x004c
        L_0x0072:
            android.accounts.Account r0 = r4.LJIIIIZZ     // Catch:{ ClassCastException -> 0x007f }
            boolean r0 = r1.equals(r0)     // Catch:{ ClassCastException -> 0x007f }
            if (r0 == 0) goto L_0x007f
            goto L_0x003c
        L_0x007b:
            if (r0 == 0) goto L_0x007f
            r0 = 1
            return r0
        L_0x007f:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.auth.api.signin.GoogleSignInOptions.equals(java.lang.Object):boolean");
    }

    public void writeToParcel(Parcel parcel, int i) {
        int LIZ2 = C36088vf.LIZ(parcel, 20293);
        C36088vf.LIZIZ(parcel, 1, this.LJIILLIIL);
        C36088vf.LIZIZ(parcel, 2, LIZ());
        C36088vf.LIZ(parcel, 3, (Parcelable) this.LJIIIIZZ, i);
        C36088vf.LIZ(parcel, 4, this.LJIIIZ);
        C36088vf.LIZ(parcel, 5, this.LJIIJ);
        C36088vf.LIZ(parcel, 6, this.LJIIJJI);
        C36088vf.LIZ(parcel, 7, this.LJIIL);
        C36088vf.LIZ(parcel, 8, this.LJIILIIL);
        C36088vf.LIZIZ(parcel, 9, this.LJIILJJIL);
        C36088vf.LIZ(parcel, 10, this.LJIILL);
        C36088vf.LIZIZ(parcel, LIZ2);
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public /* synthetic */ GoogleSignInOptions(java.util.ArrayList r12, android.accounts.Account r13, boolean r14, boolean r15, boolean r16, java.lang.String r17, java.lang.String r18, java.util.Map r19, java.lang.String r20) {
        /*
            r11 = this;
            r1 = 3
            r0 = r11
            r7 = r17
            r6 = r16
            r5 = r15
            r9 = r19
            r2 = r12
            r10 = r20
            r3 = r13
            r8 = r18
            r4 = r14
            r0.<init>((int) r1, (java.util.ArrayList<com.google.android.gms.common.api.Scope>) r2, (android.accounts.Account) r3, (boolean) r4, (boolean) r5, (boolean) r6, (java.lang.String) r7, (java.lang.String) r8, (java.util.Map<java.lang.Integer, com.google.android.gms.auth.api.signin.internal.GoogleSignInOptionsExtensionParcelable>) r9, (java.lang.String) r10)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.auth.api.signin.GoogleSignInOptions.<init>(java.util.ArrayList, android.accounts.Account, boolean, boolean, boolean, java.lang.String, java.lang.String, java.util.Map, java.lang.String):void");
    }

    /* JADX WARNING: Illegal instructions before constructor call */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public GoogleSignInOptions(int r12, java.util.ArrayList<com.google.android.gms.common.api.Scope> r13, android.accounts.Account r14, boolean r15, boolean r16, boolean r17, java.lang.String r18, java.lang.String r19, java.util.ArrayList<com.google.android.gms.auth.api.signin.internal.GoogleSignInOptionsExtensionParcelable> r20, java.lang.String r21) {
        /*
            r11 = this;
            java.util.Map r9 = LIZIZ(r20)
            r0 = r11
            r6 = r17
            r5 = r16
            r4 = r15
            r8 = r19
            r1 = r12
            r10 = r21
            r3 = r14
            r7 = r18
            r2 = r13
            r0.<init>((int) r1, (java.util.ArrayList<com.google.android.gms.common.api.Scope>) r2, (android.accounts.Account) r3, (boolean) r4, (boolean) r5, (boolean) r6, (java.lang.String) r7, (java.lang.String) r8, (java.util.Map<java.lang.Integer, com.google.android.gms.auth.api.signin.internal.GoogleSignInOptionsExtensionParcelable>) r9, (java.lang.String) r10)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.auth.api.signin.GoogleSignInOptions.<init>(int, java.util.ArrayList, android.accounts.Account, boolean, boolean, boolean, java.lang.String, java.lang.String, java.util.ArrayList, java.lang.String):void");
    }

    public GoogleSignInOptions(int i, ArrayList<Scope> arrayList, Account account, boolean z, boolean z2, boolean z3, String str, String str2, Map<Integer, GoogleSignInOptionsExtensionParcelable> map, String str3) {
        this.LJIILLIIL = i;
        this.LJII = arrayList;
        this.LJIIIIZZ = account;
        this.LJIIIZ = z;
        this.LJIIJ = z2;
        this.LJIIJJI = z3;
        this.LJIIL = str;
        this.LJIILIIL = str2;
        this.LJIILJJIL = new ArrayList<>(map.values());
        this.LJIIZILJ = map;
        this.LJIILL = str3;
    }
}
