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

import android.content.Context;
import android.graphics.Point;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicLong;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
public final class ul0 implements sm0 {
    public final hn0 Q;
    public final i8.c R;
    public final bk0 S;
    public final re1 T;
    public final eq0 U;
    public final md1 V;
    public final hw0 W;
    public boolean Y;

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final kp0 f17307d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final pm0 f17309e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final tg f17311f;

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    public n7.v1 f17312f0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final gf0 f17313g;

    /* JADX INFO: renamed from: g0, reason: collision with root package name */
    public final rg0 f17314g0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final te0 f17315h;

    /* JADX INFO: renamed from: h0, reason: collision with root package name */
    public final en0 f17316h0;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final ek0 f17317i;

    /* JADX INFO: renamed from: i0, reason: collision with root package name */
    public final td0 f17318i0;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final wa1 f17319j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final q7.a f17320k;

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

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final na0 f17322m;

    @Nullable
    private final m7.b zzF;
    public boolean X = false;
    public boolean Z = false;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public boolean f17302a0 = false;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public Point f17304b0 = new Point();

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public Point f17306c0 = new Point();

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public long f17308d0 = 0;

    /* JADX INFO: renamed from: e0, reason: collision with root package name */
    public long f17310e0 = 0;

    public ul0(Context context, um0 um0Var, JSONObject jSONObject, kp0 kp0Var, pm0 pm0Var, tg tgVar, gf0 gf0Var, te0 te0Var, ek0 ek0Var, wa1 wa1Var, q7.a aVar, ib1 ib1Var, na0 na0Var, hn0 hn0Var, i8.c cVar, bk0 bk0Var, re1 re1Var, md1 md1Var, hw0 hw0Var, eq0 eq0Var, en0 en0Var, rg0 rg0Var, @Nullable m7.b bVar, @Nullable p10 p10Var, td0 td0Var) {
        this.f17301a = context;
        this.f17303b = um0Var;
        this.f17305c = jSONObject;
        this.f17307d = kp0Var;
        this.f17309e = pm0Var;
        this.f17311f = tgVar;
        this.f17313g = gf0Var;
        this.f17315h = te0Var;
        this.f17317i = ek0Var;
        this.f17319j = wa1Var;
        this.f17320k = aVar;
        this.f17321l = ib1Var;
        this.f17322m = na0Var;
        this.Q = hn0Var;
        this.R = cVar;
        this.S = bk0Var;
        this.T = re1Var;
        this.V = md1Var;
        this.W = hw0Var;
        this.U = eq0Var;
        this.f17316h0 = en0Var;
        this.f17314g0 = rg0Var;
        this.zzF = bVar;
        this.f17318i0 = td0Var;
    }

    @Nullable
    private final String zzH(@Nullable View view, @Nullable Map map) {
        if (map != null && view != null) {
            for (Map.Entry entry : map.entrySet()) {
                if (view.equals((View) ((WeakReference) entry.getValue()).get())) {
                    return (String) entry.getKey();
                }
            }
        }
        int iR = this.f17309e.r();
        if (iR == 1) {
            return "1099";
        }
        if (iR == 2) {
            return "2099";
        }
        if (iR != 6) {
            return null;
        }
        return "3099";
    }

    private final boolean zzK(@Nullable JSONObject jSONObject, @Nullable JSONObject jSONObject2, @Nullable JSONObject jSONObject3, @Nullable JSONObject jSONObject4, @Nullable String str, @Nullable JSONObject jSONObject5, boolean z10, @Nullable View view) {
        td0 td0Var;
        wa1 wa1Var = this.f17319j;
        Context context = this.f17301a;
        try {
            JSONObject jSONObject6 = new JSONObject();
            jSONObject6.put("ad", this.f17305c);
            jSONObject6.put("asset_view_signal", jSONObject2);
            jSONObject6.put("ad_view_signal", jSONObject);
            jSONObject6.put("scroll_view_signal", jSONObject3);
            jSONObject6.put("lock_screen_signal", jSONObject4);
            jSONObject6.put("provided_signals", jSONObject5);
            tn tnVar = ao.f8915j4;
            n7.y yVar = n7.y.f31093e;
            yn ynVar = yVar.f31096c;
            yn ynVar2 = yVar.f31096c;
            if (((Boolean) ynVar.b(tnVar)).booleanValue()) {
                jSONObject6.put("view_signals", str);
            }
            jSONObject6.put("policy_validator_enabled", z10);
            jSONObject6.put("screen", p7.z.zzj(context));
            if (((Boolean) ynVar2.b(ao.Ve)).booleanValue() && (td0Var = this.f17318i0) != null) {
                AtomicLong atomicLong = td0Var.f16861a;
                if (atomicLong.get() > 0) {
                    jSONObject6.put("placement_id", atomicLong.get());
                }
            }
            boolean zBooleanValue = ((Boolean) ynVar2.b(ao.J9)).booleanValue();
            kp0 kp0Var = this.f17307d;
            if (zBooleanValue) {
                kp0Var.b("/clickRecorded", new rl0(this, 1));
            } else {
                kp0Var.b("/logScionEvent", new rl0(this, 0));
            }
            kp0Var.b("/nativeImpression", new gn0(this, view));
            kp0Var.b("/nativeImpressionFlowControl", new tl0(this, this.T, wa1Var.zzax, this.V));
            ni.k(kp0Var.a("google.afma.nativeAds.handleImpression", jSONObject6), "Error during performing handleImpression");
            if (!this.X) {
                this.X = m7.n.C.f30476o.d(context, this.f17320k.f32212a, wa1Var.f18021z.toString(), this.f17321l.f12455d);
            }
            return true;
        } catch (JSONException unused) {
            return false;
        }
    }

    @Nullable
    private final String zzL(View view) {
        if (!((Boolean) n7.y.f31093e.f31096c.b(ao.f8915j4)).booleanValue()) {
            return null;
        }
        try {
            return this.f17311f.f16877b.zzj(this.f17301a, view, null);
        } catch (Exception unused) {
            q7.j.b("Exception getting data.");
            return null;
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void D() {
        try {
            n7.v1 v1Var = this.f17312f0;
            if (v1Var != null) {
                n7.u1 u1Var = (n7.u1) v1Var;
                u1Var.O0(1, u1Var.O());
            }
        } catch (RemoteException e10) {
            q7.j.zzl("#007 Could not call remote method.", e10);
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void a(View view) {
        if (!this.f17305c.optBoolean("custom_one_point_five_click_enabled", false)) {
            q7.j.d("setClickConfirmingView: Your account need to be in the allow list to use this feature.\nContact your account manager for more information.");
        } else {
            if (view == null) {
                return;
            }
            hn0 hn0Var = this.Q;
            view.setOnClickListener(hn0Var);
            view.setClickable(true);
            hn0Var.zzc = new WeakReference(view);
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void b(as asVar) {
        if (this.f17305c.optBoolean("custom_one_point_five_click_enabled", false)) {
            this.Q.a(asVar);
        } else {
            q7.j.d("setUnconfirmedClickListener: Your account need to be in the allow list to use this feature.\nContact your account manager for more information.");
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final int c() {
        kq kqVar = this.f17321l.zzj;
        if (kqVar == null) {
            return 0;
        }
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.Lc)).booleanValue()) {
            return kqVar.f13376h;
        }
        return 0;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final boolean d() {
        if (c() == 0) {
            return true;
        }
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.Lc)).booleanValue()) {
            return this.f17321l.zzj.f13377i;
        }
        return true;
    }

    public final boolean e(String str) {
        JSONObject jSONObjectOptJSONObject = this.f17305c.optJSONObject("allow_pub_event_reporting");
        return jSONObjectOptJSONObject != null && jSONObjectOptJSONObject.optBoolean(str, false);
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void f(n7.v1 v1Var) {
        this.f17312f0 = v1Var;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void g() {
        if (this.f17305c.optBoolean("custom_one_point_five_click_enabled", false)) {
            this.Q.b();
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final boolean h(Bundle bundle) {
        if (e("impression_reporting")) {
            return zzK(null, null, null, null, ((Boolean) n7.y.f31093e.f31096c.b(ao.Hc)).booleanValue() ? zzL(null) : null, n7.x.f31085g.f31086a.zzl(bundle, null), false, null);
        }
        q7.j.b("The ad slot cannot handle external impression events. You must be in the allow list to be able to report your impression events.");
        return false;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void i() {
        kp0 kp0Var = this.f17307d;
        synchronized (kp0Var) {
            ku1 ku1Var = kp0Var.f13366m;
            if (ku1Var != null) {
                ih1.z1(ku1Var, new g30(kp0Var), kp0Var.f13358e);
                kp0Var.f13366m = null;
            }
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void j() {
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("ad", this.f17305c);
            ni.k(this.f17307d.a("google.afma.nativeAds.handleDownloadedImpression", jSONObject), "Error during performing handleDownloadedImpression");
        } catch (JSONException unused) {
        }
    }

    public final void k() {
        m7.b bVar;
        if (!((Boolean) n7.y.f31093e.f31096c.b(ao.Te)).booleanValue() || (bVar = this.zzF) == null) {
            return;
        }
        bVar.f30424b = true;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void m() {
        zzK(null, null, null, null, null, null, false, null);
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void n(String str) {
        zzi(null, null, null, null, null, str, null, null, false, false);
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zza(View view, @Nullable Map map, @Nullable Map map2, View.OnTouchListener onTouchListener, View.OnClickListener onClickListener) {
        this.f17304b0 = new Point();
        this.f17306c0 = new Point();
        if (!this.Y) {
            this.S.I0(view);
            this.Y = true;
        }
        view.setOnTouchListener(onTouchListener);
        view.setClickable(true);
        view.setOnClickListener(onClickListener);
        na0 na0Var = this.f17322m;
        na0Var.getClass();
        na0Var.f14507j = new WeakReference(this);
        boolean zA = p7.z.a(this.f17320k.f32214c);
        if (map != null) {
            Iterator it = map.entrySet().iterator();
            while (it.hasNext()) {
                View view2 = (View) ((WeakReference) ((Map.Entry) it.next()).getValue()).get();
                if (view2 != null) {
                    if (zA) {
                        view2.setOnTouchListener(onTouchListener);
                    }
                    view2.setClickable(true);
                    view2.setOnClickListener(onClickListener);
                }
            }
        }
        if (map2 != null) {
            Iterator it2 = map2.entrySet().iterator();
            while (it2.hasNext()) {
                View view3 = (View) ((WeakReference) ((Map.Entry) it2.next()).getValue()).get();
                if (view3 != null) {
                    if (zA) {
                        view3.setOnTouchListener(onTouchListener);
                    }
                    view3.setClickable(false);
                }
            }
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzb(@Nullable View view, @Nullable Map map) {
        this.f17304b0 = new Point();
        this.f17306c0 = new Point();
        if (view != null) {
            bk0 bk0Var = this.S;
            synchronized (bk0Var) {
                WeakHashMap weakHashMap = bk0Var.f9559b;
                if (weakHashMap.containsKey(view)) {
                    ((lj) weakHashMap.get(view)).f13728k.remove(bk0Var);
                    weakHashMap.remove(view);
                }
            }
        }
        this.Y = false;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzc(View view, @Nullable View view2, @Nullable Map map, @Nullable Map map2, boolean z10, @Nullable ImageView.ScaleType scaleType) {
        Context context = this.f17301a;
        JSONObject jSONObjectZze = p7.z.zze(context, map, map2, view2, scaleType);
        JSONObject jSONObjectZzb = p7.z.zzb(context, view2);
        JSONObject jSONObjectZzc = p7.z.zzc(view2);
        JSONObject jSONObjectZzd = p7.z.zzd(context, view2);
        String strZzH = zzH(view, map);
        zzi(true == ((Boolean) n7.y.f31093e.f31096c.b(ao.f9032q4)).booleanValue() ? view2 : view, jSONObjectZzb, jSONObjectZze, jSONObjectZzc, jSONObjectZzd, strZzH, p7.z.zzf(strZzH, context, this.f17306c0, this.f17304b0), null, z10, false);
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zze(@Nullable Bundle bundle) {
        if (bundle == null) {
            q7.j.a("Click data is null. No click is reported.");
        } else if (!e("click_reporting")) {
            q7.j.b("The ad slot cannot handle external click events. You must be part of the allow list to be able to report your click events.");
        } else {
            Bundle bundle2 = bundle.getBundle("click_signal");
            zzi(null, null, null, null, null, bundle2 != null ? bundle2.getString("asset_id") : null, null, n7.x.f31085g.f31086a.zzl(bundle, null), false, false);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0025  */
    @Override // com.google.android.gms.internal.ads.sm0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void zzf(@Nullable View view, @Nullable View view2, @Nullable Map map, @Nullable Map map2, boolean z10, @Nullable ImageView.ScaleType scaleType, int i10) {
        boolean z11;
        JSONObject jSONObject;
        JSONObject jSONObject2 = this.f17305c;
        if (jSONObject2.optBoolean("allow_sdk_custom_click_gesture", false)) {
            z11 = ((Boolean) n7.y.f31093e.f31096c.b(ao.Lc)).booleanValue();
        }
        if (!z11) {
            if (!this.f17302a0) {
                q7.j.a("Custom click reporting failed. enableCustomClickGesture is not set.");
                return;
            } else if (!jSONObject2.optBoolean("allow_custom_click_gesture", false)) {
                q7.j.a("Custom click reporting failed. Ad unit id not in the allow list.");
                return;
            }
        }
        Context context = this.f17301a;
        JSONObject jSONObjectZze = p7.z.zze(context, map, map2, view2, scaleType);
        JSONObject jSONObjectZzb = p7.z.zzb(context, view2);
        JSONObject jSONObjectZzc = p7.z.zzc(view2);
        JSONObject jSONObjectZzd = p7.z.zzd(context, view2);
        String strZzH = zzH(view, map);
        JSONObject jSONObjectZzf = p7.z.zzf(strZzH, context, this.f17306c0, this.f17304b0);
        if (z11) {
            try {
                Point point = this.f17306c0;
                Point point2 = this.f17304b0;
                try {
                    jSONObject = new JSONObject();
                    try {
                        JSONObject jSONObject3 = new JSONObject();
                        JSONObject jSONObject4 = new JSONObject();
                        if (point != null) {
                            jSONObject3.put("x", point.x);
                            jSONObject3.put("y", point.y);
                        }
                        if (point2 != null) {
                            jSONObject4.put("x", point2.x);
                            jSONObject4.put("y", point2.y);
                        }
                        jSONObject.put("start_point", jSONObject3);
                        jSONObject.put("end_point", jSONObject4);
                        jSONObject.put("duration_ms", i10);
                    } catch (Exception unused) {
                    }
                } catch (Exception unused2) {
                    jSONObject = null;
                }
                jSONObject2.put("custom_click_gesture_signal", jSONObject);
            } catch (JSONException e10) {
                m7.n.C.f30469h.d("FirstPartyNativeAdCore.performCustomClickGesture", e10);
            }
        }
        zzi(view2, jSONObjectZzb, jSONObjectZze, jSONObjectZzc, jSONObjectZzd, strZzH, jSONObjectZzf, null, z10, true);
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzg() {
        this.f17302a0 = true;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final boolean zzh() {
        return this.f17305c.optBoolean("allow_custom_click_gesture", false);
    }

    @VisibleForTesting
    public final void zzi(@Nullable View view, @Nullable JSONObject jSONObject, @Nullable JSONObject jSONObject2, @Nullable JSONObject jSONObject3, @Nullable JSONObject jSONObject4, @Nullable String str, @Nullable JSONObject jSONObject5, @Nullable JSONObject jSONObject6, boolean z10, boolean z11) {
        List list;
        String strZzg;
        i8.c cVar = this.R;
        pm0 pm0Var = this.f17309e;
        JSONObject jSONObject7 = this.f17305c;
        try {
            k();
            JSONObject jSONObject8 = new JSONObject();
            jSONObject8.put("ad", jSONObject7);
            jSONObject8.put("asset_view_signal", jSONObject2);
            jSONObject8.put("ad_view_signal", jSONObject);
            jSONObject8.put("click_signal", jSONObject5);
            jSONObject8.put("scroll_view_signal", jSONObject3);
            jSONObject8.put("lock_screen_signal", jSONObject4);
            um0 um0Var = this.f17303b;
            jSONObject8.put("has_custom_click_handler", um0Var.zzg(pm0Var.zzS()) != null);
            jSONObject8.put("provided_signals", jSONObject6);
            JSONObject jSONObject9 = new JSONObject();
            jSONObject9.put("asset_id", str);
            jSONObject9.put("template", pm0Var.r());
            jSONObject9.put("view_aware_api_used", z10);
            kq kqVar = this.f17321l.zzj;
            jSONObject9.put("custom_mute_requested", kqVar != null && kqVar.f13374f);
            synchronized (pm0Var) {
                list = pm0Var.f15460b;
            }
            jSONObject9.put("custom_mute_enabled", (list.isEmpty() || pm0Var.zzF() == null) ? false : true);
            if (this.Q.zzb() != null && jSONObject7.optBoolean("custom_one_point_five_click_enabled", false)) {
                jSONObject9.put("custom_one_point_five_click_eligible", true);
            }
            ((i8.d) cVar).getClass();
            jSONObject9.put("timestamp", System.currentTimeMillis());
            if (this.f17302a0 && this.f17305c.optBoolean("allow_custom_click_gesture", false)) {
                jSONObject9.put("custom_click_gesture_eligible", true);
            }
            if (z11) {
                jSONObject9.put("is_custom_click_gesture", true);
            }
            jSONObject9.put("has_custom_click_handler", um0Var.zzg(pm0Var.zzS()) != null);
            try {
                JSONObject jSONObjectOptJSONObject = jSONObject7.optJSONObject("tracking_urls_and_actions");
                if (jSONObjectOptJSONObject == null) {
                    jSONObjectOptJSONObject = new JSONObject();
                }
                strZzg = this.f17311f.f16877b.zzg(this.f17301a, jSONObjectOptJSONObject.optString("click_string"), view);
            } catch (Exception unused) {
                strZzg = null;
            }
            jSONObject9.put("click_signals", strZzg);
            jSONObject9.put("open_chrome_custom_tab", true);
            tn tnVar = ao.N9;
            n7.y yVar = n7.y.f31093e;
            if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue() && com.bumptech.glide.g.m()) {
                jSONObject9.put("try_fallback_for_deep_link", true);
            }
            if (((Boolean) yVar.f31096c.b(ao.O9)).booleanValue() && com.bumptech.glide.g.m()) {
                jSONObject9.put("in_app_link_handling_for_android_11_enabled", true);
            }
            jSONObject8.put("click", jSONObject9);
            JSONObject jSONObject10 = new JSONObject();
            ((i8.d) cVar).getClass();
            long jCurrentTimeMillis = System.currentTimeMillis();
            jSONObject10.put("time_from_last_touch_down", jCurrentTimeMillis - this.f17308d0);
            jSONObject10.put("time_from_last_touch", jCurrentTimeMillis - this.f17310e0);
            jSONObject8.put("touch_signal", jSONObject10);
            if (this.f17319j.b()) {
                JSONObject jSONObject11 = (JSONObject) jSONObject7.get("tracking_urls_and_actions");
                String string = jSONObject11 != null ? jSONObject11.getString("gws_query_id") : null;
                if (string != null) {
                    this.W.R2(string, pm0Var);
                }
            }
            ni.k(this.f17307d.a("google.afma.nativeAds.handleClick", jSONObject8), "Error during performing handleClick");
        } catch (JSONException unused2) {
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzj(@Nullable View view, MotionEvent motionEvent, @Nullable View view2) {
        this.f17304b0 = p7.z.zzh(motionEvent, view2);
        ((i8.d) this.R).getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        this.f17310e0 = jCurrentTimeMillis;
        if (motionEvent.getAction() == 0) {
            this.U.f10898a = motionEvent;
            this.f17308d0 = jCurrentTimeMillis;
            this.f17306c0 = this.f17304b0;
        }
        MotionEvent motionEventObtain = MotionEvent.obtain(motionEvent);
        Point point = this.f17304b0;
        motionEventObtain.setLocation(point.x, point.y);
        this.f17311f.f16877b.zzd(motionEventObtain);
        motionEventObtain.recycle();
        k();
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzk(@Nullable Bundle bundle) {
        if (bundle == null) {
            q7.j.a("Touch event data is null. No touch event is reported.");
            return;
        }
        if (!e("touch_reporting")) {
            q7.j.b("The ad slot cannot handle external touch events. You must be in the allow list to be able to report your touch events.");
            return;
        }
        this.f17311f.f16877b.a((int) bundle.getFloat("x"), (int) bundle.getFloat("y"), bundle.getInt("duration_ms"));
        k();
    }

    @Override // com.google.android.gms.internal.ads.sm0
    @Nullable
    public final JSONObject zzl(@Nullable View view, @Nullable Map map, @Nullable Map map2, @Nullable ImageView.ScaleType scaleType) {
        Context context = this.f17301a;
        JSONObject jSONObjectZze = p7.z.zze(context, map, map2, view, scaleType);
        JSONObject jSONObjectZzb = p7.z.zzb(context, view);
        JSONObject jSONObjectZzc = p7.z.zzc(view);
        JSONObject jSONObjectZzd = p7.z.zzd(context, view);
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("asset_view_signal", jSONObjectZze);
            jSONObject.put("ad_view_signal", jSONObjectZzb);
            jSONObject.put("scroll_view_signal", jSONObjectZzc);
            jSONObject.put("lock_screen_signal", jSONObjectZzd);
            return jSONObject;
        } catch (JSONException unused) {
            return null;
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    @Nullable
    public final JSONObject zzm(@Nullable View view, @Nullable Map map, @Nullable Map map2, @Nullable ImageView.ScaleType scaleType) {
        JSONObject jSONObjectZzl = zzl(view, map, map2, scaleType);
        JSONObject jSONObject = new JSONObject();
        try {
            if (this.f17302a0 && this.f17305c.optBoolean("allow_custom_click_gesture", false)) {
                jSONObject.put("custom_click_gesture_eligible", true);
            }
            if (jSONObjectZzl != null) {
                jSONObject.put("nas", jSONObjectZzl);
            }
        } catch (JSONException unused) {
        }
        return jSONObject;
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzr(@Nullable n7.x1 x1Var) {
        try {
            if (this.Z) {
                return;
            }
            md1 md1Var = this.V;
            wa1 wa1Var = this.f17319j;
            re1 re1Var = this.T;
            if (x1Var == null) {
                pm0 pm0Var = this.f17309e;
                if (pm0Var.zzF() != null) {
                    this.Z = true;
                    re1Var.zzb(pm0Var.zzF().f30932b, wa1Var.zzax, md1Var, null);
                    D();
                    return;
                }
            }
            this.Z = true;
            re1Var.zzb(x1Var.zzf(), wa1Var.zzax, md1Var, null);
            D();
        } catch (RemoteException e10) {
            q7.j.zzl("#007 Could not call remote method.", e10);
        }
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzw(@Nullable View view, @Nullable Map map, @Nullable Map map2, @Nullable ImageView.ScaleType scaleType) {
        Context context = this.f17301a;
        zzK(p7.z.zzb(context, view), p7.z.zze(context, map, map2, view, scaleType), p7.z.zzc(view), p7.z.zzd(context, view), zzL(view), null, p7.z.b(context, this.f17319j), view);
    }

    @Override // com.google.android.gms.internal.ads.sm0
    public final void zzx(View view, @Nullable Map map, @Nullable Map map2, @Nullable ImageView.ScaleType scaleType) {
        Context context = this.f17301a;
        JSONObject jSONObjectZze = p7.z.zze(context, map, map2, view, scaleType);
        JSONObject jSONObjectZzb = p7.z.zzb(context, view);
        JSONObject jSONObjectZzc = p7.z.zzc(view);
        JSONObject jSONObjectZzd = p7.z.zzd(context, view);
        boolean zB = p7.z.b(context, this.f17319j);
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("ad", this.f17305c);
            jSONObject.put("asset_view_signal", jSONObjectZze);
            jSONObject.put("ad_view_signal", jSONObjectZzb);
            jSONObject.put("scroll_view_signal", jSONObjectZzc);
            jSONObject.put("lock_screen_signal", jSONObjectZzd);
            if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8915j4)).booleanValue()) {
                jSONObject.put("view_signals", zzL(view));
            }
            jSONObject.put("policy_validator_enabled", zB);
            jSONObject.put("screen", p7.z.zzj(context));
            ni.k(this.f17307d.a("google.afma.nativeAds.handleNativeAdSignalsLogging", jSONObject), "Error during performing handleNativeAdSignalsLogging");
        } catch (JSONException unused) {
        }
    }
}
