package com.google.android.gms.internal.ads;

import android.location.Location;
import android.os.Bundle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;

/* JADX INFO: loaded from: classes2.dex */
public final class dc1 implements cc1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Object[] f10371a;

    public dc1(n7.a4 a4Var, String str, int i10, String str2, n7.i4 i4Var) {
        HashSet hashSet = new HashSet(Arrays.asList(str2.split(",")));
        ArrayList arrayList = new ArrayList();
        arrayList.add(str2);
        arrayList.add(str);
        if (hashSet.contains("networkType")) {
            arrayList.add(Integer.valueOf(i10));
        }
        if (hashSet.contains("birthday")) {
            arrayList.add(Long.valueOf(a4Var.f30893b));
        }
        if (hashSet.contains("extras")) {
            arrayList.add(a(a4Var.f30895c));
        } else if (hashSet.contains("npa")) {
            arrayList.add(a4Var.f30895c.getString("npa"));
        }
        if (hashSet.contains("gender")) {
            arrayList.add(Integer.valueOf(a4Var.f30896d));
        }
        if (hashSet.contains("keywords")) {
            List list = a4Var.f30897e;
            if (list != null) {
                arrayList.add(list.toString());
            } else {
                arrayList.add(null);
            }
        }
        if (hashSet.contains("isTestDevice")) {
            arrayList.add(Boolean.valueOf(a4Var.f30898f));
        }
        if (hashSet.contains("tagForChildDirectedTreatment")) {
            arrayList.add(Integer.valueOf(a4Var.f30899g));
        }
        if (hashSet.contains("manualImpressionsEnabled")) {
            arrayList.add(Boolean.valueOf(a4Var.f30900h));
        }
        if (hashSet.contains("publisherProvidedId")) {
            arrayList.add(a4Var.f30901i);
        }
        if (hashSet.contains("location")) {
            Location location = a4Var.f30903k;
            if (location != null) {
                arrayList.add(location.toString());
            } else {
                arrayList.add(null);
            }
        }
        if (hashSet.contains("contentUrl")) {
            arrayList.add(a4Var.f30904l);
        }
        if (hashSet.contains("networkExtras")) {
            arrayList.add(a(a4Var.f30905m));
        }
        if (hashSet.contains("customTargeting")) {
            arrayList.add(a(a4Var.Q));
        }
        if (hashSet.contains("categoryExclusions")) {
            List list2 = a4Var.R;
            if (list2 != null) {
                arrayList.add(list2.toString());
            } else {
                arrayList.add(null);
            }
        }
        if (hashSet.contains("requestAgent")) {
            arrayList.add(a4Var.S);
        }
        if (hashSet.contains("requestPackage")) {
            arrayList.add(a4Var.T);
        }
        if (hashSet.contains("isDesignedForFamilies")) {
            arrayList.add(Boolean.valueOf(a4Var.U));
        }
        if (hashSet.contains("tagForUnderAgeOfConsent")) {
            arrayList.add(Integer.valueOf(a4Var.V));
        }
        if (hashSet.contains("maxAdContentRating")) {
            arrayList.add(a4Var.zzu);
        }
        if (hashSet.contains("orientation")) {
            if (i4Var != null) {
                arrayList.add(Integer.valueOf(i4Var.f30980a));
            } else {
                arrayList.add(null);
            }
        }
        this.f10371a = arrayList.toArray();
    }

    public static String a(Bundle bundle) {
        if (bundle == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        while (it.hasNext()) {
            Object obj = bundle.get((String) it.next());
            sb.append(obj == null ? "null" : obj instanceof Bundle ? a((Bundle) obj) : obj.toString());
        }
        return sb.toString();
    }

    @Override // com.google.android.gms.internal.ads.cc1
    public final boolean equals(Object obj) {
        if (obj instanceof dc1) {
            return Arrays.equals(this.f10371a, ((dc1) obj).f10371a);
        }
        return false;
    }

    public final int hashCode() {
        return Arrays.hashCode(this.f10371a);
    }

    public final String toString() {
        Object[] objArr = this.f10371a;
        int iHashCode = Arrays.hashCode(objArr);
        String string = Arrays.toString(objArr);
        StringBuilder sb = new StringBuilder(String.valueOf(iHashCode).length() + 10 + String.valueOf(string).length() + 1);
        sb.append("[PoolKey#");
        sb.append(iHashCode);
        sb.append(" ");
        sb.append(string);
        sb.append("]");
        return sb.toString();
    }
}
