Live Football Updates v1.0.1版本的 MD5 值为:636649089335ebb37514551724606ad0

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


package pa;

import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import com.google.android.gms.common.util.VisibleForTesting;
import com.google.android.gms.internal.measurement.sb;
import com.google.android.gms.internal.measurement.tb;
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
public final class g7 extends o4 {
    public static final String[] f28759h = {"firebase_", "google_", "ga_"};
    public static final String[] i = {"_err"};
    public SecureRandom f28760d;
    public final AtomicLong f28761e;
    public int f28762f;
    public Integer f28763g;

    public g7(b4 b4Var) {
        super(b4Var);
        this.f28763g = null;
        this.f28761e = new AtomicLong(0L);
    }

    public static void A(f7 f7Var, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        d0(i10, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i10 == 6 || i10 == 7 || i10 == 2) {
            bundle.putLong("_el", i11);
        }
        f7Var.a(str, bundle);
    }

    public static boolean U(Object obj) {
        return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle);
    }

    public static boolean X(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("_");
    }

    public static boolean Y(String str) {
        x9.l.f(str);
        if (str.charAt(0) == '_' && !str.equals("_ep")) {
            return false;
        }
        return true;
    }

    public static boolean Z(Context context) {
        ActivityInfo receiverInfo;
        x9.l.j(context);
        try {
            PackageManager packageManager = context.getPackageManager();
            if (packageManager != null && (receiverInfo = packageManager.getReceiverInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementReceiver"), 0)) != null) {
                if (receiverInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused) {
        }
        return false;
    }

    public static boolean a0(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        x9.l.j(context);
        if (Build.VERSION.SDK_INT >= 24) {
            try {
                PackageManager packageManager = context.getPackageManager();
                if (packageManager != null && (serviceInfo2 = packageManager.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementJobService"), 0)) != null) {
                    if (serviceInfo2.enabled) {
                        return true;
                    }
                }
            } catch (PackageManager.NameNotFoundException unused) {
            }
            return false;
        }
        try {
            PackageManager packageManager2 = context.getPackageManager();
            if (packageManager2 != null && (serviceInfo = packageManager2.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementService"), 0)) != null) {
                if (serviceInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused2) {
        }
        return false;
    }

    public static boolean b0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            x9.l.j(str);
            if (!str.equals(str2)) {
                return true;
            }
            return false;
        } else if (isEmpty && isEmpty2) {
            if (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
                if (!str3.equals(str4)) {
                    return true;
                }
                return false;
            } else if (!TextUtils.isEmpty(str4)) {
                return true;
            } else {
                return false;
            }
        } else if (!isEmpty) {
            if (TextUtils.isEmpty(str4)) {
                return false;
            }
            if (TextUtils.isEmpty(str3) || !str3.equals(str4)) {
                return true;
            }
            return false;
        } else if (TextUtils.isEmpty(str3) || !str3.equals(str4)) {
            return true;
        } else {
            return false;
        }
    }

    public static byte[] c0(Parcelable parcelable) {
        if (parcelable == null) {
            return null;
        }
        Parcel obtain = Parcel.obtain();
        try {
            parcelable.writeToParcel(obtain, 0);
            return obtain.marshall();
        } finally {
            obtain.recycle();
        }
    }

    public static final boolean d0(int i10, Bundle bundle) {
        if (bundle == null || bundle.getLong("_err") != 0) {
            return false;
        }
        bundle.putLong("_err", i10);
        return true;
    }

    public static boolean g0(String str, String[] strArr) {
        boolean z10;
        x9.l.j(strArr);
        for (String str2 : strArr) {
            if (str != str2 && (str == null || !str.equals(str2))) {
                z10 = false;
            } else {
                z10 = true;
            }
            if (z10) {
                return true;
            }
        }
        return false;
    }

    public static String n(int i10, String str, boolean z10) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) > i10) {
            if (!z10) {
                return null;
            }
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i10))).concat("...");
        }
        return str;
    }

    @VisibleForTesting
    public static long n0(byte[] bArr) {
        boolean z10;
        x9.l.j(bArr);
        int length = bArr.length;
        int i10 = 0;
        if (length > 0) {
            z10 = true;
        } else {
            z10 = false;
        }
        x9.l.m(z10);
        long j4 = 0;
        for (int i11 = length - 1; i11 >= 0 && i11 >= bArr.length - 8; i11--) {
            j4 += (bArr[i11] & 255) << i10;
            i10 += 8;
        }
        return j4;
    }

    public static MessageDigest o() {
        MessageDigest messageDigest;
        for (int i10 = 0; i10 < 2; i10++) {
            try {
                messageDigest = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException unused) {
            }
            if (messageDigest != null) {
                return messageDigest;
            }
        }
        return null;
    }

    public static ArrayList r(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            c cVar = (c) it.next();
            Bundle bundle = new Bundle();
            bundle.putString("app_id", cVar.f28639a);
            bundle.putString(com.ironsource.j4.f18719o, cVar.f28640b);
            bundle.putLong("creation_timestamp", cVar.f28642d);
            bundle.putString(com.ironsource.q2.f19990p, cVar.f28641c.f28674b);
            Object m10 = cVar.f28641c.m();
            x9.l.j(m10);
            a4.n0.m(bundle, m10);
            bundle.putBoolean("active", cVar.f28643e);
            String str = cVar.f28644f;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            t tVar = cVar.f28645g;
            if (tVar != null) {
                bundle.putString("timed_out_event_name", tVar.f29145a);
                r rVar = tVar.f29146b;
                if (rVar != null) {
                    bundle.putBundle("timed_out_event_params", rVar.m());
                }
            }
            bundle.putLong("trigger_timeout", cVar.f28646h);
            t tVar2 = cVar.i;
            if (tVar2 != null) {
                bundle.putString("triggered_event_name", tVar2.f29145a);
                r rVar2 = tVar2.f29146b;
                if (rVar2 != null) {
                    bundle.putBundle("triggered_event_params", rVar2.m());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.f28641c.f28675c);
            bundle.putLong("time_to_live", cVar.f28647j);
            t tVar3 = cVar.f28648k;
            if (tVar3 != null) {
                bundle.putString("expired_event_name", tVar3.f29145a);
                r rVar3 = tVar3.f29146b;
                if (rVar3 != null) {
                    bundle.putBundle("expired_event_params", rVar3.m());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void w(p5 p5Var, Bundle bundle, boolean z10) {
        if (bundle != null && p5Var != null) {
            if (bundle.containsKey("_sc") && !z10) {
                z10 = false;
            } else {
                String str = p5Var.f29045a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = p5Var.f29046b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", p5Var.f29047c);
                return;
            }
        }
        if (bundle != null && p5Var == null && z10) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public final void B(Bundle bundle, String str, Object obj) {
        String str2;
        if (bundle == null) {
            return;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
        } else if (obj instanceof String) {
            bundle.putString(str, String.valueOf(obj));
        } else if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
        } else if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
        } else if (str != null) {
            if (obj != null) {
                str2 = obj.getClass().getSimpleName();
            } else {
                str2 = null;
            }
            Object obj2 = this.f27031b;
            y2 y2Var = ((b4) obj2).i;
            b4.g(y2Var);
            y2Var.f29246l.c(((b4) obj2).f28619m.e(str), str2, "Not putting event parameter. Invalid value type. name, type");
        }
    }

    public final void C(com.google.android.gms.internal.measurement.y0 y0Var, boolean z10) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z10);
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void D(com.google.android.gms.internal.measurement.y0 y0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning bundle list to wrapper");
        }
    }

    public final void E(com.google.android.gms.internal.measurement.y0 y0Var, Bundle bundle) {
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void F(com.google.android.gms.internal.measurement.y0 y0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning byte array to wrapper");
        }
    }

    public final void G(com.google.android.gms.internal.measurement.y0 y0Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning int value to wrapper");
        }
    }

    public final void H(com.google.android.gms.internal.measurement.y0 y0Var, long j4) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j4);
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning long value to wrapper");
        }
    }

    public final void I(String str, com.google.android.gms.internal.measurement.y0 y0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            y0Var.u0(bundle);
        } catch (RemoteException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Error returning string value to wrapper");
        }
    }

    public final void J(String str, String str2, Bundle bundle, List list, boolean z10) {
        int i10;
        Iterator it;
        int i11;
        String str3;
        int i12;
        int M;
        String str4;
        String str5;
        if (bundle == null) {
            return;
        }
        b4 b4Var = (b4) this.f27031b;
        f fVar = b4Var.f28614g;
        ((tb) sb.f16611b.f16612a.zza()).zza();
        String str6 = null;
        if (((b4) fVar.f27031b).f28614g.p(null, m2.f28946t0)) {
            g7 g7Var = ((b4) fVar.f27031b).f28618l;
            b4.e(g7Var);
            if (g7Var.W(231100000)) {
                i10 = 35;
                it = new TreeSet(bundle.keySet()).iterator();
                int i13 = 0;
                while (it.hasNext()) {
                    String str7 = (String) it.next();
                    if (list != null && list.contains(str7)) {
                        i11 = 0;
                    } else {
                        if (!z10) {
                            i11 = k0(str7);
                        } else {
                            i11 = 0;
                        }
                        if (i11 == 0) {
                            i11 = j0(str7);
                        }
                    }
                    if (i11 != 0) {
                        if (i11 == 3) {
                            str5 = str7;
                        } else {
                            str5 = str6;
                        }
                        v(bundle, i11, str7, str5);
                        bundle.remove(str7);
                        str4 = str6;
                        i12 = i10;
                    } else {
                        if (U(bundle.get(str7))) {
                            y2 y2Var = b4Var.i;
                            b4.g(y2Var);
                            y2Var.f29246l.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str7);
                            M = 22;
                            str3 = str7;
                            i12 = i10;
                        } else {
                            str3 = str7;
                            i12 = i10;
                            M = M(str, str7, bundle.get(str7), bundle, list, z10, false);
                        }
                        if (M != 0 && !"_ev".equals(str3)) {
                            v(bundle, M, str3, bundle.get(str3));
                            bundle.remove(str3);
                        } else if (Y(str3) && !g0(str3, com.google.common.collect.m.f17641j)) {
                            int i14 = i13 + 1;
                            if (!W(231100000)) {
                                y2 y2Var2 = b4Var.i;
                                b4.g(y2Var2);
                                y2Var2.i.c(b4Var.f28619m.d(str), b4Var.f28619m.b(bundle), "Item array not supported on client's version of Google Play Services (Android Only)");
                                d0(23, bundle);
                                bundle.remove(str3);
                            } else if (i14 > i12) {
                                ((tb) sb.f16611b.f16612a.zza()).zza();
                                str4 = null;
                                if (b4Var.f28614g.p(null, m2.f28946t0)) {
                                    y2 y2Var3 = b4Var.i;
                                    b4.g(y2Var3);
                                    y2Var3.i.c(b4Var.f28619m.d(str), b4Var.f28619m.b(bundle), "Item can't contain more than " + i12 + " item-scoped custom params");
                                    d0(28, bundle);
                                    bundle.remove(str3);
                                } else {
                                    y2 y2Var4 = b4Var.i;
                                    b4.g(y2Var4);
                                    y2Var4.i.c(b4Var.f28619m.d(str), b4Var.f28619m.b(bundle), "Item cannot contain custom parameters");
                                    d0(23, bundle);
                                    bundle.remove(str3);
                                }
                                i13 = i14;
                            }
                            str4 = null;
                            i13 = i14;
                        }
                        str4 = null;
                    }
                    i10 = i12;
                    str6 = str4;
                }
            }
        }
        i10 = 0;
        it = new TreeSet(bundle.keySet()).iterator();
        int i132 = 0;
        while (it.hasNext()) {
        }
    }

    public final boolean K(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        Object obj = this.f27031b;
        if (!isEmpty) {
            x9.l.j(str);
            if (!str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                b4 b4Var = (b4) obj;
                if (TextUtils.isEmpty(b4Var.f28609b)) {
                    y2 y2Var = b4Var.i;
                    b4.g(y2Var);
                    y2Var.i.b(y2.p(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
                }
                return false;
            }
            return true;
        } else if (!TextUtils.isEmpty(str2)) {
            x9.l.j(str2);
            if (!str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                y2 y2Var2 = ((b4) obj).i;
                b4.g(y2Var2);
                y2Var2.i.b(y2.p(str2), "Invalid admob_app_id. Analytics disabled.");
                return false;
            }
            return true;
        } else {
            b4 b4Var2 = (b4) obj;
            if (TextUtils.isEmpty(b4Var2.f28609b)) {
                y2 y2Var3 = b4Var2.i;
                b4.g(y2Var3);
                y2Var3.i.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
    }

    public final boolean L(int i10, String str, String str2) {
        Object obj = this.f27031b;
        if (str2 == null) {
            y2 y2Var = ((b4) obj).i;
            b4.g(y2Var);
            y2Var.i.b(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.codePointCount(0, str2.length()) > i10) {
            y2 y2Var2 = ((b4) obj).i;
            b4.g(y2Var2);
            y2Var2.i.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
            return false;
        } else {
            return true;
        }
    }

    public final int M(String str, String str2, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
        int i10;
        int i11;
        Object obj2;
        Parcelable[] parcelableArr;
        int size;
        c();
        boolean U = U(obj);
        Object obj3 = this.f27031b;
        if (U) {
            if (z11) {
                if (!g0(str2, com.google.common.collect.m.i)) {
                    return 20;
                }
                b4 b4Var = (b4) obj3;
                f6 r10 = b4Var.r();
                r10.c();
                r10.e();
                if (r10.o()) {
                    g7 g7Var = ((b4) r10.f27031b).f28618l;
                    b4.e(g7Var);
                    if (g7Var.m0() < 200900) {
                        return 25;
                    }
                }
                b4Var.getClass();
                boolean z12 = obj instanceof Parcelable[];
                if (z12) {
                    size = ((Parcelable[]) obj).length;
                } else if (obj instanceof ArrayList) {
                    size = ((ArrayList) obj).size();
                }
                if (size > 200) {
                    y2 y2Var = b4Var.i;
                    b4.g(y2Var);
                    y2Var.f29246l.d("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
                    b4Var.getClass();
                    if (z12) {
                        Parcelable[] parcelableArr2 = (Parcelable[]) obj;
                        if (parcelableArr2.length > 200) {
                            bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr2, 200));
                        }
                    } else if (obj instanceof ArrayList) {
                        ArrayList arrayList = (ArrayList) obj;
                        if (arrayList.size() > 200) {
                            bundle.putParcelableArrayList(str2, new ArrayList<>(arrayList.subList(0, 200)));
                        }
                    }
                    i10 = 17;
                    if (X(str) && !X(str2)) {
                        ((b4) obj3).getClass();
                        i11 = 100;
                    } else {
                        ((b4) obj3).getClass();
                        i11 = 256;
                    }
                    if (!P("param", str2, i11, obj)) {
                        return i10;
                    }
                    if (z11) {
                        if (obj instanceof Bundle) {
                            J(str, str2, (Bundle) obj, list, z10);
                        } else if (obj instanceof Parcelable[]) {
                            for (Parcelable parcelable : (Parcelable[]) obj) {
                                if (!(parcelable instanceof Bundle)) {
                                    y2 y2Var2 = ((b4) obj3).i;
                                    b4.g(y2Var2);
                                    y2Var2.f29246l.c(parcelable.getClass(), str2, "All Parcelable[] elements must be of type Bundle. Value type, name");
                                    return 4;
                                }
                                J(str, str2, (Bundle) parcelable, list, z10);
                            }
                        } else if (obj instanceof ArrayList) {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            for (int i12 = 0; i12 < size2; i12++) {
                                Object obj4 = arrayList2.get(i12);
                                if (!(obj4 instanceof Bundle)) {
                                    y2 y2Var3 = ((b4) obj3).i;
                                    b4.g(y2Var3);
                                    if (obj4 != null) {
                                        obj2 = obj4.getClass();
                                    } else {
                                        obj2 = "null";
                                    }
                                    y2Var3.f29246l.c(obj2, str2, "All ArrayList elements must be of type Bundle. Value type, name");
                                    return 4;
                                }
                                J(str, str2, (Bundle) obj4, list, z10);
                            }
                        } else {
                            return 4;
                        }
                        return i10;
                    }
                    return 4;
                }
            } else {
                return 21;
            }
        }
        i10 = 0;
        if (X(str)) {
        }
        ((b4) obj3).getClass();
        i11 = 256;
        if (!P("param", str2, i11, obj)) {
        }
    }

    public final void N() {
        c();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                y2 y2Var = ((b4) this.f27031b).i;
                b4.g(y2Var);
                y2Var.f29244j.a("Utils falling back to Random for random id");
            }
        }
        this.f28761e.set(nextLong);
    }

    public final boolean O(String str, String[] strArr, String[] strArr2, String str2) {
        Object obj = this.f27031b;
        if (str2 == null) {
            y2 y2Var = ((b4) obj).i;
            b4.g(y2Var);
            y2Var.i.b(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f28759h;
        for (int i10 = 0; i10 < 3; i10++) {
            if (str2.startsWith(strArr3[i10])) {
                y2 y2Var2 = ((b4) obj).i;
                b4.g(y2Var2);
                y2Var2.i.c(str, str2, "Name starts with reserved prefix. Type, name");
                return false;
            }
        }
        if (strArr != null && g0(str2, strArr)) {
            if (strArr2 == null || !g0(str2, strArr2)) {
                y2 y2Var3 = ((b4) obj).i;
                b4.g(y2Var3);
                y2Var3.i.c(str, str2, "Name is reserved. Type, name");
                return false;
            }
            return true;
        }
        return true;
    }

    public final boolean P(String str, String str2, int i10, Object obj) {
        if (obj != null && !(obj instanceof Long) && !(obj instanceof Float) && !(obj instanceof Integer) && !(obj instanceof Byte) && !(obj instanceof Short) && !(obj instanceof Boolean) && !(obj instanceof Double)) {
            if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                return false;
            }
            String obj2 = obj.toString();
            if (obj2.codePointCount(0, obj2.length()) > i10) {
                y2 y2Var = ((b4) this.f27031b).i;
                b4.g(y2Var);
                y2Var.f29246l.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean Q(String str, String str2) {
        Object obj = this.f27031b;
        if (str2 == null) {
            y2 y2Var = ((b4) obj).i;
            b4.g(y2Var);
            y2Var.i.b(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.length() == 0) {
            y2 y2Var2 = ((b4) obj).i;
            b4.g(y2Var2);
            y2Var2.i.b(str, "Name is required and can't be empty. Type");
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                if (codePointAt == 95) {
                    codePointAt = 95;
                } else {
                    y2 y2Var3 = ((b4) obj).i;
                    b4.g(y2Var3);
                    y2Var3.i.c(str, str2, "Name must start with a letter or _ (underscore). Type, name");
                    return false;
                }
            }
            int length = str2.length();
            int charCount = Character.charCount(codePointAt);
            while (charCount < length) {
                int codePointAt2 = str2.codePointAt(charCount);
                if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                    y2 y2Var4 = ((b4) obj).i;
                    b4.g(y2Var4);
                    y2Var4.i.c(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean R(String str, String str2) {
        Object obj = this.f27031b;
        if (str2 == null) {
            y2 y2Var = ((b4) obj).i;
            b4.g(y2Var);
            y2Var.i.b(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.length() == 0) {
            y2 y2Var2 = ((b4) obj).i;
            b4.g(y2Var2);
            y2Var2.i.b(str, "Name is required and can't be empty. Type");
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                y2 y2Var3 = ((b4) obj).i;
                b4.g(y2Var3);
                y2Var3.i.c(str, str2, "Name must start with a letter. Type, name");
                return false;
            }
            int length = str2.length();
            int charCount = Character.charCount(codePointAt);
            while (charCount < length) {
                int codePointAt2 = str2.codePointAt(charCount);
                if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                    y2 y2Var4 = ((b4) obj).i;
                    b4.g(y2Var4);
                    y2Var4.i.c(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean S(String str) {
        c();
        b4 b4Var = (b4) this.f27031b;
        if (da.c.a(b4Var.f28608a).f21656a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        y2 y2Var = b4Var.i;
        b4.g(y2Var);
        y2Var.f29248n.b(str, "Permission not granted");
        return false;
    }

    public final boolean T(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        b4 b4Var = (b4) this.f27031b;
        String e10 = b4Var.f28614g.e("debug.firebase.analytics.app");
        b4Var.getClass();
        return e10.equals(str);
    }

    @VisibleForTesting
    public final boolean V(Context context, String str) {
        Signature[] signatureArr;
        Object obj = this.f27031b;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo c10 = da.c.a(context).c(64, str);
            if (c10 != null && (signatureArr = c10.signatures) != null && signatureArr.length > 0) {
                return ((X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(signatureArr[0].toByteArray()))).getSubjectX500Principal().equals(x500Principal);
            }
            return true;
        } catch (PackageManager.NameNotFoundException e10) {
            y2 y2Var = ((b4) obj).i;
            b4.g(y2Var);
            y2Var.f29242g.b(e10, "Package name not found");
            return true;
        } catch (CertificateException e11) {
            y2 y2Var2 = ((b4) obj).i;
            b4.g(y2Var2);
            y2Var2.f29242g.b(e11, "Error obtaining certificate");
            return true;
        }
    }

    public final boolean W(int i10) {
        Boolean bool = ((b4) this.f27031b).r().f28730f;
        if (m0() < i10 / 1000 && (bool == null || bool.booleanValue())) {
            return false;
        }
        return true;
    }

    @Override
    public final boolean e() {
        return true;
    }

    public final int e0(String str) {
        boolean equals = "_ldl".equals(str);
        Object obj = this.f27031b;
        if (equals) {
            ((b4) obj).getClass();
            return com.ironsource.mediationsdk.metadata.a.f19349m;
        } else if ("_id".equals(str)) {
            ((b4) obj).getClass();
            return 256;
        } else if ("_lgclid".equals(str)) {
            ((b4) obj).getClass();
            return 100;
        } else {
            ((b4) obj).getClass();
            return 36;
        }
    }

    public final Object f0(int i10, Object obj, boolean z10, boolean z11) {
        Parcelable[] parcelableArr;
        long j4;
        if (obj == null) {
            return null;
        }
        if (!(obj instanceof Long) && !(obj instanceof Double)) {
            if (obj instanceof Integer) {
                return Long.valueOf(((Integer) obj).intValue());
            }
            if (obj instanceof Byte) {
                return Long.valueOf(((Byte) obj).byteValue());
            }
            if (obj instanceof Short) {
                return Long.valueOf(((Short) obj).shortValue());
            }
            if (obj instanceof Boolean) {
                if (true != ((Boolean) obj).booleanValue()) {
                    j4 = 0;
                } else {
                    j4 = 1;
                }
                return Long.valueOf(j4);
            } else if (obj instanceof Float) {
                return Double.valueOf(((Float) obj).doubleValue());
            } else {
                if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                    if (!z11 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
                        return null;
                    }
                    ArrayList arrayList = new ArrayList();
                    for (Parcelable parcelable : (Parcelable[]) obj) {
                        if (parcelable instanceof Bundle) {
                            Bundle q02 = q0((Bundle) parcelable);
                            if (!q02.isEmpty()) {
                                arrayList.add(q02);
                            }
                        }
                    }
                    return arrayList.toArray(new Bundle[arrayList.size()]);
                }
                return n(i10, obj.toString(), z10);
            }
        }
        return obj;
    }

    public final int h0(Object obj, String str) {
        boolean P;
        if ("_ldl".equals(str)) {
            P = P("user property referrer", str, e0(str), obj);
        } else {
            P = P("user property", str, e0(str), obj);
        }
        if (P) {
            return 0;
        }
        return 7;
    }

    public final int i0(String str) {
        if (!Q("event", str)) {
            return 2;
        }
        if (!O("event", cj.x.f4243c, cj.x.f4244d, str)) {
            return 13;
        }
        ((b4) this.f27031b).getClass();
        if (!L(40, "event", str)) {
            return 2;
        }
        return 0;
    }

    public final Object j(Object obj, String str) {
        boolean equals = "_ev".equals(str);
        int i10 = 256;
        Object obj2 = this.f27031b;
        if (equals) {
            ((b4) obj2).getClass();
            return f0(256, obj, true, true);
        }
        if (X(str)) {
            ((b4) obj2).getClass();
        } else {
            ((b4) obj2).getClass();
            i10 = 100;
        }
        return f0(i10, obj, false, true);
    }

    public final int j0(String str) {
        if (!Q("event param", str)) {
            return 3;
        }
        if (!O("event param", null, null, str)) {
            return 14;
        }
        ((b4) this.f27031b).getClass();
        if (!L(40, "event param", str)) {
            return 3;
        }
        return 0;
    }

    public final Object k(Object obj, String str) {
        if ("_ldl".equals(str)) {
            return f0(e0(str), obj, true, false);
        }
        return f0(e0(str), obj, false, false);
    }

    public final int k0(String str) {
        if (!R("event param", str)) {
            return 3;
        }
        if (!O("event param", null, null, str)) {
            return 14;
        }
        ((b4) this.f27031b).getClass();
        if (!L(40, "event param", str)) {
            return 3;
        }
        return 0;
    }

    public final String l() {
        byte[] bArr = new byte[16];
        p().nextBytes(bArr);
        return String.format(Locale.US, "%032x", new BigInteger(1, bArr));
    }

    public final int l0(String str) {
        if (!Q("user property", str)) {
            return 6;
        }
        if (!O("user property", cj.h0.f4168p, null, str)) {
            return 15;
        }
        ((b4) this.f27031b).getClass();
        if (!L(24, "user property", str)) {
            return 6;
        }
        return 0;
    }

    public final int m0() {
        if (this.f28763g == null) {
            v9.f fVar = v9.f.f31907b;
            Context context = ((b4) this.f27031b).f28608a;
            fVar.getClass();
            this.f28763g = Integer.valueOf(v9.f.a(context) / 1000);
        }
        return this.f28763g.intValue();
    }

    public final long o0() {
        long andIncrement;
        long j4;
        if (this.f28761e.get() == 0) {
            synchronized (this.f28761e) {
                long nanoTime = System.nanoTime();
                ((b4) this.f27031b).f28620n.getClass();
                long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
                int i10 = this.f28762f + 1;
                this.f28762f = i10;
                j4 = nextLong + i10;
            }
            return j4;
        }
        synchronized (this.f28761e) {
            this.f28761e.compareAndSet(-1L, 1L);
            andIncrement = this.f28761e.getAndIncrement();
        }
        return andIncrement;
    }

    public final SecureRandom p() {
        c();
        if (this.f28760d == null) {
            this.f28760d = new SecureRandom();
        }
        return this.f28760d;
    }

    public final Bundle p0(boolean z10, Uri uri) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        String str8;
        if (uri == null) {
            return null;
        }
        try {
            if (uri.isHierarchical()) {
                str = uri.getQueryParameter("utm_campaign");
                str2 = uri.getQueryParameter("utm_source");
                str3 = uri.getQueryParameter("utm_medium");
                str4 = uri.getQueryParameter("gclid");
                str5 = uri.getQueryParameter("utm_id");
                str6 = uri.getQueryParameter("dclid");
                str7 = uri.getQueryParameter("srsltid");
                if (z10) {
                    str8 = uri.getQueryParameter("sfmc_id");
                } else {
                    str8 = null;
                }
            } else {
                str = null;
                str2 = null;
                str3 = null;
                str4 = null;
                str5 = null;
                str6 = null;
                str7 = null;
                str8 = null;
            }
            if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7) && (!z10 || TextUtils.isEmpty(str8))) {
                return null;
            }
            Bundle bundle = new Bundle();
            if (!TextUtils.isEmpty(str)) {
                bundle.putString("campaign", str);
            }
            if (!TextUtils.isEmpty(str2)) {
                bundle.putString("source", str2);
            }
            if (!TextUtils.isEmpty(str3)) {
                bundle.putString("medium", str3);
            }
            if (!TextUtils.isEmpty(str4)) {
                bundle.putString("gclid", str4);
            }
            String queryParameter = uri.getQueryParameter("utm_term");
            if (!TextUtils.isEmpty(queryParameter)) {
                bundle.putString("term", queryParameter);
            }
            String queryParameter2 = uri.getQueryParameter("utm_content");
            if (!TextUtils.isEmpty(queryParameter2)) {
                bundle.putString("content", queryParameter2);
            }
            String queryParameter3 = uri.getQueryParameter("aclid");
            if (!TextUtils.isEmpty(queryParameter3)) {
                bundle.putString("aclid", queryParameter3);
            }
            String queryParameter4 = uri.getQueryParameter("cp1");
            if (!TextUtils.isEmpty(queryParameter4)) {
                bundle.putString("cp1", queryParameter4);
            }
            String queryParameter5 = uri.getQueryParameter("anid");
            if (!TextUtils.isEmpty(queryParameter5)) {
                bundle.putString("anid", queryParameter5);
            }
            if (!TextUtils.isEmpty(str5)) {
                bundle.putString("campaign_id", str5);
            }
            if (!TextUtils.isEmpty(str6)) {
                bundle.putString("dclid", str6);
            }
            String queryParameter6 = uri.getQueryParameter("utm_source_platform");
            if (!TextUtils.isEmpty(queryParameter6)) {
                bundle.putString("source_platform", queryParameter6);
            }
            String queryParameter7 = uri.getQueryParameter("utm_creative_format");
            if (!TextUtils.isEmpty(queryParameter7)) {
                bundle.putString("creative_format", queryParameter7);
            }
            String queryParameter8 = uri.getQueryParameter("utm_marketing_tactic");
            if (!TextUtils.isEmpty(queryParameter8)) {
                bundle.putString("marketing_tactic", queryParameter8);
            }
            if (!TextUtils.isEmpty(str7)) {
                bundle.putString("srsltid", str7);
            }
            if (z10 && !TextUtils.isEmpty(str8)) {
                bundle.putString("sfmc_id", str8);
            }
            return bundle;
        } catch (UnsupportedOperationException e10) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(e10, "Install referrer url isn't a hierarchical URI");
            return null;
        }
    }

    public final Bundle q0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object j4 = j(bundle.get(str), str);
                if (j4 == null) {
                    Object obj = this.f27031b;
                    y2 y2Var = ((b4) obj).i;
                    b4.g(y2Var);
                    y2Var.f29246l.b(((b4) obj).f28619m.e(str), "Param value can't be null");
                } else {
                    B(bundle2, str, j4);
                }
            }
        }
        return bundle2;
    }

    public final Bundle r0(String str, Bundle bundle, List list, boolean z10) {
        int i10;
        int i11;
        String str2;
        String str3;
        List list2 = list;
        boolean g02 = g0(str, cj.x.f4246f);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            b4 b4Var = (b4) this.f27031b;
            g7 g7Var = ((b4) b4Var.f28614g.f27031b).f28618l;
            b4.e(g7Var);
            if (g7Var.W(201500000)) {
                i10 = 100;
            } else {
                i10 = 25;
            }
            int i12 = i10;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i13 = 0;
            while (it.hasNext()) {
                String str4 = (String) it.next();
                if (list2 != null && list2.contains(str4)) {
                    i11 = 0;
                } else {
                    if (!z10) {
                        i11 = k0(str4);
                    } else {
                        i11 = 0;
                    }
                    if (i11 == 0) {
                        i11 = j0(str4);
                    }
                }
                if (i11 != 0) {
                    if (i11 == 3) {
                        str3 = str4;
                    } else {
                        str3 = null;
                    }
                    v(bundle2, i11, str4, str3);
                    bundle2.remove(str4);
                } else {
                    int M = M(str, str4, bundle.get(str4), bundle2, list, z10, g02);
                    if (M == 17) {
                        v(bundle2, 17, str4, Boolean.FALSE);
                    } else if (M != 0 && !"_ev".equals(str4)) {
                        if (M == 21) {
                            str2 = str;
                        } else {
                            str2 = str4;
                        }
                        v(bundle2, M, str2, bundle.get(str4));
                        bundle2.remove(str4);
                    }
                    if (Y(str4)) {
                        int i14 = i13 + 1;
                        if (i14 > i12) {
                            String g10 = a0.f.g("Event can't contain more than ", i12, " params");
                            y2 y2Var = b4Var.i;
                            b4.g(y2Var);
                            y2Var.i.c(b4Var.f28619m.d(str), b4Var.f28619m.b(bundle), g10);
                            d0(5, bundle2);
                            bundle2.remove(str4);
                        }
                        i13 = i14;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

    public final t s0(String str, Bundle bundle, String str2, long j4, boolean z10) {
        Bundle bundle2;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (i0(str) == 0) {
            if (bundle != null) {
                bundle2 = new Bundle(bundle);
            } else {
                bundle2 = new Bundle();
            }
            bundle2.putString("_o", str2);
            Bundle r02 = r0(str, bundle2, Collections.singletonList("_o"), true);
            if (z10) {
                r02 = q0(r02);
            }
            x9.l.j(r02);
            return new t(str, new r(r02), str2, j4);
        }
        b4 b4Var = (b4) this.f27031b;
        y2 y2Var = b4Var.i;
        b4.g(y2Var);
        y2Var.f29242g.b(b4Var.f28619m.f(str), "Invalid conditional property event name");
        throw new IllegalArgumentException();
    }

    public final void t(Bundle bundle, long j4) {
        long j10 = bundle.getLong("_et");
        if (j10 != 0) {
            y2 y2Var = ((b4) this.f27031b).i;
            b4.g(y2Var);
            y2Var.f29244j.b(Long.valueOf(j10), "Params already contained engagement");
        } else {
            j10 = 0;
        }
        bundle.putLong("_et", j4 + j10);
    }

    public final void v(Bundle bundle, int i10, String str, Object obj) {
        if (d0(i10, bundle)) {
            ((b4) this.f27031b).getClass();
            bundle.putString("_ev", n(40, str, true));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void x(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                g7 g7Var = ((b4) this.f27031b).f28618l;
                b4.e(g7Var);
                g7Var.B(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void y(Parcelable[] parcelableArr, int i10, boolean z10) {
        x9.l.j(parcelableArr);
        for (Parcelable parcelable : parcelableArr) {
            Bundle bundle = (Bundle) parcelable;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str = (String) it.next();
                if (Y(str) && !g0(str, com.google.common.collect.m.f17641j) && (i11 = i11 + 1) > i10) {
                    Object obj = this.f27031b;
                    if (z10) {
                        b4 b4Var = (b4) obj;
                        y2 y2Var = b4Var.i;
                        b4.g(y2Var);
                        y2Var.i.c(b4Var.f28619m.e(str), b4Var.f28619m.b(bundle), "Param can't contain more than " + i10 + " item-scoped custom parameters");
                        d0(28, bundle);
                    } else {
                        b4 b4Var2 = (b4) obj;
                        y2 y2Var2 = b4Var2.i;
                        b4.g(y2Var2);
                        y2Var2.i.c(b4Var2.f28619m.e(str), b4Var2.f28619m.b(bundle), "Param cannot contain item-scoped custom parameters");
                        d0(23, bundle);
                    }
                    bundle.remove(str);
                }
            }
        }
    }

    public final void z(z2 z2Var, int i10) {
        Bundle bundle = z2Var.f29265d;
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (Y(str) && (i11 = i11 + 1) > i10) {
                String g10 = a0.f.g("Event can't contain more than ", i10, " params");
                b4 b4Var = (b4) this.f27031b;
                y2 y2Var = b4Var.i;
                b4.g(y2Var);
                y2Var.i.c(b4Var.f28619m.d(z2Var.f29262a), b4Var.f28619m.b(bundle), g10);
                d0(5, bundle);
                bundle.remove(str);
            }
        }
    }
}