Joi Chat v2.1.3版本的 MD5 值为:58ea59fdad6b082c42108185d2ef342d

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


package u1;

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.Signature;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import androidx.core.app.NotificationCompat;
import androidx.media3.extractor.text.ttml.TtmlNode;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.internal.measurement.m8;
import com.google.android.gms.internal.measurement.n8;
import com.google.android.gms.measurement.internal.zzac;
import com.google.android.gms.measurement.internal.zzas;
import com.google.android.gms.measurement.internal.zzau;
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.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;

public final class d6 extends d4 {

    public static final String[] f4978q = {"firebase_", "google_", "ga_"};

    public static final String[] f4979r = {"_err"};

    public SecureRandom f4980m;

    public final AtomicLong f4981n;

    public int f4982o;

    public Integer f4983p;

    public d6(y3 y3Var) {
        super(y3Var);
        this.f4983p = null;
        this.f4981n = new AtomicLong(0L);
    }

    public static ArrayList B(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            zzac zzacVar = (zzac) it.next();
            Bundle bundle = new Bundle();
            bundle.putString("app_id", zzacVar.c);
            bundle.putString(TtmlNode.ATTR_TTS_ORIGIN, zzacVar.f1964e);
            bundle.putLong("creation_timestamp", zzacVar.f1966m);
            bundle.putString("name", zzacVar.f1965f.f1977e);
            Object g5 = zzacVar.f1965f.g();
            q.a.i(g5);
            c2.b.y0(bundle, g5);
            bundle.putBoolean("active", zzacVar.f1967n);
            String str = zzacVar.f1968o;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            zzau zzauVar = zzacVar.f1969p;
            if (zzauVar != null) {
                bundle.putString("timed_out_event_name", zzauVar.c);
                zzas zzasVar = zzauVar.f1974e;
                if (zzasVar != null) {
                    bundle.putBundle("timed_out_event_params", zzasVar.g());
                }
            }
            bundle.putLong("trigger_timeout", zzacVar.f1970q);
            zzau zzauVar2 = zzacVar.f1971r;
            if (zzauVar2 != null) {
                bundle.putString("triggered_event_name", zzauVar2.c);
                zzas zzasVar2 = zzauVar2.f1974e;
                if (zzasVar2 != null) {
                    bundle.putBundle("triggered_event_params", zzasVar2.g());
                }
            }
            bundle.putLong("triggered_timestamp", zzacVar.f1965f.f1978f);
            bundle.putLong("time_to_live", zzacVar.f1972s);
            zzau zzauVar3 = zzacVar.f1973t;
            if (zzauVar3 != null) {
                bundle.putString("expired_event_name", zzauVar3.c);
                zzas zzasVar3 = zzauVar3.f1974e;
                if (zzasVar3 != null) {
                    bundle.putBundle("expired_event_params", zzasVar3.g());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void E(x4 x4Var, Bundle bundle, boolean z5) {
        if (bundle != null && x4Var != null) {
            if (!bundle.containsKey("_sc") || z5) {
                String str = x4Var.f5305a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = x4Var.b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", x4Var.c);
                return;
            }
            z5 = false;
        }
        if (bundle != null && x4Var == null && z5) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public static void I(c6 c6Var, String str, int i5, String str2, String str3, int i6) {
        Bundle bundle = new Bundle();
        k0(i5, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i5 == 6 || i5 == 7 || i5 == 2) {
            bundle.putLong("_el", i6);
        }
        c6Var.c(bundle, str);
    }

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

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

    public static boolean g0(String str) {
        q.a.f(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean h0(Context context) {
        ActivityInfo receiverInfo;
        q.a.i(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 i0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            q.a.i(str);
            return !str.equals(str2);
        }
        if (isEmpty && isEmpty2) {
            return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
        }
        if (isEmpty) {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        }
        if (TextUtils.isEmpty(str4)) {
            return false;
        }
        return TextUtils.isEmpty(str3) || !str3.equals(str4);
    }

    public static byte[] j0(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 k0(int i5, Bundle bundle) {
        if (bundle == null || bundle.getLong("_err") != 0) {
            return false;
        }
        bundle.putLong("_err", i5);
        return true;
    }

    public static boolean n0(String str, String[] strArr) {
        boolean z5;
        q.a.i(strArr);
        for (Object obj : strArr) {
            if (str != obj && (str == null || !str.equals(obj))) {
                z5 = false;
            } else {
                z5 = true;
            }
            if (z5) {
                return true;
            }
        }
        return false;
    }

    public static long u0(byte[] bArr) {
        boolean z5;
        q.a.i(bArr);
        int length = bArr.length;
        int i5 = 0;
        if (length > 0) {
            z5 = true;
        } else {
            z5 = false;
        }
        if (z5) {
            long j5 = 0;
            for (int i6 = length - 1; i6 >= 0 && i6 >= bArr.length - 8; i6--) {
                j5 += (bArr[i6] & 255) << i5;
                i5 += 8;
            }
            return j5;
        }
        throw new IllegalStateException();
    }

    public static String y(int i5, String str, boolean z5) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) <= i5) {
            return str;
        }
        if (z5) {
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i5))).concat("...");
        }
        return null;
    }

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

    public final SecureRandom A() {
        r();
        if (this.f4980m == null) {
            this.f4980m = new SecureRandom();
        }
        return this.f4980m;
    }

    public final void C(Bundle bundle, long j5) {
        long j6 = bundle.getLong("_et");
        if (j6 != 0) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(Long.valueOf(j6), "Params already contained engagement");
        } else {
            j6 = 0;
        }
        bundle.putLong("_et", j5 + j6);
    }

    public final void D(Bundle bundle, int i5, String str, Object obj) {
        if (k0(i5, bundle)) {
            ((y3) this.f3001e).getClass();
            bundle.putString("_ev", y(40, str, true));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void F(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                d6 d6Var = ((y3) this.f3001e).f5325u;
                y3.i(d6Var);
                d6Var.J(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void G(Parcelable[] parcelableArr, int i5, boolean z5) {
        int i6;
        q.a.i(parcelableArr);
        for (Parcelable parcelable : parcelableArr) {
            Bundle bundle = (Bundle) parcelable;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i7 = 0;
            while (it.hasNext()) {
                String str = (String) it.next();
                if (g0(str) && !n0(str, q.a.f4386f) && (i7 = i7 + 1) > i5) {
                    y3 y3Var = (y3) this.f3001e;
                    if (z5) {
                        b3 b3Var = y3Var.f5322r;
                        y3.k(b3Var);
                        b3Var.f4948r.c("Param can't contain more than " + i5 + " item-scoped custom parameters", y3Var.f5326v.e(str), y3Var.f5326v.b(bundle));
                        i6 = 28;
                    } else {
                        b3 b3Var2 = y3Var.f5322r;
                        y3.k(b3Var2);
                        b3Var2.f4948r.c("Param cannot contain item-scoped custom parameters", y3Var.f5326v.e(str), y3Var.f5326v.b(bundle));
                        i6 = 23;
                    }
                    k0(i6, bundle);
                    bundle.remove(str);
                }
            }
        }
    }

    public final void H(c3 c3Var, int i5) {
        Object obj = c3Var.f4968e;
        Iterator it = new TreeSet(((Bundle) obj).keySet()).iterator();
        int i6 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (g0(str) && (i6 = i6 + 1) > i5) {
                String g5 = android.support.v4.media.a.g("Event can't contain more than ", i5, " params");
                y3 y3Var = (y3) this.f3001e;
                b3 b3Var = y3Var.f5322r;
                y3.k(b3Var);
                Bundle bundle = (Bundle) obj;
                b3Var.f4948r.c(g5, y3Var.f5326v.d((String) c3Var.c), y3Var.f5326v.b(bundle));
                k0(5, bundle);
                bundle.remove(str);
            }
        }
    }

    public final void J(Bundle bundle, String str, Object obj) {
        String str2;
        if (bundle == null) {
            return;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
            return;
        }
        if (obj instanceof String) {
            bundle.putString(str, String.valueOf(obj));
            return;
        }
        if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
            return;
        }
        if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
            return;
        }
        if (str != null) {
            if (obj != null) {
                str2 = obj.getClass().getSimpleName();
            } else {
                str2 = null;
            }
            Object obj2 = this.f3001e;
            b3 b3Var = ((y3) obj2).f5322r;
            y3.k(b3Var);
            b3Var.f4951u.c("Not putting event parameter. Invalid value type. name, type", ((y3) obj2).f5326v.e(str), str2);
        }
    }

    public final void K(com.google.android.gms.internal.measurement.j0 j0Var, boolean z5) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z5);
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning boolean value to wrapper");
        }
    }

    public final void L(com.google.android.gms.internal.measurement.j0 j0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning bundle list to wrapper");
        }
    }

    public final void M(com.google.android.gms.internal.measurement.j0 j0Var, Bundle bundle) {
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning bundle value to wrapper");
        }
    }

    public final void N(com.google.android.gms.internal.measurement.j0 j0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning byte array to wrapper");
        }
    }

    public final void O(com.google.android.gms.internal.measurement.j0 j0Var, int i5) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i5);
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning int value to wrapper");
        }
    }

    public final void P(com.google.android.gms.internal.measurement.j0 j0Var, long j5) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j5);
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning long value to wrapper");
        }
    }

    public final void Q(String str, com.google.android.gms.internal.measurement.j0 j0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            j0Var.k(bundle);
        } catch (RemoteException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Error returning string value to wrapper");
        }
    }

    public final void R(String str, String str2, Bundle bundle, List list, boolean z5) {
        int i5;
        Iterator it;
        int i6;
        String str3;
        int i7;
        int U;
        String str4;
        String str5;
        if (bundle == null) {
            return;
        }
        y3 y3Var = (y3) this.f3001e;
        d dVar = y3Var.f5320p;
        ((n8) m8.f1655e.c.a()).getClass();
        String str6 = null;
        if (((y3) dVar.f3001e).f5320p.z(null, r2.f5206s0)) {
            d6 d6Var = ((y3) dVar.f3001e).f5325u;
            y3.i(d6Var);
            if (d6Var.e0(231100000)) {
                i5 = 35;
                it = new TreeSet(bundle.keySet()).iterator();
                int i8 = 0;
                while (it.hasNext()) {
                    String str7 = (String) it.next();
                    if (list != null && list.contains(str7)) {
                        i6 = 0;
                    } else {
                        if (!z5) {
                            i6 = r0(str7);
                        } else {
                            i6 = 0;
                        }
                        if (i6 == 0) {
                            i6 = q0(str7);
                        }
                    }
                    if (i6 != 0) {
                        if (i6 == 3) {
                            str5 = str7;
                        } else {
                            str5 = str6;
                        }
                        D(bundle, i6, str7, str5);
                        bundle.remove(str7);
                        str4 = str6;
                        i7 = i5;
                    } else {
                        if (c0(bundle.get(str7))) {
                            b3 b3Var = y3Var.f5322r;
                            y3.k(b3Var);
                            b3Var.f4951u.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str7);
                            U = 22;
                            str3 = str7;
                            i7 = i5;
                        } else {
                            str3 = str7;
                            i7 = i5;
                            U = U(str, str7, bundle.get(str7), bundle, list, z5, false);
                        }
                        if (U != 0 && !"_ev".equals(str3)) {
                            D(bundle, U, str3, bundle.get(str3));
                            bundle.remove(str3);
                        } else if (g0(str3) && !n0(str3, q.a.f4386f)) {
                            int i9 = i8 + 1;
                            int i10 = 23;
                            if (!e0(231100000)) {
                                b3 b3Var2 = y3Var.f5322r;
                                y3.k(b3Var2);
                                b3Var2.f4948r.c("Item array not supported on client's version of Google Play Services (Android Only)", y3Var.f5326v.d(str), y3Var.f5326v.b(bundle));
                                k0(23, bundle);
                                bundle.remove(str3);
                            } else if (i9 > i7) {
                                ((n8) m8.f1655e.c.a()).getClass();
                                str4 = null;
                                if (y3Var.f5320p.z(null, r2.f5206s0)) {
                                    b3 b3Var3 = y3Var.f5322r;
                                    y3.k(b3Var3);
                                    b3Var3.f4948r.c("Item can't contain more than " + i7 + " item-scoped custom params", y3Var.f5326v.d(str), y3Var.f5326v.b(bundle));
                                    i10 = 28;
                                } else {
                                    b3 b3Var4 = y3Var.f5322r;
                                    y3.k(b3Var4);
                                    b3Var4.f4948r.c("Item cannot contain custom parameters", y3Var.f5326v.d(str), y3Var.f5326v.b(bundle));
                                }
                                k0(i10, bundle);
                                bundle.remove(str3);
                                i8 = i9;
                            }
                            str4 = null;
                            i8 = i9;
                        }
                        str4 = null;
                    }
                    i5 = i7;
                    str6 = str4;
                }
            }
        }
        i5 = 0;
        it = new TreeSet(bundle.keySet()).iterator();
        int i82 = 0;
        while (it.hasNext()) {
        }
    }

    public final boolean S(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        Object obj = this.f3001e;
        if (!isEmpty) {
            q.a.i(str);
            if (!str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                y3 y3Var = (y3) obj;
                if (TextUtils.isEmpty(y3Var.f5315e)) {
                    b3 b3Var = y3Var.f5322r;
                    y3.k(b3Var);
                    b3Var.f4948r.b(b3.A(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
                }
                return false;
            }
            return true;
        }
        if (!TextUtils.isEmpty(str2)) {
            q.a.i(str2);
            if (!str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                b3 b3Var2 = ((y3) obj).f5322r;
                y3.k(b3Var2);
                b3Var2.f4948r.b(b3.A(str2), "Invalid admob_app_id. Analytics disabled.");
                return false;
            }
            return true;
        }
        y3 y3Var2 = (y3) obj;
        if (TextUtils.isEmpty(y3Var2.f5315e)) {
            b3 b3Var3 = y3Var2.f5322r;
            y3.k(b3Var3);
            b3Var3.f4948r.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
        }
        return false;
    }

    public final boolean T(int i5, String str, String str2) {
        Object obj = this.f3001e;
        if (str2 == null) {
            b3 b3Var = ((y3) obj).f5322r;
            y3.k(b3Var);
            b3Var.f4948r.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.codePointCount(0, str2.length()) > i5) {
            b3 b3Var2 = ((y3) obj).f5322r;
            y3.k(b3Var2);
            b3Var2.f4948r.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i5), str2);
            return false;
        }
        return true;
    }

    public final int U(String str, String str2, Object obj, Bundle bundle, List list, boolean z5, boolean z6) {
        int i5;
        int i6;
        b3 b3Var;
        String str3;
        String str4;
        int size;
        r();
        boolean c02 = c0(obj);
        Object obj2 = this.f3001e;
        if (c02) {
            if (!z6) {
                return 21;
            }
            if (!n0(str2, q.a.f4385e)) {
                return 20;
            }
            y3 y3Var = (y3) obj2;
            i5 t4 = y3Var.t();
            t4.r();
            t4.s();
            if (t4.z()) {
                d6 d6Var = ((y3) t4.f3001e).f5325u;
                y3.i(d6Var);
                if (d6Var.t0() < 200900) {
                    return 25;
                }
            }
            y3Var.getClass();
            boolean z7 = obj instanceof Parcelable[];
            if (z7) {
                size = ((Parcelable[]) obj).length;
            } else if (obj instanceof ArrayList) {
                size = ((ArrayList) obj).size();
            }
            if (size > 200) {
                b3 b3Var2 = y3Var.f5322r;
                y3.k(b3Var2);
                b3Var2.f4951u.d("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
                y3Var.getClass();
                if (z7) {
                    Parcelable[] parcelableArr = (Parcelable[]) obj;
                    if (parcelableArr.length > 200) {
                        bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr, 200));
                    }
                } else if (obj instanceof ArrayList) {
                    ArrayList arrayList = (ArrayList) obj;
                    if (arrayList.size() > 200) {
                        bundle.putParcelableArrayList(str2, new ArrayList<>(arrayList.subList(0, 200)));
                    }
                }
                i5 = 17;
                if (!f0(str) || f0(str2)) {
                    ((y3) obj2).getClass();
                    i6 = 256;
                } else {
                    ((y3) obj2).getClass();
                    i6 = 100;
                }
                if (!X("param", str2, i6, obj)) {
                    return i5;
                }
                if (!z6) {
                    return 4;
                }
                if (obj instanceof Bundle) {
                    R(str, str2, (Bundle) obj, list, z5);
                } else if (obj instanceof Parcelable[]) {
                    for (Parcelable parcelable : (Parcelable[]) obj) {
                        if (!(parcelable instanceof Bundle)) {
                            b3Var = ((y3) obj2).f5322r;
                            y3.k(b3Var);
                            str3 = parcelable.getClass();
                            str4 = "All Parcelable[] elements must be of type Bundle. Value type, name";
                            b3Var.f4951u.c(str4, str3, str2);
                            return 4;
                        }
                        R(str, str2, (Bundle) parcelable, list, z5);
                    }
                } else {
                    if (!(obj instanceof ArrayList)) {
                        return 4;
                    }
                    ArrayList arrayList2 = (ArrayList) obj;
                    int size2 = arrayList2.size();
                    for (int i7 = 0; i7 < size2; i7++) {
                        Object obj3 = arrayList2.get(i7);
                        if (!(obj3 instanceof Bundle)) {
                            b3Var = ((y3) obj2).f5322r;
                            y3.k(b3Var);
                            str3 = obj3 != null ? obj3.getClass() : "null";
                            str4 = "All ArrayList elements must be of type Bundle. Value type, name";
                            b3Var.f4951u.c(str4, str3, str2);
                            return 4;
                        }
                        R(str, str2, (Bundle) obj3, list, z5);
                    }
                }
                return i5;
            }
        }
        i5 = 0;
        if (f0(str)) {
        }
        ((y3) obj2).getClass();
        i6 = 256;
        if (!X("param", str2, i6, obj)) {
        }
    }

    public final void V() {
        r();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                b3 b3Var = ((y3) this.f3001e).f5322r;
                y3.k(b3Var);
                b3Var.f4949s.a("Utils falling back to Random for random id");
            }
        }
        this.f4981n.set(nextLong);
    }

    public final boolean W(String str, String[] strArr, String[] strArr2, String str2) {
        Object obj = this.f3001e;
        if (str2 == null) {
            b3 b3Var = ((y3) obj).f5322r;
            y3.k(b3Var);
            b3Var.f4948r.b(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f4978q;
        for (int i5 = 0; i5 < 3; i5++) {
            if (str2.startsWith(strArr3[i5])) {
                b3 b3Var2 = ((y3) obj).f5322r;
                y3.k(b3Var2);
                b3Var2.f4948r.c("Name starts with reserved prefix. Type, name", str, str2);
                return false;
            }
        }
        if (strArr != null && n0(str2, strArr)) {
            if (strArr2 == null || !n0(str2, strArr2)) {
                b3 b3Var3 = ((y3) obj).f5322r;
                y3.k(b3Var3);
                b3Var3.f4948r.c("Name is reserved. Type, name", str, str2);
                return false;
            }
            return true;
        }
        return true;
    }

    public final boolean X(String str, String str2, int i5, 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()) > i5) {
                b3 b3Var = ((y3) this.f3001e).f5322r;
                y3.k(b3Var);
                b3Var.f4951u.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean Y(String str, String str2) {
        Object obj = this.f3001e;
        if (str2 == null) {
            b3 b3Var = ((y3) obj).f5322r;
            y3.k(b3Var);
            b3Var.f4948r.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            b3 b3Var2 = ((y3) obj).f5322r;
            y3.k(b3Var2);
            b3Var2.f4948r.b(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            if (codePointAt == 95) {
                codePointAt = 95;
            } else {
                b3 b3Var3 = ((y3) obj).f5322r;
                y3.k(b3Var3);
                b3Var3.f4948r.c("Name must start with a letter or _ (underscore). Type, name", str, str2);
                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)) {
                b3 b3Var4 = ((y3) obj).f5322r;
                y3.k(b3Var4);
                b3Var4.f4948r.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean Z(String str, String str2) {
        Object obj = this.f3001e;
        if (str2 == null) {
            b3 b3Var = ((y3) obj).f5322r;
            y3.k(b3Var);
            b3Var.f4948r.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            b3 b3Var2 = ((y3) obj).f5322r;
            y3.k(b3Var2);
            b3Var2.f4948r.b(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            b3 b3Var3 = ((y3) obj).f5322r;
            y3.k(b3Var3);
            b3Var3.f4948r.c("Name must start with a letter. Type, name", str, str2);
            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)) {
                b3 b3Var4 = ((y3) obj).f5322r;
                y3.k(b3Var4);
                b3Var4.f4948r.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean a0(String str) {
        r();
        y3 y3Var = (y3) this.f3001e;
        if (i1.b.a(y3Var.c).c.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        b3 b3Var = y3Var.f5322r;
        y3.k(b3Var);
        b3Var.f4953w.b(str, "Permission not granted");
        return false;
    }

    public final boolean b0(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        y3 y3Var = (y3) this.f3001e;
        String s5 = y3Var.f5320p.s("debug.firebase.analytics.app");
        y3Var.getClass();
        return s5.equals(str);
    }

    public final boolean d0(Context context, String str) {
        b3 b3Var;
        String str2;
        Signature[] signatureArr;
        Object obj = this.f3001e;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo c = i1.b.a(context).c(64, str);
            if (c != null && (signatureArr = c.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 e6) {
            e = e6;
            b3Var = ((y3) obj).f5322r;
            y3.k(b3Var);
            str2 = "Package name not found";
            b3Var.f4946p.b(e, str2);
            return true;
        } catch (CertificateException e7) {
            e = e7;
            b3Var = ((y3) obj).f5322r;
            y3.k(b3Var);
            str2 = "Error obtaining certificate";
            b3Var.f4946p.b(e, str2);
            return true;
        }
    }

    public final boolean e0(int i5) {
        Boolean bool = ((y3) this.f3001e).t().f5073o;
        if (t0() < i5 / 1000 && (bool == null || bool.booleanValue())) {
            return false;
        }
        return true;
    }

    public final int l0(String str) {
        boolean equals = "_ldl".equals(str);
        Object obj = this.f3001e;
        if (equals) {
            ((y3) obj).getClass();
            return 2048;
        }
        if ("_id".equals(str)) {
            ((y3) obj).getClass();
            return 256;
        }
        boolean equals2 = "_lgclid".equals(str);
        ((y3) obj).getClass();
        return equals2 ? 100 : 36;
    }

    public final Object m0(int i5, Object obj, boolean z5, boolean z6) {
        if (obj == null) {
            return null;
        }
        if ((obj instanceof Long) || (obj instanceof Double)) {
            return obj;
        }
        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) {
            return Long.valueOf(true != ((Boolean) obj).booleanValue() ? 0L : 1L);
        }
        if (obj instanceof Float) {
            return Double.valueOf(((Float) obj).doubleValue());
        }
        if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
            return y(i5, obj.toString(), z5);
        }
        if (!z6 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Parcelable parcelable : (Parcelable[]) obj) {
            if (parcelable instanceof Bundle) {
                Bundle x02 = x0((Bundle) parcelable);
                if (!x02.isEmpty()) {
                    arrayList.add(x02);
                }
            }
        }
        return arrayList.toArray(new Bundle[arrayList.size()]);
    }

    public final int o0(Object obj, String str) {
        int l02;
        String str2;
        if ("_ldl".equals(str)) {
            l02 = l0(str);
            str2 = "user property referrer";
        } else {
            l02 = l0(str);
            str2 = "user property";
        }
        return X(str2, str, l02, obj) ? 0 : 7;
    }

    public final int p0(String str) {
        if (!Y(NotificationCompat.CATEGORY_EVENT, str)) {
            return 2;
        }
        if (!W(NotificationCompat.CATEGORY_EVENT, p2.h.f4317h, p2.h.f4318i, str)) {
            return 13;
        }
        ((y3) this.f3001e).getClass();
        return !T(40, NotificationCompat.CATEGORY_EVENT, str) ? 2 : 0;
    }

    public final int q0(String str) {
        if (!Y("event param", str)) {
            return 3;
        }
        if (!W("event param", null, null, str)) {
            return 14;
        }
        ((y3) this.f3001e).getClass();
        return !T(40, "event param", str) ? 3 : 0;
    }

    public final int r0(String str) {
        if (!Z("event param", str)) {
            return 3;
        }
        if (!W("event param", null, null, str)) {
            return 14;
        }
        ((y3) this.f3001e).getClass();
        return !T(40, "event param", str) ? 3 : 0;
    }

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

    public final int s0(String str) {
        if (!Y("user property", str)) {
            return 6;
        }
        if (!W("user property", r2.c1.f4502d, null, str)) {
            return 15;
        }
        ((y3) this.f3001e).getClass();
        return !T(24, "user property", str) ? 6 : 0;
    }

    public final int t0() {
        if (this.f4983p == null) {
            b1.c cVar = b1.c.b;
            Context context = ((y3) this.f3001e).c;
            cVar.getClass();
            AtomicBoolean atomicBoolean = b1.e.f459a;
            int i5 = 0;
            try {
                i5 = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
            } catch (PackageManager.NameNotFoundException unused) {
            }
            this.f4983p = Integer.valueOf(i5 / 1000);
        }
        return this.f4983p.intValue();
    }

    public final Object v(Object obj, String str) {
        boolean equals = "_ev".equals(str);
        Object obj2 = this.f3001e;
        if (equals) {
            ((y3) obj2).getClass();
            return m0(256, obj, true, true);
        }
        boolean f02 = f0(str);
        ((y3) obj2).getClass();
        return m0(f02 ? 256 : 100, obj, false, true);
    }

    public final long v0() {
        long andIncrement;
        long j5;
        if (this.f4981n.get() == 0) {
            synchronized (this.f4981n) {
                long nanoTime = System.nanoTime();
                ((y3) this.f3001e).f5327w.getClass();
                long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
                int i5 = this.f4982o + 1;
                this.f4982o = i5;
                j5 = nextLong + i5;
            }
            return j5;
        }
        synchronized (this.f4981n) {
            this.f4981n.compareAndSet(-1L, 1L);
            andIncrement = this.f4981n.getAndIncrement();
        }
        return andIncrement;
    }

    public final Object w(Object obj, String str) {
        boolean equals = "_ldl".equals(str);
        int l02 = l0(str);
        return equals ? m0(l02, obj, true, false) : m0(l02, obj, false, false);
    }

    public final Bundle w0(Uri uri, boolean z5) {
        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 (z5) {
                    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) && (!z5 || TextUtils.isEmpty(str8))) {
                return null;
            }
            Bundle bundle = new Bundle();
            if (!TextUtils.isEmpty(str)) {
                bundle.putString("campaign", str);
            }
            if (!TextUtils.isEmpty(str2)) {
                bundle.putString(ShareConstants.FEED_SOURCE_PARAM, 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 (z5 && !TextUtils.isEmpty(str8)) {
                bundle.putString("sfmc_id", str8);
            }
            return bundle;
        } catch (UnsupportedOperationException e6) {
            b3 b3Var = ((y3) this.f3001e).f5322r;
            y3.k(b3Var);
            b3Var.f4949s.b(e6, "Install referrer url isn't a hierarchical URI");
            return null;
        }
    }

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

    public final Bundle x0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object v5 = v(bundle.get(str), str);
                if (v5 == null) {
                    Object obj = this.f3001e;
                    b3 b3Var = ((y3) obj).f5322r;
                    y3.k(b3Var);
                    b3Var.f4951u.b(((y3) obj).f5326v.e(str), "Param value can't be null");
                } else {
                    J(bundle2, str, v5);
                }
            }
        }
        return bundle2;
    }

    public final Bundle y0(String str, Bundle bundle, List list, boolean z5) {
        int i5;
        int i6;
        String str2;
        String str3;
        List list2 = list;
        boolean n02 = n0(str, p2.h.f4320k);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            y3 y3Var = (y3) this.f3001e;
            d6 d6Var = ((y3) y3Var.f5320p.f3001e).f5325u;
            y3.i(d6Var);
            if (d6Var.e0(201500000)) {
                i5 = 100;
            } else {
                i5 = 25;
            }
            int i7 = i5;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i8 = 0;
            while (it.hasNext()) {
                String str4 = (String) it.next();
                if (list2 != null && list2.contains(str4)) {
                    i6 = 0;
                } else {
                    if (!z5) {
                        i6 = r0(str4);
                    } else {
                        i6 = 0;
                    }
                    if (i6 == 0) {
                        i6 = q0(str4);
                    }
                }
                if (i6 != 0) {
                    if (i6 == 3) {
                        str3 = str4;
                    } else {
                        str3 = null;
                    }
                    D(bundle2, i6, str4, str3);
                    bundle2.remove(str4);
                } else {
                    int U = U(str, str4, bundle.get(str4), bundle2, list, z5, n02);
                    if (U == 17) {
                        D(bundle2, 17, str4, Boolean.FALSE);
                    } else if (U != 0 && !"_ev".equals(str4)) {
                        if (U == 21) {
                            str2 = str;
                        } else {
                            str2 = str4;
                        }
                        D(bundle2, U, str2, bundle.get(str4));
                        bundle2.remove(str4);
                    }
                    if (g0(str4)) {
                        int i9 = i8 + 1;
                        if (i9 > i7) {
                            String g5 = android.support.v4.media.a.g("Event can't contain more than ", i7, " params");
                            b3 b3Var = y3Var.f5322r;
                            y3.k(b3Var);
                            b3Var.f4948r.c(g5, y3Var.f5326v.d(str), y3Var.f5326v.b(bundle));
                            k0(5, bundle2);
                            bundle2.remove(str4);
                        }
                        i8 = i9;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

    public final zzau z0(String str, Bundle bundle, String str2, long j5, boolean z5) {
        Bundle bundle2;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (p0(str) == 0) {
            if (bundle != null) {
                bundle2 = new Bundle(bundle);
            } else {
                bundle2 = new Bundle();
            }
            bundle2.putString("_o", str2);
            Bundle y02 = y0(str, bundle2, Collections.singletonList("_o"), true);
            if (z5) {
                y02 = x0(y02);
            }
            q.a.i(y02);
            return new zzau(str, new zzas(y02), str2, j5);
        }
        y3 y3Var = (y3) this.f3001e;
        b3 b3Var = y3Var.f5322r;
        y3.k(b3Var);
        b3Var.f4946p.b(y3Var.f5326v.f(str), "Invalid conditional property event name");
        throw new IllegalArgumentException();
    }
}