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

import android.location.Location;
import android.os.Bundle;
import android.text.TextUtils;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;

/* JADX INFO: loaded from: classes2.dex */
public final class x11 implements m61 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ib1 f18293a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final long f18294b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final long f18295c;

    public x11(ib1 ib1Var, long j10, long j11) {
        this.f18293a = ib1Var;
        this.f18294b = j10;
        this.f18295c = j11;
    }

    @Override // com.google.android.gms.internal.ads.m61
    public final void zza(Object obj) {
        Bundle bundle = ((zd0) obj).f19235a;
        ib1 ib1Var = this.f18293a;
        n7.a4 a4Var = ib1Var.f12452a;
        bundle.putInt("http_timeout_millis", a4Var.X);
        bundle.putString("slotname", ib1Var.f12455d);
        int i10 = ib1Var.f12462k.f30185b;
        if (i10 == 0) {
            throw null;
        }
        int i11 = i10 - 1;
        if (i11 == 1) {
            bundle.putBoolean("is_new_rewarded", true);
        } else if (i11 == 2) {
            bundle.putBoolean("is_rewarded_interstitial", true);
        }
        long j10 = this.f18294b;
        bundle.putLong("start_signals_timestamp", j10);
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.Ke)).booleanValue()) {
            bundle.putLong("tsi", j10 - this.f18295c);
        }
        Bundle bundle2 = a4Var.f30895c;
        mb1.zzd(bundle, "is_sdk_preload", true, bundle2.getBoolean("is_sdk_preload", false));
        mb1.zzb(bundle, "prefetch_type", "zenith_v2", bundle2.getBoolean("zenith_v2", false));
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd", Locale.US);
        long j11 = a4Var.f30893b;
        mb1.zzb(bundle, "cust_age", simpleDateFormat.format(new Date(j11)), j11 != -1);
        mb1.zzf(bundle, "extras", bundle2);
        int i12 = a4Var.f30896d;
        mb1.zzc(bundle, "cust_gender", i12, i12 != -1);
        mb1.zzg(bundle, "kw", a4Var.f30897e);
        int i13 = a4Var.f30899g;
        mb1.zzc(bundle, "tag_for_child_directed_treatment", i13, i13 != -1);
        if (a4Var.f30898f) {
            bundle.putBoolean("test_request", true);
        }
        bundle.putInt("ppt_p13n", a4Var.Y);
        int i14 = a4Var.f30891a;
        mb1.zzc(bundle, "d_imp_hdr", 1, i14 >= 2 && a4Var.f30900h);
        String str = a4Var.f30901i;
        mb1.zzb(bundle, "ppid", str, i14 >= 2 && !TextUtils.isEmpty(str));
        Location location = a4Var.f30903k;
        if (location != null) {
            float accuracy = location.getAccuracy() * 1000.0f;
            long time = location.getTime() * 1000;
            double latitude = location.getLatitude() * 1.0E7d;
            double longitude = 1.0E7d * location.getLongitude();
            Bundle bundle3 = new Bundle();
            bundle3.putFloat("radius", accuracy);
            bundle3.putLong("lat", (long) latitude);
            bundle3.putLong("long", (long) longitude);
            bundle3.putLong("time", time);
            bundle.putBundle("uule", bundle3);
        }
        mb1.zze(bundle, IjkMediaPlayer.OnNativeInvokeListener.ARG_URL, a4Var.f30904l);
        mb1.zzg(bundle, "neighboring_content_urls", a4Var.W);
        mb1.zzf(bundle, "custom_targeting", a4Var.Q);
        mb1.zzg(bundle, "category_exclusions", a4Var.R);
        mb1.zze(bundle, "request_agent", a4Var.S);
        mb1.zze(bundle, "request_pkg", a4Var.T);
        mb1.zzd(bundle, "is_designed_for_families", a4Var.U, i14 >= 7);
        if (i14 >= 8) {
            int i15 = a4Var.V;
            mb1.zzc(bundle, "tag_for_under_age_of_consent", i15, i15 != -1);
            mb1.zze(bundle, "max_ad_content_rating", a4Var.zzu);
        }
        Bundle bundle4 = ib1Var.f12453b;
        mb1.zzh(bundle, "plcs", Integer.valueOf(bundle4.getInt("plcs")));
        mb1.zzh(bundle, "plbs", Integer.valueOf(bundle4.getInt("plbs")));
        mb1.zze(bundle, "plid", bundle4.getString("plid"));
        mb1.zzc(bundle, "s2s_rr", 1, ib1Var.f12468q && !(a4Var.zzs == null && a4Var.zzx == null));
    }

    @Override // com.google.android.gms.internal.ads.m61
    public final void zzb(Object obj) {
        Bundle bundle = ((zd0) obj).f19236b;
        ib1 ib1Var = this.f18293a;
        bundle.putString("slotname", ib1Var.f12455d);
        n7.a4 a4Var = ib1Var.f12452a;
        if (a4Var.f30898f) {
            bundle.putBoolean("test_request", true);
        }
        int i10 = a4Var.f30899g;
        mb1.zzc(bundle, "tag_for_child_directed_treatment", i10, i10 != -1);
        if (a4Var.f30891a >= 8) {
            int i11 = a4Var.V;
            mb1.zzc(bundle, "tag_for_under_age_of_consent", i11, i11 != -1);
        }
        mb1.zze(bundle, IjkMediaPlayer.OnNativeInvokeListener.ARG_URL, a4Var.f30904l);
        mb1.zzg(bundle, "neighboring_content_urls", a4Var.W);
        Bundle bundle2 = a4Var.f30895c;
        Bundle bundle3 = (Bundle) bundle2.clone();
        HashSet hashSet = new HashSet(Arrays.asList(((String) n7.y.f31093e.f31096c.b(ao.f9053r8)).split(",", -1)));
        for (String str : bundle2.keySet()) {
            if (!hashSet.contains(str)) {
                bundle3.remove(str);
            }
        }
        mb1.zzf(bundle, "extras", bundle3);
    }
}
